src/dpdk/lib/librte_lpm/rte_lpm6.c
int
rte_lpm6_lookup_bulk_func(const struct rte_lpm6 *lpm,
		uint8_t ips[][RTE_LPM6_IPV6_ADDR_SIZE],
		int32_t *next_hops, unsigned int n)
{
	unsigned int i;
	const struct rte_lpm6_tbl_entry *tbl;
	const struct rte_lpm6_tbl_entry *tbl_next = NULL;
	uint32_t tbl24_index, next_hop;
	uint8_t first_byte;
	int status;

	/* DEBUG: Check user input arguments. */
	if ((lpm == NULL) || (ips == NULL) || (next_hops == NULL))
		return -EINVAL;

	for (i = 0; i < n; i++) {
		first_byte = LOOKUP_FIRST_BYTE;
		tbl24_index = (ips[i][0] << BYTES2_SIZE) |
				(ips[i][1] << BYTE_SIZE) | ips[i][2];

		/* Calculate pointer to the first entry to be inspected */
		tbl = &lpm->tbl24[tbl24_index];

		do {
			/* Continue inspecting following levels
			 * until success or failure
			 */
			status = lookup_step(lpm, tbl, &tbl_next, ips[i],
					first_byte++, &next_hop);
			tbl = tbl_next;
		} while (status == 1);

		if (status < 0)
			next_hops[i] = -1;
		else
			next_hops[i] = (int32_t)next_hop;
	}

	return 0;
}
/*
 * Looks up a group of IP addresses
 */
Looks up a group of IP addresses
Looks up a group of IP addresses
int
rte_lpm6_lookup_bulk_func(const struct rte_lpm6 *lpm,
		uint8_t ips[][RTE_LPM6_IPV6_ADDR_SIZE],
		int32_t *next_hops, unsigned int n)
{
	unsigned int i;
	const struct rte_lpm6_tbl_entry *tbl;
	const struct rte_lpm6_tbl_entry *tbl_next = NULL;
	uint32_t tbl24_index, next_hop;
	uint8_t first_byte;
	int status;
	if ((lpm == NULL) || (ips == NULL) || (next_hops == NULL))
		return -EINVAL;
	for (i = 0; i < n; i++) {
		first_byte = LOOKUP_FIRST_BYTE;
		tbl24_index = (ips[i][0] << BYTES2_SIZE) |
				(ips[i][1] << BYTE_SIZE) | ips[i][2];
		tbl = &lpm->tbl24[tbl24_index];
		do {
			status = lookup_step(lpm, tbl, &tbl_next, ips[i],
					first_byte++, &next_hop);
			tbl = tbl_next;
		} while (status == 1);
		if (status < 0)
			next_hops[i] = -1;
		else
			next_hops[i] = (int32_t)next_hop;
	}
	return 0;
}
int rte_lpm6_lookup_bulk_func ( const struct rte_lpm6 * lpm , uint8_t ips [ ] [ RTE_LPM6_IPV6_ADDR_SIZE ] , int32_t * next_hops , unsigned int n ) { unsigned int i ; const struct rte_lpm6_tbl_entry * tbl ; const struct rte_lpm6_tbl_entry * tbl_next = NULL ; uint32_t tbl24_index , next_hop ; uint8_t first_byte ; int status ; if ( ( lpm == NULL ) || ( ips == NULL ) || ( next_hops == NULL ) ) return - EINVAL ; for ( i = 0 ; i < n ; i ++ ) { first_byte = LOOKUP_FIRST_BYTE ; tbl24_index = ( ips [ i ] [ 0 ] << BYTES2_SIZE ) | ( ips [ i ] [ 1 ] << BYTE_SIZE ) | ips [ i ] [ 2 ] ; tbl = & lpm -> tbl24 [ tbl24_index ] ; do { status = lookup_step ( lpm , tbl , & tbl_next , ips [ i ] , first_byte ++ , & next_hop ) ; tbl = tbl_next ; } while ( status == 1 ) ; if ( status < 0 ) next_hops [ i ] = -1 ; else next_hops [ i ] = ( int32_t ) next_hop ; } return 0 ; }
Looks up a group of IP addresses
Looks up a group of IP addresses
/* DEBUG: Check user input arguments. */ /* Calculate pointer to the first entry to be inspected */ /* Continue inspecting following levels
			 * until success or failure
			 */