@@ -1439,7 +1439,7 @@ static inline struct sk_buff *bnxt_tpa_end(struct bnxt *bp,
1439
1439
(skb -> dev -> features & NETIF_F_HW_VLAN_CTAG_RX )) {
1440
1440
u16 vlan_proto = tpa_info -> metadata >>
1441
1441
RX_CMP_FLAGS2_METADATA_TPID_SFT ;
1442
- u16 vtag = tpa_info -> metadata & RX_CMP_FLAGS2_METADATA_VID_MASK ;
1442
+ u16 vtag = tpa_info -> metadata & RX_CMP_FLAGS2_METADATA_TCI_MASK ;
1443
1443
1444
1444
__vlan_hwaccel_put_tag (skb , htons (vlan_proto ), vtag );
1445
1445
}
@@ -1623,7 +1623,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_napi *bnapi, u32 *raw_cons,
1623
1623
cpu_to_le32 (RX_CMP_FLAGS2_META_FORMAT_VLAN )) &&
1624
1624
(skb -> dev -> features & NETIF_F_HW_VLAN_CTAG_RX )) {
1625
1625
u32 meta_data = le32_to_cpu (rxcmp1 -> rx_cmp_meta_data );
1626
- u16 vtag = meta_data & RX_CMP_FLAGS2_METADATA_VID_MASK ;
1626
+ u16 vtag = meta_data & RX_CMP_FLAGS2_METADATA_TCI_MASK ;
1627
1627
u16 vlan_proto = meta_data >> RX_CMP_FLAGS2_METADATA_TPID_SFT ;
1628
1628
1629
1629
__vlan_hwaccel_put_tag (skb , htons (vlan_proto ), vtag );
@@ -3847,6 +3847,9 @@ static int bnxt_hwrm_vnic_set_tpa(struct bnxt *bp, u16 vnic_id, u32 tpa_flags)
3847
3847
struct bnxt_vnic_info * vnic = & bp -> vnic_info [vnic_id ];
3848
3848
struct hwrm_vnic_tpa_cfg_input req = {0 };
3849
3849
3850
+ if (vnic -> fw_vnic_id == INVALID_HW_RING_ID )
3851
+ return 0 ;
3852
+
3850
3853
bnxt_hwrm_cmd_hdr_init (bp , & req , HWRM_VNIC_TPA_CFG , -1 , -1 );
3851
3854
3852
3855
if (tpa_flags ) {
@@ -4558,18 +4561,17 @@ int __bnxt_hwrm_get_tx_rings(struct bnxt *bp, u16 fid, int *tx_rings)
4558
4561
return rc ;
4559
4562
}
4560
4563
4561
- static int
4562
- bnxt_hwrm_reserve_pf_rings (struct bnxt * bp , int tx_rings , int rx_rings ,
4563
- int ring_grps , int cp_rings , int vnics )
4564
+ static void
4565
+ __bnxt_hwrm_reserve_pf_rings (struct bnxt * bp , struct hwrm_func_cfg_input * req ,
4566
+ int tx_rings , int rx_rings , int ring_grps ,
4567
+ int cp_rings , int vnics )
4564
4568
{
4565
- struct hwrm_func_cfg_input req = {0 };
4566
4569
u32 enables = 0 ;
4567
- int rc ;
4568
4570
4569
- bnxt_hwrm_cmd_hdr_init (bp , & req , HWRM_FUNC_CFG , -1 , -1 );
4570
- req . fid = cpu_to_le16 (0xffff );
4571
+ bnxt_hwrm_cmd_hdr_init (bp , req , HWRM_FUNC_CFG , -1 , -1 );
4572
+ req -> fid = cpu_to_le16 (0xffff );
4571
4573
enables |= tx_rings ? FUNC_CFG_REQ_ENABLES_NUM_TX_RINGS : 0 ;
4572
- req . num_tx_rings = cpu_to_le16 (tx_rings );
4574
+ req -> num_tx_rings = cpu_to_le16 (tx_rings );
4573
4575
if (bp -> flags & BNXT_FLAG_NEW_RM ) {
4574
4576
enables |= rx_rings ? FUNC_CFG_REQ_ENABLES_NUM_RX_RINGS : 0 ;
4575
4577
enables |= cp_rings ? FUNC_CFG_REQ_ENABLES_NUM_CMPL_RINGS |
@@ -4578,16 +4580,53 @@ bnxt_hwrm_reserve_pf_rings(struct bnxt *bp, int tx_rings, int rx_rings,
4578
4580
FUNC_CFG_REQ_ENABLES_NUM_HW_RING_GRPS : 0 ;
4579
4581
enables |= vnics ? FUNC_VF_CFG_REQ_ENABLES_NUM_VNICS : 0 ;
4580
4582
4581
- req . num_rx_rings = cpu_to_le16 (rx_rings );
4582
- req . num_hw_ring_grps = cpu_to_le16 (ring_grps );
4583
- req . num_cmpl_rings = cpu_to_le16 (cp_rings );
4584
- req . num_stat_ctxs = req . num_cmpl_rings ;
4585
- req . num_vnics = cpu_to_le16 (vnics );
4583
+ req -> num_rx_rings = cpu_to_le16 (rx_rings );
4584
+ req -> num_hw_ring_grps = cpu_to_le16 (ring_grps );
4585
+ req -> num_cmpl_rings = cpu_to_le16 (cp_rings );
4586
+ req -> num_stat_ctxs = req -> num_cmpl_rings ;
4587
+ req -> num_vnics = cpu_to_le16 (vnics );
4586
4588
}
4587
- if (!enables )
4589
+ req -> enables = cpu_to_le32 (enables );
4590
+ }
4591
+
4592
+ static void
4593
+ __bnxt_hwrm_reserve_vf_rings (struct bnxt * bp ,
4594
+ struct hwrm_func_vf_cfg_input * req , int tx_rings ,
4595
+ int rx_rings , int ring_grps , int cp_rings ,
4596
+ int vnics )
4597
+ {
4598
+ u32 enables = 0 ;
4599
+
4600
+ bnxt_hwrm_cmd_hdr_init (bp , req , HWRM_FUNC_VF_CFG , -1 , -1 );
4601
+ enables |= tx_rings ? FUNC_VF_CFG_REQ_ENABLES_NUM_TX_RINGS : 0 ;
4602
+ enables |= rx_rings ? FUNC_VF_CFG_REQ_ENABLES_NUM_RX_RINGS : 0 ;
4603
+ enables |= cp_rings ? FUNC_VF_CFG_REQ_ENABLES_NUM_CMPL_RINGS |
4604
+ FUNC_VF_CFG_REQ_ENABLES_NUM_STAT_CTXS : 0 ;
4605
+ enables |= ring_grps ? FUNC_VF_CFG_REQ_ENABLES_NUM_HW_RING_GRPS : 0 ;
4606
+ enables |= vnics ? FUNC_VF_CFG_REQ_ENABLES_NUM_VNICS : 0 ;
4607
+
4608
+ req -> num_tx_rings = cpu_to_le16 (tx_rings );
4609
+ req -> num_rx_rings = cpu_to_le16 (rx_rings );
4610
+ req -> num_hw_ring_grps = cpu_to_le16 (ring_grps );
4611
+ req -> num_cmpl_rings = cpu_to_le16 (cp_rings );
4612
+ req -> num_stat_ctxs = req -> num_cmpl_rings ;
4613
+ req -> num_vnics = cpu_to_le16 (vnics );
4614
+
4615
+ req -> enables = cpu_to_le32 (enables );
4616
+ }
4617
+
4618
+ static int
4619
+ bnxt_hwrm_reserve_pf_rings (struct bnxt * bp , int tx_rings , int rx_rings ,
4620
+ int ring_grps , int cp_rings , int vnics )
4621
+ {
4622
+ struct hwrm_func_cfg_input req = {0 };
4623
+ int rc ;
4624
+
4625
+ __bnxt_hwrm_reserve_pf_rings (bp , & req , tx_rings , rx_rings , ring_grps ,
4626
+ cp_rings , vnics );
4627
+ if (!req .enables )
4588
4628
return 0 ;
4589
4629
4590
- req .enables = cpu_to_le32 (enables );
4591
4630
rc = hwrm_send_message (bp , & req , sizeof (req ), HWRM_CMD_TIMEOUT );
4592
4631
if (rc )
4593
4632
return - ENOMEM ;
@@ -4604,30 +4643,15 @@ bnxt_hwrm_reserve_vf_rings(struct bnxt *bp, int tx_rings, int rx_rings,
4604
4643
int ring_grps , int cp_rings , int vnics )
4605
4644
{
4606
4645
struct hwrm_func_vf_cfg_input req = {0 };
4607
- u32 enables = 0 ;
4608
4646
int rc ;
4609
4647
4610
4648
if (!(bp -> flags & BNXT_FLAG_NEW_RM )) {
4611
4649
bp -> hw_resc .resv_tx_rings = tx_rings ;
4612
4650
return 0 ;
4613
4651
}
4614
4652
4615
- bnxt_hwrm_cmd_hdr_init (bp , & req , HWRM_FUNC_VF_CFG , -1 , -1 );
4616
- enables |= tx_rings ? FUNC_VF_CFG_REQ_ENABLES_NUM_TX_RINGS : 0 ;
4617
- enables |= rx_rings ? FUNC_VF_CFG_REQ_ENABLES_NUM_RX_RINGS : 0 ;
4618
- enables |= cp_rings ? FUNC_VF_CFG_REQ_ENABLES_NUM_CMPL_RINGS |
4619
- FUNC_VF_CFG_REQ_ENABLES_NUM_STAT_CTXS : 0 ;
4620
- enables |= ring_grps ? FUNC_VF_CFG_REQ_ENABLES_NUM_HW_RING_GRPS : 0 ;
4621
- enables |= vnics ? FUNC_VF_CFG_REQ_ENABLES_NUM_VNICS : 0 ;
4622
-
4623
- req .num_tx_rings = cpu_to_le16 (tx_rings );
4624
- req .num_rx_rings = cpu_to_le16 (rx_rings );
4625
- req .num_hw_ring_grps = cpu_to_le16 (ring_grps );
4626
- req .num_cmpl_rings = cpu_to_le16 (cp_rings );
4627
- req .num_stat_ctxs = req .num_cmpl_rings ;
4628
- req .num_vnics = cpu_to_le16 (vnics );
4629
-
4630
- req .enables = cpu_to_le32 (enables );
4653
+ __bnxt_hwrm_reserve_vf_rings (bp , & req , tx_rings , rx_rings , ring_grps ,
4654
+ cp_rings , vnics );
4631
4655
rc = hwrm_send_message (bp , & req , sizeof (req ), HWRM_CMD_TIMEOUT );
4632
4656
if (rc )
4633
4657
return - ENOMEM ;
@@ -4743,96 +4767,67 @@ static bool bnxt_need_reserve_rings(struct bnxt *bp)
4743
4767
}
4744
4768
4745
4769
static int bnxt_hwrm_check_vf_rings (struct bnxt * bp , int tx_rings , int rx_rings ,
4746
- int ring_grps , int cp_rings )
4770
+ int ring_grps , int cp_rings , int vnics )
4747
4771
{
4748
4772
struct hwrm_func_vf_cfg_input req = {0 };
4749
- u32 flags , enables ;
4773
+ u32 flags ;
4750
4774
int rc ;
4751
4775
4752
4776
if (!(bp -> flags & BNXT_FLAG_NEW_RM ))
4753
4777
return 0 ;
4754
4778
4755
- bnxt_hwrm_cmd_hdr_init (bp , & req , HWRM_FUNC_VF_CFG , -1 , -1 );
4779
+ __bnxt_hwrm_reserve_vf_rings (bp , & req , tx_rings , rx_rings , ring_grps ,
4780
+ cp_rings , vnics );
4756
4781
flags = FUNC_VF_CFG_REQ_FLAGS_TX_ASSETS_TEST |
4757
4782
FUNC_VF_CFG_REQ_FLAGS_RX_ASSETS_TEST |
4758
4783
FUNC_VF_CFG_REQ_FLAGS_CMPL_ASSETS_TEST |
4759
4784
FUNC_VF_CFG_REQ_FLAGS_RING_GRP_ASSETS_TEST |
4760
4785
FUNC_VF_CFG_REQ_FLAGS_STAT_CTX_ASSETS_TEST |
4761
4786
FUNC_VF_CFG_REQ_FLAGS_VNIC_ASSETS_TEST ;
4762
- enables = FUNC_VF_CFG_REQ_ENABLES_NUM_TX_RINGS |
4763
- FUNC_VF_CFG_REQ_ENABLES_NUM_RX_RINGS |
4764
- FUNC_VF_CFG_REQ_ENABLES_NUM_CMPL_RINGS |
4765
- FUNC_VF_CFG_REQ_ENABLES_NUM_HW_RING_GRPS |
4766
- FUNC_VF_CFG_REQ_ENABLES_NUM_STAT_CTXS |
4767
- FUNC_VF_CFG_REQ_ENABLES_NUM_VNICS ;
4768
4787
4769
4788
req .flags = cpu_to_le32 (flags );
4770
- req .enables = cpu_to_le32 (enables );
4771
- req .num_tx_rings = cpu_to_le16 (tx_rings );
4772
- req .num_rx_rings = cpu_to_le16 (rx_rings );
4773
- req .num_cmpl_rings = cpu_to_le16 (cp_rings );
4774
- req .num_hw_ring_grps = cpu_to_le16 (ring_grps );
4775
- req .num_stat_ctxs = cpu_to_le16 (cp_rings );
4776
- req .num_vnics = cpu_to_le16 (1 );
4777
- if (bp -> flags & BNXT_FLAG_RFS )
4778
- req .num_vnics = cpu_to_le16 (rx_rings + 1 );
4779
4789
rc = hwrm_send_message_silent (bp , & req , sizeof (req ), HWRM_CMD_TIMEOUT );
4780
4790
if (rc )
4781
4791
return - ENOMEM ;
4782
4792
return 0 ;
4783
4793
}
4784
4794
4785
4795
static int bnxt_hwrm_check_pf_rings (struct bnxt * bp , int tx_rings , int rx_rings ,
4786
- int ring_grps , int cp_rings )
4796
+ int ring_grps , int cp_rings , int vnics )
4787
4797
{
4788
4798
struct hwrm_func_cfg_input req = {0 };
4789
- u32 flags , enables ;
4799
+ u32 flags ;
4790
4800
int rc ;
4791
4801
4792
- bnxt_hwrm_cmd_hdr_init (bp , & req , HWRM_FUNC_CFG , -1 , -1 );
4793
- req . fid = cpu_to_le16 ( 0xffff );
4802
+ __bnxt_hwrm_reserve_pf_rings (bp , & req , tx_rings , rx_rings , ring_grps ,
4803
+ cp_rings , vnics );
4794
4804
flags = FUNC_CFG_REQ_FLAGS_TX_ASSETS_TEST ;
4795
- enables = FUNC_CFG_REQ_ENABLES_NUM_TX_RINGS ;
4796
- req .num_tx_rings = cpu_to_le16 (tx_rings );
4797
- if (bp -> flags & BNXT_FLAG_NEW_RM ) {
4805
+ if (bp -> flags & BNXT_FLAG_NEW_RM )
4798
4806
flags |= FUNC_CFG_REQ_FLAGS_RX_ASSETS_TEST |
4799
4807
FUNC_CFG_REQ_FLAGS_CMPL_ASSETS_TEST |
4800
4808
FUNC_CFG_REQ_FLAGS_RING_GRP_ASSETS_TEST |
4801
4809
FUNC_CFG_REQ_FLAGS_STAT_CTX_ASSETS_TEST |
4802
4810
FUNC_CFG_REQ_FLAGS_VNIC_ASSETS_TEST ;
4803
- enables |= FUNC_CFG_REQ_ENABLES_NUM_RX_RINGS |
4804
- FUNC_CFG_REQ_ENABLES_NUM_CMPL_RINGS |
4805
- FUNC_CFG_REQ_ENABLES_NUM_HW_RING_GRPS |
4806
- FUNC_CFG_REQ_ENABLES_NUM_STAT_CTXS |
4807
- FUNC_CFG_REQ_ENABLES_NUM_VNICS ;
4808
- req .num_rx_rings = cpu_to_le16 (rx_rings );
4809
- req .num_cmpl_rings = cpu_to_le16 (cp_rings );
4810
- req .num_hw_ring_grps = cpu_to_le16 (ring_grps );
4811
- req .num_stat_ctxs = cpu_to_le16 (cp_rings );
4812
- req .num_vnics = cpu_to_le16 (1 );
4813
- if (bp -> flags & BNXT_FLAG_RFS )
4814
- req .num_vnics = cpu_to_le16 (rx_rings + 1 );
4815
- }
4811
+
4816
4812
req .flags = cpu_to_le32 (flags );
4817
- req .enables = cpu_to_le32 (enables );
4818
4813
rc = hwrm_send_message_silent (bp , & req , sizeof (req ), HWRM_CMD_TIMEOUT );
4819
4814
if (rc )
4820
4815
return - ENOMEM ;
4821
4816
return 0 ;
4822
4817
}
4823
4818
4824
4819
static int bnxt_hwrm_check_rings (struct bnxt * bp , int tx_rings , int rx_rings ,
4825
- int ring_grps , int cp_rings )
4820
+ int ring_grps , int cp_rings , int vnics )
4826
4821
{
4827
4822
if (bp -> hwrm_spec_code < 0x10801 )
4828
4823
return 0 ;
4829
4824
4830
4825
if (BNXT_PF (bp ))
4831
4826
return bnxt_hwrm_check_pf_rings (bp , tx_rings , rx_rings ,
4832
- ring_grps , cp_rings );
4827
+ ring_grps , cp_rings , vnics );
4833
4828
4834
4829
return bnxt_hwrm_check_vf_rings (bp , tx_rings , rx_rings , ring_grps ,
4835
- cp_rings );
4830
+ cp_rings , vnics );
4836
4831
}
4837
4832
4838
4833
static void bnxt_hwrm_set_coal_params (struct bnxt_coal * hw_coal ,
@@ -5865,7 +5860,6 @@ static int bnxt_init_msix(struct bnxt *bp)
5865
5860
if (rc )
5866
5861
goto msix_setup_exit ;
5867
5862
5868
- bp -> tx_nr_rings_per_tc = bp -> tx_nr_rings ;
5869
5863
bp -> cp_nr_rings = (min == 1 ) ?
5870
5864
max_t (int , bp -> tx_nr_rings , bp -> rx_nr_rings ) :
5871
5865
bp -> tx_nr_rings + bp -> rx_nr_rings ;
@@ -5897,7 +5891,6 @@ static int bnxt_init_inta(struct bnxt *bp)
5897
5891
bp -> rx_nr_rings = 1 ;
5898
5892
bp -> tx_nr_rings = 1 ;
5899
5893
bp -> cp_nr_rings = 1 ;
5900
- bp -> tx_nr_rings_per_tc = bp -> tx_nr_rings ;
5901
5894
bp -> flags |= BNXT_FLAG_SHARED_RINGS ;
5902
5895
bp -> irq_tbl [0 ].vector = bp -> pdev -> irq ;
5903
5896
return 0 ;
@@ -7531,7 +7524,7 @@ int bnxt_check_rings(struct bnxt *bp, int tx, int rx, bool sh, int tcs,
7531
7524
int max_rx , max_tx , tx_sets = 1 ;
7532
7525
int tx_rings_needed ;
7533
7526
int rx_rings = rx ;
7534
- int cp , rc ;
7527
+ int cp , vnics , rc ;
7535
7528
7536
7529
if (tcs )
7537
7530
tx_sets = tcs ;
@@ -7547,10 +7540,15 @@ int bnxt_check_rings(struct bnxt *bp, int tx, int rx, bool sh, int tcs,
7547
7540
if (max_tx < tx_rings_needed )
7548
7541
return - ENOMEM ;
7549
7542
7543
+ vnics = 1 ;
7544
+ if (bp -> flags & BNXT_FLAG_RFS )
7545
+ vnics += rx_rings ;
7546
+
7550
7547
if (bp -> flags & BNXT_FLAG_AGG_RINGS )
7551
7548
rx_rings <<= 1 ;
7552
7549
cp = sh ? max_t (int , tx_rings_needed , rx ) : tx_rings_needed + rx ;
7553
- return bnxt_hwrm_check_rings (bp , tx_rings_needed , rx_rings , rx , cp );
7550
+ return bnxt_hwrm_check_rings (bp , tx_rings_needed , rx_rings , rx , cp ,
7551
+ vnics );
7554
7552
}
7555
7553
7556
7554
static void bnxt_unmap_bars (struct bnxt * bp , struct pci_dev * pdev )
@@ -8437,13 +8435,20 @@ int bnxt_restore_pf_fw_resources(struct bnxt *bp)
8437
8435
return 0 ;
8438
8436
8439
8437
bnxt_hwrm_func_qcaps (bp );
8440
- __bnxt_close_nic (bp , true, false);
8438
+
8439
+ if (netif_running (bp -> dev ))
8440
+ __bnxt_close_nic (bp , true, false);
8441
+
8441
8442
bnxt_clear_int_mode (bp );
8442
8443
rc = bnxt_init_int_mode (bp );
8443
- if (rc )
8444
- dev_close (bp -> dev );
8445
- else
8446
- rc = bnxt_open_nic (bp , true, false);
8444
+
8445
+ if (netif_running (bp -> dev )) {
8446
+ if (rc )
8447
+ dev_close (bp -> dev );
8448
+ else
8449
+ rc = bnxt_open_nic (bp , true, false);
8450
+ }
8451
+
8447
8452
return rc ;
8448
8453
}
8449
8454
@@ -8664,6 +8669,11 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
8664
8669
if (rc )
8665
8670
goto init_err_pci_clean ;
8666
8671
8672
+ /* No TC has been set yet and rings may have been trimmed due to
8673
+ * limited MSIX, so we re-initialize the TX rings per TC.
8674
+ */
8675
+ bp -> tx_nr_rings_per_tc = bp -> tx_nr_rings ;
8676
+
8667
8677
bnxt_get_wol_settings (bp );
8668
8678
if (bp -> flags & BNXT_FLAG_WOL_CAP )
8669
8679
device_set_wakeup_enable (& pdev -> dev , bp -> wol );
0 commit comments