提交 48930c84 编写于 作者: M Manish Rangankar 提交者: Lipeng Sang

scsi: qla2xxx: Use transport-defined speed mask for supported_speeds

stable inclusion
from stable-v5.10.153
commit 44a86d96fac89f9a5b3de50215c1ed41872b5126
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I64YCA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=44a86d96fac89f9a5b3de50215c1ed41872b5126

--------------------------------

commit 0b863257 upstream.

One of the sysfs values reported for supported_speeds was not valid (20Gb/s
reported instead of 64Gb/s).  Instead of driver internal speed mask
definition, use speed mask defined in transport_fc for reporting
host->supported_speeds.

Link: https://lore.kernel.org/r/20220927115946.17559-1-njavali@marvell.com
Cc: stable@vger.kernel.org
Reviewed-by: NHimanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: NManish Rangankar <mrangankar@marvell.com>
Signed-off-by: NNilesh Javali <njavali@marvell.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NLipeng Sang <sanglipeng1@jd.com>
上级 60ee6838
...@@ -3262,11 +3262,34 @@ struct fc_function_template qla2xxx_transport_vport_functions = { ...@@ -3262,11 +3262,34 @@ struct fc_function_template qla2xxx_transport_vport_functions = {
.bsg_timeout = qla24xx_bsg_timeout, .bsg_timeout = qla24xx_bsg_timeout,
}; };
static uint
qla2x00_get_host_supported_speeds(scsi_qla_host_t *vha, uint speeds)
{
uint supported_speeds = FC_PORTSPEED_UNKNOWN;
if (speeds & FDMI_PORT_SPEED_64GB)
supported_speeds |= FC_PORTSPEED_64GBIT;
if (speeds & FDMI_PORT_SPEED_32GB)
supported_speeds |= FC_PORTSPEED_32GBIT;
if (speeds & FDMI_PORT_SPEED_16GB)
supported_speeds |= FC_PORTSPEED_16GBIT;
if (speeds & FDMI_PORT_SPEED_8GB)
supported_speeds |= FC_PORTSPEED_8GBIT;
if (speeds & FDMI_PORT_SPEED_4GB)
supported_speeds |= FC_PORTSPEED_4GBIT;
if (speeds & FDMI_PORT_SPEED_2GB)
supported_speeds |= FC_PORTSPEED_2GBIT;
if (speeds & FDMI_PORT_SPEED_1GB)
supported_speeds |= FC_PORTSPEED_1GBIT;
return supported_speeds;
}
void void
qla2x00_init_host_attr(scsi_qla_host_t *vha) qla2x00_init_host_attr(scsi_qla_host_t *vha)
{ {
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
u32 speeds = FC_PORTSPEED_UNKNOWN; u32 speeds = 0, fdmi_speed = 0;
fc_host_dev_loss_tmo(vha->host) = ha->port_down_retry_count; fc_host_dev_loss_tmo(vha->host) = ha->port_down_retry_count;
fc_host_node_name(vha->host) = wwn_to_u64(vha->node_name); fc_host_node_name(vha->host) = wwn_to_u64(vha->node_name);
...@@ -3276,7 +3299,8 @@ qla2x00_init_host_attr(scsi_qla_host_t *vha) ...@@ -3276,7 +3299,8 @@ qla2x00_init_host_attr(scsi_qla_host_t *vha)
fc_host_max_npiv_vports(vha->host) = ha->max_npiv_vports; fc_host_max_npiv_vports(vha->host) = ha->max_npiv_vports;
fc_host_npiv_vports_inuse(vha->host) = ha->cur_vport_count; fc_host_npiv_vports_inuse(vha->host) = ha->cur_vport_count;
speeds = qla25xx_fdmi_port_speed_capability(ha); fdmi_speed = qla25xx_fdmi_port_speed_capability(ha);
speeds = qla2x00_get_host_supported_speeds(vha, fdmi_speed);
fc_host_supported_speeds(vha->host) = speeds; fc_host_supported_speeds(vha->host) = speeds;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册