]>
Commit | Line | Data |
---|---|---|
c92ccb42 BS |
1 | m4_define([CONFIGURE_VETH_OFFLOADS], |
2 | [AT_CHECK([ethtool -K $1 tx off], [0], [ignore], [ignore])]) | |
3 | ||
a7e4849e MR |
4 | AT_BANNER([OVS-DPDK unit tests]) |
5 | ||
6 | dnl -------------------------------------------------------------------------- | |
c92ccb42 | 7 | dnl Check if EAL init is successful |
49df3c0f | 8 | AT_SETUP([OVS-DPDK - EAL init]) |
a7e4849e | 9 | AT_KEYWORDS([dpdk]) |
a01786b4 | 10 | OVS_DPDK_PRE_CHECK() |
a7e4849e MR |
11 | OVS_DPDK_START() |
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]) | |
a01786b4 AC |
15 | OVS_VSWITCHD_STOP(["/Global register is changed during/d |
16 | /EAL: Invalid NUMA socket, default to 0/d | |
b042ea2a | 17 | /EAL: WARNING: cpu flags constant_tsc=yes nonstop_tsc=no -> using unreliable clock cycles !/d |
a01786b4 | 18 | /EAL: No free hugepages reported in hugepages-1048576kB/d"]) |
a7e4849e MR |
19 | AT_CLEANUP |
20 | dnl -------------------------------------------------------------------------- | |
21 | ||
22 | ||
23 | ||
24 | dnl -------------------------------------------------------------------------- | |
25 | dnl Add standard DPDK PHY port | |
49df3c0f | 26 | AT_SETUP([OVS-DPDK - add standard DPDK port]) |
a7e4849e MR |
27 | AT_KEYWORDS([dpdk]) |
28 | ||
a01786b4 | 29 | OVS_DPDK_PRE_PHY_SKIP() |
a7e4849e MR |
30 | OVS_DPDK_START() |
31 | ||
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]) | |
36 | sleep 2 | |
37 | ||
38 | dnl Clean up | |
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 | |
cf8f6f81 | 42 | /Global register is changed during/d |
b042ea2a | 43 | /EAL: WARNING: cpu flags constant_tsc=yes nonstop_tsc=no -> using unreliable clock cycles !/d |
cf8f6f81 TL |
44 | /EAL: No free hugepages reported in hugepages-1048576kB/d |
45 | ") | |
a7e4849e MR |
46 | AT_CLEANUP |
47 | dnl -------------------------------------------------------------------------- | |
48 | ||
49 | ||
50 | ||
51 | dnl -------------------------------------------------------------------------- | |
52 | dnl Add vhost-user-client port | |
49df3c0f | 53 | AT_SETUP([OVS-DPDK - add vhost-user-client port]) |
a7e4849e | 54 | AT_KEYWORDS([dpdk]) |
f9e1eba9 | 55 | OVS_DPDK_PRE_CHECK() |
a7e4849e MR |
56 | OVS_DPDK_START() |
57 | ||
58 | dnl Add userspace bridge and attach it to OVS | |
59 | AT_CHECK([ovs-vsctl add-br br10 -- set bridge br10 datapath_type=netdev]) | |
7d897046 | 60 | AT_CHECK([ovs-vsctl add-port br10 dpdkvhostuserclient0 -- set Interface dpdkvhostuserclient0 type=dpdkvhostuserclient options:vhost-server-path=$OVS_RUNDIR/dpdkvhostclient0], [], [stdout], [stderr]) |
a7e4849e MR |
61 | AT_CHECK([ovs-vsctl show], [], [stdout]) |
62 | sleep 2 | |
63 | ||
64 | dnl Parse log file | |
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]) | |
7d897046 | 67 | AT_CHECK([grep "VHOST_CONFIG: $OVS_RUNDIR/dpdkvhostclient0: reconnecting..." ovs-vswitchd.log], [], [stdout]) |
a7e4849e MR |
68 | |
69 | dnl Clean up | |
70 | AT_CHECK([ovs-vsctl del-port br10 dpdkvhostuserclient0], [], [stdout], [stderr]) | |
322e49a6 AC |
71 | OVS_VSWITCHD_STOP(["\@does not exist. The Open vSwitch kernel module is probably not loaded.@d |
72 | \@Failed to enable flow control@d | |
7d897046 | 73 | \@VHOST_CONFIG: failed to connect to $OVS_RUNDIR/dpdkvhostclient0: No such file or directory@d |
322e49a6 AC |
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"]) | |
a7e4849e MR |
78 | AT_CLEANUP |
79 | dnl -------------------------------------------------------------------------- | |
c92ccb42 BS |
80 | |
81 | ||
82 | ||
83 | dnl -------------------------------------------------------------------------- | |
84 | dnl Ping vhost-user port | |
49df3c0f | 85 | AT_SETUP([OVS-DPDK - ping vhost-user ports]) |
c92ccb42 BS |
86 | AT_KEYWORDS([dpdk]) |
87 | OVS_DPDK_PRE_CHECK() | |
88 | AT_SKIP_IF([! which testpmd >/dev/null 2>/dev/null]) | |
89 | OVS_DPDK_START() | |
90 | ||
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]) | |
94 | ||
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], [], | |
99 | [stdout], [stderr]) | |
100 | AT_CHECK([ovs-vsctl show], [], [stdout]) | |
101 | ||
102 | dnl Parse log file | |
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], [], | |
108 | [stdout]) | |
109 | ||
110 | dnl Set up namespaces | |
111 | ADD_NAMESPACES(ns1, ns2) | |
112 | ||
113 | dnl Add veth device | |
114 | ADD_VETH(tap1, ns2, br10, "172.31.110.12/24") | |
115 | ||
116 | dnl Execute testpmd in background | |
117 | on_exit "pkill -f -x -9 'tail -f /dev/null'" | |
118 | tail -f /dev/null | 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 & | |
122 | ||
123 | dnl Give settling time to the testpmd processes - NOTE: this is bad form. | |
124 | sleep 10 | |
125 | ||
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]) | |
130 | ||
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], [], | |
135 | [stdout], [stderr]) | |
136 | ||
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], | |
140 | [stderr]) | |
141 | ||
142 | dnl Clean up the testpmd now | |
143 | pkill -f -x -9 'tail -f /dev/null' | |
144 | ||
145 | dnl Clean up | |
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"]) | |
157 | AT_CLEANUP | |
158 | dnl -------------------------------------------------------------------------- | |
159 | ||
160 | dnl -------------------------------------------------------------------------- | |
161 | dnl Ping vhost-user-client port | |
49df3c0f | 162 | AT_SETUP([OVS-DPDK - ping vhost-user-client ports]) |
c92ccb42 BS |
163 | AT_KEYWORDS([dpdk]) |
164 | OVS_DPDK_PRE_CHECK() | |
165 | AT_SKIP_IF([! which testpmd >/dev/null 2>/dev/null]) | |
166 | OVS_DPDK_START() | |
167 | ||
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]) | |
171 | ||
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], [], | |
178 | [stdout], [stderr]) | |
179 | AT_CHECK([ovs-vsctl show], [], [stdout]) | |
180 | ||
181 | dnl Parse log file | |
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]) | |
185 | ||
186 | dnl Set up namespaces | |
187 | ADD_NAMESPACES(ns1, ns2) | |
188 | ||
189 | dnl Add veth device | |
190 | ADD_VETH(tap1, ns2, br10, "172.31.110.12/24") | |
191 | ||
192 | dnl Execute testpmd in background | |
193 | on_exit "pkill -f -x -9 'tail -f /dev/null'" | |
194 | tail -f /dev/null | 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 & | |
198 | ||
199 | dnl Give settling time to the testpmd processes - NOTE: this is bad form. | |
200 | sleep 10 | |
201 | ||
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]) | |
206 | ||
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], [], | |
211 | [stdout], [stderr]) | |
212 | ||
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], | |
216 | [stderr]) | |
217 | ||
218 | dnl Clean up the testpmd now | |
219 | pkill -f -x -9 'tail -f /dev/null' | |
220 | ||
221 | dnl Clean up | |
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"]) | |
233 | AT_CLEANUP | |
234 | dnl -------------------------------------------------------------------------- |