On 2/3/20 12:33 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 <el...@mellanox.com>
> Reviewed-by: Roi Dayan <r...@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..07cec3718 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))"

Could you, please, specify all the arp fields, so the parser will
not report all zeroes.

> +   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=0.0.0.0,tip=0.0.0.0,op=0,sha=00:00:00:00:00:00,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=0,arp_sha=00:00:00:00:00:00,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 ip address and udp port were correctly modified in output 
> packets.

"ip address and udp port" ?

> +   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=0.0.0.0,arp_tpa=0.0.0.0,arp_op=0,arp_sha=00:00:00:00:00:00,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=0.0.0.0,arp_tpa=0.0.0.0,arp_op=0,arp_sha=00:00:00:00:00:00,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=0.0.0.0,arp_tpa=0.0.0.0,arp_op=0,arp_sha=00:00:00:00:00:00,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=0.0.0.0,arp_tpa=0.0.0.0,arp_op=0,arp_sha=00:00:00:00:00:00,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])
> 

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to