26 #include <rte_thash_gfni.h> 28 #if defined(RTE_ARCH_X86) || defined(__ARM_NEON) 36 static const __m128i rte_thash_ipv6_bswap_mask = {
37 0x0405060700010203ULL, 0x0C0D0E0F08090A0BULL};
44 #define RTE_THASH_V4_L3_LEN ((sizeof(struct rte_ipv4_tuple) - \ 45 sizeof(((struct rte_ipv4_tuple *)0)->sctp_tag)) / 4) 52 #define RTE_THASH_V4_L4_LEN ((sizeof(struct rte_ipv4_tuple)) / 4) 58 #define RTE_THASH_V6_L3_LEN ((sizeof(struct rte_ipv6_tuple) - \ 59 sizeof(((struct rte_ipv6_tuple *)0)->sctp_tag)) / 4) 66 #define RTE_THASH_V6_L4_LEN ((sizeof(struct rte_ipv6_tuple)) / 4) 103 union rte_thash_tuple {
126 for (i = 0; i < (len >> 2); i++)
140 union rte_thash_tuple *targ)
143 __m128i ipv6 = _mm_loadu_si128((
const __m128i *)orig->
src_addr);
144 *(__m128i *)targ->v6.src_addr =
145 _mm_shuffle_epi8(ipv6, rte_thash_ipv6_bswap_mask);
146 ipv6 = _mm_loadu_si128((
const __m128i *)orig->
dst_addr);
147 *(__m128i *)targ->v6.dst_addr =
148 _mm_shuffle_epi8(ipv6, rte_thash_ipv6_bswap_mask);
149 #elif defined(__ARM_NEON) 150 uint8x16_t ipv6 = vld1q_u8((uint8_t
const *)orig->
src_addr);
151 vst1q_u8((uint8_t *)targ->v6.src_addr, vrev32q_u8(ipv6));
152 ipv6 = vld1q_u8((uint8_t
const *)orig->
dst_addr);
153 vst1q_u8((uint8_t *)targ->v6.dst_addr, vrev32q_u8(ipv6));
156 for (i = 0; i < 4; i++) {
157 *((uint32_t *)targ->v6.src_addr + i) =
159 *((uint32_t *)targ->v6.dst_addr + i) =
176 static inline uint32_t
178 const uint8_t *rss_key)
180 uint32_t i, j, map, ret = 0;
182 for (j = 0; j < input_len; j++) {
183 for (map = input_tuple[j]; map; map &= (map - 1)) {
186 (uint32_t)((uint64_t)(
rte_cpu_to_be_32(((
const uint32_t *)rss_key)[j + 1])) >>
206 static inline uint32_t
208 const uint8_t *rss_key)
210 uint32_t i, j, map, ret = 0;
212 for (j = 0; j < input_len; j++) {
213 for (map = input_tuple[j]; map; map &= (map - 1)) {
215 ret ^= ((
const uint32_t *)rss_key)[j] << (31 - i) |
216 (uint32_t)((uint64_t)(((
const uint32_t *)rss_key)[j + 1]) >> (i + 1));
257 #define RTE_THASH_RETA_SZ_MIN 2U 259 #define RTE_THASH_RETA_SZ_MAX 16U 265 #define RTE_THASH_IGNORE_PERIOD_OVERFLOW 0x1 270 #define RTE_THASH_MINIMAL_SEQ 0x2 273 struct rte_thash_ctx;
275 struct rte_thash_subtuple_helper;
303 struct rte_thash_ctx *
305 uint8_t *key, uint32_t flags);
321 struct rte_thash_ctx *
380 struct rte_thash_subtuple_helper *
401 uint32_t hash, uint32_t desired_hash);
492 struct rte_thash_subtuple_helper *h,
493 uint8_t *tuple,
unsigned int tuple_len,
494 uint32_t desired_value,
unsigned int attempts,
struct rte_ether_addr src_addr
int(* rte_thash_check_tuple_t)(void *userdata, uint8_t *tuple)
static rte_be32_t rte_cpu_to_be_32(uint32_t x)
__rte_experimental int rte_thash_add_helper(struct rte_thash_ctx *ctx, const char *name, uint32_t len, uint32_t offset)
static void rte_convert_rss_key(const uint32_t *orig, uint32_t *targ, int len)
struct rte_ether_addr dst_addr
__rte_experimental int rte_thash_adjust_tuple(struct rte_thash_ctx *ctx, struct rte_thash_subtuple_helper *h, uint8_t *tuple, unsigned int tuple_len, uint32_t desired_value, unsigned int attempts, rte_thash_check_tuple_t fn, void *userdata)
__rte_experimental void rte_thash_complete_matrix(uint64_t *matrixes, const uint8_t *rss_key, int size)
static uint32_t rte_bsf32(uint32_t v)
static void rte_thash_load_v6_addrs(const struct rte_ipv6_hdr *orig, union rte_thash_tuple *targ)
static uint32_t rte_softrss(uint32_t *input_tuple, uint32_t input_len, const uint8_t *rss_key)
__rte_experimental const uint64_t * rte_thash_get_gfni_matrices(struct rte_thash_ctx *ctx)
static uint32_t rte_be_to_cpu_32(rte_be32_t x)
__rte_experimental int rte_thash_gfni_supported(void)
__rte_experimental struct rte_thash_ctx * rte_thash_find_existing(const char *name)
static uint32_t rte_softrss_be(uint32_t *input_tuple, uint32_t input_len, const uint8_t *rss_key)
__rte_experimental uint32_t rte_thash_get_complement(struct rte_thash_subtuple_helper *h, uint32_t hash, uint32_t desired_hash)
__rte_experimental const uint8_t * rte_thash_get_key(struct rte_thash_ctx *ctx)
__rte_experimental void rte_thash_free_ctx(struct rte_thash_ctx *ctx)
__rte_experimental struct rte_thash_ctx * rte_thash_init_ctx(const char *name, uint32_t key_len, uint32_t reta_sz, uint8_t *key, uint32_t flags)
__rte_experimental struct rte_thash_subtuple_helper * rte_thash_get_helper(struct rte_thash_ctx *ctx, const char *name)