[PATCH v2 2/3] nvme-tcp: support IPv6 traffic class

Stanislav Fomichev sdf.kernel at gmail.com
Mon Aug 10 17:32:36 PDT 2026


On 08/08, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang at kylinos.cn>
> 
> The NVMe/TCP transport needs to configure the IPv6 traffic class on its
> queue sockets, but the fabrics option parser currently has no corresponding
> option.
> 
> Add the tclass option to the fabrics parser and store the validated value
> in struct nvmf_ctrl_options. Negative values are rejected, while values
> greater than 255 are clamped to 255, matching the valid range of the IPv6
> traffic class field.
> 
> Keep -1 as the default value to let the transport use its default traffic
> class.
> 
> The fabrics layer now supports parsing the tclass option, but the NVMe/TCP
> transport does not currently advertise or apply it.
> 
> Allow NVMe/TCP to use NVMF_OPT_TCLASS and set IPV6_TCLASS on each queue
> socket via ip6_sock_set_tclass() when a traffic class is specified, keeping
> the existing IPv4 TOS handling unchanged.
> 
> Signed-off-by: Geliang Tang <tanggeliang at kylinos.cn>
> ---
>  drivers/nvme/host/fabrics.c | 18 ++++++++++++++++++
>  drivers/nvme/host/fabrics.h |  3 +++
>  drivers/nvme/host/tcp.c     |  8 +++++++-
>  3 files changed, 28 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
> index ac3d4f400601..643c03dc7bcb 100644
> --- a/drivers/nvme/host/fabrics.c
> +++ b/drivers/nvme/host/fabrics.c
> @@ -695,6 +695,7 @@ static const match_table_t opt_tokens = {
>  	{ NVMF_OPT_NR_WRITE_QUEUES,	"nr_write_queues=%d"	},
>  	{ NVMF_OPT_NR_POLL_QUEUES,	"nr_poll_queues=%d"	},
>  	{ NVMF_OPT_TOS,			"tos=%d"		},
> +	{ NVMF_OPT_TCLASS,		"tclass=%d"		},

Do you really need new UAPI for v6? Any reason not to apply existing
NVMF_OPT_TOS to ipv6 sockets?



More information about the Linux-nvme mailing list