@@ -65,6 +65,7 @@ void serial_test_tc_links_basic(void)
6565	ASSERT_EQ (optq .prog_ids [1 ], 0 , "prog_ids[1]" );
6666	ASSERT_EQ (optq .link_ids [1 ], 0 , "link_ids[1]" );
6767
68+ 	tc_skel_reset_all_seen (skel );
6869	ASSERT_OK (system (ping_cmd ), ping_cmd );
6970
7071	ASSERT_EQ (skel -> bss -> seen_tc1 , true, "seen_tc1" );
@@ -97,6 +98,7 @@ void serial_test_tc_links_basic(void)
9798	ASSERT_EQ (optq .prog_ids [1 ], 0 , "prog_ids[1]" );
9899	ASSERT_EQ (optq .link_ids [1 ], 0 , "link_ids[1]" );
99100
101+ 	tc_skel_reset_all_seen (skel );
100102	ASSERT_OK (system (ping_cmd ), ping_cmd );
101103
102104	ASSERT_EQ (skel -> bss -> seen_tc1 , true, "seen_tc1" );
@@ -187,16 +189,14 @@ static void test_tc_links_before_target(int target)
187189	ASSERT_EQ (optq .prog_ids [2 ], 0 , "prog_ids[2]" );
188190	ASSERT_EQ (optq .link_ids [2 ], 0 , "link_ids[2]" );
189191
192+ 	tc_skel_reset_all_seen (skel );
190193	ASSERT_OK (system (ping_cmd ), ping_cmd );
191194
192195	ASSERT_EQ (skel -> bss -> seen_tc1 , true, "seen_tc1" );
193196	ASSERT_EQ (skel -> bss -> seen_tc2 , true, "seen_tc2" );
194197	ASSERT_EQ (skel -> bss -> seen_tc3 , false, "seen_tc3" );
195198	ASSERT_EQ (skel -> bss -> seen_tc4 , false, "seen_tc4" );
196199
197- 	skel -> bss -> seen_tc1  =  false;
198- 	skel -> bss -> seen_tc2  =  false;
199- 
200200	LIBBPF_OPTS_RESET (optl ,
201201		.flags  =  BPF_F_BEFORE ,
202202		.relative_fd  =  bpf_program__fd (skel -> progs .tc2 ),
@@ -246,6 +246,7 @@ static void test_tc_links_before_target(int target)
246246	ASSERT_EQ (optq .prog_ids [4 ], 0 , "prog_ids[4]" );
247247	ASSERT_EQ (optq .link_ids [4 ], 0 , "link_ids[4]" );
248248
249+ 	tc_skel_reset_all_seen (skel );
249250	ASSERT_OK (system (ping_cmd ), ping_cmd );
250251
251252	ASSERT_EQ (skel -> bss -> seen_tc1 , true, "seen_tc1" );
@@ -342,16 +343,14 @@ static void test_tc_links_after_target(int target)
342343	ASSERT_EQ (optq .prog_ids [2 ], 0 , "prog_ids[2]" );
343344	ASSERT_EQ (optq .link_ids [2 ], 0 , "link_ids[2]" );
344345
346+ 	tc_skel_reset_all_seen (skel );
345347	ASSERT_OK (system (ping_cmd ), ping_cmd );
346348
347349	ASSERT_EQ (skel -> bss -> seen_tc1 , true, "seen_tc1" );
348350	ASSERT_EQ (skel -> bss -> seen_tc2 , true, "seen_tc2" );
349351	ASSERT_EQ (skel -> bss -> seen_tc3 , false, "seen_tc3" );
350352	ASSERT_EQ (skel -> bss -> seen_tc4 , false, "seen_tc4" );
351353
352- 	skel -> bss -> seen_tc1  =  false;
353- 	skel -> bss -> seen_tc2  =  false;
354- 
355354	LIBBPF_OPTS_RESET (optl ,
356355		.flags  =  BPF_F_AFTER ,
357356		.relative_fd  =  bpf_program__fd (skel -> progs .tc1 ),
@@ -401,6 +400,7 @@ static void test_tc_links_after_target(int target)
401400	ASSERT_EQ (optq .prog_ids [4 ], 0 , "prog_ids[4]" );
402401	ASSERT_EQ (optq .link_ids [4 ], 0 , "link_ids[4]" );
403402
403+ 	tc_skel_reset_all_seen (skel );
404404	ASSERT_OK (system (ping_cmd ), ping_cmd );
405405
406406	ASSERT_EQ (skel -> bss -> seen_tc1 , true, "seen_tc1" );
@@ -502,6 +502,7 @@ static void test_tc_links_revision_target(int target)
502502	ASSERT_EQ (optq .prog_ids [2 ], 0 , "prog_ids[2]" );
503503	ASSERT_EQ (optq .link_ids [2 ], 0 , "prog_ids[2]" );
504504
505+ 	tc_skel_reset_all_seen (skel );
505506	ASSERT_OK (system (ping_cmd ), ping_cmd );
506507
507508	ASSERT_EQ (skel -> bss -> seen_tc1 , true, "seen_tc1" );
@@ -581,22 +582,20 @@ static void test_tc_chain_classic(int target, bool chain_tc_old)
581582
582583	assert_mprog_count (target , 2 );
583584
585+ 	tc_skel_reset_all_seen (skel );
584586	ASSERT_OK (system (ping_cmd ), ping_cmd );
585587
586588	ASSERT_EQ (skel -> bss -> seen_tc1 , true, "seen_tc1" );
587589	ASSERT_EQ (skel -> bss -> seen_tc2 , true, "seen_tc2" );
588590	ASSERT_EQ (skel -> bss -> seen_tc3 , chain_tc_old , "seen_tc3" );
589591
590- 	skel -> bss -> seen_tc1  =  false;
591- 	skel -> bss -> seen_tc2  =  false;
592- 	skel -> bss -> seen_tc3  =  false;
593- 
594592	err  =  bpf_link__detach (skel -> links .tc2 );
595593	if  (!ASSERT_OK (err , "prog_detach" ))
596594		goto cleanup ;
597595
598596	assert_mprog_count (target , 1 );
599597
598+ 	tc_skel_reset_all_seen (skel );
600599	ASSERT_OK (system (ping_cmd ), ping_cmd );
601600
602601	ASSERT_EQ (skel -> bss -> seen_tc1 , true, "seen_tc1" );
@@ -707,16 +706,13 @@ static void test_tc_links_replace_target(int target)
707706	ASSERT_EQ (optq .prog_ids [2 ], 0 , "prog_ids[2]" );
708707	ASSERT_EQ (optq .link_ids [2 ], 0 , "link_ids[2]" );
709708
709+ 	tc_skel_reset_all_seen (skel );
710710	ASSERT_OK (system (ping_cmd ), ping_cmd );
711711
712712	ASSERT_EQ (skel -> bss -> seen_tc1 , true, "seen_tc1" );
713713	ASSERT_EQ (skel -> bss -> seen_tc2 , true, "seen_tc2" );
714714	ASSERT_EQ (skel -> bss -> seen_tc3 , false, "seen_tc3" );
715715
716- 	skel -> bss -> seen_tc1  =  false;
717- 	skel -> bss -> seen_tc2  =  false;
718- 	skel -> bss -> seen_tc3  =  false;
719- 
720716	LIBBPF_OPTS_RESET (optl ,
721717		.flags  =  BPF_F_REPLACE ,
722718		.relative_fd  =  bpf_program__fd (skel -> progs .tc2 ),
@@ -781,16 +777,13 @@ static void test_tc_links_replace_target(int target)
781777	ASSERT_EQ (optq .prog_ids [2 ], 0 , "prog_ids[2]" );
782778	ASSERT_EQ (optq .link_ids [2 ], 0 , "link_ids[2]" );
783779
780+ 	tc_skel_reset_all_seen (skel );
784781	ASSERT_OK (system (ping_cmd ), ping_cmd );
785782
786783	ASSERT_EQ (skel -> bss -> seen_tc1 , true, "seen_tc1" );
787784	ASSERT_EQ (skel -> bss -> seen_tc2 , false, "seen_tc2" );
788785	ASSERT_EQ (skel -> bss -> seen_tc3 , true, "seen_tc3" );
789786
790- 	skel -> bss -> seen_tc1  =  false;
791- 	skel -> bss -> seen_tc2  =  false;
792- 	skel -> bss -> seen_tc3  =  false;
793- 
794787	err  =  bpf_link__detach (skel -> links .tc2 );
795788	if  (!ASSERT_OK (err , "link_detach" ))
796789		goto cleanup ;
@@ -812,16 +805,13 @@ static void test_tc_links_replace_target(int target)
812805	ASSERT_EQ (optq .prog_ids [1 ], 0 , "prog_ids[1]" );
813806	ASSERT_EQ (optq .link_ids [1 ], 0 , "link_ids[1]" );
814807
808+ 	tc_skel_reset_all_seen (skel );
815809	ASSERT_OK (system (ping_cmd ), ping_cmd );
816810
817811	ASSERT_EQ (skel -> bss -> seen_tc1 , true, "seen_tc1" );
818812	ASSERT_EQ (skel -> bss -> seen_tc2 , false, "seen_tc2" );
819813	ASSERT_EQ (skel -> bss -> seen_tc3 , false, "seen_tc3" );
820814
821- 	skel -> bss -> seen_tc1  =  false;
822- 	skel -> bss -> seen_tc2  =  false;
823- 	skel -> bss -> seen_tc3  =  false;
824- 
825815	err  =  bpf_link__update_program (skel -> links .tc1 , skel -> progs .tc1 );
826816	if  (!ASSERT_OK (err , "link_update_self" ))
827817		goto cleanup ;
@@ -843,6 +833,7 @@ static void test_tc_links_replace_target(int target)
843833	ASSERT_EQ (optq .prog_ids [1 ], 0 , "prog_ids[1]" );
844834	ASSERT_EQ (optq .link_ids [1 ], 0 , "link_ids[1]" );
845835
836+ 	tc_skel_reset_all_seen (skel );
846837	ASSERT_OK (system (ping_cmd ), ping_cmd );
847838
848839	ASSERT_EQ (skel -> bss -> seen_tc1 , true, "seen_tc1" );
@@ -1254,16 +1245,14 @@ static void test_tc_links_prepend_target(int target)
12541245	ASSERT_EQ (optq .prog_ids [2 ], 0 , "prog_ids[2]" );
12551246	ASSERT_EQ (optq .link_ids [2 ], 0 , "link_ids[2]" );
12561247
1248+ 	tc_skel_reset_all_seen (skel );
12571249	ASSERT_OK (system (ping_cmd ), ping_cmd );
12581250
12591251	ASSERT_EQ (skel -> bss -> seen_tc1 , true, "seen_tc1" );
12601252	ASSERT_EQ (skel -> bss -> seen_tc2 , true, "seen_tc2" );
12611253	ASSERT_EQ (skel -> bss -> seen_tc3 , false, "seen_tc3" );
12621254	ASSERT_EQ (skel -> bss -> seen_tc4 , false, "seen_tc4" );
12631255
1264- 	skel -> bss -> seen_tc1  =  false;
1265- 	skel -> bss -> seen_tc2  =  false;
1266- 
12671256	LIBBPF_OPTS_RESET (optl ,
12681257		.flags  =  BPF_F_BEFORE ,
12691258	);
@@ -1311,6 +1300,7 @@ static void test_tc_links_prepend_target(int target)
13111300	ASSERT_EQ (optq .prog_ids [4 ], 0 , "prog_ids[4]" );
13121301	ASSERT_EQ (optq .link_ids [4 ], 0 , "link_ids[4]" );
13131302
1303+ 	tc_skel_reset_all_seen (skel );
13141304	ASSERT_OK (system (ping_cmd ), ping_cmd );
13151305
13161306	ASSERT_EQ (skel -> bss -> seen_tc1 , true, "seen_tc1" );
@@ -1411,16 +1401,14 @@ static void test_tc_links_append_target(int target)
14111401	ASSERT_EQ (optq .prog_ids [2 ], 0 , "prog_ids[2]" );
14121402	ASSERT_EQ (optq .link_ids [2 ], 0 , "link_ids[2]" );
14131403
1404+ 	tc_skel_reset_all_seen (skel );
14141405	ASSERT_OK (system (ping_cmd ), ping_cmd );
14151406
14161407	ASSERT_EQ (skel -> bss -> seen_tc1 , true, "seen_tc1" );
14171408	ASSERT_EQ (skel -> bss -> seen_tc2 , true, "seen_tc2" );
14181409	ASSERT_EQ (skel -> bss -> seen_tc3 , false, "seen_tc3" );
14191410	ASSERT_EQ (skel -> bss -> seen_tc4 , false, "seen_tc4" );
14201411
1421- 	skel -> bss -> seen_tc1  =  false;
1422- 	skel -> bss -> seen_tc2  =  false;
1423- 
14241412	LIBBPF_OPTS_RESET (optl ,
14251413		.flags  =  BPF_F_AFTER ,
14261414	);
@@ -1468,6 +1456,7 @@ static void test_tc_links_append_target(int target)
14681456	ASSERT_EQ (optq .prog_ids [4 ], 0 , "prog_ids[4]" );
14691457	ASSERT_EQ (optq .link_ids [4 ], 0 , "link_ids[4]" );
14701458
1459+ 	tc_skel_reset_all_seen (skel );
14711460	ASSERT_OK (system (ping_cmd ), ping_cmd );
14721461
14731462	ASSERT_EQ (skel -> bss -> seen_tc1 , true, "seen_tc1" );
@@ -1637,38 +1626,33 @@ static void test_tc_chain_mixed(int target)
16371626
16381627	assert_mprog_count (target , 1 );
16391628
1629+ 	tc_skel_reset_all_seen (skel );
16401630	ASSERT_OK (system (ping_cmd ), ping_cmd );
16411631
16421632	ASSERT_EQ (skel -> bss -> seen_tc4 , false, "seen_tc4" );
16431633	ASSERT_EQ (skel -> bss -> seen_tc5 , false, "seen_tc5" );
16441634	ASSERT_EQ (skel -> bss -> seen_tc6 , true, "seen_tc6" );
16451635
1646- 	skel -> bss -> seen_tc4  =  false;
1647- 	skel -> bss -> seen_tc5  =  false;
1648- 	skel -> bss -> seen_tc6  =  false;
1649- 
16501636	err  =  bpf_link__update_program (skel -> links .tc6 , skel -> progs .tc4 );
16511637	if  (!ASSERT_OK (err , "link_update" ))
16521638		goto cleanup ;
16531639
16541640	assert_mprog_count (target , 1 );
16551641
1642+ 	tc_skel_reset_all_seen (skel );
16561643	ASSERT_OK (system (ping_cmd ), ping_cmd );
16571644
16581645	ASSERT_EQ (skel -> bss -> seen_tc4 , true, "seen_tc4" );
16591646	ASSERT_EQ (skel -> bss -> seen_tc5 , true, "seen_tc5" );
16601647	ASSERT_EQ (skel -> bss -> seen_tc6 , false, "seen_tc6" );
16611648
1662- 	skel -> bss -> seen_tc4  =  false;
1663- 	skel -> bss -> seen_tc5  =  false;
1664- 	skel -> bss -> seen_tc6  =  false;
1665- 
16661649	err  =  bpf_link__detach (skel -> links .tc6 );
16671650	if  (!ASSERT_OK (err , "prog_detach" ))
16681651		goto cleanup ;
16691652
16701653	assert_mprog_count (target , 0 );
16711654
1655+ 	tc_skel_reset_all_seen (skel );
16721656	ASSERT_OK (system (ping_cmd ), ping_cmd );
16731657
16741658	ASSERT_EQ (skel -> bss -> seen_tc4 , false, "seen_tc4" );
@@ -1758,22 +1742,20 @@ static void test_tc_links_ingress(int target, bool chain_tc_old,
17581742
17591743	assert_mprog_count (target , 2 );
17601744
1745+ 	tc_skel_reset_all_seen (skel );
17611746	ASSERT_OK (system (ping_cmd ), ping_cmd );
17621747
17631748	ASSERT_EQ (skel -> bss -> seen_tc1 , true, "seen_tc1" );
17641749	ASSERT_EQ (skel -> bss -> seen_tc2 , true, "seen_tc2" );
17651750	ASSERT_EQ (skel -> bss -> seen_tc3 , chain_tc_old , "seen_tc3" );
17661751
1767- 	skel -> bss -> seen_tc1  =  false;
1768- 	skel -> bss -> seen_tc2  =  false;
1769- 	skel -> bss -> seen_tc3  =  false;
1770- 
17711752	err  =  bpf_link__detach (skel -> links .tc2 );
17721753	if  (!ASSERT_OK (err , "prog_detach" ))
17731754		goto cleanup ;
17741755
17751756	assert_mprog_count (target , 1 );
17761757
1758+ 	tc_skel_reset_all_seen (skel );
17771759	ASSERT_OK (system (ping_cmd ), ping_cmd );
17781760
17791761	ASSERT_EQ (skel -> bss -> seen_tc1 , true, "seen_tc1" );
0 commit comments