freebsd-skq/sys/net80211
Adrian Chadd 03475bd01a [net80211] remove node scan lock / generation number + fix few LORs
Drop scan generation number and node table scan lock - the only place
where ni_scangen is checked is in ieee80211_timeout_stations() (and it
is used to prevent duplicate checking of the same node); node scan lock
protects only this variable + node table scan generation number.

This will fix (at least) next LOR (hostap mode):

lock order reversal:
1st 0xc175f84c urtwm0_scan_loc (urtwm0_scan_loc) @ /usr/src/sys/modules/wlan/../../net80211/ieee80211_node.c:2019
2nd 0xc175e018 urtwm0_com_lock (urtwm0_com_lock) @ /usr/src/sys/modules/wlan/../../net80211/ieee80211_node.c:2693
stack backtrace:
#0 0xa070d1c5 at witness_debugger+0x75
#1 0xa070d0f6 at witness_checkorder+0xd46
#2 0xa0694cce at __mtx_lock_flags+0x9e
#3 0xb03ad9ef at ieee80211_node_leave+0x12f
#4 0xb03afd13 at ieee80211_timeout_stations+0x483
#5 0xb03aa1c2 at ieee80211_node_timeout+0x42
#6 0xa06c6fa1 at softclock_call_cc+0x1e1
#7 0xa06c7518 at softclock+0xc8
#8 0xa06789ae at intr_event_execute_handlers+0x8e
#9 0xa0678fa0 at ithread_loop+0x90
#10 0xa0675fbe at fork_exit+0x7e
#11 0xa08af910 at fork_trampoline+0x8

In addition to the above:

* switch to ieee80211_iterate_nodes();
* do not assert that node table lock is held, while calling node_age();
  that's not really needed (there are no resources, which can be protected
  by this lock) + this fixes LOR/deadlock between ieee80211_timeout_stations()
  and ieee80211_set_tim() (easy to reproduce in HOSTAP mode while
  sending something to an STA with enabled power management).

Tested:

* (avos) urtwn0, hostap mode
* (adrian) AR9380, STA mode
* (adrian) AR9380, AR9331, AR9580, hostap mode

Notes:

* This changes the net80211 internals, so you have to recompile all of it
  and the wifi drivers.

Submitted by:	avos
Approved by:	re (delphij)
Differential Revision:	https://reviews.freebsd.org/D6833
2016-06-19 07:31:02 +00:00
..
_ieee80211.h net80211: calculate IEEE80211_MODE_BYTES / IEEE80211_CHAN_BYTES 2016-05-01 20:57:10 +00:00
ieee80211_acl.c These files were getting sys/malloc.h and vm/uma.h with header pollution 2016-02-01 17:41:21 +00:00
ieee80211_action.c net80211: fix more compiler warnings. 2016-05-19 21:08:33 +00:00
ieee80211_action.h
ieee80211_adhoc.c net80211: drop some unused variables / local macros 2016-05-12 22:17:00 +00:00
ieee80211_adhoc.h
ieee80211_ageq.c These files were getting sys/malloc.h and vm/uma.h with header pollution 2016-02-01 17:41:21 +00:00
ieee80211_ageq.h
ieee80211_alq.c
ieee80211_alq.h
ieee80211_amrr.c [net80211] Begin implementing rate control module stats. 2016-03-16 02:07:04 +00:00
ieee80211_amrr.h
ieee80211_crypto_ccmp.c net80211: add new method for ieee80211_cipher (ic_setiv). 2015-10-03 00:50:13 +00:00
ieee80211_crypto_none.c net80211: fix more compiler warnings. 2016-05-19 21:08:33 +00:00
ieee80211_crypto_tkip.c net80211: add new method for ieee80211_cipher (ic_setiv). 2015-10-03 00:50:13 +00:00
ieee80211_crypto_wep.c net80211: add new method for ieee80211_cipher (ic_setiv). 2015-10-03 00:50:13 +00:00
ieee80211_crypto.c net80211: drop redundant 3rd parameter from iv_key_set(). 2015-10-03 21:48:27 +00:00
ieee80211_crypto.h net80211: add a possibility to retrieve current TX key without encapsulation. 2015-10-03 00:57:33 +00:00
ieee80211_ddb.c [net80211] remove node scan lock / generation number + fix few LORs 2016-06-19 07:31:02 +00:00
ieee80211_dfs.c [net80211] migrate the time_* macros to ieee80211_* namespace. 2016-03-30 00:44:10 +00:00
ieee80211_dfs.h
ieee80211_freebsd.c net80211: fix more compiler warnings. 2016-05-19 21:08:33 +00:00
ieee80211_freebsd.h [net80211] remove node scan lock / generation number + fix few LORs 2016-06-19 07:31:02 +00:00
ieee80211_hostap.c net80211: fix duplicate packet counter incrementation. 2016-06-09 08:19:42 +00:00
ieee80211_hostap.h
ieee80211_ht.c net80211: fix more compiler warnings. 2016-05-19 21:08:33 +00:00
ieee80211_ht.h [net80211] Initial A-MSDU support for testing / evaluation 2016-04-06 01:21:51 +00:00
ieee80211_hwmp.c net80211: fix more compiler warnings. 2016-05-19 21:08:33 +00:00
ieee80211_input.c net80211: fix use-after-free in frame defragmentation procedure. 2016-05-28 18:49:17 +00:00
ieee80211_input.h net80211: hide subtype mask & shift in function call. 2016-04-20 21:15:55 +00:00
ieee80211_ioctl.c net80211: restore interface state check for IEEE80211_IOC_SCAN_REQ ioctl. 2016-05-19 22:02:03 +00:00
ieee80211_ioctl.h [net80211] add an ioctl for LDPC configuration. 2016-04-26 01:26:11 +00:00
ieee80211_mesh.c net80211: fix more compiler warnings. 2016-05-19 21:08:33 +00:00
ieee80211_mesh.h Migrate the 802.11s locks out into ieee80211_freebsd.h, so they can be 2015-05-26 04:25:11 +00:00
ieee80211_monitor.c Begin plumbing ieee80211_rx_stats through the receive path. 2015-05-25 16:37:41 +00:00
ieee80211_monitor.h
ieee80211_node.c [net80211] remove node scan lock / generation number + fix few LORs 2016-06-19 07:31:02 +00:00
ieee80211_node.h [net80211] remove node scan lock / generation number + fix few LORs 2016-06-19 07:31:02 +00:00
ieee80211_output.c net80211: discard an injected frame if it is smaller than header length. 2016-06-09 13:42:18 +00:00
ieee80211_phy.c net80211: fix more compiler warnings. 2016-05-19 21:08:33 +00:00
ieee80211_phy.h [net80211] rename 11n rate macros into a useful spot 2016-04-05 22:01:56 +00:00
ieee80211_power.c [net80211] migrate the time_* macros to ieee80211_* namespace. 2016-03-30 00:44:10 +00:00
ieee80211_power.h Begin fleshing out support for net80211 provided (legacy) sleep management. 2014-04-24 01:39:53 +00:00
ieee80211_proto.c sys/net*: minor spelling fixes. 2016-05-03 18:05:43 +00:00
ieee80211_proto.h sys/net*: minor spelling fixes. 2016-05-03 18:05:43 +00:00
ieee80211_radiotap.c Remove unused include. 2015-05-25 14:54:10 +00:00
ieee80211_radiotap.h
ieee80211_ratectl_none.c Move counter.h include into ieee80211_freebsd.h. Should fix build. 2015-05-27 14:05:46 +00:00
ieee80211_ratectl.c [net80211] Begin implementing rate control module stats. 2016-03-16 02:07:04 +00:00
ieee80211_ratectl.h [net80211] Begin implementing rate control module stats. 2016-03-16 02:07:04 +00:00
ieee80211_regdomain.c ifconfig: set by default FCC regulatory domain for wireless interfaces. 2016-05-26 13:14:08 +00:00
ieee80211_regdomain.h
ieee80211_rssadapt.c Convert malloc/free back to #define's, as part of OS portability work. 2015-05-25 19:18:16 +00:00
ieee80211_rssadapt.h
ieee80211_scan_sta.c net80211: fix more compiler warnings. 2016-05-19 21:08:33 +00:00
ieee80211_scan_sw.c net80211: send RTM_IEEE80211_SCAN event when scan was cancelled. 2016-05-21 23:21:42 +00:00
ieee80211_scan_sw.h Break out the current 802.11 software scan methods into an indirect table. 2015-06-08 02:35:43 +00:00
ieee80211_scan.c net80211: refresh comments for ieee80211_scan_next() and 2016-04-21 06:19:33 +00:00
ieee80211_scan.h Break out the current 802.11 software scan methods into an indirect table. 2015-06-08 02:35:43 +00:00
ieee80211_sta.c net80211: fix more compiler warnings. 2016-05-19 21:08:33 +00:00
ieee80211_sta.h
ieee80211_superg.c [net80211] remove node scan lock / generation number + fix few LORs 2016-06-19 07:31:02 +00:00
ieee80211_superg.h [net80211] Initial A-MSDU support for testing / evaluation 2016-04-06 01:21:51 +00:00
ieee80211_tdma.c net80211: hide subtype mask & shift in function call. 2016-04-20 21:15:55 +00:00
ieee80211_tdma.h Begin plumbing ieee80211_rx_stats through the receive path. 2015-05-25 16:37:41 +00:00
ieee80211_var.h net80211: unbreak 'show all vaps(/a)' ddb command 2016-05-17 16:38:18 +00:00
ieee80211_wds.c net80211: drop some unused variables / local macros 2016-05-12 22:17:00 +00:00
ieee80211_wds.h
ieee80211_xauth.c These files were getting sys/malloc.h and vm/uma.h with header pollution 2016-02-01 17:41:21 +00:00
ieee80211.c net80211: fix more compiler warnings. 2016-05-19 21:08:33 +00:00
ieee80211.h [net80211] Add fields to decode uAPSD fields. 2016-03-30 00:42:18 +00:00