Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp545742rwb; Wed, 28 Sep 2022 06:14:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6LGF1DwGcyug05hgthmqm/ZtALAIdUBHiUBGjjehBP7AsLjZyzW7lxvNBBxh4h0s46S+wn X-Received: by 2002:a17:903:284:b0:178:2a94:9b6a with SMTP id j4-20020a170903028400b001782a949b6amr33089407plr.135.1664370894876; Wed, 28 Sep 2022 06:14:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664370894; cv=none; d=google.com; s=arc-20160816; b=xXeqjlxgKQFPXmjS9tKv1MPTXYMwcv674HxF7F2i64jFn1wgaTfZfM1HMh0YJE3CYe DHugpyvW1t+VeugOJGA7brLf0iVQMrN+Xk64v3sRRu9klTtSDHnBYqAsCZ9ckEJavKLO MxuOuf4Onk3DKA4j9eNg89cbJ0gvKz4SsWgAVQ6WmNoiOwn64OcBq9pUHsRl9v2CvsZn oTyAej7yk8lEZYYDIfekNfxPsdvSFvc1kFunywagcjbwExDzev6mpwD8ZHheDqZZU+d4 yoPTcttC/8Q9NoIxvUshhtx+nGkhBFR7XRr+QGEhC8peXP0z0hzPwVApQa0O6h8M9pr8 v5uw== 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=K1G0faYHuZgU9+2B//IfsQAd+zO2VZxLHSQGsUv5MA0=; b=FmF6AHTQSrEkO8PAHtSgmI992yxxp04CX20Jau51s5lZeTfFRG5VH1F8wvrF2Jz2gs OaXIvvW5xA6iLhuLVXT1G/X6ig55HpfHIAcUmZvTO7KmgM7RgLGizXGwzgBKJVkEanXv STFZ1Tp+3bKkBsR+sHVy5LKG3apVEuYWH/gy3gr3MC2wllEl7zz2CXr1E4XzG/kQpZi5 C7/3eO9Tp9/GqS4qfmtBO/Nm3HLa9mig3secDCyMlRB3367QSUyMs0oWvhu5ttjwGy8v nTUtIlwQt0dfxgsoi5hoZDqcg9yJZ4hnQCrDIH1clTrFMrYtfoz531w8/nE8Z8sCVY69 /54g== 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 np3-20020a17090b4c4300b002008b35cef0si2452547pjb.144.2022.09.28.06.14.41; Wed, 28 Sep 2022 06:14:54 -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 S233622AbiI1Md5 (ORCPT + 99 others); Wed, 28 Sep 2022 08:33:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233954AbiI1Mdy (ORCPT ); Wed, 28 Sep 2022 08:33:54 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 452C89C200; Wed, 28 Sep 2022 05:33:52 -0700 (PDT) Received: from fraeml712-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Mcwql6nlrz6H75m; Wed, 28 Sep 2022 20:32:35 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml712-chm.china.huawei.com (10.206.15.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 28 Sep 2022 14:33:50 +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; Wed, 28 Sep 2022 13:33:46 +0100 From: John Garry To: , , , CC: , , , , , , , John Garry Subject: [PATCH 1/6] scsi: libsas: Add sas_task_find_rq() Date: Wed, 28 Sep 2022 20:27:09 +0800 Message-ID: <1664368034-114991-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1664368034-114991-1-git-send-email-john.garry@huawei.com> References: <1664368034-114991-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 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 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index f86b56bf7833..bc51756a3317 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h @@ -644,6 +644,28 @@ 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->uldd_task) + return NULL; + + if (task->task_proto & SAS_PROTOCOL_STP_ALL) { + struct ata_queued_cmd *qc; + + qc = task->uldd_task; + scmd = qc->scsicmd; + } 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