MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sanity_test_with_mbuf_alloc

Function sanity_test_with_mbuf_alloc

dpdk/app/test/test_distributor.c:334–372  ·  view source on GitHub ↗

Perform a sanity test of the distributor with a large number of packets, * where we allocate a new set of mbufs for each burst. The workers then * free the mbufs. This ensures that we don't have any packet leaks in the * library. */

Source from the content-addressed store, hash-verified

332 * library.
333 */
334static int
335sanity_test_with_mbuf_alloc(struct worker_params *wp, struct rte_mempool *p)
336{
337 struct rte_distributor *d = wp->dist;
338 unsigned i;
339 struct rte_mbuf *bufs[BURST];
340 unsigned int processed;
341
342 printf("=== Sanity test with mbuf alloc/free (%s) ===\n", wp->name);
343
344 clear_packet_count();
345 for (i = 0; i < ((1<<ITER_POWER)); i += BURST) {
346 unsigned j;
347 while (rte_mempool_get_bulk(p, (void *)bufs, BURST) < 0)
348 rte_distributor_process(d, NULL, 0);
349 for (j = 0; j < BURST; j++) {
350 bufs[j]->hash.usr = (i+j) << 1;
351 }
352
353 processed = 0;
354 while (processed < BURST)
355 processed += rte_distributor_process(d,
356 &bufs[processed], BURST - processed);
357 }
358
359 rte_distributor_flush(d);
360
361 rte_delay_us(10000);
362
363 if (total_packet_count() < (1<<ITER_POWER)) {
364 printf("Line %u: Packet count is incorrect, %u, expected %u\n",
365 __LINE__, total_packet_count(),
366 (1<<ITER_POWER));
367 return -1;
368 }
369
370 printf("Sanity test with mbuf alloc/free passed\n\n");
371 return 0;
372}
373
374static int
375handle_work_for_shutdown_test(void *arg)

Callers 1

test_distributorFunction · 0.85

Calls 6

rte_mempool_get_bulkFunction · 0.85
rte_distributor_processFunction · 0.85
rte_distributor_flushFunction · 0.85
clear_packet_countFunction · 0.70
total_packet_countFunction · 0.70
printfFunction · 0.50

Tested by

no test coverage detected