X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_lpm%2Frte_lpm.h;h=c299ce2fb4f84cbc63a356cc24f0a3c4fab5b777;hb=386c993e95f13b555afe240f29679c19dcf4a73a;hp=62d7736ec6bf84d7031e1946c8d8b5b2f80be17f;hpb=899d8bc9b3b5956d10fbbb79a6b27fc9838a683c;p=dpdk.git diff --git a/lib/librte_lpm/rte_lpm.h b/lib/librte_lpm/rte_lpm.h index 62d7736ec6..c299ce2fb4 100644 --- a/lib/librte_lpm/rte_lpm.h +++ b/lib/librte_lpm/rte_lpm.h @@ -44,9 +44,10 @@ #include #include #include +#include #include #include -#include +#include #ifdef __cplusplus extern "C" { @@ -55,16 +56,6 @@ extern "C" { /** Max number of characters in LPM name. */ #define RTE_LPM_NAMESIZE 32 -/** @deprecated Possible location to allocate memory. This was for last - * parameter of rte_lpm_create(), but is now redundant. The LPM table is always - * allocated in memory using librte_malloc which uses a memzone. */ -#define RTE_LPM_HEAP 0 - -/** @deprecated Possible location to allocate memory. This was for last - * parameter of rte_lpm_create(), but is now redundant. The LPM table is always - * allocated in memory using librte_malloc which uses a memzone. */ -#define RTE_LPM_MEMZONE 1 - /** Maximum depth value possible for IPv4 LPM. */ #define RTE_LPM_MAX_DEPTH 32 @@ -96,6 +87,7 @@ extern "C" { /** Bitmask used to indicate successful lookup */ #define RTE_LPM_LOOKUP_SUCCESS 0x0100 +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN /** @internal Tbl24 entry structure. */ struct rte_lpm_tbl24_entry { /* Stores Next hop or group index (i.e. gindex)into tbl8. */ @@ -117,6 +109,24 @@ struct rte_lpm_tbl8_entry { uint8_t valid_group :1; /**< Group validation flag. */ uint8_t depth :6; /**< Rule depth. */ }; +#else +struct rte_lpm_tbl24_entry { + uint8_t depth :6; + uint8_t ext_entry :1; + uint8_t valid :1; + union { + uint8_t tbl8_gindex; + uint8_t next_hop; + }; +}; + +struct rte_lpm_tbl8_entry { + uint8_t depth :6; + uint8_t valid_group :1; + uint8_t valid :1; + uint8_t next_hop; +}; +#endif /** @internal Rule structure. */ struct rte_lpm_rule { @@ -134,7 +144,6 @@ struct rte_lpm_rule_info { struct rte_lpm { /* LPM metadata. */ char name[RTE_LPM_NAMESIZE]; /**< Name of the lpm. */ - int mem_location; /**< @deprecated @see RTE_LPM_HEAP and RTE_LPM_MEMZONE. */ uint32_t max_rules; /**< Max. balanced rules per lpm. */ struct rte_lpm_rule_info rule_info[RTE_LPM_MAX_DEPTH]; /**< Rule info table. */ @@ -163,7 +172,6 @@ struct rte_lpm { * to an appropriate values. Possible rte_errno values include: * - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure * - E_RTE_SECONDARY - function was called from a secondary process instance - * - E_RTE_NO_TAILQ - no tailq list could be got for the lpm object list * - EINVAL - invalid parameter passed to function * - ENOSPC - the maximum number of memzones has already been allocated * - EEXIST - a memzone with the same name already exists @@ -420,7 +428,7 @@ rte_lpm_lookupx4(const struct rte_lpm *lpm, __m128i ip, uint16_t hop[4], tbl[3] = *(const uint16_t *)&lpm->tbl24[idx >> 32]; /* get 4 indexes for tbl8[]. */ - i8.m = _mm_and_si128(ip, mask8); + i8.x = _mm_and_si128(ip, mask8); pt = (uint64_t)tbl[0] | (uint64_t)tbl[1] << 16 |