* Creates an LPM table with a small number of tbl8s and exhaust them in the * middle of the process of adding a rule when there is already an existing rule * in that position and needs to be extended. */
| 588 | * in that position and needs to be extended. |
| 589 | */ |
| 590 | int32_t |
| 591 | test12(void) |
| 592 | { |
| 593 | struct rte_lpm6 *lpm = NULL; |
| 594 | struct rte_lpm6_config config; |
| 595 | uint8_t ip[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; |
| 596 | uint8_t depth; |
| 597 | uint32_t next_hop_add = 100; |
| 598 | int32_t status = 0; |
| 599 | |
| 600 | config.max_rules = MAX_RULES; |
| 601 | config.number_tbl8s = 16; |
| 602 | config.flags = 0; |
| 603 | |
| 604 | lpm = rte_lpm6_create(__func__, SOCKET_ID_ANY, &config); |
| 605 | TEST_LPM_ASSERT(lpm != NULL); |
| 606 | |
| 607 | depth = 128; |
| 608 | status = rte_lpm6_add(lpm, ip, depth, next_hop_add); |
| 609 | TEST_LPM_ASSERT(status == 0); |
| 610 | |
| 611 | ip[0] = 1; |
| 612 | depth = 41; |
| 613 | status = rte_lpm6_add(lpm, ip, depth, next_hop_add); |
| 614 | TEST_LPM_ASSERT(status == 0); |
| 615 | |
| 616 | depth = 49; |
| 617 | status = rte_lpm6_add(lpm, ip, depth, next_hop_add); |
| 618 | TEST_LPM_ASSERT(status == -ENOSPC); |
| 619 | |
| 620 | rte_lpm6_free(lpm); |
| 621 | |
| 622 | return PASS; |
| 623 | } |
| 624 | |
| 625 | /* |
| 626 | * Creates an LPM table with max_rules = 2 and tries to add 3 rules. |
nothing calls this directly
no test coverage detected