Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3169190pxp; Tue, 22 Mar 2022 13:39:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx563um+bJc7O9U2u8EHwBS95mmXD1HJRL+ny0PBZwQMF64Dqc+2XOJFBgDQJKQ10jzGaYz X-Received: by 2002:a17:906:d1c4:b0:6d5:83bb:f58a with SMTP id bs4-20020a170906d1c400b006d583bbf58amr28204928ejb.672.1647981558865; Tue, 22 Mar 2022 13:39:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647981558; cv=none; d=google.com; s=arc-20160816; b=K00J9f1IOafqNq50M0BQY8AEGQuhIMxmzcc88e/4AOtJQLfrI8e9NcKjzad9c3KlTk k5ywIM/Tx64L4xkJ6wAMx15YfmJOELXbrdnF3EU4iQlx6qYY0vCWnWbkEVB1n+RgkrAU 1d++YYwP5B9nNFrj64INw7M3RnJZ/i7aqn1TeJCwSddroOxQDX/RP0cWzOJFFNW9U7OX RmLi8IDrR8cFz6GgHJDL6bwmHGz1xpWJqk6KPZWIGagKQZE0xNXr6pDWjURgc7TsB4UZ pp1uiR/LX8jpOsbhyvH0I1zjrUArlBWJ8/dke14bMp2gehaxrgFkxwjL4o/Wqn01x/kr PrxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=rC7RXhmIpG4NOoQ20qyH7WWzjiIDbJAVEl2RaPOkaH0=; b=aA8I4fUucfeIYNp+SCiu1nFB9uyyLw+kwdMYyumbP/YAGtvHP0TXNWlcf1UdExZOr4 DI0rrGgtALFdK+6euc5L2afjcrHH5yjIJfLj1Gtr7ar631t8tqkURzpVjOoN5M+n39Ol 1oi4h6gC5rnxoi6fKYR+86rpjLQWey7GUHpTtz4lj029N+3n4wQFaYXZ8XeegO5VKMgj FduymzNxE0bD5fN3IuNh3lS5WPx+/NhunevomvjTYjIZErTXnEDNBE3YQzOhhf60Y2gM RDZbOpmw8osSjHLJ2u8Lm9VQHV2GRhlTclbq7+/9+78LV8obsr7Vj6XS7mKuhOHYpXGX HHog== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m24-20020a17090677d800b006e00c59f3c2si5711536ejn.558.2022.03.22.13.38.52; Tue, 22 Mar 2022 13:39:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232677AbiCVKtr (ORCPT + 99 others); Tue, 22 Mar 2022 06:49:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233688AbiCVKrv (ORCPT ); Tue, 22 Mar 2022 06:47:51 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6474182322; Tue, 22 Mar 2022 03:46:20 -0700 (PDT) Received: from fraeml740-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4KN7QJ0GhKz67Xmk; Tue, 22 Mar 2022 18:44:08 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml740-chm.china.huawei.com (10.206.15.221) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 22 Mar 2022 11:46:18 +0100 Received: from localhost.localdomain (10.69.192.58) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Tue, 22 Mar 2022 10:46:14 +0000 From: John Garry To: , , , , , , , CC: , , , , , , , John Garry Subject: [PATCH 10/11] scsi: libsas: Add sas_task_to_hwq() Date: Tue, 22 Mar 2022 18:39:44 +0800 Message-ID: <1647945585-197349-11-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1647945585-197349-1-git-send-email-john.garry@huawei.com> References: <1647945585-197349-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a function to get the hw queue index from a sas_task. Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 20 ++------------------ drivers/scsi/libsas/sas_scsi_host.c | 9 ++++++++- include/scsi/libsas.h | 2 +- 3 files changed, 11 insertions(+), 20 deletions(-) diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index f6b64c789335..b3e03c229cb5 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -461,7 +461,6 @@ static int hisi_sas_queue_command(struct sas_task *task, gfp_t gfp_flags) struct asd_sas_port *sas_port = device->port; struct hisi_sas_device *sas_dev = device->lldd_dev; bool internal_abort = sas_is_internal_abort(task); - struct scsi_cmnd *scmd = NULL; struct hisi_sas_dq *dq = NULL; struct hisi_sas_port *port; struct hisi_hba *hisi_hba; @@ -486,6 +485,8 @@ static int hisi_sas_queue_command(struct sas_task *task, gfp_t gfp_flags) hisi_hba = dev_to_hisi_hba(device); dev = hisi_hba->dev; + dq = &hisi_hba->dq[sas_task_to_hwq(task)]; + switch (task->task_proto) { case SAS_PROTOCOL_SSP: case SAS_PROTOCOL_SMP: @@ -520,22 +521,6 @@ static int hisi_sas_queue_command(struct sas_task *task, gfp_t gfp_flags) return -ECOMM; } - scmd = task->uldd_task; - - if (scmd) { - unsigned int dq_index; - u32 blk_tag; - - blk_tag = blk_mq_unique_tag(scsi_cmd_to_rq(scmd)); - dq_index = blk_mq_unique_tag_to_hwq(blk_tag); - dq = &hisi_hba->dq[dq_index]; - } else { - struct Scsi_Host *shost = hisi_hba->shost; - struct blk_mq_queue_map *qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT]; - int queue = qmap->mq_map[raw_smp_processor_id()]; - - dq = &hisi_hba->dq[queue]; - } break; case SAS_PROTOCOL_INTERNAL_ABORT: if (!hisi_hba->hw->prep_abort) @@ -550,7 +535,6 @@ static int hisi_sas_queue_command(struct sas_task *task, gfp_t gfp_flags) return -EINVAL; port = to_hisi_sas_port(sas_port); - dq = &hisi_hba->dq[task->abort_task.qid]; break; default: dev_err(hisi_hba->dev, "task prep: unknown/unsupported proto (0x%x)\n", diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c index 425904fa4cc7..b808b23e265e 100644 --- a/drivers/scsi/libsas/sas_scsi_host.c +++ b/drivers/scsi/libsas/sas_scsi_host.c @@ -986,7 +986,6 @@ static int sas_execute_internal_abort(struct domain_device *device, task->abort_task.tag = tag; task->abort_task.type = type; - task->abort_task.qid = qid; rq = scsi_alloc_request_hwq(request_queue, REQ_OP_DRV_IN, BLK_MQ_REQ_NOWAIT, qid); if (!rq) { @@ -1079,6 +1078,14 @@ unsigned int sas_task_to_unique_tag(struct sas_task *task) } EXPORT_SYMBOL_GPL(sas_task_to_unique_tag); +unsigned int sas_task_to_hwq(struct sas_task *task) +{ + u32 unique = sas_task_to_rq_unique_tag(task); + + return blk_mq_unique_tag_to_hwq(unique); +} +EXPORT_SYMBOL_GPL(sas_task_to_hwq); + int sas_execute_tmf(struct domain_device *device, void *parameter, int para_len, int force_phy_id, struct sas_tmf_task *tmf) diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index 3d9ef4c2c889..368c45016af0 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h @@ -565,7 +565,6 @@ enum sas_internal_abort { struct sas_internal_abort_task { enum sas_internal_abort type; - unsigned int qid; u16 tag; }; @@ -626,6 +625,7 @@ struct sas_task { }; unsigned int sas_task_to_unique_tag(struct sas_task *task); +unsigned int sas_task_to_hwq(struct sas_task *task); struct sas_task_slow { /* standard/extra infrastructure for slow path commands (SMP and -- 2.26.2