mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
kselftest: bonding: add num_grat_arp test
TEST: num_grat_arp (active-backup miimon num_grat_arp 10) [ OK ] TEST: num_grat_arp (active-backup miimon num_grat_arp 20) [ OK ] TEST: num_grat_arp (active-backup miimon num_grat_arp 30) [ OK ] TEST: num_grat_arp (active-backup miimon num_grat_arp 50) [ OK ] Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
b6d1599f8c
commit
6cbe791c0f
@ -6,6 +6,7 @@
|
|||||||
ALL_TESTS="
|
ALL_TESTS="
|
||||||
prio
|
prio
|
||||||
arp_validate
|
arp_validate
|
||||||
|
num_grat_arp
|
||||||
"
|
"
|
||||||
|
|
||||||
REQUIRE_MZ=no
|
REQUIRE_MZ=no
|
||||||
@ -255,6 +256,55 @@ arp_validate()
|
|||||||
arp_validate_ns "active-backup"
|
arp_validate_ns "active-backup"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
garp_test()
|
||||||
|
{
|
||||||
|
local param="$1"
|
||||||
|
local active_slave exp_num real_num i
|
||||||
|
RET=0
|
||||||
|
|
||||||
|
# create bond
|
||||||
|
bond_reset "${param}"
|
||||||
|
|
||||||
|
bond_check_connection
|
||||||
|
[ $RET -ne 0 ] && log_test "num_grat_arp" "$retmsg"
|
||||||
|
|
||||||
|
|
||||||
|
# Add tc rules to count GARP number
|
||||||
|
for i in $(seq 0 2); do
|
||||||
|
tc -n ${g_ns} filter add dev s$i ingress protocol arp pref 1 handle 101 \
|
||||||
|
flower skip_hw arp_op request arp_sip ${s_ip4} arp_tip ${s_ip4} action pass
|
||||||
|
done
|
||||||
|
|
||||||
|
# Do failover
|
||||||
|
active_slave=$(cmd_jq "ip -n ${s_ns} -d -j link show bond0" ".[].linkinfo.info_data.active_slave")
|
||||||
|
ip -n ${s_ns} link set ${active_slave} down
|
||||||
|
|
||||||
|
exp_num=$(echo "${param}" | cut -f6 -d ' ')
|
||||||
|
sleep $((exp_num + 2))
|
||||||
|
|
||||||
|
active_slave=$(cmd_jq "ip -n ${s_ns} -d -j link show bond0" ".[].linkinfo.info_data.active_slave")
|
||||||
|
|
||||||
|
# check result
|
||||||
|
real_num=$(tc_rule_handle_stats_get "dev s${active_slave#eth} ingress" 101 ".packets" "-n ${g_ns}")
|
||||||
|
if [ "${real_num}" -ne "${exp_num}" ]; then
|
||||||
|
echo "$real_num garp packets sent on active slave ${active_slave}"
|
||||||
|
RET=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
for i in $(seq 0 2); do
|
||||||
|
tc -n ${g_ns} filter del dev s$i ingress
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
num_grat_arp()
|
||||||
|
{
|
||||||
|
local val
|
||||||
|
for val in 10 20 30 50; do
|
||||||
|
garp_test "mode active-backup miimon 100 num_grat_arp $val peer_notify_delay 1000"
|
||||||
|
log_test "num_grat_arp" "active-backup miimon num_grat_arp $val"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|
||||||
setup_prepare
|
setup_prepare
|
||||||
|
@ -61,6 +61,8 @@ server_create()
|
|||||||
ip -n ${g_ns} link set s${i} up
|
ip -n ${g_ns} link set s${i} up
|
||||||
ip -n ${g_ns} link set s${i} master br0
|
ip -n ${g_ns} link set s${i} master br0
|
||||||
ip -n ${s_ns} link set eth${i} master bond0
|
ip -n ${s_ns} link set eth${i} master bond0
|
||||||
|
|
||||||
|
tc -n ${g_ns} qdisc add dev s${i} clsact
|
||||||
done
|
done
|
||||||
|
|
||||||
ip -n ${s_ns} link set bond0 up
|
ip -n ${s_ns} link set bond0 up
|
||||||
|
Loading…
Reference in New Issue
Block a user