src/dpdk/lib/librte_lpm/rte_lpm6.c
int
rte_lpm6_delete_bulk_func(struct rte_lpm6 *lpm,
		uint8_t ips[][RTE_LPM6_IPV6_ADDR_SIZE], uint8_t *depths,
		unsigned n)
{
	uint8_t masked_ip[RTE_LPM6_IPV6_ADDR_SIZE];
	unsigned i;

	/* Check input arguments. */
	if ((lpm == NULL) || (ips == NULL) || (depths == NULL))
		return -EINVAL;

	for (i = 0; i < n; i++) {
		ip6_copy_addr(masked_ip, ips[i]);
		ip6_mask_addr(masked_ip, depths[i]);
		rule_delete(lpm, masked_ip, depths[i]);
	}

	/*
	 * Set all the table entries to 0 (ie delete every rule
	 * from the data structure.
	 */
	memset(lpm->tbl24, 0, sizeof(lpm->tbl24));
	memset(lpm->tbl8, 0, sizeof(lpm->tbl8[0])
			* RTE_LPM6_TBL8_GROUP_NUM_ENTRIES * lpm->number_tbl8s);
	tbl8_pool_init(lpm);

	/*
	 * Add every rule again (except for the ones that were removed from
	 * the rules table).
	 */
	rebuild_lpm(lpm);

	return 0;
}
/*
 * Deletes a group of rules
 *
 * Note that the function rebuilds the lpm table,
 * rather than doing incremental updates like
 * the regular delete function
 */
Deletes a group of rules
Note that the function rebuilds the lpm table,
rather than doing incremental updates like
the regular delete function
Deletes a group of rules Note that the function rebuilds the lpm table rather than doing incremental updates like the regular delete function
int
rte_lpm6_delete_bulk_func(struct rte_lpm6 *lpm,
		uint8_t ips[][RTE_LPM6_IPV6_ADDR_SIZE], uint8_t *depths,
		unsigned n)
{
	uint8_t masked_ip[RTE_LPM6_IPV6_ADDR_SIZE];
	unsigned i;
	if ((lpm == NULL) || (ips == NULL) || (depths == NULL))
		return -EINVAL;
	for (i = 0; i < n; i++) {
		ip6_copy_addr(masked_ip, ips[i]);
		ip6_mask_addr(masked_ip, depths[i]);
		rule_delete(lpm, masked_ip, depths[i]);
	}
	memset(lpm->tbl24, 0, sizeof(lpm->tbl24));
	memset(lpm->tbl8, 0, sizeof(lpm->tbl8[0])
			* RTE_LPM6_TBL8_GROUP_NUM_ENTRIES * lpm->number_tbl8s);
	tbl8_pool_init(lpm);
	rebuild_lpm(lpm);
	return 0;
}
int rte_lpm6_delete_bulk_func ( struct rte_lpm6 * lpm , uint8_t ips [ ] [ RTE_LPM6_IPV6_ADDR_SIZE ] , uint8_t * depths , unsigned n ) { uint8_t masked_ip [ RTE_LPM6_IPV6_ADDR_SIZE ] ; unsigned i ; if ( ( lpm == NULL ) || ( ips == NULL ) || ( depths == NULL ) ) return - EINVAL ; for ( i = 0 ; i < n ; i ++ ) { ip6_copy_addr ( masked_ip , ips [ i ] ) ; ip6_mask_addr ( masked_ip , depths [ i ] ) ; rule_delete ( lpm , masked_ip , depths [ i ] ) ; } memset ( lpm -> tbl24 , 0 , sizeof ( lpm -> tbl24 ) ) ; memset ( lpm -> tbl8 , 0 , sizeof ( lpm -> tbl8 [ 0 ] ) * RTE_LPM6_TBL8_GROUP_NUM_ENTRIES * lpm -> number_tbl8s ) ; tbl8_pool_init ( lpm ) ; rebuild_lpm ( lpm ) ; return 0 ; }
Deletes a group of rules
 Note that the function rebuilds the lpm table,
 rather than doing incremental updates like
 the regular delete function
Deletes a group of rules Note that the function rebuilds the lpm table rather than doing incremental updates like the regular delete function
/* Check input arguments. */ /*
	 * Set all the table entries to 0 (ie delete every rule
	 * from the data structure.
	 */ /*
	 * Add every rule again (except for the ones that were removed from
	 * the rules table).
	 */