diff options
author | Sujith <Sujith.Manoharan@atheros.com> | 2008-08-11 04:33:13 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-08-29 16:23:56 -0400 |
commit | 7dcfdcd908a4540512aaf06b2b35e8c8a084fb69 (patch) | |
tree | 1a86f888c4868c37b64bbd5e26bf0eb22553e1fa /drivers | |
parent | f45144ef412422edf8018825328768e3db3ea45b (diff) |
ath9k: RX Filter cleanup
Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/ath9k/core.c | 53 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/core.h | 5 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/main.c | 19 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/recv.c | 11 |
4 files changed, 21 insertions, 67 deletions
diff --git a/drivers/net/wireless/ath9k/core.c b/drivers/net/wireless/ath9k/core.c index 10f2729a8c4b..7f92d469ad02 100644 --- a/drivers/net/wireless/ath9k/core.c +++ b/drivers/net/wireless/ath9k/core.c | |||
@@ -21,9 +21,6 @@ | |||
21 | 21 | ||
22 | static int ath_outdoor; /* enable outdoor use */ | 22 | static int ath_outdoor; /* enable outdoor use */ |
23 | 23 | ||
24 | static const u8 ath_bcast_mac[ETH_ALEN] = | ||
25 | { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; | ||
26 | |||
27 | static u32 ath_chainmask_sel_up_rssi_thres = | 24 | static u32 ath_chainmask_sel_up_rssi_thres = |
28 | ATH_CHAINMASK_SEL_UP_RSSI_THRES; | 25 | ATH_CHAINMASK_SEL_UP_RSSI_THRES; |
29 | static u32 ath_chainmask_sel_down_rssi_thres = | 26 | static u32 ath_chainmask_sel_down_rssi_thres = |
@@ -307,56 +304,6 @@ static int ath_stop(struct ath_softc *sc) | |||
307 | } | 304 | } |
308 | 305 | ||
309 | /* | 306 | /* |
310 | * Start Scan | ||
311 | * | ||
312 | * This function is called when starting a channel scan. It will perform | ||
313 | * power save wakeup processing, set the filter for the scan, and get the | ||
314 | * chip ready to send broadcast packets out during the scan. | ||
315 | */ | ||
316 | |||
317 | void ath_scan_start(struct ath_softc *sc) | ||
318 | { | ||
319 | struct ath_hal *ah = sc->sc_ah; | ||
320 | u32 rfilt; | ||
321 | u32 now = (u32) jiffies_to_msecs(get_timestamp()); | ||
322 | |||
323 | sc->sc_scanning = 1; | ||
324 | rfilt = ath_calcrxfilter(sc); | ||
325 | ath9k_hw_setrxfilter(ah, rfilt); | ||
326 | ath9k_hw_write_associd(ah, ath_bcast_mac, 0); | ||
327 | |||
328 | /* Restore previous power management state. */ | ||
329 | |||
330 | DPRINTF(sc, ATH_DBG_CONFIG, "%d.%03d | %s: RX filter 0x%x aid 0\n", | ||
331 | now / 1000, now % 1000, __func__, rfilt); | ||
332 | } | ||
333 | |||
334 | /* | ||
335 | * Scan End | ||
336 | * | ||
337 | * This routine is called by the upper layer when the scan is completed. This | ||
338 | * will set the filters back to normal operating mode, set the BSSID to the | ||
339 | * correct value, and restore the power save state. | ||
340 | */ | ||
341 | |||
342 | void ath_scan_end(struct ath_softc *sc) | ||
343 | { | ||
344 | struct ath_hal *ah = sc->sc_ah; | ||
345 | u32 rfilt; | ||
346 | u32 now = (u32) jiffies_to_msecs(get_timestamp()); | ||
347 | |||
348 | sc->sc_scanning = 0; | ||
349 | /* Request for a full reset due to rx packet filter changes */ | ||
350 | sc->sc_full_reset = 1; | ||
351 | rfilt = ath_calcrxfilter(sc); | ||
352 | ath9k_hw_setrxfilter(ah, rfilt); | ||
353 | ath9k_hw_write_associd(ah, sc->sc_curbssid, sc->sc_curaid); | ||
354 | |||
355 | DPRINTF(sc, ATH_DBG_CONFIG, "%d.%03d | %s: RX filter 0x%x aid 0x%x\n", | ||
356 | now / 1000, now % 1000, __func__, rfilt, sc->sc_curaid); | ||
357 | } | ||
358 | |||
359 | /* | ||
360 | * Set the current channel | 307 | * Set the current channel |
361 | * | 308 | * |
362 | * Set/change channels. If the channel is really being changed, it's done | 309 | * Set/change channels. If the channel is really being changed, it's done |
diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h index ef8f63766d43..07c958802b79 100644 --- a/drivers/net/wireless/ath9k/core.h +++ b/drivers/net/wireless/ath9k/core.h | |||
@@ -95,6 +95,8 @@ static inline unsigned long get_timestamp(void) | |||
95 | return ((jiffies / HZ) * 1000) + (jiffies % HZ) * (1000 / HZ); | 95 | return ((jiffies / HZ) * 1000) + (jiffies % HZ) * (1000 / HZ); |
96 | } | 96 | } |
97 | 97 | ||
98 | static const u8 ath_bcast_mac[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; | ||
99 | |||
98 | /*************/ | 100 | /*************/ |
99 | /* Debugging */ | 101 | /* Debugging */ |
100 | /*************/ | 102 | /*************/ |
@@ -919,10 +921,9 @@ struct ath_softc { | |||
919 | struct ath_rate_softc *sc_rc; /* tx rate control support */ | 921 | struct ath_rate_softc *sc_rc; /* tx rate control support */ |
920 | u32 sc_intrstatus; | 922 | u32 sc_intrstatus; |
921 | enum ath9k_opmode sc_opmode; /* current operating mode */ | 923 | enum ath9k_opmode sc_opmode; /* current operating mode */ |
922 | 924 | unsigned int rx_filter; | |
923 | u8 sc_invalid; /* being detached */ | 925 | u8 sc_invalid; /* being detached */ |
924 | u8 sc_beacons; /* beacons running */ | 926 | u8 sc_beacons; /* beacons running */ |
925 | u8 sc_scanning; /* scanning active */ | ||
926 | u8 sc_txaggr; /* enable 11n tx aggregation */ | 927 | u8 sc_txaggr; /* enable 11n tx aggregation */ |
927 | u8 sc_rxaggr; /* enable 11n rx aggregation */ | 928 | u8 sc_rxaggr; /* enable 11n rx aggregation */ |
928 | u8 sc_update_chainmask; /* change chain mask */ | 929 | u8 sc_update_chainmask; /* change chain mask */ |
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c index 2888778040e4..262fd7a8cd9a 100644 --- a/drivers/net/wireless/ath9k/main.c +++ b/drivers/net/wireless/ath9k/main.c | |||
@@ -549,10 +549,6 @@ static int ath9k_config_interface(struct ieee80211_hw *hw, | |||
549 | /* Update ratectrl about the new state */ | 549 | /* Update ratectrl about the new state */ |
550 | ath_rate_newstate(sc, avp); | 550 | ath_rate_newstate(sc, avp); |
551 | 551 | ||
552 | /* Set rx filter */ | ||
553 | rfilt = ath_calcrxfilter(sc); | ||
554 | ath9k_hw_setrxfilter(sc->sc_ah, rfilt); | ||
555 | |||
556 | /* Set BSSID */ | 552 | /* Set BSSID */ |
557 | memcpy(sc->sc_curbssid, conf->bssid, ETH_ALEN); | 553 | memcpy(sc->sc_curbssid, conf->bssid, ETH_ALEN); |
558 | sc->sc_curaid = 0; | 554 | sc->sc_curaid = 0; |
@@ -636,8 +632,7 @@ static int ath9k_config_interface(struct ieee80211_hw *hw, | |||
636 | FIF_BCN_PRBRESP_PROMISC | \ | 632 | FIF_BCN_PRBRESP_PROMISC | \ |
637 | FIF_FCSFAIL) | 633 | FIF_FCSFAIL) |
638 | 634 | ||
639 | /* Accept unicast, bcast and mcast frames */ | 635 | /* FIXME: sc->sc_full_reset ? */ |
640 | |||
641 | static void ath9k_configure_filter(struct ieee80211_hw *hw, | 636 | static void ath9k_configure_filter(struct ieee80211_hw *hw, |
642 | unsigned int changed_flags, | 637 | unsigned int changed_flags, |
643 | unsigned int *total_flags, | 638 | unsigned int *total_flags, |
@@ -645,16 +640,22 @@ static void ath9k_configure_filter(struct ieee80211_hw *hw, | |||
645 | struct dev_mc_list *mclist) | 640 | struct dev_mc_list *mclist) |
646 | { | 641 | { |
647 | struct ath_softc *sc = hw->priv; | 642 | struct ath_softc *sc = hw->priv; |
643 | u32 rfilt; | ||
648 | 644 | ||
649 | changed_flags &= SUPPORTED_FILTERS; | 645 | changed_flags &= SUPPORTED_FILTERS; |
650 | *total_flags &= SUPPORTED_FILTERS; | 646 | *total_flags &= SUPPORTED_FILTERS; |
651 | 647 | ||
648 | sc->rx_filter = *total_flags; | ||
649 | rfilt = ath_calcrxfilter(sc); | ||
650 | ath9k_hw_setrxfilter(sc->sc_ah, rfilt); | ||
651 | |||
652 | if (changed_flags & FIF_BCN_PRBRESP_PROMISC) { | 652 | if (changed_flags & FIF_BCN_PRBRESP_PROMISC) { |
653 | if (*total_flags & FIF_BCN_PRBRESP_PROMISC) | 653 | if (*total_flags & FIF_BCN_PRBRESP_PROMISC) |
654 | ath_scan_start(sc); | 654 | ath9k_hw_write_associd(sc->sc_ah, ath_bcast_mac, 0); |
655 | else | ||
656 | ath_scan_end(sc); | ||
657 | } | 655 | } |
656 | |||
657 | DPRINTF(sc, ATH_DBG_CONFIG, "%s: Set HW RX filter: 0x%x\n", | ||
658 | __func__, sc->rx_filter); | ||
658 | } | 659 | } |
659 | 660 | ||
660 | static void ath9k_sta_notify(struct ieee80211_hw *hw, | 661 | static void ath9k_sta_notify(struct ieee80211_hw *hw, |
diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c index 838b656b9da4..a12584961d69 100644 --- a/drivers/net/wireless/ath9k/recv.c +++ b/drivers/net/wireless/ath9k/recv.c | |||
@@ -597,6 +597,7 @@ void ath_rx_cleanup(struct ath_softc *sc) | |||
597 | u32 ath_calcrxfilter(struct ath_softc *sc) | 597 | u32 ath_calcrxfilter(struct ath_softc *sc) |
598 | { | 598 | { |
599 | #define RX_FILTER_PRESERVE (ATH9K_RX_FILTER_PHYERR | ATH9K_RX_FILTER_PHYRADAR) | 599 | #define RX_FILTER_PRESERVE (ATH9K_RX_FILTER_PHYERR | ATH9K_RX_FILTER_PHYRADAR) |
600 | |||
600 | u32 rfilt; | 601 | u32 rfilt; |
601 | 602 | ||
602 | rfilt = (ath9k_hw_getrxfilter(sc->sc_ah) & RX_FILTER_PRESERVE) | 603 | rfilt = (ath9k_hw_getrxfilter(sc->sc_ah) & RX_FILTER_PRESERVE) |
@@ -608,14 +609,17 @@ u32 ath_calcrxfilter(struct ath_softc *sc) | |||
608 | rfilt |= ATH9K_RX_FILTER_PROBEREQ; | 609 | rfilt |= ATH9K_RX_FILTER_PROBEREQ; |
609 | 610 | ||
610 | /* Can't set HOSTAP into promiscous mode */ | 611 | /* Can't set HOSTAP into promiscous mode */ |
611 | if (sc->sc_opmode == ATH9K_M_MONITOR) { | 612 | if (((sc->sc_opmode != ATH9K_M_HOSTAP) && |
613 | (sc->rx_filter & FIF_PROMISC_IN_BSS)) || | ||
614 | (sc->sc_opmode == ATH9K_M_MONITOR)) { | ||
612 | rfilt |= ATH9K_RX_FILTER_PROM; | 615 | rfilt |= ATH9K_RX_FILTER_PROM; |
613 | /* ??? To prevent from sending ACK */ | 616 | /* ??? To prevent from sending ACK */ |
614 | rfilt &= ~ATH9K_RX_FILTER_UCAST; | 617 | rfilt &= ~ATH9K_RX_FILTER_UCAST; |
615 | } | 618 | } |
616 | 619 | ||
617 | if (sc->sc_opmode == ATH9K_M_STA || sc->sc_opmode == ATH9K_M_IBSS || | 620 | if (((sc->sc_opmode == ATH9K_M_STA) && |
618 | sc->sc_scanning) | 621 | (sc->rx_filter & FIF_BCN_PRBRESP_PROMISC)) || |
622 | (sc->sc_opmode == ATH9K_M_IBSS)) | ||
619 | rfilt |= ATH9K_RX_FILTER_BEACON; | 623 | rfilt |= ATH9K_RX_FILTER_BEACON; |
620 | 624 | ||
621 | /* If in HOSTAP mode, want to enable reception of PSPOLL frames | 625 | /* If in HOSTAP mode, want to enable reception of PSPOLL frames |
@@ -623,6 +627,7 @@ u32 ath_calcrxfilter(struct ath_softc *sc) | |||
623 | if (sc->sc_opmode == ATH9K_M_HOSTAP) | 627 | if (sc->sc_opmode == ATH9K_M_HOSTAP) |
624 | rfilt |= (ATH9K_RX_FILTER_BEACON | ATH9K_RX_FILTER_PSPOLL); | 628 | rfilt |= (ATH9K_RX_FILTER_BEACON | ATH9K_RX_FILTER_PSPOLL); |
625 | return rfilt; | 629 | return rfilt; |
630 | |||
626 | #undef RX_FILTER_PRESERVE | 631 | #undef RX_FILTER_PRESERVE |
627 | } | 632 | } |
628 | 633 | ||