From patchwork Wed Aug 19 15:20:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 247970 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:522:0:0:0:0 with SMTP id h2csp560401ils; Wed, 19 Aug 2020 08:25:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLSqFpLR0pjVvgjK6FRR8o/fLnjpUwV9vCPZTU0EoMxdvpfxvdn90hFbz4tVq+R/U6jOFB X-Received: by 2002:a17:907:4064:: with SMTP id nl4mr25490551ejb.342.1597850736657; Wed, 19 Aug 2020 08:25:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597850736; cv=none; d=google.com; s=arc-20160816; b=WDvnRTUJPBZ1TD/IRJULfm9q/2szOS717M3w7ef7jQL/Km02BXoFpyi/lHo05ZRw5i artU7qFmLT+YLZ2kWXhaV/5T/EpyHyf/4pSdRZzo+ekdtJc+m8NY1U12FcBmFXKPgn0P 5tX6MPo97iop1vxQL3Feod5jCyARPYly8CG9Lnf6EQEWvSpM6VwG30OHxdCygVXN7VYO iOI6KH4TvhK36koSbb1yUCtpu6xJg/5Wzz10LG6lNpu8tkXukSbMGd/HRCm6kO5VshaB 03aH8ch7QQvXVAHsGyxfWWPsJo2wu4VMAdnloM4g9yE+LDkDF2PLe7zZMsjxq32ouryj +eAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=sScbSgplrZ+sSXreevFApx8bueop8lqFQ4YTn6Ak2EA=; b=dctC51kEtU040nT4t8Nyq/8NqHb23SrFL15PcqBfLIrAX+gAO0ngoZevdARY8u5rho hmsJO/gYvmOMPa6ODzaW3fJum4u8AWd+q2sdE9hzntJQ/tntK+ZP6cJRzhbXIGsSfH7r wXrK1Ngcn/kt9rF3rct7AQ+pz0VFsm816UUG6TmnzYASY3SlE7/ZxP+4CpMM/2pz0zeS 3ub3w0DINq1tQU9+AtyyMbzpZMvJHNz4skvcvVqDd+5JyPlQu7q7GHaYaV7p5T8XB3hT RtAt2+1qzAinnQBMnwURAoguFknEKRDnYl88mP/dJFOnvL6IvSJLIj8pCvDIqKsjcFpE DUug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z17si11533547edx.532.2020.08.19.08.25.36 for ; Wed, 19 Aug 2020 08:25:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728767AbgHSPZ3 (ORCPT ); Wed, 19 Aug 2020 11:25:29 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:39650 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728758AbgHSPZV (ORCPT ); Wed, 19 Aug 2020 11:25:21 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id E2FC13F36854AB68B766; Wed, 19 Aug 2020 23:24:58 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.487.0; Wed, 19 Aug 2020 23:24:51 +0800 From: John Garry To: , , , , , , , , , , CC: , , , , , , , , Hannes Reinecke , John Garry Subject: [PATCH v8 12/18] scsi: Add host and host template flag 'host_tagset' Date: Wed, 19 Aug 2020 23:20:30 +0800 Message-ID: <1597850436-116171-13-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1597850436-116171-1-git-send-email-john.garry@huawei.com> References: <1597850436-116171-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Hannes Reinecke Add Host and host template flag 'host_tagset' so hostwide tagset can be shared on multiple reply queues after the SCSI device's reply queue is converted to blk-mq hw queue. Tested-by: Don Brace #SCSI resv cmds patches used Signed-off-by: Hannes Reinecke [jpg: Update comment on .can_queue and add Scsi_Host.host_tagset] Signed-off-by: John Garry --- drivers/scsi/hosts.c | 1 + drivers/scsi/scsi_lib.c | 2 ++ include/scsi/scsi_host.h | 9 ++++++++- 3 files changed, 11 insertions(+), 1 deletion(-) -- 2.26.2 diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 37d1c5565d90..2f162603876f 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -421,6 +421,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) shost->cmd_per_lun = sht->cmd_per_lun; shost->unchecked_isa_dma = sht->unchecked_isa_dma; shost->no_write_same = sht->no_write_same; + shost->host_tagset = sht->host_tagset; if (shost_eh_deadline == -1 || !sht->eh_host_reset_handler) shost->eh_deadline = -1; diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 7c6dd6f75190..cdef5d1777cb 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1891,6 +1891,8 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost) tag_set->flags |= BLK_ALLOC_POLICY_TO_MQ_FLAG(shost->hostt->tag_alloc_policy); tag_set->driver_data = shost; + if (shost->host_tagset) + tag_set->flags |= BLK_MQ_F_TAG_HCTX_SHARED; return blk_mq_alloc_tag_set(tag_set); } diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 46ef8cccc982..701f178b20ae 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -436,6 +436,9 @@ struct scsi_host_template { /* True if the controller does not support WRITE SAME */ unsigned no_write_same:1; + /* True if the host uses host-wide tagspace */ + unsigned host_tagset:1; + /* * Countdown for host blocking with no commands outstanding. */ @@ -603,7 +606,8 @@ struct Scsi_Host { * * Note: it is assumed that each hardware queue has a queue depth of * can_queue. In other words, the total queue depth per host - * is nr_hw_queues * can_queue. + * is nr_hw_queues * can_queue. However, for when host_tagset is set, + * the total queue depth is can_queue. */ unsigned nr_hw_queues; unsigned active_mode:2; @@ -634,6 +638,9 @@ struct Scsi_Host { /* The controller does not support WRITE SAME */ unsigned no_write_same:1; + /* True if the host uses host-wide tagspace */ + unsigned host_tagset:1; + /* Host responded with short (<36 bytes) INQUIRY result */ unsigned short_inquiry:1;