From patchwork Tue Oct 10 13:11:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sreekanth Reddy X-Patchwork-Id: 9996109 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 119B0603B5 for ; Tue, 10 Oct 2017 13:15:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00FA7285C9 for ; Tue, 10 Oct 2017 13:15:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E987E285CC; Tue, 10 Oct 2017 13:15:09 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 D96F5285C9 for ; Tue, 10 Oct 2017 13:15:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756517AbdJJNPH (ORCPT ); Tue, 10 Oct 2017 09:15:07 -0400 Received: from mail-qt0-f170.google.com ([209.85.216.170]:56620 "EHLO mail-qt0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756268AbdJJNMP (ORCPT ); Tue, 10 Oct 2017 09:12:15 -0400 Received: by mail-qt0-f170.google.com with SMTP id 34so33851405qtb.13 for ; Tue, 10 Oct 2017 06:12:14 -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=HOU1ZR1eMEvCX2miMdSracv0rCrobIbOw+mh4fH9PT0=; b=aNsuPL1IiMRRbv17lvrhPMywniHdN7eHJfikgu/D74/uTBRA+PnBxc26/6QhB+Vm/g eWj1RSdxaBGUzeN+JCRQWcSGyNo2zyKk5iGzVtH9dHRdvv5iiy6/v0ZRLn24x9j3Hxt4 mfbOyDI4TiUFVP3fL1iMO8qmGRKBO/EuFxvIc= 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=HOU1ZR1eMEvCX2miMdSracv0rCrobIbOw+mh4fH9PT0=; b=gitUzNbD67HJq/1g61cm5vQv4jyNIYpWv+vO9S3IDGBtNYXl3OfwKcA97TCDAwD4qb Xyl0DCfbfqen89jyMjz0D/0DfsNwaVJh6gw71K3cDvV/yNecwW1LzB99kEtEm/oiEZnR ONAZzG0BmgYN2ozaXHcU9WOgOd516UU1dKwm4JSUy6RG7MVqtRJILTTBPClTIgr5RV39 3IObTFdhG92gfvxeuvwKOcturyKQaB2aaJMBdIsf8kICdnSoiyTJE5YrOZNl5nM/NSWm iexUWH7TxVH+twrFWIktnkPfK/ez+gdXQzFBE6zt6YLaND1gKIQZYvXi0DCf8dpJGclC qyug== X-Gm-Message-State: AMCzsaVtB7VTO4ex78BFXVuhZfmPOStaY05MoOjyiAuxuStPmMz7A1uo fXjRi6ThVKhGvIz+zH7nVtENvJjn X-Google-Smtp-Source: AOwi7QA1eRbgmsnECN0vjJP3L445pm6fpIKd1iFo4LsrHWQNrN78wcraSJF28fl99naL7DUjXm9mPA== X-Received: by 10.200.37.76 with SMTP id 12mr19610209qtn.235.1507641134113; Tue, 10 Oct 2017 06:12:14 -0700 (PDT) Received: from host1.dhcp.avagotech.net ([192.19.239.250]) by smtp.gmail.com with ESMTPSA id h135sm634004qke.5.2017.10.10.06.12.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Oct 2017 06:12:13 -0700 (PDT) From: Sreekanth Reddy X-Google-Original-From: Sreekanth Reddy To: linux-scsi@vger.kernel.org, hch@infradead.org Cc: martin.petersen@oracle.com, JBottomley@Parallels.com, Sathya.Prakash@broadcom.com, linux-kernel@vger.kernel.org, Sreekanth Reddy Subject: [PATCH 04/10] mpt3sas: Fix removal and addition of vSES device during host reset Date: Tue, 10 Oct 2017 18:41:17 +0530 Message-Id: <1507641083-20207-5-git-send-email-Sreekanth.Reddy@broadcom.com> X-Mailer: git-send-email 2.0.2 In-Reply-To: <1507641083-20207-1-git-send-email-Sreekanth.Reddy@broadcom.com> References: <1507641083-20207-1-git-send-email-Sreekanth.Reddy@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 For Dev Handles who value is less than hba's phys count number driver will return HBA sas address value as a sas address. So for Virtual SES device also driver was returning HBA sas address instead of Virtual SES sas address. So now updated the driver to return Virtual SES's sas address for Virtual SES device instead of HBA's sas address. Signed-off-by: Sreekanth Reddy Signed-off-by: Tomas Henzl --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index 600e8ef..cc78ce4 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -406,11 +406,6 @@ _scsih_get_sas_address(struct MPT3SAS_ADAPTER *ioc, u16 handle, *sas_address = 0; - if (handle <= ioc->sas_hba.num_phys) { - *sas_address = ioc->sas_hba.sas_address; - return 0; - } - if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) { pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc->name, @@ -420,7 +415,15 @@ _scsih_get_sas_address(struct MPT3SAS_ADAPTER *ioc, u16 handle, ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & MPI2_IOCSTATUS_MASK; if (ioc_status == MPI2_IOCSTATUS_SUCCESS) { - *sas_address = le64_to_cpu(sas_device_pg0.SASAddress); + /* For HBA vSES don't return hba sas address instead return + * vSES's sas address. + */ + if ((handle <= ioc->sas_hba.num_phys) && + (!(le32_to_cpu(sas_device_pg0.DeviceInfo) & + MPI2_SAS_DEVICE_INFO_SEP))) + *sas_address = ioc->sas_hba.sas_address; + else + *sas_address = le64_to_cpu(sas_device_pg0.SASAddress); return 0; }