BPF List
 help / color / mirror / Atom feed
* [PATCH net] net: bpf: Use the protocol's set_rcvlowat behavior if there is one
@ 2022-08-04 15:04 gfree.wind
  2022-08-08 10:00 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: gfree.wind @ 2022-08-04 15:04 UTC (permalink / raw)
  To: martin.lau, daniel, john.fastabend, song, yhs, kpsingh, davem,
	edumazet, kuba, pabeni, bpf, netdev
  Cc: gfree.wind, Gao Feng

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-08 10:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-04 15:04 [PATCH net] net: bpf: Use the protocol's set_rcvlowat behavior if there is one gfree.wind
2022-08-08 10:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox