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 69b6c4a6ec)
In case of LKPI_80211_HW_CRYPTO we convert from LinuxKPI cipher_suites
to net80211 ic_cryptocaps fields. For WLAN_CIPHER_SUITE_CCMP we
accidentally returned the bit number instead of the shifted value
which leads to ieee80211_crypto_newkey() setting IEEE80211_KEY_SWCRYPT,
which in turned lead to us trying to decode the frame again despite
HW had already done it. This was found out of a discussion in D43634.
Reviewed by: cc, adrian
Differential Revision: https://reviews.freebsd.org/D44208
(cherry picked from commit 906521f817)
Add the SET_SYSTEM_SLEEP_PM_OPS() by factoring some other macro code
out in order to set the suspend/resume functions when the struct is
already given. Such is the case in iwlwifi d3.
Also add an initial implementation of device_can_wakeup(). Though
this is likely all we need we have no way of setting the flag for it
yet so leave a pr_debug() and a comment there as well. Until we want
to support WoWLAN this is likely not needed for wireless.
Doing it the proper way checking a bool in 'struct dev_pm_info' would
change 'struct device' and with that 'struct pci_dev' and break the
KBI. In favour of mergeability this version does not implement the
full functionality yet.
Both help to make an updated iwlwifi d3 compile.
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45358
(cherry picked from commit 3753988c5d)
Sponsored by: The FreeBSD Foundation
Reviewed by: emaste (earlier version, found another two)
Differential Revision: https://reviews.freebsd.org/D45386
(cherry picked from commit ecd1d1f1da)
Add FIELD_PREP_CONST() like FIELD_PREP() without any extra checks likely
expected on this version in Linux. This is called by an updated wireless
driver.
Sposnored by: The FreeBSD Foundation
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D45180
(cherry picked from commit bb025df257)
Add kvmemdup() as a variant of kmemdup(). While currently it could
just call kmemdup() we duplicate the code and use kvmalloc() in case
someone will change the implementation of kvmalloc/kvfree in slab.h.
This is used by an updated wireless driver.
Sponsored by: The FreeBSD Foundation
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D45181
(cherry picked from commit 8e4b8e9d80)
Add checks for __counted_by(_x) and __nonstring as and depending
on compiler support enable the attribute/feature.
This is needed to make mtk76 and ath1xk drivers compile.
Sposnored by: The FreeBSD Foundation
Reviewed by: emaste, dim
Differential Revision: https://reviews.freebsd.org/D44587
(cherry picked from commit 2a8c50592f)
mt76 calls devm_kfree() directly, so alias it to our
lkpi_devm_kmalloc_release() function.
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44589
(cherry picked from commit 170c2e0e2b)
A newer version of iwlwifi requires a return value from napi_schedule();
unclear if the function always should have been bool. Add the bool to test
based on the napi_schedule_prep() result.
Also add napi_is_scheduled() for rtw89.
Sponsored by: The FreeBSD Foundation
Reviewed by: emaste (previous version)
Differential Revision: https://reviews.freebsd.org/D44591
(cherry picked from commit 21761f2ede)
Implement skb_queue_splice_tail_init() and SKB_DATA_ALIGN() as
needed by the mt76 wireless driver.
Sponsord by: The FreeBD Foundation
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D44590
(cherry picked from commit 3d3ec17825)
Add dev_alloc_pages() though it seems a weird KPI, not passing a dev
despite its name. Used by updated wireless driver.
Sponsored by: The FreeBSD Foundation
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D44588
(cherry picked from commit 738c02ba24)
Just like BITS_TO_LONG() ... used in rtw89.
Sponsored by: The FreeBSD Foundation
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D44603
(cherry picked from commit f674f016c0)
AMPDU_RX was added as a second AMPDU_TX, LDPC_TX and LDPC_RX missing;
correct and add missing.
Makes ddb output (and other debugging) look more correct.
Sponsored by: The FreeBSD Foundation
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D45505
(cherry picked from commit 5bbf4b6291)
First run the KASSERT before trying to do the free operation.
Better for reporting and debugging.
Add a guard setting the value to NULL afterwards. NULL pointers
are a lot easier to test for.
Reviewed by: cc
Differential Revision: https://reviews.freebsd.org/D43751
(cherry picked from commit cd9fee3d2c)
pkg_add has been gone since 2013(?). Refer to pkg(8) instead.
Sponsored by: The FreeBSD Foundation
Reviewed by: jrtc27
Differential Revision: https://reviews.freebsd.org/D44946
(cherry picked from commit ad31d47642)
The timeout array in struct pf_rule has PFTM_OLD_MAX entries, the one in
struct pf_krule has PFTM_MAX entries (and PFTM_MAX > PFTM_OLD_MAX).
Use the smaller of the sizes when copying.
Reported by: CheriBSD
MFC after: 1 week
Event: Kitchener-Waterloo Hackathon 202406
(cherry picked from commit 4779b16fa6)
A number of tests create a bridge, but did not check if if_bridge.ko is loaded.
We usually get away with that, because `ifconfig bridge create` autoloads the
module, but if we run the tests in a jail (e.g. because of kyua's upcoming
execenv.jail.params feature) we can't load the module and these tests can fail.
Check if the module is loaded, skip the test if it is not.
Reviewed by: markj
MFC after: 1 week
Event: Kitchener-Waterloo Hackathon 202406
Differential Revision: https://reviews.freebsd.org/D45487
(cherry picked from commit 480ad40553)
With multiple flags passed in, e.g., CTLFLAG_RD | CTLFLAG_CAPRD, due to
the precedence rules, this will result in false positive assertion. Fix
that by surrounding the replacement lists with parentheses.
Reviewed by: imp, erj
Fixes: 10a1e981d4 iflib: mark isc_driver_version as constant
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D45531
(cherry picked from commit 23f4131ad6)
(cherry picked from commit 9cd77bd9c6)
[libc++][NFC] Rewrite function call on two lines for clarity (#79141)
Previously, there was a ternary conditional with a less-than comparison
appearing inside a template argument, which was really confusing because
of the <...> of the function template. This patch rewrites the same
statement on two lines for clarity.
Merge commit d129ea8d2fa3 from llvm-project (by Vitaly Buka):
[libcxx] Align `__recommend() + 1` by __endian_factor (#90292)
This is detected by asan after #83774
Allocation size will be divided by `__endian_factor` before storing. If
it's not aligned,
we will not be able to recover allocation size to pass into
`__alloc_traits::deallocate`.
we have code like this
```
auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__sz) + 1);
__p = __allocation.ptr;
__set_long_cap(__allocation.count);
void __set_long_cap(size_type __s) _NOEXCEPT {
__r_.first().__l.__cap_ = __s / __endian_factor;
__r_.first().__l.__is_long_ = true;
}
size_type __get_long_cap() const _NOEXCEPT {
return __r_.first().__l.__cap_ * __endian_factor;
}
inline ~basic_string() {
__annotate_delete();
if (__is_long())
__alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
}
```
1. __recommend() -> even size
2. `std::__allocate_at_least(__alloc(), __recommend(__sz) + 1)` - > not
even size
3. ` __set_long_cap() `- > lose one bit of size for __endian_factor == 2
(see `/ __endian_factor`)
4. `__alloc_traits::deallocate(__alloc(), __get_long_pointer(),
__get_long_cap())` -> uses even size (see `__get_long_cap`)
This should fix incorrect deallocation sizes for some instances of
std::string. Memory profiling or debugging tools like AddressSanitizer,
LeakSanitizer or TCMalloc could then complain about the the size passed
to a deallocation not matching the size originally passed to the
allocation.
Reported by: Aliaksei Kandratsenka <alkondratenko@gmail.com>
PR: 279560
MFC after: 3 days
(cherry picked from commit ead8e4c081)
I cannot find a time where the function was not named this.
Reviewed by: kib, markj
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45383
(cherry picked from commit deab57178f)
No functional change.
Reviewed by: markj
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45322
(cherry picked from commit b5e17840de)
It is inherited from arm, where the global exists and is used. No
functional change.
Reviewed by: markj
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45323
(cherry picked from commit 1d3c23676d)
This function is documented to be gone in after 11. Time to remove this
compat shim.
PR: 275296
Reviewed by: jrm (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D44796
(cherry picked from commit aa48259f33)
mlx4 and mlx5 are Ethernet devices and ether_ifattach() does an
unconditional bpfattach(). From commit 16d878cc99 [1] and on, we
should not check ifp->if_bpf to tell us whether or not we have any bpf
peers that might be interested in receiving packets. And since commit
2b9600b449 [2], ifp->if_bpf can not be NULL even after the network
interface has been detached.
No functional change intended.
1. 16d878cc99 Fix the following bpf(4) race condition which can result in a panic
2. 2b9600b449 Add dead_bpf_if structure, that should be used as fake bpf_if during ifnet detach
Reviewed by: kp, kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D45196
(cherry picked from commit 2439ae9483)
(cherry picked from commit d98ced6588)
... or install an empty file.
The locate database is a mutable working file, and unsuitable to be
managed by pkg(8). locate(1) copes gracefully with the absence of
this file. Running /etc/periodic/weekly/310.locate will create the
locate database with the correct ownership and permissions.
Having the locate.database file as part of the FreeBSD-runtime package
means it gets zeroed if ever that package gets updated, which is
excessive, given that updating packages will typically only change a
relatively small number of the _filenames_ on the system -- unlike the
file contents. Plus it always causes it to flag as modified when
verifying checksums, but /var/db/locate.database is expected to be
modified by the user.
MFC after: 1 week
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D45384
(cherry picked from commit 4354163e5f)
[PPCMergeStringPool] Only replace constant once (#92996)
In #88846 I changed this code to use RAUW to perform the replacement
instead of manual updates -- but kept the outer loop, which means we try
to perform RAUW once per user. However, some of the users might be freed
by the RAUW operation, resulting in use-after-free.
The case where this happens is constant users where the replacement
might result in the destruction of the original constant.
Fixes https://github.com/llvm/llvm-project/issues/92991.
This fixes a possible crash when building crypto/openssh/sshkey.c for
PowerPC targets.
Reported by: cperciva
PR: 276104
MFC after: 3 days
(cherry picked from commit f30188c468)
To fix WITHOUT_NIS build. Building yp_xdr.c is gated by MK_NIS.
PR: 279270
Reported by: peterj
Reported by: matteo
Reported by: Michael Dexter's Build Option Survey run
Reviewed by: brooks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45347
(cherry picked from commit 61639bb3fc)
(cherry picked from commit 1e3dfe0c34)
[X86] Add slow div64 tuning flag to Nehalem target (#91129)
This appears to have been missed because later cpus don't inherit from Nehalem tuning much.
Noticed while cleaning up for #90985
Merge commit 8b400de79eff from llvm-project (by Simon Pilgrim):
[X86] Enable TuningSlowDivide64 on Barcelona/Bobcat/Bulldozer/Ryzen Families (#91277)
Despite most AMD cpus having a lower latency for i64 divisions that converge early, we are still better off testing for values representable as i32 and performing a i32 division if possible.
All AMD cpus appear to have been missed when we added the "idivq-to-divl" attribute - this patch now matches Intel cpu behaviour (and the x86-64/v2/3/4 levels).
Unfortunately the difference in code scheduling means I've had to stop using the update_llc_test_checks script and just use old-fashioned CHECK-DAG checks for divl/divq pairs.
Fixes#90985
This fixes possibly worse runtime performance on AMD Zen hardware, when
using -march=znver4 (or any other znver), as opposed to -march=x86-64-v4
or the baseline -march=x86-64. A similar fix is applied for Nehalem.
PR: 278908
MFC after: 3 days
(cherry picked from commit cadd2ca217)
The content that `value` point to is not going to be altered by function
handle_string().
MFC after: 1 week
(cherry picked from commit 68c890b443)
(cherry picked from commit 1b3f88bc80)
This local variable s is for iterating characters of global variable
`version`. The content of `version` is not going to be altered by
function freebsd4_uname().
MFC after: 1 week
(cherry picked from commit 92f2a4c820)
(cherry picked from commit 5fd1902b0c)
A test system provided by AMD panicked with "madt_parse_apics:
I/O APIC ID 255 too high". I/O APIC ID 255 is acceptable, so increase
the limit.
Reviewed by: jhb, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45157
(cherry picked from commit 4e32868183)
(cherry picked from commit 18119e711f)
syscons is not compatible with UEFI boot. This is noted in syscons(4),
but not mentioned in vt(4) where the kern.vty tunable (used to select vt
or sc) is documented. Add a note so that if someone reads vt(4) but not
sc(4) they are not surprised by having no usable console.
PR: 276206
Reviewed by: brooks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45357
(cherry picked from commit f52481f3b8)
(cherry picked from commit 03d3230d51)
Code for pools before version 11 uses dmu_objset_find_dp() to scan
for children datasets/clones. It calls enqueue_clones_cb() and
enqueue_cb() callbacks in parallel from multiple taskq threads.
It ends up bad for scan_ds_queue_insert(), corrupting scn_queue
AVL-tree. Fix it by introducing a mutex to protect those two
scan_ds_queue_insert() calls. All other calls are done from the
sync thread and so serialized.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #16162
PR: 278414
(cherry picked from commit 49086aa35d)