* Test the mbuf pool with pinned external data buffers * - Allocate memory zone for external buffer * - Create the mbuf pool with pinned external buffer * - Check the created pool with relevant mbuf pool unit tests */
| 2418 | * - Check the created pool with relevant mbuf pool unit tests |
| 2419 | */ |
| 2420 | static int |
| 2421 | test_pktmbuf_ext_pinned_buffer(struct rte_mempool *std_pool) |
| 2422 | { |
| 2423 | |
| 2424 | struct rte_pktmbuf_extmem ext_mem; |
| 2425 | struct rte_mempool *pinned_pool = NULL; |
| 2426 | const struct rte_memzone *mz = NULL; |
| 2427 | |
| 2428 | printf("Test mbuf pool with external pinned data buffers\n"); |
| 2429 | |
| 2430 | /* Allocate memzone for the external data buffer */ |
| 2431 | mz = rte_memzone_reserve("pinned_pool", |
| 2432 | NB_MBUF * MBUF_DATA_SIZE, |
| 2433 | SOCKET_ID_ANY, |
| 2434 | RTE_MEMZONE_2MB | RTE_MEMZONE_SIZE_HINT_ONLY); |
| 2435 | if (mz == NULL) |
| 2436 | GOTO_FAIL("%s: Memzone allocation failed\n", __func__); |
| 2437 | |
| 2438 | /* Create the mbuf pool with pinned external data buffer */ |
| 2439 | ext_mem.buf_ptr = mz->addr; |
| 2440 | ext_mem.buf_iova = mz->iova; |
| 2441 | ext_mem.buf_len = mz->len; |
| 2442 | ext_mem.elt_size = MBUF_DATA_SIZE; |
| 2443 | |
| 2444 | pinned_pool = rte_pktmbuf_pool_create_extbuf("test_pinned_pool", |
| 2445 | NB_MBUF, MEMPOOL_CACHE_SIZE, 0, |
| 2446 | MBUF_DATA_SIZE, SOCKET_ID_ANY, |
| 2447 | &ext_mem, 1); |
| 2448 | if (pinned_pool == NULL) |
| 2449 | GOTO_FAIL("%s: Mbuf pool with pinned external" |
| 2450 | " buffer creation failed\n", __func__); |
| 2451 | /* test multiple mbuf alloc */ |
| 2452 | if (test_pktmbuf_pool(pinned_pool) < 0) |
| 2453 | GOTO_FAIL("%s: test_mbuf_pool(pinned) failed\n", |
| 2454 | __func__); |
| 2455 | |
| 2456 | /* do it another time to check that all mbufs were freed */ |
| 2457 | if (test_pktmbuf_pool(pinned_pool) < 0) |
| 2458 | GOTO_FAIL("%s: test_mbuf_pool(pinned) failed (2)\n", |
| 2459 | __func__); |
| 2460 | |
| 2461 | /* test that the data pointer on a packet mbuf is set properly */ |
| 2462 | if (test_pktmbuf_pool_ptr(pinned_pool) < 0) |
| 2463 | GOTO_FAIL("%s: test_pktmbuf_pool_ptr(pinned) failed\n", |
| 2464 | __func__); |
| 2465 | |
| 2466 | /* test data manipulation in mbuf with non-ascii data */ |
| 2467 | if (test_pktmbuf_with_non_ascii_data(pinned_pool) < 0) |
| 2468 | GOTO_FAIL("%s: test_pktmbuf_with_non_ascii_data(pinned)" |
| 2469 | " failed\n", __func__); |
| 2470 | |
| 2471 | /* test free pktmbuf segment one by one */ |
| 2472 | if (test_pktmbuf_free_segment(pinned_pool) < 0) |
| 2473 | GOTO_FAIL("%s: test_pktmbuf_free_segment(pinned) failed\n", |
| 2474 | __func__); |
| 2475 | |
| 2476 | if (testclone_testupdate_testdetach(pinned_pool, std_pool) < 0) |
| 2477 | GOTO_FAIL("%s: testclone_and_testupdate(pinned) failed\n", |
no test coverage detected