aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/recv.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/recv.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/recv.c63
1 files changed, 41 insertions, 22 deletions
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index fa78914cbfb1..6e00eafc9b24 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -86,28 +86,19 @@ static void ath_setdefantenna(struct ath_softc *sc, u32 antenna)
86 sc->rx.rxotherant = 0; 86 sc->rx.rxotherant = 0;
87} 87}
88 88
89/* 89/* Assumes you've already done the endian to CPU conversion */
90 * For Decrypt or Demic errors, we only mark packet status here and always push 90static bool ath9k_rx_accept(struct ath_common *common,
91 * up the frame up to let mac80211 handle the actual error case, be it no 91 struct sk_buff *skb,
92 * decryption key or real decryption error. This let us keep statistics there. 92 struct ieee80211_rx_status *rxs,
93 */ 93 struct ath_rx_status *rx_stats,
94static int ath_rx_prepare(struct ath_common *common, 94 bool *decrypt_error)
95 struct ieee80211_hw *hw,
96 struct sk_buff *skb, struct ath_rx_status *rx_stats,
97 struct ieee80211_rx_status *rx_status,
98 bool *decrypt_error)
99{ 95{
100 struct ath_hw *ah = common->ah; 96 struct ath_hw *ah = common->ah;
101 struct ieee80211_hdr *hdr; 97 struct ieee80211_hdr *hdr;
102 u8 ratecode;
103 __le16 fc; 98 __le16 fc;
104 struct ieee80211_sta *sta;
105 struct ath_node *an;
106 int last_rssi = ATH_RSSI_DUMMY_MARKER;
107 99
108 hdr = (struct ieee80211_hdr *)skb->data; 100 hdr = (struct ieee80211_hdr *) skb->data;
109 fc = hdr->frame_control; 101 fc = hdr->frame_control;
110 memset(rx_status, 0, sizeof(struct ieee80211_rx_status));
111 102
112 if (rx_stats->rs_more) { 103 if (rx_stats->rs_more) {
113 /* 104 /*
@@ -117,12 +108,12 @@ static int ath_rx_prepare(struct ath_common *common,
117 * error frames in Monitor mode. 108 * error frames in Monitor mode.
118 */ 109 */
119 if (ah->opmode != NL80211_IFTYPE_MONITOR) 110 if (ah->opmode != NL80211_IFTYPE_MONITOR)
120 goto rx_next; 111 return false;
121 } else if (rx_stats->rs_status != 0) { 112 } else if (rx_stats->rs_status != 0) {
122 if (rx_stats->rs_status & ATH9K_RXERR_CRC) 113 if (rx_stats->rs_status & ATH9K_RXERR_CRC)
123 rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; 114 rxs->flag |= RX_FLAG_FAILED_FCS_CRC;
124 if (rx_stats->rs_status & ATH9K_RXERR_PHY) 115 if (rx_stats->rs_status & ATH9K_RXERR_PHY)
125 goto rx_next; 116 return false;
126 117
127 if (rx_stats->rs_status & ATH9K_RXERR_DECRYPT) { 118 if (rx_stats->rs_status & ATH9K_RXERR_DECRYPT) {
128 *decrypt_error = true; 119 *decrypt_error = true;
@@ -135,7 +126,7 @@ static int ath_rx_prepare(struct ath_common *common,
135 */ 126 */
136 rx_stats->rs_status &= ~ATH9K_RXERR_MIC; 127 rx_stats->rs_status &= ~ATH9K_RXERR_MIC;
137 else 128 else
138 rx_status->flag |= RX_FLAG_MMIC_ERROR; 129 rxs->flag |= RX_FLAG_MMIC_ERROR;
139 } 130 }
140 /* 131 /*
141 * Reject error frames with the exception of 132 * Reject error frames with the exception of
@@ -146,14 +137,42 @@ static int ath_rx_prepare(struct ath_common *common,
146 if (rx_stats->rs_status & 137 if (rx_stats->rs_status &
147 ~(ATH9K_RXERR_DECRYPT | ATH9K_RXERR_MIC | 138 ~(ATH9K_RXERR_DECRYPT | ATH9K_RXERR_MIC |
148 ATH9K_RXERR_CRC)) 139 ATH9K_RXERR_CRC))
149 goto rx_next; 140 return false;
150 } else { 141 } else {
151 if (rx_stats->rs_status & 142 if (rx_stats->rs_status &
152 ~(ATH9K_RXERR_DECRYPT | ATH9K_RXERR_MIC)) { 143 ~(ATH9K_RXERR_DECRYPT | ATH9K_RXERR_MIC)) {
153 goto rx_next; 144 return false;
154 } 145 }
155 } 146 }
156 } 147 }
148 return true;
149}
150
151/*
152 * For Decrypt or Demic errors, we only mark packet status here and always push
153 * up the frame up to let mac80211 handle the actual error case, be it no
154 * decryption key or real decryption error. This let us keep statistics there.
155 */
156static int ath_rx_prepare(struct ath_common *common,
157 struct ieee80211_hw *hw,
158 struct sk_buff *skb, struct ath_rx_status *rx_stats,
159 struct ieee80211_rx_status *rx_status,
160 bool *decrypt_error)
161{
162 struct ath_hw *ah = common->ah;
163 struct ieee80211_hdr *hdr;
164 u8 ratecode;
165 __le16 fc;
166 struct ieee80211_sta *sta;
167 struct ath_node *an;
168 int last_rssi = ATH_RSSI_DUMMY_MARKER;
169
170 hdr = (struct ieee80211_hdr *)skb->data;
171 fc = hdr->frame_control;
172 memset(rx_status, 0, sizeof(struct ieee80211_rx_status));
173
174 if (!ath9k_rx_accept(common, skb, rx_status, rx_stats, decrypt_error))
175 goto rx_next;
157 176
158 ratecode = rx_stats->rs_rate; 177 ratecode = rx_stats->rs_rate;
159 178