* - Add rule that covers a TBL24 range previously invalid & lookup (& delete & * lookup) * - Add rule that extends a TBL24 invalid entry & lookup (& delete & lookup) * - Add rule that extends a TBL24 valid entry & lookup for both rules (& * delete & lookup) * - Add rule that updates the next hop in TBL24 & lookup (& delete & lookup) * - Add rule that updates the next hop in TBL8 & lookup
| 617 | * |
| 618 | */ |
| 619 | int32_t |
| 620 | test10(void) |
| 621 | { |
| 622 | |
| 623 | struct rte_lpm *lpm = NULL; |
| 624 | struct rte_lpm_config config; |
| 625 | |
| 626 | config.max_rules = MAX_RULES; |
| 627 | config.number_tbl8s = NUMBER_TBL8S; |
| 628 | config.flags = 0; |
| 629 | uint32_t ip, next_hop_add, next_hop_return; |
| 630 | uint8_t depth; |
| 631 | int32_t status = 0; |
| 632 | |
| 633 | /* Add rule that covers a TBL24 range previously invalid & lookup |
| 634 | * (& delete & lookup) */ |
| 635 | lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); |
| 636 | TEST_LPM_ASSERT(lpm != NULL); |
| 637 | |
| 638 | ip = RTE_IPV4(128, 0, 0, 0); |
| 639 | depth = 16; |
| 640 | next_hop_add = 100; |
| 641 | |
| 642 | status = rte_lpm_add(lpm, ip, depth, next_hop_add); |
| 643 | TEST_LPM_ASSERT(status == 0); |
| 644 | |
| 645 | status = rte_lpm_lookup(lpm, ip, &next_hop_return); |
| 646 | TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); |
| 647 | |
| 648 | status = rte_lpm_delete(lpm, ip, depth); |
| 649 | TEST_LPM_ASSERT(status == 0); |
| 650 | |
| 651 | status = rte_lpm_lookup(lpm, ip, &next_hop_return); |
| 652 | TEST_LPM_ASSERT(status == -ENOENT); |
| 653 | |
| 654 | rte_lpm_delete_all(lpm); |
| 655 | |
| 656 | ip = RTE_IPV4(128, 0, 0, 0); |
| 657 | depth = 25; |
| 658 | next_hop_add = 100; |
| 659 | |
| 660 | status = rte_lpm_add(lpm, ip, depth, next_hop_add); |
| 661 | TEST_LPM_ASSERT(status == 0); |
| 662 | |
| 663 | status = rte_lpm_lookup(lpm, ip, &next_hop_return); |
| 664 | TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); |
| 665 | |
| 666 | status = rte_lpm_delete(lpm, ip, depth); |
| 667 | TEST_LPM_ASSERT(status == 0); |
| 668 | |
| 669 | rte_lpm_delete_all(lpm); |
| 670 | |
| 671 | /* Add rule that extends a TBL24 valid entry & lookup for both rules |
| 672 | * (& delete & lookup) */ |
| 673 | |
| 674 | ip = RTE_IPV4(128, 0, 0, 0); |
| 675 | depth = 24; |
| 676 | next_hop_add = 100; |
nothing calls this directly
no test coverage detected