All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saurav Kashyap <skashyap@marvell.com>
To: <martin.petersen@oracle.com>
Cc: <GR-QLogic-Storage-Upstream@marvell.com>,
	<linux-scsi@vger.kernel.org>, <jhasan@marvell.com>,
	<netdev@vger.kernel.org>
Subject: [PATCH v3 4/7] qedf: Implement callback for bw_update.
Date: Fri, 3 Apr 2020 05:09:54 -0700	[thread overview]
Message-ID: <20200403120957.2431-5-skashyap@marvell.com> (raw)
In-Reply-To: <20200403120957.2431-1-skashyap@marvell.com>

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(+)

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,
-- 
1.8.3.1


  parent reply	other threads:[~2020-04-03 12:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-03 12:09 [PATCH v3 0/7] qed/qedf: Firmware recovery, bw update and misc fixes Saurav Kashyap
2020-04-03 12:09 ` [PATCH v3 1/7] qedf: Keep track of num of pending flogi Saurav Kashyap
2020-04-14  1:19   ` Martin K. Petersen
2020-04-14  4:13     ` [EXT] " Saurav Kashyap
2020-04-03 12:09 ` [PATCH v3 2/7] qedf: Fix for the deviations from the SAM-4 spec Saurav Kashyap
2020-04-14  1:22   ` Martin K. Petersen
2020-04-14  4:20     ` [EXT] " Saurav Kashyap
2020-04-03 12:09 ` [PATCH v3 3/7] qed: Send BW update notifications to the protocol drivers Saurav Kashyap
2020-04-03 12:09 ` Saurav Kashyap [this message]
2020-04-14  1:24   ` [PATCH v3 4/7] qedf: Implement callback for bw_update Martin K. Petersen
2020-04-14  4:18     ` [EXT] " Saurav Kashyap
2020-04-03 12:09 ` [PATCH v3 5/7] qedf: Add schedule recovery handler Saurav Kashyap
2020-04-14  1:25   ` Martin K. Petersen
2020-04-03 12:09 ` [PATCH v3 6/7] qedf: Fix crash when MFW calls for protocol stats while function is still probing Saurav Kashyap
2020-04-03 12:09 ` [PATCH v3 7/7] qedf: Get dev info after updating the params Saurav Kashyap
2020-04-14  1:27   ` Martin K. Petersen
2020-04-14  4:21     ` [EXT] " Saurav Kashyap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200403120957.2431-5-skashyap@marvell.com \
    --to=skashyap@marvell.com \
    --cc=GR-QLogic-Storage-Upstream@marvell.com \
    --cc=jhasan@marvell.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.