@@ -331,16 +331,16 @@ static void bnxt_sched_reset_rxr(struct bnxt *bp, struct bnxt_rx_ring_info *rxr)
331
331
}
332
332
333
333
void bnxt_sched_reset_txr (struct bnxt * bp , struct bnxt_tx_ring_info * txr ,
334
- int idx )
334
+ u16 curr )
335
335
{
336
336
struct bnxt_napi * bnapi = txr -> bnapi ;
337
337
338
338
if (bnapi -> tx_fault )
339
339
return ;
340
340
341
- netdev_err (bp -> dev , "Invalid Tx completion (ring:%d tx_pkts:%d cons:%u prod:%u i:%d )" ,
342
- txr -> txq_index , bnapi -> tx_pkts ,
343
- txr -> tx_cons , txr -> tx_prod , idx );
341
+ netdev_err (bp -> dev , "Invalid Tx completion (ring:%d tx_hw_cons:%u cons:%u prod:%u curr:%u )" ,
342
+ txr -> txq_index , txr -> tx_hw_cons ,
343
+ txr -> tx_cons , txr -> tx_prod , curr );
344
344
WARN_ON_ONCE (1 );
345
345
bnapi -> tx_fault = 1 ;
346
346
bnxt_queue_sp_work (bp , BNXT_RESET_TASK_SP_EVENT );
@@ -691,13 +691,13 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int budget)
691
691
{
692
692
struct bnxt_tx_ring_info * txr = bnapi -> tx_ring ;
693
693
struct netdev_queue * txq = netdev_get_tx_queue (bp -> dev , txr -> txq_index );
694
+ u16 hw_cons = txr -> tx_hw_cons ;
694
695
u16 cons = txr -> tx_cons ;
695
696
struct pci_dev * pdev = bp -> pdev ;
696
- int nr_pkts = bnapi -> tx_pkts ;
697
- int i ;
698
697
unsigned int tx_bytes = 0 ;
698
+ int tx_pkts = 0 ;
699
699
700
- for ( i = 0 ; i < nr_pkts ; i ++ ) {
700
+ while ( cons != hw_cons ) {
701
701
struct bnxt_sw_tx_bd * tx_buf ;
702
702
struct sk_buff * skb ;
703
703
int j , last ;
@@ -708,10 +708,11 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int budget)
708
708
tx_buf -> skb = NULL ;
709
709
710
710
if (unlikely (!skb )) {
711
- bnxt_sched_reset_txr (bp , txr , i );
711
+ bnxt_sched_reset_txr (bp , txr , cons );
712
712
return ;
713
713
}
714
714
715
+ tx_pkts ++ ;
715
716
tx_bytes += skb -> len ;
716
717
717
718
if (tx_buf -> is_push ) {
@@ -748,10 +749,10 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int budget)
748
749
dev_consume_skb_any (skb );
749
750
}
750
751
751
- bnapi -> tx_pkts = 0 ;
752
+ bnapi -> events &= ~ BNXT_TX_CMP_EVENT ;
752
753
WRITE_ONCE (txr -> tx_cons , cons );
753
754
754
- __netif_txq_completed_wake (txq , nr_pkts , tx_bytes ,
755
+ __netif_txq_completed_wake (txq , tx_pkts , tx_bytes ,
755
756
bnxt_tx_avail (bp , txr ), bp -> tx_wake_thresh ,
756
757
READ_ONCE (txr -> dev_state ) == BNXT_DEV_STATE_CLOSING );
757
758
}
@@ -2588,14 +2589,15 @@ static int __bnxt_poll_work(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
2588
2589
{
2589
2590
struct bnxt_napi * bnapi = cpr -> bnapi ;
2590
2591
u32 raw_cons = cpr -> cp_raw_cons ;
2592
+ struct bnxt_tx_ring_info * txr ;
2591
2593
u32 cons ;
2592
- int tx_pkts = 0 ;
2593
2594
int rx_pkts = 0 ;
2594
2595
u8 event = 0 ;
2595
2596
struct tx_cmp * txcmp ;
2596
2597
2597
2598
cpr -> has_more_work = 0 ;
2598
2599
cpr -> had_work_done = 1 ;
2600
+ txr = bnapi -> tx_ring ;
2599
2601
while (1 ) {
2600
2602
int rc ;
2601
2603
@@ -2610,9 +2612,15 @@ static int __bnxt_poll_work(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
2610
2612
*/
2611
2613
dma_rmb ();
2612
2614
if (TX_CMP_TYPE (txcmp ) == CMP_TYPE_TX_L2_CMP ) {
2613
- tx_pkts ++ ;
2615
+ u32 opaque = txcmp -> tx_cmp_opaque ;
2616
+ u16 tx_freed ;
2617
+
2618
+ event |= BNXT_TX_CMP_EVENT ;
2619
+ txr -> tx_hw_cons = TX_OPAQUE_PROD (bp , opaque );
2620
+ tx_freed = (txr -> tx_hw_cons - txr -> tx_cons ) &
2621
+ bp -> tx_ring_mask ;
2614
2622
/* return full budget so NAPI will complete. */
2615
- if (unlikely (tx_pkts >= bp -> tx_wake_thresh )) {
2623
+ if (unlikely (tx_freed >= bp -> tx_wake_thresh )) {
2616
2624
rx_pkts = budget ;
2617
2625
raw_cons = NEXT_RAW_CMP (raw_cons );
2618
2626
if (budget )
@@ -2666,15 +2674,14 @@ static int __bnxt_poll_work(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
2666
2674
}
2667
2675
2668
2676
cpr -> cp_raw_cons = raw_cons ;
2669
- bnapi -> tx_pkts += tx_pkts ;
2670
2677
bnapi -> events |= event ;
2671
2678
return rx_pkts ;
2672
2679
}
2673
2680
2674
2681
static void __bnxt_poll_work_done (struct bnxt * bp , struct bnxt_napi * bnapi ,
2675
2682
int budget )
2676
2683
{
2677
- if (bnapi -> tx_pkts && !bnapi -> tx_fault )
2684
+ if (( bnapi -> events & BNXT_TX_CMP_EVENT ) && !bnapi -> tx_fault )
2678
2685
bnapi -> tx_int (bp , bnapi , budget );
2679
2686
2680
2687
if ((bnapi -> events & BNXT_RX_EVENT ) && !(bnapi -> in_reset )) {
@@ -2687,7 +2694,7 @@ static void __bnxt_poll_work_done(struct bnxt *bp, struct bnxt_napi *bnapi,
2687
2694
2688
2695
bnxt_db_write (bp , & rxr -> rx_agg_db , rxr -> rx_agg_prod );
2689
2696
}
2690
- bnapi -> events = 0 ;
2697
+ bnapi -> events &= BNXT_TX_CMP_EVENT ;
2691
2698
}
2692
2699
2693
2700
static int bnxt_poll_work (struct bnxt * bp , struct bnxt_cp_ring_info * cpr ,
@@ -4515,6 +4522,7 @@ static void bnxt_clear_ring_indices(struct bnxt *bp)
4515
4522
if (txr ) {
4516
4523
txr -> tx_prod = 0 ;
4517
4524
txr -> tx_cons = 0 ;
4525
+ txr -> tx_hw_cons = 0 ;
4518
4526
}
4519
4527
4520
4528
rxr = bnapi -> rx_ring ;
@@ -4524,6 +4532,7 @@ static void bnxt_clear_ring_indices(struct bnxt *bp)
4524
4532
rxr -> rx_sw_agg_prod = 0 ;
4525
4533
rxr -> rx_next_cons = 0 ;
4526
4534
}
4535
+ bnapi -> events = 0 ;
4527
4536
}
4528
4537
}
4529
4538
@@ -9528,8 +9537,6 @@ static void bnxt_enable_napi(struct bnxt *bp)
9528
9537
cpr = & bnapi -> cp_ring ;
9529
9538
bnapi -> in_reset = false;
9530
9539
9531
- bnapi -> tx_pkts = 0 ;
9532
-
9533
9540
if (bnapi -> rx_ring ) {
9534
9541
INIT_WORK (& cpr -> dim .work , bnxt_dim_work );
9535
9542
cpr -> dim .mode = DIM_CQ_PERIOD_MODE_START_FROM_EQE ;
0 commit comments