aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2010-03-29 06:37:09 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-03-31 14:46:39 -0400
commit0995d110118b35c0dc5195e3ddddcc0dec263830 (patch)
treeddacae9fa13fd209fa1090ea7d513cb8a29293a1 /drivers/net/wireless/ath
parent0af26b278bc1d747370b451595b7586cb7b3455c (diff)
ath9k_common: Move RX filter code to ath9k_htc
The calculation of RX filter is fairly different between ath9k and ath9k_htc, trying to make this common between the two drivers would result in code churn. While at it, remove the handling of PSPOLL filter, it can be added when(if) AP support is added to ath9k_htc. Signed-off-by: Sujith <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r--drivers/net/wireless/ath/ath9k/common.c82
-rw-r--r--drivers/net/wireless/ath/ath9k/common.h4
-rw-r--r--drivers/net/wireless/ath/ath9k/htc.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_main.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_txrx.c76
5 files changed, 77 insertions, 88 deletions
diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c
index 7902d287f671..cf768f2811eb 100644
--- a/drivers/net/wireless/ath/ath9k/common.c
+++ b/drivers/net/wireless/ath/ath9k/common.c
@@ -303,88 +303,6 @@ int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb)
303} 303}
304EXPORT_SYMBOL(ath9k_cmn_get_hw_crypto_keytype); 304EXPORT_SYMBOL(ath9k_cmn_get_hw_crypto_keytype);
305 305
306/*
307 * Calculate the RX filter to be set in the HW.
308 */
309u32 ath9k_cmn_calcrxfilter(struct ieee80211_hw *hw, struct ath_hw *ah,
310 unsigned int rxfilter)
311{
312#define RX_FILTER_PRESERVE (ATH9K_RX_FILTER_PHYERR | ATH9K_RX_FILTER_PHYRADAR)
313
314 u32 rfilt;
315
316 rfilt = (ath9k_hw_getrxfilter(ah) & RX_FILTER_PRESERVE)
317 | ATH9K_RX_FILTER_UCAST | ATH9K_RX_FILTER_BCAST
318 | ATH9K_RX_FILTER_MCAST;
319
320 /* If not a STA, enable processing of Probe Requests */
321 if (ah->opmode != NL80211_IFTYPE_STATION)
322 rfilt |= ATH9K_RX_FILTER_PROBEREQ;
323
324 /*
325 * Set promiscuous mode when FIF_PROMISC_IN_BSS is enabled for station
326 * mode interface or when in monitor mode. AP mode does not need this
327 * since it receives all in-BSS frames anyway.
328 */
329 if (((ah->opmode != NL80211_IFTYPE_AP) &&
330 (rxfilter & FIF_PROMISC_IN_BSS)) ||
331 (ah->opmode == NL80211_IFTYPE_MONITOR))
332 rfilt |= ATH9K_RX_FILTER_PROM;
333
334 if (rxfilter & FIF_CONTROL)
335 rfilt |= ATH9K_RX_FILTER_CONTROL;
336
337 if ((ah->opmode == NL80211_IFTYPE_STATION) &&
338 !(rxfilter & FIF_BCN_PRBRESP_PROMISC))
339 rfilt |= ATH9K_RX_FILTER_MYBEACON;
340 else
341 rfilt |= ATH9K_RX_FILTER_BEACON;
342
343 if ((AR_SREV_9280_10_OR_LATER(ah) ||
344 AR_SREV_9285_10_OR_LATER(ah)) &&
345 (ah->opmode == NL80211_IFTYPE_AP) &&
346 (rxfilter & FIF_PSPOLL))
347 rfilt |= ATH9K_RX_FILTER_PSPOLL;
348
349 if (conf_is_ht(&hw->conf))
350 rfilt |= ATH9K_RX_FILTER_COMP_BAR;
351
352 return rfilt;
353
354#undef RX_FILTER_PRESERVE
355}
356EXPORT_SYMBOL(ath9k_cmn_calcrxfilter);
357
358/*
359 * Recv initialization for opmode change.
360 */
361void ath9k_cmn_opmode_init(struct ieee80211_hw *hw, struct ath_hw *ah,
362 unsigned int rxfilter)
363{
364 struct ath_common *common = ath9k_hw_common(ah);
365
366 u32 rfilt, mfilt[2];
367
368 /* configure rx filter */
369 rfilt = ath9k_cmn_calcrxfilter(hw, ah, rxfilter);
370 ath9k_hw_setrxfilter(ah, rfilt);
371
372 /* configure bssid mask */
373 if (ah->caps.hw_caps & ATH9K_HW_CAP_BSSIDMASK)
374 ath_hw_setbssidmask(common);
375
376 /* configure operational mode */
377 ath9k_hw_setopmode(ah);
378
379 /* Handle any link-level address change. */
380 ath9k_hw_setmac(ah, common->macaddr);
381
382 /* calculate and install multicast filter */
383 mfilt[0] = mfilt[1] = ~0;
384 ath9k_hw_setmcastfilter(ah, mfilt[0], mfilt[1]);
385}
386EXPORT_SYMBOL(ath9k_cmn_opmode_init);
387
388static u32 ath9k_get_extchanmode(struct ieee80211_channel *chan, 306static u32 ath9k_get_extchanmode(struct ieee80211_channel *chan,
389 enum nl80211_channel_type channel_type) 307 enum nl80211_channel_type channel_type)
390{ 308{
diff --git a/drivers/net/wireless/ath/ath9k/common.h b/drivers/net/wireless/ath/ath9k/common.h
index bbcc57f6eba3..72a835d9e97f 100644
--- a/drivers/net/wireless/ath/ath9k/common.h
+++ b/drivers/net/wireless/ath/ath9k/common.h
@@ -128,10 +128,6 @@ void ath9k_cmn_rx_skb_postprocess(struct ath_common *common,
128 128
129int ath9k_cmn_padpos(__le16 frame_control); 129int ath9k_cmn_padpos(__le16 frame_control);
130int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb); 130int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb);
131u32 ath9k_cmn_calcrxfilter(struct ieee80211_hw *hw, struct ath_hw *ah,
132 unsigned int rxfilter);
133void ath9k_cmn_opmode_init(struct ieee80211_hw *hw, struct ath_hw *ah,
134 unsigned int rxfilter);
135void ath9k_cmn_update_ichannel(struct ieee80211_hw *hw, 131void ath9k_cmn_update_ichannel(struct ieee80211_hw *hw,
136 struct ath9k_channel *ichan); 132 struct ath9k_channel *ichan);
137struct ath9k_channel *ath9k_cmn_get_curchannel(struct ieee80211_hw *hw, 133struct ath9k_channel *ath9k_cmn_get_curchannel(struct ieee80211_hw *hw,
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h
index 777064945fca..698e6f1a506a 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -415,6 +415,7 @@ int ath9k_rx_init(struct ath9k_htc_priv *priv);
415void ath9k_rx_cleanup(struct ath9k_htc_priv *priv); 415void ath9k_rx_cleanup(struct ath9k_htc_priv *priv);
416void ath9k_host_rx_init(struct ath9k_htc_priv *priv); 416void ath9k_host_rx_init(struct ath9k_htc_priv *priv);
417void ath9k_rx_tasklet(unsigned long data); 417void ath9k_rx_tasklet(unsigned long data);
418u32 ath9k_htc_calcrxfilter(struct ath9k_htc_priv *priv);
418 419
419void ath9k_start_rfkill_poll(struct ath9k_htc_priv *priv); 420void ath9k_start_rfkill_poll(struct ath9k_htc_priv *priv);
420void ath9k_init_leds(struct ath9k_htc_priv *priv); 421void ath9k_init_leds(struct ath9k_htc_priv *priv);
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 20a2c1341e20..e5f78c7b2b1f 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1299,7 +1299,7 @@ static void ath9k_htc_configure_filter(struct ieee80211_hw *hw,
1299 *total_flags &= SUPPORTED_FILTERS; 1299 *total_flags &= SUPPORTED_FILTERS;
1300 1300
1301 priv->rxfilter = *total_flags; 1301 priv->rxfilter = *total_flags;
1302 rfilt = ath9k_cmn_calcrxfilter(hw, priv->ah, priv->rxfilter); 1302 rfilt = ath9k_htc_calcrxfilter(priv);
1303 ath9k_hw_setrxfilter(priv->ah, rfilt); 1303 ath9k_hw_setrxfilter(priv->ah, rfilt);
1304 1304
1305 ath_print(ath9k_hw_common(priv->ah), ATH_DBG_CONFIG, 1305 ath_print(ath9k_hw_common(priv->ah), ATH_DBG_CONFIG,
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
index ac66cf0b2d53..94e299fabbb2 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
@@ -290,10 +290,84 @@ bool ath9k_htc_txq_setup(struct ath9k_htc_priv *priv,
290/* RX */ 290/* RX */
291/******/ 291/******/
292 292
293/*
294 * Calculate the RX filter to be set in the HW.
295 */
296u32 ath9k_htc_calcrxfilter(struct ath9k_htc_priv *priv)
297{
298#define RX_FILTER_PRESERVE (ATH9K_RX_FILTER_PHYERR | ATH9K_RX_FILTER_PHYRADAR)
299
300 struct ath_hw *ah = priv->ah;
301 u32 rfilt;
302
303 rfilt = (ath9k_hw_getrxfilter(ah) & RX_FILTER_PRESERVE)
304 | ATH9K_RX_FILTER_UCAST | ATH9K_RX_FILTER_BCAST
305 | ATH9K_RX_FILTER_MCAST;
306
307 /* If not a STA, enable processing of Probe Requests */
308 if (ah->opmode != NL80211_IFTYPE_STATION)
309 rfilt |= ATH9K_RX_FILTER_PROBEREQ;
310
311 /*
312 * Set promiscuous mode when FIF_PROMISC_IN_BSS is enabled for station
313 * mode interface or when in monitor mode. AP mode does not need this
314 * since it receives all in-BSS frames anyway.
315 */
316 if (((ah->opmode != NL80211_IFTYPE_AP) &&
317 (priv->rxfilter & FIF_PROMISC_IN_BSS)) ||
318 (ah->opmode == NL80211_IFTYPE_MONITOR))
319 rfilt |= ATH9K_RX_FILTER_PROM;
320
321 if (priv->rxfilter & FIF_CONTROL)
322 rfilt |= ATH9K_RX_FILTER_CONTROL;
323
324 if ((ah->opmode == NL80211_IFTYPE_STATION) &&
325 !(priv->rxfilter & FIF_BCN_PRBRESP_PROMISC))
326 rfilt |= ATH9K_RX_FILTER_MYBEACON;
327 else
328 rfilt |= ATH9K_RX_FILTER_BEACON;
329
330 if (conf_is_ht(&priv->hw->conf))
331 rfilt |= ATH9K_RX_FILTER_COMP_BAR;
332
333 return rfilt;
334
335#undef RX_FILTER_PRESERVE
336}
337
338/*
339 * Recv initialization for opmode change.
340 */
341static void ath9k_htc_opmode_init(struct ath9k_htc_priv *priv)
342{
343 struct ath_hw *ah = priv->ah;
344 struct ath_common *common = ath9k_hw_common(ah);
345
346 u32 rfilt, mfilt[2];
347
348 /* configure rx filter */
349 rfilt = ath9k_htc_calcrxfilter(priv);
350 ath9k_hw_setrxfilter(ah, rfilt);
351
352 /* configure bssid mask */
353 if (ah->caps.hw_caps & ATH9K_HW_CAP_BSSIDMASK)
354 ath_hw_setbssidmask(common);
355
356 /* configure operational mode */
357 ath9k_hw_setopmode(ah);
358
359 /* Handle any link-level address change. */
360 ath9k_hw_setmac(ah, common->macaddr);
361
362 /* calculate and install multicast filter */
363 mfilt[0] = mfilt[1] = ~0;
364 ath9k_hw_setmcastfilter(ah, mfilt[0], mfilt[1]);
365}
366
293void ath9k_host_rx_init(struct ath9k_htc_priv *priv) 367void ath9k_host_rx_init(struct ath9k_htc_priv *priv)
294{ 368{
295 ath9k_hw_rxena(priv->ah); 369 ath9k_hw_rxena(priv->ah);
296 ath9k_cmn_opmode_init(priv->hw, priv->ah, priv->rxfilter); 370 ath9k_htc_opmode_init(priv);
297 ath9k_hw_startpcureceive(priv->ah); 371 ath9k_hw_startpcureceive(priv->ah);
298 priv->rx.last_rssi = ATH_RSSI_DUMMY_MARKER; 372 priv->rx.last_rssi = ATH_RSSI_DUMMY_MARKER;
299} 373}