1 m4_define([CONFIGURE_VETH_OFFLOADS],
2 [AT_CHECK([ethtool -K $1 tx off], [0], [ignore], [ignore])])
4 AT_BANNER([OVS-DPDK unit tests])
6 dnl --------------------------------------------------------------------------
7 dnl Check if EAL init is successful
8 AT_SETUP([OVS-DPDK - EAL init])
12 AT_CHECK([grep "DPDK Enabled - initializing..." ovs-vswitchd.log], [], [stdout])
13 AT_CHECK([grep "EAL" ovs-vswitchd.log], [], [stdout])
14 AT_CHECK([grep "DPDK Enabled - initialized" ovs-vswitchd.log], [], [stdout])
15 OVS_VSWITCHD_STOP(["/Global register is changed during/d
16 /EAL: Invalid NUMA socket, default to 0/d
17 /EAL: WARNING: cpu flags constant_tsc=yes nonstop_tsc=no -> using unreliable clock cycles !/d
18 /EAL: No free hugepages reported in hugepages-1048576kB/d"])
20 dnl --------------------------------------------------------------------------
24 dnl --------------------------------------------------------------------------
25 dnl Add standard DPDK PHY port
26 AT_SETUP([OVS-DPDK - add standard DPDK port])
29 OVS_DPDK_PRE_PHY_SKIP()
32 dnl Add userspace bridge and attach it to OVS
33 AT_CHECK([ovs-vsctl add-br br10 -- set bridge br10 datapath_type=netdev])
34 AT_CHECK([ovs-vsctl add-port br10 phy0 -- set Interface phy0 type=dpdk options:dpdk-devargs=$(cat PCI_ADDR)], [], [stdout], [stderr])
35 AT_CHECK([ovs-vsctl show], [], [stdout])
39 AT_CHECK([ovs-vsctl del-port br10 phy0], [], [stdout], [stderr])
40 OVS_VSWITCHD_STOP("/does not exist. The Open vSwitch kernel module is probably not loaded./d
41 /Failed to enable flow control/d
42 /Global register is changed during/d
43 /EAL: WARNING: cpu flags constant_tsc=yes nonstop_tsc=no -> using unreliable clock cycles !/d
44 /EAL: No free hugepages reported in hugepages-1048576kB/d
47 dnl --------------------------------------------------------------------------
51 dnl --------------------------------------------------------------------------
52 dnl Add vhost-user-client port
53 AT_SETUP([OVS-DPDK - add vhost-user-client port])
58 dnl Add userspace bridge and attach it to OVS
59 AT_CHECK([ovs-vsctl add-br br10 -- set bridge br10 datapath_type=netdev])
60 AT_CHECK([ovs-vsctl add-port br10 dpdkvhostuserclient0 -- set Interface dpdkvhostuserclient0 type=dpdkvhostuserclient options:vhost-server-path=$OVS_RUNDIR/dpdkvhostclient0], [], [stdout], [stderr])
61 AT_CHECK([ovs-vsctl show], [], [stdout])
65 AT_CHECK([grep "VHOST_CONFIG: vhost-user client: socket created" ovs-vswitchd.log], [], [stdout])
66 AT_CHECK([grep "vHost User device 'dpdkvhostuserclient0' created in 'client' mode, using client socket" ovs-vswitchd.log], [], [stdout])
67 AT_CHECK([grep "VHOST_CONFIG: $OVS_RUNDIR/dpdkvhostclient0: reconnecting..." ovs-vswitchd.log], [], [stdout])
70 AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuserclient0], [], [stdout], [stderr])
71 OVS_VSWITCHD_STOP(["\@does not exist. The Open vSwitch kernel module is probably not loaded.@d
72 \@Failed to enable flow control@d
73 \@VHOST_CONFIG: failed to connect to $OVS_RUNDIR/dpdkvhostclient0: No such file or directory@d
74 \@Global register is changed during@d
75 \@EAL: Invalid NUMA socket, default to 0@d
76 \@EAL: WARNING: cpu flags constant_tsc=yes nonstop_tsc=no -> using unreliable clock cycles !@d
77 \@EAL: No free hugepages reported in hugepages-1048576kB@d"])
79 dnl --------------------------------------------------------------------------
83 dnl --------------------------------------------------------------------------
84 dnl Ping vhost-user port
85 AT_SETUP([OVS-DPDK - ping vhost-user ports])
88 AT_SKIP_IF([! which dpdk-testpmd >/dev/null 2>/dev/null])
91 dnl Find number of sockets
92 AT_CHECK([lscpu], [], [stdout])
93 AT_CHECK([cat stdout | grep "NUMA node(s)" | awk '{c=1; while (c++<$(3)) {printf "512,"}; print "512"}' > NUMA_NODE])
95 dnl Add userspace bridge and attach it to OVS
96 AT_CHECK([ovs-vsctl add-br br10 -- set bridge br10 datapath_type=netdev])
97 AT_CHECK([ovs-vsctl add-port br10 dpdkvhostuser0 -- set Interface dpdkvhostuser0 \
98 type=dpdkvhostuser], [],
100 AT_CHECK([ovs-vsctl show], [], [stdout])
103 AT_CHECK([grep "VHOST_CONFIG: vhost-user server: socket created" \
104 ovs-vswitchd.log], [], [stdout])
105 AT_CHECK([grep "Socket $OVS_RUNDIR/dpdkvhostuser0 created for vhost-user port dpdkvhostuser0" \
106 ovs-vswitchd.log], [], [stdout])
107 AT_CHECK([grep "VHOST_CONFIG: bind to $OVS_RUNDIR/dpdkvhostuser0" ovs-vswitchd.log], [],
110 dnl Set up namespaces
111 ADD_NAMESPACES(ns1, ns2)
114 ADD_VETH(tap1, ns2, br10, "172.31.110.12/24")
116 dnl Execute testpmd in background
117 on_exit "pkill -f -x -9 'tail -f /dev/null'"
118 tail -f /dev/null | dpdk-testpmd --socket-mem="$(cat NUMA_NODE)" --no-pci\
119 --vdev="net_virtio_user,path=$OVS_RUNDIR/dpdkvhostuser0" \
120 --vdev="net_tap0,iface=tap0" --file-prefix page0 \
121 --single-file-segments -- -a >$OVS_RUNDIR/testpmd-dpdkvhostuser0.log 2>&1 &
123 dnl Give settling time to the testpmd processes - NOTE: this is bad form.
126 dnl Move the tap devices to the namespaces
127 AT_CHECK([ps aux | grep testpmd], [], [stdout], [stderr])
128 AT_CHECK([ip link show], [], [stdout], [stderr])
129 AT_CHECK([ip link set tap0 netns ns1], [], [stdout], [stderr])
131 AT_CHECK([ip netns exec ns1 ip link show], [], [stdout], [stderr])
132 AT_CHECK([ip netns exec ns1 ip link show | grep tap0], [], [stdout], [stderr])
133 AT_CHECK([ip netns exec ns1 ip link set tap0 up], [], [stdout], [stderr])
134 AT_CHECK([ip netns exec ns1 ip addr add 172.31.110.11/24 dev tap0], [],
137 AT_CHECK([ip netns exec ns1 ip link show], [], [stdout], [stderr])
138 AT_CHECK([ip netns exec ns2 ip link show], [], [stdout], [stderr])
139 AT_CHECK([ip netns exec ns1 ping -c 4 -I tap0 172.31.110.12], [], [stdout],
142 dnl Clean up the testpmd now
143 pkill -f -x -9 'tail -f /dev/null'
146 AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuser0], [], [stdout], [stderr])
147 OVS_VSWITCHD_STOP(["\@does not exist. The Open vSwitch kernel module is probably not loaded.@d
148 \@Failed to enable flow control@d
149 \@VHOST_CONFIG: recvmsg failed@d
150 \@VHOST_CONFIG: failed to connect to $OVS_RUNDIR/dpdkvhostuser0: No such file or directory@d
151 \@Global register is changed during@d
152 \@dpdkvhostuser ports are considered deprecated; please migrate to dpdkvhostuserclient ports.@d
153 \@failed to enumerate system datapaths: No such file or directory@d
154 \@EAL: Invalid NUMA socket, default to 0@d
155 \@EAL: WARNING: cpu flags constant_tsc=yes nonstop_tsc=no -> using unreliable clock cycles !@d
156 \@EAL: No free hugepages reported in hugepages-1048576kB@d"])
158 dnl --------------------------------------------------------------------------
160 dnl --------------------------------------------------------------------------
161 dnl Ping vhost-user-client port
162 AT_SETUP([OVS-DPDK - ping vhost-user-client ports])
165 AT_SKIP_IF([! which dpdk-testpmd >/dev/null 2>/dev/null])
168 dnl Find number of sockets
169 AT_CHECK([lscpu], [], [stdout])
170 AT_CHECK([cat stdout | grep "NUMA node(s)" | awk '{c=1; while (c++<$(3)) {printf "512,"}; print "512"}' > NUMA_NODE])
172 dnl Add userspace bridge and attach it to OVS
173 AT_CHECK([ovs-vsctl add-br br10 -- set bridge br10 datapath_type=netdev])
174 AT_CHECK([ovs-vsctl add-port br10 dpdkvhostuserclient0 -- set Interface \
175 dpdkvhostuserclient0 \
176 type=dpdkvhostuserclient \
177 options:vhost-server-path=$OVS_RUNDIR/dpdkvhostclient0], [],
179 AT_CHECK([ovs-vsctl show], [], [stdout])
182 AT_CHECK([grep "VHOST_CONFIG: vhost-user client: socket created" ovs-vswitchd.log], [], [stdout])
183 AT_CHECK([grep "vHost User device 'dpdkvhostuserclient0' created in 'client' mode, using client socket" ovs-vswitchd.log], [], [stdout])
184 AT_CHECK([grep "VHOST_CONFIG: $OVS_RUNDIR/dpdkvhostclient0: reconnecting..." ovs-vswitchd.log], [], [stdout])
186 dnl Set up namespaces
187 ADD_NAMESPACES(ns1, ns2)
190 ADD_VETH(tap1, ns2, br10, "172.31.110.12/24")
192 dnl Execute testpmd in background
193 on_exit "pkill -f -x -9 'tail -f /dev/null'"
194 tail -f /dev/null | dpdk-testpmd --socket-mem="$(cat NUMA_NODE)" --no-pci\
195 --vdev="net_virtio_user,path=$OVS_RUNDIR/dpdkvhostclient0,server=1" \
196 --vdev="net_tap0,iface=tap0" --file-prefix page0 \
197 --single-file-segments -- -a >$OVS_RUNDIR/testpmd-dpdkvhostuserclient0.log 2>&1 &
199 dnl Give settling time to the testpmd processes - NOTE: this is bad form.
202 dnl Move the tap devices to the namespaces
203 AT_CHECK([ps aux | grep testpmd], [], [stdout], [stderr])
204 AT_CHECK([ip link show], [], [stdout], [stderr])
205 AT_CHECK([ip link set tap0 netns ns1], [], [stdout], [stderr])
207 AT_CHECK([ip netns exec ns1 ip link show], [], [stdout], [stderr])
208 AT_CHECK([ip netns exec ns1 ip link show | grep tap0], [], [stdout], [stderr])
209 AT_CHECK([ip netns exec ns1 ip link set tap0 up], [], [stdout], [stderr])
210 AT_CHECK([ip netns exec ns1 ip addr add 172.31.110.11/24 dev tap0], [],
213 AT_CHECK([ip netns exec ns1 ip link show], [], [stdout], [stderr])
214 AT_CHECK([ip netns exec ns2 ip link show], [], [stdout], [stderr])
215 AT_CHECK([ip netns exec ns1 ping -c 4 -I tap0 172.31.110.12], [], [stdout],
218 dnl Clean up the testpmd now
219 pkill -f -x -9 'tail -f /dev/null'
222 AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuserclient0], [], [stdout], [stderr])
223 OVS_VSWITCHD_STOP(["\@does not exist. The Open vSwitch kernel module is probably not loaded.@d
224 \@Failed to enable flow control@d
225 \@VHOST_CONFIG: recvmsg failed@d
226 \@VHOST_CONFIG: failed to connect to $OVS_RUNDIR/dpdkvhostclient0: No such file or directory@d
227 \@Global register is changed during@d
228 \@dpdkvhostuser ports are considered deprecated; please migrate to dpdkvhostuserclient ports.@d
229 \@failed to enumerate system datapaths: No such file or directory@d
230 \@EAL: Invalid NUMA socket, default to 0@d
231 \@EAL: WARNING: cpu flags constant_tsc=yes nonstop_tsc=no -> using unreliable clock cycles !@d
232 \@EAL: No free hugepages reported in hugepages-1048576kB@d"])
234 dnl --------------------------------------------------------------------------