Commit 7c266d7a authored by Shivasharan S's avatar Shivasharan S Committed by Greg Kroah-Hartman

scsi: megaraid_sas: Fix calculation of target ID

commit c8f96df5 upstream.

In megasas_get_target_prop(), driver is incorrectly calculating the target
ID for devices with channel 1 and 3.  Due to this, firmware will either
fail the command (if there is no device with the target id sent from
driver) or could return the properties for a target which was not
intended.  Devices could end up with the wrong queue depth due to this.

Fix target id calculation for channel 1 and 3.

Fixes: 96188a89 ("scsi: megaraid_sas: NVME interface target prop added")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarShivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3f0548a6
...@@ -6168,7 +6168,8 @@ megasas_get_target_prop(struct megasas_instance *instance, ...@@ -6168,7 +6168,8 @@ megasas_get_target_prop(struct megasas_instance *instance,
int ret; int ret;
struct megasas_cmd *cmd; struct megasas_cmd *cmd;
struct megasas_dcmd_frame *dcmd; struct megasas_dcmd_frame *dcmd;
u16 targetId = (sdev->channel % 2) + sdev->id; u16 targetId = ((sdev->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) +
sdev->id;
cmd = megasas_get_cmd(instance); cmd = megasas_get_cmd(instance);
......
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