ath9k: Check for identical channels when changing channels.
PATCH 1/2 ath9k: Check for identical channels when changing channels.
From: Ben Greear <[email protected]>
Don't do un-needed work. Should be useful when scanning on only the working channel.
---
:100644 100644 a133878... 4d34ba5... M drivers/net/wireless/ath/ath9k/main.c
drivers/net/wireless/ath/ath9k/main.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +5 -0
@@ -1602,6 +1602,11 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)struct ieee80211_channel *curchan = hw->conf.channel;int pos = curchan->hw_value; +/* If channels are the same, then don't actually do anything. +*/ +if (sc->sc_ah->curchan == &sc->sc_ah->channels[pos]) + goto skip_chan_change; + aphy->chan_idx = pos; aphy->chan_is_ht =conf_is_ht (conf);if (hw->conf.flags &IEEE80211_CONF_OFFCHANNEL )
Signature · 1 line
1.7.2.2
PATCH 2/2 mac80211: Allow scanning single channel if other VIF is associated.
From: Ben Greear <[email protected]>
This patch aims to decrease channel switching when there is at least one interface associated. This should help multiple station interfaces co-exist on the same hardware, especially in WPA mode.
---
:100644 100644 f0518b0... 7ecf8b0... M include/linux/nl80211.h
:100644 100644 a0613ff... f355b8c... M include/net/cfg80211.h
:100644 100644 945fbf2... ac720d2... M net/mac80211/ieee80211_i.h
:100644 100644 8b733cf... 6323954... M net/mac80211/mlme.c
:100644 100644 0b0e83e... 318b2de... M net/mac80211/rx.c
:100644 100644 57b5e66... 59d5925... M net/mac80211/scan.c
:100644 100644 ae344d1... 1bfc1e0... M net/mac80211/work.c
:100644 100644 4ff827e... b45646e... M net/wireless/nl80211.c
:100644 100644 f161b98... 87b0cd7... M net/wireless/sme.c
include/linux/nl80211.h | 2 + include/net/cfg80211.h | 3 + net/mac80211/ieee80211_i.h | 2 + net/mac80211/mlme.c | 14 +++-- net/mac80211/rx.c | 2 +- net/mac80211/scan.c | 110 +++++++++++++++++++++++++++++++++----------- net/mac80211/work.c | 17 ++++-- net/wireless/nl80211.c | 6 ++ net/wireless/sme.c | 5 ++ 9 files changed, 121 insertions(+), 40 deletions(-)
include/linux/nl80211.h +2 -0
@@ -965,6 +965,8 @@ enum nl80211_attrs {NL80211_ATTR_CONTROL_PORT_ETHERTYPE ,NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT , +NL80211_ATTR_SCAN_ONE_IF_ASSOC , +/* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,
include/net/cfg80211.h +3 -0
@@ -667,6 +667,8 @@ struct cfg80211_ssid {* @wiphy: the wiphy this was for * @dev: the interface * @aborted: (internal) scan request was notified as aborted +* @can_scan_one: If true, only scan active channel if at least one +* vif is already associated. */ struct cfg80211_scan_request {struct cfg80211_ssid *ssids;
@@ -679,6 +681,7 @@ struct cfg80211_scan_request {struct wiphy *wiphy;struct net_device *dev;bool aborted; +bool can_scan_one;/* keep last */ struct ieee80211_channel *channels[0 ];
net/mac80211/ieee80211_i.h +2 -0
@@ -815,6 +815,8 @@ struct ieee80211_local {enum ieee80211_band hw_scan_band;int scan_channel_idx;int scan_ies_len; +int scanned_count;/* how many channels scanned so far in this scan */ +bool scan_probe_once;/* if true, scan only the current channel. */ unsigned long leave_oper_channel_time;enum mac80211_scan_state next_scan_state;
net/mac80211/mlme.c +8 -6
@@ -1863,10 +1863,11 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata)else if (ifmgd->probe_send_count <IEEE80211_MAX_PROBE_TRIES ) {#ifdef CONFIG_MAC80211_VERBOSE_DEBUG -printk (KERN_DEBUG "No probe response from AP %pM" -" after %dms, try %d\n" , bssid, +printk (KERN_DEBUG "%s: No probe response from AP %pM" +" after %dms, try %d flags: 0x%x\n" , + sdata->dev->name, bssid, (1000 *IEEE80211_PROBE_WAIT )/HZ , - ifmgd->probe_send_count); + ifmgd->probe_send_count, ifmgd->flags);#endif ieee80211_mgd_probe_ap_send (sdata); }else {
@@ -1876,9 +1877,10 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata)*/ ifmgd->flags &= ~(IEEE80211_STA_CONNECTION_POLL |IEEE80211_STA_BEACON_POLL ); -printk (KERN_DEBUG "No probe response from AP %pM" -" after %dms, disconnecting.\n" , - bssid, (1000 *IEEE80211_PROBE_WAIT )/HZ ); +printk (KERN_DEBUG "%s: No probe response from AP %pM" +" after %dms, disconnecting, flags: 0x%x\n" , + sdata->dev->name, bssid, + (1000 *IEEE80211_PROBE_WAIT )/HZ , ifmgd->flags);ieee80211_set_disassoc (sdata, true);mutex_unlock (&ifmgd->mtx);mutex_lock (&local->mtx);
net/mac80211/rx.c +1 -1
@@ -2407,7 +2407,7 @@ static void ieee80211_rx_handlers(struct ieee80211_rx_data *rx,do { \ res =rxh (rx); \if (res !=RX_CONTINUE ) \ - goto rxh_next; \ + goto rxh_next; \ }while (0 );while ((skb =__skb_dequeue (frames))) {
net/mac80211/scan.c +83 -27
172 lines not on this page · raw message
net/mac80211/work.c +11 -6
@@ -910,12 +910,17 @@ static void ieee80211_work_work(struct work_struct *work)* happen to be on the same channel as * the requested channel */ -ieee80211_offchannel_stop_beaconing (local); -ieee80211_offchannel_stop_station (local); - - local->tmp_channel = wk->chan; - local->tmp_channel_type = wk->chan_type; -ieee80211_hw_config (local,0 ); +if (!(wk->chan == local->scan_channel || + (wk->chan == local->oper_channel && + !local->scan_channel))) { +/* Only change channels if we need to */ +ieee80211_offchannel_stop_beaconing (local); +ieee80211_offchannel_stop_station (local); + + local->tmp_channel = wk->chan; + local->tmp_channel_type = wk->chan_type; +ieee80211_hw_config (local,0 ); + } started = true; wk->timeout = jiffies; }
net/wireless/nl80211.c +6 -0
@@ -138,6 +138,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { [NL80211_ATTR_CONTROL_PORT] = { .type = NLA_FLAG }, [NL80211_ATTR_CONTROL_PORT_ETHERTYPE] = { .type = NLA_U16 }, [NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT] = { .type = NLA_FLAG }, + [NL80211_ATTR_SCAN_ONE_IF_ASSOC] = { .type = NLA_FLAG }, [NL80211_ATTR_PRIVACY] = { .type = NLA_FLAG }, [NL80211_ATTR_CIPHER_SUITE_GROUP] = { .type = NLA_U32 }, [NL80211_ATTR_WPA_VERSIONS] = { .type = NLA_U32 },
@@ -3217,6 +3218,11 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) goto out; } +if (info->attrs[NL80211_ATTR_SCAN_ONE_IF_ASSOC ]) + request->can_scan_one = true; +else + request->can_scan_one = false; +if (n_ssids) request->ssids = (void *)&request->channels[n_channels]; request->n_ssids = n_ssids;
net/wireless/sme.c +5 -0
@@ -105,6 +105,11 @@ static int cfg80211_conn_scan(struct wireless_dev *wdev)if (!request)return -ENOMEM ; +/* If at least one VIF on this hardware is already associated, then +* only scan on the active channel. +*/ + request->can_scan_one = true; +if (wdev->conn->params.channel) request->channels[0 ] = wdev->conn->params.channel;else {
Signature · 1 line
1.7.2.2
Johannes Berg
maintainerRe: [PATCH 2/2] mac80211: Allow scanning single channel if other VIF is associated.
Quoted 5 lines · On Mon, 2010-09-27 at 17:07 -0700, [email protected] wrote:
From: Ben Greear <[email protected]>
This patch aims to decrease channel switching when there is at least one interface associated. This should help multiple station interfaces co-exist on the same hardware, especially in WPA mode.
Totally NACK. The code is ugly, complex, and unnecessary.
You can make wpa_s scan the channels one by one, or you can improve the off-channel behaviour, but this is a workaround that just isn't appropriate.
johannes
Re: [PATCH 2/2] mac80211: Allow scanning single channel if other VIF is associated.
Quoted 7 lines · Johannes Berg
Quoted 5 lines · On Mon, 2010-09-27 at 17:07 -0700, [email protected] wrote:
From: Ben Greear<[email protected]>
This patch aims to decrease channel switching when there is at least one interface associated. This should help multiple station interfaces co-exist on the same hardware, especially in WPA mode.
Quoted 5 lines
Totally NACK. The code is ugly, complex, and unnecessary.
You can make
wpa_sscan the channels one by one, or you can improve the off-channel behaviour, but this is a workaround that just isn't appropriate.
At best, it would be a race for wpa_s to determine if any other interface on it's interface's hardware is associated, so I don't see a good way to do this in user-space.
When at least one is associated, I don't want the NIC to go offchannel at all, at least not for wpa_s scanning. Anything else is going to interrupt other stations's traffic, and for no good reason that I can see, since the scanning interface must associate on the same channel as the rest of the stations anyway.
If you have any suggestions for how to accomplish this, please let me know.. otherwise, I can just carry this patch in my tree.
Thanks,
Ben
Quoted 2 lines
johannes
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Johannes Berg
maintainerRe: [PATCH 2/2] mac80211: Allow scanning single channel if other VIF is associated.
Quoted 4 lines · Ben Greear
At best, it would be a race for
wpa_sto determine if any other interface on it's interface's hardware is associated, so I don't see a good way to do this in user-space.
Quoted 8 lines
When at least one is associated, I don't want the NIC to go offchannel at all, at least not for
wpa_sscanning. Anything else is going to interrupt other stations's traffic, and for no good reason that I can see, since the scanning interface must associate on the same channel as the rest of the stations anyway.If you have any suggestions for how to accomplish this, please let me know.. otherwise, I can just carry this patch in my tree.
You can run all networks in a single wpa_s instance, I believe, and then it'd know about all this, right?
johannes
Re: [PATCH 2/2] mac80211: Allow scanning single channel if other VIF is associated.
Quoted 12 lines · Johannes Berg
Quoted 10 lines · Ben Greear
At best, it would be a race for
wpa_sto determine if any other interface on it's interface's hardware is associated, so I don't see a good way to do this in user-space.When at least one is associated, I don't want the NIC to go offchannel at all, at least not for
wpa_sscanning. Anything else is going to interrupt other stations's traffic, and for no good reason that I can see, since the scanning interface must associate on the same channel as the rest of the stations anyway.
Quoted 5 lines
Quoted 2 lines
If you have any suggestions for how to accomplish this, please let me know.. otherwise, I can just carry this patch in my tree.
You can run all networks in a single
wpa_sinstance, I believe, and then it'd know about all this, right?
But then, if you want to add an additional interface, you have to restart everything.
I was thinking that maybe I could keep the logic in wpa_s, but instead of all the special casing, just locate the current associated channel for the phy in question and populate the scan-req with that single channel.
Then, I think I wouldn't have to muck with much of the scan logic..just a bit of code on the entry point to select the proper channel.
Does that sound like a possible solution to you?
Thanks,
Ben
Quoted 2 lines
johannes
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Johannes Berg
maintainerRe: [PATCH 2/2] mac80211: Allow scanning single channel if other VIF is associated.
Quoted 5 lines · Ben Greear
Quoted 2 lines
You can run all networks in a single
wpa_sinstance, I believe, and then it'd know about all this, right?But then, if you want to add an additional interface, you have to restart everything.
Well, you can add it dynamically over dbus or the unix socket control interface.
Quoted 8 lines
I was thinking that maybe I could keep the logic in
wpa_s, but instead of all the special casing, just locate the current associated channel for the phy in question and populate the scan-req with that single channel.Then, I think I wouldn't have to muck with much of the scan logic..just a bit of code on the entry point to select the proper channel.
Does that sound like a possible solution to you?
I don't care all that much, but I really don't like the in-kernel workaround. For that, you'd have to iterate over "iw <wlanX> link" I suppose.
johannes
Re: [PATCH 2/2] mac80211: Allow scanning single channel if other VIF is associated.
In reply to Ben GreearQuoted 6 lines · Ben Greear
Quoted 2 lines · Johannes Berg
You can run all networks in a single
wpa_sinstance, I believe, and then it'd know about all this, right?But then, if you want to add an additional interface, you have to restart everything.
We would you restart everything? You can add/remove interface dynamically..
Quoted 3 lines
I was thinking that maybe I could keep the logic in
wpa_s, but instead of all the special casing, just locate the current associated channel for the phy in question and populate the scan-req with that single channel.
wpa_supplicant already stores the operating channel: wpa_s->assoc_freq. You can iterate over the configured interfaces and fetch the current operating channel(s) using that without adding anything new to the kernel. With that, you could make some wpa_supplicant scans (e.g., bgscan or scan for new networks if only a single network block is enabled) restrict the list of channels to scan. Still, some other scan requests (e.g., user initiated full scan or P2P Search) would need to be able to specify more channels even if one of the interfaces is associated.
I would like to get rid of the one-channel-per-phy restriction, so I don't think I would like to see new code added for that.
Signature · 1 line
Jouni Malinen PGP id EFC895FA
Re: [PATCH 2/2] mac80211: Allow scanning single channel if other VIF is associated.
Quoted 10 lines · Jouni Malinen
Quoted 6 lines · Ben Greear
Quoted 2 lines · Johannes Berg
You can run all networks in a single
wpa_sinstance, I believe, and then it'd know about all this, right?But then, if you want to add an additional interface, you have to restart everything.
We would you restart everything? You can add/remove interface dynamically..
I prefer to run one supplicant process per interface..just makes everything easier in my environment.
Quoted 4 lines
Quoted 3 lines
I was thinking that maybe I could keep the logic in
wpa_s, but instead of all the special casing, just locate the current associated channel for the phy in question and populate the scan-req with that single channel.
Quoted 9 lines
wpa_supplicantalready stores the operating channel:wpa_s->assoc_freq. You can iterate over the configured interfaces and fetch the current operating channel(s) using that without adding anything new to the kernel. With that, you could make somewpa_supplicantscans (e.g., bgscan or scan for new networks if only a single network block is enabled) restrict the list of channels to scan. Still, some other scan requests (e.g., user initiated full scan or P2P Search) would need to be able to specify more channels even if one of the interfaces is associated.
Even if wpa_supplicant can work around this in user-space, the kernel scanning logic for non-supplicant controlled interfaces still needs the kernel portion.
That said, it looks like the patch is DOA as Johannes doesn't like it at all, so I'll quite submitting it :)
Quoted 2 lines
I would like to get rid of the one-channel-per-phy restriction, so I don't think I would like to see new code added for that.
If that ever happened, then the can_scan_one logic could simply indicate you want to scan only on associated channels, not all of them. It would still help by not scanning on channels you have no intention of using because other VIFs are already associated on channels you do wish to use.
Thanks,
Ben
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Quoted 16 lines · On 2010-09-28 2:07 AM, [email protected] wrote:
From: Ben Greear <[email protected]>
Don't do un-needed work. Should be useful when scanning on only the working channel.
Signed-off-by Ben Greear <[email protected]>---
:100644 100644 a133878... 4d34ba5... Mdrivers/net/wireless/ath/ath9k/main.cdrivers/net/wireless/ath/ath9k/main.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)drivers/net/wireless/ath/ath9k/main.c +0
-0
drivers/net/wireless/ath/ath9k/main.c static int ath9k_config(struct ieee80211_hw *hw, u32 changed) · line 1609
Quoted 8 lines
drivers/net/wireless/ath/ath9k/main.c +5
-0@@ -1602,6 +1602,11 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)struct ieee80211_channel *curchan = hw->conf.channel;int pos = curchan->hw_value; +/* If channels are the same, then don't actually do anything. +*/ +if (sc->sc_ah->curchan == &sc->sc_ah->channels[pos]) + goto skip_chan_change; +
NACK. This ignores off-channel flag changes, which are important for calibration.
- Felix
Quoted 20 lines · Felix Fietkau
Quoted 19 lines · On 2010-09-28 2:07 AM, [email protected] wrote:
From: Ben Greear<[email protected]>
Don't do un-needed work. Should be useful when scanning on only the working channel.
Signed-off-by Ben Greear<[email protected]>---
:100644 100644 a133878... 4d34ba5... Mdrivers/net/wireless/ath/ath9k/main.cdrivers/net/wireless/ath/ath9k/main.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)drivers/net/wireless/ath/ath9k/main.c +0
-0@@ -1602,6 +1602,11 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)struct ieee80211_channel *curchan = hw->conf.channel;int pos = curchan->hw_value;
Quoted 7 lines
drivers/net/wireless/ath/ath9k/main.c static int ath9k_config(struct ieee80211_hw *hw, u32 changed) · line 1609
Quoted 5 lines
drivers/net/wireless/ath/ath9k/main.c +5
-0+/* If channels are the same, then don't actually do anything. +*/ +if (sc->sc_ah->curchan ==&sc->sc_ah->channels[pos]) + goto skip_chan_change; +NACK. This ignores off-channel flag changes, which are important for calibration.
Is it enough to just add a check to make sure no changes were made to the SC_OP_OFFCHANNEL flag?
Thanks,
Ben
Quoted 2 lines
- Felix
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Quoted 29 lines · Ben Greear
Quoted 20 lines · Felix Fietkau
Quoted 19 lines · On 2010-09-28 2:07 AM, [email protected] wrote:
From: Ben Greear<[email protected]>
Don't do un-needed work. Should be useful when scanning on only the working channel.
Signed-off-by Ben Greear<[email protected]>---
:100644 100644 a133878... 4d34ba5... Mdrivers/net/wireless/ath/ath9k/main.cdrivers/net/wireless/ath/ath9k/main.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)drivers/net/wireless/ath/ath9k/main.c +0
-0@@ -1602,6 +1602,11 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)struct ieee80211_channel *curchan = hw->conf.channel;int pos = curchan->hw_value;Quoted 7 lines
drivers/net/wireless/ath/ath9k/main.c static int ath9k_config(struct ieee80211_hw *hw, u32 changed) · line 1609
Quoted 5 lines
drivers/net/wireless/ath/ath9k/main.c +5
-0+/* If channels are the same, then don't actually do anything. +*/ +if (sc->sc_ah->curchan ==&sc->sc_ah->channels[pos]) + goto skip_chan_change; +NACK. This ignores off-channel flag changes, which are important for calibration.
Quoted 2 lines
Is it enough to just add a check to make sure no changes were made to the
SC_OP_OFFCHANNELflag?
Shouldn't this check be done in mac80211 then?
- Felix
Quoted 30 lines · Felix Fietkau
Quoted 29 lines · Ben Greear
Quoted 27 lines · Felix Fietkau
Quoted 16 lines · On 2010-09-28 2:07 AM, [email protected] wrote:
From: Ben Greear<[email protected]>
Don't do un-needed work. Should be useful when scanning on only the working channel.
Signed-off-by Ben Greear<[email protected]>---
:100644 100644 a133878... 4d34ba5... Mdrivers/net/wireless/ath/ath9k/main.cdrivers/net/wireless/ath/ath9k/main.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)drivers/net/wireless/ath/ath9k/main.c +0
-0drivers/net/wireless/ath/ath9k/main.c static int ath9k_config(struct ieee80211_hw *hw, u32 changed) · line 1609
Quoted 8 lines
drivers/net/wireless/ath/ath9k/main.c +5
-0@@ -1602,6 +1602,11 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)struct ieee80211_channel *curchan = hw->conf.channel;int pos = curchan->hw_value; +/* If channels are the same, then don't actually do anything. +*/ +if (sc->sc_ah->curchan ==&sc->sc_ah->channels[pos]) + goto skip_chan_change; +NACK. This ignores off-channel flag changes, which are important for calibration.
Quoted 3 lines
Quoted 2 lines
Is it enough to just add a check to make sure no changes were made to the
SC_OP_OFFCHANNELflag?Shouldn't this check be done in mac80211 then?
Maybe so...I was curious why the check wasn't already in place, and assumed that maybe some drivers needed it, or maybe the calling code doesn't always know the driver's current channel?
Thanks,
Ben
Quoted 2 lines
- Felix
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com