diff mbox series

[ovs-dev,v12,5/6] tests: system-traffic: Add coverage for drop action.

Message ID 20240315195508.95099-6-eric@garver.life
State Changes Requested
Delegated to: Eelco Chaudron
Headers show
Series dpif: probe support for OVS_ACTION_ATTR_DROP | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Eric Garver March 15, 2024, 7:55 p.m. UTC
Exercise the drop action in the datapath. This specific tests triggers
an xlate_error.

For the kernel datapath skb drop reasons can then be seen while this
test runs.

 # perf trace -e skb:kfree_skb --filter="reason >= 0x30000"
   0.000 ping/1275884 skb:kfree_skb(skbaddr: 0xffff8acd76546000, \
      location: 0xffffffffc0ee3634, protocol: 2048, reason: 196611)

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Eric Garver <eric@garver.life>
---
 tests/system-common-macros.at |  4 ++++
 tests/system-traffic.at       | 31 +++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

Comments

Eelco Chaudron March 22, 2024, 10:05 a.m. UTC | #1
On 15 Mar 2024, at 20:55, Eric Garver wrote:

> Exercise the drop action in the datapath. This specific tests triggers
> an xlate_error.
>
> For the kernel datapath skb drop reasons can then be seen while this
> test runs.
>
>  # perf trace -e skb:kfree_skb --filter="reason >= 0x30000"
>    0.000 ping/1275884 skb:kfree_skb(skbaddr: 0xffff8acd76546000, \
>       location: 0xffffffffc0ee3634, protocol: 2048, reason: 196611)
>
> Acked-by: Eelco Chaudron <echaudro@redhat.com>
> Signed-off-by: Eric Garver <eric@garver.life>

Looking at this patch again I have one small comment, see below.

//Eelco


> ---
>  tests/system-common-macros.at |  4 ++++
>  tests/system-traffic.at       | 31 +++++++++++++++++++++++++++++++
>  2 files changed, 35 insertions(+)
>
> diff --git a/tests/system-common-macros.at b/tests/system-common-macros.at
> index 01ebe364ee7c..2a68cd664e5c 100644
> --- a/tests/system-common-macros.at
> +++ b/tests/system-common-macros.at
> @@ -374,3 +374,7 @@ m4_define([OVS_CHECK_CT_CLEAR],
>  # OVS_CHECK_GITHUB_ACTION
>  m4_define([OVS_CHECK_GITHUB_ACTION],
>      [AT_SKIP_IF([test "$GITHUB_ACTIONS" = "true"])])
> +
> +# OVS_CHECK_DROP_ACTION()
> +m4_define([OVS_CHECK_DROP_ACTION],
> +    [AT_SKIP_IF([! grep -q "Datapath supports explicit drop action" ovs-vswitchd.log])])
> diff --git a/tests/system-traffic.at b/tests/system-traffic.at
> index 2d12d558ec2f..2ddb4921c60e 100644
> --- a/tests/system-traffic.at
> +++ b/tests/system-traffic.at
> @@ -2231,6 +2231,37 @@ masks-cache:size:256
>  OVS_TRAFFIC_VSWITCHD_STOP
>  AT_CLEANUP
>
> +AT_SETUP([datapath - drop action])
> +OVS_TRAFFIC_VSWITCHD_START()
> +OVS_CHECK_DROP_ACTION()
> +AT_KEYWORDS(drop_action)
> +
> +ADD_NAMESPACES(at_ns0, at_ns1)
> +
> +ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24")
> +ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24")
> +
> +dnl Exceed the max number of resubmits.
> +(echo "dl_type=0x806, actions=normal"
> +for i in `seq 1 64`; do
> +     j=`expr $i + 1`
> +     echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
> + done
> + echo "in_port=65, actions=local"
> +) > flows.txt
> +AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
> +
> +dnl Generate some traffic.
> +NS_CHECK_EXEC([at_ns0], [ping -q -c 10 -i 0.1 -w 2 10.1.1.2], [1], [ignore])
> +
> +OVS_WAIT_UNTIL_EQUAL([ovs-appctl dpctl/dump-flows | grep "eth_type(0x0800)" | dnl
> +          sed 's/,packet_type(ns=[[0-9]]*,id=[[0-9]]*),/,/;s/,eth(),/,/;' | dnl

There are two macros to do this sed command, maybe we should use those instead.

strip_ptype | strip_eth

> +          strip_recirc | strip_stats | strip_used | sort], [dnl
> +recirc_id(<recirc>),in_port(2),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:0.0s, actions:drop])
> +
> +OVS_TRAFFIC_VSWITCHD_STOP(["/|WARN|/d"])
> +AT_CLEANUP
> +
>  AT_SETUP([datapath - simulated flow action update])
>  OVS_TRAFFIC_VSWITCHD_START()
>
> -- 
> 2.43.0
diff mbox series

Patch

diff --git a/tests/system-common-macros.at b/tests/system-common-macros.at
index 01ebe364ee7c..2a68cd664e5c 100644
--- a/tests/system-common-macros.at
+++ b/tests/system-common-macros.at
@@ -374,3 +374,7 @@  m4_define([OVS_CHECK_CT_CLEAR],
 # OVS_CHECK_GITHUB_ACTION
 m4_define([OVS_CHECK_GITHUB_ACTION],
     [AT_SKIP_IF([test "$GITHUB_ACTIONS" = "true"])])
+
+# OVS_CHECK_DROP_ACTION()
+m4_define([OVS_CHECK_DROP_ACTION],
+    [AT_SKIP_IF([! grep -q "Datapath supports explicit drop action" ovs-vswitchd.log])])
diff --git a/tests/system-traffic.at b/tests/system-traffic.at
index 2d12d558ec2f..2ddb4921c60e 100644
--- a/tests/system-traffic.at
+++ b/tests/system-traffic.at
@@ -2231,6 +2231,37 @@  masks-cache:size:256
 OVS_TRAFFIC_VSWITCHD_STOP
 AT_CLEANUP
 
+AT_SETUP([datapath - drop action])
+OVS_TRAFFIC_VSWITCHD_START()
+OVS_CHECK_DROP_ACTION()
+AT_KEYWORDS(drop_action)
+
+ADD_NAMESPACES(at_ns0, at_ns1)
+
+ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24")
+ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24")
+
+dnl Exceed the max number of resubmits.
+(echo "dl_type=0x806, actions=normal"
+for i in `seq 1 64`; do
+     j=`expr $i + 1`
+     echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
+ done
+ echo "in_port=65, actions=local"
+) > flows.txt
+AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
+
+dnl Generate some traffic.
+NS_CHECK_EXEC([at_ns0], [ping -q -c 10 -i 0.1 -w 2 10.1.1.2], [1], [ignore])
+
+OVS_WAIT_UNTIL_EQUAL([ovs-appctl dpctl/dump-flows | grep "eth_type(0x0800)" | dnl
+          sed 's/,packet_type(ns=[[0-9]]*,id=[[0-9]]*),/,/;s/,eth(),/,/;' | dnl
+          strip_recirc | strip_stats | strip_used | sort], [dnl
+recirc_id(<recirc>),in_port(2),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:0.0s, actions:drop])
+
+OVS_TRAFFIC_VSWITCHD_STOP(["/|WARN|/d"])
+AT_CLEANUP
+
 AT_SETUP([datapath - simulated flow action update])
 OVS_TRAFFIC_VSWITCHD_START()