From: Jasvinder Singh Date: Thu, 29 Mar 2018 18:31:37 +0000 (+0100) Subject: examples/ip_pipeline: remove master pipeline X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=b5e408acd1e3bf7437273ab3a4ec2927b165809c;p=dpdk.git examples/ip_pipeline: remove master pipeline remove master pipeline. Signed-off-by: Cristian Dumitrescu Signed-off-by: Jasvinder Singh --- diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index ae76edc853..8ba7887216 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -12,14 +12,8 @@ SRCS-y += config_parse_tm.c SRCS-y += config_check.c SRCS-y += init.c SRCS-y += thread.c -SRCS-y += thread_fe.c SRCS-y += cpu_core_map.c -SRCS-y += pipeline_common_be.c -SRCS-y += pipeline_common_fe.c -SRCS-y += pipeline_master_be.c -SRCS-y += pipeline_master.c - # Build using pkg-config variables if possible $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) diff --git a/examples/ip_pipeline/app.h b/examples/ip_pipeline/app.h index 907d4e7c5c..dadaf2b6f8 100644 --- a/examples/ip_pipeline/app.h +++ b/examples/ip_pipeline/app.h @@ -1359,10 +1359,6 @@ app_core_build_core_mask_string(struct app_params *app, char *mask_buffer) } } -void app_pipeline_params_get(struct app_params *app, - struct app_pipeline_params *p_in, - struct pipeline_params *p_out); - int app_config_init(struct app_params *app); int app_config_args(struct app_params *app, @@ -1382,16 +1378,8 @@ int app_config_check(struct app_params *app); int app_init(struct app_params *app); -int app_post_init(struct app_params *app); - int app_thread(void *arg); -int app_pipeline_type_register(struct app_params *app, - struct pipeline_type *ptype); - -struct pipeline_type *app_pipeline_type_find(struct app_params *app, - char *name); - void app_link_up_internal(struct app_params *app, struct app_link_params *cp); diff --git a/examples/ip_pipeline/hash_func.h b/examples/ip_pipeline/hash_func.h new file mode 100644 index 0000000000..f1b9d944c9 --- /dev/null +++ b/examples/ip_pipeline/hash_func.h @@ -0,0 +1,357 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2018 Intel Corporation + */ + +#ifndef __INCLUDE_HASH_FUNC_H__ +#define __INCLUDE_HASH_FUNC_H__ + +static inline uint64_t +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] & m[0]); + + return (xor0 >> 32) ^ xor0; +} + +static inline uint64_t +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] & m[0]) ^ seed) ^ (k[1] & m[1]); + + return (xor0 >> 32) ^ xor0; +} + +static inline uint64_t +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] & m[0]) ^ seed) ^ (k[1] & m[1]); + + xor0 ^= k[2] & m[2]; + + return (xor0 >> 32) ^ xor0; +} + +static inline uint64_t +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] & m[0]) ^ seed) ^ (k[1] & m[1]); + xor1 = (k[2] & m[2]) ^ (k[3] & m[3]); + + xor0 ^= xor1; + + return (xor0 >> 32) ^ xor0; +} + +static inline uint64_t +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] & m[0]) ^ seed) ^ (k[1] & m[1]); + xor1 = (k[2] & m[2]) ^ (k[3] & m[3]); + + xor0 ^= xor1; + + xor0 ^= k[4] & m[4]; + + return (xor0 >> 32) ^ xor0; +} + +static inline uint64_t +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] & 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; + + xor0 ^= xor2; + + return (xor0 >> 32) ^ xor0; +} + +static inline uint64_t +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] & 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] & m[6]; + + xor0 ^= xor2; + + return (xor0 >> 32) ^ xor0; +} + +static inline uint64_t +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] & 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; + + xor0 ^= xor2; + + return (xor0 >> 32) ^ xor0; +} + +#if defined(RTE_ARCH_X86_64) + +#include + +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; + uint64_t crc0; + + crc0 = _mm_crc32_u64(seed, 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; + uint64_t *m = mask; + uint64_t k0, crc0, crc1; + + k0 = k[0] & m[0]; + + crc0 = _mm_crc32_u64(k0, seed); + crc1 = _mm_crc32_u64(k0 >> 32, 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; + uint64_t *m = mask; + uint64_t k0, k2, crc0, crc1; + + k0 = k[0] & m[0]; + k2 = k[2] & m[2]; + + crc0 = _mm_crc32_u64(k0, seed); + crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]); + + crc0 = _mm_crc32_u64(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; + uint64_t *m = mask; + uint64_t k0, k2, crc0, crc1, crc2, crc3; + + k0 = k[0] & m[0]; + k2 = k[2] & m[2]; + + crc0 = _mm_crc32_u64(k0, seed); + crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]); + + crc2 = _mm_crc32_u64(k2, k[3] & m[3]); + crc3 = k2 >> 32; + + crc0 = _mm_crc32_u64(crc0, crc1); + crc1 = _mm_crc32_u64(crc2, crc3); + + crc0 ^= crc1; + + 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; + uint64_t *m = mask; + uint64_t k0, k2, crc0, crc1, crc2, crc3; + + k0 = k[0] & m[0]; + k2 = k[2] & m[2]; + + crc0 = _mm_crc32_u64(k0, seed); + crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]); + + 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); + + crc0 ^= crc1; + + 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; + uint64_t *m = mask; + uint64_t k0, k2, k5, crc0, crc1, crc2, crc3; + + 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] & m[1]); + + 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); + + crc0 ^= crc1; + + 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; + uint64_t *m = mask; + uint64_t k0, k2, k5, crc0, crc1, crc2, crc3, crc4, crc5; + + 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] & m[1]); + + 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] & m[6]); + crc5 = k5 >> 32; + + crc0 = _mm_crc32_u64(crc0, (crc1 << 32) ^ crc2); + crc1 = _mm_crc32_u64(crc3, (crc4 << 32) ^ crc5); + + crc0 ^= crc1; + + 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; + uint64_t *m = mask; + uint64_t k0, k2, k5, crc0, crc1, crc2, crc3, crc4, crc5; + + 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] & m[1]); + + 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] & 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); + + crc0 ^= crc1; + + 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 + +#elif defined(RTE_ARCH_ARM64) +#include "hash_func_arm64.h" +#else + +#define hash_default_key8 hash_xor_key8 +#define hash_default_key16 hash_xor_key16 +#define hash_default_key24 hash_xor_key24 +#define hash_default_key32 hash_xor_key32 +#define hash_default_key40 hash_xor_key40 +#define hash_default_key48 hash_xor_key48 +#define hash_default_key56 hash_xor_key56 +#define hash_default_key64 hash_xor_key64 + +#endif + +#endif diff --git a/examples/ip_pipeline/hash_func_arm64.h b/examples/ip_pipeline/hash_func_arm64.h new file mode 100644 index 0000000000..ae6c0f41d3 --- /dev/null +++ b/examples/ip_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/init.c b/examples/ip_pipeline/init.c index f848310e8a..9430809b22 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -24,9 +24,6 @@ #include "app.h" #include "pipeline.h" -#include "pipeline_common_fe.h" -#include "pipeline_master.h" -#include "thread_fe.h" #define APP_NAME_SIZE 32 @@ -1328,478 +1325,6 @@ app_init_msgq(struct app_params *app) } } -void app_pipeline_params_get(struct app_params *app, - struct app_pipeline_params *p_in, - struct pipeline_params *p_out) -{ - uint32_t i; - - snprintf(p_out->name, PIPELINE_NAME_SIZE, "%s", p_in->name); - - snprintf(p_out->type, PIPELINE_TYPE_SIZE, "%s", p_in->type); - - p_out->socket_id = (int) p_in->socket_id; - - p_out->log_level = app->log_level; - - /* pktq_in */ - p_out->n_ports_in = p_in->n_pktq_in; - for (i = 0; i < p_in->n_pktq_in; i++) { - struct app_pktq_in_params *in = &p_in->pktq_in[i]; - struct pipeline_port_in_params *out = &p_out->port_in[i]; - - switch (in->type) { - case APP_PKTQ_IN_HWQ: - { - struct app_pktq_hwq_in_params *p_hwq_in = - &app->hwq_in_params[in->id]; - struct app_link_params *p_link = - app_get_link_for_rxq(app, p_hwq_in); - uint32_t rxq_link_id, rxq_queue_id; - - sscanf(p_hwq_in->name, "RXQ%" SCNu32 ".%" SCNu32, - &rxq_link_id, - &rxq_queue_id); - - out->type = PIPELINE_PORT_IN_ETHDEV_READER; - out->params.ethdev.port_id = p_link->pmd_id; - out->params.ethdev.queue_id = rxq_queue_id; - out->burst_size = p_hwq_in->burst; - break; - } - case APP_PKTQ_IN_SWQ: - { - struct app_pktq_swq_params *swq_params = &app->swq_params[in->id]; - - if ((swq_params->ipv4_frag == 0) && (swq_params->ipv6_frag == 0)) { - if (app_swq_get_readers(app, swq_params) == 1) { - out->type = PIPELINE_PORT_IN_RING_READER; - out->params.ring.ring = app->swq[in->id]; - out->burst_size = app->swq_params[in->id].burst_read; - } else { - out->type = PIPELINE_PORT_IN_RING_MULTI_READER; - out->params.ring_multi.ring = app->swq[in->id]; - out->burst_size = swq_params->burst_read; - } - } else { - if (swq_params->ipv4_frag == 1) { - struct rte_port_ring_reader_ipv4_frag_params *params = - &out->params.ring_ipv4_frag; - - out->type = PIPELINE_PORT_IN_RING_READER_IPV4_FRAG; - params->ring = app->swq[in->id]; - params->mtu = swq_params->mtu; - params->metadata_size = swq_params->metadata_size; - params->pool_direct = - app->mempool[swq_params->mempool_direct_id]; - params->pool_indirect = - app->mempool[swq_params->mempool_indirect_id]; - out->burst_size = swq_params->burst_read; - } else { - struct rte_port_ring_reader_ipv6_frag_params *params = - &out->params.ring_ipv6_frag; - - out->type = PIPELINE_PORT_IN_RING_READER_IPV6_FRAG; - params->ring = app->swq[in->id]; - params->mtu = swq_params->mtu; - params->metadata_size = swq_params->metadata_size; - params->pool_direct = - app->mempool[swq_params->mempool_direct_id]; - params->pool_indirect = - app->mempool[swq_params->mempool_indirect_id]; - out->burst_size = swq_params->burst_read; - } - } - break; - } - case APP_PKTQ_IN_TM: - { - out->type = PIPELINE_PORT_IN_SCHED_READER; - out->params.sched.sched = app->tm[in->id]; - out->burst_size = app->tm_params[in->id].burst_read; - break; - } -#ifdef RTE_EXEC_ENV_LINUXAPP - case APP_PKTQ_IN_TAP: - { - struct app_pktq_tap_params *tap_params = - &app->tap_params[in->id]; - struct app_mempool_params *mempool_params = - &app->mempool_params[tap_params->mempool_id]; - struct rte_mempool *mempool = - app->mempool[tap_params->mempool_id]; - - out->type = PIPELINE_PORT_IN_FD_READER; - out->params.fd.fd = app->tap[in->id]; - out->params.fd.mtu = mempool_params->buffer_size; - out->params.fd.mempool = mempool; - out->burst_size = app->tap_params[in->id].burst_read; - break; - } -#endif -#ifdef RTE_LIBRTE_KNI - case APP_PKTQ_IN_KNI: - { - out->type = PIPELINE_PORT_IN_KNI_READER; - out->params.kni.kni = app->kni[in->id]; - out->burst_size = app->kni_params[in->id].burst_read; - break; - } -#endif /* RTE_LIBRTE_KNI */ - case APP_PKTQ_IN_SOURCE: - { - uint32_t mempool_id = - app->source_params[in->id].mempool_id; - - out->type = PIPELINE_PORT_IN_SOURCE; - out->params.source.mempool = app->mempool[mempool_id]; - out->burst_size = app->source_params[in->id].burst; - out->params.source.file_name = - app->source_params[in->id].file_name; - out->params.source.n_bytes_per_pkt = - app->source_params[in->id].n_bytes_per_pkt; - break; - } - default: - break; - } - } - - /* pktq_out */ - p_out->n_ports_out = p_in->n_pktq_out; - for (i = 0; i < p_in->n_pktq_out; i++) { - struct app_pktq_out_params *in = &p_in->pktq_out[i]; - struct pipeline_port_out_params *out = &p_out->port_out[i]; - - switch (in->type) { - case APP_PKTQ_OUT_HWQ: - { - struct app_pktq_hwq_out_params *p_hwq_out = - &app->hwq_out_params[in->id]; - struct app_link_params *p_link = - app_get_link_for_txq(app, p_hwq_out); - uint32_t txq_link_id, txq_queue_id; - - sscanf(p_hwq_out->name, - "TXQ%" SCNu32 ".%" SCNu32, - &txq_link_id, - &txq_queue_id); - - if (p_hwq_out->dropless == 0) { - struct rte_port_ethdev_writer_params *params = - &out->params.ethdev; - - out->type = PIPELINE_PORT_OUT_ETHDEV_WRITER; - params->port_id = p_link->pmd_id; - params->queue_id = txq_queue_id; - params->tx_burst_sz = - app->hwq_out_params[in->id].burst; - } else { - struct rte_port_ethdev_writer_nodrop_params - *params = &out->params.ethdev_nodrop; - - out->type = - PIPELINE_PORT_OUT_ETHDEV_WRITER_NODROP; - params->port_id = p_link->pmd_id; - params->queue_id = txq_queue_id; - params->tx_burst_sz = p_hwq_out->burst; - params->n_retries = p_hwq_out->n_retries; - } - break; - } - case APP_PKTQ_OUT_SWQ: - { - struct app_pktq_swq_params *swq_params = &app->swq_params[in->id]; - - if ((swq_params->ipv4_ras == 0) && (swq_params->ipv6_ras == 0)) { - if (app_swq_get_writers(app, swq_params) == 1) { - if (app->swq_params[in->id].dropless == 0) { - struct rte_port_ring_writer_params *params = - &out->params.ring; - - out->type = PIPELINE_PORT_OUT_RING_WRITER; - params->ring = app->swq[in->id]; - params->tx_burst_sz = - app->swq_params[in->id].burst_write; - } else { - struct rte_port_ring_writer_nodrop_params - *params = &out->params.ring_nodrop; - - out->type = - PIPELINE_PORT_OUT_RING_WRITER_NODROP; - params->ring = app->swq[in->id]; - params->tx_burst_sz = - app->swq_params[in->id].burst_write; - params->n_retries = - app->swq_params[in->id].n_retries; - } - } else { - if (swq_params->dropless == 0) { - struct rte_port_ring_multi_writer_params *params = - &out->params.ring_multi; - - out->type = PIPELINE_PORT_OUT_RING_MULTI_WRITER; - params->ring = app->swq[in->id]; - params->tx_burst_sz = swq_params->burst_write; - } else { - struct rte_port_ring_multi_writer_nodrop_params - *params = &out->params.ring_multi_nodrop; - - out->type = PIPELINE_PORT_OUT_RING_MULTI_WRITER_NODROP; - params->ring = app->swq[in->id]; - params->tx_burst_sz = swq_params->burst_write; - params->n_retries = swq_params->n_retries; - } - } - } else { - if (swq_params->ipv4_ras == 1) { - struct rte_port_ring_writer_ipv4_ras_params *params = - &out->params.ring_ipv4_ras; - - out->type = PIPELINE_PORT_OUT_RING_WRITER_IPV4_RAS; - params->ring = app->swq[in->id]; - params->tx_burst_sz = swq_params->burst_write; - } else { - struct rte_port_ring_writer_ipv6_ras_params *params = - &out->params.ring_ipv6_ras; - - out->type = PIPELINE_PORT_OUT_RING_WRITER_IPV6_RAS; - params->ring = app->swq[in->id]; - params->tx_burst_sz = swq_params->burst_write; - } - } - break; - } - case APP_PKTQ_OUT_TM: - { - struct rte_port_sched_writer_params *params = - &out->params.sched; - - out->type = PIPELINE_PORT_OUT_SCHED_WRITER; - params->sched = app->tm[in->id]; - params->tx_burst_sz = - app->tm_params[in->id].burst_write; - break; - } -#ifdef RTE_EXEC_ENV_LINUXAPP - case APP_PKTQ_OUT_TAP: - { - struct rte_port_fd_writer_params *params = - &out->params.fd; - - out->type = PIPELINE_PORT_OUT_FD_WRITER; - params->fd = app->tap[in->id]; - params->tx_burst_sz = - app->tap_params[in->id].burst_write; - break; - } -#endif -#ifdef RTE_LIBRTE_KNI - case APP_PKTQ_OUT_KNI: - { - struct app_pktq_kni_params *p_kni = - &app->kni_params[in->id]; - - if (p_kni->dropless == 0) { - struct rte_port_kni_writer_params *params = - &out->params.kni; - - out->type = PIPELINE_PORT_OUT_KNI_WRITER; - params->kni = app->kni[in->id]; - params->tx_burst_sz = - app->kni_params[in->id].burst_write; - } else { - struct rte_port_kni_writer_nodrop_params - *params = &out->params.kni_nodrop; - - out->type = PIPELINE_PORT_OUT_KNI_WRITER_NODROP; - params->kni = app->kni[in->id]; - params->tx_burst_sz = - app->kni_params[in->id].burst_write; - params->n_retries = - app->kni_params[in->id].n_retries; - } - break; - } -#endif /* RTE_LIBRTE_KNI */ - case APP_PKTQ_OUT_SINK: - { - out->type = PIPELINE_PORT_OUT_SINK; - out->params.sink.file_name = - app->sink_params[in->id].file_name; - out->params.sink.max_n_pkts = - app->sink_params[in->id]. - n_pkts_to_dump; - - break; - } - default: - break; - } - } - - /* msgq */ - p_out->n_msgq = p_in->n_msgq_in; - - for (i = 0; i < p_in->n_msgq_in; i++) - p_out->msgq_in[i] = app->msgq[p_in->msgq_in[i]]; - - for (i = 0; i < p_in->n_msgq_out; i++) - p_out->msgq_out[i] = app->msgq[p_in->msgq_out[i]]; - - /* args */ - p_out->n_args = p_in->n_args; - for (i = 0; i < p_in->n_args; i++) { - p_out->args_name[i] = p_in->args_name[i]; - p_out->args_value[i] = p_in->args_value[i]; - } -} - -static void -app_init_pipelines(struct app_params *app) -{ - uint32_t p_id; - - for (p_id = 0; p_id < app->n_pipelines; p_id++) { - struct app_pipeline_params *params = - &app->pipeline_params[p_id]; - struct app_pipeline_data *data = &app->pipeline_data[p_id]; - struct pipeline_type *ptype; - struct pipeline_params pp; - - APP_LOG(app, HIGH, "Initializing %s ...", params->name); - - ptype = app_pipeline_type_find(app, params->type); - if (ptype == NULL) - rte_panic("Init error: Unknown pipeline type \"%s\"\n", - params->type); - - app_pipeline_params_get(app, params, &pp); - - /* Back-end */ - data->be = NULL; - if (ptype->be_ops->f_init) { - data->be = ptype->be_ops->f_init(&pp, (void *) app); - - if (data->be == NULL) - rte_panic("Pipeline instance \"%s\" back-end " - "init error\n", params->name); - } - - /* Front-end */ - data->fe = NULL; - if (ptype->fe_ops->f_init) { - data->fe = ptype->fe_ops->f_init(&pp, (void *) app); - - if (data->fe == NULL) - rte_panic("Pipeline instance \"%s\" front-end " - "init error\n", params->name); - } - - data->ptype = ptype; - - data->timer_period = (rte_get_tsc_hz() * - params->timer_period) / 1000; - } -} - -static void -app_post_init_pipelines(struct app_params *app) -{ - uint32_t p_id; - - for (p_id = 0; p_id < app->n_pipelines; p_id++) { - struct app_pipeline_params *params = - &app->pipeline_params[p_id]; - struct app_pipeline_data *data = &app->pipeline_data[p_id]; - int status; - - if (data->ptype->fe_ops->f_post_init == NULL) - continue; - - status = data->ptype->fe_ops->f_post_init(data->fe); - if (status) - rte_panic("Pipeline instance \"%s\" front-end " - "post-init error\n", params->name); - } -} - -static void -app_init_threads(struct app_params *app) -{ - uint64_t time = rte_get_tsc_cycles(); - uint32_t p_id; - - for (p_id = 0; p_id < app->n_pipelines; p_id++) { - struct app_pipeline_params *params = - &app->pipeline_params[p_id]; - struct app_pipeline_data *data = &app->pipeline_data[p_id]; - struct pipeline_type *ptype; - struct app_thread_data *t; - struct app_thread_pipeline_data *p; - int lcore_id; - - lcore_id = cpu_core_map_get_lcore_id(app->core_map, - params->socket_id, - params->core_id, - params->hyper_th_id); - - if (lcore_id < 0) - rte_panic("Invalid core s%" PRIu32 "c%" PRIu32 "%s\n", - params->socket_id, - params->core_id, - (params->hyper_th_id) ? "h" : ""); - - t = &app->thread_data[lcore_id]; - - t->timer_period = (rte_get_tsc_hz() * APP_THREAD_TIMER_PERIOD) / 1000; - t->thread_req_deadline = time + t->timer_period; - - t->headroom_cycles = 0; - t->headroom_time = rte_get_tsc_cycles(); - t->headroom_ratio = 0.0; - - t->msgq_in = app_thread_msgq_in_get(app, - params->socket_id, - params->core_id, - params->hyper_th_id); - if (t->msgq_in == NULL) - rte_panic("Init error: Cannot find MSGQ_IN for thread %" PRId32, - lcore_id); - - t->msgq_out = app_thread_msgq_out_get(app, - params->socket_id, - params->core_id, - params->hyper_th_id); - if (t->msgq_out == NULL) - rte_panic("Init error: Cannot find MSGQ_OUT for thread %" PRId32, - lcore_id); - - ptype = app_pipeline_type_find(app, params->type); - if (ptype == NULL) - rte_panic("Init error: Unknown pipeline " - "type \"%s\"\n", params->type); - - p = (ptype->be_ops->f_run == NULL) ? - &t->regular[t->n_regular] : - &t->custom[t->n_custom]; - - p->pipeline_id = p_id; - p->be = data->be; - p->f_run = ptype->be_ops->f_run; - p->f_timer = ptype->be_ops->f_timer; - p->timer_period = data->timer_period; - p->deadline = time + data->timer_period; - - data->enabled = 1; - - if (ptype->be_ops->f_run == NULL) - t->n_regular++; - else - t->n_custom++; - } -} - int app_init(struct app_params *app) { app_init_core_map(app); @@ -1814,104 +1339,5 @@ int app_init(struct app_params *app) app_init_kni(app); app_init_msgq(app); - app_pipeline_common_cmd_push(app); - app_pipeline_thread_cmd_push(app); - app_pipeline_type_register(app, &pipeline_master); - - app_init_pipelines(app); - app_init_threads(app); - return 0; } - -int app_post_init(struct app_params *app) -{ - app_post_init_pipelines(app); - - return 0; -} - -static int -app_pipeline_type_cmd_push(struct app_params *app, - struct pipeline_type *ptype) -{ - cmdline_parse_ctx_t *cmds; - uint32_t n_cmds, i; - - /* Check input arguments */ - if ((app == NULL) || - (ptype == NULL)) - return -EINVAL; - - n_cmds = pipeline_type_cmds_count(ptype); - if (n_cmds == 0) - return 0; - - cmds = ptype->fe_ops->cmds; - - /* Check for available slots in the application commands array */ - if (n_cmds > APP_MAX_CMDS - app->n_cmds) - return -ENOMEM; - - /* Push pipeline commands into the application */ - memcpy(&app->cmds[app->n_cmds], - cmds, - n_cmds * sizeof(cmdline_parse_ctx_t)); - - for (i = 0; i < n_cmds; i++) - app->cmds[app->n_cmds + i]->data = app; - - app->n_cmds += n_cmds; - app->cmds[app->n_cmds] = NULL; - - return 0; -} - -int -app_pipeline_type_register(struct app_params *app, struct pipeline_type *ptype) -{ - uint32_t n_cmds, i; - - /* Check input arguments */ - if ((app == NULL) || - (ptype == NULL) || - (ptype->name == NULL) || - (strlen(ptype->name) == 0) || - (ptype->be_ops->f_init == NULL) || - (ptype->be_ops->f_timer == NULL)) - return -EINVAL; - - /* Check for duplicate entry */ - for (i = 0; i < app->n_pipeline_types; i++) - if (strcmp(app->pipeline_type[i].name, ptype->name) == 0) - return -EEXIST; - - /* Check for resource availability */ - n_cmds = pipeline_type_cmds_count(ptype); - if ((app->n_pipeline_types == APP_MAX_PIPELINE_TYPES) || - (n_cmds > APP_MAX_CMDS - app->n_cmds)) - return -ENOMEM; - - /* Copy pipeline type */ - memcpy(&app->pipeline_type[app->n_pipeline_types++], - ptype, - sizeof(struct pipeline_type)); - - /* Copy CLI commands */ - if (n_cmds) - app_pipeline_type_cmd_push(app, ptype); - - return 0; -} - -struct -pipeline_type *app_pipeline_type_find(struct app_params *app, char *name) -{ - uint32_t i; - - for (i = 0; i < app->n_pipeline_types; i++) - if (strcmp(app->pipeline_type[i].name, name) == 0) - return &app->pipeline_type[i]; - - return NULL; -} diff --git a/examples/ip_pipeline/meson.build b/examples/ip_pipeline/meson.build index 1fdfc48627..be3f3e511b 100644 --- a/examples/ip_pipeline/meson.build +++ b/examples/ip_pipeline/meson.build @@ -6,9 +6,7 @@ # To build this example as a standalone application with an already-installed # DPDK instance, use 'make' -deps += ['cfgfile', 'pipeline', 'bus_pci'] -allow_experimental_apis = true -includes += include_directories('pipeline') +deps += ['cfgfile', 'bus_pci'] sources = files( 'config_check.c', 'config_parse.c', @@ -18,9 +16,4 @@ sources = files( 'main.c', 'parser.c', 'thread.c', - 'thread_fe.c', - 'pipeline/pipeline_common_be.c', - 'pipeline/pipeline_common_fe.c', - 'pipeline/pipeline_master_be.c', - 'pipeline/pipeline_master.c', ) diff --git a/examples/ip_pipeline/pipeline/hash_func.h b/examples/ip_pipeline/pipeline/hash_func.h deleted file mode 100644 index 806ac22793..0000000000 --- a/examples/ip_pipeline/pipeline/hash_func.h +++ /dev/null @@ -1,356 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2010-2015 Intel Corporation - */ -#ifndef __INCLUDE_HASH_FUNC_H__ -#define __INCLUDE_HASH_FUNC_H__ - -static inline uint64_t -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] & m[0]); - - return (xor0 >> 32) ^ xor0; -} - -static inline uint64_t -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] & m[0]) ^ seed) ^ (k[1] & m[1]); - - return (xor0 >> 32) ^ xor0; -} - -static inline uint64_t -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] & m[0]) ^ seed) ^ (k[1] & m[1]); - - xor0 ^= k[2] & m[2]; - - return (xor0 >> 32) ^ xor0; -} - -static inline uint64_t -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] & m[0]) ^ seed) ^ (k[1] & m[1]); - xor1 = (k[2] & m[2]) ^ (k[3] & m[3]); - - xor0 ^= xor1; - - return (xor0 >> 32) ^ xor0; -} - -static inline uint64_t -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] & m[0]) ^ seed) ^ (k[1] & m[1]); - xor1 = (k[2] & m[2]) ^ (k[3] & m[3]); - - xor0 ^= xor1; - - xor0 ^= k[4] & m[4]; - - return (xor0 >> 32) ^ xor0; -} - -static inline uint64_t -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] & 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; - - xor0 ^= xor2; - - return (xor0 >> 32) ^ xor0; -} - -static inline uint64_t -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] & 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] & m[6]; - - xor0 ^= xor2; - - return (xor0 >> 32) ^ xor0; -} - -static inline uint64_t -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] & 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; - - xor0 ^= xor2; - - return (xor0 >> 32) ^ xor0; -} - -#if defined(RTE_ARCH_X86_64) - -#include - -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; - uint64_t crc0; - - crc0 = _mm_crc32_u64(seed, 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; - uint64_t *m = mask; - uint64_t k0, crc0, crc1; - - k0 = k[0] & m[0]; - - crc0 = _mm_crc32_u64(k0, seed); - crc1 = _mm_crc32_u64(k0 >> 32, 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; - uint64_t *m = mask; - uint64_t k0, k2, crc0, crc1; - - k0 = k[0] & m[0]; - k2 = k[2] & m[2]; - - crc0 = _mm_crc32_u64(k0, seed); - crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]); - - crc0 = _mm_crc32_u64(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; - uint64_t *m = mask; - uint64_t k0, k2, crc0, crc1, crc2, crc3; - - k0 = k[0] & m[0]; - k2 = k[2] & m[2]; - - crc0 = _mm_crc32_u64(k0, seed); - crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]); - - crc2 = _mm_crc32_u64(k2, k[3] & m[3]); - crc3 = k2 >> 32; - - crc0 = _mm_crc32_u64(crc0, crc1); - crc1 = _mm_crc32_u64(crc2, crc3); - - crc0 ^= crc1; - - 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; - uint64_t *m = mask; - uint64_t k0, k2, crc0, crc1, crc2, crc3; - - k0 = k[0] & m[0]; - k2 = k[2] & m[2]; - - crc0 = _mm_crc32_u64(k0, seed); - crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]); - - 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); - - crc0 ^= crc1; - - 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; - uint64_t *m = mask; - uint64_t k0, k2, k5, crc0, crc1, crc2, crc3; - - 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] & m[1]); - - 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); - - crc0 ^= crc1; - - 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; - uint64_t *m = mask; - uint64_t k0, k2, k5, crc0, crc1, crc2, crc3, crc4, crc5; - - 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] & m[1]); - - 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] & m[6]); - crc5 = k5 >> 32; - - crc0 = _mm_crc32_u64(crc0, (crc1 << 32) ^ crc2); - crc1 = _mm_crc32_u64(crc3, (crc4 << 32) ^ crc5); - - crc0 ^= crc1; - - 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; - uint64_t *m = mask; - uint64_t k0, k2, k5, crc0, crc1, crc2, crc3, crc4, crc5; - - 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] & m[1]); - - 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] & 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); - - crc0 ^= crc1; - - 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 - -#elif defined(RTE_ARCH_ARM64) -#include "hash_func_arm64.h" -#else - -#define hash_default_key8 hash_xor_key8 -#define hash_default_key16 hash_xor_key16 -#define hash_default_key24 hash_xor_key24 -#define hash_default_key32 hash_xor_key32 -#define hash_default_key40 hash_xor_key40 -#define hash_default_key48 hash_xor_key48 -#define hash_default_key56 hash_xor_key56 -#define hash_default_key64 hash_xor_key64 - -#endif - -#endif diff --git a/examples/ip_pipeline/pipeline/hash_func_arm64.h b/examples/ip_pipeline/pipeline/hash_func_arm64.h deleted file mode 100644 index ae6c0f41d3..0000000000 --- a/examples/ip_pipeline/pipeline/hash_func_arm64.h +++ /dev/null @@ -1,261 +0,0 @@ -/*- - * 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_actions_common.h b/examples/ip_pipeline/pipeline/pipeline_actions_common.h deleted file mode 100644 index 23f88367de..0000000000 --- a/examples/ip_pipeline/pipeline/pipeline_actions_common.h +++ /dev/null @@ -1,202 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2010-2016 Intel Corporation - */ -#ifndef __INCLUDE_PIPELINE_ACTIONS_COMMON_H__ -#define __INCLUDE_PIPELINE_ACTIONS_COMMON_H__ - -#include - -#include -#include -#include -#include - -#define PIPELINE_PORT_IN_AH(f_ah, f_pkt_work, f_pkt4_work) \ -static int \ -f_ah( \ - __rte_unused struct rte_pipeline *p, \ - struct rte_mbuf **pkts, \ - uint32_t n_pkts, \ - void *arg) \ -{ \ - uint32_t i; \ - \ - for (i = 0; i < (n_pkts & (~0x3LLU)); i += 4) \ - f_pkt4_work(&pkts[i], arg); \ - \ - for ( ; i < n_pkts; i++) \ - f_pkt_work(pkts[i], arg); \ - \ - return 0; \ -} - -#define PIPELINE_PORT_IN_AH_HIJACK_ALL(f_ah, f_pkt_work, f_pkt4_work) \ -static int \ -f_ah( \ - struct rte_pipeline *p, \ - struct rte_mbuf **pkts, \ - uint32_t n_pkts, \ - void *arg) \ -{ \ - uint64_t pkt_mask = RTE_LEN2MASK(n_pkts, uint64_t); \ - uint32_t i; \ - \ - rte_pipeline_ah_packet_hijack(p, pkt_mask); \ - \ - for (i = 0; i < (n_pkts & (~0x3LLU)); i += 4) \ - f_pkt4_work(&pkts[i], arg); \ - \ - for ( ; i < n_pkts; i++) \ - f_pkt_work(pkts[i], arg); \ - \ - return 0; \ -} - -#define PIPELINE_TABLE_AH_HIT(f_ah, f_pkt_work, f_pkt4_work) \ -static int \ -f_ah( \ - __rte_unused struct rte_pipeline *p, \ - struct rte_mbuf **pkts, \ - uint64_t pkts_in_mask, \ - struct rte_pipeline_table_entry **entries, \ - void *arg) \ -{ \ - if ((pkts_in_mask & (pkts_in_mask + 1)) == 0) { \ - uint64_t n_pkts = __builtin_popcountll(pkts_in_mask); \ - uint32_t i; \ - \ - for (i = 0; i < (n_pkts & (~0x3LLU)); i += 4) \ - f_pkt4_work(&pkts[i], &entries[i], arg); \ - \ - for ( ; i < n_pkts; i++) \ - f_pkt_work(pkts[i], entries[i], arg); \ - } else \ - for ( ; pkts_in_mask; ) { \ - uint32_t pos = __builtin_ctzll(pkts_in_mask); \ - uint64_t pkt_mask = 1LLU << pos; \ - \ - pkts_in_mask &= ~pkt_mask; \ - f_pkt_work(pkts[pos], entries[pos], arg); \ - } \ - \ - return 0; \ -} - -#define PIPELINE_TABLE_AH_MISS(f_ah, f_pkt_work, f_pkt4_work) \ -static int \ -f_ah( \ - __rte_unused struct rte_pipeline *p, \ - struct rte_mbuf **pkts, \ - uint64_t pkts_in_mask, \ - struct rte_pipeline_table_entry *entry, \ - void *arg) \ -{ \ - if ((pkts_in_mask & (pkts_in_mask + 1)) == 0) { \ - uint64_t n_pkts = __builtin_popcountll(pkts_in_mask); \ - uint32_t i; \ - \ - for (i = 0; i < (n_pkts & (~0x3LLU)); i += 4) \ - f_pkt4_work(&pkts[i], entry, arg); \ - \ - for ( ; i < n_pkts; i++) \ - f_pkt_work(pkts[i], entry, arg); \ - } else \ - for ( ; pkts_in_mask; ) { \ - uint32_t pos = __builtin_ctzll(pkts_in_mask); \ - uint64_t pkt_mask = 1LLU << pos; \ - \ - pkts_in_mask &= ~pkt_mask; \ - f_pkt_work(pkts[pos], entry, arg); \ - } \ - \ - return 0; \ -} - -#define PIPELINE_TABLE_AH_HIT_DROP_TIME(f_ah, f_pkt_work, f_pkt4_work) \ -static int \ -f_ah( \ - struct rte_pipeline *p, \ - struct rte_mbuf **pkts, \ - uint64_t pkts_mask, \ - struct rte_pipeline_table_entry **entries, \ - void *arg) \ -{ \ - uint64_t pkts_in_mask = pkts_mask; \ - uint64_t pkts_out_mask = pkts_mask; \ - uint64_t time = rte_rdtsc(); \ - \ - if ((pkts_in_mask & (pkts_in_mask + 1)) == 0) { \ - uint64_t n_pkts = __builtin_popcountll(pkts_in_mask); \ - uint32_t i; \ - \ - for (i = 0; i < (n_pkts & (~0x3LLU)); i += 4) { \ - uint64_t mask = f_pkt4_work(&pkts[i], \ - &entries[i], arg, time); \ - pkts_out_mask ^= mask << i; \ - } \ - \ - for ( ; i < n_pkts; i++) { \ - uint64_t mask = f_pkt_work(pkts[i], \ - entries[i], arg, time); \ - pkts_out_mask ^= mask << i; \ - } \ - } else \ - for ( ; pkts_in_mask; ) { \ - uint32_t pos = __builtin_ctzll(pkts_in_mask); \ - uint64_t pkt_mask = 1LLU << pos; \ - uint64_t mask = f_pkt_work(pkts[pos], \ - entries[pos], arg, time); \ - \ - pkts_in_mask &= ~pkt_mask; \ - pkts_out_mask ^= mask << pos; \ - } \ - \ - rte_pipeline_ah_packet_drop(p, pkts_out_mask ^ pkts_mask); \ - \ - return 0; \ -} - -#define PIPELINE_TABLE_AH_MISS_DROP_TIME(f_ah, f_pkt_work, f_pkt4_work) \ -static int \ -f_ah( \ - struct rte_pipeline *p, \ - struct rte_mbuf **pkts, \ - uint64_t pkts_mask, \ - struct rte_pipeline_table_entry *entry, \ - void *arg) \ -{ \ - uint64_t pkts_in_mask = pkts_mask; \ - uint64_t pkts_out_mask = pkts_mask; \ - uint64_t time = rte_rdtsc(); \ - \ - if ((pkts_in_mask & (pkts_in_mask + 1)) == 0) { \ - uint64_t n_pkts = __builtin_popcountll(pkts_in_mask); \ - uint32_t i; \ - \ - for (i = 0; i < (n_pkts & (~0x3LLU)); i += 4) { \ - uint64_t mask = f_pkt4_work(&pkts[i], \ - entry, arg, time); \ - pkts_out_mask ^= mask << i; \ - } \ - \ - for ( ; i < n_pkts; i++) { \ - uint64_t mask = f_pkt_work(pkts[i], entry, arg, time);\ - pkts_out_mask ^= mask << i; \ - } \ - } else \ - for ( ; pkts_in_mask; ) { \ - uint32_t pos = __builtin_ctzll(pkts_in_mask); \ - uint64_t pkt_mask = 1LLU << pos; \ - uint64_t mask = f_pkt_work(pkts[pos], \ - entry, arg, time); \ - \ - pkts_in_mask &= ~pkt_mask; \ - pkts_out_mask ^= mask << pos; \ - } \ - \ - rte_pipeline_ah_packet_drop(p, pkts_out_mask ^ pkts_mask); \ - \ - return 0; \ -} - -#endif diff --git a/examples/ip_pipeline/pipeline/pipeline_common_be.c b/examples/ip_pipeline/pipeline/pipeline_common_be.c deleted file mode 100644 index 5d84989a14..0000000000 --- a/examples/ip_pipeline/pipeline/pipeline_common_be.c +++ /dev/null @@ -1,176 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2010-2015 Intel Corporation - */ - -#include -#include - -#include "pipeline_common_be.h" - -void * -pipeline_msg_req_ping_handler(__rte_unused struct pipeline *p, - void *msg) -{ - struct pipeline_msg_rsp *rsp = msg; - - rsp->status = 0; /* OK */ - - return rsp; -} - -void * -pipeline_msg_req_stats_port_in_handler(struct pipeline *p, - void *msg) -{ - struct pipeline_stats_msg_req *req = msg; - struct pipeline_stats_port_in_msg_rsp *rsp = msg; - uint32_t port_id; - - /* Check request */ - if (req->id >= p->n_ports_in) { - rsp->status = -1; - return rsp; - } - port_id = p->port_in_id[req->id]; - - /* Process request */ - rsp->status = rte_pipeline_port_in_stats_read(p->p, - port_id, - &rsp->stats, - 1); - - return rsp; -} - -void * -pipeline_msg_req_stats_port_out_handler(struct pipeline *p, - void *msg) -{ - struct pipeline_stats_msg_req *req = msg; - struct pipeline_stats_port_out_msg_rsp *rsp = msg; - uint32_t port_id; - - /* Check request */ - if (req->id >= p->n_ports_out) { - rsp->status = -1; - return rsp; - } - port_id = p->port_out_id[req->id]; - - /* Process request */ - rsp->status = rte_pipeline_port_out_stats_read(p->p, - port_id, - &rsp->stats, - 1); - - return rsp; -} - -void * -pipeline_msg_req_stats_table_handler(struct pipeline *p, - void *msg) -{ - struct pipeline_stats_msg_req *req = msg; - struct pipeline_stats_table_msg_rsp *rsp = msg; - uint32_t table_id; - - /* Check request */ - if (req->id >= p->n_tables) { - rsp->status = -1; - return rsp; - } - table_id = p->table_id[req->id]; - - /* Process request */ - rsp->status = rte_pipeline_table_stats_read(p->p, - table_id, - &rsp->stats, - 1); - - return rsp; -} - -void * -pipeline_msg_req_port_in_enable_handler(struct pipeline *p, - void *msg) -{ - struct pipeline_port_in_msg_req *req = msg; - struct pipeline_msg_rsp *rsp = msg; - uint32_t port_id; - - /* Check request */ - if (req->port_id >= p->n_ports_in) { - rsp->status = -1; - return rsp; - } - port_id = p->port_in_id[req->port_id]; - - /* Process request */ - rsp->status = rte_pipeline_port_in_enable(p->p, - port_id); - - return rsp; -} - -void * -pipeline_msg_req_port_in_disable_handler(struct pipeline *p, - void *msg) -{ - struct pipeline_port_in_msg_req *req = msg; - struct pipeline_msg_rsp *rsp = msg; - uint32_t port_id; - - /* Check request */ - if (req->port_id >= p->n_ports_in) { - rsp->status = -1; - return rsp; - } - port_id = p->port_in_id[req->port_id]; - - /* Process request */ - rsp->status = rte_pipeline_port_in_disable(p->p, - port_id); - - return rsp; -} - -void * -pipeline_msg_req_invalid_handler(__rte_unused struct pipeline *p, - void *msg) -{ - struct pipeline_msg_rsp *rsp = msg; - - rsp->status = -1; /* Error */ - - return rsp; -} - -int -pipeline_msg_req_handle(struct pipeline *p) -{ - uint32_t msgq_id; - - for (msgq_id = 0; msgq_id < p->n_msgq; msgq_id++) { - for ( ; ; ) { - struct pipeline_msg_req *req; - pipeline_msg_req_handler f_handle; - - req = pipeline_msg_recv(p, msgq_id); - if (req == NULL) - break; - - f_handle = (req->type < PIPELINE_MSG_REQS) ? - p->handlers[req->type] : - pipeline_msg_req_invalid_handler; - - if (f_handle == NULL) - f_handle = pipeline_msg_req_invalid_handler; - - pipeline_msg_send(p, - msgq_id, - f_handle(p, (void *) req)); - } - } - - return 0; -} diff --git a/examples/ip_pipeline/pipeline/pipeline_common_be.h b/examples/ip_pipeline/pipeline/pipeline_common_be.h deleted file mode 100644 index 83bd04e64b..0000000000 --- a/examples/ip_pipeline/pipeline/pipeline_common_be.h +++ /dev/null @@ -1,134 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2010-2015 Intel Corporation - */ - -#ifndef __INCLUDE_PIPELINE_COMMON_BE_H__ -#define __INCLUDE_PIPELINE_COMMON_BE_H__ - -#include -#include -#include - -#include "pipeline_be.h" - -struct pipeline; - -enum pipeline_msg_req_type { - PIPELINE_MSG_REQ_PING = 0, - PIPELINE_MSG_REQ_STATS_PORT_IN, - PIPELINE_MSG_REQ_STATS_PORT_OUT, - PIPELINE_MSG_REQ_STATS_TABLE, - PIPELINE_MSG_REQ_PORT_IN_ENABLE, - PIPELINE_MSG_REQ_PORT_IN_DISABLE, - PIPELINE_MSG_REQ_CUSTOM, - PIPELINE_MSG_REQS -}; - -typedef void *(*pipeline_msg_req_handler)(struct pipeline *p, void *msg); - -struct pipeline { - struct rte_pipeline *p; - uint32_t port_in_id[PIPELINE_MAX_PORT_IN]; - uint32_t port_out_id[PIPELINE_MAX_PORT_OUT]; - uint32_t table_id[PIPELINE_MAX_TABLES]; - struct rte_ring *msgq_in[PIPELINE_MAX_MSGQ_IN]; - struct rte_ring *msgq_out[PIPELINE_MAX_MSGQ_OUT]; - - uint32_t n_ports_in; - uint32_t n_ports_out; - uint32_t n_tables; - uint32_t n_msgq; - - pipeline_msg_req_handler handlers[PIPELINE_MSG_REQS]; - char name[PIPELINE_NAME_SIZE]; - uint32_t log_level; -}; - -enum pipeline_log_level { - PIPELINE_LOG_LEVEL_HIGH = 1, - PIPELINE_LOG_LEVEL_LOW, - PIPELINE_LOG_LEVELS -}; - -#define PLOG(p, level, fmt, ...) \ -do { \ - if (p->log_level >= PIPELINE_LOG_LEVEL_ ## level) \ - fprintf(stdout, "[%s] " fmt "\n", p->name, ## __VA_ARGS__);\ -} while (0) - -static inline void * -pipeline_msg_recv(struct pipeline *p, - uint32_t msgq_id) -{ - struct rte_ring *r = p->msgq_in[msgq_id]; - void *msg; - int status = rte_ring_sc_dequeue(r, &msg); - - if (status != 0) - return NULL; - - return msg; -} - -static inline void -pipeline_msg_send(struct pipeline *p, - uint32_t msgq_id, - void *msg) -{ - struct rte_ring *r = p->msgq_out[msgq_id]; - int status; - - do { - status = rte_ring_sp_enqueue(r, msg); - } while (status == -ENOBUFS); -} - -struct pipeline_msg_req { - enum pipeline_msg_req_type type; -}; - -struct pipeline_stats_msg_req { - enum pipeline_msg_req_type type; - uint32_t id; -}; - -struct pipeline_port_in_msg_req { - enum pipeline_msg_req_type type; - uint32_t port_id; -}; - -struct pipeline_custom_msg_req { - enum pipeline_msg_req_type type; - uint32_t subtype; -}; - -struct pipeline_msg_rsp { - int status; -}; - -struct pipeline_stats_port_in_msg_rsp { - int status; - struct rte_pipeline_port_in_stats stats; -}; - -struct pipeline_stats_port_out_msg_rsp { - int status; - struct rte_pipeline_port_out_stats stats; -}; - -struct pipeline_stats_table_msg_rsp { - int status; - struct rte_pipeline_table_stats stats; -}; - -void *pipeline_msg_req_ping_handler(struct pipeline *p, void *msg); -void *pipeline_msg_req_stats_port_in_handler(struct pipeline *p, void *msg); -void *pipeline_msg_req_stats_port_out_handler(struct pipeline *p, void *msg); -void *pipeline_msg_req_stats_table_handler(struct pipeline *p, void *msg); -void *pipeline_msg_req_port_in_enable_handler(struct pipeline *p, void *msg); -void *pipeline_msg_req_port_in_disable_handler(struct pipeline *p, void *msg); -void *pipeline_msg_req_invalid_handler(struct pipeline *p, void *msg); - -int pipeline_msg_req_handle(struct pipeline *p); - -#endif diff --git a/examples/ip_pipeline/pipeline/pipeline_common_fe.c b/examples/ip_pipeline/pipeline/pipeline_common_fe.c deleted file mode 100644 index cc5214c73c..0000000000 --- a/examples/ip_pipeline/pipeline/pipeline_common_fe.c +++ /dev/null @@ -1,1455 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2010-2016 Intel Corporation - */ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "pipeline_common_fe.h" -#include "parser.h" - -struct app_link_params * -app_pipeline_track_pktq_out_to_link(struct app_params *app, - uint32_t pipeline_id, - uint32_t pktq_out_id) -{ - struct app_pipeline_params *p; - - /* Check input arguments */ - if (app == NULL) - return NULL; - - APP_PARAM_FIND_BY_ID(app->pipeline_params, "PIPELINE", pipeline_id, p); - if (p == NULL) - return NULL; - - for ( ; ; ) { - struct app_pktq_out_params *pktq_out = - &p->pktq_out[pktq_out_id]; - - switch (pktq_out->type) { - case APP_PKTQ_OUT_HWQ: - { - struct app_pktq_hwq_out_params *hwq_out; - - hwq_out = &app->hwq_out_params[pktq_out->id]; - - return app_get_link_for_txq(app, hwq_out); - } - - case APP_PKTQ_OUT_SWQ: - { - struct pipeline_params pp; - struct pipeline_type *ptype; - struct app_pktq_swq_params *swq; - uint32_t pktq_in_id; - int status; - - swq = &app->swq_params[pktq_out->id]; - p = app_swq_get_reader(app, swq, &pktq_in_id); - if (p == NULL) - return NULL; - - ptype = app_pipeline_type_find(app, p->type); - if ((ptype == NULL) || (ptype->fe_ops->f_track == NULL)) - return NULL; - - app_pipeline_params_get(app, p, &pp); - status = ptype->fe_ops->f_track(&pp, - pktq_in_id, - &pktq_out_id); - if (status) - return NULL; - - break; - } - - case APP_PKTQ_OUT_TM: - { - struct pipeline_params pp; - struct pipeline_type *ptype; - struct app_pktq_tm_params *tm; - uint32_t pktq_in_id; - int status; - - tm = &app->tm_params[pktq_out->id]; - p = app_tm_get_reader(app, tm, &pktq_in_id); - if (p == NULL) - return NULL; - - ptype = app_pipeline_type_find(app, p->type); - if ((ptype == NULL) || (ptype->fe_ops->f_track == NULL)) - return NULL; - - app_pipeline_params_get(app, p, &pp); - status = ptype->fe_ops->f_track(&pp, - pktq_in_id, - &pktq_out_id); - if (status) - return NULL; - - break; - } - - case APP_PKTQ_OUT_KNI: - { - struct pipeline_params pp; - struct pipeline_type *ptype; - struct app_pktq_kni_params *kni; - uint32_t pktq_in_id; - int status; - - kni = &app->kni_params[pktq_out->id]; - p = app_kni_get_reader(app, kni, &pktq_in_id); - if (p == NULL) - return NULL; - - ptype = app_pipeline_type_find(app, p->type); - if ((ptype == NULL) || (ptype->fe_ops->f_track == NULL)) - return NULL; - - app_pipeline_params_get(app, p, &pp); - status = ptype->fe_ops->f_track(&pp, - pktq_in_id, - &pktq_out_id); - if (status) - return NULL; - - break; - } - - case APP_PKTQ_OUT_TAP: - case APP_PKTQ_OUT_SINK: - default: - return NULL; - } - } -} - -int -app_pipeline_track_default(struct pipeline_params *p, - uint32_t port_in, - uint32_t *port_out) -{ - /* Check input arguments */ - if ((p == NULL) || - (port_in >= p->n_ports_in) || - (port_out == NULL)) - return -1; - - if (p->n_ports_out == 1) { - *port_out = 0; - return 0; - } - - return -1; -} - -int -app_pipeline_ping(struct app_params *app, - uint32_t pipeline_id) -{ - struct app_pipeline_params *p; - struct pipeline_msg_req *req; - struct pipeline_msg_rsp *rsp; - int status = 0; - - /* Check input arguments */ - if (app == NULL) - return -1; - - APP_PARAM_FIND_BY_ID(app->pipeline_params, "PIPELINE", pipeline_id, p); - if (p == NULL) - return -1; - - /* Message buffer allocation */ - req = app_msg_alloc(app); - if (req == NULL) - return -1; - - /* Fill in request */ - req->type = PIPELINE_MSG_REQ_PING; - - /* Send request and wait for response */ - rsp = app_msg_send_recv(app, pipeline_id, req, MSG_TIMEOUT_DEFAULT); - if (rsp == NULL) - return -1; - - /* Check response */ - status = rsp->status; - - /* Message buffer free */ - app_msg_free(app, rsp); - - return status; -} - -int -app_pipeline_stats_port_in(struct app_params *app, - uint32_t pipeline_id, - uint32_t port_id, - struct rte_pipeline_port_in_stats *stats) -{ - struct app_pipeline_params *p; - struct pipeline_stats_msg_req *req; - struct pipeline_stats_port_in_msg_rsp *rsp; - int status = 0; - - /* Check input arguments */ - if ((app == NULL) || - (stats == NULL)) - return -1; - - APP_PARAM_FIND_BY_ID(app->pipeline_params, "PIPELINE", pipeline_id, p); - if ((p == NULL) || - (port_id >= p->n_pktq_in)) - return -1; - - /* Message buffer allocation */ - req = app_msg_alloc(app); - if (req == NULL) - return -1; - - /* Fill in request */ - req->type = PIPELINE_MSG_REQ_STATS_PORT_IN; - req->id = port_id; - - /* Send request and wait for response */ - rsp = (struct pipeline_stats_port_in_msg_rsp *) - app_msg_send_recv(app, pipeline_id, req, MSG_TIMEOUT_DEFAULT); - if (rsp == NULL) - return -1; - - /* Check response */ - status = rsp->status; - if (status == 0) - memcpy(stats, &rsp->stats, sizeof(rsp->stats)); - - /* Message buffer free */ - app_msg_free(app, rsp); - - return status; -} - -int -app_pipeline_stats_port_out(struct app_params *app, - uint32_t pipeline_id, - uint32_t port_id, - struct rte_pipeline_port_out_stats *stats) -{ - struct app_pipeline_params *p; - struct pipeline_stats_msg_req *req; - struct pipeline_stats_port_out_msg_rsp *rsp; - int status = 0; - - /* Check input arguments */ - if ((app == NULL) || - (pipeline_id >= app->n_pipelines) || - (stats == NULL)) - return -1; - - APP_PARAM_FIND_BY_ID(app->pipeline_params, "PIPELINE", pipeline_id, p); - if ((p == NULL) || - (port_id >= p->n_pktq_out)) - return -1; - - /* Message buffer allocation */ - req = app_msg_alloc(app); - if (req == NULL) - return -1; - - /* Fill in request */ - req->type = PIPELINE_MSG_REQ_STATS_PORT_OUT; - req->id = port_id; - - /* Send request and wait for response */ - rsp = app_msg_send_recv(app, pipeline_id, req, MSG_TIMEOUT_DEFAULT); - if (rsp == NULL) - return -1; - - /* Check response */ - status = rsp->status; - if (status == 0) - memcpy(stats, &rsp->stats, sizeof(rsp->stats)); - - /* Message buffer free */ - app_msg_free(app, rsp); - - return status; -} - -int -app_pipeline_stats_table(struct app_params *app, - uint32_t pipeline_id, - uint32_t table_id, - struct rte_pipeline_table_stats *stats) -{ - struct app_pipeline_params *p; - struct pipeline_stats_msg_req *req; - struct pipeline_stats_table_msg_rsp *rsp; - int status = 0; - - /* Check input arguments */ - if ((app == NULL) || - (stats == NULL)) - return -1; - - APP_PARAM_FIND_BY_ID(app->pipeline_params, "PIPELINE", pipeline_id, p); - if (p == NULL) - return -1; - - /* Message buffer allocation */ - req = app_msg_alloc(app); - if (req == NULL) - return -1; - - /* Fill in request */ - req->type = PIPELINE_MSG_REQ_STATS_TABLE; - req->id = table_id; - - /* Send request and wait for response */ - rsp = app_msg_send_recv(app, pipeline_id, req, MSG_TIMEOUT_DEFAULT); - if (rsp == NULL) - return -1; - - /* Check response */ - status = rsp->status; - if (status == 0) - memcpy(stats, &rsp->stats, sizeof(rsp->stats)); - - /* Message buffer free */ - app_msg_free(app, rsp); - - return status; -} - -int -app_pipeline_port_in_enable(struct app_params *app, - uint32_t pipeline_id, - uint32_t port_id) -{ - struct app_pipeline_params *p; - struct pipeline_port_in_msg_req *req; - struct pipeline_msg_rsp *rsp; - int status = 0; - - /* Check input arguments */ - if (app == NULL) - return -1; - - APP_PARAM_FIND_BY_ID(app->pipeline_params, "PIPELINE", pipeline_id, p); - if ((p == NULL) || - (port_id >= p->n_pktq_in)) - return -1; - - /* Message buffer allocation */ - req = app_msg_alloc(app); - if (req == NULL) - return -1; - - /* Fill in request */ - req->type = PIPELINE_MSG_REQ_PORT_IN_ENABLE; - req->port_id = port_id; - - /* Send request and wait for response */ - rsp = app_msg_send_recv(app, pipeline_id, req, MSG_TIMEOUT_DEFAULT); - if (rsp == NULL) - return -1; - - /* Check response */ - status = rsp->status; - - /* Message buffer free */ - app_msg_free(app, rsp); - - return status; -} - -int -app_pipeline_port_in_disable(struct app_params *app, - uint32_t pipeline_id, - uint32_t port_id) -{ - struct app_pipeline_params *p; - struct pipeline_port_in_msg_req *req; - struct pipeline_msg_rsp *rsp; - int status = 0; - - /* Check input arguments */ - if (app == NULL) - return -1; - - APP_PARAM_FIND_BY_ID(app->pipeline_params, "PIPELINE", pipeline_id, p); - if ((p == NULL) || - (port_id >= p->n_pktq_in)) - return -1; - - /* Message buffer allocation */ - req = app_msg_alloc(app); - if (req == NULL) - return -1; - - /* Fill in request */ - req->type = PIPELINE_MSG_REQ_PORT_IN_DISABLE; - req->port_id = port_id; - - /* Send request and wait for response */ - rsp = app_msg_send_recv(app, pipeline_id, req, MSG_TIMEOUT_DEFAULT); - if (rsp == NULL) - return -1; - - /* Check response */ - status = rsp->status; - - /* Message buffer free */ - app_msg_free(app, rsp); - - return status; -} - -int -app_link_set_op(struct app_params *app, - uint32_t link_id, - uint32_t pipeline_id, - app_link_op op, - void *arg) -{ - struct app_pipeline_params *pp; - struct app_link_params *lp; - struct app_link_data *ld; - uint32_t ppos, lpos; - - /* Check input arguments */ - if ((app == NULL) || - (op == NULL)) - return -1; - - APP_PARAM_FIND_BY_ID(app->link_params, "LINK", link_id, lp); - if (lp == NULL) - return -1; - lpos = lp - app->link_params; - ld = &app->link_data[lpos]; - - APP_PARAM_FIND_BY_ID(app->pipeline_params, "PIPELINE", pipeline_id, pp); - if (pp == NULL) - return -1; - ppos = pp - app->pipeline_params; - - ld->f_link[ppos] = op; - ld->arg[ppos] = arg; - - return 0; -} - -int -app_link_config(struct app_params *app, - uint32_t link_id, - uint32_t ip, - uint32_t depth) -{ - struct app_link_params *p; - uint32_t i, netmask, host, bcast; - - /* Check input arguments */ - if (app == NULL) - return -1; - - APP_PARAM_FIND_BY_ID(app->link_params, "LINK", link_id, p); - if (p == NULL) { - APP_LOG(app, HIGH, "LINK%" PRIu32 " is not a valid link", - link_id); - return -1; - } - - if (p->state) { - APP_LOG(app, HIGH, "%s is UP, please bring it DOWN first", - p->name); - return -1; - } - - netmask = (~0U) << (32 - depth); - host = ip & netmask; - bcast = host | (~netmask); - - if ((ip == 0) || - (ip == UINT32_MAX) || - (ip == host) || - (ip == bcast)) { - APP_LOG(app, HIGH, "Illegal IP address"); - return -1; - } - - for (i = 0; i < app->n_links; i++) { - struct app_link_params *link = &app->link_params[i]; - - if (strcmp(p->name, link->name) == 0) - continue; - - if (link->ip == ip) { - APP_LOG(app, HIGH, - "%s is already assigned this IP address", - link->name); - return -1; - } - } - - if ((depth == 0) || (depth > 32)) { - APP_LOG(app, HIGH, "Illegal value for depth parameter " - "(%" PRIu32 ")", - depth); - return -1; - } - - /* Save link parameters */ - p->ip = ip; - p->depth = depth; - - return 0; -} - -int -app_link_up(struct app_params *app, - uint32_t link_id) -{ - struct app_link_params *p; - struct app_link_data *d; - int i; - - /* Check input arguments */ - if (app == NULL) - return -1; - - APP_PARAM_FIND_BY_ID(app->link_params, "LINK", link_id, p); - if (p == NULL) { - APP_LOG(app, HIGH, "LINK%" PRIu32 " is not a valid link", - link_id); - return -1; - } - - d = &app->link_data[p - app->link_params]; - - /* Check link state */ - if (p->state) { - APP_LOG(app, HIGH, "%s is already UP", p->name); - return 0; - } - - /* Check that IP address is valid */ - if (p->ip == 0) { - APP_LOG(app, HIGH, "%s IP address is not set", p->name); - return 0; - } - - app_link_up_internal(app, p); - - /* Callbacks */ - for (i = 0; i < APP_MAX_PIPELINES; i++) - if (d->f_link[i]) - d->f_link[i](app, link_id, 1, d->arg[i]); - - return 0; -} - -int -app_link_down(struct app_params *app, - uint32_t link_id) -{ - struct app_link_params *p; - struct app_link_data *d; - uint32_t i; - - /* Check input arguments */ - if (app == NULL) - return -1; - - APP_PARAM_FIND_BY_ID(app->link_params, "LINK", link_id, p); - if (p == NULL) { - APP_LOG(app, HIGH, "LINK%" PRIu32 " is not a valid link", - link_id); - return -1; - } - - d = &app->link_data[p - app->link_params]; - - /* Check link state */ - if (p->state == 0) { - APP_LOG(app, HIGH, "%s is already DOWN", p->name); - return 0; - } - - app_link_down_internal(app, p); - - /* Callbacks */ - for (i = 0; i < APP_MAX_PIPELINES; i++) - if (d->f_link[i]) - d->f_link[i](app, link_id, 0, d->arg[i]); - - return 0; -} - -/* - * ping - */ - -struct cmd_ping_result { - cmdline_fixed_string_t p_string; - uint32_t pipeline_id; - cmdline_fixed_string_t ping_string; -}; - -static void -cmd_ping_parsed( - void *parsed_result, - __rte_unused struct cmdline *cl, - void *data) -{ - struct cmd_ping_result *params = parsed_result; - struct app_params *app = data; - int status; - - status = app_pipeline_ping(app, params->pipeline_id); - if (status != 0) - printf("Command failed\n"); -} - -static cmdline_parse_token_string_t cmd_ping_p_string = - TOKEN_STRING_INITIALIZER(struct cmd_ping_result, p_string, "p"); - -static cmdline_parse_token_num_t cmd_ping_pipeline_id = - TOKEN_NUM_INITIALIZER(struct cmd_ping_result, pipeline_id, UINT32); - -static cmdline_parse_token_string_t cmd_ping_ping_string = - TOKEN_STRING_INITIALIZER(struct cmd_ping_result, ping_string, "ping"); - -static cmdline_parse_inst_t cmd_ping = { - .f = cmd_ping_parsed, - .data = NULL, - .help_str = "Pipeline ping", - .tokens = { - (void *) &cmd_ping_p_string, - (void *) &cmd_ping_pipeline_id, - (void *) &cmd_ping_ping_string, - NULL, - }, -}; - -/* - * stats port in - */ - -struct cmd_stats_port_in_result { - cmdline_fixed_string_t p_string; - uint32_t pipeline_id; - cmdline_fixed_string_t stats_string; - cmdline_fixed_string_t port_string; - cmdline_fixed_string_t in_string; - uint32_t port_in_id; - -}; - -static void -cmd_stats_port_in_parsed( - void *parsed_result, - __rte_unused struct cmdline *cl, - void *data) -{ - struct cmd_stats_port_in_result *params = parsed_result; - struct app_params *app = data; - struct rte_pipeline_port_in_stats stats; - int status; - - status = app_pipeline_stats_port_in(app, - params->pipeline_id, - params->port_in_id, - &stats); - - if (status != 0) { - printf("Command failed\n"); - return; - } - - /* Display stats */ - printf("Pipeline %" PRIu32 " - stats for input port %" PRIu32 ":\n" - "\tPkts in: %" PRIu64 "\n" - "\tPkts dropped by AH: %" PRIu64 "\n" - "\tPkts dropped by other: %" PRIu64 "\n", - params->pipeline_id, - params->port_in_id, - stats.stats.n_pkts_in, - stats.n_pkts_dropped_by_ah, - stats.stats.n_pkts_drop); -} - -static cmdline_parse_token_string_t cmd_stats_port_in_p_string = - TOKEN_STRING_INITIALIZER(struct cmd_stats_port_in_result, p_string, - "p"); - -static cmdline_parse_token_num_t cmd_stats_port_in_pipeline_id = - TOKEN_NUM_INITIALIZER(struct cmd_stats_port_in_result, pipeline_id, - UINT32); - -static cmdline_parse_token_string_t cmd_stats_port_in_stats_string = - TOKEN_STRING_INITIALIZER(struct cmd_stats_port_in_result, stats_string, - "stats"); - -static cmdline_parse_token_string_t cmd_stats_port_in_port_string = - TOKEN_STRING_INITIALIZER(struct cmd_stats_port_in_result, port_string, - "port"); - -static cmdline_parse_token_string_t cmd_stats_port_in_in_string = - TOKEN_STRING_INITIALIZER(struct cmd_stats_port_in_result, in_string, - "in"); - - cmdline_parse_token_num_t cmd_stats_port_in_port_in_id = - TOKEN_NUM_INITIALIZER(struct cmd_stats_port_in_result, port_in_id, - UINT32); - -static cmdline_parse_inst_t cmd_stats_port_in = { - .f = cmd_stats_port_in_parsed, - .data = NULL, - .help_str = "Pipeline input port stats", - .tokens = { - (void *) &cmd_stats_port_in_p_string, - (void *) &cmd_stats_port_in_pipeline_id, - (void *) &cmd_stats_port_in_stats_string, - (void *) &cmd_stats_port_in_port_string, - (void *) &cmd_stats_port_in_in_string, - (void *) &cmd_stats_port_in_port_in_id, - NULL, - }, -}; - -/* - * stats port out - */ - -struct cmd_stats_port_out_result { - cmdline_fixed_string_t p_string; - uint32_t pipeline_id; - cmdline_fixed_string_t stats_string; - cmdline_fixed_string_t port_string; - cmdline_fixed_string_t out_string; - uint32_t port_out_id; -}; - -static void -cmd_stats_port_out_parsed( - void *parsed_result, - __rte_unused struct cmdline *cl, - void *data) -{ - - struct cmd_stats_port_out_result *params = parsed_result; - struct app_params *app = data; - struct rte_pipeline_port_out_stats stats; - int status; - - status = app_pipeline_stats_port_out(app, - params->pipeline_id, - params->port_out_id, - &stats); - - if (status != 0) { - printf("Command failed\n"); - return; - } - - /* Display stats */ - printf("Pipeline %" PRIu32 " - stats for output port %" PRIu32 ":\n" - "\tPkts in: %" PRIu64 "\n" - "\tPkts dropped by AH: %" PRIu64 "\n" - "\tPkts dropped by other: %" PRIu64 "\n", - params->pipeline_id, - params->port_out_id, - stats.stats.n_pkts_in, - stats.n_pkts_dropped_by_ah, - stats.stats.n_pkts_drop); -} - -static cmdline_parse_token_string_t cmd_stats_port_out_p_string = - TOKEN_STRING_INITIALIZER(struct cmd_stats_port_out_result, p_string, - "p"); - -static cmdline_parse_token_num_t cmd_stats_port_out_pipeline_id = - TOKEN_NUM_INITIALIZER(struct cmd_stats_port_out_result, pipeline_id, - UINT32); - -static cmdline_parse_token_string_t cmd_stats_port_out_stats_string = - TOKEN_STRING_INITIALIZER(struct cmd_stats_port_out_result, stats_string, - "stats"); - -static cmdline_parse_token_string_t cmd_stats_port_out_port_string = - TOKEN_STRING_INITIALIZER(struct cmd_stats_port_out_result, port_string, - "port"); - -static cmdline_parse_token_string_t cmd_stats_port_out_out_string = - TOKEN_STRING_INITIALIZER(struct cmd_stats_port_out_result, out_string, - "out"); - -static cmdline_parse_token_num_t cmd_stats_port_out_port_out_id = - TOKEN_NUM_INITIALIZER(struct cmd_stats_port_out_result, port_out_id, - UINT32); - -static cmdline_parse_inst_t cmd_stats_port_out = { - .f = cmd_stats_port_out_parsed, - .data = NULL, - .help_str = "Pipeline output port stats", - .tokens = { - (void *) &cmd_stats_port_out_p_string, - (void *) &cmd_stats_port_out_pipeline_id, - (void *) &cmd_stats_port_out_stats_string, - (void *) &cmd_stats_port_out_port_string, - (void *) &cmd_stats_port_out_out_string, - (void *) &cmd_stats_port_out_port_out_id, - NULL, - }, -}; - -/* - * stats table - */ - -struct cmd_stats_table_result { - cmdline_fixed_string_t p_string; - uint32_t pipeline_id; - cmdline_fixed_string_t stats_string; - cmdline_fixed_string_t table_string; - uint32_t table_id; -}; - -static void -cmd_stats_table_parsed( - void *parsed_result, - __rte_unused struct cmdline *cl, - void *data) -{ - struct cmd_stats_table_result *params = parsed_result; - struct app_params *app = data; - struct rte_pipeline_table_stats stats; - int status; - - status = app_pipeline_stats_table(app, - params->pipeline_id, - params->table_id, - &stats); - - if (status != 0) { - printf("Command failed\n"); - return; - } - - /* Display stats */ - printf("Pipeline %" PRIu32 " - stats for table %" PRIu32 ":\n" - "\tPkts in: %" PRIu64 "\n" - "\tPkts in with lookup miss: %" PRIu64 "\n" - "\tPkts in with lookup hit dropped by AH: %" PRIu64 "\n" - "\tPkts in with lookup hit dropped by others: %" PRIu64 "\n" - "\tPkts in with lookup miss dropped by AH: %" PRIu64 "\n" - "\tPkts in with lookup miss dropped by others: %" PRIu64 "\n", - params->pipeline_id, - params->table_id, - stats.stats.n_pkts_in, - stats.stats.n_pkts_lookup_miss, - stats.n_pkts_dropped_by_lkp_hit_ah, - stats.n_pkts_dropped_lkp_hit, - stats.n_pkts_dropped_by_lkp_miss_ah, - stats.n_pkts_dropped_lkp_miss); -} - -static cmdline_parse_token_string_t cmd_stats_table_p_string = - TOKEN_STRING_INITIALIZER(struct cmd_stats_table_result, p_string, - "p"); - -static cmdline_parse_token_num_t cmd_stats_table_pipeline_id = - TOKEN_NUM_INITIALIZER(struct cmd_stats_table_result, pipeline_id, - UINT32); - -static cmdline_parse_token_string_t cmd_stats_table_stats_string = - TOKEN_STRING_INITIALIZER(struct cmd_stats_table_result, stats_string, - "stats"); - -static cmdline_parse_token_string_t cmd_stats_table_table_string = - TOKEN_STRING_INITIALIZER(struct cmd_stats_table_result, table_string, - "table"); - -static cmdline_parse_token_num_t cmd_stats_table_table_id = - TOKEN_NUM_INITIALIZER(struct cmd_stats_table_result, table_id, UINT32); - -static cmdline_parse_inst_t cmd_stats_table = { - .f = cmd_stats_table_parsed, - .data = NULL, - .help_str = "Pipeline table stats", - .tokens = { - (void *) &cmd_stats_table_p_string, - (void *) &cmd_stats_table_pipeline_id, - (void *) &cmd_stats_table_stats_string, - (void *) &cmd_stats_table_table_string, - (void *) &cmd_stats_table_table_id, - NULL, - }, -}; - -/* - * port in enable - */ - -struct cmd_port_in_enable_result { - cmdline_fixed_string_t p_string; - uint32_t pipeline_id; - cmdline_fixed_string_t port_string; - cmdline_fixed_string_t in_string; - uint32_t port_in_id; - cmdline_fixed_string_t enable_string; -}; - -static void -cmd_port_in_enable_parsed( - void *parsed_result, - __rte_unused struct cmdline *cl, - void *data) -{ - struct cmd_port_in_enable_result *params = parsed_result; - struct app_params *app = data; - int status; - - status = app_pipeline_port_in_enable(app, - params->pipeline_id, - params->port_in_id); - - if (status != 0) - printf("Command failed\n"); -} - -static cmdline_parse_token_string_t cmd_port_in_enable_p_string = - TOKEN_STRING_INITIALIZER(struct cmd_port_in_enable_result, p_string, - "p"); - -static cmdline_parse_token_num_t cmd_port_in_enable_pipeline_id = - TOKEN_NUM_INITIALIZER(struct cmd_port_in_enable_result, pipeline_id, - UINT32); - -static cmdline_parse_token_string_t cmd_port_in_enable_port_string = - TOKEN_STRING_INITIALIZER(struct cmd_port_in_enable_result, port_string, - "port"); - -static cmdline_parse_token_string_t cmd_port_in_enable_in_string = - TOKEN_STRING_INITIALIZER(struct cmd_port_in_enable_result, in_string, - "in"); - -static cmdline_parse_token_num_t cmd_port_in_enable_port_in_id = - TOKEN_NUM_INITIALIZER(struct cmd_port_in_enable_result, port_in_id, - UINT32); - -static cmdline_parse_token_string_t cmd_port_in_enable_enable_string = - TOKEN_STRING_INITIALIZER(struct cmd_port_in_enable_result, - enable_string, "enable"); - -static cmdline_parse_inst_t cmd_port_in_enable = { - .f = cmd_port_in_enable_parsed, - .data = NULL, - .help_str = "Pipeline input port enable", - .tokens = { - (void *) &cmd_port_in_enable_p_string, - (void *) &cmd_port_in_enable_pipeline_id, - (void *) &cmd_port_in_enable_port_string, - (void *) &cmd_port_in_enable_in_string, - (void *) &cmd_port_in_enable_port_in_id, - (void *) &cmd_port_in_enable_enable_string, - NULL, - }, -}; - -/* - * port in disable - */ - -struct cmd_port_in_disable_result { - cmdline_fixed_string_t p_string; - uint32_t pipeline_id; - cmdline_fixed_string_t port_string; - cmdline_fixed_string_t in_string; - uint32_t port_in_id; - cmdline_fixed_string_t disable_string; -}; - -static void -cmd_port_in_disable_parsed( - void *parsed_result, - __rte_unused struct cmdline *cl, - void *data) -{ - struct cmd_port_in_disable_result *params = parsed_result; - struct app_params *app = data; - int status; - - status = app_pipeline_port_in_disable(app, - params->pipeline_id, - params->port_in_id); - - if (status != 0) - printf("Command failed\n"); -} - -static cmdline_parse_token_string_t cmd_port_in_disable_p_string = - TOKEN_STRING_INITIALIZER(struct cmd_port_in_disable_result, p_string, - "p"); - -static cmdline_parse_token_num_t cmd_port_in_disable_pipeline_id = - TOKEN_NUM_INITIALIZER(struct cmd_port_in_disable_result, pipeline_id, - UINT32); - -static cmdline_parse_token_string_t cmd_port_in_disable_port_string = - TOKEN_STRING_INITIALIZER(struct cmd_port_in_disable_result, port_string, - "port"); - -static cmdline_parse_token_string_t cmd_port_in_disable_in_string = - TOKEN_STRING_INITIALIZER(struct cmd_port_in_disable_result, in_string, - "in"); - -static cmdline_parse_token_num_t cmd_port_in_disable_port_in_id = - TOKEN_NUM_INITIALIZER(struct cmd_port_in_disable_result, port_in_id, - UINT32); - -static cmdline_parse_token_string_t cmd_port_in_disable_disable_string = - TOKEN_STRING_INITIALIZER(struct cmd_port_in_disable_result, - disable_string, "disable"); - -static cmdline_parse_inst_t cmd_port_in_disable = { - .f = cmd_port_in_disable_parsed, - .data = NULL, - .help_str = "Pipeline input port disable", - .tokens = { - (void *) &cmd_port_in_disable_p_string, - (void *) &cmd_port_in_disable_pipeline_id, - (void *) &cmd_port_in_disable_port_string, - (void *) &cmd_port_in_disable_in_string, - (void *) &cmd_port_in_disable_port_in_id, - (void *) &cmd_port_in_disable_disable_string, - NULL, - }, -}; - -/* - * link config - */ - -static void -print_link_info(struct app_link_params *p) -{ - struct rte_eth_stats stats; - struct ether_addr *mac_addr; - uint32_t netmask = (~0U) << (32 - p->depth); - uint32_t host = p->ip & netmask; - uint32_t bcast = host | (~netmask); - - memset(&stats, 0, sizeof(stats)); - rte_eth_stats_get(p->pmd_id, &stats); - - mac_addr = (struct ether_addr *) &p->mac_addr; - - if (strlen(p->pci_bdf)) - printf("%s(%s): flags=<%s>\n", - p->name, - p->pci_bdf, - (p->state) ? "UP" : "DOWN"); - else - printf("%s: flags=<%s>\n", - p->name, - (p->state) ? "UP" : "DOWN"); - - if (p->ip) - printf("\tinet %" PRIu32 ".%" PRIu32 - ".%" PRIu32 ".%" PRIu32 - " netmask %" PRIu32 ".%" PRIu32 - ".%" PRIu32 ".%" PRIu32 " " - "broadcast %" PRIu32 ".%" PRIu32 - ".%" PRIu32 ".%" PRIu32 "\n", - (p->ip >> 24) & 0xFF, - (p->ip >> 16) & 0xFF, - (p->ip >> 8) & 0xFF, - p->ip & 0xFF, - (netmask >> 24) & 0xFF, - (netmask >> 16) & 0xFF, - (netmask >> 8) & 0xFF, - netmask & 0xFF, - (bcast >> 24) & 0xFF, - (bcast >> 16) & 0xFF, - (bcast >> 8) & 0xFF, - bcast & 0xFF); - - printf("\tether %02" PRIx32 ":%02" PRIx32 ":%02" PRIx32 - ":%02" PRIx32 ":%02" PRIx32 ":%02" PRIx32 "\n", - mac_addr->addr_bytes[0], - mac_addr->addr_bytes[1], - mac_addr->addr_bytes[2], - mac_addr->addr_bytes[3], - mac_addr->addr_bytes[4], - mac_addr->addr_bytes[5]); - - printf("\tRX packets %" PRIu64 - " bytes %" PRIu64 - "\n", - stats.ipackets, - stats.ibytes); - - printf("\tRX errors %" PRIu64 - " missed %" PRIu64 - " no-mbuf %" PRIu64 - "\n", - stats.ierrors, - stats.imissed, - stats.rx_nombuf); - - printf("\tTX packets %" PRIu64 - " bytes %" PRIu64 "\n", - stats.opackets, - stats.obytes); - - printf("\tTX errors %" PRIu64 - "\n", - stats.oerrors); - - printf("\n"); -} - -/* - * link - * - * link config: - * link config - * - * link up: - * link up - * - * link down: - * link down - * - * link ls: - * link ls - */ - -struct cmd_link_result { - cmdline_fixed_string_t link_string; - cmdline_multi_string_t multi_string; -}; - -static void -cmd_link_parsed( - void *parsed_result, - __attribute__((unused)) struct cmdline *cl, - void *data) -{ - struct cmd_link_result *params = parsed_result; - struct app_params *app = data; - - char *tokens[16]; - uint32_t n_tokens = RTE_DIM(tokens); - int status; - - uint32_t link_id; - - status = parse_tokenize_string(params->multi_string, tokens, &n_tokens); - if (status != 0) { - printf(CMD_MSG_TOO_MANY_ARGS, "link"); - return; - } - - /* link ls */ - if ((n_tokens == 1) && (strcmp(tokens[0], "ls") == 0)) { - for (link_id = 0; link_id < app->n_links; link_id++) { - struct app_link_params *p; - - APP_PARAM_FIND_BY_ID(app->link_params, "LINK", link_id, p); - print_link_info(p); - } - return; - } /* link ls */ - - if (n_tokens < 2) { - printf(CMD_MSG_MISMATCH_ARGS, "link"); - return; - } - - if (parser_read_uint32(&link_id, tokens[0])) { - printf(CMD_MSG_INVALID_ARG, "linkid"); - return; - } - - /* link config */ - if (strcmp(tokens[1], "config") == 0) { - struct in_addr ipaddr_ipv4; - uint32_t depth; - - if (n_tokens != 4) { - printf(CMD_MSG_MISMATCH_ARGS, "link config"); - return; - } - - if (parse_ipv4_addr(tokens[2], &ipaddr_ipv4)) { - printf(CMD_MSG_INVALID_ARG, "ipaddr"); - return; - } - - if (parser_read_uint32(&depth, tokens[3])) { - printf(CMD_MSG_INVALID_ARG, "depth"); - return; - } - - status = app_link_config(app, - link_id, - rte_be_to_cpu_32(ipaddr_ipv4.s_addr), - depth); - if (status) - printf(CMD_MSG_FAIL, "link config"); - - return; - } /* link config */ - - /* link up */ - if (strcmp(tokens[1], "up") == 0) { - if (n_tokens != 2) { - printf(CMD_MSG_MISMATCH_ARGS, "link up"); - return; - } - - status = app_link_up(app, link_id); - if (status) - printf(CMD_MSG_FAIL, "link up"); - - return; - } /* link up */ - - /* link down */ - if (strcmp(tokens[1], "down") == 0) { - if (n_tokens != 2) { - printf(CMD_MSG_MISMATCH_ARGS, "link down"); - return; - } - - status = app_link_down(app, link_id); - if (status) - printf(CMD_MSG_FAIL, "link down"); - - return; - } /* link down */ - - printf(CMD_MSG_MISMATCH_ARGS, "link"); -} - -static cmdline_parse_token_string_t cmd_link_link_string = - TOKEN_STRING_INITIALIZER(struct cmd_link_result, link_string, "link"); - -static cmdline_parse_token_string_t cmd_link_multi_string = - TOKEN_STRING_INITIALIZER(struct cmd_link_result, multi_string, - TOKEN_STRING_MULTI); - -static cmdline_parse_inst_t cmd_link = { - .f = cmd_link_parsed, - .data = NULL, - .help_str = "link config / up / down / ls", - .tokens = { - (void *) &cmd_link_link_string, - (void *) &cmd_link_multi_string, - NULL, - }, -}; - -/* - * quit - */ - -struct cmd_quit_result { - cmdline_fixed_string_t quit; -}; - -static void -cmd_quit_parsed( - __rte_unused void *parsed_result, - struct cmdline *cl, - __rte_unused void *data) -{ - cmdline_quit(cl); -} - -static cmdline_parse_token_string_t cmd_quit_quit = - TOKEN_STRING_INITIALIZER(struct cmd_quit_result, quit, "quit"); - -static cmdline_parse_inst_t cmd_quit = { - .f = cmd_quit_parsed, - .data = NULL, - .help_str = "Quit", - .tokens = { - (void *) &cmd_quit_quit, - NULL, - }, -}; - -/* - * run - * - * run - * run [ []] - default is 1 - * is measured in milliseconds, default is 1 second - */ - -static void -app_run_file( - cmdline_parse_ctx_t *ctx, - const char *file_name) -{ - struct cmdline *file_cl; - int fd; - - fd = open(file_name, O_RDONLY); - if (fd < 0) { - printf("Cannot open file \"%s\"\n", file_name); - return; - } - - file_cl = cmdline_new(ctx, "", fd, 1); - cmdline_interact(file_cl); - close(fd); -} - -struct cmd_run_result { - cmdline_fixed_string_t run_string; - cmdline_multi_string_t multi_string; -}; - -static void -cmd_run_parsed( - void *parsed_result, - struct cmdline *cl, - __attribute__((unused)) void *data) -{ - struct cmd_run_result *params = parsed_result; - - char *tokens[16]; - uint32_t n_tokens = RTE_DIM(tokens); - int status; - - char *file_name; - uint32_t count, interval, i; - - status = parse_tokenize_string(params->multi_string, tokens, &n_tokens); - if (status) { - printf(CMD_MSG_TOO_MANY_ARGS, "run"); - return; - } - - switch (n_tokens) { - case 0: - printf(CMD_MSG_NOT_ENOUGH_ARGS, "run"); - return; - - case 1: - file_name = tokens[0]; - count = 1; - interval = 1000; - break; - - case 2: - file_name = tokens[0]; - - if (parser_read_uint32(&count, tokens[1]) || - (count == 0)) { - printf(CMD_MSG_INVALID_ARG, "count"); - return; - } - - interval = 1000; - break; - - case 3: - file_name = tokens[0]; - - if (parser_read_uint32(&count, tokens[1]) || - (count == 0)) { - printf(CMD_MSG_INVALID_ARG, "count"); - return; - } - - if (parser_read_uint32(&interval, tokens[2]) || - (interval == 0)) { - printf(CMD_MSG_INVALID_ARG, "interval"); - return; - } - break; - - default: - printf(CMD_MSG_MISMATCH_ARGS, "run"); - return; - } - - for (i = 0; i < count; i++) { - app_run_file(cl->ctx, file_name); - if (interval) - usleep(interval * 1000); - } -} - -static cmdline_parse_token_string_t cmd_run_run_string = - TOKEN_STRING_INITIALIZER(struct cmd_run_result, run_string, "run"); - -static cmdline_parse_token_string_t cmd_run_multi_string = - TOKEN_STRING_INITIALIZER(struct cmd_run_result, multi_string, - TOKEN_STRING_MULTI); - - -static cmdline_parse_inst_t cmd_run = { - .f = cmd_run_parsed, - .data = NULL, - .help_str = "Run CLI script file", - .tokens = { - (void *) &cmd_run_run_string, - (void *) &cmd_run_multi_string, - NULL, - }, -}; - -static cmdline_parse_ctx_t pipeline_common_cmds[] = { - (cmdline_parse_inst_t *) &cmd_quit, - (cmdline_parse_inst_t *) &cmd_run, - (cmdline_parse_inst_t *) &cmd_link, - (cmdline_parse_inst_t *) &cmd_ping, - (cmdline_parse_inst_t *) &cmd_stats_port_in, - (cmdline_parse_inst_t *) &cmd_stats_port_out, - (cmdline_parse_inst_t *) &cmd_stats_table, - (cmdline_parse_inst_t *) &cmd_port_in_enable, - (cmdline_parse_inst_t *) &cmd_port_in_disable, - NULL, -}; - -int -app_pipeline_common_cmd_push(struct app_params *app) -{ - uint32_t n_cmds, i; - - /* Check for available slots in the application commands array */ - n_cmds = RTE_DIM(pipeline_common_cmds) - 1; - if (n_cmds > APP_MAX_CMDS - app->n_cmds) - return -ENOMEM; - - /* Push pipeline commands into the application */ - memcpy(&app->cmds[app->n_cmds], - pipeline_common_cmds, - n_cmds * sizeof(cmdline_parse_ctx_t)); - - for (i = 0; i < n_cmds; i++) - app->cmds[app->n_cmds + i]->data = app; - - app->n_cmds += n_cmds; - app->cmds[app->n_cmds] = NULL; - - return 0; -} diff --git a/examples/ip_pipeline/pipeline/pipeline_common_fe.h b/examples/ip_pipeline/pipeline/pipeline_common_fe.h deleted file mode 100644 index 7227544f6c..0000000000 --- a/examples/ip_pipeline/pipeline/pipeline_common_fe.h +++ /dev/null @@ -1,231 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2010-2015 Intel Corporation - */ - -#ifndef __INCLUDE_PIPELINE_COMMON_FE_H__ -#define __INCLUDE_PIPELINE_COMMON_FE_H__ - -#include -#include -#include -#include - -#include "pipeline_common_be.h" -#include "pipeline.h" -#include "app.h" - -#ifndef MSG_TIMEOUT_DEFAULT -#define MSG_TIMEOUT_DEFAULT 1000 -#endif - -static inline struct app_pipeline_data * -app_pipeline_data(struct app_params *app, uint32_t id) -{ - struct app_pipeline_params *params; - - APP_PARAM_FIND_BY_ID(app->pipeline_params, "PIPELINE", id, params); - if (params == NULL) - return NULL; - - return &app->pipeline_data[params - app->pipeline_params]; -} - -static inline void * -app_pipeline_data_fe(struct app_params *app, uint32_t id, struct pipeline_type *ptype) -{ - struct app_pipeline_data *pipeline_data; - - pipeline_data = app_pipeline_data(app, id); - if (pipeline_data == NULL) - return NULL; - - if (strcmp(pipeline_data->ptype->name, ptype->name) != 0) - return NULL; - - if (pipeline_data->enabled == 0) - return NULL; - - return pipeline_data->fe; -} - -static inline struct rte_ring * -app_pipeline_msgq_in_get(struct app_params *app, - uint32_t pipeline_id) -{ - struct app_msgq_params *p; - - APP_PARAM_FIND_BY_ID(app->msgq_params, - "MSGQ-REQ-PIPELINE", - pipeline_id, - p); - if (p == NULL) - return NULL; - - return app->msgq[p - app->msgq_params]; -} - -static inline struct rte_ring * -app_pipeline_msgq_out_get(struct app_params *app, - uint32_t pipeline_id) -{ - struct app_msgq_params *p; - - APP_PARAM_FIND_BY_ID(app->msgq_params, - "MSGQ-RSP-PIPELINE", - pipeline_id, - p); - if (p == NULL) - return NULL; - - return app->msgq[p - app->msgq_params]; -} - -static inline void * -app_msg_alloc(__rte_unused struct app_params *app) -{ - return rte_malloc(NULL, 2048, RTE_CACHE_LINE_SIZE); -} - -static inline void -app_msg_free(__rte_unused struct app_params *app, - void *msg) -{ - rte_free(msg); -} - -static inline void -app_msg_send(struct app_params *app, - uint32_t pipeline_id, - void *msg) -{ - struct rte_ring *r = app_pipeline_msgq_in_get(app, pipeline_id); - int status; - - do { - status = rte_ring_sp_enqueue(r, msg); - } while (status == -ENOBUFS); -} - -static inline void * -app_msg_recv(struct app_params *app, - uint32_t pipeline_id) -{ - struct rte_ring *r = app_pipeline_msgq_out_get(app, pipeline_id); - void *msg; - int status = rte_ring_sc_dequeue(r, &msg); - - if (status != 0) - return NULL; - - return msg; -} - -static inline void * -app_msg_send_recv(struct app_params *app, - uint32_t pipeline_id, - void *msg, - uint32_t timeout_ms) -{ - struct rte_ring *r_req = app_pipeline_msgq_in_get(app, pipeline_id); - struct rte_ring *r_rsp = app_pipeline_msgq_out_get(app, pipeline_id); - uint64_t hz = rte_get_tsc_hz(); - void *msg_recv; - uint64_t deadline; - int status; - - /* send */ - do { - status = rte_ring_sp_enqueue(r_req, (void *) msg); - } while (status == -ENOBUFS); - - /* recv */ - deadline = (timeout_ms) ? - (rte_rdtsc() + ((hz * timeout_ms) / 1000)) : - UINT64_MAX; - - do { - if (rte_rdtsc() > deadline) - return NULL; - - status = rte_ring_sc_dequeue(r_rsp, &msg_recv); - } while (status != 0); - - return msg_recv; -} - -struct app_link_params * -app_pipeline_track_pktq_out_to_link(struct app_params *app, - uint32_t pipeline_id, - uint32_t pktq_out_id); - -int -app_pipeline_track_default(struct pipeline_params *params, - uint32_t port_in, - uint32_t *port_out); - -int -app_pipeline_ping(struct app_params *app, - uint32_t pipeline_id); - -int -app_pipeline_stats_port_in(struct app_params *app, - uint32_t pipeline_id, - uint32_t port_id, - struct rte_pipeline_port_in_stats *stats); - -int -app_pipeline_stats_port_out(struct app_params *app, - uint32_t pipeline_id, - uint32_t port_id, - struct rte_pipeline_port_out_stats *stats); - -int -app_pipeline_stats_table(struct app_params *app, - uint32_t pipeline_id, - uint32_t table_id, - struct rte_pipeline_table_stats *stats); - -int -app_pipeline_port_in_enable(struct app_params *app, - uint32_t pipeline_id, - uint32_t port_id); - -int -app_pipeline_port_in_disable(struct app_params *app, - uint32_t pipeline_id, - uint32_t port_id); - -int -app_link_set_op(struct app_params *app, - uint32_t link_id, - uint32_t pipeline_id, - app_link_op op, - void *arg); - -int -app_link_config(struct app_params *app, - uint32_t link_id, - uint32_t ip, - uint32_t depth); - -int -app_link_up(struct app_params *app, - uint32_t link_id); - -int -app_link_down(struct app_params *app, - uint32_t link_id); - -int -app_pipeline_common_cmd_push(struct app_params *app); - -#define CMD_MSG_OUT_OF_MEMORY "Not enough memory\n" -#define CMD_MSG_NOT_ENOUGH_ARGS "Not enough arguments for command \"%s\"\n" -#define CMD_MSG_TOO_MANY_ARGS "Too many arguments for command \"%s\"\n" -#define CMD_MSG_MISMATCH_ARGS "Incorrect set of arguments for command \"%s\"\n" -#define CMD_MSG_INVALID_ARG "Invalid value for argument \"%s\"\n" -#define CMD_MSG_ARG_NOT_FOUND "Syntax error: \"%s\" not found\n" -#define CMD_MSG_FILE_ERR "Error in file \"%s\" at line %u\n" -#define CMD_MSG_FAIL "Command \"%s\" failed\n" - -#endif diff --git a/examples/ip_pipeline/pipeline/pipeline_master.c b/examples/ip_pipeline/pipeline/pipeline_master.c deleted file mode 100644 index b0d730a6ae..0000000000 --- a/examples/ip_pipeline/pipeline/pipeline_master.c +++ /dev/null @@ -1,20 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2010-2015 Intel Corporation - */ - -#include "pipeline_master.h" -#include "pipeline_master_be.h" - -static struct pipeline_fe_ops pipeline_master_fe_ops = { - .f_init = NULL, - .f_post_init = NULL, - .f_free = NULL, - .f_track = NULL, - .cmds = NULL, -}; - -struct pipeline_type pipeline_master = { - .name = "MASTER", - .be_ops = &pipeline_master_be_ops, - .fe_ops = &pipeline_master_fe_ops, -}; diff --git a/examples/ip_pipeline/pipeline/pipeline_master.h b/examples/ip_pipeline/pipeline/pipeline_master.h deleted file mode 100644 index a5183e33cc..0000000000 --- a/examples/ip_pipeline/pipeline/pipeline_master.h +++ /dev/null @@ -1,12 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2010-2015 Intel Corporation - */ - -#ifndef __INCLUDE_PIPELINE_MASTER_H__ -#define __INCLUDE_PIPELINE_MASTER_H__ - -#include "pipeline.h" - -extern struct pipeline_type pipeline_master; - -#endif diff --git a/examples/ip_pipeline/pipeline/pipeline_master_be.c b/examples/ip_pipeline/pipeline/pipeline_master_be.c deleted file mode 100644 index c72038eac2..0000000000 --- a/examples/ip_pipeline/pipeline/pipeline_master_be.c +++ /dev/null @@ -1,141 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2010-2015 Intel Corporation - */ - -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include "app.h" -#include "pipeline_master_be.h" - -struct pipeline_master { - struct app_params *app; - struct cmdline *cl; - int post_init_done; - int script_file_done; -} __rte_cache_aligned; - -static void* -pipeline_init(__rte_unused struct pipeline_params *params, void *arg) -{ - struct app_params *app = (struct app_params *) arg; - struct pipeline_master *p; - uint32_t size; - - /* Check input arguments */ - if (app == NULL) - return NULL; - - /* Memory allocation */ - size = RTE_CACHE_LINE_ROUNDUP(sizeof(struct pipeline_master)); - p = rte_zmalloc(NULL, size, RTE_CACHE_LINE_SIZE); - if (p == NULL) - return NULL; - - /* Initialization */ - p->app = app; - - p->cl = cmdline_stdin_new(app->cmds, "pipeline> "); - if (p->cl == NULL) { - rte_free(p); - return NULL; - } - - p->post_init_done = 0; - p->script_file_done = 0; - if (app->script_file == NULL) - p->script_file_done = 1; - - return (void *) p; -} - -static int -pipeline_free(void *pipeline) -{ - struct pipeline_master *p = (struct pipeline_master *) pipeline; - - if (p == NULL) - return -EINVAL; - - cmdline_stdin_exit(p->cl); - rte_free(p); - - return 0; -} - -static int -pipeline_run(void *pipeline) -{ - struct pipeline_master *p = (struct pipeline_master *) pipeline; - struct app_params *app = p->app; - int status; -#ifdef RTE_LIBRTE_KNI - uint32_t i; -#endif /* RTE_LIBRTE_KNI */ - - /* Application post-init phase */ - if (p->post_init_done == 0) { - app_post_init(app); - - p->post_init_done = 1; - } - - /* Run startup script file */ - if (p->script_file_done == 0) { - struct app_params *app = p->app; - int fd = open(app->script_file, O_RDONLY); - - if (fd < 0) - printf("Cannot open CLI script file \"%s\"\n", - app->script_file); - else { - struct cmdline *file_cl; - - printf("Running CLI script file \"%s\" ...\n", - app->script_file); - file_cl = cmdline_new(p->cl->ctx, "", fd, 1); - cmdline_interact(file_cl); - close(fd); - } - - p->script_file_done = 1; - } - - /* Command Line Interface (CLI) */ - status = cmdline_poll(p->cl); - if (status < 0) - rte_panic("CLI poll error (%" PRId32 ")\n", status); - else if (status == RDLINE_EXITED) { - cmdline_stdin_exit(p->cl); - rte_exit(0, "Bye!\n"); - } - -#ifdef RTE_LIBRTE_KNI - /* Handle KNI requests from Linux kernel */ - for (i = 0; i < app->n_pktq_kni; i++) - rte_kni_handle_request(app->kni[i]); -#endif /* RTE_LIBRTE_KNI */ - - return 0; -} - -static int -pipeline_timer(__rte_unused void *pipeline) -{ - return 0; -} - -struct pipeline_be_ops pipeline_master_be_ops = { - .f_init = pipeline_init, - .f_free = pipeline_free, - .f_run = pipeline_run, - .f_timer = pipeline_timer, -}; diff --git a/examples/ip_pipeline/pipeline/pipeline_master_be.h b/examples/ip_pipeline/pipeline/pipeline_master_be.h deleted file mode 100644 index 847c564c06..0000000000 --- a/examples/ip_pipeline/pipeline/pipeline_master_be.h +++ /dev/null @@ -1,12 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2010-2015 Intel Corporation - */ - -#ifndef __INCLUDE_PIPELINE_MASTER_BE_H__ -#define __INCLUDE_PIPELINE_MASTER_BE_H__ - -#include "pipeline_common_be.h" - -extern struct pipeline_be_ops pipeline_master_be_ops; - -#endif diff --git a/examples/ip_pipeline/thread.c b/examples/ip_pipeline/thread.c index 9013afd149..a36bf92115 100644 --- a/examples/ip_pipeline/thread.c +++ b/examples/ip_pipeline/thread.c @@ -6,47 +6,9 @@ #include #include -#include "pipeline_common_be.h" #include "app.h" #include "thread.h" -#if APP_THREAD_HEADROOM_STATS_COLLECT - -#define PIPELINE_RUN_REGULAR(thread, pipeline) \ -do { \ - uint64_t t0 = rte_rdtsc_precise(); \ - int n_pkts = rte_pipeline_run(pipeline->p); \ - \ - if (n_pkts == 0) { \ - uint64_t t1 = rte_rdtsc_precise(); \ - \ - thread->headroom_cycles += t1 - t0; \ - } \ -} while (0) - - -#define PIPELINE_RUN_CUSTOM(thread, data) \ -do { \ - uint64_t t0 = rte_rdtsc_precise(); \ - int n_pkts = data->f_run(data->be); \ - \ - if (n_pkts == 0) { \ - uint64_t t1 = rte_rdtsc_precise(); \ - \ - thread->headroom_cycles += t1 - t0; \ - } \ -} while (0) - -#else - -#define PIPELINE_RUN_REGULAR(thread, pipeline) \ - rte_pipeline_run(pipeline->p) - -#define PIPELINE_RUN_CUSTOM(thread, data) \ - data->f_run(data->be) - -#endif - static inline void * thread_msg_recv(struct rte_ring *r) { @@ -214,21 +176,6 @@ app_thread(void *arg) uint32_t n_regular = RTE_MIN(t->n_regular, RTE_DIM(t->regular)); uint32_t n_custom = RTE_MIN(t->n_custom, RTE_DIM(t->custom)); - /* Run regular pipelines */ - for (j = 0; j < n_regular; j++) { - struct app_thread_pipeline_data *data = &t->regular[j]; - struct pipeline *p = data->be; - - PIPELINE_RUN_REGULAR(t, p); - } - - /* Run custom pipelines */ - for (j = 0; j < n_custom; j++) { - struct app_thread_pipeline_data *data = &t->custom[j]; - - PIPELINE_RUN_CUSTOM(t, data); - } - /* Timer */ if ((i & 0xF) == 0) { uint64_t time = rte_get_tsc_cycles(); diff --git a/examples/ip_pipeline/thread_fe.c b/examples/ip_pipeline/thread_fe.c deleted file mode 100644 index 4590c2b58d..0000000000 --- a/examples/ip_pipeline/thread_fe.c +++ /dev/null @@ -1,457 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include "thread.h" -#include "thread_fe.h" -#include "pipeline.h" -#include "pipeline_common_fe.h" -#include "app.h" - -static inline void * -thread_msg_send_recv(struct app_params *app, - uint32_t socket_id, uint32_t core_id, uint32_t ht_id, - void *msg, - uint32_t timeout_ms) -{ - struct rte_ring *r_req = app_thread_msgq_in_get(app, - socket_id, core_id, ht_id); - struct rte_ring *r_rsp = app_thread_msgq_out_get(app, - socket_id, core_id, ht_id); - uint64_t hz = rte_get_tsc_hz(); - void *msg_recv; - uint64_t deadline; - int status; - - /* send */ - do { - status = rte_ring_sp_enqueue(r_req, (void *) msg); - } while (status == -ENOBUFS); - - /* recv */ - deadline = (timeout_ms) ? - (rte_rdtsc() + ((hz * timeout_ms) / 1000)) : - UINT64_MAX; - - do { - if (rte_rdtsc() > deadline) - return NULL; - - status = rte_ring_sc_dequeue(r_rsp, &msg_recv); - } while (status != 0); - - return msg_recv; -} - -int -app_pipeline_enable(struct app_params *app, - uint32_t socket_id, - uint32_t core_id, - uint32_t hyper_th_id, - uint32_t pipeline_id) -{ - struct thread_pipeline_enable_msg_req *req; - struct thread_pipeline_enable_msg_rsp *rsp; - int thread_id; - struct app_pipeline_data *p; - struct app_pipeline_params *p_params; - struct pipeline_type *p_type; - int status; - - if (app == NULL) - return -1; - - thread_id = cpu_core_map_get_lcore_id(app->core_map, - socket_id, - core_id, - hyper_th_id); - - if ((thread_id < 0) || !app_core_is_enabled(app, thread_id)) - return -1; - - if (app_pipeline_data(app, pipeline_id) == NULL) - return -1; - - p = &app->pipeline_data[pipeline_id]; - p_params = &app->pipeline_params[pipeline_id]; - p_type = app_pipeline_type_find(app, p_params->type); - - if (p_type == NULL) - return -1; - - if (p->enabled == 1) - return -1; - - req = app_msg_alloc(app); - if (req == NULL) - return -1; - - req->type = THREAD_MSG_REQ_PIPELINE_ENABLE; - req->pipeline_id = pipeline_id; - req->be = p->be; - req->f_run = p_type->be_ops->f_run; - req->f_timer = p_type->be_ops->f_timer; - req->timer_period = p->timer_period; - - rsp = thread_msg_send_recv(app, - socket_id, core_id, hyper_th_id, req, MSG_TIMEOUT_DEFAULT); - if (rsp == NULL) - return -1; - - status = rsp->status; - app_msg_free(app, rsp); - - if (status != 0) - return -1; - - p->enabled = 1; - return 0; -} - -int -app_pipeline_disable(struct app_params *app, - uint32_t socket_id, - uint32_t core_id, - uint32_t hyper_th_id, - uint32_t pipeline_id) -{ - struct thread_pipeline_disable_msg_req *req; - struct thread_pipeline_disable_msg_rsp *rsp; - int thread_id; - struct app_pipeline_data *p; - int status; - - if (app == NULL) - return -1; - - thread_id = cpu_core_map_get_lcore_id(app->core_map, - socket_id, - core_id, - hyper_th_id); - - if ((thread_id < 0) || !app_core_is_enabled(app, thread_id)) - return -1; - - if (app_pipeline_data(app, pipeline_id) == NULL) - return -1; - - p = &app->pipeline_data[pipeline_id]; - - if (p->enabled == 0) - return -1; - - req = app_msg_alloc(app); - if (req == NULL) - return -1; - - req->type = THREAD_MSG_REQ_PIPELINE_DISABLE; - req->pipeline_id = pipeline_id; - - rsp = thread_msg_send_recv(app, - socket_id, core_id, hyper_th_id, req, MSG_TIMEOUT_DEFAULT); - - if (rsp == NULL) - return -1; - - status = rsp->status; - app_msg_free(app, rsp); - - if (status != 0) - return -1; - - p->enabled = 0; - return 0; -} - -int -app_thread_headroom(struct app_params *app, - uint32_t socket_id, - uint32_t core_id, - uint32_t hyper_th_id) -{ - struct thread_headroom_read_msg_req *req; - struct thread_headroom_read_msg_rsp *rsp; - int thread_id; - int status; - - if (app == NULL) - return -1; - - thread_id = cpu_core_map_get_lcore_id(app->core_map, - socket_id, - core_id, - hyper_th_id); - - if ((thread_id < 0) || !app_core_is_enabled(app, thread_id)) - return -1; - - req = app_msg_alloc(app); - if (req == NULL) - return -1; - - req->type = THREAD_MSG_REQ_HEADROOM_READ; - - rsp = thread_msg_send_recv(app, - socket_id, core_id, hyper_th_id, req, MSG_TIMEOUT_DEFAULT); - - if (rsp == NULL) - return -1; - - status = rsp->status; - - if (status != 0) - return -1; - - printf("%.3f%%\n", rsp->headroom_ratio * 100); - - - app_msg_free(app, rsp); - - return 0; -} - -/* - * pipeline enable - */ - -struct cmd_pipeline_enable_result { - cmdline_fixed_string_t t_string; - cmdline_fixed_string_t t_id_string; - cmdline_fixed_string_t pipeline_string; - uint32_t pipeline_id; - cmdline_fixed_string_t enable_string; -}; - -static void -cmd_pipeline_enable_parsed( - void *parsed_result, - __rte_unused struct cmdline *cl, - void *data) -{ - struct cmd_pipeline_enable_result *params = parsed_result; - struct app_params *app = data; - int status; - uint32_t core_id, socket_id, hyper_th_id; - - if (parse_pipeline_core(&socket_id, - &core_id, - &hyper_th_id, - params->t_id_string) != 0) { - printf("Command failed\n"); - return; - } - - status = app_pipeline_enable(app, - socket_id, - core_id, - hyper_th_id, - params->pipeline_id); - - if (status != 0) - printf("Command failed\n"); -} - -static cmdline_parse_token_string_t cmd_pipeline_enable_t_string = - TOKEN_STRING_INITIALIZER(struct cmd_pipeline_enable_result, t_string, "t"); - -static cmdline_parse_token_string_t cmd_pipeline_enable_t_id_string = - TOKEN_STRING_INITIALIZER(struct cmd_pipeline_enable_result, t_id_string, - NULL); - -static cmdline_parse_token_string_t cmd_pipeline_enable_pipeline_string = - TOKEN_STRING_INITIALIZER(struct cmd_pipeline_enable_result, pipeline_string, - "pipeline"); - -static cmdline_parse_token_num_t cmd_pipeline_enable_pipeline_id = - TOKEN_NUM_INITIALIZER(struct cmd_pipeline_enable_result, pipeline_id, - UINT32); - -static cmdline_parse_token_string_t cmd_pipeline_enable_enable_string = - TOKEN_STRING_INITIALIZER(struct cmd_pipeline_enable_result, enable_string, - "enable"); - -static cmdline_parse_inst_t cmd_pipeline_enable = { - .f = cmd_pipeline_enable_parsed, - .data = NULL, - .help_str = "Enable pipeline on specified core", - .tokens = { - (void *)&cmd_pipeline_enable_t_string, - (void *)&cmd_pipeline_enable_t_id_string, - (void *)&cmd_pipeline_enable_pipeline_string, - (void *)&cmd_pipeline_enable_pipeline_id, - (void *)&cmd_pipeline_enable_enable_string, - NULL, - }, -}; - -/* - * pipeline disable - */ - -struct cmd_pipeline_disable_result { - cmdline_fixed_string_t t_string; - cmdline_fixed_string_t t_id_string; - cmdline_fixed_string_t pipeline_string; - uint32_t pipeline_id; - cmdline_fixed_string_t disable_string; -}; - -static void -cmd_pipeline_disable_parsed( - void *parsed_result, - __rte_unused struct cmdline *cl, - void *data) -{ - struct cmd_pipeline_disable_result *params = parsed_result; - struct app_params *app = data; - int status; - uint32_t core_id, socket_id, hyper_th_id; - - if (parse_pipeline_core(&socket_id, - &core_id, - &hyper_th_id, - params->t_id_string) != 0) { - printf("Command failed\n"); - return; - } - - status = app_pipeline_disable(app, - socket_id, - core_id, - hyper_th_id, - params->pipeline_id); - - if (status != 0) - printf("Command failed\n"); -} - -static cmdline_parse_token_string_t cmd_pipeline_disable_t_string = - TOKEN_STRING_INITIALIZER(struct cmd_pipeline_disable_result, t_string, "t"); - -static cmdline_parse_token_string_t cmd_pipeline_disable_t_id_string = - TOKEN_STRING_INITIALIZER(struct cmd_pipeline_disable_result, t_id_string, - NULL); - -static cmdline_parse_token_string_t cmd_pipeline_disable_pipeline_string = - TOKEN_STRING_INITIALIZER(struct cmd_pipeline_disable_result, - pipeline_string, "pipeline"); - -static cmdline_parse_token_num_t cmd_pipeline_disable_pipeline_id = - TOKEN_NUM_INITIALIZER(struct cmd_pipeline_disable_result, pipeline_id, - UINT32); - -static cmdline_parse_token_string_t cmd_pipeline_disable_disable_string = - TOKEN_STRING_INITIALIZER(struct cmd_pipeline_disable_result, disable_string, - "disable"); - -static cmdline_parse_inst_t cmd_pipeline_disable = { - .f = cmd_pipeline_disable_parsed, - .data = NULL, - .help_str = "Disable pipeline on specified core", - .tokens = { - (void *)&cmd_pipeline_disable_t_string, - (void *)&cmd_pipeline_disable_t_id_string, - (void *)&cmd_pipeline_disable_pipeline_string, - (void *)&cmd_pipeline_disable_pipeline_id, - (void *)&cmd_pipeline_disable_disable_string, - NULL, - }, -}; - - -/* - * thread headroom - */ - -struct cmd_thread_headroom_result { - cmdline_fixed_string_t t_string; - cmdline_fixed_string_t t_id_string; - cmdline_fixed_string_t headroom_string; -}; - -static void -cmd_thread_headroom_parsed( - void *parsed_result, - __rte_unused struct cmdline *cl, - void *data) -{ - struct cmd_thread_headroom_result *params = parsed_result; - struct app_params *app = data; - int status; - uint32_t core_id, socket_id, hyper_th_id; - - if (parse_pipeline_core(&socket_id, - &core_id, - &hyper_th_id, - params->t_id_string) != 0) { - printf("Command failed\n"); - return; - } - - status = app_thread_headroom(app, - socket_id, - core_id, - hyper_th_id); - - if (status != 0) - printf("Command failed\n"); -} - -static cmdline_parse_token_string_t cmd_thread_headroom_t_string = - TOKEN_STRING_INITIALIZER(struct cmd_thread_headroom_result, - t_string, "t"); - -static cmdline_parse_token_string_t cmd_thread_headroom_t_id_string = - TOKEN_STRING_INITIALIZER(struct cmd_thread_headroom_result, - t_id_string, NULL); - -static cmdline_parse_token_string_t cmd_thread_headroom_headroom_string = - TOKEN_STRING_INITIALIZER(struct cmd_thread_headroom_result, - headroom_string, "headroom"); - -static cmdline_parse_inst_t cmd_thread_headroom = { - .f = cmd_thread_headroom_parsed, - .data = NULL, - .help_str = "Display thread headroom", - .tokens = { - (void *)&cmd_thread_headroom_t_string, - (void *)&cmd_thread_headroom_t_id_string, - (void *)&cmd_thread_headroom_headroom_string, - NULL, - }, -}; - - -static cmdline_parse_ctx_t thread_cmds[] = { - (cmdline_parse_inst_t *) &cmd_pipeline_enable, - (cmdline_parse_inst_t *) &cmd_pipeline_disable, - (cmdline_parse_inst_t *) &cmd_thread_headroom, - NULL, -}; - -int -app_pipeline_thread_cmd_push(struct app_params *app) -{ - uint32_t n_cmds, i; - - /* Check for available slots in the application commands array */ - n_cmds = RTE_DIM(thread_cmds) - 1; - if (n_cmds > APP_MAX_CMDS - app->n_cmds) - return -ENOMEM; - - /* Push thread commands into the application */ - memcpy(&app->cmds[app->n_cmds], thread_cmds, - n_cmds * sizeof(cmdline_parse_ctx_t)); - - for (i = 0; i < n_cmds; i++) - app->cmds[app->n_cmds + i]->data = app; - - app->n_cmds += n_cmds; - app->cmds[app->n_cmds] = NULL; - - return 0; -} diff --git a/examples/ip_pipeline/thread_fe.h b/examples/ip_pipeline/thread_fe.h deleted file mode 100644 index 056a5e8a91..0000000000 --- a/examples/ip_pipeline/thread_fe.h +++ /dev/null @@ -1,72 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2010-2015 Intel Corporation - */ - -#ifndef THREAD_FE_H_ -#define THREAD_FE_H_ - -static inline struct rte_ring * -app_thread_msgq_in_get(struct app_params *app, - uint32_t socket_id, uint32_t core_id, uint32_t ht_id) -{ - char msgq_name[32]; - ssize_t param_idx; - - snprintf(msgq_name, sizeof(msgq_name), - "MSGQ-REQ-CORE-s%" PRIu32 "c%" PRIu32 "%s", - socket_id, - core_id, - (ht_id) ? "h" : ""); - param_idx = APP_PARAM_FIND(app->msgq_params, msgq_name); - - if (param_idx < 0) - return NULL; - - return app->msgq[param_idx]; -} - -static inline struct rte_ring * -app_thread_msgq_out_get(struct app_params *app, - uint32_t socket_id, uint32_t core_id, uint32_t ht_id) -{ - char msgq_name[32]; - ssize_t param_idx; - - snprintf(msgq_name, sizeof(msgq_name), - "MSGQ-RSP-CORE-s%" PRIu32 "c%" PRIu32 "%s", - socket_id, - core_id, - (ht_id) ? "h" : ""); - param_idx = APP_PARAM_FIND(app->msgq_params, msgq_name); - - if (param_idx < 0) - return NULL; - - return app->msgq[param_idx]; - -} - -int -app_pipeline_thread_cmd_push(struct app_params *app); - -int -app_pipeline_enable(struct app_params *app, - uint32_t core_id, - uint32_t socket_id, - uint32_t hyper_th_id, - uint32_t pipeline_id); - -int -app_pipeline_disable(struct app_params *app, - uint32_t core_id, - uint32_t socket_id, - uint32_t hyper_th_id, - uint32_t pipeline_id); - -int -app_thread_headroom(struct app_params *app, - uint32_t core_id, - uint32_t socket_id, - uint32_t hyper_th_id); - -#endif /* THREAD_FE_H_ */