In a mixed lagg, its likely that ifcaps or hwassist may not
match between members. If this is true, the logical OR will
be short-circuited and if_hw_tsomax_update() will not be called.
Fix this by calling it inside the body of the if as well
Sponsored by: Netflix
(cherry picked from commit 78bdaa57cfbac759a6d79ecad2fae570e294a4b3)
This was recently added to Linux to improve incremental update support,
as you could previously add Allowed-IPs but not remove without replacing
the whole set (and thus, potentially disrupting existing traffic).
Removal is incredibly straightforward; we'll find it in p_aips first
to ensure that it's actually valid for this peer, then we'll delete it
from the radix tree before we remove the corresponding p_aips entry.
Reviewed by: Jason A. Donenfeld, jhb
(cherry picked from commit d15d610fac97df4fefed3f14b31dcfbdcec65bf9)
(cherry picked from commit d1ac3e245f084ee0637bde9a446687621358c418)
We'll re-use these in a future wg_aip_del() to perfectly reconstruct
what we expect to find in a_addr/a_mask.
Reviewed by: ivy, markj (both earlier version), Aaron LI, jhb
(cherry picked from commit 2475a3dab0d5c5614e303c0022a834f725e2a078)
The only difference in the wg_aip_add() call after IP validation is the
address family. Just pull that out into a variable and avoid the two
different callsites for wg_aip_add(). A future change will add a new
call for each case to remove an address from the peer, so it's nice to
avoid needing to repeat the logic for two different branches.
Reviewed by: Aaron LI, Jason A. Donenfeld, ivy, jhb, markj
(cherry picked from commit ba2607ae7dff17957d9e62ccd567ba716c168e77)
It's possible for a peer to send us a state update with an rtableid we don't
support (i.e. >= net.fibs).
Drop these updates rather than potentially crashing later by setting an invalid
fib number.
PR: 287981
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
(cherry picked from commit 4af4fefedd1bf14b5a27387075edde98744b722e)
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@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@gmail.com, cyric@mm.st
Tested by: Einar Bjarni Halldórsson <einar@isnic.is>
(cherry picked from commit 5e6e4f752833acc96f1efc893318d3f6b74b9689)
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)
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)
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)
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)
Update threshold values once we are associated.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 6e7a6a66b239180778bb31da9fa8544bbd977cde)
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
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)
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)
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)
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)
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)
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)
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)
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)
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: 8f61992d7c
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D50153
(cherry picked from commit 2c65f965146a7f822302715a439e17996d17453c)
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)
Check results of non-bool to be != 0.
No functional changes intended.
Sponsored by: The FreeBSD Foundation
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D50158
(cherry picked from commit 76b66ac45ea804f23ffb35712b0ceaa98864c06f)
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)
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)
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)
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)
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)
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)
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)
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)
Now that LinuxKPI supports the lower case Linux ACPI spellings under
LINUXKPI_WANT_LINUX_ACPI remove the #ifdef around the code and compile in
ACPI support.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 8c97c46418f9767a9984df259116da08d9659076)
Add a acpi_evaluate_dsm() wrapper around the native implementation
as needd by wireless drivers.
Sponsored by: The FreeBSD Foundation
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D50864
(cherry picked from commit ba6460df5607e572e9c868413c75ce9bc5ce9a00)
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.
Sponsored by: The FreeBSD Foundation
Reviewed by: wulf (previous version), dumbbell
Differential Revision: https://reviews.freebsd.org/D50863
(cherry picked from commit 2ddfcc013c251f13c8c9b24970b8134ddd49afea)
In order to be able to use MODULE_DEVICE_TABLE() with multiple bus
attachments, factor out the bus-specfic MODULE_PNP_INFO() and place
it next to the structure defining the table.
As it turns out bnxt(4) has been using the MODULE_DEVICE_TABLE() with
PCI attachments for the "auxillary" bus so far. That makes little sense.
Define the MODULE_PNP_INFO() to nothing for that. We may consider
pulling these LinucKPI bits in semi-native drivers into LinuxKPI
one day as that route is not really sustainabke.
Sponsored by: The FreeBSD Foundation
Reviewed by: imp, dumbbell
Differential Revision: https://reviews.freebsd.org/D51049
(cherry picked from commit 2f5666c1727c949491f73e6c3277b7b542131714)
While we currently only use MODULE_DEVICE_TABLE() for pci (or so I
thought [*]), this may soon change. Remove a hard coded "pci" for
the bus and use the bus name passed in as _bus.
[*] see follow-up change
Sponsored by: The FreeBSD Foundation
Reviewed by: imp, dumbbell
Differential Revision: https://reviews.freebsd.org/D51048
(cherry picked from commit f58e032410c93d67c83d6bce8a3e6711f377a4be)
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
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D49625
(cherry picked from commit a02180cf60a6a0102669b678e9c81ad9f1aa4d91)
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
Differential Revision: https://reviews.freebsd.org/D45294
(cherry picked from commit f99d393f7f787ff080c12b92243adcc310ac7c58)
In ieee80211_sta_join() there are currently two ways to set
"do_ht": (1) after checking HT IEs are avail, and (2) after
checking VHT IEs are avail and we are not on 2GHz.
In the latter case no one checks that HT IEs are available and
when we hit ieee80211_ht_updateparams_final() htinfo may be NULL
and we panic.
Avoid this by only checking for VHT if do_ht was set.
No VHT without HT IEs.
While here switch do_ht to be a bool.
Sponsored by: The FreeBSD Foundation
PR: 287625
Fixes: 51172f62a7
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D50923
(cherry picked from commit f51c794cbc80682931d47264e3c18329bae0a2c1)
After applying FreeBSD-SA-24:05.pf, a problem with ICMP ECHO passing
through PF NAT was raised: two or more Windows workstations cannot ping
the same destination address at the same time. More precisely, only one
workstation pings normally, while the pings of the others are rejected
by the packet filter.
The thing is that Windows always uses the same ICMP ID (1). Therefore,
the state is created only for the workstation that started pinging
earlier.
In the pf_get_sport() function, we compare *nport with the ICMP_ECHO constant,
while icmptype (virtual_type actually) is passed in the pd->ndport parameter.
MFC after: 2 weeks
Reviewed by: kp
(cherry picked from commit e7abf8829d8d496a8753946f67fb2016851b4f7c)
From the upstream pull request merges:
#17340 b144b160b Fix 2 bugs in non-raw send with encryption
Obtained from: OpenZFS
Approved by: so
Security: FreeBSD-EN-25:10.zfs
For SCTP we create states for all combinations of endpoints, to allow multihoming to work.
Malicious users could abuse this to fill our state table more easily
than they otherwise could, because we create states between all
combinations of endpoints. Limit this to no more than 8 extra endpoints
for each side of the connection.
MFC after: 2 weeks
Sponsored by: Orange Business Services
(cherry picked from commit cd0169c9379c400ec75b77e87ca770e37f964276)
Otherwise we can end up with a lost interrupt, causing lost request
completion wakeups and hangs in the filesystem layer.
Continue processing until we enable interrupts and then observe an empty
queue, like other virtio drivers do.
Sponsored by: Klara, Inc.
This prevents a potential race that the ioctl threads see NULL or
uninitialized buckets.
Reviewed by: kp
Fixes: 4fc65bcbe3 pfsync: Performance improvement
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D51064
(cherry picked from commit edc307eca9a9a9b0ce7445cff513b48f6489e5c6)
So that the associated data with them will be freed.
Reviewed by: kp
Fixes: 4fc65bcbe3 pfsync: Performance improvement
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D51063
(cherry picked from commit 8213c07c20586a67bc7f7152bd7ff76c02cbc007)