sys/arm64: fix return values of freebsd32_{set,swap}context()
This patch aligns the return values of freebsd32_{set,swap}context()
with their counterparts on amd64 and powerpc64, fixing the setcontext()
and swapcontext() calls in armv7 applications running on aarch64.
In particular, this fixes random crashes in armv7 Ruby applications
running on aarch64 hosts.
Tested by: fuz
MFC after: 1 week
(cherry picked from commit 92ae21e8a155734f73589b7ef9fa19a6bb6d042f)
sys/arm64: fix return values of freebsd32_{set,swap}context()
This patch aligns the return values of freebsd32_{set,swap}context()
with their counterparts on amd64 and powerpc64, fixing the setcontext()
and swapcontext() calls in armv7 applications running on aarch64.
In particular, this fixes random crashes in armv7 Ruby applications
running on aarch64 hosts.
Tested by: fuz
MFC after: 1 week
(cherry picked from commit 92ae21e8a155734f73589b7ef9fa19a6bb6d042f)
Vendor import of pkgconf 2.9.93
Obtained from https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.9.93.tar.gz
SHA1: 6bcbedc97081e17ea58e0164adea2ab827acfe23 -
SHA256: b9632d0d91321f56645de720fd8cd3584b0d0ca8ff13a3d9d5285888869fcc98 -
SHA512: e014096f5486b7cdfa8c6410992b9143b63c7ef0ba540c7cad09923867c3924b951c1dfbd9a85f6d786b0deb30be1b7284f67317f4b261b6e0eca70b20ace1af -
One test folder in tests/lib1 had to be removed to avoid UTF-8 filenames
in the tree. (Breaks `make create-source-packages`)
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57890
Vendor import of pkgconf 2.9.92
Obtained from https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.9.92.tar.gz
SHA1: 865d15aac5e720a8897b14e0f475736a810a9340 -
SHA256: 1eeda57d5f7b8dd346278ea164536f313366bb10d531d7c490be439638942f6d -
SHA512: a66960f79f83508e372ef948ec98f906abb31aed0b4c1a667f2cf8235f55ede1553fc5dfd1baaa6217a2d82c725448e64207b1dfb858f21fdb12f82e6771546f -
One test folder in tests/lib1 had to be removed to avoid UTF-8 filenames
in the tree. (Breaks `make create-source-packages`)
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57856
Vendor import of pkgconf 2.9.91
Obtained from https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.9.91.tar.gz
SHA1: 8ac84e584ff568dace16f9012efcec603b78ca34 -
SHA256: 68de1892189f085ab21e735561c67b5a077b85e0ce29f91ac774c3ad1afbfc94 -
SHA512: b069c7e9266059a126443392853b353845f0ebffd1591bdbc5582853016074d284d3b2f3a2b6588deb29a662bb712f05261c9bca81452d6de536018dbc9d4314 -
One test folder in tests/lib1 had to be removed to avoid UTF-8 filenames
in the tree. (Breaks `make create-source-packages`)
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57855
Vendor import of pkgconf 2.9.90
Obtained from https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-2.9.90.tar.gz
SHA1: ebfb0525c019eda14190d463680cb1625f3177f9 -
SHA256: f5c10610be8ea7278fc31ad63b943525b5b2a2f6e5038d3c11947f5bd6fd214d -
SHA512: f93e6d15d25d02869a03ba339e18582f01a9b7241be89a87183c0f373a3df78d1be005dee376ea464f7942735700f51dab57b8688bc802ec152ff343af721f46 -
One test folder in tests/lib1 had to be removed to avoid UTF-8 filenames
in the tree. (Breaks `make create-source-packages`)
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57837
LinuxKPI: 802.11: adjust timing of sync_from_ni in lkpi_sta_assoc_to_run()
We used to call the (*sta_state) downcall into the driver to set the
sta state to ASSOC. After that we did a lot of sync operations incl.
the lkpi_sta_sync_from_ni() which does a lot of rate and bandwith
adjustments. This sync call needs to happen before we set the sta
to assoc as drivers rely on some of this information, e.g., ht_cap and
vht_cap (and equivalents for later standards) at that point. Moving
this will make, e.g., mt7921 transmit at higher rates than just
basic_rates.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 75aadc902298005c47d2b931c483452027ceae69)
LinuxKPI: 802.11: track bandwidth/rx_nss change in lkpi_sta_sync_from_ni()
In lkpi_sta_sync_from_ni() track the bandwidth and rx_nss at the
beginning so at the end we can diff if they changed in order to generate
the appropriate RC*CHNAGED flags for the (*link_sta_rc_update) downcall.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 53d9c14af6a65dcc037527c6ff5308c94806fafe)
LinuxKPI: 802.11: consider emulate_chanctx in lkpi_sync_chanctx_cw_from_rx_bw()
Only return early if the bandwidth has not changed and we are not
using emulate_chanctx or the chandef.width already matches the new
bandwidth. Otherwise we have to continue to get all the values
updated.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit cff565a4c0335e12376ea43f99ef5328c45ce933)
LinuxKPI: 802.11: add/change rate related tracing
Make use of the TRACE_RATES() macro and add various tracing events.
Also adjust some events formerly under TRACEOK to TRACE_RATES().
Ignoring the tracing, no other functional changes.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 42cf2798110e12df6ccc22a138ed89617ac7d407)
LinuxKPI: 802.11: add function to update some rate related fields
Add lkpi_sta_supp_rates() which serves multiple purposes:
(a) build (and update) the supp_rates field on a sta link (deflink only
in our case still),
(b) build and update basic_rates on the vif->bss_conf and print a
warning in case we end up without any basic rate (should not happen
anymore, not even on initial startup sync),
(c) if HT or VHT are supported, then update the relevant br_mask fields
for the current band.
Deal with the various flags which trigger different updates by returning
them so the caller can act upon.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 0d3cd54642f6695f9f82b82402f27e10bbee7cfc)
LinuxKPI: 802.11: make lkpi_sta_sync_from_ni() return bss_changes
This is a preparatory change with no functional changes.
Sponosred by: The FreeBSD Foundation
(cherry picked from commit 038489e46ea3e77484ea85c4369610ba3ee8381b)
LinuxKPI: 802.11: initalize br_mask and basic_rates for each vap
During vap creating we inialize most [l]vif related variables.
Add a br_mask (bit rate mask) to the lvif and setup the legacy component
as it seems to be static.
Given we are looping over the bands, also initialize the bss_conf
basic_rates. At this point we only have all bitrates for the band
or the mandatory bitrates for the band available. In order to not
hint usage of possibly unsupported bit rates set it up with the
manadatory bit rates only, which should get us through the mgmt
frames, etc. to get to assoc state. By then we will do updates.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 7bf2eec68a293a22f332fc1592dffaa4ed9f0809)
LinuxKPI: 802.11: introduce TRACE_RATES()
Add a tracing bit for tracing rates related changes introduced in
followup commits.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit b58d8df5829233ced7024c30a0a979e2e0a722fd)
LinuxKPI: 802.11: add 11g check to lkpi_ic_getradiocaps()
Replace an early comment with code and add a (simplified) 11g check.
We make use of the annotated bitrate flags we added (see
lkpi_wiphy_band_annotate()) and check if on the 2GHz band there are
any bitrates which are 11g. Upon the first one found we do set the
IEEE80211_MODE_11G to announce to net80211 that the 2.4Ghz channels
may operate on 11g as well.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit d4a529ad0d5638ad3e8d27815948b0a7c4628e3f)
LinuxKPI: 802.11: add/improve/correct comments
Adjust/add comments to clarify certain situations.
No functional changes.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 08a78a296c840aa95ec13895c3c9bf1349becbae)
LinuxKPI: 802.11: leave a comment for sta->rates (mt7615, ?)
While we currently try to fill most rates places (e.g., basic_rates,
supp_rates, (*set_bitrate_mask)), sta->rates are not populated.
They are likely managed by the 802.11 rate control code (given no
ieee80211_hw_check HAS_RATE_CONTROL), which for use would be net80211,
which will require some extra code just to manage that.
At least Mediatek mt76 (mt7615) driver seems to fall into the category
of this need. See about that once/if we get to it.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 557eed60d2a34d061350ac37acebe6686cd80d83)
mt76: mt7925: prevent PM from scheduling another delayed work on detach
This duplicates 009d92b25f7c from mt7921 which has the full description.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 482fda9814937691557ebadd0930535ff3d301b0)
LinuxKPI: scatterlist.h: implement sg_init_marker()
Add sg_init_marker() which is needed by mt76 drivers USB attachment.
Sponosored by: The FreeBSD Foundation
Reviewed by: emaste, dumbbell
Differential Revision: https://reviews.freebsd.org/D57594
(cherry picked from commit 3d0b6c69dced4936fccff6733912a0ef93214dbe)
LinuxKPI: add KERNEL_VERSION() macro
Add a KERNEL_VERSION() macro which normally would be in linux/version.h.
On Linux that file is auto-generated and we are supporting more than
one Linux version in LinuxKPI anyway so any further defines in there
would likely be wrong.
Adding the macro helps to support (vendor/out of tree) drivers more
easily which are supporting multiple Linux versions.
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D57590
(cherry picked from commit c5d6e2085a471cbb75cc7b88b37a2fe6276c16f8)
LinuxKPI: 802.11: lock down mac80211 downcalls
Add lock assertions and "might_sleep" annotations to various
mac80211 operation downcalls into the driver.
Make sure the code to these is all covered by locks--pushing more wiphy
lock into the code--or lock assertions as well. Split up parts of the
MC code up into an unlocked and locked version to avoid recurive locking.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 1c601bf516ebefb1670f5612316c501f2ae2654a)
mt76: mt7921: depend on lindebugfs and turn debugfs support on
Add the missing MODULE_DEPEND() calls for lindebugfs.
It is unfortunate that they are shared code between various bus
implementations. Ideally we would leave the MODULE_DEPEND() calls
in the debugfs.c file instead of adding extra #ifdef guards to the
bus attachment files.
Turn debugfs support on for mt76(core) and the mt7921 module for now.
Sponsonred by: The FreeBSD Foundation
(cherry picked from commit 134e90e01da181a6048f0ca3368e466818def1b3)
mt76: mt7921: terminate fw log messages with \n
In order to make the firmware messages spewed on the console readable
write one message per line and not one very long line.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit b662295ecb620b8ebf00188a111ff16701b0375d)
mt76: ensure net80211 com instance before returning from driver load
Do as we have done for iwlwifi (f808c43ad923, bee60c989745) add a
completion event for device registration which calls into 802.11
and creates the wifi "device" (net80211 com instance).
This is needed as otherwise the deferred work in the mt76 drivers
(mt7915, mt7921, mt7925, mt7996; but not the 7615 [*]) would make
driver loading return before the wifi device is there. We would then
continue, e.g., during rc startup and race possibly trying to create
a vap (wlan interface) with the underlying device not being registered
yet and fail.
[*] the 7615 does not seem to do this asynchronously so is fine.
Sponsored by: The FreeBSD Foundation
Tested on: 7921, others to be tested at time
(cherry picked from commit baf8561bdc3f39c542a82cd1235fbf4bf97b4310)
callout: ddb: resolve symbol of callout function
In the ddb show callout function try to resolve the symbol of the
callout function to improve debugging. In my case I went through
various callouts from show ktr to check what they were and this saved
me opening lldb/gdb next to it (and still having the old kernel as
the panic to debug was upon reboot).
Sponsored by: The FreeBSD Foundation
Reviewed by: rlibby
Differential Revision: https://reviews.freebsd.org/D57521
(cherry picked from commit b8ec4929e9f4c83bf02f412de1f9022b17abf867)
lindebugfs: improve an error message
In case the fill function fails do not report (read/write) but the
actual operation only given we can easily determine it.
Sponsored by: The FreeBSD Foundation
Reviewed by: dumbbell, emaste
Differential Revision: https://reviews.freebsd.org/D57523
(cherry picked from commit 84008e34ce5fb92c69b63cdf1ce2938c5006320b)
linudebugfs: fix simple_attr_write_common() kernel buffer
With 2cf15144daf7e we added a kernel buffer for parsing input copying the
user buffer into that. The problem is that we only copy exactly as many
bytes as the user supplied. printf 1 would have a write_size of 1, while
echo 1 would have a write_size of 2 (1\n). But in order to check and
parse we need a terminating '\0'.
Overallocate the kernel buffer by 1 and make sure it is always '\0'
terminated.
Remove the check that the string needs to be of different length than
the write_size as this will always fail unless the user passes in, e.g.,
"1\02\n\0" somehow in which case we won't bother as kstrto*ll() will
not only handle the '\n' but also stop at '\0' and should be fine or
it will fail and we will error.
In theory we could use a static buffer here as well as we know a maximum
possible length of digits plus \n and \0 and take a min of that buffer
[9 lines not shown]
mt76: mt7921: prevent PM from scheduling another delayed work on detach
Amongst others mt76_connac_pm_unref() is calling mt76_connac_power_save_sched()
which will (normaly) re-schedule the pm_work.
In various parts we also cancel that work, also during PCI detach ("shutdown",
"remove" in LinuxKPI terms).
However we also keep calling mt76_connac_pm_unref() in the detach path and thus
we get to a point where we re-scheduled the work but then the device goes away.
At that point LinuxKPI delayed work has a callput pending which is embedded in
the work structure (pm_work). The moment we free the device that structure
and callout is gone but the callout is still on the list and once that list
is walked we panic.
Simply prevent mt76_connac_power_save_sched() from getting to the point of
possibly re-scheduling the pm_work by setting pm->enable to false in the
beginning of the detach path.
The are likely more paths which will need the same treatment as the code
is by far anything from "symmetric" (that is the attach path is highly
[7 lines not shown]
LinuxKPI: 802.11: force update of net80211 crypto key flags
Several drivers (rtw8x, mt76) do not announce the supported ciphers suites
in the wiphy instance. This means we never populate net80211 ic_cryptocaps
on device creation and thus not announcing any supported hw crypto
offload forcing a fallback to software crypto.
However when the mac80211 (*set_key) succeeds we know we can offload
crypto. At that point the net80211 key flags have IEEE80211_KEY_SWCRYPT
set which we want to clear. Historically the net80211 API does not
allow this though there should be no ill side effects (base on a
quick code inspection). We thus have to DECONST the key argument
for now. It is expected that with MFP support this will need to
become a common operation and the API will need to change as we
will only get the information of some details from the driver on a
per-cipher case when the (*set_key) downcall returns.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 31ded414b1282abdebcb24c18cc6dbebf84210f2)