src/dpdk/lib/librte_lpm/rte_lpm6.c
static inline int
lookup_step(const struct rte_lpm6 *lpm, const struct rte_lpm6_tbl_entry *tbl,
		const struct rte_lpm6_tbl_entry **tbl_next, const uint8_t *ip,
		uint8_t first_byte, uint32_t *next_hop)
{
	uint32_t tbl8_index, tbl_entry;

	/* Take the integer value from the pointer. */
	tbl_entry = *(const uint32_t *)tbl;

	/* If it is valid and extended we calculate the new pointer to return. */
	if ((tbl_entry & RTE_LPM6_VALID_EXT_ENTRY_BITMASK) ==
			RTE_LPM6_VALID_EXT_ENTRY_BITMASK) {

		tbl8_index = ip[first_byte-1] +
				((tbl_entry & RTE_LPM6_TBL8_BITMASK) *
				RTE_LPM6_TBL8_GROUP_NUM_ENTRIES);

		*tbl_next = &lpm->tbl8[tbl8_index];

		return 1;
	} else {
		/* If not extended then we can have a match. */
		*next_hop = ((uint32_t)tbl_entry & RTE_LPM6_TBL8_BITMASK);
		return (tbl_entry & RTE_LPM6_LOOKUP_SUCCESS) ? 0 : -ENOENT;
	}
}
/*
 * Takes a pointer to a table entry and inspect one level.
 * The function returns 0 on lookup success, ENOENT if no match was found
 * or 1 if the process needs to be continued by calling the function again.
 */
Takes a pointer to a table entry and inspect one level.
The function returns 0 on lookup success, ENOENT if no match was found
or 1 if the process needs to be continued by calling the function again.
Takes a pointer to a table entry and inspect one level . The function returns 0 on lookup success ENOENT if no match was found or 1 if the process needs to be continued by calling the function again .
static inline int
lookup_step(const struct rte_lpm6 *lpm, const struct rte_lpm6_tbl_entry *tbl,
		const struct rte_lpm6_tbl_entry **tbl_next, const uint8_t *ip,
		uint8_t first_byte, uint32_t *next_hop)
{
	uint32_t tbl8_index, tbl_entry;
	tbl_entry = *(const uint32_t *)tbl;
	if ((tbl_entry & RTE_LPM6_VALID_EXT_ENTRY_BITMASK) ==
			RTE_LPM6_VALID_EXT_ENTRY_BITMASK) {
		tbl8_index = ip[first_byte-1] +
				((tbl_entry & RTE_LPM6_TBL8_BITMASK) *
				RTE_LPM6_TBL8_GROUP_NUM_ENTRIES);
		*tbl_next = &lpm->tbl8[tbl8_index];
		return 1;
	} else {
		*next_hop = ((uint32_t)tbl_entry & RTE_LPM6_TBL8_BITMASK);
		return (tbl_entry & RTE_LPM6_LOOKUP_SUCCESS) ? 0 : -ENOENT;
	}
}
static inline int lookup_step ( const struct rte_lpm6 * lpm , const struct rte_lpm6_tbl_entry * tbl , const struct rte_lpm6_tbl_entry * * tbl_next , const uint8_t * ip , uint8_t first_byte , uint32_t * next_hop ) { uint32_t tbl8_index , tbl_entry ; tbl_entry = * ( const uint32_t * ) tbl ; if ( ( tbl_entry & RTE_LPM6_VALID_EXT_ENTRY_BITMASK ) == RTE_LPM6_VALID_EXT_ENTRY_BITMASK ) { tbl8_index = ip [ first_byte - 1 ] + ( ( tbl_entry & RTE_LPM6_TBL8_BITMASK ) * RTE_LPM6_TBL8_GROUP_NUM_ENTRIES ) ; * tbl_next = & lpm -> tbl8 [ tbl8_index ] ; return 1 ; } else { * next_hop = ( ( uint32_t ) tbl_entry & RTE_LPM6_TBL8_BITMASK ) ; return ( tbl_entry & RTE_LPM6_LOOKUP_SUCCESS ) ? 0 : - ENOENT ; } }
Takes a pointer to a table entry and inspect one level.
Takes a pointer to a table entry and inspect one level .
/* Take the integer value from the pointer. */ /* If it is valid and extended we calculate the new pointer to return. */ /* If not extended then we can have a match. */