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

Function test11

dpdk/app/test/test_lpm6.c:529–583  ·  view source on GitHub ↗

* Creates an LPM table with a small number of tbl8s and exhaust them in the * middle of the process of creating a rule. */

Source from the content-addressed store, hash-verified

527 * middle of the process of creating a rule.
528 */
529int32_t
530test11(void)
531{
532 struct rte_lpm6 *lpm = NULL;
533 struct rte_lpm6_config config;
534 uint8_t ip[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
535 uint8_t depth;
536 uint32_t next_hop_add = 100;
537 int32_t status = 0;
538
539 config.max_rules = MAX_RULES;
540 config.number_tbl8s = 16;
541 config.flags = 0;
542
543 lpm = rte_lpm6_create(__func__, SOCKET_ID_ANY, &config);
544 TEST_LPM_ASSERT(lpm != NULL);
545
546 depth = 128;
547 status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
548 TEST_LPM_ASSERT(status == 0);
549
550 ip[0] = 1;
551 depth = 25;
552 status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
553 TEST_LPM_ASSERT(status == 0);
554
555 status = rte_lpm6_delete(lpm, ip, depth);
556 TEST_LPM_ASSERT(status == 0);
557
558 depth = 33;
559 status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
560 TEST_LPM_ASSERT(status == 0);
561
562 status = rte_lpm6_delete(lpm, ip, depth);
563 TEST_LPM_ASSERT(status == 0);
564
565 depth = 41;
566 status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
567 TEST_LPM_ASSERT(status == 0);
568
569 status = rte_lpm6_delete(lpm, ip, depth);
570 TEST_LPM_ASSERT(status == 0);
571
572 depth = 49;
573 status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
574 TEST_LPM_ASSERT(status == -ENOSPC);
575
576 depth = 41;
577 status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
578 TEST_LPM_ASSERT(status == 0);
579
580 rte_lpm6_free(lpm);
581
582 return PASS;
583}
584
585/*
586 * 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