MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test10

Function test10

dpdk/app/test/test_lpm6.c:484–523  ·  view source on GitHub ↗

* Adds max_rules + 1 and expects a failure. Deletes a rule, then adds * another one and expects success. */

Source from the content-addressed store, hash-verified

482 * another one and expects success.
483 */
484int32_t
485test10(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

Callers

nothing calls this directly

Calls 4

rte_lpm6_createFunction · 0.50
rte_lpm6_addFunction · 0.50
rte_lpm6_deleteFunction · 0.50
rte_lpm6_freeFunction · 0.50

Tested by

no test coverage detected