@@ -50,9 +50,11 @@ static u16 bits_per_symbol[][2] = {
50
50
static void ath_tx_send_normal (struct ath_softc * sc , struct ath_txq * txq ,
51
51
struct ath_atx_tid * tid , struct sk_buff * skb );
52
52
static void ath_tx_complete (struct ath_softc * sc , struct sk_buff * skb ,
53
- int tx_flags , struct ath_txq * txq );
53
+ int tx_flags , struct ath_txq * txq ,
54
+ struct ieee80211_sta * sta );
54
55
static void ath_tx_complete_buf (struct ath_softc * sc , struct ath_buf * bf ,
55
56
struct ath_txq * txq , struct list_head * bf_q ,
57
+ struct ieee80211_sta * sta ,
56
58
struct ath_tx_status * ts , int txok );
57
59
static void ath_tx_txqaddbuf (struct ath_softc * sc , struct ath_txq * txq ,
58
60
struct list_head * head , bool internal );
@@ -77,6 +79,22 @@ enum {
77
79
/* Aggregation logic */
78
80
/*********************/
79
81
82
+ static void ath_tx_status (struct ieee80211_hw * hw , struct sk_buff * skb )
83
+ {
84
+ struct ieee80211_tx_info * info = IEEE80211_SKB_CB (skb );
85
+ struct ieee80211_sta * sta = info -> status .status_driver_data [0 ];
86
+
87
+ if (info -> flags & IEEE80211_TX_CTL_REQ_TX_STATUS ) {
88
+ ieee80211_tx_status (hw , skb );
89
+ return ;
90
+ }
91
+
92
+ if (sta )
93
+ ieee80211_tx_status_noskb (hw , sta , info );
94
+
95
+ dev_kfree_skb (skb );
96
+ }
97
+
80
98
void ath_txq_lock (struct ath_softc * sc , struct ath_txq * txq )
81
99
__acquires (& txq - > axq_lock )
82
100
{
@@ -92,6 +110,7 @@ void ath_txq_unlock(struct ath_softc *sc, struct ath_txq *txq)
92
110
void ath_txq_unlock_complete (struct ath_softc * sc , struct ath_txq * txq )
93
111
__releases (& txq - > axq_lock )
94
112
{
113
+ struct ieee80211_hw * hw = sc -> hw ;
95
114
struct sk_buff_head q ;
96
115
struct sk_buff * skb ;
97
116
@@ -100,7 +119,7 @@ void ath_txq_unlock_complete(struct ath_softc *sc, struct ath_txq *txq)
100
119
spin_unlock_bh (& txq -> axq_lock );
101
120
102
121
while ((skb = __skb_dequeue (& q )))
103
- ieee80211_tx_status ( sc -> hw , skb );
122
+ ath_tx_status ( hw , skb );
104
123
}
105
124
106
125
static void ath_tx_queue_tid (struct ath_softc * sc , struct ath_txq * txq ,
@@ -253,7 +272,7 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
253
272
}
254
273
255
274
list_add_tail (& bf -> list , & bf_head );
256
- ath_tx_complete_buf (sc , bf , txq , & bf_head , & ts , 0 );
275
+ ath_tx_complete_buf (sc , bf , txq , & bf_head , NULL , & ts , 0 );
257
276
}
258
277
259
278
if (sendbar ) {
@@ -318,12 +337,12 @@ static void ath_tid_drain(struct ath_softc *sc, struct ath_txq *txq,
318
337
bf = fi -> bf ;
319
338
320
339
if (!bf ) {
321
- ath_tx_complete (sc , skb , ATH_TX_ERROR , txq );
340
+ ath_tx_complete (sc , skb , ATH_TX_ERROR , txq , NULL );
322
341
continue ;
323
342
}
324
343
325
344
list_add_tail (& bf -> list , & bf_head );
326
- ath_tx_complete_buf (sc , bf , txq , & bf_head , & ts , 0 );
345
+ ath_tx_complete_buf (sc , bf , txq , & bf_head , NULL , & ts , 0 );
327
346
}
328
347
}
329
348
@@ -426,12 +445,11 @@ static void ath_tx_count_frames(struct ath_softc *sc, struct ath_buf *bf,
426
445
427
446
static void ath_tx_complete_aggr (struct ath_softc * sc , struct ath_txq * txq ,
428
447
struct ath_buf * bf , struct list_head * bf_q ,
448
+ struct ieee80211_sta * sta ,
429
449
struct ath_tx_status * ts , int txok )
430
450
{
431
451
struct ath_node * an = NULL ;
432
452
struct sk_buff * skb ;
433
- struct ieee80211_sta * sta ;
434
- struct ieee80211_hw * hw = sc -> hw ;
435
453
struct ieee80211_hdr * hdr ;
436
454
struct ieee80211_tx_info * tx_info ;
437
455
struct ath_atx_tid * tid = NULL ;
@@ -460,20 +478,15 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
460
478
for (i = 0 ; i < ts -> ts_rateindex ; i ++ )
461
479
retries += rates [i ].count ;
462
480
463
- rcu_read_lock ();
464
-
465
- sta = ieee80211_find_sta_by_ifaddr (hw , hdr -> addr1 , hdr -> addr2 );
466
481
if (!sta ) {
467
- rcu_read_unlock ();
468
-
469
482
INIT_LIST_HEAD (& bf_head );
470
483
while (bf ) {
471
484
bf_next = bf -> bf_next ;
472
485
473
486
if (!bf -> bf_state .stale || bf_next != NULL )
474
487
list_move_tail (& bf -> list , & bf_head );
475
488
476
- ath_tx_complete_buf (sc , bf , txq , & bf_head , ts , 0 );
489
+ ath_tx_complete_buf (sc , bf , txq , & bf_head , NULL , ts , 0 );
477
490
478
491
bf = bf_next ;
479
492
}
@@ -583,7 +596,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
583
596
ts );
584
597
}
585
598
586
- ath_tx_complete_buf (sc , bf , txq , & bf_head , ts ,
599
+ ath_tx_complete_buf (sc , bf , txq , & bf_head , sta , ts ,
587
600
!txfail );
588
601
} else {
589
602
if (tx_info -> flags & IEEE80211_TX_STATUS_EOSP ) {
@@ -604,7 +617,8 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
604
617
ath_tx_update_baw (sc , tid , seqno );
605
618
606
619
ath_tx_complete_buf (sc , bf , txq ,
607
- & bf_head , ts , 0 );
620
+ & bf_head , NULL , ts ,
621
+ 0 );
608
622
bar_index = max_t (int , bar_index ,
609
623
ATH_BA_INDEX (seq_first , seqno ));
610
624
break ;
@@ -648,8 +662,6 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
648
662
ath_txq_lock (sc , txq );
649
663
}
650
664
651
- rcu_read_unlock ();
652
-
653
665
if (needreset )
654
666
ath9k_queue_reset (sc , RESET_TYPE_TX_ERROR );
655
667
}
@@ -664,7 +676,10 @@ static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq,
664
676
struct ath_tx_status * ts , struct ath_buf * bf ,
665
677
struct list_head * bf_head )
666
678
{
679
+ struct ieee80211_hw * hw = sc -> hw ;
667
680
struct ieee80211_tx_info * info ;
681
+ struct ieee80211_sta * sta ;
682
+ struct ieee80211_hdr * hdr ;
668
683
bool txok , flush ;
669
684
670
685
txok = !(ts -> ts_status & ATH9K_TXERR_MASK );
@@ -677,6 +692,10 @@ static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq,
677
692
678
693
ts -> duration = ath9k_hw_get_duration (sc -> sc_ah , bf -> bf_desc ,
679
694
ts -> ts_rateindex );
695
+
696
+ hdr = (struct ieee80211_hdr * ) bf -> bf_mpdu -> data ;
697
+ sta = ieee80211_find_sta_by_ifaddr (hw , hdr -> addr1 , hdr -> addr2 );
698
+
680
699
if (!bf_isampdu (bf )) {
681
700
if (!flush ) {
682
701
info = IEEE80211_SKB_CB (bf -> bf_mpdu );
@@ -685,9 +704,9 @@ static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq,
685
704
ath_tx_rc_status (sc , bf , ts , 1 , txok ? 0 : 1 , txok );
686
705
ath_dynack_sample_tx_ts (sc -> sc_ah , bf -> bf_mpdu , ts );
687
706
}
688
- ath_tx_complete_buf (sc , bf , txq , bf_head , ts , txok );
707
+ ath_tx_complete_buf (sc , bf , txq , bf_head , sta , ts , txok );
689
708
} else
690
- ath_tx_complete_aggr (sc , txq , bf , bf_head , ts , txok );
709
+ ath_tx_complete_aggr (sc , txq , bf , bf_head , sta , ts , txok );
691
710
692
711
if (!flush )
693
712
ath_txq_schedule (sc , txq );
@@ -923,7 +942,7 @@ ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq,
923
942
list_add (& bf -> list , & bf_head );
924
943
__skb_unlink (skb , * q );
925
944
ath_tx_update_baw (sc , tid , seqno );
926
- ath_tx_complete_buf (sc , bf , txq , & bf_head , & ts , 0 );
945
+ ath_tx_complete_buf (sc , bf , txq , & bf_head , NULL , & ts , 0 );
927
946
continue ;
928
947
}
929
948
@@ -1832,6 +1851,7 @@ static void ath_drain_txq_list(struct ath_softc *sc, struct ath_txq *txq,
1832
1851
*/
1833
1852
void ath_draintxq (struct ath_softc * sc , struct ath_txq * txq )
1834
1853
{
1854
+ rcu_read_lock ();
1835
1855
ath_txq_lock (sc , txq );
1836
1856
1837
1857
if (sc -> sc_ah -> caps .hw_caps & ATH9K_HW_CAP_EDMA ) {
@@ -1850,6 +1870,7 @@ void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq)
1850
1870
ath_drain_txq_list (sc , txq , & txq -> axq_q );
1851
1871
1852
1872
ath_txq_unlock_complete (sc , txq );
1873
+ rcu_read_unlock ();
1853
1874
}
1854
1875
1855
1876
bool ath_drain_all_txq (struct ath_softc * sc )
@@ -2472,7 +2493,8 @@ void ath_tx_cabq(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2472
2493
/*****************/
2473
2494
2474
2495
static void ath_tx_complete (struct ath_softc * sc , struct sk_buff * skb ,
2475
- int tx_flags , struct ath_txq * txq )
2496
+ int tx_flags , struct ath_txq * txq ,
2497
+ struct ieee80211_sta * sta )
2476
2498
{
2477
2499
struct ieee80211_tx_info * tx_info = IEEE80211_SKB_CB (skb );
2478
2500
struct ath_common * common = ath9k_hw_common (sc -> sc_ah );
@@ -2492,15 +2514,17 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
2492
2514
tx_info -> flags |= IEEE80211_TX_STAT_ACK ;
2493
2515
}
2494
2516
2495
- padpos = ieee80211_hdrlen (hdr -> frame_control );
2496
- padsize = padpos & 3 ;
2497
- if (padsize && skb -> len > padpos + padsize ) {
2498
- /*
2499
- * Remove MAC header padding before giving the frame back to
2500
- * mac80211.
2501
- */
2502
- memmove (skb -> data + padsize , skb -> data , padpos );
2503
- skb_pull (skb , padsize );
2517
+ if (tx_info -> flags & IEEE80211_TX_CTL_REQ_TX_STATUS ) {
2518
+ padpos = ieee80211_hdrlen (hdr -> frame_control );
2519
+ padsize = padpos & 3 ;
2520
+ if (padsize && skb -> len > padpos + padsize ) {
2521
+ /*
2522
+ * Remove MAC header padding before giving the frame back to
2523
+ * mac80211.
2524
+ */
2525
+ memmove (skb -> data + padsize , skb -> data , padpos );
2526
+ skb_pull (skb , padsize );
2527
+ }
2504
2528
}
2505
2529
2506
2530
spin_lock_irqsave (& sc -> sc_pm_lock , flags );
@@ -2515,12 +2539,14 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
2515
2539
}
2516
2540
spin_unlock_irqrestore (& sc -> sc_pm_lock , flags );
2517
2541
2518
- __skb_queue_tail (& txq -> complete_q , skb );
2519
2542
ath_txq_skb_done (sc , txq , skb );
2543
+ tx_info -> status .status_driver_data [0 ] = sta ;
2544
+ __skb_queue_tail (& txq -> complete_q , skb );
2520
2545
}
2521
2546
2522
2547
static void ath_tx_complete_buf (struct ath_softc * sc , struct ath_buf * bf ,
2523
2548
struct ath_txq * txq , struct list_head * bf_q ,
2549
+ struct ieee80211_sta * sta ,
2524
2550
struct ath_tx_status * ts , int txok )
2525
2551
{
2526
2552
struct sk_buff * skb = bf -> bf_mpdu ;
@@ -2548,7 +2574,7 @@ static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
2548
2574
complete (& sc -> paprd_complete );
2549
2575
} else {
2550
2576
ath_debug_stat_tx (sc , bf , ts , txq , tx_flags );
2551
- ath_tx_complete (sc , skb , tx_flags , txq );
2577
+ ath_tx_complete (sc , skb , tx_flags , txq , sta );
2552
2578
}
2553
2579
skip_tx_complete :
2554
2580
/* At this point, skb (bf->bf_mpdu) is consumed...make sure we don't
@@ -2700,10 +2726,12 @@ void ath_tx_tasklet(struct ath_softc *sc)
2700
2726
u32 qcumask = ((1 << ATH9K_NUM_TX_QUEUES ) - 1 ) & ah -> intr_txqs ;
2701
2727
int i ;
2702
2728
2729
+ rcu_read_lock ();
2703
2730
for (i = 0 ; i < ATH9K_NUM_TX_QUEUES ; i ++ ) {
2704
2731
if (ATH_TXQ_SETUP (sc , i ) && (qcumask & (1 << i )))
2705
2732
ath_tx_processq (sc , & sc -> tx .txq [i ]);
2706
2733
}
2734
+ rcu_read_unlock ();
2707
2735
}
2708
2736
2709
2737
void ath_tx_edma_tasklet (struct ath_softc * sc )
@@ -2717,6 +2745,7 @@ void ath_tx_edma_tasklet(struct ath_softc *sc)
2717
2745
struct list_head * fifo_list ;
2718
2746
int status ;
2719
2747
2748
+ rcu_read_lock ();
2720
2749
for (;;) {
2721
2750
if (test_bit (ATH_OP_HW_RESET , & common -> op_flags ))
2722
2751
break ;
@@ -2787,6 +2816,7 @@ void ath_tx_edma_tasklet(struct ath_softc *sc)
2787
2816
ath_tx_process_buffer (sc , txq , & ts , bf , & bf_head );
2788
2817
ath_txq_unlock_complete (sc , txq );
2789
2818
}
2819
+ rcu_read_unlock ();
2790
2820
}
2791
2821
2792
2822
/*****************/
0 commit comments