56 #include <rte_config.h>
60 #if defined(RTE_ARCH_X86) || defined(RTE_MACHINE_CPUFLAG_NEON)
68 static const __m128i rte_thash_ipv6_bswap_mask = {
69 0x0405060700010203ULL, 0x0C0D0E0F08090A0BULL};
76 #define RTE_THASH_V4_L3_LEN ((sizeof(struct rte_ipv4_tuple) - \
77 sizeof(((struct rte_ipv4_tuple *)0)->sctp_tag)) / 4)
84 #define RTE_THASH_V4_L4_LEN ((sizeof(struct rte_ipv4_tuple)) / 4)
90 #define RTE_THASH_V6_L3_LEN ((sizeof(struct rte_ipv6_tuple) - \
91 sizeof(((struct rte_ipv6_tuple *)0)->sctp_tag)) / 4)
98 #define RTE_THASH_V6_L4_LEN ((sizeof(struct rte_ipv6_tuple)) / 4)
123 uint8_t src_addr[16];
124 uint8_t dst_addr[16];
135 union rte_thash_tuple {
139 } __attribute__((aligned(XMM_SIZE)));
158 for (i = 0; i < (len >> 2); i++)
174 __m128i ipv6 = _mm_loadu_si128((
const __m128i *)orig->
src_addr);
175 *(__m128i *)targ->v6.src_addr =
176 _mm_shuffle_epi8(ipv6, rte_thash_ipv6_bswap_mask);
177 ipv6 = _mm_loadu_si128((
const __m128i *)orig->
dst_addr);
178 *(__m128i *)targ->v6.dst_addr =
179 _mm_shuffle_epi8(ipv6, rte_thash_ipv6_bswap_mask);
180 #elif defined(RTE_MACHINE_CPUFLAG_NEON)
181 uint8x16_t ipv6 = vld1q_u8((uint8_t
const *)orig->
src_addr);
182 vst1q_u8((uint8_t *)targ->v6.src_addr, vrev32q_u8(ipv6));
183 ipv6 = vld1q_u8((uint8_t
const *)orig->
dst_addr);
184 vst1q_u8((uint8_t *)targ->v6.dst_addr, vrev32q_u8(ipv6));
187 for (i = 0; i < 4; i++) {
188 *((uint32_t *)targ->v6.src_addr + i) =
190 *((uint32_t *)targ->v6.dst_addr + i) =
207 static inline uint32_t
209 const uint8_t *rss_key)
211 uint32_t i, j, map, ret = 0;
213 for (j = 0; j < input_len; j++) {
214 for (map = input_tuple[j]; map; map &= (map - 1)) {
217 (uint32_t)((uint64_t)(
rte_cpu_to_be_32(((
const uint32_t *)rss_key)[j + 1])) >>
237 static inline uint32_t
239 const uint8_t *rss_key)
241 uint32_t i, j, map, ret = 0;
243 for (j = 0; j < input_len; j++) {
244 for (map = input_tuple[j]; map; map &= (map - 1)) {
246 ret ^= ((
const uint32_t *)rss_key)[j] << (31 - i) |
247 (uint32_t)((uint64_t)(((
const uint32_t *)rss_key)[j + 1]) >> (i + 1));