diff options
author | Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com> | 2016-09-26 14:56:24 -0400 |
---|---|---|
committer | Kalle Valo <kvalo@qca.qualcomm.com> | 2016-09-27 08:15:51 -0400 |
commit | 2f38c3c01de945234d23dd163e3528ccb413066d (patch) | |
tree | 936ac3c28df219d4319106eccd115e3b004f164b | |
parent | 65901a9e70584afb840b1c013d582d07b7f61696 (diff) |
ath10k: fix rfc1042 header retrieval in QCA4019 with eth decap mode
Chipset from QCA99X0 onwards (QCA99X0, QCA9984, QCA4019 & future)
rx_hdr_status is not padded to align in 4-byte boundary. Define a
new hw_params field to handle different alignment behaviour between
different hw. This patch fixes improper retrieval of rfc1042 header
with QCA4019. This patch along with "ath10k: Properly remove padding
from the start of rx payload" will fix traffic failure in ethernet
decap mode for QCA4019.
Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r-- | drivers/net/wireless/ath/ath10k/core.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath10k/htt_rx.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath10k/hw.h | 3 |
3 files changed, 18 insertions, 2 deletions
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 3a8984ba9f74..98af0053d30d 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c | |||
@@ -68,6 +68,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { | |||
68 | .board_ext_size = QCA988X_BOARD_EXT_DATA_SZ, | 68 | .board_ext_size = QCA988X_BOARD_EXT_DATA_SZ, |
69 | }, | 69 | }, |
70 | .hw_ops = &qca988x_ops, | 70 | .hw_ops = &qca988x_ops, |
71 | .decap_align_bytes = 4, | ||
71 | }, | 72 | }, |
72 | { | 73 | { |
73 | .id = QCA9887_HW_1_0_VERSION, | 74 | .id = QCA9887_HW_1_0_VERSION, |
@@ -87,6 +88,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { | |||
87 | .board_ext_size = QCA9887_BOARD_EXT_DATA_SZ, | 88 | .board_ext_size = QCA9887_BOARD_EXT_DATA_SZ, |
88 | }, | 89 | }, |
89 | .hw_ops = &qca988x_ops, | 90 | .hw_ops = &qca988x_ops, |
91 | .decap_align_bytes = 4, | ||
90 | }, | 92 | }, |
91 | { | 93 | { |
92 | .id = QCA6174_HW_2_1_VERSION, | 94 | .id = QCA6174_HW_2_1_VERSION, |
@@ -105,6 +107,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { | |||
105 | .board_ext_size = QCA6174_BOARD_EXT_DATA_SZ, | 107 | .board_ext_size = QCA6174_BOARD_EXT_DATA_SZ, |
106 | }, | 108 | }, |
107 | .hw_ops = &qca988x_ops, | 109 | .hw_ops = &qca988x_ops, |
110 | .decap_align_bytes = 4, | ||
108 | }, | 111 | }, |
109 | { | 112 | { |
110 | .id = QCA6174_HW_2_1_VERSION, | 113 | .id = QCA6174_HW_2_1_VERSION, |
@@ -123,6 +126,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { | |||
123 | .board_ext_size = QCA6174_BOARD_EXT_DATA_SZ, | 126 | .board_ext_size = QCA6174_BOARD_EXT_DATA_SZ, |
124 | }, | 127 | }, |
125 | .hw_ops = &qca988x_ops, | 128 | .hw_ops = &qca988x_ops, |
129 | .decap_align_bytes = 4, | ||
126 | }, | 130 | }, |
127 | { | 131 | { |
128 | .id = QCA6174_HW_3_0_VERSION, | 132 | .id = QCA6174_HW_3_0_VERSION, |
@@ -141,6 +145,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { | |||
141 | .board_ext_size = QCA6174_BOARD_EXT_DATA_SZ, | 145 | .board_ext_size = QCA6174_BOARD_EXT_DATA_SZ, |
142 | }, | 146 | }, |
143 | .hw_ops = &qca988x_ops, | 147 | .hw_ops = &qca988x_ops, |
148 | .decap_align_bytes = 4, | ||
144 | }, | 149 | }, |
145 | { | 150 | { |
146 | .id = QCA6174_HW_3_2_VERSION, | 151 | .id = QCA6174_HW_3_2_VERSION, |
@@ -160,6 +165,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { | |||
160 | .board_ext_size = QCA6174_BOARD_EXT_DATA_SZ, | 165 | .board_ext_size = QCA6174_BOARD_EXT_DATA_SZ, |
161 | }, | 166 | }, |
162 | .hw_ops = &qca988x_ops, | 167 | .hw_ops = &qca988x_ops, |
168 | .decap_align_bytes = 4, | ||
163 | }, | 169 | }, |
164 | { | 170 | { |
165 | .id = QCA99X0_HW_2_0_DEV_VERSION, | 171 | .id = QCA99X0_HW_2_0_DEV_VERSION, |
@@ -184,6 +190,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { | |||
184 | }, | 190 | }, |
185 | .sw_decrypt_mcast_mgmt = true, | 191 | .sw_decrypt_mcast_mgmt = true, |
186 | .hw_ops = &qca99x0_ops, | 192 | .hw_ops = &qca99x0_ops, |
193 | .decap_align_bytes = 1, | ||
187 | }, | 194 | }, |
188 | { | 195 | { |
189 | .id = QCA9984_HW_1_0_DEV_VERSION, | 196 | .id = QCA9984_HW_1_0_DEV_VERSION, |
@@ -208,6 +215,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { | |||
208 | }, | 215 | }, |
209 | .sw_decrypt_mcast_mgmt = true, | 216 | .sw_decrypt_mcast_mgmt = true, |
210 | .hw_ops = &qca99x0_ops, | 217 | .hw_ops = &qca99x0_ops, |
218 | .decap_align_bytes = 1, | ||
211 | }, | 219 | }, |
212 | { | 220 | { |
213 | .id = QCA9888_HW_2_0_DEV_VERSION, | 221 | .id = QCA9888_HW_2_0_DEV_VERSION, |
@@ -231,6 +239,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { | |||
231 | }, | 239 | }, |
232 | .sw_decrypt_mcast_mgmt = true, | 240 | .sw_decrypt_mcast_mgmt = true, |
233 | .hw_ops = &qca99x0_ops, | 241 | .hw_ops = &qca99x0_ops, |
242 | .decap_align_bytes = 1, | ||
234 | }, | 243 | }, |
235 | { | 244 | { |
236 | .id = QCA9377_HW_1_0_DEV_VERSION, | 245 | .id = QCA9377_HW_1_0_DEV_VERSION, |
@@ -249,6 +258,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { | |||
249 | .board_ext_size = QCA9377_BOARD_EXT_DATA_SZ, | 258 | .board_ext_size = QCA9377_BOARD_EXT_DATA_SZ, |
250 | }, | 259 | }, |
251 | .hw_ops = &qca988x_ops, | 260 | .hw_ops = &qca988x_ops, |
261 | .decap_align_bytes = 4, | ||
252 | }, | 262 | }, |
253 | { | 263 | { |
254 | .id = QCA9377_HW_1_1_DEV_VERSION, | 264 | .id = QCA9377_HW_1_1_DEV_VERSION, |
@@ -267,6 +277,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { | |||
267 | .board_ext_size = QCA9377_BOARD_EXT_DATA_SZ, | 277 | .board_ext_size = QCA9377_BOARD_EXT_DATA_SZ, |
268 | }, | 278 | }, |
269 | .hw_ops = &qca988x_ops, | 279 | .hw_ops = &qca988x_ops, |
280 | .decap_align_bytes = 4, | ||
270 | }, | 281 | }, |
271 | { | 282 | { |
272 | .id = QCA4019_HW_1_0_DEV_VERSION, | 283 | .id = QCA4019_HW_1_0_DEV_VERSION, |
@@ -292,6 +303,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { | |||
292 | }, | 303 | }, |
293 | .sw_decrypt_mcast_mgmt = true, | 304 | .sw_decrypt_mcast_mgmt = true, |
294 | .hw_ops = &qca99x0_ops, | 305 | .hw_ops = &qca99x0_ops, |
306 | .decap_align_bytes = 1, | ||
295 | }, | 307 | }, |
296 | }; | 308 | }; |
297 | 309 | ||
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index a3785a9aa843..0b4c1562420f 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c | |||
@@ -1103,6 +1103,7 @@ static void *ath10k_htt_rx_h_find_rfc1042(struct ath10k *ar, | |||
1103 | size_t hdr_len, crypto_len; | 1103 | size_t hdr_len, crypto_len; |
1104 | void *rfc1042; | 1104 | void *rfc1042; |
1105 | bool is_first, is_last, is_amsdu; | 1105 | bool is_first, is_last, is_amsdu; |
1106 | int bytes_aligned = ar->hw_params.decap_align_bytes; | ||
1106 | 1107 | ||
1107 | rxd = (void *)msdu->data - sizeof(*rxd); | 1108 | rxd = (void *)msdu->data - sizeof(*rxd); |
1108 | hdr = (void *)rxd->rx_hdr_status; | 1109 | hdr = (void *)rxd->rx_hdr_status; |
@@ -1119,8 +1120,8 @@ static void *ath10k_htt_rx_h_find_rfc1042(struct ath10k *ar, | |||
1119 | hdr_len = ieee80211_hdrlen(hdr->frame_control); | 1120 | hdr_len = ieee80211_hdrlen(hdr->frame_control); |
1120 | crypto_len = ath10k_htt_rx_crypto_param_len(ar, enctype); | 1121 | crypto_len = ath10k_htt_rx_crypto_param_len(ar, enctype); |
1121 | 1122 | ||
1122 | rfc1042 += round_up(hdr_len, 4) + | 1123 | rfc1042 += round_up(hdr_len, bytes_aligned) + |
1123 | round_up(crypto_len, 4); | 1124 | round_up(crypto_len, bytes_aligned); |
1124 | } | 1125 | } |
1125 | 1126 | ||
1126 | if (is_amsdu) | 1127 | if (is_amsdu) |
diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h index 4a01bcff49a7..6038b7486f1d 100644 --- a/drivers/net/wireless/ath/ath10k/hw.h +++ b/drivers/net/wireless/ath/ath10k/hw.h | |||
@@ -408,6 +408,9 @@ struct ath10k_hw_params { | |||
408 | bool sw_decrypt_mcast_mgmt; | 408 | bool sw_decrypt_mcast_mgmt; |
409 | 409 | ||
410 | const struct ath10k_hw_ops *hw_ops; | 410 | const struct ath10k_hw_ops *hw_ops; |
411 | |||
412 | /* Number of bytes used for alignment in rx_hdr_status of rx desc. */ | ||
413 | int decap_align_bytes; | ||
411 | }; | 414 | }; |
412 | 415 | ||
413 | struct htt_rx_desc; | 416 | struct htt_rx_desc; |