aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi/common/include
Commit message (Collapse)AuthorAgeFilesLines
...
* linuxkpi: Take const root in read-only radix tree functionsJean-Sébastien Pédron2025-12-091-2/+2
| | | | | | | | This is a preparation step for a future addition to this file. This is also closer to what Linux does. Reviewed by: emaste Sponsored by: The FreeBSD Foundation
* LinuxKPI: ath10k: adjust for led changes to keep ath10k compilingBjoern A. Zeeb2025-12-061-1/+4
| | | | | | | | | Add the conditional compile time option defaulting to off as we do not support leds in LinuxKPI to ath10k for the new file. Add empty struct gpio_led to LinuxKPI. MFC after: 3 days
* LinuxKPI: mt76: depend on CONFIG_NET_MEDIATEK_SOC_WEDBjoern A. Zeeb2025-12-031-1/+27
| | | | | | | | | If CONFIG_NET_MEDIATEK_SOC_WED is not set then be silent; if CONFIG_NET_MEDIATEK_SOC_WED is set we will enable logic or rather te pr_debug("TODO") calls for now. Spsonsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: move ieee80211_offload_flagsBjoern A. Zeeb2025-12-031-7/+7
| | | | | | | | | | Move the enum and leave a comment on the struct member for the vif about the type. No functional changes. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: fill in more skeleton functionsBjoern A. Zeeb2025-12-032-31/+141
| | | | | | | | | | | | Some of these are used by mt76 and while I was here and it only was a handfull I figured I should just clean this all up. There is one problem in that between 802.11az and 802.11-2024 action frame formats have changed; I got compile errors from iwlwifi(4) given I updated them to -2024 so we remain on older versions for the moment. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: device: add a pr_debug("TODO") call to device_release_driver()Bjoern A. Zeeb2025-12-031-0/+1
| | | | | | | | | The logic in device_release_driver() got disabled in 93b14194acaf2 and since left alone. Add a pr_debug() call so we have a chance to notice if that code is actually still in need to be fixed and re-enabled. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: make airtime fairness an IMPROVEBjoern A. Zeeb2025-12-031-1/+1
| | | | | | | | | We are ways away from implementing "airtime fairness" in LinuxKPI (or rather net80211). For now make it an 'improve' rather than a 'todo' to get the logging away. Everything will work without it. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: use a _check rather than a _protected version for linkstaBjoern A. Zeeb2025-11-191-1/+1
| | | | | | | | Switch to link_sta_dereference_check rather than _protected to access the value. The actual problem we hit was elsewhere though. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: initialize the passed in chandef in cfg80211_chandef_createBjoern A. Zeeb2025-11-171-1/+1
| | | | | | | | | | | | | cfg80211_chandef_create() gets passed a pointer to a cfg80211_chan_def. It seems that several users are passing in an uninitialized variable from the stack and expect cfg80211_chandef_create() to initialize it. Run memset() on the struct, which for all callers currently seems to do the right thing, to avoid later accesses to uninitialized struct members like "punctured". Reported by: CI (gcc build) MFC after: 3 days Sponsonred by: The FreeBSD Foundation
* linuxkpi: add stub implementation of pm_vt_switch_(un)registerAustin Shafer2025-10-291-0/+14
| | | | | | | | | | This adds empty implementations of pm_vt_switch_(un)register which are used by nvidia-drm. We do not need to specify anything here as a VT switch always happens on suspend/resume. Sponsored by: NVIDIA Reviewed by: kbowling (mentor), emaste Differential Revision: https://reviews.freebsd.org/D53400
* LinuxKPI: 802.11: additions for Linux v6.17 based wireless driversBjoern A. Zeeb2025-10-231-7/+7
| | | | | | | This includes the conflicting changes from previous driver versions (v6.11/v6.14), mostly being function pointer or function arguments. MFC after: 3 days
* linuxkpi: Fix the definition of BITS_PER_LONGMark Johnston2025-10-221-7/+2
| | | | | | | | | | | Don't use __LP64__ to decide the value, as it gives the wrong result on CHERI platforms. Just define it in terms of __SIZEOF_LONG__. Make a similar adjustment for BITS_PER_LONG_LONG while here. Reviewed by: bz, dumbbell, emaste MFC after: 1 week Sponsored by: CHERI Research Centre (EPSRC grant UKRI3001) Differential Revision: https://reviews.freebsd.org/D53135
* LinuxKPI: 802.11: additions for Linux v6.17 based wireless driversBjoern A. Zeeb2025-10-214-134/+235
| | | | | | | | | | | | This includes some type cleanups as well as some shuffling of structs and functions to sort dependencies out. Few new functions and defines as well as new struct members. Minor fixes to style and debug logging. This is the majority of changes. None of these should conflict with current in-tree drivers. The final bit of changes will come along with the driver updates adding an extra argument to function pointers. MFC after: 3 days
* LinuxKPI: netdevice add attach/detach skeleton functionsBjoern A. Zeeb2025-10-211-0/+15
| | | | | | | For the moment add skeleton functions for netif_device_attach/detach() needed by rtw8[89] v6.17. MFC after; 3 days
* LinuxKPI: skbuff: add a misplaced socket operation to skbuff.h for nowBjoern A. Zeeb2025-10-211-0/+3
| | | | | | | This likely belongs in socket code which we do not have in LinuxKPI. Needed by a wirless driver at v6.17. MFC after: 3 days
* LinuxKPI: soc/mediatek add pr_debug callsBjoern A. Zeeb2025-10-211-32/+15
| | | | | | | | We do not support Wireless Ethernet Dispatch (wed) on the mt76 (yet). Add pr_debug calls with TODO in case we run into the calls anyway so we could deal with them. MFC after: 3 days
* LinuxKPI: page_pool headers moved; add netmem.hBjoern A. Zeeb2025-10-214-119/+136
| | | | | | | | | page_pool headers were not used yet; they were created for mt76 but are without functionality. Upstream has migrated them for v6.17 and split them up into multiple files. Also add netmem.h which the little needed is directly related to page pools. MFC after: 3 days
* LinuxKPI: add skeleton pci_enable_wake()Bjoern A. Zeeb2025-10-211-0/+13
| | | | | | | | | | | | Given we do not yet support "wake" bits in device there is little need doing it in PCI if we cannot check if we are supposed to do the operation in first place. Once we would implement this, we would need to also do the appropriate PCI (pme) checks before enabling (disabling) it. MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D53208
* LinuxKPI: add fips.hBjoern A. Zeeb2025-10-211-0/+12
| | | | | | | | | We do not currently aim to support crypto FIPS compliance in LinuxKPI so keep this turned off. MFC after: 3 days Reviewed by: emaste, dumbbell Differential Revision: https://reviews.freebsd.org/D53207
* LinuxKPI: device_driver add (*coredump)()Bjoern A. Zeeb2025-10-211-0/+1
| | | | | | | | | Needed by multiple wireless driver for the v6.17 update (likely earlier versions already). MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D53206
* LinuxKPI: platform_device return type changeBjoern A. Zeeb2025-10-211-1/+1
| | | | | | | | | | The return type now is void; I believe no one ever used this so we can just chnage it. The only active platform_driver_register() calls seems to be in ath1[01]k and mt76 and there in unsupported code. MFC after: 3 days Reviewed by: dumbbell, emaste Differential Revision: https://reviews.freebsd.org/D53205
* LinuxKPI: add three skeleton functions to etherdevice.hBjoern A. Zeeb2025-10-211-0/+23
| | | | | | | | We will see how much we will need them and how to fill them at that point. They are left with a pr_debug("TODO") for now. MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D53204
* LinuxKPI: add __counted_by_le() and __counted_by_be()Bjoern A. Zeeb2025-10-211-0/+8
| | | | | | | | The former is needed by a wireless driver at v6.17. MFC after: 3 days Reviewed by: dumbbell, emaste Differential Revision: https://reviews.freebsd.org/D53203
* LinuxKPI: pci: implementation of [lkpi_]pci_get_slot()Bjoern A. Zeeb2025-09-291-0/+6
| | | | | | | | | | | | | | | | | Like lkpi_pci_get_domain_bus_and_slot() implement lkpi_pci_get_slot() using pci_find_bsf() instead of pci_find_dbsf() (no domain). This is needed for a wireless driver. Unfortunately the name [pci_get_slot()] collides with the native PCI function. Add a guard around it and disable the use when the native version is required (in lkpifill_pci_dev() and in bnxt/bnxt_en; if the latter gets fixed we can probably also fix work around it in the former; further conflicts in drm-kmod 6.1-lts, 6.6-lts, and master were resolved). Sponsored by: The FreeBSD Foundation (initially) MFC aftre: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52065
* linuxkpi: Move string_helpers.h to string_choices.hEd Maste2025-09-192-63/+75
| | | | | | | | | | | | Chace Linux change fca76071bab2 ("lib/string_helpers: Split out string_choices.h") from v6.5. Everything that we implemented from string_helpers.h has moved, so rename the file, update the include guards, and add a new dummy string_helpers.h that just #includes it. This matches Linux for the functionality that we have. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D52606
* LinuxKPI: devres: divorce dem_kfree from lkpi_devm_kmalloc_releaseBjoern A. Zeeb2025-09-051-2/+3
| | | | | | | | | | | | | | dem_kfree() is called from all over the place and should actually do something; contrary to lkpi_devm_kmalloc_release() it can also take a const void *. We have to __DECONST() that though as the entire devres framework does otherwise not take a const argument. This was discovered during the rtw89 upadte to 6.16. Sponsored by: The FreeBSD Foundation (initially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52082
* LinuxKPI: maths64: implement roundup_u64()Bjoern A. Zeeb2025-09-051-0/+6
| | | | | | | | | Needed by a wifi driver update. Sponsored by: The FreeBSD Foundation (initially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52080
* LinuxKPI: kunit: add static_stub.h and more dummy headersBjoern A. Zeeb2025-09-051-0/+15
| | | | | | | | | These came up during a wifi driver update. Sponsored by: The FreeBSD Foundation (initially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52079
* LinuxKPI: sync overflow.h from Linux v6.16Bjoern A. Zeeb2025-09-051-27/+153
| | | | | | | | | | | | It seems overflow.h wsa imported directly from Linux in 3208d4ad2b8320a. Update the file to the newer version as needed for wireless driver updates. Sponsored by: The FreeBSD Foundation (initially) MFC after: 3 days Obtained from: git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 038d61fd642278 (tag: v6.16) Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52078
* LinuxKPI: add __struct_sizeBjoern A. Zeeb2025-09-051-0/+6
| | | | | | | | | | | | | | Use __builtin_object_size() by default. If __builtin_dynamic_object_size() is available use that instead. I would hope that in a future version we can remove the conditional checks but in order to be able to MFC this without checking all compiler versions simply keep it this way for now. Sponsored by: The FreeBSD Foundation (initially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52077
* LinuxKPI: add DEFINE_LOCK_GUARD_0 for rcuBjoern A. Zeeb2025-09-052-1/+39
| | | | | | | | | | | | | This adds guard support for non-real-types like rcu locking meaning that we need to keep the lock state separately ourselves. _T is still special and needs to be updated. Given it may not be used it needs an __unused attribute (we are using the LinuxKPI __maybe_unused which indeed is more expressive in this case). Sponsored by: The FreeBSD Foundation (initially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52076
* LinuxKPI: cleanup: implement __free() and DEFINE_FREE(); use for kfree()Bjoern A. Zeeb2025-09-052-1/+17
| | | | | | | | | A wifi driver update needs this. Sponsored by: The FreeBSD Foundation (initially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52075
* LinuxKPI: timer KPI *_timer -> timer_*Bjoern A. Zeeb2025-09-051-2/+14
| | | | | | | | | | | | | | del_timer() got renamed to timer_delete() approximately in Linux 6.2 (similar for *_sync and likely others). Keep the old functions as compat; unclear when we can gc them. We should also re-define them with a linuxkpi_ prefix to avoid possible conflicts in the future if we do a full pass over this at some point. Sponsored by: The FreeBSD Foundation (intiially) MFC after: 3 days X-MFC; preserve symbols, not inline Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52074
* LinuxKPI: rename from_timer() to timer_container_of()Bjoern A. Zeeb2025-09-051-0/+5
| | | | | | | | | | | | With Linux 6.16 from_timer() got renamed to timer_container_of(); add the LINUXKPI_VERSION check with a default to the current version. Update all in-tree consumers (apart from wireless drivers managed otherwise). Sponsored by: The FreeBSD Foundation (initially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52073
* LinuxKPI: acpi; fix type to acpi_get_handle()Bjoern A. Zeeb2025-09-051-1/+1
| | | | | | | | | | | The native AcpiGetHandle() and acpi_get_handle() take a const char * argument for pathname and not an acpi_string (char *). For that they spell it out fully as 'const char *', so should we. Sponsored by: The FreeBSD Foundation (intially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52072
* LinuxKPI: correct the LINUXKPI_VERSION check for abs_diff()Bjoern A. Zeeb2025-09-051-1/+1
| | | | | | | | | | | | | The code introduced abs_diff() as migrated from drm to standard linux headers. The LINUXKPI_VERSION check did not allow this to be visible by default in-tree. Make sure the v6.6 check is optional. drm-kmod always defines LINUXKPI_VERSION so this should be fine. Sponsored by: The FreeBSD Foundation (initially) Fixes: afc450fac9f04 MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52071
* LinuxKPI: pci: implement [linuxkpi_]pcim_request_all_regions()Bjoern A. Zeeb2025-09-051-3/+8
| | | | | | | | | | | | | | | | | | Factor out the pci_request_region() implementation into an internal function and make pci_request_region() a simple wrapperaround it. Likewise implement pcim_request_all_regions() as a loop calling pci_request_region() for each entry. In two cases which we returned an error before (bar index is valid but bar is not (no len), and neither IO nor MEM) we now reutrn success (nothing to do for us). Otherwise callers, especially pcim_request_all_regions() would error out for the wrong reasons. This seems to also match the expected behaviour of pci_request_region(). Sponsored by: The FreeBSD Foundation (intially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52068
* LinuxKPI: pci: implement pcim_iomap()Bjoern A. Zeeb2025-09-051-0/+3
| | | | | | | | | | | | | Like pci_iomap() add the devres version pcim_iomap() using the former to get the resource. Add a helper function to validate that the bar is within a valid range and sprinkle that check also to other related functions. Sponsored by: The FreeBSD Foundation (intially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52067
* LinuxKPI: pci: implement for_each_pci_dev() and improve pci_get_device()Bjoern A. Zeeb2025-09-051-0/+3
| | | | | | | | | | | Implement for_each_pci_dev() needed by a wireless driver update. For that also improve pci_get_device() and add the functionality to support the odev argument to start searching from that. Sponsored by: The FreeBSD Foundation (intially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52066
* LinuxKPI: skbuff: no longer use IEEE80211_DEBUG to turn on debugBjoern A. Zeeb2025-09-031-8/+6
| | | | | | | | | | | | | | A port using linux(kpi) header files but not using skbuffs is hitting the case that it cannot find opt_wlan.h. Give up to the idea that skbuff.h is only used by wireless drivers (or in-tree) and that IEEE80211_DEBUG (via opt_lwan.h) could autmatically compile in debug support. It is likely time to add a LINUXKPI_DEBUG knob in the near future (also for linuxkpi_debug or linuxkpi_debug_rcu). PR: 289268 MFC after: 3 days
* net80211 / LinuxKPI: 802.11: revert / redo enum ieee80211_sta_rx_bwBjoern A. Zeeb2025-08-302-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | The initial thought of migrating the LinuxKPI 802.11 enum into net80211 for shared use did not work out well. Currently in the need for yet another adjustment, I decided to undo/de-couple net80211 and LinuxKPI 802.11 again. The enum name now gets used in LinuxKPI based wifi drivers and it turns out it is spelt differntly than what I used initially. This creates a conflict. net80211 still in the need to be able to express BW_320 in an uint8_t will likely be fine with the current solution as well. Rename the enum and prefixes in net80211 to "net80211" instead of "ieee80211". Apart from the names/prefix we leave the values the same. In LinuxKPI add the enum with the expected name and use it there throughout to make modern versions of LinuxKPI based wifi drivers compile. Sponsored by: The FreeBSD Foundation Fixes: ca389486a9599, 2c8b0d6205f6f MFC after: 3 days Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D52064
* LinuxKPI: skbuff: checksum offloading flagsBjoern A. Zeeb2025-08-291-2/+2
| | | | | | | | | | | Given the checksum offloading flags are mutually exclusive and are not a bit mask, we can compress them into 2 bit for the four possible values. Change the define but leave the type at uint8_t for now with a comment. We can possible combine them with another sub-octet field in the future. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: mark all structs in struct ieee80211_mgmt __packedBjoern A. Zeeb2025-08-291-10/+10
| | | | | | | | These structs as part of the union are used to handle raw packet data so mark them all __packed. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: implement str_disable_enable()Bjoern A. Zeeb2025-08-291-0/+2
| | | | | | | | | | Implement str_disable_enable() needed by a wireless driver by using the already existing str_enable_disable() with a toggled argument. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D52081
* linuxkpi: Fix a typo in a source code commentGordon Bergling2025-08-261-1/+1
| | | | | | - s/__FreeBSD_verison/__FreeBSD_version/ MFC after: 3 days
* LinuxKPI: 802.11: rework multicat filter updatesBjoern A. Zeeb2025-08-252-1/+11
| | | | | | | | | | | | Multicast filter updates are done at different times and either triggered by net80211/if code or within LinuxKPI. Keep the setting and address list and update that (only) if triggered from net80211. Otherwise we will (depending on state) just update additional flags. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: improve ieee80211_request_smps()Bjoern A. Zeeb2025-08-241-4/+7
| | | | | | | | | | Adjust logging from TODO() to IMPROVE() now that we can use fmt strings there too. Make sure we are not getting unsuported values to print. Also for non-station mode simply return. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPi: 802.11: adjust linuxkpi_set_ieee80211_dev() to set ic_nameBjoern A. Zeeb2025-08-241-2/+2
| | | | | | | | | | | While we used to pass in the dev_name(), we now use wiphy_dev() inside the implementation to get the dev and the name. This is for two reasons: (1) ath1xk also unset the dev and we need to check once we add support, and (2) in preparation for future work, which needs to hook into that point. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: correct struct linuxkpi_ieee80211_channelBjoern A. Zeeb2025-08-241-10/+15
| | | | | | | | | Some of the annotations were not quite right. Also various fields had not been typed properly. Correct the types of field members and given the change also re-sort. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: improve reg_query_regdb_wmm()Bjoern A. Zeeb2025-08-241-5/+4
| | | | | | | | | | | Adjust the IMPROVE macro to also take a format string and use that in reg_query_regdb_wmm() instead of TODO() to avoid spamming the console with something that needs larger reworks. Return -ENODATA instead of -ENXIO as that seems a better fit though the only consumer uses it without checking the return value these days. Sponsored by: The FreeBSD Foundation MFC after: 3 days