aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath5k
diff options
context:
space:
mode:
authorBob Copeland <me@bobcopeland.com>2009-08-24 23:00:30 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-08-28 14:40:43 -0400
commit56d1de0a21db28e41741cfa0a66e18bc8d920554 (patch)
treeffcdd090c27c949e8a9a79e04d8b3004957fe989 /drivers/net/wireless/ath/ath5k
parenteadac6bf95e1945bb64e6f8f22d8509391645e2e (diff)
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: Bob Copeland <me@bobcopeland.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath5k')
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 5056410d788a..c4adf9846410 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -2918,6 +2918,8 @@ static void ath5k_configure_filter(struct ieee80211_hw *hw,
2918 struct ath5k_hw *ah = sc->ah; 2918 struct ath5k_hw *ah = sc->ah;
2919 u32 mfilt[2], rfilt; 2919 u32 mfilt[2], rfilt;
2920 2920
2921 mutex_lock(&sc->lock);
2922
2921 mfilt[0] = multicast; 2923 mfilt[0] = multicast;
2922 mfilt[1] = multicast >> 32; 2924 mfilt[1] = multicast >> 32;
2923 2925
@@ -2968,22 +2970,25 @@ static void ath5k_configure_filter(struct ieee80211_hw *hw,
2968 2970
2969 /* XXX move these to mac80211, and add a beacon IFF flag to mac80211 */ 2971 /* XXX move these to mac80211, and add a beacon IFF flag to mac80211 */
2970 2972
2971 if (sc->opmode == NL80211_IFTYPE_MONITOR) 2973 switch (sc->opmode) {
2972 rfilt |= AR5K_RX_FILTER_CONTROL | AR5K_RX_FILTER_BEACON | 2974 case NL80211_IFTYPE_MESH_POINT:
2973 AR5K_RX_FILTER_PROBEREQ | AR5K_RX_FILTER_PROM; 2975 case NL80211_IFTYPE_MONITOR:
2974 if (sc->opmode != NL80211_IFTYPE_STATION) 2976 rfilt |= AR5K_RX_FILTER_CONTROL |
2975 rfilt |= AR5K_RX_FILTER_PROBEREQ; 2977 AR5K_RX_FILTER_BEACON |
2976 if (sc->opmode != NL80211_IFTYPE_AP && 2978 AR5K_RX_FILTER_PROBEREQ |
2977 sc->opmode != NL80211_IFTYPE_MESH_POINT && 2979 AR5K_RX_FILTER_PROM;
2978 test_bit(ATH_STAT_PROMISC, sc->status)) 2980 break;
2979 rfilt |= AR5K_RX_FILTER_PROM; 2981 case NL80211_IFTYPE_AP:
2980 if ((sc->opmode == NL80211_IFTYPE_STATION && sc->assoc) || 2982 case NL80211_IFTYPE_ADHOC:
2981 sc->opmode == NL80211_IFTYPE_ADHOC || 2983 rfilt |= AR5K_RX_FILTER_PROBEREQ |
2982 sc->opmode == NL80211_IFTYPE_AP) 2984 AR5K_RX_FILTER_BEACON;
2983 rfilt |= AR5K_RX_FILTER_BEACON; 2985 break;
2984 if (sc->opmode == NL80211_IFTYPE_MESH_POINT) 2986 case NL80211_IFTYPE_STATION:
2985 rfilt |= AR5K_RX_FILTER_CONTROL | AR5K_RX_FILTER_BEACON | 2987 if (sc->assoc)
2986 AR5K_RX_FILTER_PROBEREQ | AR5K_RX_FILTER_PROM; 2988 rfilt |= AR5K_RX_FILTER_BEACON;
2989 default:
2990 break;
2991 }
2987 2992
2988 /* Set filters */ 2993 /* Set filters */
2989 ath5k_hw_set_rx_filter(ah, rfilt); 2994 ath5k_hw_set_rx_filter(ah, rfilt);
@@ -2993,6 +2998,8 @@ static void ath5k_configure_filter(struct ieee80211_hw *hw,
2993 /* Set the cached hw filter flags, this will alter actually 2998 /* Set the cached hw filter flags, this will alter actually
2994 * be set in HW */ 2999 * be set in HW */
2995 sc->filter_flags = rfilt; 3000 sc->filter_flags = rfilt;
3001
3002 mutex_unlock(&sc->lock);
2996} 3003}
2997 3004
2998static int 3005static int