From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6B95CA0C4B; Thu, 14 Oct 2021 20:28:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EB67240041; Thu, 14 Oct 2021 20:28:43 +0200 (CEST) Received: from mail.anongoth.pl (mail.anongoth.pl [46.248.190.61]) by mails.dpdk.org (Postfix) with ESMTP id C92DE4003C for ; Thu, 14 Oct 2021 19:36:14 +0200 (CEST) Received: from talos.g.anongoth.pl (unknown [192.168.1.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: pkubaj@anongoth.pl) by mail.anongoth.pl (Postfix) with ESMTPSA id 01660F35DD; Thu, 14 Oct 2021 19:36:12 +0200 (CEST) From: Piotr Kubaj To: nicolas.chautru@intel.com, declan.doherty@intel.com, ciara.power@intel.com, beilei.xing@intel.com, haiyue.wang@intel.com, jiawenwu@trustnetic.com, jianwang@trustnetic.com, drc@linux.vnet.ibm.com Cc: dev@dpdk.org, Piotr Kubaj Date: Thu, 14 Oct 2021 19:35:37 +0200 Message-Id: <20211014173537.81806-1-pkubaj@FreeBSD.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Thu, 14 Oct 2021 20:28:42 +0200 Subject: [dpdk-dev] [PATCH] ppc64le: fix build with Clang X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Couple of quite common issues: 1. In rte_cycles.h, sys/platform/ppc.h and __ppc_get_timebase() are only for glibc. 2. In include/rte_atomic.h, the same issue already was encountered on arm64: https://mails.dpdk.org/archives/dev/2019-January/123331.html 3. In rte_altivec.h, defining vector to __vector is necessary. 4. In i40e_rxtx_vec_altivec.c, some type changes from vector unsigned long to vector unsigned int is necessary since clang doesn't support vector unsigned long very well and deprecated it. Signed-off-by: Piotr Kubaj --- app/test-bbdev/test_bbdev_perf.c | 8 +- app/test-bbdev/test_bbdev_vector.c | 336 +++++++++--------- app/test-bbdev/test_bbdev_vector.h | 2 +- .../cperf_test_vector_parsing.c | 114 +++--- .../cperf_test_vector_parsing.h | 2 +- app/test-crypto-perf/cperf_test_verify.c | 8 +- drivers/net/i40e/i40e_rxtx_vec_altivec.c | 36 +- drivers/net/ixgbe/ixgbe_ethdev.c | 24 +- drivers/net/ixgbe/ixgbe_rxtx.c | 10 +- drivers/net/txgbe/txgbe_ethdev.c | 24 +- lib/eal/ppc/include/rte_altivec.h | 3 + lib/eal/ppc/include/rte_atomic.h | 6 +- lib/eal/ppc/include/rte_cycles.h | 8 + 13 files changed, 296 insertions(+), 285 deletions(-) diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c index 469597b8b3..a7d2a7c820 100644 --- a/app/test-bbdev/test_bbdev_perf.c +++ b/app/test-bbdev/test_bbdev_perf.c @@ -566,14 +566,14 @@ create_mempools(struct active_device *ad, int socket_id, static int add_bbdev_dev(uint8_t dev_id, struct rte_bbdev_info *info, - struct test_bbdev_vector *vector) + struct test_bbdev_vector *dpdk_vector) { int ret; unsigned int queue_id; struct rte_bbdev_queue_conf qconf; struct active_device *ad = &active_devs[nb_active_devs]; unsigned int nb_queues; - enum rte_bbdev_op_type op_type = vector->op_type; + enum rte_bbdev_op_type op_type = dpdk_vector->op_type; /* Configure fpga lte fec with PF & VF values * if '-i' flag is set and using fpga device @@ -782,14 +782,14 @@ add_bbdev_dev(uint8_t dev_id, struct rte_bbdev_info *info, static int add_active_device(uint8_t dev_id, struct rte_bbdev_info *info, - struct test_bbdev_vector *vector) + struct test_bbdev_vector *dpdk_vector) { int ret; active_devs[nb_active_devs].driver_name = info->drv.driver_name; active_devs[nb_active_devs].dev_id = dev_id; - ret = add_bbdev_dev(dev_id, info, vector); + ret = add_bbdev_dev(dev_id, info, dpdk_vector); if (ret == TEST_SUCCESS) ++nb_active_devs; return ret; diff --git a/app/test-bbdev/test_bbdev_vector.c b/app/test-bbdev/test_bbdev_vector.c index f020836f88..267b4a4704 100644 --- a/app/test-bbdev/test_bbdev_vector.c +++ b/app/test-bbdev/test_bbdev_vector.c @@ -382,7 +382,7 @@ parse_expected_status(char *tokens, int *status, enum rte_bbdev_op_type op_type) */ static int parse_data_entry(const char *key_token, char *token, - struct test_bbdev_vector *vector, enum op_data_type type, + struct test_bbdev_vector *dpdk_vector, enum op_data_type type, const char *prefix) { int ret; @@ -397,8 +397,8 @@ parse_data_entry(const char *key_token, char *token, return -1; } - op_data = vector->entries[type].segments; - nb_ops = &vector->entries[type].nb_segments; + op_data = dpdk_vector->entries[type].segments; + nb_ops = &dpdk_vector->entries[type].nb_segments; if (*nb_ops >= RTE_BBDEV_TURBO_MAX_CODE_BLOCKS) { printf("Too many segments (code blocks defined): %u, max %d!\n", @@ -433,106 +433,106 @@ parse_data_entry(const char *key_token, char *token, /* parses turbo decoder parameters and assigns to global variable */ static int parse_decoder_params(const char *key_token, char *token, - struct test_bbdev_vector *vector) + struct test_bbdev_vector *dpdk_vector) { int ret = 0, status = 0; uint32_t op_flags = 0; char *err = NULL; - struct rte_bbdev_op_turbo_dec *turbo_dec = &vector->turbo_dec; + struct rte_bbdev_op_turbo_dec *turbo_dec = &dpdk_vector->turbo_dec; /* compare keys */ if (starts_with(key_token, op_data_prefixes[DATA_INPUT])) - ret = parse_data_entry(key_token, token, vector, + ret = parse_data_entry(key_token, token, dpdk_vector, DATA_INPUT, op_data_prefixes[DATA_INPUT]); else if (starts_with(key_token, op_data_prefixes[DATA_SOFT_OUTPUT])) - ret = parse_data_entry(key_token, token, vector, + ret = parse_data_entry(key_token, token, dpdk_vector, DATA_SOFT_OUTPUT, op_data_prefixes[DATA_SOFT_OUTPUT]); else if (starts_with(key_token, op_data_prefixes[DATA_HARD_OUTPUT])) - ret = parse_data_entry(key_token, token, vector, + ret = parse_data_entry(key_token, token, dpdk_vector, DATA_HARD_OUTPUT, op_data_prefixes[DATA_HARD_OUTPUT]); else if (!strcmp(key_token, "e")) { - vector->mask |= TEST_BBDEV_VF_E; + dpdk_vector->mask |= TEST_BBDEV_VF_E; turbo_dec->cb_params.e = (uint32_t) strtoul(token, &err, 0); } else if (!strcmp(key_token, "ea")) { - vector->mask |= TEST_BBDEV_VF_EA; + dpdk_vector->mask |= TEST_BBDEV_VF_EA; turbo_dec->tb_params.ea = (uint32_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "eb")) { - vector->mask |= TEST_BBDEV_VF_EB; + dpdk_vector->mask |= TEST_BBDEV_VF_EB; turbo_dec->tb_params.eb = (uint32_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "k")) { - vector->mask |= TEST_BBDEV_VF_K; + dpdk_vector->mask |= TEST_BBDEV_VF_K; turbo_dec->cb_params.k = (uint16_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "k_pos")) { - vector->mask |= TEST_BBDEV_VF_K_POS; + dpdk_vector->mask |= TEST_BBDEV_VF_K_POS; turbo_dec->tb_params.k_pos = (uint16_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "k_neg")) { - vector->mask |= TEST_BBDEV_VF_K_NEG; + dpdk_vector->mask |= TEST_BBDEV_VF_K_NEG; turbo_dec->tb_params.k_neg = (uint16_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "c")) { - vector->mask |= TEST_BBDEV_VF_C; + dpdk_vector->mask |= TEST_BBDEV_VF_C; turbo_dec->tb_params.c = (uint16_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "c_neg")) { - vector->mask |= TEST_BBDEV_VF_C_NEG; + dpdk_vector->mask |= TEST_BBDEV_VF_C_NEG; turbo_dec->tb_params.c_neg = (uint16_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "cab")) { - vector->mask |= TEST_BBDEV_VF_CAB; + dpdk_vector->mask |= TEST_BBDEV_VF_CAB; turbo_dec->tb_params.cab = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "rv_index")) { - vector->mask |= TEST_BBDEV_VF_RV_INDEX; + dpdk_vector->mask |= TEST_BBDEV_VF_RV_INDEX; turbo_dec->rv_index = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "iter_max")) { - vector->mask |= TEST_BBDEV_VF_ITER_MAX; + dpdk_vector->mask |= TEST_BBDEV_VF_ITER_MAX; turbo_dec->iter_max = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "iter_min")) { - vector->mask |= TEST_BBDEV_VF_ITER_MIN; + dpdk_vector->mask |= TEST_BBDEV_VF_ITER_MIN; turbo_dec->iter_min = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "expected_iter_count")) { - vector->mask |= TEST_BBDEV_VF_EXPECTED_ITER_COUNT; + dpdk_vector->mask |= TEST_BBDEV_VF_EXPECTED_ITER_COUNT; turbo_dec->iter_count = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "ext_scale")) { - vector->mask |= TEST_BBDEV_VF_EXT_SCALE; + dpdk_vector->mask |= TEST_BBDEV_VF_EXT_SCALE; turbo_dec->ext_scale = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "num_maps")) { - vector->mask |= TEST_BBDEV_VF_NUM_MAPS; + dpdk_vector->mask |= TEST_BBDEV_VF_NUM_MAPS; turbo_dec->num_maps = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "r")) { - vector->mask |= TEST_BBDEV_VF_R; + dpdk_vector->mask |= TEST_BBDEV_VF_R; turbo_dec->tb_params.r = (uint8_t)strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "code_block_mode")) { - vector->mask |= TEST_BBDEV_VF_CODE_BLOCK_MODE; + dpdk_vector->mask |= TEST_BBDEV_VF_CODE_BLOCK_MODE; turbo_dec->code_block_mode = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "op_flags")) { - vector->mask |= TEST_BBDEV_VF_OP_FLAGS; + dpdk_vector->mask |= TEST_BBDEV_VF_OP_FLAGS; ret = parse_turbo_flags(token, &op_flags, - vector->op_type); + dpdk_vector->op_type); if (!ret) turbo_dec->op_flags = op_flags; } else if (!strcmp(key_token, "expected_status")) { - vector->mask |= TEST_BBDEV_VF_EXPECTED_STATUS; - ret = parse_expected_status(token, &status, vector->op_type); + dpdk_vector->mask |= TEST_BBDEV_VF_EXPECTED_STATUS; + ret = parse_expected_status(token, &status, dpdk_vector->op_type); if (!ret) - vector->expected_status = status; + dpdk_vector->expected_status = status; } else { printf("Not valid dec key: '%s'\n", key_token); return -1; @@ -549,94 +549,94 @@ parse_decoder_params(const char *key_token, char *token, /* parses turbo encoder parameters and assigns to global variable */ static int parse_encoder_params(const char *key_token, char *token, - struct test_bbdev_vector *vector) + struct test_bbdev_vector *dpdk_vector) { int ret = 0, status = 0; uint32_t op_flags = 0; char *err = NULL; - struct rte_bbdev_op_turbo_enc *turbo_enc = &vector->turbo_enc; + struct rte_bbdev_op_turbo_enc *turbo_enc = &dpdk_vector->turbo_enc; if (starts_with(key_token, op_data_prefixes[DATA_INPUT])) - ret = parse_data_entry(key_token, token, vector, + ret = parse_data_entry(key_token, token, dpdk_vector, DATA_INPUT, op_data_prefixes[DATA_INPUT]); else if (starts_with(key_token, "output")) - ret = parse_data_entry(key_token, token, vector, + ret = parse_data_entry(key_token, token, dpdk_vector, DATA_HARD_OUTPUT, "output"); else if (!strcmp(key_token, "e")) { - vector->mask |= TEST_BBDEV_VF_E; + dpdk_vector->mask |= TEST_BBDEV_VF_E; turbo_enc->cb_params.e = (uint32_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "ea")) { - vector->mask |= TEST_BBDEV_VF_EA; + dpdk_vector->mask |= TEST_BBDEV_VF_EA; turbo_enc->tb_params.ea = (uint32_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "eb")) { - vector->mask |= TEST_BBDEV_VF_EB; + dpdk_vector->mask |= TEST_BBDEV_VF_EB; turbo_enc->tb_params.eb = (uint32_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "k")) { - vector->mask |= TEST_BBDEV_VF_K; + dpdk_vector->mask |= TEST_BBDEV_VF_K; turbo_enc->cb_params.k = (uint16_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "k_neg")) { - vector->mask |= TEST_BBDEV_VF_K_NEG; + dpdk_vector->mask |= TEST_BBDEV_VF_K_NEG; turbo_enc->tb_params.k_neg = (uint16_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "k_pos")) { - vector->mask |= TEST_BBDEV_VF_K_POS; + dpdk_vector->mask |= TEST_BBDEV_VF_K_POS; turbo_enc->tb_params.k_pos = (uint16_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "c_neg")) { - vector->mask |= TEST_BBDEV_VF_C_NEG; + dpdk_vector->mask |= TEST_BBDEV_VF_C_NEG; turbo_enc->tb_params.c_neg = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "c")) { - vector->mask |= TEST_BBDEV_VF_C; + dpdk_vector->mask |= TEST_BBDEV_VF_C; turbo_enc->tb_params.c = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "cab")) { - vector->mask |= TEST_BBDEV_VF_CAB; + dpdk_vector->mask |= TEST_BBDEV_VF_CAB; turbo_enc->tb_params.cab = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "rv_index")) { - vector->mask |= TEST_BBDEV_VF_RV_INDEX; + dpdk_vector->mask |= TEST_BBDEV_VF_RV_INDEX; turbo_enc->rv_index = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "ncb")) { - vector->mask |= TEST_BBDEV_VF_NCB; + dpdk_vector->mask |= TEST_BBDEV_VF_NCB; turbo_enc->cb_params.ncb = (uint16_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "ncb_neg")) { - vector->mask |= TEST_BBDEV_VF_NCB_NEG; + dpdk_vector->mask |= TEST_BBDEV_VF_NCB_NEG; turbo_enc->tb_params.ncb_neg = (uint16_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "ncb_pos")) { - vector->mask |= TEST_BBDEV_VF_NCB_POS; + dpdk_vector->mask |= TEST_BBDEV_VF_NCB_POS; turbo_enc->tb_params.ncb_pos = (uint16_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "r")) { - vector->mask |= TEST_BBDEV_VF_R; + dpdk_vector->mask |= TEST_BBDEV_VF_R; turbo_enc->tb_params.r = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "code_block_mode")) { - vector->mask |= TEST_BBDEV_VF_CODE_BLOCK_MODE; + dpdk_vector->mask |= TEST_BBDEV_VF_CODE_BLOCK_MODE; turbo_enc->code_block_mode = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "op_flags")) { - vector->mask |= TEST_BBDEV_VF_OP_FLAGS; + dpdk_vector->mask |= TEST_BBDEV_VF_OP_FLAGS; ret = parse_turbo_flags(token, &op_flags, - vector->op_type); + dpdk_vector->op_type); if (!ret) turbo_enc->op_flags = op_flags; } else if (!strcmp(key_token, "expected_status")) { - vector->mask |= TEST_BBDEV_VF_EXPECTED_STATUS; - ret = parse_expected_status(token, &status, vector->op_type); + dpdk_vector->mask |= TEST_BBDEV_VF_EXPECTED_STATUS; + ret = parse_expected_status(token, &status, dpdk_vector->op_type); if (!ret) - vector->expected_status = status; + dpdk_vector->expected_status = status; } else { printf("Not valid enc key: '%s'\n", key_token); return -1; @@ -654,84 +654,84 @@ parse_encoder_params(const char *key_token, char *token, /* parses LDPC encoder parameters and assigns to global variable */ static int parse_ldpc_encoder_params(const char *key_token, char *token, - struct test_bbdev_vector *vector) + struct test_bbdev_vector *dpdk_vector) { int ret = 0, status = 0; uint32_t op_flags = 0; char *err = NULL; - struct rte_bbdev_op_ldpc_enc *ldpc_enc = &vector->ldpc_enc; + struct rte_bbdev_op_ldpc_enc *ldpc_enc = &dpdk_vector->ldpc_enc; if (starts_with(key_token, op_data_prefixes[DATA_INPUT])) - ret = parse_data_entry(key_token, token, vector, + ret = parse_data_entry(key_token, token, dpdk_vector, DATA_INPUT, op_data_prefixes[DATA_INPUT]); else if (starts_with(key_token, "output")) - ret = parse_data_entry(key_token, token, vector, + ret = parse_data_entry(key_token, token, dpdk_vector, DATA_HARD_OUTPUT, "output"); else if (!strcmp(key_token, "e")) { - vector->mask |= TEST_BBDEV_VF_E; + dpdk_vector->mask |= TEST_BBDEV_VF_E; ldpc_enc->cb_params.e = (uint32_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "ea")) { - vector->mask |= TEST_BBDEV_VF_EA; + dpdk_vector->mask |= TEST_BBDEV_VF_EA; ldpc_enc->tb_params.ea = (uint32_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "eb")) { - vector->mask |= TEST_BBDEV_VF_EB; + dpdk_vector->mask |= TEST_BBDEV_VF_EB; ldpc_enc->tb_params.eb = (uint32_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "c")) { - vector->mask |= TEST_BBDEV_VF_C; + dpdk_vector->mask |= TEST_BBDEV_VF_C; ldpc_enc->tb_params.c = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "cab")) { - vector->mask |= TEST_BBDEV_VF_CAB; + dpdk_vector->mask |= TEST_BBDEV_VF_CAB; ldpc_enc->tb_params.cab = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "rv_index")) { - vector->mask |= TEST_BBDEV_VF_RV_INDEX; + dpdk_vector->mask |= TEST_BBDEV_VF_RV_INDEX; ldpc_enc->rv_index = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "n_cb")) { - vector->mask |= TEST_BBDEV_VF_NCB; + dpdk_vector->mask |= TEST_BBDEV_VF_NCB; ldpc_enc->n_cb = (uint16_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "r")) { - vector->mask |= TEST_BBDEV_VF_R; + dpdk_vector->mask |= TEST_BBDEV_VF_R; ldpc_enc->tb_params.r = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "q_m")) { - vector->mask |= TEST_BBDEV_VF_QM; + dpdk_vector->mask |= TEST_BBDEV_VF_QM; ldpc_enc->q_m = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "basegraph")) { - vector->mask |= TEST_BBDEV_VF_BG; + dpdk_vector->mask |= TEST_BBDEV_VF_BG; ldpc_enc->basegraph = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "z_c")) { - vector->mask |= TEST_BBDEV_VF_ZC; + dpdk_vector->mask |= TEST_BBDEV_VF_ZC; ldpc_enc->z_c = (uint16_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "n_filler")) { - vector->mask |= TEST_BBDEV_VF_F; + dpdk_vector->mask |= TEST_BBDEV_VF_F; ldpc_enc->n_filler = (uint16_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "code_block_mode")) { - vector->mask |= TEST_BBDEV_VF_CODE_BLOCK_MODE; + dpdk_vector->mask |= TEST_BBDEV_VF_CODE_BLOCK_MODE; ldpc_enc->code_block_mode = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "op_flags")) { - vector->mask |= TEST_BBDEV_VF_OP_FLAGS; - ret = parse_turbo_flags(token, &op_flags, vector->op_type); + dpdk_vector->mask |= TEST_BBDEV_VF_OP_FLAGS; + ret = parse_turbo_flags(token, &op_flags, dpdk_vector->op_type); if (!ret) ldpc_enc->op_flags = op_flags; } else if (!strcmp(key_token, "expected_status")) { - vector->mask |= TEST_BBDEV_VF_EXPECTED_STATUS; - ret = parse_expected_status(token, &status, vector->op_type); + dpdk_vector->mask |= TEST_BBDEV_VF_EXPECTED_STATUS; + ret = parse_expected_status(token, &status, dpdk_vector->op_type); if (!ret) - vector->expected_status = status; + dpdk_vector->expected_status = status; } else { printf("Not valid ldpc enc key: '%s'\n", key_token); return -1; @@ -748,100 +748,100 @@ parse_ldpc_encoder_params(const char *key_token, char *token, /* parses LDPC decoder parameters and assigns to global variable */ static int parse_ldpc_decoder_params(const char *key_token, char *token, - struct test_bbdev_vector *vector) + struct test_bbdev_vector *dpdk_vector) { int ret = 0, status = 0; uint32_t op_flags = 0; char *err = NULL; - struct rte_bbdev_op_ldpc_dec *ldpc_dec = &vector->ldpc_dec; + struct rte_bbdev_op_ldpc_dec *ldpc_dec = &dpdk_vector->ldpc_dec; if (starts_with(key_token, op_data_prefixes[DATA_INPUT])) - ret = parse_data_entry(key_token, token, vector, + ret = parse_data_entry(key_token, token, dpdk_vector, DATA_INPUT, op_data_prefixes[DATA_INPUT]); else if (starts_with(key_token, "output")) - ret = parse_data_entry(key_token, token, vector, + ret = parse_data_entry(key_token, token, dpdk_vector, DATA_HARD_OUTPUT, "output"); else if (starts_with(key_token, op_data_prefixes[DATA_HARQ_INPUT])) - ret = parse_data_entry(key_token, token, vector, + ret = parse_data_entry(key_token, token, dpdk_vector, DATA_HARQ_INPUT, op_data_prefixes[DATA_HARQ_INPUT]); else if (starts_with(key_token, op_data_prefixes[DATA_HARQ_OUTPUT])) - ret = parse_data_entry(key_token, token, vector, + ret = parse_data_entry(key_token, token, dpdk_vector, DATA_HARQ_OUTPUT, op_data_prefixes[DATA_HARQ_OUTPUT]); else if (!strcmp(key_token, "e")) { - vector->mask |= TEST_BBDEV_VF_E; + dpdk_vector->mask |= TEST_BBDEV_VF_E; ldpc_dec->cb_params.e = (uint32_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "ea")) { - vector->mask |= TEST_BBDEV_VF_EA; + dpdk_vector->mask |= TEST_BBDEV_VF_EA; ldpc_dec->tb_params.ea = (uint32_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "eb")) { - vector->mask |= TEST_BBDEV_VF_EB; + dpdk_vector->mask |= TEST_BBDEV_VF_EB; ldpc_dec->tb_params.eb = (uint32_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "c")) { - vector->mask |= TEST_BBDEV_VF_C; + dpdk_vector->mask |= TEST_BBDEV_VF_C; ldpc_dec->tb_params.c = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "cab")) { - vector->mask |= TEST_BBDEV_VF_CAB; + dpdk_vector->mask |= TEST_BBDEV_VF_CAB; ldpc_dec->tb_params.cab = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "rv_index")) { - vector->mask |= TEST_BBDEV_VF_RV_INDEX; + dpdk_vector->mask |= TEST_BBDEV_VF_RV_INDEX; ldpc_dec->rv_index = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "n_cb")) { - vector->mask |= TEST_BBDEV_VF_NCB; + dpdk_vector->mask |= TEST_BBDEV_VF_NCB; ldpc_dec->n_cb = (uint16_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "r")) { - vector->mask |= TEST_BBDEV_VF_R; + dpdk_vector->mask |= TEST_BBDEV_VF_R; ldpc_dec->tb_params.r = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "q_m")) { - vector->mask |= TEST_BBDEV_VF_QM; + dpdk_vector->mask |= TEST_BBDEV_VF_QM; ldpc_dec->q_m = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "basegraph")) { - vector->mask |= TEST_BBDEV_VF_BG; + dpdk_vector->mask |= TEST_BBDEV_VF_BG; ldpc_dec->basegraph = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "z_c")) { - vector->mask |= TEST_BBDEV_VF_ZC; + dpdk_vector->mask |= TEST_BBDEV_VF_ZC; ldpc_dec->z_c = (uint16_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "n_filler")) { - vector->mask |= TEST_BBDEV_VF_F; + dpdk_vector->mask |= TEST_BBDEV_VF_F; ldpc_dec->n_filler = (uint16_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "expected_iter_count")) { - vector->mask |= TEST_BBDEV_VF_EXPECTED_ITER_COUNT; + dpdk_vector->mask |= TEST_BBDEV_VF_EXPECTED_ITER_COUNT; ldpc_dec->iter_count = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "iter_max")) { - vector->mask |= TEST_BBDEV_VF_ITER_MAX; + dpdk_vector->mask |= TEST_BBDEV_VF_ITER_MAX; ldpc_dec->iter_max = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "code_block_mode")) { - vector->mask |= TEST_BBDEV_VF_CODE_BLOCK_MODE; + dpdk_vector->mask |= TEST_BBDEV_VF_CODE_BLOCK_MODE; ldpc_dec->code_block_mode = (uint8_t) strtoul(token, &err, 0); ret = ((err == NULL) || (*err != '\0')) ? -1 : 0; } else if (!strcmp(key_token, "op_flags")) { - vector->mask |= TEST_BBDEV_VF_OP_FLAGS; - ret = parse_turbo_flags(token, &op_flags, vector->op_type); + dpdk_vector->mask |= TEST_BBDEV_VF_OP_FLAGS; + ret = parse_turbo_flags(token, &op_flags, dpdk_vector->op_type); if (!ret) ldpc_dec->op_flags = op_flags; } else if (!strcmp(key_token, "expected_status")) { - vector->mask |= TEST_BBDEV_VF_EXPECTED_STATUS; - ret = parse_expected_status(token, &status, vector->op_type); + dpdk_vector->mask |= TEST_BBDEV_VF_EXPECTED_STATUS; + ret = parse_expected_status(token, &status, dpdk_vector->op_type); if (!ret) - vector->expected_status = status; + dpdk_vector->expected_status = status; } else { printf("Not valid ldpc dec key: '%s'\n", key_token); return -1; @@ -857,7 +857,7 @@ parse_ldpc_decoder_params(const char *key_token, char *token, /* checks the type of key and assigns data */ static int -parse_entry(char *entry, struct test_bbdev_vector *vector) +parse_entry(char *entry, struct test_bbdev_vector *dpdk_vector) { int ret = 0; char *token, *key_token; @@ -881,11 +881,11 @@ parse_entry(char *entry, struct test_bbdev_vector *vector) trim_space(key_token); /* first key_token has to specify type of operation */ - if (vector->op_type == RTE_BBDEV_OP_NONE) { + if (dpdk_vector->op_type == RTE_BBDEV_OP_NONE) { if (!strcmp(key_token, "op_type")) { ret = op_turbo_type_strtol(token, &op_type); if (!ret) - vector->op_type = op_type; + dpdk_vector->op_type = op_type; return (!ret) ? 0 : -1; } printf("First key_token (%s) does not specify op_type\n", @@ -894,17 +894,17 @@ parse_entry(char *entry, struct test_bbdev_vector *vector) } /* compare keys */ - if (vector->op_type == RTE_BBDEV_OP_TURBO_DEC) { - if (parse_decoder_params(key_token, token, vector) == -1) + if (dpdk_vector->op_type == RTE_BBDEV_OP_TURBO_DEC) { + if (parse_decoder_params(key_token, token, dpdk_vector) == -1) return -1; - } else if (vector->op_type == RTE_BBDEV_OP_TURBO_ENC) { - if (parse_encoder_params(key_token, token, vector) == -1) + } else if (dpdk_vector->op_type == RTE_BBDEV_OP_TURBO_ENC) { + if (parse_encoder_params(key_token, token, dpdk_vector) == -1) return -1; - } else if (vector->op_type == RTE_BBDEV_OP_LDPC_ENC) { - if (parse_ldpc_encoder_params(key_token, token, vector) == -1) + } else if (dpdk_vector->op_type == RTE_BBDEV_OP_LDPC_ENC) { + if (parse_ldpc_encoder_params(key_token, token, dpdk_vector) == -1) return -1; - } else if (vector->op_type == RTE_BBDEV_OP_LDPC_DEC) { - if (parse_ldpc_decoder_params(key_token, token, vector) == -1) + } else if (dpdk_vector->op_type == RTE_BBDEV_OP_LDPC_DEC) { + if (parse_ldpc_decoder_params(key_token, token, dpdk_vector) == -1) return -1; } @@ -912,75 +912,75 @@ parse_entry(char *entry, struct test_bbdev_vector *vector) } static int -check_decoder_segments(struct test_bbdev_vector *vector) +check_decoder_segments(struct test_bbdev_vector *dpdk_vector) { unsigned char i; - struct rte_bbdev_op_turbo_dec *turbo_dec = &vector->turbo_dec; + struct rte_bbdev_op_turbo_dec *turbo_dec = &dpdk_vector->turbo_dec; - if (vector->entries[DATA_INPUT].nb_segments == 0) + if (dpdk_vector->entries[DATA_INPUT].nb_segments == 0) return -1; - for (i = 0; i < vector->entries[DATA_INPUT].nb_segments; i++) - if (vector->entries[DATA_INPUT].segments[i].addr == NULL) + for (i = 0; i < dpdk_vector->entries[DATA_INPUT].nb_segments; i++) + if (dpdk_vector->entries[DATA_INPUT].segments[i].addr == NULL) return -1; - if (vector->entries[DATA_HARD_OUTPUT].nb_segments == 0) + if (dpdk_vector->entries[DATA_HARD_OUTPUT].nb_segments == 0) return -1; - for (i = 0; i < vector->entries[DATA_HARD_OUTPUT].nb_segments; + for (i = 0; i < dpdk_vector->entries[DATA_HARD_OUTPUT].nb_segments; i++) - if (vector->entries[DATA_HARD_OUTPUT].segments[i].addr == NULL) + if (dpdk_vector->entries[DATA_HARD_OUTPUT].segments[i].addr == NULL) return -1; if ((turbo_dec->op_flags & RTE_BBDEV_TURBO_SOFT_OUTPUT) && - (vector->entries[DATA_SOFT_OUTPUT].nb_segments == 0)) + (dpdk_vector->entries[DATA_SOFT_OUTPUT].nb_segments == 0)) return -1; - for (i = 0; i < vector->entries[DATA_SOFT_OUTPUT].nb_segments; + for (i = 0; i < dpdk_vector->entries[DATA_SOFT_OUTPUT].nb_segments; i++) - if (vector->entries[DATA_SOFT_OUTPUT].segments[i].addr == NULL) + if (dpdk_vector->entries[DATA_SOFT_OUTPUT].segments[i].addr == NULL) return -1; return 0; } static int -check_ldpc_decoder_segments(struct test_bbdev_vector *vector) +check_ldpc_decoder_segments(struct test_bbdev_vector *dpdk_vector) { unsigned char i; - struct rte_bbdev_op_ldpc_dec *ldpc_dec = &vector->ldpc_dec; + struct rte_bbdev_op_ldpc_dec *ldpc_dec = &dpdk_vector->ldpc_dec; - for (i = 0; i < vector->entries[DATA_INPUT].nb_segments; i++) - if (vector->entries[DATA_INPUT].segments[i].addr == NULL) + for (i = 0; i < dpdk_vector->entries[DATA_INPUT].nb_segments; i++) + if (dpdk_vector->entries[DATA_INPUT].segments[i].addr == NULL) return -1; - for (i = 0; i < vector->entries[DATA_HARD_OUTPUT].nb_segments; i++) - if (vector->entries[DATA_HARD_OUTPUT].segments[i].addr == NULL) + for (i = 0; i < dpdk_vector->entries[DATA_HARD_OUTPUT].nb_segments; i++) + if (dpdk_vector->entries[DATA_HARD_OUTPUT].segments[i].addr == NULL) return -1; if ((ldpc_dec->op_flags & RTE_BBDEV_LDPC_SOFT_OUT_ENABLE) && - (vector->entries[DATA_SOFT_OUTPUT].nb_segments == 0)) + (dpdk_vector->entries[DATA_SOFT_OUTPUT].nb_segments == 0)) return -1; - for (i = 0; i < vector->entries[DATA_SOFT_OUTPUT].nb_segments; i++) - if (vector->entries[DATA_SOFT_OUTPUT].segments[i].addr == NULL) + for (i = 0; i < dpdk_vector->entries[DATA_SOFT_OUTPUT].nb_segments; i++) + if (dpdk_vector->entries[DATA_SOFT_OUTPUT].segments[i].addr == NULL) return -1; if ((ldpc_dec->op_flags & RTE_BBDEV_LDPC_HQ_COMBINE_OUT_ENABLE) && - (vector->entries[DATA_HARQ_OUTPUT].nb_segments == 0)) + (dpdk_vector->entries[DATA_HARQ_OUTPUT].nb_segments == 0)) return -1; - for (i = 0; i < vector->entries[DATA_HARQ_OUTPUT].nb_segments; i++) - if (vector->entries[DATA_HARQ_OUTPUT].segments[i].addr == NULL) + for (i = 0; i < dpdk_vector->entries[DATA_HARQ_OUTPUT].nb_segments; i++) + if (dpdk_vector->entries[DATA_HARQ_OUTPUT].segments[i].addr == NULL) return -1; return 0; } static int -check_decoder_llr_spec(struct test_bbdev_vector *vector) +check_decoder_llr_spec(struct test_bbdev_vector *dpdk_vector) { - struct rte_bbdev_op_turbo_dec *turbo_dec = &vector->turbo_dec; + struct rte_bbdev_op_turbo_dec *turbo_dec = &dpdk_vector->turbo_dec; /* Check input LLR sign formalism specification */ if ((turbo_dec->op_flags & RTE_BBDEV_TURBO_POS_LLR_1_BIT_IN) && @@ -1022,9 +1022,9 @@ check_decoder_llr_spec(struct test_bbdev_vector *vector) } static int -check_decoder_op_flags(struct test_bbdev_vector *vector) +check_decoder_op_flags(struct test_bbdev_vector *dpdk_vector) { - struct rte_bbdev_op_turbo_dec *turbo_dec = &vector->turbo_dec; + struct rte_bbdev_op_turbo_dec *turbo_dec = &dpdk_vector->turbo_dec; if ((turbo_dec->op_flags & RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP) && !(turbo_dec->op_flags & RTE_BBDEV_TURBO_CRC_TYPE_24B)) { @@ -1038,18 +1038,18 @@ check_decoder_op_flags(struct test_bbdev_vector *vector) /* checks decoder parameters */ static int -check_decoder(struct test_bbdev_vector *vector) +check_decoder(struct test_bbdev_vector *dpdk_vector) { - struct rte_bbdev_op_turbo_dec *turbo_dec = &vector->turbo_dec; - const int mask = vector->mask; + struct rte_bbdev_op_turbo_dec *turbo_dec = &dpdk_vector->turbo_dec; + const int mask = dpdk_vector->mask; - if (check_decoder_segments(vector) < 0) + if (check_decoder_segments(dpdk_vector) < 0) return -1; - if (check_decoder_llr_spec(vector) < 0) + if (check_decoder_llr_spec(dpdk_vector) < 0) return -1; - if (check_decoder_op_flags(vector) < 0) + if (check_decoder_op_flags(dpdk_vector) < 0) return -1; /* Check which params were set */ @@ -1126,19 +1126,19 @@ check_decoder(struct test_bbdev_vector *vector) /* checks LDPC decoder parameters */ static int -check_ldpc_decoder(struct test_bbdev_vector *vector) +check_ldpc_decoder(struct test_bbdev_vector *dpdk_vector) { - struct rte_bbdev_op_ldpc_dec *ldpc_dec = &vector->ldpc_dec; - const int mask = vector->mask; + struct rte_bbdev_op_ldpc_dec *ldpc_dec = &dpdk_vector->ldpc_dec; + const int mask = dpdk_vector->mask; - if (check_ldpc_decoder_segments(vector) < 0) + if (check_ldpc_decoder_segments(dpdk_vector) < 0) return -1; /* - * if (check_ldpc_decoder_llr_spec(vector) < 0) + * if (check_ldpc_decoder_llr_spec(dpdk_vector) < 0) * return -1; * - * if (check_ldpc_decoder_op_flags(vector) < 0) + * if (check_ldpc_decoder_op_flags(dpdk_vector) < 0) * return -1; */ @@ -1237,9 +1237,9 @@ check_encoder(struct test_bbdev_vector *vector) if (!(mask & TEST_BBDEV_VF_C)) { printf( "WARNING: c was not specified in vector file and will be set to 1\n"); - vector->turbo_enc.tb_params.c = 1; + dpdk_vector->turbo_enc.tb_params.c = 1; } - if (!(mask & TEST_BBDEV_VF_CAB) && (vector->turbo_enc.op_flags & + if (!(mask & TEST_BBDEV_VF_CAB) && (dpdk_vector->turbo_enc.op_flags & RTE_BBDEV_TURBO_RATE_MATCH)) printf( "WARNING: cab was not specified in vector file and will be set to 0\n"); @@ -1253,7 +1253,7 @@ check_encoder(struct test_bbdev_vector *vector) printf( "WARNING: r was not specified in vector file and will be set to 0\n"); } else { - if (!(mask & TEST_BBDEV_VF_E) && (vector->turbo_enc.op_flags & + if (!(mask & TEST_BBDEV_VF_E) && (dpdk_vector->turbo_enc.op_flags & RTE_BBDEV_TURBO_RATE_MATCH)) printf( "WARNING: e was not specified in vector file and will be set to 0\n"); @@ -1334,21 +1334,21 @@ check_ldpc_encoder(struct test_bbdev_vector *vector) } static int -bbdev_check_vector(struct test_bbdev_vector *vector) +bbdev_check_vector(struct test_bbdev_vector *dpdk_vector) { - if (vector->op_type == RTE_BBDEV_OP_TURBO_DEC) { - if (check_decoder(vector) == -1) + if (dpdk_vector->op_type == RTE_BBDEV_OP_TURBO_DEC) { + if (check_decoder(dpdk_vector) == -1) return -1; - } else if (vector->op_type == RTE_BBDEV_OP_TURBO_ENC) { - if (check_encoder(vector) == -1) + } else if (dpdk_vector->op_type == RTE_BBDEV_OP_TURBO_ENC) { + if (check_encoder(dpdk_vector) == -1) return -1; - } else if (vector->op_type == RTE_BBDEV_OP_LDPC_ENC) { - if (check_ldpc_encoder(vector) == -1) + } else if (dpdk_vector->op_type == RTE_BBDEV_OP_LDPC_ENC) { + if (check_ldpc_encoder(dpdk_vector) == -1) return -1; - } else if (vector->op_type == RTE_BBDEV_OP_LDPC_DEC) { - if (check_ldpc_decoder(vector) == -1) + } else if (dpdk_vector->op_type == RTE_BBDEV_OP_LDPC_DEC) { + if (check_ldpc_decoder(dpdk_vector) == -1) return -1; - } else if (vector->op_type != RTE_BBDEV_OP_NONE) { + } else if (dpdk_vector->op_type != RTE_BBDEV_OP_NONE) { printf("Vector was not filled\n"); return -1; } @@ -1358,7 +1358,7 @@ bbdev_check_vector(struct test_bbdev_vector *vector) int test_bbdev_vector_read(const char *filename, - struct test_bbdev_vector *vector) + struct test_bbdev_vector *dpdk_vector) { int ret = 0; size_t len = 0; @@ -1419,13 +1419,13 @@ test_bbdev_vector_read(const char *filename, break; } } - ret = parse_entry(entry, vector); + ret = parse_entry(entry, dpdk_vector); if (ret != 0) { printf("An error occurred while parsing!\n"); goto exit; } } - ret = bbdev_check_vector(vector); + ret = bbdev_check_vector(dpdk_vector); if (ret != 0) printf("An error occurred while checking!\n"); diff --git a/app/test-bbdev/test_bbdev_vector.h b/app/test-bbdev/test_bbdev_vector.h index 4e5dbf5d50..2607826964 100644 --- a/app/test-bbdev/test_bbdev_vector.h +++ b/app/test-bbdev/test_bbdev_vector.h @@ -73,7 +73,7 @@ struct test_bbdev_vector { /* fills test vector parameters based on test file */ int test_bbdev_vector_read(const char *filename, - struct test_bbdev_vector *vector); + struct test_bbdev_vector *dpdk_vector); #endif /* TEST_BBDEV_VECTOR_H_ */ diff --git a/app/test-crypto-perf/cperf_test_vector_parsing.c b/app/test-crypto-perf/cperf_test_vector_parsing.c index 1e9dfcfff0..65fabb5d3f 100644 --- a/app/test-crypto-perf/cperf_test_vector_parsing.c +++ b/app/test-crypto-perf/cperf_test_vector_parsing.c @@ -13,24 +13,24 @@ #include "cperf_test_vector_parsing.h" int -free_test_vector(struct cperf_test_vector *vector, struct cperf_options *opts) +free_test_vector(struct cperf_test_vector *dpdk_vector, struct cperf_options *opts) { - if (vector == NULL || opts == NULL) + if (dpdk_vector == NULL || opts == NULL) return -1; - rte_free(vector->cipher_iv.data); - rte_free(vector->auth_iv.data); - rte_free(vector->aad.data); - rte_free(vector->digest.data); + rte_free(dpdk_vector->cipher_iv.data); + rte_free(dpdk_vector->auth_iv.data); + rte_free(dpdk_vector->aad.data); + rte_free(dpdk_vector->digest.data); if (opts->test_file != NULL) { - rte_free(vector->plaintext.data); - rte_free(vector->cipher_key.data); - rte_free(vector->auth_key.data); - rte_free(vector->ciphertext.data); + rte_free(dpdk_vector->plaintext.data); + rte_free(dpdk_vector->cipher_key.data); + rte_free(dpdk_vector->auth_key.data); + rte_free(dpdk_vector->ciphertext.data); } - rte_free(vector); + rte_free(dpdk_vector); return 0; } @@ -272,7 +272,7 @@ parse_values(char *tokens, uint8_t **data, uint32_t *data_length) /* checks the type of key and assigns data */ static int -parse_entry(char *entry, struct cperf_test_vector *vector, +parse_entry(char *entry, struct cperf_test_vector *dpdk_vector, struct cperf_options *opts, uint8_t tc_found) { int status; @@ -303,146 +303,146 @@ parse_entry(char *entry, struct cperf_test_vector *vector, /* compare keys */ if (strstr(key_token, "plaintext")) { - rte_free(vector->plaintext.data); - vector->plaintext.data = data; + rte_free(dpdk_vector->plaintext.data); + dpdk_vector->plaintext.data = data; if (tc_found) - vector->plaintext.length = data_length; + dpdk_vector->plaintext.length = data_length; else { if (opts->max_buffer_size > data_length) { printf("Global plaintext shorter than " "buffer_sz\n"); return -1; } - vector->plaintext.length = opts->max_buffer_size; + dpdk_vector->plaintext.length = opts->max_buffer_size; } } else if (strstr(key_token, "cipher_key")) { - rte_free(vector->cipher_key.data); - vector->cipher_key.data = data; + rte_free(dpdk_vector->cipher_key.data); + dpdk_vector->cipher_key.data = data; if (tc_found) - vector->cipher_key.length = data_length; + dpdk_vector->cipher_key.length = data_length; else { if (opts->cipher_key_sz > data_length) { printf("Global cipher_key shorter than " "cipher_key_sz\n"); return -1; } - vector->cipher_key.length = opts->cipher_key_sz; + dpdk_vector->cipher_key.length = opts->cipher_key_sz; } } else if (strstr(key_token, "auth_key")) { - rte_free(vector->auth_key.data); - vector->auth_key.data = data; + rte_free(dpdk_vector->auth_key.data); + dpdk_vector->auth_key.data = data; if (tc_found) - vector->auth_key.length = data_length; + dpdk_vector->auth_key.length = data_length; else { if (opts->auth_key_sz > data_length) { printf("Global auth_key shorter than " "auth_key_sz\n"); return -1; } - vector->auth_key.length = opts->auth_key_sz; + dpdk_vector->auth_key.length = opts->auth_key_sz; } } else if (strstr(key_token, "aead_key")) { - rte_free(vector->aead_key.data); - vector->aead_key.data = data; + rte_free(dpdk_vector->aead_key.data); + dpdk_vector->aead_key.data = data; if (tc_found) - vector->aead_key.length = data_length; + dpdk_vector->aead_key.length = data_length; else { if (opts->aead_key_sz > data_length) { printf("Global aead_key shorter than " "aead_key_sz\n"); return -1; } - vector->aead_key.length = opts->aead_key_sz; + dpdk_vector->aead_key.length = opts->aead_key_sz; } } else if (strstr(key_token, "cipher_iv")) { - rte_free(vector->cipher_iv.data); - vector->cipher_iv.data = data; + rte_free(dpdk_vector->cipher_iv.data); + dpdk_vector->cipher_iv.data = data; if (tc_found) - vector->cipher_iv.length = data_length; + dpdk_vector->cipher_iv.length = data_length; else { if (opts->cipher_iv_sz > data_length) { printf("Global cipher iv shorter than " "cipher_iv_sz\n"); return -1; } - vector->cipher_iv.length = opts->cipher_iv_sz; + dpdk_vector->cipher_iv.length = opts->cipher_iv_sz; } } else if (strstr(key_token, "auth_iv")) { - rte_free(vector->auth_iv.data); - vector->auth_iv.data = data; + rte_free(dpdk_vector->auth_iv.data); + dpdk_vector->auth_iv.data = data; if (tc_found) - vector->auth_iv.length = data_length; + dpdk_vector->auth_iv.length = data_length; else { if (opts->auth_iv_sz > data_length) { printf("Global auth iv shorter than " "auth_iv_sz\n"); return -1; } - vector->auth_iv.length = opts->auth_iv_sz; + dpdk_vector->auth_iv.length = opts->auth_iv_sz; } } else if (strstr(key_token, "aead_iv")) { - rte_free(vector->aead_iv.data); - vector->aead_iv.data = data; + rte_free(dpdk_vector->aead_iv.data); + dpdk_vector->aead_iv.data = data; if (tc_found) - vector->aead_iv.length = data_length; + dpdk_vector->aead_iv.length = data_length; else { if (opts->aead_iv_sz > data_length) { printf("Global aead iv shorter than " "aead_iv_sz\n"); return -1; } - vector->aead_iv.length = opts->aead_iv_sz; + dpdk_vector->aead_iv.length = opts->aead_iv_sz; } } else if (strstr(key_token, "ciphertext")) { - rte_free(vector->ciphertext.data); - vector->ciphertext.data = data; + rte_free(dpdk_vector->ciphertext.data); + dpdk_vector->ciphertext.data = data; if (tc_found) - vector->ciphertext.length = data_length; + dpdk_vector->ciphertext.length = data_length; else { if (opts->max_buffer_size > data_length) { printf("Global ciphertext shorter than " "buffer_sz\n"); return -1; } - vector->ciphertext.length = opts->max_buffer_size; + dpdk_vector->ciphertext.length = opts->max_buffer_size; } } else if (strstr(key_token, "aad")) { - rte_free(vector->aad.data); - vector->aad.data = data; - vector->aad.phys_addr = rte_malloc_virt2iova(vector->aad.data); + rte_free(dpdk_vector->aad.data); + dpdk_vector->aad.data = data; + dpdk_vector->aad.phys_addr = rte_malloc_virt2iova(dpdk_vector->aad.data); if (tc_found) - vector->aad.length = data_length; + dpdk_vector->aad.length = data_length; else { if (opts->aead_aad_sz > data_length) { printf("Global aad shorter than " "aead_aad_sz\n"); return -1; } - vector->aad.length = opts->aead_aad_sz; + dpdk_vector->aad.length = opts->aead_aad_sz; } } else if (strstr(key_token, "digest")) { - rte_free(vector->digest.data); - vector->digest.data = data; - vector->digest.phys_addr = rte_malloc_virt2iova( - vector->digest.data); + rte_free(dpdk_vector->digest.data); + dpdk_vector->digest.data = data; + dpdk_vector->digest.phys_addr = rte_malloc_virt2iova( + dpdk_vector->digest.data); if (tc_found) - vector->digest.length = data_length; + dpdk_vector->digest.length = data_length; else { if (opts->digest_sz > data_length) { printf("Global digest shorter than " "digest_sz\n"); return -1; } - vector->digest.length = opts->digest_sz; + dpdk_vector->digest.length = opts->digest_sz; } } else { printf("Not valid key: '%s'\n", trim_space(key_token)); @@ -454,7 +454,7 @@ parse_entry(char *entry, struct cperf_test_vector *vector, /* searches in the file for test keys and values */ static int -parse_file(struct cperf_test_vector *vector, struct cperf_options *opts) +parse_file(struct cperf_test_vector *dpdk_vector, struct cperf_options *opts) { uint8_t tc_found = 0; uint8_t tc_data_start = 0; @@ -530,7 +530,7 @@ parse_file(struct cperf_test_vector *vector, struct cperf_options *opts) break; } } - status = parse_entry(entry, vector, opts, tc_found); + status = parse_entry(entry, dpdk_vector, opts, tc_found); if (status) { printf("An error occurred while parsing!\n"); goto err; diff --git a/app/test-crypto-perf/cperf_test_vector_parsing.h b/app/test-crypto-perf/cperf_test_vector_parsing.h index 247b142216..9c83537c1c 100644 --- a/app/test-crypto-perf/cperf_test_vector_parsing.h +++ b/app/test-crypto-perf/cperf_test_vector_parsing.h @@ -19,7 +19,7 @@ * 0 on success, (-1) on error. */ int -free_test_vector(struct cperf_test_vector *vector, struct cperf_options *opts); +free_test_vector(struct cperf_test_vector *dpdk_vector, struct cperf_options *opts); /** * Displays data in test vector diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c index 2939aeaa93..6f7f248a2e 100644 --- a/app/test-crypto-perf/cperf_test_verify.c +++ b/app/test-crypto-perf/cperf_test_verify.c @@ -94,7 +94,7 @@ cperf_verify_test_constructor(struct rte_mempool *sess_mp, static int cperf_verify_op(struct rte_crypto_op *op, const struct cperf_options *options, - const struct cperf_test_vector *vector) + const struct cperf_test_vector *dpdk_vector) { const struct rte_mbuf *m; uint32_t len; @@ -176,18 +176,18 @@ cperf_verify_op(struct rte_crypto_op *op, if (cipher == 1) { if (options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) res += memcmp(data + cipher_offset, - vector->ciphertext.data, + dpdk_vector->ciphertext.data, options->test_buffer_size); else res += memcmp(data + cipher_offset, - vector->plaintext.data, + dpdk_vector->plaintext.data, options->test_buffer_size); } if (auth == 1) { if (options->auth_op == RTE_CRYPTO_AUTH_OP_GENERATE) res += memcmp(data + auth_offset, - vector->digest.data, + dpdk_vector->digest.data, options->digest_sz); } diff --git a/drivers/net/i40e/i40e_rxtx_vec_altivec.c b/drivers/net/i40e/i40e_rxtx_vec_altivec.c index b99323992f..e90bd00827 100644 --- a/drivers/net/i40e/i40e_rxtx_vec_altivec.c +++ b/drivers/net/i40e/i40e_rxtx_vec_altivec.c @@ -27,10 +27,10 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) struct i40e_rx_entry *rxep = &rxq->sw_ring[rxq->rxrearm_start]; struct rte_mbuf *mb0, *mb1; - vector unsigned long hdr_room = (vector unsigned long){ + vector unsigned int hdr_room = (vector unsigned int){ RTE_PKTMBUF_HEADROOM, RTE_PKTMBUF_HEADROOM}; - vector unsigned long dma_addr0, dma_addr1; + vector unsigned int dma_addr0, dma_addr1; rxdp = rxq->rx_ring + rxq->rxrearm_start; @@ -40,11 +40,11 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) RTE_I40E_RXQ_REARM_THRESH) < 0) { if (rxq->rxrearm_nb + RTE_I40E_RXQ_REARM_THRESH >= rxq->nb_rx_desc) { - dma_addr0 = (vector unsigned long){}; + dma_addr0 = (vector unsigned int){}; for (i = 0; i < RTE_I40E_DESCS_PER_LOOP; i++) { rxep[i].mbuf = &rxq->fake_mbuf; vec_st(dma_addr0, 0, - (vector unsigned long *)&rxdp[i].read); + (vector unsigned int *)&rxdp[i].read); } } rte_eth_devices[rxq->port_id].data->rx_mbuf_alloc_failed += @@ -54,7 +54,7 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) /* Initialize the mbufs in vector, process 2 mbufs in one loop */ for (i = 0; i < RTE_I40E_RXQ_REARM_THRESH; i += 2, rxep += 2) { - vector unsigned long vaddr0, vaddr1; + vector unsigned int vaddr0, vaddr1; uintptr_t p0, p1; mb0 = rxep[0].mbuf; @@ -72,8 +72,8 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) *(uint64_t *)p1 = rxq->mbuf_initializer; /* load buf_addr(lo 64bit) and buf_iova(hi 64bit) */ - vaddr0 = vec_ld(0, (vector unsigned long *)&mb0->buf_addr); - vaddr1 = vec_ld(0, (vector unsigned long *)&mb1->buf_addr); + vaddr0 = vec_ld(0, (vector unsigned int *)&mb0->buf_addr); + vaddr1 = vec_ld(0, (vector unsigned int *)&mb1->buf_addr); /* convert pa to dma_addr hdr/data */ dma_addr0 = vec_mergel(vaddr0, vaddr0); @@ -84,8 +84,8 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) dma_addr1 = vec_add(dma_addr1, hdr_room); /* flush desc with pa dma_addr */ - vec_st(dma_addr0, 0, (vector unsigned long *)&rxdp++->read); - vec_st(dma_addr1, 0, (vector unsigned long *)&rxdp++->read); + vec_st(dma_addr0, 0, (vector unsigned int *)&rxdp++->read); + vec_st(dma_addr1, 0, (vector unsigned int *)&rxdp++->read); } rxq->rxrearm_start += RTE_I40E_RXQ_REARM_THRESH; @@ -102,7 +102,7 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) } static inline void -desc_to_olflags_v(vector unsigned long descs[4], struct rte_mbuf **rx_pkts) +desc_to_olflags_v(vector unsigned int descs[4], struct rte_mbuf **rx_pkts) { vector unsigned int vlan0, vlan1, rss, l3_l4e; @@ -169,14 +169,14 @@ desc_to_olflags_v(vector unsigned long descs[4], struct rte_mbuf **rx_pkts) #define PKTLEN_SHIFT 10 static inline void -desc_to_ptype_v(vector unsigned long descs[4], struct rte_mbuf **rx_pkts, +desc_to_ptype_v(vector unsigned int descs[4], struct rte_mbuf **rx_pkts, uint32_t *ptype_tbl) { - vector unsigned long ptype0 = vec_mergel(descs[0], descs[1]); - vector unsigned long ptype1 = vec_mergel(descs[2], descs[3]); + vector unsigned int ptype0 = vec_mergel(descs[0], descs[1]); + vector unsigned int ptype1 = vec_mergel(descs[2], descs[3]); - ptype0 = vec_sr(ptype0, (vector unsigned long){30, 30}); - ptype1 = vec_sr(ptype1, (vector unsigned long){30, 30}); + ptype0 = vec_sr(ptype0, (vector unsigned int){30, 30}); + ptype1 = vec_sr(ptype1, (vector unsigned int){30, 30}); rx_pkts[0]->packet_type = ptype_tbl[(*(vector unsigned char *)&ptype0)[0]]; @@ -214,7 +214,7 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts, rxq->crc_len, /* sub crc on data_len */ 0, 0, 0 /* ignore non-length fields */ }; - vector unsigned long dd_check, eop_check; + vector unsigned int dd_check, eop_check; /* nb_pkts has to be floor-aligned to RTE_I40E_DESCS_PER_LOOP */ nb_pkts = RTE_ALIGN_FLOOR(nb_pkts, RTE_I40E_DESCS_PER_LOOP); @@ -274,7 +274,7 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts, for (pos = 0, nb_pkts_recd = 0; pos < nb_pkts; pos += RTE_I40E_DESCS_PER_LOOP, rxdp += RTE_I40E_DESCS_PER_LOOP) { - vector unsigned long descs[RTE_I40E_DESCS_PER_LOOP]; + vector unsigned int descs[RTE_I40E_DESCS_PER_LOOP]; vector unsigned char pkt_mb1, pkt_mb2, pkt_mb3, pkt_mb4; vector unsigned short staterr, sterr_tmp1, sterr_tmp2; vector unsigned long mbp1, mbp2; /* two mbuf pointer @@ -432,7 +432,7 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts, /* C.4 calc avaialbe number of desc */ var = __builtin_popcountll((vec_ld(0, - (vector unsigned long *)&staterr)[0])); + (vector unsigned int *)&staterr)[0])); nb_pkts_recd += var; if (likely(var != RTE_I40E_DESCS_PER_LOOP)) break; diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index a127dc0d86..f0931928f1 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -5618,39 +5618,39 @@ ixgbe_vt_check(struct ixgbe_hw *hw) static uint32_t ixgbe_uta_vector(struct ixgbe_hw *hw, struct rte_ether_addr *uc_addr) { - uint32_t vector = 0; + uint32_t dpdk_vector = 0; switch (hw->mac.mc_filter_type) { case 0: /* use bits [47:36] of the address */ - vector = ((uc_addr->addr_bytes[4] >> 4) | + dpdk_vector = ((uc_addr->addr_bytes[4] >> 4) | (((uint16_t)uc_addr->addr_bytes[5]) << 4)); break; case 1: /* use bits [46:35] of the address */ - vector = ((uc_addr->addr_bytes[4] >> 3) | + dpdk_vector = ((uc_addr->addr_bytes[4] >> 3) | (((uint16_t)uc_addr->addr_bytes[5]) << 5)); break; case 2: /* use bits [45:34] of the address */ - vector = ((uc_addr->addr_bytes[4] >> 2) | + dpdk_vector = ((uc_addr->addr_bytes[4] >> 2) | (((uint16_t)uc_addr->addr_bytes[5]) << 6)); break; case 3: /* use bits [43:32] of the address */ - vector = ((uc_addr->addr_bytes[4]) | + dpdk_vector = ((uc_addr->addr_bytes[4]) | (((uint16_t)uc_addr->addr_bytes[5]) << 8)); break; default: /* Invalid mc_filter_type */ break; } - /* vector can only be 12-bits or boundary will be exceeded */ - vector &= 0xFFF; - return vector; + /* dpdk_vector can only be 12-bits or boundary will be exceeded */ + dpdk_vector &= 0xFFF; + return dpdk_vector; } static int ixgbe_uc_hash_table_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint8_t on) { - uint32_t vector; + uint32_t dpdk_vector; uint32_t uta_idx; uint32_t reg_val; uint32_t uta_shift; @@ -5669,9 +5669,9 @@ ixgbe_uc_hash_table_set(struct rte_eth_dev *dev, if (hw->mac.type < ixgbe_mac_82599EB) return -ENOTSUP; - vector = ixgbe_uta_vector(hw, mac_addr); - uta_idx = (vector >> ixgbe_uta_bit_shift) & ixgbe_uta_idx_mask; - uta_shift = vector & ixgbe_uta_bit_mask; + dpdk_vector = ixgbe_uta_vector(hw, mac_addr); + uta_idx = (dpdk_vector >> ixgbe_uta_bit_shift) & ixgbe_uta_idx_mask; + uta_shift = dpdk_vector & ixgbe_uta_bit_mask; rc = ((uta_info->uta_shadow[uta_idx] >> uta_shift & bit1) != 0); if (rc == on) diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 349180e7c1..021e9860d4 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -4755,12 +4755,12 @@ ixgbe_get_rscctl_maxdesc(struct rte_mempool *pool) * @type RX/TX/MISC */ static void -ixgbe_set_ivar(struct rte_eth_dev *dev, u8 entry, u8 vector, s8 type) +ixgbe_set_ivar(struct rte_eth_dev *dev, u8 entry, u8 dpdk_vector, s8 type) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); u32 ivar, index; - vector |= IXGBE_IVAR_ALLOC_VAL; + dpdk_vector |= IXGBE_IVAR_ALLOC_VAL; switch (hw->mac.type) { @@ -4772,7 +4772,7 @@ ixgbe_set_ivar(struct rte_eth_dev *dev, u8 entry, u8 vector, s8 type) index = (entry >> 2) & 0x1F; ivar = IXGBE_READ_REG(hw, IXGBE_IVAR(index)); ivar &= ~(0xFF << (8 * (entry & 0x3))); - ivar |= (vector << (8 * (entry & 0x3))); + ivar |= (dpdk_vector << (8 * (entry & 0x3))); IXGBE_WRITE_REG(hw, IXGBE_IVAR(index), ivar); break; @@ -4782,13 +4782,13 @@ ixgbe_set_ivar(struct rte_eth_dev *dev, u8 entry, u8 vector, s8 type) index = (entry & 1) * 8; ivar = IXGBE_READ_REG(hw, IXGBE_IVAR_MISC); ivar &= ~(0xFF << index); - ivar |= (vector << index); + ivar |= (dpdk_vector << index); IXGBE_WRITE_REG(hw, IXGBE_IVAR_MISC, ivar); } else { /* RX/TX IVARS */ index = (16 * (entry & 1)) + (8 * type); ivar = IXGBE_READ_REG(hw, IXGBE_IVAR(entry >> 1)); ivar &= ~(0xFF << index); - ivar |= (vector << index); + ivar |= (dpdk_vector << index); IXGBE_WRITE_REG(hw, IXGBE_IVAR(entry >> 1), ivar); } diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c index b267da462b..ee45078aee 100644 --- a/drivers/net/txgbe/txgbe_ethdev.c +++ b/drivers/net/txgbe/txgbe_ethdev.c @@ -3502,39 +3502,39 @@ txgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) static uint32_t txgbe_uta_vector(struct txgbe_hw *hw, struct rte_ether_addr *uc_addr) { - uint32_t vector = 0; + uint32_t dpdk_vector = 0; switch (hw->mac.mc_filter_type) { case 0: /* use bits [47:36] of the address */ - vector = ((uc_addr->addr_bytes[4] >> 4) | + dpdk_vector = ((uc_addr->addr_bytes[4] >> 4) | (((uint16_t)uc_addr->addr_bytes[5]) << 4)); break; case 1: /* use bits [46:35] of the address */ - vector = ((uc_addr->addr_bytes[4] >> 3) | + dpdk_vector = ((uc_addr->addr_bytes[4] >> 3) | (((uint16_t)uc_addr->addr_bytes[5]) << 5)); break; case 2: /* use bits [45:34] of the address */ - vector = ((uc_addr->addr_bytes[4] >> 2) | + dpdk_vector = ((uc_addr->addr_bytes[4] >> 2) | (((uint16_t)uc_addr->addr_bytes[5]) << 6)); break; case 3: /* use bits [43:32] of the address */ - vector = ((uc_addr->addr_bytes[4]) | + dpdk_vector = ((uc_addr->addr_bytes[4]) | (((uint16_t)uc_addr->addr_bytes[5]) << 8)); break; default: /* Invalid mc_filter_type */ break; } - /* vector can only be 12-bits or boundary will be exceeded */ - vector &= 0xFFF; - return vector; + /* dpdk_vector can only be 12-bits or boundary will be exceeded */ + dpdk_vector &= 0xFFF; + return dpdk_vector; } static int txgbe_uc_hash_table_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint8_t on) { - uint32_t vector; + uint32_t dpdk_vector; uint32_t uta_idx; uint32_t reg_val; uint32_t uta_mask; @@ -3547,9 +3547,9 @@ txgbe_uc_hash_table_set(struct rte_eth_dev *dev, if (hw->mac.type < txgbe_mac_raptor) return -ENOTSUP; - vector = txgbe_uta_vector(hw, mac_addr); - uta_idx = (vector >> 5) & 0x7F; - uta_mask = 0x1UL << (vector & 0x1F); + dpdk_vector = txgbe_uta_vector(hw, mac_addr); + uta_idx = (dpdk_vector >> 5) & 0x7F; + uta_mask = 0x1UL << (dpdk_vector & 0x1F); if (!!on == !!(uta_info->uta_shadow[uta_idx] & uta_mask)) return 0; diff --git a/lib/eal/ppc/include/rte_altivec.h b/lib/eal/ppc/include/rte_altivec.h index 1551a94544..3fcc819c11 100644 --- a/lib/eal/ppc/include/rte_altivec.h +++ b/lib/eal/ppc/include/rte_altivec.h @@ -7,6 +7,9 @@ #define _RTE_ALTIVEC_H_ /* To include altivec.h, GCC version must be >= 4.8 */ +#ifdef __clang__ +#define vector __vector +#endif #include /* diff --git a/lib/eal/ppc/include/rte_atomic.h b/lib/eal/ppc/include/rte_atomic.h index 86d3f9b2a1..bd4c3c67b1 100644 --- a/lib/eal/ppc/include/rte_atomic.h +++ b/lib/eal/ppc/include/rte_atomic.h @@ -83,7 +83,7 @@ static inline int rte_atomic16_dec_and_test(rte_atomic16_t *v) static inline uint16_t rte_atomic16_exchange(volatile uint16_t *dst, uint16_t val) { - return __atomic_exchange_2(dst, val, __ATOMIC_SEQ_CST); + return __atomic_exchange_n(dst, val, __ATOMIC_SEQ_CST); } /*------------------------- 32 bit atomic operations -------------------------*/ @@ -125,7 +125,7 @@ static inline int rte_atomic32_dec_and_test(rte_atomic32_t *v) static inline uint32_t rte_atomic32_exchange(volatile uint32_t *dst, uint32_t val) { - return __atomic_exchange_4(dst, val, __ATOMIC_SEQ_CST); + return __atomic_exchange_n(dst, val, __ATOMIC_SEQ_CST); } /*------------------------- 64 bit atomic operations -------------------------*/ @@ -214,7 +214,7 @@ static inline void rte_atomic64_clear(rte_atomic64_t *v) static inline uint64_t rte_atomic64_exchange(volatile uint64_t *dst, uint64_t val) { - return __atomic_exchange_8(dst, val, __ATOMIC_SEQ_CST); + return __atomic_exchange_n(dst, val, __ATOMIC_SEQ_CST); } #endif diff --git a/lib/eal/ppc/include/rte_cycles.h b/lib/eal/ppc/include/rte_cycles.h index 5585f9273c..160a2de0a7 100644 --- a/lib/eal/ppc/include/rte_cycles.h +++ b/lib/eal/ppc/include/rte_cycles.h @@ -10,7 +10,9 @@ extern "C" { #endif +#ifdef __linux__ #include +#endif #include "generic/rte_cycles.h" @@ -26,7 +28,13 @@ extern "C" { static inline uint64_t rte_rdtsc(void) { +#ifdef __linux__ return __ppc_get_timebase(); +#elif defined(__FreeBSD__) + uint64_t __tb; + __asm__ volatile ("mfspr %0, 268" : "=r" (__tb)); + return __tb; +#endif } static inline uint64_t -- 2.32.0