Skip to content

Commit 9150820

Browse files
liuhangbinkuba-moo
authored andcommitted
selftests: bonding: use tc filter to check if LACP was sent
Use tc filter to check if LACP was sent, which is accurate and save more time. No need to remove bonding module as some test env may buildin bonding. And the bond link has been deleted. Reviewed-by: Przemek Kitszel <[email protected]> Signed-off-by: Hangbin Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent c8f4b19 commit 9150820

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

tools/testing/selftests/drivers/net/bonding/bond-break-lacpdu-tx.sh

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@
2020
# +------+ +------+
2121
#
2222
# We use veths instead of physical interfaces
23+
REQUIRE_MZ=no
24+
NUM_NETIFS=0
25+
lib_dir=$(dirname "$0")
26+
source "$lib_dir"/../../../net/forwarding/lib.sh
2327

2428
set -e
25-
tmp=$(mktemp -q dump.XXXXXX)
2629
cleanup() {
2730
ip link del fab-br0 >/dev/null 2>&1 || :
2831
ip link del fbond >/dev/null 2>&1 || :
2932
ip link del veth1-bond >/dev/null 2>&1 || :
3033
ip link del veth2-bond >/dev/null 2>&1 || :
31-
modprobe -r bonding >/dev/null 2>&1 || :
32-
rm -f -- ${tmp}
3334
}
3435

3536
trap cleanup 0 1 2
3637
cleanup
37-
sleep 1
3838

3939
# create the bridge
4040
ip link add fab-br0 address 52:54:00:3B:7C:A6 mtu 1500 type bridge \
@@ -67,13 +67,12 @@ ip link set fab-br0 up
6767
ip link set fbond up
6868
ip addr add dev fab-br0 10.0.0.3
6969

70-
tcpdump -n -i veth1-end -e ether proto 0x8809 >${tmp} 2>&1 &
71-
sleep 15
72-
pkill tcpdump >/dev/null 2>&1
7370
rc=0
74-
num=$(grep "packets captured" ${tmp} | awk '{print $1}')
75-
if test "$num" -gt 0; then
76-
echo "PASS, captured ${num}"
71+
tc qdisc add dev veth1-end clsact
72+
tc filter add dev veth1-end ingress protocol 0x8809 pref 1 handle 101 flower skip_hw action pass
73+
if slowwait_for_counter 15 2 \
74+
tc_rule_handle_stats_get "dev veth1-end ingress" 101 ".packets" "" &> /dev/null; then
75+
echo "PASS, captured 2"
7776
else
7877
echo "FAIL"
7978
rc=1

0 commit comments

Comments
 (0)