[ovs-dev,V2,1/1] dpif-netdev.at: VLAN id modification test for ARP partial HW offloading
diff mbox series

Message ID 20200218134912.17442-1-elibr@mellanox.com
State Accepted
Delegated to: Ilya Maximets
Headers show
Series
  • [ovs-dev,V2,1/1] dpif-netdev.at: VLAN id modification test for ARP partial HW offloading
Related show

Commit Message

Eli Britstein Feb. 18, 2020, 1:49 p.m. UTC
Follow up to commit eb540c0f5fc8 ("flow: Fix parsing l3_ofs with partial
offloading") that fixed the issue, add a unit-test for it.

Signed-off-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
---
 tests/dpif-netdev.at | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)

Comments

Eli Britstein Feb. 27, 2020, 3:25 p.m. UTC | #1
ping

On 2/18/2020 3:49 PM, Eli Britstein wrote:
> Follow up to commit eb540c0f5fc8 ("flow: Fix parsing l3_ofs with partial
> offloading") that fixed the issue, add a unit-test for it.
>
> Signed-off-by: Eli Britstein <elibr@mellanox.com>
> Reviewed-by: Roi Dayan <roid@mellanox.com>
> ---
>   tests/dpif-netdev.at | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 77 insertions(+)
>
> diff --git a/tests/dpif-netdev.at b/tests/dpif-netdev.at
> index 0aeb4e788..f50d41360 100644
> --- a/tests/dpif-netdev.at
> +++ b/tests/dpif-netdev.at
> @@ -506,3 +506,80 @@ udp,in_port=ANY,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=00:06:07:08:09:
>   
>   DPIF_NETDEV_FLOW_HW_OFFLOAD_OFFSETS([dummy])
>   DPIF_NETDEV_FLOW_HW_OFFLOAD_OFFSETS([dummy-pmd])
> +
> +m4_define([DPIF_NETDEV_FLOW_HW_OFFLOAD_OFFSETS_VID_ARP],
> +  [AT_SETUP([dpif-netdev - partial hw offload with arp vlan id packet modifications - $1])
> +   OVS_VSWITCHD_START(
> +     [add-port br0 p1 -- \
> +      set interface p1 type=$1 ofport_request=1 options:pcap=p1.pcap options:ifindex=1 -- \
> +      set bridge br0 datapath-type=dummy \
> +                     other-config:datapath-id=1234 fail-mode=secure], [], [],
> +      [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])])
> +   AT_CHECK([ovs-appctl vlog/set dpif:file:dbg dpif_netdev:file:dbg netdev_dummy:file:dbg])
> +
> +   AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:hw-offload=true])
> +   OVS_WAIT_UNTIL([grep "netdev: Flow API Enabled" ovs-vswitchd.log])
> +
> +   AT_CHECK([ovs-ofctl del-flows br0])
> +
> +   # Setting flow to modify vlan id with arp packet to be sure that
> +   # offloaded packets has correctly initialized l3 offset.
> +   AT_CHECK([ovs-ofctl add-flow br0 in_port=1,arp,dl_vlan=99,actions=mod_vlan_vid=11,output:IN_PORT])
> +
> +   packet="packet_type(ns=0,id=0),eth(src=00:06:07:08:09:0a,dst=00:01:02:03:04:05),eth_type(0x8100),vlan(vid=99,pcp=7),encap(eth_type(0x0806),arp(sip=127.0.0.1,tip=127.0.0.1,op=1,sha=00:0b:0c:0d:0e:0f,tha=00:00:00:00:00:00))"
> +   AT_CHECK([ovs-appctl netdev-dummy/receive p1 $packet --len 64], [0])
> +
> +   OVS_WAIT_UNTIL([grep "miss upcall" ovs-vswitchd.log])
> +   AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl
> +skb_priority(0),skb_mark(0),ct_state(0),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),dnl
> +packet_type(ns=0,id=0),eth(src=00:06:07:08:09:0a,dst=00:01:02:03:04:05),eth_type(0x8100),vlan(vid=99,pcp=7),encap(eth_type(0x0806),arp(sip=127.0.0.1,tip=127.0.0.1,op=1,sha=00:0b:0c:0d:0e:0f,tha=00:00:00:00:00:00))
> +])
> +   # Check that flow successfully offloaded.
> +   OVS_WAIT_UNTIL([grep "succeed to add netdev flow" ovs-vswitchd.log])
> +   AT_CHECK([filter_hw_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
> +p1: flow put[[create]]: flow match: recirc_id=0,eth,arp,in_port=1,dl_vlan=99,dl_vlan_pcp=7, mark: 0
> +])
> +   # Check that datapath flow installed successfully.
> +   AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
> +recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x8100),vlan(vid=99,pcp=7),encap(eth_type(0x0806)), actions: <del>
> +])
> +   # Inject the same packet again.
> +   AT_CHECK([ovs-appctl netdev-dummy/receive p1 $packet --len 64], [0])
> +
> +   # Check for succesfull packet matching with installed offloaded flow.
> +   AT_CHECK([filter_hw_packet_netdev_dummy < ovs-vswitchd.log | strip_xout], [0], [dnl
> +p1: packet: arp,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=00:06:07:08:09:0a,dl_dst=00:01:02:03:04:05,arp_spa=127.0.0.1,arp_tpa=127.0.0.1,arp_op=1,arp_sha=00:0b:0c:0d:0e:0f,arp_tha=00:00:00:00:00:00 dnl
> +matches with flow: recirc_id=0,eth,arp,dl_vlan=99,dl_vlan_pcp=7 with mark: 0
> +])
> +
> +   ovs-appctl revalidator/wait
> +   # Dump the datapath flow to see that actions was executed for a packet.
> +   AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_timers], [0], [dnl
> +recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x8100),vlan(vid=99,pcp=7),encap(eth_type(0x0806)), dnl
> +packets:1, bytes:64, used:0.0s, actions:pop_vlan,push_vlan(vid=11,pcp=7),1
> +])
> +
> +   # Wait for datapath flow expiration.
> +   ovs-appctl time/stop
> +   ovs-appctl time/warp 15000
> +   ovs-appctl revalidator/wait
> +
> +   # Check that flow successfully deleted from HW.
> +   OVS_WAIT_UNTIL([grep "succeed to delete netdev flow" ovs-vswitchd.log])
> +   AT_CHECK([filter_hw_flow_del < ovs-vswitchd.log | strip_xout], [0], [dnl
> +p1: flow del: mark: 0
> +])
> +
> +   # Check that VLAN ID was correctly modified in output packets.
> +   AT_CHECK([ovs-ofctl parse-pcap p1.pcap], [0], [dnl
> +arp,in_port=ANY,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=00:06:07:08:09:0a,dl_dst=00:01:02:03:04:05,arp_spa=127.0.0.1,arp_tpa=127.0.0.1,arp_op=1,arp_sha=00:0b:0c:0d:0e:0f,arp_tha=00:00:00:00:00:00
> +arp,in_port=ANY,dl_vlan=11,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=00:06:07:08:09:0a,dl_dst=00:01:02:03:04:05,arp_spa=127.0.0.1,arp_tpa=127.0.0.1,arp_op=1,arp_sha=00:0b:0c:0d:0e:0f,arp_tha=00:00:00:00:00:00
> +arp,in_port=ANY,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=00:06:07:08:09:0a,dl_dst=00:01:02:03:04:05,arp_spa=127.0.0.1,arp_tpa=127.0.0.1,arp_op=1,arp_sha=00:0b:0c:0d:0e:0f,arp_tha=00:00:00:00:00:00
> +arp,in_port=ANY,dl_vlan=11,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=00:06:07:08:09:0a,dl_dst=00:01:02:03:04:05,arp_spa=127.0.0.1,arp_tpa=127.0.0.1,arp_op=1,arp_sha=00:0b:0c:0d:0e:0f,arp_tha=00:00:00:00:00:00
> +])
> +
> +   OVS_VSWITCHD_STOP
> +   AT_CLEANUP])
> +
> +DPIF_NETDEV_FLOW_HW_OFFLOAD_OFFSETS_VID_ARP([dummy])
> +DPIF_NETDEV_FLOW_HW_OFFLOAD_OFFSETS_VID_ARP([dummy-pmd])
Ilya Maximets Feb. 27, 2020, 3:38 p.m. UTC | #2
On 2/27/20 4:25 PM, Eli Britstein wrote:
> ping
> 
> On 2/18/2020 3:49 PM, Eli Britstein wrote:
>> Follow up to commit eb540c0f5fc8 ("flow: Fix parsing l3_ofs with partial
>> offloading") that fixed the issue, add a unit-test for it.
>>
>> Signed-off-by: Eli Britstein <elibr@mellanox.com>
>> Reviewed-by: Roi Dayan <roid@mellanox.com>

Thanks for v2.  It looks OK and it on my list to apply.

One thing is that I'll change ifindex before applying the test due to:
https://mail.openvswitch.org/pipermail/ovs-dev/2020-February/368118.html

Best regards, Ilya Maximets.
Ilya Maximets Feb. 28, 2020, 3:37 p.m. UTC | #3
On 2/18/20 2:49 PM, Eli Britstein wrote:
> Follow up to commit eb540c0f5fc8 ("flow: Fix parsing l3_ofs with partial
> offloading") that fixed the issue, add a unit-test for it.
> 
> Signed-off-by: Eli Britstein <elibr@mellanox.com>
> Reviewed-by: Roi Dayan <roid@mellanox.com>
> ---
>  tests/dpif-netdev.at | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 77 insertions(+)
> 

Thanks!  Applied to master.

Best regards, Ilya Maximets.

Patch
diff mbox series

diff --git a/tests/dpif-netdev.at b/tests/dpif-netdev.at
index 0aeb4e788..f50d41360 100644
--- a/tests/dpif-netdev.at
+++ b/tests/dpif-netdev.at
@@ -506,3 +506,80 @@  udp,in_port=ANY,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=00:06:07:08:09:
 
 DPIF_NETDEV_FLOW_HW_OFFLOAD_OFFSETS([dummy])
 DPIF_NETDEV_FLOW_HW_OFFLOAD_OFFSETS([dummy-pmd])
+
+m4_define([DPIF_NETDEV_FLOW_HW_OFFLOAD_OFFSETS_VID_ARP],
+  [AT_SETUP([dpif-netdev - partial hw offload with arp vlan id packet modifications - $1])
+   OVS_VSWITCHD_START(
+     [add-port br0 p1 -- \
+      set interface p1 type=$1 ofport_request=1 options:pcap=p1.pcap options:ifindex=1 -- \
+      set bridge br0 datapath-type=dummy \
+                     other-config:datapath-id=1234 fail-mode=secure], [], [],
+      [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])])
+   AT_CHECK([ovs-appctl vlog/set dpif:file:dbg dpif_netdev:file:dbg netdev_dummy:file:dbg])
+
+   AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:hw-offload=true])
+   OVS_WAIT_UNTIL([grep "netdev: Flow API Enabled" ovs-vswitchd.log])
+
+   AT_CHECK([ovs-ofctl del-flows br0])
+
+   # Setting flow to modify vlan id with arp packet to be sure that
+   # offloaded packets has correctly initialized l3 offset.
+   AT_CHECK([ovs-ofctl add-flow br0 in_port=1,arp,dl_vlan=99,actions=mod_vlan_vid=11,output:IN_PORT])
+
+   packet="packet_type(ns=0,id=0),eth(src=00:06:07:08:09:0a,dst=00:01:02:03:04:05),eth_type(0x8100),vlan(vid=99,pcp=7),encap(eth_type(0x0806),arp(sip=127.0.0.1,tip=127.0.0.1,op=1,sha=00:0b:0c:0d:0e:0f,tha=00:00:00:00:00:00))"
+   AT_CHECK([ovs-appctl netdev-dummy/receive p1 $packet --len 64], [0])
+
+   OVS_WAIT_UNTIL([grep "miss upcall" ovs-vswitchd.log])
+   AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl
+skb_priority(0),skb_mark(0),ct_state(0),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),dnl
+packet_type(ns=0,id=0),eth(src=00:06:07:08:09:0a,dst=00:01:02:03:04:05),eth_type(0x8100),vlan(vid=99,pcp=7),encap(eth_type(0x0806),arp(sip=127.0.0.1,tip=127.0.0.1,op=1,sha=00:0b:0c:0d:0e:0f,tha=00:00:00:00:00:00))
+])
+   # Check that flow successfully offloaded.
+   OVS_WAIT_UNTIL([grep "succeed to add netdev flow" ovs-vswitchd.log])
+   AT_CHECK([filter_hw_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
+p1: flow put[[create]]: flow match: recirc_id=0,eth,arp,in_port=1,dl_vlan=99,dl_vlan_pcp=7, mark: 0
+])
+   # Check that datapath flow installed successfully.
+   AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
+recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x8100),vlan(vid=99,pcp=7),encap(eth_type(0x0806)), actions: <del>
+])
+   # Inject the same packet again.
+   AT_CHECK([ovs-appctl netdev-dummy/receive p1 $packet --len 64], [0])
+
+   # Check for succesfull packet matching with installed offloaded flow.
+   AT_CHECK([filter_hw_packet_netdev_dummy < ovs-vswitchd.log | strip_xout], [0], [dnl
+p1: packet: arp,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=00:06:07:08:09:0a,dl_dst=00:01:02:03:04:05,arp_spa=127.0.0.1,arp_tpa=127.0.0.1,arp_op=1,arp_sha=00:0b:0c:0d:0e:0f,arp_tha=00:00:00:00:00:00 dnl
+matches with flow: recirc_id=0,eth,arp,dl_vlan=99,dl_vlan_pcp=7 with mark: 0
+])
+
+   ovs-appctl revalidator/wait
+   # Dump the datapath flow to see that actions was executed for a packet.
+   AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_timers], [0], [dnl
+recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x8100),vlan(vid=99,pcp=7),encap(eth_type(0x0806)), dnl
+packets:1, bytes:64, used:0.0s, actions:pop_vlan,push_vlan(vid=11,pcp=7),1
+])
+
+   # Wait for datapath flow expiration.
+   ovs-appctl time/stop
+   ovs-appctl time/warp 15000
+   ovs-appctl revalidator/wait
+
+   # Check that flow successfully deleted from HW.
+   OVS_WAIT_UNTIL([grep "succeed to delete netdev flow" ovs-vswitchd.log])
+   AT_CHECK([filter_hw_flow_del < ovs-vswitchd.log | strip_xout], [0], [dnl
+p1: flow del: mark: 0
+])
+
+   # Check that VLAN ID was correctly modified in output packets.
+   AT_CHECK([ovs-ofctl parse-pcap p1.pcap], [0], [dnl
+arp,in_port=ANY,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=00:06:07:08:09:0a,dl_dst=00:01:02:03:04:05,arp_spa=127.0.0.1,arp_tpa=127.0.0.1,arp_op=1,arp_sha=00:0b:0c:0d:0e:0f,arp_tha=00:00:00:00:00:00
+arp,in_port=ANY,dl_vlan=11,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=00:06:07:08:09:0a,dl_dst=00:01:02:03:04:05,arp_spa=127.0.0.1,arp_tpa=127.0.0.1,arp_op=1,arp_sha=00:0b:0c:0d:0e:0f,arp_tha=00:00:00:00:00:00
+arp,in_port=ANY,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=00:06:07:08:09:0a,dl_dst=00:01:02:03:04:05,arp_spa=127.0.0.1,arp_tpa=127.0.0.1,arp_op=1,arp_sha=00:0b:0c:0d:0e:0f,arp_tha=00:00:00:00:00:00
+arp,in_port=ANY,dl_vlan=11,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=00:06:07:08:09:0a,dl_dst=00:01:02:03:04:05,arp_spa=127.0.0.1,arp_tpa=127.0.0.1,arp_op=1,arp_sha=00:0b:0c:0d:0e:0f,arp_tha=00:00:00:00:00:00
+])
+
+   OVS_VSWITCHD_STOP
+   AT_CLEANUP])
+
+DPIF_NETDEV_FLOW_HW_OFFLOAD_OFFSETS_VID_ARP([dummy])
+DPIF_NETDEV_FLOW_HW_OFFLOAD_OFFSETS_VID_ARP([dummy-pmd])