[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250521225800.89218-1-kuniyu@amazon.com>
Date: Wed, 21 May 2025 15:57:59 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <jordan@...fe.io>
CC: <alexei.starovoitov@...il.com>, <bpf@...r.kernel.org>,
<daniel@...earbox.net>, <kuniyu@...zon.com>, <martin.lau@...ux.dev>,
<netdev@...r.kernel.org>, <willemdebruijn.kernel@...il.com>
Subject: Re: [PATCH v1 bpf-next 03/10] bpf: tcp: Get rid of st_bucket_done
From: Jordan Rife <jordan@...fe.io>
Date: Tue, 20 May 2025 07:50:50 -0700
> Get rid of the st_bucket_done field to simplify TCP iterator state and
> logic. Before, st_bucket_done could be false if bpf_iter_tcp_batch
> returned a partial batch; however, with the last patch ("bpf: tcp: Make
> sure iter->batch always contains a full bucket snapshot"),
> st_bucket_done == true is equivalent to iter->cur_sk == iter->end_sk.
>
> Signed-off-by: Jordan Rife <jordan@...fe.io>
> ---
> net/ipv4/tcp_ipv4.c | 14 ++++++--------
> 1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
> index 27022018194a..20730723a02c 100644
> --- a/net/ipv4/tcp_ipv4.c
> +++ b/net/ipv4/tcp_ipv4.c
> @@ -3020,7 +3020,6 @@ struct bpf_tcp_iter_state {
> unsigned int end_sk;
> unsigned int max_sk;
> struct sock **batch;
> - bool st_bucket_done;
> };
>
> struct bpf_iter__tcp {
> @@ -3043,8 +3042,10 @@ static int tcp_prog_seq_show(struct bpf_prog *prog, struct bpf_iter_meta *meta,
>
> static void bpf_iter_tcp_put_batch(struct bpf_tcp_iter_state *iter)
> {
> - while (iter->cur_sk < iter->end_sk)
> - sock_gen_put(iter->batch[iter->cur_sk++]);
> + unsigned int cur_sk = iter->cur_sk;
> +
> + while (cur_sk < iter->end_sk)
> + sock_gen_put(iter->batch[cur_sk++]);
Why is this chunk included in this patch ?
This is a bit confusing given bpf_iter_tcp_seq_next() proceeds
iter->cur_sk during sock_gen_put().
Otherwise looks good.
Reviewed-by: Kuniyuki Iwashima <kuniyu@...zon.com>
Powered by blists - more mailing lists