* Creates an LPM table with a small number of tbl8s and exhaust them in the * middle of the process of creating a rule. */
| 527 | * middle of the process of creating a rule. |
| 528 | */ |
| 529 | int32_t |
| 530 | test11(void) |
| 531 | { |
| 532 | struct rte_lpm6 *lpm = NULL; |
| 533 | struct rte_lpm6_config config; |
| 534 | uint8_t ip[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; |
| 535 | uint8_t depth; |
| 536 | uint32_t next_hop_add = 100; |
| 537 | int32_t status = 0; |
| 538 | |
| 539 | config.max_rules = MAX_RULES; |
| 540 | config.number_tbl8s = 16; |
| 541 | config.flags = 0; |
| 542 | |
| 543 | lpm = rte_lpm6_create(__func__, SOCKET_ID_ANY, &config); |
| 544 | TEST_LPM_ASSERT(lpm != NULL); |
| 545 | |
| 546 | depth = 128; |
| 547 | status = rte_lpm6_add(lpm, ip, depth, next_hop_add); |
| 548 | TEST_LPM_ASSERT(status == 0); |
| 549 | |
| 550 | ip[0] = 1; |
| 551 | depth = 25; |
| 552 | status = rte_lpm6_add(lpm, ip, depth, next_hop_add); |
| 553 | TEST_LPM_ASSERT(status == 0); |
| 554 | |
| 555 | status = rte_lpm6_delete(lpm, ip, depth); |
| 556 | TEST_LPM_ASSERT(status == 0); |
| 557 | |
| 558 | depth = 33; |
| 559 | status = rte_lpm6_add(lpm, ip, depth, next_hop_add); |
| 560 | TEST_LPM_ASSERT(status == 0); |
| 561 | |
| 562 | status = rte_lpm6_delete(lpm, ip, depth); |
| 563 | TEST_LPM_ASSERT(status == 0); |
| 564 | |
| 565 | depth = 41; |
| 566 | status = rte_lpm6_add(lpm, ip, depth, next_hop_add); |
| 567 | TEST_LPM_ASSERT(status == 0); |
| 568 | |
| 569 | status = rte_lpm6_delete(lpm, ip, depth); |
| 570 | TEST_LPM_ASSERT(status == 0); |
| 571 | |
| 572 | depth = 49; |
| 573 | status = rte_lpm6_add(lpm, ip, depth, next_hop_add); |
| 574 | TEST_LPM_ASSERT(status == -ENOSPC); |
| 575 | |
| 576 | depth = 41; |
| 577 | status = rte_lpm6_add(lpm, ip, depth, next_hop_add); |
| 578 | TEST_LPM_ASSERT(status == 0); |
| 579 | |
| 580 | rte_lpm6_free(lpm); |
| 581 | |
| 582 | return PASS; |
| 583 | } |
| 584 | |
| 585 | /* |
| 586 | * Creates an LPM table with a small number of tbl8s and exhaust them in the |
nothing calls this directly
no test coverage detected