From: Jason Xing <kerneljasonxing@gmail.com>
To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, dsahern@kernel.org, ast@kernel.org,
daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev,
eddyz87@gmail.com, song@kernel.org, yonghong.song@linux.dev,
john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me,
haoluo@google.com, jolsa@kernel.org, horms@kernel.org,
kuniyu@amazon.com, ncardwell@google.com
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org,
Jason Xing <kerneljasonxing@gmail.com>
Subject: [PATCH net-next 2/5] tcp: bpf: support bpf_getsockopt for TCP_BPF_DELACK_MAX
Date: Sun, 9 Mar 2025 13:30:01 +0100 [thread overview]
Message-ID: <20250309123004.85612-3-kerneljasonxing@gmail.com> (raw)
In-Reply-To: <20250309123004.85612-1-kerneljasonxing@gmail.com>
Support bpf_getsockopt if application tries to know what the delayed ack
max time is.
Signed-off-by: Jason Xing <kerneljasonxing@gmail.com>
---
net/core/filter.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/net/core/filter.c b/net/core/filter.c
index 31aef259e104..5564917e0c6d 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -5415,6 +5415,17 @@ static int sol_tcp_sockopt(struct sock *sk, int optname,
if (*optlen < 1)
return -EINVAL;
break;
+ case TCP_BPF_DELACK_MAX:
+ if (*optlen != sizeof(int))
+ return -EINVAL;
+ if (getopt) {
+ int delack_max = inet_csk(sk)->icsk_delack_max;
+ int delack_max_us = jiffies_to_usecs(delack_max);
+
+ memcpy(optval, &delack_max_us, *optlen);
+ return 0;
+ }
+ return bpf_sol_tcp_setsockopt(sk, optname, optval, *optlen);
case TCP_BPF_RTO_MIN:
if (*optlen != sizeof(int))
return -EINVAL;
--
2.43.5
next prev parent reply other threads:[~2025-03-09 12:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-09 12:29 [PATCH net-next 0/5] tcp: add some RTO MIN and DELACK MAX Jason Xing
2025-03-09 12:30 ` [PATCH net-next 1/5] tcp: bpf: support bpf_getsockopt for TCP_BPF_RTO_MIN Jason Xing
2025-03-09 12:30 ` Jason Xing [this message]
2025-03-11 1:21 ` [PATCH net-next 2/5] tcp: bpf: support bpf_getsockopt for TCP_BPF_DELACK_MAX Martin KaFai Lau
2025-03-11 4:50 ` Jason Xing
2025-03-09 12:30 ` [PATCH net-next 3/5] tcp: support TCP_RTO_MIN_US for set/getsockopt use Jason Xing
2025-03-09 12:30 ` [PATCH net-next 4/5] tcp: support TCP_DELACK_MAX_US " Jason Xing
2025-03-09 12:30 ` [PATCH net-next 5/5] selftests: add bpf_set/getsockopt() for TCP_BPF_DELACK_MAX and TCP_BPF_RTO_MIN Jason Xing
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=20250309123004.85612-3-kerneljasonxing@gmail.com \
--to=kerneljasonxing@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=eddyz87@gmail.com \
--cc=edumazet@google.com \
--cc=haoluo@google.com \
--cc=horms@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@amazon.com \
--cc=martin.lau@linux.dev \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/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;
as well as URLs for NNTP newsgroup(s).