From: Martin KaFai Lau <martin.lau@linux.dev>
To: Jordan Rife <jordan@jrife.io>
Cc: Daniel Borkmann <daniel@iogearbox.net>,
Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
Kuniyuki Iwashima <kuniyu@google.com>,
Alexei Starovoitov <alexei.starovoitov@gmail.com>,
Stanislav Fomichev <stfomichev@gmail.com>,
netdev@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH v4 bpf-next 12/12] selftests/bpf: Add tests for bucket resume logic in established sockets
Date: Tue, 8 Jul 2025 16:44:50 -0700 [thread overview]
Message-ID: <3c3a1640-16b6-47a8-b1a3-a90a594885af@linux.dev> (raw)
In-Reply-To: <20250707155102.672692-13-jordan@jrife.io>
On 7/7/25 8:51 AM, Jordan Rife wrote:
> +static void remove_seen_established(int family, int sock_type, const char *addr,
> + __u16 port, int *listen_socks,
> + int listen_socks_len, int *established_socks,
> + int established_socks_len,
> + struct sock_count *counts, int counts_len,
> + struct bpf_link *link, int iter_fd)
> +{
> + int close_idx;
> +
> + /* Iterate through all listening sockets. */
> + read_n(iter_fd, listen_socks_len, counts, counts_len);
> +
> + /* Make sure we saw all listening sockets exactly once. */
> + check_n_were_seen_once(listen_socks, listen_socks_len, listen_socks_len,
> + counts, counts_len);
> +
> + /* Leave one established socket. */
> + read_n(iter_fd, established_socks_len - 1, counts, counts_len);
> +
> + /* Close a socket we've already seen to remove it from the bucket. */
> + close_idx = get_nth_socket(established_socks, established_socks_len,
> + link, listen_socks_len + 1);
> + if (!ASSERT_GE(close_idx, 0, "close_idx"))
> + return;
> + destroy(established_socks[close_idx]);
> + established_socks[close_idx] = -1;
I may have missed where the fd is closed,
does it need to be close() first before assigning -1?
The set lgtm overall. Thanks for working on this.
next prev parent reply other threads:[~2025-07-08 23:45 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-07 15:50 [PATCH v4 bpf-next 00/12] bpf: tcp: Exactly-once socket iteration Jordan Rife
2025-07-07 15:50 ` [PATCH v4 bpf-next 01/12] bpf: tcp: Make mem flags configurable through bpf_iter_tcp_realloc_batch Jordan Rife
2025-07-07 15:50 ` [PATCH v4 bpf-next 02/12] bpf: tcp: Make sure iter->batch always contains a full bucket snapshot Jordan Rife
2025-07-08 23:16 ` Martin KaFai Lau
2025-07-08 23:30 ` Martin KaFai Lau
2025-07-07 15:50 ` [PATCH v4 bpf-next 03/12] bpf: tcp: Get rid of st_bucket_done Jordan Rife
2025-07-07 15:50 ` [PATCH v4 bpf-next 04/12] bpf: tcp: Use bpf_tcp_iter_batch_item for bpf_tcp_iter_state batch items Jordan Rife
2025-07-07 15:50 ` [PATCH v4 bpf-next 05/12] bpf: tcp: Avoid socket skips and repeats during iteration Jordan Rife
2025-07-07 15:50 ` [PATCH v4 bpf-next 06/12] selftests/bpf: Add tests for bucket resume logic in listening sockets Jordan Rife
2025-07-07 15:50 ` [PATCH v4 bpf-next 07/12] selftests/bpf: Allow for iteration over multiple ports Jordan Rife
2025-07-07 15:50 ` [PATCH v4 bpf-next 08/12] selftests/bpf: Allow for iteration over multiple states Jordan Rife
2025-07-07 15:50 ` [PATCH v4 bpf-next 09/12] selftests/bpf: Make ehash buckets configurable in socket iterator tests Jordan Rife
2025-07-07 15:50 ` [PATCH v4 bpf-next 10/12] selftests/bpf: Create established sockets " Jordan Rife
2025-07-07 15:50 ` [PATCH v4 bpf-next 11/12] selftests/bpf: Create iter_tcp_destroy test program Jordan Rife
2025-07-08 23:39 ` Martin KaFai Lau
2025-07-07 15:51 ` [PATCH v4 bpf-next 12/12] selftests/bpf: Add tests for bucket resume logic in established sockets Jordan Rife
2025-07-08 23:44 ` Martin KaFai Lau [this message]
2025-07-09 22:47 ` Jordan Rife
2025-07-07 18:31 ` [PATCH v4 bpf-next 00/12] bpf: tcp: Exactly-once socket iteration Stanislav Fomichev
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=3c3a1640-16b6-47a8-b1a3-a90a594885af@linux.dev \
--to=martin.lau@linux.dev \
--cc=alexei.starovoitov@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=jordan@jrife.io \
--cc=kuniyu@google.com \
--cc=netdev@vger.kernel.org \
--cc=stfomichev@gmail.com \
--cc=willemdebruijn.kernel@gmail.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;
as well as URLs for NNTP newsgroup(s).