Commit d061b241 authored by Michael Chan's avatar Michael Chan Committed by David S. Miller

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: 03213a99 ("bnxt: move bp->switch_id initialization to PF probe")
Reported-by: default avatarMarc Smith <msmith626@gmail.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6fc7caa8
...@@ -11373,7 +11373,7 @@ int bnxt_get_port_parent_id(struct net_device *dev, ...@@ -11373,7 +11373,7 @@ int bnxt_get_port_parent_id(struct net_device *dev,
return -EOPNOTSUPP; return -EOPNOTSUPP;
/* The PF and it's VF-reps only support the switchdev framework */ /* The PF and it's VF-reps only support the switchdev framework */
if (!BNXT_PF(bp)) if (!BNXT_PF(bp) || !(bp->flags & BNXT_FLAG_DSN_VALID))
return -EOPNOTSUPP; return -EOPNOTSUPP;
ppid->id_len = sizeof(bp->switch_id); ppid->id_len = sizeof(bp->switch_id);
...@@ -11746,6 +11746,7 @@ static int bnxt_pcie_dsn_get(struct bnxt *bp, u8 dsn[]) ...@@ -11746,6 +11746,7 @@ static int bnxt_pcie_dsn_get(struct bnxt *bp, u8 dsn[])
put_unaligned_le32(dw, &dsn[0]); put_unaligned_le32(dw, &dsn[0]);
pci_read_config_dword(pdev, pos + 4, &dw); pci_read_config_dword(pdev, pos + 4, &dw);
put_unaligned_le32(dw, &dsn[4]); put_unaligned_le32(dw, &dsn[4]);
bp->flags |= BNXT_FLAG_DSN_VALID;
return 0; return 0;
} }
...@@ -11857,9 +11858,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -11857,9 +11858,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (BNXT_PF(bp)) { if (BNXT_PF(bp)) {
/* Read the adapter's DSN to use as the eswitch switch_id */ /* Read the adapter's DSN to use as the eswitch switch_id */
rc = bnxt_pcie_dsn_get(bp, bp->switch_id); bnxt_pcie_dsn_get(bp, bp->switch_id);
if (rc)
goto init_err_pci_clean;
} }
/* MTU range: 60 - FW defined max */ /* MTU range: 60 - FW defined max */
......
...@@ -1532,6 +1532,7 @@ struct bnxt { ...@@ -1532,6 +1532,7 @@ struct bnxt {
#define BNXT_FLAG_NO_AGG_RINGS 0x20000 #define BNXT_FLAG_NO_AGG_RINGS 0x20000
#define BNXT_FLAG_RX_PAGE_MODE 0x40000 #define BNXT_FLAG_RX_PAGE_MODE 0x40000
#define BNXT_FLAG_MULTI_HOST 0x100000 #define BNXT_FLAG_MULTI_HOST 0x100000
#define BNXT_FLAG_DSN_VALID 0x200000
#define BNXT_FLAG_DOUBLE_DB 0x400000 #define BNXT_FLAG_DOUBLE_DB 0x400000
#define BNXT_FLAG_CHIP_NITRO_A0 0x1000000 #define BNXT_FLAG_CHIP_NITRO_A0 0x1000000
#define BNXT_FLAG_DIM 0x2000000 #define BNXT_FLAG_DIM 0x2000000
......
...@@ -398,6 +398,9 @@ static int bnxt_vf_reps_create(struct bnxt *bp) ...@@ -398,6 +398,9 @@ static int bnxt_vf_reps_create(struct bnxt *bp)
struct net_device *dev; struct net_device *dev;
int rc, i; int rc, i;
if (!(bp->flags & BNXT_FLAG_DSN_VALID))
return -ENODEV;
bp->vf_reps = kcalloc(num_vfs, sizeof(vf_rep), GFP_KERNEL); bp->vf_reps = kcalloc(num_vfs, sizeof(vf_rep), GFP_KERNEL);
if (!bp->vf_reps) if (!bp->vf_reps)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment