bnxt: Fix BASE-T, 40G AOC, 1G-CX, autoneg and unknown media lists
This was broken in c63d67e137f3, the early returns prevent building the
media lists as expected.
The BASE-T parts of the patch were suggested by "cyric at mm.st", while I
am adding the additional 40G AOC, 1CX, autoneg and unknown PHY fixes
based on code inspection. There may be additional work left here for
Broadcom but this is certainly better than the returns.
PR: 287395
Reported by: mickael.maillot at gmail.com, cyric at mm.st
Tested by: Einar Bjarni Halldórsson <einar at isnic.is>
(cherry picked from commit 5e6e4f752833acc96f1efc893318d3f6b74b9689)
bnxt: add guards around struct_group macros
The header file might be included after linux/stddef.h or others are
included and the macros would be re-defined.
Sponsored by: The FreeBSD Foundation
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D50156
(cherry picked from commit 152e6197615570e7a2f5f1c6c2ed00ecee9dd10c)
LinuxKPI: 802.11: switch to m_get3()
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
Discovered by: adrian with rtwn(4) [see D50049].
(cherry picked from commit 02382a0ac822b88e17d86643e27964eba18479e0)
LinuxKPI: 802.11: add support for GCMP hw crypto offload
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
(cherry picked from commit 29ddd583693aced69be48b545e1c7e7249bdfb9c)
LinuxKPI: 802.11: improve queue locking
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
(cherry picked from commit bc24342d96aa816b448bec4d32b1f5e4a5793886)
LinuxKPI: 802.11; update frag_threshold and rts_threshold
Update threshold values once we are associated.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 6e7a6a66b239180778bb31da9fa8544bbd977cde)
LinuxKPI: 802.11: cast jiffies to unsigned long
The joffoes changes are not (yet) merged if they will be. In order to
not break a possible future MFC of them, cast jiffies to unsigned long
already. They are only used in logging/debugging here.
Sponsored by: The FreeBSD Foundation
Fixes: dcc99bf830b2
LinuxKPI: 802.11: place lock asserts for key operation
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
(cherry picked from commit 284af342971d102702df950a2f1e5479eaabdf0b)
LinuxKPI: 802.11: WEP noise
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
(cherry picked from commit aaee0ed3d163a1d29ea74d7e4d2c3658a51cfb27)
LinuxKPI: 802.11: adjust logging for key handling
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
(cherry picked from commit 80386ed954aaa33b849877e8a86918de9365a087)
LinuxKPI: 802.11: move rx_nss check to be at least 1 into sync function
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
(cherry picked from commit 34c150cc5fdb3c599bb6ff14eb56afee00c45258)
LinuxKPI: 802.11: ensure bandwidth <= channel bandwidth
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
(cherry picked from commit 9df0d1f3d1f3dd8823800210dd49e40170d5abd8)
LinuxKPI: 802.11: make synching from HT more resilient
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
(cherry picked from commit 58dae28f665b32650f452730378693de40e96d68)
LinuxKPI: 802.11: fix lkpi_scan_ies_add() channel lookup
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
(cherry picked from commit f1a110f1f0f2ef83758f7d0a984b14f512ea00fd)
LinuxKPI: 802.11: stop queues during key updates
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
(cherry picked from commit db480c29879cac1afba1d887d7b8871aa4eef6db)
LinuxKPI: dummy: add more dummy hreader files
These are needed for mt76.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit e8e2ed66f0978c439c7e93ff3d30a86ffad5bf56)
LinuxKPI: pci: fix two errors in lkpi_pci_get_device()
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
Fixes: 8f61992d7cc11
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D50153
[2 lines not shown]
LinuxKPI: pci: deal with kobject_add() being able to fail
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
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D50154
(cherry picked from commit 96e86aa6faa6fde4ff75fd757db55afe9e4be132)
LinuxKPI: skbuff: make csum_unfold return __wsum
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
Fixes: 59481c7db234
(cherry picked from commit 36ca21722c2700e00e41444a29aeabf246eea90d)
LinuxKPI: skbuff: add dummy skb_copy_header()
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
(cherry picked from commit 84c5998ccb0b3e8a401d1f2b5a32649e88847d63)
LinuxKPI: add struct_group_tagged()
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
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D50157
(cherry picked from commit 54d0e1772fb6b83d72725764e0a5d3ead8337673)
LinuxKPI: add ktime_get_boottime_seconds()
ktime_get_boottime_seconds() is needed by an updated iwlwifi driver.
Sposored by: The FreeBSD Foundation
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D50005
(cherry picked from commit 93b82146c43b8ecad4fd7694ec1daf6d79cca65c)
LinuxKPI: add is_unicast_ether_addr()
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]
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D50152
(cherry picked from commit a4618caa43c16e6e672c27dac1943fd833f8bd8f)
LinuxKPI: add _devcd_free_sgtable() to devcoredump.h
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
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D50006
(cherry picked from commit 71576ed24b56143429a3b6774a7862965c2dea88)
LinuxKPI: netdev features style, annotate, and add %b decoding mask
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
(cherry picked from commit 4b6b9c1368b346f7093153d14e7931403ac3202d)
LinuxKPI: netdev: add NETIF_F_HW_TC
Add a new flag needed by mt76.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 9c05d6320cc091ffb43002a149c04c122ccb798c)
iwlwifi: compile in ACPI support
Now that LinuxKPI supports the lower case Linux ACPI spellings under
LINUXKPI_WANT_LINUX_ACPI we only need to provide the debug macro to
allow us to compile in ACPI support.
This ties into regulatory and will be used, e.g., for 11ax, 11be,
and Per Platform Antenna Gain (PPAG) settings.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 228b43c258d24c293b135ae94c120e7ccf0a7aea)
LinuxKPI: acpi: provide union [linuxkpi]_acpi_(object|buffer)
Provide union acpi_(object|buffer) as linuxkpi_ versions and in Linux
native lower case spelling so that driver code compiles unmodified.
Use the linuxkpi_ prefix to avoid name clashes with the native ACPI
implementation which uses CamelCase.
Use the linuxkpi_ names internally and redefine the linuxkpi_ unions
to their native names so they are avail as expected in drivers.
As a transition to not break drm-kmod which has in-place (no #ifdef)
changes from Linux spelling ot FreeBSD spelling, introduce
LINUXKPI_WANT_LINUX_ACPI so we have the Linux spelling as an opt-in.
That way the transition can happen gracefully and once "top-of-trees"
are all sorted we can remove the #ifdefs here again.
Bump __FreeBSD_version to be able to detect this change.
[5 lines not shown]