Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp327869rwb; Tue, 4 Oct 2022 04:48:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7XVA0N+YOFPud+rPZ4v7RI90L4QX+SZjyxwI1v4mMoO1wWXw9V3m1fdkawgfhPCob6rcxj X-Received: by 2002:aa7:ca45:0:b0:458:d9a2:6164 with SMTP id j5-20020aa7ca45000000b00458d9a26164mr11321092edt.340.1664884080920; Tue, 04 Oct 2022 04:48:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664884080; cv=none; d=google.com; s=arc-20160816; b=LKxPLFydpr6MtQjzR9unEMAVLcyiKyh8prEoE2wN2O67dpKRv/07N/2Wh6YLxUqR32 69TGrKHiAMXLpjEsYAQvJXM3OEUnCLratJpSSFxKDzw3aQVTE5a3r3NmceeOgfBTra/W /viinrwsnIMUdOQUZTxDZ21pWKKzBv4zJEAFR9taN9Y8wVN7TUBb9n+dpUJoke3SNECI aCNjG9xzYl5HoeZ3E1/5bQPSau9+YukcfUYpShraZWeKsGBD6FubhWPlZexzcyRCaR5z dhtCM92kt5IfYgxvXhf391RyMWjL4uh7x3DK1xwIl/Q+f9L5hEwgsusB18Wog/ckWQuo wOlA== 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=CQv5WstjT3YeH7kbYWAkRBggNZL1OsK+8jL2u/FF7sk=; b=sxDmGrzbcj44BQ6gQBv+oxnmaHGBP/wmn22hBok/UYaL9VPgx8VaYlhKg2udlMJkws 2QfW5UmZAymAcomUw3XltS+LSrScyF+2hah8opwfQ/Q1a36ZAoLNGr0QOmEyKteu3hbp mB5U+JxUc1/yVnpGNm8DT+U24c43n9Ds5oOqGV2rhRHluifBPPjTpModc8pDctO0z8Ri yV5cXqVrFYiPWvH5KaMlZ2lvOqKzZTZOLajFkviEUff3KsLoz4ZvjSlzxG3K36OhOhev rPyYclTgu1pnGPzQFSqlyj4gxKgyD2GHw8Re8i9HZda1GWZ/D4iKz/mmr0AQsGN+GEiJ vKVg== 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 r24-20020a170906549800b00741757d62adsi9600025ejo.993.2022.10.04.04.47.36; Tue, 04 Oct 2022 04:48:00 -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 S229791AbiJDK4w (ORCPT + 99 others); Tue, 4 Oct 2022 06:56:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229726AbiJDK4s (ORCPT ); Tue, 4 Oct 2022 06:56:48 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7050E53D16; Tue, 4 Oct 2022 03:56:47 -0700 (PDT) Received: from fraeml744-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MhZMc6yL5z689Hq; Tue, 4 Oct 2022 18:54:20 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml744-chm.china.huawei.com (10.206.15.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 4 Oct 2022 12:56:45 +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; Tue, 4 Oct 2022 11:56:42 +0100 From: John Garry To: , , CC: , , , , , , , , John Garry Subject: [PATCH v3 1/7] scsi: libsas: Add sas_task_find_rq() Date: Tue, 4 Oct 2022 19:27:07 +0800 Message-ID: <1664882833-39804-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1664882833-39804-1-git-send-email-john.garry@huawei.com> References: <1664882833-39804-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 Reviewed-by: Jack Wang Reviewed-by: Jason Yan Reviewed-by: Hannes Reinecke --- 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.25.1