scsi: smartpqi: Add support for wwid

WWID has been added to Report Physical LUNs in newer controller
firmware. The presence of this field is detected by a feature bit. Add
detection of this new feature and store the WWID when set.

Link: https://lore.kernel.org/r/161549378041.25025.3869709982357729841.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>
Signed-off-by: Kevin Barnett <kevin.barnett@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:
Kevin Barnett 2021-03-11 14:16:20 -06:00 committed by Martin K. Petersen
parent ae0c189db4
commit 7a84a821f1
2 changed files with 27 additions and 2 deletions

View File

@ -853,7 +853,8 @@ struct pqi_config_table_firmware_features {
#define PQI_FIRMWARE_FEATURE_RAID_IU_TIMEOUT 13
#define PQI_FIRMWARE_FEATURE_TMF_IU_TIMEOUT 14
#define PQI_FIRMWARE_FEATURE_RAID_BYPASS_ON_ENCRYPTED_NVME 15
#define PQI_FIRMWARE_FEATURE_MAXIMUM 15
#define PQI_FIRMWARE_FEATURE_UNIQUE_WWID_IN_REPORT_PHYS_LUN 16
#define PQI_FIRMWARE_FEATURE_MAXIMUM 16
struct pqi_config_table_debug {
struct pqi_config_table_section_header header;
@ -1110,6 +1111,7 @@ struct pqi_scsi_dev {
struct pqi_stream_data stream_data[NUM_STREAMS_PER_LUN];
atomic_t scsi_cmds_outstanding;
atomic_t raid_bypass_cnt;
u8 page_83_identifier[16];
};
/* VPD inquiry pages */
@ -1303,6 +1305,7 @@ struct pqi_ctrl_info {
u8 soft_reset_handshake_supported : 1;
u8 raid_iu_timeout_supported : 1;
u8 tmf_iu_timeout_supported : 1;
u8 unique_wwid_in_report_phys_lun_supported : 1;
u8 enable_r1_writes : 1;
u8 enable_r5_writes : 1;
u8 enable_r6_writes : 1;

View File

@ -1441,6 +1441,9 @@ static int pqi_get_physical_device_info(struct pqi_ctrl_info *ctrl_info,
sizeof(device->phys_connector));
device->bay = id_phys->phys_bay_in_box;
memcpy(&device->page_83_identifier, &id_phys->page_83_identifier,
sizeof(device->page_83_identifier));
return 0;
}
@ -2045,6 +2048,16 @@ static inline bool pqi_expose_device(struct pqi_scsi_dev *device)
return !device->is_physical_device || !pqi_skip_device(device->scsi3addr);
}
static inline void pqi_set_physical_device_wwid(struct pqi_ctrl_info *ctrl_info,
struct pqi_scsi_dev *device, struct report_phys_lun_extended_entry *phys_lun_ext_entry)
{
if (ctrl_info->unique_wwid_in_report_phys_lun_supported ||
pqi_is_device_with_sas_address(device))
device->wwid = phys_lun_ext_entry->wwid;
else
device->wwid = cpu_to_be64(get_unaligned_be64(&device->page_83_identifier));
}
static int pqi_update_scsi_devices(struct pqi_ctrl_info *ctrl_info)
{
int i;
@ -2210,7 +2223,7 @@ static int pqi_update_scsi_devices(struct pqi_ctrl_info *ctrl_info)
pqi_assign_bus_target_lun(device);
if (device->is_physical_device) {
device->wwid = phys_lun_ext_entry->wwid;
pqi_set_physical_device_wwid(ctrl_info, device, phys_lun_ext_entry);
if ((phys_lun_ext_entry->device_flags &
CISS_REPORT_PHYS_DEV_FLAG_AIO_ENABLED) &&
phys_lun_ext_entry->aio_handle) {
@ -7407,6 +7420,10 @@ static void pqi_ctrl_update_feature_flags(struct pqi_ctrl_info *ctrl_info,
case PQI_FIRMWARE_FEATURE_TMF_IU_TIMEOUT:
ctrl_info->tmf_iu_timeout_supported = firmware_feature->enabled;
break;
case PQI_FIRMWARE_FEATURE_UNIQUE_WWID_IN_REPORT_PHYS_LUN:
ctrl_info->unique_wwid_in_report_phys_lun_supported =
firmware_feature->enabled;
break;
}
pqi_firmware_feature_status(ctrl_info, firmware_feature);
@ -7497,6 +7514,11 @@ static struct pqi_firmware_feature pqi_firmware_features[] = {
.feature_bit = PQI_FIRMWARE_FEATURE_RAID_BYPASS_ON_ENCRYPTED_NVME,
.feature_status = pqi_firmware_feature_status,
},
{
.feature_name = "Unique WWID in Report Physical LUN",
.feature_bit = PQI_FIRMWARE_FEATURE_UNIQUE_WWID_IN_REPORT_PHYS_LUN,
.feature_status = pqi_ctrl_update_feature_flags,
},
};
static void pqi_process_firmware_features(