Skip to content

Commit 662c9b2

Browse files
Edwin Peerkuba-moo
authored andcommitted
bnxt_en: improve VF error messages when PF is unavailable
The current driver design relies on the PF netdev being open in order to intercept the following HWRM commands from a VF: - HWRM_FUNC_VF_CFG - HWRM_CFA_L2_FILTER_ALLOC - HWRM_PORT_PHY_QCFG (only if FW_CAP_LINK_ADMIN is not supported) If the PF is closed, then VFs are subjected to rather inscrutable error messages in response to any configuration requests involving the above command types. Recent firmware distinguishes this problem case from other errors by returning HWRM_ERR_CODE_PF_UNAVAILABLE. In most cases, the appropriate course of action is still to fail, but this can now be accomplished with the aid of more user informative log messages. For L2 filter allocations that are already asynchronous, an automatic retry seems more appropriate. v2: Delete extra newline. Signed-off-by: Edwin Peer <edwin.peer@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 8fa4219 commit 662c9b2

File tree

3 files changed

+40
-9
lines changed

3 files changed

+40
-9
lines changed

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

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8637,7 +8637,10 @@ static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init)
86378637
/* Filter for default vnic 0 */
86388638
rc = bnxt_hwrm_set_vnic_filter(bp, 0, 0, bp->dev->dev_addr);
86398639
if (rc) {
8640-
netdev_err(bp->dev, "HWRM vnic filter failure rc: %x\n", rc);
8640+
if (BNXT_VF(bp) && rc == -ENODEV)
8641+
netdev_err(bp->dev, "Cannot configure L2 filter while PF is unavailable\n");
8642+
else
8643+
netdev_err(bp->dev, "HWRM vnic filter failure rc: %x\n", rc);
86418644
goto err_out;
86428645
}
86438646
vnic->uc_filter_count = 1;
@@ -9430,6 +9433,10 @@ int bnxt_update_link(struct bnxt *bp, bool chng_link_state)
94309433
rc = hwrm_req_send(bp, req);
94319434
if (rc) {
94329435
hwrm_req_drop(bp, req);
9436+
if (BNXT_VF(bp) && rc == -ENODEV) {
9437+
netdev_warn(bp->dev, "Cannot obtain link state while PF unavailable.\n");
9438+
rc = 0;
9439+
}
94339440
return rc;
94349441
}
94359442

@@ -10828,12 +10835,21 @@ static int bnxt_cfg_rx_mode(struct bnxt *bp)
1082810835
for (i = 1, off = 0; i < vnic->uc_filter_count; i++, off += ETH_ALEN) {
1082910836
rc = bnxt_hwrm_set_vnic_filter(bp, 0, i, vnic->uc_list + off);
1083010837
if (rc) {
10831-
netdev_err(bp->dev, "HWRM vnic filter failure rc: %x\n",
10832-
rc);
10838+
if (BNXT_VF(bp) && rc == -ENODEV) {
10839+
if (!test_and_set_bit(BNXT_STATE_L2_FILTER_RETRY, &bp->state))
10840+
netdev_warn(bp->dev, "Cannot configure L2 filters while PF is unavailable, will retry\n");
10841+
else
10842+
netdev_dbg(bp->dev, "PF still unavailable while configuring L2 filters.\n");
10843+
rc = 0;
10844+
} else {
10845+
netdev_err(bp->dev, "HWRM vnic filter failure rc: %x\n", rc);
10846+
}
1083310847
vnic->uc_filter_count = i;
1083410848
return rc;
1083510849
}
1083610850
}
10851+
if (test_and_clear_bit(BNXT_STATE_L2_FILTER_RETRY, &bp->state))
10852+
netdev_notice(bp->dev, "Retry of L2 filter configuration successful.\n");
1083710853

1083810854
skip_uc:
1083910855
if ((vnic->rx_mask & CFA_L2_SET_RX_MASK_REQ_MASK_PROMISCUOUS) &&
@@ -11398,6 +11414,11 @@ static void bnxt_timer(struct timer_list *t)
1139811414
}
1139911415
}
1140011416

11417+
if (test_bit(BNXT_STATE_L2_FILTER_RETRY, &bp->state)) {
11418+
set_bit(BNXT_RX_MASK_SP_EVENT, &bp->sp_event);
11419+
bnxt_queue_sp_work(bp);
11420+
}
11421+
1140111422
if ((bp->flags & BNXT_FLAG_CHIP_P5) && !bp->chip_rev &&
1140211423
netif_carrier_ok(dev)) {
1140311424
set_bit(BNXT_RING_COAL_NOW_SP_EVENT, &bp->sp_event);
@@ -13104,7 +13125,7 @@ static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh)
1310413125
bp->tx_nr_rings = bp->tx_nr_rings_per_tc;
1310513126

1310613127
rc = __bnxt_reserve_rings(bp);
13107-
if (rc)
13128+
if (rc && rc != -ENODEV)
1310813129
netdev_warn(bp->dev, "Unable to reserve tx rings\n");
1310913130
bp->tx_nr_rings_per_tc = bp->tx_nr_rings;
1311013131
if (sh)
@@ -13113,7 +13134,7 @@ static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh)
1311313134
/* Rings may have been trimmed, re-reserve the trimmed rings. */
1311413135
if (bnxt_need_reserve_rings(bp)) {
1311513136
rc = __bnxt_reserve_rings(bp);
13116-
if (rc)
13137+
if (rc && rc != -ENODEV)
1311713138
netdev_warn(bp->dev, "2nd rings reservation failed.\n");
1311813139
bp->tx_nr_rings_per_tc = bp->tx_nr_rings;
1311913140
}
@@ -13139,7 +13160,10 @@ static int bnxt_init_dflt_ring_mode(struct bnxt *bp)
1313913160
bnxt_clear_int_mode(bp);
1314013161
rc = bnxt_set_dflt_rings(bp, true);
1314113162
if (rc) {
13142-
netdev_err(bp->dev, "Not enough rings available.\n");
13163+
if (BNXT_VF(bp) && rc == -ENODEV)
13164+
netdev_err(bp->dev, "Cannot configure VF rings while PF is unavailable.\n");
13165+
else
13166+
netdev_err(bp->dev, "Not enough rings available.\n");
1314313167
goto init_dflt_ring_err;
1314413168
}
1314513169
rc = bnxt_init_int_mode(bp);
@@ -13427,8 +13451,12 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1342713451
bnxt_set_ring_params(bp);
1342813452
rc = bnxt_set_dflt_rings(bp, true);
1342913453
if (rc) {
13430-
netdev_err(bp->dev, "Not enough rings available.\n");
13431-
rc = -ENOMEM;
13454+
if (BNXT_VF(bp) && rc == -ENODEV) {
13455+
netdev_err(bp->dev, "Cannot configure VF rings while PF is unavailable.\n");
13456+
} else {
13457+
netdev_err(bp->dev, "Not enough rings available.\n");
13458+
rc = -ENOMEM;
13459+
}
1343213460
goto init_err_pci_clean;
1343313461
}
1343413462

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1916,6 +1916,7 @@ struct bnxt {
19161916
#define BNXT_STATE_DRV_REGISTERED 7
19171917
#define BNXT_STATE_PCI_CHANNEL_IO_FROZEN 8
19181918
#define BNXT_STATE_NAPI_DISABLED 9
1919+
#define BNXT_STATE_L2_FILTER_RETRY 10
19191920
#define BNXT_STATE_FW_ACTIVATE 11
19201921
#define BNXT_STATE_RECOVER 12
19211922
#define BNXT_STATE_FW_NON_FATAL_COND 13

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,8 @@ static int __hwrm_to_stderr(u32 hwrm_err)
359359
return -EAGAIN;
360360
case HWRM_ERR_CODE_CMD_NOT_SUPPORTED:
361361
return -EOPNOTSUPP;
362+
case HWRM_ERR_CODE_PF_UNAVAILABLE:
363+
return -ENODEV;
362364
default:
363365
return -EIO;
364366
}
@@ -648,7 +650,7 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx)
648650
if (rc == HWRM_ERR_CODE_BUSY && !(ctx->flags & BNXT_HWRM_CTX_SILENT))
649651
netdev_warn(bp->dev, "FW returned busy, hwrm req_type 0x%x\n",
650652
req_type);
651-
else if (rc)
653+
else if (rc && rc != HWRM_ERR_CODE_PF_UNAVAILABLE)
652654
hwrm_err(bp, ctx, "hwrm req_type 0x%x seq id 0x%x error 0x%x\n",
653655
req_type, token->seq_id, rc);
654656
rc = __hwrm_to_stderr(rc);

0 commit comments

Comments
 (0)