From patchwork Wed Apr 7 02:04:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kashyap Desai X-Patchwork-Id: 12186537 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 A3F1BC43461 for ; Wed, 7 Apr 2021 02:04:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 80DD9613BD for ; Wed, 7 Apr 2021 02:04:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344129AbhDGCFH (ORCPT ); Tue, 6 Apr 2021 22:05:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343899AbhDGCFA (ORCPT ); Tue, 6 Apr 2021 22:05:00 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3447C061762 for ; Tue, 6 Apr 2021 19:04:48 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id p10so3417100pld.0 for ; Tue, 06 Apr 2021 19:04:48 -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=bZFXQ06UXYZ+iiVvF8MKRNbHM9qfjzMheaLdMXxZxwc=; b=KrbTZobSdJUGP8Vu21TmjU9BOYP4sDHcW84hrG+TAaRPhAfcHs3NyLrd7Vv3wBkryd pvnunCXI+9H6IHxE32ntORWrB5EFsJ0F+s8XCbDQCu+VVE3/5Yie/GJrchdpO5lljJQD Ovt4sjYb3SXZ6ThP5LMm+u82DG7yTtEzRsAyc= 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=bZFXQ06UXYZ+iiVvF8MKRNbHM9qfjzMheaLdMXxZxwc=; b=UQo7L48jqNedNfPEp7ZSYwRgD50oA6Fy+9p/XDPXGFChpEaltljmtysVku3+LbsgsL PYUWDYqnmZZBX3QXYGJBXCtdiZ4KAUbEdEWwKDRZdSfJyJSxgO1pvfDb72MLQZjq4GSu zWRuJdTXOauxcqQXASx+dqHGr5cgkWpokjG+rlmIL9N3BRK5r6D6nrebDrbHs/do9/1x sC6QwZndHpeAAmmtnEzchLKigluixmMWx2lPlZqRHc+mwRMFoA3XScKRN1UJjHt6CMAO FU9yM86dPxVM+Y3oP78X+V3BW/6yAevGzz5N44/hDd0EvQYQoUS+qRv8OBfLucLMLdM6 jO+g== X-Gm-Message-State: AOAM5316xJtcJed9M8zU1/jeh6BnBi56+lWXq6V1R/2B0to8cNpqSbKr NwHsOPj7QoGppjBqtXQK9b0LQ4g8rQr2xhcwRbwUuV/fsxR/B0coTaBhs3utFFOo9xgQu97wkON tVxAd563MkgICg4b+3OSubd2DEA3Uxg+mmL1AbvbL9aoibrcYWpJFR4DMna4URLMGkzEwPJEckT UBVnvd9g== X-Google-Smtp-Source: ABdhPJzar3MlKTAFI8Gud8JvYr2ptKOCWzZ3YB0Em7qIKfvSKf3t+ZZthyMNqdE93IBBSrVtw1U+gQ== X-Received: by 2002:a17:90a:4a8e:: with SMTP id f14mr1020034pjh.84.1617761088076; Tue, 06 Apr 2021 19:04:48 -0700 (PDT) Received: from drv-bst-rhel8.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id y9sm3435858pja.50.2021.04.06.19.04.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Apr 2021 19:04:47 -0700 (PDT) From: Kashyap Desai To: linux-scsi@vger.kernel.org Cc: Kashyap Desai , sathya.prakash@broadcom.com Subject: [PATCH v2 15/24] mpi3mr: allow certain commands during pci-remove hook Date: Wed, 7 Apr 2021 07:34:42 +0530 Message-Id: <20210407020451.924822-16-kashyap.desai@broadcom.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20210407020451.924822-1-kashyap.desai@broadcom.com> References: <20210407020451.924822-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 Cc: sathya.prakash@broadcom.com Reviewed-by: Tomas Henzl --- 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 a521e59efd28..558be8c75a88 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_os.c +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c @@ -2862,6 +2862,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 @@ -2897,7 +2918,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;