[PATCH mptcp-next v4 10/10] nvmet-tcp: support IPv6 traffic class
Geliang Tang <[email protected]> Thu, 30 Jul 2026 10:54:03 +0800
| Newsgroups | dev.linux.lists.mptcp |
|---|---|
| Message-ID | <0fa74e2213b703f9680ad053196e799cc7111f7b.1785378180.git.tanggeliang@kylinos.cn> |
From: Geliang Tang <[email protected]> nvmet-tcp currently applies the received IPv4 TOS value when setting up a queue socket, but does not handle the IPv6 traffic class. Extend the queue socket setup to handle AF_INET6 sockets. Obtain the traffic class from the IPv6 socket and apply it through IPV6_TCLASS. Keep the existing IPv4 TOS handling unchanged. Signed-off-by: Geliang Tang <[email protected]> --- drivers/nvme/target/tcp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c index 75a276d73be3..e775c4d3ede6 100644 --- a/drivers/nvme/target/tcp.c +++ b/drivers/nvme/target/tcp.c @@ -1725,6 +1725,14 @@ static int nvmet_tcp_set_queue_sock(struct nvmet_tcp_queue *queue) /* Set socket type of service */ if (inet->rcv_tos > 0) ip_sock_set_tos(sock->sk, inet->rcv_tos); +#if IS_ENABLED(CONFIG_IPV6) + if (sock->sk->sk_family == AF_INET6) { + struct ipv6_pinfo *np = inet6_sk(sock->sk); + + if (np->tclass > 0) + ip6_sock_set_tclass(sock->sk, np->tclass); + } +#endif ret = 0; write_lock_bh(&sock->sk->sk_callback_lock); -- 2.53.0