Skip to content

Commit f85af9d

Browse files
Geliang Tangborkmann
authored andcommitted
selftests/bpf: Drop useless arguments of do_test in bpf_tcp_ca
bpf_map_lookup_elem() has been removed from do_test(), it makes the sk_stg_map argument of do_test() useless. In addition, two exactly the same opts are passed in all the places where do_test() is invoked, so cli_opts argument can be dropped too. This patch drops these two useless arguments of do_test() in bpf_tcp_ca.c. Signed-off-by: Geliang Tang <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Link: https://lore.kernel.org/bpf/7056eab111d78a05bce29d2821228dc93f240de4.1717054461.git.tanggeliang@kylinos.cn
1 parent cd984b2 commit f85af9d

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

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

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,11 @@ static bool start_test(char *addr_str,
6767
return false;
6868
}
6969

70-
static void do_test(const struct network_helper_opts *opts,
71-
const struct network_helper_opts *cli_opts,
72-
const struct bpf_map *sk_stg_map)
70+
static void do_test(const struct network_helper_opts *opts)
7371
{
7472
int lfd = -1, fd = -1;
7573

76-
if (!start_test(NULL, opts, cli_opts, &lfd, &fd))
74+
if (!start_test(NULL, opts, opts, &lfd, &fd))
7775
goto done;
7876

7977
ASSERT_OK(send_recv_data(lfd, fd, total_bytes), "send_recv_data");
@@ -114,7 +112,7 @@ static void test_cubic(void)
114112
return;
115113
}
116114

117-
do_test(&opts, &opts, NULL);
115+
do_test(&opts);
118116

119117
ASSERT_EQ(cubic_skel->bss->bpf_cubic_acked_called, 1, "pkts_acked called");
120118

@@ -382,14 +380,14 @@ static void test_update_ca(void)
382380
link = bpf_map__attach_struct_ops(skel->maps.ca_update_1);
383381
ASSERT_OK_PTR(link, "attach_struct_ops");
384382

385-
do_test(&opts, &opts, NULL);
383+
do_test(&opts);
386384
saved_ca1_cnt = skel->bss->ca1_cnt;
387385
ASSERT_GT(saved_ca1_cnt, 0, "ca1_ca1_cnt");
388386

389387
err = bpf_link__update_map(link, skel->maps.ca_update_2);
390388
ASSERT_OK(err, "update_map");
391389

392-
do_test(&opts, &opts, NULL);
390+
do_test(&opts);
393391
ASSERT_EQ(skel->bss->ca1_cnt, saved_ca1_cnt, "ca2_ca1_cnt");
394392
ASSERT_GT(skel->bss->ca2_cnt, 0, "ca2_ca2_cnt");
395393

@@ -418,14 +416,14 @@ static void test_update_wrong(void)
418416
link = bpf_map__attach_struct_ops(skel->maps.ca_update_1);
419417
ASSERT_OK_PTR(link, "attach_struct_ops");
420418

421-
do_test(&opts, &opts, NULL);
419+
do_test(&opts);
422420
saved_ca1_cnt = skel->bss->ca1_cnt;
423421
ASSERT_GT(saved_ca1_cnt, 0, "ca1_ca1_cnt");
424422

425423
err = bpf_link__update_map(link, skel->maps.ca_wrong);
426424
ASSERT_ERR(err, "update_map");
427425

428-
do_test(&opts, &opts, NULL);
426+
do_test(&opts);
429427
ASSERT_GT(skel->bss->ca1_cnt, saved_ca1_cnt, "ca2_ca1_cnt");
430428

431429
bpf_link__destroy(link);
@@ -455,7 +453,7 @@ static void test_mixed_links(void)
455453
link = bpf_map__attach_struct_ops(skel->maps.ca_update_1);
456454
ASSERT_OK_PTR(link, "attach_struct_ops");
457455

458-
do_test(&opts, &opts, NULL);
456+
do_test(&opts);
459457
ASSERT_GT(skel->bss->ca1_cnt, 0, "ca1_ca1_cnt");
460458

461459
err = bpf_link__update_map(link, skel->maps.ca_no_link);
@@ -562,7 +560,7 @@ static void test_cc_cubic(void)
562560
return;
563561
}
564562

565-
do_test(&opts, &opts, NULL);
563+
do_test(&opts);
566564

567565
bpf_link__destroy(link);
568566
bpf_cc_cubic__destroy(cc_cubic_skel);

0 commit comments

Comments
 (0)