freebsd-src/sys/dev/rtwn
Bjoern A. Zeeb 713db49d06 net80211: deal with lost state transitions
Since 5efea30f03 we can possibly lose a state transition which can
cause trouble further down the road.
The reproducer from 643d6dce6c can trigger these for example.
Drivers for firmware based wireless cards have worked around some of
this (and other) problems in the past.

Add an array of tasks rather than a single one as we would simply
get npending > 1 and lose order with other tasks.  Try to keep state
changes updated as queued in case we end up with more than one at a
time.  While this is not ideal either (call it a hack) it will sort
the problem for now.
We will queue in ieee80211_new_state_locked() and do checks there
and dequeue in ieee80211_newstate_cb().
If we still overrun the (currently) 8 slots we will drop the state
change rather than overwrite the last one.
When dequeing we will update iv_nstate and keep it around for historic
reasons for the moment.

The longer term we should make the callers of
ieee80211_new_state[_locked]() actually use the returned errors
and act appropriately but that will touch a lot more places and
drivers (possibly incl. changed behaviour for ioctls).

rtwn(4) and rum(4) should probably be revisted and net80211 internals
removed (for rum(4) at least the current logic still seems prone to
races).

PR:		271979, 271988, 275255, 263613, 274003
Sponsored by:	The FreeBSD Foundation (in 2023)
MFC after:	3 days
Reviewed by:	cc
Differential Revision: https://reviews.freebsd.org/D43389
2024-02-14 19:47:21 +00:00
..
pci Revert "Widen EPOCH(9) usage in PCI WLAN drivers." 2023-12-01 00:48:54 +00:00
rtl8188e sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
rtl8192c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
rtl8192e sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
rtl8812a sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
rtl8821a sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
usb Revert "Enter the network epoch in USB WiFi drivers when processing input" 2023-12-01 00:48:54 +00:00
if_rtwn_beacon.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
if_rtwn_beacon.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_rtwn_calib.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
if_rtwn_calib.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_rtwn_cam.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
if_rtwn_cam.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_rtwn_debug.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_rtwn_efuse.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
if_rtwn_efuse.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_rtwn_fw.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
if_rtwn_fw.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
if_rtwn_nop.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_rtwn_ridx.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_rtwn_rx.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
if_rtwn_rx.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_rtwn_task.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
if_rtwn_task.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_rtwn_tx.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
if_rtwn_tx.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_rtwn.c net80211: deal with lost state transitions 2024-02-14 19:47:21 +00:00
if_rtwnreg.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
if_rtwnvar.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00