Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3350456rwb; Fri, 30 Sep 2022 02:10:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5fPwE4+O9/+dz3ytr89aYQGaKthXRV4uVK2MfHQ5i5siHTNIkpXiPHmvJ3PrhrvFYPYGtP X-Received: by 2002:a17:907:1ddb:b0:777:51ba:e58f with SMTP id og27-20020a1709071ddb00b0077751bae58fmr5588195ejc.695.1664529050909; Fri, 30 Sep 2022 02:10:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664529050; cv=none; d=google.com; s=arc-20160816; b=F3F32NJt0RZFm0ZXAhMTz4opUVfdWZkVIPnl5TM/9qFdj8nS6UOApS5dQGKgE0u4PU +dHPljg9dvzP/iTbTPrK2tr0KdzIKGCH49p9CZUZk4k2lv8ZONOVjI5dYywSnGDszPdP 3JKWoJCs//UnmyoL5uzyJUcu3czZOdBhEn1L2voLb7B/41gOOx1JRWffk47N5xzIw57d HQZZt7wkPOOobuc4/fT1ufT4ou2fpxuSC/VyIxhbcO/ckriOVacdoXApGLYSYAWd0GhV 8aBZde4TuBDsKSymHAStYqdCIcAn6Zf6RH3i7dAYo4KMC+DEKxySBFuaqnk9/wuGVvCI 5RqQ== 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=pGz5HmyHMDVwvszp26GErLQLKS2KlMoVTuNL+IomccI=; b=R+G/GJNW6T6qLChNtC2wW0gMy4wvptc+EiMgtIDAo81xLmkbED6DbZb4c6zBlahgc4 2dpodm9PkV6ngpm+ifL5QB08hTMMV9FQI0MTl8lDOjvUXT1XQwkCatFwHILL3jPOTTLa mJm2NjIsrimWy34lRVGusgsceJoTLja43fDiNuvCSyAwHufGFTJ32NG2lg2acAPyncGq 98k/XTVfozgJOw0wT9Q4HVQW4wcguMmJCsRp//f81sUHmLmeBwr2RtItranq8XoqwN67 d5QIK+jdl8AOdzsC+Q+N03i2qNYsJohvSxKAMjjLN99DGlSAv1wKaTwdffHSI4oVepRE hUFw== 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 gl13-20020a170906e0cd00b00783286f155fsi1118106ejb.311.2022.09.30.02.10.25; Fri, 30 Sep 2022 02:10:50 -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 S230442AbiI3JDx (ORCPT + 99 others); Fri, 30 Sep 2022 05:03:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230094AbiI3JDu (ORCPT ); Fri, 30 Sep 2022 05:03:50 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30DDAFEE4E; Fri, 30 Sep 2022 02:03:49 -0700 (PDT) Received: from fraeml735-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Mf45j2ZJvz689Q8; Fri, 30 Sep 2022 17:03:37 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml735-chm.china.huawei.com (10.206.15.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 11:03:47 +0200 Received: from localhost.localdomain (10.69.192.58) by lhrpeml500003.china.huawei.com (7.191.162.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 30 Sep 2022 10:03:43 +0100 From: John Garry To: , , , CC: , , , , , , , , John Garry Subject: [PATCH v2 1/6] scsi: libsas: Add sas_task_find_rq() Date: Fri, 30 Sep 2022 16:56:19 +0800 Message-ID: <1664528184-162714-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1664528184-162714-1-git-send-email-john.garry@huawei.com> References: <1664528184-162714-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: dggems705-chm.china.huawei.com (10.3.19.182) To lhrpeml500003.china.huawei.com (7.191.162.67) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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 blk-mq already provides a unique tag per request. Some libsas LLDDs - like hisi_sas - already use this tag as the unique per-IO HW tag. Add a common function to provide the request associated with a sas_task for all libsas LLDDs. Signed-off-by: John Garry --- include/scsi/libsas.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index f86b56bf7833..f498217961db 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h @@ -644,6 +644,24 @@ static inline bool sas_is_internal_abort(struct sas_task *task) return task->task_proto == SAS_PROTOCOL_INTERNAL_ABORT; } +static inline struct request *sas_task_find_rq(struct sas_task *task) +{ + struct scsi_cmnd *scmd; + + if (task->task_proto & SAS_PROTOCOL_STP_ALL) { + struct ata_queued_cmd *qc = task->uldd_task; + + scmd = qc ? qc->scsicmd : NULL; + } else { + scmd = task->uldd_task; + } + + if (!scmd) + return NULL; + + return scsi_cmd_to_rq(scmd); +} + struct sas_domain_function_template { /* The class calls these to notify the LLDD of an event. */ void (*lldd_port_formed)(struct asd_sas_phy *); -- 2.35.3