@@ -3817,7 +3817,7 @@ static int bnxt_alloc_cp_rings(struct bnxt *bp)
3817
3817
{
3818
3818
bool sh = !!(bp -> flags & BNXT_FLAG_SHARED_RINGS );
3819
3819
int i , j , rc , ulp_base_vec , ulp_msix ;
3820
- int tcs = netdev_get_num_tc ( bp -> dev ) ;
3820
+ int tcs = bp -> num_tc ;
3821
3821
3822
3822
if (!tcs )
3823
3823
tcs = 1 ;
@@ -5935,8 +5935,12 @@ static u16 bnxt_get_max_rss_ring(struct bnxt *bp)
5935
5935
5936
5936
int bnxt_get_nr_rss_ctxs (struct bnxt * bp , int rx_rings )
5937
5937
{
5938
- if (bp -> flags & BNXT_FLAG_CHIP_P5_PLUS )
5939
- return DIV_ROUND_UP (rx_rings , BNXT_RSS_TABLE_ENTRIES_P5 );
5938
+ if (bp -> flags & BNXT_FLAG_CHIP_P5_PLUS ) {
5939
+ if (!rx_rings )
5940
+ return 0 ;
5941
+ return bnxt_calc_nr_ring_pages (rx_rings - 1 ,
5942
+ BNXT_RSS_TABLE_ENTRIES_P5 );
5943
+ }
5940
5944
if (BNXT_CHIP_TYPE_NITRO_A0 (bp ))
5941
5945
return 2 ;
5942
5946
return 1 ;
@@ -6926,7 +6930,7 @@ static int bnxt_hwrm_get_rings(struct bnxt *bp)
6926
6930
if (cp < (rx + tx )) {
6927
6931
rc = __bnxt_trim_rings (bp , & rx , & tx , cp , false);
6928
6932
if (rc )
6929
- return rc ;
6933
+ goto get_rings_exit ;
6930
6934
if (bp -> flags & BNXT_FLAG_AGG_RINGS )
6931
6935
rx <<= 1 ;
6932
6936
hw_resc -> resv_rx_rings = rx ;
@@ -6938,8 +6942,9 @@ static int bnxt_hwrm_get_rings(struct bnxt *bp)
6938
6942
hw_resc -> resv_cp_rings = cp ;
6939
6943
hw_resc -> resv_stat_ctxs = stats ;
6940
6944
}
6945
+ get_rings_exit :
6941
6946
hwrm_req_drop (bp , req );
6942
- return 0 ;
6947
+ return rc ;
6943
6948
}
6944
6949
6945
6950
int __bnxt_hwrm_get_tx_rings (struct bnxt * bp , u16 fid , int * tx_rings )
@@ -7000,10 +7005,11 @@ __bnxt_hwrm_reserve_pf_rings(struct bnxt *bp, int tx_rings, int rx_rings,
7000
7005
7001
7006
req -> num_rx_rings = cpu_to_le16 (rx_rings );
7002
7007
if (bp -> flags & BNXT_FLAG_CHIP_P5_PLUS ) {
7008
+ u16 rss_ctx = bnxt_get_nr_rss_ctxs (bp , ring_grps );
7009
+
7003
7010
req -> num_cmpl_rings = cpu_to_le16 (tx_rings + ring_grps );
7004
7011
req -> num_msix = cpu_to_le16 (cp_rings );
7005
- req -> num_rsscos_ctxs =
7006
- cpu_to_le16 (DIV_ROUND_UP (ring_grps , 64 ));
7012
+ req -> num_rsscos_ctxs = cpu_to_le16 (rss_ctx );
7007
7013
} else {
7008
7014
req -> num_cmpl_rings = cpu_to_le16 (cp_rings );
7009
7015
req -> num_hw_ring_grps = cpu_to_le16 (ring_grps );
@@ -7050,8 +7056,10 @@ __bnxt_hwrm_reserve_vf_rings(struct bnxt *bp, int tx_rings, int rx_rings,
7050
7056
req -> num_tx_rings = cpu_to_le16 (tx_rings );
7051
7057
req -> num_rx_rings = cpu_to_le16 (rx_rings );
7052
7058
if (bp -> flags & BNXT_FLAG_CHIP_P5_PLUS ) {
7059
+ u16 rss_ctx = bnxt_get_nr_rss_ctxs (bp , ring_grps );
7060
+
7053
7061
req -> num_cmpl_rings = cpu_to_le16 (tx_rings + ring_grps );
7054
- req -> num_rsscos_ctxs = cpu_to_le16 (DIV_ROUND_UP ( ring_grps , 64 ) );
7062
+ req -> num_rsscos_ctxs = cpu_to_le16 (rss_ctx );
7055
7063
} else {
7056
7064
req -> num_cmpl_rings = cpu_to_le16 (cp_rings );
7057
7065
req -> num_hw_ring_grps = cpu_to_le16 (ring_grps );
@@ -9938,7 +9946,7 @@ static int __bnxt_num_tx_to_cp(struct bnxt *bp, int tx, int tx_sets, int tx_xdp)
9938
9946
9939
9947
int bnxt_num_tx_to_cp (struct bnxt * bp , int tx )
9940
9948
{
9941
- int tcs = netdev_get_num_tc ( bp -> dev ) ;
9949
+ int tcs = bp -> num_tc ;
9942
9950
9943
9951
if (!tcs )
9944
9952
tcs = 1 ;
@@ -9947,7 +9955,7 @@ int bnxt_num_tx_to_cp(struct bnxt *bp, int tx)
9947
9955
9948
9956
static int bnxt_num_cp_to_tx (struct bnxt * bp , int tx_cp )
9949
9957
{
9950
- int tcs = netdev_get_num_tc ( bp -> dev ) ;
9958
+ int tcs = bp -> num_tc ;
9951
9959
9952
9960
return (tx_cp - bp -> tx_nr_rings_xdp ) * tcs +
9953
9961
bp -> tx_nr_rings_xdp ;
@@ -9977,7 +9985,7 @@ static void bnxt_setup_msix(struct bnxt *bp)
9977
9985
struct net_device * dev = bp -> dev ;
9978
9986
int tcs , i ;
9979
9987
9980
- tcs = netdev_get_num_tc ( dev ) ;
9988
+ tcs = bp -> num_tc ;
9981
9989
if (tcs ) {
9982
9990
int i , off , count ;
9983
9991
@@ -10009,8 +10017,10 @@ static void bnxt_setup_inta(struct bnxt *bp)
10009
10017
{
10010
10018
const int len = sizeof (bp -> irq_tbl [0 ].name );
10011
10019
10012
- if (netdev_get_num_tc ( bp -> dev ))
10020
+ if (bp -> num_tc ) {
10013
10021
netdev_reset_tc (bp -> dev );
10022
+ bp -> num_tc = 0 ;
10023
+ }
10014
10024
10015
10025
snprintf (bp -> irq_tbl [0 ].name , len , "%s-%s-%d" , bp -> dev -> name , "TxRx" ,
10016
10026
0 );
@@ -10236,8 +10246,8 @@ static void bnxt_clear_int_mode(struct bnxt *bp)
10236
10246
10237
10247
int bnxt_reserve_rings (struct bnxt * bp , bool irq_re_init )
10238
10248
{
10239
- int tcs = netdev_get_num_tc (bp -> dev );
10240
10249
bool irq_cleared = false;
10250
+ int tcs = bp -> num_tc ;
10241
10251
int rc ;
10242
10252
10243
10253
if (!bnxt_need_reserve_rings (bp ))
@@ -10263,6 +10273,7 @@ int bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init)
10263
10273
bp -> tx_nr_rings - bp -> tx_nr_rings_xdp )) {
10264
10274
netdev_err (bp -> dev , "tx ring reservation failure\n" );
10265
10275
netdev_reset_tc (bp -> dev );
10276
+ bp -> num_tc = 0 ;
10266
10277
if (bp -> tx_nr_rings_xdp )
10267
10278
bp -> tx_nr_rings_per_tc = bp -> tx_nr_rings_xdp ;
10268
10279
else
@@ -11564,10 +11575,12 @@ int bnxt_half_open_nic(struct bnxt *bp)
11564
11575
netdev_err (bp -> dev , "bnxt_alloc_mem err: %x\n" , rc );
11565
11576
goto half_open_err ;
11566
11577
}
11578
+ bnxt_init_napi (bp );
11567
11579
set_bit (BNXT_STATE_HALF_OPEN , & bp -> state );
11568
11580
rc = bnxt_init_nic (bp , true);
11569
11581
if (rc ) {
11570
11582
clear_bit (BNXT_STATE_HALF_OPEN , & bp -> state );
11583
+ bnxt_del_napi (bp );
11571
11584
netdev_err (bp -> dev , "bnxt_init_nic err: %x\n" , rc );
11572
11585
goto half_open_err ;
11573
11586
}
@@ -11586,6 +11599,7 @@ int bnxt_half_open_nic(struct bnxt *bp)
11586
11599
void bnxt_half_close_nic (struct bnxt * bp )
11587
11600
{
11588
11601
bnxt_hwrm_resource_free (bp , false, true);
11602
+ bnxt_del_napi (bp );
11589
11603
bnxt_free_skbs (bp );
11590
11604
bnxt_free_mem (bp , true);
11591
11605
clear_bit (BNXT_STATE_HALF_OPEN , & bp -> state );
@@ -13232,6 +13246,11 @@ static int bnxt_fw_init_one_p1(struct bnxt *bp)
13232
13246
13233
13247
bp -> fw_cap = 0 ;
13234
13248
rc = bnxt_hwrm_ver_get (bp );
13249
+ /* FW may be unresponsive after FLR. FLR must complete within 100 msec
13250
+ * so wait before continuing with recovery.
13251
+ */
13252
+ if (rc )
13253
+ msleep (100 );
13235
13254
bnxt_try_map_fw_health_reg (bp );
13236
13255
if (rc ) {
13237
13256
rc = bnxt_try_recover_fw (bp );
@@ -13784,7 +13803,7 @@ int bnxt_setup_mq_tc(struct net_device *dev, u8 tc)
13784
13803
return - EINVAL ;
13785
13804
}
13786
13805
13787
- if (netdev_get_num_tc ( dev ) == tc )
13806
+ if (bp -> num_tc == tc )
13788
13807
return 0 ;
13789
13808
13790
13809
if (bp -> flags & BNXT_FLAG_SHARED_RINGS )
@@ -13802,9 +13821,11 @@ int bnxt_setup_mq_tc(struct net_device *dev, u8 tc)
13802
13821
if (tc ) {
13803
13822
bp -> tx_nr_rings = bp -> tx_nr_rings_per_tc * tc ;
13804
13823
netdev_set_num_tc (dev , tc );
13824
+ bp -> num_tc = tc ;
13805
13825
} else {
13806
13826
bp -> tx_nr_rings = bp -> tx_nr_rings_per_tc ;
13807
13827
netdev_reset_tc (dev );
13828
+ bp -> num_tc = 0 ;
13808
13829
}
13809
13830
bp -> tx_nr_rings += bp -> tx_nr_rings_xdp ;
13810
13831
tx_cp = bnxt_num_tx_to_cp (bp , bp -> tx_nr_rings );
0 commit comments