Skip to content

Commit 9e5fb72

Browse files
committed
Merge branch 'bnxt_en-Bug-fixes'
Michael Chan says: ==================== bnxt_en: Bug fixes. There are 3 bug fixes in this series to fix regressions recently introduced when adding the new ring reservations scheme. 2 minor fixes in the TC Flower code to return standard errno values and to elide some unnecessary warning dmesg. One Fixes the VLAN TCI value passed to the stack by including the entire 16-bit VLAN TCI, and the last fix is to check for valid VNIC ID before setting up or shutting down LRO/GRO. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents a2c054a + 3c4fe80 commit 9e5fb72

File tree

3 files changed

+118
-96
lines changed

3 files changed

+118
-96
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 95 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,7 +1439,7 @@ static inline struct sk_buff *bnxt_tpa_end(struct bnxt *bp,
14391439
(skb->dev->features & NETIF_F_HW_VLAN_CTAG_RX)) {
14401440
u16 vlan_proto = tpa_info->metadata >>
14411441
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;
14431443

14441444
__vlan_hwaccel_put_tag(skb, htons(vlan_proto), vtag);
14451445
}
@@ -1623,7 +1623,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_napi *bnapi, u32 *raw_cons,
16231623
cpu_to_le32(RX_CMP_FLAGS2_META_FORMAT_VLAN)) &&
16241624
(skb->dev->features & NETIF_F_HW_VLAN_CTAG_RX)) {
16251625
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;
16271627
u16 vlan_proto = meta_data >> RX_CMP_FLAGS2_METADATA_TPID_SFT;
16281628

16291629
__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)
38473847
struct bnxt_vnic_info *vnic = &bp->vnic_info[vnic_id];
38483848
struct hwrm_vnic_tpa_cfg_input req = {0};
38493849

3850+
if (vnic->fw_vnic_id == INVALID_HW_RING_ID)
3851+
return 0;
3852+
38503853
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_VNIC_TPA_CFG, -1, -1);
38513854

38523855
if (tpa_flags) {
@@ -4558,18 +4561,17 @@ int __bnxt_hwrm_get_tx_rings(struct bnxt *bp, u16 fid, int *tx_rings)
45584561
return rc;
45594562
}
45604563

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)
45644568
{
4565-
struct hwrm_func_cfg_input req = {0};
45664569
u32 enables = 0;
4567-
int rc;
45684570

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);
45714573
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);
45734575
if (bp->flags & BNXT_FLAG_NEW_RM) {
45744576
enables |= rx_rings ? FUNC_CFG_REQ_ENABLES_NUM_RX_RINGS : 0;
45754577
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,
45784580
FUNC_CFG_REQ_ENABLES_NUM_HW_RING_GRPS : 0;
45794581
enables |= vnics ? FUNC_VF_CFG_REQ_ENABLES_NUM_VNICS : 0;
45804582

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);
45864588
}
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)
45884628
return 0;
45894629

4590-
req.enables = cpu_to_le32(enables);
45914630
rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
45924631
if (rc)
45934632
return -ENOMEM;
@@ -4604,30 +4643,15 @@ bnxt_hwrm_reserve_vf_rings(struct bnxt *bp, int tx_rings, int rx_rings,
46044643
int ring_grps, int cp_rings, int vnics)
46054644
{
46064645
struct hwrm_func_vf_cfg_input req = {0};
4607-
u32 enables = 0;
46084646
int rc;
46094647

46104648
if (!(bp->flags & BNXT_FLAG_NEW_RM)) {
46114649
bp->hw_resc.resv_tx_rings = tx_rings;
46124650
return 0;
46134651
}
46144652

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);
46314655
rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
46324656
if (rc)
46334657
return -ENOMEM;
@@ -4743,96 +4767,67 @@ static bool bnxt_need_reserve_rings(struct bnxt *bp)
47434767
}
47444768

47454769
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)
47474771
{
47484772
struct hwrm_func_vf_cfg_input req = {0};
4749-
u32 flags, enables;
4773+
u32 flags;
47504774
int rc;
47514775

47524776
if (!(bp->flags & BNXT_FLAG_NEW_RM))
47534777
return 0;
47544778

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);
47564781
flags = FUNC_VF_CFG_REQ_FLAGS_TX_ASSETS_TEST |
47574782
FUNC_VF_CFG_REQ_FLAGS_RX_ASSETS_TEST |
47584783
FUNC_VF_CFG_REQ_FLAGS_CMPL_ASSETS_TEST |
47594784
FUNC_VF_CFG_REQ_FLAGS_RING_GRP_ASSETS_TEST |
47604785
FUNC_VF_CFG_REQ_FLAGS_STAT_CTX_ASSETS_TEST |
47614786
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;
47684787

47694788
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);
47794789
rc = hwrm_send_message_silent(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
47804790
if (rc)
47814791
return -ENOMEM;
47824792
return 0;
47834793
}
47844794

47854795
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)
47874797
{
47884798
struct hwrm_func_cfg_input req = {0};
4789-
u32 flags, enables;
4799+
u32 flags;
47904800
int rc;
47914801

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);
47944804
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)
47984806
flags |= FUNC_CFG_REQ_FLAGS_RX_ASSETS_TEST |
47994807
FUNC_CFG_REQ_FLAGS_CMPL_ASSETS_TEST |
48004808
FUNC_CFG_REQ_FLAGS_RING_GRP_ASSETS_TEST |
48014809
FUNC_CFG_REQ_FLAGS_STAT_CTX_ASSETS_TEST |
48024810
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+
48164812
req.flags = cpu_to_le32(flags);
4817-
req.enables = cpu_to_le32(enables);
48184813
rc = hwrm_send_message_silent(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
48194814
if (rc)
48204815
return -ENOMEM;
48214816
return 0;
48224817
}
48234818

48244819
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)
48264821
{
48274822
if (bp->hwrm_spec_code < 0x10801)
48284823
return 0;
48294824

48304825
if (BNXT_PF(bp))
48314826
return bnxt_hwrm_check_pf_rings(bp, tx_rings, rx_rings,
4832-
ring_grps, cp_rings);
4827+
ring_grps, cp_rings, vnics);
48334828

48344829
return bnxt_hwrm_check_vf_rings(bp, tx_rings, rx_rings, ring_grps,
4835-
cp_rings);
4830+
cp_rings, vnics);
48364831
}
48374832

48384833
static void bnxt_hwrm_set_coal_params(struct bnxt_coal *hw_coal,
@@ -5865,7 +5860,6 @@ static int bnxt_init_msix(struct bnxt *bp)
58655860
if (rc)
58665861
goto msix_setup_exit;
58675862

5868-
bp->tx_nr_rings_per_tc = bp->tx_nr_rings;
58695863
bp->cp_nr_rings = (min == 1) ?
58705864
max_t(int, bp->tx_nr_rings, bp->rx_nr_rings) :
58715865
bp->tx_nr_rings + bp->rx_nr_rings;
@@ -5897,7 +5891,6 @@ static int bnxt_init_inta(struct bnxt *bp)
58975891
bp->rx_nr_rings = 1;
58985892
bp->tx_nr_rings = 1;
58995893
bp->cp_nr_rings = 1;
5900-
bp->tx_nr_rings_per_tc = bp->tx_nr_rings;
59015894
bp->flags |= BNXT_FLAG_SHARED_RINGS;
59025895
bp->irq_tbl[0].vector = bp->pdev->irq;
59035896
return 0;
@@ -7531,7 +7524,7 @@ int bnxt_check_rings(struct bnxt *bp, int tx, int rx, bool sh, int tcs,
75317524
int max_rx, max_tx, tx_sets = 1;
75327525
int tx_rings_needed;
75337526
int rx_rings = rx;
7534-
int cp, rc;
7527+
int cp, vnics, rc;
75357528

75367529
if (tcs)
75377530
tx_sets = tcs;
@@ -7547,10 +7540,15 @@ int bnxt_check_rings(struct bnxt *bp, int tx, int rx, bool sh, int tcs,
75477540
if (max_tx < tx_rings_needed)
75487541
return -ENOMEM;
75497542

7543+
vnics = 1;
7544+
if (bp->flags & BNXT_FLAG_RFS)
7545+
vnics += rx_rings;
7546+
75507547
if (bp->flags & BNXT_FLAG_AGG_RINGS)
75517548
rx_rings <<= 1;
75527549
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);
75547552
}
75557553

75567554
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)
84378435
return 0;
84388436

84398437
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+
84418442
bnxt_clear_int_mode(bp);
84428443
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+
84478452
return rc;
84488453
}
84498454

@@ -8664,6 +8669,11 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
86648669
if (rc)
86658670
goto init_err_pci_clean;
86668671

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+
86678677
bnxt_get_wol_settings(bp);
86688678
if (bp->flags & BNXT_FLAG_WOL_CAP)
86698679
device_set_wakeup_enable(&pdev->dev, bp->wol);

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ struct rx_cmp_ext {
189189
#define RX_CMP_FLAGS2_T_L4_CS_CALC (0x1 << 3)
190190
#define RX_CMP_FLAGS2_META_FORMAT_VLAN (0x1 << 4)
191191
__le32 rx_cmp_meta_data;
192+
#define RX_CMP_FLAGS2_METADATA_TCI_MASK 0xffff
192193
#define RX_CMP_FLAGS2_METADATA_VID_MASK 0xfff
193194
#define RX_CMP_FLAGS2_METADATA_TPID_MASK 0xffff0000
194195
#define RX_CMP_FLAGS2_METADATA_TPID_SFT 16

0 commit comments

Comments
 (0)