mac80211: Optimize scans on current operating channel.
PATCH v8 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 on operating 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.
* Pass probe-responses up the stack if scanning on local channel, so that mlme can take a look.
---
v8: Fix patch description w/regard to accepting non-beacon
frames while scanning on channel.
And, ensure scan_channel is NULL in the scan-finish logic. This is basically insurrance against bugs in the scan state machine. I have not seen the WARNings hit in my testing.
: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 7185c93... 030c3e9... M net/mac80211/rx.c
:100644 100644 f246d8a... b48ce0d... 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 | 75 ++++++++++++++++++++++++++++--------------- net/mac80211/tx.c | 3 +- net/mac80211/work.c | 54 +++++++++++++++++++++++++------ 7 files changed, 163 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
@@ -409,16 +409,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 ;
@@ -2766,7 +2760,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 +49 -26
142 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
Johannes Berg
maintainerAre you asleep now? Good thing I didn't even look at v7 ;-)
I'm kinda afraid of this patch. It's big, but I guess there's nothing we can do about that.
net/mac80211/ieee80211_i.h void ieee80211_rx_bss_put(struct ieee80211_local *local, · line 1152
Quoted 12 lines
net/mac80211/ieee80211_i.h +6
-2@@ -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. +*/
Please don't use /** unless you add real kernel-doc (which I don't think is necessary or even makes sense here)
net/mac80211/main.c static void ieee80211_reconfig_filter(struct work_struct *work) · line 104
Quoted 4 lines
net/mac80211/main.c +4
-0+/* Return true if we are logically configured to be on +* the operating channel AND the hardware-conf is currently +* configured on the operating channel. +*/
Err, I prefer not to have this duplicated -- one or the other will be missed when changing ... Maybe just add it here and remove from the header since it's internal API.
net/mac80211/main.c int ieee80211_hw_config(struct ieee80211_local *local, u32 changed) · line 148
Quoted 10 lines
net/mac80211/main.c +3
-0int ieee80211_hw_config (struct ieee80211_local *local,u32 changed) {struct ieee80211_channel *chan, *scan_chan;@@ -110,21 +143,27 @@ int ieee80211_hw_config(struct ieee80211_local *local, u32 changed) scan_chan = local->scan_channel; +/* If this off-channel logic ever changes, ieee80211_on_oper_channel +* may need to change as well. +*/
Would it make sense to roll this thing into one?
Like "ieee80211_get_desired_channel(local, &chan, &chantype)"
and then this code and on_oper_channel would use that?
Quoted 6 lines
net/mac80211/main.c +0
-2offchannel_flag = local->hw.conf.flags &IEEE80211_CONF_OFFCHANNEL ;if (scan_chan) { chan = scan_chan; channel_type =NL80211_CHAN_NO_HT ; - local->hw.conf.flags |=IEEE80211_CONF_OFFCHANNEL ; - } else if (local->tmp_channel &&
net/mac80211/main.c int ieee80211_hw_config(struct ieee80211_local *local, u32 changed) · line 159
Quoted 10 lines
net/mac80211/main.c +1
-3- local->oper_channel != local->tmp_channel) { + }else if (local->tmp_channel) { chan = scan_chan = local->tmp_channel; channel_type = local->tmp_channel_type; - local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL; }else { chan = local->oper_channel; channel_type = local->_oper_channel_type; - local->hw.conf.flags &= ~IEEE80211_CONF_OFFCHANNEL ; }
Basically rolling up this piece of code?
Quoted 5 lines
net/mac80211/scan.c +0
-0
net/mac80211/scan.c ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb) · line 220
Quoted 9 lines
net/mac80211/scan.c +6
-0@@ -212,6 +212,13 @@ ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)if (bss)ieee80211_rx_bss_put (sdata->local, bss); +/* If we are scanning on-channel, pass the pkt on up the stack so that +* mlme can make use of it +*/ +if (ieee80211_cfg_on_oper_channel (sdata->local) + && (channel == sdata->local->oper_channel)) +return RX_CONTINUE ;
Ah, neat trick, no need to duplicate the packet :-)
But didn't you say this wasn't necessary since timers were stopped anyway during scan? So maybe the comment shouldn't refer to scanning, but other work?
net/mac80211/scan.c static void __ieee80211_scan_completed_finish(struct ieee80211_hw *hw, · line 303
Quoted 8 lines
net/mac80211/scan.c +1
-0dev_kfree_skb (skb);return RX_QUEUED ; }@@ -293,15 +300,28 @@ static void __ieee80211_scan_completed_finish(struct ieee80211_hw *hw, bool was_hw_scan) {struct ieee80211_local *local =hw_to_local (hw); +bool ooc;
That might be nicer if it was a bit more verbose. Same with ooc2 I think. I suppose it's understandable though, so if it really gets messy with long lines maybe we shouldn't worry about it.
Quoted 4 lines
net/mac80211/scan.c +3
-1-if (local->scan_channel) { + next_chan = local->scan_req->channels[local->scan_channel_idx]; + +if (ieee80211_cfg_on_oper_channel (local)) {
net/mac80211/scan.c static void ieee80211_scan_state_decision(struct ieee80211_local *local, · line 575
Quoted 10 lines
net/mac80211/scan.c +10
-0+/* We're currently on operating channel. */ +if ((next_chan == local->oper_channel) && + (local->_oper_channel_type ==NL80211_CHAN_NO_HT )) +/* We don't need to move off of operating channel. */ + local->next_scan_state =SCAN_SET_CHANNEL ; +else +/* +* We do need to leave operating channel, as next +* scan is somewhere else. +*/
Hmm, is that really "leave"? You aren't sorting (yet) so might this not go back onto the operating channel then?
net/mac80211/scan.c ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) · line 261
Quoted 8 lines
net/mac80211/scan.c +3
-1+++ b/net/mac80211/tx.c@@ -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) &&
Shouldn't that be || ? Or only the off-channel check I think?
Quoted 30 lines
net/mac80211/scan.c +0
-0!ieee80211_is_probe_req (hdr->frame_control) && !ieee80211_is_nullfunc(hdr->frame_control))/* net/mac80211/work.c +7
-9@@ -924,18 +924,39 @@ static void ieee80211_work_work(struct work_struct *work) }if (!started && !local->tmp_channel) { -/* -* TODO: could optimize this by leaving the -* station vifs in awake mode if they -* happen to be on the same channel as -* the requested channel -*/ -ieee80211_offchannel_stop_beaconing (local); -ieee80211_offchannel_stop_station (local); +bool ooc =ieee80211_cfg_on_oper_channel (local); +bool tmp_chan_changed = false; +bool ooc2; +if (local->tmp_channel) +if ((local->tmp_channel != wk->chan) || + (local->tmp_channel_type != wk->chan_type)) + tmp_chan_changed = true; local->tmp_channel = wk->chan; local->tmp_channel_type = wk->chan_type; -ieee80211_hw_config (local,0 );
net/mac80211/work.c static void ieee80211_work_work(struct work_struct *work) · line 946
Quoted 10 lines
net/mac80211/work.c +10
-0+/* +* Leave the station vifs in awake mode if they +* happen to be on the same channel as +* the requested channel. +*/ + ooc2 =ieee80211_cfg_on_oper_channel (local); +if (ooc != ooc2) { +if (ooc2) { +/* went off operating channel */ +ieee80211_offchannel_stop_vifs (local);
"went" is a little misleading, I think it needs to be "will go"? It shouldn't be "went" since we need to stop first and then switch channels.
johannes
Quoted 18 lines · Johannes Berg
Are you asleep now? Good thing I didn't even look at v7 ;-)
I'm kinda afraid of this patch. It's big, but I guess there's nothing we can do about that.
net/mac80211/main.c int ieee80211_hw_config(struct ieee80211_local *local, u32 changed) · line 148
Quoted 10 lines
int ieee80211_hw_config(struct ieee80211_local *local, u32 changed) { struct ieee80211_channel *chan, *scan_chan;net/mac80211/main.c +3
-0@@ -110,21 +143,27 @@ int ieee80211_hw_config(struct ieee80211_local *local, u32 changed) scan_chan = local->scan_channel; +/* If this off-channel logic ever changes, ieee80211_on_oper_channel +* may need to change as well. +*/ Would it make sense to roll this thing into one?
Quoted 3 lines
Like "
ieee80211_get_desired_channel(local,&chan,&chantype)"and then this code and
on_oper_channelwould use that?
As you say, the patch is big and scary already. I would like to attempt this change as a small follow-on patch that does just one thing. To me, the open-coded logic is a bit more similar to existing logic and thus easier to review.
Quoted 11 lines
net/mac80211/scan.c ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb) · line 220
Quoted 6 lines
net/mac80211/scan.c +6
-0+/* If we are scanning on-channel, pass the pkt on up the stack so that +* mlme can make use of it +*/ +if (ieee80211_cfg_on_oper_channel (sdata->local) + && (channel == sdata->local->oper_channel)) +return RX_CONTINUE ;Ah, neat trick, no need to duplicate the packet :-)
But didn't you say this wasn't necessary since timers were stopped anyway during scan? So maybe the comment shouldn't refer to scanning, but other work?
Timers are stopped only if we are off-channel for scanning, I think. And, they are NOT stopped when we go off channel for work_work(). Even if the packets are not currently used by the rest of the stack, it seems logically sound to pass them up in this case.
Quoted 22 lines
net/mac80211/scan.c static void __ieee80211_scan_completed_finish(struct ieee80211_hw *hw, · line 303
Quoted 8 lines
net/mac80211/scan.c +1
-0dev_kfree_skb (skb);return RX_QUEUED ; }@@ -293,15 +300,28 @@ static void __ieee80211_scan_completed_finish(struct ieee80211_hw *hw, bool was_hw_scan) {struct ieee80211_local *local =hw_to_local (hw); +bool ooc;That might be nicer if it was a bit more verbose. Same with ooc2 I think. I suppose it's understandable though, so if it really gets messy with long lines maybe we shouldn't worry about it.
Quoted 9 lines
net/mac80211/scan.c +8
-1-if (local->scan_channel) { + next_chan = local->scan_req->channels[local->scan_channel_idx]; + +if (ieee80211_cfg_on_oper_channel (local)) { +/* We're currently on operating channel. */ +if ((next_chan == local->oper_channel)&& + (local->_oper_channel_type ==NL80211_CHAN_NO_HT )) +/* We don't need to move off of operating channel. */ + local->next_scan_state =SCAN_SET_CHANNEL ;
Quoted 8 lines
net/mac80211/scan.c static void ieee80211_scan_state_decision(struct ieee80211_local *local, · line 575
Quoted 5 lines
net/mac80211/scan.c +5
-0+else +/* +* We do need to leave operating channel, as next +* scan is somewhere else. +*/ Hmm, is that really "leave"? You aren't sorting (yet) so might this not go back onto the operating channel then?
I'm checking next_chan, and it's not operating channel (or at least the channel_type must change), so yes, I think we really are leaving here.
Quoted 11 lines
Review ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) · line 261
Quoted 9 lines
(quoted diff) +3
-1+++ b/net/mac80211/tx.c@@ -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)&&Shouldn't that be || ? Or only the off-channel check I think?
The old check was for scan-off-channel flag. That is equiv to sw-scanning AND state-offchannel.
So, I don't think the logic changes much here...except that we used to be 'scanning-off-channel' even if we were on-channel.
I think we should be able to do normal tx if scanning on-channel, so I think this code is correct.
One thing: If we are normally operating in HT40 mode, we have to shift to NO_HT for scanning. But, I think we could probably still transmit packets even if we are temporarily in NO_HT, right? So, follow-on patches might be able to relax the is-on-channel checks slightly to take channel-type co-existence into account.
Quoted 9 lines
Quoted 9 lines
net/mac80211/work.c +6
-1local->tmp_channel = wk->chan; local->tmp_channel_type = wk->chan_type; -ieee80211_hw_config (local,0 ); +/* +* Leave the station vifs in awake mode if they +* happen to be on the same channel as +* the requested channel. +*/ + ooc2 =ieee80211_cfg_on_oper_channel (local);
Quoted 8 lines
net/mac80211/work.c static void ieee80211_work_work(struct work_struct *work) · line 946
Quoted 4 lines
net/mac80211/work.c +4
-0+if (ooc != ooc2) { +if (ooc2) { +/* went off operating channel */ +ieee80211_offchannel_stop_vifs (local);"went" is a little misleading, I think it needs to be "will go"? It shouldn't be "went" since we need to stop first and then switch channels.
We logically went off-channel in mac80211. We just haven't told the NIC about it yet... I'll try to make that more clear.
v9 coming soon :)
Thanks,
Ben
Quoted 2 lines
johannes
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Johannes Berg
maintainerQuoted 6 lines · Ben Greear
Quoted 6 lines
net/mac80211/main.c int ieee80211_hw_config(struct ieee80211_local *local, u32 changed) · line 148
Quoted 3 lines
net/mac80211/main.c +3
-0+/* If this off-channel logic ever changes, ieee80211_on_oper_channel +* may need to change as well. +*/ Would it make sense to roll this thing into one?
Quoted 8 lines
Quoted 3 lines
Like "
ieee80211_get_desired_channel(local,&chan,&chantype)"and then this code and
on_oper_channelwould use that?As you say, the patch is big and scary already. I would like to attempt this change as a small follow-on patch that does just one thing. To me, the open-coded logic is a bit more similar to existing logic and thus easier to review.
Yeah that's a good plan.
Quoted 12 lines
Quoted 11 lines
net/mac80211/scan.c ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb) · line 220
Quoted 6 lines
net/mac80211/scan.c +6
-0+/* If we are scanning on-channel, pass the pkt on up the stack so that +* mlme can make use of it +*/ +if (ieee80211_cfg_on_oper_channel (sdata->local) + && (channel == sdata->local->oper_channel)) +return RX_CONTINUE ;Ah, neat trick, no need to duplicate the packet :-)
But didn't you say this wasn't necessary since timers were stopped anyway during scan? So maybe the comment shouldn't refer to scanning, but other work?
Quoted 4 lines
Timers are stopped only if we are off-channel for scanning, I think. And, they are NOT stopped when we go off channel for
work_work(). Even if the packets are not currently used by the rest of the stack, it seems logically sound to pass them up in this case.
Right. But could you change the comment to clarify?
Quoted 11 lines
Quoted 7 lines
net/mac80211/scan.c static void ieee80211_scan_state_decision(struct ieee80211_local *local, · line 575
Quoted 4 lines
net/mac80211/scan.c +4
-0+/* +* We do need to leave operating channel, as next +* scan is somewhere else. +*/ Hmm, is that really "leave"? You aren't sorting (yet) so might this not go back onto the operating channel then?
I'm checking
next_chan, and it's not operating channel (or at least thechannel_typemust change), so yes, I think we really are leaving here.
Ok.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
+++
b/net/mac80211/tx.cnet/mac80211/tx.c +0
-0@@ -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 ;
Quoted 8 lines
Quoted 5 lines
Review ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) · line 261
Quoted 3 lines
(quoted diff) +2
-1- 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)&&Shouldn't that be || ? Or only the off-channel check I think?
The old check was for scan-off-channel flag. That is equiv to sw-scanning AND state-offchannel.
Oh, true. I was just thinking this should also kick in for work stuff off-channel.
Come to think of it -- what if work isn't off-channel, but needs to disable powersave?
Quoted 3 lines
One thing: If we are normally operating in HT40 mode, we have to shift to
NO_HTfor scanning. But, I think we could probably still transmit packets even if we are temporarily inNO_HT, right?
Oh, hmm, that might be tricky depending on the rate scale algorithm and the device. But do we really have to shift to NO_HT for scanning?
Quoted 3 lines
So,
follow-on patches might be able to relax the is-on-channel checks slightly to take channel-type co-existence into account.
Right.
Quoted 1 line
v9 coming soon :)
:)
Thanks!
johannes
Quoted 31 lines · Johannes Berg
Quoted 6 lines · Ben Greear
Quoted 6 lines
net/mac80211/main.c int ieee80211_hw_config(struct ieee80211_local *local, u32 changed) · line 148
Quoted 3 lines
net/mac80211/main.c +3
-0+/* If this off-channel logic ever changes, ieee80211_on_oper_channel +* may need to change as well. +*/ Would it make sense to roll this thing into one?
Quoted 8 lines
Quoted 3 lines
Like "
ieee80211_get_desired_channel(local,&chan,&chantype)"and then this code and
on_oper_channelwould use that?As you say, the patch is big and scary already. I would like to attempt this change as a small follow-on patch that does just one thing. To me, the open-coded logic is a bit more similar to existing logic and thus easier to review.
Yeah that's a good plan.
Quoted 12 lines
Quoted 11 lines
net/mac80211/scan.c ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb) · line 220
Quoted 6 lines
net/mac80211/scan.c +6
-0+/* If we are scanning on-channel, pass the pkt on up the stack so that +* mlme can make use of it +*/ +if (ieee80211_cfg_on_oper_channel (sdata->local) + && (channel == sdata->local->oper_channel)) +return RX_CONTINUE ;Ah, neat trick, no need to duplicate the packet :-)
But didn't you say this wasn't necessary since timers were stopped anyway during scan? So maybe the comment shouldn't refer to scanning, but other work?
Quoted 6 lines
Quoted 4 lines
Timers are stopped only if we are off-channel for scanning, I think. And, they are NOT stopped when we go off channel for
work_work(). Even if the packets are not currently used by the rest of the stack, it seems logically sound to pass them up in this case.Right. But could you change the comment to clarify?
Sure, will do. I'm making the comment slightly more generic, but let me know if you want it changed.
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Review ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) · line 261
Quoted 8 lines
+++
b/net/mac80211/tx.c(quoted diff) +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)&&Shouldn't that be || ? Or only the off-channel check I think?
Quoted 8 lines
Quoted 2 lines
The old check was for scan-off-channel flag. That is equiv to sw-scanning AND state-offchannel.
Oh, true. I was just thinking this should also kick in for work stuff off-channel.
Come to think of it -- what if work isn't off-channel, but needs to disable powersave?
I don't know. I tried to change the work logic as little as possible while dealing with just on/off channel changes. If work has power-save requirements, then probably we'd need to add a new flag and explicitly deal with power-save instead of relying on some subtle effect of going on or off channel.
Quoted 6 lines
Quoted 3 lines
One thing: If we are normally operating in HT40 mode, we have to shift to
NO_HTfor scanning. But, I think we could probably still transmit packets even if we are temporarily inNO_HT, right?Oh, hmm, that might be tricky depending on the rate scale algorithm and the device. But do we really have to shift to
NO_HTfor scanning?
I have no idea. The current code explicitly sets NO_HT (ie, config_hw() when scan_chan is set).
If we can scan on other channel-types, then that would be another thing to add in a new patch. This would be of interest to me since currently the 'scan-on-channel' doesn't really save much work if we are running any type of HT mode...
Thanks,
Ben
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com