diff mbox

mwl8k: always apply configuration even when device is idle

Message ID 1364225994-19375-1-git-send-email-jogo@openwrt.org (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Jonas Gorski March 25, 2013, 3:39 p.m. UTC
Fix settings not being applied when the device is idle and the firmware
gets reloaded (because of changing from STA to AP mode). This caused
the device using the wrong channel (and likely band), e.g. a 5 GHz only
card still defaulted to channel 6 in the 2.4 GHz band when left
unconfigured.

This issue was always present, but only made visible with "mwl8k: Do not
call mwl8k_cmd_set_rf_channel unconditionally" (0f4316b9), since before
that the channel was (re-)configured at the next _config call even when
it did not change from the mac80211 perspective.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
---
 drivers/net/wireless/mwl8k.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Johannes Berg March 25, 2013, 3:49 p.m. UTC | #1
On Mon, 2013-03-25 at 16:39 +0100, Jonas Gorski wrote:
> Fix settings not being applied when the device is idle and the firmware
> gets reloaded (because of changing from STA to AP mode). This caused
> the device using the wrong channel (and likely band), e.g. a 5 GHz only
> card still defaulted to channel 6 in the 2.4 GHz band when left
> unconfigured.
> 
> This issue was always present, but only made visible with "mwl8k: Do not
> call mwl8k_cmd_set_rf_channel unconditionally" (0f4316b9), since before
> that the channel was (re-)configured at the next _config call even when
> it did not change from the mac80211 perspective.

I'm changing mac80211 back to unset idle first and then set the channel,
if that helps ... ath9k_htc was also broken by the change.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jonas Gorski March 25, 2013, 4:15 p.m. UTC | #2
On 25 March 2013 16:49, Johannes Berg <johannes@sipsolutions.net> wrote:
> On Mon, 2013-03-25 at 16:39 +0100, Jonas Gorski wrote:
>> Fix settings not being applied when the device is idle and the firmware
>> gets reloaded (because of changing from STA to AP mode). This caused
>> the device using the wrong channel (and likely band), e.g. a 5 GHz only
>> card still defaulted to channel 6 in the 2.4 GHz band when left
>> unconfigured.
>>
>> This issue was always present, but only made visible with "mwl8k: Do not
>> call mwl8k_cmd_set_rf_channel unconditionally" (0f4316b9), since before
>> that the channel was (re-)configured at the next _config call even when
>> it did not change from the mac80211 perspective.
>
> I'm changing mac80211 back to unset idle first and then set the channel,
> if that helps ... ath9k_htc was also broken by the change.

I think it only helps partially - the main issue is that a firmware
reload seems to require reapplying any settings, but this wasn't done
the if the device was currently in idle.

Also setting the channel when the device is in idle has the advantage
for mwl8k that it does not start rx'ing packets from the wrong channel
- which did confuse mac80211 in case of my 5 GHz "only" card that
happily received frames while being left unconfigured in 2.4 GHz, with
->bands[2GHZ] == NULL. Produced several pages worth of WARN_ON()s with
stack traces, and the reason why I caught this.


Jonas
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c
index 0640e7d..956c108 100644
--- a/drivers/net/wireless/mwl8k.c
+++ b/drivers/net/wireless/mwl8k.c
@@ -4807,16 +4807,14 @@  static int mwl8k_config(struct ieee80211_hw *hw, u32 changed)
 	struct mwl8k_priv *priv = hw->priv;
 	int rc;
 
-	if (conf->flags & IEEE80211_CONF_IDLE) {
-		mwl8k_cmd_radio_disable(hw);
-		return 0;
-	}
-
 	rc = mwl8k_fw_lock(hw);
 	if (rc)
 		return rc;
 
-	rc = mwl8k_cmd_radio_enable(hw);
+	if (conf->flags & IEEE80211_CONF_IDLE)
+		rc = mwl8k_cmd_radio_disable(hw);
+	else
+		rc = mwl8k_cmd_radio_enable(hw);
 	if (rc)
 		goto out;