aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k
diff options
context:
space:
mode:
authorOleksij Rempel <linux@rempel-privat.de>2014-02-04 04:27:47 -0500
committerJohn W. Linville <linville@tuxdriver.com>2014-02-12 15:36:01 -0500
commit5a078fcbdedf88cc3a76ed1b3b4a55a5c61a2e7f (patch)
treedd0c31379eef319cb34bad77ef336a26028c56aa /drivers/net/wireless/ath/ath9k
parent64d9f1f52807dfb562eb510af2fa0f833a6b3a79 (diff)
ath9k: move ath9k_rx_skb_postprocess to common.c
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>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k')
-rw-r--r--drivers/net/wireless/ath/ath9k/common.c52
-rw-r--r--drivers/net/wireless/ath/ath9k/common.h5
-rw-r--r--drivers/net/wireless/ath/ath9k/recv.c55
3 files changed, 59 insertions, 53 deletions
diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c
index 5c0d94936a0f..c6dd7f1fed65 100644
--- a/drivers/net/wireless/ath/ath9k/common.c
+++ b/drivers/net/wireless/ath/ath9k/common.c
@@ -115,6 +115,58 @@ bool ath9k_cmn_rx_accept(struct ath_common *common,
115} 115}
116EXPORT_SYMBOL(ath9k_cmn_rx_accept); 116EXPORT_SYMBOL(ath9k_cmn_rx_accept);
117 117
118void ath9k_cmn_rx_skb_postprocess(struct ath_common *common,
119 struct sk_buff *skb,
120 struct ath_rx_status *rx_stats,
121 struct ieee80211_rx_status *rxs,
122 bool decrypt_error)
123{
124 struct ath_hw *ah = common->ah;
125 struct ieee80211_hdr *hdr;
126 int hdrlen, padpos, padsize;
127 u8 keyix;
128 __le16 fc;
129
130 /* see if any padding is done by the hw and remove it */
131 hdr = (struct ieee80211_hdr *) skb->data;
132 hdrlen = ieee80211_get_hdrlen_from_skb(skb);
133 fc = hdr->frame_control;
134 padpos = ieee80211_hdrlen(fc);
135
136 /* The MAC header is padded to have 32-bit boundary if the
137 * packet payload is non-zero. The general calculation for
138 * padsize would take into account odd header lengths:
139 * padsize = (4 - padpos % 4) % 4; However, since only
140 * even-length headers are used, padding can only be 0 or 2
141 * bytes and we can optimize this a bit. In addition, we must
142 * not try to remove padding from short control frames that do
143 * not have payload. */
144 padsize = padpos & 3;
145 if (padsize && skb->len>=padpos+padsize+FCS_LEN) {
146 memmove(skb->data + padsize, skb->data, padpos);
147 skb_pull(skb, padsize);
148 }
149
150 keyix = rx_stats->rs_keyix;
151
152 if (!(keyix == ATH9K_RXKEYIX_INVALID) && !decrypt_error &&
153 ieee80211_has_protected(fc)) {
154 rxs->flag |= RX_FLAG_DECRYPTED;
155 } else if (ieee80211_has_protected(fc)
156 && !decrypt_error && skb->len >= hdrlen + 4) {
157 keyix = skb->data[hdrlen + 3] >> 6;
158
159 if (test_bit(keyix, common->keymap))
160 rxs->flag |= RX_FLAG_DECRYPTED;
161 }
162 if (ah->sw_mgmt_crypto &&
163 (rxs->flag & RX_FLAG_DECRYPTED) &&
164 ieee80211_is_mgmt(fc))
165 /* Use software decrypt for management frames. */
166 rxs->flag &= ~RX_FLAG_DECRYPTED;
167}
168EXPORT_SYMBOL(ath9k_cmn_rx_skb_postprocess);
169
118int ath9k_cmn_process_rate(struct ath_common *common, 170int ath9k_cmn_process_rate(struct ath_common *common,
119 struct ieee80211_hw *hw, 171 struct ieee80211_hw *hw,
120 struct ath_rx_status *rx_stats, 172 struct ath_rx_status *rx_stats,
diff --git a/drivers/net/wireless/ath/ath9k/common.h b/drivers/net/wireless/ath/ath9k/common.h
index c59d3f5db2c3..38b5609a4018 100644
--- a/drivers/net/wireless/ath/ath9k/common.h
+++ b/drivers/net/wireless/ath/ath9k/common.h
@@ -48,6 +48,11 @@ bool ath9k_cmn_rx_accept(struct ath_common *common,
48 struct ath_rx_status *rx_stats, 48 struct ath_rx_status *rx_stats,
49 bool *decrypt_error, 49 bool *decrypt_error,
50 unsigned int rxfilter); 50 unsigned int rxfilter);
51void ath9k_cmn_rx_skb_postprocess(struct ath_common *common,
52 struct sk_buff *skb,
53 struct ath_rx_status *rx_stats,
54 struct ieee80211_rx_status *rxs,
55 bool decrypt_error);
51int ath9k_cmn_process_rate(struct ath_common *common, 56int ath9k_cmn_process_rate(struct ath_common *common,
52 struct ieee80211_hw *hw, 57 struct ieee80211_hw *hw,
53 struct ath_rx_status *rx_stats, 58 struct ath_rx_status *rx_stats,
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index 4dedbc237c9d..076dae1e5ab7 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -901,57 +901,6 @@ exit:
901 return ret; 901 return ret;
902} 902}
903 903
904static void ath9k_rx_skb_postprocess(struct ath_common *common,
905 struct sk_buff *skb,
906 struct ath_rx_status *rx_stats,
907 struct ieee80211_rx_status *rxs,
908 bool decrypt_error)
909{
910 struct ath_hw *ah = common->ah;
911 struct ieee80211_hdr *hdr;
912 int hdrlen, padpos, padsize;
913 u8 keyix;
914 __le16 fc;
915
916 /* see if any padding is done by the hw and remove it */
917 hdr = (struct ieee80211_hdr *) skb->data;
918 hdrlen = ieee80211_get_hdrlen_from_skb(skb);
919 fc = hdr->frame_control;
920 padpos = ieee80211_hdrlen(fc);
921
922 /* The MAC header is padded to have 32-bit boundary if the
923 * packet payload is non-zero. The general calculation for
924 * padsize would take into account odd header lengths:
925 * padsize = (4 - padpos % 4) % 4; However, since only
926 * even-length headers are used, padding can only be 0 or 2
927 * bytes and we can optimize this a bit. In addition, we must
928 * not try to remove padding from short control frames that do
929 * not have payload. */
930 padsize = padpos & 3;
931 if (padsize && skb->len>=padpos+padsize+FCS_LEN) {
932 memmove(skb->data + padsize, skb->data, padpos);
933 skb_pull(skb, padsize);
934 }
935
936 keyix = rx_stats->rs_keyix;
937
938 if (!(keyix == ATH9K_RXKEYIX_INVALID) && !decrypt_error &&
939 ieee80211_has_protected(fc)) {
940 rxs->flag |= RX_FLAG_DECRYPTED;
941 } else if (ieee80211_has_protected(fc)
942 && !decrypt_error && skb->len >= hdrlen + 4) {
943 keyix = skb->data[hdrlen + 3] >> 6;
944
945 if (test_bit(keyix, common->keymap))
946 rxs->flag |= RX_FLAG_DECRYPTED;
947 }
948 if (ah->sw_mgmt_crypto &&
949 (rxs->flag & RX_FLAG_DECRYPTED) &&
950 ieee80211_is_mgmt(fc))
951 /* Use software decrypt for management frames. */
952 rxs->flag &= ~RX_FLAG_DECRYPTED;
953}
954
955/* 904/*
956 * Run the LNA combining algorithm only in these cases: 905 * Run the LNA combining algorithm only in these cases:
957 * 906 *
@@ -1101,8 +1050,8 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
1101 skb_pull(skb, ah->caps.rx_status_len); 1050 skb_pull(skb, ah->caps.rx_status_len);
1102 1051
1103 if (!rs.rs_more) 1052 if (!rs.rs_more)
1104 ath9k_rx_skb_postprocess(common, hdr_skb, &rs, 1053 ath9k_cmn_rx_skb_postprocess(common, hdr_skb, &rs,
1105 rxs, decrypt_error); 1054 rxs, decrypt_error);
1106 1055
1107 if (rs.rs_more) { 1056 if (rs.rs_more) {
1108 RX_STAT_INC(rx_frags); 1057 RX_STAT_INC(rx_frags);