mirror of
https://github.com/openvswitch/ovs
synced 2025-08-30 22:05:19 +00:00
OVS-DPDK: Change "dpdk-socket-mem" default value.
When "dpdk-socket-mem" and "dpdk-alloc-mem" are not specified, "dpdk-socket-mem" will be set to allocate 1024MB on each NUMA node. This change will prevent OVS from failing when NIC is attached on NUMA node 1 and higher. Patch contains documentation update. Signed-off-by: Marcin Rybka <marcinx.rybka@intel.com> Co-authored-by: Billy O'Mahony <billy.o.mahony@intel.com> Signed-off-by: Billy O'Mahony <billy.o.mahony@intel.com> Tested-by: Hariprasad Govindharajan <hariprasad.govindharajan@intel.com> Signed-off-by: Ian Stokes <ian.stokes@intel.com>
This commit is contained in:
28
lib/dpdk.c
28
lib/dpdk.c
@@ -36,6 +36,7 @@
|
||||
#include "netdev-dpdk.h"
|
||||
#include "openvswitch/dynamic-string.h"
|
||||
#include "openvswitch/vlog.h"
|
||||
#include "ovs-numa.h"
|
||||
#include "smap.h"
|
||||
#include "vswitch-idl.h"
|
||||
|
||||
@@ -167,6 +168,28 @@ construct_dpdk_options(const struct smap *ovs_other_config,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char *
|
||||
construct_dpdk_socket_mem(void)
|
||||
{
|
||||
int numa;
|
||||
const char *def_value = "1024";
|
||||
int numa_nodes = ovs_numa_get_n_numas();
|
||||
|
||||
if (numa_nodes == 0 || numa_nodes == OVS_NUMA_UNSPEC) {
|
||||
numa_nodes = 1;
|
||||
}
|
||||
/* Allocate enough memory for digits, comma-sep and terminator. */
|
||||
char *dpdk_socket_mem = xzalloc(numa_nodes * (strlen(def_value) + 1));
|
||||
|
||||
strcat(dpdk_socket_mem, def_value);
|
||||
for (numa = 1; numa < numa_nodes; ++numa) {
|
||||
strcat(dpdk_socket_mem, ",");
|
||||
strcat(dpdk_socket_mem, def_value);
|
||||
}
|
||||
|
||||
return dpdk_socket_mem;
|
||||
}
|
||||
|
||||
#define MAX_DPDK_EXCL_OPTS 10
|
||||
|
||||
static int
|
||||
@@ -174,6 +197,7 @@ construct_dpdk_mutex_options(const struct smap *ovs_other_config,
|
||||
char ***argv, const int initial_size,
|
||||
char **extra_args, const size_t extra_argc)
|
||||
{
|
||||
char *default_dpdk_socket_mem = construct_dpdk_socket_mem();
|
||||
struct dpdk_exclusive_options_map {
|
||||
const char *category;
|
||||
const char *ovs_dpdk_options[MAX_DPDK_EXCL_OPTS];
|
||||
@@ -184,7 +208,7 @@ construct_dpdk_mutex_options(const struct smap *ovs_other_config,
|
||||
{"memory type",
|
||||
{"dpdk-alloc-mem", "dpdk-socket-mem", NULL,},
|
||||
{"-m", "--socket-mem", NULL,},
|
||||
"1024,0", 1
|
||||
default_dpdk_socket_mem, 1
|
||||
},
|
||||
};
|
||||
|
||||
@@ -231,6 +255,8 @@ construct_dpdk_mutex_options(const struct smap *ovs_other_config,
|
||||
}
|
||||
}
|
||||
|
||||
free(default_dpdk_socket_mem);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user