#include "netdev-dpdk.h"
#include "openvswitch/dynamic-string.h"
#include "openvswitch/vlog.h"
+#include "ovs-numa.h"
#include "smap.h"
#include "vswitch-idl.h"
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
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];
{"memory type",
{"dpdk-alloc-mem", "dpdk-socket-mem", NULL,},
{"-m", "--socket-mem", NULL,},
- "1024,0", 1
+ default_dpdk_socket_mem, 1
},
};
}
}
+ free(default_dpdk_socket_mem);
+
return ret;
}
</p>
<p>
If dpdk-socket-mem and dpdk-alloc-mem are not specified, dpdk-socket-mem
- will be used and the default value is 1024,0. If dpdk-socket-mem and
- dpdk-alloc-mem are specified at same time, dpdk-socket-mem will be
- used as default. Changing this value requires restarting the daemon.
+ will be used and the default value is 1024 for each numa node. If
+ dpdk-socket-mem and dpdk-alloc-mem are specified at same time,
+ dpdk-socket-mem will be used as default. Changing this value
+ requires restarting the daemon.
</p>
</column>