Netdev List
 help / color / mirror / Atom feed
From: Sagi Grimberg <sagi@grimberg.me>
To: Geliang Tang <geliang@kernel.org>,
	Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@kernel.dk>,
	Christoph Hellwig <hch@lst.de>,
	Chaitanya Kulkarni <kch@nvidia.com>,
	David Ahern <dsahern@kernel.org>,
	Ido Schimmel <idosch@nvidia.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>, Hannes Reinecke <hare@suse.de>,
	Stanislav Fomichev <sdf@fomichev.me>
Cc: Geliang Tang <tanggeliang@kylinos.cn>,
	linux-nvme@lists.infradead.org, netdev@vger.kernel.org,
	mptcp@lists.linux.dev
Subject: Re: [PATCH v4 4/4] nvme-tcp: support IPv6 traffic class
Date: Sun, 23 Aug 2026 01:19:38 +0300	[thread overview]
Message-ID: <904ec61e-17e1-42f6-8215-63a806aeca76@grimberg.me> (raw)
In-Reply-To: <d6095cd3809af7addc44ed162d70d6327dc237ac.1786947923.git.tanggeliang@kylinos.cn>



On 18/08/2026 9:03, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> Currently, nvme-tcp host only supports setting the IPv4 TOS value when a
> TOS is specified, but does not handle the IPv6 traffic class.
>
> Extend the queue socket setup to handle AF_INET6 sockets by applying the
> TOS value to both IPv4 and IPv6 sockets. For IPv6, the TOS value is set
> as the IPv6 traffic class via IPV6_TCLASS using do_sock_setsockopt().
>
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
>   drivers/nvme/host/tcp.c | 20 ++++++++++++++++++++
>   1 file changed, 20 insertions(+)
>
> diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
> index 025cade370b2..5f30be04a9dd 100644
> --- a/drivers/nvme/host/tcp.c
> +++ b/drivers/nvme/host/tcp.c
> @@ -1815,6 +1815,17 @@ static int nvme_tcp_sock_set_tos(struct sock *sk, int tos)
>   				  KERNEL_SOCKPTR(&tos), sizeof(tos));
>   }
>   
> +static int nvme_tcp_sock_set_tclass(struct sock *sk, int tclass)
> +{
> +#if IS_ENABLED(CONFIG_IPV6)
> +	if (sk->sk_family == AF_INET6)
> +		return do_sock_setsockopt(sk->sk_socket, false, SOL_IPV6,
> +					  IPV6_TCLASS, KERNEL_SOCKPTR(&tclass),
> +					  sizeof(tclass));
> +#endif
> +	return 0;
> +}
> +
>   static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, int qid,
>   				key_serial_t pskid)
>   {
> @@ -1909,6 +1920,15 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, int qid,
>   				qid, ret);
>   			goto err_sock;
>   		}
> +
> +		ret = nvme_tcp_sock_set_tclass(queue->sock->sk,
> +					       nctrl->opts->tos);

Won't it just be cleaner to add a generic ip_sock_set_tclass() that 
hides the IS_ENABLED(CONFIG_IPV6) ifdef? Why do we need to wrap all 
these generic helpers?

      reply	other threads:[~2026-08-22 22:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18  6:02 [PATCH v4 0/4] nvme-tcp: add IPv6 traffic class support Geliang Tang
2026-08-18  6:03 ` [PATCH v4 1/4] nvmet-tcp: unify sockopt with do_sock_setsockopt Geliang Tang
2026-08-18  8:30   ` Hannes Reinecke
2026-08-19  9:04   ` Christoph Hellwig
2026-08-19 11:04     ` Breno Leitao
2026-08-19 13:23       ` Breno Leitao
2026-08-20 17:31     ` Jakub Kicinski
2026-08-18  6:03 ` [PATCH v4 2/4] nvme-tcp: " Geliang Tang
2026-08-18  6:03 ` [PATCH v4 3/4] nvmet-tcp: support IPv6 traffic class Geliang Tang
2026-08-18  6:03 ` [PATCH v4 4/4] nvme-tcp: " Geliang Tang
2026-08-22 22:19   ` Sagi Grimberg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=904ec61e-17e1-42f6-8215-63a806aeca76@grimberg.me \
    --to=sagi@grimberg.me \
    --cc=axboe@kernel.dk \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=geliang@kernel.org \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kbusch@kernel.org \
    --cc=kch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=mptcp@lists.linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    --cc=tanggeliang@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox