* - Add & lookup to hit invalid TBL24 entry * - Add & lookup to hit valid TBL24 entry not extended * - Add & lookup to hit valid extended TBL24 entry with invalid TBL8 entry * - Add & lookup to hit valid extended TBL24 entry with valid TBL8 entry * */
| 449 | * |
| 450 | */ |
| 451 | int32_t |
| 452 | test9(void) |
| 453 | { |
| 454 | struct rte_lpm *lpm = NULL; |
| 455 | struct rte_lpm_config config; |
| 456 | |
| 457 | config.max_rules = MAX_RULES; |
| 458 | config.number_tbl8s = NUMBER_TBL8S; |
| 459 | config.flags = 0; |
| 460 | uint32_t ip, ip_1, ip_2; |
| 461 | uint8_t depth, depth_1, depth_2; |
| 462 | uint32_t next_hop_add, next_hop_add_1, next_hop_add_2, next_hop_return; |
| 463 | int32_t status = 0; |
| 464 | |
| 465 | /* Add & lookup to hit invalid TBL24 entry */ |
| 466 | ip = RTE_IPV4(128, 0, 0, 0); |
| 467 | depth = 24; |
| 468 | next_hop_add = 100; |
| 469 | |
| 470 | lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); |
| 471 | TEST_LPM_ASSERT(lpm != NULL); |
| 472 | |
| 473 | status = rte_lpm_add(lpm, ip, depth, next_hop_add); |
| 474 | TEST_LPM_ASSERT(status == 0); |
| 475 | |
| 476 | status = rte_lpm_lookup(lpm, ip, &next_hop_return); |
| 477 | TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); |
| 478 | |
| 479 | status = rte_lpm_delete(lpm, ip, depth); |
| 480 | TEST_LPM_ASSERT(status == 0); |
| 481 | |
| 482 | status = rte_lpm_lookup(lpm, ip, &next_hop_return); |
| 483 | TEST_LPM_ASSERT(status == -ENOENT); |
| 484 | |
| 485 | rte_lpm_delete_all(lpm); |
| 486 | |
| 487 | /* Add & lookup to hit valid TBL24 entry not extended */ |
| 488 | ip = RTE_IPV4(128, 0, 0, 0); |
| 489 | depth = 23; |
| 490 | next_hop_add = 100; |
| 491 | |
| 492 | status = rte_lpm_add(lpm, ip, depth, next_hop_add); |
| 493 | TEST_LPM_ASSERT(status == 0); |
| 494 | |
| 495 | status = rte_lpm_lookup(lpm, ip, &next_hop_return); |
| 496 | TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); |
| 497 | |
| 498 | depth = 24; |
| 499 | next_hop_add = 101; |
| 500 | |
| 501 | status = rte_lpm_add(lpm, ip, depth, next_hop_add); |
| 502 | TEST_LPM_ASSERT(status == 0); |
| 503 | |
| 504 | status = rte_lpm_lookup(lpm, ip, &next_hop_return); |
| 505 | TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); |
| 506 | |
| 507 | depth = 24; |
| 508 |
nothing calls this directly
no test coverage detected