@@ -3609,14 +3609,18 @@ static int bnxt_alloc_cp_rings(struct bnxt *bp)
3609
3609
{
3610
3610
bool sh = !!(bp -> flags & BNXT_FLAG_SHARED_RINGS );
3611
3611
int i , j , rc , ulp_base_vec , ulp_msix ;
3612
+ int tcs = netdev_get_num_tc (bp -> dev );
3612
3613
3614
+ if (!tcs )
3615
+ tcs = 1 ;
3613
3616
ulp_msix = bnxt_get_ulp_msix_num (bp );
3614
3617
ulp_base_vec = bnxt_get_ulp_msix_base (bp );
3615
3618
for (i = 0 , j = 0 ; i < bp -> cp_nr_rings ; i ++ ) {
3616
3619
struct bnxt_napi * bnapi = bp -> bnapi [i ];
3617
3620
struct bnxt_cp_ring_info * cpr , * cpr2 ;
3618
3621
struct bnxt_ring_struct * ring ;
3619
3622
int cp_count = 0 , k ;
3623
+ int rx = 0 , tx = 0 ;
3620
3624
3621
3625
if (!bnapi )
3622
3626
continue ;
@@ -3637,11 +3641,18 @@ static int bnxt_alloc_cp_rings(struct bnxt *bp)
3637
3641
if (!(bp -> flags & BNXT_FLAG_CHIP_P5 ))
3638
3642
continue ;
3639
3643
3640
- if (i < bp -> rx_nr_rings )
3644
+ if (i < bp -> rx_nr_rings ) {
3641
3645
cp_count ++ ;
3642
- if ((sh && i < bp -> tx_nr_rings ) ||
3643
- (!sh && i >= bp -> rx_nr_rings ))
3646
+ rx = 1 ;
3647
+ }
3648
+ if (i < bp -> tx_nr_rings_xdp ) {
3644
3649
cp_count ++ ;
3650
+ tx = 1 ;
3651
+ } else if ((sh && i < bp -> tx_nr_rings ) ||
3652
+ (!sh && i >= bp -> rx_nr_rings )) {
3653
+ cp_count += tcs ;
3654
+ tx = 1 ;
3655
+ }
3645
3656
3646
3657
cpr -> cp_ring_arr = kcalloc (cp_count , sizeof (* cpr ),
3647
3658
GFP_KERNEL );
@@ -3656,14 +3667,19 @@ static int bnxt_alloc_cp_rings(struct bnxt *bp)
3656
3667
return rc ;
3657
3668
cpr2 -> bnapi = bnapi ;
3658
3669
cpr2 -> cp_idx = k ;
3659
- if (!k && i < bp -> rx_nr_rings ) {
3670
+ if (!k && rx ) {
3660
3671
bp -> rx_ring [i ].rx_cpr = cpr2 ;
3661
3672
cpr2 -> cp_ring_type = BNXT_NQ_HDL_TYPE_RX ;
3662
3673
} else {
3663
- bp -> tx_ring [j ++ ].tx_cpr = cpr2 ;
3674
+ int n , tc = k - rx ;
3675
+
3676
+ n = BNXT_TC_TO_RING_BASE (bp , tc ) + j ;
3677
+ bp -> tx_ring [n ].tx_cpr = cpr2 ;
3664
3678
cpr2 -> cp_ring_type = BNXT_NQ_HDL_TYPE_TX ;
3665
3679
}
3666
3680
}
3681
+ if (tx )
3682
+ j ++ ;
3667
3683
}
3668
3684
return 0 ;
3669
3685
}
@@ -4704,24 +4720,33 @@ static int bnxt_alloc_mem(struct bnxt *bp, bool irq_re_init)
4704
4720
else
4705
4721
j = bp -> rx_nr_rings ;
4706
4722
4707
- for (i = 0 ; i < bp -> tx_nr_rings ; i ++ , j ++ ) {
4723
+ for (i = 0 ; i < bp -> tx_nr_rings ; i ++ ) {
4708
4724
struct bnxt_tx_ring_info * txr = & bp -> tx_ring [i ];
4725
+ struct bnxt_napi * bnapi2 ;
4709
4726
4710
4727
if (bp -> flags & BNXT_FLAG_CHIP_P5 )
4711
4728
txr -> tx_ring_struct .ring_mem .flags =
4712
4729
BNXT_RMEM_RING_PTE_FLAG ;
4713
- else
4714
- txr -> tx_cpr = & bp -> bnapi [i ]-> cp_ring ;
4715
- txr -> bnapi = bp -> bnapi [j ];
4716
- bp -> bnapi [j ]-> tx_ring [0 ] = txr ;
4717
4730
bp -> tx_ring_map [i ] = bp -> tx_nr_rings_xdp + i ;
4718
4731
if (i >= bp -> tx_nr_rings_xdp ) {
4732
+ int k = j + BNXT_RING_TO_TC_OFF (bp , i );
4733
+
4734
+ bnapi2 = bp -> bnapi [k ];
4719
4735
txr -> txq_index = i - bp -> tx_nr_rings_xdp ;
4720
- bp -> bnapi [j ]-> tx_int = bnxt_tx_int ;
4736
+ txr -> tx_napi_idx =
4737
+ BNXT_RING_TO_TC (bp , txr -> txq_index );
4738
+ bnapi2 -> tx_ring [txr -> tx_napi_idx ] = txr ;
4739
+ bnapi2 -> tx_int = bnxt_tx_int ;
4721
4740
} else {
4722
- bp -> bnapi [j ]-> flags |= BNXT_NAPI_FLAG_XDP ;
4723
- bp -> bnapi [j ]-> tx_int = bnxt_tx_int_xdp ;
4741
+ bnapi2 = bp -> bnapi [j ];
4742
+ bnapi2 -> flags |= BNXT_NAPI_FLAG_XDP ;
4743
+ bnapi2 -> tx_ring [0 ] = txr ;
4744
+ bnapi2 -> tx_int = bnxt_tx_int_xdp ;
4745
+ j ++ ;
4724
4746
}
4747
+ txr -> bnapi = bnapi2 ;
4748
+ if (!(bp -> flags & BNXT_FLAG_CHIP_P5 ))
4749
+ txr -> tx_cpr = & bnapi2 -> cp_ring ;
4725
4750
}
4726
4751
4727
4752
rc = bnxt_alloc_stats (bp );
@@ -9099,7 +9124,7 @@ static int __bnxt_trim_rings(struct bnxt *bp, int *rx, int *tx, int max,
9099
9124
9100
9125
static int __bnxt_num_tx_to_cp (struct bnxt * bp , int tx , int tx_sets , int tx_xdp )
9101
9126
{
9102
- return tx ;
9127
+ return ( tx - tx_xdp ) / tx_sets + tx_xdp ;
9103
9128
}
9104
9129
9105
9130
int bnxt_num_tx_to_cp (struct bnxt * bp , int tx )
@@ -13723,7 +13748,8 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
13723
13748
}
13724
13749
13725
13750
max_irqs = bnxt_get_max_irq (pdev );
13726
- dev = alloc_etherdev_mq (sizeof (* bp ), max_irqs );
13751
+ dev = alloc_etherdev_mqs (sizeof (* bp ), max_irqs * BNXT_MAX_QUEUE ,
13752
+ max_irqs );
13727
13753
if (!dev )
13728
13754
return - ENOMEM ;
13729
13755
0 commit comments