[PATCH v2 1/3] ipv6: extract and export ip6_sock_set_tclass helpers
Jakub Kicinski
kuba at kernel.org
Sat Aug 8 12:59:53 PDT 2026
On Sat, 8 Aug 2026 14:54:59 +0800 Geliang Tang wrote:
> IPV6_TCLASS handling in do_ipv6_setsockopt() inlines the same ECN mask
> logic and inet6_sk(sk)->tclass write that callers need when propagating
> a tclass value onto a newly created socket.
>
> Pull this into small helpers __ip6_sock_set_tclass()/ip6_sock_set_tclass()
> exported via <net/ipv6.h>, so external modules can apply IPV6_TCLASS
> without duplicating the ECN handling.
>
> __ip6_sock_set_tclass() will be used by MPTCP's sockopt implementation
> (similar to __ip_sock_set_tos),
not part of this series
> while ip6_sock_set_tclass() will be used
> by nvme-tcp (similar to ip_sock_set_tos).
setsockopt already supports generic kernel callers, sth like:
do_sock_setsockopt(sock, false, SOL_IPV6, IPV6_TCLASS,
KERNEL_SOCKPTR(&val), sizeof(val));
? Please don't export helpers for every single sockopt.
More information about the Linux-nvme
mailing list