diff options
Diffstat (limited to 'drivers/net/wireless')
44 files changed, 923 insertions, 1365 deletions
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index 2fbe9b4506c0..174e3442d519 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig | |||
@@ -5,6 +5,7 @@ | |||
5 | menuconfig WLAN | 5 | menuconfig WLAN |
6 | bool "Wireless LAN" | 6 | bool "Wireless LAN" |
7 | depends on !S390 | 7 | depends on !S390 |
8 | depends on NET | ||
8 | select WIRELESS | 9 | select WIRELESS |
9 | default y | 10 | default y |
10 | ---help--- | 11 | ---help--- |
diff --git a/drivers/net/wireless/ath/ar9170/ar9170.h b/drivers/net/wireless/ath/ar9170/ar9170.h index dc662b76a1c8..4f845f80c098 100644 --- a/drivers/net/wireless/ath/ar9170/ar9170.h +++ b/drivers/net/wireless/ath/ar9170/ar9170.h | |||
@@ -109,41 +109,6 @@ struct ar9170_rxstream_mpdu_merge { | |||
109 | bool has_plcp; | 109 | bool has_plcp; |
110 | }; | 110 | }; |
111 | 111 | ||
112 | #define AR9170_NUM_TID 16 | ||
113 | #define WME_BA_BMP_SIZE 64 | ||
114 | #define AR9170_NUM_MAX_AGG_LEN (2 * WME_BA_BMP_SIZE) | ||
115 | |||
116 | #define WME_AC_BE 2 | ||
117 | #define WME_AC_BK 3 | ||
118 | #define WME_AC_VI 1 | ||
119 | #define WME_AC_VO 0 | ||
120 | |||
121 | #define TID_TO_WME_AC(_tid) \ | ||
122 | ((((_tid) == 0) || ((_tid) == 3)) ? WME_AC_BE : \ | ||
123 | (((_tid) == 1) || ((_tid) == 2)) ? WME_AC_BK : \ | ||
124 | (((_tid) == 4) || ((_tid) == 5)) ? WME_AC_VI : \ | ||
125 | WME_AC_VO) | ||
126 | |||
127 | #define BAW_WITHIN(_start, _bawsz, _seqno) \ | ||
128 | ((((_seqno) - (_start)) & 0xfff) < (_bawsz)) | ||
129 | |||
130 | enum ar9170_tid_state { | ||
131 | AR9170_TID_STATE_INVALID, | ||
132 | AR9170_TID_STATE_SHUTDOWN, | ||
133 | AR9170_TID_STATE_PROGRESS, | ||
134 | AR9170_TID_STATE_COMPLETE, | ||
135 | }; | ||
136 | |||
137 | struct ar9170_sta_tid { | ||
138 | struct list_head list; | ||
139 | struct sk_buff_head queue; | ||
140 | u8 addr[ETH_ALEN]; | ||
141 | u16 ssn; | ||
142 | u16 tid; | ||
143 | enum ar9170_tid_state state; | ||
144 | bool active; | ||
145 | }; | ||
146 | |||
147 | struct ar9170_tx_queue_stats { | 112 | struct ar9170_tx_queue_stats { |
148 | unsigned int len; | 113 | unsigned int len; |
149 | unsigned int limit; | 114 | unsigned int limit; |
@@ -152,14 +117,11 @@ struct ar9170_tx_queue_stats { | |||
152 | 117 | ||
153 | #define AR9170_QUEUE_TIMEOUT 64 | 118 | #define AR9170_QUEUE_TIMEOUT 64 |
154 | #define AR9170_TX_TIMEOUT 8 | 119 | #define AR9170_TX_TIMEOUT 8 |
155 | #define AR9170_BA_TIMEOUT 4 | ||
156 | #define AR9170_JANITOR_DELAY 128 | 120 | #define AR9170_JANITOR_DELAY 128 |
157 | #define AR9170_TX_INVALID_RATE 0xffffffff | 121 | #define AR9170_TX_INVALID_RATE 0xffffffff |
158 | 122 | ||
159 | #define AR9170_NUM_TX_STATUS 128 | 123 | #define AR9170_NUM_TX_LIMIT_HARD AR9170_TXQ_DEPTH |
160 | #define AR9170_NUM_TX_AGG_MAX 30 | 124 | #define AR9170_NUM_TX_LIMIT_SOFT (AR9170_TXQ_DEPTH - 10) |
161 | #define AR9170_NUM_TX_LIMIT_HARD AR9170_TXQ_DEPTH | ||
162 | #define AR9170_NUM_TX_LIMIT_SOFT (AR9170_TXQ_DEPTH - 10) | ||
163 | 125 | ||
164 | struct ar9170 { | 126 | struct ar9170 { |
165 | struct ieee80211_hw *hw; | 127 | struct ieee80211_hw *hw; |
@@ -234,11 +196,6 @@ struct ar9170 { | |||
234 | struct sk_buff_head tx_pending[__AR9170_NUM_TXQ]; | 196 | struct sk_buff_head tx_pending[__AR9170_NUM_TXQ]; |
235 | struct sk_buff_head tx_status[__AR9170_NUM_TXQ]; | 197 | struct sk_buff_head tx_status[__AR9170_NUM_TXQ]; |
236 | struct delayed_work tx_janitor; | 198 | struct delayed_work tx_janitor; |
237 | /* tx ampdu */ | ||
238 | struct sk_buff_head tx_status_ampdu; | ||
239 | spinlock_t tx_ampdu_list_lock; | ||
240 | struct list_head tx_ampdu_list; | ||
241 | atomic_t tx_ampdu_pending; | ||
242 | 199 | ||
243 | /* rxstream mpdu merge */ | 200 | /* rxstream mpdu merge */ |
244 | struct ar9170_rxstream_mpdu_merge rx_mpdu; | 201 | struct ar9170_rxstream_mpdu_merge rx_mpdu; |
@@ -250,11 +207,6 @@ struct ar9170 { | |||
250 | u8 global_ampdu_factor; | 207 | u8 global_ampdu_factor; |
251 | }; | 208 | }; |
252 | 209 | ||
253 | struct ar9170_sta_info { | ||
254 | struct ar9170_sta_tid agg[AR9170_NUM_TID]; | ||
255 | unsigned int ampdu_max_len; | ||
256 | }; | ||
257 | |||
258 | struct ar9170_tx_info { | 210 | struct ar9170_tx_info { |
259 | unsigned long timeout; | 211 | unsigned long timeout; |
260 | }; | 212 | }; |
diff --git a/drivers/net/wireless/ath/ar9170/main.c b/drivers/net/wireless/ath/ar9170/main.c index 2e9b330f6413..2abc87578994 100644 --- a/drivers/net/wireless/ath/ar9170/main.c +++ b/drivers/net/wireless/ath/ar9170/main.c | |||
@@ -50,10 +50,6 @@ static int modparam_nohwcrypt; | |||
50 | module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO); | 50 | module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO); |
51 | MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); | 51 | MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); |
52 | 52 | ||
53 | static int modparam_ht; | ||
54 | module_param_named(ht, modparam_ht, bool, S_IRUGO); | ||
55 | MODULE_PARM_DESC(ht, "enable MPDU aggregation."); | ||
56 | |||
57 | #define RATE(_bitrate, _hw_rate, _txpidx, _flags) { \ | 53 | #define RATE(_bitrate, _hw_rate, _txpidx, _flags) { \ |
58 | .bitrate = (_bitrate), \ | 54 | .bitrate = (_bitrate), \ |
59 | .flags = (_flags), \ | 55 | .flags = (_flags), \ |
@@ -182,7 +178,6 @@ static struct ieee80211_supported_band ar9170_band_5GHz = { | |||
182 | }; | 178 | }; |
183 | 179 | ||
184 | static void ar9170_tx(struct ar9170 *ar); | 180 | static void ar9170_tx(struct ar9170 *ar); |
185 | static bool ar9170_tx_ampdu(struct ar9170 *ar); | ||
186 | 181 | ||
187 | static inline u16 ar9170_get_seq_h(struct ieee80211_hdr *hdr) | 182 | static inline u16 ar9170_get_seq_h(struct ieee80211_hdr *hdr) |
188 | { | 183 | { |
@@ -195,21 +190,7 @@ static inline u16 ar9170_get_seq(struct sk_buff *skb) | |||
195 | return ar9170_get_seq_h((void *) txc->frame_data); | 190 | return ar9170_get_seq_h((void *) txc->frame_data); |
196 | } | 191 | } |
197 | 192 | ||
198 | static inline u16 ar9170_get_tid_h(struct ieee80211_hdr *hdr) | 193 | #ifdef AR9170_QUEUE_DEBUG |
199 | { | ||
200 | return (ieee80211_get_qos_ctl(hdr))[0] & IEEE80211_QOS_CTL_TID_MASK; | ||
201 | } | ||
202 | |||
203 | static inline u16 ar9170_get_tid(struct sk_buff *skb) | ||
204 | { | ||
205 | struct ar9170_tx_control *txc = (void *) skb->data; | ||
206 | return ar9170_get_tid_h((struct ieee80211_hdr *) txc->frame_data); | ||
207 | } | ||
208 | |||
209 | #define GET_NEXT_SEQ(seq) ((seq + 1) & 0x0fff) | ||
210 | #define GET_NEXT_SEQ_FROM_SKB(skb) (GET_NEXT_SEQ(ar9170_get_seq(skb))) | ||
211 | |||
212 | #if (defined AR9170_QUEUE_DEBUG) || (defined AR9170_TXAGG_DEBUG) | ||
213 | static void ar9170_print_txheader(struct ar9170 *ar, struct sk_buff *skb) | 194 | static void ar9170_print_txheader(struct ar9170 *ar, struct sk_buff *skb) |
214 | { | 195 | { |
215 | struct ar9170_tx_control *txc = (void *) skb->data; | 196 | struct ar9170_tx_control *txc = (void *) skb->data; |
@@ -244,7 +225,7 @@ static void __ar9170_dump_txqueue(struct ar9170 *ar, | |||
244 | "mismatch %d != %d\n", skb_queue_len(queue), i); | 225 | "mismatch %d != %d\n", skb_queue_len(queue), i); |
245 | printk(KERN_DEBUG "---[ end ]---\n"); | 226 | printk(KERN_DEBUG "---[ end ]---\n"); |
246 | } | 227 | } |
247 | #endif /* AR9170_QUEUE_DEBUG || AR9170_TXAGG_DEBUG */ | 228 | #endif /* AR9170_QUEUE_DEBUG */ |
248 | 229 | ||
249 | #ifdef AR9170_QUEUE_DEBUG | 230 | #ifdef AR9170_QUEUE_DEBUG |
250 | static void ar9170_dump_txqueue(struct ar9170 *ar, | 231 | static void ar9170_dump_txqueue(struct ar9170 *ar, |
@@ -275,20 +256,6 @@ static void __ar9170_dump_txstats(struct ar9170 *ar) | |||
275 | } | 256 | } |
276 | #endif /* AR9170_QUEUE_STOP_DEBUG */ | 257 | #endif /* AR9170_QUEUE_STOP_DEBUG */ |
277 | 258 | ||
278 | #ifdef AR9170_TXAGG_DEBUG | ||
279 | static void ar9170_dump_tx_status_ampdu(struct ar9170 *ar) | ||
280 | { | ||
281 | unsigned long flags; | ||
282 | |||
283 | spin_lock_irqsave(&ar->tx_status_ampdu.lock, flags); | ||
284 | printk(KERN_DEBUG "%s: A-MPDU tx_status queue =>\n", | ||
285 | wiphy_name(ar->hw->wiphy)); | ||
286 | __ar9170_dump_txqueue(ar, &ar->tx_status_ampdu); | ||
287 | spin_unlock_irqrestore(&ar->tx_status_ampdu.lock, flags); | ||
288 | } | ||
289 | |||
290 | #endif /* AR9170_TXAGG_DEBUG */ | ||
291 | |||
292 | /* caller must guarantee exclusive access for _bin_ queue. */ | 259 | /* caller must guarantee exclusive access for _bin_ queue. */ |
293 | static void ar9170_recycle_expired(struct ar9170 *ar, | 260 | static void ar9170_recycle_expired(struct ar9170 *ar, |
294 | struct sk_buff_head *queue, | 261 | struct sk_buff_head *queue, |
@@ -360,70 +327,6 @@ static void ar9170_tx_status(struct ar9170 *ar, struct sk_buff *skb, | |||
360 | ieee80211_tx_status_irqsafe(ar->hw, skb); | 327 | ieee80211_tx_status_irqsafe(ar->hw, skb); |
361 | } | 328 | } |
362 | 329 | ||
363 | static void ar9170_tx_fake_ampdu_status(struct ar9170 *ar) | ||
364 | { | ||
365 | struct sk_buff_head success; | ||
366 | struct sk_buff *skb; | ||
367 | unsigned int i; | ||
368 | unsigned long queue_bitmap = 0; | ||
369 | |||
370 | skb_queue_head_init(&success); | ||
371 | |||
372 | while (skb_queue_len(&ar->tx_status_ampdu) > AR9170_NUM_TX_STATUS) | ||
373 | __skb_queue_tail(&success, skb_dequeue(&ar->tx_status_ampdu)); | ||
374 | |||
375 | ar9170_recycle_expired(ar, &ar->tx_status_ampdu, &success); | ||
376 | |||
377 | #ifdef AR9170_TXAGG_DEBUG | ||
378 | printk(KERN_DEBUG "%s: collected %d A-MPDU frames.\n", | ||
379 | wiphy_name(ar->hw->wiphy), skb_queue_len(&success)); | ||
380 | __ar9170_dump_txqueue(ar, &success); | ||
381 | #endif /* AR9170_TXAGG_DEBUG */ | ||
382 | |||
383 | while ((skb = __skb_dequeue(&success))) { | ||
384 | struct ieee80211_tx_info *txinfo; | ||
385 | |||
386 | queue_bitmap |= BIT(skb_get_queue_mapping(skb)); | ||
387 | |||
388 | txinfo = IEEE80211_SKB_CB(skb); | ||
389 | ieee80211_tx_info_clear_status(txinfo); | ||
390 | |||
391 | txinfo->flags |= IEEE80211_TX_STAT_ACK; | ||
392 | txinfo->status.rates[0].count = 1; | ||
393 | |||
394 | skb_pull(skb, sizeof(struct ar9170_tx_control)); | ||
395 | ieee80211_tx_status_irqsafe(ar->hw, skb); | ||
396 | } | ||
397 | |||
398 | for_each_set_bit(i, &queue_bitmap, BITS_PER_BYTE) { | ||
399 | #ifdef AR9170_QUEUE_STOP_DEBUG | ||
400 | printk(KERN_DEBUG "%s: wake queue %d\n", | ||
401 | wiphy_name(ar->hw->wiphy), i); | ||
402 | __ar9170_dump_txstats(ar); | ||
403 | #endif /* AR9170_QUEUE_STOP_DEBUG */ | ||
404 | ieee80211_wake_queue(ar->hw, i); | ||
405 | } | ||
406 | |||
407 | if (queue_bitmap) | ||
408 | ar9170_tx(ar); | ||
409 | } | ||
410 | |||
411 | static void ar9170_tx_ampdu_callback(struct ar9170 *ar, struct sk_buff *skb) | ||
412 | { | ||
413 | struct ieee80211_tx_info *txinfo = IEEE80211_SKB_CB(skb); | ||
414 | struct ar9170_tx_info *arinfo = (void *) txinfo->rate_driver_data; | ||
415 | |||
416 | arinfo->timeout = jiffies + | ||
417 | msecs_to_jiffies(AR9170_BA_TIMEOUT); | ||
418 | |||
419 | skb_queue_tail(&ar->tx_status_ampdu, skb); | ||
420 | ar9170_tx_fake_ampdu_status(ar); | ||
421 | |||
422 | if (atomic_dec_and_test(&ar->tx_ampdu_pending) && | ||
423 | !list_empty(&ar->tx_ampdu_list)) | ||
424 | ar9170_tx_ampdu(ar); | ||
425 | } | ||
426 | |||
427 | void ar9170_tx_callback(struct ar9170 *ar, struct sk_buff *skb) | 330 | void ar9170_tx_callback(struct ar9170 *ar, struct sk_buff *skb) |
428 | { | 331 | { |
429 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 332 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
@@ -447,14 +350,10 @@ void ar9170_tx_callback(struct ar9170 *ar, struct sk_buff *skb) | |||
447 | if (info->flags & IEEE80211_TX_CTL_NO_ACK) { | 350 | if (info->flags & IEEE80211_TX_CTL_NO_ACK) { |
448 | ar9170_tx_status(ar, skb, AR9170_TX_STATUS_FAILED); | 351 | ar9170_tx_status(ar, skb, AR9170_TX_STATUS_FAILED); |
449 | } else { | 352 | } else { |
450 | if (info->flags & IEEE80211_TX_CTL_AMPDU) { | 353 | arinfo->timeout = jiffies + |
451 | ar9170_tx_ampdu_callback(ar, skb); | 354 | msecs_to_jiffies(AR9170_TX_TIMEOUT); |
452 | } else { | ||
453 | arinfo->timeout = jiffies + | ||
454 | msecs_to_jiffies(AR9170_TX_TIMEOUT); | ||
455 | 355 | ||
456 | skb_queue_tail(&ar->tx_status[queue], skb); | 356 | skb_queue_tail(&ar->tx_status[queue], skb); |
457 | } | ||
458 | } | 357 | } |
459 | 358 | ||
460 | if (!ar->tx_stats[queue].len && | 359 | if (!ar->tx_stats[queue].len && |
@@ -524,38 +423,6 @@ static struct sk_buff *ar9170_get_queued_skb(struct ar9170 *ar, | |||
524 | return NULL; | 423 | return NULL; |
525 | } | 424 | } |
526 | 425 | ||
527 | static void ar9170_handle_block_ack(struct ar9170 *ar, u16 count, u16 r) | ||
528 | { | ||
529 | struct sk_buff *skb; | ||
530 | struct ieee80211_tx_info *txinfo; | ||
531 | |||
532 | while (count) { | ||
533 | skb = ar9170_get_queued_skb(ar, NULL, &ar->tx_status_ampdu, r); | ||
534 | if (!skb) | ||
535 | break; | ||
536 | |||
537 | txinfo = IEEE80211_SKB_CB(skb); | ||
538 | ieee80211_tx_info_clear_status(txinfo); | ||
539 | |||
540 | /* FIXME: maybe more ? */ | ||
541 | txinfo->status.rates[0].count = 1; | ||
542 | |||
543 | skb_pull(skb, sizeof(struct ar9170_tx_control)); | ||
544 | ieee80211_tx_status_irqsafe(ar->hw, skb); | ||
545 | count--; | ||
546 | } | ||
547 | |||
548 | #ifdef AR9170_TXAGG_DEBUG | ||
549 | if (count) { | ||
550 | printk(KERN_DEBUG "%s: got %d more failed mpdus, but no more " | ||
551 | "suitable frames left in tx_status queue.\n", | ||
552 | wiphy_name(ar->hw->wiphy), count); | ||
553 | |||
554 | ar9170_dump_tx_status_ampdu(ar); | ||
555 | } | ||
556 | #endif /* AR9170_TXAGG_DEBUG */ | ||
557 | } | ||
558 | |||
559 | /* | 426 | /* |
560 | * This worker tries to keeps an maintain tx_status queues. | 427 | * This worker tries to keeps an maintain tx_status queues. |
561 | * So we can guarantee that incoming tx_status reports are | 428 | * So we can guarantee that incoming tx_status reports are |
@@ -592,8 +459,6 @@ static void ar9170_tx_janitor(struct work_struct *work) | |||
592 | resched = true; | 459 | resched = true; |
593 | } | 460 | } |
594 | 461 | ||
595 | ar9170_tx_fake_ampdu_status(ar); | ||
596 | |||
597 | if (!resched) | 462 | if (!resched) |
598 | return; | 463 | return; |
599 | 464 | ||
@@ -673,10 +538,6 @@ void ar9170_handle_command_response(struct ar9170 *ar, void *buf, u32 len) | |||
673 | 538 | ||
674 | case 0xc5: | 539 | case 0xc5: |
675 | /* BlockACK events */ | 540 | /* BlockACK events */ |
676 | ar9170_handle_block_ack(ar, | ||
677 | le16_to_cpu(cmd->ba_fail_cnt.failed), | ||
678 | le16_to_cpu(cmd->ba_fail_cnt.rate)); | ||
679 | ar9170_tx_fake_ampdu_status(ar); | ||
680 | break; | 541 | break; |
681 | 542 | ||
682 | case 0xc6: | 543 | case 0xc6: |
@@ -1247,7 +1108,6 @@ static int ar9170_op_start(struct ieee80211_hw *hw) | |||
1247 | ar->global_ampdu_density = 6; | 1108 | ar->global_ampdu_density = 6; |
1248 | ar->global_ampdu_factor = 3; | 1109 | ar->global_ampdu_factor = 3; |
1249 | 1110 | ||
1250 | atomic_set(&ar->tx_ampdu_pending, 0); | ||
1251 | ar->bad_hw_nagger = jiffies; | 1111 | ar->bad_hw_nagger = jiffies; |
1252 | 1112 | ||
1253 | err = ar->open(ar); | 1113 | err = ar->open(ar); |
@@ -1310,40 +1170,10 @@ static void ar9170_op_stop(struct ieee80211_hw *hw) | |||
1310 | skb_queue_purge(&ar->tx_pending[i]); | 1170 | skb_queue_purge(&ar->tx_pending[i]); |
1311 | skb_queue_purge(&ar->tx_status[i]); | 1171 | skb_queue_purge(&ar->tx_status[i]); |
1312 | } | 1172 | } |
1313 | skb_queue_purge(&ar->tx_status_ampdu); | ||
1314 | 1173 | ||
1315 | mutex_unlock(&ar->mutex); | 1174 | mutex_unlock(&ar->mutex); |
1316 | } | 1175 | } |
1317 | 1176 | ||
1318 | static void ar9170_tx_indicate_immba(struct ar9170 *ar, struct sk_buff *skb) | ||
1319 | { | ||
1320 | struct ar9170_tx_control *txc = (void *) skb->data; | ||
1321 | |||
1322 | txc->mac_control |= cpu_to_le16(AR9170_TX_MAC_IMM_AMPDU); | ||
1323 | } | ||
1324 | |||
1325 | static void ar9170_tx_copy_phy(struct ar9170 *ar, struct sk_buff *dst, | ||
1326 | struct sk_buff *src) | ||
1327 | { | ||
1328 | struct ar9170_tx_control *dst_txc, *src_txc; | ||
1329 | struct ieee80211_tx_info *dst_info, *src_info; | ||
1330 | struct ar9170_tx_info *dst_arinfo, *src_arinfo; | ||
1331 | |||
1332 | src_txc = (void *) src->data; | ||
1333 | src_info = IEEE80211_SKB_CB(src); | ||
1334 | src_arinfo = (void *) src_info->rate_driver_data; | ||
1335 | |||
1336 | dst_txc = (void *) dst->data; | ||
1337 | dst_info = IEEE80211_SKB_CB(dst); | ||
1338 | dst_arinfo = (void *) dst_info->rate_driver_data; | ||
1339 | |||
1340 | dst_txc->phy_control = src_txc->phy_control; | ||
1341 | |||
1342 | /* same MCS for the whole aggregate */ | ||
1343 | memcpy(dst_info->driver_rates, src_info->driver_rates, | ||
1344 | sizeof(dst_info->driver_rates)); | ||
1345 | } | ||
1346 | |||
1347 | static int ar9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb) | 1177 | static int ar9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb) |
1348 | { | 1178 | { |
1349 | struct ieee80211_hdr *hdr; | 1179 | struct ieee80211_hdr *hdr; |
@@ -1420,14 +1250,7 @@ static int ar9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb) | |||
1420 | txc->phy_control |= | 1250 | txc->phy_control |= |
1421 | cpu_to_le32(queue << AR9170_TX_PHY_QOS_SHIFT); | 1251 | cpu_to_le32(queue << AR9170_TX_PHY_QOS_SHIFT); |
1422 | 1252 | ||
1423 | if (info->flags & IEEE80211_TX_CTL_AMPDU) { | 1253 | txc->mac_control |= cpu_to_le16(AR9170_TX_MAC_RATE_PROBE); |
1424 | if (unlikely(!info->control.sta)) | ||
1425 | goto err_out; | ||
1426 | |||
1427 | txc->mac_control |= cpu_to_le16(AR9170_TX_MAC_AGGR); | ||
1428 | } else { | ||
1429 | txc->mac_control |= cpu_to_le16(AR9170_TX_MAC_RATE_PROBE); | ||
1430 | } | ||
1431 | } | 1254 | } |
1432 | 1255 | ||
1433 | return 0; | 1256 | return 0; |
@@ -1537,158 +1360,6 @@ static void ar9170_tx_prepare_phy(struct ar9170 *ar, struct sk_buff *skb) | |||
1537 | txc->phy_control |= cpu_to_le32(chains << AR9170_TX_PHY_TXCHAIN_SHIFT); | 1360 | txc->phy_control |= cpu_to_le32(chains << AR9170_TX_PHY_TXCHAIN_SHIFT); |
1538 | } | 1361 | } |
1539 | 1362 | ||
1540 | static bool ar9170_tx_ampdu(struct ar9170 *ar) | ||
1541 | { | ||
1542 | struct sk_buff_head agg; | ||
1543 | struct ar9170_sta_tid *tid_info = NULL, *tmp; | ||
1544 | struct sk_buff *skb, *first = NULL; | ||
1545 | unsigned long flags, f2; | ||
1546 | unsigned int i = 0; | ||
1547 | u16 seq, queue, tmpssn; | ||
1548 | bool run = false; | ||
1549 | |||
1550 | skb_queue_head_init(&agg); | ||
1551 | |||
1552 | spin_lock_irqsave(&ar->tx_ampdu_list_lock, flags); | ||
1553 | if (list_empty(&ar->tx_ampdu_list)) { | ||
1554 | #ifdef AR9170_TXAGG_DEBUG | ||
1555 | printk(KERN_DEBUG "%s: aggregation list is empty.\n", | ||
1556 | wiphy_name(ar->hw->wiphy)); | ||
1557 | #endif /* AR9170_TXAGG_DEBUG */ | ||
1558 | goto out_unlock; | ||
1559 | } | ||
1560 | |||
1561 | list_for_each_entry_safe(tid_info, tmp, &ar->tx_ampdu_list, list) { | ||
1562 | if (tid_info->state != AR9170_TID_STATE_COMPLETE) { | ||
1563 | #ifdef AR9170_TXAGG_DEBUG | ||
1564 | printk(KERN_DEBUG "%s: dangling aggregation entry!\n", | ||
1565 | wiphy_name(ar->hw->wiphy)); | ||
1566 | #endif /* AR9170_TXAGG_DEBUG */ | ||
1567 | continue; | ||
1568 | } | ||
1569 | |||
1570 | if (++i > 64) { | ||
1571 | #ifdef AR9170_TXAGG_DEBUG | ||
1572 | printk(KERN_DEBUG "%s: enough frames aggregated.\n", | ||
1573 | wiphy_name(ar->hw->wiphy)); | ||
1574 | #endif /* AR9170_TXAGG_DEBUG */ | ||
1575 | break; | ||
1576 | } | ||
1577 | |||
1578 | queue = TID_TO_WME_AC(tid_info->tid); | ||
1579 | |||
1580 | if (skb_queue_len(&ar->tx_pending[queue]) >= | ||
1581 | AR9170_NUM_TX_AGG_MAX) { | ||
1582 | #ifdef AR9170_TXAGG_DEBUG | ||
1583 | printk(KERN_DEBUG "%s: queue %d full.\n", | ||
1584 | wiphy_name(ar->hw->wiphy), queue); | ||
1585 | #endif /* AR9170_TXAGG_DEBUG */ | ||
1586 | continue; | ||
1587 | } | ||
1588 | |||
1589 | list_del_init(&tid_info->list); | ||
1590 | |||
1591 | spin_lock_irqsave(&tid_info->queue.lock, f2); | ||
1592 | tmpssn = seq = tid_info->ssn; | ||
1593 | first = skb_peek(&tid_info->queue); | ||
1594 | |||
1595 | if (likely(first)) | ||
1596 | tmpssn = ar9170_get_seq(first); | ||
1597 | |||
1598 | if (unlikely(tmpssn != seq)) { | ||
1599 | #ifdef AR9170_TXAGG_DEBUG | ||
1600 | printk(KERN_DEBUG "%s: ssn mismatch [%d != %d]\n.", | ||
1601 | wiphy_name(ar->hw->wiphy), seq, tmpssn); | ||
1602 | #endif /* AR9170_TXAGG_DEBUG */ | ||
1603 | tid_info->ssn = tmpssn; | ||
1604 | } | ||
1605 | |||
1606 | #ifdef AR9170_TXAGG_DEBUG | ||
1607 | printk(KERN_DEBUG "%s: generate A-MPDU for tid:%d ssn:%d with " | ||
1608 | "%d queued frames.\n", wiphy_name(ar->hw->wiphy), | ||
1609 | tid_info->tid, tid_info->ssn, | ||
1610 | skb_queue_len(&tid_info->queue)); | ||
1611 | __ar9170_dump_txqueue(ar, &tid_info->queue); | ||
1612 | #endif /* AR9170_TXAGG_DEBUG */ | ||
1613 | |||
1614 | while ((skb = skb_peek(&tid_info->queue))) { | ||
1615 | if (unlikely(ar9170_get_seq(skb) != seq)) | ||
1616 | break; | ||
1617 | |||
1618 | __skb_unlink(skb, &tid_info->queue); | ||
1619 | tid_info->ssn = seq = GET_NEXT_SEQ(seq); | ||
1620 | |||
1621 | if (unlikely(skb_get_queue_mapping(skb) != queue)) { | ||
1622 | #ifdef AR9170_TXAGG_DEBUG | ||
1623 | printk(KERN_DEBUG "%s: tid:%d(q:%d) queue:%d " | ||
1624 | "!match.\n", wiphy_name(ar->hw->wiphy), | ||
1625 | tid_info->tid, | ||
1626 | TID_TO_WME_AC(tid_info->tid), | ||
1627 | skb_get_queue_mapping(skb)); | ||
1628 | #endif /* AR9170_TXAGG_DEBUG */ | ||
1629 | dev_kfree_skb_any(skb); | ||
1630 | continue; | ||
1631 | } | ||
1632 | |||
1633 | if (unlikely(first == skb)) { | ||
1634 | ar9170_tx_prepare_phy(ar, skb); | ||
1635 | __skb_queue_tail(&agg, skb); | ||
1636 | first = skb; | ||
1637 | } else { | ||
1638 | ar9170_tx_copy_phy(ar, skb, first); | ||
1639 | __skb_queue_tail(&agg, skb); | ||
1640 | } | ||
1641 | |||
1642 | if (unlikely(skb_queue_len(&agg) == | ||
1643 | AR9170_NUM_TX_AGG_MAX)) | ||
1644 | break; | ||
1645 | } | ||
1646 | |||
1647 | if (skb_queue_empty(&tid_info->queue)) | ||
1648 | tid_info->active = false; | ||
1649 | else | ||
1650 | list_add_tail(&tid_info->list, | ||
1651 | &ar->tx_ampdu_list); | ||
1652 | |||
1653 | spin_unlock_irqrestore(&tid_info->queue.lock, f2); | ||
1654 | |||
1655 | if (unlikely(skb_queue_empty(&agg))) { | ||
1656 | #ifdef AR9170_TXAGG_DEBUG | ||
1657 | printk(KERN_DEBUG "%s: queued empty list!\n", | ||
1658 | wiphy_name(ar->hw->wiphy)); | ||
1659 | #endif /* AR9170_TXAGG_DEBUG */ | ||
1660 | continue; | ||
1661 | } | ||
1662 | |||
1663 | /* | ||
1664 | * tell the FW/HW that this is the last frame, | ||
1665 | * that way it will wait for the immediate block ack. | ||
1666 | */ | ||
1667 | ar9170_tx_indicate_immba(ar, skb_peek_tail(&agg)); | ||
1668 | |||
1669 | #ifdef AR9170_TXAGG_DEBUG | ||
1670 | printk(KERN_DEBUG "%s: generated A-MPDU looks like this:\n", | ||
1671 | wiphy_name(ar->hw->wiphy)); | ||
1672 | __ar9170_dump_txqueue(ar, &agg); | ||
1673 | #endif /* AR9170_TXAGG_DEBUG */ | ||
1674 | |||
1675 | spin_unlock_irqrestore(&ar->tx_ampdu_list_lock, flags); | ||
1676 | |||
1677 | spin_lock_irqsave(&ar->tx_pending[queue].lock, flags); | ||
1678 | skb_queue_splice_tail_init(&agg, &ar->tx_pending[queue]); | ||
1679 | spin_unlock_irqrestore(&ar->tx_pending[queue].lock, flags); | ||
1680 | run = true; | ||
1681 | |||
1682 | spin_lock_irqsave(&ar->tx_ampdu_list_lock, flags); | ||
1683 | } | ||
1684 | |||
1685 | out_unlock: | ||
1686 | spin_unlock_irqrestore(&ar->tx_ampdu_list_lock, flags); | ||
1687 | __skb_queue_purge(&agg); | ||
1688 | |||
1689 | return run; | ||
1690 | } | ||
1691 | |||
1692 | static void ar9170_tx(struct ar9170 *ar) | 1363 | static void ar9170_tx(struct ar9170 *ar) |
1693 | { | 1364 | { |
1694 | struct sk_buff *skb; | 1365 | struct sk_buff *skb; |
@@ -1763,9 +1434,6 @@ static void ar9170_tx(struct ar9170 *ar) | |||
1763 | arinfo->timeout = jiffies + | 1434 | arinfo->timeout = jiffies + |
1764 | msecs_to_jiffies(AR9170_TX_TIMEOUT); | 1435 | msecs_to_jiffies(AR9170_TX_TIMEOUT); |
1765 | 1436 | ||
1766 | if (info->flags & IEEE80211_TX_CTL_AMPDU) | ||
1767 | atomic_inc(&ar->tx_ampdu_pending); | ||
1768 | |||
1769 | #ifdef AR9170_QUEUE_DEBUG | 1437 | #ifdef AR9170_QUEUE_DEBUG |
1770 | printk(KERN_DEBUG "%s: send frame q:%d =>\n", | 1438 | printk(KERN_DEBUG "%s: send frame q:%d =>\n", |
1771 | wiphy_name(ar->hw->wiphy), i); | 1439 | wiphy_name(ar->hw->wiphy), i); |
@@ -1774,9 +1442,6 @@ static void ar9170_tx(struct ar9170 *ar) | |||
1774 | 1442 | ||
1775 | err = ar->tx(ar, skb); | 1443 | err = ar->tx(ar, skb); |
1776 | if (unlikely(err)) { | 1444 | if (unlikely(err)) { |
1777 | if (info->flags & IEEE80211_TX_CTL_AMPDU) | ||
1778 | atomic_dec(&ar->tx_ampdu_pending); | ||
1779 | |||
1780 | frames_failed++; | 1445 | frames_failed++; |
1781 | dev_kfree_skb_any(skb); | 1446 | dev_kfree_skb_any(skb); |
1782 | } else { | 1447 | } else { |
@@ -1823,94 +1488,11 @@ static void ar9170_tx(struct ar9170 *ar) | |||
1823 | msecs_to_jiffies(AR9170_JANITOR_DELAY)); | 1488 | msecs_to_jiffies(AR9170_JANITOR_DELAY)); |
1824 | } | 1489 | } |
1825 | 1490 | ||
1826 | static bool ar9170_tx_ampdu_queue(struct ar9170 *ar, struct sk_buff *skb) | ||
1827 | { | ||
1828 | struct ieee80211_tx_info *txinfo; | ||
1829 | struct ar9170_sta_info *sta_info; | ||
1830 | struct ar9170_sta_tid *agg; | ||
1831 | struct sk_buff *iter; | ||
1832 | unsigned long flags, f2; | ||
1833 | unsigned int max; | ||
1834 | u16 tid, seq, qseq; | ||
1835 | bool run = false, queue = false; | ||
1836 | |||
1837 | tid = ar9170_get_tid(skb); | ||
1838 | seq = ar9170_get_seq(skb); | ||
1839 | txinfo = IEEE80211_SKB_CB(skb); | ||
1840 | sta_info = (void *) txinfo->control.sta->drv_priv; | ||
1841 | agg = &sta_info->agg[tid]; | ||
1842 | max = sta_info->ampdu_max_len; | ||
1843 | |||
1844 | spin_lock_irqsave(&ar->tx_ampdu_list_lock, flags); | ||
1845 | |||
1846 | if (unlikely(agg->state != AR9170_TID_STATE_COMPLETE)) { | ||
1847 | #ifdef AR9170_TXAGG_DEBUG | ||
1848 | printk(KERN_DEBUG "%s: BlockACK session not fully initialized " | ||
1849 | "for ESS:%pM tid:%d state:%d.\n", | ||
1850 | wiphy_name(ar->hw->wiphy), agg->addr, agg->tid, | ||
1851 | agg->state); | ||
1852 | #endif /* AR9170_TXAGG_DEBUG */ | ||
1853 | goto err_unlock; | ||
1854 | } | ||
1855 | |||
1856 | if (!agg->active) { | ||
1857 | agg->active = true; | ||
1858 | agg->ssn = seq; | ||
1859 | queue = true; | ||
1860 | } | ||
1861 | |||
1862 | /* check if seq is within the BA window */ | ||
1863 | if (unlikely(!BAW_WITHIN(agg->ssn, max, seq))) { | ||
1864 | #ifdef AR9170_TXAGG_DEBUG | ||
1865 | printk(KERN_DEBUG "%s: frame with tid:%d seq:%d does not " | ||
1866 | "fit into BA window (%d - %d)\n", | ||
1867 | wiphy_name(ar->hw->wiphy), tid, seq, agg->ssn, | ||
1868 | (agg->ssn + max) & 0xfff); | ||
1869 | #endif /* AR9170_TXAGG_DEBUG */ | ||
1870 | goto err_unlock; | ||
1871 | } | ||
1872 | |||
1873 | spin_lock_irqsave(&agg->queue.lock, f2); | ||
1874 | |||
1875 | skb_queue_reverse_walk(&agg->queue, iter) { | ||
1876 | qseq = ar9170_get_seq(iter); | ||
1877 | |||
1878 | if (GET_NEXT_SEQ(qseq) == seq) { | ||
1879 | __skb_queue_after(&agg->queue, iter, skb); | ||
1880 | goto queued; | ||
1881 | } | ||
1882 | } | ||
1883 | |||
1884 | __skb_queue_head(&agg->queue, skb); | ||
1885 | |||
1886 | queued: | ||
1887 | spin_unlock_irqrestore(&agg->queue.lock, f2); | ||
1888 | |||
1889 | #ifdef AR9170_TXAGG_DEBUG | ||
1890 | printk(KERN_DEBUG "%s: new aggregate %p queued.\n", | ||
1891 | wiphy_name(ar->hw->wiphy), skb); | ||
1892 | __ar9170_dump_txqueue(ar, &agg->queue); | ||
1893 | #endif /* AR9170_TXAGG_DEBUG */ | ||
1894 | |||
1895 | if (skb_queue_len(&agg->queue) >= AR9170_NUM_TX_AGG_MAX) | ||
1896 | run = true; | ||
1897 | |||
1898 | if (queue) | ||
1899 | list_add_tail(&agg->list, &ar->tx_ampdu_list); | ||
1900 | |||
1901 | spin_unlock_irqrestore(&ar->tx_ampdu_list_lock, flags); | ||
1902 | return run; | ||
1903 | |||
1904 | err_unlock: | ||
1905 | spin_unlock_irqrestore(&ar->tx_ampdu_list_lock, flags); | ||
1906 | dev_kfree_skb_irq(skb); | ||
1907 | return false; | ||
1908 | } | ||
1909 | |||
1910 | int ar9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 1491 | int ar9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) |
1911 | { | 1492 | { |
1912 | struct ar9170 *ar = hw->priv; | 1493 | struct ar9170 *ar = hw->priv; |
1913 | struct ieee80211_tx_info *info; | 1494 | struct ieee80211_tx_info *info; |
1495 | unsigned int queue; | ||
1914 | 1496 | ||
1915 | if (unlikely(!IS_STARTED(ar))) | 1497 | if (unlikely(!IS_STARTED(ar))) |
1916 | goto err_free; | 1498 | goto err_free; |
@@ -1918,18 +1500,10 @@ int ar9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1918 | if (unlikely(ar9170_tx_prepare(ar, skb))) | 1500 | if (unlikely(ar9170_tx_prepare(ar, skb))) |
1919 | goto err_free; | 1501 | goto err_free; |
1920 | 1502 | ||
1503 | queue = skb_get_queue_mapping(skb); | ||
1921 | info = IEEE80211_SKB_CB(skb); | 1504 | info = IEEE80211_SKB_CB(skb); |
1922 | if (info->flags & IEEE80211_TX_CTL_AMPDU) { | 1505 | ar9170_tx_prepare_phy(ar, skb); |
1923 | bool run = ar9170_tx_ampdu_queue(ar, skb); | 1506 | skb_queue_tail(&ar->tx_pending[queue], skb); |
1924 | |||
1925 | if (run || !atomic_read(&ar->tx_ampdu_pending)) | ||
1926 | ar9170_tx_ampdu(ar); | ||
1927 | } else { | ||
1928 | unsigned int queue = skb_get_queue_mapping(skb); | ||
1929 | |||
1930 | ar9170_tx_prepare_phy(ar, skb); | ||
1931 | skb_queue_tail(&ar->tx_pending[queue], skb); | ||
1932 | } | ||
1933 | 1507 | ||
1934 | ar9170_tx(ar); | 1508 | ar9170_tx(ar); |
1935 | return NETDEV_TX_OK; | 1509 | return NETDEV_TX_OK; |
@@ -2326,57 +1900,6 @@ out: | |||
2326 | return err; | 1900 | return err; |
2327 | } | 1901 | } |
2328 | 1902 | ||
2329 | static int ar9170_sta_add(struct ieee80211_hw *hw, | ||
2330 | struct ieee80211_vif *vif, | ||
2331 | struct ieee80211_sta *sta) | ||
2332 | { | ||
2333 | struct ar9170 *ar = hw->priv; | ||
2334 | struct ar9170_sta_info *sta_info = (void *) sta->drv_priv; | ||
2335 | unsigned int i; | ||
2336 | |||
2337 | memset(sta_info, 0, sizeof(*sta_info)); | ||
2338 | |||
2339 | if (!sta->ht_cap.ht_supported) | ||
2340 | return 0; | ||
2341 | |||
2342 | if (sta->ht_cap.ampdu_density > ar->global_ampdu_density) | ||
2343 | ar->global_ampdu_density = sta->ht_cap.ampdu_density; | ||
2344 | |||
2345 | if (sta->ht_cap.ampdu_factor < ar->global_ampdu_factor) | ||
2346 | ar->global_ampdu_factor = sta->ht_cap.ampdu_factor; | ||
2347 | |||
2348 | for (i = 0; i < AR9170_NUM_TID; i++) { | ||
2349 | sta_info->agg[i].state = AR9170_TID_STATE_SHUTDOWN; | ||
2350 | sta_info->agg[i].active = false; | ||
2351 | sta_info->agg[i].ssn = 0; | ||
2352 | sta_info->agg[i].tid = i; | ||
2353 | INIT_LIST_HEAD(&sta_info->agg[i].list); | ||
2354 | skb_queue_head_init(&sta_info->agg[i].queue); | ||
2355 | } | ||
2356 | |||
2357 | sta_info->ampdu_max_len = 1 << (3 + sta->ht_cap.ampdu_factor); | ||
2358 | |||
2359 | return 0; | ||
2360 | } | ||
2361 | |||
2362 | static int ar9170_sta_remove(struct ieee80211_hw *hw, | ||
2363 | struct ieee80211_vif *vif, | ||
2364 | struct ieee80211_sta *sta) | ||
2365 | { | ||
2366 | struct ar9170_sta_info *sta_info = (void *) sta->drv_priv; | ||
2367 | unsigned int i; | ||
2368 | |||
2369 | if (!sta->ht_cap.ht_supported) | ||
2370 | return 0; | ||
2371 | |||
2372 | for (i = 0; i < AR9170_NUM_TID; i++) { | ||
2373 | sta_info->agg[i].state = AR9170_TID_STATE_INVALID; | ||
2374 | skb_queue_purge(&sta_info->agg[i].queue); | ||
2375 | } | ||
2376 | |||
2377 | return 0; | ||
2378 | } | ||
2379 | |||
2380 | static int ar9170_get_stats(struct ieee80211_hw *hw, | 1903 | static int ar9170_get_stats(struct ieee80211_hw *hw, |
2381 | struct ieee80211_low_level_stats *stats) | 1904 | struct ieee80211_low_level_stats *stats) |
2382 | { | 1905 | { |
@@ -2419,55 +1942,7 @@ static int ar9170_ampdu_action(struct ieee80211_hw *hw, | |||
2419 | enum ieee80211_ampdu_mlme_action action, | 1942 | enum ieee80211_ampdu_mlme_action action, |
2420 | struct ieee80211_sta *sta, u16 tid, u16 *ssn) | 1943 | struct ieee80211_sta *sta, u16 tid, u16 *ssn) |
2421 | { | 1944 | { |
2422 | struct ar9170 *ar = hw->priv; | ||
2423 | struct ar9170_sta_info *sta_info = (void *) sta->drv_priv; | ||
2424 | struct ar9170_sta_tid *tid_info = &sta_info->agg[tid]; | ||
2425 | unsigned long flags; | ||
2426 | |||
2427 | if (!modparam_ht) | ||
2428 | return -EOPNOTSUPP; | ||
2429 | |||
2430 | switch (action) { | 1945 | switch (action) { |
2431 | case IEEE80211_AMPDU_TX_START: | ||
2432 | spin_lock_irqsave(&ar->tx_ampdu_list_lock, flags); | ||
2433 | if (tid_info->state != AR9170_TID_STATE_SHUTDOWN || | ||
2434 | !list_empty(&tid_info->list)) { | ||
2435 | spin_unlock_irqrestore(&ar->tx_ampdu_list_lock, flags); | ||
2436 | #ifdef AR9170_TXAGG_DEBUG | ||
2437 | printk(KERN_INFO "%s: A-MPDU [ESS:[%pM] tid:[%d]] " | ||
2438 | "is in a very bad state!\n", | ||
2439 | wiphy_name(hw->wiphy), sta->addr, tid); | ||
2440 | #endif /* AR9170_TXAGG_DEBUG */ | ||
2441 | return -EBUSY; | ||
2442 | } | ||
2443 | |||
2444 | *ssn = tid_info->ssn; | ||
2445 | tid_info->state = AR9170_TID_STATE_PROGRESS; | ||
2446 | tid_info->active = false; | ||
2447 | spin_unlock_irqrestore(&ar->tx_ampdu_list_lock, flags); | ||
2448 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); | ||
2449 | break; | ||
2450 | |||
2451 | case IEEE80211_AMPDU_TX_STOP: | ||
2452 | spin_lock_irqsave(&ar->tx_ampdu_list_lock, flags); | ||
2453 | tid_info->state = AR9170_TID_STATE_SHUTDOWN; | ||
2454 | list_del_init(&tid_info->list); | ||
2455 | tid_info->active = false; | ||
2456 | skb_queue_purge(&tid_info->queue); | ||
2457 | spin_unlock_irqrestore(&ar->tx_ampdu_list_lock, flags); | ||
2458 | ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); | ||
2459 | break; | ||
2460 | |||
2461 | case IEEE80211_AMPDU_TX_OPERATIONAL: | ||
2462 | #ifdef AR9170_TXAGG_DEBUG | ||
2463 | printk(KERN_INFO "%s: A-MPDU for %pM [tid:%d] Operational.\n", | ||
2464 | wiphy_name(hw->wiphy), sta->addr, tid); | ||
2465 | #endif /* AR9170_TXAGG_DEBUG */ | ||
2466 | spin_lock_irqsave(&ar->tx_ampdu_list_lock, flags); | ||
2467 | sta_info->agg[tid].state = AR9170_TID_STATE_COMPLETE; | ||
2468 | spin_unlock_irqrestore(&ar->tx_ampdu_list_lock, flags); | ||
2469 | break; | ||
2470 | |||
2471 | case IEEE80211_AMPDU_RX_START: | 1946 | case IEEE80211_AMPDU_RX_START: |
2472 | case IEEE80211_AMPDU_RX_STOP: | 1947 | case IEEE80211_AMPDU_RX_STOP: |
2473 | /* Handled by firmware */ | 1948 | /* Handled by firmware */ |
@@ -2493,8 +1968,6 @@ static const struct ieee80211_ops ar9170_ops = { | |||
2493 | .bss_info_changed = ar9170_op_bss_info_changed, | 1968 | .bss_info_changed = ar9170_op_bss_info_changed, |
2494 | .get_tsf = ar9170_op_get_tsf, | 1969 | .get_tsf = ar9170_op_get_tsf, |
2495 | .set_key = ar9170_set_key, | 1970 | .set_key = ar9170_set_key, |
2496 | .sta_add = ar9170_sta_add, | ||
2497 | .sta_remove = ar9170_sta_remove, | ||
2498 | .get_stats = ar9170_get_stats, | 1971 | .get_stats = ar9170_get_stats, |
2499 | .ampdu_action = ar9170_ampdu_action, | 1972 | .ampdu_action = ar9170_ampdu_action, |
2500 | }; | 1973 | }; |
@@ -2527,8 +2000,6 @@ void *ar9170_alloc(size_t priv_size) | |||
2527 | mutex_init(&ar->mutex); | 2000 | mutex_init(&ar->mutex); |
2528 | spin_lock_init(&ar->cmdlock); | 2001 | spin_lock_init(&ar->cmdlock); |
2529 | spin_lock_init(&ar->tx_stats_lock); | 2002 | spin_lock_init(&ar->tx_stats_lock); |
2530 | spin_lock_init(&ar->tx_ampdu_list_lock); | ||
2531 | skb_queue_head_init(&ar->tx_status_ampdu); | ||
2532 | for (i = 0; i < __AR9170_NUM_TXQ; i++) { | 2003 | for (i = 0; i < __AR9170_NUM_TXQ; i++) { |
2533 | skb_queue_head_init(&ar->tx_status[i]); | 2004 | skb_queue_head_init(&ar->tx_status[i]); |
2534 | skb_queue_head_init(&ar->tx_pending[i]); | 2005 | skb_queue_head_init(&ar->tx_pending[i]); |
@@ -2536,7 +2007,6 @@ void *ar9170_alloc(size_t priv_size) | |||
2536 | ar9170_rx_reset_rx_mpdu(ar); | 2007 | ar9170_rx_reset_rx_mpdu(ar); |
2537 | INIT_WORK(&ar->beacon_work, ar9170_new_beacon); | 2008 | INIT_WORK(&ar->beacon_work, ar9170_new_beacon); |
2538 | INIT_DELAYED_WORK(&ar->tx_janitor, ar9170_tx_janitor); | 2009 | INIT_DELAYED_WORK(&ar->tx_janitor, ar9170_tx_janitor); |
2539 | INIT_LIST_HEAD(&ar->tx_ampdu_list); | ||
2540 | 2010 | ||
2541 | /* all hw supports 2.4 GHz, so set channel to 1 by default */ | 2011 | /* all hw supports 2.4 GHz, so set channel to 1 by default */ |
2542 | ar->channel = &ar9170_2ghz_chantable[0]; | 2012 | ar->channel = &ar9170_2ghz_chantable[0]; |
@@ -2549,16 +2019,8 @@ void *ar9170_alloc(size_t priv_size) | |||
2549 | IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | | 2019 | IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | |
2550 | IEEE80211_HW_SIGNAL_DBM; | 2020 | IEEE80211_HW_SIGNAL_DBM; |
2551 | 2021 | ||
2552 | if (modparam_ht) { | ||
2553 | ar->hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION; | ||
2554 | } else { | ||
2555 | ar9170_band_2GHz.ht_cap.ht_supported = false; | ||
2556 | ar9170_band_5GHz.ht_cap.ht_supported = false; | ||
2557 | } | ||
2558 | |||
2559 | ar->hw->queues = __AR9170_NUM_TXQ; | 2022 | ar->hw->queues = __AR9170_NUM_TXQ; |
2560 | ar->hw->extra_tx_headroom = 8; | 2023 | ar->hw->extra_tx_headroom = 8; |
2561 | ar->hw->sta_data_size = sizeof(struct ar9170_sta_info); | ||
2562 | 2024 | ||
2563 | ar->hw->max_rates = 1; | 2025 | ar->hw->max_rates = 1; |
2564 | ar->hw->max_rate_tries = 3; | 2026 | ar->hw->max_rate_tries = 3; |
diff --git a/drivers/net/wireless/ath/ath5k/ani.c b/drivers/net/wireless/ath/ath5k/ani.c index 584a32859bdb..f2311ab35504 100644 --- a/drivers/net/wireless/ath/ath5k/ani.c +++ b/drivers/net/wireless/ath/ath5k/ani.c | |||
@@ -73,7 +73,7 @@ ath5k_ani_set_noise_immunity_level(struct ath5k_hw *ah, int level) | |||
73 | const s8 hi[] = { -14, -12 }; | 73 | const s8 hi[] = { -14, -12 }; |
74 | const s8 fr[] = { -78, -80 }; | 74 | const s8 fr[] = { -78, -80 }; |
75 | #endif | 75 | #endif |
76 | if (level < 0 || level > ARRAY_SIZE(sz)) { | 76 | if (level < 0 || level >= ARRAY_SIZE(sz)) { |
77 | ATH5K_DBG_UNLIMIT(ah->ah_sc, ATH5K_DEBUG_ANI, | 77 | ATH5K_DBG_UNLIMIT(ah->ah_sc, ATH5K_DEBUG_ANI, |
78 | "level out of range %d", level); | 78 | "level out of range %d", level); |
79 | return; | 79 | return; |
@@ -104,7 +104,7 @@ ath5k_ani_set_spur_immunity_level(struct ath5k_hw *ah, int level) | |||
104 | { | 104 | { |
105 | const int val[] = { 2, 4, 6, 8, 10, 12, 14, 16 }; | 105 | const int val[] = { 2, 4, 6, 8, 10, 12, 14, 16 }; |
106 | 106 | ||
107 | if (level < 0 || level > ARRAY_SIZE(val) || | 107 | if (level < 0 || level >= ARRAY_SIZE(val) || |
108 | level > ah->ah_sc->ani_state.max_spur_level) { | 108 | level > ah->ah_sc->ani_state.max_spur_level) { |
109 | ATH5K_DBG_UNLIMIT(ah->ah_sc, ATH5K_DEBUG_ANI, | 109 | ATH5K_DBG_UNLIMIT(ah->ah_sc, ATH5K_DEBUG_ANI, |
110 | "level out of range %d", level); | 110 | "level out of range %d", level); |
@@ -129,7 +129,7 @@ ath5k_ani_set_firstep_level(struct ath5k_hw *ah, int level) | |||
129 | { | 129 | { |
130 | const int val[] = { 0, 4, 8 }; | 130 | const int val[] = { 0, 4, 8 }; |
131 | 131 | ||
132 | if (level < 0 || level > ARRAY_SIZE(val)) { | 132 | if (level < 0 || level >= ARRAY_SIZE(val)) { |
133 | ATH5K_DBG_UNLIMIT(ah->ah_sc, ATH5K_DEBUG_ANI, | 133 | ATH5K_DBG_UNLIMIT(ah->ah_sc, ATH5K_DEBUG_ANI, |
134 | "level out of range %d", level); | 134 | "level out of range %d", level); |
135 | return; | 135 | return; |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_initvals.h b/drivers/net/wireless/ath/ath9k/ar9003_initvals.h index a131cd10ef29..ef6116e13033 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9003_initvals.h | |||
@@ -541,7 +541,7 @@ static const u32 ar9300_2p0_mac_postamble[][5] = { | |||
541 | 541 | ||
542 | static const u32 ar9300_2p0_soc_postamble[][5] = { | 542 | static const u32 ar9300_2p0_soc_postamble[][5] = { |
543 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 543 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
544 | {0x00007010, 0x00000023, 0x00000023, 0x00000022, 0x00000022}, | 544 | {0x00007010, 0x00000023, 0x00000023, 0x00000023, 0x00000023}, |
545 | }; | 545 | }; |
546 | 546 | ||
547 | static const u32 ar9200_merlin_2p0_radio_core[][2] = { | 547 | static const u32 ar9200_merlin_2p0_radio_core[][2] = { |
@@ -588,12 +588,12 @@ static const u32 ar9200_merlin_2p0_radio_core[][2] = { | |||
588 | 588 | ||
589 | static const u32 ar9300_2p0_baseband_postamble[][5] = { | 589 | static const u32 ar9300_2p0_baseband_postamble[][5] = { |
590 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 590 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
591 | {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8005, 0xd00a8005}, | 591 | {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8005, 0xd00a800b}, |
592 | {0x00009820, 0x206a022e, 0x206a022e, 0x206a012e, 0x206a012e}, | 592 | {0x00009820, 0x206a022e, 0x206a022e, 0x206a012e, 0x206a012e}, |
593 | {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0}, | 593 | {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0}, |
594 | {0x00009828, 0x06903081, 0x06903081, 0x06903881, 0x06903881}, | 594 | {0x00009828, 0x06903081, 0x06903081, 0x06903881, 0x06903881}, |
595 | {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, | 595 | {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, |
596 | {0x00009830, 0x0000059c, 0x0000059c, 0x0000059c, 0x0000059c}, | 596 | {0x00009830, 0x0000059c, 0x0000059c, 0x0000059c, 0x00000b9c}, |
597 | {0x00009c00, 0x00000044, 0x000000c4, 0x000000c4, 0x00000044}, | 597 | {0x00009c00, 0x00000044, 0x000000c4, 0x000000c4, 0x00000044}, |
598 | {0x00009e00, 0x0372161e, 0x0372161e, 0x037216a0, 0x037216a0}, | 598 | {0x00009e00, 0x0372161e, 0x0372161e, 0x037216a0, 0x037216a0}, |
599 | {0x00009e04, 0x00802020, 0x00802020, 0x00802020, 0x00802020}, | 599 | {0x00009e04, 0x00802020, 0x00802020, 0x00802020, 0x00802020}, |
@@ -744,7 +744,7 @@ static const u32 ar9300_2p0_baseband_core[][2] = { | |||
744 | {0x0000a408, 0x0e79e5c6}, | 744 | {0x0000a408, 0x0e79e5c6}, |
745 | {0x0000a40c, 0x00820820}, | 745 | {0x0000a40c, 0x00820820}, |
746 | {0x0000a414, 0x1ce739ce}, | 746 | {0x0000a414, 0x1ce739ce}, |
747 | {0x0000a418, 0x7d001dce}, | 747 | {0x0000a418, 0x2d001dce}, |
748 | {0x0000a41c, 0x1ce739ce}, | 748 | {0x0000a41c, 0x1ce739ce}, |
749 | {0x0000a420, 0x000001ce}, | 749 | {0x0000a420, 0x000001ce}, |
750 | {0x0000a424, 0x1ce739ce}, | 750 | {0x0000a424, 0x1ce739ce}, |
@@ -756,7 +756,7 @@ static const u32 ar9300_2p0_baseband_core[][2] = { | |||
756 | {0x0000a43c, 0x00000000}, | 756 | {0x0000a43c, 0x00000000}, |
757 | {0x0000a440, 0x00000000}, | 757 | {0x0000a440, 0x00000000}, |
758 | {0x0000a444, 0x00000000}, | 758 | {0x0000a444, 0x00000000}, |
759 | {0x0000a448, 0x07000080}, | 759 | {0x0000a448, 0x04000080}, |
760 | {0x0000a44c, 0x00000001}, | 760 | {0x0000a44c, 0x00000001}, |
761 | {0x0000a450, 0x00010000}, | 761 | {0x0000a450, 0x00010000}, |
762 | {0x0000a458, 0x00000000}, | 762 | {0x0000a458, 0x00000000}, |
@@ -777,7 +777,7 @@ static const u32 ar9300_2p0_baseband_core[][2] = { | |||
777 | {0x0000a638, 0x00000000}, | 777 | {0x0000a638, 0x00000000}, |
778 | {0x0000a63c, 0x00000000}, | 778 | {0x0000a63c, 0x00000000}, |
779 | {0x0000a640, 0x00000000}, | 779 | {0x0000a640, 0x00000000}, |
780 | {0x0000a644, 0x3ffd9d74}, | 780 | {0x0000a644, 0x3fad9d74}, |
781 | {0x0000a648, 0x0048060a}, | 781 | {0x0000a648, 0x0048060a}, |
782 | {0x0000a64c, 0x00000637}, | 782 | {0x0000a64c, 0x00000637}, |
783 | {0x0000a670, 0x03020100}, | 783 | {0x0000a670, 0x03020100}, |
@@ -835,9 +835,9 @@ static const u32 ar9300_2p0_baseband_core[][2] = { | |||
835 | 835 | ||
836 | static const u32 ar9300Modes_high_power_tx_gain_table_2p0[][5] = { | 836 | static const u32 ar9300Modes_high_power_tx_gain_table_2p0[][5] = { |
837 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 837 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
838 | {0x0000a410, 0x000050db, 0x000050db, 0x000050d9, 0x000050d9}, | 838 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, |
839 | {0x0000a500, 0x00020220, 0x00020220, 0x00000000, 0x00000000}, | 839 | {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, |
840 | {0x0000a504, 0x06020223, 0x06020223, 0x04000002, 0x04000002}, | 840 | {0x0000a504, 0x06002223, 0x06002223, 0x04000002, 0x04000002}, |
841 | {0x0000a508, 0x0a022220, 0x0a022220, 0x08000004, 0x08000004}, | 841 | {0x0000a508, 0x0a022220, 0x0a022220, 0x08000004, 0x08000004}, |
842 | {0x0000a50c, 0x0f022223, 0x0f022223, 0x0b000200, 0x0b000200}, | 842 | {0x0000a50c, 0x0f022223, 0x0f022223, 0x0b000200, 0x0b000200}, |
843 | {0x0000a510, 0x14022620, 0x14022620, 0x0f000202, 0x0f000202}, | 843 | {0x0000a510, 0x14022620, 0x14022620, 0x0f000202, 0x0f000202}, |
@@ -848,28 +848,28 @@ static const u32 ar9300Modes_high_power_tx_gain_table_2p0[][5] = { | |||
848 | {0x0000a524, 0x28023042, 0x28023042, 0x1f000a02, 0x1f000a02}, | 848 | {0x0000a524, 0x28023042, 0x28023042, 0x1f000a02, 0x1f000a02}, |
849 | {0x0000a528, 0x2c023044, 0x2c023044, 0x23000a04, 0x23000a04}, | 849 | {0x0000a528, 0x2c023044, 0x2c023044, 0x23000a04, 0x23000a04}, |
850 | {0x0000a52c, 0x2f023644, 0x2f023644, 0x26000a20, 0x26000a20}, | 850 | {0x0000a52c, 0x2f023644, 0x2f023644, 0x26000a20, 0x26000a20}, |
851 | {0x0000a530, 0x34043643, 0x34043643, 0x2a000e20, 0x2a000e20}, | 851 | {0x0000a530, 0x34025643, 0x34025643, 0x2a000e20, 0x2a000e20}, |
852 | {0x0000a534, 0x38043a44, 0x38043a44, 0x2e000e22, 0x2e000e22}, | 852 | {0x0000a534, 0x38025a44, 0x38025a44, 0x2e000e22, 0x2e000e22}, |
853 | {0x0000a538, 0x3b043e45, 0x3b043e45, 0x31000e24, 0x31000e24}, | 853 | {0x0000a538, 0x3b025e45, 0x3b025e45, 0x31000e24, 0x31000e24}, |
854 | {0x0000a53c, 0x40063e46, 0x40063e46, 0x34001640, 0x34001640}, | 854 | {0x0000a53c, 0x41025e4a, 0x41025e4a, 0x34001640, 0x34001640}, |
855 | {0x0000a540, 0x44083e46, 0x44083e46, 0x38001660, 0x38001660}, | 855 | {0x0000a540, 0x48025e6c, 0x48025e6c, 0x38001660, 0x38001660}, |
856 | {0x0000a544, 0x46083e66, 0x46083e66, 0x3b001861, 0x3b001861}, | 856 | {0x0000a544, 0x4e025e8e, 0x4e025e8e, 0x3b001861, 0x3b001861}, |
857 | {0x0000a548, 0x4b0a3e69, 0x4b0a3e69, 0x3e001a81, 0x3e001a81}, | 857 | {0x0000a548, 0x53025eb2, 0x53025eb2, 0x3e001a81, 0x3e001a81}, |
858 | {0x0000a54c, 0x4f0a5e66, 0x4f0a5e66, 0x42001a83, 0x42001a83}, | 858 | {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42001a83, 0x42001a83}, |
859 | {0x0000a550, 0x540a7e66, 0x540a7e66, 0x44001c84, 0x44001c84}, | 859 | {0x0000a550, 0x5f025ef6, 0x5f025ef6, 0x44001c84, 0x44001c84}, |
860 | {0x0000a554, 0x570a7e89, 0x570a7e89, 0x48001ce3, 0x48001ce3}, | 860 | {0x0000a554, 0x62025f56, 0x62025f56, 0x48001ce3, 0x48001ce3}, |
861 | {0x0000a558, 0x5c0e7e8a, 0x5c0e7e8a, 0x4c001ce5, 0x4c001ce5}, | 861 | {0x0000a558, 0x66027f56, 0x66027f56, 0x4c001ce5, 0x4c001ce5}, |
862 | {0x0000a55c, 0x60127e8b, 0x60127e8b, 0x50001ce9, 0x50001ce9}, | 862 | {0x0000a55c, 0x6a029f56, 0x6a029f56, 0x50001ce9, 0x50001ce9}, |
863 | {0x0000a560, 0x65127ecc, 0x65127ecc, 0x54001ceb, 0x54001ceb}, | 863 | {0x0000a560, 0x70049f56, 0x70049f56, 0x54001ceb, 0x54001ceb}, |
864 | {0x0000a564, 0x6b169ecd, 0x6b169ecd, 0x56001eec, 0x56001eec}, | 864 | {0x0000a564, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec}, |
865 | {0x0000a568, 0x70169f0e, 0x70169f0e, 0x56001eec, 0x56001eec}, | 865 | {0x0000a568, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec}, |
866 | {0x0000a56c, 0x75169f4f, 0x75169f4f, 0x56001eec, 0x56001eec}, | 866 | {0x0000a56c, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec}, |
867 | {0x0000a570, 0x75169f4f, 0x75169f4f, 0x56001eec, 0x56001eec}, | 867 | {0x0000a570, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec}, |
868 | {0x0000a574, 0x75169f4f, 0x75169f4f, 0x56001eec, 0x56001eec}, | 868 | {0x0000a574, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec}, |
869 | {0x0000a578, 0x75169f4f, 0x75169f4f, 0x56001eec, 0x56001eec}, | 869 | {0x0000a578, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec}, |
870 | {0x0000a57c, 0x75169f4f, 0x75169f4f, 0x56001eec, 0x56001eec}, | 870 | {0x0000a57c, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec}, |
871 | {0x0000a580, 0x00820220, 0x00820220, 0x00800000, 0x00800000}, | 871 | {0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000}, |
872 | {0x0000a584, 0x06820223, 0x06820223, 0x04800002, 0x04800002}, | 872 | {0x0000a584, 0x06802223, 0x06802223, 0x04800002, 0x04800002}, |
873 | {0x0000a588, 0x0a822220, 0x0a822220, 0x08800004, 0x08800004}, | 873 | {0x0000a588, 0x0a822220, 0x0a822220, 0x08800004, 0x08800004}, |
874 | {0x0000a58c, 0x0f822223, 0x0f822223, 0x0b800200, 0x0b800200}, | 874 | {0x0000a58c, 0x0f822223, 0x0f822223, 0x0b800200, 0x0b800200}, |
875 | {0x0000a590, 0x14822620, 0x14822620, 0x0f800202, 0x0f800202}, | 875 | {0x0000a590, 0x14822620, 0x14822620, 0x0f800202, 0x0f800202}, |
@@ -880,42 +880,42 @@ static const u32 ar9300Modes_high_power_tx_gain_table_2p0[][5] = { | |||
880 | {0x0000a5a4, 0x28823042, 0x28823042, 0x1f800a02, 0x1f800a02}, | 880 | {0x0000a5a4, 0x28823042, 0x28823042, 0x1f800a02, 0x1f800a02}, |
881 | {0x0000a5a8, 0x2c823044, 0x2c823044, 0x23800a04, 0x23800a04}, | 881 | {0x0000a5a8, 0x2c823044, 0x2c823044, 0x23800a04, 0x23800a04}, |
882 | {0x0000a5ac, 0x2f823644, 0x2f823644, 0x26800a20, 0x26800a20}, | 882 | {0x0000a5ac, 0x2f823644, 0x2f823644, 0x26800a20, 0x26800a20}, |
883 | {0x0000a5b0, 0x34843643, 0x34843643, 0x2a800e20, 0x2a800e20}, | 883 | {0x0000a5b0, 0x34825643, 0x34825643, 0x2a800e20, 0x2a800e20}, |
884 | {0x0000a5b4, 0x38843a44, 0x38843a44, 0x2e800e22, 0x2e800e22}, | 884 | {0x0000a5b4, 0x38825a44, 0x38825a44, 0x2e800e22, 0x2e800e22}, |
885 | {0x0000a5b8, 0x3b843e45, 0x3b843e45, 0x31800e24, 0x31800e24}, | 885 | {0x0000a5b8, 0x3b825e45, 0x3b825e45, 0x31800e24, 0x31800e24}, |
886 | {0x0000a5bc, 0x40863e46, 0x40863e46, 0x34801640, 0x34801640}, | 886 | {0x0000a5bc, 0x41825e4a, 0x41825e4a, 0x34801640, 0x34801640}, |
887 | {0x0000a5c0, 0x4c8a3065, 0x44883e46, 0x44883e46, 0x38801660}, | 887 | {0x0000a5c0, 0x48825e6c, 0x48825e6c, 0x38801660, 0x38801660}, |
888 | {0x0000a5c4, 0x46883e66, 0x46883e66, 0x3b801861, 0x3b801861}, | 888 | {0x0000a5c4, 0x4e825e8e, 0x4e825e8e, 0x3b801861, 0x3b801861}, |
889 | {0x0000a5c8, 0x4b8a3e69, 0x4b8a3e69, 0x3e801a81, 0x3e801a81}, | 889 | {0x0000a5c8, 0x53825eb2, 0x53825eb2, 0x3e801a81, 0x3e801a81}, |
890 | {0x0000a5cc, 0x4f8a5e66, 0x4f8a5e66, 0x42801a83, 0x42801a83}, | 890 | {0x0000a5cc, 0x59825eb5, 0x59825eb5, 0x42801a83, 0x42801a83}, |
891 | {0x0000a5d0, 0x548a7e66, 0x548a7e66, 0x44801c84, 0x44801c84}, | 891 | {0x0000a5d0, 0x5f825ef6, 0x5f825ef6, 0x44801c84, 0x44801c84}, |
892 | {0x0000a5d4, 0x578a7e89, 0x578a7e89, 0x48801ce3, 0x48801ce3}, | 892 | {0x0000a5d4, 0x62825f56, 0x62825f56, 0x48801ce3, 0x48801ce3}, |
893 | {0x0000a5d8, 0x5c8e7e8a, 0x5c8e7e8a, 0x4c801ce5, 0x4c801ce5}, | 893 | {0x0000a5d8, 0x66827f56, 0x66827f56, 0x4c801ce5, 0x4c801ce5}, |
894 | {0x0000a5dc, 0x60927e8b, 0x60927e8b, 0x50801ce9, 0x50801ce9}, | 894 | {0x0000a5dc, 0x6a829f56, 0x6a829f56, 0x50801ce9, 0x50801ce9}, |
895 | {0x0000a5e0, 0x65927ecc, 0x65927ecc, 0x54801ceb, 0x54801ceb}, | 895 | {0x0000a5e0, 0x70849f56, 0x70849f56, 0x54801ceb, 0x54801ceb}, |
896 | {0x0000a5e4, 0x6b969ecd, 0x6b969ecd, 0x56801eec, 0x56801eec}, | 896 | {0x0000a5e4, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec}, |
897 | {0x0000a5e8, 0x70969f0e, 0x70969f0e, 0x56801eec, 0x56801eec}, | 897 | {0x0000a5e8, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec}, |
898 | {0x0000a5ec, 0x75969f4f, 0x75969f4f, 0x56801eec, 0x56801eec}, | 898 | {0x0000a5ec, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec}, |
899 | {0x0000a5f0, 0x75969f4f, 0x75969f4f, 0x56801eec, 0x56801eec}, | 899 | {0x0000a5f0, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec}, |
900 | {0x0000a5f4, 0x75969f4f, 0x75969f4f, 0x56801eec, 0x56801eec}, | 900 | {0x0000a5f4, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec}, |
901 | {0x0000a5f8, 0x75969f4f, 0x75969f4f, 0x56801eec, 0x56801eec}, | 901 | {0x0000a5f8, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec}, |
902 | {0x0000a5fc, 0x75969f4f, 0x75969f4f, 0x56801eec, 0x56801eec}, | 902 | {0x0000a5fc, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec}, |
903 | {0x00016044, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6}, | 903 | {0x00016044, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6}, |
904 | {0x00016048, 0xad241a61, 0xad241a61, 0xad241a61, 0xad241a61}, | 904 | {0x00016048, 0xae481a61, 0xae481a61, 0xae481a61, 0xae481a61}, |
905 | {0x00016068, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c}, | 905 | {0x00016068, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c}, |
906 | {0x00016444, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6}, | 906 | {0x00016444, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6}, |
907 | {0x00016448, 0xad241a61, 0xad241a61, 0xad241a61, 0xad241a61}, | 907 | {0x00016448, 0xae481a61, 0xae481a61, 0xae481a61, 0xae481a61}, |
908 | {0x00016468, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c}, | 908 | {0x00016468, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c}, |
909 | {0x00016844, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6}, | 909 | {0x00016844, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6}, |
910 | {0x00016848, 0xad241a61, 0xad241a61, 0xad241a61, 0xad241a61}, | 910 | {0x00016848, 0xae481a61, 0xae481a61, 0xae481a61, 0xae481a61}, |
911 | {0x00016868, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c}, | 911 | {0x00016868, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c}, |
912 | }; | 912 | }; |
913 | 913 | ||
914 | static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p0[][5] = { | 914 | static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p0[][5] = { |
915 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 915 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
916 | {0x0000a410, 0x000050db, 0x000050db, 0x000050d9, 0x000050d9}, | 916 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, |
917 | {0x0000a500, 0x00020220, 0x00020220, 0x00000000, 0x00000000}, | 917 | {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, |
918 | {0x0000a504, 0x06020223, 0x06020223, 0x04000002, 0x04000002}, | 918 | {0x0000a504, 0x06002223, 0x06002223, 0x04000002, 0x04000002}, |
919 | {0x0000a508, 0x0a022220, 0x0a022220, 0x08000004, 0x08000004}, | 919 | {0x0000a508, 0x0a022220, 0x0a022220, 0x08000004, 0x08000004}, |
920 | {0x0000a50c, 0x0f022223, 0x0f022223, 0x0b000200, 0x0b000200}, | 920 | {0x0000a50c, 0x0f022223, 0x0f022223, 0x0b000200, 0x0b000200}, |
921 | {0x0000a510, 0x14022620, 0x14022620, 0x0f000202, 0x0f000202}, | 921 | {0x0000a510, 0x14022620, 0x14022620, 0x0f000202, 0x0f000202}, |
@@ -926,28 +926,28 @@ static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p0[][5] = { | |||
926 | {0x0000a524, 0x28023042, 0x28023042, 0x1f000a02, 0x1f000a02}, | 926 | {0x0000a524, 0x28023042, 0x28023042, 0x1f000a02, 0x1f000a02}, |
927 | {0x0000a528, 0x2c023044, 0x2c023044, 0x23000a04, 0x23000a04}, | 927 | {0x0000a528, 0x2c023044, 0x2c023044, 0x23000a04, 0x23000a04}, |
928 | {0x0000a52c, 0x2f023644, 0x2f023644, 0x26000a20, 0x26000a20}, | 928 | {0x0000a52c, 0x2f023644, 0x2f023644, 0x26000a20, 0x26000a20}, |
929 | {0x0000a530, 0x34043643, 0x34043643, 0x2a000e20, 0x2a000e20}, | 929 | {0x0000a530, 0x34025643, 0x34025643, 0x2a000e20, 0x2a000e20}, |
930 | {0x0000a534, 0x38043a44, 0x38043a44, 0x2e000e22, 0x2e000e22}, | 930 | {0x0000a534, 0x38025a44, 0x38025a44, 0x2e000e22, 0x2e000e22}, |
931 | {0x0000a538, 0x3b043e45, 0x3b043e45, 0x31000e24, 0x31000e24}, | 931 | {0x0000a538, 0x3b025e45, 0x3b025e45, 0x31000e24, 0x31000e24}, |
932 | {0x0000a53c, 0x40063e46, 0x40063e46, 0x34001640, 0x34001640}, | 932 | {0x0000a53c, 0x41025e4a, 0x41025e4a, 0x34001640, 0x34001640}, |
933 | {0x0000a540, 0x44083e46, 0x44083e46, 0x38001660, 0x38001660}, | 933 | {0x0000a540, 0x48025e6c, 0x48025e6c, 0x38001660, 0x38001660}, |
934 | {0x0000a544, 0x46083e66, 0x46083e66, 0x3b001861, 0x3b001861}, | 934 | {0x0000a544, 0x4e025e8e, 0x4e025e8e, 0x3b001861, 0x3b001861}, |
935 | {0x0000a548, 0x4b0a3e69, 0x4b0a3e69, 0x3e001a81, 0x3e001a81}, | 935 | {0x0000a548, 0x53025eb2, 0x53025eb2, 0x3e001a81, 0x3e001a81}, |
936 | {0x0000a54c, 0x4f0a5e66, 0x4f0a5e66, 0x42001a83, 0x42001a83}, | 936 | {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42001a83, 0x42001a83}, |
937 | {0x0000a550, 0x540a7e66, 0x540a7e66, 0x44001c84, 0x44001c84}, | 937 | {0x0000a550, 0x5f025ef6, 0x5f025ef6, 0x44001c84, 0x44001c84}, |
938 | {0x0000a554, 0x570a7e89, 0x570a7e89, 0x48001ce3, 0x48001ce3}, | 938 | {0x0000a554, 0x62025f56, 0x62025f56, 0x48001ce3, 0x48001ce3}, |
939 | {0x0000a558, 0x5c0e7e8a, 0x5c0e7e8a, 0x4c001ce5, 0x4c001ce5}, | 939 | {0x0000a558, 0x66027f56, 0x66027f56, 0x4c001ce5, 0x4c001ce5}, |
940 | {0x0000a55c, 0x60127e8b, 0x60127e8b, 0x50001ce9, 0x50001ce9}, | 940 | {0x0000a55c, 0x6a029f56, 0x6a029f56, 0x50001ce9, 0x50001ce9}, |
941 | {0x0000a560, 0x65127ecc, 0x65127ecc, 0x54001ceb, 0x54001ceb}, | 941 | {0x0000a560, 0x70049f56, 0x70049f56, 0x54001ceb, 0x54001ceb}, |
942 | {0x0000a564, 0x6b169ecd, 0x6b169ecd, 0x56001eec, 0x56001eec}, | 942 | {0x0000a564, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec}, |
943 | {0x0000a568, 0x70169f0e, 0x70169f0e, 0x56001eec, 0x56001eec}, | 943 | {0x0000a568, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec}, |
944 | {0x0000a56c, 0x75169f4f, 0x75169f4f, 0x56001eec, 0x56001eec}, | 944 | {0x0000a56c, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec}, |
945 | {0x0000a570, 0x75169f4f, 0x75169f4f, 0x56001eec, 0x56001eec}, | 945 | {0x0000a570, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec}, |
946 | {0x0000a574, 0x75169f4f, 0x75169f4f, 0x56001eec, 0x56001eec}, | 946 | {0x0000a574, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec}, |
947 | {0x0000a578, 0x75169f4f, 0x75169f4f, 0x56001eec, 0x56001eec}, | 947 | {0x0000a578, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec}, |
948 | {0x0000a57c, 0x75169f4f, 0x75169f4f, 0x56001eec, 0x56001eec}, | 948 | {0x0000a57c, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec}, |
949 | {0x0000a580, 0x00820220, 0x00820220, 0x00800000, 0x00800000}, | 949 | {0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000}, |
950 | {0x0000a584, 0x06820223, 0x06820223, 0x04800002, 0x04800002}, | 950 | {0x0000a584, 0x06802223, 0x06802223, 0x04800002, 0x04800002}, |
951 | {0x0000a588, 0x0a822220, 0x0a822220, 0x08800004, 0x08800004}, | 951 | {0x0000a588, 0x0a822220, 0x0a822220, 0x08800004, 0x08800004}, |
952 | {0x0000a58c, 0x0f822223, 0x0f822223, 0x0b800200, 0x0b800200}, | 952 | {0x0000a58c, 0x0f822223, 0x0f822223, 0x0b800200, 0x0b800200}, |
953 | {0x0000a590, 0x14822620, 0x14822620, 0x0f800202, 0x0f800202}, | 953 | {0x0000a590, 0x14822620, 0x14822620, 0x0f800202, 0x0f800202}, |
@@ -958,34 +958,34 @@ static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p0[][5] = { | |||
958 | {0x0000a5a4, 0x28823042, 0x28823042, 0x1f800a02, 0x1f800a02}, | 958 | {0x0000a5a4, 0x28823042, 0x28823042, 0x1f800a02, 0x1f800a02}, |
959 | {0x0000a5a8, 0x2c823044, 0x2c823044, 0x23800a04, 0x23800a04}, | 959 | {0x0000a5a8, 0x2c823044, 0x2c823044, 0x23800a04, 0x23800a04}, |
960 | {0x0000a5ac, 0x2f823644, 0x2f823644, 0x26800a20, 0x26800a20}, | 960 | {0x0000a5ac, 0x2f823644, 0x2f823644, 0x26800a20, 0x26800a20}, |
961 | {0x0000a5b0, 0x34843643, 0x34843643, 0x2a800e20, 0x2a800e20}, | 961 | {0x0000a5b0, 0x34825643, 0x34825643, 0x2a800e20, 0x2a800e20}, |
962 | {0x0000a5b4, 0x38843a44, 0x38843a44, 0x2e800e22, 0x2e800e22}, | 962 | {0x0000a5b4, 0x38825a44, 0x38825a44, 0x2e800e22, 0x2e800e22}, |
963 | {0x0000a5b8, 0x3b843e45, 0x3b843e45, 0x31800e24, 0x31800e24}, | 963 | {0x0000a5b8, 0x3b825e45, 0x3b825e45, 0x31800e24, 0x31800e24}, |
964 | {0x0000a5bc, 0x40863e46, 0x40863e46, 0x34801640, 0x34801640}, | 964 | {0x0000a5bc, 0x41825e4a, 0x41825e4a, 0x34801640, 0x34801640}, |
965 | {0x0000a5c0, 0x44883e46, 0x44883e46, 0x38801660, 0x38801660}, | 965 | {0x0000a5c0, 0x48825e6c, 0x48825e6c, 0x38801660, 0x38801660}, |
966 | {0x0000a5c4, 0x46883e66, 0x46883e66, 0x3b801861, 0x3b801861}, | 966 | {0x0000a5c4, 0x4e825e8e, 0x4e825e8e, 0x3b801861, 0x3b801861}, |
967 | {0x0000a5c8, 0x4b8a3e69, 0x4b8a3e69, 0x3e801a81, 0x3e801a81}, | 967 | {0x0000a5c8, 0x53825eb2, 0x53825eb2, 0x3e801a81, 0x3e801a81}, |
968 | {0x0000a5cc, 0x4f8a5e66, 0x4f8a5e66, 0x42801a83, 0x42801a83}, | 968 | {0x0000a5cc, 0x59825eb5, 0x59825eb5, 0x42801a83, 0x42801a83}, |
969 | {0x0000a5d0, 0x548a7e66, 0x548a7e66, 0x44801c84, 0x44801c84}, | 969 | {0x0000a5d0, 0x5f825ef6, 0x5f825ef6, 0x44801c84, 0x44801c84}, |
970 | {0x0000a5d4, 0x578a7e89, 0x578a7e89, 0x48801ce3, 0x48801ce3}, | 970 | {0x0000a5d4, 0x62825f56, 0x62825f56, 0x48801ce3, 0x48801ce3}, |
971 | {0x0000a5d8, 0x5c8e7e8a, 0x5c8e7e8a, 0x4c801ce5, 0x4c801ce5}, | 971 | {0x0000a5d8, 0x66827f56, 0x66827f56, 0x4c801ce5, 0x4c801ce5}, |
972 | {0x0000a5dc, 0x60927e8b, 0x60927e8b, 0x50801ce9, 0x50801ce9}, | 972 | {0x0000a5dc, 0x6a829f56, 0x6a829f56, 0x50801ce9, 0x50801ce9}, |
973 | {0x0000a5e0, 0x65927ecc, 0x65927ecc, 0x54801ceb, 0x54801ceb}, | 973 | {0x0000a5e0, 0x70849f56, 0x70849f56, 0x54801ceb, 0x54801ceb}, |
974 | {0x0000a5e4, 0x6b969ecd, 0x6b969ecd, 0x56801eec, 0x56801eec}, | 974 | {0x0000a5e4, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec}, |
975 | {0x0000a5e8, 0x70969f0e, 0x70969f0e, 0x56801eec, 0x56801eec}, | 975 | {0x0000a5e8, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec}, |
976 | {0x0000a5ec, 0x75969f4f, 0x75969f4f, 0x56801eec, 0x56801eec}, | 976 | {0x0000a5ec, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec}, |
977 | {0x0000a5f0, 0x75969f4f, 0x75969f4f, 0x56801eec, 0x56801eec}, | 977 | {0x0000a5f0, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec}, |
978 | {0x0000a5f4, 0x75969f4f, 0x75969f4f, 0x56801eec, 0x56801eec}, | 978 | {0x0000a5f4, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec}, |
979 | {0x0000a5f8, 0x75969f4f, 0x75969f4f, 0x56801eec, 0x56801eec}, | 979 | {0x0000a5f8, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec}, |
980 | {0x0000a5fc, 0x75969f4f, 0x75969f4f, 0x56801eec, 0x56801eec}, | 980 | {0x0000a5fc, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec}, |
981 | {0x00016044, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, | 981 | {0x00016044, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, |
982 | {0x00016048, 0x8c001a61, 0x8c001a61, 0x8c001a61, 0x8c001a61}, | 982 | {0x00016048, 0x8e481a61, 0x8e481a61, 0x8e481a61, 0x8e481a61}, |
983 | {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | 983 | {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
984 | {0x00016444, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, | 984 | {0x00016444, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, |
985 | {0x00016448, 0x8c001a61, 0x8c001a61, 0x8c001a61, 0x8c001a61}, | 985 | {0x00016448, 0x8e481a61, 0x8e481a61, 0x8e481a61, 0x8e481a61}, |
986 | {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | 986 | {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
987 | {0x00016844, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, | 987 | {0x00016844, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, |
988 | {0x00016848, 0x8c001a61, 0x8c001a61, 0x8c001a61, 0x8c001a61}, | 988 | {0x00016848, 0x8e481a61, 0x8e481a61, 0x8e481a61, 0x8e481a61}, |
989 | {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | 989 | {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
990 | }; | 990 | }; |
991 | 991 | ||
diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c index b4424a623cf5..7707341cd0d3 100644 --- a/drivers/net/wireless/ath/ath9k/common.c +++ b/drivers/net/wireless/ath/ath9k/common.c | |||
@@ -57,13 +57,19 @@ static bool ath9k_rx_accept(struct ath_common *common, | |||
57 | * rs_more indicates chained descriptors which can be used | 57 | * rs_more indicates chained descriptors which can be used |
58 | * to link buffers together for a sort of scatter-gather | 58 | * to link buffers together for a sort of scatter-gather |
59 | * operation. | 59 | * operation. |
60 | * | 60 | * reject the frame, we don't support scatter-gather yet and |
61 | * the frame is probably corrupt anyway | ||
62 | */ | ||
63 | if (rx_stats->rs_more) | ||
64 | return false; | ||
65 | |||
66 | /* | ||
61 | * The rx_stats->rs_status will not be set until the end of the | 67 | * The rx_stats->rs_status will not be set until the end of the |
62 | * chained descriptors so it can be ignored if rs_more is set. The | 68 | * chained descriptors so it can be ignored if rs_more is set. The |
63 | * rs_more will be false at the last element of the chained | 69 | * rs_more will be false at the last element of the chained |
64 | * descriptors. | 70 | * descriptors. |
65 | */ | 71 | */ |
66 | if (!rx_stats->rs_more && rx_stats->rs_status != 0) { | 72 | if (rx_stats->rs_status != 0) { |
67 | if (rx_stats->rs_status & ATH9K_RXERR_CRC) | 73 | if (rx_stats->rs_status & ATH9K_RXERR_CRC) |
68 | rxs->flag |= RX_FLAG_FAILED_FCS_CRC; | 74 | rxs->flag |= RX_FLAG_FAILED_FCS_CRC; |
69 | if (rx_stats->rs_status & ATH9K_RXERR_PHY) | 75 | if (rx_stats->rs_status & ATH9K_RXERR_PHY) |
@@ -102,11 +108,11 @@ static bool ath9k_rx_accept(struct ath_common *common, | |||
102 | return true; | 108 | return true; |
103 | } | 109 | } |
104 | 110 | ||
105 | static u8 ath9k_process_rate(struct ath_common *common, | 111 | static int ath9k_process_rate(struct ath_common *common, |
106 | struct ieee80211_hw *hw, | 112 | struct ieee80211_hw *hw, |
107 | struct ath_rx_status *rx_stats, | 113 | struct ath_rx_status *rx_stats, |
108 | struct ieee80211_rx_status *rxs, | 114 | struct ieee80211_rx_status *rxs, |
109 | struct sk_buff *skb) | 115 | struct sk_buff *skb) |
110 | { | 116 | { |
111 | struct ieee80211_supported_band *sband; | 117 | struct ieee80211_supported_band *sband; |
112 | enum ieee80211_band band; | 118 | enum ieee80211_band band; |
@@ -122,25 +128,32 @@ static u8 ath9k_process_rate(struct ath_common *common, | |||
122 | rxs->flag |= RX_FLAG_40MHZ; | 128 | rxs->flag |= RX_FLAG_40MHZ; |
123 | if (rx_stats->rs_flags & ATH9K_RX_GI) | 129 | if (rx_stats->rs_flags & ATH9K_RX_GI) |
124 | rxs->flag |= RX_FLAG_SHORT_GI; | 130 | rxs->flag |= RX_FLAG_SHORT_GI; |
125 | return rx_stats->rs_rate & 0x7f; | 131 | rxs->rate_idx = rx_stats->rs_rate & 0x7f; |
132 | return 0; | ||
126 | } | 133 | } |
127 | 134 | ||
128 | for (i = 0; i < sband->n_bitrates; i++) { | 135 | for (i = 0; i < sband->n_bitrates; i++) { |
129 | if (sband->bitrates[i].hw_value == rx_stats->rs_rate) | 136 | if (sband->bitrates[i].hw_value == rx_stats->rs_rate) { |
130 | return i; | 137 | rxs->rate_idx = i; |
138 | return 0; | ||
139 | } | ||
131 | if (sband->bitrates[i].hw_value_short == rx_stats->rs_rate) { | 140 | if (sband->bitrates[i].hw_value_short == rx_stats->rs_rate) { |
132 | rxs->flag |= RX_FLAG_SHORTPRE; | 141 | rxs->flag |= RX_FLAG_SHORTPRE; |
133 | return i; | 142 | rxs->rate_idx = i; |
143 | return 0; | ||
134 | } | 144 | } |
135 | } | 145 | } |
136 | 146 | ||
137 | /* No valid hardware bitrate found -- we should not get here */ | 147 | /* |
148 | * No valid hardware bitrate found -- we should not get here | ||
149 | * because hardware has already validated this frame as OK. | ||
150 | */ | ||
138 | ath_print(common, ATH_DBG_XMIT, "unsupported hw bitrate detected " | 151 | ath_print(common, ATH_DBG_XMIT, "unsupported hw bitrate detected " |
139 | "0x%02x using 1 Mbit\n", rx_stats->rs_rate); | 152 | "0x%02x using 1 Mbit\n", rx_stats->rs_rate); |
140 | if ((common->debug_mask & ATH_DBG_XMIT)) | 153 | if ((common->debug_mask & ATH_DBG_XMIT)) |
141 | print_hex_dump_bytes("", DUMP_PREFIX_NONE, skb->data, skb->len); | 154 | print_hex_dump_bytes("", DUMP_PREFIX_NONE, skb->data, skb->len); |
142 | 155 | ||
143 | return 0; | 156 | return -EINVAL; |
144 | } | 157 | } |
145 | 158 | ||
146 | static void ath9k_process_rssi(struct ath_common *common, | 159 | static void ath9k_process_rssi(struct ath_common *common, |
@@ -202,13 +215,19 @@ int ath9k_cmn_rx_skb_preprocess(struct ath_common *common, | |||
202 | struct ath_hw *ah = common->ah; | 215 | struct ath_hw *ah = common->ah; |
203 | 216 | ||
204 | memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); | 217 | memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); |
218 | |||
219 | /* | ||
220 | * everything but the rate is checked here, the rate check is done | ||
221 | * separately to avoid doing two lookups for a rate for each frame. | ||
222 | */ | ||
205 | if (!ath9k_rx_accept(common, skb, rx_status, rx_stats, decrypt_error)) | 223 | if (!ath9k_rx_accept(common, skb, rx_status, rx_stats, decrypt_error)) |
206 | return -EINVAL; | 224 | return -EINVAL; |
207 | 225 | ||
208 | ath9k_process_rssi(common, hw, skb, rx_stats); | 226 | ath9k_process_rssi(common, hw, skb, rx_stats); |
209 | 227 | ||
210 | rx_status->rate_idx = ath9k_process_rate(common, hw, | 228 | if (ath9k_process_rate(common, hw, rx_stats, rx_status, skb)) |
211 | rx_stats, rx_status, skb); | 229 | return -EINVAL; |
230 | |||
212 | rx_status->mactime = ath9k_hw_extend_tsf(ah, rx_stats->rs_tstamp); | 231 | rx_status->mactime = ath9k_hw_extend_tsf(ah, rx_stats->rs_tstamp); |
213 | rx_status->band = hw->conf.channel->band; | 232 | rx_status->band = hw->conf.channel->band; |
214 | rx_status->freq = hw->conf.channel->center_freq; | 233 | rx_status->freq = hw->conf.channel->center_freq; |
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h index 1ae18bbc4d9e..ad556aa8da39 100644 --- a/drivers/net/wireless/ath/ath9k/htc.h +++ b/drivers/net/wireless/ath/ath9k/htc.h | |||
@@ -356,7 +356,6 @@ struct ath9k_htc_priv { | |||
356 | u16 seq_no; | 356 | u16 seq_no; |
357 | u32 bmiss_cnt; | 357 | u32 bmiss_cnt; |
358 | 358 | ||
359 | struct sk_buff *beacon; | ||
360 | spinlock_t beacon_lock; | 359 | spinlock_t beacon_lock; |
361 | 360 | ||
362 | bool tx_queues_stop; | 361 | bool tx_queues_stop; |
@@ -408,13 +407,13 @@ static inline void ath_read_cachesize(struct ath_common *common, int *csz) | |||
408 | void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv, | 407 | void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv, |
409 | struct ieee80211_vif *vif); | 408 | struct ieee80211_vif *vif); |
410 | void ath9k_htc_swba(struct ath9k_htc_priv *priv, u8 beacon_pending); | 409 | void ath9k_htc_swba(struct ath9k_htc_priv *priv, u8 beacon_pending); |
411 | void ath9k_htc_beacon_update(struct ath9k_htc_priv *priv, | ||
412 | struct ieee80211_vif *vif); | ||
413 | 410 | ||
414 | void ath9k_htc_rxep(void *priv, struct sk_buff *skb, | 411 | void ath9k_htc_rxep(void *priv, struct sk_buff *skb, |
415 | enum htc_endpoint_id ep_id); | 412 | enum htc_endpoint_id ep_id); |
416 | void ath9k_htc_txep(void *priv, struct sk_buff *skb, enum htc_endpoint_id ep_id, | 413 | void ath9k_htc_txep(void *priv, struct sk_buff *skb, enum htc_endpoint_id ep_id, |
417 | bool txok); | 414 | bool txok); |
415 | void ath9k_htc_beaconep(void *drv_priv, struct sk_buff *skb, | ||
416 | enum htc_endpoint_id ep_id, bool txok); | ||
418 | 417 | ||
419 | void ath9k_htc_station_work(struct work_struct *work); | 418 | void ath9k_htc_station_work(struct work_struct *work); |
420 | void ath9k_htc_aggr_work(struct work_struct *work); | 419 | void ath9k_htc_aggr_work(struct work_struct *work); |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c index 7cb55f5b071c..c10c7d002eb7 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c | |||
@@ -165,22 +165,10 @@ static void ath9k_htc_beacon_config_adhoc(struct ath9k_htc_priv *priv, | |||
165 | WMI_CMD_BUF(WMI_ENABLE_INTR_CMDID, &htc_imask); | 165 | WMI_CMD_BUF(WMI_ENABLE_INTR_CMDID, &htc_imask); |
166 | } | 166 | } |
167 | 167 | ||
168 | void ath9k_htc_beacon_update(struct ath9k_htc_priv *priv, | 168 | void ath9k_htc_beaconep(void *drv_priv, struct sk_buff *skb, |
169 | struct ieee80211_vif *vif) | 169 | enum htc_endpoint_id ep_id, bool txok) |
170 | { | 170 | { |
171 | struct ath_common *common = ath9k_hw_common(priv->ah); | 171 | dev_kfree_skb_any(skb); |
172 | |||
173 | spin_lock_bh(&priv->beacon_lock); | ||
174 | |||
175 | if (priv->beacon) | ||
176 | dev_kfree_skb_any(priv->beacon); | ||
177 | |||
178 | priv->beacon = ieee80211_beacon_get(priv->hw, vif); | ||
179 | if (!priv->beacon) | ||
180 | ath_print(common, ATH_DBG_BEACON, | ||
181 | "Unable to allocate beacon\n"); | ||
182 | |||
183 | spin_unlock_bh(&priv->beacon_lock); | ||
184 | } | 172 | } |
185 | 173 | ||
186 | void ath9k_htc_swba(struct ath9k_htc_priv *priv, u8 beacon_pending) | 174 | void ath9k_htc_swba(struct ath9k_htc_priv *priv, u8 beacon_pending) |
@@ -189,6 +177,7 @@ void ath9k_htc_swba(struct ath9k_htc_priv *priv, u8 beacon_pending) | |||
189 | struct tx_beacon_header beacon_hdr; | 177 | struct tx_beacon_header beacon_hdr; |
190 | struct ath9k_htc_tx_ctl tx_ctl; | 178 | struct ath9k_htc_tx_ctl tx_ctl; |
191 | struct ieee80211_tx_info *info; | 179 | struct ieee80211_tx_info *info; |
180 | struct sk_buff *beacon; | ||
192 | u8 *tx_fhdr; | 181 | u8 *tx_fhdr; |
193 | 182 | ||
194 | memset(&beacon_hdr, 0, sizeof(struct tx_beacon_header)); | 183 | memset(&beacon_hdr, 0, sizeof(struct tx_beacon_header)); |
@@ -207,25 +196,17 @@ void ath9k_htc_swba(struct ath9k_htc_priv *priv, u8 beacon_pending) | |||
207 | return; | 196 | return; |
208 | } | 197 | } |
209 | 198 | ||
210 | if (unlikely(priv->beacon == NULL)) { | ||
211 | spin_unlock_bh(&priv->beacon_lock); | ||
212 | return; | ||
213 | } | ||
214 | |||
215 | /* Free the old SKB first */ | ||
216 | dev_kfree_skb_any(priv->beacon); | ||
217 | |||
218 | /* Get a new beacon */ | 199 | /* Get a new beacon */ |
219 | priv->beacon = ieee80211_beacon_get(priv->hw, priv->vif); | 200 | beacon = ieee80211_beacon_get(priv->hw, priv->vif); |
220 | if (!priv->beacon) { | 201 | if (!beacon) { |
221 | spin_unlock_bh(&priv->beacon_lock); | 202 | spin_unlock_bh(&priv->beacon_lock); |
222 | return; | 203 | return; |
223 | } | 204 | } |
224 | 205 | ||
225 | info = IEEE80211_SKB_CB(priv->beacon); | 206 | info = IEEE80211_SKB_CB(beacon); |
226 | if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { | 207 | if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { |
227 | struct ieee80211_hdr *hdr = | 208 | struct ieee80211_hdr *hdr = |
228 | (struct ieee80211_hdr *) priv->beacon->data; | 209 | (struct ieee80211_hdr *) beacon->data; |
229 | priv->seq_no += 0x10; | 210 | priv->seq_no += 0x10; |
230 | hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); | 211 | hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); |
231 | hdr->seq_ctrl |= cpu_to_le16(priv->seq_no); | 212 | hdr->seq_ctrl |= cpu_to_le16(priv->seq_no); |
@@ -233,10 +214,10 @@ void ath9k_htc_swba(struct ath9k_htc_priv *priv, u8 beacon_pending) | |||
233 | 214 | ||
234 | tx_ctl.type = ATH9K_HTC_NORMAL; | 215 | tx_ctl.type = ATH9K_HTC_NORMAL; |
235 | beacon_hdr.vif_index = avp->index; | 216 | beacon_hdr.vif_index = avp->index; |
236 | tx_fhdr = skb_push(priv->beacon, sizeof(beacon_hdr)); | 217 | tx_fhdr = skb_push(beacon, sizeof(beacon_hdr)); |
237 | memcpy(tx_fhdr, (u8 *) &beacon_hdr, sizeof(beacon_hdr)); | 218 | memcpy(tx_fhdr, (u8 *) &beacon_hdr, sizeof(beacon_hdr)); |
238 | 219 | ||
239 | htc_send(priv->htc, priv->beacon, priv->beacon_ep, &tx_ctl); | 220 | htc_send(priv->htc, beacon, priv->beacon_ep, &tx_ctl); |
240 | 221 | ||
241 | spin_unlock_bh(&priv->beacon_lock); | 222 | spin_unlock_bh(&priv->beacon_lock); |
242 | } | 223 | } |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c index 701f2ef5a440..17111fc1d2cc 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c | |||
@@ -144,7 +144,7 @@ static int ath9k_init_htc_services(struct ath9k_htc_priv *priv) | |||
144 | goto err; | 144 | goto err; |
145 | 145 | ||
146 | /* Beacon */ | 146 | /* Beacon */ |
147 | ret = ath9k_htc_connect_svc(priv, WMI_BEACON_SVC, NULL, | 147 | ret = ath9k_htc_connect_svc(priv, WMI_BEACON_SVC, ath9k_htc_beaconep, |
148 | &priv->beacon_ep); | 148 | &priv->beacon_ep); |
149 | if (ret) | 149 | if (ret) |
150 | goto err; | 150 | goto err; |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c index ca7f3a78eb11..6c386dad1d40 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c | |||
@@ -461,11 +461,11 @@ static int ath9k_htc_aggr_oper(struct ath9k_htc_priv *priv, | |||
461 | struct ath_common *common = ath9k_hw_common(priv->ah); | 461 | struct ath_common *common = ath9k_hw_common(priv->ah); |
462 | struct ath9k_htc_target_aggr aggr; | 462 | struct ath9k_htc_target_aggr aggr; |
463 | struct ieee80211_sta *sta = NULL; | 463 | struct ieee80211_sta *sta = NULL; |
464 | struct ath9k_htc_sta *ista = (struct ath9k_htc_sta *) sta->drv_priv; | 464 | struct ath9k_htc_sta *ista; |
465 | int ret = 0; | 465 | int ret = 0; |
466 | u8 cmd_rsp; | 466 | u8 cmd_rsp; |
467 | 467 | ||
468 | if (tid > ATH9K_HTC_MAX_TID) | 468 | if (tid >= ATH9K_HTC_MAX_TID) |
469 | return -EINVAL; | 469 | return -EINVAL; |
470 | 470 | ||
471 | memset(&aggr, 0, sizeof(struct ath9k_htc_target_aggr)); | 471 | memset(&aggr, 0, sizeof(struct ath9k_htc_target_aggr)); |
@@ -1099,7 +1099,7 @@ fail_tx: | |||
1099 | return 0; | 1099 | return 0; |
1100 | } | 1100 | } |
1101 | 1101 | ||
1102 | static int ath9k_htc_radio_enable(struct ieee80211_hw *hw) | 1102 | static int ath9k_htc_radio_enable(struct ieee80211_hw *hw, bool led) |
1103 | { | 1103 | { |
1104 | struct ath9k_htc_priv *priv = hw->priv; | 1104 | struct ath9k_htc_priv *priv = hw->priv; |
1105 | struct ath_hw *ah = priv->ah; | 1105 | struct ath_hw *ah = priv->ah; |
@@ -1147,6 +1147,13 @@ static int ath9k_htc_radio_enable(struct ieee80211_hw *hw) | |||
1147 | priv->tx_queues_stop = false; | 1147 | priv->tx_queues_stop = false; |
1148 | spin_unlock_bh(&priv->tx_lock); | 1148 | spin_unlock_bh(&priv->tx_lock); |
1149 | 1149 | ||
1150 | if (led) { | ||
1151 | /* Enable LED */ | ||
1152 | ath9k_hw_cfg_output(ah, ah->led_pin, | ||
1153 | AR_GPIO_OUTPUT_MUX_AS_OUTPUT); | ||
1154 | ath9k_hw_set_gpio(ah, ah->led_pin, 0); | ||
1155 | } | ||
1156 | |||
1150 | ieee80211_wake_queues(hw); | 1157 | ieee80211_wake_queues(hw); |
1151 | 1158 | ||
1152 | return ret; | 1159 | return ret; |
@@ -1158,13 +1165,13 @@ static int ath9k_htc_start(struct ieee80211_hw *hw) | |||
1158 | int ret = 0; | 1165 | int ret = 0; |
1159 | 1166 | ||
1160 | mutex_lock(&priv->mutex); | 1167 | mutex_lock(&priv->mutex); |
1161 | ret = ath9k_htc_radio_enable(hw); | 1168 | ret = ath9k_htc_radio_enable(hw, false); |
1162 | mutex_unlock(&priv->mutex); | 1169 | mutex_unlock(&priv->mutex); |
1163 | 1170 | ||
1164 | return ret; | 1171 | return ret; |
1165 | } | 1172 | } |
1166 | 1173 | ||
1167 | static void ath9k_htc_radio_disable(struct ieee80211_hw *hw) | 1174 | static void ath9k_htc_radio_disable(struct ieee80211_hw *hw, bool led) |
1168 | { | 1175 | { |
1169 | struct ath9k_htc_priv *priv = hw->priv; | 1176 | struct ath9k_htc_priv *priv = hw->priv; |
1170 | struct ath_hw *ah = priv->ah; | 1177 | struct ath_hw *ah = priv->ah; |
@@ -1177,6 +1184,12 @@ static void ath9k_htc_radio_disable(struct ieee80211_hw *hw) | |||
1177 | return; | 1184 | return; |
1178 | } | 1185 | } |
1179 | 1186 | ||
1187 | if (led) { | ||
1188 | /* Disable LED */ | ||
1189 | ath9k_hw_set_gpio(ah, ah->led_pin, 1); | ||
1190 | ath9k_hw_cfg_gpio_input(ah, ah->led_pin); | ||
1191 | } | ||
1192 | |||
1180 | /* Cancel all the running timers/work .. */ | 1193 | /* Cancel all the running timers/work .. */ |
1181 | cancel_work_sync(&priv->ps_work); | 1194 | cancel_work_sync(&priv->ps_work); |
1182 | cancel_delayed_work_sync(&priv->ath9k_ani_work); | 1195 | cancel_delayed_work_sync(&priv->ath9k_ani_work); |
@@ -1217,7 +1230,7 @@ static void ath9k_htc_stop(struct ieee80211_hw *hw) | |||
1217 | struct ath9k_htc_priv *priv = hw->priv; | 1230 | struct ath9k_htc_priv *priv = hw->priv; |
1218 | 1231 | ||
1219 | mutex_lock(&priv->mutex); | 1232 | mutex_lock(&priv->mutex); |
1220 | ath9k_htc_radio_disable(hw); | 1233 | ath9k_htc_radio_disable(hw, false); |
1221 | mutex_unlock(&priv->mutex); | 1234 | mutex_unlock(&priv->mutex); |
1222 | } | 1235 | } |
1223 | 1236 | ||
@@ -1313,15 +1326,6 @@ static void ath9k_htc_remove_interface(struct ieee80211_hw *hw, | |||
1313 | priv->nvifs--; | 1326 | priv->nvifs--; |
1314 | 1327 | ||
1315 | ath9k_htc_remove_station(priv, vif, NULL); | 1328 | ath9k_htc_remove_station(priv, vif, NULL); |
1316 | |||
1317 | if (vif->type == NL80211_IFTYPE_ADHOC) { | ||
1318 | spin_lock_bh(&priv->beacon_lock); | ||
1319 | if (priv->beacon) | ||
1320 | dev_kfree_skb_any(priv->beacon); | ||
1321 | priv->beacon = NULL; | ||
1322 | spin_unlock_bh(&priv->beacon_lock); | ||
1323 | } | ||
1324 | |||
1325 | priv->vif = NULL; | 1329 | priv->vif = NULL; |
1326 | 1330 | ||
1327 | mutex_unlock(&priv->mutex); | 1331 | mutex_unlock(&priv->mutex); |
@@ -1346,7 +1350,7 @@ static int ath9k_htc_config(struct ieee80211_hw *hw, u32 changed) | |||
1346 | 1350 | ||
1347 | if (enable_radio) { | 1351 | if (enable_radio) { |
1348 | ath9k_htc_setpower(priv, ATH9K_PM_AWAKE); | 1352 | ath9k_htc_setpower(priv, ATH9K_PM_AWAKE); |
1349 | ath9k_htc_radio_enable(hw); | 1353 | ath9k_htc_radio_enable(hw, true); |
1350 | ath_print(common, ATH_DBG_CONFIG, | 1354 | ath_print(common, ATH_DBG_CONFIG, |
1351 | "not-idle: enabling radio\n"); | 1355 | "not-idle: enabling radio\n"); |
1352 | } | 1356 | } |
@@ -1398,10 +1402,9 @@ static int ath9k_htc_config(struct ieee80211_hw *hw, u32 changed) | |||
1398 | if (priv->ps_idle) { | 1402 | if (priv->ps_idle) { |
1399 | ath_print(common, ATH_DBG_CONFIG, | 1403 | ath_print(common, ATH_DBG_CONFIG, |
1400 | "idle: disabling radio\n"); | 1404 | "idle: disabling radio\n"); |
1401 | ath9k_htc_radio_disable(hw); | 1405 | ath9k_htc_radio_disable(hw, true); |
1402 | } | 1406 | } |
1403 | 1407 | ||
1404 | |||
1405 | mutex_unlock(&priv->mutex); | 1408 | mutex_unlock(&priv->mutex); |
1406 | 1409 | ||
1407 | return 0; | 1410 | return 0; |
@@ -1590,9 +1593,6 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw, | |||
1590 | ath9k_htc_beacon_config(priv, vif); | 1593 | ath9k_htc_beacon_config(priv, vif); |
1591 | } | 1594 | } |
1592 | 1595 | ||
1593 | if (changed & BSS_CHANGED_BEACON) | ||
1594 | ath9k_htc_beacon_update(priv, vif); | ||
1595 | |||
1596 | if ((changed & BSS_CHANGED_BEACON_ENABLED) && | 1596 | if ((changed & BSS_CHANGED_BEACON_ENABLED) && |
1597 | !bss_conf->enable_beacon) { | 1597 | !bss_conf->enable_beacon) { |
1598 | priv->op_flags &= ~OP_ENABLE_BEACON; | 1598 | priv->op_flags &= ~OP_ENABLE_BEACON; |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 559019262d30..c33f17dbe6f1 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -574,6 +574,26 @@ static int __ath9k_hw_init(struct ath_hw *ah) | |||
574 | 574 | ||
575 | ath9k_hw_init_mode_regs(ah); | 575 | ath9k_hw_init_mode_regs(ah); |
576 | 576 | ||
577 | /* | ||
578 | * Configire PCIE after Ini init. SERDES values now come from ini file | ||
579 | * This enables PCIe low power mode. | ||
580 | */ | ||
581 | if (AR_SREV_9300_20_OR_LATER(ah)) { | ||
582 | u32 regval; | ||
583 | unsigned int i; | ||
584 | |||
585 | /* Set Bits 16 and 17 in the AR_WA register. */ | ||
586 | regval = REG_READ(ah, AR_WA); | ||
587 | regval |= 0x00030000; | ||
588 | REG_WRITE(ah, AR_WA, regval); | ||
589 | |||
590 | for (i = 0; i < ah->iniPcieSerdesLowPower.ia_rows; i++) { | ||
591 | REG_WRITE(ah, | ||
592 | INI_RA(&ah->iniPcieSerdesLowPower, i, 0), | ||
593 | INI_RA(&ah->iniPcieSerdesLowPower, i, 1)); | ||
594 | } | ||
595 | } | ||
596 | |||
577 | if (ah->is_pciexpress) | 597 | if (ah->is_pciexpress) |
578 | ath9k_hw_configpcipowersave(ah, 0, 0); | 598 | ath9k_hw_configpcipowersave(ah, 0, 0); |
579 | else | 599 | else |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 17197a78d894..99b876a2feb9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -2483,7 +2483,6 @@ int iwl3945_hw_set_hw_params(struct iwl_priv *priv) | |||
2483 | &priv->_3945.shared_phys, GFP_KERNEL); | 2483 | &priv->_3945.shared_phys, GFP_KERNEL); |
2484 | if (!priv->_3945.shared_virt) { | 2484 | if (!priv->_3945.shared_virt) { |
2485 | IWL_ERR(priv, "failed to allocate pci memory\n"); | 2485 | IWL_ERR(priv, "failed to allocate pci memory\n"); |
2486 | mutex_unlock(&priv->mutex); | ||
2487 | return -ENOMEM; | 2486 | return -ENOMEM; |
2488 | } | 2487 | } |
2489 | 2488 | ||
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c index ce7bec402a33..9d5d3ccf08c8 100644 --- a/drivers/net/wireless/libertas/cfg.c +++ b/drivers/net/wireless/libertas/cfg.c | |||
@@ -79,6 +79,7 @@ static const u32 cipher_suites[] = { | |||
79 | 79 | ||
80 | 80 | ||
81 | static int lbs_cfg_set_channel(struct wiphy *wiphy, | 81 | static int lbs_cfg_set_channel(struct wiphy *wiphy, |
82 | struct net_device *netdev, | ||
82 | struct ieee80211_channel *chan, | 83 | struct ieee80211_channel *chan, |
83 | enum nl80211_channel_type channel_type) | 84 | enum nl80211_channel_type channel_type) |
84 | { | 85 | { |
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 9fd2beadb6f5..6f8cb3ee6fed 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -652,17 +652,17 @@ static void mac80211_hwsim_beacon(unsigned long arg) | |||
652 | add_timer(&data->beacon_timer); | 652 | add_timer(&data->beacon_timer); |
653 | } | 653 | } |
654 | 654 | ||
655 | static const char *hwsim_chantypes[] = { | ||
656 | [NL80211_CHAN_NO_HT] = "noht", | ||
657 | [NL80211_CHAN_HT20] = "ht20", | ||
658 | [NL80211_CHAN_HT40MINUS] = "ht40-", | ||
659 | [NL80211_CHAN_HT40PLUS] = "ht40+", | ||
660 | }; | ||
655 | 661 | ||
656 | static int mac80211_hwsim_config(struct ieee80211_hw *hw, u32 changed) | 662 | static int mac80211_hwsim_config(struct ieee80211_hw *hw, u32 changed) |
657 | { | 663 | { |
658 | struct mac80211_hwsim_data *data = hw->priv; | 664 | struct mac80211_hwsim_data *data = hw->priv; |
659 | struct ieee80211_conf *conf = &hw->conf; | 665 | struct ieee80211_conf *conf = &hw->conf; |
660 | static const char *chantypes[4] = { | ||
661 | [NL80211_CHAN_NO_HT] = "noht", | ||
662 | [NL80211_CHAN_HT20] = "ht20", | ||
663 | [NL80211_CHAN_HT40MINUS] = "ht40-", | ||
664 | [NL80211_CHAN_HT40PLUS] = "ht40+", | ||
665 | }; | ||
666 | static const char *smps_modes[IEEE80211_SMPS_NUM_MODES] = { | 666 | static const char *smps_modes[IEEE80211_SMPS_NUM_MODES] = { |
667 | [IEEE80211_SMPS_AUTOMATIC] = "auto", | 667 | [IEEE80211_SMPS_AUTOMATIC] = "auto", |
668 | [IEEE80211_SMPS_OFF] = "off", | 668 | [IEEE80211_SMPS_OFF] = "off", |
@@ -673,7 +673,7 @@ static int mac80211_hwsim_config(struct ieee80211_hw *hw, u32 changed) | |||
673 | printk(KERN_DEBUG "%s:%s (freq=%d/%s idle=%d ps=%d smps=%s)\n", | 673 | printk(KERN_DEBUG "%s:%s (freq=%d/%s idle=%d ps=%d smps=%s)\n", |
674 | wiphy_name(hw->wiphy), __func__, | 674 | wiphy_name(hw->wiphy), __func__, |
675 | conf->channel->center_freq, | 675 | conf->channel->center_freq, |
676 | chantypes[conf->channel_type], | 676 | hwsim_chantypes[conf->channel_type], |
677 | !!(conf->flags & IEEE80211_CONF_IDLE), | 677 | !!(conf->flags & IEEE80211_CONF_IDLE), |
678 | !!(conf->flags & IEEE80211_CONF_PS), | 678 | !!(conf->flags & IEEE80211_CONF_PS), |
679 | smps_modes[conf->smps_mode]); | 679 | smps_modes[conf->smps_mode]); |
@@ -761,9 +761,10 @@ static void mac80211_hwsim_bss_info_changed(struct ieee80211_hw *hw, | |||
761 | } | 761 | } |
762 | 762 | ||
763 | if (changed & BSS_CHANGED_HT) { | 763 | if (changed & BSS_CHANGED_HT) { |
764 | printk(KERN_DEBUG " %s: HT: op_mode=0x%x\n", | 764 | printk(KERN_DEBUG " %s: HT: op_mode=0x%x, chantype=%s\n", |
765 | wiphy_name(hw->wiphy), | 765 | wiphy_name(hw->wiphy), |
766 | info->ht_operation_mode); | 766 | info->ht_operation_mode, |
767 | hwsim_chantypes[info->channel_type]); | ||
767 | } | 768 | } |
768 | 769 | ||
769 | if (changed & BSS_CHANGED_BASIC_RATES) { | 770 | if (changed & BSS_CHANGED_BASIC_RATES) { |
diff --git a/drivers/net/wireless/orinoco/cfg.c b/drivers/net/wireless/orinoco/cfg.c index 81d228de9e5d..8c4169c227ae 100644 --- a/drivers/net/wireless/orinoco/cfg.c +++ b/drivers/net/wireless/orinoco/cfg.c | |||
@@ -159,6 +159,7 @@ static int orinoco_scan(struct wiphy *wiphy, struct net_device *dev, | |||
159 | } | 159 | } |
160 | 160 | ||
161 | static int orinoco_set_channel(struct wiphy *wiphy, | 161 | static int orinoco_set_channel(struct wiphy *wiphy, |
162 | struct net_device *netdev, | ||
162 | struct ieee80211_channel *chan, | 163 | struct ieee80211_channel *chan, |
163 | enum nl80211_channel_type channel_type) | 164 | enum nl80211_channel_type channel_type) |
164 | { | 165 | { |
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c index 884a7779fc5f..97e954ee17f8 100644 --- a/drivers/net/wireless/orinoco/main.c +++ b/drivers/net/wireless/orinoco/main.c | |||
@@ -340,18 +340,109 @@ EXPORT_SYMBOL(orinoco_change_mtu); | |||
340 | /* Tx path */ | 340 | /* Tx path */ |
341 | /********************************************************************/ | 341 | /********************************************************************/ |
342 | 342 | ||
343 | /* Add encapsulation and MIC to the existing SKB. | ||
344 | * The main xmit routine will then send the whole lot to the card. | ||
345 | * Need 8 bytes headroom | ||
346 | * Need 8 bytes tailroom | ||
347 | * | ||
348 | * With encapsulated ethernet II frame | ||
349 | * -------- | ||
350 | * 803.3 header (14 bytes) | ||
351 | * dst[6] | ||
352 | * -------- src[6] | ||
353 | * 803.3 header (14 bytes) len[2] | ||
354 | * dst[6] 803.2 header (8 bytes) | ||
355 | * src[6] encaps[6] | ||
356 | * len[2] <- leave alone -> len[2] | ||
357 | * -------- -------- <-- 0 | ||
358 | * Payload Payload | ||
359 | * ... ... | ||
360 | * | ||
361 | * -------- -------- | ||
362 | * MIC (8 bytes) | ||
363 | * -------- | ||
364 | * | ||
365 | * returns 0 on success, -ENOMEM on error. | ||
366 | */ | ||
367 | int orinoco_process_xmit_skb(struct sk_buff *skb, | ||
368 | struct net_device *dev, | ||
369 | struct orinoco_private *priv, | ||
370 | int *tx_control, | ||
371 | u8 *mic_buf) | ||
372 | { | ||
373 | struct orinoco_tkip_key *key; | ||
374 | struct ethhdr *eh; | ||
375 | int do_mic; | ||
376 | |||
377 | key = (struct orinoco_tkip_key *) priv->keys[priv->tx_key].key; | ||
378 | |||
379 | do_mic = ((priv->encode_alg == ORINOCO_ALG_TKIP) && | ||
380 | (key != NULL)); | ||
381 | |||
382 | if (do_mic) | ||
383 | *tx_control |= (priv->tx_key << HERMES_MIC_KEY_ID_SHIFT) | | ||
384 | HERMES_TXCTRL_MIC; | ||
385 | |||
386 | eh = (struct ethhdr *)skb->data; | ||
387 | |||
388 | /* Encapsulate Ethernet-II frames */ | ||
389 | if (ntohs(eh->h_proto) > ETH_DATA_LEN) { /* Ethernet-II frame */ | ||
390 | struct header_struct { | ||
391 | struct ethhdr eth; /* 802.3 header */ | ||
392 | u8 encap[6]; /* 802.2 header */ | ||
393 | } __attribute__ ((packed)) hdr; | ||
394 | int len = skb->len + sizeof(encaps_hdr) - (2 * ETH_ALEN); | ||
395 | |||
396 | if (skb_headroom(skb) < ENCAPS_OVERHEAD) { | ||
397 | if (net_ratelimit()) | ||
398 | printk(KERN_ERR | ||
399 | "%s: Not enough headroom for 802.2 headers %d\n", | ||
400 | dev->name, skb_headroom(skb)); | ||
401 | return -ENOMEM; | ||
402 | } | ||
403 | |||
404 | /* Fill in new header */ | ||
405 | memcpy(&hdr.eth, eh, 2 * ETH_ALEN); | ||
406 | hdr.eth.h_proto = htons(len); | ||
407 | memcpy(hdr.encap, encaps_hdr, sizeof(encaps_hdr)); | ||
408 | |||
409 | /* Make room for the new header, and copy it in */ | ||
410 | eh = (struct ethhdr *) skb_push(skb, ENCAPS_OVERHEAD); | ||
411 | memcpy(eh, &hdr, sizeof(hdr)); | ||
412 | } | ||
413 | |||
414 | /* Calculate Michael MIC */ | ||
415 | if (do_mic) { | ||
416 | size_t len = skb->len - ETH_HLEN; | ||
417 | u8 *mic = &mic_buf[0]; | ||
418 | |||
419 | /* Have to write to an even address, so copy the spare | ||
420 | * byte across */ | ||
421 | if (skb->len % 2) { | ||
422 | *mic = skb->data[skb->len - 1]; | ||
423 | mic++; | ||
424 | } | ||
425 | |||
426 | orinoco_mic(priv->tx_tfm_mic, key->tx_mic, | ||
427 | eh->h_dest, eh->h_source, 0 /* priority */, | ||
428 | skb->data + ETH_HLEN, | ||
429 | len, mic); | ||
430 | } | ||
431 | |||
432 | return 0; | ||
433 | } | ||
434 | EXPORT_SYMBOL(orinoco_process_xmit_skb); | ||
435 | |||
343 | static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev) | 436 | static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev) |
344 | { | 437 | { |
345 | struct orinoco_private *priv = ndev_priv(dev); | 438 | struct orinoco_private *priv = ndev_priv(dev); |
346 | struct net_device_stats *stats = &priv->stats; | 439 | struct net_device_stats *stats = &priv->stats; |
347 | struct orinoco_tkip_key *key; | ||
348 | hermes_t *hw = &priv->hw; | 440 | hermes_t *hw = &priv->hw; |
349 | int err = 0; | 441 | int err = 0; |
350 | u16 txfid = priv->txfid; | 442 | u16 txfid = priv->txfid; |
351 | struct ethhdr *eh; | ||
352 | int tx_control; | 443 | int tx_control; |
353 | unsigned long flags; | 444 | unsigned long flags; |
354 | int do_mic; | 445 | u8 mic_buf[MICHAEL_MIC_LEN+1]; |
355 | 446 | ||
356 | if (!netif_running(dev)) { | 447 | if (!netif_running(dev)) { |
357 | printk(KERN_ERR "%s: Tx on stopped device!\n", | 448 | printk(KERN_ERR "%s: Tx on stopped device!\n", |
@@ -383,16 +474,12 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev) | |||
383 | if (skb->len < ETH_HLEN) | 474 | if (skb->len < ETH_HLEN) |
384 | goto drop; | 475 | goto drop; |
385 | 476 | ||
386 | key = (struct orinoco_tkip_key *) priv->keys[priv->tx_key].key; | ||
387 | |||
388 | do_mic = ((priv->encode_alg == ORINOCO_ALG_TKIP) && | ||
389 | (key != NULL)); | ||
390 | |||
391 | tx_control = HERMES_TXCTRL_TX_OK | HERMES_TXCTRL_TX_EX; | 477 | tx_control = HERMES_TXCTRL_TX_OK | HERMES_TXCTRL_TX_EX; |
392 | 478 | ||
393 | if (do_mic) | 479 | err = orinoco_process_xmit_skb(skb, dev, priv, &tx_control, |
394 | tx_control |= (priv->tx_key << HERMES_MIC_KEY_ID_SHIFT) | | 480 | &mic_buf[0]); |
395 | HERMES_TXCTRL_MIC; | 481 | if (err) |
482 | goto drop; | ||
396 | 483 | ||
397 | if (priv->has_alt_txcntl) { | 484 | if (priv->has_alt_txcntl) { |
398 | /* WPA enabled firmwares have tx_cntl at the end of | 485 | /* WPA enabled firmwares have tx_cntl at the end of |
@@ -435,34 +522,6 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev) | |||
435 | HERMES_802_3_OFFSET - HERMES_802_11_OFFSET); | 522 | HERMES_802_3_OFFSET - HERMES_802_11_OFFSET); |
436 | } | 523 | } |
437 | 524 | ||
438 | eh = (struct ethhdr *)skb->data; | ||
439 | |||
440 | /* Encapsulate Ethernet-II frames */ | ||
441 | if (ntohs(eh->h_proto) > ETH_DATA_LEN) { /* Ethernet-II frame */ | ||
442 | struct header_struct { | ||
443 | struct ethhdr eth; /* 802.3 header */ | ||
444 | u8 encap[6]; /* 802.2 header */ | ||
445 | } __attribute__ ((packed)) hdr; | ||
446 | |||
447 | /* Strip destination and source from the data */ | ||
448 | skb_pull(skb, 2 * ETH_ALEN); | ||
449 | |||
450 | /* And move them to a separate header */ | ||
451 | memcpy(&hdr.eth, eh, 2 * ETH_ALEN); | ||
452 | hdr.eth.h_proto = htons(sizeof(encaps_hdr) + skb->len); | ||
453 | memcpy(hdr.encap, encaps_hdr, sizeof(encaps_hdr)); | ||
454 | |||
455 | /* Insert the SNAP header */ | ||
456 | if (skb_headroom(skb) < sizeof(hdr)) { | ||
457 | printk(KERN_ERR | ||
458 | "%s: Not enough headroom for 802.2 headers %d\n", | ||
459 | dev->name, skb_headroom(skb)); | ||
460 | goto drop; | ||
461 | } | ||
462 | eh = (struct ethhdr *) skb_push(skb, sizeof(hdr)); | ||
463 | memcpy(eh, &hdr, sizeof(hdr)); | ||
464 | } | ||
465 | |||
466 | err = hw->ops->bap_pwrite(hw, USER_BAP, skb->data, skb->len, | 525 | err = hw->ops->bap_pwrite(hw, USER_BAP, skb->data, skb->len, |
467 | txfid, HERMES_802_3_OFFSET); | 526 | txfid, HERMES_802_3_OFFSET); |
468 | if (err) { | 527 | if (err) { |
@@ -471,32 +530,16 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev) | |||
471 | goto busy; | 530 | goto busy; |
472 | } | 531 | } |
473 | 532 | ||
474 | /* Calculate Michael MIC */ | 533 | if (tx_control & HERMES_TXCTRL_MIC) { |
475 | if (do_mic) { | 534 | size_t offset = HERMES_802_3_OFFSET + skb->len; |
476 | u8 mic_buf[MICHAEL_MIC_LEN + 1]; | 535 | size_t len = MICHAEL_MIC_LEN; |
477 | u8 *mic; | ||
478 | size_t offset; | ||
479 | size_t len; | ||
480 | 536 | ||
481 | if (skb->len % 2) { | 537 | if (offset % 2) { |
482 | /* MIC start is on an odd boundary */ | 538 | offset--; |
483 | mic_buf[0] = skb->data[skb->len - 1]; | 539 | len++; |
484 | mic = &mic_buf[1]; | ||
485 | offset = skb->len - 1; | ||
486 | len = MICHAEL_MIC_LEN + 1; | ||
487 | } else { | ||
488 | mic = &mic_buf[0]; | ||
489 | offset = skb->len; | ||
490 | len = MICHAEL_MIC_LEN; | ||
491 | } | 540 | } |
492 | |||
493 | orinoco_mic(priv->tx_tfm_mic, key->tx_mic, | ||
494 | eh->h_dest, eh->h_source, 0 /* priority */, | ||
495 | skb->data + ETH_HLEN, skb->len - ETH_HLEN, mic); | ||
496 | |||
497 | /* Write the MIC */ | ||
498 | err = hw->ops->bap_pwrite(hw, USER_BAP, &mic_buf[0], len, | 541 | err = hw->ops->bap_pwrite(hw, USER_BAP, &mic_buf[0], len, |
499 | txfid, HERMES_802_3_OFFSET + offset); | 542 | txfid, offset); |
500 | if (err) { | 543 | if (err) { |
501 | printk(KERN_ERR "%s: Error %d writing MIC to BAP\n", | 544 | printk(KERN_ERR "%s: Error %d writing MIC to BAP\n", |
502 | dev->name, err); | 545 | dev->name, err); |
@@ -2234,7 +2277,7 @@ int orinoco_if_add(struct orinoco_private *priv, | |||
2234 | /* we use the default eth_mac_addr for setting the MAC addr */ | 2277 | /* we use the default eth_mac_addr for setting the MAC addr */ |
2235 | 2278 | ||
2236 | /* Reserve space in skb for the SNAP header */ | 2279 | /* Reserve space in skb for the SNAP header */ |
2237 | dev->hard_header_len += ENCAPS_OVERHEAD; | 2280 | dev->needed_headroom = ENCAPS_OVERHEAD; |
2238 | 2281 | ||
2239 | netif_carrier_off(dev); | 2282 | netif_carrier_off(dev); |
2240 | 2283 | ||
diff --git a/drivers/net/wireless/orinoco/orinoco.h b/drivers/net/wireless/orinoco/orinoco.h index e9f415a56d4d..a6da86e0a70f 100644 --- a/drivers/net/wireless/orinoco/orinoco.h +++ b/drivers/net/wireless/orinoco/orinoco.h | |||
@@ -200,6 +200,12 @@ extern irqreturn_t orinoco_interrupt(int irq, void *dev_id); | |||
200 | extern void __orinoco_ev_info(struct net_device *dev, hermes_t *hw); | 200 | extern void __orinoco_ev_info(struct net_device *dev, hermes_t *hw); |
201 | extern void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw); | 201 | extern void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw); |
202 | 202 | ||
203 | int orinoco_process_xmit_skb(struct sk_buff *skb, | ||
204 | struct net_device *dev, | ||
205 | struct orinoco_private *priv, | ||
206 | int *tx_control, | ||
207 | u8 *mic); | ||
208 | |||
203 | /* Common ndo functions exported for reuse by orinoco_usb */ | 209 | /* Common ndo functions exported for reuse by orinoco_usb */ |
204 | int orinoco_open(struct net_device *dev); | 210 | int orinoco_open(struct net_device *dev); |
205 | int orinoco_stop(struct net_device *dev); | 211 | int orinoco_stop(struct net_device *dev); |
diff --git a/drivers/net/wireless/orinoco/orinoco_usb.c b/drivers/net/wireless/orinoco/orinoco_usb.c index e22093359f3e..78f089baa8c9 100644 --- a/drivers/net/wireless/orinoco/orinoco_usb.c +++ b/drivers/net/wireless/orinoco/orinoco_usb.c | |||
@@ -67,6 +67,7 @@ | |||
67 | #include <linux/wireless.h> | 67 | #include <linux/wireless.h> |
68 | #include <linux/firmware.h> | 68 | #include <linux/firmware.h> |
69 | 69 | ||
70 | #include "mic.h" | ||
70 | #include "orinoco.h" | 71 | #include "orinoco.h" |
71 | 72 | ||
72 | #ifndef URB_ASYNC_UNLINK | 73 | #ifndef URB_ASYNC_UNLINK |
@@ -1198,11 +1199,9 @@ static netdev_tx_t ezusb_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1198 | struct orinoco_private *priv = ndev_priv(dev); | 1199 | struct orinoco_private *priv = ndev_priv(dev); |
1199 | struct net_device_stats *stats = &priv->stats; | 1200 | struct net_device_stats *stats = &priv->stats; |
1200 | struct ezusb_priv *upriv = priv->card; | 1201 | struct ezusb_priv *upriv = priv->card; |
1202 | u8 mic[MICHAEL_MIC_LEN+1]; | ||
1201 | int err = 0; | 1203 | int err = 0; |
1202 | char *p; | 1204 | int tx_control; |
1203 | struct ethhdr *eh; | ||
1204 | int len, data_len, data_off; | ||
1205 | __le16 tx_control; | ||
1206 | unsigned long flags; | 1205 | unsigned long flags; |
1207 | struct request_context *ctx; | 1206 | struct request_context *ctx; |
1208 | u8 *buf; | 1207 | u8 *buf; |
@@ -1222,7 +1221,7 @@ static netdev_tx_t ezusb_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1222 | 1221 | ||
1223 | if (orinoco_lock(priv, &flags) != 0) { | 1222 | if (orinoco_lock(priv, &flags) != 0) { |
1224 | printk(KERN_ERR | 1223 | printk(KERN_ERR |
1225 | "%s: orinoco_xmit() called while hw_unavailable\n", | 1224 | "%s: ezusb_xmit() called while hw_unavailable\n", |
1226 | dev->name); | 1225 | dev->name); |
1227 | return NETDEV_TX_BUSY; | 1226 | return NETDEV_TX_BUSY; |
1228 | } | 1227 | } |
@@ -1232,53 +1231,46 @@ static netdev_tx_t ezusb_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1232 | /* Oops, the firmware hasn't established a connection, | 1231 | /* Oops, the firmware hasn't established a connection, |
1233 | silently drop the packet (this seems to be the | 1232 | silently drop the packet (this seems to be the |
1234 | safest approach). */ | 1233 | safest approach). */ |
1235 | stats->tx_errors++; | 1234 | goto drop; |
1236 | orinoco_unlock(priv, &flags); | ||
1237 | dev_kfree_skb(skb); | ||
1238 | return NETDEV_TX_OK; | ||
1239 | } | 1235 | } |
1240 | 1236 | ||
1237 | /* Check packet length */ | ||
1238 | if (skb->len < ETH_HLEN) | ||
1239 | goto drop; | ||
1240 | |||
1241 | ctx = ezusb_alloc_ctx(upriv, EZUSB_RID_TX, 0); | 1241 | ctx = ezusb_alloc_ctx(upriv, EZUSB_RID_TX, 0); |
1242 | if (!ctx) | 1242 | if (!ctx) |
1243 | goto fail; | 1243 | goto busy; |
1244 | 1244 | ||
1245 | memset(ctx->buf, 0, BULK_BUF_SIZE); | 1245 | memset(ctx->buf, 0, BULK_BUF_SIZE); |
1246 | buf = ctx->buf->data; | 1246 | buf = ctx->buf->data; |
1247 | 1247 | ||
1248 | /* Length of the packet body */ | 1248 | tx_control = 0; |
1249 | /* FIXME: what if the skb is smaller than this? */ | 1249 | |
1250 | len = max_t(int, skb->len - ETH_HLEN, ETH_ZLEN - ETH_HLEN); | 1250 | err = orinoco_process_xmit_skb(skb, dev, priv, &tx_control, |
1251 | 1251 | &mic[0]); | |
1252 | eh = (struct ethhdr *) skb->data; | 1252 | if (err) |
1253 | 1253 | goto drop; | |
1254 | tx_control = cpu_to_le16(0); | 1254 | |
1255 | memcpy(buf, &tx_control, sizeof(tx_control)); | 1255 | { |
1256 | buf += sizeof(tx_control); | 1256 | __le16 *tx_cntl = (__le16 *)buf; |
1257 | /* Encapsulate Ethernet-II frames */ | 1257 | *tx_cntl = cpu_to_le16(tx_control); |
1258 | if (ntohs(eh->h_proto) > ETH_DATA_LEN) { /* Ethernet-II frame */ | 1258 | buf += sizeof(*tx_cntl); |
1259 | struct header_struct *hdr = (void *) buf; | ||
1260 | buf += sizeof(*hdr); | ||
1261 | data_len = len; | ||
1262 | data_off = sizeof(tx_control) + sizeof(*hdr); | ||
1263 | p = skb->data + ETH_HLEN; | ||
1264 | |||
1265 | /* 802.3 header */ | ||
1266 | memcpy(hdr->dest, eh->h_dest, ETH_ALEN); | ||
1267 | memcpy(hdr->src, eh->h_source, ETH_ALEN); | ||
1268 | hdr->len = htons(data_len + ENCAPS_OVERHEAD); | ||
1269 | |||
1270 | /* 802.2 header */ | ||
1271 | memcpy(&hdr->dsap, &encaps_hdr, sizeof(encaps_hdr)); | ||
1272 | |||
1273 | hdr->ethertype = eh->h_proto; | ||
1274 | } else { /* IEEE 802.3 frame */ | ||
1275 | data_len = len + ETH_HLEN; | ||
1276 | data_off = sizeof(tx_control); | ||
1277 | p = skb->data; | ||
1278 | } | 1259 | } |
1279 | 1260 | ||
1280 | memcpy(buf, p, data_len); | 1261 | memcpy(buf, skb->data, skb->len); |
1281 | buf += data_len; | 1262 | buf += skb->len; |
1263 | |||
1264 | if (tx_control & HERMES_TXCTRL_MIC) { | ||
1265 | u8 *m = mic; | ||
1266 | /* Mic has been offset so it can be copied to an even | ||
1267 | * address. We're copying eveything anyway, so we | ||
1268 | * don't need to copy that first byte. */ | ||
1269 | if (skb->len % 2) | ||
1270 | m++; | ||
1271 | memcpy(buf, m, MICHAEL_MIC_LEN); | ||
1272 | buf += MICHAEL_MIC_LEN; | ||
1273 | } | ||
1282 | 1274 | ||
1283 | /* Finally, we actually initiate the send */ | 1275 | /* Finally, we actually initiate the send */ |
1284 | netif_stop_queue(dev); | 1276 | netif_stop_queue(dev); |
@@ -1294,20 +1286,23 @@ static netdev_tx_t ezusb_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1294 | if (net_ratelimit()) | 1286 | if (net_ratelimit()) |
1295 | printk(KERN_ERR "%s: Error %d transmitting packet\n", | 1287 | printk(KERN_ERR "%s: Error %d transmitting packet\n", |
1296 | dev->name, err); | 1288 | dev->name, err); |
1297 | stats->tx_errors++; | 1289 | goto busy; |
1298 | goto fail; | ||
1299 | } | 1290 | } |
1300 | 1291 | ||
1301 | dev->trans_start = jiffies; | 1292 | dev->trans_start = jiffies; |
1302 | stats->tx_bytes += data_off + data_len; | 1293 | stats->tx_bytes += skb->len; |
1294 | goto ok; | ||
1303 | 1295 | ||
1304 | orinoco_unlock(priv, &flags); | 1296 | drop: |
1297 | stats->tx_errors++; | ||
1298 | stats->tx_dropped++; | ||
1305 | 1299 | ||
1300 | ok: | ||
1301 | orinoco_unlock(priv, &flags); | ||
1306 | dev_kfree_skb(skb); | 1302 | dev_kfree_skb(skb); |
1307 | |||
1308 | return NETDEV_TX_OK; | 1303 | return NETDEV_TX_OK; |
1309 | 1304 | ||
1310 | fail: | 1305 | busy: |
1311 | orinoco_unlock(priv, &flags); | 1306 | orinoco_unlock(priv, &flags); |
1312 | return NETDEV_TX_BUSY; | 1307 | return NETDEV_TX_BUSY; |
1313 | } | 1308 | } |
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c index babdcdf6d71d..2d2890878dea 100644 --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c | |||
@@ -535,7 +535,7 @@ static int rndis_join_ibss(struct wiphy *wiphy, struct net_device *dev, | |||
535 | 535 | ||
536 | static int rndis_leave_ibss(struct wiphy *wiphy, struct net_device *dev); | 536 | static int rndis_leave_ibss(struct wiphy *wiphy, struct net_device *dev); |
537 | 537 | ||
538 | static int rndis_set_channel(struct wiphy *wiphy, | 538 | static int rndis_set_channel(struct wiphy *wiphy, struct net_device *dev, |
539 | struct ieee80211_channel *chan, enum nl80211_channel_type channel_type); | 539 | struct ieee80211_channel *chan, enum nl80211_channel_type channel_type); |
540 | 540 | ||
541 | static int rndis_add_key(struct wiphy *wiphy, struct net_device *netdev, | 541 | static int rndis_add_key(struct wiphy *wiphy, struct net_device *netdev, |
@@ -2291,7 +2291,7 @@ static int rndis_leave_ibss(struct wiphy *wiphy, struct net_device *dev) | |||
2291 | return deauthenticate(usbdev); | 2291 | return deauthenticate(usbdev); |
2292 | } | 2292 | } |
2293 | 2293 | ||
2294 | static int rndis_set_channel(struct wiphy *wiphy, | 2294 | static int rndis_set_channel(struct wiphy *wiphy, struct net_device *netdev, |
2295 | struct ieee80211_channel *chan, enum nl80211_channel_type channel_type) | 2295 | struct ieee80211_channel *chan, enum nl80211_channel_type channel_type) |
2296 | { | 2296 | { |
2297 | struct rndis_wlan_private *priv = wiphy_priv(wiphy); | 2297 | struct rndis_wlan_private *priv = wiphy_priv(wiphy); |
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index 06b92f8b7a55..6126c0ab5880 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c | |||
@@ -1060,7 +1060,8 @@ static void rt2400pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1060 | /* | 1060 | /* |
1061 | * TX data initialization | 1061 | * TX data initialization |
1062 | */ | 1062 | */ |
1063 | static void rt2400pci_write_beacon(struct queue_entry *entry) | 1063 | static void rt2400pci_write_beacon(struct queue_entry *entry, |
1064 | struct txentry_desc *txdesc) | ||
1064 | { | 1065 | { |
1065 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 1066 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
1066 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; | 1067 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; |
@@ -1090,6 +1091,14 @@ static void rt2400pci_write_beacon(struct queue_entry *entry) | |||
1090 | rt2x00_desc_read(entry_priv->desc, 1, &word); | 1091 | rt2x00_desc_read(entry_priv->desc, 1, &word); |
1091 | rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma); | 1092 | rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma); |
1092 | rt2x00_desc_write(entry_priv->desc, 1, word); | 1093 | rt2x00_desc_write(entry_priv->desc, 1, word); |
1094 | |||
1095 | /* | ||
1096 | * Enable beaconing again. | ||
1097 | */ | ||
1098 | rt2x00_set_field32(®, CSR14_TSF_COUNT, 1); | ||
1099 | rt2x00_set_field32(®, CSR14_TBCN, 1); | ||
1100 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 1); | ||
1101 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | ||
1093 | } | 1102 | } |
1094 | 1103 | ||
1095 | static void rt2400pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | 1104 | static void rt2400pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, |
@@ -1097,17 +1106,6 @@ static void rt2400pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | |||
1097 | { | 1106 | { |
1098 | u32 reg; | 1107 | u32 reg; |
1099 | 1108 | ||
1100 | if (queue == QID_BEACON) { | ||
1101 | rt2x00pci_register_read(rt2x00dev, CSR14, ®); | ||
1102 | if (!rt2x00_get_field32(reg, CSR14_BEACON_GEN)) { | ||
1103 | rt2x00_set_field32(®, CSR14_TSF_COUNT, 1); | ||
1104 | rt2x00_set_field32(®, CSR14_TBCN, 1); | ||
1105 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 1); | ||
1106 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | ||
1107 | } | ||
1108 | return; | ||
1109 | } | ||
1110 | |||
1111 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | 1109 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); |
1112 | rt2x00_set_field32(®, TXCSR0_KICK_PRIO, (queue == QID_AC_BE)); | 1110 | rt2x00_set_field32(®, TXCSR0_KICK_PRIO, (queue == QID_AC_BE)); |
1113 | rt2x00_set_field32(®, TXCSR0_KICK_TX, (queue == QID_AC_BK)); | 1111 | rt2x00_set_field32(®, TXCSR0_KICK_TX, (queue == QID_AC_BK)); |
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index ae8e205df269..2e4f461406ae 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -1217,7 +1217,8 @@ static void rt2500pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1217 | /* | 1217 | /* |
1218 | * TX data initialization | 1218 | * TX data initialization |
1219 | */ | 1219 | */ |
1220 | static void rt2500pci_write_beacon(struct queue_entry *entry) | 1220 | static void rt2500pci_write_beacon(struct queue_entry *entry, |
1221 | struct txentry_desc *txdesc) | ||
1221 | { | 1222 | { |
1222 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 1223 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
1223 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; | 1224 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; |
@@ -1247,6 +1248,14 @@ static void rt2500pci_write_beacon(struct queue_entry *entry) | |||
1247 | rt2x00_desc_read(entry_priv->desc, 1, &word); | 1248 | rt2x00_desc_read(entry_priv->desc, 1, &word); |
1248 | rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma); | 1249 | rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma); |
1249 | rt2x00_desc_write(entry_priv->desc, 1, word); | 1250 | rt2x00_desc_write(entry_priv->desc, 1, word); |
1251 | |||
1252 | /* | ||
1253 | * Enable beaconing again. | ||
1254 | */ | ||
1255 | rt2x00_set_field32(®, CSR14_TSF_COUNT, 1); | ||
1256 | rt2x00_set_field32(®, CSR14_TBCN, 1); | ||
1257 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 1); | ||
1258 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | ||
1250 | } | 1259 | } |
1251 | 1260 | ||
1252 | static void rt2500pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | 1261 | static void rt2500pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, |
@@ -1254,17 +1263,6 @@ static void rt2500pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | |||
1254 | { | 1263 | { |
1255 | u32 reg; | 1264 | u32 reg; |
1256 | 1265 | ||
1257 | if (queue == QID_BEACON) { | ||
1258 | rt2x00pci_register_read(rt2x00dev, CSR14, ®); | ||
1259 | if (!rt2x00_get_field32(reg, CSR14_BEACON_GEN)) { | ||
1260 | rt2x00_set_field32(®, CSR14_TSF_COUNT, 1); | ||
1261 | rt2x00_set_field32(®, CSR14_TBCN, 1); | ||
1262 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 1); | ||
1263 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | ||
1264 | } | ||
1265 | return; | ||
1266 | } | ||
1267 | |||
1268 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | 1266 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); |
1269 | rt2x00_set_field32(®, TXCSR0_KICK_PRIO, (queue == QID_AC_BE)); | 1267 | rt2x00_set_field32(®, TXCSR0_KICK_PRIO, (queue == QID_AC_BE)); |
1270 | rt2x00_set_field32(®, TXCSR0_KICK_TX, (queue == QID_AC_BK)); | 1268 | rt2x00_set_field32(®, TXCSR0_KICK_TX, (queue == QID_AC_BK)); |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 41d9996c80e6..e88d7033fbc9 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -1083,7 +1083,8 @@ static void rt2500usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1083 | */ | 1083 | */ |
1084 | static void rt2500usb_beacondone(struct urb *urb); | 1084 | static void rt2500usb_beacondone(struct urb *urb); |
1085 | 1085 | ||
1086 | static void rt2500usb_write_beacon(struct queue_entry *entry) | 1086 | static void rt2500usb_write_beacon(struct queue_entry *entry, |
1087 | struct txentry_desc *txdesc) | ||
1087 | { | 1088 | { |
1088 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 1089 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
1089 | struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); | 1090 | struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); |
@@ -1091,7 +1092,7 @@ static void rt2500usb_write_beacon(struct queue_entry *entry) | |||
1091 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | 1092 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); |
1092 | int pipe = usb_sndbulkpipe(usb_dev, entry->queue->usb_endpoint); | 1093 | int pipe = usb_sndbulkpipe(usb_dev, entry->queue->usb_endpoint); |
1093 | int length; | 1094 | int length; |
1094 | u16 reg; | 1095 | u16 reg, reg0; |
1095 | 1096 | ||
1096 | /* | 1097 | /* |
1097 | * Add the descriptor in front of the skb. | 1098 | * Add the descriptor in front of the skb. |
@@ -1133,6 +1134,26 @@ static void rt2500usb_write_beacon(struct queue_entry *entry) | |||
1133 | * Send out the guardian byte. | 1134 | * Send out the guardian byte. |
1134 | */ | 1135 | */ |
1135 | usb_submit_urb(bcn_priv->guardian_urb, GFP_ATOMIC); | 1136 | usb_submit_urb(bcn_priv->guardian_urb, GFP_ATOMIC); |
1137 | |||
1138 | /* | ||
1139 | * Enable beaconing again. | ||
1140 | */ | ||
1141 | rt2x00_set_field16(®, TXRX_CSR19_TSF_COUNT, 1); | ||
1142 | rt2x00_set_field16(®, TXRX_CSR19_TBCN, 1); | ||
1143 | reg0 = reg; | ||
1144 | rt2x00_set_field16(®, TXRX_CSR19_BEACON_GEN, 1); | ||
1145 | /* | ||
1146 | * Beacon generation will fail initially. | ||
1147 | * To prevent this we need to change the TXRX_CSR19 | ||
1148 | * register several times (reg0 is the same as reg | ||
1149 | * except for TXRX_CSR19_BEACON_GEN, which is 0 in reg0 | ||
1150 | * and 1 in reg). | ||
1151 | */ | ||
1152 | rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); | ||
1153 | rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg0); | ||
1154 | rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); | ||
1155 | rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg0); | ||
1156 | rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); | ||
1136 | } | 1157 | } |
1137 | 1158 | ||
1138 | static int rt2500usb_get_tx_data_len(struct queue_entry *entry) | 1159 | static int rt2500usb_get_tx_data_len(struct queue_entry *entry) |
@@ -1149,37 +1170,6 @@ static int rt2500usb_get_tx_data_len(struct queue_entry *entry) | |||
1149 | return length; | 1170 | return length; |
1150 | } | 1171 | } |
1151 | 1172 | ||
1152 | static void rt2500usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | ||
1153 | const enum data_queue_qid queue) | ||
1154 | { | ||
1155 | u16 reg, reg0; | ||
1156 | |||
1157 | if (queue != QID_BEACON) { | ||
1158 | rt2x00usb_kick_tx_queue(rt2x00dev, queue); | ||
1159 | return; | ||
1160 | } | ||
1161 | |||
1162 | rt2500usb_register_read(rt2x00dev, TXRX_CSR19, ®); | ||
1163 | if (!rt2x00_get_field16(reg, TXRX_CSR19_BEACON_GEN)) { | ||
1164 | rt2x00_set_field16(®, TXRX_CSR19_TSF_COUNT, 1); | ||
1165 | rt2x00_set_field16(®, TXRX_CSR19_TBCN, 1); | ||
1166 | reg0 = reg; | ||
1167 | rt2x00_set_field16(®, TXRX_CSR19_BEACON_GEN, 1); | ||
1168 | /* | ||
1169 | * Beacon generation will fail initially. | ||
1170 | * To prevent this we need to change the TXRX_CSR19 | ||
1171 | * register several times (reg0 is the same as reg | ||
1172 | * except for TXRX_CSR19_BEACON_GEN, which is 0 in reg0 | ||
1173 | * and 1 in reg). | ||
1174 | */ | ||
1175 | rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); | ||
1176 | rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg0); | ||
1177 | rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); | ||
1178 | rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg0); | ||
1179 | rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); | ||
1180 | } | ||
1181 | } | ||
1182 | |||
1183 | /* | 1173 | /* |
1184 | * RX control handlers | 1174 | * RX control handlers |
1185 | */ | 1175 | */ |
@@ -1214,11 +1204,9 @@ static void rt2500usb_fill_rxdone(struct queue_entry *entry, | |||
1214 | if (rt2x00_get_field32(word0, RXD_W0_PHYSICAL_ERROR)) | 1204 | if (rt2x00_get_field32(word0, RXD_W0_PHYSICAL_ERROR)) |
1215 | rxdesc->flags |= RX_FLAG_FAILED_PLCP_CRC; | 1205 | rxdesc->flags |= RX_FLAG_FAILED_PLCP_CRC; |
1216 | 1206 | ||
1217 | if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) { | 1207 | rxdesc->cipher = rt2x00_get_field32(word0, RXD_W0_CIPHER); |
1218 | rxdesc->cipher = rt2x00_get_field32(word0, RXD_W0_CIPHER); | 1208 | if (rt2x00_get_field32(word0, RXD_W0_CIPHER_ERROR)) |
1219 | if (rt2x00_get_field32(word0, RXD_W0_CIPHER_ERROR)) | 1209 | rxdesc->cipher_status = RX_CRYPTO_FAIL_KEY; |
1220 | rxdesc->cipher_status = RX_CRYPTO_FAIL_KEY; | ||
1221 | } | ||
1222 | 1210 | ||
1223 | if (rxdesc->cipher != CIPHER_NONE) { | 1211 | if (rxdesc->cipher != CIPHER_NONE) { |
1224 | _rt2x00_desc_read(rxd, 2, &rxdesc->iv[0]); | 1212 | _rt2x00_desc_read(rxd, 2, &rxdesc->iv[0]); |
@@ -1780,7 +1768,7 @@ static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = { | |||
1780 | .write_tx_data = rt2x00usb_write_tx_data, | 1768 | .write_tx_data = rt2x00usb_write_tx_data, |
1781 | .write_beacon = rt2500usb_write_beacon, | 1769 | .write_beacon = rt2500usb_write_beacon, |
1782 | .get_tx_data_len = rt2500usb_get_tx_data_len, | 1770 | .get_tx_data_len = rt2500usb_get_tx_data_len, |
1783 | .kick_tx_queue = rt2500usb_kick_tx_queue, | 1771 | .kick_tx_queue = rt2x00usb_kick_tx_queue, |
1784 | .kill_tx_queue = rt2x00usb_kill_tx_queue, | 1772 | .kill_tx_queue = rt2x00usb_kill_tx_queue, |
1785 | .fill_rxdone = rt2500usb_fill_rxdone, | 1773 | .fill_rxdone = rt2500usb_fill_rxdone, |
1786 | .config_shared_key = rt2500usb_config_key, | 1774 | .config_shared_key = rt2500usb_config_key, |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index e37bbeab9233..db4250d1c8b3 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -282,6 +282,104 @@ int rt2800_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev) | |||
282 | } | 282 | } |
283 | EXPORT_SYMBOL_GPL(rt2800_wait_wpdma_ready); | 283 | EXPORT_SYMBOL_GPL(rt2800_wait_wpdma_ready); |
284 | 284 | ||
285 | void rt2800_write_txwi(struct sk_buff *skb, struct txentry_desc *txdesc) | ||
286 | { | ||
287 | __le32 *txwi = (__le32 *)(skb->data - TXWI_DESC_SIZE); | ||
288 | u32 word; | ||
289 | |||
290 | /* | ||
291 | * Initialize TX Info descriptor | ||
292 | */ | ||
293 | rt2x00_desc_read(txwi, 0, &word); | ||
294 | rt2x00_set_field32(&word, TXWI_W0_FRAG, | ||
295 | test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); | ||
296 | rt2x00_set_field32(&word, TXWI_W0_MIMO_PS, 0); | ||
297 | rt2x00_set_field32(&word, TXWI_W0_CF_ACK, 0); | ||
298 | rt2x00_set_field32(&word, TXWI_W0_TS, | ||
299 | test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags)); | ||
300 | rt2x00_set_field32(&word, TXWI_W0_AMPDU, | ||
301 | test_bit(ENTRY_TXD_HT_AMPDU, &txdesc->flags)); | ||
302 | rt2x00_set_field32(&word, TXWI_W0_MPDU_DENSITY, txdesc->mpdu_density); | ||
303 | rt2x00_set_field32(&word, TXWI_W0_TX_OP, txdesc->txop); | ||
304 | rt2x00_set_field32(&word, TXWI_W0_MCS, txdesc->mcs); | ||
305 | rt2x00_set_field32(&word, TXWI_W0_BW, | ||
306 | test_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags)); | ||
307 | rt2x00_set_field32(&word, TXWI_W0_SHORT_GI, | ||
308 | test_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags)); | ||
309 | rt2x00_set_field32(&word, TXWI_W0_STBC, txdesc->stbc); | ||
310 | rt2x00_set_field32(&word, TXWI_W0_PHYMODE, txdesc->rate_mode); | ||
311 | rt2x00_desc_write(txwi, 0, word); | ||
312 | |||
313 | rt2x00_desc_read(txwi, 1, &word); | ||
314 | rt2x00_set_field32(&word, TXWI_W1_ACK, | ||
315 | test_bit(ENTRY_TXD_ACK, &txdesc->flags)); | ||
316 | rt2x00_set_field32(&word, TXWI_W1_NSEQ, | ||
317 | test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags)); | ||
318 | rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size); | ||
319 | rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID, | ||
320 | test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ? | ||
321 | txdesc->key_idx : 0xff); | ||
322 | rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, | ||
323 | txdesc->length); | ||
324 | rt2x00_set_field32(&word, TXWI_W1_PACKETID, txdesc->queue + 1); | ||
325 | rt2x00_desc_write(txwi, 1, word); | ||
326 | |||
327 | /* | ||
328 | * Always write 0 to IV/EIV fields, hardware will insert the IV | ||
329 | * from the IVEIV register when TXD_W3_WIV is set to 0. | ||
330 | * When TXD_W3_WIV is set to 1 it will use the IV data | ||
331 | * from the descriptor. The TXWI_W1_WIRELESS_CLI_ID indicates which | ||
332 | * crypto entry in the registers should be used to encrypt the frame. | ||
333 | */ | ||
334 | _rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */); | ||
335 | _rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */); | ||
336 | } | ||
337 | EXPORT_SYMBOL_GPL(rt2800_write_txwi); | ||
338 | |||
339 | void rt2800_process_rxwi(struct sk_buff *skb, struct rxdone_entry_desc *rxdesc) | ||
340 | { | ||
341 | __le32 *rxwi = (__le32 *) skb->data; | ||
342 | u32 word; | ||
343 | |||
344 | rt2x00_desc_read(rxwi, 0, &word); | ||
345 | |||
346 | rxdesc->cipher = rt2x00_get_field32(word, RXWI_W0_UDF); | ||
347 | rxdesc->size = rt2x00_get_field32(word, RXWI_W0_MPDU_TOTAL_BYTE_COUNT); | ||
348 | |||
349 | rt2x00_desc_read(rxwi, 1, &word); | ||
350 | |||
351 | if (rt2x00_get_field32(word, RXWI_W1_SHORT_GI)) | ||
352 | rxdesc->flags |= RX_FLAG_SHORT_GI; | ||
353 | |||
354 | if (rt2x00_get_field32(word, RXWI_W1_BW)) | ||
355 | rxdesc->flags |= RX_FLAG_40MHZ; | ||
356 | |||
357 | /* | ||
358 | * Detect RX rate, always use MCS as signal type. | ||
359 | */ | ||
360 | rxdesc->dev_flags |= RXDONE_SIGNAL_MCS; | ||
361 | rxdesc->signal = rt2x00_get_field32(word, RXWI_W1_MCS); | ||
362 | rxdesc->rate_mode = rt2x00_get_field32(word, RXWI_W1_PHYMODE); | ||
363 | |||
364 | /* | ||
365 | * Mask of 0x8 bit to remove the short preamble flag. | ||
366 | */ | ||
367 | if (rxdesc->rate_mode == RATE_MODE_CCK) | ||
368 | rxdesc->signal &= ~0x8; | ||
369 | |||
370 | rt2x00_desc_read(rxwi, 2, &word); | ||
371 | |||
372 | rxdesc->rssi = | ||
373 | (rt2x00_get_field32(word, RXWI_W2_RSSI0) + | ||
374 | rt2x00_get_field32(word, RXWI_W2_RSSI1)) / 2; | ||
375 | |||
376 | /* | ||
377 | * Remove RXWI descriptor from start of buffer. | ||
378 | */ | ||
379 | skb_pull(skb, RXWI_DESC_SIZE); | ||
380 | } | ||
381 | EXPORT_SYMBOL_GPL(rt2800_process_rxwi); | ||
382 | |||
285 | #ifdef CONFIG_RT2X00_LIB_DEBUGFS | 383 | #ifdef CONFIG_RT2X00_LIB_DEBUGFS |
286 | const struct rt2x00debug rt2800_rt2x00debug = { | 384 | const struct rt2x00debug rt2800_rt2x00debug = { |
287 | .owner = THIS_MODULE, | 385 | .owner = THIS_MODULE, |
@@ -640,8 +738,6 @@ void rt2800_config_erp(struct rt2x00_dev *rt2x00dev, struct rt2x00lib_erp *erp) | |||
640 | rt2800_register_write(rt2x00dev, BKOFF_SLOT_CFG, reg); | 738 | rt2800_register_write(rt2x00dev, BKOFF_SLOT_CFG, reg); |
641 | 739 | ||
642 | rt2800_register_read(rt2x00dev, XIFS_TIME_CFG, ®); | 740 | rt2800_register_read(rt2x00dev, XIFS_TIME_CFG, ®); |
643 | rt2x00_set_field32(®, XIFS_TIME_CFG_CCKM_SIFS_TIME, erp->sifs); | ||
644 | rt2x00_set_field32(®, XIFS_TIME_CFG_OFDM_SIFS_TIME, erp->sifs); | ||
645 | rt2x00_set_field32(®, XIFS_TIME_CFG_EIFS, erp->eifs); | 741 | rt2x00_set_field32(®, XIFS_TIME_CFG_EIFS, erp->eifs); |
646 | rt2800_register_write(rt2x00dev, XIFS_TIME_CFG, reg); | 742 | rt2800_register_write(rt2x00dev, XIFS_TIME_CFG, reg); |
647 | 743 | ||
@@ -1415,9 +1511,16 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) | |||
1415 | 1511 | ||
1416 | rt2800_register_write(rt2x00dev, EXP_ACK_TIME, 0x002400ca); | 1512 | rt2800_register_write(rt2x00dev, EXP_ACK_TIME, 0x002400ca); |
1417 | 1513 | ||
1514 | /* | ||
1515 | * Usually the CCK SIFS time should be set to 10 and the OFDM SIFS | ||
1516 | * time should be set to 16. However, the original Ralink driver uses | ||
1517 | * 16 for both and indeed using a value of 10 for CCK SIFS results in | ||
1518 | * connection problems with 11g + CTS protection. Hence, use the same | ||
1519 | * defaults as the Ralink driver: 16 for both, CCK and OFDM SIFS. | ||
1520 | */ | ||
1418 | rt2800_register_read(rt2x00dev, XIFS_TIME_CFG, ®); | 1521 | rt2800_register_read(rt2x00dev, XIFS_TIME_CFG, ®); |
1419 | rt2x00_set_field32(®, XIFS_TIME_CFG_CCKM_SIFS_TIME, 32); | 1522 | rt2x00_set_field32(®, XIFS_TIME_CFG_CCKM_SIFS_TIME, 16); |
1420 | rt2x00_set_field32(®, XIFS_TIME_CFG_OFDM_SIFS_TIME, 32); | 1523 | rt2x00_set_field32(®, XIFS_TIME_CFG_OFDM_SIFS_TIME, 16); |
1421 | rt2x00_set_field32(®, XIFS_TIME_CFG_OFDM_XIFS_TIME, 4); | 1524 | rt2x00_set_field32(®, XIFS_TIME_CFG_OFDM_XIFS_TIME, 4); |
1422 | rt2x00_set_field32(®, XIFS_TIME_CFG_EIFS, 314); | 1525 | rt2x00_set_field32(®, XIFS_TIME_CFG_EIFS, 314); |
1423 | rt2x00_set_field32(®, XIFS_TIME_CFG_BB_RXEND_ENABLE, 1); | 1526 | rt2x00_set_field32(®, XIFS_TIME_CFG_BB_RXEND_ENABLE, 1); |
@@ -2219,7 +2322,7 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
2219 | EXPORT_SYMBOL_GPL(rt2800_init_eeprom); | 2322 | EXPORT_SYMBOL_GPL(rt2800_init_eeprom); |
2220 | 2323 | ||
2221 | /* | 2324 | /* |
2222 | * RF value list for rt28x0 | 2325 | * RF value list for rt28xx |
2223 | * Supports: 2.4 GHz (all) & 5.2 GHz (RF2850 & RF2750) | 2326 | * Supports: 2.4 GHz (all) & 5.2 GHz (RF2850 & RF2750) |
2224 | */ | 2327 | */ |
2225 | static const struct rf_channel rf_vals[] = { | 2328 | static const struct rf_channel rf_vals[] = { |
@@ -2294,10 +2397,10 @@ static const struct rf_channel rf_vals[] = { | |||
2294 | }; | 2397 | }; |
2295 | 2398 | ||
2296 | /* | 2399 | /* |
2297 | * RF value list for rt3070 | 2400 | * RF value list for rt3xxx |
2298 | * Supports: 2.4 GHz | 2401 | * Supports: 2.4 GHz (all) & 5.2 GHz (RF3052) |
2299 | */ | 2402 | */ |
2300 | static const struct rf_channel rf_vals_302x[] = { | 2403 | static const struct rf_channel rf_vals_3x[] = { |
2301 | {1, 241, 2, 2 }, | 2404 | {1, 241, 2, 2 }, |
2302 | {2, 241, 2, 7 }, | 2405 | {2, 241, 2, 7 }, |
2303 | {3, 242, 2, 2 }, | 2406 | {3, 242, 2, 2 }, |
@@ -2312,6 +2415,51 @@ static const struct rf_channel rf_vals_302x[] = { | |||
2312 | {12, 246, 2, 7 }, | 2415 | {12, 246, 2, 7 }, |
2313 | {13, 247, 2, 2 }, | 2416 | {13, 247, 2, 2 }, |
2314 | {14, 248, 2, 4 }, | 2417 | {14, 248, 2, 4 }, |
2418 | |||
2419 | /* 802.11 UNI / HyperLan 2 */ | ||
2420 | {36, 0x56, 0, 4}, | ||
2421 | {38, 0x56, 0, 6}, | ||
2422 | {40, 0x56, 0, 8}, | ||
2423 | {44, 0x57, 0, 0}, | ||
2424 | {46, 0x57, 0, 2}, | ||
2425 | {48, 0x57, 0, 4}, | ||
2426 | {52, 0x57, 0, 8}, | ||
2427 | {54, 0x57, 0, 10}, | ||
2428 | {56, 0x58, 0, 0}, | ||
2429 | {60, 0x58, 0, 4}, | ||
2430 | {62, 0x58, 0, 6}, | ||
2431 | {64, 0x58, 0, 8}, | ||
2432 | |||
2433 | /* 802.11 HyperLan 2 */ | ||
2434 | {100, 0x5b, 0, 8}, | ||
2435 | {102, 0x5b, 0, 10}, | ||
2436 | {104, 0x5c, 0, 0}, | ||
2437 | {108, 0x5c, 0, 4}, | ||
2438 | {110, 0x5c, 0, 6}, | ||
2439 | {112, 0x5c, 0, 8}, | ||
2440 | {116, 0x5d, 0, 0}, | ||
2441 | {118, 0x5d, 0, 2}, | ||
2442 | {120, 0x5d, 0, 4}, | ||
2443 | {124, 0x5d, 0, 8}, | ||
2444 | {126, 0x5d, 0, 10}, | ||
2445 | {128, 0x5e, 0, 0}, | ||
2446 | {132, 0x5e, 0, 4}, | ||
2447 | {134, 0x5e, 0, 6}, | ||
2448 | {136, 0x5e, 0, 8}, | ||
2449 | {140, 0x5f, 0, 0}, | ||
2450 | |||
2451 | /* 802.11 UNII */ | ||
2452 | {149, 0x5f, 0, 9}, | ||
2453 | {151, 0x5f, 0, 11}, | ||
2454 | {153, 0x60, 0, 1}, | ||
2455 | {157, 0x60, 0, 5}, | ||
2456 | {159, 0x60, 0, 7}, | ||
2457 | {161, 0x60, 0, 9}, | ||
2458 | {165, 0x61, 0, 1}, | ||
2459 | {167, 0x61, 0, 3}, | ||
2460 | {169, 0x61, 0, 5}, | ||
2461 | {171, 0x61, 0, 7}, | ||
2462 | {173, 0x61, 0, 9}, | ||
2315 | }; | 2463 | }; |
2316 | 2464 | ||
2317 | int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | 2465 | int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) |
@@ -2352,11 +2500,11 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2352 | spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; | 2500 | spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; |
2353 | 2501 | ||
2354 | if (rt2x00_rf(rt2x00dev, RF2820) || | 2502 | if (rt2x00_rf(rt2x00dev, RF2820) || |
2355 | rt2x00_rf(rt2x00dev, RF2720) || | 2503 | rt2x00_rf(rt2x00dev, RF2720)) { |
2356 | rt2x00_rf(rt2x00dev, RF3052)) { | ||
2357 | spec->num_channels = 14; | 2504 | spec->num_channels = 14; |
2358 | spec->channels = rf_vals; | 2505 | spec->channels = rf_vals; |
2359 | } else if (rt2x00_rf(rt2x00dev, RF2850) || rt2x00_rf(rt2x00dev, RF2750)) { | 2506 | } else if (rt2x00_rf(rt2x00dev, RF2850) || |
2507 | rt2x00_rf(rt2x00dev, RF2750)) { | ||
2360 | spec->supported_bands |= SUPPORT_BAND_5GHZ; | 2508 | spec->supported_bands |= SUPPORT_BAND_5GHZ; |
2361 | spec->num_channels = ARRAY_SIZE(rf_vals); | 2509 | spec->num_channels = ARRAY_SIZE(rf_vals); |
2362 | spec->channels = rf_vals; | 2510 | spec->channels = rf_vals; |
@@ -2364,8 +2512,12 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2364 | rt2x00_rf(rt2x00dev, RF2020) || | 2512 | rt2x00_rf(rt2x00dev, RF2020) || |
2365 | rt2x00_rf(rt2x00dev, RF3021) || | 2513 | rt2x00_rf(rt2x00dev, RF3021) || |
2366 | rt2x00_rf(rt2x00dev, RF3022)) { | 2514 | rt2x00_rf(rt2x00dev, RF3022)) { |
2367 | spec->num_channels = ARRAY_SIZE(rf_vals_302x); | 2515 | spec->num_channels = 14; |
2368 | spec->channels = rf_vals_302x; | 2516 | spec->channels = rf_vals_3x; |
2517 | } else if (rt2x00_rf(rt2x00dev, RF3052)) { | ||
2518 | spec->supported_bands |= SUPPORT_BAND_5GHZ; | ||
2519 | spec->num_channels = ARRAY_SIZE(rf_vals_3x); | ||
2520 | spec->channels = rf_vals_3x; | ||
2369 | } | 2521 | } |
2370 | 2522 | ||
2371 | /* | 2523 | /* |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.h b/drivers/net/wireless/rt2x00/rt2800lib.h index ebabeae62d1b..94de999e2290 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.h +++ b/drivers/net/wireless/rt2x00/rt2800lib.h | |||
@@ -111,6 +111,9 @@ void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev, | |||
111 | const u8 command, const u8 token, | 111 | const u8 command, const u8 token, |
112 | const u8 arg0, const u8 arg1); | 112 | const u8 arg0, const u8 arg1); |
113 | 113 | ||
114 | void rt2800_write_txwi(struct sk_buff *skb, struct txentry_desc *txdesc); | ||
115 | void rt2800_process_rxwi(struct sk_buff *skb, struct rxdone_entry_desc *txdesc); | ||
116 | |||
114 | extern const struct rt2x00debug rt2800_rt2x00debug; | 117 | extern const struct rt2x00debug rt2800_rt2x00debug; |
115 | 118 | ||
116 | int rt2800_rfkill_poll(struct rt2x00_dev *rt2x00dev); | 119 | int rt2800_rfkill_poll(struct rt2x00_dev *rt2x00dev); |
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index f08b6a37bf2d..7d4778d66e77 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -616,67 +616,13 @@ static int rt2800pci_set_device_state(struct rt2x00_dev *rt2x00dev, | |||
616 | static int rt2800pci_write_tx_data(struct queue_entry* entry, | 616 | static int rt2800pci_write_tx_data(struct queue_entry* entry, |
617 | struct txentry_desc *txdesc) | 617 | struct txentry_desc *txdesc) |
618 | { | 618 | { |
619 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | ||
620 | struct sk_buff *skb = entry->skb; | ||
621 | struct skb_frame_desc *skbdesc; | ||
622 | int ret; | 619 | int ret; |
623 | __le32 *txwi; | ||
624 | u32 word; | ||
625 | 620 | ||
626 | ret = rt2x00pci_write_tx_data(entry, txdesc); | 621 | ret = rt2x00pci_write_tx_data(entry, txdesc); |
627 | if (ret) | 622 | if (ret) |
628 | return ret; | 623 | return ret; |
629 | 624 | ||
630 | skbdesc = get_skb_frame_desc(skb); | 625 | rt2800_write_txwi(entry->skb, txdesc); |
631 | txwi = (__le32 *)(skb->data - rt2x00dev->ops->extra_tx_headroom); | ||
632 | |||
633 | /* | ||
634 | * Initialize TX Info descriptor | ||
635 | */ | ||
636 | rt2x00_desc_read(txwi, 0, &word); | ||
637 | rt2x00_set_field32(&word, TXWI_W0_FRAG, | ||
638 | test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); | ||
639 | rt2x00_set_field32(&word, TXWI_W0_MIMO_PS, 0); | ||
640 | rt2x00_set_field32(&word, TXWI_W0_CF_ACK, 0); | ||
641 | rt2x00_set_field32(&word, TXWI_W0_TS, | ||
642 | test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags)); | ||
643 | rt2x00_set_field32(&word, TXWI_W0_AMPDU, | ||
644 | test_bit(ENTRY_TXD_HT_AMPDU, &txdesc->flags)); | ||
645 | rt2x00_set_field32(&word, TXWI_W0_MPDU_DENSITY, txdesc->mpdu_density); | ||
646 | rt2x00_set_field32(&word, TXWI_W0_TX_OP, txdesc->ifs); | ||
647 | rt2x00_set_field32(&word, TXWI_W0_MCS, txdesc->mcs); | ||
648 | rt2x00_set_field32(&word, TXWI_W0_BW, | ||
649 | test_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags)); | ||
650 | rt2x00_set_field32(&word, TXWI_W0_SHORT_GI, | ||
651 | test_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags)); | ||
652 | rt2x00_set_field32(&word, TXWI_W0_STBC, txdesc->stbc); | ||
653 | rt2x00_set_field32(&word, TXWI_W0_PHYMODE, txdesc->rate_mode); | ||
654 | rt2x00_desc_write(txwi, 0, word); | ||
655 | |||
656 | rt2x00_desc_read(txwi, 1, &word); | ||
657 | rt2x00_set_field32(&word, TXWI_W1_ACK, | ||
658 | test_bit(ENTRY_TXD_ACK, &txdesc->flags)); | ||
659 | rt2x00_set_field32(&word, TXWI_W1_NSEQ, | ||
660 | test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags)); | ||
661 | rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size); | ||
662 | rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID, | ||
663 | test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ? | ||
664 | txdesc->key_idx : 0xff); | ||
665 | rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, | ||
666 | txdesc->length); | ||
667 | rt2x00_set_field32(&word, TXWI_W1_PACKETID, | ||
668 | skbdesc->entry->queue->qid + 1); | ||
669 | rt2x00_desc_write(txwi, 1, word); | ||
670 | |||
671 | /* | ||
672 | * Always write 0 to IV/EIV fields, hardware will insert the IV | ||
673 | * from the IVEIV register when TXD_W3_WIV is set to 0. | ||
674 | * When TXD_W3_WIV is set to 1 it will use the IV data | ||
675 | * from the descriptor. The TXWI_W1_WIRELESS_CLI_ID indicates which | ||
676 | * crypto entry in the registers should be used to encrypt the frame. | ||
677 | */ | ||
678 | _rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */); | ||
679 | _rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */); | ||
680 | 626 | ||
681 | return 0; | 627 | return 0; |
682 | } | 628 | } |
@@ -732,10 +678,10 @@ static void rt2800pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
732 | /* | 678 | /* |
733 | * TX data initialization | 679 | * TX data initialization |
734 | */ | 680 | */ |
735 | static void rt2800pci_write_beacon(struct queue_entry *entry) | 681 | static void rt2800pci_write_beacon(struct queue_entry *entry, |
682 | struct txentry_desc *txdesc) | ||
736 | { | 683 | { |
737 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 684 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
738 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | ||
739 | unsigned int beacon_base; | 685 | unsigned int beacon_base; |
740 | u32 reg; | 686 | u32 reg; |
741 | 687 | ||
@@ -748,15 +694,25 @@ static void rt2800pci_write_beacon(struct queue_entry *entry) | |||
748 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | 694 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); |
749 | 695 | ||
750 | /* | 696 | /* |
751 | * Write entire beacon with descriptor to register. | 697 | * Add the TXWI for the beacon to the skb. |
698 | */ | ||
699 | rt2800_write_txwi(entry->skb, txdesc); | ||
700 | skb_push(entry->skb, TXWI_DESC_SIZE); | ||
701 | |||
702 | /* | ||
703 | * Write entire beacon with TXWI to register. | ||
752 | */ | 704 | */ |
753 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); | 705 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); |
754 | rt2800_register_multiwrite(rt2x00dev, | 706 | rt2800_register_multiwrite(rt2x00dev, beacon_base, |
755 | beacon_base, | 707 | entry->skb->data, entry->skb->len); |
756 | skbdesc->desc, skbdesc->desc_len); | 708 | |
757 | rt2800_register_multiwrite(rt2x00dev, | 709 | /* |
758 | beacon_base + skbdesc->desc_len, | 710 | * Enable beaconing again. |
759 | entry->skb->data, entry->skb->len); | 711 | */ |
712 | rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 1); | ||
713 | rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, 1); | ||
714 | rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 1); | ||
715 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | ||
760 | 716 | ||
761 | /* | 717 | /* |
762 | * Clean up beacon skb. | 718 | * Clean up beacon skb. |
@@ -770,18 +726,6 @@ static void rt2800pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | |||
770 | { | 726 | { |
771 | struct data_queue *queue; | 727 | struct data_queue *queue; |
772 | unsigned int idx, qidx = 0; | 728 | unsigned int idx, qidx = 0; |
773 | u32 reg; | ||
774 | |||
775 | if (queue_idx == QID_BEACON) { | ||
776 | rt2800_register_read(rt2x00dev, BCN_TIME_CFG, ®); | ||
777 | if (!rt2x00_get_field32(reg, BCN_TIME_CFG_BEACON_GEN)) { | ||
778 | rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 1); | ||
779 | rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, 1); | ||
780 | rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 1); | ||
781 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | ||
782 | } | ||
783 | return; | ||
784 | } | ||
785 | 729 | ||
786 | if (queue_idx > QID_HCCA && queue_idx != QID_MGMT) | 730 | if (queue_idx > QID_HCCA && queue_idx != QID_MGMT) |
787 | return; | 731 | return; |
@@ -824,34 +768,21 @@ static void rt2800pci_fill_rxdone(struct queue_entry *entry, | |||
824 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 768 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
825 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; | 769 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; |
826 | __le32 *rxd = entry_priv->desc; | 770 | __le32 *rxd = entry_priv->desc; |
827 | __le32 *rxwi = (__le32 *)entry->skb->data; | 771 | u32 word; |
828 | u32 rxd3; | 772 | |
829 | u32 rxwi0; | 773 | rt2x00_desc_read(rxd, 3, &word); |
830 | u32 rxwi1; | 774 | |
831 | u32 rxwi2; | 775 | if (rt2x00_get_field32(word, RXD_W3_CRC_ERROR)) |
832 | u32 rxwi3; | ||
833 | |||
834 | rt2x00_desc_read(rxd, 3, &rxd3); | ||
835 | rt2x00_desc_read(rxwi, 0, &rxwi0); | ||
836 | rt2x00_desc_read(rxwi, 1, &rxwi1); | ||
837 | rt2x00_desc_read(rxwi, 2, &rxwi2); | ||
838 | rt2x00_desc_read(rxwi, 3, &rxwi3); | ||
839 | |||
840 | if (rt2x00_get_field32(rxd3, RXD_W3_CRC_ERROR)) | ||
841 | rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; | 776 | rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; |
842 | 777 | ||
843 | if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) { | 778 | /* |
844 | /* | 779 | * Unfortunately we don't know the cipher type used during |
845 | * Unfortunately we don't know the cipher type used during | 780 | * decryption. This prevents us from correct providing |
846 | * decryption. This prevents us from correct providing | 781 | * correct statistics through debugfs. |
847 | * correct statistics through debugfs. | 782 | */ |
848 | */ | 783 | rxdesc->cipher_status = rt2x00_get_field32(word, RXD_W3_CIPHER_ERROR); |
849 | rxdesc->cipher = rt2x00_get_field32(rxwi0, RXWI_W0_UDF); | ||
850 | rxdesc->cipher_status = | ||
851 | rt2x00_get_field32(rxd3, RXD_W3_CIPHER_ERROR); | ||
852 | } | ||
853 | 784 | ||
854 | if (rt2x00_get_field32(rxd3, RXD_W3_DECRYPTED)) { | 785 | if (rt2x00_get_field32(word, RXD_W3_DECRYPTED)) { |
855 | /* | 786 | /* |
856 | * Hardware has stripped IV/EIV data from 802.11 frame during | 787 | * Hardware has stripped IV/EIV data from 802.11 frame during |
857 | * decryption. Unfortunately the descriptor doesn't contain | 788 | * decryption. Unfortunately the descriptor doesn't contain |
@@ -866,47 +797,22 @@ static void rt2800pci_fill_rxdone(struct queue_entry *entry, | |||
866 | rxdesc->flags |= RX_FLAG_MMIC_ERROR; | 797 | rxdesc->flags |= RX_FLAG_MMIC_ERROR; |
867 | } | 798 | } |
868 | 799 | ||
869 | if (rt2x00_get_field32(rxd3, RXD_W3_MY_BSS)) | 800 | if (rt2x00_get_field32(word, RXD_W3_MY_BSS)) |
870 | rxdesc->dev_flags |= RXDONE_MY_BSS; | 801 | rxdesc->dev_flags |= RXDONE_MY_BSS; |
871 | 802 | ||
872 | if (rt2x00_get_field32(rxd3, RXD_W3_L2PAD)) | 803 | if (rt2x00_get_field32(word, RXD_W3_L2PAD)) |
873 | rxdesc->dev_flags |= RXDONE_L2PAD; | 804 | rxdesc->dev_flags |= RXDONE_L2PAD; |
874 | 805 | ||
875 | if (rt2x00_get_field32(rxwi1, RXWI_W1_SHORT_GI)) | ||
876 | rxdesc->flags |= RX_FLAG_SHORT_GI; | ||
877 | |||
878 | if (rt2x00_get_field32(rxwi1, RXWI_W1_BW)) | ||
879 | rxdesc->flags |= RX_FLAG_40MHZ; | ||
880 | |||
881 | /* | ||
882 | * Detect RX rate, always use MCS as signal type. | ||
883 | */ | ||
884 | rxdesc->dev_flags |= RXDONE_SIGNAL_MCS; | ||
885 | rxdesc->rate_mode = rt2x00_get_field32(rxwi1, RXWI_W1_PHYMODE); | ||
886 | rxdesc->signal = rt2x00_get_field32(rxwi1, RXWI_W1_MCS); | ||
887 | |||
888 | /* | 806 | /* |
889 | * Mask of 0x8 bit to remove the short preamble flag. | 807 | * Process the RXWI structure that is at the start of the buffer. |
890 | */ | 808 | */ |
891 | if (rxdesc->rate_mode == RATE_MODE_CCK) | 809 | rt2800_process_rxwi(entry->skb, rxdesc); |
892 | rxdesc->signal &= ~0x8; | ||
893 | |||
894 | rxdesc->rssi = | ||
895 | (rt2x00_get_field32(rxwi2, RXWI_W2_RSSI0) + | ||
896 | rt2x00_get_field32(rxwi2, RXWI_W2_RSSI1)) / 2; | ||
897 | |||
898 | rxdesc->size = rt2x00_get_field32(rxwi0, RXWI_W0_MPDU_TOTAL_BYTE_COUNT); | ||
899 | 810 | ||
900 | /* | 811 | /* |
901 | * Set RX IDX in register to inform hardware that we have handled | 812 | * Set RX IDX in register to inform hardware that we have handled |
902 | * this entry and it is available for reuse again. | 813 | * this entry and it is available for reuse again. |
903 | */ | 814 | */ |
904 | rt2800_register_write(rt2x00dev, RX_CRX_IDX, entry->entry_idx); | 815 | rt2800_register_write(rt2x00dev, RX_CRX_IDX, entry->entry_idx); |
905 | |||
906 | /* | ||
907 | * Remove TXWI descriptor from start of buffer. | ||
908 | */ | ||
909 | skb_pull(entry->skb, RXWI_DESC_SIZE); | ||
910 | } | 816 | } |
911 | 817 | ||
912 | /* | 818 | /* |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index e3f3a97db807..8ad0669a1b99 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -401,59 +401,15 @@ static void rt2800usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
401 | { | 401 | { |
402 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); | 402 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); |
403 | __le32 *txi = skbdesc->desc; | 403 | __le32 *txi = skbdesc->desc; |
404 | __le32 *txwi = &txi[TXINFO_DESC_SIZE / sizeof(__le32)]; | ||
405 | u32 word; | 404 | u32 word; |
406 | 405 | ||
407 | /* | 406 | /* |
408 | * Initialize TX Info descriptor | 407 | * Initialize TXWI descriptor |
409 | */ | 408 | */ |
410 | rt2x00_desc_read(txwi, 0, &word); | 409 | rt2800_write_txwi(skb, txdesc); |
411 | rt2x00_set_field32(&word, TXWI_W0_FRAG, | ||
412 | test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); | ||
413 | rt2x00_set_field32(&word, TXWI_W0_MIMO_PS, 0); | ||
414 | rt2x00_set_field32(&word, TXWI_W0_CF_ACK, 0); | ||
415 | rt2x00_set_field32(&word, TXWI_W0_TS, | ||
416 | test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags)); | ||
417 | rt2x00_set_field32(&word, TXWI_W0_AMPDU, | ||
418 | test_bit(ENTRY_TXD_HT_AMPDU, &txdesc->flags)); | ||
419 | rt2x00_set_field32(&word, TXWI_W0_MPDU_DENSITY, txdesc->mpdu_density); | ||
420 | rt2x00_set_field32(&word, TXWI_W0_TX_OP, txdesc->ifs); | ||
421 | rt2x00_set_field32(&word, TXWI_W0_MCS, txdesc->mcs); | ||
422 | rt2x00_set_field32(&word, TXWI_W0_BW, | ||
423 | test_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags)); | ||
424 | rt2x00_set_field32(&word, TXWI_W0_SHORT_GI, | ||
425 | test_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags)); | ||
426 | rt2x00_set_field32(&word, TXWI_W0_STBC, txdesc->stbc); | ||
427 | rt2x00_set_field32(&word, TXWI_W0_PHYMODE, txdesc->rate_mode); | ||
428 | rt2x00_desc_write(txwi, 0, word); | ||
429 | |||
430 | rt2x00_desc_read(txwi, 1, &word); | ||
431 | rt2x00_set_field32(&word, TXWI_W1_ACK, | ||
432 | test_bit(ENTRY_TXD_ACK, &txdesc->flags)); | ||
433 | rt2x00_set_field32(&word, TXWI_W1_NSEQ, | ||
434 | test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags)); | ||
435 | rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size); | ||
436 | rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID, | ||
437 | test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ? | ||
438 | txdesc->key_idx : 0xff); | ||
439 | rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, | ||
440 | txdesc->length); | ||
441 | rt2x00_set_field32(&word, TXWI_W1_PACKETID, | ||
442 | skbdesc->entry->queue->qid + 1); | ||
443 | rt2x00_desc_write(txwi, 1, word); | ||
444 | 410 | ||
445 | /* | 411 | /* |
446 | * Always write 0 to IV/EIV fields, hardware will insert the IV | 412 | * Initialize TXINFO descriptor |
447 | * from the IVEIV register when TXINFO_W0_WIV is set to 0. | ||
448 | * When TXINFO_W0_WIV is set to 1 it will use the IV data | ||
449 | * from the descriptor. The TXWI_W1_WIRELESS_CLI_ID indicates which | ||
450 | * crypto entry in the registers should be used to encrypt the frame. | ||
451 | */ | ||
452 | _rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */); | ||
453 | _rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */); | ||
454 | |||
455 | /* | ||
456 | * Initialize TX descriptor | ||
457 | */ | 413 | */ |
458 | rt2x00_desc_read(txi, 0, &word); | 414 | rt2x00_desc_read(txi, 0, &word); |
459 | rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN, | 415 | rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN, |
@@ -471,21 +427,14 @@ static void rt2800usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
471 | /* | 427 | /* |
472 | * TX data initialization | 428 | * TX data initialization |
473 | */ | 429 | */ |
474 | static void rt2800usb_write_beacon(struct queue_entry *entry) | 430 | static void rt2800usb_write_beacon(struct queue_entry *entry, |
431 | struct txentry_desc *txdesc) | ||
475 | { | 432 | { |
476 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 433 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
477 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | ||
478 | unsigned int beacon_base; | 434 | unsigned int beacon_base; |
479 | u32 reg; | 435 | u32 reg; |
480 | 436 | ||
481 | /* | 437 | /* |
482 | * Add the descriptor in front of the skb. | ||
483 | */ | ||
484 | skb_push(entry->skb, entry->queue->desc_size); | ||
485 | memcpy(entry->skb->data, skbdesc->desc, skbdesc->desc_len); | ||
486 | skbdesc->desc = entry->skb->data; | ||
487 | |||
488 | /* | ||
489 | * Disable beaconing while we are reloading the beacon data, | 438 | * Disable beaconing while we are reloading the beacon data, |
490 | * otherwise we might be sending out invalid data. | 439 | * otherwise we might be sending out invalid data. |
491 | */ | 440 | */ |
@@ -494,6 +443,12 @@ static void rt2800usb_write_beacon(struct queue_entry *entry) | |||
494 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | 443 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); |
495 | 444 | ||
496 | /* | 445 | /* |
446 | * Add the TXWI for the beacon to the skb. | ||
447 | */ | ||
448 | rt2800_write_txwi(entry->skb, txdesc); | ||
449 | skb_push(entry->skb, TXWI_DESC_SIZE); | ||
450 | |||
451 | /* | ||
497 | * Write entire beacon with descriptor to register. | 452 | * Write entire beacon with descriptor to register. |
498 | */ | 453 | */ |
499 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); | 454 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); |
@@ -503,6 +458,14 @@ static void rt2800usb_write_beacon(struct queue_entry *entry) | |||
503 | REGISTER_TIMEOUT32(entry->skb->len)); | 458 | REGISTER_TIMEOUT32(entry->skb->len)); |
504 | 459 | ||
505 | /* | 460 | /* |
461 | * Enable beaconing again. | ||
462 | */ | ||
463 | rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 1); | ||
464 | rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, 1); | ||
465 | rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 1); | ||
466 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | ||
467 | |||
468 | /* | ||
506 | * Clean up the beacon skb. | 469 | * Clean up the beacon skb. |
507 | */ | 470 | */ |
508 | dev_kfree_skb(entry->skb); | 471 | dev_kfree_skb(entry->skb); |
@@ -524,84 +487,53 @@ static int rt2800usb_get_tx_data_len(struct queue_entry *entry) | |||
524 | return length; | 487 | return length; |
525 | } | 488 | } |
526 | 489 | ||
527 | static void rt2800usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | ||
528 | const enum data_queue_qid queue) | ||
529 | { | ||
530 | u32 reg; | ||
531 | |||
532 | if (queue != QID_BEACON) { | ||
533 | rt2x00usb_kick_tx_queue(rt2x00dev, queue); | ||
534 | return; | ||
535 | } | ||
536 | |||
537 | rt2800_register_read(rt2x00dev, BCN_TIME_CFG, ®); | ||
538 | if (!rt2x00_get_field32(reg, BCN_TIME_CFG_BEACON_GEN)) { | ||
539 | rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 1); | ||
540 | rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, 1); | ||
541 | rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 1); | ||
542 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | ||
543 | } | ||
544 | } | ||
545 | |||
546 | /* | 490 | /* |
547 | * RX control handlers | 491 | * RX control handlers |
548 | */ | 492 | */ |
549 | static void rt2800usb_fill_rxdone(struct queue_entry *entry, | 493 | static void rt2800usb_fill_rxdone(struct queue_entry *entry, |
550 | struct rxdone_entry_desc *rxdesc) | 494 | struct rxdone_entry_desc *rxdesc) |
551 | { | 495 | { |
552 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | ||
553 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | 496 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); |
554 | __le32 *rxi = (__le32 *)entry->skb->data; | 497 | __le32 *rxi = (__le32 *)entry->skb->data; |
555 | __le32 *rxwi; | ||
556 | __le32 *rxd; | 498 | __le32 *rxd; |
557 | u32 rxi0; | 499 | u32 word; |
558 | u32 rxwi0; | ||
559 | u32 rxwi1; | ||
560 | u32 rxwi2; | ||
561 | u32 rxwi3; | ||
562 | u32 rxd0; | ||
563 | int rx_pkt_len; | 500 | int rx_pkt_len; |
564 | 501 | ||
565 | /* | 502 | /* |
503 | * Copy descriptor to the skbdesc->desc buffer, making it safe from | ||
504 | * moving of frame data in rt2x00usb. | ||
505 | */ | ||
506 | memcpy(skbdesc->desc, rxi, skbdesc->desc_len); | ||
507 | |||
508 | /* | ||
566 | * RX frame format is : | 509 | * RX frame format is : |
567 | * | RXINFO | RXWI | header | L2 pad | payload | pad | RXD | USB pad | | 510 | * | RXINFO | RXWI | header | L2 pad | payload | pad | RXD | USB pad | |
568 | * |<------------ rx_pkt_len -------------->| | 511 | * |<------------ rx_pkt_len -------------->| |
569 | */ | 512 | */ |
570 | rt2x00_desc_read(rxi, 0, &rxi0); | 513 | rt2x00_desc_read(rxi, 0, &word); |
571 | rx_pkt_len = rt2x00_get_field32(rxi0, RXINFO_W0_USB_DMA_RX_PKT_LEN); | 514 | rx_pkt_len = rt2x00_get_field32(word, RXINFO_W0_USB_DMA_RX_PKT_LEN); |
572 | |||
573 | rxwi = (__le32 *)(entry->skb->data + RXINFO_DESC_SIZE); | ||
574 | 515 | ||
575 | /* | 516 | /* |
576 | * FIXME : we need to check for rx_pkt_len validity | 517 | * Remove the RXINFO structure from the sbk. |
577 | */ | 518 | */ |
578 | rxd = (__le32 *)(entry->skb->data + RXINFO_DESC_SIZE + rx_pkt_len); | 519 | skb_pull(entry->skb, RXINFO_DESC_SIZE); |
579 | 520 | ||
580 | /* | 521 | /* |
581 | * Copy descriptor to the skbdesc->desc buffer, making it safe from | 522 | * FIXME: we need to check for rx_pkt_len validity |
582 | * moving of frame data in rt2x00usb. | ||
583 | */ | 523 | */ |
584 | memcpy(skbdesc->desc, rxi, skbdesc->desc_len); | 524 | rxd = (__le32 *)(entry->skb->data + rx_pkt_len); |
585 | 525 | ||
586 | /* | 526 | /* |
587 | * It is now safe to read the descriptor on all architectures. | 527 | * It is now safe to read the descriptor on all architectures. |
588 | */ | 528 | */ |
589 | rt2x00_desc_read(rxwi, 0, &rxwi0); | 529 | rt2x00_desc_read(rxd, 0, &word); |
590 | rt2x00_desc_read(rxwi, 1, &rxwi1); | ||
591 | rt2x00_desc_read(rxwi, 2, &rxwi2); | ||
592 | rt2x00_desc_read(rxwi, 3, &rxwi3); | ||
593 | rt2x00_desc_read(rxd, 0, &rxd0); | ||
594 | 530 | ||
595 | if (rt2x00_get_field32(rxd0, RXD_W0_CRC_ERROR)) | 531 | if (rt2x00_get_field32(word, RXD_W0_CRC_ERROR)) |
596 | rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; | 532 | rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; |
597 | 533 | ||
598 | if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) { | 534 | rxdesc->cipher_status = rt2x00_get_field32(word, RXD_W0_CIPHER_ERROR); |
599 | rxdesc->cipher = rt2x00_get_field32(rxwi0, RXWI_W0_UDF); | ||
600 | rxdesc->cipher_status = | ||
601 | rt2x00_get_field32(rxd0, RXD_W0_CIPHER_ERROR); | ||
602 | } | ||
603 | 535 | ||
604 | if (rt2x00_get_field32(rxd0, RXD_W0_DECRYPTED)) { | 536 | if (rt2x00_get_field32(word, RXD_W0_DECRYPTED)) { |
605 | /* | 537 | /* |
606 | * Hardware has stripped IV/EIV data from 802.11 frame during | 538 | * Hardware has stripped IV/EIV data from 802.11 frame during |
607 | * decryption. Unfortunately the descriptor doesn't contain | 539 | * decryption. Unfortunately the descriptor doesn't contain |
@@ -616,41 +548,21 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry, | |||
616 | rxdesc->flags |= RX_FLAG_MMIC_ERROR; | 548 | rxdesc->flags |= RX_FLAG_MMIC_ERROR; |
617 | } | 549 | } |
618 | 550 | ||
619 | if (rt2x00_get_field32(rxd0, RXD_W0_MY_BSS)) | 551 | if (rt2x00_get_field32(word, RXD_W0_MY_BSS)) |
620 | rxdesc->dev_flags |= RXDONE_MY_BSS; | 552 | rxdesc->dev_flags |= RXDONE_MY_BSS; |
621 | 553 | ||
622 | if (rt2x00_get_field32(rxd0, RXD_W0_L2PAD)) | 554 | if (rt2x00_get_field32(word, RXD_W0_L2PAD)) |
623 | rxdesc->dev_flags |= RXDONE_L2PAD; | 555 | rxdesc->dev_flags |= RXDONE_L2PAD; |
624 | 556 | ||
625 | if (rt2x00_get_field32(rxwi1, RXWI_W1_SHORT_GI)) | ||
626 | rxdesc->flags |= RX_FLAG_SHORT_GI; | ||
627 | |||
628 | if (rt2x00_get_field32(rxwi1, RXWI_W1_BW)) | ||
629 | rxdesc->flags |= RX_FLAG_40MHZ; | ||
630 | |||
631 | /* | 557 | /* |
632 | * Detect RX rate, always use MCS as signal type. | 558 | * Remove RXD descriptor from end of buffer. |
633 | */ | 559 | */ |
634 | rxdesc->dev_flags |= RXDONE_SIGNAL_MCS; | 560 | skb_trim(entry->skb, rx_pkt_len); |
635 | rxdesc->rate_mode = rt2x00_get_field32(rxwi1, RXWI_W1_PHYMODE); | ||
636 | rxdesc->signal = rt2x00_get_field32(rxwi1, RXWI_W1_MCS); | ||
637 | |||
638 | /* | ||
639 | * Mask of 0x8 bit to remove the short preamble flag. | ||
640 | */ | ||
641 | if (rxdesc->rate_mode == RATE_MODE_CCK) | ||
642 | rxdesc->signal &= ~0x8; | ||
643 | |||
644 | rxdesc->rssi = | ||
645 | (rt2x00_get_field32(rxwi2, RXWI_W2_RSSI0) + | ||
646 | rt2x00_get_field32(rxwi2, RXWI_W2_RSSI1)) / 2; | ||
647 | |||
648 | rxdesc->size = rt2x00_get_field32(rxwi0, RXWI_W0_MPDU_TOTAL_BYTE_COUNT); | ||
649 | 561 | ||
650 | /* | 562 | /* |
651 | * Remove RXWI descriptor from start of buffer. | 563 | * Process the RXWI structure. |
652 | */ | 564 | */ |
653 | skb_pull(entry->skb, skbdesc->desc_len); | 565 | rt2800_process_rxwi(entry->skb, rxdesc); |
654 | } | 566 | } |
655 | 567 | ||
656 | /* | 568 | /* |
@@ -743,7 +655,7 @@ static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = { | |||
743 | .write_tx_data = rt2x00usb_write_tx_data, | 655 | .write_tx_data = rt2x00usb_write_tx_data, |
744 | .write_beacon = rt2800usb_write_beacon, | 656 | .write_beacon = rt2800usb_write_beacon, |
745 | .get_tx_data_len = rt2800usb_get_tx_data_len, | 657 | .get_tx_data_len = rt2800usb_get_tx_data_len, |
746 | .kick_tx_queue = rt2800usb_kick_tx_queue, | 658 | .kick_tx_queue = rt2x00usb_kick_tx_queue, |
747 | .kill_tx_queue = rt2x00usb_kill_tx_queue, | 659 | .kill_tx_queue = rt2x00usb_kill_tx_queue, |
748 | .fill_rxdone = rt2800usb_fill_rxdone, | 660 | .fill_rxdone = rt2800usb_fill_rxdone, |
749 | .config_shared_key = rt2800_config_shared_key, | 661 | .config_shared_key = rt2800_config_shared_key, |
@@ -841,7 +753,7 @@ static struct usb_device_id rt2800usb_device_table[] = { | |||
841 | { USB_DEVICE(0x7392, 0x7717), USB_DEVICE_DATA(&rt2800usb_ops) }, | 753 | { USB_DEVICE(0x7392, 0x7717), USB_DEVICE_DATA(&rt2800usb_ops) }, |
842 | { USB_DEVICE(0x7392, 0x7718), USB_DEVICE_DATA(&rt2800usb_ops) }, | 754 | { USB_DEVICE(0x7392, 0x7718), USB_DEVICE_DATA(&rt2800usb_ops) }, |
843 | /* EnGenius */ | 755 | /* EnGenius */ |
844 | { USB_DEVICE(0X1740, 0x9701), USB_DEVICE_DATA(&rt2800usb_ops) }, | 756 | { USB_DEVICE(0x1740, 0x9701), USB_DEVICE_DATA(&rt2800usb_ops) }, |
845 | { USB_DEVICE(0x1740, 0x9702), USB_DEVICE_DATA(&rt2800usb_ops) }, | 757 | { USB_DEVICE(0x1740, 0x9702), USB_DEVICE_DATA(&rt2800usb_ops) }, |
846 | /* Gigabyte */ | 758 | /* Gigabyte */ |
847 | { USB_DEVICE(0x1044, 0x800b), USB_DEVICE_DATA(&rt2800usb_ops) }, | 759 | { USB_DEVICE(0x1044, 0x800b), USB_DEVICE_DATA(&rt2800usb_ops) }, |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.h b/drivers/net/wireless/rt2x00/rt2800usb.h index d1d8ae94b4d4..2bca6a71a7f5 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.h +++ b/drivers/net/wireless/rt2x00/rt2800usb.h | |||
@@ -79,8 +79,6 @@ | |||
79 | */ | 79 | */ |
80 | #define TXINFO_DESC_SIZE ( 1 * sizeof(__le32) ) | 80 | #define TXINFO_DESC_SIZE ( 1 * sizeof(__le32) ) |
81 | #define RXINFO_DESC_SIZE ( 1 * sizeof(__le32) ) | 81 | #define RXINFO_DESC_SIZE ( 1 * sizeof(__le32) ) |
82 | #define RXWI_DESC_SIZE ( 4 * sizeof(__le32) ) | ||
83 | #define RXD_DESC_SIZE ( 1 * sizeof(__le32) ) | ||
84 | 82 | ||
85 | /* | 83 | /* |
86 | * TX Info structure | 84 | * TX Info structure |
@@ -113,44 +111,6 @@ | |||
113 | #define RXINFO_W0_USB_DMA_RX_PKT_LEN FIELD32(0x0000ffff) | 111 | #define RXINFO_W0_USB_DMA_RX_PKT_LEN FIELD32(0x0000ffff) |
114 | 112 | ||
115 | /* | 113 | /* |
116 | * RX WI structure | ||
117 | */ | ||
118 | |||
119 | /* | ||
120 | * Word0 | ||
121 | */ | ||
122 | #define RXWI_W0_WIRELESS_CLI_ID FIELD32(0x000000ff) | ||
123 | #define RXWI_W0_KEY_INDEX FIELD32(0x00000300) | ||
124 | #define RXWI_W0_BSSID FIELD32(0x00001c00) | ||
125 | #define RXWI_W0_UDF FIELD32(0x0000e000) | ||
126 | #define RXWI_W0_MPDU_TOTAL_BYTE_COUNT FIELD32(0x0fff0000) | ||
127 | #define RXWI_W0_TID FIELD32(0xf0000000) | ||
128 | |||
129 | /* | ||
130 | * Word1 | ||
131 | */ | ||
132 | #define RXWI_W1_FRAG FIELD32(0x0000000f) | ||
133 | #define RXWI_W1_SEQUENCE FIELD32(0x0000fff0) | ||
134 | #define RXWI_W1_MCS FIELD32(0x007f0000) | ||
135 | #define RXWI_W1_BW FIELD32(0x00800000) | ||
136 | #define RXWI_W1_SHORT_GI FIELD32(0x01000000) | ||
137 | #define RXWI_W1_STBC FIELD32(0x06000000) | ||
138 | #define RXWI_W1_PHYMODE FIELD32(0xc0000000) | ||
139 | |||
140 | /* | ||
141 | * Word2 | ||
142 | */ | ||
143 | #define RXWI_W2_RSSI0 FIELD32(0x000000ff) | ||
144 | #define RXWI_W2_RSSI1 FIELD32(0x0000ff00) | ||
145 | #define RXWI_W2_RSSI2 FIELD32(0x00ff0000) | ||
146 | |||
147 | /* | ||
148 | * Word3 | ||
149 | */ | ||
150 | #define RXWI_W3_SNR0 FIELD32(0x000000ff) | ||
151 | #define RXWI_W3_SNR1 FIELD32(0x0000ff00) | ||
152 | |||
153 | /* | ||
154 | * RX descriptor format for RX Ring. | 114 | * RX descriptor format for RX Ring. |
155 | */ | 115 | */ |
156 | 116 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 4f9b666f7a7f..6c1ff4c15c84 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -551,7 +551,8 @@ struct rt2x00lib_ops { | |||
551 | struct txentry_desc *txdesc); | 551 | struct txentry_desc *txdesc); |
552 | int (*write_tx_data) (struct queue_entry *entry, | 552 | int (*write_tx_data) (struct queue_entry *entry, |
553 | struct txentry_desc *txdesc); | 553 | struct txentry_desc *txdesc); |
554 | void (*write_beacon) (struct queue_entry *entry); | 554 | void (*write_beacon) (struct queue_entry *entry, |
555 | struct txentry_desc *txdesc); | ||
555 | int (*get_tx_data_len) (struct queue_entry *entry); | 556 | int (*get_tx_data_len) (struct queue_entry *entry); |
556 | void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev, | 557 | void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev, |
557 | const enum data_queue_qid queue); | 558 | const enum data_queue_qid queue); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00crypto.c b/drivers/net/wireless/rt2x00/rt2x00crypto.c index d291c7862e10..583dacd8d241 100644 --- a/drivers/net/wireless/rt2x00/rt2x00crypto.c +++ b/drivers/net/wireless/rt2x00/rt2x00crypto.c | |||
@@ -128,6 +128,7 @@ void rt2x00crypto_tx_remove_iv(struct sk_buff *skb, struct txentry_desc *txdesc) | |||
128 | 128 | ||
129 | /* Pull buffer to correct size */ | 129 | /* Pull buffer to correct size */ |
130 | skb_pull(skb, txdesc->iv_len); | 130 | skb_pull(skb, txdesc->iv_len); |
131 | txdesc->length -= txdesc->iv_len; | ||
131 | 132 | ||
132 | /* IV/EIV data has officially been stripped */ | 133 | /* IV/EIV data has officially been stripped */ |
133 | skbdesc->flags |= SKBDESC_IV_STRIPPED; | 134 | skbdesc->flags |= SKBDESC_IV_STRIPPED; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00ht.c b/drivers/net/wireless/rt2x00/rt2x00ht.c index 1056c92143a8..5a407602ce3e 100644 --- a/drivers/net/wireless/rt2x00/rt2x00ht.c +++ b/drivers/net/wireless/rt2x00/rt2x00ht.c | |||
@@ -35,6 +35,7 @@ void rt2x00ht_create_tx_descriptor(struct queue_entry *entry, | |||
35 | { | 35 | { |
36 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb); | 36 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb); |
37 | struct ieee80211_tx_rate *txrate = &tx_info->control.rates[0]; | 37 | struct ieee80211_tx_rate *txrate = &tx_info->control.rates[0]; |
38 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)entry->skb->data; | ||
38 | 39 | ||
39 | if (tx_info->control.sta) | 40 | if (tx_info->control.sta) |
40 | txdesc->mpdu_density = | 41 | txdesc->mpdu_density = |
@@ -66,4 +67,20 @@ void rt2x00ht_create_tx_descriptor(struct queue_entry *entry, | |||
66 | __set_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags); | 67 | __set_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags); |
67 | if (txrate->flags & IEEE80211_TX_RC_SHORT_GI) | 68 | if (txrate->flags & IEEE80211_TX_RC_SHORT_GI) |
68 | __set_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags); | 69 | __set_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags); |
70 | |||
71 | /* | ||
72 | * Determine IFS values | ||
73 | * - Use TXOP_BACKOFF for management frames | ||
74 | * - Use TXOP_SIFS for fragment bursts | ||
75 | * - Use TXOP_HTTXOP for everything else | ||
76 | * | ||
77 | * Note: rt2800 devices won't use CTS protection (if used) | ||
78 | * for frames not transmitted with TXOP_HTTXOP | ||
79 | */ | ||
80 | if (ieee80211_is_mgmt(hdr->frame_control)) | ||
81 | txdesc->txop = TXOP_BACKOFF; | ||
82 | else if (!(tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)) | ||
83 | txdesc->txop = TXOP_SIFS; | ||
84 | else | ||
85 | txdesc->txop = TXOP_HTTXOP; | ||
69 | } | 86 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index e22029fcf411..089a12c7b90f 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c | |||
@@ -429,20 +429,23 @@ static void rt2x00queue_write_tx_descriptor(struct queue_entry *entry, | |||
429 | * it is now ready to be dumped to userspace through debugfs. | 429 | * it is now ready to be dumped to userspace through debugfs. |
430 | */ | 430 | */ |
431 | rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TX, entry->skb); | 431 | rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TX, entry->skb); |
432 | } | ||
433 | |||
434 | static void rt2x00queue_kick_tx_queue(struct queue_entry *entry, | ||
435 | struct txentry_desc *txdesc) | ||
436 | { | ||
437 | struct data_queue *queue = entry->queue; | ||
438 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
432 | 439 | ||
433 | /* | 440 | /* |
434 | * Check if we need to kick the queue, there are however a few rules | 441 | * Check if we need to kick the queue, there are however a few rules |
435 | * 1) Don't kick beacon queue | 442 | * 1) Don't kick unless this is the last in frame in a burst. |
436 | * 2) Don't kick unless this is the last in frame in a burst. | ||
437 | * When the burst flag is set, this frame is always followed | 443 | * When the burst flag is set, this frame is always followed |
438 | * by another frame which in some way are related to eachother. | 444 | * by another frame which in some way are related to eachother. |
439 | * This is true for fragments, RTS or CTS-to-self frames. | 445 | * This is true for fragments, RTS or CTS-to-self frames. |
440 | * 3) Rule 2 can be broken when the available entries | 446 | * 2) Rule 1 can be broken when the available entries |
441 | * in the queue are less then a certain threshold. | 447 | * in the queue are less then a certain threshold. |
442 | */ | 448 | */ |
443 | if (entry->queue->qid == QID_BEACON) | ||
444 | return; | ||
445 | |||
446 | if (rt2x00queue_threshold(queue) || | 449 | if (rt2x00queue_threshold(queue) || |
447 | !test_bit(ENTRY_TXD_BURST, &txdesc->flags)) | 450 | !test_bit(ENTRY_TXD_BURST, &txdesc->flags)) |
448 | rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, queue->qid); | 451 | rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, queue->qid); |
@@ -538,6 +541,7 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb, | |||
538 | 541 | ||
539 | rt2x00queue_index_inc(queue, Q_INDEX); | 542 | rt2x00queue_index_inc(queue, Q_INDEX); |
540 | rt2x00queue_write_tx_descriptor(entry, &txdesc); | 543 | rt2x00queue_write_tx_descriptor(entry, &txdesc); |
544 | rt2x00queue_kick_tx_queue(entry, &txdesc); | ||
541 | 545 | ||
542 | return 0; | 546 | return 0; |
543 | } | 547 | } |
@@ -603,12 +607,9 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev, | |||
603 | rt2x00queue_write_tx_descriptor(intf->beacon, &txdesc); | 607 | rt2x00queue_write_tx_descriptor(intf->beacon, &txdesc); |
604 | 608 | ||
605 | /* | 609 | /* |
606 | * Send beacon to hardware. | 610 | * Send beacon to hardware and enable beacon genaration.. |
607 | * Also enable beacon generation, which might have been disabled | ||
608 | * by the driver during the config_beacon() callback function. | ||
609 | */ | 611 | */ |
610 | rt2x00dev->ops->lib->write_beacon(intf->beacon); | 612 | rt2x00dev->ops->lib->write_beacon(intf->beacon, &txdesc); |
611 | rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, QID_BEACON); | ||
612 | 613 | ||
613 | mutex_unlock(&intf->beacon_skb_mutex); | 614 | mutex_unlock(&intf->beacon_skb_mutex); |
614 | 615 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.h b/drivers/net/wireless/rt2x00/rt2x00queue.h index 94a48c174d67..36a957adc1f9 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.h +++ b/drivers/net/wireless/rt2x00/rt2x00queue.h | |||
@@ -299,6 +299,7 @@ enum txentry_desc_flags { | |||
299 | * @retry_limit: Max number of retries. | 299 | * @retry_limit: Max number of retries. |
300 | * @aifs: AIFS value. | 300 | * @aifs: AIFS value. |
301 | * @ifs: IFS value. | 301 | * @ifs: IFS value. |
302 | * @txop: IFS value for 11n capable chips. | ||
302 | * @cw_min: cwmin value. | 303 | * @cw_min: cwmin value. |
303 | * @cw_max: cwmax value. | 304 | * @cw_max: cwmax value. |
304 | * @cipher: Cipher type used for encryption. | 305 | * @cipher: Cipher type used for encryption. |
@@ -328,6 +329,7 @@ struct txentry_desc { | |||
328 | short retry_limit; | 329 | short retry_limit; |
329 | short aifs; | 330 | short aifs; |
330 | short ifs; | 331 | short ifs; |
332 | short txop; | ||
331 | short cw_min; | 333 | short cw_min; |
332 | short cw_max; | 334 | short cw_max; |
333 | 335 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00reg.h b/drivers/net/wireless/rt2x00/rt2x00reg.h index 603bfc0adaa3..b9fe94873ee0 100644 --- a/drivers/net/wireless/rt2x00/rt2x00reg.h +++ b/drivers/net/wireless/rt2x00/rt2x00reg.h | |||
@@ -101,6 +101,16 @@ enum ifs { | |||
101 | }; | 101 | }; |
102 | 102 | ||
103 | /* | 103 | /* |
104 | * IFS backoff values for HT devices | ||
105 | */ | ||
106 | enum txop { | ||
107 | TXOP_HTTXOP = 0, | ||
108 | TXOP_PIFS = 1, | ||
109 | TXOP_SIFS = 2, | ||
110 | TXOP_BACKOFF = 3, | ||
111 | }; | ||
112 | |||
113 | /* | ||
104 | * Cipher types for hardware encryption | 114 | * Cipher types for hardware encryption |
105 | */ | 115 | */ |
106 | enum cipher { | 116 | enum cipher { |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index 26ee7911fba9..86c75b9c3f25 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -1843,7 +1843,8 @@ static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1843 | /* | 1843 | /* |
1844 | * TX data initialization | 1844 | * TX data initialization |
1845 | */ | 1845 | */ |
1846 | static void rt61pci_write_beacon(struct queue_entry *entry) | 1846 | static void rt61pci_write_beacon(struct queue_entry *entry, |
1847 | struct txentry_desc *txdesc) | ||
1847 | { | 1848 | { |
1848 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 1849 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
1849 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | 1850 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); |
@@ -1870,6 +1871,19 @@ static void rt61pci_write_beacon(struct queue_entry *entry) | |||
1870 | entry->skb->data, entry->skb->len); | 1871 | entry->skb->data, entry->skb->len); |
1871 | 1872 | ||
1872 | /* | 1873 | /* |
1874 | * Enable beaconing again. | ||
1875 | * | ||
1876 | * For Wi-Fi faily generated beacons between participating | ||
1877 | * stations. Set TBTT phase adaptive adjustment step to 8us. | ||
1878 | */ | ||
1879 | rt2x00pci_register_write(rt2x00dev, TXRX_CSR10, 0x00001008); | ||
1880 | |||
1881 | rt2x00_set_field32(®, TXRX_CSR9_TSF_TICKING, 1); | ||
1882 | rt2x00_set_field32(®, TXRX_CSR9_TBTT_ENABLE, 1); | ||
1883 | rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 1); | ||
1884 | rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg); | ||
1885 | |||
1886 | /* | ||
1873 | * Clean up beacon skb. | 1887 | * Clean up beacon skb. |
1874 | */ | 1888 | */ |
1875 | dev_kfree_skb_any(entry->skb); | 1889 | dev_kfree_skb_any(entry->skb); |
@@ -1881,23 +1895,6 @@ static void rt61pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | |||
1881 | { | 1895 | { |
1882 | u32 reg; | 1896 | u32 reg; |
1883 | 1897 | ||
1884 | if (queue == QID_BEACON) { | ||
1885 | /* | ||
1886 | * For Wi-Fi faily generated beacons between participating | ||
1887 | * stations. Set TBTT phase adaptive adjustment step to 8us. | ||
1888 | */ | ||
1889 | rt2x00pci_register_write(rt2x00dev, TXRX_CSR10, 0x00001008); | ||
1890 | |||
1891 | rt2x00pci_register_read(rt2x00dev, TXRX_CSR9, ®); | ||
1892 | if (!rt2x00_get_field32(reg, TXRX_CSR9_BEACON_GEN)) { | ||
1893 | rt2x00_set_field32(®, TXRX_CSR9_TSF_TICKING, 1); | ||
1894 | rt2x00_set_field32(®, TXRX_CSR9_TBTT_ENABLE, 1); | ||
1895 | rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 1); | ||
1896 | rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg); | ||
1897 | } | ||
1898 | return; | ||
1899 | } | ||
1900 | |||
1901 | rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); | 1898 | rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); |
1902 | rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC0, (queue == QID_AC_BE)); | 1899 | rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC0, (queue == QID_AC_BE)); |
1903 | rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC1, (queue == QID_AC_BK)); | 1900 | rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC1, (queue == QID_AC_BK)); |
@@ -1969,12 +1966,8 @@ static void rt61pci_fill_rxdone(struct queue_entry *entry, | |||
1969 | if (rt2x00_get_field32(word0, RXD_W0_CRC_ERROR)) | 1966 | if (rt2x00_get_field32(word0, RXD_W0_CRC_ERROR)) |
1970 | rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; | 1967 | rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; |
1971 | 1968 | ||
1972 | if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) { | 1969 | rxdesc->cipher = rt2x00_get_field32(word0, RXD_W0_CIPHER_ALG); |
1973 | rxdesc->cipher = | 1970 | rxdesc->cipher_status = rt2x00_get_field32(word0, RXD_W0_CIPHER_ERROR); |
1974 | rt2x00_get_field32(word0, RXD_W0_CIPHER_ALG); | ||
1975 | rxdesc->cipher_status = | ||
1976 | rt2x00_get_field32(word0, RXD_W0_CIPHER_ERROR); | ||
1977 | } | ||
1978 | 1971 | ||
1979 | if (rxdesc->cipher != CIPHER_NONE) { | 1972 | if (rxdesc->cipher != CIPHER_NONE) { |
1980 | _rt2x00_desc_read(entry_priv->desc, 2, &rxdesc->iv[0]); | 1973 | _rt2x00_desc_read(entry_priv->desc, 2, &rxdesc->iv[0]); |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 39b3c6d04af4..11c130748206 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -1505,7 +1505,8 @@ static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1505 | /* | 1505 | /* |
1506 | * TX data initialization | 1506 | * TX data initialization |
1507 | */ | 1507 | */ |
1508 | static void rt73usb_write_beacon(struct queue_entry *entry) | 1508 | static void rt73usb_write_beacon(struct queue_entry *entry, |
1509 | struct txentry_desc *txdesc) | ||
1509 | { | 1510 | { |
1510 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 1511 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
1511 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | 1512 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); |
@@ -1537,6 +1538,19 @@ static void rt73usb_write_beacon(struct queue_entry *entry) | |||
1537 | REGISTER_TIMEOUT32(entry->skb->len)); | 1538 | REGISTER_TIMEOUT32(entry->skb->len)); |
1538 | 1539 | ||
1539 | /* | 1540 | /* |
1541 | * Enable beaconing again. | ||
1542 | * | ||
1543 | * For Wi-Fi faily generated beacons between participating stations. | ||
1544 | * Set TBTT phase adaptive adjustment step to 8us (default 16us) | ||
1545 | */ | ||
1546 | rt2x00usb_register_write(rt2x00dev, TXRX_CSR10, 0x00001008); | ||
1547 | |||
1548 | rt2x00_set_field32(®, TXRX_CSR9_TSF_TICKING, 1); | ||
1549 | rt2x00_set_field32(®, TXRX_CSR9_TBTT_ENABLE, 1); | ||
1550 | rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 1); | ||
1551 | rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg); | ||
1552 | |||
1553 | /* | ||
1540 | * Clean up the beacon skb. | 1554 | * Clean up the beacon skb. |
1541 | */ | 1555 | */ |
1542 | dev_kfree_skb(entry->skb); | 1556 | dev_kfree_skb(entry->skb); |
@@ -1557,31 +1571,6 @@ static int rt73usb_get_tx_data_len(struct queue_entry *entry) | |||
1557 | return length; | 1571 | return length; |
1558 | } | 1572 | } |
1559 | 1573 | ||
1560 | static void rt73usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | ||
1561 | const enum data_queue_qid queue) | ||
1562 | { | ||
1563 | u32 reg; | ||
1564 | |||
1565 | if (queue != QID_BEACON) { | ||
1566 | rt2x00usb_kick_tx_queue(rt2x00dev, queue); | ||
1567 | return; | ||
1568 | } | ||
1569 | |||
1570 | /* | ||
1571 | * For Wi-Fi faily generated beacons between participating stations. | ||
1572 | * Set TBTT phase adaptive adjustment step to 8us (default 16us) | ||
1573 | */ | ||
1574 | rt2x00usb_register_write(rt2x00dev, TXRX_CSR10, 0x00001008); | ||
1575 | |||
1576 | rt2x00usb_register_read(rt2x00dev, TXRX_CSR9, ®); | ||
1577 | if (!rt2x00_get_field32(reg, TXRX_CSR9_BEACON_GEN)) { | ||
1578 | rt2x00_set_field32(®, TXRX_CSR9_TSF_TICKING, 1); | ||
1579 | rt2x00_set_field32(®, TXRX_CSR9_TBTT_ENABLE, 1); | ||
1580 | rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 1); | ||
1581 | rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg); | ||
1582 | } | ||
1583 | } | ||
1584 | |||
1585 | /* | 1574 | /* |
1586 | * RX control handlers | 1575 | * RX control handlers |
1587 | */ | 1576 | */ |
@@ -1645,12 +1634,8 @@ static void rt73usb_fill_rxdone(struct queue_entry *entry, | |||
1645 | if (rt2x00_get_field32(word0, RXD_W0_CRC_ERROR)) | 1634 | if (rt2x00_get_field32(word0, RXD_W0_CRC_ERROR)) |
1646 | rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; | 1635 | rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; |
1647 | 1636 | ||
1648 | if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) { | 1637 | rxdesc->cipher = rt2x00_get_field32(word0, RXD_W0_CIPHER_ALG); |
1649 | rxdesc->cipher = | 1638 | rxdesc->cipher_status = rt2x00_get_field32(word0, RXD_W0_CIPHER_ERROR); |
1650 | rt2x00_get_field32(word0, RXD_W0_CIPHER_ALG); | ||
1651 | rxdesc->cipher_status = | ||
1652 | rt2x00_get_field32(word0, RXD_W0_CIPHER_ERROR); | ||
1653 | } | ||
1654 | 1639 | ||
1655 | if (rxdesc->cipher != CIPHER_NONE) { | 1640 | if (rxdesc->cipher != CIPHER_NONE) { |
1656 | _rt2x00_desc_read(rxd, 2, &rxdesc->iv[0]); | 1641 | _rt2x00_desc_read(rxd, 2, &rxdesc->iv[0]); |
@@ -2266,7 +2251,7 @@ static const struct rt2x00lib_ops rt73usb_rt2x00_ops = { | |||
2266 | .write_tx_data = rt2x00usb_write_tx_data, | 2251 | .write_tx_data = rt2x00usb_write_tx_data, |
2267 | .write_beacon = rt73usb_write_beacon, | 2252 | .write_beacon = rt73usb_write_beacon, |
2268 | .get_tx_data_len = rt73usb_get_tx_data_len, | 2253 | .get_tx_data_len = rt73usb_get_tx_data_len, |
2269 | .kick_tx_queue = rt73usb_kick_tx_queue, | 2254 | .kick_tx_queue = rt2x00usb_kick_tx_queue, |
2270 | .kill_tx_queue = rt2x00usb_kill_tx_queue, | 2255 | .kill_tx_queue = rt2x00usb_kill_tx_queue, |
2271 | .fill_rxdone = rt73usb_fill_rxdone, | 2256 | .fill_rxdone = rt73usb_fill_rxdone, |
2272 | .config_shared_key = rt73usb_config_shared_key, | 2257 | .config_shared_key = rt73usb_config_shared_key, |
diff --git a/drivers/net/wireless/rtl818x/rtl8180.h b/drivers/net/wireless/rtl818x/rtl8180.h index de3844fe06d8..4baf0cf0826f 100644 --- a/drivers/net/wireless/rtl818x/rtl8180.h +++ b/drivers/net/wireless/rtl818x/rtl8180.h | |||
@@ -55,6 +55,14 @@ struct rtl8180_tx_ring { | |||
55 | struct sk_buff_head queue; | 55 | struct sk_buff_head queue; |
56 | }; | 56 | }; |
57 | 57 | ||
58 | struct rtl8180_vif { | ||
59 | struct ieee80211_hw *dev; | ||
60 | |||
61 | /* beaconing */ | ||
62 | struct delayed_work beacon_work; | ||
63 | bool enable_beacon; | ||
64 | }; | ||
65 | |||
58 | struct rtl8180_priv { | 66 | struct rtl8180_priv { |
59 | /* common between rtl818x drivers */ | 67 | /* common between rtl818x drivers */ |
60 | struct rtl818x_csr __iomem *map; | 68 | struct rtl818x_csr __iomem *map; |
@@ -78,6 +86,9 @@ struct rtl8180_priv { | |||
78 | u32 anaparam; | 86 | u32 anaparam; |
79 | u16 rfparam; | 87 | u16 rfparam; |
80 | u8 csthreshold; | 88 | u8 csthreshold; |
89 | |||
90 | /* sequence # */ | ||
91 | u16 seqno; | ||
81 | }; | 92 | }; |
82 | 93 | ||
83 | void rtl8180_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data); | 94 | void rtl8180_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data); |
diff --git a/drivers/net/wireless/rtl818x/rtl8180_dev.c b/drivers/net/wireless/rtl818x/rtl8180_dev.c index 21307f2412b8..515817de2905 100644 --- a/drivers/net/wireless/rtl818x/rtl8180_dev.c +++ b/drivers/net/wireless/rtl818x/rtl8180_dev.c | |||
@@ -234,6 +234,7 @@ static irqreturn_t rtl8180_interrupt(int irq, void *dev_id) | |||
234 | static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb) | 234 | static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb) |
235 | { | 235 | { |
236 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 236 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
237 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | ||
237 | struct rtl8180_priv *priv = dev->priv; | 238 | struct rtl8180_priv *priv = dev->priv; |
238 | struct rtl8180_tx_ring *ring; | 239 | struct rtl8180_tx_ring *ring; |
239 | struct rtl8180_tx_desc *entry; | 240 | struct rtl8180_tx_desc *entry; |
@@ -285,6 +286,14 @@ static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
285 | } | 286 | } |
286 | 287 | ||
287 | spin_lock_irqsave(&priv->lock, flags); | 288 | spin_lock_irqsave(&priv->lock, flags); |
289 | |||
290 | if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { | ||
291 | if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) | ||
292 | priv->seqno += 0x10; | ||
293 | hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); | ||
294 | hdr->seq_ctrl |= cpu_to_le16(priv->seqno); | ||
295 | } | ||
296 | |||
288 | idx = (ring->idx + skb_queue_len(&ring->queue)) % ring->entries; | 297 | idx = (ring->idx + skb_queue_len(&ring->queue)) % ring->entries; |
289 | entry = &ring->desc[idx]; | 298 | entry = &ring->desc[idx]; |
290 | 299 | ||
@@ -299,6 +308,7 @@ static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
299 | __skb_queue_tail(&ring->queue, skb); | 308 | __skb_queue_tail(&ring->queue, skb); |
300 | if (ring->entries - skb_queue_len(&ring->queue) < 2) | 309 | if (ring->entries - skb_queue_len(&ring->queue) < 2) |
301 | ieee80211_stop_queue(dev, prio); | 310 | ieee80211_stop_queue(dev, prio); |
311 | |||
302 | spin_unlock_irqrestore(&priv->lock, flags); | 312 | spin_unlock_irqrestore(&priv->lock, flags); |
303 | 313 | ||
304 | rtl818x_iowrite8(priv, &priv->map->TX_DMA_POLLING, (1 << (prio + 4))); | 314 | rtl818x_iowrite8(priv, &priv->map->TX_DMA_POLLING, (1 << (prio + 4))); |
@@ -653,10 +663,59 @@ static void rtl8180_stop(struct ieee80211_hw *dev) | |||
653 | rtl8180_free_tx_ring(dev, i); | 663 | rtl8180_free_tx_ring(dev, i); |
654 | } | 664 | } |
655 | 665 | ||
666 | static u64 rtl8180_get_tsf(struct ieee80211_hw *dev) | ||
667 | { | ||
668 | struct rtl8180_priv *priv = dev->priv; | ||
669 | |||
670 | return rtl818x_ioread32(priv, &priv->map->TSFT[0]) | | ||
671 | (u64)(rtl818x_ioread32(priv, &priv->map->TSFT[1])) << 32; | ||
672 | } | ||
673 | |||
674 | void rtl8180_beacon_work(struct work_struct *work) | ||
675 | { | ||
676 | struct rtl8180_vif *vif_priv = | ||
677 | container_of(work, struct rtl8180_vif, beacon_work.work); | ||
678 | struct ieee80211_vif *vif = | ||
679 | container_of((void *)vif_priv, struct ieee80211_vif, drv_priv); | ||
680 | struct ieee80211_hw *dev = vif_priv->dev; | ||
681 | struct ieee80211_mgmt *mgmt; | ||
682 | struct sk_buff *skb; | ||
683 | int err = 0; | ||
684 | |||
685 | /* don't overflow the tx ring */ | ||
686 | if (ieee80211_queue_stopped(dev, 0)) | ||
687 | goto resched; | ||
688 | |||
689 | /* grab a fresh beacon */ | ||
690 | skb = ieee80211_beacon_get(dev, vif); | ||
691 | |||
692 | /* | ||
693 | * update beacon timestamp w/ TSF value | ||
694 | * TODO: make hardware update beacon timestamp | ||
695 | */ | ||
696 | mgmt = (struct ieee80211_mgmt *)skb->data; | ||
697 | mgmt->u.beacon.timestamp = cpu_to_le64(rtl8180_get_tsf(dev)); | ||
698 | |||
699 | /* TODO: use actual beacon queue */ | ||
700 | skb_set_queue_mapping(skb, 0); | ||
701 | |||
702 | err = rtl8180_tx(dev, skb); | ||
703 | WARN_ON(err); | ||
704 | |||
705 | resched: | ||
706 | /* | ||
707 | * schedule next beacon | ||
708 | * TODO: use hardware support for beacon timing | ||
709 | */ | ||
710 | schedule_delayed_work(&vif_priv->beacon_work, | ||
711 | usecs_to_jiffies(1024 * vif->bss_conf.beacon_int)); | ||
712 | } | ||
713 | |||
656 | static int rtl8180_add_interface(struct ieee80211_hw *dev, | 714 | static int rtl8180_add_interface(struct ieee80211_hw *dev, |
657 | struct ieee80211_vif *vif) | 715 | struct ieee80211_vif *vif) |
658 | { | 716 | { |
659 | struct rtl8180_priv *priv = dev->priv; | 717 | struct rtl8180_priv *priv = dev->priv; |
718 | struct rtl8180_vif *vif_priv; | ||
660 | 719 | ||
661 | /* | 720 | /* |
662 | * We only support one active interface at a time. | 721 | * We only support one active interface at a time. |
@@ -666,6 +725,7 @@ static int rtl8180_add_interface(struct ieee80211_hw *dev, | |||
666 | 725 | ||
667 | switch (vif->type) { | 726 | switch (vif->type) { |
668 | case NL80211_IFTYPE_STATION: | 727 | case NL80211_IFTYPE_STATION: |
728 | case NL80211_IFTYPE_ADHOC: | ||
669 | break; | 729 | break; |
670 | default: | 730 | default: |
671 | return -EOPNOTSUPP; | 731 | return -EOPNOTSUPP; |
@@ -673,6 +733,12 @@ static int rtl8180_add_interface(struct ieee80211_hw *dev, | |||
673 | 733 | ||
674 | priv->vif = vif; | 734 | priv->vif = vif; |
675 | 735 | ||
736 | /* Initialize driver private area */ | ||
737 | vif_priv = (struct rtl8180_vif *)&vif->drv_priv; | ||
738 | vif_priv->dev = dev; | ||
739 | INIT_DELAYED_WORK(&vif_priv->beacon_work, rtl8180_beacon_work); | ||
740 | vif_priv->enable_beacon = false; | ||
741 | |||
676 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); | 742 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); |
677 | rtl818x_iowrite32(priv, (__le32 __iomem *)&priv->map->MAC[0], | 743 | rtl818x_iowrite32(priv, (__le32 __iomem *)&priv->map->MAC[0], |
678 | le32_to_cpu(*(__le32 *)vif->addr)); | 744 | le32_to_cpu(*(__le32 *)vif->addr)); |
@@ -706,8 +772,11 @@ static void rtl8180_bss_info_changed(struct ieee80211_hw *dev, | |||
706 | u32 changed) | 772 | u32 changed) |
707 | { | 773 | { |
708 | struct rtl8180_priv *priv = dev->priv; | 774 | struct rtl8180_priv *priv = dev->priv; |
775 | struct rtl8180_vif *vif_priv; | ||
709 | int i; | 776 | int i; |
710 | 777 | ||
778 | vif_priv = (struct rtl8180_vif *)&vif->drv_priv; | ||
779 | |||
711 | if (changed & BSS_CHANGED_BSSID) { | 780 | if (changed & BSS_CHANGED_BSSID) { |
712 | for (i = 0; i < ETH_ALEN; i++) | 781 | for (i = 0; i < ETH_ALEN; i++) |
713 | rtl818x_iowrite8(priv, &priv->map->BSSID[i], | 782 | rtl818x_iowrite8(priv, &priv->map->BSSID[i], |
@@ -722,7 +791,16 @@ static void rtl8180_bss_info_changed(struct ieee80211_hw *dev, | |||
722 | } | 791 | } |
723 | 792 | ||
724 | if (changed & BSS_CHANGED_ERP_SLOT && priv->rf->conf_erp) | 793 | if (changed & BSS_CHANGED_ERP_SLOT && priv->rf->conf_erp) |
725 | priv->rf->conf_erp(dev, info); | 794 | priv->rf->conf_erp(dev, info); |
795 | |||
796 | if (changed & BSS_CHANGED_BEACON_ENABLED) | ||
797 | vif_priv->enable_beacon = info->enable_beacon; | ||
798 | |||
799 | if (changed & (BSS_CHANGED_BEACON_ENABLED | BSS_CHANGED_BEACON)) { | ||
800 | cancel_delayed_work_sync(&vif_priv->beacon_work); | ||
801 | if (vif_priv->enable_beacon) | ||
802 | schedule_work(&vif_priv->beacon_work.work); | ||
803 | } | ||
726 | } | 804 | } |
727 | 805 | ||
728 | static u64 rtl8180_prepare_multicast(struct ieee80211_hw *dev, | 806 | static u64 rtl8180_prepare_multicast(struct ieee80211_hw *dev, |
@@ -763,14 +841,6 @@ static void rtl8180_configure_filter(struct ieee80211_hw *dev, | |||
763 | rtl818x_iowrite32(priv, &priv->map->RX_CONF, priv->rx_conf); | 841 | rtl818x_iowrite32(priv, &priv->map->RX_CONF, priv->rx_conf); |
764 | } | 842 | } |
765 | 843 | ||
766 | static u64 rtl8180_get_tsf(struct ieee80211_hw *dev) | ||
767 | { | ||
768 | struct rtl8180_priv *priv = dev->priv; | ||
769 | |||
770 | return rtl818x_ioread32(priv, &priv->map->TSFT[0]) | | ||
771 | (u64)(rtl818x_ioread32(priv, &priv->map->TSFT[1])) << 32; | ||
772 | } | ||
773 | |||
774 | static const struct ieee80211_ops rtl8180_ops = { | 844 | static const struct ieee80211_ops rtl8180_ops = { |
775 | .tx = rtl8180_tx, | 845 | .tx = rtl8180_tx, |
776 | .start = rtl8180_start, | 846 | .start = rtl8180_start, |
@@ -857,8 +927,8 @@ static int __devinit rtl8180_probe(struct pci_dev *pdev, | |||
857 | goto err_free_reg; | 927 | goto err_free_reg; |
858 | } | 928 | } |
859 | 929 | ||
860 | if ((err = pci_set_dma_mask(pdev, 0xFFFFFF00ULL)) || | 930 | if ((err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) || |
861 | (err = pci_set_consistent_dma_mask(pdev, 0xFFFFFF00ULL))) { | 931 | (err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)))) { |
862 | printk(KERN_ERR "%s (rtl8180): No suitable DMA available\n", | 932 | printk(KERN_ERR "%s (rtl8180): No suitable DMA available\n", |
863 | pci_name(pdev)); | 933 | pci_name(pdev)); |
864 | goto err_free_reg; | 934 | goto err_free_reg; |
@@ -907,7 +977,9 @@ static int __devinit rtl8180_probe(struct pci_dev *pdev, | |||
907 | dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | | 977 | dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | |
908 | IEEE80211_HW_RX_INCLUDES_FCS | | 978 | IEEE80211_HW_RX_INCLUDES_FCS | |
909 | IEEE80211_HW_SIGNAL_UNSPEC; | 979 | IEEE80211_HW_SIGNAL_UNSPEC; |
910 | dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); | 980 | dev->vif_data_size = sizeof(struct rtl8180_vif); |
981 | dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | | ||
982 | BIT(NL80211_IFTYPE_ADHOC); | ||
911 | dev->queues = 1; | 983 | dev->queues = 1; |
912 | dev->max_signal = 65; | 984 | dev->max_signal = 65; |
913 | 985 | ||
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h index 75887e74205b..6f1b6b5640c0 100644 --- a/drivers/net/wireless/wl12xx/wl1271.h +++ b/drivers/net/wireless/wl12xx/wl1271.h | |||
@@ -388,6 +388,8 @@ struct wl1271 { | |||
388 | size_t fw_len; | 388 | size_t fw_len; |
389 | struct wl1271_nvs_file *nvs; | 389 | struct wl1271_nvs_file *nvs; |
390 | 390 | ||
391 | s8 hw_pg_ver; | ||
392 | |||
391 | u8 bssid[ETH_ALEN]; | 393 | u8 bssid[ETH_ALEN]; |
392 | u8 mac_addr[ETH_ALEN]; | 394 | u8 mac_addr[ETH_ALEN]; |
393 | u8 bss_type; | 395 | u8 bss_type; |
@@ -479,7 +481,7 @@ struct wl1271 { | |||
479 | struct wl1271_stats stats; | 481 | struct wl1271_stats stats; |
480 | struct wl1271_debugfs debugfs; | 482 | struct wl1271_debugfs debugfs; |
481 | 483 | ||
482 | u32 buffer_32; | 484 | __le32 buffer_32; |
483 | u32 buffer_cmd; | 485 | u32 buffer_cmd; |
484 | u32 buffer_busyword[WL1271_BUSY_WORD_CNT]; | 486 | u32 buffer_busyword[WL1271_BUSY_WORD_CNT]; |
485 | 487 | ||
diff --git a/drivers/net/wireless/wl12xx/wl1271_boot.c b/drivers/net/wireless/wl12xx/wl1271_boot.c index acb1d9e6b7d2..1a36d8a2196e 100644 --- a/drivers/net/wireless/wl12xx/wl1271_boot.c +++ b/drivers/net/wireless/wl12xx/wl1271_boot.c | |||
@@ -441,11 +441,23 @@ static int wl1271_boot_write_irq_polarity(struct wl1271 *wl) | |||
441 | return 0; | 441 | return 0; |
442 | } | 442 | } |
443 | 443 | ||
444 | static void wl1271_boot_hw_version(struct wl1271 *wl) | ||
445 | { | ||
446 | u32 fuse; | ||
447 | |||
448 | fuse = wl1271_top_reg_read(wl, REG_FUSE_DATA_2_1); | ||
449 | fuse = (fuse & PG_VER_MASK) >> PG_VER_OFFSET; | ||
450 | |||
451 | wl->hw_pg_ver = (s8)fuse; | ||
452 | } | ||
453 | |||
444 | int wl1271_boot(struct wl1271 *wl) | 454 | int wl1271_boot(struct wl1271 *wl) |
445 | { | 455 | { |
446 | int ret = 0; | 456 | int ret = 0; |
447 | u32 tmp, clk, pause; | 457 | u32 tmp, clk, pause; |
448 | 458 | ||
459 | wl1271_boot_hw_version(wl); | ||
460 | |||
449 | if (REF_CLOCK == 0 || REF_CLOCK == 2 || REF_CLOCK == 4) | 461 | if (REF_CLOCK == 0 || REF_CLOCK == 2 || REF_CLOCK == 4) |
450 | /* ref clk: 19.2/38.4/38.4-XTAL */ | 462 | /* ref clk: 19.2/38.4/38.4-XTAL */ |
451 | clk = 0x3; | 463 | clk = 0x3; |
diff --git a/drivers/net/wireless/wl12xx/wl1271_boot.h b/drivers/net/wireless/wl12xx/wl1271_boot.h index 95ecc5241959..f829699d597e 100644 --- a/drivers/net/wireless/wl12xx/wl1271_boot.h +++ b/drivers/net/wireless/wl12xx/wl1271_boot.h | |||
@@ -55,6 +55,9 @@ struct wl1271_static_data { | |||
55 | #define OCP_REG_CLK_POLARITY 0x0cb2 | 55 | #define OCP_REG_CLK_POLARITY 0x0cb2 |
56 | #define OCP_REG_CLK_PULL 0x0cb4 | 56 | #define OCP_REG_CLK_PULL 0x0cb4 |
57 | 57 | ||
58 | #define REG_FUSE_DATA_2_1 0x050a | ||
59 | #define PG_VER_MASK 0x3c | ||
60 | #define PG_VER_OFFSET 2 | ||
58 | 61 | ||
59 | #define CMD_MBOX_ADDRESS 0x407B4 | 62 | #define CMD_MBOX_ADDRESS 0x407B4 |
60 | 63 | ||
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c index 62c11af1d8e2..19393e236e2c 100644 --- a/drivers/net/wireless/wl12xx/wl1271_cmd.c +++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c | |||
@@ -516,7 +516,7 @@ int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode, bool send) | |||
516 | ps_params->ps_mode = ps_mode; | 516 | ps_params->ps_mode = ps_mode; |
517 | ps_params->send_null_data = send; | 517 | ps_params->send_null_data = send; |
518 | ps_params->retries = 5; | 518 | ps_params->retries = 5; |
519 | ps_params->hang_over_period = 128; | 519 | ps_params->hang_over_period = 1; |
520 | ps_params->null_data_rate = cpu_to_le32(1); /* 1 Mbps */ | 520 | ps_params->null_data_rate = cpu_to_le32(1); /* 1 Mbps */ |
521 | 521 | ||
522 | ret = wl1271_cmd_send(wl, CMD_SET_PS_MODE, ps_params, | 522 | ret = wl1271_cmd_send(wl, CMD_SET_PS_MODE, ps_params, |
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.h b/drivers/net/wireless/wl12xx/wl1271_cmd.h index 00f78b7aa384..f2820b42a943 100644 --- a/drivers/net/wireless/wl12xx/wl1271_cmd.h +++ b/drivers/net/wireless/wl12xx/wl1271_cmd.h | |||
@@ -129,7 +129,7 @@ enum cmd_templ { | |||
129 | /* unit ms */ | 129 | /* unit ms */ |
130 | #define WL1271_COMMAND_TIMEOUT 2000 | 130 | #define WL1271_COMMAND_TIMEOUT 2000 |
131 | #define WL1271_CMD_TEMPL_MAX_SIZE 252 | 131 | #define WL1271_CMD_TEMPL_MAX_SIZE 252 |
132 | #define WL1271_EVENT_TIMEOUT 100 | 132 | #define WL1271_EVENT_TIMEOUT 750 |
133 | 133 | ||
134 | struct wl1271_cmd_header { | 134 | struct wl1271_cmd_header { |
135 | __le16 id; | 135 | __le16 id; |
diff --git a/drivers/net/wireless/wl12xx/wl1271_io.h b/drivers/net/wireless/wl12xx/wl1271_io.h index d8837ef0bb40..bc806c74c63a 100644 --- a/drivers/net/wireless/wl12xx/wl1271_io.h +++ b/drivers/net/wireless/wl12xx/wl1271_io.h | |||
@@ -74,12 +74,12 @@ static inline u32 wl1271_raw_read32(struct wl1271 *wl, int addr) | |||
74 | wl1271_raw_read(wl, addr, &wl->buffer_32, | 74 | wl1271_raw_read(wl, addr, &wl->buffer_32, |
75 | sizeof(wl->buffer_32), false); | 75 | sizeof(wl->buffer_32), false); |
76 | 76 | ||
77 | return wl->buffer_32; | 77 | return le32_to_cpu(wl->buffer_32); |
78 | } | 78 | } |
79 | 79 | ||
80 | static inline void wl1271_raw_write32(struct wl1271 *wl, int addr, u32 val) | 80 | static inline void wl1271_raw_write32(struct wl1271 *wl, int addr, u32 val) |
81 | { | 81 | { |
82 | wl->buffer_32 = val; | 82 | wl->buffer_32 = cpu_to_le32(val); |
83 | wl1271_raw_write(wl, addr, &wl->buffer_32, | 83 | wl1271_raw_write(wl, addr, &wl->buffer_32, |
84 | sizeof(wl->buffer_32), false); | 84 | sizeof(wl->buffer_32), false); |
85 | } | 85 | } |
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c index 62e544041d0d..5bb9e3fff961 100644 --- a/drivers/net/wireless/wl12xx/wl1271_main.c +++ b/drivers/net/wireless/wl12xx/wl1271_main.c | |||
@@ -1140,10 +1140,25 @@ out: | |||
1140 | return ret; | 1140 | return ret; |
1141 | } | 1141 | } |
1142 | 1142 | ||
1143 | static int wl1271_join(struct wl1271 *wl) | 1143 | static int wl1271_join(struct wl1271 *wl, bool set_assoc) |
1144 | { | 1144 | { |
1145 | int ret; | 1145 | int ret; |
1146 | 1146 | ||
1147 | /* | ||
1148 | * One of the side effects of the JOIN command is that is clears | ||
1149 | * WPA/WPA2 keys from the chipset. Performing a JOIN while associated | ||
1150 | * to a WPA/WPA2 access point will therefore kill the data-path. | ||
1151 | * Currently there is no supported scenario for JOIN during | ||
1152 | * association - if it becomes a supported scenario, the WPA/WPA2 keys | ||
1153 | * must be handled somehow. | ||
1154 | * | ||
1155 | */ | ||
1156 | if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) | ||
1157 | wl1271_info("JOIN while associated."); | ||
1158 | |||
1159 | if (set_assoc) | ||
1160 | set_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags); | ||
1161 | |||
1147 | ret = wl1271_cmd_join(wl, wl->set_bss_type); | 1162 | ret = wl1271_cmd_join(wl, wl->set_bss_type); |
1148 | if (ret < 0) | 1163 | if (ret < 0) |
1149 | goto out; | 1164 | goto out; |
@@ -1190,7 +1205,6 @@ static int wl1271_unjoin(struct wl1271 *wl) | |||
1190 | goto out; | 1205 | goto out; |
1191 | 1206 | ||
1192 | clear_bit(WL1271_FLAG_JOINED, &wl->flags); | 1207 | clear_bit(WL1271_FLAG_JOINED, &wl->flags); |
1193 | wl->channel = 0; | ||
1194 | memset(wl->bssid, 0, ETH_ALEN); | 1208 | memset(wl->bssid, 0, ETH_ALEN); |
1195 | 1209 | ||
1196 | /* stop filterting packets based on bssid */ | 1210 | /* stop filterting packets based on bssid */ |
@@ -1250,7 +1264,9 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) | |||
1250 | goto out; | 1264 | goto out; |
1251 | 1265 | ||
1252 | /* if the channel changes while joined, join again */ | 1266 | /* if the channel changes while joined, join again */ |
1253 | if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { | 1267 | if (changed & IEEE80211_CONF_CHANGE_CHANNEL && |
1268 | ((wl->band != conf->channel->band) || | ||
1269 | (wl->channel != channel))) { | ||
1254 | wl->band = conf->channel->band; | 1270 | wl->band = conf->channel->band; |
1255 | wl->channel = channel; | 1271 | wl->channel = channel; |
1256 | 1272 | ||
@@ -1270,7 +1286,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) | |||
1270 | "failed %d", ret); | 1286 | "failed %d", ret); |
1271 | 1287 | ||
1272 | if (test_bit(WL1271_FLAG_JOINED, &wl->flags)) { | 1288 | if (test_bit(WL1271_FLAG_JOINED, &wl->flags)) { |
1273 | ret = wl1271_join(wl); | 1289 | ret = wl1271_join(wl, false); |
1274 | if (ret < 0) | 1290 | if (ret < 0) |
1275 | wl1271_warning("cmd join to update channel " | 1291 | wl1271_warning("cmd join to update channel " |
1276 | "failed %d", ret); | 1292 | "failed %d", ret); |
@@ -1647,6 +1663,7 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1647 | enum wl1271_cmd_ps_mode mode; | 1663 | enum wl1271_cmd_ps_mode mode; |
1648 | struct wl1271 *wl = hw->priv; | 1664 | struct wl1271 *wl = hw->priv; |
1649 | bool do_join = false; | 1665 | bool do_join = false; |
1666 | bool set_assoc = false; | ||
1650 | int ret; | 1667 | int ret; |
1651 | 1668 | ||
1652 | wl1271_debug(DEBUG_MAC80211, "mac80211 bss info changed"); | 1669 | wl1271_debug(DEBUG_MAC80211, "mac80211 bss info changed"); |
@@ -1756,7 +1773,7 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1756 | if (bss_conf->assoc) { | 1773 | if (bss_conf->assoc) { |
1757 | u32 rates; | 1774 | u32 rates; |
1758 | wl->aid = bss_conf->aid; | 1775 | wl->aid = bss_conf->aid; |
1759 | set_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags); | 1776 | set_assoc = true; |
1760 | 1777 | ||
1761 | /* | 1778 | /* |
1762 | * use basic rates from AP, and determine lowest rate | 1779 | * use basic rates from AP, and determine lowest rate |
@@ -1856,7 +1873,7 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1856 | } | 1873 | } |
1857 | 1874 | ||
1858 | if (do_join) { | 1875 | if (do_join) { |
1859 | ret = wl1271_join(wl); | 1876 | ret = wl1271_join(wl, set_assoc); |
1860 | if (ret < 0) { | 1877 | if (ret < 0) { |
1861 | wl1271_warning("cmd join failed %d", ret); | 1878 | wl1271_warning("cmd join failed %d", ret); |
1862 | goto out_sleep; | 1879 | goto out_sleep; |
@@ -2228,6 +2245,29 @@ static DEVICE_ATTR(bt_coex_state, S_IRUGO | S_IWUSR, | |||
2228 | wl1271_sysfs_show_bt_coex_state, | 2245 | wl1271_sysfs_show_bt_coex_state, |
2229 | wl1271_sysfs_store_bt_coex_state); | 2246 | wl1271_sysfs_store_bt_coex_state); |
2230 | 2247 | ||
2248 | static ssize_t wl1271_sysfs_show_hw_pg_ver(struct device *dev, | ||
2249 | struct device_attribute *attr, | ||
2250 | char *buf) | ||
2251 | { | ||
2252 | struct wl1271 *wl = dev_get_drvdata(dev); | ||
2253 | ssize_t len; | ||
2254 | |||
2255 | /* FIXME: what's the maximum length of buf? page size?*/ | ||
2256 | len = 500; | ||
2257 | |||
2258 | mutex_lock(&wl->mutex); | ||
2259 | if (wl->hw_pg_ver >= 0) | ||
2260 | len = snprintf(buf, len, "%d\n", wl->hw_pg_ver); | ||
2261 | else | ||
2262 | len = snprintf(buf, len, "n/a\n"); | ||
2263 | mutex_unlock(&wl->mutex); | ||
2264 | |||
2265 | return len; | ||
2266 | } | ||
2267 | |||
2268 | static DEVICE_ATTR(hw_pg_ver, S_IRUGO | S_IWUSR, | ||
2269 | wl1271_sysfs_show_hw_pg_ver, NULL); | ||
2270 | |||
2231 | int wl1271_register_hw(struct wl1271 *wl) | 2271 | int wl1271_register_hw(struct wl1271 *wl) |
2232 | { | 2272 | { |
2233 | int ret; | 2273 | int ret; |
@@ -2347,6 +2387,7 @@ struct ieee80211_hw *wl1271_alloc_hw(void) | |||
2347 | wl->vif = NULL; | 2387 | wl->vif = NULL; |
2348 | wl->flags = 0; | 2388 | wl->flags = 0; |
2349 | wl->sg_enabled = true; | 2389 | wl->sg_enabled = true; |
2390 | wl->hw_pg_ver = -1; | ||
2350 | 2391 | ||
2351 | for (i = 0; i < ACX_TX_DESCRIPTORS; i++) | 2392 | for (i = 0; i < ACX_TX_DESCRIPTORS; i++) |
2352 | wl->tx_frames[i] = NULL; | 2393 | wl->tx_frames[i] = NULL; |
@@ -2376,8 +2417,18 @@ struct ieee80211_hw *wl1271_alloc_hw(void) | |||
2376 | goto err_platform; | 2417 | goto err_platform; |
2377 | } | 2418 | } |
2378 | 2419 | ||
2420 | /* Create sysfs file to get HW PG version */ | ||
2421 | ret = device_create_file(&wl->plat_dev->dev, &dev_attr_hw_pg_ver); | ||
2422 | if (ret < 0) { | ||
2423 | wl1271_error("failed to create sysfs file hw_pg_ver"); | ||
2424 | goto err_bt_coex_state; | ||
2425 | } | ||
2426 | |||
2379 | return hw; | 2427 | return hw; |
2380 | 2428 | ||
2429 | err_bt_coex_state: | ||
2430 | device_remove_file(&wl->plat_dev->dev, &dev_attr_bt_coex_state); | ||
2431 | |||
2381 | err_platform: | 2432 | err_platform: |
2382 | platform_device_unregister(wl->plat_dev); | 2433 | platform_device_unregister(wl->plat_dev); |
2383 | 2434 | ||