mac80211: Optimize scans on current operating channel.
PATCH v6 1/1 mac80211: Optimize scans on current operating channel.
From: Ben Greear <[email protected]>
This should decrease un-necessary flushes, on/off channel work, and channel changes in cases where the only scanned channel is the current operating channel.
* Removes SCAN_OFF_CHANNEL flag, uses SDATA_STATE_OFFCHANNEL and is-scanning flags instead.
* Add helper method to determine if we are currently configured for the operating channel.
* Do no blindly go off/on channel in work.c Instead, only call appropriate on/off code when we really need to change channels.
* Consolidate ieee80211_offchannel_stop_station and ieee80211_offchannel_stop_beaconing, call it ieee80211_offchannel_stop_vifs instead.
* Accept non-beacon frames when scanning, even if off-channel.
* Scan state machine optimized to minimize on/off channel transitions. Also, when going on-channel, go ahead and re-enable beaconing. We're going to be there for 200ms, so seems like some useful beaconing could happen.
* Grab local->mtx earlier in __ieee80211_scan_completed_finish so that we are protected when calling hw_config(), etc.
---
:100644 100644 c47d7c0... 50ceb67... M net/mac80211/ieee80211_i.h
:100644 100644 09a2744... 6684b9e... M net/mac80211/main.c
:100644 100644 b4e5267... 5400da6... M net/mac80211/offchannel.c
:100644 100644 f36d70f... fa8e5ec... M net/mac80211/rx.c
:100644 100644 f246d8a... 3bc020d... M net/mac80211/scan.c
:100644 100644 ffc6749... 5f8b4a6... M net/mac80211/tx.c
:100644 100644 36305e0... 3c8ece9... M net/mac80211/work.c
net/mac80211/ieee80211_i.h | 13 +++++--- net/mac80211/main.c | 51 ++++++++++++++++++++++++++++++---- net/mac80211/offchannel.c | 48 +++++++++----------------------- net/mac80211/rx.c | 12 ++------ net/mac80211/scan.c | 65 ++++++++++++++++++++++++++----------------- net/mac80211/tx.c | 3 +- net/mac80211/work.c | 54 +++++++++++++++++++++++++++++------- 7 files changed, 153 insertions(+), 93 deletions(-)
net/mac80211/ieee80211_i.h +8 -5
@@ -654,8 +654,6 @@ struct tpt_led_trigger {* well be on the operating channel * @SCAN_HW_SCANNING: The hardware is scanning for us, we have no way to * determine if we are on the operating channel or not -* @SCAN_OFF_CHANNEL: We're off our operating channel for scanning, -* gets only set in conjunction with SCAN_SW_SCANNING * @SCAN_COMPLETED: Set for our scan work function when the driver reported * that the scan completed. * @SCAN_ABORTED: Set for our scan work function when the driver reported
@@ -664,7 +662,6 @@ struct tpt_led_trigger {enum {SCAN_SW_SCANNING ,SCAN_HW_SCANNING , -SCAN_OFF_CHANNEL ,SCAN_COMPLETED ,SCAN_ABORTED , };
@@ -1147,8 +1144,14 @@ void ieee80211_rx_bss_put(struct ieee80211_local *local, struct ieee80211_bss *bss);/* off-channel helpers */ -void ieee80211_offchannel_stop_beaconing (struct ieee80211_local *local); -void ieee80211_offchannel_stop_station (struct ieee80211_local *local); +/** +* Returns true if we are logically configured to be on +* the operating channel AND the hardware-conf is currently +* configured on the operating channel. Compares channel-type +* as well. +*/ +bool ieee80211_cfg_on_oper_channel (struct ieee80211_local *local); +void ieee80211_offchannel_stop_vifs (struct ieee80211_local *local);void ieee80211_offchannel_return (struct ieee80211_local *local,bool enable_beaconing);void ieee80211_hw_roc_setup (struct ieee80211_local *local);
net/mac80211/main.c +45 -6
79 lines not on this page · raw message
net/mac80211/offchannel.c +13 -35
75 lines not on this page · raw message
net/mac80211/rx.c +3 -9
@@ -392,16 +392,10 @@ ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx)if (likely (!(status->rx_flags &IEEE80211_RX_IN_SCAN )))return RX_CONTINUE ; -if (test_bit (SCAN_HW_SCANNING , &local->scanning)) +if (test_bit (SCAN_HW_SCANNING , &local->scanning) || +test_bit (SCAN_SW_SCANNING , &local->scanning))return ieee80211_scan_rx (rx->sdata, skb); -if (test_bit (SCAN_SW_SCANNING , &local->scanning)) { -/* drop all the other packets during a software scan anyway */ -if (ieee80211_scan_rx (rx->sdata, skb) !=RX_QUEUED ) -dev_kfree_skb (skb); -return RX_QUEUED ; - } -/* scanning finished during invoking of handlers */ I802_DEBUG_INC (local->rx_handlers_drop_passive_scan);return RX_DROP_UNUSABLE ;
@@ -2749,7 +2743,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, local->dot11ReceivedFragmentCount++;if (unlikely (test_bit (SCAN_HW_SCANNING , &local->scanning) || -test_bit (SCAN_OFF_CHANNEL , &local->scanning))) +test_bit (SCAN_SW_SCANNING , &local->scanning))) status->rx_flags |=IEEE80211_RX_IN_SCAN ;if (ieee80211_is_mgmt (fc))
net/mac80211/scan.c +39 -26
126 lines not on this page · raw message
net/mac80211/tx.c +2 -1
@@ -257,7 +257,8 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)if (unlikely (info->flags &IEEE80211_TX_CTL_INJECTED ))return TX_CONTINUE ; -if (unlikely (test_bit (SCAN_OFF_CHANNEL , &tx->local->scanning)) && +if (unlikely (test_bit (SCAN_SW_SCANNING , &tx->local->scanning)) && +test_bit (SDATA_STATE_OFFCHANNEL , &tx->sdata->state) && !ieee80211_is_probe_req (hdr->frame_control) && !ieee80211_is_nullfunc (hdr->frame_control))/*
net/mac80211/work.c +43 -11
70 lines not on this page · raw message
Signature · 1 line
1.7.2.3