Commit ca529c93 authored by Sujith Manoharan's avatar Sujith Manoharan Committed by John W. Linville

ath9k: Fix interface accounting

Currently, the interface count is maintained globally,
but this causes problems in RX filter calculation.
Make the interface count a per-channel-context variable
to fix this.
Signed-off-by: default avatarSujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent fce34430
...@@ -350,6 +350,7 @@ struct ath_chanctx { ...@@ -350,6 +350,7 @@ struct ath_chanctx {
bool assigned; bool assigned;
bool switch_after_beacon; bool switch_after_beacon;
short nvifs;
unsigned int rxfilter; unsigned int rxfilter;
}; };
...@@ -963,7 +964,6 @@ struct ath_softc { ...@@ -963,7 +964,6 @@ struct ath_softc {
bool ps_enabled; bool ps_enabled;
bool ps_idle; bool ps_idle;
short nbcnvifs; short nbcnvifs;
short nvifs;
unsigned long ps_usecount; unsigned long ps_usecount;
struct ath_rx rx; struct ath_rx rx;
......
...@@ -183,7 +183,7 @@ static struct ath_buf *ath9k_beacon_generate(struct ieee80211_hw *hw, ...@@ -183,7 +183,7 @@ static struct ath_buf *ath9k_beacon_generate(struct ieee80211_hw *hw,
spin_unlock_bh(&cabq->axq_lock); spin_unlock_bh(&cabq->axq_lock);
if (skb && cabq_depth) { if (skb && cabq_depth) {
if (sc->nvifs > 1) { if (sc->cur_chan->nvifs > 1) {
ath_dbg(common, BEACON, ath_dbg(common, BEACON,
"Flushing previous cabq traffic\n"); "Flushing previous cabq traffic\n");
ath_draintxq(sc, cabq); ath_draintxq(sc, cabq);
......
...@@ -838,7 +838,7 @@ static ssize_t read_file_misc(struct file *file, char __user *user_buf, ...@@ -838,7 +838,7 @@ static ssize_t read_file_misc(struct file *file, char __user *user_buf,
iter_data.nmeshes, iter_data.nwds); iter_data.nmeshes, iter_data.nwds);
len += scnprintf(buf + len, sizeof(buf) - len, len += scnprintf(buf + len, sizeof(buf) - len,
" ADHOC: %i TOTAL: %hi BEACON-VIF: %hi\n", " ADHOC: %i TOTAL: %hi BEACON-VIF: %hi\n",
iter_data.nadhocs, sc->nvifs, sc->nbcnvifs); iter_data.nadhocs, sc->cur_chan->nvifs, sc->nbcnvifs);
} }
if (len > sizeof(buf)) if (len > sizeof(buf))
......
...@@ -1117,7 +1117,7 @@ static int ath9k_add_interface(struct ieee80211_hw *hw, ...@@ -1117,7 +1117,7 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
mutex_lock(&sc->mutex); mutex_lock(&sc->mutex);
if (config_enabled(CONFIG_ATH9K_TX99)) { if (config_enabled(CONFIG_ATH9K_TX99)) {
if (sc->nvifs >= 1) { if (sc->cur_chan->nvifs >= 1) {
mutex_unlock(&sc->mutex); mutex_unlock(&sc->mutex);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
...@@ -1125,7 +1125,7 @@ static int ath9k_add_interface(struct ieee80211_hw *hw, ...@@ -1125,7 +1125,7 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
} }
ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type); ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type);
sc->nvifs++; sc->cur_chan->nvifs++;
if (ath9k_uses_beacons(vif->type)) if (ath9k_uses_beacons(vif->type))
ath9k_beacon_assign_slot(sc, vif); ath9k_beacon_assign_slot(sc, vif);
...@@ -1207,7 +1207,7 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw, ...@@ -1207,7 +1207,7 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
ath9k_p2p_remove_vif(sc, vif); ath9k_p2p_remove_vif(sc, vif);
sc->nvifs--; sc->cur_chan->nvifs--;
sc->tx99_vif = NULL; sc->tx99_vif = NULL;
if (!ath9k_is_chanctx_enabled()) if (!ath9k_is_chanctx_enabled())
list_del(&avp->list); list_del(&avp->list);
......
...@@ -404,7 +404,7 @@ u32 ath_calcrxfilter(struct ath_softc *sc) ...@@ -404,7 +404,7 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
rfilt |= ATH9K_RX_FILTER_CONTROL; rfilt |= ATH9K_RX_FILTER_CONTROL;
if ((sc->sc_ah->opmode == NL80211_IFTYPE_STATION) && if ((sc->sc_ah->opmode == NL80211_IFTYPE_STATION) &&
(sc->nvifs <= 1) && (sc->cur_chan->nvifs <= 1) &&
!(sc->cur_chan->rxfilter & FIF_BCN_PRBRESP_PROMISC)) !(sc->cur_chan->rxfilter & FIF_BCN_PRBRESP_PROMISC))
rfilt |= ATH9K_RX_FILTER_MYBEACON; rfilt |= ATH9K_RX_FILTER_MYBEACON;
else else
...@@ -417,7 +417,7 @@ u32 ath_calcrxfilter(struct ath_softc *sc) ...@@ -417,7 +417,7 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
if (sc->cur_chandef.width != NL80211_CHAN_WIDTH_20_NOHT) if (sc->cur_chandef.width != NL80211_CHAN_WIDTH_20_NOHT)
rfilt |= ATH9K_RX_FILTER_COMP_BAR; rfilt |= ATH9K_RX_FILTER_COMP_BAR;
if (sc->nvifs > 1 || (sc->cur_chan->rxfilter & FIF_OTHER_BSS)) { if (sc->cur_chan->nvifs > 1 || (sc->cur_chan->rxfilter & FIF_OTHER_BSS)) {
/* This is needed for older chips */ /* This is needed for older chips */
if (sc->sc_ah->hw_version.macVersion <= AR_SREV_VERSION_9160) if (sc->sc_ah->hw_version.macVersion <= AR_SREV_VERSION_9160)
rfilt |= ATH9K_RX_FILTER_PROM; rfilt |= ATH9K_RX_FILTER_PROM;
......
...@@ -174,7 +174,7 @@ static ssize_t write_file_tx99(struct file *file, const char __user *user_buf, ...@@ -174,7 +174,7 @@ static ssize_t write_file_tx99(struct file *file, const char __user *user_buf,
ssize_t len; ssize_t len;
int r; int r;
if (sc->nvifs > 1) if (sc->cur_chan->nvifs > 1)
return -EOPNOTSUPP; return -EOPNOTSUPP;
len = min(count, sizeof(buf) - 1); len = min(count, sizeof(buf) - 1);
......
...@@ -232,7 +232,7 @@ int ath9k_suspend(struct ieee80211_hw *hw, ...@@ -232,7 +232,7 @@ int ath9k_suspend(struct ieee80211_hw *hw,
goto fail_wow; goto fail_wow;
} }
if (sc->nvifs > 1) { if (sc->cur_chan->nvifs > 1) {
ath_dbg(common, WOW, "WoW for multivif is not yet supported\n"); ath_dbg(common, WOW, "WoW for multivif is not yet supported\n");
ret = 1; ret = 1;
goto fail_wow; goto fail_wow;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment