Commit 72a92df2 authored by Joe Carnuccio's avatar Joe Carnuccio Committed by Martin K. Petersen

scsi: qla2xxx: Correctly report max/min supported speeds

This patch fixes reported speed for min_link and max_supported speed. Also
rename sysfs nodes link_speed and max_supported to be consistent with
{min|max}_suuported_speed.
Signed-off-by: default avatarJoe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: default avatarMike Hernandez <mhernandez@marvell.com>
Signed-off-by: default avatarHimanshu Madhani <hmadhani@marvell.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 2a3192a3
...@@ -1621,8 +1621,8 @@ qla2x00_pep_version_show(struct device *dev, struct device_attribute *attr, ...@@ -1621,8 +1621,8 @@ qla2x00_pep_version_show(struct device *dev, struct device_attribute *attr,
} }
static ssize_t static ssize_t
qla2x00_min_link_speed_show(struct device *dev, struct device_attribute *attr, qla2x00_min_supported_speed_show(struct device *dev,
char *buf) struct device_attribute *attr, char *buf)
{ {
scsi_qla_host_t *vha = shost_priv(class_to_shost(dev)); scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
...@@ -1631,16 +1631,17 @@ qla2x00_min_link_speed_show(struct device *dev, struct device_attribute *attr, ...@@ -1631,16 +1631,17 @@ qla2x00_min_link_speed_show(struct device *dev, struct device_attribute *attr,
return scnprintf(buf, PAGE_SIZE, "\n"); return scnprintf(buf, PAGE_SIZE, "\n");
return scnprintf(buf, PAGE_SIZE, "%s\n", return scnprintf(buf, PAGE_SIZE, "%s\n",
ha->min_link_speed == 5 ? "32Gps" : ha->min_supported_speed == 6 ? "64Gps" :
ha->min_link_speed == 4 ? "16Gps" : ha->min_supported_speed == 5 ? "32Gps" :
ha->min_link_speed == 3 ? "8Gps" : ha->min_supported_speed == 4 ? "16Gps" :
ha->min_link_speed == 2 ? "4Gps" : ha->min_supported_speed == 3 ? "8Gps" :
ha->min_link_speed != 0 ? "unknown" : ""); ha->min_supported_speed == 2 ? "4Gps" :
ha->min_supported_speed != 0 ? "unknown" : "");
} }
static ssize_t static ssize_t
qla2x00_max_speed_sup_show(struct device *dev, struct device_attribute *attr, qla2x00_max_supported_speed_show(struct device *dev,
char *buf) struct device_attribute *attr, char *buf)
{ {
scsi_qla_host_t *vha = shost_priv(class_to_shost(dev)); scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
...@@ -1649,7 +1650,9 @@ qla2x00_max_speed_sup_show(struct device *dev, struct device_attribute *attr, ...@@ -1649,7 +1650,9 @@ qla2x00_max_speed_sup_show(struct device *dev, struct device_attribute *attr,
return scnprintf(buf, PAGE_SIZE, "\n"); return scnprintf(buf, PAGE_SIZE, "\n");
return scnprintf(buf, PAGE_SIZE, "%s\n", return scnprintf(buf, PAGE_SIZE, "%s\n",
ha->max_speed_sup ? "32Gps" : "16Gps"); ha->max_supported_speed == 2 ? "64Gps" :
ha->max_supported_speed == 1 ? "32Gps" :
ha->max_supported_speed == 0 ? "16Gps" : "unknown");
} }
static ssize_t static ssize_t
...@@ -2253,8 +2256,10 @@ static DEVICE_ATTR(allow_cna_fw_dump, S_IRUGO | S_IWUSR, ...@@ -2253,8 +2256,10 @@ static DEVICE_ATTR(allow_cna_fw_dump, S_IRUGO | S_IWUSR,
qla2x00_allow_cna_fw_dump_show, qla2x00_allow_cna_fw_dump_show,
qla2x00_allow_cna_fw_dump_store); qla2x00_allow_cna_fw_dump_store);
static DEVICE_ATTR(pep_version, S_IRUGO, qla2x00_pep_version_show, NULL); static DEVICE_ATTR(pep_version, S_IRUGO, qla2x00_pep_version_show, NULL);
static DEVICE_ATTR(min_link_speed, S_IRUGO, qla2x00_min_link_speed_show, NULL); static DEVICE_ATTR(min_supported_speed, 0444,
static DEVICE_ATTR(max_speed_sup, S_IRUGO, qla2x00_max_speed_sup_show, NULL); qla2x00_min_supported_speed_show, NULL);
static DEVICE_ATTR(max_supported_speed, 0444,
qla2x00_max_supported_speed_show, NULL);
static DEVICE_ATTR(zio_threshold, 0644, static DEVICE_ATTR(zio_threshold, 0644,
qla_zio_threshold_show, qla_zio_threshold_show,
qla_zio_threshold_store); qla_zio_threshold_store);
...@@ -2303,8 +2308,8 @@ struct device_attribute *qla2x00_host_attrs[] = { ...@@ -2303,8 +2308,8 @@ struct device_attribute *qla2x00_host_attrs[] = {
&dev_attr_fw_dump_size, &dev_attr_fw_dump_size,
&dev_attr_allow_cna_fw_dump, &dev_attr_allow_cna_fw_dump,
&dev_attr_pep_version, &dev_attr_pep_version,
&dev_attr_min_link_speed, &dev_attr_min_supported_speed,
&dev_attr_max_speed_sup, &dev_attr_max_supported_speed,
&dev_attr_zio_threshold, &dev_attr_zio_threshold,
&dev_attr_dif_bundle_statistics, &dev_attr_dif_bundle_statistics,
&dev_attr_port_speed, &dev_attr_port_speed,
...@@ -3033,7 +3038,7 @@ void ...@@ -3033,7 +3038,7 @@ 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 speed = FC_PORTSPEED_UNKNOWN; u32 speeds = FC_PORTSPEED_UNKNOWN;
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);
...@@ -3044,28 +3049,45 @@ qla2x00_init_host_attr(scsi_qla_host_t *vha) ...@@ -3044,28 +3049,45 @@ qla2x00_init_host_attr(scsi_qla_host_t *vha)
fc_host_npiv_vports_inuse(vha->host) = ha->cur_vport_count; fc_host_npiv_vports_inuse(vha->host) = ha->cur_vport_count;
if (IS_CNA_CAPABLE(ha)) if (IS_CNA_CAPABLE(ha))
speed = FC_PORTSPEED_10GBIT; speeds = FC_PORTSPEED_10GBIT;
else if (IS_QLA2031(ha)) else if (IS_QLA28XX(ha) || IS_QLA27XX(ha)) {
speed = FC_PORTSPEED_16GBIT | FC_PORTSPEED_8GBIT | if (ha->max_supported_speed == 2) {
FC_PORTSPEED_4GBIT; if (ha->min_supported_speed <= 6)
else if (IS_QLA25XX(ha)) speeds |= FC_PORTSPEED_64GBIT;
speed = FC_PORTSPEED_8GBIT | FC_PORTSPEED_4GBIT | }
FC_PORTSPEED_2GBIT | FC_PORTSPEED_1GBIT; if (ha->max_supported_speed == 2 ||
ha->max_supported_speed == 1) {
if (ha->min_supported_speed <= 5)
speeds |= FC_PORTSPEED_32GBIT;
}
if (ha->max_supported_speed == 2 ||
ha->max_supported_speed == 1 ||
ha->max_supported_speed == 0) {
if (ha->min_supported_speed <= 4)
speeds |= FC_PORTSPEED_16GBIT;
}
if (ha->max_supported_speed == 1 ||
ha->max_supported_speed == 0) {
if (ha->min_supported_speed <= 3)
speeds |= FC_PORTSPEED_8GBIT;
}
if (ha->max_supported_speed == 0) {
if (ha->min_supported_speed <= 2)
speeds |= FC_PORTSPEED_4GBIT;
}
} else if (IS_QLA2031(ha))
speeds = FC_PORTSPEED_16GBIT|FC_PORTSPEED_8GBIT|
FC_PORTSPEED_4GBIT;
else if (IS_QLA25XX(ha) || IS_QLAFX00(ha))
speeds = FC_PORTSPEED_8GBIT|FC_PORTSPEED_4GBIT|
FC_PORTSPEED_2GBIT|FC_PORTSPEED_1GBIT;
else if (IS_QLA24XX_TYPE(ha)) else if (IS_QLA24XX_TYPE(ha))
speed = FC_PORTSPEED_4GBIT | FC_PORTSPEED_2GBIT | speeds = FC_PORTSPEED_4GBIT|FC_PORTSPEED_2GBIT|
FC_PORTSPEED_1GBIT; FC_PORTSPEED_1GBIT;
else if (IS_QLA23XX(ha)) else if (IS_QLA23XX(ha))
speed = FC_PORTSPEED_2GBIT | FC_PORTSPEED_1GBIT; speeds = FC_PORTSPEED_2GBIT|FC_PORTSPEED_1GBIT;
else if (IS_QLAFX00(ha))
speed = FC_PORTSPEED_8GBIT | FC_PORTSPEED_4GBIT |
FC_PORTSPEED_2GBIT | FC_PORTSPEED_1GBIT;
else if (IS_QLA27XX(ha))
speed = FC_PORTSPEED_32GBIT | FC_PORTSPEED_16GBIT |
FC_PORTSPEED_8GBIT;
else if (IS_QLA28XX(ha))
speed = FC_PORTSPEED_64GBIT | FC_PORTSPEED_32GBIT |
FC_PORTSPEED_16GBIT | FC_PORTSPEED_8GBIT;
else else
speed = FC_PORTSPEED_1GBIT; speeds = FC_PORTSPEED_1GBIT;
fc_host_supported_speeds(vha->host) = speed;
fc_host_supported_speeds(vha->host) = speeds;
} }
...@@ -4223,8 +4223,8 @@ struct qla_hw_data { ...@@ -4223,8 +4223,8 @@ struct qla_hw_data {
struct qlt_hw_data tgt; struct qlt_hw_data tgt;
int allow_cna_fw_dump; int allow_cna_fw_dump;
uint32_t fw_ability_mask; uint32_t fw_ability_mask;
uint16_t min_link_speed; uint16_t min_supported_speed;
uint16_t max_speed_sup; uint16_t max_supported_speed;
/* DMA pool for the DIF bundling buffers */ /* DMA pool for the DIF bundling buffers */
struct dma_pool *dif_bundl_pool; struct dma_pool *dif_bundl_pool;
...@@ -4455,7 +4455,7 @@ typedef struct scsi_qla_host { ...@@ -4455,7 +4455,7 @@ typedef struct scsi_qla_host {
int fcport_count; int fcport_count;
wait_queue_head_t fcport_waitQ; wait_queue_head_t fcport_waitQ;
wait_queue_head_t vref_waitq; wait_queue_head_t vref_waitq;
uint8_t min_link_speed_feat; uint8_t min_supported_speed;
uint8_t n2n_node_name[WWN_SIZE]; uint8_t n2n_node_name[WWN_SIZE];
uint8_t n2n_port_name[WWN_SIZE]; uint8_t n2n_port_name[WWN_SIZE];
uint16_t n2n_id; uint16_t n2n_id;
...@@ -4738,4 +4738,5 @@ struct sff_8247_a0 { ...@@ -4738,4 +4738,5 @@ struct sff_8247_a0 {
#include "qla_gbl.h" #include "qla_gbl.h"
#include "qla_dbg.h" #include "qla_dbg.h"
#include "qla_inline.h" #include "qla_inline.h"
#endif #endif
...@@ -1757,7 +1757,7 @@ struct nvram_81xx { ...@@ -1757,7 +1757,7 @@ struct nvram_81xx {
uint16_t reserved_6_3[14]; uint16_t reserved_6_3[14];
/* Offset 192. */ /* Offset 192. */
uint8_t min_link_speed; uint8_t min_supported_speed;
uint8_t reserved_7_0; uint8_t reserved_7_0;
uint16_t reserved_7[31]; uint16_t reserved_7[31];
......
...@@ -737,13 +737,14 @@ qla2x00_execute_fw(scsi_qla_host_t *vha, uint32_t risc_addr) ...@@ -737,13 +737,14 @@ qla2x00_execute_fw(scsi_qla_host_t *vha, uint32_t risc_addr)
if (IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) { if (IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) {
struct nvram_81xx *nv = ha->nvram; struct nvram_81xx *nv = ha->nvram;
/* set minimum speed if specified in nvram */ /* set minimum speed if specified in nvram */
if (nv->min_link_speed >= 2 && if (nv->min_supported_speed >= 2 &&
nv->min_link_speed <= 5) { nv->min_supported_speed <= 5) {
mcp->mb[4] |= BIT_4; mcp->mb[4] |= BIT_4;
mcp->mb[11] = nv->min_link_speed; mcp->mb[11] |= nv->min_supported_speed & 0xF;
mcp->out_mb |= MBX_11; mcp->out_mb |= MBX_11;
mcp->in_mb |= BIT_5; mcp->in_mb |= BIT_5;
vha->min_link_speed_feat = nv->min_link_speed; vha->min_supported_speed =
nv->min_supported_speed;
} }
} }
...@@ -771,35 +772,39 @@ qla2x00_execute_fw(scsi_qla_host_t *vha, uint32_t risc_addr) ...@@ -771,35 +772,39 @@ qla2x00_execute_fw(scsi_qla_host_t *vha, uint32_t risc_addr)
if (rval != QLA_SUCCESS) { if (rval != QLA_SUCCESS) {
ql_dbg(ql_dbg_mbx, vha, 0x1026, ql_dbg(ql_dbg_mbx, vha, 0x1026,
"Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]);
} else { return rval;
if (IS_FWI2_CAPABLE(ha)) { }
ha->fw_ability_mask = mcp->mb[3] << 16 | mcp->mb[2];
ql_dbg(ql_dbg_mbx, vha, 0x119a, if (!IS_FWI2_CAPABLE(ha))
"fw_ability_mask=%x.\n", ha->fw_ability_mask); goto done;
ql_dbg(ql_dbg_mbx, vha, 0x1027,
"exchanges=%x.\n", mcp->mb[1]); ha->fw_ability_mask = mcp->mb[3] << 16 | mcp->mb[2];
if (IS_QLA83XX(ha) || IS_QLA27XX(ha) || ql_dbg(ql_dbg_mbx, vha, 0x119a,
IS_QLA28XX(ha)) { "fw_ability_mask=%x.\n", ha->fw_ability_mask);
ha->max_speed_sup = mcp->mb[2] & BIT_0; ql_dbg(ql_dbg_mbx, vha, 0x1027, "exchanges=%x.\n", mcp->mb[1]);
ql_dbg(ql_dbg_mbx, vha, 0x119b, if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) {
"Maximum speed supported=%s.\n", ha->max_supported_speed = mcp->mb[2] & (BIT_0|BIT_1);
ha->max_speed_sup ? "32Gps" : "16Gps"); ql_dbg(ql_dbg_mbx, vha, 0x119b, "max_supported_speed=%s.\n",
if (vha->min_link_speed_feat) { ha->max_supported_speed == 0 ? "16Gps" :
ha->min_link_speed = mcp->mb[5]; ha->max_supported_speed == 1 ? "32Gps" :
ql_dbg(ql_dbg_mbx, vha, 0x119c, ha->max_supported_speed == 2 ? "64Gps" : "unknown");
"Minimum speed set=%s.\n", if (vha->min_supported_speed) {
mcp->mb[5] == 5 ? "32Gps" : ha->min_supported_speed = mcp->mb[5] &
mcp->mb[5] == 4 ? "16Gps" : (BIT_0 | BIT_1 | BIT_2);
mcp->mb[5] == 3 ? "8Gps" : ql_dbg(ql_dbg_mbx, vha, 0x119c,
mcp->mb[5] == 2 ? "4Gps" : "min_supported_speed=%s.\n",
"unknown"); ha->min_supported_speed == 6 ? "64Gps" :
} ha->min_supported_speed == 5 ? "32Gps" :
} ha->min_supported_speed == 4 ? "16Gps" :
ha->min_supported_speed == 3 ? "8Gps" :
ha->min_supported_speed == 2 ? "4Gps" : "unknown");
} }
ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1028,
"Done.\n");
} }
done:
ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1028,
"Done %s.\n", __func__);
return rval; return rval;
} }
......
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