ath9k_common: Move RX filter code to ath9k_htc
authorSujith <Sujith.Manoharan@atheros.com>
Mon, 29 Mar 2010 10:37:09 +0000 (16:07 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 31 Mar 2010 18:46:39 +0000 (14:46 -0400)
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>
drivers/net/wireless/ath/ath9k/common.c
drivers/net/wireless/ath/ath9k/common.h
drivers/net/wireless/ath/ath9k/htc.h
drivers/net/wireless/ath/ath9k/htc_drv_main.c
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c

index 7902d287f671c81e0ea7b789a45a91b8f00f87d7..cf768f2811ebd96cfad05a801eba8d03e817a6b8 100644 (file)
@@ -303,88 +303,6 @@ int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb)
 }
 EXPORT_SYMBOL(ath9k_cmn_get_hw_crypto_keytype);
 
-/*
- * Calculate the RX filter to be set in the HW.
- */
-u32 ath9k_cmn_calcrxfilter(struct ieee80211_hw *hw, struct ath_hw *ah,
-                          unsigned int rxfilter)
-{
-#define        RX_FILTER_PRESERVE (ATH9K_RX_FILTER_PHYERR | ATH9K_RX_FILTER_PHYRADAR)
-
-       u32 rfilt;
-
-       rfilt = (ath9k_hw_getrxfilter(ah) & RX_FILTER_PRESERVE)
-               | ATH9K_RX_FILTER_UCAST | ATH9K_RX_FILTER_BCAST
-               | ATH9K_RX_FILTER_MCAST;
-
-       /* If not a STA, enable processing of Probe Requests */
-       if (ah->opmode != NL80211_IFTYPE_STATION)
-               rfilt |= ATH9K_RX_FILTER_PROBEREQ;
-
-       /*
-        * Set promiscuous mode when FIF_PROMISC_IN_BSS is enabled for station
-        * mode interface or when in monitor mode. AP mode does not need this
-        * since it receives all in-BSS frames anyway.
-        */
-       if (((ah->opmode != NL80211_IFTYPE_AP) &&
-            (rxfilter & FIF_PROMISC_IN_BSS)) ||
-           (ah->opmode == NL80211_IFTYPE_MONITOR))
-               rfilt |= ATH9K_RX_FILTER_PROM;
-
-       if (rxfilter & FIF_CONTROL)
-               rfilt |= ATH9K_RX_FILTER_CONTROL;
-
-       if ((ah->opmode == NL80211_IFTYPE_STATION) &&
-           !(rxfilter & FIF_BCN_PRBRESP_PROMISC))
-               rfilt |= ATH9K_RX_FILTER_MYBEACON;
-       else
-               rfilt |= ATH9K_RX_FILTER_BEACON;
-
-       if ((AR_SREV_9280_10_OR_LATER(ah) ||
-           AR_SREV_9285_10_OR_LATER(ah)) &&
-           (ah->opmode == NL80211_IFTYPE_AP) &&
-           (rxfilter & FIF_PSPOLL))
-               rfilt |= ATH9K_RX_FILTER_PSPOLL;
-
-       if (conf_is_ht(&hw->conf))
-               rfilt |= ATH9K_RX_FILTER_COMP_BAR;
-
-       return rfilt;
-
-#undef RX_FILTER_PRESERVE
-}
-EXPORT_SYMBOL(ath9k_cmn_calcrxfilter);
-
-/*
- * Recv initialization for opmode change.
- */
-void ath9k_cmn_opmode_init(struct ieee80211_hw *hw, struct ath_hw *ah,
-                          unsigned int rxfilter)
-{
-       struct ath_common *common = ath9k_hw_common(ah);
-
-       u32 rfilt, mfilt[2];
-
-       /* configure rx filter */
-       rfilt = ath9k_cmn_calcrxfilter(hw, ah, rxfilter);
-       ath9k_hw_setrxfilter(ah, rfilt);
-
-       /* configure bssid mask */
-       if (ah->caps.hw_caps & ATH9K_HW_CAP_BSSIDMASK)
-               ath_hw_setbssidmask(common);
-
-       /* configure operational mode */
-       ath9k_hw_setopmode(ah);
-
-       /* Handle any link-level address change. */
-       ath9k_hw_setmac(ah, common->macaddr);
-
-       /* calculate and install multicast filter */
-       mfilt[0] = mfilt[1] = ~0;
-       ath9k_hw_setmcastfilter(ah, mfilt[0], mfilt[1]);
-}
-EXPORT_SYMBOL(ath9k_cmn_opmode_init);
-
 static u32 ath9k_get_extchanmode(struct ieee80211_channel *chan,
                                 enum nl80211_channel_type channel_type)
 {
index bbcc57f6eba35dfda828366101756085e4e5d9a6..72a835d9e97fc1a55693d2ecc75bf20d9ca9759b 100644 (file)
@@ -128,10 +128,6 @@ void ath9k_cmn_rx_skb_postprocess(struct ath_common *common,
 
 int ath9k_cmn_padpos(__le16 frame_control);
 int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb);
-u32 ath9k_cmn_calcrxfilter(struct ieee80211_hw *hw, struct ath_hw *ah,
-                          unsigned int rxfilter);
-void ath9k_cmn_opmode_init(struct ieee80211_hw *hw, struct ath_hw *ah,
-                          unsigned int rxfilter);
 void ath9k_cmn_update_ichannel(struct ieee80211_hw *hw,
                               struct ath9k_channel *ichan);
 struct ath9k_channel *ath9k_cmn_get_curchannel(struct ieee80211_hw *hw,
index 777064945fca45c767caea2854e7950ca7a5fd99..698e6f1a506a3c26fd176ec4eb38ce3c4aa8199b 100644 (file)
@@ -415,6 +415,7 @@ int ath9k_rx_init(struct ath9k_htc_priv *priv);
 void ath9k_rx_cleanup(struct ath9k_htc_priv *priv);
 void ath9k_host_rx_init(struct ath9k_htc_priv *priv);
 void ath9k_rx_tasklet(unsigned long data);
+u32 ath9k_htc_calcrxfilter(struct ath9k_htc_priv *priv);
 
 void ath9k_start_rfkill_poll(struct ath9k_htc_priv *priv);
 void ath9k_init_leds(struct ath9k_htc_priv *priv);
index 20a2c1341e200bc4f7ebee17a83a709c8f2672b7..e5f78c7b2b1f6945f8ca1e07ee5e97518561afe0 100644 (file)
@@ -1299,7 +1299,7 @@ static void ath9k_htc_configure_filter(struct ieee80211_hw *hw,
        *total_flags &= SUPPORTED_FILTERS;
 
        priv->rxfilter = *total_flags;
-       rfilt = ath9k_cmn_calcrxfilter(hw, priv->ah, priv->rxfilter);
+       rfilt = ath9k_htc_calcrxfilter(priv);
        ath9k_hw_setrxfilter(priv->ah, rfilt);
 
        ath_print(ath9k_hw_common(priv->ah), ATH_DBG_CONFIG,
index ac66cf0b2d53a045081ac4292696fb2876afb582..94e299fabbb2ad240fa8c9bffae17b70b12c215e 100644 (file)
@@ -290,10 +290,84 @@ bool ath9k_htc_txq_setup(struct ath9k_htc_priv *priv,
 /* RX */
 /******/
 
+/*
+ * Calculate the RX filter to be set in the HW.
+ */
+u32 ath9k_htc_calcrxfilter(struct ath9k_htc_priv *priv)
+{
+#define        RX_FILTER_PRESERVE (ATH9K_RX_FILTER_PHYERR | ATH9K_RX_FILTER_PHYRADAR)
+
+       struct ath_hw *ah = priv->ah;
+       u32 rfilt;
+
+       rfilt = (ath9k_hw_getrxfilter(ah) & RX_FILTER_PRESERVE)
+               | ATH9K_RX_FILTER_UCAST | ATH9K_RX_FILTER_BCAST
+               | ATH9K_RX_FILTER_MCAST;
+
+       /* If not a STA, enable processing of Probe Requests */
+       if (ah->opmode != NL80211_IFTYPE_STATION)
+               rfilt |= ATH9K_RX_FILTER_PROBEREQ;
+
+       /*
+        * Set promiscuous mode when FIF_PROMISC_IN_BSS is enabled for station
+        * mode interface or when in monitor mode. AP mode does not need this
+        * since it receives all in-BSS frames anyway.
+        */
+       if (((ah->opmode != NL80211_IFTYPE_AP) &&
+            (priv->rxfilter & FIF_PROMISC_IN_BSS)) ||
+           (ah->opmode == NL80211_IFTYPE_MONITOR))
+               rfilt |= ATH9K_RX_FILTER_PROM;
+
+       if (priv->rxfilter & FIF_CONTROL)
+               rfilt |= ATH9K_RX_FILTER_CONTROL;
+
+       if ((ah->opmode == NL80211_IFTYPE_STATION) &&
+           !(priv->rxfilter & FIF_BCN_PRBRESP_PROMISC))
+               rfilt |= ATH9K_RX_FILTER_MYBEACON;
+       else
+               rfilt |= ATH9K_RX_FILTER_BEACON;
+
+       if (conf_is_ht(&priv->hw->conf))
+               rfilt |= ATH9K_RX_FILTER_COMP_BAR;
+
+       return rfilt;
+
+#undef RX_FILTER_PRESERVE
+}
+
+/*
+ * Recv initialization for opmode change.
+ */
+static void ath9k_htc_opmode_init(struct ath9k_htc_priv *priv)
+{
+       struct ath_hw *ah = priv->ah;
+       struct ath_common *common = ath9k_hw_common(ah);
+
+       u32 rfilt, mfilt[2];
+
+       /* configure rx filter */
+       rfilt = ath9k_htc_calcrxfilter(priv);
+       ath9k_hw_setrxfilter(ah, rfilt);
+
+       /* configure bssid mask */
+       if (ah->caps.hw_caps & ATH9K_HW_CAP_BSSIDMASK)
+               ath_hw_setbssidmask(common);
+
+       /* configure operational mode */
+       ath9k_hw_setopmode(ah);
+
+       /* Handle any link-level address change. */
+       ath9k_hw_setmac(ah, common->macaddr);
+
+       /* calculate and install multicast filter */
+       mfilt[0] = mfilt[1] = ~0;
+       ath9k_hw_setmcastfilter(ah, mfilt[0], mfilt[1]);
+}
+
 void ath9k_host_rx_init(struct ath9k_htc_priv *priv)
 {
        ath9k_hw_rxena(priv->ah);
-       ath9k_cmn_opmode_init(priv->hw, priv->ah, priv->rxfilter);
+       ath9k_htc_opmode_init(priv);
        ath9k_hw_startpcureceive(priv->ah);
        priv->rx.last_rssi = ATH_RSSI_DUMMY_MARKER;
 }