All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mingbao Sun <sunmingbao@tom.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@fb.com>,
	Sagi Grimberg <sagi@grimberg.me>,
	Chaitanya Kulkarni <kch@nvidia.com>,
	linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
	tyler.sun@dell.com, ping.gan@dell.com, yanxiu.cai@dell.com,
	libin.zhang@dell.com, ao.sun@dell.com
Subject: Re: [PATCH v2 2/2] nvme-tcp: support specifying the congestion-control
Date: Wed, 9 Mar 2022 15:32:33 +0800	[thread overview]
Message-ID: <20220309153136.000048e1@tom.com> (raw)
In-Reply-To: <20220309061442.GA31316@lst.de>

> > @@ -1447,6 +1449,21 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl,
> >  	if (nctrl->opts->tos >= 0)
> >  		ip_sock_set_tos(queue->sock->sk, nctrl->opts->tos);
> >  
> > +	if (nctrl->opts->mask & NVMF_OPT_TCP_CONGESTION) {
> > +		strncpy(ca_name, nctrl->opts->tcp_congestion,
> > +			TCP_CA_NAME_MAX-1);
> > +		optval = KERNEL_SOCKPTR(ca_name);
> > +		ret = sock_common_setsockopt(queue->sock, IPPROTO_TCP,
> > +					     TCP_CONGESTION, optval,
> > +					     strlen(ca_name));  
> 
> This needs to use kernel_setsockopt.  I also can see absolutely no
> need for the optval local variable, and I also don't really see why
> we need ca_name either - if we need to limit the length and terminate
> it (but why?) that can be done during option parsing.

Well, actually at the beginning I did use kernel_setsockopt.
But the compilation failed.

Then I found the API kernel_setsockopt disappeared from kernel v5.8.
So I use sock_common_setsockopt instead.
The birth of variable ca_name and optval is just because of the
the relevant definitions related to the prototype of
sock_common_setsockopt.

But now through thinking your comments and investigating the story of
the disappearance of kernel_setsockopt, I feel I should use
tcp_set_congestion_control instead of sock_common_setsockopt.
Just as target/tcp.c replaced kernel_setsockopt with ip_sock_set_tos.

As for the length limitation of the ca name, I will (if required) move
them into the phase of option parsing in the next version.


  reply	other threads:[~2022-03-09  7:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08 15:16 [PATCH v2 2/2] nvme-tcp: support specifying the congestion-control Mingbao Sun
2022-03-08 15:36 ` Mingbao Sun
2022-03-09  6:14 ` Christoph Hellwig
2022-03-09  7:32   ` Mingbao Sun [this message]
2022-03-09 13:41     ` Mingbao Sun
2022-03-10  8:19       ` Christoph Hellwig
2022-03-10  8:31         ` Mingbao Sun

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=20220309153136.000048e1@tom.com \
    --to=sunmingbao@tom.com \
    --cc=ao.sun@dell.com \
    --cc=axboe@fb.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=kch@nvidia.com \
    --cc=libin.zhang@dell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=ping.gan@dell.com \
    --cc=sagi@grimberg.me \
    --cc=tyler.sun@dell.com \
    --cc=yanxiu.cai@dell.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.