diff options
author | Javed Hasan | 2021-03-31 09:49:16 -0700 |
---|---|---|
committer | Martin K. Petersen | 2021-04-13 00:26:11 -0400 |
commit | 4aab946f789ed7c2e44481f395ab2eab0b63824a (patch) | |
tree | b8ccba0862114dad946de2b6485a30e9a015bd9b /drivers/scsi/qedf | |
parent | 1160d61bc51e87e509cfaf9da50a0060f67b6de4 (diff) |
scsi: qedf: Enable devlink support
Devlink instance lifetime was linked to qed_dev object. That caused devlink
to be recreated on each recovery.
Change it by making higher level driver (qede) responsible for lifetime
management. This way devlink survives recoveries.
qede now stores devlink structure pointer as a part of its device object,
devlink private data contains a linkage structure, qed_devlink.
Link: https://lore.kernel.org/r/20210331164917.24662-2-jhasan@marvell.com
Signed-off-by: Javed Hasan <jhasan@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/qedf')
-rw-r--r-- | drivers/scsi/qedf/qedf.h | 1 | ||||
-rw-r--r-- | drivers/scsi/qedf/qedf_main.c | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/drivers/scsi/qedf/qedf.h b/drivers/scsi/qedf/qedf.h index 0583b0707354..ba94413fe2ea 100644 --- a/drivers/scsi/qedf/qedf.h +++ b/drivers/scsi/qedf/qedf.h @@ -333,6 +333,7 @@ struct qedf_ctx { unsigned int curr_conn_id; struct workqueue_struct *ll2_recv_wq; struct workqueue_struct *link_update_wq; + struct devlink *devlink; struct delayed_work link_update; struct delayed_work link_recovery; struct completion flogi_compl; diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index cec27f2ef70d..b8d016914eee 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -3408,6 +3408,14 @@ retry_probe: goto err2; } + if (mode != QEDF_MODE_RECOVERY) { + qedf->devlink = qed_ops->common->devlink_register(qedf->cdev); + if (IS_ERR(qedf->devlink)) { + QEDF_ERR(&qedf->dbg_ctx, "Cannot register devlink\n"); + qedf->devlink = NULL; + } + } + /* Record BDQ producer doorbell addresses */ qedf->bdq_primary_prod = qedf->dev_info.primary_dbq_rq_addr; qedf->bdq_secondary_prod = qedf->dev_info.secondary_bdq_rq_addr; @@ -3789,6 +3797,11 @@ static void __qedf_remove(struct pci_dev *pdev, int mode) QEDF_ERR(&(qedf->dbg_ctx), "Failed to send drv state to MFW.\n"); + if (mode != QEDF_MODE_RECOVERY && qedf->devlink) { + qed_ops->common->devlink_unregister(qedf->devlink); + qedf->devlink = NULL; + } + qed_ops->common->slowpath_stop(qedf->cdev); qed_ops->common->remove(qedf->cdev); |