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

Function test9

dpdk/app/test/test_lpm.c:451–604  ·  view source on GitHub ↗

* - 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 * */

Source from the content-addressed store, hash-verified

449 *
450 */
451int32_t
452test9(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

Callers

nothing calls this directly

Calls 6

rte_lpm_createFunction · 0.50
rte_lpm_addFunction · 0.50
rte_lpm_lookupFunction · 0.50
rte_lpm_deleteFunction · 0.50
rte_lpm_delete_allFunction · 0.50
rte_lpm_freeFunction · 0.50

Tested by

no test coverage detected