From nobody Thu Apr 2 01:17:39 2026 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 D337E3EFD36 for ; Tue, 31 Mar 2026 10:28:52 +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=1774952932; cv=none; b=Kuq4iXIz3neaZyN3/g+sQYUf5htLqY34aG7ACAJgocB4n7McvO1G4TINbdBFiOd8mtH2HwbqReA1arbFCcjhzNX90T/y9leeY1a1bIL87v0b9KK1i1EmPoVcQfZmD7VX5mMfAZJ1B93Dnr7sbckq4e/C7+LVketUUXu+uWAdI7c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774952932; c=relaxed/simple; bh=4GEOfh62BsBFGONz1JD+59smDt+yIIMIoIYikAP2xLg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=I16+lfNUYev/tenWKE7RXLyFaWoi44gi4E41zcLTvkBYVpmHjBzU2fNmUWnl6aVHy/tjY5Wn+vAq1wZwYm37k8kFKRbjiRpnTs42a83BvjKYa9YeuwUaAnRTikvpFrgFV1KlnH10xQshTVkS5bWWbsJjrum+JMzKNeaqQUuTlhU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=c5knIY67; 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="c5knIY67" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5EAEC19423; Tue, 31 Mar 2026 10:28:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774952932; bh=4GEOfh62BsBFGONz1JD+59smDt+yIIMIoIYikAP2xLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c5knIY67VMVVqPxe5dD99oErUUICNMl8AR+wiwrQeecVcDIHIWBioA4hwtU04M0ts Y1Tk3wDYwbUA0ilLe0zgMq6/kCf80XRHHdw7RHghqbKAMWks4oJ3eKaGbgO5e0jt30 qEN7MbIu+YQfOuNs0Pcfdd/yN9OMPBiosO21SgWOh4VOg4kFqlM2Jwoee4lHOdru2w Vshe8V8ukLt5K/rA8vZZS9E8trQNXrj8iAlZnPi8fQTXJCHbwA5uZsn/Vj3E2hc8BI gb7K4vs4arXuEV+bZYycQQLSq9mURTkCQJiG3hGuJUjyU3B4MjmR4pbxo03LH16yKJ meB6JFOtZ/wTQ== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang , Hannes Reinecke , zhenwei pi , Hui Zhu , Gang Yan Subject: [RFC mptcp-next v7 6/7] nvme-tcp: register host mptcp transport Date: Tue, 31 Mar 2026 18:28:30 +0800 Message-ID: <89096187f25fd5fdecfe2fb8646fdb243b702c93.1774952107.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 and .allowed_opts. MPTCP currently does not support TLS. The four TLS-related options (NVMF_OPT_TLS, NVMF_OPT_KEYRING, NVMF_OPT_TLS_KEY, and NVMF_OPT_CONCAT) have been removed from allowed_opts. They will be added back once MPTCP TLS is supported. It is registered in nvme_tcp_init_module() and unregistered in nvme_tcp_cleanup_module(). A separate nvme_mptcp_ctrl_ops structure with .name =3D "mptcp" is defined and used for MPTCP controllers. A MODULE_ALIAS("nvme-mptcp") declaration alongside the other module metadata is added at the end of the file. v2: - use 'trtype' instead of '--mptcp' (Hannes) v3: - check mptcp protocol from opts->transport instead of passing a parameter (Hannes). v4: - check CONFIG_MPTCP. Cc: Hannes Reinecke Co-developed-by: zhenwei pi Signed-off-by: zhenwei pi Co-developed-by: Hui Zhu Signed-off-by: Hui Zhu Co-developed-by: Gang Yan Signed-off-by: Gang Yan Signed-off-by: Geliang Tang --- drivers/nvme/host/tcp.c | 44 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index f0ce09b0c142..c137fce4d358 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -2880,6 +2880,24 @@ static const struct nvme_ctrl_ops nvme_tcp_ctrl_ops = =3D { .get_virt_boundary =3D nvmf_get_virt_boundary, }; =20 +#ifdef CONFIG_MPTCP +static const struct nvme_ctrl_ops nvme_mptcp_ctrl_ops =3D { + .name =3D "mptcp", + .module =3D THIS_MODULE, + .flags =3D NVME_F_FABRICS | NVME_F_BLOCKING, + .reg_read32 =3D nvmf_reg_read32, + .reg_read64 =3D nvmf_reg_read64, + .reg_write32 =3D nvmf_reg_write32, + .subsystem_reset =3D nvmf_subsystem_reset, + .free_ctrl =3D nvme_tcp_free_ctrl, + .submit_async_event =3D nvme_tcp_submit_async_event, + .delete_ctrl =3D nvme_tcp_delete_ctrl, + .get_address =3D nvme_tcp_get_address, + .stop_ctrl =3D nvme_tcp_stop_ctrl, + .get_virt_boundary =3D nvmf_get_virt_boundary, +}; +#endif + static bool nvme_tcp_existing_controller(struct nvmf_ctrl_options *opts) { @@ -2920,6 +2938,7 @@ static const struct nvme_tcp_sockops nvme_mptcp_socko= ps =3D { static struct nvme_tcp_ctrl *nvme_tcp_alloc_ctrl(struct device *dev, struct nvmf_ctrl_options *opts) { + const struct nvme_ctrl_ops *ops; struct nvme_tcp_ctrl *ctrl; int ret; =20 @@ -2983,9 +3002,11 @@ static struct nvme_tcp_ctrl *nvme_tcp_alloc_ctrl(str= uct device *dev, =20 if (!strcmp(ctrl->ctrl.opts->transport, "tcp")) { ctrl->sockops =3D &nvme_tcp_sockops; + ops =3D &nvme_tcp_ctrl_ops; #ifdef CONFIG_MPTCP } else if (!strcmp(ctrl->ctrl.opts->transport, "mptcp")) { ctrl->sockops =3D &nvme_mptcp_sockops; + ops =3D &nvme_mptcp_ctrl_ops; #endif } else { ret =3D -EINVAL; @@ -2998,7 +3019,7 @@ static struct nvme_tcp_ctrl *nvme_tcp_alloc_ctrl(stru= ct device *dev, goto out_free_ctrl; } =20 - ret =3D nvme_init_ctrl(&ctrl->ctrl, dev, &nvme_tcp_ctrl_ops, 0); + ret =3D nvme_init_ctrl(&ctrl->ctrl, dev, ops, 0); if (ret) goto out_kfree_queues; =20 @@ -3065,6 +3086,20 @@ static struct nvmf_transport_ops nvme_tcp_transport = =3D { .create_ctrl =3D nvme_tcp_create_ctrl, }; =20 +#ifdef CONFIG_MPTCP +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, + .create_ctrl =3D nvme_tcp_create_ctrl, +}; +#endif + static int __init nvme_tcp_init_module(void) { unsigned int wq_flags =3D WQ_MEM_RECLAIM | WQ_HIGHPRI | WQ_SYSFS; @@ -3090,6 +3125,9 @@ static int __init nvme_tcp_init_module(void) atomic_set(&nvme_tcp_cpu_queues[cpu], 0); =20 nvmf_register_transport(&nvme_tcp_transport); +#ifdef CONFIG_MPTCP + nvmf_register_transport(&nvme_mptcp_transport); +#endif return 0; } =20 @@ -3097,6 +3135,9 @@ static void __exit nvme_tcp_cleanup_module(void) { struct nvme_tcp_ctrl *ctrl; =20 +#ifdef CONFIG_MPTCP + nvmf_unregister_transport(&nvme_mptcp_transport); +#endif nvmf_unregister_transport(&nvme_tcp_transport); =20 mutex_lock(&nvme_tcp_ctrl_mutex); @@ -3113,3 +3154,4 @@ module_exit(nvme_tcp_cleanup_module); =20 MODULE_DESCRIPTION("NVMe host TCP transport driver"); MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("nvme-mptcp"); --=20 2.51.0