From f6e384eb8c8404f8c6c7713982f6ae12864f09d7 Mon Sep 17 00:00:00 2001 From: Nilesh Javali Date: Thu, 23 Jul 2026 10:34:01 +0530 Subject: [PATCH] scsi: qla2xxx: Add 64G/128G port speed setting support The port speed setting paths topped out at 32G: qla2x00_port_speed_store() only mapped sysfs inputs up to 32 (and their no-loss-of-sync forms up to 320), and qla2x00_set_data_rate() only accepted PORT_SPEED_AUTO/4/8/16/32 in its switch. A user request for 64G or 128G therefore hit the default arm and was silently downgraded to auto-negotiation. Map the 64 and 128 sysfs inputs (and their /10 no-loss-of-sync forms 640 and 1280) to PORT_SPEED_64GB and PORT_SPEED_128GB, and accept those values in qla2x00_set_data_rate(). The firmware validates the requested rate against the adapter's actual capability. Signed-off-by: Nilesh Javali Reviewed-by: Hannes Reinecke Link: https://patch.msgid.link/20260723050413.3897522-45-njavali@marvell.com Signed-off-by: Martin K. Petersen (Oracle) --- drivers/scsi/qla2xxx/qla_attr.c | 8 +++++++- drivers/scsi/qla2xxx/qla_init.c | 9 ++++++++- drivers/scsi/qla2xxx/qla_mbx.c | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 6cf74f8c9628..3b24e8a5e29b 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -1835,7 +1835,7 @@ qla2x00_port_speed_store(struct device *dev, struct device_attribute *attr, return rval; speed = type; if (type == 40 || type == 80 || type == 160 || - type == 320) { + type == 320 || type == 640 || type == 1280) { ql_dbg(ql_dbg_user, vha, 0x70d9, "Setting will be affected after a loss of sync\n"); type = type/10; @@ -1860,6 +1860,12 @@ qla2x00_port_speed_store(struct device *dev, struct device_attribute *attr, case 32: ha->set_data_rate = PORT_SPEED_32GB; break; + case 64: + ha->set_data_rate = PORT_SPEED_64GB; + break; + case 128: + ha->set_data_rate = PORT_SPEED_128GB; + break; default: ql_log(ql_log_warn, vha, 0x1199, "Unrecognized speed setting:%lx. Setting Autoneg\n", diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 545066f67e02..5f7bc68aab3c 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -4793,7 +4793,14 @@ qla24xx_config_rings(struct scsi_qla_host *vha) ql_dbg(ql_dbg_init, vha, 0x00fd, "Speed set by user : %s Gbps \n", qla2x00_get_link_speed_str(ha, ha->set_data_rate)); - icb->firmware_options_3 = cpu_to_le32(ha->set_data_rate << 13); + /* + * The ICB data-rate field is 3 bits (bits 13-15); rates above + * 64G do not fit and would overflow into bit 16 (75 ohm + * termination select). Such rates are forced via MBC_DATA_RATE. + */ + if (ha->set_data_rate <= PORT_SPEED_64GB) + icb->firmware_options_3 = + cpu_to_le32(ha->set_data_rate << 13); } /* PCI posting */ diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index d0894cc90470..ba822c196894 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -5720,6 +5720,8 @@ qla2x00_set_data_rate(scsi_qla_host_t *vha, uint16_t mode) case PORT_SPEED_8GB: case PORT_SPEED_16GB: case PORT_SPEED_32GB: + case PORT_SPEED_64GB: + case PORT_SPEED_128GB: val = ha->set_data_rate; break; default: