From patchwork Thu May 13 08:35:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kashyap Desai X-Patchwork-Id: 437610 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=-19.3 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 E8900C433ED for ; Thu, 13 May 2021 08:34:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B87BD613E6 for ; Thu, 13 May 2021 08:34:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232009AbhEMIfU (ORCPT ); Thu, 13 May 2021 04:35:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232021AbhEMIei (ORCPT ); Thu, 13 May 2021 04:34:38 -0400 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E47ACC0613ED for ; Thu, 13 May 2021 01:33:26 -0700 (PDT) Received: by mail-pg1-x52a.google.com with SMTP id m190so20725173pga.2 for ; Thu, 13 May 2021 01:33:26 -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=q4YHFY1D+JPCAO1rZnyrco/xAHZHnkm3ruDwhbDqNu0=; b=Wt+YXpTjBuYy9QBa0tEMA0fZIABd1N8vw4YnuM3FDMC3RowrVRNWg+kd4eAhPxvFZv Eyb5jwuazVKjWx2H2+dER6XH/un1l4Vw79TRWG/BkGjtKYcXp72RnLpZ2GIfSrmetMk6 cZtG0MqQMRtB6gq9woVxEE1sPanCq8lw8gmsA= 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=q4YHFY1D+JPCAO1rZnyrco/xAHZHnkm3ruDwhbDqNu0=; b=rvlwHxnqgfuFvWMiOM77Gt4KNm+ljHObtVQMpV9u9c0WeFJPjqHQWn1I3Z7duKm1ZQ scIS+4ocPNZkIrSpHE88LbbY2MxLV8CY6VpyjvOmS3j4UkiROwhrg85mKEooOUxq07Q9 +FpQC3zP8QM5hbNOXUntgiO1j4szUq+q8mlv/N6NvPRym4kNk1rG7KB5jxtXfGmw00bQ XM9OBdmV9mb0CViEMfnC9NTbgMG6mQPtZadES0CH0XCfLxG1szHKmhxlGKYo8rPhNjXn t1QxMB0s2Ti/iix6imjMvOcHmZmjW0+LmwNvOzwzUuDXYQRXOjCQUDZLs/pY66yolSzv Sr2Q== X-Gm-Message-State: AOAM531fyBLRFR7CF4a4p4D+tKazossqlFb9wgDu7P+gRgGEQVzOJz+O 5MX/0SbUOCKhpPMlYx9tjA1uCzEQzfEwo1TwT3O8TSio6QQcqklB4QPWY6toJr9PTGr1ln/qTAB 72ubOcMHrcDgou/snCXjP7S7+MVH1PfOI1BjuNiJZgoC5cjAjSAifhYmByzoFts/DYqLPgxgqVI VGAwDabQ== X-Google-Smtp-Source: ABdhPJxlBJ5771sE8Zl3geAlKj9fV5QtWera4qATyMcirrftSo1jqCZCazWJdMoDuUfMspy1l3jJrg== X-Received: by 2002:aa7:8552:0:b029:2cf:9310:92b with SMTP id y18-20020aa785520000b02902cf9310092bmr5279854pfn.16.1620894805679; Thu, 13 May 2021 01:33:25 -0700 (PDT) Received: from drv-bst-rhel8.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id i123sm1632468pfc.53.2021.05.13.01.33.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 May 2021 01:33:25 -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 v5 15/24] mpi3mr: allow certain commands during pci-remove hook Date: Thu, 13 May 2021 14:05:59 +0530 Message-Id: <20210513083608.2243297-16-kashyap.desai@broadcom.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20210513083608.2243297-1-kashyap.desai@broadcom.com> References: <20210513083608.2243297-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 Reviewed-by: Himanshu Madhani Cc: sathya.prakash@broadcom.com --- drivers/scsi/mpi3mr/mpi3mr_os.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c index 786128da1b54..992a0e4d37d1 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_os.c +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c @@ -2776,6 +2776,26 @@ 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 @@ -2811,7 +2831,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;