@@ -324,8 +324,6 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
324
324
else
325
325
txwi -> wcid = 0xff ;
326
326
327
- txwi -> pktid = 1 ;
328
-
329
327
if (wcid && wcid -> sw_iv && key ) {
330
328
u64 pn = atomic64_inc_return (& key -> tx_pn );
331
329
ccmp_pn [0 ] = pn ;
@@ -371,8 +369,6 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
371
369
txwi -> ack_ctl |= MT_TXWI_ACK_CTL_REQ ;
372
370
if (info -> flags & IEEE80211_TX_CTL_ASSIGN_SEQ )
373
371
txwi -> ack_ctl |= MT_TXWI_ACK_CTL_NSEQ ;
374
- if (info -> flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE )
375
- txwi -> pktid |= MT_TXWI_PKTID_PROBE ;
376
372
if ((info -> flags & IEEE80211_TX_CTL_AMPDU ) && sta ) {
377
373
u8 ba_size = IEEE80211_MIN_AMPDU_BUF ;
378
374
@@ -425,9 +421,6 @@ mt76x02_mac_fill_tx_status(struct mt76x02_dev *dev,
425
421
info -> status .ampdu_len = n_frames ;
426
422
info -> status .ampdu_ack_len = st -> success ? n_frames : 0 ;
427
423
428
- if (st -> pktid & MT_TXWI_PKTID_PROBE )
429
- info -> flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE ;
430
-
431
424
if (st -> aggr )
432
425
info -> flags |= IEEE80211_TX_CTL_AMPDU |
433
426
IEEE80211_TX_STAT_AMPDU ;
@@ -442,23 +435,39 @@ void mt76x02_send_tx_status(struct mt76x02_dev *dev,
442
435
struct mt76x02_tx_status * stat , u8 * update )
443
436
{
444
437
struct ieee80211_tx_info info = {};
445
- struct ieee80211_sta * sta = NULL ;
438
+ struct ieee80211_tx_status status = {
439
+ .info = & info
440
+ };
446
441
struct mt76_wcid * wcid = NULL ;
447
442
struct mt76x02_sta * msta = NULL ;
443
+ struct mt76_dev * mdev = & dev -> mt76 ;
444
+
445
+ if (stat -> pktid == MT_PACKET_ID_NO_ACK )
446
+ return ;
448
447
449
448
rcu_read_lock ();
449
+ spin_lock_bh (& mdev -> status_list .lock );
450
+
450
451
if (stat -> wcid < ARRAY_SIZE (dev -> mt76 .wcid ))
451
452
wcid = rcu_dereference (dev -> mt76 .wcid [stat -> wcid ]);
452
453
453
454
if (wcid && wcid -> sta ) {
454
455
void * priv ;
455
456
456
457
priv = msta = container_of (wcid , struct mt76x02_sta , wcid );
457
- sta = container_of (priv , struct ieee80211_sta ,
458
- drv_priv );
458
+ status .sta = container_of (priv , struct ieee80211_sta ,
459
+ drv_priv );
460
+ }
461
+
462
+ if (wcid ) {
463
+ if (stat -> pktid )
464
+ status .skb = mt76_tx_status_skb_get (mdev , wcid ,
465
+ stat -> pktid );
466
+ if (status .skb )
467
+ status .info = IEEE80211_SKB_CB (status .skb );
459
468
}
460
469
461
- if (msta && stat -> aggr ) {
470
+ if (msta && stat -> aggr && ! status . skb ) {
462
471
u32 stat_val , stat_cache ;
463
472
464
473
stat_val = stat -> rate ;
@@ -472,20 +481,24 @@ void mt76x02_send_tx_status(struct mt76x02_dev *dev,
472
481
goto out ;
473
482
}
474
483
475
- mt76x02_mac_fill_tx_status (dev , & info , & msta -> status ,
484
+ mt76x02_mac_fill_tx_status (dev , status . info , & msta -> status ,
476
485
msta -> n_frames );
477
486
478
487
msta -> status = * stat ;
479
488
msta -> n_frames = 1 ;
480
489
* update = 0 ;
481
490
} else {
482
- mt76x02_mac_fill_tx_status (dev , & info , stat , 1 );
491
+ mt76x02_mac_fill_tx_status (dev , status . info , stat , 1 );
483
492
* update = 1 ;
484
493
}
485
494
486
- ieee80211_tx_status_noskb (dev -> mt76 .hw , sta , & info );
495
+ if (status .skb )
496
+ mt76_tx_status_skb_done (mdev , status .skb );
497
+ else
498
+ ieee80211_tx_status_ext (mt76_hw (dev ), & status );
487
499
488
500
out :
501
+ spin_unlock_bh (& mdev -> status_list .lock );
489
502
rcu_read_unlock ();
490
503
}
491
504
@@ -707,32 +720,23 @@ void mt76x02_mac_poll_tx_status(struct mt76x02_dev *dev, bool irq)
707
720
}
708
721
}
709
722
710
- static void
711
- mt76x02_mac_queue_txdone (struct mt76x02_dev * dev , struct sk_buff * skb ,
712
- void * txwi_ptr )
713
- {
714
- struct mt76x02_tx_info * txi = mt76x02_skb_tx_info (skb );
715
- struct mt76x02_txwi * txwi = txwi_ptr ;
716
-
717
- mt76x02_mac_poll_tx_status (dev , false);
718
-
719
- txi -> tries = 0 ;
720
- txi -> jiffies = jiffies ;
721
- txi -> wcid = txwi -> wcid ;
722
- txi -> pktid = txwi -> pktid ;
723
- trace_mac_txdone_add (dev , txwi -> wcid , txwi -> pktid );
724
- mt76x02_tx_complete (& dev -> mt76 , skb );
725
- }
726
-
727
723
void mt76x02_tx_complete_skb (struct mt76_dev * mdev , struct mt76_queue * q ,
728
724
struct mt76_queue_entry * e , bool flush )
729
725
{
730
726
struct mt76x02_dev * dev = container_of (mdev , struct mt76x02_dev , mt76 );
727
+ struct mt76x02_txwi * txwi ;
731
728
732
- if (e -> txwi )
733
- mt76x02_mac_queue_txdone (dev , e -> skb , & e -> txwi -> txwi );
734
- else
729
+ if (!e -> txwi ) {
735
730
dev_kfree_skb_any (e -> skb );
731
+ return ;
732
+ }
733
+
734
+ mt76x02_mac_poll_tx_status (dev , false);
735
+
736
+ txwi = (struct mt76x02_txwi * ) & e -> txwi -> txwi ;
737
+ trace_mac_txdone_add (dev , txwi -> wcid , txwi -> pktid );
738
+
739
+ mt76_tx_complete_skb (mdev , e -> skb );
736
740
}
737
741
EXPORT_SYMBOL_GPL (mt76x02_tx_complete_skb );
738
742
@@ -817,6 +821,8 @@ void mt76x02_mac_work(struct work_struct *work)
817
821
if (!dev -> beacon_mask )
818
822
mt76x02_check_mac_err (dev );
819
823
824
+ mt76_tx_status_check (& dev -> mt76 );
825
+
820
826
ieee80211_queue_delayed_work (mt76_hw (dev ), & dev -> mac_work ,
821
827
MT_CALIBRATE_INTERVAL );
822
828
}
0 commit comments