diff mbox series

[v3,4/7] qedf: Implement callback for bw_update.

Message ID 20200403120957.2431-5-skashyap@marvell.com (mailing list archive)
State Superseded
Headers show
Series qed/qedf: Firmware recovery, bw update and misc fixes. | expand

Commit Message

Saurav Kashyap April 3, 2020, 12:09 p.m. UTC
This is extension of bw common callback provided by qed.
This is called whenever there is a change in the BW.

Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
---
 drivers/scsi/qedf/qedf_main.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

Comments

Martin K. Petersen April 14, 2020, 1:24 a.m. UTC | #1
Saurav,

> This is extension of bw common callback provided by qed.
> This is called whenever there is a change in the BW.

    Add support for the common qed bw_update callback to qedf.  This
    function is called whenever there is a reported change in the
    bandwidth. It is required because...
Saurav Kashyap April 14, 2020, 4:18 a.m. UTC | #2
Hi Martin,

> -----Original Message-----
> From: Martin K. Petersen <martin.petersen@oracle.com>
> Sent: Tuesday, April 14, 2020 6:55 AM
> To: Saurav Kashyap <skashyap@marvell.com>
> Cc: martin.petersen@oracle.com; GR-QLogic-Storage-Upstream <GR-QLogic-
> Storage-Upstream@marvell.com>; linux-scsi@vger.kernel.org; Javed Hasan
> <jhasan@marvell.com>; netdev@vger.kernel.org
> Subject: [EXT] Re: [PATCH v3 4/7] qedf: Implement callback for bw_update.
> 
> External Email
> 
> ----------------------------------------------------------------------
> 
> Saurav,
> 
> > This is extension of bw common callback provided by qed.
> > This is called whenever there is a change in the BW.
> 
>     Add support for the common qed bw_update callback to qedf.  This
>     function is called whenever there is a reported change in the
>     bandwidth. It is required because...

<SK> We have OEMs that have software to manage SAN. Using those
tools bandwidth can be updated and notified to the driver. The driver will
update the sysfs nodes accordingly.

Thanks,
~Saurav
> 
> --
> Martin K. Petersen	Oracle Linux Engineering
diff mbox series

Patch

diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index ee468102..ba66216 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -509,6 +509,32 @@  static void qedf_update_link_speed(struct qedf_ctx *qedf,
 	fc_host_supported_speeds(lport->host) = lport->link_supported_speeds;
 }
 
+static void qedf_bw_update(void *dev)
+{
+	struct qedf_ctx *qedf = (struct qedf_ctx *)dev;
+	struct qed_link_output link;
+
+	/* Get the latest status of the link */
+	qed_ops->common->get_link(qedf->cdev, &link);
+
+	if (test_bit(QEDF_UNLOADING, &qedf->flags)) {
+		QEDF_ERR(&qedf->dbg_ctx,
+			 "Ignore link update, driver getting unload.\n");
+		return;
+	}
+
+	if (link.link_up) {
+		if (atomic_read(&qedf->link_state) == QEDF_LINK_UP)
+			qedf_update_link_speed(qedf, &link);
+		else
+			QEDF_ERR(&qedf->dbg_ctx,
+				 "Ignore bw update, link is down.\n");
+
+	} else {
+		QEDF_ERR(&qedf->dbg_ctx, "link_up is not set.\n");
+	}
+}
+
 static void qedf_link_update(void *dev, struct qed_link_output *link)
 {
 	struct qedf_ctx *qedf = (struct qedf_ctx *)dev;
@@ -635,6 +661,7 @@  static u32 qedf_get_login_failures(void *cookie)
 static struct qed_fcoe_cb_ops qedf_cb_ops = {
 	{
 		.link_update = qedf_link_update,
+		.bw_update = qedf_bw_update,
 		.dcbx_aen = qedf_dcbx_handler,
 		.get_generic_tlv_data = qedf_get_generic_tlv_data,
 		.get_protocol_tlv_data = qedf_get_protocol_tlv_data,