Skip to content

Commit

Permalink
efd: allow more CPU sockets in table creation
Browse files Browse the repository at this point in the history
[ upstream commit 8751a7e ]

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 uint64_t increases it to 64, which should be
more future-proof.

Coverity issue: 366390
Fixes: 56b6ef8 ("efd: new Elastic Flow Distributor library")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Yipeng Wang <yipeng1.wang@intel.com>
Tested-by: David Christensen <drc@linux.vnet.ibm.com>
  • Loading branch information
pablodelara authored and cpaelzer committed Nov 30, 2021
1 parent 6cd9c88 commit 6cf6872
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions app/test/test_efd.c
Expand Up @@ -96,9 +96,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_master_lcore();
const int val_true = 1, val_false = 0;
Expand Down Expand Up @@ -448,6 +448,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)
Expand Down
4 changes: 2 additions & 2 deletions app/test/test_efd_perf.c
Expand Up @@ -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_master_lcore();
const int val_true = 1, val_false = 0;
Expand Down
2 changes: 1 addition & 1 deletion lib/librte_efd/rte_efd.c
Expand Up @@ -494,7 +494,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;
Expand Down
2 changes: 1 addition & 1 deletion lib/librte_efd/rte_efd.h
Expand Up @@ -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
Expand Down

0 comments on commit 6cf6872

Please sign in to comment.