diff mbox

ath9k: fix drop of multicast / broadcast data during scan

Message ID 1282934606-4169-1-git-send-email-lrodriguez@atheros.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Luis Rodriguez Aug. 27, 2010, 6:43 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 1165f90..3b0cd19 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1511,6 +1511,22 @@  void ath9k_enable_ps(struct ath_softc *sc)
 	}
 }
 
+static bool ath9k_can_change_channel(struct ath_softc *sc)
+{
+	u32 wait_for = PS_WAIT_FOR_BEACON |
+		       PS_WAIT_FOR_CAB |
+		       PS_WAIT_FOR_PSPOLL_DATA |
+		       PS_WAIT_FOR_TX_ACK;
+
+	if (sc->ps_flags & wait_for) {
+		ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_PS,
+			  "Cannot change channel due to a wait constraint\n");
+		return false;
+	}
+
+	return true;
+}
+
 static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
 {
 	struct ath_wiphy *aphy = hw->priv;
@@ -1605,6 +1621,9 @@  static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
 		struct ieee80211_channel *curchan = hw->conf.channel;
 		int pos = curchan->hw_value;
 
+		if (!ath9k_can_change_channel(sc))
+			goto skip_chan_change;
+
 		aphy->chan_idx = pos;
 		aphy->chan_is_ht = conf_is_ht(conf);
 		if (hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)