From patchwork Mon Apr 19 11:01:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kashyap Desai X-Patchwork-Id: 424267 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY, SPF_HELO_NONE, SPF_PASS, T_TVD_MIME_NO_HEADERS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65A2BC43460 for ; Mon, 19 Apr 2021 11:02:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 47E2C61284 for ; Mon, 19 Apr 2021 11:02:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238552AbhDSLDP (ORCPT ); Mon, 19 Apr 2021 07:03:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238386AbhDSLDN (ORCPT ); Mon, 19 Apr 2021 07:03:13 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21813C06174A for ; Mon, 19 Apr 2021 04:02:44 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id u11so14054870pjr.0 for ; Mon, 19 Apr 2021 04:02:44 -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=PkbVBItx3Afi+PzqZFX4L+0RgXj/5hKprroERb/K5yY=; b=GZuqcVqIZFz3ysc54QqXS7qjTXkHs+Bu10vvYDzZ9yhq1Xnt/x11gnUvw02Y1tW6/B KrZtU0dHySZCR7G1MnOY8xm+wolfBMi9Y0KZu2PfMwozbqBCcQxowkcxFb7k1XAWljkK wuzgZqognkgaLDry7tjumslGb0moV3PwXEsds= 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=PkbVBItx3Afi+PzqZFX4L+0RgXj/5hKprroERb/K5yY=; b=UPaZ0HiJXQVDapAbrxX3w+d59xrDjdH62MrMyFG7UADF5sP9K4hn0y2yDHG1ADosaE mwz869Rb7MQ0udLoxqDZVwKlgp0KVMrYaPOrrBLrzc7XAy7amxwEzFcQ2CI3HsvN+6pI 9XZJbukwU50JN3ACLU3jAf4k9Gh8xAgYYazLWFfl6eMA0tajlENNaXEN0wt1nJrVULYa 7yJSy5enw5BQyNGN5AyWY4WnC/3u4czw+d8GSxgvEsJHlGZ5a5CCWbQMmZ4vDx03IxqU QKxBrLjKR3AlxSzIQfid/QzAz41A5v8hV3qcF+1eg9SMcry4LwpTEqJtLCt25Y5URKTJ Nv4w== X-Gm-Message-State: AOAM531PW3Yxfm9eeeWx+mspWTTQv+I8q+wSG2E1fraWRnaN8U8lH8xC zbIfs/SLpV3Fp8526jd8BqaXfxNLrvqiq8oPfpHJuruUdSpKEc0KWS+O1jz5o4yBnjLVLV6PSxz fTPF8aqxO0IfmZvuO51++7y1dg9YAf1jL7spWbP1PnNhLcmfuwoZeVLtma553kOQE65LGy2fs3U 3ToO2KzxmO X-Google-Smtp-Source: ABdhPJwBUFugwgJC6QEntBaVAfcPLrtZuc5za9f6ktOhKJmiTdsdsoV4PtOUxbu/1QUfJMztEcd5ag== X-Received: by 2002:a17:903:2310:b029:eb:73d5:3e4e with SMTP id d16-20020a1709032310b02900eb73d53e4emr22031120plh.66.1618830163317; Mon, 19 Apr 2021 04:02:43 -0700 (PDT) Received: from drv-bst-rhel8.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id k13sm11825736pfc.50.2021.04.19.04.02.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 04:02:42 -0700 (PDT) From: Kashyap Desai To: linux-scsi@vger.kernel.org Cc: jejb@linux.ibm.com, martin.petersen@oracle.com, steve.hagan@broadcom.com, peter.rivera@broadcom.com, mpi3mr-linuxdrv.pdl@broadcom.com, Kashyap Desai , sathya.prakash@broadcom.com Subject: [PATCH v3 15/24] mpi3mr: allow certain commands during pci-remove hook Date: Mon, 19 Apr 2021 16:31:47 +0530 Message-Id: <20210419110156.1786882-16-kashyap.desai@broadcom.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20210419110156.1786882-1-kashyap.desai@broadcom.com> References: <20210419110156.1786882-1-kashyap.desai@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This patch allows SSU and Sync Cache commands to be sent to the controller instead of driver returning DID_NO_CONNECT during driver unload to flush any cached data from the drive. Signed-off-by: Kashyap Desai Reviewed-by: Hannes Reinecke Reviewed-by: Tomas Henzl Cc: sathya.prakash@broadcom.com Reviewed-by: Himanshu Madhani --- drivers/scsi/mpi3mr/mpi3mr_os.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c index 99a60e6777d5..ac30699c7d69 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_os.c +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c @@ -2786,6 +2786,27 @@ static int mpi3mr_target_alloc(struct scsi_target *starget) return retval; } + +/** + * mpi3mr_allow_scmd_to_fw - Command is allowed during shutdown + * @scmd: SCSI Command reference + * + * Checks whether a CDB is allowed during shutdown or not. + * + * Return: TRUE for allowed commands, FALSE otherwise. + */ + +inline bool mpi3mr_allow_scmd_to_fw(struct scsi_cmnd *scmd) +{ + switch (scmd->cmnd[0]) { + case SYNCHRONIZE_CACHE: + case START_STOP: + return true; + default: + return false; + } +} + /** * mpi3mr_qcmd - I/O request despatcher * @shost: SCSI Host reference @@ -2821,7 +2842,8 @@ static int mpi3mr_qcmd(struct Scsi_Host *shost, goto out; } - if (mrioc->stop_drv_processing) { + if (mrioc->stop_drv_processing && + !(mpi3mr_allow_scmd_to_fw(scmd))) { scmd->result = DID_NO_CONNECT << 16; scmd->scsi_done(scmd); goto out;