Re: [PATCH v2 1/3] ipv6: extract and export ip6_sock_set_tclass helpers

Jakub Kicinski <[email protected]>
Newsgroups dev.linux.lists.mptcp,org.infradead.lists.linux-nvme,org.kernel.vger.netdev
Message-ID <[email protected]>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.