diff options
author | Nathan Skrzypczak <nathan.skrzypczak@gmail.com> | 2020-11-23 16:23:11 +0100 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2020-11-24 12:54:21 +0000 |
commit | f06b3bdd9232e722c04062de58da5b45a115bc34 (patch) | |
tree | d66ebc2e62cefef0597e225739a64d0d65c76d7c /src/plugins/dpdk/device | |
parent | 6a2794ea2b8cb439308c3991e2ec57e158cdc7c9 (diff) |
dpdk: fix eal in nohugtlb mode
When running with `dpdk { no-hugetlb }` dont try
to allocate hugepages and remove --in-memory as
this seems to be rejected by DPDK
Type: fix
Change-Id: I02c56ade0b4e706b3f76331745e2af64bb62f6e0
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/plugins/dpdk/device')
-rw-r--r-- | src/plugins/dpdk/device/init.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c index 58de03b5343..2d2281e64a9 100644 --- a/src/plugins/dpdk/device/init.c +++ b/src/plugins/dpdk/device/init.c @@ -1177,6 +1177,7 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input) u8 *s, *tmp = 0; int ret, i; int num_whitelisted = 0; + int eal_no_hugetlb = 0; u8 no_pci = 0; u8 no_vmbus = 0; u8 file_prefix = 0; @@ -1195,6 +1196,7 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input) if (unformat (input, "no-hugetlb")) { vec_add1 (conf->eal_init_args, (u8 *) "--no-huge"); + eal_no_hugetlb = 1; } else if (unformat (input, "telemetry")) conf->enable_telemetry = 1; @@ -1345,22 +1347,27 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input) if (!conf->uio_driver_name) conf->uio_driver_name = format (0, "auto%c", 0); - default_hugepage_sz = clib_mem_get_default_hugepage_size (); - - /* *INDENT-OFF* */ - clib_bitmap_foreach (x, tm->cpu_socket_bitmap, ( + if (eal_no_hugetlb == 0) { - clib_error_t *e; - uword n_pages; - /* preallocate at least 16MB of hugepages per socket, - if more is needed it is up to consumer to preallocate more */ - n_pages = round_pow2 ((uword) 16 << 20, default_hugepage_sz); - n_pages /= default_hugepage_sz; - - if ((e = clib_sysfs_prealloc_hugepages(x, 0, n_pages))) - clib_error_report (e); - })); - /* *INDENT-ON* */ + vec_add1 (conf->eal_init_args, (u8 *) "--in-memory"); + + default_hugepage_sz = clib_mem_get_default_hugepage_size (); + + /* *INDENT-OFF* */ + clib_bitmap_foreach (x, tm->cpu_socket_bitmap, ( + { + clib_error_t *e; + uword n_pages; + /* preallocate at least 16MB of hugepages per socket, + if more is needed it is up to consumer to preallocate more */ + n_pages = round_pow2 ((uword) 16 << 20, default_hugepage_sz); + n_pages /= default_hugepage_sz; + + if ((e = clib_sysfs_prealloc_hugepages(x, 0, n_pages))) + clib_error_report (e); + })); + /* *INDENT-ON* */ + } /* on/off dpdk's telemetry thread */ if (conf->enable_telemetry == 0) @@ -1720,7 +1727,6 @@ dpdk_init (vlib_main_t * vm) dm->conf->nchannels = 4; vec_add1 (dm->conf->eal_init_args, (u8 *) "vnet"); - vec_add1 (dm->conf->eal_init_args, (u8 *) "--in-memory"); /* Default vlib_buffer_t flags, DISABLES tcp/udp checksumming... */ dm->buffer_flags_template = (VLIB_BUFFER_TOTAL_LENGTH_VALID | |