Commit 7e334fc8 authored by Vasundhara Volam's avatar Vasundhara Volam Committed by David S. Miller
Browse files

bnxt_en: Add missing devlink health reporters for VFs.



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: 6763c779 ("bnxt_en: Add new FW devlink_health_reporter")
Signed-off-by: default avatarVasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 937f188c
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -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);
	}

	pci_disable_pcie_error_reporting(pdev);
	unregister_netdev(dev);
	bnxt_shutdown_tc(bp);
@@ -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);
	}

	netdev_info(dev, "%s found at mem %lx, node addr %pM\n",
		    board_info[ent->driver_data].name,
+17 −6
Original line number Diff line number Diff line
@@ -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,
@@ -483,7 +485,10 @@ int bnxt_dl_register(struct bnxt *bp)
		return -ENOTSUPP;
	}

	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;
@@ -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) {
@@ -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,
	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);
}