Add ieee80211_purge_tx_queue() dummy function needed by rtw88 SDIO.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 9cac7351868d0e896a648ffe354b001ced55acfa)
Migrate most LinuxKPI 802.11 definitions for HE IEs to net80211.
During that process also properly define them as most of them only
had dummy values. Some of the definitions are sparse; that is, only
the bits used by drivers so far were listed and annotated with the
standards section.
There seems to be little point to mangle the names and have two copies
of all these bit field definitions. We can add "_S" (shift/mask)
variants to those we need in net80211 (if we do).
Sponsored by: The FreeBSD Foundation
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D50677
(cherry picked from commit 2ab7cbdc346e2a174a7bee4ce44c4f78b1ca093b)
Take the HE IE structures as they are used by drivers and put them
into net80211 rather than LinuxKPI. There is little need to
re-invent the wheel on those. They settled for long enough.
Do not export them by default to user space as some also overlap with
wpa and we still do not have a clear distinction for what is available
only in kernel and what to user space. In our case ifconfig(8)
is a consumer of these structs which it can setting WANT_NET80211 like
we have done for some VHT bits before.
Add struct net80211_he_cap which holds the IE fields but also a bool
and is meant to be put into ic/vap/ni. The bool will give us the same
naming for all layers rather than having individual flags in each part
which was highly confusing. In theory this struct should be in
ieee80211_var.h but that would pull things apart.
Extend struct ieee80211_mu_edca_param_set by a union as it will help
ifconfig(8) parsing the bk/be/vi/vo parts.
Sponsored by: The FreeBSD Foundation
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D50676
(cherry picked from commit 8be200cf968f0c7f72f75c8a73d7b2bee43f935d)
Update strutures needed for 11ax (HE) to be correct. Add references
to the standard.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 71f854e5a01a347174d09d594b3d490f806cf850)
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
(cherry picked from commit d87ee937ed852cd22eac808bc8fcf7b0e34c9ec1)
Add more structs, fields, flags, defines.
Sponsored by: The FreeBSD Foundation
Approved by: re (cperciva)
(cherry picked from commit 675e6b1c68ba71af1853952f7df4d84399340009)
(cherry picked from commit 6a0dbc0a1246c9825f0892bb6dd957f5d081057a)
The dev field in wiphy is a pointer already; no need for &.
Sponsored by: The FreeBSD Foundation
Fixes: ac1d519c01ca8
Approved by: re (cperciva)
(cherry picked from commit 845b81cf908002b14ac08ce8c42246720a5b30d9)
(cherry picked from commit a21addc7a0137c5938414df322dbf5f929729834)
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
(cherry picked from commit e6010da63903cc6d9aac0077ab861cfd6bae2aa7)
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
(cherry picked from commit 71034267d861c183297bb209770004751f0e30c5)
In addition to CCMP add TKIP and GCMP support. The others are still
TODO() until we do suport them natively.
Also refine checks for tid and narrow them down (also don't assert but
gratiously fail).
Sponsored by: The FreeBSD Foundation
(cherry picked from commit a7131a748483adf783ff7ac2a8ab71d5c17eb925)
Add IEEE80211_KEY_FLAG_BITS to be used with %b for debugging
ieee802111_key_flag bit flags. Names are a lot easier to deal
with than just numbers.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 52e39daeef8804d134e1aa76149d47c026663a61)
csa_active, color_change_active, mu_mimo_owner also moved from
vif to bss_conf; we already have the fields in bss_conf (adjust type
for one) so all we have to do is remove the old relics in vif.
Sponsored by: The FreeBSD Foundation
Tested by: Oleksandr Kryvulia (shuriku shurik.kiev.ua)
Tested by: Oleg Nauman (oleg.nauman gmail.com) [rtw88]
Differential Revision: https://reviews.freebsd.org/D49734
(cherry picked from commit 5321cf2b15d7bff1b01182cfc4897ac978c63fe7)
In preparations for MLD support chanctx_conf was moved from vif to
the bss_conf as it will be per-link later. Follow accordingly.
Sponsored by: The FreeBSD Foundation
PR: 280546
Tested by: Oleksandr Kryvulia (shuriku shurik.kiev.ua)
Tested by: Oleg Nauman (oleg.nauman gmail.com) [rtw88]
Differential Revision: https://reviews.freebsd.org/D49734
(cherry picked from commit 11604b2a1659fd6da9bbfdc6acf9758884cb2b36)
We have the same code three times, so factor it out into its own
function to make it easier to maintain.
Sponsored by: The FreeBSD Foundation
PR: 280546
Tested by: Oleksandr Kryvulia (shuriku shurik.kiev.ua)
Tested by: Oleg Nauman (oleg.nauman gmail.com) [rtw88]
Differential Revision: https://reviews.freebsd.org/D49734
(cherry picked from commit 50d826be664ef35065e8c4c4966252f2dfde9cb9)
Sort out some (though not yet all) changes needed for CONFIG_PM_SLEEP
and respectively WoWLAN support (so we can compile it in). This is
just one further step towards proper suspend/resume support.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit b42c339c59fd00f2d97f6854b17b54b340019d0c)
Define the last missing PN length and for consistency use them
in struct ieee80211_key_seq (even though a 6 is a 6 is a 6).
Sponsored by: The FreeBSD Foundation
(cherry picked from commit c8a6676eb652b59fee545dc3e24ffec21bd0cd8d)
iwlwifi was the only driver we care about which "used" cipher_scheme
and it was removed from there too. Remove given it is no longer
used anywhere.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit cdef9a9f91e2eee00e8f6f1ed743a8d8bd0bdc14)
ieee80211_sta_recalc_aggregates() shows up in TODO traces but there is
nothing we have to do there until we have active links (MLO support).
Make the TODO conditional for a time when we will get there.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 72ee3d57f31eff420948048ba3c6afdefe4aab5b)
Define cfg80211 IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK to
net80211 IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK.
We should likely at some point make a sweep and replace all the
values with the defines from the comments for the matching net80211
version.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit a6994e208cca65684d160e1795a3b9e8c0a2e0a9)
Implement cfg80211_chandef_create() to work with HT. Update enum
with HT channel types. When calling the function from LinuxKPI 802.11
code, pass in NL80211_CHAN_HT20 if HT is supported rather than NO_HT.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 11450726d3cf8d76d2113d7cabe995f8ef31ec5a)
Implement mac80211 functions ieee80211_iter_keys[_rcu](), and
ieee80211_get_key_rx_seq() (*).
Implement an internal function lkpi_sta_del_keys() to delete keys
when we are leaving RUN (AUTHORIZED) state.
Improve and make work (*) the net80211 vap function pointers
(*iv_key_set)(), (*iv_key_delete)() implementations.
Correct the logic in lkpi_80211_txq_tx_one() and factor most crypto
related bits out into lkpi_hw_crypto_prepare() (*).
(*) We are currently supporting CCMP only. I would hope we will
not have to do full WEP/TKIP support anymore given both are deprecated.
The entire logic remains behind the LKPI_80211_HW_CRYPTO pre-processor
condition and with this commit in addition behind a tunable.
The code is compiled in by default now but the tunable remains off until
wider testing has shown no problems.
I have seen one net80211 triggered panic on shutdown related to deleting
keys which I cannot reproduce anymore and could have been fixed by
9763fec11b83; otherwise we will have to investigate as it shows again.
The dedicated hw crypto tracing option can help in that case with debug
kernels.
Sponsored by: The FreeBSD Foundation
Fixes: b35f6cd066
(cherry picked from commit 11db70b6057e41b259dc2245cd893d5b19179fcc)
Implement the mac80211 (*sta_statistics) to obtain station statistics.
Fix up struct station_info for that.
Add supporting funtions to decode station_info and rate_info_bw fields
to make the output more usable to human beings.
Add a per-VIF (VAP) sysctl to export that information. This is mostly
used for now to see what the driver/fw thinks about its TX rate.
We should later gather this information in different ways and pass it
to net80211 to export it to user space so we can finally have nice
station information (also for the non-AP side).
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 408394185fe9be0c158189b7671bde316ac14ac9)
ieee80211_vif_usable_links() shows up in TODO() tracking.
Turns out the return (1) is likely wrong and should be 0 given we do
not support MLD yet. For now return the valid_links bitmap and leave
an IMPROVE as likely not all of the valid ones will be useable.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit d2407a21bd032587194dff46779862ffcd5c33d8)
For now we only return the legacy rate and have two TODOs for HT and
VHT which still need to be implemented as needed.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit a7c19b8a99a604e8940c7475220df5de7e295ffa)
Given I was looking at the struct make it more packed at the beginning
at least. In fact it did not shrink but the tx_time_est got expanded.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 470aaf42c3c0661821a8744ae7c29b096adb4aa3)
Convert a lot more LinuxKPI rx_status fields to net80211 rx_stats
bits for as much as we can see fit. Factor the entire logic out
into its own function as it got quite long.
Now only net80211 needs to start using more of these values and
report them.
Also fix some related fields and struct definitions in LinuxKPI.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 49010ba706d39fba0d8bc128d96e6122e65eb8ad)
Implement ieee80211_rate_set_vht(), ieee80211_rate_get_vht_{mcs,nss}(),
and ieee80211_get_vht_max_nss().
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 5778cbdae7616c09efa6ccdd8c611d82cbc75f00)
Add the mask and shift for the VHT Extended NSS BW Support field.
Document them in net80211 and further related bitmasks in LinuxKPI.
Sponsored by: The FreeBSD Foundation
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D48975
(cherry picked from commit 75fb66d8241d0487baf482c975c1de3b55d9a315)
Make iwlwifi compile with debugfs after the last updates and turn it on
for both iwlwifi and rtw88 in order to be able to get at least some
useful information on driver/firwmare state.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 07f6575585bf69ae48dffe87c4578057ae4782d8)
rate_lowest_index() is no longer used anywhere in our code.
Garbage collect it.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 1b840f09b6b379c0aae5a558ba5a4ed6bb571a85)
Implement the combination of all four functions, the *_vif versions
from mac80211.h as a wrapper to the non-*_vif ones in cfg80211.h.
Put the function pairs next to each other and in the right files
and harmonize argument naming, etc.
Both of them have shown up too often in the todo-tracing to bother
enough to implement them now for a time in the future when we will
support HE/EHT.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit c75a558d0729da87ee3c016b57cc8f5ac4fc65d0)
Add a print mask for use with %b to aid debugging. It is a lot easier
to read names than numbers.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit f1aeb5d850cf26418fb70a16d1304b92c45b5f1d)
This will help us to get minimally better lock coverage in iwlwifi
though not yet against the LinuxKPI implementation which will likely
switch to this in the future. At least the TODO() logging noise is
out of the way.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 95a7aa8009877ca95d81967f9af568ef832bb565)
Bring in the LinuxKPI 802.11 compat bits which are altering
the mac80211 KPI.
* In struct ieee80211_bss_conf chandef -> chanreq.
* Various struct ieee80211_ops gained a link_id arguemnt,
stop gained a suspend flag.
* Various functions gained a link_id argument.
* ieee80211_tx_status() was renamed to ieee80211_tx_status_skb()
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 7b43f4d064195bcf66816cb9fe350a1392fe24ce)
Bring ing the LinuxKPI 802.11 compat bits which are not altering
the mac80211 ops KPI.
* Add various functions for driver updates.
* Add functions (some compat code to I assume cleanup some
mac80211 ops) emulating chanctx changes doing (*config) updates.
* Adjust structs and defines.
* Deal with an enum growing more than 32 bits in printf.
* Add a mtx to struct wiphy which is exposed to the drivers.
Handle initialization and destruction for now.
* Implementation of wiphy_work and wiphy_delayed_work.
* Set was_assoc for deassoc/deauth in prep_tx_info.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit ac1d519c01ca8beb59f27962c7052d09a03f72c8)
Move some ieee8022_{is,has,get}_... functions working on header fields
from mac80211.h to ieee80211.h to avoid problems with #includes.
No functional changes.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 0b325167f60def621536632460caf68e2fab4fb8)
Upstream new defines, enum values, etc. for coming driver updates which
are non-conflicting with the current state.
The only notable change is the rename of the enum ieee80211_ap_reg_power
but the enum name had not been used so far by any driver in the tree
(only in mac80211.h) but an updated version of ath11k does use it so we
need to correct our initial naming.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit c1c989588df67396392edceb0e7e7028abc06c49)
Implement ieee80211_sn_*() using the equivalent net80211 macros.
We need those implemented for at least 11n.
While here also sort all the BA functions together next to the
"sn" functions.
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45819
(cherry picked from commit db8b3578627b5be93eba019ab2bbe3c03f7366f4)
Likely a c&p error from for_each_vif_active_link() to
for_each_sta_active_link().
We are checking the nitems on the vif instead of the sta in this macro.
Function wise there is no difference as the arrays are the same size
but for correctness fix this.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 69b6c4a6ec6654978628ccd48edce46f00ac3e96)
For iwlwifi(4) d3.c we need another struct in struct ieee80211_key_seq
and related WLAN_KEY_LEN_* defines in.
Reviewed by: cc, emaste
Differential Revision: https://reviews.freebsd.org/D43646
(cherry picked from commit 2f029bf911e29dc46c32ea142daba4f26a2078f4)
When adding the new field link_id to struct ieee80211_key_conf, it
was erroneously placed at the end of the struct; the zero-length
(variable sized) array for the key always needs to stay last.
Resort fields and add hopefully helpful comment to avoid the problem
in the future.
Fixes: adff403fe7
Reviewed by: cc
Differential Revision: https://reviews.freebsd.org/D43635
(cherry picked from commit 828ce22f079df77b3bf52c4cf296959ea66bdc11)
Implement ieee80211_handle_wake_tx_queue() and ieee80211_tx_dequeue_ni()
while looking at the code. They are needed by various wireless drivers.
Introduce an ltxq lock and protect the skbq by that.
This prevents panics due to a race between a driver upcall and
the net80211 tx downcall. While the former should be rcu protected we
cannot rely on that.
It remains questionable if we need to protect further fields there
(with a different lock?).
Also introduce a txq_mtx on the lhw which needs to be further deployed
but we need to come up with a good strategy to not end up with 7 different
locks.
Sponsored by: The FreeBSD Foundation
PR: 274178, 275710
Tested by: cc
(cherry picked from commit eac3646fcdd445297cade756630335e23e92ea13)
Fix defines and structures to use proper types.
Bring in basic ni->sta synchronization, some channel width handling,
and overload the net80211 functions so that we can talk to
driver/firmware to setup parameters. We will likely not need one
or two of those but it is good for tracing currently.
Cover HT and bits of VHT code in LinuxKPI behind apropriate #ifdef
which are currently not enabled (like LKPI_80211_HW_CRYPTO) until
confirmed to work.
Last, IEEE80211_AMPDU_RX_START made some firmware unhappy.
This will allow others to work on it and test as well.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 9fb914634eff85b3b36bcbf39c1faf2967b0aa9e)
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)
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)
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)
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