Skip to contentSkip to conversation

mac80211: Make STA disconnect messages warn instead of debug.

PATCH In review [email protected] 3 participants 13 messages Feb 7, 2011 – Feb 14, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/7 mac80211: Make STA disconnect messages warn instead of debug.

From: Ben Greear <[email protected]>

This makes them more easily seen in /var/log/messages and the console, for instance.

---
:100644 100644 f77adf1... 340bef6... M net/mac80211/mlme.c

 net/mac80211/mlme.c |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)
net/mac80211/mlme.c +14 -14
index f77adf1..340bef6 100644
@@ -2019,10 +2019,10 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata)
 				ieee80211_mgd_probe_ap_send(sdata);
 			} else {
 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
-				wiphy_debug(local->hw.wiphy,
-					    "%s: No ack for nullfunc frame to"
-					    " AP %pM, disconnecting.\n",
-					    sdata->name, bssid);
+				wiphy_warn(local->hw.wiphy,
+					   "%s: No ack for nullfunc frame to"
+					   " AP %pM, disconnecting.\n",
+					   sdata->name, bssid);
 #endif
 				ieee80211_sta_connection_lost(sdata, bssid);
 			}
@@ -2030,11 +2030,11 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata)
 			run_again(ifmgd, ifmgd->probe_timeout);
 		else if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) {
 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
-			wiphy_debug(local->hw.wiphy,
-				    "%s: Failed to send nullfunc to AP %pM"
-				    " after %dms, disconnecting.\n",
-				    sdata->name,
-				    bssid, probe_wait_ms);
+			wiphy_warn(local->hw.wiphy,
+				   "%s: Failed to send nullfunc to AP %pM"
+				   " after %dms, disconnecting.\n",
+				   sdata->name,
+				   bssid, probe_wait_ms);
 #endif
 			ieee80211_sta_connection_lost(sdata, bssid);
 		} else if (ifmgd->probe_send_count < max_tries) {
@@ -2052,11 +2052,11 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata)
 			 * We actually lost the connection ... or did we?
 			 * Let's make sure!
 			 */
-			wiphy_debug(local->hw.wiphy,
-				    "%s: No probe response from AP %pM"
-				    " after %dms, disconnecting.\n",
-				    sdata->name,
-				    bssid, probe_wait_ms);
+			wiphy_warn(local->hw.wiphy,
+				   "%s: No probe response from AP %pM"
+				   " after %dms, disconnecting.\n",
+				   sdata->name,
+				   bssid, probe_wait_ms);
 
 			ieee80211_sta_connection_lost(sdata, bssid);
 		}
Signature · 1 line
1.7.2.3
#1 lore raw

PATCH 2/7 ath9k: Print channel-type in chan-change dbg message.

From: Ben Greear <[email protected]>

---
:100644 100644 70bb871... 1447887... M drivers/net/wireless/ath/ath9k/main.c

 drivers/net/wireless/ath/ath9k/main.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +3 -2
index 70bb871..1447887 100644
@@ -1677,8 +1677,9 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
 		else
 			sc->sc_flags &= ~SC_OP_OFFCHANNEL;
 
-		ath_dbg(common, ATH_DBG_CONFIG, "Set channel: %d MHz\n",
-			curchan->center_freq);
+		ath_dbg(common, ATH_DBG_CONFIG,
+			"Set channel: %d MHz type: %d\n",
+			curchan->center_freq, conf->channel_type);
 
 		ath9k_cmn_update_ichannel(&sc->sc_ah->channels[pos],
 					  curchan, conf->channel_type);
Signature · 1 line
1.7.2.3
#2 lore raw

PATCH 3/7 mac80211: Properly set work-item channel-type.

In reply to [email protected]

From: Ben Greear <[email protected]>

Some were indirectly set to NO_HT (zero), but I think it's better to explicitly set it in case the enum ever changes. In cfg.c, it seems the channel-type was just ignored (and thus always set to NO_HT).

---
:100644 100644 a7cd6a1... 9938f7f... M net/mac80211/cfg.c
:100644 100644 340bef6... cd68f2a... M net/mac80211/mlme.c

 net/mac80211/cfg.c  |    1 +
 net/mac80211/mlme.c |    2 ++
 2 files changed, 3 insertions(+), 0 deletions(-)
net/mac80211/cfg.c +1 -0
index a7cd6a1..9938f7f 100644
@@ -1871,6 +1871,7 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct net_device *dev,
 
 	wk->type = IEEE80211_WORK_OFFCHANNEL_TX;
 	wk->chan = chan;
+	wk->chan_type = channel_type;
 	wk->sdata = sdata;
 	wk->done = ieee80211_offchan_tx_done;
 	wk->offchan_tx.frame = skb;
net/mac80211/mlme.c +2 -0
index 340bef6..cd68f2a 100644
@@ -2294,6 +2294,7 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
 	else
 		wk->type = IEEE80211_WORK_DIRECT_PROBE;
 	wk->chan = req->bss->channel;
+	wk->chan_type = NL80211_CHAN_NO_HT;
 	wk->sdata = sdata;
 	wk->done = ieee80211_probe_auth_done;
 
@@ -2443,6 +2444,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
 		memcpy(wk->assoc.prev_bssid, req->prev_bssid, ETH_ALEN);
 
 	wk->chan = req->bss->channel;
+	wk->chan_type = NL80211_CHAN_NO_HT;
 	wk->sdata = sdata;
 	wk->done = ieee80211_assoc_done;
 	if (!bss->dtim_period &&
Signature · 1 line
1.7.2.3
maintainer Acked-by on v1 3/7
#3 lore raw

Re: [PATCH 3/7] mac80211: Properly set work-item channel-type.

Quoted 6 lines · On Mon, 2011-02-07 at 13:44 -0800, [email protected] wrote:

From: Ben Greear <[email protected]>

Some were indirectly set to NO_HT (zero), but I think it's better to explicitly set it in case the enum ever changes. In cfg.c, it seems the channel-type was just ignored (and thus always set to NO_HT).

Quoted 40 lines

---
:100644 100644 a7cd6a1... 9938f7f... M net/mac80211/cfg.c
:100644 100644 340bef6... cd68f2a... M net/mac80211/mlme.c

 net/mac80211/cfg.c  |    1 +
 net/mac80211/mlme.c |    2 ++
 2 files changed, 3 insertions(+), 0 deletions(-)
net/mac80211/cfg.c +1 -0
index a7cd6a1..9938f7f 100644
@@ -1871,6 +1871,7 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct net_device *dev,
 
 	wk->type = IEEE80211_WORK_OFFCHANNEL_TX;
 	wk->chan = chan;
+	wk->chan_type = channel_type;
 	wk->sdata = sdata;
 	wk->done = ieee80211_offchan_tx_done;
 	wk->offchan_tx.frame = skb;
net/mac80211/mlme.c +2 -0
index 340bef6..cd68f2a 100644
@@ -2294,6 +2294,7 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
 	else
 		wk->type = IEEE80211_WORK_DIRECT_PROBE;
 	wk->chan = req->bss->channel;
+	wk->chan_type = NL80211_CHAN_NO_HT;
 	wk->sdata = sdata;
 	wk->done = ieee80211_probe_auth_done;
 
@@ -2443,6 +2444,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
 		memcpy(wk->assoc.prev_bssid, req->prev_bssid, ETH_ALEN);
 
 	wk->chan = req->bss->channel;
+	wk->chan_type = NL80211_CHAN_NO_HT;
 	wk->sdata = sdata;
 	wk->done = ieee80211_assoc_done;
 	if (!bss->dtim_period &&
#4 lore raw

PATCH 4/7 mac80211: Allow scanning on existing channel-type.

In reply to [email protected]

From: Ben Greear <[email protected]>

Previous code set the channel type to NO_HT, but it appears that NO_HT packets can be sent on any channel type, so we do not need to change the channel type as long as the channel is correct.

---
:100644 100644 c155c0b... 86562ce... M net/mac80211/main.c
:100644 100644 93da164... 1f277c9... M net/mac80211/scan.c

 net/mac80211/main.c |   16 ++++++++++++++--
 net/mac80211/scan.c |    6 ++----
 2 files changed, 16 insertions(+), 6 deletions(-)
net/mac80211/main.c +14 -2
index c155c0b..86562ce 100644
@@ -112,7 +112,13 @@ bool ieee80211_cfg_on_oper_channel(struct ieee80211_local *local)
 	/* This logic needs to match logic in ieee80211_hw_config */
 	if (local->scan_channel) {
 		chan = local->scan_channel;
-		channel_type = NL80211_CHAN_NO_HT;
+		/* If scanning on oper channel, use whatever channel-type
+		 * is currently in use.
+		 */
+		if (chan == local->oper_channel)
+			channel_type = local->_oper_channel_type;
+		else
+			channel_type = NL80211_CHAN_NO_HT;
 	} else if (local->tmp_channel) {
 		chan = scan_chan = local->tmp_channel;
 		channel_type = local->tmp_channel_type;
@@ -151,7 +157,13 @@ int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
 	offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
 	if (scan_chan) {
 		chan = scan_chan;
-		channel_type = NL80211_CHAN_NO_HT;
+		/* If scanning on oper channel, use whatever channel-type
+		 * is currently in use.
+		 */
+		if (chan == local->oper_channel)
+			channel_type = local->_oper_channel_type;
+		else
+			channel_type = NL80211_CHAN_NO_HT;
 	} else if (local->tmp_channel) {
 		chan = scan_chan = local->tmp_channel;
 		channel_type = local->tmp_channel_type;
net/mac80211/scan.c +2 -4
index 93da164..1f277c9 100644
@@ -574,8 +574,7 @@ static void ieee80211_scan_state_decision(struct ieee80211_local *local,
 
 	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))
+		if (next_chan == local->oper_channel)
 			/* We don't need to move off of operating channel. */
 			local->next_scan_state = SCAN_SET_CHANNEL;
 		else
@@ -677,8 +676,7 @@ static void ieee80211_scan_state_set_channel(struct ieee80211_local *local,
 	local->scan_channel = chan;
 
 	/* Only call hw-config if we really need to change channels. */
-	if ((chan != local->hw.conf.channel) ||
-	    (local->hw.conf.channel_type != NL80211_CHAN_NO_HT))
+	if (chan != local->hw.conf.channel)
 		if (ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL))
 			skip = 1;
 
Signature · 1 line
1.7.2.3
#5 lore raw

PATCH 5/7 mac80211: Allow work items to use existing channel type.

In reply to [email protected]

From: Ben Greear <[email protected]>

Narrow channel types can function within larger channel types. So, use existing channel type for work items when possible. This decreases hardware channel changes significantly when using non NO_HT channel types on the operating channel.

---
:100644 100644 6bf787a... 64f2b28... M net/mac80211/work.c

 net/mac80211/work.c |   53 ++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 50 insertions(+), 3 deletions(-)
net/mac80211/work.c +50 -3
index 6bf787a..64f2b28 100644
@@ -874,6 +874,44 @@ static void ieee80211_work_rx_queued_mgmt(struct ieee80211_local *local,
 	kfree_skb(skb);
 }
 
+static bool ieee80211_work_ct_coexists(enum nl80211_channel_type wk_ct,
+				       enum nl80211_channel_type oper_ct)
+{
+	switch (wk_ct) {
+	case NL80211_CHAN_NO_HT:
+		return true;
+	case NL80211_CHAN_HT20:
+		if (oper_ct != NL80211_CHAN_NO_HT)
+			return true;
+		return false;
+	case NL80211_CHAN_HT40MINUS:
+	case NL80211_CHAN_HT40PLUS:
+		return (wk_ct == oper_ct);
+	}
+	WARN_ON(1); /* shouldn't get here */
+	return false;
+}
+
+static enum nl80211_channel_type
+ieee80211_calc_ct(enum nl80211_channel_type wk_ct,
+		  enum nl80211_channel_type oper_ct)
+{
+	switch (wk_ct) {
+	case NL80211_CHAN_NO_HT:
+		return oper_ct;
+	case NL80211_CHAN_HT20:
+		if (oper_ct != NL80211_CHAN_NO_HT)
+			return oper_ct;
+		return wk_ct;
+	case NL80211_CHAN_HT40MINUS:
+	case NL80211_CHAN_HT40PLUS:
+		return wk_ct;
+	}
+	WARN_ON(1); /* shouldn't get here */
+	return wk_ct;
+}
+
+
 static void ieee80211_work_timer(unsigned long data)
 {
 	struct ieee80211_local *local = (void *) data;
@@ -927,14 +965,22 @@ static void ieee80211_work_work(struct work_struct *work)
 			bool on_oper_chan;
 			bool tmp_chan_changed = false;
 			bool on_oper_chan2;
+			enum nl80211_channel_type wk_ct;
 			on_oper_chan = ieee80211_cfg_on_oper_channel(local);
+
+			/* Work with existing channel type if possible. */
+			wk_ct = wk->chan_type;
+			if (wk->chan == local->hw.conf.channel)
+				wk_ct = ieee80211_calc_ct(wk->chan_type,
+						local->hw.conf.channel_type);
+
 			if (local->tmp_channel)
 				if ((local->tmp_channel != wk->chan) ||
-				    (local->tmp_channel_type != wk->chan_type))
+				    (local->tmp_channel_type != wk_ct))
 					tmp_chan_changed = true;
 
 			local->tmp_channel = wk->chan;
-			local->tmp_channel_type = wk->chan_type;
+			local->tmp_channel_type = wk_ct;
 			/*
 			 * Leave the station vifs in awake mode if they
 			 * happen to be on the same channel as
@@ -1031,7 +1077,8 @@ static void ieee80211_work_work(struct work_struct *work)
 			continue;
 		if (wk->chan != local->tmp_channel)
 			continue;
-		if (wk->chan_type != local->tmp_channel_type)
+		if (ieee80211_work_ct_coexists(wk->chan_type,
+					       local->tmp_channel_type))
 			continue;
 		remain_off_channel = true;
 	}
Signature · 1 line
1.7.2.3
#6 lore raw

PATCH 6/7 ath9k: Add debug info for configuring power level.

In reply to [email protected]

From: Ben Greear <[email protected]>

---
:100644 100644 1447887... e462a3f... M drivers/net/wireless/ath/ath9k/main.c

 drivers/net/wireless/ath/ath9k/main.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +2 -0
index 1447887..e462a3f 100644
@@ -1725,6 +1725,8 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
 	}
 
 	if (changed & IEEE80211_CONF_CHANGE_POWER) {
+		ath_dbg(common, ATH_DBG_CONFIG,
+			"Set power: %d\n", conf->power_level);
 		sc->config.txpowlimit = 2 * conf->power_level;
 		ath9k_ps_wakeup(sc);
 		ath9k_cmn_update_txpow(ah, sc->curtxpow,
Signature · 1 line
1.7.2.3
#7 lore raw

PATCH 7/7 mac80211: Ensure power-level set properly for scanning.

In reply to [email protected]

From: Ben Greear <[email protected]>

My previous patch to optimize scanning on operating channel accidentally removed the code that would ensure power was set to maximum for scanning.

This patch re-adds that functionality.

---
:100644 100644 86562ce... e7eb2cf... M net/mac80211/main.c
:100644 100644 1f277c9... ab8d2c6... M net/mac80211/scan.c

 net/mac80211/main.c |    3 ++-
 net/mac80211/scan.c |    9 ++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
net/mac80211/main.c +2 -1
index 86562ce..e7eb2cf 100644
@@ -199,7 +199,8 @@ int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
 		changed |= IEEE80211_CONF_CHANGE_SMPS;
 	}
 
-	if (scan_chan)
+	if ((local->scanning & SCAN_SW_SCANNING) ||
+	    (local->scanning & SCAN_HW_SCANNING))
 		power = chan->max_power;
 	else
 		power = local->power_constr_level ?
net/mac80211/scan.c +8 -1
index 1f277c9..ab8d2c6 100644
@@ -307,11 +307,15 @@ static void __ieee80211_scan_completed_finish(struct ieee80211_hw *hw,
 	mutex_lock(&local->mtx);
 	on_oper_chan = ieee80211_cfg_on_oper_channel(local);
 
+	WARN_ON(local->scanning & (SCAN_SW_SCANNING | SCAN_HW_SCANNING));
+
 	if (was_hw_scan || !on_oper_chan) {
 		if (WARN_ON(local->scan_channel))
 			local->scan_channel = NULL;
 		ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
-	}
+	} else
+		/* Set power back to normal operating levels. */
+		ieee80211_hw_config(local, 0);
 
 	if (!was_hw_scan) {
 		bool on_oper_chan2;
@@ -434,6 +438,9 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local)
 
 	ieee80211_configure_filter(local);
 
+	/* We need to set power level at maximum rate for scanning. */
+	ieee80211_hw_config(local, 0);
+
 	ieee80211_queue_delayed_work(&local->hw,
 				     &local->scan_work,
 				     IEEE80211_CHANNEL_TIME);
Signature · 1 line
1.7.2.3
#8 lore raw
In reply to [email protected]
Quoted 4 lines · [email protected] writes:

From: Ben Greear <[email protected]>

This makes them more easily seen in /var/log/messages and the console, for instance.

Messages like these are in the category "business as usual", which happens frequently when the device is moved. IMHO they are not really warnings. I'm worried that making the messages more visible might scare the users too much.

Signature · 1 line
Kalle Valo
author
#9 lore raw
Quoted 11 lines · Kalle Valo
Quoted 4 lines · [email protected] writes:

From: Ben Greear<[email protected]>

This makes them more easily seen in /var/log/messages and the console, for instance.

Messages like these are in the category "business as usual", which happens frequently when the device is moved. IMHO they are not really warnings. I'm worried that making the messages more visible might scare the users too much.

To me it seems more useful than the network up/down messages that are already printed from the networking core.

That said, I don't feel strongly about this change, and it's certainly an easy patch for me to carry in my own tree.

Thanks
Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
#10 lore raw
Quoted 7 lines · Ben Greear
Quoted 4 lines

Messages like these are in the category "business as usual", which happens frequently when the device is moved. IMHO they are not really warnings. I'm worried that making the messages more visible might scare the users too much.

To me it seems more useful than the network up/down messages that are already printed from the networking core.

You are not a normal user :) But what networking core messages are you referring to? I don't recall seeing anything like that.

Quoted 2 lines

That said, I don't feel strongly about this change, and it's certainly an easy patch for me to carry in my own tree.

I also don't have any strong opinion about this, just voiced my concern.

Signature · 1 line
Kalle Valo
author
#11 lore raw
Quoted 7 lines · Kalle Valo
Quoted 5 lines · Ben Greear
Quoted 4 lines

Messages like these are in the category "business as usual", which happens frequently when the device is moved. IMHO they are not really warnings. I'm worried that making the messages more visible might scare the users too much.

Quoted 5 lines
Quoted 2 lines

To me it seems more useful than the network up/down messages that are already printed from the networking core.

You are not a normal user :) But what networking core messages are you referring to? I don't recall seeing anything like that.

ADDRCONF(NETDEV_CHANGE): sta6: link becomes ready
ADDRCONF(NETDEV_CHANGE): sta5: link becomes ready
ADDRCONF(NETDEV_CHANGE): sta4: link becomes ready

Possibly I previously hacked on the console logging levels and forgot about it...

Quoted 6 lines
Quoted 3 lines

That said, I don't feel strongly about this change, and it's certainly an easy patch for me to carry in my own tree.

I also don't have any strong opinion about this, just voiced my concern.

No problem. One final note: These will only show if someone has compiled in wireless debugging...

We can let the maintainer make the call :)

Thanks,
Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
maintainer
#12 lore raw
In reply to Kalle Valo
Quoted 11 lines · Kalle Valo
Quoted 4 lines · [email protected] writes:

From: Ben Greear <[email protected]>

This makes them more easily seen in /var/log/messages and the console, for instance.

Messages like these are in the category "business as usual", which happens frequently when the device is moved. IMHO they are not really warnings. I'm worried that making the messages more visible might scare the users too much.

I agree -- this will happen all the time unless you have a really really good roaming algorithm or never move around.

johannes