Commit a09454ce authored by Shivasharan S's avatar Shivasharan S Committed by Martin K. Petersen

scsi: megaraid_sas: In validate raid map, raid capability is not converted to...

scsi: megaraid_sas: In validate raid map, raid capability is not converted to cpu format for all lds

On a host, if an ld is deleted there is a hole in the ld array returned
by the FW. But in MR_ValidateMapInfo we are not accounting for holes in
the ld array and traverse only upto index num_lds.  This patch takes
care of converting the capability field of all the valid lds in the ld
raid map.
Signed-off-by: default avatarShivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: default avatarKashyap Desai <kashyap.desai@broadcom.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Reviewed-by: default avatarTomas Henzl <thenzl@redhat.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 5fc499b6
...@@ -452,7 +452,7 @@ u8 MR_ValidateMapInfo(struct megasas_instance *instance) ...@@ -452,7 +452,7 @@ u8 MR_ValidateMapInfo(struct megasas_instance *instance)
struct LD_LOAD_BALANCE_INFO *lbInfo; struct LD_LOAD_BALANCE_INFO *lbInfo;
PLD_SPAN_INFO ldSpanInfo; PLD_SPAN_INFO ldSpanInfo;
struct MR_LD_RAID *raid; struct MR_LD_RAID *raid;
u16 ldCount, num_lds; u16 num_lds, i;
u16 ld; u16 ld;
u32 expected_size; u32 expected_size;
...@@ -495,10 +495,17 @@ u8 MR_ValidateMapInfo(struct megasas_instance *instance) ...@@ -495,10 +495,17 @@ u8 MR_ValidateMapInfo(struct megasas_instance *instance)
num_lds = le16_to_cpu(drv_map->raidMap.ldCount); num_lds = le16_to_cpu(drv_map->raidMap.ldCount);
/*Convert Raid capability values to CPU arch */ /*Convert Raid capability values to CPU arch */
for (ldCount = 0; ldCount < num_lds; ldCount++) { for (i = 0; (num_lds > 0) && (i < MAX_LOGICAL_DRIVES_EXT); i++) {
ld = MR_TargetIdToLdGet(ldCount, drv_map); ld = MR_TargetIdToLdGet(i, drv_map);
/* For non existing VDs, iterate to next VD*/
if (ld >= (MAX_LOGICAL_DRIVES_EXT - 1))
continue;
raid = MR_LdRaidGet(ld, drv_map); raid = MR_LdRaidGet(ld, drv_map);
le32_to_cpus((u32 *)&raid->capability); le32_to_cpus((u32 *)&raid->capability);
num_lds--;
} }
return 1; return 1;
......
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