diff options
author | Luca Boccassi <luca.boccassi@gmail.com> | 2017-11-08 14:15:11 +0000 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2017-11-08 14:45:54 +0000 |
commit | 055c52583a2794da8ba1e85a48cce3832372b12f (patch) | |
tree | 8ceb1cb78fbb46a0f341f8ee24feb3c6b5540013 /examples/ip_pipeline | |
parent | f239aed5e674965691846e8ce3f187dd47523689 (diff) |
New upstream version 17.11-rc3
Change-Id: I6a5baa40612fe0c20f30b5fa773a6cbbac63a685
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Diffstat (limited to 'examples/ip_pipeline')
-rw-r--r-- | examples/ip_pipeline/Makefile | 2 | ||||
-rw-r--r-- | examples/ip_pipeline/app.h | 4 | ||||
-rw-r--r-- | examples/ip_pipeline/config_parse.c | 19 | ||||
-rw-r--r-- | examples/ip_pipeline/init.c | 10 | ||||
-rw-r--r-- | examples/ip_pipeline/pipeline/hash_func.h | 178 | ||||
-rw-r--r-- | examples/ip_pipeline/pipeline/hash_func_arm64.h | 261 | ||||
-rw-r--r-- | examples/ip_pipeline/pipeline/pipeline_flow_classification.c | 10 | ||||
-rw-r--r-- | examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c | 53 | ||||
-rw-r--r-- | examples/ip_pipeline/pipeline/pipeline_passthrough_be.c | 10 | ||||
-rw-r--r-- | examples/ip_pipeline/pipeline/pipeline_routing_be.c | 15 |
10 files changed, 399 insertions, 163 deletions
diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index dc7e0ddd..12ce0a1d 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -43,7 +43,7 @@ APP = ip_pipeline VPATH += $(SRCDIR)/pipeline -INC += $(wildcard *.h) $(wildcard pipeline/*.h) +INC += $(sort $(wildcard *.h)) $(sort $(wildcard pipeline/*.h)) # all source are stored in SRCS-y SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := main.c diff --git a/examples/ip_pipeline/app.h b/examples/ip_pipeline/app.h index e41290e7..94e7a6df 100644 --- a/examples/ip_pipeline/app.h +++ b/examples/ip_pipeline/app.h @@ -428,10 +428,6 @@ struct app_eal_params { /* Interrupt mode for VFIO (legacy|msi|msix) */ char *vfio_intr; - /* Support running on Xen dom0 without hugetlbfs */ - uint32_t xen_dom0_present; - int xen_dom0; - uint32_t parsed; }; diff --git a/examples/ip_pipeline/config_parse.c b/examples/ip_pipeline/config_parse.c index 0b761346..3211c6ab 100644 --- a/examples/ip_pipeline/config_parse.c +++ b/examples/ip_pipeline/config_parse.c @@ -809,21 +809,6 @@ parse_eal(struct app_params *app, continue; } - /* xen_dom0 */ - if (strcmp(entry->name, "xen_dom0") == 0) { - int val; - - PARSE_ERROR_DUPLICATE((p->xen_dom0_present == 0), - section_name, - entry->name); - p->xen_dom0_present = 1; - - val = parser_read_arg_bool(entry->value); - PARSE_ERROR((val >= 0), section_name, entry->name); - p->xen_dom0 = val; - continue; - } - /* unrecognized */ PARSE_ERROR_INVALID(0, section_name, entry->name); } @@ -2643,10 +2628,6 @@ save_eal_params(struct app_params *app, FILE *f) if (p->vfio_intr) fprintf(f, "%s = %s\n", "vfio_intr", p->vfio_intr); - if (p->xen_dom0_present) - fprintf(f, "%s = %s\n", "xen_dom0", - (p->xen_dom0) ? "yes" : "no"); - fputc('\n', f); } diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index 7cde49a4..e56e4048 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -49,6 +49,7 @@ #include <rte_ip.h> #include <rte_eal.h> #include <rte_malloc.h> +#include <rte_bus_pci.h> #include "app.h" #include "pipeline.h" @@ -296,11 +297,6 @@ app_init_eal(struct app_params *app) app->eal_argv[n_args++] = strdup(buffer); } - if ((p->xen_dom0_present) && (p->xen_dom0)) { - snprintf(buffer, sizeof(buffer), "--xen-dom0"); - app->eal_argv[n_args++] = strdup(buffer); - } - snprintf(buffer, sizeof(buffer), "--"); app->eal_argv[n_args++] = strdup(buffer); @@ -1236,7 +1232,7 @@ app_init_tap(struct app_params *app) #ifdef RTE_LIBRTE_KNI static int -kni_config_network_interface(uint8_t port_id, uint8_t if_up) { +kni_config_network_interface(uint16_t port_id, uint8_t if_up) { int ret = 0; if (port_id >= rte_eth_dev_count()) @@ -1250,7 +1246,7 @@ kni_config_network_interface(uint8_t port_id, uint8_t if_up) { } static int -kni_change_mtu(uint8_t port_id, unsigned new_mtu) { +kni_change_mtu(uint16_t port_id, unsigned int new_mtu) { int ret; if (port_id >= rte_eth_dev_count()) diff --git a/examples/ip_pipeline/pipeline/hash_func.h b/examples/ip_pipeline/pipeline/hash_func.h index b112369c..42128c1f 100644 --- a/examples/ip_pipeline/pipeline/hash_func.h +++ b/examples/ip_pipeline/pipeline/hash_func.h @@ -34,48 +34,56 @@ #define __INCLUDE_HASH_FUNC_H__ static inline uint64_t -hash_xor_key8(void *key, __rte_unused uint32_t key_size, uint64_t seed) +hash_xor_key8(void *key, void *mask, __rte_unused uint32_t key_size, + uint64_t seed) { uint64_t *k = key; + uint64_t *m = mask; uint64_t xor0; - xor0 = seed ^ k[0]; + xor0 = seed ^ (k[0] & m[0]); return (xor0 >> 32) ^ xor0; } static inline uint64_t -hash_xor_key16(void *key, __rte_unused uint32_t key_size, uint64_t seed) +hash_xor_key16(void *key, void *mask, __rte_unused uint32_t key_size, + uint64_t seed) { uint64_t *k = key; + uint64_t *m = mask; uint64_t xor0; - xor0 = (k[0] ^ seed) ^ k[1]; + xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]); return (xor0 >> 32) ^ xor0; } static inline uint64_t -hash_xor_key24(void *key, __rte_unused uint32_t key_size, uint64_t seed) +hash_xor_key24(void *key, void *mask, __rte_unused uint32_t key_size, + uint64_t seed) { uint64_t *k = key; + uint64_t *m = mask; uint64_t xor0; - xor0 = (k[0] ^ seed) ^ k[1]; + xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]); - xor0 ^= k[2]; + xor0 ^= k[2] & m[2]; return (xor0 >> 32) ^ xor0; } static inline uint64_t -hash_xor_key32(void *key, __rte_unused uint32_t key_size, uint64_t seed) +hash_xor_key32(void *key, void *mask, __rte_unused uint32_t key_size, + uint64_t seed) { uint64_t *k = key; + uint64_t *m = mask; uint64_t xor0, xor1; - xor0 = (k[0] ^ seed) ^ k[1]; - xor1 = k[2] ^ k[3]; + xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]); + xor1 = (k[2] & m[2]) ^ (k[3] & m[3]); xor0 ^= xor1; @@ -83,30 +91,34 @@ hash_xor_key32(void *key, __rte_unused uint32_t key_size, uint64_t seed) } static inline uint64_t -hash_xor_key40(void *key, __rte_unused uint32_t key_size, uint64_t seed) +hash_xor_key40(void *key, void *mask, __rte_unused uint32_t key_size, + uint64_t seed) { uint64_t *k = key; + uint64_t *m = mask; uint64_t xor0, xor1; - xor0 = (k[0] ^ seed) ^ k[1]; - xor1 = k[2] ^ k[3]; + xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]); + xor1 = (k[2] & m[2]) ^ (k[3] & m[3]); xor0 ^= xor1; - xor0 ^= k[4]; + xor0 ^= k[4] & m[4]; return (xor0 >> 32) ^ xor0; } static inline uint64_t -hash_xor_key48(void *key, __rte_unused uint32_t key_size, uint64_t seed) +hash_xor_key48(void *key, void *mask, __rte_unused uint32_t key_size, + uint64_t seed) { uint64_t *k = key; + uint64_t *m = mask; uint64_t xor0, xor1, xor2; - xor0 = (k[0] ^ seed) ^ k[1]; - xor1 = k[2] ^ k[3]; - xor2 = k[4] ^ k[5]; + xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]); + xor1 = (k[2] & m[2]) ^ (k[3] & m[3]); + xor2 = (k[4] & m[4]) ^ (k[5] & m[5]); xor0 ^= xor1; @@ -116,17 +128,19 @@ hash_xor_key48(void *key, __rte_unused uint32_t key_size, uint64_t seed) } static inline uint64_t -hash_xor_key56(void *key, __rte_unused uint32_t key_size, uint64_t seed) +hash_xor_key56(void *key, void *mask, __rte_unused uint32_t key_size, + uint64_t seed) { uint64_t *k = key; + uint64_t *m = mask; uint64_t xor0, xor1, xor2; - xor0 = (k[0] ^ seed) ^ k[1]; - xor1 = k[2] ^ k[3]; - xor2 = k[4] ^ k[5]; + xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]); + xor1 = (k[2] & m[2]) ^ (k[3] & m[3]); + xor2 = (k[4] & m[4]) ^ (k[5] & m[5]); xor0 ^= xor1; - xor2 ^= k[6]; + xor2 ^= k[6] & m[6]; xor0 ^= xor2; @@ -134,15 +148,17 @@ hash_xor_key56(void *key, __rte_unused uint32_t key_size, uint64_t seed) } static inline uint64_t -hash_xor_key64(void *key, __rte_unused uint32_t key_size, uint64_t seed) +hash_xor_key64(void *key, void *mask, __rte_unused uint32_t key_size, + uint64_t seed) { uint64_t *k = key; + uint64_t *m = mask; uint64_t xor0, xor1, xor2, xor3; - xor0 = (k[0] ^ seed) ^ k[1]; - xor1 = k[2] ^ k[3]; - xor2 = k[4] ^ k[5]; - xor3 = k[6] ^ k[7]; + xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]); + xor1 = (k[2] & m[2]) ^ (k[3] & m[3]); + xor2 = (k[4] & m[4]) ^ (k[5] & m[5]); + xor3 = (k[6] & m[6]) ^ (k[7] & m[7]); xor0 ^= xor1; xor2 ^= xor3; @@ -157,26 +173,30 @@ hash_xor_key64(void *key, __rte_unused uint32_t key_size, uint64_t seed) #include <x86intrin.h> static inline uint64_t -hash_crc_key8(void *key, __rte_unused uint32_t key_size, uint64_t seed) +hash_crc_key8(void *key, void *mask, __rte_unused uint32_t key_size, + uint64_t seed) { uint64_t *k = key; + uint64_t *m = mask; uint64_t crc0; - crc0 = _mm_crc32_u64(seed, k[0]); + crc0 = _mm_crc32_u64(seed, k[0] & m[0]); return crc0; } static inline uint64_t -hash_crc_key16(void *key, __rte_unused uint32_t key_size, uint64_t seed) +hash_crc_key16(void *key, void *mask, __rte_unused uint32_t key_size, + uint64_t seed) { uint64_t *k = key; + uint64_t *m = mask; uint64_t k0, crc0, crc1; - k0 = k[0]; + k0 = k[0] & m[0]; crc0 = _mm_crc32_u64(k0, seed); - crc1 = _mm_crc32_u64(k0 >> 32, k[1]); + crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]); crc0 ^= crc1; @@ -184,16 +204,18 @@ hash_crc_key16(void *key, __rte_unused uint32_t key_size, uint64_t seed) } static inline uint64_t -hash_crc_key24(void *key, __rte_unused uint32_t key_size, uint64_t seed) +hash_crc_key24(void *key, void *mask, __rte_unused uint32_t key_size, + uint64_t seed) { uint64_t *k = key; + uint64_t *m = mask; uint64_t k0, k2, crc0, crc1; - k0 = k[0]; - k2 = k[2]; + k0 = k[0] & m[0]; + k2 = k[2] & m[2]; crc0 = _mm_crc32_u64(k0, seed); - crc1 = _mm_crc32_u64(k0 >> 32, k[1]); + crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]); crc0 = _mm_crc32_u64(crc0, k2); @@ -203,18 +225,20 @@ hash_crc_key24(void *key, __rte_unused uint32_t key_size, uint64_t seed) } static inline uint64_t -hash_crc_key32(void *key, __rte_unused uint32_t key_size, uint64_t seed) +hash_crc_key32(void *key, void *mask, __rte_unused uint32_t key_size, + uint64_t seed) { uint64_t *k = key; + uint64_t *m = mask; uint64_t k0, k2, crc0, crc1, crc2, crc3; - k0 = k[0]; - k2 = k[2]; + k0 = k[0] & m[0]; + k2 = k[2] & m[2]; crc0 = _mm_crc32_u64(k0, seed); - crc1 = _mm_crc32_u64(k0 >> 32, k[1]); + crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]); - crc2 = _mm_crc32_u64(k2, k[3]); + crc2 = _mm_crc32_u64(k2, k[3] & m[3]); crc3 = k2 >> 32; crc0 = _mm_crc32_u64(crc0, crc1); @@ -226,19 +250,21 @@ hash_crc_key32(void *key, __rte_unused uint32_t key_size, uint64_t seed) } static inline uint64_t -hash_crc_key40(void *key, __rte_unused uint32_t key_size, uint64_t seed) +hash_crc_key40(void *key, void *mask, __rte_unused uint32_t key_size, + uint64_t seed) { uint64_t *k = key; + uint64_t *m = mask; uint64_t k0, k2, crc0, crc1, crc2, crc3; - k0 = k[0]; - k2 = k[2]; + k0 = k[0] & m[0]; + k2 = k[2] & m[2]; crc0 = _mm_crc32_u64(k0, seed); - crc1 = _mm_crc32_u64(k0 >> 32, k[1]); + crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]); - crc2 = _mm_crc32_u64(k2, k[3]); - crc3 = _mm_crc32_u64(k2 >> 32, k[4]); + crc2 = _mm_crc32_u64(k2, k[3] & m[3]); + crc3 = _mm_crc32_u64(k2 >> 32, k[4] & m[4]); crc0 = _mm_crc32_u64(crc0, crc1); crc1 = _mm_crc32_u64(crc2, crc3); @@ -249,20 +275,22 @@ hash_crc_key40(void *key, __rte_unused uint32_t key_size, uint64_t seed) } static inline uint64_t -hash_crc_key48(void *key, __rte_unused uint32_t key_size, uint64_t seed) +hash_crc_key48(void *key, void *mask, __rte_unused uint32_t key_size, + uint64_t seed) { uint64_t *k = key; + uint64_t *m = mask; uint64_t k0, k2, k5, crc0, crc1, crc2, crc3; - k0 = k[0]; - k2 = k[2]; - k5 = k[5]; + k0 = k[0] & m[0]; + k2 = k[2] & m[2]; + k5 = k[5] & m[5]; crc0 = _mm_crc32_u64(k0, seed); - crc1 = _mm_crc32_u64(k0 >> 32, k[1]); + crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]); - crc2 = _mm_crc32_u64(k2, k[3]); - crc3 = _mm_crc32_u64(k2 >> 32, k[4]); + crc2 = _mm_crc32_u64(k2, k[3] & m[3]); + crc3 = _mm_crc32_u64(k2 >> 32, k[4] & m[4]); crc0 = _mm_crc32_u64(crc0, (crc1 << 32) ^ crc2); crc1 = _mm_crc32_u64(crc3, k5); @@ -273,22 +301,24 @@ hash_crc_key48(void *key, __rte_unused uint32_t key_size, uint64_t seed) } static inline uint64_t -hash_crc_key56(void *key, __rte_unused uint32_t key_size, uint64_t seed) +hash_crc_key56(void *key, void *mask, __rte_unused uint32_t key_size, + uint64_t seed) { uint64_t *k = key; + uint64_t *m = mask; uint64_t k0, k2, k5, crc0, crc1, crc2, crc3, crc4, crc5; - k0 = k[0]; - k2 = k[2]; - k5 = k[5]; + k0 = k[0] & m[0]; + k2 = k[2] & m[2]; + k5 = k[5] & m[5]; crc0 = _mm_crc32_u64(k0, seed); - crc1 = _mm_crc32_u64(k0 >> 32, k[1]); + crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]); - crc2 = _mm_crc32_u64(k2, k[3]); - crc3 = _mm_crc32_u64(k2 >> 32, k[4]); + crc2 = _mm_crc32_u64(k2, k[3] & m[3]); + crc3 = _mm_crc32_u64(k2 >> 32, k[4] & m[4]); - crc4 = _mm_crc32_u64(k5, k[6]); + crc4 = _mm_crc32_u64(k5, k[6] & m[6]); crc5 = k5 >> 32; crc0 = _mm_crc32_u64(crc0, (crc1 << 32) ^ crc2); @@ -300,23 +330,25 @@ hash_crc_key56(void *key, __rte_unused uint32_t key_size, uint64_t seed) } static inline uint64_t -hash_crc_key64(void *key, __rte_unused uint32_t key_size, uint64_t seed) +hash_crc_key64(void *key, void *mask, __rte_unused uint32_t key_size, + uint64_t seed) { uint64_t *k = key; + uint64_t *m = mask; uint64_t k0, k2, k5, crc0, crc1, crc2, crc3, crc4, crc5; - k0 = k[0]; - k2 = k[2]; - k5 = k[5]; + k0 = k[0] & m[0]; + k2 = k[2] & m[2]; + k5 = k[5] & m[5]; crc0 = _mm_crc32_u64(k0, seed); - crc1 = _mm_crc32_u64(k0 >> 32, k[1]); + crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]); - crc2 = _mm_crc32_u64(k2, k[3]); - crc3 = _mm_crc32_u64(k2 >> 32, k[4]); + crc2 = _mm_crc32_u64(k2, k[3] & m[3]); + crc3 = _mm_crc32_u64(k2 >> 32, k[4] & m[4]); - crc4 = _mm_crc32_u64(k5, k[6]); - crc5 = _mm_crc32_u64(k5 >> 32, k[7]); + crc4 = _mm_crc32_u64(k5, k[6] & m[6]); + crc5 = _mm_crc32_u64(k5 >> 32, k[7] & m[7]); crc0 = _mm_crc32_u64(crc0, (crc1 << 32) ^ crc2); crc1 = _mm_crc32_u64(crc3, (crc4 << 32) ^ crc5); @@ -335,6 +367,8 @@ hash_crc_key64(void *key, __rte_unused uint32_t key_size, uint64_t seed) #define hash_default_key56 hash_crc_key56 #define hash_default_key64 hash_crc_key64 +#elif defined(RTE_ARCH_ARM64) +#include "hash_func_arm64.h" #else #define hash_default_key8 hash_xor_key8 diff --git a/examples/ip_pipeline/pipeline/hash_func_arm64.h b/examples/ip_pipeline/pipeline/hash_func_arm64.h new file mode 100644 index 00000000..ae6c0f41 --- /dev/null +++ b/examples/ip_pipeline/pipeline/hash_func_arm64.h @@ -0,0 +1,261 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2017 Linaro Limited. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef __HASH_FUNC_ARM64_H__ +#define __HASH_FUNC_ARM64_H__ + +#define _CRC32CX(crc, val) \ + __asm__("crc32cx %w[c], %w[c], %x[v]":[c] "+r" (crc):[v] "r" (val)) + +static inline uint64_t +hash_crc_key8(void *key, void *mask, __rte_unused uint32_t key_size, + uint64_t seed) +{ + uint64_t *k = key; + uint64_t *m = mask; + uint32_t crc0; + + crc0 = seed; + _CRC32CX(crc0, k[0] & m[0]); + + return crc0; +} + +static inline uint64_t +hash_crc_key16(void *key, void *mask, __rte_unused uint32_t key_size, + uint64_t seed) +{ + uint64_t *k = key, k0; + uint64_t *m = mask; + uint32_t crc0, crc1; + + k0 = k[0] & m[0]; + + crc0 = k0; + _CRC32CX(crc0, seed); + crc1 = k0 >> 32; + _CRC32CX(crc1, k[1] & m[1]); + + crc0 ^= crc1; + + return crc0; +} + +static inline uint64_t +hash_crc_key24(void *key, void *mask, __rte_unused uint32_t key_size, + uint64_t seed) +{ + uint64_t *k = key, k0, k2; + uint64_t *m = mask; + uint32_t crc0, crc1; + + k0 = k[0] & m[0]; + k2 = k[2] & m[2]; + + crc0 = k0; + _CRC32CX(crc0, seed); + crc1 = k0 >> 32; + _CRC32CX(crc1, k[1] & m[1]); + + _CRC32CX(crc0, k2); + + crc0 ^= crc1; + + return crc0; +} + +static inline uint64_t +hash_crc_key32(void *key, void *mask, __rte_unused uint32_t key_size, + uint64_t seed) +{ + uint64_t *k = key, k0, k2; + uint64_t *m = mask; + uint32_t crc0, crc1, crc2, crc3; + + k0 = k[0] & m[0]; + k2 = k[2] & m[2]; + + crc0 = k0; + _CRC32CX(crc0, seed); + crc1 = k0 >> 32; + _CRC32CX(crc1, k[1] & m[1]); + + crc2 = k2; + _CRC32CX(crc2, k[3] & m[3]); + crc3 = k2 >> 32; + + _CRC32CX(crc0, crc1); + _CRC32CX(crc2, crc3); + + crc0 ^= crc2; + + return crc0; +} + +static inline uint64_t +hash_crc_key40(void *key, void *mask, __rte_unused uint32_t key_size, + uint64_t seed) +{ + uint64_t *k = key, k0, k2; + uint64_t *m = mask; + uint32_t crc0, crc1, crc2, crc3; + + k0 = k[0] & m[0]; + k2 = k[2] & m[2]; + + crc0 = k0; + _CRC32CX(crc0, seed); + crc1 = k0 >> 32; + _CRC32CX(crc1, k[1] & m[1]); + + crc2 = k2; + _CRC32CX(crc2, k[3] & m[3]); + crc3 = k2 >> 32; + _CRC32CX(crc3, k[4] & m[4]); + + _CRC32CX(crc0, crc1); + _CRC32CX(crc2, crc3); + + crc0 ^= crc2; + + return crc0; +} + +static inline uint64_t +hash_crc_key48(void *key, void *mask, __rte_unused uint32_t key_size, + uint64_t seed) +{ + uint64_t *k = key, k0, k2, k5; + uint64_t *m = mask; + uint32_t crc0, crc1, crc2, crc3; + + k0 = k[0] & m[0]; + k2 = k[2] & m[2]; + k5 = k[5] & m[5]; + + crc0 = k0; + _CRC32CX(crc0, seed); + crc1 = k0 >> 32; + _CRC32CX(crc1, k[1] & m[1]); + + crc2 = k2; + _CRC32CX(crc2, k[3] & m[3]); + crc3 = k2 >> 32; + _CRC32CX(crc3, k[4] & m[4]); + + _CRC32CX(crc0, ((uint64_t)crc1 << 32) ^ crc2); + _CRC32CX(crc3, k5); + + crc0 ^= crc3; + + return crc0; +} + +static inline uint64_t +hash_crc_key56(void *key, void *mask, __rte_unused uint32_t key_size, + uint64_t seed) +{ + uint64_t *k = key, k0, k2, k5; + uint64_t *m = mask; + uint32_t crc0, crc1, crc2, crc3, crc4, crc5; + + k0 = k[0] & m[0]; + k2 = k[2] & m[2]; + k5 = k[5] & m[5]; + + crc0 = k0; + _CRC32CX(crc0, seed); + crc1 = k0 >> 32; + _CRC32CX(crc1, k[1] & m[1]); + + crc2 = k2; + _CRC32CX(crc2, k[3] & m[3]); + crc3 = k2 >> 32; + _CRC32CX(crc3, k[4] & m[4]); + + crc4 = k5; + _CRC32CX(crc4, k[6] & m[6]); + crc5 = k5 >> 32; + + _CRC32CX(crc0, ((uint64_t)crc1 << 32) ^ crc2); + _CRC32CX(crc3, ((uint64_t)crc4 << 32) ^ crc5); + + crc0 ^= crc3; + + return crc0; +} + +static inline uint64_t +hash_crc_key64(void *key, void *mask, __rte_unused uint32_t key_size, + uint64_t seed) +{ + uint64_t *k = key, k0, k2, k5; + uint64_t *m = mask; + uint32_t crc0, crc1, crc2, crc3, crc4, crc5; + + k0 = k[0] & m[0]; + k2 = k[2] & m[2]; + k5 = k[5] & m[5]; + + crc0 = k0; + _CRC32CX(crc0, seed); + crc1 = k0 >> 32; + _CRC32CX(crc1, k[1] & m[1]); + + crc2 = k2; + _CRC32CX(crc2, k[3] & m[3]); + crc3 = k2 >> 32; + _CRC32CX(crc3, k[4] & m[4]); + + crc4 = k5; + _CRC32CX(crc4, k[6] & m[6]); + crc5 = k5 >> 32; + _CRC32CX(crc5, k[7] & m[7]); + + _CRC32CX(crc0, ((uint64_t)crc1 << 32) ^ crc2); + _CRC32CX(crc3, ((uint64_t)crc4 << 32) ^ crc5); + + crc0 ^= crc3; + + return crc0; +} + +#define hash_default_key8 hash_crc_key8 +#define hash_default_key16 hash_crc_key16 +#define hash_default_key24 hash_crc_key24 +#define hash_default_key32 hash_crc_key32 +#define hash_default_key40 hash_crc_key40 +#define hash_default_key48 hash_crc_key48 +#define hash_default_key56 hash_crc_key56 +#define hash_default_key64 hash_crc_key64 + +#endif diff --git a/examples/ip_pipeline/pipeline/pipeline_flow_classification.c b/examples/ip_pipeline/pipeline/pipeline_flow_classification.c index 9ef50cc9..70b19381 100644 --- a/examples/ip_pipeline/pipeline/pipeline_flow_classification.c +++ b/examples/ip_pipeline/pipeline/pipeline_flow_classification.c @@ -88,8 +88,10 @@ app_pipeline_fc_key_convert(struct pipeline_fc_key *key_in, uint32_t *signature) { uint8_t buffer[PIPELINE_FC_FLOW_KEY_MAX_SIZE]; + uint8_t m[PIPELINE_FC_FLOW_KEY_MAX_SIZE]; /* key mask */ void *key_buffer = (key_out) ? key_out : buffer; + memset(m, 0xFF, sizeof(m)); switch (key_in->type) { case FLOW_KEY_QINQ: { @@ -101,7 +103,7 @@ app_pipeline_fc_key_convert(struct pipeline_fc_key *key_in, qinq->cvlan = rte_cpu_to_be_16(key_in->key.qinq.cvlan); if (signature) - *signature = (uint32_t) hash_default_key8(qinq, 8, 0); + *signature = (uint32_t) hash_default_key8(qinq, m, 8, 0); return 0; } @@ -118,7 +120,7 @@ app_pipeline_fc_key_convert(struct pipeline_fc_key *key_in, ipv4->port_dst = rte_cpu_to_be_16(key_in->key.ipv4_5tuple.port_dst); if (signature) - *signature = (uint32_t) hash_default_key16(ipv4, 16, 0); + *signature = (uint32_t) hash_default_key16(ipv4, m, 16, 0); return 0; } @@ -136,7 +138,7 @@ app_pipeline_fc_key_convert(struct pipeline_fc_key *key_in, ipv6->port_dst = rte_cpu_to_be_16(key_in->key.ipv6_5tuple.port_dst); if (signature) - *signature = (uint32_t) hash_default_key64(ipv6, 64, 0); + *signature = (uint32_t) hash_default_key64(ipv6, m, 64, 0); return 0; } @@ -832,12 +834,12 @@ app_pipeline_fc_add_bulk(struct app_params *app, } /* Free resources */ - app_msg_free(app, rsp); for (i = rsp->n_keys; i < n_keys; i++) if (new_flow[i]) rte_free(flow[i]); + app_msg_free(app, rsp); rte_free(flow_rsp); rte_free(flow_req); rte_free(new_flow); diff --git a/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c b/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c index 026f00cd..929d81cb 100644 --- a/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c +++ b/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c @@ -492,40 +492,16 @@ static void *pipeline_fc_init(struct pipeline_params *params, /* Tables */ p->n_tables = 1; { - struct rte_table_hash_key8_ext_params - table_hash_key8_params = { - .n_entries = p_fc->n_flows, - .n_entries_ext = p_fc->n_flows, - .signature_offset = p_fc->hash_offset, + struct rte_table_hash_params table_hash_params = { + .name = p->name, + .key_size = p_fc->key_size, .key_offset = p_fc->key_offset, - .f_hash = hash_func[(p_fc->key_size / 8) - 1], .key_mask = (p_fc->key_mask_present) ? p_fc->key_mask : NULL, - .seed = 0, - }; - - struct rte_table_hash_key16_ext_params - table_hash_key16_params = { - .n_entries = p_fc->n_flows, - .n_entries_ext = p_fc->n_flows, - .signature_offset = p_fc->hash_offset, - .key_offset = p_fc->key_offset, - .f_hash = hash_func[(p_fc->key_size / 8) - 1], - .key_mask = (p_fc->key_mask_present) ? - p_fc->key_mask : NULL, - .seed = 0, - }; - - struct rte_table_hash_ext_params - table_hash_params = { - .key_size = p_fc->key_size, .n_keys = p_fc->n_flows, - .n_buckets = p_fc->n_flows / 4, - .n_buckets_ext = p_fc->n_flows / 4, + .n_buckets = rte_align32pow2(p_fc->n_flows / 4), .f_hash = hash_func[(p_fc->key_size / 8) - 1], .seed = 0, - .signature_offset = p_fc->hash_offset, - .key_offset = p_fc->key_offset, }; struct rte_pipeline_table_params table_params = { @@ -542,32 +518,19 @@ static void *pipeline_fc_init(struct pipeline_params *params, switch (p_fc->key_size) { case 8: - if (p_fc->hash_offset != 0) { - table_params.ops = - &rte_table_hash_key8_ext_ops; - } else { - table_params.ops = - &rte_table_hash_key8_ext_dosig_ops; - } - table_params.arg_create = &table_hash_key8_params; + table_params.ops = &rte_table_hash_key8_ext_ops; break; case 16: - if (p_fc->hash_offset != 0) { - table_params.ops = - &rte_table_hash_key16_ext_ops; - } else { - table_params.ops = - &rte_table_hash_key16_ext_dosig_ops; - } - table_params.arg_create = &table_hash_key16_params; + table_params.ops = &rte_table_hash_key16_ext_ops; break; default: table_params.ops = &rte_table_hash_ext_ops; - table_params.arg_create = &table_hash_params; } + table_params.arg_create = &table_hash_params; + status = rte_pipeline_table_create(p->p, &table_params, &p->table_id[0]); diff --git a/examples/ip_pipeline/pipeline/pipeline_passthrough_be.c b/examples/ip_pipeline/pipeline/pipeline_passthrough_be.c index 8cb2f0c7..93eedbe8 100644 --- a/examples/ip_pipeline/pipeline/pipeline_passthrough_be.c +++ b/examples/ip_pipeline/pipeline/pipeline_passthrough_be.c @@ -102,7 +102,7 @@ pkt_work_dma( /* Read (dma_dst), compute (hash), write (hash) */ if (hash_enabled) { - uint32_t hash = p->f_hash(dma_dst, dma_size, 0); + uint32_t hash = p->f_hash(dma_src, dma_mask, dma_size, 0); *dma_hash = hash; if (lb_hash) { @@ -173,10 +173,10 @@ pkt4_work_dma( /* Read (dma_dst), compute (hash), write (hash) */ if (hash_enabled) { - uint32_t hash0 = p->f_hash(dma_dst0, dma_size, 0); - uint32_t hash1 = p->f_hash(dma_dst1, dma_size, 0); - uint32_t hash2 = p->f_hash(dma_dst2, dma_size, 0); - uint32_t hash3 = p->f_hash(dma_dst3, dma_size, 0); + uint32_t hash0 = p->f_hash(dma_src0, dma_mask, dma_size, 0); + uint32_t hash1 = p->f_hash(dma_src1, dma_mask, dma_size, 0); + uint32_t hash2 = p->f_hash(dma_src2, dma_mask, dma_size, 0); + uint32_t hash3 = p->f_hash(dma_src3, dma_mask, dma_size, 0); *dma_hash0 = hash0; *dma_hash1 = hash1; diff --git a/examples/ip_pipeline/pipeline/pipeline_routing_be.c b/examples/ip_pipeline/pipeline/pipeline_routing_be.c index 78317165..0414f248 100644 --- a/examples/ip_pipeline/pipeline/pipeline_routing_be.c +++ b/examples/ip_pipeline/pipeline/pipeline_routing_be.c @@ -1349,17 +1349,20 @@ pipeline_routing_init(struct pipeline_params *params, /* ARP table configuration */ if (p_rt->params.n_arp_entries) { - struct rte_table_hash_key8_ext_params table_arp_params = { - .n_entries = p_rt->params.n_arp_entries, - .n_entries_ext = p_rt->params.n_arp_entries, + struct rte_table_hash_params table_arp_params = { + .name = p->name, + .key_size = 8, + .key_offset = p_rt->params.arp_key_offset, + .key_mask = NULL, + .n_keys = p_rt->params.n_arp_entries, + .n_buckets = + rte_align32pow2(p_rt->params.n_arp_entries / 4), .f_hash = hash_default_key8, .seed = 0, - .signature_offset = 0, /* Unused */ - .key_offset = p_rt->params.arp_key_offset, }; struct rte_pipeline_table_params table_params = { - .ops = &rte_table_hash_key8_ext_dosig_ops, + .ops = &rte_table_hash_key8_ext_ops, .arg_create = &table_arp_params, .f_action_hit = get_arp_table_ah_hit(p_rt), .f_action_miss = NULL, |