23 #include <rte_config.h> 27 #if defined(RTE_ARCH_X86) || defined(__ARM_NEON) 35 static const __m128i rte_thash_ipv6_bswap_mask = {
36 0x0405060700010203ULL, 0x0C0D0E0F08090A0BULL};
43 #define RTE_THASH_V4_L3_LEN ((sizeof(struct rte_ipv4_tuple) - \ 44 sizeof(((struct rte_ipv4_tuple *)0)->sctp_tag)) / 4) 51 #define RTE_THASH_V4_L4_LEN ((sizeof(struct rte_ipv4_tuple)) / 4) 57 #define RTE_THASH_V6_L3_LEN ((sizeof(struct rte_ipv6_tuple) - \ 58 sizeof(((struct rte_ipv6_tuple *)0)->sctp_tag)) / 4) 65 #define RTE_THASH_V6_L4_LEN ((sizeof(struct rte_ipv6_tuple)) / 4) 102 union rte_thash_tuple {
125 for (i = 0; i < (len >> 2); i++)
139 union rte_thash_tuple *targ)
142 __m128i ipv6 = _mm_loadu_si128((
const __m128i *)orig->
src_addr);
143 *(__m128i *)targ->v6.src_addr =
144 _mm_shuffle_epi8(ipv6, rte_thash_ipv6_bswap_mask);
145 ipv6 = _mm_loadu_si128((
const __m128i *)orig->
dst_addr);
146 *(__m128i *)targ->v6.dst_addr =
147 _mm_shuffle_epi8(ipv6, rte_thash_ipv6_bswap_mask);
148 #elif defined(__ARM_NEON) 149 uint8x16_t ipv6 = vld1q_u8((uint8_t
const *)orig->
src_addr);
150 vst1q_u8((uint8_t *)targ->v6.src_addr, vrev32q_u8(ipv6));
151 ipv6 = vld1q_u8((uint8_t
const *)orig->
dst_addr);
152 vst1q_u8((uint8_t *)targ->v6.dst_addr, vrev32q_u8(ipv6));
155 for (i = 0; i < 4; i++) {
156 *((uint32_t *)targ->v6.src_addr + i) =
158 *((uint32_t *)targ->v6.dst_addr + i) =
175 static inline uint32_t
177 const uint8_t *rss_key)
179 uint32_t i, j, map, ret = 0;
181 for (j = 0; j < input_len; j++) {
182 for (map = input_tuple[j]; map; map &= (map - 1)) {
185 (uint32_t)((uint64_t)(
rte_cpu_to_be_32(((
const uint32_t *)rss_key)[j + 1])) >>
205 static inline uint32_t
207 const uint8_t *rss_key)
209 uint32_t i, j, map, ret = 0;
211 for (j = 0; j < input_len; j++) {
212 for (map = input_tuple[j]; map; map &= (map - 1)) {
214 ret ^= ((
const uint32_t *)rss_key)[j] << (31 - i) |
215 (uint32_t)((uint64_t)(((
const uint32_t *)rss_key)[j + 1]) >> (i + 1));
static rte_be32_t rte_cpu_to_be_32(uint32_t x)
static void rte_convert_rss_key(const uint32_t *orig, uint32_t *targ, int len)
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)
static uint32_t rte_be_to_cpu_32(rte_be32_t x)
static uint32_t rte_softrss_be(uint32_t *input_tuple, uint32_t input_len, const uint8_t *rss_key)
__extension__ struct rte_eth_link __rte_aligned(8)