* Adds max_rules + 1 and expects a failure. Deletes a rule, then adds * another one and expects success. */
| 482 | * another one and expects success. |
| 483 | */ |
| 484 | int32_t |
| 485 | test10(void) |
| 486 | { |
| 487 | struct rte_lpm6 *lpm = NULL; |
| 488 | struct rte_lpm6_config config; |
| 489 | uint8_t ip[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; |
| 490 | uint8_t depth; |
| 491 | uint32_t next_hop_add = 100; |
| 492 | int32_t status = 0; |
| 493 | int i; |
| 494 | |
| 495 | config.max_rules = 127; |
| 496 | config.number_tbl8s = NUMBER_TBL8S; |
| 497 | config.flags = 0; |
| 498 | |
| 499 | lpm = rte_lpm6_create(__func__, SOCKET_ID_ANY, &config); |
| 500 | TEST_LPM_ASSERT(lpm != NULL); |
| 501 | |
| 502 | for (i = 1; i < 128; i++) { |
| 503 | depth = (uint8_t)i; |
| 504 | status = rte_lpm6_add(lpm, ip, depth, next_hop_add); |
| 505 | TEST_LPM_ASSERT(status == 0); |
| 506 | } |
| 507 | |
| 508 | depth = 128; |
| 509 | status = rte_lpm6_add(lpm, ip, depth, next_hop_add); |
| 510 | TEST_LPM_ASSERT(status == -ENOSPC); |
| 511 | |
| 512 | depth = 127; |
| 513 | status = rte_lpm6_delete(lpm, ip, depth); |
| 514 | TEST_LPM_ASSERT(status == 0); |
| 515 | |
| 516 | depth = 128; |
| 517 | status = rte_lpm6_add(lpm, ip, depth, next_hop_add); |
| 518 | TEST_LPM_ASSERT(status == 0); |
| 519 | |
| 520 | rte_lpm6_free(lpm); |
| 521 | |
| 522 | return PASS; |
| 523 | } |
| 524 | |
| 525 | /* |
| 526 | * Creates an LPM table with a small number of tbl8s and exhaust them in the |
nothing calls this directly
no test coverage detected