[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4c5e97c4-2311-4a4f-9340-5e4a1c7d0e2b@linux.dev>
Date: Mon, 10 Mar 2025 18:21:45 -0700
From: Martin KaFai Lau <martin.lau@...ux.dev>
To: Jason Xing <kerneljasonxing@...il.com>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, dsahern@...nel.org, ast@...nel.org, daniel@...earbox.net,
andrii@...nel.org, eddyz87@...il.com, song@...nel.org,
yonghong.song@...ux.dev, john.fastabend@...il.com, kpsingh@...nel.org,
sdf@...ichev.me, haoluo@...gle.com, jolsa@...nel.org, horms@...nel.org,
kuniyu@...zon.com, ncardwell@...gle.com, bpf@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH net-next 2/5] tcp: bpf: support bpf_getsockopt for
TCP_BPF_DELACK_MAX
On 3/9/25 5:30 AM, Jason Xing wrote:
> Support bpf_getsockopt if application tries to know what the delayed ack
> max time is.
>
> Signed-off-by: Jason Xing <kerneljasonxing@...il.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);
There are three TCP_BPF_* specific optnames supported by bpf_getsockopt now.
Please take this chance to create a bpf_sol_tcp_getsockopt and refactor the
existing bpf_getsockopt(TCP_BPF_SOCK_OPS_CB_FLAGS) support into it also. The new
bpf_sol_tcp_getsockopt can reject the TCP_BPF_IW and TCP_BPF_SNDCWND_CLAMP.
Powered by blists - more mailing lists