Skip to content

Commit da1d987

Browse files
jrifeMartin KaFai Lau
authored andcommitted
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 <[email protected]> Signed-off-by: Martin KaFai Lau <[email protected]> Acked-by: Stanislav Fomichev <[email protected]>
1 parent f5080f6 commit da1d987

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

tools/testing/selftests/bpf/prog_tests/sock_iter_batch.c

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,53 @@ static struct test_case resume_tests[] = {
358358
.family = AF_INET6,
359359
.test = force_realloc,
360360
},
361+
{
362+
.description = "tcp: resume after removing a seen socket (listening)",
363+
.init_socks = nr_soreuse,
364+
.max_socks = nr_soreuse,
365+
.sock_type = SOCK_STREAM,
366+
.family = AF_INET6,
367+
.test = remove_seen,
368+
},
369+
{
370+
.description = "tcp: resume after removing one unseen socket (listening)",
371+
.init_socks = nr_soreuse,
372+
.max_socks = nr_soreuse,
373+
.sock_type = SOCK_STREAM,
374+
.family = AF_INET6,
375+
.test = remove_unseen,
376+
},
377+
{
378+
.description = "tcp: resume after removing all unseen sockets (listening)",
379+
.init_socks = nr_soreuse,
380+
.max_socks = nr_soreuse,
381+
.sock_type = SOCK_STREAM,
382+
.family = AF_INET6,
383+
.test = remove_all,
384+
},
385+
{
386+
.description = "tcp: resume after adding a few sockets (listening)",
387+
.init_socks = nr_soreuse,
388+
.max_socks = nr_soreuse,
389+
.sock_type = SOCK_STREAM,
390+
/* Use AF_INET so that new sockets are added to the head of the
391+
* bucket's list.
392+
*/
393+
.family = AF_INET,
394+
.test = add_some,
395+
},
396+
{
397+
.description = "tcp: force a realloc to occur (listening)",
398+
.init_socks = init_batch_size,
399+
.max_socks = init_batch_size * 2,
400+
.sock_type = SOCK_STREAM,
401+
/* Use AF_INET6 so that new sockets are added to the tail of the
402+
* bucket's list, needing to be added to the next batch to force
403+
* a realloc.
404+
*/
405+
.family = AF_INET6,
406+
.test = force_realloc,
407+
},
361408
};
362409

363410
static void do_resume_test(struct test_case *tc)

0 commit comments

Comments
 (0)