aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi/common/include
Commit message (Collapse)AuthorAgeFilesLines
* Fix O(n^2) behavior in sysctlAlan Somers20 hours1-1/+1
| | | | | | | | | | | | | | | | | Sysctl OIDs were internally stored in linked lists, triggering O(n^2) behavior when userland iterates over many of them. The slowdown is noticeable for MIBs that have > 100 children (for example, vm.uma). But it's unignorable for kstat.zfs when a pool has > 1000 datasets. Convert the linked lists into RB trees. This produces a ~25x speedup for listing kstat.zfs with 4100 datasets, and no measurable penalty for small dataset counts. Bump __FreeBSD_version for the KPI change. Sponsored by: Axcient Reviewed by: mjg Differential Revision: https://reviews.freebsd.org/D36500
* LinuxKPI: add DMA_MAPPING_ERRORBjoern A. Zeeb25 hours1-1/+5
| | | | | | | | | While we deal with 0 returned, some drivers directly use and check for DMA_MAPPING_ERROR. Add the case and check for both in dma_mapping_error(). MFC after: 1 week Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36686
* LinuxKPI: add struct dmi_header and unsupported dmi_walk()Bjoern A. Zeeb25 hours1-0/+13
| | | | | | | | | | | Add a structure definition as well as a dummy dmi_walk for now which returns an error as not supported. Our current dmi implementation is special but does not give access to all details but rather only information from kenv which does not suffice all use cases. MFC after: 1 week Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36687
* kmem_malloc/free: Use void * instead of vm_offset_t for kernel pointers.John Baldwin5 days1-1/+1
| | | | | | Reviewed by: kib, markj Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D36549
* LinuxKPI: cache.h add L1_CACHE_ALIGN()Bjoern A. Zeeb5 days1-0/+1
| | | | | | | Sponsored by: The FreeBSD Foundation MFC after: 7 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36655
* LinuxKPI: pci.h split up pcim_iomap_regions_request_all()Bjoern A. Zeeb5 days1-17/+35
| | | | | | | | | | Factor out parts of pcim_iomap_regions_request_all() into pcim_iomap_regions() now needed for a driver. Sponsored by: The FreeBSD Foundation MFC after: 7 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36654
* LinuxKPI: if_ether.h add more constantsBjoern A. Zeeb5 days1-0/+9
| | | | | | | | | | In addition to the ones added last year add more found in modern drivers. Sponsored by: The FreeBSD Foundation MFC after: 7 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36656
* LinuxKPI: io.h constify arguments and add more functionsBjoern A. Zeeb5 days1-4/+30
| | | | | | | | | | Constify "*from" arguments and add __ioread32_copy() and __ioread64_copy() based on the already existing implementations. Sponsored by: The FreeBSD Foundation MFC after: 7 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36657
* LinuxKPI: dma-mapping: add dmam_alloc_coherent()Bjoern A. Zeeb5 days1-0/+10
| | | | | | | | | | Add the devres version dmam_alloc_coherent() of dma_alloc_coherent() along with the ancillary free function. Sponsored by: The FreeBSD Foundation MFC after: 7 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36661
* LinuxKPI: tracepoint.h add more definesBjoern A. Zeeb5 days1-1/+7
| | | | | | | | Add some more defines used in drivers to make it easier to compile. MFC after: 7 days Reviewed by: hselasky, emaste Differential Revision: https://reviews.freebsd.org/D36660
* LinuxKPI: pci_ids.h Add more Vendor IDs.Bjoern A. Zeeb5 days1-0/+4
| | | | | | | | | Add PCI vendor IDs found in ath and mt76 drivers. This should make it easier for me and others not having to re-define them locally. MFC after: 7 days Reviewed by: hselasky, emaste Differential Revision: https://reviews.freebsd.org/D36659
* LinuxKPI: lockdep.h add lockdep_{,un}register_key()Bjoern A. Zeeb5 days1-0/+2
| | | | | | | | | Add NOPs for lockdep_{,un}register_key(). Sponsored by: The FreeBSD Foundation MFC after: 7 days Reviewed by: hselasky, emaste Differential Revision: https://reviews.freebsd.org/D36658
* LinuxKPI: pci.h add more defines and functionsBjoern A. Zeeb5 days1-2/+27
| | | | | | | | | | | Add #defines for PCI_DEVICE_ID and repoint the PCI_VENDOR_ID one. Add dev_is_pci(). Add pcie_capability_clear_word() according to similar implementations. Sponsored by: The FreeBSD Foundation MFC after: 7 days Reviewed by: hselasky, emaste Differential Revision: https://reviews.freebsd.org/D36653
* LinuxKPI: device.h add devm_kmemdup()Bjoern A. Zeeb5 days1-0/+19
| | | | | | | | | Add devm_kmemdup() as needed by a networking driver. Sponsored by: The FreeBSD Foundation MFC after: 7 days eviewed by: hselasky, emaste Differential Revision: https://reviews.freebsd.org/D36652
* LinuxKPI: device.h remove duplicate #includeBjoern A. Zeeb6 days1-1/+0
| | | | | | | linux/types.h is included twice; reduce to the first. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: add more header compat bitsBjoern A. Zeeb6 days4-0/+33
| | | | | | | First part adding more bits in order to synch up drivers to the same level and enable a new ones. MFC after: 3 days
* linuxkpi: Resolve duplicate global symbol name to fix LINT kernel build.Hans Petter Selasky7 days1-2/+5
| | | | | | | | | | | seq_printf() is defined in both spl_procfs_list.c and linux_seq_file.c . Fix this by renaming the LinuxKPI ones and use macros to invoke the correct function. Reported by: jfree@ Differential Revision: https://reviews.freebsd.org/D35883 MFC after: 1 week Sponsored by: NVIDIA Networking
* linuxkpi: drm-kmod debugfs supportJake Freeland7 days4-14/+123
| | | | | | | | | | | | This diff extends LinuxKPI to support simple attribute files in debugfs. These simple attributes are an essential component for compiling drm-kmod with CONFIG_DEBUG_FS enabled. This will allow for easier graphics driver debugging using Intel's igt-gpu-tools. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D35883 Sponsored by: Google, Inc. (GSoC 2022)
* linuxkpi: Add strndup_userJake Freeland7 days1-0/+9
| | | | | | Reviewed by: hselasky, markj Differential Revision: https://reviews.freebsd.org/D36350 Sponsored by: Google, Inc. (GSoC 2022)
* linuxkpi: Add EPOLL aliasesJake Freeland7 days2-0/+46
| | | | | | Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36527 Sponsored by: Google, Inc. (GSoC 2022)
* linuxkpi: Add down_read_killable()Jake Freeland7 days1-0/+2
| | | | | | Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36528 Sponsored by: Google, Inc. (GSoC 2022)
* rb_tree: pass parent to RB_INSERT_COLORDoug Moore2022-09-131-3/+8
| | | | | | | | | Change RB_COLOR_INSERT to take a parent parameter, to avoid looking up a value already available. Make adjustments to a linux rbtree header, which invokes it. Reviewed by: alc, hselasky Differential Revision: https://reviews.freebsd.org/D36114
* LinuxKPI: 80211 (+net80211): update and cleanup headersBjoern A. Zeeb2022-09-094-97/+245
| | | | | | | | | | | | | | | | | | | | | | Fix types for various struct fields (initially added as int). Move structs and inline functions logically together, e.g., for wowlan. Add more skeleton functions and #defines needed for iwlwifi d3.c in the future. Add struct ieee80211_vht_cap (without "_ie") to net80211 and remove duplicate definitions in LinuxKPI headers now using net80211 structs. For now leave ieee80211_ie_vhtcap in net80211. I am not sure yet if we actually need it as such. That'll be cleaned up with more VHT updates in net80211 in the future. No functional changes in currently compiled code intended. Try to implement ieee80211_action_contains_tpc() as I ran into it with an older iwlwifi chipset. This depends on c994352a8841eb453. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
* LinuxKPI: 80211: add ieee80211_stop_tx_ba_session()Bjoern A. Zeeb2022-09-091-0/+7
| | | | | | | | rtw89 needs ieee80211_stop_tx_ba_session(). Add the skeleton function for now so we can implement BA functions all together. MFC after: 3 days
* linuxkpi: Add non-atomic readq()/writeq()Felix Palmen2022-09-091-0/+65
| | | | | | | | The non-atomic versions are required by drm-510-kmod to build on 32-bit architectures. Approved by: hselasky, manu, tcberner (mentor) Differential Revision: https://reviews.freebsd.org/D36507
* rb_tree: reduce duplication in balancing codeDoug Moore2022-09-081-6/+6
| | | | | | | | | | | | | | | Change RB_INSERT_COLOR and RB_REMOVE_COLOR so that the blocks of code that are identical except for left and right being exchanged are made only one block with a variable to indicate left- or right-handedness. Rename RB macros so that those not intended for external use begin with an underscore. Add comments to the balancing code so that another might understand it. Reviewed by: alc, kib MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D36393
* LinuxKPI, dev: 80211 update mac80211 KPIBjoern A. Zeeb2022-09-071-7/+7
| | | | | | | | | | | | Update the mac80211 ops KPI for (*conf_tx), (*assign_vif_chanctx), (*unassign_vif_chanctx), (*start_ap), and (*stop_ap), as well as ieee80211_beacon_get_tim() and ieee80211_beacon_get_template(). Update in-tree drivers iwlwifi and rtw88 accordingly based on upstream changes (as well as out-of-tree ones). This was triggered by trying to synchronize more drivers to a common state. MFC after: 1 week
* LinuxKPI: netdev: expose napi stateBjoern A. Zeeb2022-09-071-2/+27
| | | | | | | | | | | | | There are drivers directly accessing napi->state testing for bits (NAPI_STATE_SCHED encountered so far). Rename the internal _flags struct field to state and expose our internal state flag bits along with the one official aliased. As I left in a comment, I wished Linux would hide these accesses behind inline functions or by other means and not public expose the implementation details. MFC after: 1 week
* LinuxKPI: firmware: add request_partial_firmware_into_buf()Bjoern A. Zeeb2022-09-071-0/+13
| | | | | | | | | | A (so far out-of-tree) driver update needs request_partial_firmware_into_buf(). Given we load the full .ko file using firmware(9) just do that and copy the requeste data into the buffer (rather than poissibly only reading portions of the firmware file). MFC after: 1 week
* LinuxKPI: 80211: improve linuxkpi_ieee80211_get_tid()Bjoern A. Zeeb2022-09-051-3/+3
| | | | | | | | | | | | | | | Continue what was started in 26a36948331bd08d9afaddfc0da724eacdb953dd in iwlwifi and extend out internal implementation of linuxkpi_ieee80211_get_tid() by an argument as to whether "no-QoS" answers are acceptable. For the LinuxKPI ieee80211_get_tid() set this to false as the Linux derived drivers seem to do extra checks for the QoS-Data frame before acquiring the tid. Add KASSERTs to enforce the extra argument. This allows us to use the net80211 variant in LinuxKPI for other means explicitly documenting that we do accept a IEEE80211_NONQOS_TID. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* net80211 / drivers: rename to IEEE80211_FC0_SUBTYPE_QOS_DATABjoern A. Zeeb2022-09-031-4/+4
| | | | | | | | | | | | | | Going through the Frame (Sub)types the "QOS Data" being called "QOS" scheme leads to a naming conflict for QOS_CFPOLL and QOS_CFACKPOLL (if added). Rename QOS* to QOS_DATA* to avoid the conflict and to also better match the standards name. No functional changes intended. Sponsored by: The FreeBSD Foundation MFC after: 5 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36409
* LinuxKPI 802.11: change type of bssid in struct ieee80211_bss_confBjoern A. Zeeb2022-08-271-1/+1
| | | | | | | | | | | | | | | | | Enabling other driver code found that the bssid in struct ieee80211_bss_conf is not an array but expected to be a const pointer (const, != NULL checks). Adjust accordingly in the header and in the LinuxKPI compat code. There initialization now needs to be a static array always present as we need a value before we will have a BSS (node in scan_to_auth) as the mac80211 driver (*handlers) are expecting the pointer to be not NULL (copying without checks). This is a pre-req to enable d3 (CONFIG_PM[_SLEEP]) in the future. Tested by: Tomoaki AOKI (junchoon dec.sakura.ne.jp) Tested by: Berislav Purgar (bpurgar gmail.com) Sponsored by: The FreeBSD Foundation MFC after: 3 days
* linuxkpi: unbreak linux_i2cbbEmmanuel Vadot2022-08-241-2/+2
| | | | | | | | | | | | | | | | | | | | This is a joint work with manu. - fixed conditions in do_i2c_transfer and i2c_transfer as linux_i2cbb does not set adapter->algo->master_xfer but does set adapter->algo_data; - fixed parent bus specification for linux_i2cbb driver module; - actually implemented iicbb_transfer method; - added iicbb_pre_xfer and iicbb_post_xfer methods; - removed unnecessary and harmful delays (and other extra logic) from iicbb methods as iicbb driver already has them; - added setting of iicbb speed based on algo_data->udelay, so that iicbb uses correct delays; PR: 265920 Fixes: 1961a14a4743 linuxkpi: Add i2c support MFC after: 2 weeks Sponsored by: Beckhoff Automation GmbH & Co. KG (manu's work)
* rb_tree: speed-up double rotationDoug Moore2022-08-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | RB_ROTATE_LEFT (and it symmetric twin) modify the rb-tree, adjusting pointers so that what started as a proper tree ends up a proper tree. When two consecutive rotations move the same node up the tree, some of the pointers changed in the first rotation are immediately changed again in the second - namely, the pointer from the rising node to its new parent, and the pointer from that parent back to the rising node. This change removes from RB_ROTATE macros the responsibility for managing those two pointers, and leaves it to the code that calls for rotations to fix up those pointers afterward. That drops a comparison and a pair of assignments from every INSERT_COLOR or REMOVE_COLOR call that ends in a double rotation. A side-effect of this change is that the SWAP_CHILD macro must take as a parameter a pointer to the node that is changing children, where it is now computed from the old child. Since this macro is called in a couple of places besides the RB_ROTATE macros, those calls are also affected. Reviewed by: alc MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D36266
* net80211: LinuxKPI 802.11: harmonize IEEE80211_VHT_MCS_*Bjoern A. Zeeb2022-08-181-19/+0
| | | | | | | | | | | | Rather than defining the same values in two places and having to do conflict resulution on the name in LKPI, change the defines to an enum in net80211. In addition to de-duplication this also gives us value checks in certain cases. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D36250
* LinuxKPI: extend kfifo to be usableBjoern A. Zeeb2022-08-181-0/+89
| | | | | | | | Implement some basic kfifo pieces as needed by drivers. MFC after: 2 weeks Reviewed by: wulf, hselasky Differential Revision: https://reviews.freebsd.org/D35829
* linuxkpi: Add I2C_NAME_SIZE and I2C_MODULE_PREFIX definesEmmanuel Vadot2022-08-181-0/+3
| | | | | | | | Both are needed by drm-kmod Obtained from: drm-kmod Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: //reviews.freebsd.org/D36212
* linuxkpi: Add linux/vgaarb.hEmmanuel Vadot2022-08-181-0/+254
| | | | | | | | | Needed by drm-kmod. Reviewed by: bz Obtained from: Linux Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36104
* linuxkpi: Add video/mipi_display.hEmmanuel Vadot2022-08-181-0/+64
| | | | | | | | | Needed by drm-kmod. Reviewed by: bz Obtained from: OpenBSD Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36103
* linuxkpi: acpi/video.h: Add stubs acpi_video_{register,unregister}Emmanuel Vadot2022-08-181-0/+12
| | | | | | | | | Needed by i915. Reviewed by: bz Obtained from: drm-kmod Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36102
* linuxkpi: Add __copy_to_user_inatomic and __copy_from_user_inatomicEmmanuel Vadot2022-08-181-0/+25
| | | | | | | Reviewed by: bz Obtained from: drm-kmod Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36113
* linuxkpi: Add add_taint stubEmmanuel Vadot2022-08-181-0/+2
| | | | | | | Needed by drm-kmod. Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36112
* linuxkpi: Add few more include in linux/kernel.hEmmanuel Vadot2022-08-181-0/+3
| | | | | | | | Those are needed and also included in linux (via polution). Reviewed by: bz Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36111
* linuxkpi: swap.h: Fix includeEmmanuel Vadot2022-08-181-0/+7
| | | | | | | | | Add needed includes so we can use it. Reviewed by: bz Fixes: c3f4f28c63da ("linuxkpi: Add some basic swap functions") Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36109
* linuxkpi: Add stub kmem_cache_shrinkEmmanuel Vadot2022-08-181-0/+1
| | | | | | | | Needed by drm-kmod. Reviewed by: bz Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36108
* linuxkpi: Add asm/processor.hEmmanuel Vadot2022-08-181-0/+46
| | | | | | | | | Also fill the boot_cpu_data struct as drm needs it. Reviewed by: bz Obtained from: drm-kmod Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36107
* linuxkpi: Add dma_{un,}map_sgtableEmmanuel Vadot2022-08-181-0/+20
| | | | | | | | | Variant of dma_{un,}map_sg_attrs for struct sg_table. Reviewed by: bz Obtained from: drm-kmod Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36106
* linuxkpi: Add linux/stackdepot.hEmmanuel Vadot2022-08-181-0/+32
| | | | | | | | | With a typedef needed by drm-kmod. Reviewed by: bz Obtained from: drm-kmod Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36105
* linuxkpi: pgtable: Add more definesEmmanuel Vadot2022-08-181-0/+15
| | | | | | | | | Needed by drm-kmod Reviewed by: bz Obtained from: drm-kmod Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36101
* linuxkpi: Add sched/mm.hEmmanuel Vadot2022-08-181-0/+40
| | | | | | | | With stubs needed by drm-kmod. Obtained from: drm-kmod Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36100