Skip to content

Commit 237c1e1

Browse files
committed
Merge branch 'selftests-forwarding-vxlan_bridge_1q_mc_ul-fix-flakiness'
Petr Machata says: ==================== selftests: forwarding: vxlan_bridge_1q_mc_ul: Fix flakiness The net/forwarding/vxlan_bridge_1q_mc_ul selftest runs an overlay traffic, forwarded over a multicast-routed VXLAN underlay. In order to determine whether packets reach their intended destination, it uses a TC match. For convenience, it uses a flower match, which however does not allow matching on the encapsulated packet. So various service traffic ends up being indistinguishable from the test packets, and ends up confusing the test. To alleviate the problem, the test uses sleep to allow the necessary service traffic to run and clear the channel, before running the test traffic. This worked for a while, but lately we have nevertheless seen flakiness of the test in the CI. In this patchset, first generalize tc_rule_stats_get() to support u32 in patch #1, then in patch #2 convert the test to use u32 to allow parsing deeper into the packet, and in #3 drop the now-unnecessary sleep. ==================== Link: https://patch.msgid.link/cover.1765289566.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents 6bcb772 + 514520b commit 237c1e1

File tree

3 files changed

+34
-46
lines changed

3 files changed

+34
-46
lines changed

tools/testing/selftests/net/forwarding/config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ CONFIG_NET_ACT_VLAN=m
2929
CONFIG_NET_CLS_BASIC=m
3030
CONFIG_NET_CLS_FLOWER=m
3131
CONFIG_NET_CLS_MATCHALL=m
32+
CONFIG_NET_CLS_U32=m
3233
CONFIG_NET_EMATCH=y
3334
CONFIG_NET_EMATCH_META=m
3435
CONFIG_NETFILTER=y

tools/testing/selftests/net/forwarding/vxlan_bridge_1q_mc_ul.sh

Lines changed: 31 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,18 @@ install_capture()
138138
defer tc qdisc del dev "$dev" clsact
139139

140140
tc filter add dev "$dev" ingress proto ip pref 104 \
141-
flower skip_hw ip_proto udp dst_port "$VXPORT" \
142-
action pass
141+
u32 match ip protocol 0x11 0xff \
142+
match u16 "$VXPORT" 0xffff at 0x16 \
143+
match u16 0x0800 0xffff at 0x30 \
144+
action pass
143145
defer tc filter del dev "$dev" ingress proto ip pref 104
144146

145147
tc filter add dev "$dev" ingress proto ipv6 pref 106 \
146-
flower skip_hw ip_proto udp dst_port "$VXPORT" \
147-
action pass
148+
u32 match ip6 protocol 0x11 0xff \
149+
match u16 "$VXPORT" 0xffff at 0x2a \
150+
match u16 0x86dd 0xffff at 0x44 \
151+
match u8 0x11 0xff at 0x4c \
152+
action pass
148153
defer tc filter del dev "$dev" ingress proto ipv6 pref 106
149154
}
150155

@@ -248,13 +253,6 @@ vx_create()
248253
}
249254
export -f vx_create
250255

251-
vx_wait()
252-
{
253-
# Wait for all the ARP, IGMP etc. noise to settle down so that the
254-
# tunnel is clear for measurements.
255-
sleep 10
256-
}
257-
258256
vx10_create()
259257
{
260258
vx_create vx10 10 id 1000 "$@"
@@ -267,18 +265,6 @@ vx20_create()
267265
}
268266
export -f vx20_create
269267

270-
vx10_create_wait()
271-
{
272-
vx10_create "$@"
273-
vx_wait
274-
}
275-
276-
vx20_create_wait()
277-
{
278-
vx20_create "$@"
279-
vx_wait
280-
}
281-
282268
ns_init_common()
283269
{
284270
local ns=$1; shift
@@ -554,15 +540,15 @@ ipv4_nomcroute()
554540
# Install a misleading (S,G) rule to attempt to trick the system into
555541
# pushing the packets elsewhere.
556542
adf_install_broken_sg
557-
vx10_create_wait local 192.0.2.100 group "$GROUP4" dev "$swp2"
543+
vx10_create local 192.0.2.100 group "$GROUP4" dev "$swp2"
558544
do_test 4 10 0 "IPv4 nomcroute"
559545
}
560546

561547
ipv6_nomcroute()
562548
{
563549
# Like for IPv4, install a misleading (S,G).
564550
adf_install_broken_sg
565-
vx20_create_wait local 2001:db8:4::1 group "$GROUP6" dev "$swp2"
551+
vx20_create local 2001:db8:4::1 group "$GROUP6" dev "$swp2"
566552
do_test 6 10 0 "IPv6 nomcroute"
567553
}
568554

@@ -581,35 +567,35 @@ ipv6_nomcroute_rx()
581567
ipv4_mcroute()
582568
{
583569
adf_install_sg
584-
vx10_create_wait local 192.0.2.100 group "$GROUP4" dev "$IPMR" mcroute
570+
vx10_create local 192.0.2.100 group "$GROUP4" dev "$IPMR" mcroute
585571
do_test 4 10 10 "IPv4 mcroute"
586572
}
587573

588574
ipv6_mcroute()
589575
{
590576
adf_install_sg
591-
vx20_create_wait local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute
577+
vx20_create local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute
592578
do_test 6 10 10 "IPv6 mcroute"
593579
}
594580

595581
ipv4_mcroute_rx()
596582
{
597583
adf_install_sg
598-
vx10_create_wait local 192.0.2.100 group "$GROUP4" dev "$IPMR" mcroute
584+
vx10_create local 192.0.2.100 group "$GROUP4" dev "$IPMR" mcroute
599585
ipv4_do_test_rx 0 "IPv4 mcroute ping"
600586
}
601587

602588
ipv6_mcroute_rx()
603589
{
604590
adf_install_sg
605-
vx20_create_wait local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute
591+
vx20_create local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute
606592
ipv6_do_test_rx 0 "IPv6 mcroute ping"
607593
}
608594

609595
ipv4_mcroute_changelink()
610596
{
611597
adf_install_sg
612-
vx10_create_wait local 192.0.2.100 group "$GROUP4" dev "$IPMR"
598+
vx10_create local 192.0.2.100 group "$GROUP4" dev "$IPMR"
613599
ip link set dev vx10 type vxlan mcroute
614600
sleep 1
615601
do_test 4 10 10 "IPv4 mcroute changelink"
@@ -618,7 +604,7 @@ ipv4_mcroute_changelink()
618604
ipv6_mcroute_changelink()
619605
{
620606
adf_install_sg
621-
vx20_create_wait local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute
607+
vx20_create local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute
622608
ip link set dev vx20 type vxlan mcroute
623609
sleep 1
624610
do_test 6 10 10 "IPv6 mcroute changelink"
@@ -627,47 +613,47 @@ ipv6_mcroute_changelink()
627613
ipv4_mcroute_starg()
628614
{
629615
adf_install_starg
630-
vx10_create_wait local 192.0.2.100 group "$GROUP4" dev "$IPMR" mcroute
616+
vx10_create local 192.0.2.100 group "$GROUP4" dev "$IPMR" mcroute
631617
do_test 4 10 10 "IPv4 mcroute (*,G)"
632618
}
633619

634620
ipv6_mcroute_starg()
635621
{
636622
adf_install_starg
637-
vx20_create_wait local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute
623+
vx20_create local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute
638624
do_test 6 10 10 "IPv6 mcroute (*,G)"
639625
}
640626

641627
ipv4_mcroute_starg_rx()
642628
{
643629
adf_install_starg
644-
vx10_create_wait local 192.0.2.100 group "$GROUP4" dev "$IPMR" mcroute
630+
vx10_create local 192.0.2.100 group "$GROUP4" dev "$IPMR" mcroute
645631
ipv4_do_test_rx 0 "IPv4 mcroute (*,G) ping"
646632
}
647633

648634
ipv6_mcroute_starg_rx()
649635
{
650636
adf_install_starg
651-
vx20_create_wait local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute
637+
vx20_create local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute
652638
ipv6_do_test_rx 0 "IPv6 mcroute (*,G) ping"
653639
}
654640

655641
ipv4_mcroute_noroute()
656642
{
657-
vx10_create_wait local 192.0.2.100 group "$GROUP4" dev "$IPMR" mcroute
643+
vx10_create local 192.0.2.100 group "$GROUP4" dev "$IPMR" mcroute
658644
do_test 4 0 0 "IPv4 mcroute, no route"
659645
}
660646

661647
ipv6_mcroute_noroute()
662648
{
663-
vx20_create_wait local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute
649+
vx20_create local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute
664650
do_test 6 0 0 "IPv6 mcroute, no route"
665651
}
666652

667653
ipv4_mcroute_fdb()
668654
{
669655
adf_install_sg
670-
vx10_create_wait local 192.0.2.100 dev "$IPMR" mcroute
656+
vx10_create local 192.0.2.100 dev "$IPMR" mcroute
671657
bridge fdb add dev vx10 \
672658
00:00:00:00:00:00 self static dst "$GROUP4" via "$IPMR"
673659
do_test 4 10 10 "IPv4 mcroute FDB"
@@ -676,7 +662,7 @@ ipv4_mcroute_fdb()
676662
ipv6_mcroute_fdb()
677663
{
678664
adf_install_sg
679-
vx20_create_wait local 2001:db8:4::1 dev "$IPMR" mcroute
665+
vx20_create local 2001:db8:4::1 dev "$IPMR" mcroute
680666
bridge -6 fdb add dev vx20 \
681667
00:00:00:00:00:00 self static dst "$GROUP6" via "$IPMR"
682668
do_test 6 10 10 "IPv6 mcroute FDB"
@@ -686,7 +672,7 @@ ipv6_mcroute_fdb()
686672
ipv4_mcroute_fdb_oif0()
687673
{
688674
adf_install_sg
689-
vx10_create_wait local 192.0.2.100 group "$GROUP4" dev "$IPMR" mcroute
675+
vx10_create local 192.0.2.100 group "$GROUP4" dev "$IPMR" mcroute
690676
bridge fdb del dev vx10 00:00:00:00:00:00
691677
bridge fdb add dev vx10 00:00:00:00:00:00 self static dst "$GROUP4"
692678
do_test 4 10 10 "IPv4 mcroute oif=0"
@@ -703,7 +689,7 @@ ipv6_mcroute_fdb_oif0()
703689
defer ip -6 route del table local multicast "$GROUP6/128" dev "$IPMR"
704690

705691
adf_install_sg
706-
vx20_create_wait local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute
692+
vx20_create local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute
707693
bridge -6 fdb del dev vx20 00:00:00:00:00:00
708694
bridge -6 fdb add dev vx20 00:00:00:00:00:00 self static dst "$GROUP6"
709695
do_test 6 10 10 "IPv6 mcroute oif=0"
@@ -716,7 +702,7 @@ ipv4_mcroute_fdb_oif0_sep()
716702
adf_install_sg_sep
717703

718704
adf_ip_addr_add lo 192.0.2.120/28
719-
vx10_create_wait local 192.0.2.120 group "$GROUP4" dev "$IPMR" mcroute
705+
vx10_create local 192.0.2.120 group "$GROUP4" dev "$IPMR" mcroute
720706
bridge fdb del dev vx10 00:00:00:00:00:00
721707
bridge fdb add dev vx10 00:00:00:00:00:00 self static dst "$GROUP4"
722708
do_test 4 10 10 "IPv4 mcroute TX!=RX oif=0"
@@ -727,7 +713,7 @@ ipv4_mcroute_fdb_oif0_sep_rx()
727713
adf_install_sg_sep_rx lo
728714

729715
adf_ip_addr_add lo 192.0.2.120/28
730-
vx10_create_wait local 192.0.2.120 group "$GROUP4" dev "$IPMR" mcroute
716+
vx10_create local 192.0.2.120 group "$GROUP4" dev "$IPMR" mcroute
731717
bridge fdb del dev vx10 00:00:00:00:00:00
732718
bridge fdb add dev vx10 00:00:00:00:00:00 self static dst "$GROUP4"
733719
ipv4_do_test_rx 0 "IPv4 mcroute TX!=RX oif=0 ping"
@@ -738,7 +724,7 @@ ipv4_mcroute_fdb_sep_rx()
738724
adf_install_sg_sep_rx lo
739725

740726
adf_ip_addr_add lo 192.0.2.120/28
741-
vx10_create_wait local 192.0.2.120 group "$GROUP4" dev "$IPMR" mcroute
727+
vx10_create local 192.0.2.120 group "$GROUP4" dev "$IPMR" mcroute
742728
bridge fdb del dev vx10 00:00:00:00:00:00
743729
bridge fdb add \
744730
dev vx10 00:00:00:00:00:00 self static dst "$GROUP4" via lo
@@ -750,7 +736,7 @@ ipv6_mcroute_fdb_sep_rx()
750736
adf_install_sg_sep_rx "X$IPMR"
751737

752738
adf_ip_addr_add "X$IPMR" 2001:db8:5::1/64
753-
vx20_create_wait local 2001:db8:5::1 group "$GROUP6" dev "$IPMR" mcroute
739+
vx20_create local 2001:db8:5::1 group "$GROUP6" dev "$IPMR" mcroute
754740
bridge -6 fdb del dev vx20 00:00:00:00:00:00
755741
bridge -6 fdb add dev vx20 00:00:00:00:00:00 \
756742
self static dst "$GROUP6" via "X$IPMR"

tools/testing/selftests/net/lib.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,8 @@ tc_rule_stats_get()
280280
local selector=${1:-.packets}; shift
281281

282282
tc -j -s filter show dev $dev $dir pref $pref \
283-
| jq ".[1].options.actions[].stats$selector"
283+
| jq ".[] | select(.options.actions) |
284+
.options.actions[].stats$selector"
284285
}
285286

286287
tc_rule_handle_stats_get()

0 commit comments

Comments
 (0)