diff options
Diffstat (limited to 'common/recipes-extended/dpdk/dpdk/dpdk-1.7.0-ring-simplify-unit-tests.patch')
-rw-r--r-- | common/recipes-extended/dpdk/dpdk/dpdk-1.7.0-ring-simplify-unit-tests.patch | 380 |
1 files changed, 0 insertions, 380 deletions
diff --git a/common/recipes-extended/dpdk/dpdk/dpdk-1.7.0-ring-simplify-unit-tests.patch b/common/recipes-extended/dpdk/dpdk/dpdk-1.7.0-ring-simplify-unit-tests.patch deleted file mode 100644 index c17137b2..00000000 --- a/common/recipes-extended/dpdk/dpdk/dpdk-1.7.0-ring-simplify-unit-tests.patch +++ /dev/null | |||
@@ -1,380 +0,0 @@ | |||
1 | From 545a5fac5d6bd0b64693dfcb15b321280418ac13 Mon Sep 17 00:00:00 2001 | ||
2 | From: Pablo de Lara <pablo.de.lara.guarch@intel.com> | ||
3 | Date: Wed, 9 Jul 2014 15:35:36 +0100 | ||
4 | Subject: [PATCH] ring: simplify unit tests | ||
5 | |||
6 | Upstream-Status: Backport | ||
7 | Imported patch from: http://dpdk.org/browse/dpdk/log/ | ||
8 | |||
9 | As this unit test does not create devices anymore, | ||
10 | and uses devices created by EAL option --vdev, | ||
11 | there were unnecesary tests that were repeated, | ||
12 | so they have been removed. | ||
13 | |||
14 | So now there are three tests: | ||
15 | |||
16 | 1 - Test two devices that share a ring, one device | ||
17 | with just one RX queue and the other with one | ||
18 | TX queue. | ||
19 | |||
20 | 2 - Test a device connected to itself (loopback) by | ||
21 | a ring, with both RX and TX queue. | ||
22 | |||
23 | 3 - Test two devices that share a ring, but both devices | ||
24 | with RX and TX queue, so they can send packets to themselves | ||
25 | and to the other device. | ||
26 | |||
27 | Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> | ||
28 | Acked-by: Neil Horman <nhorman@tuxdriver.com> | ||
29 | (cherry picked from commit 572eb3cd834c5e21d7fa946432b89c1c9d63fe61) | ||
30 | Signed-off-by: Sreeju Selvaraj <sreeju.armughanx.selvaraj@intel.com> | ||
31 | --- | ||
32 | app/test/test_pmd_ring.c | 202 +++++++++++++++++------------------------------ | ||
33 | 1 file changed, 72 insertions(+), 130 deletions(-) | ||
34 | |||
35 | diff --git a/app/test/test_pmd_ring.c b/app/test/test_pmd_ring.c | ||
36 | index 0d3d95c..19ad0e9 100644 | ||
37 | --- a/app/test/test_pmd_ring.c | ||
38 | +++ b/app/test/test_pmd_ring.c | ||
39 | @@ -39,18 +39,13 @@ | ||
40 | #include <rte_eth_ring.h> | ||
41 | #include <rte_ethdev.h> | ||
42 | |||
43 | -/* two test rings, r1 is used by two ports, r2 just by one */ | ||
44 | -static struct rte_ring *r1[2], *r2; | ||
45 | - | ||
46 | static struct rte_mempool *mp; | ||
47 | -static uint8_t start_idx; /* will store the port id of the first of our new ports */ | ||
48 | - | ||
49 | -#define TX_PORT (uint8_t)(start_idx + 1) | ||
50 | -#define RX_PORT (uint8_t)(start_idx + 2) | ||
51 | -#define RXTX_PORT (uint8_t)(start_idx + 3) | ||
52 | -#define RXTX_PORT2 (uint8_t)(start_idx + 4) | ||
53 | -#define RXTX_PORT4 (uint8_t)(start_idx + 6) | ||
54 | -#define RXTX_PORT5 (uint8_t)(start_idx + 7) | ||
55 | + | ||
56 | +#define TX_PORT 0 | ||
57 | +#define RX_PORT 1 | ||
58 | +#define RXTX_PORT 2 | ||
59 | +#define RXTX_PORT2 3 | ||
60 | +#define RXTX_PORT3 4 | ||
61 | #define SOCKET0 0 | ||
62 | |||
63 | #define RING_SIZE 256 | ||
64 | @@ -86,7 +81,7 @@ test_ethdev_configure(void) | ||
65 | return -1; | ||
66 | } | ||
67 | if (rte_eth_dev_configure(RXTX_PORT, 1, 1, &null_conf) < 0) { | ||
68 | - printf("Configure failed for RX port\n"); | ||
69 | + printf("Configure failed for RXTX port\n"); | ||
70 | return -1; | ||
71 | } | ||
72 | |||
73 | @@ -250,197 +245,162 @@ test_stats_reset(void) | ||
74 | } | ||
75 | |||
76 | static int | ||
77 | -test_pmd_ring_init(void) | ||
78 | +test_pmd_ring_pair_create_attach(void) | ||
79 | { | ||
80 | - struct rte_eth_stats stats; | ||
81 | + struct rte_eth_stats stats, stats2; | ||
82 | struct rte_mbuf buf, *pbuf = &buf; | ||
83 | struct rte_eth_conf null_conf; | ||
84 | |||
85 | - printf("Testing ring pmd init\n"); | ||
86 | - | ||
87 | - if (RXTX_PORT2 >= RTE_MAX_ETHPORTS) { | ||
88 | + if ((RXTX_PORT2 >= RTE_MAX_ETHPORTS) || (RXTX_PORT3 >= RTE_MAX_ETHPORTS)) { | ||
89 | printf(" TX/RX port exceed max eth ports\n"); | ||
90 | return -1; | ||
91 | } | ||
92 | - if (rte_eth_dev_configure(RXTX_PORT2, 1, 1, &null_conf) < 0) { | ||
93 | + if ((rte_eth_dev_configure(RXTX_PORT2, 1, 1, &null_conf) < 0) | ||
94 | + || (rte_eth_dev_configure(RXTX_PORT3, 1, 1, &null_conf) < 0)) { | ||
95 | printf("Configure failed for RXTX port\n"); | ||
96 | return -1; | ||
97 | } | ||
98 | |||
99 | - if (rte_eth_tx_queue_setup(RXTX_PORT2, 0, RING_SIZE, SOCKET0, NULL) < 0) { | ||
100 | + if ((rte_eth_tx_queue_setup(RXTX_PORT2, 0, RING_SIZE, SOCKET0, NULL) < 0) | ||
101 | + || (rte_eth_tx_queue_setup(RXTX_PORT3, 0, RING_SIZE, SOCKET0, NULL) < 0)) { | ||
102 | printf("TX queue setup failed\n"); | ||
103 | return -1; | ||
104 | } | ||
105 | |||
106 | - if (rte_eth_rx_queue_setup(RXTX_PORT2, 0, RING_SIZE, SOCKET0, | ||
107 | - NULL, mp) < 0) { | ||
108 | + if ((rte_eth_rx_queue_setup(RXTX_PORT2, 0, RING_SIZE, SOCKET0, NULL, mp) < 0) | ||
109 | + || (rte_eth_rx_queue_setup(RXTX_PORT3, 0, RING_SIZE, SOCKET0, NULL, mp) < 0)) { | ||
110 | printf("RX queue setup failed\n"); | ||
111 | return -1; | ||
112 | } | ||
113 | |||
114 | - if (rte_eth_dev_start(RXTX_PORT2) < 0) { | ||
115 | - printf("Error starting RX port\n"); | ||
116 | + if ((rte_eth_dev_start(RXTX_PORT2) < 0) | ||
117 | + || (rte_eth_dev_start(RXTX_PORT3) < 0)) { | ||
118 | + printf("Error starting RXTX port\n"); | ||
119 | return -1; | ||
120 | } | ||
121 | |||
122 | - /* send and receive 1 packet and check for stats update */ | ||
123 | + /* | ||
124 | + * send and receive 1 packet (RXTX_PORT2 -> RXTX_PORT3) | ||
125 | + * and check for stats update | ||
126 | + */ | ||
127 | if (rte_eth_tx_burst(RXTX_PORT2, 0, &pbuf, 1) != 1) { | ||
128 | printf("Error sending packet to RXTX port\n"); | ||
129 | return -1; | ||
130 | } | ||
131 | |||
132 | - if (rte_eth_rx_burst(RXTX_PORT2, 0, &pbuf, 1) != 1) { | ||
133 | + if (rte_eth_rx_burst(RXTX_PORT3, 0, &pbuf, 1) != 1) { | ||
134 | printf("Error receiving packet from RXTX port\n"); | ||
135 | return -1; | ||
136 | } | ||
137 | |||
138 | rte_eth_stats_get(RXTX_PORT2, &stats); | ||
139 | - if (stats.ipackets != 1 || stats.opackets != 1 || | ||
140 | + rte_eth_stats_get(RXTX_PORT3, &stats2); | ||
141 | + if (stats.ipackets != 0 || stats.opackets != 1 || | ||
142 | stats.ibytes != 0 || stats.obytes != 0 || | ||
143 | stats.ierrors != 0 || stats.oerrors != 0) { | ||
144 | printf("Error: RXTX port stats are not as expected\n"); | ||
145 | return -1; | ||
146 | } | ||
147 | |||
148 | - rte_eth_dev_stop(RXTX_PORT2); | ||
149 | - | ||
150 | - return 0; | ||
151 | -} | ||
152 | - | ||
153 | -static int | ||
154 | -test_pmd_ring_pair_create(void) | ||
155 | -{ | ||
156 | - struct rte_eth_stats stats, stats2; | ||
157 | - struct rte_mbuf buf, *pbuf = &buf; | ||
158 | - struct rte_eth_conf null_conf; | ||
159 | - | ||
160 | - if ((RXTX_PORT4 >= RTE_MAX_ETHPORTS) || (RXTX_PORT5 >= RTE_MAX_ETHPORTS)) { | ||
161 | - printf(" TX/RX port exceed max eth ports\n"); | ||
162 | - return -1; | ||
163 | - } | ||
164 | - if ((rte_eth_dev_configure(RXTX_PORT4, 1, 1, &null_conf) < 0) | ||
165 | - || (rte_eth_dev_configure(RXTX_PORT5, 1, 1, &null_conf) < 0)) { | ||
166 | - printf("Configure failed for RXTX port\n"); | ||
167 | - return -1; | ||
168 | - } | ||
169 | - | ||
170 | - if ((rte_eth_tx_queue_setup(RXTX_PORT4, 0, RING_SIZE, SOCKET0, NULL) < 0) | ||
171 | - || (rte_eth_tx_queue_setup(RXTX_PORT5, 0, RING_SIZE, SOCKET0, NULL) < 0)) { | ||
172 | - printf("TX queue setup failed\n"); | ||
173 | - return -1; | ||
174 | - } | ||
175 | - | ||
176 | - if ((rte_eth_rx_queue_setup(RXTX_PORT4, 0, RING_SIZE, SOCKET0, NULL, mp) < 0) | ||
177 | - || (rte_eth_rx_queue_setup(RXTX_PORT5, 0, RING_SIZE, SOCKET0, NULL, mp) < 0)) { | ||
178 | - printf("RX queue setup failed\n"); | ||
179 | - return -1; | ||
180 | - } | ||
181 | - | ||
182 | - if ((rte_eth_dev_start(RXTX_PORT4) < 0) | ||
183 | - || (rte_eth_dev_start(RXTX_PORT5) < 0)) { | ||
184 | - printf("Error starting RXTX port\n"); | ||
185 | + if (stats2.ipackets != 1 || stats2.opackets != 0 || | ||
186 | + stats2.ibytes != 0 || stats2.obytes != 0 || | ||
187 | + stats2.ierrors != 0 || stats2.oerrors != 0) { | ||
188 | + printf("Error: RXTX port stats are not as expected\n"); | ||
189 | return -1; | ||
190 | } | ||
191 | |||
192 | - /* send and receive 1 packet and check for stats update */ | ||
193 | - if (rte_eth_tx_burst(RXTX_PORT4, 0, &pbuf, 1) != 1) { | ||
194 | + /* | ||
195 | + * send and receive 1 packet (RXTX_PORT3 -> RXTX_PORT2) | ||
196 | + * and check for stats update | ||
197 | + */ | ||
198 | + if (rte_eth_tx_burst(RXTX_PORT3, 0, &pbuf, 1) != 1) { | ||
199 | printf("Error sending packet to RXTX port\n"); | ||
200 | return -1; | ||
201 | } | ||
202 | |||
203 | - if (rte_eth_rx_burst(RXTX_PORT5, 0, &pbuf, 1) != 1) { | ||
204 | + if (rte_eth_rx_burst(RXTX_PORT2, 0, &pbuf, 1) != 1) { | ||
205 | printf("Error receiving packet from RXTX port\n"); | ||
206 | return -1; | ||
207 | } | ||
208 | |||
209 | - rte_eth_stats_get(RXTX_PORT4, &stats); | ||
210 | - rte_eth_stats_get(RXTX_PORT5, &stats2); | ||
211 | - if (stats.ipackets != 0 || stats.opackets != 1 || | ||
212 | + rte_eth_stats_get(RXTX_PORT2, &stats); | ||
213 | + rte_eth_stats_get(RXTX_PORT3, &stats2); | ||
214 | + if (stats.ipackets != 1 || stats.opackets != 1 || | ||
215 | stats.ibytes != 0 || stats.obytes != 0 || | ||
216 | stats.ierrors != 0 || stats.oerrors != 0) { | ||
217 | printf("Error: RXTX port stats are not as expected\n"); | ||
218 | return -1; | ||
219 | } | ||
220 | |||
221 | - if (stats2.ipackets != 1 || stats2.opackets != 0 || | ||
222 | + if (stats2.ipackets != 1 || stats2.opackets != 1 || | ||
223 | stats2.ibytes != 0 || stats2.obytes != 0 || | ||
224 | stats2.ierrors != 0 || stats2.oerrors != 0) { | ||
225 | printf("Error: RXTX port stats are not as expected\n"); | ||
226 | return -1; | ||
227 | } | ||
228 | |||
229 | - rte_eth_dev_stop(RXTX_PORT4); | ||
230 | - rte_eth_dev_stop(RXTX_PORT5); | ||
231 | - | ||
232 | - return 0; | ||
233 | -} | ||
234 | - | ||
235 | -static int | ||
236 | -test_pmd_ring_pair_attach(void) | ||
237 | -{ | ||
238 | - struct rte_eth_stats stats, stats2; | ||
239 | - struct rte_mbuf buf, *pbuf = &buf; | ||
240 | - struct rte_eth_conf null_conf; | ||
241 | - | ||
242 | - if ((RXTX_PORT4 >= RTE_MAX_ETHPORTS) || (RXTX_PORT5 >= RTE_MAX_ETHPORTS)) { | ||
243 | - printf(" TX/RX port exceed max eth ports\n"); | ||
244 | - return -1; | ||
245 | - } | ||
246 | - if ((rte_eth_dev_configure(RXTX_PORT4, 1, 1, &null_conf) < 0) | ||
247 | - || (rte_eth_dev_configure(RXTX_PORT5, 1, 1, &null_conf) < 0)) { | ||
248 | - printf("Configure failed for RXTX port\n"); | ||
249 | + /* | ||
250 | + * send and receive 1 packet (RXTX_PORT2 -> RXTX_PORT2) | ||
251 | + * and check for stats update | ||
252 | + */ | ||
253 | + if (rte_eth_tx_burst(RXTX_PORT2, 0, &pbuf, 1) != 1) { | ||
254 | + printf("Error sending packet to RXTX port\n"); | ||
255 | return -1; | ||
256 | } | ||
257 | |||
258 | - if ((rte_eth_tx_queue_setup(RXTX_PORT4, 0, RING_SIZE, SOCKET0, NULL) < 0) | ||
259 | - || (rte_eth_tx_queue_setup(RXTX_PORT5, 0, RING_SIZE, SOCKET0, NULL) < 0)) { | ||
260 | - printf("TX queue setup failed\n"); | ||
261 | + if (rte_eth_rx_burst(RXTX_PORT2, 0, &pbuf, 1) != 1) { | ||
262 | + printf("Error receiving packet from RXTX port\n"); | ||
263 | return -1; | ||
264 | } | ||
265 | |||
266 | - if ((rte_eth_rx_queue_setup(RXTX_PORT4, 0, RING_SIZE, SOCKET0, NULL, mp) < 0) | ||
267 | - || (rte_eth_rx_queue_setup(RXTX_PORT5, 0, RING_SIZE, SOCKET0, NULL, mp) < 0)) { | ||
268 | - printf("RX queue setup failed\n"); | ||
269 | + rte_eth_stats_get(RXTX_PORT2, &stats); | ||
270 | + rte_eth_stats_get(RXTX_PORT3, &stats2); | ||
271 | + if (stats.ipackets != 2 || stats.opackets != 2 || | ||
272 | + stats.ibytes != 0 || stats.obytes != 0 || | ||
273 | + stats.ierrors != 0 || stats.oerrors != 0) { | ||
274 | + printf("Error: RXTX port stats are not as expected\n"); | ||
275 | return -1; | ||
276 | } | ||
277 | |||
278 | - if ((rte_eth_dev_start(RXTX_PORT4) < 0) | ||
279 | - || (rte_eth_dev_start(RXTX_PORT5) < 0)) { | ||
280 | - printf("Error starting RXTX port\n"); | ||
281 | + if (stats2.ipackets != 1 || stats2.opackets != 1 || | ||
282 | + stats2.ibytes != 0 || stats2.obytes != 0 || | ||
283 | + stats2.ierrors != 0 || stats2.oerrors != 0) { | ||
284 | + printf("Error: RXTX port stats are not as expected\n"); | ||
285 | return -1; | ||
286 | } | ||
287 | |||
288 | - rte_eth_stats_reset(RXTX_PORT4); | ||
289 | - rte_eth_stats_reset(RXTX_PORT5); | ||
290 | - | ||
291 | - /* send and receive 1 packet and check for stats update */ | ||
292 | - if (rte_eth_tx_burst(RXTX_PORT4, 0, &pbuf, 1) != 1) { | ||
293 | + /* | ||
294 | + * send and receive 1 packet (RXTX_PORT3 -> RXTX_PORT3) | ||
295 | + * and check for stats update | ||
296 | + */ | ||
297 | + if (rte_eth_tx_burst(RXTX_PORT3, 0, &pbuf, 1) != 1) { | ||
298 | printf("Error sending packet to RXTX port\n"); | ||
299 | return -1; | ||
300 | } | ||
301 | - if (rte_eth_rx_burst(RXTX_PORT5, 0, &pbuf, 1) != 1) { | ||
302 | + | ||
303 | + if (rte_eth_rx_burst(RXTX_PORT3, 0, &pbuf, 1) != 1) { | ||
304 | printf("Error receiving packet from RXTX port\n"); | ||
305 | return -1; | ||
306 | } | ||
307 | |||
308 | - rte_eth_stats_get(RXTX_PORT4, &stats); | ||
309 | - rte_eth_stats_get(RXTX_PORT5, &stats2); | ||
310 | - if (stats.ipackets != 0 || stats.opackets != 1 || | ||
311 | + rte_eth_stats_get(RXTX_PORT2, &stats); | ||
312 | + rte_eth_stats_get(RXTX_PORT3, &stats2); | ||
313 | + if (stats.ipackets != 2 || stats.opackets != 2 || | ||
314 | stats.ibytes != 0 || stats.obytes != 0 || | ||
315 | stats.ierrors != 0 || stats.oerrors != 0) { | ||
316 | printf("Error: RXTX port stats are not as expected\n"); | ||
317 | return -1; | ||
318 | } | ||
319 | |||
320 | - if (stats2.ipackets != 1 || stats2.opackets != 0 || | ||
321 | + if (stats2.ipackets != 2 || stats2.opackets != 2 || | ||
322 | stats2.ibytes != 0 || stats2.obytes != 0 || | ||
323 | stats2.ierrors != 0 || stats2.oerrors != 0) { | ||
324 | printf("Error: RXTX port stats are not as expected\n"); | ||
325 | return -1; | ||
326 | } | ||
327 | |||
328 | - rte_eth_dev_stop(RXTX_PORT4); | ||
329 | - rte_eth_dev_stop(RXTX_PORT5); | ||
330 | + rte_eth_dev_stop(RXTX_PORT2); | ||
331 | + rte_eth_dev_stop(RXTX_PORT3); | ||
332 | |||
333 | return 0; | ||
334 | } | ||
335 | @@ -448,17 +408,6 @@ test_pmd_ring_pair_attach(void) | ||
336 | int | ||
337 | test_pmd_ring(void) | ||
338 | { | ||
339 | - r1[0] = rte_ring_create("R1", RING_SIZE, 0, 0); | ||
340 | - r1[1] = rte_ring_create("R2", RING_SIZE, 0, 0); | ||
341 | - if (r1[0] == NULL && (r1[0] = rte_ring_lookup("R1")) == NULL) | ||
342 | - return -1; | ||
343 | - if (r1[1] == NULL && (r1[1] = rte_ring_lookup("R2")) == NULL) | ||
344 | - return -1; | ||
345 | - | ||
346 | - r2 = rte_ring_create("R3", RING_SIZE, 0, RING_F_SP_ENQ|RING_F_SC_DEQ); | ||
347 | - if (r2 == NULL && (r2 = rte_ring_lookup("R3")) == NULL) | ||
348 | - return -1; | ||
349 | - | ||
350 | mp = rte_mempool_create("mbuf_pool", NB_MBUF, | ||
351 | MBUF_SIZE, 32, | ||
352 | sizeof(struct rte_pktmbuf_pool_private), | ||
353 | @@ -468,8 +417,6 @@ test_pmd_ring(void) | ||
354 | if (mp == NULL) | ||
355 | return -1; | ||
356 | |||
357 | - start_idx = rte_eth_dev_count(); | ||
358 | - | ||
359 | if ((TX_PORT >= RTE_MAX_ETHPORTS) || (RX_PORT >= RTE_MAX_ETHPORTS)\ | ||
360 | || (RXTX_PORT >= RTE_MAX_ETHPORTS)) { | ||
361 | printf(" TX/RX port exceed max eth ports\n"); | ||
362 | @@ -492,14 +439,9 @@ test_pmd_ring(void) | ||
363 | rte_eth_dev_stop(TX_PORT); | ||
364 | rte_eth_dev_stop(RXTX_PORT); | ||
365 | |||
366 | - if (test_pmd_ring_init() < 0) | ||
367 | + if (test_pmd_ring_pair_create_attach() < 0) | ||
368 | return -1; | ||
369 | |||
370 | - if (test_pmd_ring_pair_create() < 0) | ||
371 | - return -1; | ||
372 | - | ||
373 | - if (test_pmd_ring_pair_attach() < 0) | ||
374 | - return -1; | ||
375 | return 0; | ||
376 | } | ||
377 | |||
378 | -- | ||
379 | 1.9.1 | ||
380 | |||