提交 56d1de0a 编写于 作者: B Bob Copeland 提交者: John W. Linville

ath5k: clean up filter flags setting

The maze of if() statements in configure_filter is confusing.
Reorganizing it as a switch statement makes it more apparent what
is going on and reveals several suspicious settings.  This has no
functional changes, though it does remove some redundant flags
that are set earlier.

Also now that we can sleep, protect sc->filter_flags with the
sc lock.
Signed-off-by: NBob Copeland <me@bobcopeland.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 eadac6bf
...@@ -2918,6 +2918,8 @@ static void ath5k_configure_filter(struct ieee80211_hw *hw, ...@@ -2918,6 +2918,8 @@ static void ath5k_configure_filter(struct ieee80211_hw *hw,
struct ath5k_hw *ah = sc->ah; struct ath5k_hw *ah = sc->ah;
u32 mfilt[2], rfilt; u32 mfilt[2], rfilt;
mutex_lock(&sc->lock);
mfilt[0] = multicast; mfilt[0] = multicast;
mfilt[1] = multicast >> 32; mfilt[1] = multicast >> 32;
...@@ -2968,22 +2970,25 @@ static void ath5k_configure_filter(struct ieee80211_hw *hw, ...@@ -2968,22 +2970,25 @@ static void ath5k_configure_filter(struct ieee80211_hw *hw,
/* XXX move these to mac80211, and add a beacon IFF flag to mac80211 */ /* XXX move these to mac80211, and add a beacon IFF flag to mac80211 */
if (sc->opmode == NL80211_IFTYPE_MONITOR) switch (sc->opmode) {
rfilt |= AR5K_RX_FILTER_CONTROL | AR5K_RX_FILTER_BEACON | case NL80211_IFTYPE_MESH_POINT:
AR5K_RX_FILTER_PROBEREQ | AR5K_RX_FILTER_PROM; case NL80211_IFTYPE_MONITOR:
if (sc->opmode != NL80211_IFTYPE_STATION) rfilt |= AR5K_RX_FILTER_CONTROL |
rfilt |= AR5K_RX_FILTER_PROBEREQ; AR5K_RX_FILTER_BEACON |
if (sc->opmode != NL80211_IFTYPE_AP && AR5K_RX_FILTER_PROBEREQ |
sc->opmode != NL80211_IFTYPE_MESH_POINT && AR5K_RX_FILTER_PROM;
test_bit(ATH_STAT_PROMISC, sc->status)) break;
rfilt |= AR5K_RX_FILTER_PROM; case NL80211_IFTYPE_AP:
if ((sc->opmode == NL80211_IFTYPE_STATION && sc->assoc) || case NL80211_IFTYPE_ADHOC:
sc->opmode == NL80211_IFTYPE_ADHOC || rfilt |= AR5K_RX_FILTER_PROBEREQ |
sc->opmode == NL80211_IFTYPE_AP) AR5K_RX_FILTER_BEACON;
rfilt |= AR5K_RX_FILTER_BEACON; break;
if (sc->opmode == NL80211_IFTYPE_MESH_POINT) case NL80211_IFTYPE_STATION:
rfilt |= AR5K_RX_FILTER_CONTROL | AR5K_RX_FILTER_BEACON | if (sc->assoc)
AR5K_RX_FILTER_PROBEREQ | AR5K_RX_FILTER_PROM; rfilt |= AR5K_RX_FILTER_BEACON;
default:
break;
}
/* Set filters */ /* Set filters */
ath5k_hw_set_rx_filter(ah, rfilt); ath5k_hw_set_rx_filter(ah, rfilt);
...@@ -2993,6 +2998,8 @@ static void ath5k_configure_filter(struct ieee80211_hw *hw, ...@@ -2993,6 +2998,8 @@ static void ath5k_configure_filter(struct ieee80211_hw *hw,
/* Set the cached hw filter flags, this will alter actually /* Set the cached hw filter flags, this will alter actually
* be set in HW */ * be set in HW */
sc->filter_flags = rfilt; sc->filter_flags = rfilt;
mutex_unlock(&sc->lock);
} }
static int static int
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册