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. */
| 332 | * library. |
| 333 | */ |
| 334 | static int |
| 335 | sanity_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 | |
| 374 | static int |
| 375 | handle_work_for_shutdown_test(void *arg) |
no test coverage detected