| 512 | } |
| 513 | |
| 514 | static int |
| 515 | test_extmem_basic(void *addr, size_t len, size_t pgsz, rte_iova_t *iova, |
| 516 | int n_pages) |
| 517 | { |
| 518 | /* register memory */ |
| 519 | if (rte_extmem_register(addr, len, iova, n_pages, pgsz) != 0) { |
| 520 | printf("%s():%i: Failed to register memory\n", |
| 521 | __func__, __LINE__); |
| 522 | goto fail; |
| 523 | } |
| 524 | |
| 525 | /* check if memory is accessible from EAL */ |
| 526 | if (check_mem(addr, iova, pgsz, n_pages) < 0) |
| 527 | goto fail; |
| 528 | |
| 529 | if (rte_extmem_unregister(addr, len) != 0) { |
| 530 | printf("%s():%i: Removing memory from heap failed\n", |
| 531 | __func__, __LINE__); |
| 532 | goto fail; |
| 533 | } |
| 534 | |
| 535 | return 0; |
| 536 | fail: |
| 537 | /* even if something failed, attempt to clean up */ |
| 538 | rte_extmem_unregister(addr, len); |
| 539 | |
| 540 | return -1; |
| 541 | } |
| 542 | |
| 543 | /* we need to test attach/detach in secondary processes. */ |
| 544 | static int |
no test coverage detected