src/dpdk/lib/librte_lpm/rte_lpm6.c
static void
expand_rule(struct rte_lpm6 *lpm, uint32_t tbl8_gindex, uint8_t old_depth,
		uint8_t new_depth, uint32_t next_hop, uint8_t valid)
{
	uint32_t tbl8_group_end, tbl8_gindex_next, j;

	tbl8_group_end = tbl8_gindex + RTE_LPM6_TBL8_GROUP_NUM_ENTRIES;

	struct rte_lpm6_tbl_entry new_tbl8_entry = {
		.valid = valid,
		.valid_group = valid,
		.depth = new_depth,
		.next_hop = next_hop,
		.ext_entry = 0,
	};

	for (j = tbl8_gindex; j < tbl8_group_end; j++) {
		if (!lpm->tbl8[j].valid || (lpm->tbl8[j].ext_entry == 0
				&& lpm->tbl8[j].depth <= old_depth)) {

			lpm->tbl8[j] = new_tbl8_entry;

		} else if (lpm->tbl8[j].ext_entry == 1) {

			tbl8_gindex_next = lpm->tbl8[j].lpm6_tbl8_gindex
					* RTE_LPM6_TBL8_GROUP_NUM_ENTRIES;
			expand_rule(lpm, tbl8_gindex_next, old_depth, new_depth,
					next_hop, valid);
		}
	}
}
/*
 * 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.
 */
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.
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 .
static void
expand_rule(struct rte_lpm6 *lpm, uint32_t tbl8_gindex, uint8_t old_depth,
		uint8_t new_depth, uint32_t next_hop, uint8_t valid)
{
	uint32_t tbl8_group_end, tbl8_gindex_next, j;
	tbl8_group_end = tbl8_gindex + RTE_LPM6_TBL8_GROUP_NUM_ENTRIES;
	struct rte_lpm6_tbl_entry new_tbl8_entry = {
		.valid = valid,
		.valid_group = valid,
		.depth = new_depth,
		.next_hop = next_hop,
		.ext_entry = 0,
	};
	for (j = tbl8_gindex; j < tbl8_group_end; j++) {
		if (!lpm->tbl8[j].valid || (lpm->tbl8[j].ext_entry == 0
				&& lpm->tbl8[j].depth <= old_depth)) {
			lpm->tbl8[j] = new_tbl8_entry;
		} else if (lpm->tbl8[j].ext_entry == 1) {
			tbl8_gindex_next = lpm->tbl8[j].lpm6_tbl8_gindex
					* RTE_LPM6_TBL8_GROUP_NUM_ENTRIES;
			expand_rule(lpm, tbl8_gindex_next, old_depth, new_depth,
					next_hop, valid);
		}
	}
}
static void expand_rule ( struct rte_lpm6 * lpm , uint32_t tbl8_gindex , uint8_t old_depth , uint8_t new_depth , uint32_t next_hop , uint8_t valid ) { uint32_t tbl8_group_end , tbl8_gindex_next , j ; tbl8_group_end = tbl8_gindex + RTE_LPM6_TBL8_GROUP_NUM_ENTRIES ; struct rte_lpm6_tbl_entry new_tbl8_entry = { . valid = valid , . valid_group = valid , . depth = new_depth , . next_hop = next_hop , . ext_entry = 0 , } ; for ( j = tbl8_gindex ; j < tbl8_group_end ; j ++ ) { if ( ! lpm -> tbl8 [ j ] . valid || ( lpm -> tbl8 [ j ] . ext_entry == 0 && lpm -> tbl8 [ j ] . depth <= old_depth ) ) { lpm -> tbl8 [ j ] = new_tbl8_entry ; } else if ( lpm -> tbl8 [ j ] . ext_entry == 1 ) { tbl8_gindex_next = lpm -> tbl8 [ j ] . lpm6_tbl8_gindex * RTE_LPM6_TBL8_GROUP_NUM_ENTRIES ; expand_rule ( lpm , tbl8_gindex_next , old_depth , new_depth , next_hop , valid ) ; } } }
Function that expands a rule across the data structure when a less-generic
 one has been added before.
Function that expands a rule across the data structure when a less - generic one has been added before .