opnsense-src/sys/dev/usb
Bjoern A. Zeeb b392b36d37 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 643d6dce6c1e 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).

Given this changes the internal structure of 'struct ieee80211vap',
which gets allocated by the drivers, and we do not have enough
spares, all wireless drivers need to be recompiled.
Given we are forced to do the update, we leave fields in the middle
of the struct and add more spares at the same time.
__FreeBSD_version gets updated to 1400509 to be able to detect
this change.

PR:		271979, 271988, 275255, 263613, 274003
Sponsored by:	The FreeBSD Foundation (in 2023)
Reviewed by:	cc
Differential Revision: https://reviews.freebsd.org/D43389

(cherry picked from commit 713db49d06deee90dd358b2e4b9ca05368a5eaf6)
(cherry picked from commit a890a3a5ddf33acb0a4000885945b89156799b07)
2024-02-18 18:31:17 +00:00
..
controller arm64: xilinx: dwc3: Fix reset names 2023-08-23 09:42:40 +02:00
gadget sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
input uhid: Check for errors from copyin() in ioctl handlers 2024-01-01 19:29:44 -05:00
misc usb: Fix two typos in source code comments 2024-01-23 07:42:03 +01:00
net Teach if_smsc to get MAC from bootargs. 2023-12-28 15:40:31 +01:00
quirk usbdevs: add quirk for WD MyPassport Ultra External HDD 2023-12-06 11:21:42 +07:00
serial usb: Fix a typo in a source code comment 2024-01-25 07:45:09 +01:00
storage sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
template sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
video sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
wlan net80211: deal with lost state transitions 2024-02-18 18:31:17 +00:00
ufm_ioctl.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
uftdiio.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
uled_ioctl.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
usb.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_bus.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_busdma.c sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_busdma.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_cdc.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_controller.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_core.c sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_core.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_debug.c sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_debug.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_dev.c sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_dev.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_device.c sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_device.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_dynamic.c sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_dynamic.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_endian.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_error.c sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_fdt_support.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
usb_fdt_support.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
usb_freebsd.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_freebsd_loader.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_generic.c sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_generic.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_handle_request.c sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_hid.c sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_hub.c sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_hub.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_hub_acpi.c sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_hub_private.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_if.m sys: Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:54:58 -06:00
usb_ioctl.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_lookup.c sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_mbuf.c sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_mbuf.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_msctest.c sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_msctest.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_parse.c sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_pci.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_pf.c sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_pf.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
usb_process.c sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_process.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_request.c sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_request.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_transfer.c sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_transfer.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usb_util.c usb: use only usb_devinfo() in device_set_usb_desc() 2024-01-30 13:07:29 +02:00
usb_util.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
usbdevs usbdevs: add Ralink RT7601 aka MT7601 2024-02-17 16:15:10 +02:00
usbdi.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
usbdi_util.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
usbhid.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00