Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5676EC433EF for ; Mon, 11 Jul 2022 11:08:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:References:Content-Type: Content-Transfer-Encoding:MIME-Version:In-Reply-To:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TPokgc8KiyKiXoT7NCkFEOk/43/FQR9MxdUyRi6+mZk=; b=ghkobs1ASZbyBsPGQSKL1sXCr8 HBsb7x5vvZRW5PdeNeLUQfb6XwJ5CXMT0TQP4WzR0kJB2BExER7fC2ML/7o7OklVjEdeESDDsp3iT NVBMVldYQum+G/qDketO7SEoAbT1uOPiDFASMVZOwXPJVB9EK56NWTZNkjsuqL1USV9RN0kj4/jAB MW53OPC3whHTTShjxLk1YZdtPGXt63D8/K7VycShVSmNVoa4ma8bwyO4M8xd6IABPlA89V2j64gSN 3Hb07veieiUlcxJi9/MGHnkdyyOdEoxVhR7ukt05wFVP9Oekg1H0Po8Xa6Mx+Ps7CDhBvw0JZ/BfU hM9+r5Aw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oArHG-000wkX-Gx; Mon, 11 Jul 2022 11:08:34 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oArHD-000whq-HM for linux-nvme@lists.infradead.org; Mon, 11 Jul 2022 11:08:33 +0000 Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20220711110829epoutp01b40fd8f343311c36a5fc678762c9c011~AwcPEc9HL1791317913epoutp01D for ; Mon, 11 Jul 2022 11:08:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20220711110829epoutp01b40fd8f343311c36a5fc678762c9c011~AwcPEc9HL1791317913epoutp01D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1657537709; bh=TPokgc8KiyKiXoT7NCkFEOk/43/FQR9MxdUyRi6+mZk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IiNv9mdUfdwa+nQIwKsNszwLGCQ0UpZjY40j9bhKUaNCX+D0cB4UIbNzTn8ig2Vpv hWAj+YzwMVxqroYQFK+IFqFCm5MTw+8tIvYIPDHeF7vjLHb4PFAFanKyO+9cKF4bap huiFxkAiIeXhCq8dei+GYwKebEnzbFNkhsGffBzw= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20220711110828epcas5p130ed5ecf71cb8427a86abc25beb9432d~AwcODpN8E1709317093epcas5p1O; Mon, 11 Jul 2022 11:08:28 +0000 (GMT) Received: from epsmges5p2new.samsung.com (unknown [182.195.38.182]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4LhLj46SHpz4x9Pv; Mon, 11 Jul 2022 11:08:24 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id AB.30.09566.8A40CC26; Mon, 11 Jul 2022 20:08:24 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20220711110824epcas5p22c8e945cb8c3c3ac46c8c2b5ab55db9b~AwcKN9xEX2363823638epcas5p2r; Mon, 11 Jul 2022 11:08:24 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220711110824epsmtrp163c8723a98b81f7851e41ea44ecb7772~AwcKNKTnl1261612616epsmtrp1D; Mon, 11 Jul 2022 11:08:24 +0000 (GMT) X-AuditID: b6c32a4a-ba3ff7000000255e-ba-62cc04a84df3 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 7E.89.08802.8A40CC26; Mon, 11 Jul 2022 20:08:24 +0900 (KST) Received: from localhost.localdomain (unknown [107.110.206.5]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20220711110820epsmtip2521d7a387b1bdcc51eb6f4dd6b6b3ffc~AwcG34GhO0331003310epsmtip2T; Mon, 11 Jul 2022 11:08:20 +0000 (GMT) From: Kanchan Joshi To: hch@lst.de, sagi@grimberg.me, kbusch@kernel.org, axboe@kernel.dk Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, asml.silence@gmail.com, joshiiitr@gmail.com, anuj20.g@samsung.com, gost.dev@samsung.com, Kanchan Joshi Subject: [PATCH for-next 3/4] io_uring: grow a field in struct io_uring_cmd Date: Mon, 11 Jul 2022 16:31:54 +0530 Message-Id: <20220711110155.649153-4-joshi.k@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220711110155.649153-1-joshi.k@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGJsWRmVeSWpSXmKPExsWy7bCmhu4KljNJBr8nGlk0TfjLbDFn1TZG i9V3+9ksbh7YyWSxcvVRJot3redYLI7+f8tmcf7tYSaLSYeuMVrsvaVtMX/ZU3aLda/fszjw eOycdZfd4/y9jSwel8+Wemxa1cnmsXlJvcfumw1sHn1bVjF6fN4kF8AR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2b5ab55db9b X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220711110824epcas5p22c8e945cb8c3c3ac46c8c2b5ab55db9b References: <20220711110155.649153-1-joshi.k@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220711_040831_971535_A637A3C1 X-CRM114-Status: GOOD ( 19.76 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org Use the leftover space to carve 'next' field that enables linking of io_uring_cmd structs. Also introduce a list head and few helpers. This is in preparation to support nvme-mulitpath, allowing multiple uring passthrough commands to be queued. Signed-off-by: Kanchan Joshi Signed-off-by: Anuj Gupta --- include/linux/io_uring.h | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/include/linux/io_uring.h b/include/linux/io_uring.h index 54063d67506b..d734599cbcd7 100644 --- a/include/linux/io_uring.h +++ b/include/linux/io_uring.h @@ -22,9 +22,14 @@ struct io_uring_cmd { const void *cmd; /* callback to defer completions to task context */ void (*task_work_cb)(struct io_uring_cmd *cmd); + struct io_uring_cmd *next; u32 cmd_op; - u32 pad; - u8 pdu[32]; /* available inline for free use */ + u8 pdu[28]; /* available inline for free use */ +}; + +struct ioucmd_list { + struct io_uring_cmd *head; + struct io_uring_cmd *tail; }; #if defined(CONFIG_IO_URING) @@ -54,6 +59,27 @@ static inline void io_uring_free(struct task_struct *tsk) if (tsk->io_uring) __io_uring_free(tsk); } + +static inline struct io_uring_cmd *ioucmd_list_get(struct ioucmd_list *il) +{ + struct io_uring_cmd *ioucmd = il->head; + + il->head = il->tail = NULL; + + return ioucmd; +} + +static inline void ioucmd_list_add(struct ioucmd_list *il, + struct io_uring_cmd *ioucmd) +{ + ioucmd->next = NULL; + + if (il->tail) + il->tail->next = ioucmd; + else + il->head = ioucmd; + il->tail = ioucmd; +} #else static inline void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret, ssize_t ret2) @@ -80,6 +106,14 @@ static inline const char *io_uring_get_opcode(u8 opcode) { return ""; } +static inline struct io_uring_cmd *ioucmd_list_get(struct ioucmd_list *il) +{ + return NULL; +} +static inline void ioucmd_list_add(struct ioucmd_list *il, + struct io_uring_cmd *ioucmd) +{ +} #endif #endif -- 2.25.1