Skip to content

Commit

Permalink
scsi: qedf: Implement callback for bw_update
Browse files Browse the repository at this point in the history
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.com
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Saurav Kashyap authored and Martin K. Petersen committed Apr 17, 2020
1 parent 699fed4 commit 6e7c8ee
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions drivers/scsi/qedf/qedf_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 6e7c8ee

Please sign in to comment.