27 #include <rte_config.h> 31 #if defined(RTE_ARCH_X86) || defined(RTE_MACHINE_CPUFLAG_NEON) 39 static const __m128i rte_thash_ipv6_bswap_mask = {
40 0x0405060700010203ULL, 0x0C0D0E0F08090A0BULL};
47 #define RTE_THASH_V4_L3_LEN ((sizeof(struct rte_ipv4_tuple) - \ 48 sizeof(((struct rte_ipv4_tuple *)0)->sctp_tag)) / 4) 55 #define RTE_THASH_V4_L4_LEN ((sizeof(struct rte_ipv4_tuple)) / 4) 61 #define RTE_THASH_V6_L3_LEN ((sizeof(struct rte_ipv6_tuple) - \ 62 sizeof(((struct rte_ipv6_tuple *)0)->sctp_tag)) / 4) 69 #define RTE_THASH_V6_L4_LEN ((sizeof(struct rte_ipv6_tuple)) / 4) 106 union rte_thash_tuple {
110 } __attribute__((aligned(XMM_SIZE)));
129 for (i = 0; i < (len >> 2); i++)
143 union rte_thash_tuple *targ)
146 __m128i ipv6 = _mm_loadu_si128((
const __m128i *)orig->
src_addr);
147 *(__m128i *)targ->v6.src_addr =
148 _mm_shuffle_epi8(ipv6, rte_thash_ipv6_bswap_mask);
149 ipv6 = _mm_loadu_si128((
const __m128i *)orig->
dst_addr);
150 *(__m128i *)targ->v6.dst_addr =
151 _mm_shuffle_epi8(ipv6, rte_thash_ipv6_bswap_mask);
152 #elif defined(RTE_MACHINE_CPUFLAG_NEON) 153 uint8x16_t ipv6 = vld1q_u8((uint8_t
const *)orig->
src_addr);
154 vst1q_u8((uint8_t *)targ->v6.src_addr, vrev32q_u8(ipv6));
155 ipv6 = vld1q_u8((uint8_t
const *)orig->
dst_addr);
156 vst1q_u8((uint8_t *)targ->v6.dst_addr, vrev32q_u8(ipv6));
159 for (i = 0; i < 4; i++) {
160 *((uint32_t *)targ->v6.src_addr + i) =
162 *((uint32_t *)targ->v6.dst_addr + i) =
179 static inline uint32_t
181 const uint8_t *rss_key)
183 uint32_t i, j, map, ret = 0;
185 for (j = 0; j < input_len; j++) {
186 for (map = input_tuple[j]; map; map &= (map - 1)) {
189 (uint32_t)((uint64_t)(
rte_cpu_to_be_32(((
const uint32_t *)rss_key)[j + 1])) >>
209 static inline uint32_t
211 const uint8_t *rss_key)
213 uint32_t i, j, map, ret = 0;
215 for (j = 0; j < input_len; j++) {
216 for (map = input_tuple[j]; map; map &= (map - 1)) {
218 ret ^= ((
const uint32_t *)rss_key)[j] << (31 - i) |
219 (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)