From patchwork Wed Jul 12 11:59:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjan Kumar X-Patchwork-Id: 702162 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8475CEB64DA for ; Wed, 12 Jul 2023 12:01:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233342AbjGLMBM (ORCPT ); Wed, 12 Jul 2023 08:01:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232022AbjGLMBE (ORCPT ); Wed, 12 Jul 2023 08:01:04 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B1F51992 for ; Wed, 12 Jul 2023 05:00:55 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-666e5f0d60bso4050301b3a.3 for ; Wed, 12 Jul 2023 05:00:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1689163255; x=1691755255; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=xP9ESRUMWyDjTm6E5nETSqLajJJmMse6kUN7/ofQSpA=; b=eT+5bbndxWpSHm5/ZsBVMUpa7TgjLfVq1JaOhSQB+NM2paQzAzXJI1NFwn7jaciYG4 K649JAQHP5vUrpLs2brdpluQPOPJvNG3T2NqBsAnFYi+mnaJbrD4rn5N6fsUWdk4M5yK hmGM1IgFQ8aA0r2HsOAp1TYLFEMRouESGRRD4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689163255; x=1691755255; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xP9ESRUMWyDjTm6E5nETSqLajJJmMse6kUN7/ofQSpA=; b=W/KNjgLVQESjWIqs+//GPfTWIcfvKyKE5QD6MEc/WTfQG8aOObZvp1SbMNVTmeKH+S inOibMFguoErhOpJwRZveueLNZXNg7cHPsDBGpRzbHiXdBolhiRoK8somomjhJU1B/Ls spfjh/G9UGaAHt3tvqtE80D0SZEKIUZ4eCHmlzT6CYAh83cl1d7imOCrTJpphPIv/Q2n dyX/Qfuh+D8Sd7STKoE8pKOI5URULM5h+fvWaT+DA/34bkfORZCujIbkTEk7D9H/YFoO EIuKiB5EZ83NOz1KincaWxcPAj7v842L8irqmYCifTtIx1BRcno67dKs1UQf+uyUSGi3 C9kQ== X-Gm-Message-State: ABy/qLYQzaeYm1dcebpkLzPdLHSXhWQrz8+Jk3TrKg9NtOUEikPZgn8U Wo4QoKdOjTchNcN319/hldQS1cmOWmm2i3MkOJwbUH/7KMDioFN+qam3f+A88Gs+er5F3Emewq8 I8XXtB2+bYE0uE9sfNM6uS4IJW0FJpajmUl64W3u5PmDgnOKfLrmep2grPqcd9eqUAWQY5p51sj kOYd7EIpLfqw== X-Google-Smtp-Source: APBJJlERLOC80eNgVjybSlLA0DsrintFLilVjuufh8FQPhSjGC/a8BDXJ+i+GwJTnugQENaw+E/ZEg== X-Received: by 2002:a05:6a21:3d82:b0:132:c8da:851d with SMTP id bj2-20020a056a213d8200b00132c8da851dmr1076715pzc.18.1689163254528; Wed, 12 Jul 2023 05:00:54 -0700 (PDT) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id x7-20020a1709029a4700b001b531e8a000sm3799627plv.157.2023.07.12.05.00.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jul 2023 05:00:54 -0700 (PDT) From: Ranjan Kumar To: linux-scsi@vger.kernel.org, martin.petersen@oracle.com Cc: rajsekhar.chundru@broadcom.com, sathya.prakash@broadcom.com, sumit.saxena@broadcom.com, sreekanth.reddy@broadcom.com, chandrakanth.patil@broadcom.com, Ranjan Kumar Subject: [PATCH 1/6] mpi3mr: Invokes soft reset upon TSU or event ack time out Date: Wed, 12 Jul 2023 17:29:50 +0530 Message-Id: <20230712115955.6312-2-ranjan.kumar@broadcom.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230712115955.6312-1-ranjan.kumar@broadcom.com> References: <20230712115955.6312-1-ranjan.kumar@broadcom.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org When a timestamp update or an event acknowledgment command times out, the driver invokes soft reset handler to recover the controller while holding a mutex lock.The soft reset handler also tries to acquire the same mutex to send initialization commands to the controller which leads to a deadlock scenario . To resolve the issue the driver will check the controller status and if it is operational,the driver will issue a diagnostic fault reset and exit out of the command processing function.If the controller is already faulted or asynchronously reset, then the driver will just exit the command processing function. Signed-off-by: Ranjan Kumar --- drivers/scsi/mpi3mr/mpi3mr_fw.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c index 5fa07d6ee5b8..11b78d4a87a0 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_fw.c +++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c @@ -2343,8 +2343,8 @@ static int mpi3mr_sync_timestamp(struct mpi3mr_ioc *mrioc) ioc_err(mrioc, "Issue IOUCTL time_stamp: command timed out\n"); mrioc->init_cmds.is_waiting = 0; if (!(mrioc->init_cmds.state & MPI3MR_CMD_RESET)) - mpi3mr_soft_reset_handler(mrioc, - MPI3MR_RESET_FROM_TSU_TIMEOUT, 1); + mpi3mr_check_rh_fault_ioc(mrioc, + MPI3MR_RESET_FROM_TSU_TIMEOUT); retval = -1; goto out_unlock; } @@ -3359,8 +3359,8 @@ int mpi3mr_process_event_ack(struct mpi3mr_ioc *mrioc, u8 event, if (!(mrioc->init_cmds.state & MPI3MR_CMD_COMPLETE)) { ioc_err(mrioc, "Issue EvtNotify: command timed out\n"); if (!(mrioc->init_cmds.state & MPI3MR_CMD_RESET)) - mpi3mr_soft_reset_handler(mrioc, - MPI3MR_RESET_FROM_EVTACK_TIMEOUT, 1); + mpi3mr_check_rh_fault_ioc(mrioc, + MPI3MR_RESET_FROM_EVTACK_TIMEOUT); retval = -1; goto out_unlock; } From patchwork Wed Jul 12 11:59:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjan Kumar X-Patchwork-Id: 702653 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E061EB64D9 for ; Wed, 12 Jul 2023 12:01:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232429AbjGLMBS (ORCPT ); Wed, 12 Jul 2023 08:01:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233113AbjGLMBF (ORCPT ); Wed, 12 Jul 2023 08:01:05 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E130C1BE9 for ; Wed, 12 Jul 2023 05:00:58 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1b89bc52cd1so31317645ad.1 for ; Wed, 12 Jul 2023 05:00:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1689163258; x=1691755258; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=f2qntN2wxmzyFE0sczXen6bqzr3HScVnkz3S52A0Lo0=; b=OmufkHD1GTbfLRZYWkXqw1mp1t1YPjjDNNX4TBzeWbFI+vPCFkAyc93QVLj7RKQYau 3x7Z/ry4IiTav2iQkITBO86o6c+v7A9/2WCeNaF2kkkh0ODFSvgLC4ZCQfQAxgYIArl6 GibKx9Nfawf6iSrdDJHgBu2gpFpXteriIsq1M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689163258; x=1691755258; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=f2qntN2wxmzyFE0sczXen6bqzr3HScVnkz3S52A0Lo0=; b=gsQzYCHRX12jK0t5CMmnJi3kSrYvufaGlB//0hiLEAscFZauZXdHHK2+rswCH4IAuB Dd2wEN4wu4AOe2t2B5XQG3ot7L9uQpmwq7iVapcy5v1EefYz70pvR8F+OEoPmuTd1Pqt bTkLrXBmasY3UscKj/d5fBnBCOo+peAmM1K68ZSPKFpyNtO2mPUep+AsVL3AJSlEtMKf IILxffVHghQiALP+i0Ww5BxqZpZ8gJC/H3bK6wc/obKLRKy5uC1efCUtZDccbzyMbOGO D88MRE19Wbe9ghPy5sWvijvVOjY3KPZpB4FxCB+jbD/UQIL4c66d2Ubf5UXc80jnQAfT +bOw== X-Gm-Message-State: ABy/qLbt8c20VdGKgzDeTsPbvwNl/ziFpbhngL6dQWOpgDIUZprSdwtE YIOjDd69X5KzUZCjpjGbAekYpLV/WevSpLbpCBmjZs5Xy8eCB6G7xRvXWNr+Gpj6pfugvixSUka p6A3CvwebXxwUbCk2F8t3rUEepriVmdt8DXhpIdUfkRMTENSEpLOA07CbvmgUSs89ENrogRj8eJ 40E5+b0w+69g== X-Google-Smtp-Source: APBJJlFcctBRtSZSMHuu274/Ii2/aGL7cvwkRUEncoXS0xExJXgWNwliwDEuA3gF97JOE5Oo/nW6Zw== X-Received: by 2002:a17:902:e743:b0:1b8:b4d5:4c3d with SMTP id p3-20020a170902e74300b001b8b4d54c3dmr14515369plf.51.1689163257906; Wed, 12 Jul 2023 05:00:57 -0700 (PDT) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id x7-20020a1709029a4700b001b531e8a000sm3799627plv.157.2023.07.12.05.00.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jul 2023 05:00:57 -0700 (PDT) From: Ranjan Kumar To: linux-scsi@vger.kernel.org, martin.petersen@oracle.com Cc: rajsekhar.chundru@broadcom.com, sathya.prakash@broadcom.com, sumit.saxena@broadcom.com, sreekanth.reddy@broadcom.com, chandrakanth.patil@broadcom.com, Ranjan Kumar Subject: [PATCH 2/6] mpi3mr: Update MPI Headers to version 3.00.28 Date: Wed, 12 Jul 2023 17:29:51 +0530 Message-Id: <20230712115955.6312-3-ranjan.kumar@broadcom.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230712115955.6312-1-ranjan.kumar@broadcom.com> References: <20230712115955.6312-1-ranjan.kumar@broadcom.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Updated MPI Headers to version 3.00.28 Signed-off-by: Ranjan Kumar --- drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h | 2 +- drivers/scsi/mpi3mr/mpi/mpi30_ioc.h | 1 + drivers/scsi/mpi3mr/mpi/mpi30_transport.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h b/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h index 2fc196499c89..35f81af40f51 100644 --- a/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h +++ b/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h @@ -1482,7 +1482,7 @@ struct mpi3_security_page0 { #define MPI3_SECURITY1_KEY_RECORD_MAX 1 #endif #ifndef MPI3_SECURITY1_PAD_MAX -#define MPI3_SECURITY1_PAD_MAX 1 +#define MPI3_SECURITY1_PAD_MAX 4 #endif union mpi3_security1_key_data { __le32 dword[128]; diff --git a/drivers/scsi/mpi3mr/mpi/mpi30_ioc.h b/drivers/scsi/mpi3mr/mpi/mpi30_ioc.h index f5e9c2309ce6..1e4a60fc655f 100644 --- a/drivers/scsi/mpi3mr/mpi/mpi30_ioc.h +++ b/drivers/scsi/mpi3mr/mpi/mpi30_ioc.h @@ -600,6 +600,7 @@ struct mpi3_event_data_pcie_error_threshold { __le16 threshold_count; __le16 attached_dev_handle; __le16 reserved12; + __le32 reserved14; }; #define MPI3_EVENT_PCI_ERROR_RC_THRESHOLD_EXCEEDED (0x00) diff --git a/drivers/scsi/mpi3mr/mpi/mpi30_transport.h b/drivers/scsi/mpi3mr/mpi/mpi30_transport.h index 441cfc2c7f09..1e0a3dcaf723 100644 --- a/drivers/scsi/mpi3mr/mpi/mpi30_transport.h +++ b/drivers/scsi/mpi3mr/mpi/mpi30_transport.h @@ -18,7 +18,7 @@ union mpi3_version_union { #define MPI3_VERSION_MAJOR (3) #define MPI3_VERSION_MINOR (0) -#define MPI3_VERSION_UNIT (27) +#define MPI3_VERSION_UNIT (28) #define MPI3_VERSION_DEV (0) #define MPI3_DEVHANDLE_INVALID (0xffff) struct mpi3_sysif_oper_queue_indexes { From patchwork Wed Jul 12 11:59:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjan Kumar X-Patchwork-Id: 702161 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EAE2EB64D9 for ; Wed, 12 Jul 2023 12:01:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231932AbjGLMB2 (ORCPT ); Wed, 12 Jul 2023 08:01:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233317AbjGLMBI (ORCPT ); Wed, 12 Jul 2023 08:01:08 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBE481FEC for ; Wed, 12 Jul 2023 05:01:02 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6686a05bc66so4082244b3a.1 for ; Wed, 12 Jul 2023 05:01:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1689163261; x=1691755261; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=vvpM38+QvYjMBuq/IukFPvZoGADStcCeYzevXxdeN80=; b=eB6Vw679pF9DnECwc5qur+L6/Rs080e0IRKPFYHP0qPSgCmQEqLA6rdGH28FVD9FI6 sgrlDyHuqCssoasqrDd5GQglhu3NvYghHDxYDFQD3NYyS19fVRJclcQdEKSAvWSYfOEy yBGdBGYP0CVB9fChVfrtSMylN6rCAQHRBbTls= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689163261; x=1691755261; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vvpM38+QvYjMBuq/IukFPvZoGADStcCeYzevXxdeN80=; b=jkD4eoZUHBmATna8jpKlTTo/I3J9L5f4f8DQijCpwx/5RQXOeaq/2A9OTbV2E0vWok 9PP3bwgSwqbYxVUICkuunnCMF+kH08vD+Opb61DV5fwOIqrODvZTxOUGxmW8TxN0j9ju Y9Jw2BpoRtZ+JO4aVSEwqFKa9rD3LCcgGo/xGEq1Kbf429Q5/nW1UyCFR5AykVDM9XuS 3076FCgyWBmQZvqn0lRg5vt8bglcyDBonfIBZv7gRRxjW1p39B6ccU6Ld5QA0Mt6xSJt UVjHwHAlvIMNanXlzIlk6N9r95V9PZ65rF7WFYbIcaozXhek+7aBAJMf+oqX0yRtvbU/ k/hQ== X-Gm-Message-State: ABy/qLYul5Lo5XNGVsqis6OGoVJlcAaV5sWs8/lIQxzpnQTEU4gOes3F cAm/lIaVCwSvFd7/mK98SgH76aiKcVjtpNAra6xAPWnwG9S/odY5HzwXpImV8l3l0wVXvkCdJk3 vym42nt6r+vlJIOi/nzJixJ/U5yrbL2pTzayNmbcS8LxMVRVBhsTjtmyGCJQoGfx7KIYB1yQFLE 5ixQpOC/KZaQ== X-Google-Smtp-Source: APBJJlHEdEk/kqFzXDzbDewR5+8GLo9f1wEH6BMZ0EUGX7bR5NfdrvUbRrPOFaxBdFPoQDuWqJaEbQ== X-Received: by 2002:a05:6a21:6d87:b0:121:bda6:2f85 with SMTP id wl7-20020a056a216d8700b00121bda62f85mr18746684pzb.30.1689163261182; Wed, 12 Jul 2023 05:01:01 -0700 (PDT) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id x7-20020a1709029a4700b001b531e8a000sm3799627plv.157.2023.07.12.05.00.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jul 2023 05:01:00 -0700 (PDT) From: Ranjan Kumar To: linux-scsi@vger.kernel.org, martin.petersen@oracle.com Cc: rajsekhar.chundru@broadcom.com, sathya.prakash@broadcom.com, sumit.saxena@broadcom.com, sreekanth.reddy@broadcom.com, chandrakanth.patil@broadcom.com, Ranjan Kumar Subject: [PATCH 3/6] mpi3mr: Add support for more than 1MB I/O Date: Wed, 12 Jul 2023 17:29:52 +0530 Message-Id: <20230712115955.6312-4-ranjan.kumar@broadcom.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230712115955.6312-1-ranjan.kumar@broadcom.com> References: <20230712115955.6312-1-ranjan.kumar@broadcom.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The driver is enhanced to get the maximum data length per I/O request from IOC Facts data and report that to the upper layers. If the IOC facts data is not reported then the default I/O size of 1MB is reported to the OS. Signed-off-by: Ranjan Kumar --- drivers/scsi/mpi3mr/mpi3mr.h | 8 ++++++-- drivers/scsi/mpi3mr/mpi3mr_fw.c | 29 ++++++++++++++++++++++++----- drivers/scsi/mpi3mr/mpi3mr_os.c | 24 ++++++++++++++++++++---- 3 files changed, 50 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/mpi3mr/mpi3mr.h b/drivers/scsi/mpi3mr/mpi3mr.h index 0afb687402e1..fd3619775739 100644 --- a/drivers/scsi/mpi3mr/mpi3mr.h +++ b/drivers/scsi/mpi3mr/mpi3mr.h @@ -66,11 +66,12 @@ extern atomic64_t event_counter; #define MPI3MR_NAME_LENGTH 32 #define IOCNAME "%s: " -#define MPI3MR_MAX_SECTORS 2048 +#define MPI3MR_DEFAULT_MAX_IO_SIZE (1 * 1024 * 1024) /* Definitions for internal SGL and Chain SGL buffers */ #define MPI3MR_PAGE_SIZE_4K 4096 -#define MPI3MR_SG_DEPTH (MPI3MR_PAGE_SIZE_4K / sizeof(struct mpi3_sge_common)) +#define MPI3MR_DEFAULT_SGL_ENTRIES 256 +#define MPI3MR_MAX_SGL_ENTRIES 2048 /* Definitions for MAX values for shost */ #define MPI3MR_MAX_CMDS_LUN 128 @@ -323,6 +324,7 @@ struct mpi3mr_ioc_facts { u16 max_perids; u16 max_pds; u16 max_sasexpanders; + u32 max_data_length; u16 max_sasinitiators; u16 max_enclosures; u16 max_pcie_switches; @@ -959,6 +961,7 @@ struct scmd_priv { * @stop_drv_processing: Stop all command processing * @device_refresh_on: Don't process the events until devices are refreshed * @max_host_ios: Maximum host I/O count + * @max_sgl_entries: Max SGL entries per I/O * @chain_buf_count: Chain buffer count * @chain_buf_pool: Chain buffer pool * @chain_sgl_list: Chain SGL list @@ -1129,6 +1132,7 @@ struct mpi3mr_ioc { u16 max_host_ios; spinlock_t tgtdev_lock; struct list_head tgtdev_list; + u16 max_sgl_entries; u32 chain_buf_count; struct dma_pool *chain_buf_pool; diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c index 11b78d4a87a0..f039f1d98647 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_fw.c +++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c @@ -1163,6 +1163,12 @@ mpi3mr_revalidate_factsdata(struct mpi3mr_ioc *mrioc) return -EPERM; } + if (mrioc->shost->max_sectors != (mrioc->facts.max_data_length / 512)) + ioc_err(mrioc, "Warning: The maximum data transfer length\n" + "\tchanged after reset: previous(%d), new(%d),\n" + "the driver cannot change this at run time\n", + mrioc->shost->max_sectors * 512, mrioc->facts.max_data_length); + if ((mrioc->sas_transport_enabled) && (mrioc->facts.ioc_capabilities & MPI3_IOCFACTS_CAPABILITY_MULTIPATH_ENABLED)) ioc_err(mrioc, @@ -2856,6 +2862,7 @@ static void mpi3mr_process_factsdata(struct mpi3mr_ioc *mrioc, le16_to_cpu(facts_data->max_pcie_switches); mrioc->facts.max_sasexpanders = le16_to_cpu(facts_data->max_sas_expanders); + mrioc->facts.max_data_length = le16_to_cpu(facts_data->max_data_length); mrioc->facts.max_sasinitiators = le16_to_cpu(facts_data->max_sas_initiators); mrioc->facts.max_enclosures = le16_to_cpu(facts_data->max_enclosures); @@ -2893,13 +2900,18 @@ static void mpi3mr_process_factsdata(struct mpi3mr_ioc *mrioc, mrioc->facts.io_throttle_high = le16_to_cpu(facts_data->io_throttle_high); + if (mrioc->facts.max_data_length == + MPI3_IOCFACTS_MAX_DATA_LENGTH_NOT_REPORTED) + mrioc->facts.max_data_length = MPI3MR_DEFAULT_MAX_IO_SIZE; + else + mrioc->facts.max_data_length *= MPI3MR_PAGE_SIZE_4K; /* Store in 512b block count */ if (mrioc->facts.io_throttle_data_length) mrioc->io_throttle_data_length = (mrioc->facts.io_throttle_data_length * 2 * 4); else /* set the length to 1MB + 1K to disable throttle */ - mrioc->io_throttle_data_length = MPI3MR_MAX_SECTORS + 2; + mrioc->io_throttle_data_length = (mrioc->facts.max_data_length / 512) + 2; mrioc->io_throttle_high = (mrioc->facts.io_throttle_high * 2 * 1024); mrioc->io_throttle_low = (mrioc->facts.io_throttle_low * 2 * 1024); @@ -2914,9 +2926,9 @@ static void mpi3mr_process_factsdata(struct mpi3mr_ioc *mrioc, ioc_info(mrioc, "SGEModMask 0x%x SGEModVal 0x%x SGEModShift 0x%x ", mrioc->facts.sge_mod_mask, mrioc->facts.sge_mod_value, mrioc->facts.sge_mod_shift); - ioc_info(mrioc, "DMA mask %d InitialPE status 0x%x\n", + ioc_info(mrioc, "DMA mask %d InitialPE status 0x%x max_data_len (%d)\n", mrioc->facts.dma_mask, (facts_flags & - MPI3_IOCFACTS_FLAGS_INITIAL_PORT_ENABLE_MASK)); + MPI3_IOCFACTS_FLAGS_INITIAL_PORT_ENABLE_MASK), mrioc->facts.max_data_length); ioc_info(mrioc, "max_dev_per_throttle_group(%d), max_throttle_groups(%d)\n", mrioc->facts.max_dev_per_tg, mrioc->facts.max_io_throttle_group); @@ -3414,7 +3426,14 @@ static int mpi3mr_alloc_chain_bufs(struct mpi3mr_ioc *mrioc) if (!mrioc->chain_sgl_list) goto out_failed; - sz = MPI3MR_PAGE_SIZE_4K; + if (mrioc->max_sgl_entries > (mrioc->facts.max_data_length / + MPI3MR_PAGE_SIZE_4K)) + mrioc->max_sgl_entries = mrioc->facts.max_data_length / + MPI3MR_PAGE_SIZE_4K; + sz = mrioc->max_sgl_entries * sizeof(struct mpi3_sge_common); + ioc_info(mrioc, "number of sgl entries=%d chain buffer size=%dKB\n", + mrioc->max_sgl_entries, sz/1024); + mrioc->chain_buf_pool = dma_pool_create("chain_buf pool", &mrioc->pdev->dev, sz, 16, 0); if (!mrioc->chain_buf_pool) { @@ -3813,7 +3832,7 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc) } mrioc->max_host_ios = mrioc->facts.max_reqs - MPI3MR_INTERNAL_CMDS_RESVD; - + mrioc->shost->max_sectors = mrioc->facts.max_data_length / 512; mrioc->num_io_throttle_group = mrioc->facts.max_io_throttle_group; atomic_set(&mrioc->pend_large_data_sz, 0); diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c index d627355303d7..b19b624d0e97 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_os.c +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c @@ -33,6 +33,12 @@ static int logging_level; module_param(logging_level, int, 0); MODULE_PARM_DESC(logging_level, " bits for enabling additional logging info (default=0)"); +static int max_sgl_entries = MPI3MR_DEFAULT_SGL_ENTRIES; +module_param(max_sgl_entries, int, 0444); +MODULE_PARM_DESC(max_sgl_entries, + "Preferred max number of SG entries to be used for a single I/O\n" + "The actual value will be determined by the driver\n" + "(Minimum=256, Maximum=2048, default=256)"); /* Forward declarations*/ static void mpi3mr_send_event_ack(struct mpi3mr_ioc *mrioc, u8 event, @@ -3413,7 +3419,7 @@ static int mpi3mr_prepare_sg_scmd(struct mpi3mr_ioc *mrioc, scsi_bufflen(scmd)); return -ENOMEM; } - if (sges_left > MPI3MR_SG_DEPTH) { + if (sges_left > mrioc->max_sgl_entries) { sdev_printk(KERN_ERR, scmd->device, "scsi_dma_map returned unsupported sge count %d!\n", sges_left); @@ -4818,10 +4824,10 @@ static const struct scsi_host_template mpi3mr_driver_template = { .no_write_same = 1, .can_queue = 1, .this_id = -1, - .sg_tablesize = MPI3MR_SG_DEPTH, + .sg_tablesize = MPI3MR_DEFAULT_SGL_ENTRIES, /* max xfer supported is 1M (2K in 512 byte sized sectors) */ - .max_sectors = 2048, + .max_sectors = (MPI3MR_DEFAULT_MAX_IO_SIZE / 512), .cmd_per_lun = MPI3MR_MAX_CMDS_LUN, .max_segment_size = 0xffffffff, .track_queue_depth = 1, @@ -5004,6 +5010,16 @@ mpi3mr_probe(struct pci_dev *pdev, const struct pci_device_id *id) mrioc->pdev = pdev; mrioc->stop_bsgs = 1; + mrioc->max_sgl_entries = max_sgl_entries; + if (max_sgl_entries > MPI3MR_MAX_SGL_ENTRIES) + mrioc->max_sgl_entries = MPI3MR_MAX_SGL_ENTRIES; + else if (max_sgl_entries < MPI3MR_DEFAULT_SGL_ENTRIES) + mrioc->max_sgl_entries = MPI3MR_DEFAULT_SGL_ENTRIES; + else { + mrioc->max_sgl_entries /= MPI3MR_DEFAULT_SGL_ENTRIES; + mrioc->max_sgl_entries *= MPI3MR_DEFAULT_SGL_ENTRIES; + } + /* init shost parameters */ shost->max_cmd_len = MPI3MR_MAX_CDB_LENGTH; shost->max_lun = -1; @@ -5068,7 +5084,7 @@ mpi3mr_probe(struct pci_dev *pdev, const struct pci_device_id *id) shost->nr_maps = 3; shost->can_queue = mrioc->max_host_ios; - shost->sg_tablesize = MPI3MR_SG_DEPTH; + shost->sg_tablesize = mrioc->max_sgl_entries; shost->max_id = mrioc->facts.max_perids + 1; retval = scsi_add_host(shost, &pdev->dev); From patchwork Wed Jul 12 11:59:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjan Kumar X-Patchwork-Id: 702652 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B60B9EB64D9 for ; Wed, 12 Jul 2023 12:01:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231497AbjGLMBg (ORCPT ); Wed, 12 Jul 2023 08:01:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232979AbjGLMBP (ORCPT ); Wed, 12 Jul 2023 08:01:15 -0400 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FAF41993 for ; Wed, 12 Jul 2023 05:01:05 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6686ef86110so3834032b3a.2 for ; Wed, 12 Jul 2023 05:01:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1689163265; x=1691755265; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=ZZEf/uXReTAH58/OI8WmlUGk9v8llEEC6WwbsAzJOyw=; b=dLBOUCv0VPWCRDtZM+tcpfuFdTtOUf5+7DriZcg0rMf4NItB7Sy2qTBJSaxuQsvL7u E6lcdAk7oBUW4Oi2wOT6MLsIpH7o9aZbi4wKs8ZqYGRirh6FIMr9NjUkn0QZUgFMcwPr Vg75YK24ZJkXIl+ugvD7gBeHSL12vDf8LG7YU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689163265; x=1691755265; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZZEf/uXReTAH58/OI8WmlUGk9v8llEEC6WwbsAzJOyw=; b=VN4ZrxXOKqQ2FDVDoYycZUslMk9lJgWSOaneYiF7Z0KSzRehMTGC/oReGFE2n2k7A4 TdQhA9Y7awAh4KVFuLPrmtDvstkhnMbUERG6BMC8IL+jS3mbf0ZgXt7p5lwF9Bb/9K2z pRRWVEWA8ogbXUsK7ts+lKuWyYkmK094svYyWa9sv7NcCXLlkyza3Q8e43FpJrUxnHhJ 6mDZApvPGXFEZKJW/CpCZ8cg3yV97cxw0tRoMQv91Ai+8Bz263AjfJICIZoES79gTt12 RGP75Bk+mK0Krq9+8claG50OCEwQUexCECsWf8SVzynij1/pBt2+xQzw4fcDeG2GAbk6 olMg== X-Gm-Message-State: ABy/qLYUjHVHCIhlskziUuuJNSbwlWfcTEhEu4kPuyUHEM8DIIsTTQir sooHhoYgu7Nj6dwzT4xf6x2IvoYH0L19NbcPK0tnv8PSXOhJY4V9aO7vBI6ZYxLn3+/q44BnC8+ HoWeF+eMnBF+Mb3sYTY+p3AvZRlHJ3hs2IP614qm3xZKJ1c28nOX0/XbSA3jStem8U/6GZIMufe 1EvOd/2FPSNw== X-Google-Smtp-Source: APBJJlHXHBxfGoRG5GQL+s4Ah/PROpNr4aCSrfSSOwKTsK2+A/1xvU3syxIWBjzSyMlHzkGLRQZwBQ== X-Received: by 2002:a05:6a20:382:b0:12f:fccd:1a3b with SMTP id 2-20020a056a20038200b0012ffccd1a3bmr12996296pzt.23.1689163264280; Wed, 12 Jul 2023 05:01:04 -0700 (PDT) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id x7-20020a1709029a4700b001b531e8a000sm3799627plv.157.2023.07.12.05.01.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jul 2023 05:01:03 -0700 (PDT) From: Ranjan Kumar To: linux-scsi@vger.kernel.org, martin.petersen@oracle.com Cc: rajsekhar.chundru@broadcom.com, sathya.prakash@broadcom.com, sumit.saxena@broadcom.com, sreekanth.reddy@broadcom.com, chandrakanth.patil@broadcom.com, Ranjan Kumar Subject: [PATCH 4/6] mpi3mr: WriteSame implementation Date: Wed, 12 Jul 2023 17:29:53 +0530 Message-Id: <20230712115955.6312-5-ranjan.kumar@broadcom.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230712115955.6312-1-ranjan.kumar@broadcom.com> References: <20230712115955.6312-1-ranjan.kumar@broadcom.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The driver is enhanced to divert the writesame commands that are issued with unmap=1 and NDOB=1 and with the transfer length greater than the max writesame length specified by the firmware for the particular drive to the firmware. Signed-off-by: Ranjan Kumar --- drivers/scsi/mpi3mr/mpi3mr.h | 11 +++ drivers/scsi/mpi3mr/mpi3mr_os.c | 118 +++++++++++++++++++++++++------- 2 files changed, 105 insertions(+), 24 deletions(-) diff --git a/drivers/scsi/mpi3mr/mpi3mr.h b/drivers/scsi/mpi3mr/mpi3mr.h index fd3619775739..8b009ba26d88 100644 --- a/drivers/scsi/mpi3mr/mpi3mr.h +++ b/drivers/scsi/mpi3mr/mpi3mr.h @@ -207,6 +207,9 @@ extern atomic64_t event_counter; */ #define MPI3MR_MAX_APP_XFER_SECTORS (2048 + 512) +#define MPI3MR_WRITE_SAME_MAX_LEN_256_BLKS 256 +#define MPI3MR_WRITE_SAME_MAX_LEN_2048_BLKS 2048 + /** * struct mpi3mr_nvme_pt_sge - Structure to store SGEs for NVMe * Encapsulated commands. @@ -678,6 +681,7 @@ enum mpi3mr_dev_state { * @io_unit_port: IO Unit port ID * @non_stl: Is this device not to be attached with SAS TL * @io_throttle_enabled: I/O throttling needed or not + * @wslen: Write same max length * @q_depth: Device specific Queue Depth * @wwid: World wide ID * @enclosure_logical_id: Enclosure logical identifier @@ -700,6 +704,7 @@ struct mpi3mr_tgt_dev { u8 io_unit_port; u8 non_stl; u8 io_throttle_enabled; + u16 wslen; u16 q_depth; u64 wwid; u64 enclosure_logical_id; @@ -753,6 +758,8 @@ static inline void mpi3mr_tgtdev_put(struct mpi3mr_tgt_dev *s) * @dev_removed: Device removed in the Firmware * @dev_removedelay: Device is waiting to be removed in FW * @dev_type: Device type + * @dev_nvme_dif: Device is NVMe DIF enabled + * @wslen: Write same max length * @io_throttle_enabled: I/O throttling needed or not * @io_divert: Flag indicates io divert is on or off for the dev * @throttle_group: Pointer to throttle group info @@ -769,6 +776,8 @@ struct mpi3mr_stgt_priv_data { u8 dev_removed; u8 dev_removedelay; u8 dev_type; + u8 dev_nvme_dif; + u16 wslen; u8 io_throttle_enabled; u8 io_divert; struct mpi3mr_throttle_group_info *throttle_group; @@ -784,12 +793,14 @@ struct mpi3mr_stgt_priv_data { * @ncq_prio_enable: NCQ priority enable for SATA device * @pend_count: Counter to track pending I/Os during error * handling + * @wslen: Write same max length */ struct mpi3mr_sdev_priv_data { struct mpi3mr_stgt_priv_data *tgt_priv_data; u32 lun_id; u8 ncq_prio_enable; u32 pend_count; + u16 wslen; }; /** diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c index b19b624d0e97..62acda8d1d3c 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_os.c +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c @@ -430,6 +430,7 @@ void mpi3mr_invalidate_devhandles(struct mpi3mr_ioc *mrioc) tgt_priv->io_throttle_enabled = 0; tgt_priv->io_divert = 0; tgt_priv->throttle_group = NULL; + tgt_priv->wslen = 0; if (tgtdev->host_exposed) atomic_set(&tgt_priv->block_io, 1); } @@ -1108,6 +1109,18 @@ static void mpi3mr_update_tgtdev(struct mpi3mr_ioc *mrioc, tgtdev->io_throttle_enabled = (flags & MPI3_DEVICE0_FLAGS_IO_THROTTLING_REQUIRED) ? 1 : 0; + switch (flags & MPI3_DEVICE0_FLAGS_MAX_WRITE_SAME_MASK) { + case MPI3_DEVICE0_FLAGS_MAX_WRITE_SAME_256_LB: + tgtdev->wslen = MPI3MR_WRITE_SAME_MAX_LEN_256_BLKS; + break; + case MPI3_DEVICE0_FLAGS_MAX_WRITE_SAME_2048_LB: + tgtdev->wslen = MPI3MR_WRITE_SAME_MAX_LEN_2048_BLKS; + break; + case MPI3_DEVICE0_FLAGS_MAX_WRITE_SAME_NO_LIMIT: + default: + tgtdev->wslen = 0; + break; + } if (tgtdev->starget && tgtdev->starget->hostdata) { scsi_tgt_priv_data = (struct mpi3mr_stgt_priv_data *) @@ -1119,6 +1132,7 @@ static void mpi3mr_update_tgtdev(struct mpi3mr_ioc *mrioc, tgtdev->io_throttle_enabled; if (is_added == true) atomic_set(&scsi_tgt_priv_data->block_io, 0); + scsi_tgt_priv_data->wslen = tgtdev->wslen; } switch (dev_pg0->access_status) { @@ -3939,6 +3953,48 @@ void mpi3mr_wait_for_host_io(struct mpi3mr_ioc *mrioc, u32 timeout) mpi3mr_get_fw_pending_ios(mrioc)); } +/** + * mpi3mr_setup_divert_ws - Setup Divert IO flag for write same + * @mrioc: Adapter instance reference + * @scmd: SCSI command reference + * @scsiio_req: MPI3 SCSI IO request + * @scsiio_flags: Pointer to MPI3 SCSI IO Flags + * @wslen: write same max length + * + * Gets values of unmap, ndob and number of blocks from write + * same scsi io and based on these values it sets divert IO flag + * and reason for diverting IO to firmware. + * + * Return: Nothing + */ +static inline void mpi3mr_setup_divert_ws(struct mpi3mr_ioc *mrioc, + struct scsi_cmnd *scmd, struct mpi3_scsi_io_request *scsiio_req, + u32 *scsiio_flags, u16 wslen) +{ + u8 unmap = 0, ndob = 0; + u8 opcode = scmd->cmnd[0]; + u32 num_blocks = 0; + u16 sa = (scmd->cmnd[8] << 8) | (scmd->cmnd[9]); + + if (opcode == WRITE_SAME_16) { + unmap = scmd->cmnd[1] & 0x08; + ndob = scmd->cmnd[1] & 0x01; + num_blocks = get_unaligned_be32(scmd->cmnd + 10); + } else if ((opcode == VARIABLE_LENGTH_CMD) && (sa == WRITE_SAME_32)) { + unmap = scmd->cmnd[10] & 0x08; + ndob = scmd->cmnd[10] & 0x01; + num_blocks = get_unaligned_be32(scmd->cmnd + 28); + } else + return; + + if ((unmap) && (ndob) && (num_blocks > wslen)) { + scsiio_req->msg_flags |= + MPI3_SCSIIO_MSGFLAGS_DIVERT_TO_FIRMWARE; + *scsiio_flags |= + MPI3_SCSIIO_FLAGS_DIVERT_REASON_WRITE_SAME_TOO_LARGE; + } +} + /** * mpi3mr_eh_host_reset - Host reset error handling callback * @scmd: SCSI command reference @@ -4436,7 +4492,6 @@ static int mpi3mr_target_alloc(struct scsi_target *starget) unsigned long flags; int retval = 0; struct sas_rphy *rphy = NULL; - bool update_stgt_priv_data = false; scsi_tgt_priv_data = kzalloc(sizeof(*scsi_tgt_priv_data), GFP_KERNEL); if (!scsi_tgt_priv_data) @@ -4445,39 +4500,50 @@ static int mpi3mr_target_alloc(struct scsi_target *starget) starget->hostdata = scsi_tgt_priv_data; spin_lock_irqsave(&mrioc->tgtdev_lock, flags); - if (starget->channel == mrioc->scsi_device_channel) { tgt_dev = __mpi3mr_get_tgtdev_by_perst_id(mrioc, starget->id); - if (tgt_dev && !tgt_dev->is_hidden) - update_stgt_priv_data = true; - else + if (tgt_dev && !tgt_dev->is_hidden) { + scsi_tgt_priv_data->starget = starget; + scsi_tgt_priv_data->dev_handle = tgt_dev->dev_handle; + scsi_tgt_priv_data->perst_id = tgt_dev->perst_id; + scsi_tgt_priv_data->dev_type = tgt_dev->dev_type; + scsi_tgt_priv_data->tgt_dev = tgt_dev; + tgt_dev->starget = starget; + atomic_set(&scsi_tgt_priv_data->block_io, 0); + retval = 0; + if ((tgt_dev->dev_type == MPI3_DEVICE_DEVFORM_PCIE) && + ((tgt_dev->dev_spec.pcie_inf.dev_info & + MPI3_DEVICE0_PCIE_DEVICE_INFO_TYPE_MASK) == + MPI3_DEVICE0_PCIE_DEVICE_INFO_TYPE_NVME_DEVICE) && + ((tgt_dev->dev_spec.pcie_inf.dev_info & + MPI3_DEVICE0_PCIE_DEVICE_INFO_PITYPE_MASK) != + MPI3_DEVICE0_PCIE_DEVICE_INFO_PITYPE_0)) + scsi_tgt_priv_data->dev_nvme_dif = 1; + scsi_tgt_priv_data->io_throttle_enabled = tgt_dev->io_throttle_enabled; + scsi_tgt_priv_data->wslen = tgt_dev->wslen; + if (tgt_dev->dev_type == MPI3_DEVICE_DEVFORM_VD) + scsi_tgt_priv_data->throttle_group = tgt_dev->dev_spec.vd_inf.tg; + } else retval = -ENXIO; } else if (mrioc->sas_transport_enabled && !starget->channel) { rphy = dev_to_rphy(starget->dev.parent); tgt_dev = __mpi3mr_get_tgtdev_by_addr_and_rphy(mrioc, rphy->identify.sas_address, rphy); if (tgt_dev && !tgt_dev->is_hidden && !tgt_dev->non_stl && - (tgt_dev->dev_type == MPI3_DEVICE_DEVFORM_SAS_SATA)) - update_stgt_priv_data = true; - else + (tgt_dev->dev_type == MPI3_DEVICE_DEVFORM_SAS_SATA)) { + scsi_tgt_priv_data->starget = starget; + scsi_tgt_priv_data->dev_handle = tgt_dev->dev_handle; + scsi_tgt_priv_data->perst_id = tgt_dev->perst_id; + scsi_tgt_priv_data->dev_type = tgt_dev->dev_type; + scsi_tgt_priv_data->tgt_dev = tgt_dev; + scsi_tgt_priv_data->io_throttle_enabled = tgt_dev->io_throttle_enabled; + scsi_tgt_priv_data->wslen = tgt_dev->wslen; + tgt_dev->starget = starget; + atomic_set(&scsi_tgt_priv_data->block_io, 0); + retval = 0; + } else retval = -ENXIO; } - - if (update_stgt_priv_data) { - scsi_tgt_priv_data->starget = starget; - scsi_tgt_priv_data->dev_handle = tgt_dev->dev_handle; - scsi_tgt_priv_data->perst_id = tgt_dev->perst_id; - scsi_tgt_priv_data->dev_type = tgt_dev->dev_type; - scsi_tgt_priv_data->tgt_dev = tgt_dev; - tgt_dev->starget = starget; - atomic_set(&scsi_tgt_priv_data->block_io, 0); - retval = 0; - scsi_tgt_priv_data->io_throttle_enabled = - tgt_dev->io_throttle_enabled; - if (tgt_dev->dev_type == MPI3_DEVICE_DEVFORM_VD) - scsi_tgt_priv_data->throttle_group = - tgt_dev->dev_spec.vd_inf.tg; - } spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags); return retval; @@ -4738,6 +4804,10 @@ static int mpi3mr_qcmd(struct Scsi_Host *shost, mpi3mr_setup_eedp(mrioc, scmd, scsiio_req); + if (stgt_priv_data->wslen) + mpi3mr_setup_divert_ws(mrioc, scmd, scsiio_req, &scsiio_flags, + stgt_priv_data->wslen); + memcpy(scsiio_req->cdb.cdb32, scmd->cmnd, scmd->cmd_len); scsiio_req->data_length = cpu_to_le32(scsi_bufflen(scmd)); scsiio_req->dev_handle = cpu_to_le16(dev_handle); From patchwork Wed Jul 12 11:59:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjan Kumar X-Patchwork-Id: 702160 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6414EB64D9 for ; Wed, 12 Jul 2023 12:01:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233163AbjGLMBr (ORCPT ); Wed, 12 Jul 2023 08:01:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233395AbjGLMBY (ORCPT ); Wed, 12 Jul 2023 08:01:24 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE178E42 for ; Wed, 12 Jul 2023 05:01:08 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-53fa455cd94so3618329a12.2 for ; Wed, 12 Jul 2023 05:01:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1689163268; x=1691755268; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=5Sc32J/rubyEtkHKJ2nxzEpCzT0+79T4B/KP8uzQ8oE=; b=Nbl9jUJrpLzRUorjkYclb0sNhjU4HSjrY4bdM7JlA90i9oTLt4hrV2JLVSjGRC5ZY/ erVkj5xu4zxHD9uTnLRewrtj2sKFgO6h65jk+nJ9V6LrGiIrkqQeW+KpY832mCfPL9lR F1JICOEGCMcest0cG28jM21zCL8Orpbs4yAW8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689163268; x=1691755268; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5Sc32J/rubyEtkHKJ2nxzEpCzT0+79T4B/KP8uzQ8oE=; b=Sjp+2ZiaumoIEGMaC5HkcqlZNOt+DxHtJeN0Fi5DjyEAGeulvxg+l9yuc3nS60ktoN MZX6uXtKo2bPSljQKW1fXKc1wOFipERnP40gJM+B3rJ4pqrQs139u58HXHvRLnIYp6Iv L8EkPKkcMSIP3XBekBVDje/27X8QEdDUi5vskBwLbqB5yc6uo7UTAMS/OgUZgmfWZ78w te0ZYEPpCe7TcWqiyYxcDvisBQejNGZCkFK6FUreKQ5jomkmTdYkxo3OFJsX2qs7FWFj Cv51QlMdvDsi1dMKDmyKwvfO73ofNhsdKTLO1XlHb5+jY9LSQbHy5nIXjwhbGVT6k1L4 91XA== X-Gm-Message-State: ABy/qLY9Ebk69fGJRvTuu5xiS+hbdhNEI/d6m+zqGex3ynMWVdXS0lU+ PiSo2TCAhzxlzAzmRjTKsKaJAqHo1h4t01jcMS9YvukBSjP1aw3Z7GEp4uzycyT1pa19ScQJ1gc XfGIAKyKYNVhbWq4o6nMWlgragzC45FHB1J7Tk54xfFxKjsRPp3Oer+edD15y0qEDHbHKC0uX/L 3n1DTc2NiOEg== X-Google-Smtp-Source: APBJJlEBXQWjB/z6E0awNruRTfyj/aMMI6rKMTjGiu6yvMLk7I/3VOcxMVs8VNDI48JPCaBwtfrvvQ== X-Received: by 2002:a17:902:ec88:b0:1b5:532e:33b8 with SMTP id x8-20020a170902ec8800b001b5532e33b8mr15469152plg.35.1689163267403; Wed, 12 Jul 2023 05:01:07 -0700 (PDT) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id x7-20020a1709029a4700b001b531e8a000sm3799627plv.157.2023.07.12.05.01.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jul 2023 05:01:06 -0700 (PDT) From: Ranjan Kumar To: linux-scsi@vger.kernel.org, martin.petersen@oracle.com Cc: rajsekhar.chundru@broadcom.com, sathya.prakash@broadcom.com, sumit.saxena@broadcom.com, sreekanth.reddy@broadcom.com, chandrakanth.patil@broadcom.com, Ranjan Kumar Subject: [PATCH 5/6] mpi3mr: Enhance handling of devices removed after controller reset Date: Wed, 12 Jul 2023 17:29:54 +0530 Message-Id: <20230712115955.6312-6-ranjan.kumar@broadcom.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230712115955.6312-1-ranjan.kumar@broadcom.com> References: <20230712115955.6312-1-ranjan.kumar@broadcom.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Mark all of the devices that are exposed to the OS prior to a controller reset and not detected by the controller after the reset as removed devices and the I/Os to those devices are unblocked (and returned with DID_NO_CONNECT) prior to removing the devices one after the other. Signed-off-by: Ranjan Kumar --- drivers/scsi/mpi3mr/mpi3mr_os.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c index 62acda8d1d3c..fe5dcdd8fcce 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_os.c +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c @@ -1041,6 +1041,19 @@ mpi3mr_update_sdev(struct scsi_device *sdev, void *data) void mpi3mr_rfresh_tgtdevs(struct mpi3mr_ioc *mrioc) { struct mpi3mr_tgt_dev *tgtdev, *tgtdev_next; + struct mpi3mr_stgt_priv_data *tgt_priv; + + dprint_reset(mrioc, "refresh target devices: check for removals\n"); + list_for_each_entry_safe(tgtdev, tgtdev_next, &mrioc->tgtdev_list, + list) { + if ((tgtdev->dev_handle == MPI3MR_INVALID_DEV_HANDLE) && + tgtdev->host_exposed && tgtdev->starget && + tgtdev->starget->hostdata) { + tgt_priv = tgtdev->starget->hostdata; + tgt_priv->dev_removed = 1; + atomic_set(&tgt_priv->block_io, 0); + } + } list_for_each_entry_safe(tgtdev, tgtdev_next, &mrioc->tgtdev_list, list) { From patchwork Wed Jul 12 11:59:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjan Kumar X-Patchwork-Id: 702651 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FE25EB64DD for ; Wed, 12 Jul 2023 12:01:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233471AbjGLMBt (ORCPT ); Wed, 12 Jul 2023 08:01:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232683AbjGLMBZ (ORCPT ); Wed, 12 Jul 2023 08:01:25 -0400 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 871602120 for ; Wed, 12 Jul 2023 05:01:11 -0700 (PDT) Received: by mail-pg1-x52e.google.com with SMTP id 41be03b00d2f7-55ba5fae2e6so5001271a12.0 for ; Wed, 12 Jul 2023 05:01:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1689163271; x=1691755271; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=a0hKYLNK7LnJyK0x3swNJ/TOscEqkC3tts6MSBqU9uo=; b=g5+P0vQ9aMlFVUO69FKHkvf0eTLrlI6i1IBqhEfAAdWym8TsMC6EhpQmT+4QzsvLfS zQ5Sp7xGAabEb0VF+InLjliWtXShuiKopRBICUkhdwaCRpBq7LohrLV1KPeBmVT+QAI5 IqXyJMQVghSkDu50BUmqlw2F7s/4CTtng8JKo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689163271; x=1691755271; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=a0hKYLNK7LnJyK0x3swNJ/TOscEqkC3tts6MSBqU9uo=; b=MYYaPJFYERB2gOoCeZKxA7d9X2L6Df/alT5Xx5HfYoxvZ303dUW+vAt6CTdk3+9lEK +Dmy1mSefd3fMX/iDoRB+CqCVqLjUVgtxvpUfEmOPvI9GYlJHTAs1ov2pm9Y9kfOKYR4 ewEG8ha3dWLVANZWYL8viDUiAJt2+IGn5RUW+7xuNvVCZd7hKoL+TcDXE1VQ1wQz4buF oMj6g6s6gpAUjf7odCvBVcSSi3GSrrvKAdxqtpafhwGvIq58gLzN+93eyCf+R/XE6Tqr kRE/xItAp2Wfy34Sa01dc6aTlCv0wxpqz2LXMOmOpBhc+PS6ItPY8RdITDREMTdrf/GI i93A== X-Gm-Message-State: ABy/qLZUxXmtwtH5iemM51SEtFGxzNNmIq/VF6FH8z4xirlYvFsj8IFS /zZam+MbSoDkibYfGZnc6epu8nvIS/oivJIPrGIszaJoPAmDrfi29rjHNpeXMV5+DD2+fvhOzNI /IA3B4Rtr/G7R8WbEaKXR2FzVxuBbbkke4K7hg++P49vJvbk5rEk1lEybQDaCKv9iv0cWRATmAh uvt65fn915iQ== X-Google-Smtp-Source: APBJJlEIyhFZw0kEg5mjnucHqA6l9FtOfoSJUAxonQkTvRvdzV3kLsPExEO2nTyPtbeykU55zFlo2w== X-Received: by 2002:a17:902:f809:b0:1b8:b29e:b47b with SMTP id ix9-20020a170902f80900b001b8b29eb47bmr16856551plb.44.1689163270650; Wed, 12 Jul 2023 05:01:10 -0700 (PDT) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id x7-20020a1709029a4700b001b531e8a000sm3799627plv.157.2023.07.12.05.01.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jul 2023 05:01:10 -0700 (PDT) From: Ranjan Kumar To: linux-scsi@vger.kernel.org, martin.petersen@oracle.com Cc: rajsekhar.chundru@broadcom.com, sathya.prakash@broadcom.com, sumit.saxena@broadcom.com, sreekanth.reddy@broadcom.com, chandrakanth.patil@broadcom.com, Ranjan Kumar Subject: [PATCH 6/6] mpi3mr: Update driver version to 8.5.0.0.0 Date: Wed, 12 Jul 2023 17:29:55 +0530 Message-Id: <20230712115955.6312-7-ranjan.kumar@broadcom.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230712115955.6312-1-ranjan.kumar@broadcom.com> References: <20230712115955.6312-1-ranjan.kumar@broadcom.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Update driver version to 8.5.0.0.0 Signed-off-by: Ranjan Kumar --- drivers/scsi/mpi3mr/mpi3mr.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpi3mr/mpi3mr.h b/drivers/scsi/mpi3mr/mpi3mr.h index 8b009ba26d88..aeab7c305ed2 100644 --- a/drivers/scsi/mpi3mr/mpi3mr.h +++ b/drivers/scsi/mpi3mr/mpi3mr.h @@ -55,8 +55,8 @@ extern struct list_head mrioc_list; extern int prot_mask; extern atomic64_t event_counter; -#define MPI3MR_DRIVER_VERSION "8.4.1.0.0" -#define MPI3MR_DRIVER_RELDATE "16-March-2023" +#define MPI3MR_DRIVER_VERSION "8.5.0.0.0" +#define MPI3MR_DRIVER_RELDATE "12-July-2023" #define MPI3MR_DRIVER_NAME "mpi3mr" #define MPI3MR_DRIVER_LICENSE "GPL"