selftests/bpf: Add tests for bucket resume logic in listening sockets

Replicate the set of test cases used for UDP socket iterators to test
similar scenarios for TCP listening sockets.

Signed-off-by: Jordan Rife <jordan@jrife.io>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
This commit is contained in:
Jordan Rife 2025-07-14 11:09:10 -07:00 committed by Martin KaFai Lau
parent f5080f612a
commit da1d987d3b

View File

@ -358,6 +358,53 @@ static struct test_case resume_tests[] = {
.family = AF_INET6,
.test = force_realloc,
},
{
.description = "tcp: resume after removing a seen socket (listening)",
.init_socks = nr_soreuse,
.max_socks = nr_soreuse,
.sock_type = SOCK_STREAM,
.family = AF_INET6,
.test = remove_seen,
},
{
.description = "tcp: resume after removing one unseen socket (listening)",
.init_socks = nr_soreuse,
.max_socks = nr_soreuse,
.sock_type = SOCK_STREAM,
.family = AF_INET6,
.test = remove_unseen,
},
{
.description = "tcp: resume after removing all unseen sockets (listening)",
.init_socks = nr_soreuse,
.max_socks = nr_soreuse,
.sock_type = SOCK_STREAM,
.family = AF_INET6,
.test = remove_all,
},
{
.description = "tcp: resume after adding a few sockets (listening)",
.init_socks = nr_soreuse,
.max_socks = nr_soreuse,
.sock_type = SOCK_STREAM,
/* Use AF_INET so that new sockets are added to the head of the
* bucket's list.
*/
.family = AF_INET,
.test = add_some,
},
{
.description = "tcp: force a realloc to occur (listening)",
.init_socks = init_batch_size,
.max_socks = init_batch_size * 2,
.sock_type = SOCK_STREAM,
/* Use AF_INET6 so that new sockets are added to the tail of the
* bucket's list, needing to be added to the next batch to force
* a realloc.
*/
.family = AF_INET6,
.test = force_realloc,
},
};
static void do_resume_test(struct test_case *tc)