mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
add test cases for ingress_policing_kpkts parameters
Exercise OVS setting of ingress_policing_kpkts parameters using ovs-vsctl and verify that the correct values are stored on OVSDB. Verify the ingress_policing parameters with tc command. Also check offload and non-offload in tc software datapath based on tc filter type (matchall and basic). Skip test of pps if OVS or kernel does not support pps rate limit. Example invocation: make check TESTSUITEFLAGS='-k ingress_policing_kpkts' make check-offloads TESTSUITEFLAGS='-k ingress_policing_kpkts' Signed-off-by: Tianyu Yuan <tianyu.yuan@corigine.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
This commit is contained in:
committed by
Simon Horman
parent
c2567e533f
commit
f686957c96
@@ -159,9 +159,6 @@ find_command()
|
||||
# Set HAVE_NC
|
||||
find_command nc
|
||||
|
||||
# Set HAVE_TC
|
||||
find_command tc
|
||||
|
||||
# Determine correct netcat option to quit on stdin EOF
|
||||
if nc --version 2>&1 | grep -q nmap.org; then
|
||||
# Nmap netcat
|
||||
@@ -171,6 +168,20 @@ else
|
||||
NC_EOF_OPT="-q 1 -w 5"
|
||||
fi
|
||||
|
||||
# Set HAVE_TC
|
||||
find_command tc
|
||||
|
||||
# When HAVE_TC=yes, check if the current tc supports adding pps filter
|
||||
SUPPORT_TC_INGRESS_PPS="no"
|
||||
if test $HAVE_TC="yes"; then
|
||||
ip link add veth0 type veth peer name veth1
|
||||
tc qdisc add dev veth0 handle ffff: ingress
|
||||
if tc filter add dev veth0 parent ffff: u32 match u32 0 0 police pkts_rate 100 pkts_burst 10; then
|
||||
SUPPORT_TC_INGRESS_PPS="yes"
|
||||
fi
|
||||
ip link del veth0
|
||||
fi
|
||||
|
||||
# Set HAVE_TCPDUMP
|
||||
find_command tcpdump
|
||||
|
||||
|
@@ -1687,3 +1687,26 @@ ingress_policing_rate: 100
|
||||
])
|
||||
OVS_VSCTL_CLEANUP
|
||||
AT_CLEANUP
|
||||
|
||||
dnl ----------------------------------------------------------------------
|
||||
AT_BANNER([set ingress policing(kpkts) test])
|
||||
|
||||
AT_SETUP([set ingress_policing_kpkts_rate and ingress_policing_kpkts_burst])
|
||||
AT_KEYWORDS([ingress_policing_kpkts])
|
||||
OVS_VSCTL_SETUP
|
||||
AT_CHECK([RUN_OVS_VSCTL_TOGETHER(
|
||||
[add-br a],
|
||||
[add-port a a1],
|
||||
[set interface a1 ingress_policing_kpkts_rate=100],
|
||||
[set interface a1 ingress_policing_kpkts_burst=10],
|
||||
[--columns=ingress_policing_kpkts_burst,ingress_policing_kpkts_rate list interface a1])],
|
||||
[0],
|
||||
[
|
||||
|
||||
|
||||
|
||||
ingress_policing_kpkts_burst: 10
|
||||
ingress_policing_kpkts_rate: 100
|
||||
])
|
||||
OVS_VSCTL_CLEANUP
|
||||
AT_CLEANUP
|
||||
|
@@ -120,3 +120,53 @@ matchall
|
||||
])
|
||||
OVS_TRAFFIC_VSWITCHD_STOP
|
||||
AT_CLEANUP
|
||||
|
||||
AT_SETUP([offloads - set ingress_policing_kpkts_rate and ingress_policing_kpkts_burst - offloads disabled])
|
||||
AT_KEYWORDS([ingress_policing_kpkts])
|
||||
AT_SKIP_IF([test $SUPPORT_TC_INGRESS_PPS = "no"])
|
||||
OVS_TRAFFIC_VSWITCHD_START()
|
||||
AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:hw-offload=false])
|
||||
AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"])
|
||||
ADD_NAMESPACES(at_ns0)
|
||||
ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24")
|
||||
AT_CHECK([ovs-vsctl set interface ovs-p0 ingress_policing_kpkts_rate=100])
|
||||
AT_CHECK([ovs-vsctl set interface ovs-p0 ingress_policing_kpkts_burst=10])
|
||||
AT_CHECK([ovs-vsctl --columns=other_config list open], [0], [dnl
|
||||
other_config : {hw-offload="false"}
|
||||
])
|
||||
AT_CHECK([tc -o -s -d filter show dev ovs-p0 ingress |
|
||||
sed -n 's/.*\(pkts_rate [[0-9]]*[[a-zA-Z]]* pkts_burst [[0-9]]*[[a-zA-Z]]*\).*/\1/; T; p; q'],
|
||||
[0],[dnl
|
||||
pkts_rate 100000 pkts_burst 10240
|
||||
])
|
||||
AT_CHECK([tc -s -d filter show dev ovs-p0 ingress |
|
||||
sed -n 's/.*\(basic\).*/\1/; T; p; q'], [0], [dnl
|
||||
basic
|
||||
])
|
||||
OVS_TRAFFIC_VSWITCHD_STOP
|
||||
AT_CLEANUP
|
||||
|
||||
AT_SETUP([offloads - set ingress_policing_kpkts_rate and ingress_policing_kpkts_burst - offloads enabled])
|
||||
AT_KEYWORDS([ingress_policing_kpkts])
|
||||
AT_SKIP_IF([test $SUPPORT_TC_INGRESS_PPS = "no"])
|
||||
OVS_TRAFFIC_VSWITCHD_START()
|
||||
AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:hw-offload=true])
|
||||
AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"])
|
||||
ADD_NAMESPACES(at_ns0)
|
||||
ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24")
|
||||
AT_CHECK([ovs-vsctl set interface ovs-p0 ingress_policing_kpkts_rate=100])
|
||||
AT_CHECK([ovs-vsctl set interface ovs-p0 ingress_policing_kpkts_burst=10])
|
||||
AT_CHECK([ovs-vsctl --columns=other_config list open], [0], [dnl
|
||||
other_config : {hw-offload="true"}
|
||||
])
|
||||
AT_CHECK([tc -o -s -d filter show dev ovs-p0 ingress |
|
||||
sed -n 's/.*\(pkts_rate [[0-9]]*[[a-zA-Z]]* pkts_burst [[0-9]]*[[a-zA-Z]]*\).*/\1/; T; p; q'],
|
||||
[0],[dnl
|
||||
pkts_rate 100000 pkts_burst 10240
|
||||
])
|
||||
AT_CHECK([tc -s -d filter show dev ovs-p0 ingress |
|
||||
sed -n 's/.*\(matchall\).*/\1/; T; p; q'], [0], [dnl
|
||||
matchall
|
||||
])
|
||||
OVS_TRAFFIC_VSWITCHD_STOP
|
||||
AT_CLEANUP
|
||||
|
Reference in New Issue
Block a user