[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230803130540.GA2792@bogon>
Date: Thu, 3 Aug 2023 21:05:40 +0800
From: Geliang Tang <geliang.tang@...e.com>
To: Simon Horman <horms@...nel.org>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>, Song Liu <song@...nel.org>,
Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>, Stanislav Fomichev <sdf@...gle.com>,
Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
Florent Revest <revest@...omium.org>,
Brendan Jackman <jackmanb@...omium.org>,
Matthieu Baerts <matthieu.baerts@...sares.net>,
Mat Martineau <martineau@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
John Johansen <john.johansen@...onical.com>,
Paul Moore <paul@...l-moore.com>, James Morris <jmorris@...ei.org>,
"Serge E. Hallyn" <serge@...lyn.com>,
Stephen Smalley <stephen.smalley.work@...il.com>,
Eric Paris <eparis@...isplace.org>, Mykola Lysenko <mykolal@...com>,
Shuah Khan <shuah@...nel.org>, bpf@...r.kernel.org,
netdev@...r.kernel.org, mptcp@...ts.linux.dev,
apparmor@...ts.ubuntu.com, linux-security-module@...r.kernel.org,
selinux@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH bpf-next v8 1/4] bpf: Add update_socket_protocol hook
On Thu, Aug 03, 2023 at 02:53:38PM +0200, Simon Horman wrote:
> On Thu, Aug 03, 2023 at 03:30:39PM +0800, Geliang Tang wrote:
> > Add a hook named update_socket_protocol in __sys_socket(), for bpf
> > progs to attach to and update socket protocol. One user case is to
> > force legacy TCP apps to create and use MPTCP sockets instead of
> > TCP ones.
> >
> > Define a mod_ret set named bpf_mptcp_fmodret_ids, add the hook
> > update_socket_protocol into this set, and register it in
> > bpf_mptcp_kfunc_init().
> >
> > Signed-off-by: Geliang Tang <geliang.tang@...e.com>
>
> ...
>
> > diff --git a/net/socket.c b/net/socket.c
> > index 2b0e54b2405c..586a437d7a5e 100644
> > --- a/net/socket.c
> > +++ b/net/socket.c
> > @@ -1644,11 +1644,36 @@ struct file *__sys_socket_file(int family, int type, int protocol)
> > return sock_alloc_file(sock, flags, NULL);
> > }
> >
> > +/**
>
> Hi Geliang Tang,
>
> nit: The format of the text below is not in kernel doc format,
> so it is probably better if the comment begins with '/*'
> rather than '/**'.
I do use '/*' here first, but got a checkpatch.pl warning:
./scripts/checkpatch.pl v8-0001-bpf-Add-update_socket_protocol-hook.patch
WARNING: networking block comments don't use an empty /* line, use /* Comment...
#63: FILE: net/socket.c:1648:
+/*
+ * A hook for bpf progs to attach to and update socket protocol.
total: 0 errors, 1 warnings, 0 checks, 59 lines checked
And I found that other comments in net/socket.c all begins with '/**'.
So I use '/**' here too.
Thanks,
-Geliang
>
> > + * A hook for bpf progs to attach to and update socket protocol.
> > + *
> > + * A static noinline declaration here could cause the compiler to
> > + * optimize away the function. A global noinline declaration will
> > + * keep the definition, but may optimize away the callsite.
> > + * Therefore, __weak is needed to ensure that the call is still
> > + * emitted, by telling the compiler that we don't know what the
> > + * function might eventually be.
> > + *
> > + * __diag_* below are needed to dismiss the missing prototype warning.
> > + */
>
> ...
Powered by blists - more mailing lists