Commit 59db5a93 authored by Chandrakanth Patil's avatar Chandrakanth Patil Committed by Martin K. Petersen

scsi: megaraid_sas: Handle sequence JBOD map failure at driver level

Issue: This issue is applicable to scenario when JBOD sequence map is
unavailable (memory allocation for JBOD sequence map failed) to driver but
feature is supported by firmware.  If the driver sends a JBOD IO by not
adding 255 (MAX_PHYSICAL_DEVICES - 1) to device ID when underlying firmware
supports JBOD sequence map, it will lead to the IO failure.

Fix: For JBOD IOs, driver will not use the RAID map to fetch the devhandle
if JBOD sequence map is unavailable. Driver will set Devhandle to 0xffff
and Target ID to 'device ID + 255 (MAX_PHYSICAL_DEVICES - 1)'.
Signed-off-by: default avatarSumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: default avatarChandrakanth Patil <chandrakanth.patil@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 798d44b0
...@@ -2398,7 +2398,9 @@ struct megasas_instance { ...@@ -2398,7 +2398,9 @@ struct megasas_instance {
#endif #endif
u8 enable_fw_dev_list; u8 enable_fw_dev_list;
bool atomic_desc_support; bool atomic_desc_support;
bool support_seqnum_jbod_fp;
}; };
struct MR_LD_VF_MAP { struct MR_LD_VF_MAP {
u32 size; u32 size;
union MR_LD_REF ref; union MR_LD_REF ref;
......
...@@ -5103,7 +5103,7 @@ megasas_get_ctrl_info(struct megasas_instance *instance) ...@@ -5103,7 +5103,7 @@ megasas_get_ctrl_info(struct megasas_instance *instance)
* in case of Firmware upgrade without system reboot. * in case of Firmware upgrade without system reboot.
*/ */
megasas_update_ext_vd_details(instance); megasas_update_ext_vd_details(instance);
instance->use_seqnum_jbod_fp = instance->support_seqnum_jbod_fp =
ci->adapterOperations3.useSeqNumJbodFP; ci->adapterOperations3.useSeqNumJbodFP;
instance->support_morethan256jbod = instance->support_morethan256jbod =
ci->adapter_operations4.support_pd_map_target_id; ci->adapter_operations4.support_pd_map_target_id;
...@@ -5140,6 +5140,8 @@ megasas_get_ctrl_info(struct megasas_instance *instance) ...@@ -5140,6 +5140,8 @@ megasas_get_ctrl_info(struct megasas_instance *instance)
dev_info(&instance->pdev->dev, dev_info(&instance->pdev->dev,
"FW provided TM TaskAbort/Reset timeout\t: %d secs/%d secs\n", "FW provided TM TaskAbort/Reset timeout\t: %d secs/%d secs\n",
instance->task_abort_tmo, instance->max_reset_tmo); instance->task_abort_tmo, instance->max_reset_tmo);
dev_info(&instance->pdev->dev, "JBOD sequence map support\t: %s\n",
instance->support_seqnum_jbod_fp ? "Yes" : "No");
break; break;
...@@ -5554,10 +5556,12 @@ megasas_setup_jbod_map(struct megasas_instance *instance) ...@@ -5554,10 +5556,12 @@ megasas_setup_jbod_map(struct megasas_instance *instance)
pd_seq_map_sz = sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC) + pd_seq_map_sz = sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC) +
(sizeof(struct MR_PD_CFG_SEQ) * (MAX_PHYSICAL_DEVICES - 1)); (sizeof(struct MR_PD_CFG_SEQ) * (MAX_PHYSICAL_DEVICES - 1));
instance->use_seqnum_jbod_fp =
instance->support_seqnum_jbod_fp;
if (reset_devices || !fusion || if (reset_devices || !fusion ||
!instance->ctrl_info_buf->adapterOperations3.useSeqNumJbodFP) { !instance->support_seqnum_jbod_fp) {
dev_info(&instance->pdev->dev, dev_info(&instance->pdev->dev,
"Jbod map is not supported %s %d\n", "JBOD sequence map is disabled %s %d\n",
__func__, __LINE__); __func__, __LINE__);
instance->use_seqnum_jbod_fp = false; instance->use_seqnum_jbod_fp = false;
return; return;
...@@ -6042,8 +6046,8 @@ static int megasas_init_fw(struct megasas_instance *instance) ...@@ -6042,8 +6046,8 @@ static int megasas_init_fw(struct megasas_instance *instance)
instance->UnevenSpanSupport ? "yes" : "no"); instance->UnevenSpanSupport ? "yes" : "no");
dev_info(&instance->pdev->dev, "firmware crash dump : %s\n", dev_info(&instance->pdev->dev, "firmware crash dump : %s\n",
instance->crash_dump_drv_support ? "yes" : "no"); instance->crash_dump_drv_support ? "yes" : "no");
dev_info(&instance->pdev->dev, "jbod sync map : %s\n", dev_info(&instance->pdev->dev, "JBOD sequence map : %s\n",
instance->use_seqnum_jbod_fp ? "yes" : "no"); instance->use_seqnum_jbod_fp ? "enabled" : "disabled");
instance->max_sectors_per_req = instance->max_num_sge * instance->max_sectors_per_req = instance->max_num_sge *
SGE_BUFFER_SIZE / 512; SGE_BUFFER_SIZE / 512;
......
...@@ -3083,20 +3083,22 @@ megasas_build_syspd_fusion(struct megasas_instance *instance, ...@@ -3083,20 +3083,22 @@ megasas_build_syspd_fusion(struct megasas_instance *instance,
<< MR_RAID_CTX_RAID_FLAGS_IO_SUB_TYPE_SHIFT; << MR_RAID_CTX_RAID_FLAGS_IO_SUB_TYPE_SHIFT;
/* If FW supports PD sequence number */ /* If FW supports PD sequence number */
if (instance->support_seqnum_jbod_fp) {
if (instance->use_seqnum_jbod_fp && if (instance->use_seqnum_jbod_fp &&
instance->pd_list[pd_index].driveType == TYPE_DISK) { instance->pd_list[pd_index].driveType == TYPE_DISK) {
/* TgtId must be incremented by 255 as jbod seq number is index
* below raid map
*/
/* More than 256 PD/JBOD support for Ventura */ /* More than 256 PD/JBOD support for Ventura */
if (instance->support_morethan256jbod) if (instance->support_morethan256jbod)
pRAID_Context->virtual_disk_tgt_id = pRAID_Context->virtual_disk_tgt_id =
pd_sync->seq[pd_index].pd_target_id; pd_sync->seq[pd_index].pd_target_id;
else else
pRAID_Context->virtual_disk_tgt_id = pRAID_Context->virtual_disk_tgt_id =
cpu_to_le16(device_id + (MAX_PHYSICAL_DEVICES - 1)); cpu_to_le16(device_id +
pRAID_Context->config_seq_num = pd_sync->seq[pd_index].seqNum; (MAX_PHYSICAL_DEVICES - 1));
io_request->DevHandle = pd_sync->seq[pd_index].devHandle; pRAID_Context->config_seq_num =
pd_sync->seq[pd_index].seqNum;
io_request->DevHandle =
pd_sync->seq[pd_index].devHandle;
if (instance->adapter_type >= VENTURA_SERIES) { if (instance->adapter_type >= VENTURA_SERIES) {
io_request->RaidContext.raid_context_g35.routing_flags |= io_request->RaidContext.raid_context_g35.routing_flags |=
(1 << MR_RAID_CTX_ROUTINGFLAGS_SQN_SHIFT); (1 << MR_RAID_CTX_ROUTINGFLAGS_SQN_SHIFT);
...@@ -3108,20 +3110,29 @@ megasas_build_syspd_fusion(struct megasas_instance *instance, ...@@ -3108,20 +3110,29 @@ megasas_build_syspd_fusion(struct megasas_instance *instance,
pRAID_Context->type = MPI2_TYPE_CUDA; pRAID_Context->type = MPI2_TYPE_CUDA;
pRAID_Context->nseg = 0x1; pRAID_Context->nseg = 0x1;
pRAID_Context->reg_lock_flags |= pRAID_Context->reg_lock_flags |=
(MR_RL_FLAGS_SEQ_NUM_ENABLE|MR_RL_FLAGS_GRANT_DESTINATION_CUDA); (MR_RL_FLAGS_SEQ_NUM_ENABLE |
MR_RL_FLAGS_GRANT_DESTINATION_CUDA);
}
} else {
pRAID_Context->virtual_disk_tgt_id =
cpu_to_le16(device_id +
(MAX_PHYSICAL_DEVICES - 1));
pRAID_Context->config_seq_num = 0;
io_request->DevHandle = cpu_to_le16(0xFFFF);
} }
} else if (fusion->fast_path_io) { } else {
pRAID_Context->virtual_disk_tgt_id = cpu_to_le16(device_id); pRAID_Context->virtual_disk_tgt_id = cpu_to_le16(device_id);
pRAID_Context->config_seq_num = 0; pRAID_Context->config_seq_num = 0;
local_map_ptr = fusion->ld_drv_map[(instance->map_id & 1)];
if (fusion->fast_path_io) {
local_map_ptr =
fusion->ld_drv_map[(instance->map_id & 1)];
io_request->DevHandle = io_request->DevHandle =
local_map_ptr->raidMap.devHndlInfo[device_id].curDevHdl; local_map_ptr->raidMap.devHndlInfo[device_id].curDevHdl;
} else { } else {
/* Want to send all IO via FW path */
pRAID_Context->virtual_disk_tgt_id = cpu_to_le16(device_id);
pRAID_Context->config_seq_num = 0;
io_request->DevHandle = cpu_to_le16(0xFFFF); io_request->DevHandle = cpu_to_le16(0xFFFF);
} }
}
cmd->request_desc->SCSIIO.DevHandle = io_request->DevHandle; cmd->request_desc->SCSIIO.DevHandle = io_request->DevHandle;
......
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