From nobody Thu Nov 27 12:37:14 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D9A6A3195E8 for ; Wed, 26 Nov 2025 10:40:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764153624; cv=none; b=XtkFMWXz4cunePjfFnT5iz7QlYxeo+EJM6VUUVHs0nAlvuvohCLGjxcbnJZCJcugswYL/uURPdzyFLKNVWkD5AjW7fCSh7bTxIMRnTWdafxSgB7ZaXBhwxAfLLCa3+21TwMeex29iZs2D1WVPCjnQewV4e2aka0rWh5C8eOqVQc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764153624; c=relaxed/simple; bh=f0bZ6fi6QDswjUjdbSGNtKIAgYgslReMqzgUE2cGTi4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EtJYhkrW6yibIfm+s4G9oFjLFCBKSqcgoQ8ONoNlxyb6IaFG98lzssfLPRv8wiFQbFoNIzF+EzyJrWBDfaBn/gZkW2OuvL35jts+qn1D/VUtBxqAem5rKOaKnP/5rs5Pdr5KO/n7fKk5uRnbvNfyNItYrECegJ86LGuu69KIpIM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AvL40phD; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AvL40phD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73E7BC116D0; Wed, 26 Nov 2025 10:40:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764153624; bh=f0bZ6fi6QDswjUjdbSGNtKIAgYgslReMqzgUE2cGTi4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AvL40phDzGkGJp/GOx7mp6aSeCey7+jQBGz3TRYHORW7cRVrH3TtMkc5pEmLWFFNz qe8qPfTdf3GrNdLtGgwNSwCr1KBe/HdfPAAHoXSwpk5uAzU1GNqPGmpEen9wezqqbJ euX6bydXkWX8DLxeFQAB8F7wxFcy72Z2e19jah1ZSN9+99xl2acBb2BxpL1tbbqBAj VYA6s4mZZPtqcsYm17Mmsxjw3y+Ik1ulGeRcp5mkbLY8HNmUu+UuQ0wGWhe49hBTxx z64XhmLIZWvum8m0XW9TGI7kV4KgDVAqO9KszAQD44s8ksMSQs9TZ1z23HpUt1alfD wjG7FrhN0pcvQ== From: Geliang Tang To: mptcp@lists.linux.dev, hare@suse.de, hare@kernel.org Cc: Geliang Tang , Paolo Abeni , Hui Zhu , Gang Yan , zhenwei pi Subject: [RFC mptcp-next v2 1/7] mptcp: allow overridden write_space to be invoked Date: Wed, 26 Nov 2025 18:39:58 +0800 Message-ID: <6e185e586ee731d83ae6fb44254bfee7e3074f51.1764152990.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.51.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang NVMe overrides its own sk_write_space functions. This patch ensures that the overridden sk_write_space can be invoked by MPTCP. Suggested-by: Paolo Abeni Co-developed-by: Hui Zhu Signed-off-by: Hui Zhu Co-developed-by: Gang Yan Signed-off-by: Gang Yan Co-developed-by: zhenwei pi Signed-off-by: zhenwei pi Signed-off-by: Geliang Tang --- net/mptcp/protocol.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 199f28f3dd5e..483143e2d0b5 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -973,7 +973,7 @@ static inline void mptcp_write_space(struct sock *sk) /* pairs with memory barrier in mptcp_poll */ smp_mb(); if (mptcp_stream_memory_free(sk, 1)) - sk_stream_write_space(sk); + INDIRECT_CALL_1(sk->sk_write_space, sk_stream_write_space, sk); } =20 static inline void __mptcp_sync_sndbuf(struct sock *sk) --=20 2.51.0 From nobody Thu Nov 27 12:37:14 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 029EA3195E8 for ; Wed, 26 Nov 2025 10:40:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764153628; cv=none; b=CnhfvotHq4fTMmsCzk2fICyJ33qDojHJ4J/pZmFQ51/cOC7t12q6hvQbmLyPqPFavX7GK2uHSoUV12JIz+/3+IOHK7+eDVhIWGTTMa1r6OlLyjKUbTOcinYbN+osfhJC0ogzdH9vBRKLf5Fd9GGZSiUZJ4i2DPnbGCxWFgS7mN0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764153628; c=relaxed/simple; bh=3y0gLlhhbc5UrU+QOBiG/fxqKbQWulPa+7KuNAMJYnU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Xo6Dhd/IvAl8FURhUzmyrnrt0LLby6miHP7U66AuPIuuQFxBN3kxVsIVS4jBP096nhCehFjw/oDHkTYMFC4ReCT/Ktbsp4bxOj4u9xYxxZxx4pAVzKiwjidmxPfDruYmiXG/HzCs9PzUcMVtV1ikSBFiN2ZwESVwkXjpl22d3lU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=o3GERNrw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="o3GERNrw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EB57C116D0; Wed, 26 Nov 2025 10:40:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764153627; bh=3y0gLlhhbc5UrU+QOBiG/fxqKbQWulPa+7KuNAMJYnU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o3GERNrw7Aqka5vkTwOVGdM868WVQGPcYuhc8S9F2wEd1d7+Jddy1Vbe/ra0S/xDT Uzb/MVnTdQp18TYcyRZ++XlBIfzWOJvZciZSMoKXzuxpku99h2mvchWZEXWpdVCM3p ue54988E7BUdwiw4xE6Rz0QDXvi049AP3MN9LfZAaeKxIY5rlNZpGiLXWGn1P3BPDS qVw7ce1wLWYtIN6Jdr+q+F/77LggydkqC7JvdFjcVb0cKPT9V48Sm+dK/lAyoduGr0 O3lTRMT9B7pCQd9qzcAYsOFDIi/txe9MtQEL8L0+WbiohSGxdKJyNMLb0DUvyeuvH8 0yAq0nr/KqEpw== From: Geliang Tang To: mptcp@lists.linux.dev, hare@suse.de, hare@kernel.org Cc: Geliang Tang , Hui Zhu , Gang Yan , zhenwei pi Subject: [RFC mptcp-next v2 2/7] mptcp: add sock_set_reuseaddr Date: Wed, 26 Nov 2025 18:39:59 +0800 Message-ID: X-Mailer: git-send-email 2.51.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang Implement an MPTCP sock_set_nodelay helper, which will be used for NVMe over MPTCP. Using tcp_sock_set_nodelay() with MPTCP will cause list corruption: nvmet: adding nsid 1 to subsystem nqn.2014-08.org.nvmexpress.mptcpdev nvmet_tcp: enabling port 1234 (127.0.0.1:4420) slab MPTCP start ffff8880108f0b80 pointer offset 2480 size 2816 list_add corruption. prev->next should be next (ffff8880108f1530), but was ffff8885108f1530. (prev=3Dffff8880108f1530). ------------[ cut here ]------------ kernel BUG at lib/list_debug.c:32! Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI CPU: 1 UID: 0 PID: 182 Comm: nvme Not tainted 6.16.0-rc3+ #1 PREEMPT(full) Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 Co-developed-by: Hui Zhu Signed-off-by: Hui Zhu Co-developed-by: Gang Yan Signed-off-by: Gang Yan Co-developed-by: zhenwei pi Signed-off-by: zhenwei pi Signed-off-by: Geliang Tang --- include/net/mptcp.h | 4 ++++ net/mptcp/protocol.c | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/net/mptcp.h b/include/net/mptcp.h index 4cf59e83c1c5..c7bf444eee56 100644 --- a/include/net/mptcp.h +++ b/include/net/mptcp.h @@ -237,6 +237,8 @@ static inline __be32 mptcp_reset_option(const struct sk= _buff *skb) } =20 void mptcp_active_detect_blackhole(struct sock *sk, bool expired); + +void mptcp_sock_set_reuseaddr(struct sock *sk); #else =20 static inline void mptcp_init(void) @@ -323,6 +325,8 @@ static inline struct request_sock *mptcp_subflow_reqsk_= alloc(const struct reques static inline __be32 mptcp_reset_option(const struct sk_buff *skb) { retu= rn htonl(0u); } =20 static inline void mptcp_active_detect_blackhole(struct sock *sk, bool exp= ired) { } + +static inline void mptcp_sock_set_reuseaddr(struct sock *sk) { } #endif /* CONFIG_MPTCP */ =20 #if IS_ENABLED(CONFIG_MPTCP_IPV6) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index f9a544e31637..21067245a8f5 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -3764,6 +3764,21 @@ static void mptcp_sock_check_graft(struct sock *sk, = struct sock *ssk) } } =20 +void mptcp_sock_set_reuseaddr(struct sock *sk) +{ + struct mptcp_sock *msk =3D mptcp_sk(sk); + struct sock *ssk; + + lock_sock(sk); + ssk =3D __mptcp_nmpc_sk(msk); + if (IS_ERR(ssk)) + goto unlock; + ssk->sk_reuse =3D SK_CAN_REUSE; +unlock: + release_sock(sk); +} +EXPORT_SYMBOL(mptcp_sock_set_reuseaddr); + bool mptcp_finish_join(struct sock *ssk) { struct mptcp_subflow_context *subflow =3D mptcp_subflow_ctx(ssk); --=20 2.51.0 From nobody Thu Nov 27 12:37:14 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1724C315D32 for ; Wed, 26 Nov 2025 10:40:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764153631; cv=none; b=sM1+TCzMo6yIHPBqg1vWbpFhB7+1KPmM7Wtf7XfZmlM2gTqMsc+W5WYKx9zdoj9JBtpwzYmjw4Np+f2tZwEVBHD8FbBM0eIhQ7TqLICZdyO+KKc4RF6bDenJdahz/OqIGXq9hs6GQhZoX9b+ewM3aTrp382BLqd9t+IPur5ulKg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764153631; c=relaxed/simple; bh=sj/rDpT3m39PBkRW4dkQHD46hWmrQGYW4HnSuwUyocg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kzxBtPE6rHHV/VSdxh/IO1YISYTGIkHHFNdtIA9+1Q7sjZbgjfLSI6IJujN9cjQ2WLIrj9nlYKp9vBABANHJ1m8531APrVYpHB/lfC1JAQOOSMlebfF3jFm1WYVJ5bT5f8HUD1AtCTJBh+gZBLYS01hrnRZRdRY8+xCyv6u+A6g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=omv9sInZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="omv9sInZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39017C113D0; Wed, 26 Nov 2025 10:40:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764153630; bh=sj/rDpT3m39PBkRW4dkQHD46hWmrQGYW4HnSuwUyocg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=omv9sInZW+y5OHnIa7GEWTCLMQPp7isONEICCPILJBnBqhQduu8pFLZ8lBeZELrh/ 9yenNlz7lkA65jKXlz7anAdo5+heIc005KsPlzgAzUP5o0WaabS6FRSdAkiJqGmpGl FCATizJ7I0ex7IaS/u6cdVgZpX4ieisS9QvVcvXwwZJOSOVemAJME5pXmz98Pia88I Wkqa6O/4Hs1TrmmLIY5Xu8Wg2DTDkXrPX2CB+k6ItbNJABaobYqbRczAZSlv0MMWlw n3dN4gyp6nSaJ3SH52BQM8R9xTXaKndODgSZCuY6sxCSPl0q2h7PdowU9cVa5LF3OP x7lRyf8L/avtg== From: Geliang Tang To: mptcp@lists.linux.dev, hare@suse.de, hare@kernel.org Cc: Geliang Tang , Hui Zhu , Gang Yan , zhenwei pi Subject: [RFC mptcp-next v2 3/7] mptcp: add sock_set_nodelay Date: Wed, 26 Nov 2025 18:40:00 +0800 Message-ID: <8d655baf1d091f6960c4ed815d20b4a7f6eb0414.1764152990.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.51.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang Implement an MPTCP-specific sock_set_nodelay helper, which will be used for NVMe over MPTCP. Co-developed-by: Hui Zhu Signed-off-by: Hui Zhu Co-developed-by: Gang Yan Signed-off-by: Gang Yan Co-developed-by: zhenwei pi Signed-off-by: zhenwei pi Signed-off-by: Geliang Tang --- include/net/mptcp.h | 4 ++++ net/mptcp/protocol.c | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/net/mptcp.h b/include/net/mptcp.h index c7bf444eee56..4fc8f08c6588 100644 --- a/include/net/mptcp.h +++ b/include/net/mptcp.h @@ -239,6 +239,8 @@ static inline __be32 mptcp_reset_option(const struct sk= _buff *skb) void mptcp_active_detect_blackhole(struct sock *sk, bool expired); =20 void mptcp_sock_set_reuseaddr(struct sock *sk); + +void mptcp_sock_set_nodelay(struct sock *sk); #else =20 static inline void mptcp_init(void) @@ -327,6 +329,8 @@ static inline __be32 mptcp_reset_option(const struct sk= _buff *skb) { return hto static inline void mptcp_active_detect_blackhole(struct sock *sk, bool exp= ired) { } =20 static inline void mptcp_sock_set_reuseaddr(struct sock *sk) { } + +static inline void mptcp_sock_set_nodelay(struct sock *sk) { } #endif /* CONFIG_MPTCP */ =20 #if IS_ENABLED(CONFIG_MPTCP_IPV6) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 21067245a8f5..9790bc74a0b7 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -3779,6 +3779,24 @@ void mptcp_sock_set_reuseaddr(struct sock *sk) } EXPORT_SYMBOL(mptcp_sock_set_reuseaddr); =20 +void mptcp_sock_set_nodelay(struct sock *sk) +{ + struct mptcp_sock *msk =3D mptcp_sk(sk); + struct sock *ssk; + + lock_sock(sk); + ssk =3D __mptcp_nmpc_sk(msk); + if (IS_ERR(ssk)) + goto unlock; + + lock_sock(ssk); + __tcp_sock_set_nodelay(ssk, true); + release_sock(ssk); +unlock: + release_sock(sk); +} +EXPORT_SYMBOL(mptcp_sock_set_nodelay); + bool mptcp_finish_join(struct sock *ssk) { struct mptcp_subflow_context *subflow =3D mptcp_subflow_ctx(ssk); --=20 2.51.0 From nobody Thu Nov 27 12:37:15 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C23FB315D32 for ; Wed, 26 Nov 2025 10:40:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764153634; cv=none; b=Y094U1B8LNG/zW6UFOBSzy1yb6W+FnpJLegjg1chZnnNwmBc4zbzkzWL7VSH3eNyAUI5DTkm3KiC3WvJM6TtY3c9YPL4sDga9MNqZGniGqGagmA53N7hmapMxsoeBNWHH08T19/EYee7C698UJxN/bT3ViLVc2qzgjA+P3sPago= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764153634; c=relaxed/simple; bh=Hi14LHZtxQEAHLn+tqtbzmJxVrY1bXTCr/ijW47AWlk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tLpi3Gb2Wwm6An8moQmNXqqWyVLOn9icwcC3sIvm0dCHMGxuqyYpZp6UEQTBLUp5b8LSniTZcZrRaiN+uZ3gxWe6TSvuYKuvp50e3SMbAKSmfBT8IAs5EWiXQtndsHO5h4ARd8TwX/oQwa4qFUMVgvuAuuIC+kgZfqBCGd4zFX4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=s0nBRtyS; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="s0nBRtyS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9578AC116D0; Wed, 26 Nov 2025 10:40:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764153634; bh=Hi14LHZtxQEAHLn+tqtbzmJxVrY1bXTCr/ijW47AWlk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s0nBRtyS5Kx8B2uNIsR3+dxH5RJ3d5YbEIG1j6tafoayrf7yR2lMB4S1lSW6VZHCh JO7K8F84kkMtpy7M9l4lEq2TtVvI8D7L5rBM5RqTgb5kSQOF/oA1iPv1rxyFq07D+5 /hYhvfWqhuOKYHGRnFYPv1d6U7v+BzJ5QLc+TEHQrolOm868Vycs71A71Rq6sqZTxF oAh1e/PIQoj5CjLEyLQE+ILyKXPmv3VOXUjAcxWY3tB/jpG6n4pa19onZpGaiz0zP4 DE4wOZt2fNsukBLcjKPhho/R8jC5W9jqsj9vokMBvYdrn+bRnWbYQE4CIIRemUvNEQ fewwx4n0ZScsA== From: Geliang Tang To: mptcp@lists.linux.dev, hare@suse.de, hare@kernel.org Cc: Geliang Tang , Hui Zhu , Gang Yan , zhenwei pi Subject: [RFC mptcp-next v2 4/7] nvmet-tcp: add mptcp support Date: Wed, 26 Nov 2025 18:40:01 +0800 Message-ID: <02bfd26ecf5c2dd9dff8c73138c5e002ae82fab9.1764152990.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.51.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang This patch adds a new nvme target transport type NVMF_TRTYPE_MPTCP for MPTCP. And defines a new nvmet_fabrics_ops named nvmet_mptcp_ops, which is almost the same as nvmet_tcp_ops except .type. Check if disc_addr.trtype is NVMF_TRTYPE_MPTCP in nvmet_tcp_add_port() to decide whether to pass IPPROTO_MPTCP to sock_create() to create a MPTCP socket instead of a TCP one. This new nvmet_fabrics_ops can be switched in nvmet_tcp_done_recv_pdu() according to different protocol. v2: - use trtype instead of tsas (Hannes). v3: - check mptcp protocol from disc_addr.trtype instead of passing a parameter (Hannes). v4: - check CONFIG_MPTCP. Co-developed-by: Hui Zhu Signed-off-by: Hui Zhu Co-developed-by: Gang Yan Signed-off-by: Gang Yan Co-developed-by: zhenwei pi Signed-off-by: zhenwei pi Signed-off-by: Geliang Tang --- drivers/nvme/target/configfs.c | 1 + drivers/nvme/target/tcp.c | 38 ++++++++++++++++++++++++++++++++-- include/linux/nvme.h | 1 + 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c index e44ef69dffc2..14c642cd458e 100644 --- a/drivers/nvme/target/configfs.c +++ b/drivers/nvme/target/configfs.c @@ -37,6 +37,7 @@ static struct nvmet_type_name_map nvmet_transport[] =3D { { NVMF_TRTYPE_RDMA, "rdma" }, { NVMF_TRTYPE_FC, "fc" }, { NVMF_TRTYPE_TCP, "tcp" }, + { NVMF_TRTYPE_MPTCP, "mptcp" }, { NVMF_TRTYPE_PCI, "pci" }, { NVMF_TRTYPE_LOOP, "loop" }, }; diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c index d543da09ef8e..a0a165d7f9cd 100644 --- a/drivers/nvme/target/tcp.c +++ b/drivers/nvme/target/tcp.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -212,6 +213,7 @@ static DEFINE_MUTEX(nvmet_tcp_queue_mutex); =20 static struct workqueue_struct *nvmet_tcp_wq; static const struct nvmet_fabrics_ops nvmet_tcp_ops; +static const struct nvmet_fabrics_ops nvmet_mptcp_ops; static void nvmet_tcp_free_cmd(struct nvmet_tcp_cmd *c); static void nvmet_tcp_free_cmd_buffers(struct nvmet_tcp_cmd *cmd); =20 @@ -1039,7 +1041,9 @@ static int nvmet_tcp_done_recv_pdu(struct nvmet_tcp_q= ueue *queue) req =3D &queue->cmd->req; memcpy(req->cmd, nvme_cmd, sizeof(*nvme_cmd)); =20 - if (unlikely(!nvmet_req_init(req, &queue->nvme_sq, &nvmet_tcp_ops))) { + if (unlikely(!nvmet_req_init(req, &queue->nvme_sq, + queue->sock->sk->sk_protocol =3D=3D IPPROTO_MPTCP ? + &nvmet_mptcp_ops : &nvmet_tcp_ops))) { pr_err("failed cmd %p id %d opcode %d, data_len: %d, status: %04x\n", req->cmd, req->cmd->common.command_id, req->cmd->common.opcode, @@ -2007,6 +2011,7 @@ static int nvmet_tcp_add_port(struct nvmet_port *npor= t) { struct nvmet_tcp_port *port; __kernel_sa_family_t af; + int proto =3D IPPROTO_TCP; int ret; =20 port =3D kzalloc(sizeof(*port), GFP_KERNEL); @@ -2027,6 +2032,11 @@ static int nvmet_tcp_add_port(struct nvmet_port *npo= rt) goto err_port; } =20 +#ifdef CONFIG_MPTCP + if (nport->disc_addr.trtype =3D=3D NVMF_TRTYPE_MPTCP) + proto =3D IPPROTO_MPTCP; +#endif + ret =3D inet_pton_with_scope(&init_net, af, nport->disc_addr.traddr, nport->disc_addr.trsvcid, &port->addr); if (ret) { @@ -2041,7 +2051,7 @@ static int nvmet_tcp_add_port(struct nvmet_port *npor= t) port->nport->inline_data_size =3D NVMET_TCP_DEF_INLINE_DATA_SIZE; =20 ret =3D sock_create(port->addr.ss_family, SOCK_STREAM, - IPPROTO_TCP, &port->sock); + proto, &port->sock); if (ret) { pr_err("failed to create a socket\n"); goto err_port; @@ -2050,7 +2060,11 @@ static int nvmet_tcp_add_port(struct nvmet_port *npo= rt) port->sock->sk->sk_user_data =3D port; port->data_ready =3D port->sock->sk->sk_data_ready; port->sock->sk->sk_data_ready =3D nvmet_tcp_listen_data_ready; + proto =3D=3D IPPROTO_MPTCP ? + mptcp_sock_set_reuseaddr(port->sock->sk) : sock_set_reuseaddr(port->sock->sk); + proto =3D=3D IPPROTO_MPTCP ? + mptcp_sock_set_nodelay(port->sock->sk) : tcp_sock_set_nodelay(port->sock->sk); if (so_priority > 0) sock_set_priority(port->sock->sk, so_priority); @@ -2193,6 +2207,19 @@ static const struct nvmet_fabrics_ops nvmet_tcp_ops = =3D { .host_traddr =3D nvmet_tcp_host_port_addr, }; =20 +static const struct nvmet_fabrics_ops nvmet_mptcp_ops =3D { + .owner =3D THIS_MODULE, + .type =3D NVMF_TRTYPE_MPTCP, + .msdbd =3D 1, + .add_port =3D nvmet_tcp_add_port, + .remove_port =3D nvmet_tcp_remove_port, + .queue_response =3D nvmet_tcp_queue_response, + .delete_ctrl =3D nvmet_tcp_delete_ctrl, + .install_queue =3D nvmet_tcp_install_queue, + .disc_traddr =3D nvmet_tcp_disc_port_addr, + .host_traddr =3D nvmet_tcp_host_port_addr, +}; + static int __init nvmet_tcp_init(void) { int ret; @@ -2206,6 +2233,12 @@ static int __init nvmet_tcp_init(void) if (ret) goto err; =20 + ret =3D nvmet_register_transport(&nvmet_mptcp_ops); + if (ret) { + nvmet_unregister_transport(&nvmet_tcp_ops); + goto err; + } + return 0; err: destroy_workqueue(nvmet_tcp_wq); @@ -2216,6 +2249,7 @@ static void __exit nvmet_tcp_exit(void) { struct nvmet_tcp_queue *queue; =20 + nvmet_unregister_transport(&nvmet_mptcp_ops); nvmet_unregister_transport(&nvmet_tcp_ops); =20 flush_workqueue(nvmet_wq); diff --git a/include/linux/nvme.h b/include/linux/nvme.h index 655d194f8e72..8069667ad47e 100644 --- a/include/linux/nvme.h +++ b/include/linux/nvme.h @@ -68,6 +68,7 @@ enum { NVMF_TRTYPE_RDMA =3D 1, /* RDMA */ NVMF_TRTYPE_FC =3D 2, /* Fibre Channel */ NVMF_TRTYPE_TCP =3D 3, /* TCP/IP */ + NVMF_TRTYPE_MPTCP =3D 4, /* Multipath TCP */ NVMF_TRTYPE_LOOP =3D 254, /* Reserved for host usage */ NVMF_TRTYPE_MAX, }; --=20 2.51.0 From nobody Thu Nov 27 12:37:15 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B84C6315D32 for ; Wed, 26 Nov 2025 10:40:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764153637; cv=none; b=DuXoIbWL3gb7M9mRAJDtlEhM8wM4qzqD3/z2mnkUIVcD+ZIeuzp8uHirkaL+7O5EAqOXsqMMTwAvx8NQnxeaYu+YkEYG+bbMinJlKqE6FeY/aSQKpFJPBTC3s3AWR7bw0d4zGOiLHu8fH5d91HGh/zM8Euw/Ow6HIvBZjrfs0Tw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764153637; c=relaxed/simple; bh=tKUDZjqve9JfGFOd55dQPXbJ6nfcGhBqJr3QWgLPxb8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jgT6wmXVKwi2HRoc/5cx81nP7A/Lv5fFLpFpg0se20v0QhqbnLN177WmraL4ntMMQ8mNPiqUTIiRwqimUmq5chBh5UfeAQf0Bs7srXQhtj6Hufw4mTkLRGJGRUdtoQoOpaO7ZjeLyRPxCjASZN49dFGYf/aLqQkPT34ljdLtnp0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PSvTT3dQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PSvTT3dQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F208EC116D0; Wed, 26 Nov 2025 10:40:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764153637; bh=tKUDZjqve9JfGFOd55dQPXbJ6nfcGhBqJr3QWgLPxb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PSvTT3dQgFBjohjqy6kRoXhcMPy38zoOexdA1ymCTJ8V25tdXTjTnudjqtx6CfSGM LRCYIJ3wihmBLU32YSTEjzLISgxkBRIQyBBE5czTmgLQ4kWryZcS2KoOsdARvcF0XP zVM94uVLCTz6r99WazepanxO79F6AlXcF/4XqoI5qE4smg2kt/k/S3uGRYgI5CBORx sblFXeAcURbswC7qHwrTGOib/aZSqawLk08ruw2yGHQ4cAE8HnwaJ886Kps1sytImv sBcBErudDj2WPIgIuHlY9a5Uv1UwMW8b2wuxc2y3RGiNg9eD2oJHaNPXJFVGYbWUWp u8ZnliN11Vf1w== From: Geliang Tang To: mptcp@lists.linux.dev, hare@suse.de, hare@kernel.org Cc: Geliang Tang , Hui Zhu , Gang Yan , zhenwei pi Subject: [RFC mptcp-next v2 5/7] mptcp: add sock_set_syncnt Date: Wed, 26 Nov 2025 18:40:02 +0800 Message-ID: <6f8fd94cf8d2b77e9c258f73c708e139e5e279b4.1764152990.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.51.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang Implement an MPTCP-specific sock_set_syncnt helper, which will be used for NVMe over MPTCP. Co-developed-by: Hui Zhu Signed-off-by: Hui Zhu Co-developed-by: Gang Yan Signed-off-by: Gang Yan Co-developed-by: zhenwei pi Signed-off-by: zhenwei pi Signed-off-by: Geliang Tang --- include/net/mptcp.h | 7 +++++++ net/mptcp/protocol.c | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/include/net/mptcp.h b/include/net/mptcp.h index 4fc8f08c6588..7d981973df48 100644 --- a/include/net/mptcp.h +++ b/include/net/mptcp.h @@ -241,6 +241,8 @@ void mptcp_active_detect_blackhole(struct sock *sk, boo= l expired); void mptcp_sock_set_reuseaddr(struct sock *sk); =20 void mptcp_sock_set_nodelay(struct sock *sk); + +int mptcp_sock_set_syncnt(struct sock *sk, int val); #else =20 static inline void mptcp_init(void) @@ -331,6 +333,11 @@ static inline void mptcp_active_detect_blackhole(struc= t sock *sk, bool expired) static inline void mptcp_sock_set_reuseaddr(struct sock *sk) { } =20 static inline void mptcp_sock_set_nodelay(struct sock *sk) { } + +static inline int mptcp_sock_set_syncnt(struct sock *sk, int val) +{ + return 0; +} #endif /* CONFIG_MPTCP */ =20 #if IS_ENABLED(CONFIG_MPTCP_IPV6) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 9790bc74a0b7..543fa3131af7 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -3797,6 +3797,25 @@ void mptcp_sock_set_nodelay(struct sock *sk) } EXPORT_SYMBOL(mptcp_sock_set_nodelay); =20 +int mptcp_sock_set_syncnt(struct sock *sk, int val) +{ + struct mptcp_sock *msk =3D mptcp_sk(sk); + struct sock *ssk; + + if (val < 1 || val > MAX_TCP_SYNCNT) + return -EINVAL; + + lock_sock(sk); + ssk =3D __mptcp_nmpc_sk(msk); + if (IS_ERR(ssk)) + goto unlock; + WRITE_ONCE(inet_csk(ssk)->icsk_syn_retries, val); +unlock: + release_sock(sk); + return 0; +} +EXPORT_SYMBOL(mptcp_sock_set_syncnt); + bool mptcp_finish_join(struct sock *ssk) { struct mptcp_subflow_context *subflow =3D mptcp_subflow_ctx(ssk); --=20 2.51.0 From nobody Thu Nov 27 12:37:15 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FCE1315D32 for ; Wed, 26 Nov 2025 10:40:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764153641; cv=none; b=Mcg4oaz2ERzpuUkRU4bOPQhOhufW1R9UquFzveMdAoCADFO9aVDFxkzpuZ/RUvrM13Td3qGw8TW9a1auetLqen/VUDWOhEjAyW/LlL3Ec0iIBUWl7jnTCF9Vwt5NlJK6Hb9zo/1kuK7iuf7/tV3Przg+b24vGnej9PV1gu1Auk8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764153641; c=relaxed/simple; bh=KYekCXu6h9LgasFVlG19fPW+uaPOT3kYPm5SImFbNXo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Tql5IC/rO1egIB1QMe9Rqmt3GtlxRT8WCU91WCVOVvGfHwxIbrVX0aiKfklahwINMhVmvZBmTF9qe1uHeSiILICSv+GkWczSxQMHOl1EXcpgcEJ2/wuvOST+P3wD6guTPz1vogVerkf3JMCJdDiaj6YCYalihRAhV92FpH/0NWI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tlIpPUoy; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tlIpPUoy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41880C113D0; Wed, 26 Nov 2025 10:40:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764153640; bh=KYekCXu6h9LgasFVlG19fPW+uaPOT3kYPm5SImFbNXo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tlIpPUoyHTtKyDBPP5+pG2YQhLIs+aK2OngNPIw4PeXr6A+1RtLgA8clKd7x91iwj GFn4sQYfz0ieO/S/hfQW/9i3r/RUp5mTq5kztkI5Sbha/lWfYq8zYDpJflG/atWbQH aY5LMxnO8VrfMJCOVqCYgFefG1vmWeDv7kZkZ3E4497QZ3t/4F9mba0WKFtzs5x+lA dJwLwTd+mu7q5QGzWGeay9t1Vze+/QFyTtq+2COqBqG5qa/E+zqt61h4TyrnWMojnC SUmHsQPZV/85O01DvdHGrgTTQXrmhbhWDK8WQM/KuQzaCUKl32sJmZ9twR7XRKInRQ 1UWfKrDfUDZxw== From: Geliang Tang To: mptcp@lists.linux.dev, hare@suse.de, hare@kernel.org Cc: Geliang Tang , Hui Zhu , Gang Yan , zhenwei pi Subject: [RFC mptcp-next v2 6/7] nvme-tcp: add mptcp support Date: Wed, 26 Nov 2025 18:40:03 +0800 Message-ID: <097198247ebe26f15e8e576715b756541aa135db.1764152990.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.51.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang This patch defines a new nvmf_transport_ops named nvme_mptcp_transport, which is almost the same as nvme_tcp_transport except .type. Check if opts->transport is "mptcp" in nvme_tcp_alloc_queue() to decide whether to pass IPPROTO_MPTCP to sock_create_kern() to create a MPTCP socket instead of a TCP one. v2: - use 'trtype' instead of '--mptcp' (Hannes) v3: - check mptcp protocol from opts->transport instead of passing a parameter (Hannes). v4: - check CONFIG_MPTCP. Co-developed-by: Hui Zhu Signed-off-by: Hui Zhu Co-developed-by: Gang Yan Signed-off-by: Gang Yan Co-developed-by: zhenwei pi Signed-off-by: zhenwei pi Signed-off-by: Geliang Tang --- drivers/nvme/host/tcp.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index 6795b8286c35..383e56ccc539 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -19,6 +19,7 @@ #include #include #include +#include =20 #include "nvme.h" #include "fabrics.h" @@ -1766,6 +1767,7 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nct= rl, int qid, { struct nvme_tcp_ctrl *ctrl =3D to_tcp_ctrl(nctrl); struct nvme_tcp_queue *queue =3D &ctrl->queues[qid]; + int proto =3D IPPROTO_TCP; int ret, rcv_pdu_size; struct file *sock_file; =20 @@ -1782,9 +1784,14 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nc= trl, int qid, queue->cmnd_capsule_len =3D sizeof(struct nvme_command) + NVME_TCP_ADMIN_CCSZ; =20 +#ifdef CONFIG_MPTCP + if (!strcmp(ctrl->ctrl.opts->transport, "mptcp")) + proto =3D IPPROTO_MPTCP; +#endif + ret =3D sock_create_kern(current->nsproxy->net_ns, ctrl->addr.ss_family, SOCK_STREAM, - IPPROTO_TCP, &queue->sock); + proto, &queue->sock); if (ret) { dev_err(nctrl->device, "failed to create socket: %d\n", ret); @@ -1801,9 +1808,13 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nc= trl, int qid, nvme_tcp_reclassify_socket(queue->sock); =20 /* Single syn retry */ + proto =3D=3D IPPROTO_MPTCP ? + mptcp_sock_set_syncnt(queue->sock->sk, 1) : tcp_sock_set_syncnt(queue->sock->sk, 1); =20 /* Set TCP no delay */ + proto =3D=3D IPPROTO_MPTCP ? + mptcp_sock_set_nodelay(queue->sock->sk) : tcp_sock_set_nodelay(queue->sock->sk); =20 /* @@ -3022,6 +3033,19 @@ static struct nvmf_transport_ops nvme_tcp_transport = =3D { .create_ctrl =3D nvme_tcp_create_ctrl, }; =20 +static struct nvmf_transport_ops nvme_mptcp_transport =3D { + .name =3D "mptcp", + .module =3D THIS_MODULE, + .required_opts =3D NVMF_OPT_TRADDR, + .allowed_opts =3D NVMF_OPT_TRSVCID | NVMF_OPT_RECONNECT_DELAY | + NVMF_OPT_HOST_TRADDR | NVMF_OPT_CTRL_LOSS_TMO | + NVMF_OPT_HDR_DIGEST | NVMF_OPT_DATA_DIGEST | + NVMF_OPT_NR_WRITE_QUEUES | NVMF_OPT_NR_POLL_QUEUES | + NVMF_OPT_TOS | NVMF_OPT_HOST_IFACE | NVMF_OPT_TLS | + NVMF_OPT_KEYRING | NVMF_OPT_TLS_KEY | NVMF_OPT_CONCAT, + .create_ctrl =3D nvme_tcp_create_ctrl, +}; + static int __init nvme_tcp_init_module(void) { unsigned int wq_flags =3D WQ_MEM_RECLAIM | WQ_HIGHPRI | WQ_SYSFS; @@ -3047,6 +3071,7 @@ static int __init nvme_tcp_init_module(void) atomic_set(&nvme_tcp_cpu_queues[cpu], 0); =20 nvmf_register_transport(&nvme_tcp_transport); + nvmf_register_transport(&nvme_mptcp_transport); return 0; } =20 @@ -3054,6 +3079,7 @@ static void __exit nvme_tcp_cleanup_module(void) { struct nvme_tcp_ctrl *ctrl; =20 + nvmf_unregister_transport(&nvme_mptcp_transport); nvmf_unregister_transport(&nvme_tcp_transport); =20 mutex_lock(&nvme_tcp_ctrl_mutex); --=20 2.51.0 From nobody Thu Nov 27 12:37:15 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD5CF315D32 for ; Wed, 26 Nov 2025 10:40:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764153643; cv=none; b=Hwd1cs9qJjqslKyXM6U0ATmejZBFc0MuZdcmTWg/z2/pRH661DDdBf2H2uiOnrxFtmbWZM9qgLaiJSIVzTsoXLPr56WBJw6e01LsEblUEnf7wRs4g10FHVLI42/HF6Vh9ON+k73DTWdpla2NSsAepL8c9gko4Tdelh5DmtfLuAE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764153643; c=relaxed/simple; bh=dlYaBnzAl12Sh2T2GTr08YjQU4JrBld5k3SNPL+Q0PA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rSSM5xOaaiuFx5pZc+hmRb0puo0yVNevxuR52v9Uv2/goOLFyhEqFNA1CsWwsD6cXejTpvEI4DLq2EqdsRDy2aU2LcWDU7Vk7h4syQRjgkdKUPMcA83R6yNVBmOWf/2V+HLgoqrlU+rbaT2FkSId7JCFgPGLS2Lk1kJl74k2TvI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WFuP127l; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WFuP127l" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60894C16AAE; Wed, 26 Nov 2025 10:40:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764153643; bh=dlYaBnzAl12Sh2T2GTr08YjQU4JrBld5k3SNPL+Q0PA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WFuP127lmC8kP8fpwFx1sd8gZhqh3xXeTkxYcUSHuoEVminPl8WYlAf29HNgyCqjS EKCdfn6cWEy+54sVNkg+juagIspkVb0tj7fq5z/uLrwDZneLF+9TyHwFN9vVb99/xn 36ZuwIyLsI9W0ToLcpBu6bxRcdbwlW6kZfQrT5QsB0LFXDMOaV17oaphmGeBLyzG0X 4Roajvlj1eHBoIMjOJ/s4ph/LKo+luf7CTvJrwFJT5Tn1o0WvJQPVdoLlRIiSb0XQK wrGckerOxhp39AFK8/ojOr2sOJMewUULuTOgr+UxiJ2DGe2eUYio3yBxPhJd4BCA+n jxQVfmIHCmHSQ== From: Geliang Tang To: mptcp@lists.linux.dev, hare@suse.de, hare@kernel.org Cc: Geliang Tang , Hui Zhu , Gang Yan , zhenwei pi Subject: [RFC mptcp-next v2 7/7] selftests: mptcp: add NVMe-over-MPTCP test Date: Wed, 26 Nov 2025 18:40:04 +0800 Message-ID: <846c2a8fad0ecd98edb5d3fe5e5356c6a709d858.1764152990.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.51.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang A test case for NVMe over MPTCP has been implemented. It verifies the proper functionality of nvme list, discover, connect, and disconnect commands. Additionally, read/write performance has been evaluated using fio. Co-developed-by: Hui Zhu Signed-off-by: Hui Zhu Co-developed-by: Gang Yan Signed-off-by: Gang Yan Co-developed-by: zhenwei pi Signed-off-by: zhenwei pi Signed-off-by: Geliang Tang --- tools/testing/selftests/net/mptcp/config | 7 + .../testing/selftests/net/mptcp/mptcp_nvme.sh | 120 ++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100755 tools/testing/selftests/net/mptcp/mptcp_nvme.sh diff --git a/tools/testing/selftests/net/mptcp/config b/tools/testing/selft= ests/net/mptcp/config index 59051ee2a986..0eee348eff8b 100644 --- a/tools/testing/selftests/net/mptcp/config +++ b/tools/testing/selftests/net/mptcp/config @@ -34,3 +34,10 @@ CONFIG_NFT_SOCKET=3Dm CONFIG_NFT_TPROXY=3Dm CONFIG_SYN_COOKIES=3Dy CONFIG_VETH=3Dy +CONFIG_CONFIGFS_FS=3Dy +CONFIG_NVME_CORE=3Dy +CONFIG_NVME_FABRICS=3Dy +CONFIG_NVME_TCP=3Dy +CONFIG_NVME_TARGET=3Dy +CONFIG_NVME_TARGET_TCP=3Dy +CONFIG_NVME_MULTIPATH=3Dy diff --git a/tools/testing/selftests/net/mptcp/mptcp_nvme.sh b/tools/testin= g/selftests/net/mptcp/mptcp_nvme.sh new file mode 100755 index 000000000000..1c24198003e2 --- /dev/null +++ b/tools/testing/selftests/net/mptcp/mptcp_nvme.sh @@ -0,0 +1,120 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +trtype=3D"${1:-mptcp}" +traddr=3D"${2:-127.0.0.1}" +ns=3D1 +port=3D1234 +trsvcid=3D4420 +nqn=3Dnqn.2014-08.org.nvmexpress.${trtype}dev +final_ret=3D0 + +#ip mptcp monitor & + +cleanup() +{ + rm -rf /sys/kernel/config/nvmet/ports/${port}/subsystems/${trtype}subsys + rmdir /sys/kernel/config/nvmet/ports/${port} + echo 0 > /sys/kernel/config/nvmet/subsystems/${nqn}/namespaces/${ns}/enab= le + echo -n 0 > /sys/kernel/config/nvmet/subsystems/${nqn}/namespaces/${ns}/d= evice_path + rmdir /sys/kernel/config/nvmet/subsystems/${nqn}/namespaces/${ns} + rmdir /sys/kernel/config/nvmet/subsystems/${nqn} + losetup -d /dev/loop100 + rm -rf /tmp/test.raw +} + +check_error() +{ + if dmesg | grep -E -q "starting error recovery|Buffer I/O error"; then + cleanup + exit 1 + fi +} + +dd if=3D/dev/zero of=3D/tmp/test.raw bs=3D1M count=3D0 seek=3D512 +losetup /dev/loop100 /tmp/test.raw +cd /sys/kernel/config/nvmet/subsystems +mkdir ${nqn} +cd ${nqn} +echo 1 > attr_allow_any_host +cd namespaces +mkdir ${ns} +cd ${ns} +echo /dev/loop100 > device_path +echo 1 > enable +cd /sys/kernel/config/nvmet/ports +mkdir ${port} +cd ${port} +echo ${trtype} > addr_trtype +echo ipv4 > addr_adrfam +echo ${traddr} > addr_traddr +echo ${trsvcid} > addr_trsvcid +cd subsystems +ln -s ../../../subsystems/${nqn} ${trtype}subsys + +echo +echo "nvme discover" +echo +nvme discover -t ${trtype} -a ${traddr} -s ${trsvcid} + +echo +echo "nvme connect" +echo +devname=3D$(nvme connect -t ${trtype} -a ${traddr} -s ${trsvcid} -n ${nqn}= | awk '{print $4}') +lret=3D$? +if [ $lret -ne 0 ]; then + final_ret=3D${lret} +fi +check_error + +sleep 0.5 +echo +echo "nvme list" +echo +nvme list +lret=3D$? +if [ $lret -ne 0 ]; then + final_ret=3D${lret} +fi +check_error + +echo +echo "fio randread" +echo +fio --name=3Dglobal --direct=3D1 --norandommap --randrepeat=3D0 --ioengine= =3Dlibaio \ + --thread=3D1 --blocksize=3D4k --runtime=3D10 --time_based --rw=3Drandr= ead --numjobs=3D4 \ + --iodepth=3D256 --group_reporting --size=3D100% --name=3Dlibaio_4_256_= 4k_randread \ + --filename=3D/dev/${devname}n1 +lret=3D$? +if [ $lret -ne 0 ]; then + final_ret=3D${lret} +fi +check_error + +echo +echo "fio randwrite" +echo +fio --name=3Dglobal --direct=3D1 --norandommap --randrepeat=3D0 --ioengine= =3Dlibaio \ + --thread=3D1 --blocksize=3D4k --runtime=3D10 --time_based --rw=3Drandw= rite --numjobs=3D4 \ + --iodepth=3D256 --group_reporting --size=3D100% --name=3Dlibaio_4_256_= 4k_randwrite \ + --filename=3D/dev/${devname}n1 +lret=3D$? +if [ $lret -ne 0 ]; then + final_ret=3D${lret} +fi +check_error + +sleep 0.5 +echo +echo "nvme disconnect" +echo +nvme disconnect -n ${nqn} +lret=3D$? +if [ $lret -ne 0 ]; then + final_ret=3D${lret} +fi +check_error + +cleanup +echo "final_ret=3D${final_ret}" +exit ${final_ret} --=20 2.51.0