提交 7dcfdcd9 编写于 作者: S Sujith 提交者: John W. Linville

ath9k: RX Filter cleanup

Signed-off-by: NSujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 f45144ef
...@@ -21,9 +21,6 @@ ...@@ -21,9 +21,6 @@
static int ath_outdoor; /* enable outdoor use */ static int ath_outdoor; /* enable outdoor use */
static const u8 ath_bcast_mac[ETH_ALEN] =
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
static u32 ath_chainmask_sel_up_rssi_thres = static u32 ath_chainmask_sel_up_rssi_thres =
ATH_CHAINMASK_SEL_UP_RSSI_THRES; ATH_CHAINMASK_SEL_UP_RSSI_THRES;
static u32 ath_chainmask_sel_down_rssi_thres = static u32 ath_chainmask_sel_down_rssi_thres =
...@@ -306,56 +303,6 @@ static int ath_stop(struct ath_softc *sc) ...@@ -306,56 +303,6 @@ static int ath_stop(struct ath_softc *sc)
return 0; return 0;
} }
/*
* Start Scan
*
* This function is called when starting a channel scan. It will perform
* power save wakeup processing, set the filter for the scan, and get the
* chip ready to send broadcast packets out during the scan.
*/
void ath_scan_start(struct ath_softc *sc)
{
struct ath_hal *ah = sc->sc_ah;
u32 rfilt;
u32 now = (u32) jiffies_to_msecs(get_timestamp());
sc->sc_scanning = 1;
rfilt = ath_calcrxfilter(sc);
ath9k_hw_setrxfilter(ah, rfilt);
ath9k_hw_write_associd(ah, ath_bcast_mac, 0);
/* Restore previous power management state. */
DPRINTF(sc, ATH_DBG_CONFIG, "%d.%03d | %s: RX filter 0x%x aid 0\n",
now / 1000, now % 1000, __func__, rfilt);
}
/*
* Scan End
*
* This routine is called by the upper layer when the scan is completed. This
* will set the filters back to normal operating mode, set the BSSID to the
* correct value, and restore the power save state.
*/
void ath_scan_end(struct ath_softc *sc)
{
struct ath_hal *ah = sc->sc_ah;
u32 rfilt;
u32 now = (u32) jiffies_to_msecs(get_timestamp());
sc->sc_scanning = 0;
/* Request for a full reset due to rx packet filter changes */
sc->sc_full_reset = 1;
rfilt = ath_calcrxfilter(sc);
ath9k_hw_setrxfilter(ah, rfilt);
ath9k_hw_write_associd(ah, sc->sc_curbssid, sc->sc_curaid);
DPRINTF(sc, ATH_DBG_CONFIG, "%d.%03d | %s: RX filter 0x%x aid 0x%x\n",
now / 1000, now % 1000, __func__, rfilt, sc->sc_curaid);
}
/* /*
* Set the current channel * Set the current channel
* *
......
...@@ -95,6 +95,8 @@ static inline unsigned long get_timestamp(void) ...@@ -95,6 +95,8 @@ static inline unsigned long get_timestamp(void)
return ((jiffies / HZ) * 1000) + (jiffies % HZ) * (1000 / HZ); return ((jiffies / HZ) * 1000) + (jiffies % HZ) * (1000 / HZ);
} }
static const u8 ath_bcast_mac[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
/*************/ /*************/
/* Debugging */ /* Debugging */
/*************/ /*************/
...@@ -919,10 +921,9 @@ struct ath_softc { ...@@ -919,10 +921,9 @@ struct ath_softc {
struct ath_rate_softc *sc_rc; /* tx rate control support */ struct ath_rate_softc *sc_rc; /* tx rate control support */
u32 sc_intrstatus; u32 sc_intrstatus;
enum ath9k_opmode sc_opmode; /* current operating mode */ enum ath9k_opmode sc_opmode; /* current operating mode */
unsigned int rx_filter;
u8 sc_invalid; /* being detached */ u8 sc_invalid; /* being detached */
u8 sc_beacons; /* beacons running */ u8 sc_beacons; /* beacons running */
u8 sc_scanning; /* scanning active */
u8 sc_txaggr; /* enable 11n tx aggregation */ u8 sc_txaggr; /* enable 11n tx aggregation */
u8 sc_rxaggr; /* enable 11n rx aggregation */ u8 sc_rxaggr; /* enable 11n rx aggregation */
u8 sc_update_chainmask; /* change chain mask */ u8 sc_update_chainmask; /* change chain mask */
......
...@@ -549,10 +549,6 @@ static int ath9k_config_interface(struct ieee80211_hw *hw, ...@@ -549,10 +549,6 @@ static int ath9k_config_interface(struct ieee80211_hw *hw,
/* Update ratectrl about the new state */ /* Update ratectrl about the new state */
ath_rate_newstate(sc, avp); ath_rate_newstate(sc, avp);
/* Set rx filter */
rfilt = ath_calcrxfilter(sc);
ath9k_hw_setrxfilter(sc->sc_ah, rfilt);
/* Set BSSID */ /* Set BSSID */
memcpy(sc->sc_curbssid, conf->bssid, ETH_ALEN); memcpy(sc->sc_curbssid, conf->bssid, ETH_ALEN);
sc->sc_curaid = 0; sc->sc_curaid = 0;
...@@ -636,8 +632,7 @@ static int ath9k_config_interface(struct ieee80211_hw *hw, ...@@ -636,8 +632,7 @@ static int ath9k_config_interface(struct ieee80211_hw *hw,
FIF_BCN_PRBRESP_PROMISC | \ FIF_BCN_PRBRESP_PROMISC | \
FIF_FCSFAIL) FIF_FCSFAIL)
/* Accept unicast, bcast and mcast frames */ /* FIXME: sc->sc_full_reset ? */
static void ath9k_configure_filter(struct ieee80211_hw *hw, static void ath9k_configure_filter(struct ieee80211_hw *hw,
unsigned int changed_flags, unsigned int changed_flags,
unsigned int *total_flags, unsigned int *total_flags,
...@@ -645,16 +640,22 @@ static void ath9k_configure_filter(struct ieee80211_hw *hw, ...@@ -645,16 +640,22 @@ static void ath9k_configure_filter(struct ieee80211_hw *hw,
struct dev_mc_list *mclist) struct dev_mc_list *mclist)
{ {
struct ath_softc *sc = hw->priv; struct ath_softc *sc = hw->priv;
u32 rfilt;
changed_flags &= SUPPORTED_FILTERS; changed_flags &= SUPPORTED_FILTERS;
*total_flags &= SUPPORTED_FILTERS; *total_flags &= SUPPORTED_FILTERS;
sc->rx_filter = *total_flags;
rfilt = ath_calcrxfilter(sc);
ath9k_hw_setrxfilter(sc->sc_ah, rfilt);
if (changed_flags & FIF_BCN_PRBRESP_PROMISC) { if (changed_flags & FIF_BCN_PRBRESP_PROMISC) {
if (*total_flags & FIF_BCN_PRBRESP_PROMISC) if (*total_flags & FIF_BCN_PRBRESP_PROMISC)
ath_scan_start(sc); ath9k_hw_write_associd(sc->sc_ah, ath_bcast_mac, 0);
else
ath_scan_end(sc);
} }
DPRINTF(sc, ATH_DBG_CONFIG, "%s: Set HW RX filter: 0x%x\n",
__func__, sc->rx_filter);
} }
static void ath9k_sta_notify(struct ieee80211_hw *hw, static void ath9k_sta_notify(struct ieee80211_hw *hw,
......
...@@ -597,6 +597,7 @@ void ath_rx_cleanup(struct ath_softc *sc) ...@@ -597,6 +597,7 @@ void ath_rx_cleanup(struct ath_softc *sc)
u32 ath_calcrxfilter(struct ath_softc *sc) u32 ath_calcrxfilter(struct ath_softc *sc)
{ {
#define RX_FILTER_PRESERVE (ATH9K_RX_FILTER_PHYERR | ATH9K_RX_FILTER_PHYRADAR) #define RX_FILTER_PRESERVE (ATH9K_RX_FILTER_PHYERR | ATH9K_RX_FILTER_PHYRADAR)
u32 rfilt; u32 rfilt;
rfilt = (ath9k_hw_getrxfilter(sc->sc_ah) & RX_FILTER_PRESERVE) rfilt = (ath9k_hw_getrxfilter(sc->sc_ah) & RX_FILTER_PRESERVE)
...@@ -608,14 +609,17 @@ u32 ath_calcrxfilter(struct ath_softc *sc) ...@@ -608,14 +609,17 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
rfilt |= ATH9K_RX_FILTER_PROBEREQ; rfilt |= ATH9K_RX_FILTER_PROBEREQ;
/* Can't set HOSTAP into promiscous mode */ /* Can't set HOSTAP into promiscous mode */
if (sc->sc_opmode == ATH9K_M_MONITOR) { if (((sc->sc_opmode != ATH9K_M_HOSTAP) &&
(sc->rx_filter & FIF_PROMISC_IN_BSS)) ||
(sc->sc_opmode == ATH9K_M_MONITOR)) {
rfilt |= ATH9K_RX_FILTER_PROM; rfilt |= ATH9K_RX_FILTER_PROM;
/* ??? To prevent from sending ACK */ /* ??? To prevent from sending ACK */
rfilt &= ~ATH9K_RX_FILTER_UCAST; rfilt &= ~ATH9K_RX_FILTER_UCAST;
} }
if (sc->sc_opmode == ATH9K_M_STA || sc->sc_opmode == ATH9K_M_IBSS || if (((sc->sc_opmode == ATH9K_M_STA) &&
sc->sc_scanning) (sc->rx_filter & FIF_BCN_PRBRESP_PROMISC)) ||
(sc->sc_opmode == ATH9K_M_IBSS))
rfilt |= ATH9K_RX_FILTER_BEACON; rfilt |= ATH9K_RX_FILTER_BEACON;
/* If in HOSTAP mode, want to enable reception of PSPOLL frames /* If in HOSTAP mode, want to enable reception of PSPOLL frames
...@@ -623,6 +627,7 @@ u32 ath_calcrxfilter(struct ath_softc *sc) ...@@ -623,6 +627,7 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
if (sc->sc_opmode == ATH9K_M_HOSTAP) if (sc->sc_opmode == ATH9K_M_HOSTAP)
rfilt |= (ATH9K_RX_FILTER_BEACON | ATH9K_RX_FILTER_PSPOLL); rfilt |= (ATH9K_RX_FILTER_BEACON | ATH9K_RX_FILTER_PSPOLL);
return rfilt; return rfilt;
#undef RX_FILTER_PRESERVE #undef RX_FILTER_PRESERVE
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册