[PATCH v4 1/4] nvmet-tcp: unify sockopt with do_sock_setsockopt
Christoph Hellwig
hch at lst.de
Wed Aug 19 02:04:39 PDT 2026
On Tue, Aug 18, 2026 at 02:03:00PM +0800, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang at kylinos.cn>
>
> This patch consolidates socket option settings in nvmet-tcp by utilizing
> the generic do_sock_setsockopt() helper for options including SO_LINGER,
> SO_PRIORITY, SO_REUSEADDR, TCP_NODELAY, and IP_TOS. This change eliminates
> the need to export and use specialized helpers for each individual socket
> option.
Hmm. I see that do_sock_setsockopt is exported, but it really should
not be. It's really just an internal helper exposed for io_uring
and no modular code should be using it (never mind the non-GPL export).
> A key benefit of this refactoring is that it decouples the socket option
> configuration from the underlying transport protocol. This makes it
> easier to extend nvmet-tcp to support other protocols, such as MPTCP, in
> the future, as do_sock_setsockopt() abstracts away protocol-specific
> differences without requiring per-option protocol-specific wrappers.
We really should have generic helpers in the networking code for this
and not duplicate them in driver using socket options.
More information about the Linux-nvme
mailing list