mac80211: Optimize scans on current operating channel.
RFC v5 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.
---
This fixes some logic errors related to work_work(), and adds a bunch of debugging code that I know needs removing before it is merged.
:100644 100644 5b24740... cb23352... M net/mac80211/chan.c
:100644 100644 c47d7c0... b24fb2f... M net/mac80211/ieee80211_i.h
:100644 100644 09a2744... 6684b9e... M net/mac80211/main.c
:100644 100644 b4e5267... 903ef99... M net/mac80211/offchannel.c
:100644 100644 f36d70f... fa8e5ec... M net/mac80211/rx.c
:100644 100644 f246d8a... 18aee42... M net/mac80211/scan.c
:100644 100644 e46c801... 4cc8add... M net/mac80211/tx.c
:100644 100644 36305e0... 34355b7... M net/mac80211/work.c
net/mac80211/chan.c | 2 + net/mac80211/ieee80211_i.h | 17 ++++++--- net/mac80211/main.c | 51 ++++++++++++++++++++++++--- net/mac80211/offchannel.c | 53 +++++++++------------------- net/mac80211/rx.c | 12 ++----- net/mac80211/scan.c | 83 +++++++++++++++++++++++++++++-------------- net/mac80211/tx.c | 3 +- net/mac80211/work.c | 57 ++++++++++++++++++++++++------ 8 files changed, 182 insertions(+), 96 deletions(-)
net/mac80211/chan.c +2 -0
@@ -119,6 +119,8 @@ bool ieee80211_set_channel_type(struct ieee80211_local *local,if (sdata) sdata->vif.bss_conf.channel_type = chantype; +printk ("%s: Set channel, superchan: %i chantype: %i\n" , + sdata->name, superchan, chantype); result = true; out:mutex_unlock (&local->iflist_mtx);
net/mac80211/ieee80211_i.h +11 -6
@@ -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,10 +1144,18 @@ 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, +const char * dbg);void ieee80211_offchannel_return (struct ieee80211_local *local, -bool enable_beaconing); +bool enable_beaconing, +const char * dbg);void ieee80211_hw_roc_setup (struct ieee80211_local *local);/* interface handling */
net/mac80211/main.c +45 -6
79 lines not on this page · raw message
net/mac80211/offchannel.c +17 -36
90 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 +56 -27
158 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 +46 -11
74 lines not on this page · raw message
Signature · 1 line
1.7.2.3