scsi: smartpqi: Update SAS initiator_port_protocols and target_port_protocols

Export valid sas initiator_port_protocols and target_port_protocols to
sysfs. Needed for lsscsi to show correct values.

Link: https://lore.kernel.org/r/161549384532.25025.1469409935400845385.stgit@brunhilda
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Murthy Bhat <Murthy.Bhat@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Murthy Bhat 2021-03-11 14:17:25 -06:00 committed by Martin K. Petersen
parent ec504b23df
commit 55732a46d6

View File

@ -65,8 +65,8 @@ static int pqi_sas_port_add_phy(struct pqi_sas_phy *pqi_sas_phy)
memset(identify, 0, sizeof(*identify));
identify->sas_address = pqi_sas_port->sas_address;
identify->device_type = SAS_END_DEVICE;
identify->initiator_port_protocols = SAS_PROTOCOL_STP;
identify->target_port_protocols = SAS_PROTOCOL_STP;
identify->initiator_port_protocols = SAS_PROTOCOL_ALL;
identify->target_port_protocols = SAS_PROTOCOL_ALL;
phy->minimum_linkrate_hw = SAS_LINK_RATE_UNKNOWN;
phy->maximum_linkrate_hw = SAS_LINK_RATE_UNKNOWN;
phy->minimum_linkrate = SAS_LINK_RATE_UNKNOWN;
@ -94,13 +94,23 @@ static int pqi_sas_port_add_rphy(struct pqi_sas_port *pqi_sas_port,
identify->sas_address = pqi_sas_port->sas_address;
identify->phy_identifier = pqi_sas_port->device->phy_id;
if (pqi_sas_port->device &&
pqi_sas_port->device->is_expander_smp_device) {
identify->initiator_port_protocols = SAS_PROTOCOL_SMP;
identify->target_port_protocols = SAS_PROTOCOL_SMP;
} else {
identify->initiator_port_protocols = SAS_PROTOCOL_STP;
identify->target_port_protocols = SAS_PROTOCOL_STP;
identify->initiator_port_protocols = SAS_PROTOCOL_ALL;
identify->target_port_protocols = SAS_PROTOCOL_STP;
if (pqi_sas_port->device) {
switch (pqi_sas_port->device->device_type) {
case SA_DEVICE_TYPE_SAS:
case SA_DEVICE_TYPE_SES:
case SA_DEVICE_TYPE_NVME:
identify->target_port_protocols = SAS_PROTOCOL_SSP;
break;
case SA_DEVICE_TYPE_EXPANDER_SMP:
identify->target_port_protocols = SAS_PROTOCOL_SMP;
break;
case SA_DEVICE_TYPE_SATA:
default:
break;
}
}
return sas_rphy_add(rphy);