Re: [PATCH v2 2/2] nvme-tcp: support specifying the congestion-control

Mingbao Sun
2022-03-09T13:42:12Z

On Wed, 9 Mar 2022 15:32:33 +0800
Mingbao Sun <sunmingbao@tom.com> wrote:

> > > @@ -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.

Regards to the replacement of 'sock_common_setsockopt'.

Per the story of the deletion of 'kernel_setsockopt',
users of this API should switch to small functions that
implement setting a sockopt directly.

So I tried with 'tcp_set_congestion_control'.
But then I found this symbol is not exported yet.
Then I applied ‘EXPORT_SYMBOL_GPL(tcp_set_congestion_control);’
in my local source, and it works well in the testing.

Then what should I do with this?