Initial commit: Linux kernel 4.19 for Unplugged OS

This commit is contained in:
ziv committed 2025-10-06 13:52:42 +00:00
commit d30235b04c
80519 files changed
+35800681

No files matched your search

+217
View File
@@ -0,0 +1,217 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# This test uses standard topology for testing gretap. See
# ../../../net/forwarding/mirror_gre_topo_lib.sh for more details.
#
# Test offloading various features of offloading gretap mirrors specific to
# mlxsw.
lib_dir=$(dirname $0)/../../../net/forwarding
NUM_NETIFS=6
source $lib_dir/lib.sh
source $lib_dir/mirror_lib.sh
source $lib_dir/mirror_gre_lib.sh
source $lib_dir/mirror_gre_topo_lib.sh
setup_keyful()
{
tunnel_create gt6-key ip6gretap 2001:db8:3::1 2001:db8:3::2 \
ttl 100 tos inherit allow-localremote \
key 1234
tunnel_create h3-gt6-key ip6gretap 2001:db8:3::2 2001:db8:3::1 \
key 1234
ip link set h3-gt6-key vrf v$h3
matchall_sink_create h3-gt6-key
ip address add dev $swp3 2001:db8:3::1/64
ip address add dev $h3 2001:db8:3::2/64
}
cleanup_keyful()
{
ip address del dev $h3 2001:db8:3::2/64
ip address del dev $swp3 2001:db8:3::1/64
tunnel_destroy h3-gt6-key
tunnel_destroy gt6-key
}
setup_soft()
{
# Set up a topology for testing underlay routes that point at an
# unsupported soft device.
tunnel_create gt6-soft ip6gretap 2001:db8:4::1 2001:db8:4::2 \
ttl 100 tos inherit allow-localremote
tunnel_create h3-gt6-soft ip6gretap 2001:db8:4::2 2001:db8:4::1
ip link set h3-gt6-soft vrf v$h3
matchall_sink_create h3-gt6-soft
ip link add name v1 type veth peer name v2
ip link set dev v1 up
ip address add dev v1 2001:db8:4::1/64
ip link set dev v2 vrf v$h3
ip link set dev v2 up
ip address add dev v2 2001:db8:4::2/64
}
cleanup_soft()
{
ip link del dev v1
tunnel_destroy h3-gt6-soft
tunnel_destroy gt6-soft
}
setup_prepare()
{
h1=${NETIFS[p1]}
swp1=${NETIFS[p2]}
swp2=${NETIFS[p3]}
h2=${NETIFS[p4]}
swp3=${NETIFS[p5]}
h3=${NETIFS[p6]}
vrf_prepare
mirror_gre_topo_create
ip address add dev $swp3 2001:db8:2::1/64
ip address add dev $h3 2001:db8:2::2/64
ip address add dev $swp3 192.0.2.129/28
ip address add dev $h3 192.0.2.130/28
setup_keyful
setup_soft
}
cleanup()
{
pre_cleanup
cleanup_soft
cleanup_keyful
ip address del dev $h3 2001:db8:2::2/64
ip address del dev $swp3 2001:db8:2::1/64
ip address del dev $h3 192.0.2.130/28
ip address del dev $swp3 192.0.2.129/28
mirror_gre_topo_destroy
vrf_cleanup
}
test_span_gre_ttl_inherit()
{
local tundev=$1; shift
local type=$1; shift
local what=$1; shift
RET=0
ip link set dev $tundev type $type ttl inherit
mirror_install $swp1 ingress $tundev "matchall $tcflags"
fail_test_span_gre_dir $tundev ingress
ip link set dev $tundev type $type ttl 100
quick_test_span_gre_dir $tundev ingress
mirror_uninstall $swp1 ingress
log_test "$what: no offload on TTL of inherit ($tcflags)"
}
test_span_gre_tos_fixed()
{
local tundev=$1; shift
local type=$1; shift
local what=$1; shift
RET=0
ip link set dev $tundev type $type tos 0x10
mirror_install $swp1 ingress $tundev "matchall $tcflags"
fail_test_span_gre_dir $tundev ingress
ip link set dev $tundev type $type tos inherit
quick_test_span_gre_dir $tundev ingress
mirror_uninstall $swp1 ingress
log_test "$what: no offload on a fixed TOS ($tcflags)"
}
test_span_failable()
{
local should_fail=$1; shift
local tundev=$1; shift
local what=$1; shift
RET=0
mirror_install $swp1 ingress $tundev "matchall $tcflags"
if ((should_fail)); then
fail_test_span_gre_dir $tundev ingress
else
quick_test_span_gre_dir $tundev ingress
fi
mirror_uninstall $swp1 ingress
log_test "$what: should_fail=$should_fail ($tcflags)"
}
test_failable()
{
local should_fail=$1; shift
test_span_failable $should_fail gt6-key "mirror to keyful gretap"
test_span_failable $should_fail gt6-soft "mirror to gretap w/ soft underlay"
}
test_sw()
{
slow_path_trap_install $swp1 ingress
slow_path_trap_install $swp1 egress
test_failable 0
slow_path_trap_uninstall $swp1 egress
slow_path_trap_uninstall $swp1 ingress
}
test_hw()
{
test_failable 1
test_span_gre_tos_fixed gt4 gretap "mirror to gretap"
test_span_gre_tos_fixed gt6 ip6gretap "mirror to ip6gretap"
test_span_gre_ttl_inherit gt4 gretap "mirror to gretap"
test_span_gre_ttl_inherit gt6 ip6gretap "mirror to ip6gretap"
}
trap cleanup EXIT
setup_prepare
setup_wait
if ! tc_offload_check; then
check_err 1 "Could not test offloaded functionality"
log_test "mlxsw-specific tests for mirror to gretap"
exit
fi
tcflags="skip_hw"
test_sw
tcflags="skip_sw"
test_hw
exit $EXIT_STATUS
@@ -0,0 +1,197 @@
# SPDX-License-Identifier: GPL-2.0
# Test offloading a number of mirrors-to-gretap. The test creates a number of
# tunnels. Then it adds one flower mirror for each of the tunnels, matching a
# given host IP. Then it generates traffic at each of the host IPs and checks
# that the traffic has been mirrored at the appropriate tunnel.
#
# +--------------------------+ +--------------------------+
# | H1 | | H2 |
# | + $h1 | | $h2 + |
# | | 2001:db8:1:X::1/64 | | 2001:db8:1:X::2/64 | |
# +-----|--------------------+ +--------------------|-----+
# | |
# +-----|-------------------------------------------------------------|-----+
# | SW o--> mirrors | |
# | +---|-------------------------------------------------------------|---+ |
# | | + $swp1 BR $swp2 + | |
# | +---------------------------------------------------------------------+ |
# | |
# | + $swp3 + gt6-<X> (ip6gretap) |
# | | 2001:db8:2:X::1/64 : loc=2001:db8:2:X::1 |
# | | : rem=2001:db8:2:X::2 |
# | | : ttl=100 |
# | | : tos=inherit |
# | | : |
# +-----|--------------------------------:----------------------------------+
# | :
# +-----|--------------------------------:----------------------------------+
# | H3 + $h3 + h3-gt6-<X> (ip6gretap) |
# | 2001:db8:2:X::2/64 loc=2001:db8:2:X::2 |
# | rem=2001:db8:2:X::1 |
# | ttl=100 |
# | tos=inherit |
# | |
# +-------------------------------------------------------------------------+
source ../../../../net/forwarding/mirror_lib.sh
MIRROR_NUM_NETIFS=6
mirror_gre_ipv6_addr()
{
local net=$1; shift
local num=$1; shift
printf "2001:db8:%x:%x" $net $num
}
mirror_gre_tunnels_create()
{
local count=$1; shift
local should_fail=$1; shift
MIRROR_GRE_BATCH_FILE="$(mktemp)"
for ((i=0; i < count; ++i)); do
local match_dip=$(mirror_gre_ipv6_addr 1 $i)::2
local htun=h3-gt6-$i
local tun=gt6-$i
((mirror_gre_tunnels++))
ip address add dev $h1 $(mirror_gre_ipv6_addr 1 $i)::1/64
ip address add dev $h2 $(mirror_gre_ipv6_addr 1 $i)::2/64
ip address add dev $swp3 $(mirror_gre_ipv6_addr 2 $i)::1/64
ip address add dev $h3 $(mirror_gre_ipv6_addr 2 $i)::2/64
tunnel_create $tun ip6gretap \
$(mirror_gre_ipv6_addr 2 $i)::1 \
$(mirror_gre_ipv6_addr 2 $i)::2 \
ttl 100 tos inherit allow-localremote
tunnel_create $htun ip6gretap \
$(mirror_gre_ipv6_addr 2 $i)::2 \
$(mirror_gre_ipv6_addr 2 $i)::1
ip link set $htun vrf v$h3
matchall_sink_create $htun
cat >> $MIRROR_GRE_BATCH_FILE <<-EOF
filter add dev $swp1 ingress pref 1000 \
protocol ipv6 \
flower $tcflags dst_ip $match_dip \
action mirred egress mirror dev $tun
EOF
done
tc -b $MIRROR_GRE_BATCH_FILE
check_err_fail $should_fail $? "Mirror rule insertion"
}
mirror_gre_tunnels_destroy()
{
local count=$1; shift
for ((i=0; i < count; ++i)); do
local htun=h3-gt6-$i
local tun=gt6-$i
ip address del dev $h3 $(mirror_gre_ipv6_addr 2 $i)::2/64
ip address del dev $swp3 $(mirror_gre_ipv6_addr 2 $i)::1/64
ip address del dev $h2 $(mirror_gre_ipv6_addr 1 $i)::2/64
ip address del dev $h1 $(mirror_gre_ipv6_addr 1 $i)::1/64
tunnel_destroy $htun
tunnel_destroy $tun
done
}
__mirror_gre_test()
{
local count=$1; shift
local should_fail=$1; shift
mirror_gre_tunnels_create $count $should_fail
if ((should_fail)); then
return
fi
sleep 5
for ((i = 0; i < count; ++i)); do
local dip=$(mirror_gre_ipv6_addr 1 $i)::2
local htun=h3-gt6-$i
local message
icmp6_capture_install $htun
mirror_test v$h1 "" $dip $htun 100 10
icmp6_capture_uninstall $htun
done
}
mirror_gre_test()
{
local count=$1; shift
local should_fail=$1; shift
if ! tc_offload_check $TC_FLOWER_NUM_NETIFS; then
check_err 1 "Could not test offloaded functionality"
return
fi
tcflags="skip_sw"
__mirror_gre_test $count $should_fail
}
mirror_gre_setup_prepare()
{
h1=${NETIFS[p1]}
swp1=${NETIFS[p2]}
swp2=${NETIFS[p3]}
h2=${NETIFS[p4]}
swp3=${NETIFS[p5]}
h3=${NETIFS[p6]}
mirror_gre_tunnels=0
vrf_prepare
simple_if_init $h1
simple_if_init $h2
simple_if_init $h3
ip link add name br1 type bridge vlan_filtering 1
ip link set dev br1 up
ip link set dev $swp1 master br1
ip link set dev $swp1 up
tc qdisc add dev $swp1 clsact
ip link set dev $swp2 master br1
ip link set dev $swp2 up
ip link set dev $swp3 up
}
mirror_gre_cleanup()
{
mirror_gre_tunnels_destroy $mirror_gre_tunnels
ip link set dev $swp3 down
ip link set dev $swp2 down
tc qdisc del dev $swp1 clsact
ip link set dev $swp1 down
ip link del dev br1
simple_if_fini $h3
simple_if_fini $h2
simple_if_fini $h1
vrf_cleanup
}
@@ -0,0 +1,189 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# Test for DSCP prioritization and rewrite. Packets ingress $swp1 with a DSCP
# tag and are prioritized according to the map at $swp1. They egress $swp2 and
# the DSCP value is updated to match the map at that interface. The updated DSCP
# tag is verified at $h2.
#
# ICMP responses are produced with the same DSCP tag that arrived at $h2. They
# go through prioritization at $swp2 and DSCP retagging at $swp1. The tag is
# verified at $h1--it should match the original tag.
#
# +----------------------+ +----------------------+
# | H1 | | H2 |
# | + $h1 | | $h2 + |
# | | 192.0.2.1/28 | | 192.0.2.2/28 | |
# +----|-----------------+ +----------------|-----+
# | |
# +----|----------------------------------------------------------------|-----+
# | SW | | |
# | +-|----------------------------------------------------------------|-+ |
# | | + $swp1 BR $swp2 + | |
# | | APP=0,5,10 .. 7,5,17 APP=0,5,20 .. 7,5,27 | |
# | +--------------------------------------------------------------------+ |
# +---------------------------------------------------------------------------+
ALL_TESTS="
ping_ipv4
test_dscp
"
lib_dir=$(dirname $0)/../../../net/forwarding
NUM_NETIFS=4
source $lib_dir/lib.sh
h1_create()
{
local dscp;
simple_if_init $h1 192.0.2.1/28
tc qdisc add dev $h1 clsact
dscp_capture_install $h1 10
}
h1_destroy()
{
dscp_capture_uninstall $h1 10
tc qdisc del dev $h1 clsact
simple_if_fini $h1 192.0.2.1/28
}
h2_create()
{
simple_if_init $h2 192.0.2.2/28
tc qdisc add dev $h2 clsact
dscp_capture_install $h2 20
}
h2_destroy()
{
dscp_capture_uninstall $h2 20
tc qdisc del dev $h2 clsact
simple_if_fini $h2 192.0.2.2/28
}
dscp_map()
{
local base=$1; shift
for prio in {0..7}; do
echo app=$prio,5,$((base + prio))
done
}
switch_create()
{
ip link add name br1 type bridge vlan_filtering 1
ip link set dev br1 up
ip link set dev $swp1 master br1
ip link set dev $swp1 up
ip link set dev $swp2 master br1
ip link set dev $swp2 up
lldptool -T -i $swp1 -V APP $(dscp_map 10) >/dev/null
lldptool -T -i $swp2 -V APP $(dscp_map 20) >/dev/null
lldpad_app_wait_set $swp1
lldpad_app_wait_set $swp2
}
switch_destroy()
{
lldptool -T -i $swp2 -V APP -d $(dscp_map 20) >/dev/null
lldptool -T -i $swp1 -V APP -d $(dscp_map 10) >/dev/null
lldpad_app_wait_del
ip link set dev $swp2 nomaster
ip link set dev $swp1 nomaster
ip link del dev br1
}
setup_prepare()
{
h1=${NETIFS[p1]}
swp1=${NETIFS[p2]}
swp2=${NETIFS[p3]}
h2=${NETIFS[p4]}
vrf_prepare
h1_create
h2_create
switch_create
}
cleanup()
{
pre_cleanup
switch_destroy
h2_destroy
h1_destroy
vrf_cleanup
}
ping_ipv4()
{
ping_test $h1 192.0.2.2
}
dscp_ping_test()
{
local vrf_name=$1; shift
local sip=$1; shift
local dip=$1; shift
local prio=$1; shift
local dev_10=$1; shift
local dev_20=$1; shift
local dscp_10=$(((prio + 10) << 2))
local dscp_20=$(((prio + 20) << 2))
RET=0
local -A t0s
eval "t0s=($(dscp_fetch_stats $dev_10 10)
$(dscp_fetch_stats $dev_20 20))"
ip vrf exec $vrf_name \
${PING} -Q $dscp_10 ${sip:+-I $sip} $dip \
-c 10 -i 0.1 -w 2 &> /dev/null
local -A t1s
eval "t1s=($(dscp_fetch_stats $dev_10 10)
$(dscp_fetch_stats $dev_20 20))"
for key in ${!t0s[@]}; do
local expect
if ((key == prio+10 || key == prio+20)); then
expect=10
else
expect=0
fi
local delta=$((t1s[$key] - t0s[$key]))
((expect == delta))
check_err $? "DSCP $key: Expected to capture $expect packets, got $delta."
done
log_test "DSCP rewrite: $dscp_10-(prio $prio)-$dscp_20"
}
test_dscp()
{
for prio in {0..7}; do
dscp_ping_test v$h1 192.0.2.1 192.0.2.2 $prio $h1 $h2
done
}
trap cleanup EXIT
setup_prepare
setup_wait
tests_run
exit $EXIT_STATUS
@@ -0,0 +1,233 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# Test for DSCP prioritization in the router.
#
# With ip_forward_update_priority disabled, the packets are expected to keep
# their DSCP (which in this test uses only values 0..7) intact as they are
# forwarded by the switch. That is verified at $h2. ICMP responses are formed
# with the same DSCP as the requests, and likewise pass through the switch
# intact, which is verified at $h1.
#
# With ip_forward_update_priority enabled, router reprioritizes the packets
# according to the table in reprioritize(). Thus, say, DSCP 7 maps to priority
# 4, which on egress maps back to DSCP 4. The response packet then gets
# reprioritized to 6, getting DSCP 6 on egress.
#
# +----------------------+ +----------------------+
# | H1 | | H2 |
# | + $h1 | | $h2 + |
# | | 192.0.2.1/28 | | 192.0.2.18/28 | |
# +----|-----------------+ +----------------|-----+
# | |
# +----|----------------------------------------------------------------|-----+
# | SW | | |
# | + $swp1 $swp2 + |
# | 192.0.2.2/28 192.0.2.17/28 |
# | APP=0,5,0 .. 7,5,7 APP=0,5,0 .. 7,5,7 |
# +---------------------------------------------------------------------------+
ALL_TESTS="
ping_ipv4
test_update
test_no_update
"
lib_dir=$(dirname $0)/../../../net/forwarding
NUM_NETIFS=4
source $lib_dir/lib.sh
reprioritize()
{
local in=$1; shift
# This is based on rt_tos2priority in include/net/route.h. Assuming 1:1
# mapping between priorities and TOS, it yields a new priority for a
# packet with ingress priority of $in.
local -a reprio=(0 0 2 2 6 6 4 4)
echo ${reprio[$in]}
}
h1_create()
{
local dscp;
simple_if_init $h1 192.0.2.1/28
tc qdisc add dev $h1 clsact
dscp_capture_install $h1 0
ip route add vrf v$h1 192.0.2.16/28 via 192.0.2.2
}
h1_destroy()
{
ip route del vrf v$h1 192.0.2.16/28 via 192.0.2.2
dscp_capture_uninstall $h1 0
tc qdisc del dev $h1 clsact
simple_if_fini $h1 192.0.2.1/28
}
h2_create()
{
simple_if_init $h2 192.0.2.18/28
tc qdisc add dev $h2 clsact
dscp_capture_install $h2 0
ip route add vrf v$h2 192.0.2.0/28 via 192.0.2.17
}
h2_destroy()
{
ip route del vrf v$h2 192.0.2.0/28 via 192.0.2.17
dscp_capture_uninstall $h2 0
tc qdisc del dev $h2 clsact
simple_if_fini $h2 192.0.2.18/28
}
dscp_map()
{
local base=$1; shift
for prio in {0..7}; do
echo app=$prio,5,$((base + prio))
done
}
switch_create()
{
simple_if_init $swp1 192.0.2.2/28
__simple_if_init $swp2 v$swp1 192.0.2.17/28
lldptool -T -i $swp1 -V APP $(dscp_map 0) >/dev/null
lldptool -T -i $swp2 -V APP $(dscp_map 0) >/dev/null
lldpad_app_wait_set $swp1
lldpad_app_wait_set $swp2
}
switch_destroy()
{
lldptool -T -i $swp2 -V APP -d $(dscp_map 0) >/dev/null
lldptool -T -i $swp1 -V APP -d $(dscp_map 0) >/dev/null
lldpad_app_wait_del
__simple_if_fini $swp2 192.0.2.17/28
simple_if_fini $swp1 192.0.2.2/28
}
setup_prepare()
{
h1=${NETIFS[p1]}
swp1=${NETIFS[p2]}
swp2=${NETIFS[p3]}
h2=${NETIFS[p4]}
vrf_prepare
sysctl_set net.ipv4.ip_forward_update_priority 1
h1_create
h2_create
switch_create
}
cleanup()
{
pre_cleanup
switch_destroy
h2_destroy
h1_destroy
sysctl_restore net.ipv4.ip_forward_update_priority
vrf_cleanup
}
ping_ipv4()
{
ping_test $h1 192.0.2.18
}
dscp_ping_test()
{
local vrf_name=$1; shift
local sip=$1; shift
local dip=$1; shift
local prio=$1; shift
local reprio=$1; shift
local dev1=$1; shift
local dev2=$1; shift
local prio2=$($reprio $prio) # ICMP Request egress prio
local prio3=$($reprio $prio2) # ICMP Response egress prio
local dscp=$((prio << 2)) # ICMP Request ingress DSCP
local dscp2=$((prio2 << 2)) # ICMP Request egress DSCP
local dscp3=$((prio3 << 2)) # ICMP Response egress DSCP
RET=0
eval "local -A dev1_t0s=($(dscp_fetch_stats $dev1 0))"
eval "local -A dev2_t0s=($(dscp_fetch_stats $dev2 0))"
ip vrf exec $vrf_name \
${PING} -Q $dscp ${sip:+-I $sip} $dip \
-c 10 -i 0.1 -w 2 &> /dev/null
eval "local -A dev1_t1s=($(dscp_fetch_stats $dev1 0))"
eval "local -A dev2_t1s=($(dscp_fetch_stats $dev2 0))"
for i in {0..7}; do
local dscpi=$((i << 2))
local expect2=0
local expect3=0
if ((i == prio2)); then
expect2=10
fi
if ((i == prio3)); then
expect3=10
fi
local delta=$((dev2_t1s[$i] - dev2_t0s[$i]))
((expect2 == delta))
check_err $? "DSCP $dscpi@$dev2: Expected to capture $expect2 packets, got $delta."
delta=$((dev1_t1s[$i] - dev1_t0s[$i]))
((expect3 == delta))
check_err $? "DSCP $dscpi@$dev1: Expected to capture $expect3 packets, got $delta."
done
log_test "DSCP rewrite: $dscp-(prio $prio2)-$dscp2-(prio $prio3)-$dscp3"
}
__test_update()
{
local update=$1; shift
local reprio=$1; shift
sysctl_restore net.ipv4.ip_forward_update_priority
sysctl_set net.ipv4.ip_forward_update_priority $update
for prio in {0..7}; do
dscp_ping_test v$h1 192.0.2.1 192.0.2.18 $prio $reprio $h1 $h2
done
}
test_update()
{
__test_update 1 reprioritize
}
test_no_update()
{
__test_update 0 echo
}
trap cleanup EXIT
setup_prepare
setup_wait
tests_run
exit $EXIT_STATUS
@@ -0,0 +1,167 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
ROUTER_NUM_NETIFS=4
router_h1_create()
{
simple_if_init $h1 192.0.1.1/24
ip route add 193.0.0.0/8 via 192.0.1.2 dev $h1
}
router_h1_destroy()
{
ip route del 193.0.0.0/8 via 192.0.1.2 dev $h1
simple_if_fini $h1 192.0.1.1/24
}
router_h2_create()
{
simple_if_init $h2 192.0.2.1/24
tc qdisc add dev $h2 handle ffff: ingress
}
router_h2_destroy()
{
tc qdisc del dev $h2 handle ffff: ingress
simple_if_fini $h2 192.0.2.1/24
}
router_create()
{
ip link set dev $rp1 up
ip link set dev $rp2 up
ip address add 192.0.1.2/24 dev $rp1
ip address add 192.0.2.2/24 dev $rp2
}
router_destroy()
{
ip address del 192.0.2.2/24 dev $rp2
ip address del 192.0.1.2/24 dev $rp1
ip link set dev $rp2 down
ip link set dev $rp1 down
}
router_setup_prepare()
{
h1=${NETIFS[p1]}
rp1=${NETIFS[p2]}
rp2=${NETIFS[p3]}
h2=${NETIFS[p4]}
h1mac=$(mac_get $h1)
rp1mac=$(mac_get $rp1)
vrf_prepare
router_h1_create
router_h2_create
router_create
}
router_offload_validate()
{
local route_count=$1
local offloaded_count
offloaded_count=$(ip route | grep -o 'offload' | wc -l)
[[ $offloaded_count -ge $route_count ]]
}
router_routes_create()
{
local route_count=$1
local count=0
ROUTE_FILE="$(mktemp)"
for i in {0..255}
do
for j in {0..255}
do
for k in {0..255}
do
if [[ $count -eq $route_count ]]; then
break 3
fi
echo route add 193.${i}.${j}.${k}/32 via \
192.0.2.1 dev $rp2 >> $ROUTE_FILE
((count++))
done
done
done
ip -b $ROUTE_FILE &> /dev/null
}
router_routes_destroy()
{
if [[ -v ROUTE_FILE ]]; then
rm -f $ROUTE_FILE
fi
}
router_test()
{
local route_count=$1
local should_fail=$2
local count=0
RET=0
router_routes_create $route_count
router_offload_validate $route_count
check_err_fail $should_fail $? "Offload of $route_count routes"
if [[ $RET -ne 0 ]] || [[ $should_fail -eq 1 ]]; then
return
fi
tc filter add dev $h2 ingress protocol ip pref 1 flower \
skip_sw dst_ip 193.0.0.0/8 action drop
for i in {0..255}
do
for j in {0..255}
do
for k in {0..255}
do
if [[ $count -eq $route_count ]]; then
break 3
fi
$MZ $h1 -c 1 -p 64 -a $h1mac -b $rp1mac \
-A 192.0.1.1 -B 193.${i}.${j}.${k} \
-t ip -q
((count++))
done
done
done
tc_check_packets "dev $h2 ingress" 1 $route_count
check_err $? "Offload mismatch"
tc filter del dev $h2 ingress protocol ip pref 1 flower \
skip_sw dst_ip 193.0.0.0/8 action drop
router_routes_destroy
}
router_cleanup()
{
pre_cleanup
router_routes_destroy
router_destroy
router_h2_destroy
router_h1_destroy
vrf_cleanup
}
@@ -0,0 +1,366 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# This test is for checking the A-TCAM and C-TCAM operation in Spectrum-2.
# It tries to exercise as many code paths in the eRP state machine as
# possible.
lib_dir=$(dirname $0)/../../../../net/forwarding
ALL_TESTS="single_mask_test identical_filters_test two_masks_test \
multiple_masks_test ctcam_edge_cases_test"
NUM_NETIFS=2
source $lib_dir/tc_common.sh
source $lib_dir/lib.sh
tcflags="skip_hw"
h1_create()
{
simple_if_init $h1 192.0.2.1/24 198.51.100.1/24
}
h1_destroy()
{
simple_if_fini $h1 192.0.2.1/24 198.51.100.1/24
}
h2_create()
{
simple_if_init $h2 192.0.2.2/24 198.51.100.2/24
tc qdisc add dev $h2 clsact
}
h2_destroy()
{
tc qdisc del dev $h2 clsact
simple_if_fini $h2 192.0.2.2/24 198.51.100.2/24
}
single_mask_test()
{
# When only a single mask is required, the device uses the master
# mask and not the eRP table. Verify that under this mode the right
# filter is matched
RET=0
tc filter add dev $h2 ingress protocol ip pref 1 handle 101 flower \
$tcflags dst_ip 192.0.2.2 action drop
$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \
-t ip -q
tc_check_packets "dev $h2 ingress" 101 1
check_err $? "Single filter - did not match"
tc filter add dev $h2 ingress protocol ip pref 2 handle 102 flower \
$tcflags dst_ip 198.51.100.2 action drop
$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \
-t ip -q
tc_check_packets "dev $h2 ingress" 101 2
check_err $? "Two filters - did not match highest priority"
$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 198.51.100.1 -B 198.51.100.2 \
-t ip -q
tc_check_packets "dev $h2 ingress" 102 1
check_err $? "Two filters - did not match lowest priority"
tc filter del dev $h2 ingress protocol ip pref 1 handle 101 flower
$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 198.51.100.1 -B 198.51.100.2 \
-t ip -q
tc_check_packets "dev $h2 ingress" 102 2
check_err $? "Single filter - did not match after delete"
tc filter del dev $h2 ingress protocol ip pref 2 handle 102 flower
log_test "single mask test ($tcflags)"
}
identical_filters_test()
{
# When two filters that only differ in their priority are used,
# one needs to be inserted into the C-TCAM. This test verifies
# that filters are correctly spilled to C-TCAM and that the right
# filter is matched
RET=0
tc filter add dev $h2 ingress protocol ip pref 1 handle 101 flower \
$tcflags dst_ip 192.0.2.2 action drop
tc filter add dev $h2 ingress protocol ip pref 2 handle 102 flower \
$tcflags dst_ip 192.0.2.2 action drop
$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \
-t ip -q
tc_check_packets "dev $h2 ingress" 101 1
check_err $? "Did not match A-TCAM filter"
tc filter del dev $h2 ingress protocol ip pref 1 handle 101 flower
$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \
-t ip -q
tc_check_packets "dev $h2 ingress" 102 1
check_err $? "Did not match C-TCAM filter after A-TCAM delete"
tc filter add dev $h2 ingress protocol ip pref 3 handle 103 flower \
$tcflags dst_ip 192.0.2.2 action drop
$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \
-t ip -q
tc_check_packets "dev $h2 ingress" 102 2
check_err $? "Did not match C-TCAM filter after A-TCAM add"
tc filter del dev $h2 ingress protocol ip pref 2 handle 102 flower
$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \
-t ip -q
tc_check_packets "dev $h2 ingress" 103 1
check_err $? "Did not match A-TCAM filter after C-TCAM delete"
tc filter del dev $h2 ingress protocol ip pref 3 handle 103 flower
log_test "identical filters test ($tcflags)"
}
two_masks_test()
{
# When more than one mask is required, the eRP table is used. This
# test verifies that the eRP table is correctly allocated and used
RET=0
tc filter add dev $h2 ingress protocol ip pref 1 handle 101 flower \
$tcflags dst_ip 192.0.2.2 action drop
tc filter add dev $h2 ingress protocol ip pref 3 handle 103 flower \
$tcflags dst_ip 192.0.0.0/16 action drop
$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \
-t ip -q
tc_check_packets "dev $h2 ingress" 101 1
check_err $? "Two filters - did not match highest priority"
tc filter del dev $h2 ingress protocol ip pref 1 handle 101 flower
$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \
-t ip -q
tc_check_packets "dev $h2 ingress" 103 1
check_err $? "Single filter - did not match"
tc filter add dev $h2 ingress protocol ip pref 2 handle 102 flower \
$tcflags dst_ip 192.0.2.0/24 action drop
$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \
-t ip -q
tc_check_packets "dev $h2 ingress" 102 1
check_err $? "Two filters - did not match highest priority after add"
tc filter del dev $h2 ingress protocol ip pref 3 handle 103 flower
tc filter del dev $h2 ingress protocol ip pref 2 handle 102 flower
log_test "two masks test ($tcflags)"
}
multiple_masks_test()
{
# The number of masks in a region is limited. Once the maximum
# number of masks has been reached filters that require new
# masks are spilled to the C-TCAM. This test verifies that
# spillage is performed correctly and that the right filter is
# matched
local index
RET=0
NUM_MASKS=32
BASE_INDEX=100
for i in $(eval echo {1..$NUM_MASKS}); do
index=$((BASE_INDEX - i))
tc filter add dev $h2 ingress protocol ip pref $index \
handle $index \
flower $tcflags dst_ip 192.0.2.2/${i} src_ip 192.0.2.1 \
action drop
$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 \
-B 192.0.2.2 -t ip -q
tc_check_packets "dev $h2 ingress" $index 1
check_err $? "$i filters - did not match highest priority (add)"
done
for i in $(eval echo {$NUM_MASKS..1}); do
index=$((BASE_INDEX - i))
$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 \
-B 192.0.2.2 -t ip -q
tc_check_packets "dev $h2 ingress" $index 2
check_err $? "$i filters - did not match highest priority (del)"
tc filter del dev $h2 ingress protocol ip pref $index \
handle $index flower
done
log_test "multiple masks test ($tcflags)"
}
ctcam_two_atcam_masks_test()
{
RET=0
# First case: C-TCAM is disabled when there are two A-TCAM masks.
# We push a filter into the C-TCAM by using two identical filters
# as in identical_filters_test()
# Filter goes into A-TCAM
tc filter add dev $h2 ingress protocol ip pref 1 handle 101 flower \
$tcflags dst_ip 192.0.2.2 action drop
# Filter goes into C-TCAM
tc filter add dev $h2 ingress protocol ip pref 2 handle 102 flower \
$tcflags dst_ip 192.0.2.2 action drop
# Filter goes into A-TCAM
tc filter add dev $h2 ingress protocol ip pref 3 handle 103 flower \
$tcflags dst_ip 192.0.2.0/24 action drop
$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \
-t ip -q
tc_check_packets "dev $h2 ingress" 101 1
check_err $? "Did not match A-TCAM filter"
# Delete both A-TCAM and C-TCAM filters and make sure the remaining
# A-TCAM filter still works
tc filter del dev $h2 ingress protocol ip pref 2 handle 102 flower
tc filter del dev $h2 ingress protocol ip pref 1 handle 101 flower
$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \
-t ip -q
tc_check_packets "dev $h2 ingress" 103 1
check_err $? "Did not match A-TCAM filter"
tc filter del dev $h2 ingress protocol ip pref 3 handle 103 flower
log_test "ctcam with two atcam masks test ($tcflags)"
}
ctcam_one_atcam_mask_test()
{
RET=0
# Second case: C-TCAM is disabled when there is one A-TCAM mask.
# The test is similar to identical_filters_test()
# Filter goes into A-TCAM
tc filter add dev $h2 ingress protocol ip pref 2 handle 102 flower \
$tcflags dst_ip 192.0.2.2 action drop
# Filter goes into C-TCAM
tc filter add dev $h2 ingress protocol ip pref 1 handle 101 flower \
$tcflags dst_ip 192.0.2.2 action drop
$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \
-t ip -q
tc_check_packets "dev $h2 ingress" 101 1
check_err $? "Did not match C-TCAM filter"
tc filter del dev $h2 ingress protocol ip pref 1 handle 101 flower
$MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \
-t ip -q
tc_check_packets "dev $h2 ingress" 102 1
check_err $? "Did not match A-TCAM filter"
tc filter del dev $h2 ingress protocol ip pref 2 handle 102 flower
log_test "ctcam with one atcam mask test ($tcflags)"
}
ctcam_no_atcam_masks_test()
{
RET=0
# Third case: C-TCAM is disabled when there are no A-TCAM masks
# This test exercises the code path that transitions the eRP table
# to its initial state after deleting the last C-TCAM mask
# Filter goes into A-TCAM
tc filter add dev $h2 ingress protocol ip pref 1 handle 101 flower \
$tcflags dst_ip 192.0.2.2 action drop
# Filter goes into C-TCAM
tc filter add dev $h2 ingress protocol ip pref 2 handle 102 flower \
$tcflags dst_ip 192.0.2.2 action drop
tc filter del dev $h2 ingress protocol ip pref 1 handle 101 flower
tc filter del dev $h2 ingress protocol ip pref 2 handle 102 flower
log_test "ctcam with no atcam masks test ($tcflags)"
}
ctcam_edge_cases_test()
{
# When the C-TCAM is disabled after deleting the last C-TCAM
# mask, we want to make sure the eRP state machine is put in
# the correct state
ctcam_two_atcam_masks_test
ctcam_one_atcam_mask_test
ctcam_no_atcam_masks_test
}
setup_prepare()
{
h1=${NETIFS[p1]}
h2=${NETIFS[p2]}
h1mac=$(mac_get $h1)
h2mac=$(mac_get $h2)
vrf_prepare
h1_create
h2_create
}
cleanup()
{
pre_cleanup
h2_destroy
h1_destroy
vrf_cleanup
}
trap cleanup EXIT
setup_prepare
setup_wait
tests_run
if ! tc_offload_check; then
check_err 1 "Could not test offloaded functionality"
log_test "mlxsw-specific tests for tc flower"
exit
else
tcflags="skip_sw"
tests_run
fi
exit $EXIT_STATUS
@@ -0,0 +1,119 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
source "../../../../net/forwarding/devlink_lib.sh"
if [ "$DEVLINK_VIDDID" != "15b3:cb84" ]; then
echo "SKIP: test is tailored for Mellanox Spectrum"
exit 1
fi
# Needed for returning to default
declare -A KVD_DEFAULTS
KVD_CHILDREN="linear hash_single hash_double"
KVDL_CHILDREN="singles chunks large_chunks"
devlink_sp_resource_minimize()
{
local size
local i
for i in $KVD_CHILDREN; do
size=$(devlink_resource_get kvd "$i" | jq '.["size_min"]')
devlink_resource_size_set "$size" kvd "$i"
done
for i in $KVDL_CHILDREN; do
size=$(devlink_resource_get kvd linear "$i" | \
jq '.["size_min"]')
devlink_resource_size_set "$size" kvd linear "$i"
done
}
devlink_sp_size_kvd_to_default()
{
local need_reload=0
local i
for i in $KVD_CHILDREN; do
local size=$(echo "${KVD_DEFAULTS[kvd_$i]}" | jq '.["size"]')
current_size=$(devlink_resource_size_get kvd "$i")
if [ "$size" -ne "$current_size" ]; then
devlink_resource_size_set "$size" kvd "$i"
need_reload=1
fi
done
for i in $KVDL_CHILDREN; do
local size=$(echo "${KVD_DEFAULTS[kvd_linear_$i]}" | \
jq '.["size"]')
current_size=$(devlink_resource_size_get kvd linear "$i")
if [ "$size" -ne "$current_size" ]; then
devlink_resource_size_set "$size" kvd linear "$i"
need_reload=1
fi
done
if [ "$need_reload" -ne "0" ]; then
devlink_reload
fi
}
devlink_sp_read_kvd_defaults()
{
local key
local i
KVD_DEFAULTS[kvd]=$(devlink_resource_get "kvd")
for i in $KVD_CHILDREN; do
key=kvd_$i
KVD_DEFAULTS[$key]=$(devlink_resource_get kvd "$i")
done
for i in $KVDL_CHILDREN; do
key=kvd_linear_$i
KVD_DEFAULTS[$key]=$(devlink_resource_get kvd linear "$i")
done
}
KVD_PROFILES="default scale ipv4_max"
devlink_sp_resource_kvd_profile_set()
{
local profile=$1
case "$profile" in
scale)
devlink_resource_size_set 64000 kvd linear
devlink_resource_size_set 15616 kvd linear singles
devlink_resource_size_set 32000 kvd linear chunks
devlink_resource_size_set 16384 kvd linear large_chunks
devlink_resource_size_set 128000 kvd hash_single
devlink_resource_size_set 48000 kvd hash_double
devlink_reload
;;
ipv4_max)
devlink_resource_size_set 64000 kvd linear
devlink_resource_size_set 15616 kvd linear singles
devlink_resource_size_set 32000 kvd linear chunks
devlink_resource_size_set 16384 kvd linear large_chunks
devlink_resource_size_set 144000 kvd hash_single
devlink_resource_size_set 32768 kvd hash_double
devlink_reload
;;
default)
devlink_resource_size_set 98304 kvd linear
devlink_resource_size_set 16384 kvd linear singles
devlink_resource_size_set 49152 kvd linear chunks
devlink_resource_size_set 32768 kvd linear large_chunks
devlink_resource_size_set 87040 kvd hash_single
devlink_resource_size_set 60416 kvd hash_double
devlink_reload
;;
*)
check_err 1 "Unknown profile $profile"
esac
}
@@ -0,0 +1,117 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
NUM_NETIFS=1
source devlink_lib_spectrum.sh
setup_prepare()
{
devlink_sp_read_kvd_defaults
}
cleanup()
{
pre_cleanup
devlink_sp_size_kvd_to_default
}
trap cleanup EXIT
setup_prepare
profiles_test()
{
local i
log_info "Running profile tests"
for i in $KVD_PROFILES; do
RET=0
devlink_sp_resource_kvd_profile_set $i
log_test "'$i' profile"
done
# Default is explicitly tested at end to ensure it's actually applied
RET=0
devlink_sp_resource_kvd_profile_set "default"
log_test "'default' profile"
}
resources_min_test()
{
local size
local i
local j
log_info "Running KVD-minimum tests"
for i in $KVD_CHILDREN; do
RET=0
size=$(devlink_resource_get kvd "$i" | jq '.["size_min"]')
devlink_resource_size_set "$size" kvd "$i"
# In case of linear, need to minimize sub-resources as well
if [[ "$i" == "linear" ]]; then
for j in $KVDL_CHILDREN; do
devlink_resource_size_set 0 kvd linear "$j"
done
fi
devlink_reload
devlink_sp_size_kvd_to_default
log_test "'$i' minimize [$size]"
done
}
resources_max_test()
{
local min_size
local size
local i
local j
log_info "Running KVD-maximum tests"
for i in $KVD_CHILDREN; do
RET=0
devlink_sp_resource_minimize
# Calculate the maximum possible size for the given partition
size=$(devlink_resource_size_get kvd)
for j in $KVD_CHILDREN; do
if [ "$i" != "$j" ]; then
min_size=$(devlink_resource_get kvd "$j" | \
jq '.["size_min"]')
size=$((size - min_size))
fi
done
# Test almost maximum size
devlink_resource_size_set "$((size - 128))" kvd "$i"
devlink_reload
log_test "'$i' almost maximize [$((size - 128))]"
# Test above maximum size
devlink resource set "$DEVLINK_DEV" \
path "kvd/$i" size $((size + 128)) &> /dev/null
check_fail $? "Set kvd/$i to size $((size + 128)) should fail"
log_test "'$i' Overflow rejection [$((size + 128))]"
# Test maximum size
if [ "$i" == "hash_single" ] || [ "$i" == "hash_double" ]; then
echo "SKIP: Observed problem with exact max $i"
continue
fi
devlink_resource_size_set "$size" kvd "$i"
devlink_reload
log_test "'$i' maximize [$size]"
devlink_sp_size_kvd_to_default
done
}
profiles_test
resources_min_test
resources_max_test
exit "$RET"
@@ -0,0 +1,13 @@
# SPDX-License-Identifier: GPL-2.0
source ../mirror_gre_scale.sh
mirror_gre_get_target()
{
local should_fail=$1; shift
if ((! should_fail)); then
echo 3
else
echo 4
fi
}
@@ -0,0 +1,55 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
NUM_NETIFS=6
source ../../../../net/forwarding/lib.sh
source ../../../../net/forwarding/tc_common.sh
source devlink_lib_spectrum.sh
current_test=""
cleanup()
{
pre_cleanup
if [ ! -z $current_test ]; then
${current_test}_cleanup
fi
devlink_sp_size_kvd_to_default
}
devlink_sp_read_kvd_defaults
trap cleanup EXIT
ALL_TESTS="router tc_flower mirror_gre"
for current_test in ${TESTS:-$ALL_TESTS}; do
source ${current_test}_scale.sh
num_netifs_var=${current_test^^}_NUM_NETIFS
num_netifs=${!num_netifs_var:-$NUM_NETIFS}
for profile in $KVD_PROFILES; do
RET=0
devlink_sp_resource_kvd_profile_set $profile
if [[ $RET -gt 0 ]]; then
log_test "'$current_test' [$profile] setting"
continue
fi
for should_fail in 0 1; do
RET=0
target=$(${current_test}_get_target "$should_fail")
${current_test}_setup_prepare
setup_wait $num_netifs
${current_test}_test "$target" "$should_fail"
${current_test}_cleanup
if [[ "$should_fail" -eq 0 ]]; then
log_test "'$current_test' [$profile] $target"
else
log_test "'$current_test' [$profile] overflow $target"
fi
done
done
done
current_test=""
exit "$RET"
@@ -0,0 +1,18 @@
# SPDX-License-Identifier: GPL-2.0
source ../router_scale.sh
router_get_target()
{
local should_fail=$1
local target
target=$(devlink_resource_size_get kvd hash_single)
if [[ $should_fail -eq 0 ]]; then
target=$((target * 85 / 100))
else
target=$((target + 1))
fi
echo $target
}
@@ -0,0 +1,19 @@
# SPDX-License-Identifier: GPL-2.0
source ../tc_flower_scale.sh
tc_flower_get_target()
{
local should_fail=$1; shift
# 6144 (6x1024) is the theoretical maximum.
# One bank of 512 rules is taken by the 18-byte MC router rule.
# One rule is the ACL catch-all.
# 6144 - 512 - 1 = 5631
local target=5631
if ((! should_fail)); then
echo $target
else
echo $((target + 1))
fi
}
@@ -0,0 +1,134 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# Test for resource limit of offloaded flower rules. The test adds a given
# number of flower matches for different IPv6 addresses, then generates traffic,
# and ensures each was hit exactly once. This file contains functions to set up
# a testing topology and run the test, and is meant to be sourced from a test
# script that calls the testing routine with a given number of rules.
TC_FLOWER_NUM_NETIFS=2
tc_flower_h1_create()
{
simple_if_init $h1
tc qdisc add dev $h1 clsact
}
tc_flower_h1_destroy()
{
tc qdisc del dev $h1 clsact
simple_if_fini $h1
}
tc_flower_h2_create()
{
simple_if_init $h2
tc qdisc add dev $h2 clsact
}
tc_flower_h2_destroy()
{
tc qdisc del dev $h2 clsact
simple_if_fini $h2
}
tc_flower_setup_prepare()
{
h1=${NETIFS[p1]}
h2=${NETIFS[p2]}
vrf_prepare
tc_flower_h1_create
tc_flower_h2_create
}
tc_flower_cleanup()
{
pre_cleanup
tc_flower_h2_destroy
tc_flower_h1_destroy
vrf_cleanup
if [[ -v TC_FLOWER_BATCH_FILE ]]; then
rm -f $TC_FLOWER_BATCH_FILE
fi
}
tc_flower_addr()
{
local num=$1; shift
printf "2001:db8:1::%x" $num
}
tc_flower_rules_create()
{
local count=$1; shift
local should_fail=$1; shift
TC_FLOWER_BATCH_FILE="$(mktemp)"
for ((i = 0; i < count; ++i)); do
cat >> $TC_FLOWER_BATCH_FILE <<-EOF
filter add dev $h2 ingress \
prot ipv6 \
pref 1000 \
flower $tcflags dst_ip $(tc_flower_addr $i) \
action drop
EOF
done
tc -b $TC_FLOWER_BATCH_FILE
check_err_fail $should_fail $? "Rule insertion"
}
__tc_flower_test()
{
local count=$1; shift
local should_fail=$1; shift
local last=$((count - 1))
tc_flower_rules_create $count $should_fail
for ((i = 0; i < count; ++i)); do
$MZ $h1 -q -c 1 -t ip -p 20 -b bc -6 \
-A 2001:db8:2::1 \
-B $(tc_flower_addr $i)
done
MISMATCHES=$(
tc -j -s filter show dev $h2 ingress |
jq -r '[ .[] | select(.kind == "flower") | .options |
values as $rule | .actions[].stats.packets |
select(. != 1) | "\(.) on \($rule.keys.dst_ip)" ] |
join(", ")'
)
test -z "$MISMATCHES"
check_err $? "Expected to capture 1 packet for each IP, but got $MISMATCHES"
}
tc_flower_test()
{
local count=$1; shift
local should_fail=$1; shift
# We use lower 16 bits of IPv6 address for match. Also there are only 16
# bits of rule priority space.
if ((count > 65536)); then
check_err 1 "Invalid count of $count. At most 65536 rules supported"
return
fi
if ! tc_offload_check $TC_FLOWER_NUM_NETIFS; then
check_err 1 "Could not test offloaded functionality"
return
fi
tcflags="skip_sw"
__tc_flower_test $count $should_fail
}