Skip to contentSkip to conversation

efd: change data type of parameter

PATCH Superseded Pablo de Lara 1 participant 1 message Sep 17, 2021

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 efd: change data type of parameter

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")

---

v2: Fixed EFD tests

 app/test/test_efd.c      | 4 ++--
 app/test/test_efd_perf.c | 4 ++--
 lib/efd/rte_efd.c        | 2 +-
 lib/efd/rte_efd.h        | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)
app/test/test_efd.c +2 -2
index 180dc4748e..581519c1e0 100644
@@ -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;
app/test/test_efd_perf.c +2 -2
index 1c47704475..f3fe3b1736 100644
@@ -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;
lib/efd/rte_efd.c +1 -1
index 77f46809f8..68a2378e88 100644
@@ -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;
lib/efd/rte_efd.h +1 -1
index c2be4c09ae..d3d7befd0c 100644
@@ -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
Signature · 1 line
2.25.1