Commit graph

1388 commits

Author SHA1 Message Date
Bjoern A. Zeeb
7019af0394 net80211: migrate ic_vhtcaps, ic_vht_mcsinfo, ic_flags_vht
Like for the VAP rename ic_flags_vht to ic_vht_flags for consistency to
keep "VHT" fields together and merge ic_vhtcaps and ic_vht_mcsinfo
into struct ieee80211_vht_cap ic_vht_cap.

While the structure layout changes no other functional changes intended.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	adrian, cc
Differential Revision: https://reviews.freebsd.org/D42421

(cherry picked from commit 562adbe1d354377a260e66eedb6072b720a606dc)
2023-11-30 00:36:58 +00:00
Bjoern A. Zeeb
bf0d632e48 LinuxKPI: 802.11: zero-pad debug flags
Write the debug flags as full 32bit hex numbers to have a better
view on them.

No functional changes.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	cc, emaste
Differential Revision: https://reviews.freebsd.org/D42426

(cherry picked from commit 8895b47638ea4d7a13fba97afe8cd9faacfdda83)
2023-11-30 00:36:58 +00:00
Bjoern A. Zeeb
861bf0606a LinuxKPI: 802.11: deal with scan_ie_len
We only need to reserve the extra space for DSSS if
NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES is set, so add the conditional.
Also add checks in case scan_ie_len will grow beyond the maximum.
Given this is currently unlikely, leave the cleanup for later as
some other restructuring should be done first.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	cc
Differential Revision: https://reviews.freebsd.org/D42425

(cherry picked from commit 78ca45df310563ca46448a124674e0542aab2e31)
2023-11-30 00:36:57 +00:00
Bjoern A. Zeeb
d425c3c640 LinuxKPI: 802.11: fix ieee80211_add_channel_cbw() argument
Fix the last argument passed to ieee80211_add_channel_cbw() in
lkpi_ic_getradiocaps() for both 2Ghz and 5Ghz bands.
We passed in the unmodified version rather than the adjusted version
based on the per-band channel information possibly leaving
ieee80211_channel_flags enabled which should not be.

So far this should not have made a difference given we did not enable
HT or VHT.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	cc
Differential Revision: https://reviews.freebsd.org/D42424

(cherry picked from commit 5856761fd5f675c3871a82effdbf714a1d1bcc5e)
2023-11-30 00:36:57 +00:00
Bjoern A. Zeeb
1d2f963afd LinuxKPI: 802.11: error on state transition failure
The state transition failures we were seeing in the early days are
solved.  If we now experience one stop processing before passing
over to net80211 (sta_newstate()) and before updating iv_state on
the vap.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	cc
Differential Revision: https://reviews.freebsd.org/D42423

(cherry picked from commit 45c27ad5241f5491234afd0b47d13b8005fdb4de)
2023-11-30 00:36:57 +00:00
Bjoern A. Zeeb
c0398e3323 LinuxKPI: 802.11: add unconditional error reporting
Multiple reports have shown missed state transitions in net80211 without
major cause obvious (or with a txq warning in iwlwifi).
In order to better track down potential problems add unconditional
ic_printf calls to any case in the lkpi state machine compat code which
would let us return with an error in the hope that it helps us to catch
the actual problems.
Also remove the debug conditions from ieee80211_{beacon,connection}_loss
which can also cause state transitions to have the ic_printf all the time
there too.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 018d93ece16bd33077021383940d0da5121f0691)
2023-11-30 00:36:57 +00:00
Olivier Certner
f946a5ec96 linuxkpi: dma_get_cache_alignment(): Fix off-by-one result
Substituting 'uma_align_cache' by the appropriately named accessor
uma_get_cache_align_mask() made apparent that dma_get_cache_alignment()
was off by one, since it was defined to be the mask derived from the
alignment value.

Reviewed by:            markj, bz
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D42264

(cherry picked from commit 2c7dd66d09a1b92a4698232996cded6e5315b3bd)
2023-11-16 10:07:18 -05:00
Olivier Certner
4587326893 uma: Hide 'uma_align_cache'; Create/rename accessors
Create the uma_get_cache_align_mask() accessor and put it in a separate
private header so as to minimize namespace pollution in header/source
files that need only this function and not the whole 'uma.h' header.

Make sure the accessors have '_mask' as a suffix, so that callers are
aware that the real alignment is the power of two that is the mask plus
one.  Rename the stem to something more explicit.  Rename
uma_set_cache_align_mask()'s single parameter to 'mask'.

Hide 'uma_align_cache' to ensure that it cannot be set in any other way
then by a call to uma_set_cache_align_mask(), which will perform sanity
checks in a further commit.  While here, rename it to
'uma_cache_align_mask'.

This is also in preparation for some further changes, such as improving
the sanity checks, eliminating internal resolving of UMA_ALIGN_CACHE and
changing the type of the 'uma_cache_align_mask' variable.

Reviewed by:            markj, kib
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D42258

(cherry picked from commit dc8f7692fd1de628814f4eaf4a233dccf4c92199)
2023-11-16 10:07:07 -05:00
Konstantin Belousov
dbec48131f linuxkpi linux_work: use 'true' instead of 'non-zero'
(cherry picked from commit 96cb1d70008e6d42750e95135316cafd6899384f)
2023-11-14 00:29:30 +02:00
Konstantin Belousov
f15252b4fa linuxkpi: races between linux_queue_delayed_work_on() and linux_cancel_delayed_work_sync()
(cherry picked from commit 05fe82455f263ad107a860ce20dd89e1a5c1619c)
2023-11-14 00:29:30 +02:00
Mark Johnston
501e1152d2 linuxkpi: Fix an assertion in linux_free_kmem()
In the LinuxKPI, PAGE_MASK is the logical negation of FreeBSD's
PAGE_MASK, so the original assertion was simply incorrect.

Reported by:	trasz
Tested by:	trasz
Fixes:		6223d0b67af9 ("linuxkpi: Handle direct-mapped addresses in linux_free_kmem()")

(cherry picked from commit f88bd1174aab1aff7fea7241ab6e103e769d2d7a)
2023-10-24 09:20:12 -04:00
Mark Johnston
4862eb8604 linuxkpi: Handle direct-mapped addresses in linux_free_kmem()
See the analysis in PR 271333.  It is possible for driver code to
allocate a page, store its address as returned by page_address(), then
call free_page() on that address.  On most systems that'll result in the
LinuxKPI calling kmem_free() with a direct-mapped address, which is not
legal.

Fix the problem by making linux_free_kmem() check the address to see
whether it's direct-mapped or not, and handling it appropriately.

PR:		271333, 274515
Reviewed by:	hselasky, bz
Tested by:	trasz
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40028

(cherry picked from commit 6223d0b67af923f53d962a9bf594dc37004dffe8)
2023-10-24 09:20:01 -04:00
Bjoern A. Zeeb
5b9404565f LinuxKPI: 802.11: hide txq debugging behind checks
Two txq debug messages were left unconditionally.  Hide them behind
ifdef/if() condition checks for selective debugging only.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 0d2cb6a6ecde3b271ede59d77801cb43a8804688)
2023-10-06 12:47:40 +00:00
Bjoern A. Zeeb
4e26de2643 LinuxKPI: 802.11: fix problem removing sta
Move the call to lkpi_disassoc() before the state change to
IEEE80211_STA_NOTEXIST which will remove the sta (from firmware).
Based on a comment it seems that originally we had to do it the
other way round.
iwlwifi(4) has a check and will silently not remove the sta from
the firmware when vif->cfg.assoc is still set (see iwl_mvm_sta_del()).
This leads to the LinuxKPI 802.11 code thinking the sta is gone as
downward state changes by the mac80211 op (*sta_state)() may not fail.
Once we try to assoc with a newly added station later, iwlwifi firmware
will run into an assert having two ap_sta set on the same vif.
We can observe that problem in iwlwifi(4) having __le32 sta_id = 1
instead of sta_id = 0 in iwl_mvm_sta_cfg_cmd{} on the HCMD.

This should fix one of the most seen problems with iwlwifi(4), e.g.,
when running service netif restart wlan0 or
service wpa_supplicant restart wlan0.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 16e688b2a403a3dbc05de3b9f8a3132838613790)
2023-10-06 12:47:40 +00:00
Bjoern A. Zeeb
b6628a233e LinuxKPI: 802.11: move ieee80211_chanctx_conf into lkpi private struct
Factor out ieee80211_chanctx_conf into struct lkpi_chanctx in order to
keep local state as well.  In first instance that is added_to_drv
only.  For now we stay single-chanctx only but this paves the path
to make it a list.
Use the new information to implement ieee80211_iter_chan_contexts_atomic().

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit c5e257985085bd987b1dddffd0455c2230df2d1d)
2023-10-06 12:47:40 +00:00
Bjoern A. Zeeb
c18ead9cb2 LinuxKPI: 802.11: setup a default link[0] and adjust related needs
Setup more link_conf/deflink fields for vif/sta as are needed to allow
us to work with the KPI bits in a non-MLO configuration.
In lkpi_sta_scan_to_auth() set the bss_conf values before calling into
the driver for chanctx setup/updates as certain values (e.g., beacon_int)
need to be set before; we still call the MO function for the updates
after to keep the expected workflow.
Deal with the (to be dealt with otherwise later) net80211 ni swaps and
update the addresses on the deflink as well as otherwise firmware will
hit asserts or things will not work (e.g. indicating the peer is us).

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 6ffb7bd469b26f2ff6cc62cedca6ffe884076196)
2023-10-06 12:47:40 +00:00
Bjoern A. Zeeb
68e1e25baf LinuxKPI: 802.11: inialize tx queue params
When adding a VAP (vif) initialize its tx queue parameters calling
mo_conf_tx().
I could not spot net80211 providing some of the values needed before
having a node so currrently we use hard-coded values with a comment
with a reference on how to properly calculate the values in the future
(e.g., in case of 11b or other cases).

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit a6042e17c8999c4965bd4d762c4564b322f1ae7b)
2023-10-06 12:47:40 +00:00
Bjoern A. Zeeb
7537300876 LinuxKPI: 802.11: change ic_parent() to not call mo_stop()/mo_start()
Driven by net80211 we may call mac80211 ops stop() and start() mostly
when toggling a first VAP.  While this is FreeBSD behaviour the firmware
based LinuxKPI drivers seem to possibly clear state in the case of stop()
triggering further errors down the line.
We call mo_start() when starting the VAP and mo_stop() when destroying
it now only.  In the future (e.g., in multi-VAP setups) we may need to
re-address some of this so keep the code under #ifdef.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 8d58a0578635dc7dd1025ab08b0479f2b383e1a4)
2023-10-06 12:47:40 +00:00
Bjoern A. Zeeb
8614ae463a LinuxKPI: 802.11: adjust code to new structure layout
With past commits new structures were added.  Now switch over some
bss_conf fields into vif->cfg where they got moved to and remove the
old fields.  This allows drivers to find the expected values in the
now expected places and work better.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 616e13301bcf274b007f84ef99ea857a55bef46d)
2023-10-06 12:47:39 +00:00
Bjoern A. Zeeb
ad79da1b1a LinuxKPI: 802.11: mac80211 ops: distinguish between {bss,link}_info_changed
With MLO and multi-link setups if avail we want to call link_info_changed
whereas for legacy drivers we still need to call bss_info_changed.
While we currently do not (yet) support multi-link configurations
we still need to drive the correct commands to satisfy firmware
requirements.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 727f88f2617acaff4ada0f3dda6ca23c6679310d)
2023-10-06 12:47:39 +00:00
Bjoern A. Zeeb
be5f1d2e71 LinuxKPI: 802.11: pass non-0/NULL arguments to MO functions
In [1] we updated the KPI for various mac80211 ops functions to deal
with MLD code.  Newer iwlwifi driver and firmware supports these
functions so we need to pass non-dummy (0, NULL) arguments to them.
Start extending the internel MO functions by these arguments and
pass down values from LinuxKPI 802.11 code.
It is assumed that further work will be needed to have all the
right fields available to at least work in the lgeacy way of a
single link.

Sponsored by:	The FreeBSD Foundation
Improves:	549198b1ab (update mac80211 KPI) [1]

(cherry picked from commit 6854154638a2c04ab59da43aedbe2c0ee8ef71a5)
2023-10-06 12:47:39 +00:00
Bjoern A. Zeeb
82782cffea LinuxKPI: 802.11: prepare for iwlwifi driver updates
Update ieee80211_request_smps() to the new number of arguments in
LinuxKPI (which was already prepared) and update the one call in the
older iwlwifi driver version.
This will allow iwlwifi as-is now and rtw88 to compile in case someone
else wants to work on the latter in parallel to predominant efforts on
the former.

Unconditionally enable the other changes for newer drivers, as needed by
iwlwifi (and others).

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 815b7436a7c6302365b6514194d27d41cb736227)
(cherry picked from commit 3e1f5cc9a81a6065ddc371eea5755b4e207d72f8)
2023-10-06 12:47:39 +00:00
Austin Shafer
2709483a72 linuxkpi: fix iteration in __sg_alloc_table_from_pages
Commit 3f686532c9 tried to fix an issue with not properly starting
at the first page in the sg list to prevent a panic. This worked but
with the side effect of incrementing "s" during the final iteration
causing it to be NULL since the list had ended.
In cases non-DEBUG kernels this causes a panic with drm-5.15, since
"s" is NULL when we later pass it to sg_mark_end().
This change decouples the iteration sg from the return value so that
it is never incremented past the final page in the chain.

Reviewed by:	manu
Differential Revision: https://reviews.freebsd.org/D41574

(cherry picked from commit 09b0401e91a92bcb58ea1873857b42f8211f660f)
2023-10-06 12:47:39 +00:00
Bjoern A. Zeeb
a3e10c2b14 LinuxKPI: 802.11: fill regulatory_hint() with some life
Start implementing regulatory_hint() using a .c file based allocation
helper function so we could change structures in the future with
better chances to keep compatibility.
This sets wiphy->regd needed by various LinuxKPI based WiFi drivers.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 673d62fc359b0cb7a70af42c36d2fa54fb29452a)
2023-10-04 15:19:19 +00:00
Bjoern A. Zeeb
70e2b1f49c LinuxKPI: 802.11: avoid symbol clash on UP to AC mapping
tid_to_mac80211_ac is an exported symbol in and likely based on iwlwifi,
which leads to a symbol clash in NetBSD.  Rename our local LinuxKPI copy
to a better name and add a comment where to find a copy of the mapping
table.

Sponsored by:	The FreeBSD Foundation
Reported by:	Phil Nelson (phil netbsd org)

(cherry picked from commit fb3c249ed93c834d70f8361215bc40a9e9004d3b)
2023-10-04 15:19:19 +00:00
Bjoern A. Zeeb
53ef38313a LinuxKPI: 802.11: improve lkpi_ic_vap_delete()
Changing the order of cleanup in lkpi_ic_vap_delete() will avoid
firmware crashes or a direct panic as observed as ieee80211_vap_detach()
will do most cleanup for us and get us into the correct state.

Calling mo_stop() in lkpi_ic_vap_delete() seems to stop the problem
that further VAPs could not be created (error 17) after the first one
being destroyed.

Sponsored by:	The FreeBSD Foundation
PR: 		269842

(cherry picked from commit dbf7691999abe501e0ebc0fe4d8d9e97718d3890)
(cherry picked from commit 6c38c6b1b917957d420902213f318bf0153214f2)
2023-10-04 15:19:18 +00:00
Bjoern A. Zeeb
96655d8a7d LinuxKPI: 802.11: fix counting the number of supbands
While the main purpose was to assign an(y) early chandef with the
loop, later additions made use of it to also count supbands as well
as to initialise max_rates.
Due to the main goal we can exit the loop early and not properly
count and initialise supbands and max_rates.
Move the terminating condition into the loop and make it a continue
rather than ending the loop.

Fixes:		d9945d7821 ("improve hw_scan")
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit f454a4a10dc027474a85269cb4a3f50bbbf90528)
2023-10-04 15:19:18 +00:00
Bjoern A. Zeeb
204fb7d853 LinuxKPI: 802.11: make sure bssid for scans (probe_req) is set
In b0f7376822 we added bssid[] to struct cfg80211_scan_request
likely while working on mt76 and did not need it (yet) back then.
iwlwifi started to use the field in Linux f1fec51cda70f (April 2023).
Without it set firmware crashes when trying to send probe requests
((empty) SSID also given to hw_scan).
For now always set the field to the wildcard BSSID.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit e1e90be05017c335862c938fd9d577e56f02af30)
2023-10-04 15:19:18 +00:00
Bjoern A. Zeeb
46e5d2b0c6 LinuxKPI: skbuff: remove assumption about mac_header
It seems the mac_header can be set to offset 0 for frames received.
Remove the warning splattering messages to the console for each packet.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit f0e59b6903c881859d7f4eaf269b2336b774c7bc)
2023-10-04 15:19:18 +00:00
Emmanuel Vadot
15314c51e8 kern: Globally define abs64
So we can use it in non-linuxkpi sources.

Reviewed by:	emaste, mmel
Differential Revision:	https://reviews.freebsd.org/D41767
Sponsored by:	Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 229c65a83fbe0ede8c617e35d8f8c14d5ebadc19)
2023-09-18 21:13:45 +00:00
Bjoern A. Zeeb
cbb3ec2523 mt76: update driver from upstream
This is a set of updates of the mt76 driver based on wireless-testing
(wt-2023-05-11) 711dca0ca3d77414f8f346e564e9c8640147f40d (after v6.4-rc1),
  This adds support for mt7996 as well.
(wt-2023-06-09) 7bd20e011626ccc3ad53e57873452b1716fcfaaa (after v6.4-rc5),
(wt-2023-07-24) 62e409149b62a285e89018e49b2e115757fb9022 (after v6.5-rc3),
(wt-2023-08-06) 2a220a15be657a24868368892e3e2caba2115283 (after v6.5-rc4).

The current version of LinuxKPI lacks support for "page pool" which
needs enhancing and updating a decade or so old shortcut mapping
struct page directly to struct vm_page.

MFC after:	20 days
2023-08-21 01:34:03 +00:00
Bjoern A. Zeeb
adff403fe7 LinuxKPI: 802.11: update compat code for updated drivers
Adjust and add structs, fields, functions to make more modern versions
of LinuxKPI based wireless drivers (based on wireless-testing (
wt-2023-06-09, wt-2023-07-24, and later)) compile.

Some of these changes can only be applied once all drivers get
updated to not break the old versions currently in the tree.
Mark those changes with __FOR_LATER_DRV_UPDATE for now and flip the
switch at a later point.

Sponsored by:	The FreeBSD Foundation
MFC after:	20 days
2023-08-21 00:39:57 +00:00
Bjoern A. Zeeb
e039b38d46 LinuxKPI: skbuff: add skb_cow_head()
Add dummy implementation of skb_cow_head().

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
2023-08-19 04:55:56 +00:00
Bjoern A. Zeeb
149c457de1 LinuxKPI: skbuff: fix tracing
Fix arguments to a trace line and remove another trace line until we
actually will have the skb to trace along with a future implementation.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
2023-08-19 04:53:00 +00:00
Doug Moore
b6a61d6836 linuxkpi math: fix kassert in math64.h
Include <sys/systm.h> in math64.h, so that KASSERT and bool are
defined, to allow compilation to succeed after
b80ea45237 and dabbbebcb0f5...
2023-08-18 00:31:03 -05:00
Kyle Evans
dabbbebcb0 linuxkpi: fix buildkernel after b80ea45237
Unbalanced parentheses broke the build; re-balance.

Fixes:	b80ea45237 ("LinuxKPI: implement mul_u64_u64_div_u64()")
2023-08-18 00:12:37 -05:00
Bjoern A. Zeeb
b80ea45237 LinuxKPI: implement mul_u64_u64_div_u64()
Implement mul_u64_u64_div_u64() for an updated iwlwifi driver (though
we do not yet use it there; it is used for in-kernel ptp on wifi).

Sponsored by:	The FreeBSD Foundation
Submitted by:	cperciva
MFC after:	10 days
Reviewed by:	cperciva, dwmalone
Differential Revision: https://reviews.freebsd.org/D40120
2023-08-18 01:20:39 +00:00
Warner Losh
685dc743dc sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:36 -06:00
Warner Losh
71625ec9ad sys: Remove $FreeBSD$: one-line .c comment pattern
Remove /^/[*/]\s*\$FreeBSD\$.*\n/
2023-08-16 11:54:24 -06:00
Warner Losh
95ee2897e9 sys: Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-08-16 11:54:11 -06:00
Bjoern A. Zeeb
517e0978db LinuxKPI: add page pool skeleton
Add the page pool skeleton based on a wireless driver.  We have to
sort out some struct page problems first before we can start
implementing this but that should happen independent of all other
changes.

MFC after:	10 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D40250
2023-08-10 00:05:48 +00:00
Bjoern A. Zeeb
dcb0c54968 LinuxKPI: replace vtophys+PHYS_TO_VM_PAGE with virt_to_page
Rather than using the FreeBSD internal calls vtophys() and
PHYS_TO_VM_PAGE() use the already existing LinuxKPI abstraction for
this called virt_to_page().  This reduces the amount of compat code
to maintain and will allow further work on struct [vm_]page.

This should be a NOP.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D41257
2023-08-07 00:58:21 +00:00
Bjoern A. Zeeb
d1ea07642c LinuxKPI: cleanup internal calls to VM_PAGE_TO_PHYS
Replace FreeBSD native VM_PAGE_TO_PHYS() calls with page_to_phys()
allowing us to work on a struct page in the future using the one
single public Linux KPI interface to map to a native FreeBSD vm_page.

This should be a NOP.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D41256
2023-08-07 00:57:42 +00:00
Bjoern A. Zeeb
9e9c682ff3 LinuxKPI: reduce usage of struct vm_page and vm_page_t
We currently define (Linux) page to (FreeBSD) vm_page.
Cleanup some of the direct struct vm_page and vm_page_t declarations
and usages in the Linux KPI and make them 'struct page' or
'struct page *' to prepare for more upcoming work.

This should be a NOP.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D41255
2023-08-07 00:55:30 +00:00
Bjoern A. Zeeb
f74c09f3ec LinuxKPI: pci.h add more constants
Add two more PCI_EXP_LNKSTA_CLS constants to the compat defines
needed by wireless drivers.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
Reviewed by:	manu, emaste
Differential Revision: https://reviews.freebsd.org/D41258
2023-08-07 00:54:03 +00:00
Bjoern A. Zeeb
1dcd1a5392 LinuxKPI: implement get_random_u32_inclusive()
Implementation of get_random_u32_inclusive().
This is needed by an update for wireless drivers.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
Differential Revision: https://reviews.freebsd.org/D40121
2023-08-07 00:52:41 +00:00
Bjoern A. Zeeb
1b18fb7faa LinuxKPI: list.h add list_count_nodes()
Implement list_count_nodes() using a simple loop.  This is needed by
an updated wireless driver.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D40757
2023-06-28 01:32:29 +00:00
Bjoern A. Zeeb
08bc2cc4c4 LinuxKPI: cast jiffies_to_msecs() result
jiffies_to_msecs() is expected to return an uint_t.  In order to avoid
changing printf format strings, properly cast the result to the
expected type.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D40486
2023-06-26 07:54:24 +00:00
Corvin Köhne
740d76544a
linuxkpi: advance platform_device
These are required by some linux driver like:
https://github.com/beckhoff/bbapi

Reviewed by:		manu
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D39554
2023-06-13 09:49:01 +02:00
Bjoern A. Zeeb
51117ed116 LinuxKPI: 802.11: correct HE_MAC_CAP3 values
While we had assigned dummy values so far to HE, correct the HW_MAC_CAP3
values to avoid compile time errors of drivers when shifting values out
of range.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
2023-06-10 23:06:14 +00:00