From: gfree.wind@outlook.com
To: martin.lau@linux.dev, daniel@iogearbox.net,
john.fastabend@gmail.com, song@kernel.org, yhs@fb.com,
kpsingh@kernel.org, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, bpf@vger.kernel.org,
netdev@vger.kernel.org
Cc: gfree.wind@outlook.com, Gao Feng <gfree.wind@gmail.com>
Subject: [PATCH net] net: bpf: Use the protocol's set_rcvlowat behavior if there is one
Date: Thu, 4 Aug 2022 23:04:21 +0800 [thread overview]
Message-ID: <OSZP286MB140479B6DBDB0F13651A55F9959F9@OSZP286MB1404.JPNP286.PROD.OUTLOOK.COM> (raw)
From: Gao Feng <gfree.wind@gmail.com>
The commit d1361840f8c5 ("tcp: fix SO_RCVLOWAT and RCVBUF autotuning")
add one new (struct proto_ops)->set_rcvlowat method so that a protocol
can override the default setsockopt(SO_RCVLOWAT) behavior.
The prior bpf codes don't check and invoke the protos's set_rcvlowat,
now correct it.
Signed-off-by: Gao Feng <gfree.wind@gmail.com>
---
net/core/filter.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index 7950f7520765..beb6209897ab 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -5064,7 +5064,10 @@ static int _bpf_setsockopt(struct sock *sk, int level, int optname,
case SO_RCVLOWAT:
if (val < 0)
val = INT_MAX;
- WRITE_ONCE(sk->sk_rcvlowat, val ? : 1);
+ if (sk->sk_socket && sk->sk_socket->ops->set_rcvlowat)
+ ret = sk->sk_socket->ops->set_rcvlowat(sk, val);
+ else
+ WRITE_ONCE(sk->sk_rcvlowat, val ? : 1);
break;
case SO_MARK:
if (sk->sk_mark != val) {
--
2.25.1
next reply other threads:[~2022-08-04 15:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-04 15:04 gfree.wind [this message]
2022-08-08 10:00 ` [PATCH net] net: bpf: Use the protocol's set_rcvlowat behavior if there is one patchwork-bot+netdevbpf
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=OSZP286MB140479B6DBDB0F13651A55F9959F9@OSZP286MB1404.JPNP286.PROD.OUTLOOK.COM \
--to=gfree.wind@outlook.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gfree.wind@gmail.com \
--cc=john.fastabend@gmail.com \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=martin.lau@linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=song@kernel.org \
--cc=yhs@fb.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox