| 403 | } |
| 404 | |
| 405 | static int |
| 406 | test_extmem_invalid_param(void *addr, size_t len, size_t pgsz, rte_iova_t *iova, |
| 407 | int n_pages) |
| 408 | { |
| 409 | /* these calls may fail for other reasons, so check errno */ |
| 410 | if (rte_extmem_unregister(addr, len) >= 0 || |
| 411 | rte_errno != ENOENT) { |
| 412 | printf("%s():%i: Unregistered non-existent memory\n", |
| 413 | __func__, __LINE__); |
| 414 | return -1; |
| 415 | } |
| 416 | |
| 417 | if (rte_extmem_attach(addr, len) >= 0 || |
| 418 | rte_errno != ENOENT) { |
| 419 | printf("%s():%i: Attached to non-existent memory\n", |
| 420 | __func__, __LINE__); |
| 421 | return -1; |
| 422 | } |
| 423 | if (rte_extmem_attach(addr, len) >= 0 || |
| 424 | rte_errno != ENOENT) { |
| 425 | printf("%s():%i: Detached from non-existent memory\n", |
| 426 | __func__, __LINE__); |
| 427 | return -1; |
| 428 | } |
| 429 | |
| 430 | /* zero length */ |
| 431 | if (rte_extmem_register(addr, 0, NULL, 0, pgsz) >= 0 || |
| 432 | rte_errno != EINVAL) { |
| 433 | printf("%s():%i: Registered memory with invalid parameters\n", |
| 434 | __func__, __LINE__); |
| 435 | return -1; |
| 436 | } |
| 437 | |
| 438 | if (rte_extmem_unregister(addr, 0) >= 0 || |
| 439 | rte_errno != EINVAL) { |
| 440 | printf("%s():%i: Unregistered memory with invalid parameters\n", |
| 441 | __func__, __LINE__); |
| 442 | return -1; |
| 443 | } |
| 444 | |
| 445 | if (rte_extmem_attach(addr, 0) >= 0 || |
| 446 | rte_errno != EINVAL) { |
| 447 | printf("%s():%i: Attached memory with invalid parameters\n", |
| 448 | __func__, __LINE__); |
| 449 | return -1; |
| 450 | } |
| 451 | if (rte_extmem_attach(addr, 0) >= 0 || |
| 452 | rte_errno != EINVAL) { |
| 453 | printf("%s():%i: Detached memory with invalid parameters\n", |
| 454 | __func__, __LINE__); |
| 455 | return -1; |
| 456 | } |
| 457 | |
| 458 | /* zero address */ |
| 459 | if (rte_extmem_register(NULL, len, NULL, 0, pgsz) >= 0 || |
| 460 | rte_errno != EINVAL) { |
| 461 | printf("%s():%i: Registered memory with invalid parameters\n", |
| 462 | __func__, __LINE__); |
no test coverage detected