From patchwork Fri Apr 26 09:36:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10918929 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 68F031575 for ; Fri, 26 Apr 2019 09:38:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 582E828CDA for ; Fri, 26 Apr 2019 09:38:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C32A28D56; Fri, 26 Apr 2019 09:38:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F294A28CDA for ; Fri, 26 Apr 2019 09:38:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726202AbfDZJiR (ORCPT ); Fri, 26 Apr 2019 05:38:17 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:46189 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725901AbfDZJiR (ORCPT ); Fri, 26 Apr 2019 05:38:17 -0400 Received: by mail-pf1-f193.google.com with SMTP id j11so1417158pff.13 for ; Fri, 26 Apr 2019 02:38:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1S4534JddqAgWEg4VWFs7BXIkYSpCa3aMZMkw9jTEEo=; b=EmiLy1/uSWRw2cT1y/JyJpE22UiziPQWFQvktfYxvix5LsabqJbiaQKvrxnT+eAdqD nLB+wNG3Bk3G8R6YVJ/tMQzeZDMWZ5yOXQcqZGwtOCZ8rov6V/JkvIZvs/T4iRls/LoS IrWWSMxpyx6bBVUyu4RmZus1GiSbe2+8dURug= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1S4534JddqAgWEg4VWFs7BXIkYSpCa3aMZMkw9jTEEo=; b=HAe1jhWs/8RarMQ0/ZPog3kTv8gUCnxvXBDURXCgraTRkX6WtLorXHz4w85S41TKAb 6QqY85xBLfo4aKky28cVLh2F3QVvUuDw7IjI3+iCbeiIRArghDvpe3+sNnsd4ecIeJOg HqK/DS0Y1YuDkRu46w5mpQTSy9PIh5pdAwwLEkt0/3hOpNGcaqR/1EHsa5PYAK1+j8P0 MAd5qE5AZRwA1VCaBzFm/+ABjpa3PI/siHC516j1Uk3sutrfROWa/2D04AFnza3czB1P U8STPfhC6UlZUad+vnWhRrkkBs6ehNogZ/epIRFESb00jC5XsTtNiww/DguBk6YJI5j6 NZlQ== X-Gm-Message-State: APjAAAWl92oKO5lFPVkGgSH0eg41rjtEqZnlbIQanJJ8CQB9DRDQIvb1 2q/VUmVnuwJKOrfp+7sgpGSo+X9jOtlIAx9al0/0nQpAXvlSl1zcI5MCVpmbJnsSGTLYHRtGjp3 Yze+bY/mS4BeuLqOUX+LqvN8pfrKxjkXcsffD8acyZxPZdlHtZPtOPlWpJjYjO6yOsIv8kkAw5x oQ15Ym2Fefk7SoKlFpslXO X-Google-Smtp-Source: APXvYqyGU7BMW5q7CwIB92UzwizfOGV3N5CksOdNaAfSiGahObjrbn3BOVl7vOujFRkJ/OnxqgJkyw== X-Received: by 2002:a65:6554:: with SMTP id a20mr43195549pgw.284.1556271495999; Fri, 26 Apr 2019 02:38:15 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r4sm37994649pgl.69.2019.04.26.02.38.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 02:38:15 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, chandrakanth.patil@broadcom.com, Shivasharan S , stable@vger.kernel.org Subject: [PATCH 02/21] megaraid_sas: Fix calculation of target ID Date: Fri, 26 Apr 2019 02:36:56 -0700 Message-Id: <1556271435-27252-3-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/scsi/megaraid/megaraid_sas_base.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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);