Skip to content

Commit

Permalink
bnxt_en: Add missing devlink health reporters for VFs.
Browse files Browse the repository at this point in the history
The VF driver also needs to create the health reporters since
VFs are also involved in firmware reset and recovery.  Modify
bnxt_dl_register() and bnxt_dl_unregister() so that they can
be called by the VFs to register/unregister devlink.  Only the PF
will register the devlink parameters.  With devlink registered,
we can now create the health reporters on the VFs.

Fixes: 6763c77 ("bnxt_en: Add new FW devlink_health_reporter")
Signed-off-by: Vasundhara Volam <[email protected]>
Signed-off-by: Michael Chan <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Vasundhara Volam authored and davem330 committed Dec 11, 2019
1 parent 937f188 commit 7e334fc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
13 changes: 5 additions & 8 deletions drivers/net/ethernet/broadcom/bnxt/bnxt.c
Original file line number Diff line number Diff line change
Expand Up @@ -11417,12 +11417,11 @@ static void bnxt_remove_one(struct pci_dev *pdev)
struct net_device *dev = pci_get_drvdata(pdev);
struct bnxt *bp = netdev_priv(dev);

if (BNXT_PF(bp)) {
if (BNXT_PF(bp))
bnxt_sriov_disable(bp);
bnxt_dl_fw_reporters_destroy(bp, true);
bnxt_dl_unregister(bp);
}

bnxt_dl_fw_reporters_destroy(bp, true);
bnxt_dl_unregister(bp);
pci_disable_pcie_error_reporting(pdev);
unregister_netdev(dev);
bnxt_shutdown_tc(bp);
Expand Down Expand Up @@ -11899,10 +11898,8 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (rc)
goto init_err_cleanup_tc;

if (BNXT_PF(bp)) {
bnxt_dl_register(bp);
bnxt_dl_fw_reporters_create(bp);
}
bnxt_dl_register(bp);
bnxt_dl_fw_reporters_create(bp);

netdev_info(dev, "%s found at mem %lx, node addr %pM\n",
board_info[ent->driver_data].name,
Expand Down
23 changes: 17 additions & 6 deletions drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ static const struct devlink_ops bnxt_dl_ops = {
.flash_update = bnxt_dl_flash_update,
};

static const struct devlink_ops bnxt_vf_dl_ops;

enum bnxt_dl_param_id {
BNXT_DEVLINK_PARAM_ID_BASE = DEVLINK_PARAM_GENERIC_ID_MAX,
BNXT_DEVLINK_PARAM_ID_GRE_VER_CHECK,
Expand Down Expand Up @@ -483,7 +485,10 @@ int bnxt_dl_register(struct bnxt *bp)
return -ENOTSUPP;
}

dl = devlink_alloc(&bnxt_dl_ops, sizeof(struct bnxt_dl));
if (BNXT_PF(bp))
dl = devlink_alloc(&bnxt_dl_ops, sizeof(struct bnxt_dl));
else
dl = devlink_alloc(&bnxt_vf_dl_ops, sizeof(struct bnxt_dl));
if (!dl) {
netdev_warn(bp->dev, "devlink_alloc failed");
return -ENOMEM;
Expand All @@ -502,6 +507,9 @@ int bnxt_dl_register(struct bnxt *bp)
goto err_dl_free;
}

if (!BNXT_PF(bp))
return 0;

rc = devlink_params_register(dl, bnxt_dl_params,
ARRAY_SIZE(bnxt_dl_params));
if (rc) {
Expand Down Expand Up @@ -551,11 +559,14 @@ void bnxt_dl_unregister(struct bnxt *bp)
if (!dl)
return;

devlink_port_params_unregister(&bp->dl_port, bnxt_dl_port_params,
ARRAY_SIZE(bnxt_dl_port_params));
devlink_port_unregister(&bp->dl_port);
devlink_params_unregister(dl, bnxt_dl_params,
ARRAY_SIZE(bnxt_dl_params));
if (BNXT_PF(bp)) {
devlink_port_params_unregister(&bp->dl_port,
bnxt_dl_port_params,
ARRAY_SIZE(bnxt_dl_port_params));
devlink_port_unregister(&bp->dl_port);
devlink_params_unregister(dl, bnxt_dl_params,
ARRAY_SIZE(bnxt_dl_params));
}
devlink_unregister(dl);
devlink_free(dl);
}

0 comments on commit 7e334fc

Please sign in to comment.