]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ath9k: move ath9k_rx_skb_postprocess to common.c
authorOleksij Rempel <linux@rempel-privat.de>
Tue, 4 Feb 2014 09:27:47 +0000 (10:27 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 12 Feb 2014 20:36:01 +0000 (15:36 -0500)
and rename it to ath9k_cmn_rx_skb_postprocess. We will use it
on ath9k_htc.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
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/recv.c

index 5c0d94936a0f3ae5660d2f354643f1df184e8608..c6dd7f1fed65ed52b2ed1d0fd72c474260b5656f 100644 (file)
@@ -115,6 +115,58 @@ bool ath9k_cmn_rx_accept(struct ath_common *common,
 }
 EXPORT_SYMBOL(ath9k_cmn_rx_accept);
 
+void ath9k_cmn_rx_skb_postprocess(struct ath_common *common,
+                                 struct sk_buff *skb,
+                                 struct ath_rx_status *rx_stats,
+                                 struct ieee80211_rx_status *rxs,
+                                 bool decrypt_error)
+{
+       struct ath_hw *ah = common->ah;
+       struct ieee80211_hdr *hdr;
+       int hdrlen, padpos, padsize;
+       u8 keyix;
+       __le16 fc;
+
+       /* see if any padding is done by the hw and remove it */
+       hdr = (struct ieee80211_hdr *) skb->data;
+       hdrlen = ieee80211_get_hdrlen_from_skb(skb);
+       fc = hdr->frame_control;
+       padpos = ieee80211_hdrlen(fc);
+
+       /* The MAC header is padded to have 32-bit boundary if the
+        * packet payload is non-zero. The general calculation for
+        * padsize would take into account odd header lengths:
+        * padsize = (4 - padpos % 4) % 4; However, since only
+        * even-length headers are used, padding can only be 0 or 2
+        * bytes and we can optimize this a bit. In addition, we must
+        * not try to remove padding from short control frames that do
+        * not have payload. */
+       padsize = padpos & 3;
+       if (padsize && skb->len>=padpos+padsize+FCS_LEN) {
+               memmove(skb->data + padsize, skb->data, padpos);
+               skb_pull(skb, padsize);
+       }
+
+       keyix = rx_stats->rs_keyix;
+
+       if (!(keyix == ATH9K_RXKEYIX_INVALID) && !decrypt_error &&
+           ieee80211_has_protected(fc)) {
+               rxs->flag |= RX_FLAG_DECRYPTED;
+       } else if (ieee80211_has_protected(fc)
+                  && !decrypt_error && skb->len >= hdrlen + 4) {
+               keyix = skb->data[hdrlen + 3] >> 6;
+
+               if (test_bit(keyix, common->keymap))
+                       rxs->flag |= RX_FLAG_DECRYPTED;
+       }
+       if (ah->sw_mgmt_crypto &&
+           (rxs->flag & RX_FLAG_DECRYPTED) &&
+           ieee80211_is_mgmt(fc))
+               /* Use software decrypt for management frames. */
+               rxs->flag &= ~RX_FLAG_DECRYPTED;
+}
+EXPORT_SYMBOL(ath9k_cmn_rx_skb_postprocess);
+
 int ath9k_cmn_process_rate(struct ath_common *common,
                           struct ieee80211_hw *hw,
                           struct ath_rx_status *rx_stats,
index c59d3f5db2c386919836991a144c11a0cd005750..38b5609a4018fd33c3fbd148b35cc5df19c69721 100644 (file)
@@ -48,6 +48,11 @@ bool ath9k_cmn_rx_accept(struct ath_common *common,
                         struct ath_rx_status *rx_stats,
                         bool *decrypt_error,
                         unsigned int rxfilter);
+void ath9k_cmn_rx_skb_postprocess(struct ath_common *common,
+                                 struct sk_buff *skb,
+                                 struct ath_rx_status *rx_stats,
+                                 struct ieee80211_rx_status *rxs,
+                                 bool decrypt_error);
 int ath9k_cmn_process_rate(struct ath_common *common,
                           struct ieee80211_hw *hw,
                           struct ath_rx_status *rx_stats,
index 4dedbc237c9da0f333887dfc698dc53bf26b45b7..076dae1e5ab7f6de22bfdf5c179b6bd4bb09ba1b 100644 (file)
@@ -901,57 +901,6 @@ exit:
        return ret;
 }
 
-static void ath9k_rx_skb_postprocess(struct ath_common *common,
-                                    struct sk_buff *skb,
-                                    struct ath_rx_status *rx_stats,
-                                    struct ieee80211_rx_status *rxs,
-                                    bool decrypt_error)
-{
-       struct ath_hw *ah = common->ah;
-       struct ieee80211_hdr *hdr;
-       int hdrlen, padpos, padsize;
-       u8 keyix;
-       __le16 fc;
-
-       /* see if any padding is done by the hw and remove it */
-       hdr = (struct ieee80211_hdr *) skb->data;
-       hdrlen = ieee80211_get_hdrlen_from_skb(skb);
-       fc = hdr->frame_control;
-       padpos = ieee80211_hdrlen(fc);
-
-       /* The MAC header is padded to have 32-bit boundary if the
-        * packet payload is non-zero. The general calculation for
-        * padsize would take into account odd header lengths:
-        * padsize = (4 - padpos % 4) % 4; However, since only
-        * even-length headers are used, padding can only be 0 or 2
-        * bytes and we can optimize this a bit. In addition, we must
-        * not try to remove padding from short control frames that do
-        * not have payload. */
-       padsize = padpos & 3;
-       if (padsize && skb->len>=padpos+padsize+FCS_LEN) {
-               memmove(skb->data + padsize, skb->data, padpos);
-               skb_pull(skb, padsize);
-       }
-
-       keyix = rx_stats->rs_keyix;
-
-       if (!(keyix == ATH9K_RXKEYIX_INVALID) && !decrypt_error &&
-           ieee80211_has_protected(fc)) {
-               rxs->flag |= RX_FLAG_DECRYPTED;
-       } else if (ieee80211_has_protected(fc)
-                  && !decrypt_error && skb->len >= hdrlen + 4) {
-               keyix = skb->data[hdrlen + 3] >> 6;
-
-               if (test_bit(keyix, common->keymap))
-                       rxs->flag |= RX_FLAG_DECRYPTED;
-       }
-       if (ah->sw_mgmt_crypto &&
-           (rxs->flag & RX_FLAG_DECRYPTED) &&
-           ieee80211_is_mgmt(fc))
-               /* Use software decrypt for management frames. */
-               rxs->flag &= ~RX_FLAG_DECRYPTED;
-}
-
 /*
  * Run the LNA combining algorithm only in these cases:
  *
@@ -1101,8 +1050,8 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
                        skb_pull(skb, ah->caps.rx_status_len);
 
                if (!rs.rs_more)
-                       ath9k_rx_skb_postprocess(common, hdr_skb, &rs,
-                                                rxs, decrypt_error);
+                       ath9k_cmn_rx_skb_postprocess(common, hdr_skb, &rs,
+                                                    rxs, decrypt_error);
 
                if (rs.rs_more) {
                        RX_STAT_INC(rx_frags);