@@ -3817,7 +3817,7 @@ static int bnxt_alloc_cp_rings(struct bnxt *bp)
38173817{
38183818 bool sh = !!(bp -> flags & BNXT_FLAG_SHARED_RINGS );
38193819 int i , j , rc , ulp_base_vec , ulp_msix ;
3820- int tcs = netdev_get_num_tc ( bp -> dev ) ;
3820+ int tcs = bp -> num_tc ;
38213821
38223822 if (!tcs )
38233823 tcs = 1 ;
@@ -5935,8 +5935,12 @@ static u16 bnxt_get_max_rss_ring(struct bnxt *bp)
59355935
59365936int bnxt_get_nr_rss_ctxs (struct bnxt * bp , int rx_rings )
59375937{
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+ }
59405944 if (BNXT_CHIP_TYPE_NITRO_A0 (bp ))
59415945 return 2 ;
59425946 return 1 ;
@@ -6926,7 +6930,7 @@ static int bnxt_hwrm_get_rings(struct bnxt *bp)
69266930 if (cp < (rx + tx )) {
69276931 rc = __bnxt_trim_rings (bp , & rx , & tx , cp , false);
69286932 if (rc )
6929- return rc ;
6933+ goto get_rings_exit ;
69306934 if (bp -> flags & BNXT_FLAG_AGG_RINGS )
69316935 rx <<= 1 ;
69326936 hw_resc -> resv_rx_rings = rx ;
@@ -6938,8 +6942,9 @@ static int bnxt_hwrm_get_rings(struct bnxt *bp)
69386942 hw_resc -> resv_cp_rings = cp ;
69396943 hw_resc -> resv_stat_ctxs = stats ;
69406944 }
6945+ get_rings_exit :
69416946 hwrm_req_drop (bp , req );
6942- return 0 ;
6947+ return rc ;
69436948}
69446949
69456950int __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,
70007005
70017006 req -> num_rx_rings = cpu_to_le16 (rx_rings );
70027007 if (bp -> flags & BNXT_FLAG_CHIP_P5_PLUS ) {
7008+ u16 rss_ctx = bnxt_get_nr_rss_ctxs (bp , ring_grps );
7009+
70037010 req -> num_cmpl_rings = cpu_to_le16 (tx_rings + ring_grps );
70047011 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 );
70077013 } else {
70087014 req -> num_cmpl_rings = cpu_to_le16 (cp_rings );
70097015 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,
70507056 req -> num_tx_rings = cpu_to_le16 (tx_rings );
70517057 req -> num_rx_rings = cpu_to_le16 (rx_rings );
70527058 if (bp -> flags & BNXT_FLAG_CHIP_P5_PLUS ) {
7059+ u16 rss_ctx = bnxt_get_nr_rss_ctxs (bp , ring_grps );
7060+
70537061 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 );
70557063 } else {
70567064 req -> num_cmpl_rings = cpu_to_le16 (cp_rings );
70577065 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)
99389946
99399947int bnxt_num_tx_to_cp (struct bnxt * bp , int tx )
99409948{
9941- int tcs = netdev_get_num_tc ( bp -> dev ) ;
9949+ int tcs = bp -> num_tc ;
99429950
99439951 if (!tcs )
99449952 tcs = 1 ;
@@ -9947,7 +9955,7 @@ int bnxt_num_tx_to_cp(struct bnxt *bp, int tx)
99479955
99489956static int bnxt_num_cp_to_tx (struct bnxt * bp , int tx_cp )
99499957{
9950- int tcs = netdev_get_num_tc ( bp -> dev ) ;
9958+ int tcs = bp -> num_tc ;
99519959
99529960 return (tx_cp - bp -> tx_nr_rings_xdp ) * tcs +
99539961 bp -> tx_nr_rings_xdp ;
@@ -9977,7 +9985,7 @@ static void bnxt_setup_msix(struct bnxt *bp)
99779985 struct net_device * dev = bp -> dev ;
99789986 int tcs , i ;
99799987
9980- tcs = netdev_get_num_tc ( dev ) ;
9988+ tcs = bp -> num_tc ;
99819989 if (tcs ) {
99829990 int i , off , count ;
99839991
@@ -10009,8 +10017,10 @@ static void bnxt_setup_inta(struct bnxt *bp)
1000910017{
1001010018 const int len = sizeof (bp -> irq_tbl [0 ].name );
1001110019
10012- if (netdev_get_num_tc ( bp -> dev ))
10020+ if (bp -> num_tc ) {
1001310021 netdev_reset_tc (bp -> dev );
10022+ bp -> num_tc = 0 ;
10023+ }
1001410024
1001510025 snprintf (bp -> irq_tbl [0 ].name , len , "%s-%s-%d" , bp -> dev -> name , "TxRx" ,
1001610026 0 );
@@ -10236,8 +10246,8 @@ static void bnxt_clear_int_mode(struct bnxt *bp)
1023610246
1023710247int bnxt_reserve_rings (struct bnxt * bp , bool irq_re_init )
1023810248{
10239- int tcs = netdev_get_num_tc (bp -> dev );
1024010249 bool irq_cleared = false;
10250+ int tcs = bp -> num_tc ;
1024110251 int rc ;
1024210252
1024310253 if (!bnxt_need_reserve_rings (bp ))
@@ -10263,6 +10273,7 @@ int bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init)
1026310273 bp -> tx_nr_rings - bp -> tx_nr_rings_xdp )) {
1026410274 netdev_err (bp -> dev , "tx ring reservation failure\n" );
1026510275 netdev_reset_tc (bp -> dev );
10276+ bp -> num_tc = 0 ;
1026610277 if (bp -> tx_nr_rings_xdp )
1026710278 bp -> tx_nr_rings_per_tc = bp -> tx_nr_rings_xdp ;
1026810279 else
@@ -11564,10 +11575,12 @@ int bnxt_half_open_nic(struct bnxt *bp)
1156411575 netdev_err (bp -> dev , "bnxt_alloc_mem err: %x\n" , rc );
1156511576 goto half_open_err ;
1156611577 }
11578+ bnxt_init_napi (bp );
1156711579 set_bit (BNXT_STATE_HALF_OPEN , & bp -> state );
1156811580 rc = bnxt_init_nic (bp , true);
1156911581 if (rc ) {
1157011582 clear_bit (BNXT_STATE_HALF_OPEN , & bp -> state );
11583+ bnxt_del_napi (bp );
1157111584 netdev_err (bp -> dev , "bnxt_init_nic err: %x\n" , rc );
1157211585 goto half_open_err ;
1157311586 }
@@ -11586,6 +11599,7 @@ int bnxt_half_open_nic(struct bnxt *bp)
1158611599void bnxt_half_close_nic (struct bnxt * bp )
1158711600{
1158811601 bnxt_hwrm_resource_free (bp , false, true);
11602+ bnxt_del_napi (bp );
1158911603 bnxt_free_skbs (bp );
1159011604 bnxt_free_mem (bp , true);
1159111605 clear_bit (BNXT_STATE_HALF_OPEN , & bp -> state );
@@ -13232,6 +13246,11 @@ static int bnxt_fw_init_one_p1(struct bnxt *bp)
1323213246
1323313247 bp -> fw_cap = 0 ;
1323413248 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 );
1323513254 bnxt_try_map_fw_health_reg (bp );
1323613255 if (rc ) {
1323713256 rc = bnxt_try_recover_fw (bp );
@@ -13784,7 +13803,7 @@ int bnxt_setup_mq_tc(struct net_device *dev, u8 tc)
1378413803 return - EINVAL ;
1378513804 }
1378613805
13787- if (netdev_get_num_tc ( dev ) == tc )
13806+ if (bp -> num_tc == tc )
1378813807 return 0 ;
1378913808
1379013809 if (bp -> flags & BNXT_FLAG_SHARED_RINGS )
@@ -13802,9 +13821,11 @@ int bnxt_setup_mq_tc(struct net_device *dev, u8 tc)
1380213821 if (tc ) {
1380313822 bp -> tx_nr_rings = bp -> tx_nr_rings_per_tc * tc ;
1380413823 netdev_set_num_tc (dev , tc );
13824+ bp -> num_tc = tc ;
1380513825 } else {
1380613826 bp -> tx_nr_rings = bp -> tx_nr_rings_per_tc ;
1380713827 netdev_reset_tc (dev );
13828+ bp -> num_tc = 0 ;
1380813829 }
1380913830 bp -> tx_nr_rings += bp -> tx_nr_rings_xdp ;
1381013831 tx_cp = bnxt_num_tx_to_cp (bp , bp -> tx_nr_rings );
0 commit comments