From patchwork Tue Dec 22 10:11:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kashyap Desai X-Patchwork-Id: 11986245 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.8 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,SPF_HELO_NONE,SPF_PASS, 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 2458EC433DB for ; Tue, 22 Dec 2020 10:14:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D92AF2311D for ; Tue, 22 Dec 2020 10:14:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726504AbgLVKOI (ORCPT ); Tue, 22 Dec 2020 05:14:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726371AbgLVKOI (ORCPT ); Tue, 22 Dec 2020 05:14:08 -0500 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C80ECC061793 for ; Tue, 22 Dec 2020 02:13:05 -0800 (PST) Received: by mail-pg1-x530.google.com with SMTP id z21so8082283pgj.4 for ; Tue, 22 Dec 2020 02:13:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:from:to:cc:subject:date:message-id:in-reply-to :references; bh=opHhvQyD6tZmvgygkmZqlQIR/78J/tQHD586Bbko5U0=; b=TF085mjqDvXTkS8O+L+afjAhsMgg7WwBIkEAR86A6/42PsxOZOKYBqv8+8WYvOoM58 oachiVhTenmcQ4G5BgGut3aOkTem4aEA1T+V97IRz/F8wGe0pzvQ7Sazonx1wYL8g7pU tNleEBPXENh06+UWeP5meyAfzlBZk7mRrwLXo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:to:cc:subject:date:message-id :in-reply-to:references; bh=opHhvQyD6tZmvgygkmZqlQIR/78J/tQHD586Bbko5U0=; b=mRZYtl3qj9UHPBvTeqtC1DlgM1tjubqp1elB1HZ5gJSN2GqzBMGbL5F6Jtj6xY1Fn5 t3mFLiaBTGcptsC6m/tPRVG++QZEiM6Lxt/ILlK8mw5QYE+Gtf8TTdrQnY2KicBdZnDO 6DP0RC3i+7tPRTYUHq3NAkI2ATd/Im3pKclDgd/tneBfOEKSBhyBJXWN04MPG6kkjbtV FzneetQGJYbOeuEILUteQXrZ8DJ4ISPsnaKVAX2pneuAHhYaRVMmatwhUKo/dIcLFqzn g1qiZalRPSF8eBZYt3D7jjRMO6WbXscqwFT6wZG7T/yXznNZdZxGIUDMu6qeP+/o5FtC k7lw== X-Gm-Message-State: AOAM531bGtZql5c8rH5HkBS3k5nPCfhTcVgKBx3JZb12NzAu1pZNpyg/ NF3ceNLgu9cWRJQkohPyVXKzi8RRcrjLJqyOqOSJkC5+iuKI5WwdlRE0dijNYFVaL6YGXH1YqGZ l8PG4OFd4JlotdgexkrZ8ELBohOSFw6Ngv9SG+rQMJlkJ04lUDncWg1C4/vVJAhNVVuA6+QUwa+ QjsgrajYgt MIME-Version: 1.0 X-Google-Smtp-Source: ABdhPJx3bIp1UK4xG/GcS0t+/I0VbUUbwcRC3Kcy4lAKs/370b9TTG5TJGPLR1cYQpqruH3lxpTCTQ== X-Received: by 2002:a63:6207:: with SMTP id w7mr19335717pgb.164.1608631984954; Tue, 22 Dec 2020 02:13:04 -0800 (PST) Received: from drv-bst-rhel8.static.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id p16sm19148624pju.47.2020.12.22.02.13.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Dec 2020 02:13:04 -0800 (PST) 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 15/24] mpi3mr: allow certain commands during pci-remove hook Date: Tue, 22 Dec 2020 15:41:47 +0530 Message-Id: <20201222101156.98308-16-kashyap.desai@broadcom.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20201222101156.98308-1-kashyap.desai@broadcom.com> References: <20201222101156.98308-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 Cc: sathya.prakash@broadcom.com Reviewed-by: Hannes Reinecke --- 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 6f19e5392433..07a7b1efbc4f 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_os.c +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c @@ -2865,6 +2865,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 @@ -2900,7 +2921,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;