summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTom Jones <thj@freebsd.org>2024-05-07 10:07:47 +0000
committerDamjan Marion <dmarion@0xa5.net>2024-05-14 07:34:25 +0000
commit2f5d094ddd82c2ae429b38b3963456e0ef9c8225 (patch)
treec025e44c1eadc6d98926c81aabe7a05bcf007816 /src
parent16cc51b88a16c14002aebcff9943167b75d79a92 (diff)
dpdk: Only prealloc huge pages on Linux
Type: improvement Change-Id: I4d9c0f96d81c8b510086a54990b3fcd3d5fdb695 Signed-off-by: Tom Jones <thj@freebsd.org>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/dpdk/device/init.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index 421f662efa2..e416efe2e4d 100644
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -1045,12 +1045,14 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
dpdk_main_t *dm = &dpdk_main;
clib_error_t *error = 0;
dpdk_config_main_t *conf = &dpdk_config_main;
- vlib_thread_main_t *tm = vlib_get_thread_main ();
dpdk_device_config_t *devconf;
vlib_pci_addr_t pci_addr = { 0 };
vlib_vmbus_addr_t vmbus_addr = { 0 };
unformat_input_t sub_input;
+#ifdef __linux
+ vlib_thread_main_t *tm = vlib_get_thread_main ();
uword default_hugepage_sz, x;
+#endif /* __linux__ */
u8 *s, *tmp = 0;
int ret, i;
int num_whitelisted = 0;
@@ -1258,6 +1260,11 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
{
vec_add1 (conf->eal_init_args, (u8 *) "--in-memory");
+#ifdef __linux__
+ /*
+ * FreeBSD performs huge page prealloc through a dedicated kernel mode
+ * this process is only required on Linux.
+ */
default_hugepage_sz = clib_mem_get_default_hugepage_size ();
clib_bitmap_foreach (x, tm->cpu_socket_bitmap)
@@ -1272,6 +1279,7 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
if ((e = clib_sysfs_prealloc_hugepages(x, 0, n_pages)))
clib_error_report (e);
}
+#endif /* __linux__ */
}
/* on/off dpdk's telemetry thread */