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 59941A0C43; Tue, 28 Sep 2021 15:58:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CF0A740E3C; Tue, 28 Sep 2021 15:58:48 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id A28DD40DF6 for ; Tue, 28 Sep 2021 15:58:45 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10120"; a="285712932" X-IronPort-AV: E=Sophos;i="5.85,329,1624345200"; d="scan'208";a="285712932" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2021 06:58:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,329,1624345200"; d="scan'208";a="562317490" Received: from silpixa00400493.ir.intel.com ([10.237.213.146]) by fmsmga002.fm.intel.com with ESMTP; 28 Sep 2021 06:58:42 -0700 From: Pablo de Lara To: yipeng1.wang@intel.com, byron.marohn@intel.com, drc@linux.vnet.ibm.com Cc: dev@dpdk.org, Pablo de Lara , John McNamara Date: Tue, 28 Sep 2021 13:58:39 +0000 Message-Id: <20210928135839.3778960-1-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210917125606.2524678-1-pablo.de.lara.guarch@intel.com> References: <20210917125606.2524678-1-pablo.de.lara.guarch@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v4] efd: change data type of parameter 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" rte_efd_create() function was using uint8_t for a socket bitmask, for one of its parameters. This limits the maximum of NUMA sockets to be 8. Changing to to uint64_t increases it to 64, which should be more future-proof. Coverity issue: 366390 Fixes: 56b6ef874f8 ("efd: new Elastic Flow Distributor library") Signed-off-by: Pablo de Lara Acked-by: John McNamara --- v4: Set socket id in EFD tests v3: Fixed commit message v2: Fixed EFD tests --- app/test/test_efd.c | 5 +++-- app/test/test_efd_perf.c | 4 ++-- lib/efd/rte_efd.c | 2 +- lib/efd/rte_efd.h | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/test/test_efd.c b/app/test/test_efd.c index 180dc4748e..1b249e0447 100644 --- a/app/test/test_efd.c +++ b/app/test/test_efd.c @@ -91,9 +91,9 @@ static struct flow_key keys[5] = { /* Array to store the data */ static efd_value_t data[5]; -static inline uint8_t efd_get_all_sockets_bitmask(void) +static inline uint64_t efd_get_all_sockets_bitmask(void) { - uint8_t all_cpu_sockets_bitmask = 0; + uint64_t all_cpu_sockets_bitmask = 0; unsigned int i; unsigned int next_lcore = rte_get_main_lcore(); const int val_true = 1, val_false = 0; @@ -443,6 +443,7 @@ static int test_efd_creation_with_bad_parameters(void) static int test_efd(void) { + test_socket_id = rte_socket_id(); /* Unit tests */ if (test_add_delete() < 0) diff --git a/app/test/test_efd_perf.c b/app/test/test_efd_perf.c index 1c47704475..f3fe3b1736 100644 --- a/app/test/test_efd_perf.c +++ b/app/test/test_efd_perf.c @@ -29,9 +29,9 @@ #endif static unsigned int test_socket_id; -static inline uint8_t efd_get_all_sockets_bitmask(void) +static inline uint64_t efd_get_all_sockets_bitmask(void) { - uint8_t all_cpu_sockets_bitmask = 0; + uint64_t all_cpu_sockets_bitmask = 0; unsigned int i; unsigned int next_lcore = rte_get_main_lcore(); const int val_true = 1, val_false = 0; diff --git a/lib/efd/rte_efd.c b/lib/efd/rte_efd.c index 77f46809f8..68a2378e88 100644 --- a/lib/efd/rte_efd.c +++ b/lib/efd/rte_efd.c @@ -495,7 +495,7 @@ efd_search_hash(struct rte_efd_table * const table, struct rte_efd_table * rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len, - uint8_t online_cpu_socket_bitmask, uint8_t offline_cpu_socket) + uint64_t online_cpu_socket_bitmask, uint8_t offline_cpu_socket) { struct rte_efd_table *table = NULL; uint8_t *key_array = NULL; diff --git a/lib/efd/rte_efd.h b/lib/efd/rte_efd.h index c2be4c09ae..d3d7befd0c 100644 --- a/lib/efd/rte_efd.h +++ b/lib/efd/rte_efd.h @@ -139,7 +139,7 @@ typedef uint16_t efd_hashfunc_t; */ struct rte_efd_table * rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len, - uint8_t online_cpu_socket_bitmask, uint8_t offline_cpu_socket); + uint64_t online_cpu_socket_bitmask, uint8_t offline_cpu_socket); /** * Releases the resources from an EFD table -- 2.25.1