Skip to content

Commit d061b24

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Do not treat DSN (Digital Serial Number) read failure as fatal.
DSN read can fail, for example on a kdump kernel without PCIe extended config space support. If DSN read fails, don't set the BNXT_FLAG_DSN_VALID flag and continue loading. Check the flag to see if the stored DSN is valid before using it. Only VF reps creation should fail without valid DSN. Fixes: 03213a9 ("bnxt: move bp->switch_id initialization to PF probe") Reported-by: Marc Smith <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6fc7caa commit d061b24

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11373,7 +11373,7 @@ int bnxt_get_port_parent_id(struct net_device *dev,
1137311373
return -EOPNOTSUPP;
1137411374

1137511375
/* The PF and it's VF-reps only support the switchdev framework */
11376-
if (!BNXT_PF(bp))
11376+
if (!BNXT_PF(bp) || !(bp->flags & BNXT_FLAG_DSN_VALID))
1137711377
return -EOPNOTSUPP;
1137811378

1137911379
ppid->id_len = sizeof(bp->switch_id);
@@ -11746,6 +11746,7 @@ static int bnxt_pcie_dsn_get(struct bnxt *bp, u8 dsn[])
1174611746
put_unaligned_le32(dw, &dsn[0]);
1174711747
pci_read_config_dword(pdev, pos + 4, &dw);
1174811748
put_unaligned_le32(dw, &dsn[4]);
11749+
bp->flags |= BNXT_FLAG_DSN_VALID;
1174911750
return 0;
1175011751
}
1175111752

@@ -11857,9 +11858,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1185711858

1185811859
if (BNXT_PF(bp)) {
1185911860
/* Read the adapter's DSN to use as the eswitch switch_id */
11860-
rc = bnxt_pcie_dsn_get(bp, bp->switch_id);
11861-
if (rc)
11862-
goto init_err_pci_clean;
11861+
bnxt_pcie_dsn_get(bp, bp->switch_id);
1186311862
}
1186411863

1186511864
/* MTU range: 60 - FW defined max */

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,6 +1532,7 @@ struct bnxt {
15321532
#define BNXT_FLAG_NO_AGG_RINGS 0x20000
15331533
#define BNXT_FLAG_RX_PAGE_MODE 0x40000
15341534
#define BNXT_FLAG_MULTI_HOST 0x100000
1535+
#define BNXT_FLAG_DSN_VALID 0x200000
15351536
#define BNXT_FLAG_DOUBLE_DB 0x400000
15361537
#define BNXT_FLAG_CHIP_NITRO_A0 0x1000000
15371538
#define BNXT_FLAG_DIM 0x2000000

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,9 @@ static int bnxt_vf_reps_create(struct bnxt *bp)
398398
struct net_device *dev;
399399
int rc, i;
400400

401+
if (!(bp->flags & BNXT_FLAG_DSN_VALID))
402+
return -ENODEV;
403+
401404
bp->vf_reps = kcalloc(num_vfs, sizeof(vf_rep), GFP_KERNEL);
402405
if (!bp->vf_reps)
403406
return -ENOMEM;

0 commit comments

Comments
 (0)