* Add 2^12 routes with different first 12 bits and depth 25. * Add one more route with the same depth and check that results in a failure. * After that delete the last rule and create the one that was attempted to be * created. This checks tbl8 exhaustion. */
| 675 | * created. This checks tbl8 exhaustion. |
| 676 | */ |
| 677 | int32_t |
| 678 | test14(void) |
| 679 | { |
| 680 | struct rte_lpm6 *lpm = NULL; |
| 681 | struct rte_lpm6_config config; |
| 682 | uint8_t ip[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; |
| 683 | uint8_t depth = 25; |
| 684 | uint32_t next_hop_add = 100; |
| 685 | int32_t status = 0; |
| 686 | int i; |
| 687 | |
| 688 | config.max_rules = MAX_RULES; |
| 689 | config.number_tbl8s = 256; |
| 690 | config.flags = 0; |
| 691 | |
| 692 | lpm = rte_lpm6_create(__func__, SOCKET_ID_ANY, &config); |
| 693 | TEST_LPM_ASSERT(lpm != NULL); |
| 694 | |
| 695 | for (i = 0; i < 256; i++) { |
| 696 | ip[0] = (uint8_t)i; |
| 697 | status = rte_lpm6_add(lpm, ip, depth, next_hop_add); |
| 698 | TEST_LPM_ASSERT(status == 0); |
| 699 | } |
| 700 | |
| 701 | ip[0] = 255; |
| 702 | ip[1] = 1; |
| 703 | status = rte_lpm6_add(lpm, ip, depth, next_hop_add); |
| 704 | TEST_LPM_ASSERT(status == -ENOSPC); |
| 705 | |
| 706 | ip[0] = 255; |
| 707 | ip[1] = 0; |
| 708 | status = rte_lpm6_delete(lpm, ip, depth); |
| 709 | TEST_LPM_ASSERT(status == 0); |
| 710 | |
| 711 | ip[0] = 255; |
| 712 | ip[1] = 1; |
| 713 | status = rte_lpm6_add(lpm, ip, depth, next_hop_add); |
| 714 | TEST_LPM_ASSERT(status == 0); |
| 715 | |
| 716 | rte_lpm6_free(lpm); |
| 717 | |
| 718 | return PASS; |
| 719 | } |
| 720 | |
| 721 | /* |
| 722 | * Call add, lookup and delete for a single rule with depth = 24 |
nothing calls this directly
no test coverage detected