diff mbox series

[02/21] megaraid_sas: Fix calculation of target ID

Message ID 1556271435-27252-3-git-send-email-shivasharan.srikanteshwara@broadcom.com (mailing list archive)
State Changes Requested
Headers show
Series megaraid_sas: Driver updates | expand

Commit Message

Shivasharan Srikanteshwara April 26, 2019, 9:36 a.m. UTC
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.

Cc: stable@vger.kernel.org
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Shivasharan Srikanteshwara April 29, 2019, 2:37 p.m. UTC | #1
On Fri, Apr 26, 2019 at 6:36 PM Sasha Levin <sashal@kernel.org> wrote:
>
> Hi,
>
> [This is an automated email]
>
> This commit has been processed because it contains a -stable tag.
> The stable tag indicates that it's relevant for the following trees: all
>
> The bot has tested the following trees: v5.0.9, v4.19.36, v4.14.113, v4.9.170, v4.4.178, v3.18.138.
>
> v5.0.9: Build OK!
> v4.19.36: Build OK!
> v4.14.113: Build OK!
> v4.9.170: Failed to apply! Possible dependencies:
>     15dd03811d99 ("scsi: megaraid_sas: NVME Interface detection and prop settings")
>     18103efcacee ("scsi: megaraid-sas: request irqs later")
>     2493c67e518c ("scsi: megaraid_sas: 128 MSIX Support")
>     45f4f2eb3da3 ("scsi: megaraid_sas: Add new pci device Ids for SAS3.5 Generic Megaraid Controllers")
>     69c337c0f8d7 ("scsi: megaraid_sas: SAS3.5 Generic Megaraid Controllers Fast Path for RAID 1/10 Writes")
>     96188a89cc6d ("scsi: megaraid_sas: NVME interface target prop added")
>     d0fc91d67c59 ("scsi: megaraid_sas: Send SYNCHRONIZE_CACHE for VD to firmware")
>     d889344e4e59 ("scsi: megaraid_sas: Dynamic Raid Map Changes for SAS3.5 Generic Megaraid Controllers")
>     fad119b707f8 ("scsi: megaraid_sas: switch to pci_alloc_irq_vectors")
>     fdd84e2514b0 ("scsi: megaraid_sas: SAS3.5 Generic Megaraid Controllers Stream Detection and IO Coalescing")
>
> v4.4.178: Failed to apply! Possible dependencies:
>     15dd03811d99 ("scsi: megaraid_sas: NVME Interface detection and prop settings")
>     179ac14291a0 ("megaraid_sas: Reply Descriptor Post Queue (RDPQ) support")
>     18365b138508 ("megaraid_sas: Task management support")
>     2216c30523b0 ("megaraid_sas: Update device queue depth based on interface type")
>     2c048351c8e3 ("megaraid_sas: Syncing request flags macro names with firmware")
>     6d40afbc7d13 ("megaraid_sas: MFI IO timeout handling")
>     96188a89cc6d ("scsi: megaraid_sas: NVME interface target prop added")
>     d889344e4e59 ("scsi: megaraid_sas: Dynamic Raid Map Changes for SAS3.5 Generic Megaraid Controllers")
>
> v3.18.138: Failed to apply! Possible dependencies:
>     0b48d12d0365 ("megaraid_sas: Make PI enabled VD 8 byte DMA aligned")
>     0d5b47a724ba ("megaraid_sas: Expose TAPE drives unconditionally")
>     16b8528d2060 ("megaraid_sas: use raw_smp_processor_id()")
>     18365b138508 ("megaraid_sas: Task management support")
>     2216c30523b0 ("megaraid_sas: Update device queue depth based on interface type")
>     2be2a98845e6 ("megaraid_sas : Modify return value of megasas_issue_blocked_cmd() and wait_and_poll() to consider command status returned by firmware")
>     4026e9aac3ff ("megaraid_sas : Use Block layer tag support for internal command indexing")
>     4a5c814d9339 ("megaraid_sas : Add separate functions for building sysPD IOs and non RW LDIOs")
>     5765c5b8b38a ("megaraid_sas : Support for Avago's Single server High Availability product")
>     7497cde883b1 ("megaraid_sas: add support for secure JBOD")
>     8a232bb39917 ("megaraid_sas : add missing __iomem annotations")
>     96188a89cc6d ("scsi: megaraid_sas: NVME interface target prop added")
>     aed335eecf8f ("megaraid_sas: Make tape drives visible on PERC5 controllers")
>     d009b5760f57 ("megaraid_sas: online Firmware upgrade support for Extended VD feature")
>     da0dc9fb4e6b ("megaraid_sas: fix whitespace errors")
>
>
> How should we proceed with this patch?
>
Hi Sasha,
This patch is applicable for 4.11.x and later stable trees only.
I will send out a v2 of this patch with appropriate kernel version requirement
along with the -stable tag.

Thanks,
Shivasharan
> --
> Thanks,
> Sasha
diff mbox series

Patch

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index f677a84f6bc8..d2714fc833ae 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -6165,7 +6165,8 @@  megasas_get_target_prop(struct megasas_instance *instance,
 	int ret;
 	struct megasas_cmd *cmd;
 	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);