Commit 6e7c8eea authored by Saurav Kashyap's avatar Saurav Kashyap Committed by Martin K. Petersen

scsi: qedf: Implement callback for bw_update

Add support for the common qed bw_update callback to qedf.  This function
is called whenever there is a reported change in the bandwidth and updates
corresponding values in sysfs.

Link: https://lore.kernel.org/r/20200416084314.18851-7-skashyap@marvell.comSigned-off-by: default avatarSaurav Kashyap <skashyap@marvell.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 699fed4a
...@@ -509,6 +509,32 @@ static void qedf_update_link_speed(struct qedf_ctx *qedf, ...@@ -509,6 +509,32 @@ static void qedf_update_link_speed(struct qedf_ctx *qedf,
fc_host_supported_speeds(lport->host) = lport->link_supported_speeds; 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) static void qedf_link_update(void *dev, struct qed_link_output *link)
{ {
struct qedf_ctx *qedf = (struct qedf_ctx *)dev; struct qedf_ctx *qedf = (struct qedf_ctx *)dev;
...@@ -635,6 +661,7 @@ static u32 qedf_get_login_failures(void *cookie) ...@@ -635,6 +661,7 @@ static u32 qedf_get_login_failures(void *cookie)
static struct qed_fcoe_cb_ops qedf_cb_ops = { static struct qed_fcoe_cb_ops qedf_cb_ops = {
{ {
.link_update = qedf_link_update, .link_update = qedf_link_update,
.bw_update = qedf_bw_update,
.dcbx_aen = qedf_dcbx_handler, .dcbx_aen = qedf_dcbx_handler,
.get_generic_tlv_data = qedf_get_generic_tlv_data, .get_generic_tlv_data = qedf_get_generic_tlv_data,
.get_protocol_tlv_data = qedf_get_protocol_tlv_data, .get_protocol_tlv_data = qedf_get_protocol_tlv_data,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment