aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi
Commit message (Collapse)AuthorAgeFilesLines
...
* LinuxKPI: 802.11; update frag_threshold and rts_thresholdBjoern A. Zeeb2025-06-061-0/+6
| | | | | | | Update threshold values once we are associated. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: fix lkpi_scan_ies_add() channel lookupBjoern A. Zeeb2025-06-061-1/+15
| | | | | | | | | | | When looking up the channel we may not get a result if no flags are passed in as net80211 channel list setup and lookup coding requires a matching flag (band). So pass in IEEE80211_CHAN_[AG] depending on band to increase the chances of finding a base channel and from that derive rates, etc. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: stop queues during key updatesBjoern A. Zeeb2025-06-061-0/+11
| | | | | | | | | | When beginning key updates do stop and afterwards re-enable the tx queues to avoid packets being passed to the driver. This is a theoretical problem at this point but helps some cases. These functions will likely need refinement in the future. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: improve queue lockingBjoern A. Zeeb2025-06-061-4/+15
| | | | | | | | | | | | | | | Introduce an internal lkpi_ieee80211_wake_queues_locked() function that can be used from context holding the wiphy lock. Make linuxkpi_ieee80211_wake_queues() a wrapper with locking around this. Equally apply the wiphy lock to linuxkpi_ieee80211_wake_queue(). In lkpi_ieee80211_wake_queues() only wakeup the driver if the queue is not empty; otherwise weird sideeffects can happen with some drivers. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: place lock asserts for key operationBjoern A. Zeeb2025-06-061-16/+19
| | | | | | | | | | | Since b8dfc3ecf7031 we hold the wiphy lock over any key updates. Assert that on function entry. Given this invariant there is no need to recheck a kay under lock now, as the first lookup already is under the lock, so simplify the code. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: adjust logging for key handlingBjoern A. Zeeb2025-06-061-27/+35
| | | | | | | | Given there are still problems observed (at least in the Lab) adjust crypto key handling routines and enhance logging with td_tid, jiffies. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: WEP noiseBjoern A. Zeeb2025-06-051-2/+7
| | | | | | | | | | While we decided that we will not provide WEP support for the LinuxKPI 802.11 compat code, some of it is in there already (also because drivers still support it). Put proper keylen checks in place as net80211 only knows about WEP while LinuxKPI has WEP40 and WEP104. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: add support for GCMP hw crypto offloadBjoern A. Zeeb2025-06-051-9/+14
| | | | | | | | | | | | For iwlwifi, rtw88, and rtw89 we can treat GCMP the same way as we treat CCMP which allows us to re-use the CCMP code for now. Add the missing case statements and factor out some common code. Allow IEEE80211_CRYPTO_AES_GCM_128 through our filter of supported cipher suites to announce it to net80211. Sponsored by; The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: make synching from HT more resilientBjoern A. Zeeb2025-06-051-8/+12
| | | | | | | | | | | | | | | | | During testing I hit a case where htcap->mcs.rx_mask[0,1] were zero. This should not happen as that would mean we are not supporting HT. After adding extra caution for debugging I could no longer reproduce the case. So just to deal with the eventuality make synching from HT more resilient by checking that we have nss > 0 or otherwise disable HT operations. Move setting the bandwidth below this check to not alter it in case of the now early return. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: update HE structuresBjoern A. Zeeb2025-06-031-11/+17
| | | | | | | | Update strutures needed for 11ax (HE) to be correct. Add references to the standard. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* linuxkpi: Improve LKPI_80211_TRACE_MO messageEd Maste2025-06-031-1/+1
| | | | | | | | | | | | | The message used to have a prefix of the function and line, followed by `:_` and the supplied message. Commit 3206587a20de ("LinuxKPI: 802.11: improve scan handling") changed the prefix to add the CPU, tid, and ticks. `_` and the caller-supplied message were joined to the ticks value, resulting in a somewhat odd message. Instead use `: ` to separate them. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50667
* LinuxKPI: 802.11: add ieee80211_purge_tx_queue()Bjoern A. Zeeb2025-06-031-1/+8
| | | | | | | Add ieee80211_purge_tx_queue() dummy function needed by rtw88 SDIO. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: skbuff: add dummy skb_copy_header()Bjoern A. Zeeb2025-06-031-0/+7
| | | | | | | | There's one case which needs skb_copy_header(); add a dummy function for now until we get to the code which uses it to test an implementation. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: use macros for lockingBjoern A. Zeeb2025-06-031-13/+4
| | | | | | | | | Rather than using inline functions use macros so we know where we are taking the lock in the code rather than only recording the inline function location. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: move rx_nss check to be at least 1 into sync functionBjoern A. Zeeb2025-06-031-1/+7
| | | | | | | | | | | We set rx_nss to at least 1 and the sync functions for HT and VHT are careful not to set it to 0. Rather than relying on that and any possible future call to lkpi_sta_sync_from_ni() migrate the MAX() call into the sync function after each standard level went through to make sure that at the end we at least have rx_nss set to 1. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: netdev features style, annotate, and add %b decoding maskBjoern A. Zeeb2025-06-031-10/+14
| | | | | | | | | | | | | | | | Start to sort through the netdevice features to match them with FreeBSD. Annotate them a bit more verbose though the names are pretty telling already. While here adjust style(9) as well. Lastly add the bit definitions for use with printf(9) %b as names read easier than bitmasks. We will use that in LinuxKPI 802.11. No functional changes. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: skbuff: make csum_unfold return __wsumBjoern A. Zeeb2025-06-031-1/+1
| | | | | | | | | Given the internal field now stores a __wsum csum (after we added the type) also make sure csum_unfold() returns a __wsum. Sponsored by: The FreeBSD Foundation MFC after: 3 days Fixes: 59481c7db234
* LinuxKPI: 802.11: switch to m_get3()Bjoern A. Zeeb2025-06-031-1/+1
| | | | | | | | | Start using m_get3() instead of m_get2() as we may get up to 11K frames and m_get2() only gives us up to MJUMPAGESIZE (8K). Sponsored by: The FreeBSD Foundation MFC after: 3 days Discovered by: adrian with rtwn(4) [see D50049].
* LinuxKPI: 802.11: ensure bandwidth <= channel bandwidthBjoern A. Zeeb2025-06-031-3/+23
| | | | | | | | | | | | | | | While we could select our own channel width and station bandwidth indepedent of net80211 that is not a good idea and will lead to trouble. Make sure the station bandwidth we select does not exceed the bandwidth of the channel we are tuned into. Now that VHT160 work we may locally disable it (-vht160) and the AP may still support it but we would be on a 80Mhz channel. Or we do support VHT160 but the AP does not. Again we would be on a 80Mhz channel and not support 160Mhz. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: Implement dma_map_resource/dma_unmap_resource functionsBjoern A. Zeeb2025-06-031-0/+14
| | | | | | | | | | | | | | | | | | | | | | dma_map_resource() and dma_unmap_resource() functions are used to map and unmap of memory-mapped IO resources so they can be accessed by the device. Required by drm-kmod v5.5 to be built. While for drm-kmod 6.6-lts only amdgpu uses these in one place and the code apparently has not been exercised a lot it has been around like this for years. With changing the underlying implementations bring it into the tree; should we find errors with it they can also be fixed here. Bump __FreeBSD version to be able to detect this change. Obtained from: D30933 (by wulf) Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D49625
* LinuxKPI: add missing bus_dmamap_sync() calls or exclude themBjoern A. Zeeb2025-06-032-29/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rename linux_dma_unmap() to lkpi_dma_unmap(), and linux_dma_map_phys() to lkpi_dma_map_phys() so that we get the full set of function arguments (direction and attributes were missing). Leave the old functions as wrappers as they are called from drm-kmod linuxkpi/bsd still, and leaving them also allows us to MFC this change. Add missing bus_dmamap_sync() calls. Rather than inlining them in each inline function push them down to the actual implementation. From there do not inline them either but call the appropriate function dealing with the sync so that we do not have the same code splattered in many places. Adhere to the DMA_ATTR_SKIP_CPU_SYNC attribute and skip synching when requested. A previous, less complete version of this change already allowed me to load firmware on arm64 for iwlwifi (again). There are four more places which are not currently done as the functions which came with an OFED sync a long time ago seem to be unused these days. Leaving a pr_debug("TODO") call there. Also dma_[un]map_resource() when brought in from drm-kmod/linuxkpi/bsd (D30933) should be adjusted to pass the full arguments as the amdgpu callers are requesting to skip synching. Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D45294
* net80211: fix VHT160 and VHT80P80 selection and enable in LinuxKPI 802.11Bjoern A. Zeeb2025-06-011-8/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Between 802.11ac-2013 and 802.11-2020 some fields were deprecated and the way VHT160 and VHT80P80 are selected has changed. In order to get onto VHT160 with modern APs adopt and support both the deprecated as well as the new logic. For simplicity of blocks we pull out the non-HT40 handling early on, followed by the "use HT", followed by the deprectaed options and then the 80Mhz channel width. In all cases keep checking (a) what is locally supported, (b) what the user has locally allowed (FVHT flags, [-]vht160 [-]vht80p80 [-]vht80 [-]vht40), as well as (c) what is announced. Provide possible fallbacks to lower channel widths in all cases (but VHT20, which means VHT is disabled). With this enable VHT160 and VHT80P80 in the LinuxKPI 802.11 driver compat code as well. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: thj Differential Revision: https://reviews.freebsd.org/D49773
* LinuxKPI: add struct_group_tagged()Bjoern A. Zeeb2025-05-281-5/+21
| | | | | | | | | | | Restructure struct_group() into a wrapper around __struct_group(). Various callers have arguments annotated as /* no foo */ so try to add all we can find. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D50157
* LinuxKPI: 802.11: mark struct ieee80211_ht_cap __packedBjoern A. Zeeb2025-05-261-2/+2
| | | | | | | | | | | | | | In lkpi_sta_sync_ht_from_ni() we are casting the information element (IE) data to this struct as net80211 does not save the mcs/rx_mask. Not marking the structs packed results in the mcs information not being copied correctly and rx_nss calculations possibly being off. Even worse, at a later stage iwlwifi mvm/rs.c would extract the mcs values from the same field to pass to the firmware which will than crash in an assert as we would want to do HT with an empty MCS set. Sponsored by: The FreeBSD Foundation MFC after: sunrise Discovered: while testing other features on arm64.
* LinuxKPI: 802.11: make sure AUTH frames are not being sent if BSS changedBjoern A. Zeeb2025-05-121-10/+14
| | | | | | | | | | | | | | | | | iwlwifi keeps logging 'Invalid TXQ id' even after previous changes to catch the BSS changed. The reason for this is that we do not error in the SCAN -> AUTH path as otherwise we would not have the state machine get us back to SCAN to clear up firmware state before auth/assoc to the new BSS. If we are not in synch as net80211 just swapped the iv_bss from under us, disable the TX queue for the (old) lsta to prevent the AUTH frame sent from sta_newstate() reaching the driver. After all we are not trying to authenticate to that node (sta) anymore. Sponsored by: The FreeBSD Foundation PR: 274382 MFC after: 3 days
* linuxkpi: Add `folio` and `folio_batch` APIsJean-Sébastien Pédron2025-05-1211-4/+245
| | | | | | | | | | | | | | They are used by the i915 DRM driver in Linux 6.6 (although this change was only backported with Linux 6.7 DRM drivers). `struct folio` simply wraps `struct page` for now. `struct folio_batch` is the same as `struct pagevec` but it works with `struct folio` instead of `struct page` directly. Reviewed by: bz, kib, markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48743
* linuxkpi: Make "free page" code paths closer to LinuxJean-Sébastien Pédron2025-05-122-4/+21
| | | | | | | | | | | | | | | There is basically one code path to free pages on Linux. In particular, `free_pages()` is used for other pages than those returned by `alloc_pages()`. Also on Linux, `release_pages()` takes either `struct page` or `struct folio`. `struct folio` support will be added in a followup commit. Regardless, because pages come from several sources, `linux_free_pages()` need to accept managed and unmanaged pages. Reviewed by: bz, markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49813
* linuxkpi: Constify `struct page` arg to `linux_page_address()`Jean-Sébastien Pédron2025-05-122-2/+2
| | | | | | Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49812
* linuxkpi: Move `put_page()` closer to `get_page()`Jean-Sébastien Pédron2025-05-121-6/+6
| | | | | | | | | This is to prepare a future change to the implementation and make it easier to review. Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49811
* linuxkpi: Move `release_pages()` to linux_page.cJean-Sébastien Pédron2025-05-123-9/+12
| | | | | | | | | We want to avoid putting code managing memory in inline functions in the future. Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49810
* linuxkpi: Add `woken_wake_function()` and `wait_woken()`Jean-Sébastien Pédron2025-05-122-3/+70
| | | | | | | | | | | They are used by the i915 DRM driver starting with Linux 6.7. `(struct wait_queue)->flags` is no longer always zero. I wonder if some code relied on this... Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48755
* linuxkpi: Fix up jiffies handlingMark Johnston2025-05-125-38/+49
| | | | | | | | | | | | | | | | | | | | | A few issues found by code inspection while hunting for bugzilla PR 286512: - The "expires" field in struct delayed_work should be unsigned. - In linux_timer_jiffies_until(), clamp the return value to INT_MAX: this return value is used as a ticks count, not a jiffies count, so we should avoid returning too large a value, lest it get truncated. It's unlikely we are dealing with values that large, but we should be careful anyway. - In linux_add_to_sleepqueue(), truncate the timeout to INT_MAX, as this value is passed to sleepq_set_timeout() as a ticks value. Typically it's multiplied by ticks_sbt to get an sbintime, and we should make sure the multiplication doesn't overflow. In drm-kmod, there is at least one call mod_delayed_work(... MAX_SCHEDULE_TIMEOUT). Fixes: 325aa4dbd10d ("linuxkpi: Introduce a properly typed jiffies") Reviewed by: olce, bz, dumbbell, kib Tested by: dumbbell, bz Differential Revision: https://reviews.freebsd.org/D50192
* LinuxKPI: add ktime_get_boottime_seconds()Bjoern A. Zeeb2025-05-091-0/+7
| | | | | | | | | ktime_get_boottime_seconds() is needed by an updated iwlwifi driver. Sposored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D50005
* LinuxKPI: add _devcd_free_sgtable() to devcoredump.hBjoern A. Zeeb2025-05-091-1/+8
| | | | | | | | | | | | It may be that once we implement freeing of chained tables _devcd_free_sgtable() will become our _lkpi_dev_coredumpsg_free() but further investigations need to happen. For now make an updated iwlwifi driver happy which should not need more. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D50006
* LinuxKPI: pci: fix two errors in lkpi_pci_get_device()Bjoern A. Zeeb2025-05-091-3/+7
| | | | | | | | | | | | | | | | | | | | | On any result we need to acquire a reference. pci_dev_get() deals with a NULL argument so we can simply pass what we "found" at the end. This will avoid reference count problems. If the iteration on the linux list in lkpi_pci_get_device() does not find a match pdev will still be defined at the end of the loop but not pointing to a valid pdev. Store the found entry in a 2nd variable which otherwise will be NULL. This will avoid random panics, usually in sysfs_remove_dir() when the reference gets released. Found during mt76 bringup. Sponsored by: The FreeBSD Foundation MFC after: 3 days Fixes: 8f61992d7cc11 Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D50153
* LinuxKPI: pci: deal with kobject_add() being able to failBjoern A. Zeeb2025-05-091-7/+22
| | | | | | | | | | | | | | | lkpifill_pci_dev() uses a sequene of kobject_init/set_name/add. The problem is that kobject_add could fail. Move the entire logic to the beginning of the function, switch to kobject_init_and_add() and check the return code. Make lkpifill_pci_dev() return the error and deal in the callers with a possible error accordingly. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D50154
* vm_page: make iter_insert() publicDoug Moore2025-05-091-3/+8
| | | | | | | | | In places where vm_page_insert() is used after lookups, or for consecutive pages, use vm_page_iter_insert instead, to exploit locality. Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D50248
* LinuxKPI: styleBjoern A. Zeeb2025-05-051-2/+2
| | | | | | | | | | | Check results of non-bool to be != 0. No functional changes intended. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D50158
* LinuxKPI: add is_unicast_ether_addr()Bjoern A. Zeeb2025-05-051-1/+7
| | | | | | | | | | | | | Needed by mediatek/mt76 wireless driver. While here adjust the way is_multicast_ether_addr() is implemented to not look weird. [1] Sponsored by: The FreeBSD Foundation Suggested by: emaste [1] MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D50152
* LinuxKPI: 802.11: header updates for mt76Bjoern A. Zeeb2025-05-053-38/+100
| | | | | | | Add more structs, fields, flags, defines. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: dummy: add more dummy hreader filesBjoern A. Zeeb2025-05-052-0/+0
| | | | | | | These are needed for mt76. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* mt76: update Mediatek's mt76 driverBjoern A. Zeeb2025-05-041-0/+1
| | | | | | | | This version is based on git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 38fec10eb60d687e30c8c6b5420d86e8149f7557 ( tag: v6.14 ). Sponsored by: The FreeBSD Foundation
* LinuxKPI: netdev: add NETIF_F_HW_TCBjoern A. Zeeb2025-05-041-1/+2
| | | | | | | Add a new flag needed by mt76. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: fix wiphy_info[_once]Bjoern A. Zeeb2025-05-041-2/+2
| | | | | | | | The dev field in wiphy is a pointer already; no need for &. Sponsored by: The FreeBSD Foundation MFC after: 3 days Fixes: ac1d519c01ca8
* linuxkpi: Introduce a properly typed jiffiesMark Johnston2025-04-2912-59/+61
| | | | | | | | | | | | | | | | | Now that we have a long-sized tick counter, we can migrate to using properly typed timeout parameters in various bits of the LinuxKPI. This fixes a subtle incompatibility that is otherwise difficult to paper over and leads to bugs when ticks values are sign-extended. - Introduce a "jiffies" symbol in subr_ticks.S, declared only in the LinuxKPI as an unsigned long. - Remove all references to "ticks" from the LinuxKPI. - Convert interfaces to match Linux's type signatures where it makes sense. Reviewed by: manu Tested by: bz Differential Revision: https://reviews.freebsd.org/D48523
* LinuxKPI: define time64_tBjoern A. Zeeb2025-04-271-0/+2
| | | | | | | | | | Define time64_t to int64_t for all supported architectures unconditionally. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: imp, markj, emaste Differential Revision: https://reviews.freebsd.org/D50004
* LinuxKPI: add dummy header file linux/unaligned.hBjoern A. Zeeb2025-04-271-0/+0
| | | | | | | | | Long-term asm/unaligned.h is likely to migrate to this file? Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D50003
* LinuxKPI: 802.11: add SW_MGMT_TX to the expected flags for CCMPBjoern A. Zeeb2025-04-271-1/+2
| | | | | | | | | | rtw88 sets SW_MGMT_TX on (*mo_et_key) (MFP in software which we do not yet support). Add it to the list of known reply values to avoid constant logging. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reported by: Oleg Nauman (oleg.nauman gmail.com)
* LinuxKPI: 802.11: updates to headers for driver updateBjoern A. Zeeb2025-04-243-16/+46
| | | | | | | | | | | | | Move some structs into the appropriate header to be visible. Add new fields to structs and enums. Remove arguments from two functions (one function currently unused by drivers in the tree, for the other the argument was unused). Adjust the iwlwifi accordingly. This is in preparation for new driver versions to allow a smooth transition. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: introduce mlo field to staBjoern A. Zeeb2025-04-242-0/+3
| | | | | | | | | Driver updates introduce a new field "mlo" to the sta. Add the field to the struct and initialize it in the 802.11 compat code along with a IMPROVE so once we get to 11be we can deal with it. Sponsored by: The FreeBSD Foundation MFC after: 3 days