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

Function expand_rule

dpdk/lib/lpm/rte_lpm6.c:521–551  ·  view source on GitHub ↗

* Function that expands a rule across the data structure when a less-generic * one has been added before. It assures that every possible combination of bits * in the IP address returns a match. */

Source from the content-addressed store, hash-verified

519 * in the IP address returns a match.
520 */
521static void
522expand_rule(struct rte_lpm6 *lpm, uint32_t tbl8_gindex, uint8_t old_depth,
523 uint8_t new_depth, uint32_t next_hop, uint8_t valid)
524{
525 uint32_t tbl8_group_end, tbl8_gindex_next, j;
526
527 tbl8_group_end = tbl8_gindex + RTE_LPM6_TBL8_GROUP_NUM_ENTRIES;
528
529 struct rte_lpm6_tbl_entry new_tbl8_entry = {
530 .valid = valid,
531 .valid_group = valid,
532 .depth = new_depth,
533 .next_hop = next_hop,
534 .ext_entry = 0,
535 };
536
537 for (j = tbl8_gindex; j < tbl8_group_end; j++) {
538 if (!lpm->tbl8[j].valid || (lpm->tbl8[j].ext_entry == 0
539 && lpm->tbl8[j].depth <= old_depth)) {
540
541 lpm->tbl8[j] = new_tbl8_entry;
542
543 } else if (lpm->tbl8[j].ext_entry == 1) {
544
545 tbl8_gindex_next = lpm->tbl8[j].lpm6_tbl8_gindex
546 * RTE_LPM6_TBL8_GROUP_NUM_ENTRIES;
547 expand_rule(lpm, tbl8_gindex_next, old_depth, new_depth,
548 next_hop, valid);
549 }
550 }
551}
552
553/*
554 * Init a tbl8 header

Callers 2

add_stepFunction · 0.70
rte_lpm6_deleteFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected