diff options
author | Dave Wallace <dwallacelf@gmail.com> | 2020-01-21 16:56:19 +0000 |
---|---|---|
committer | Andrew Yourtchenko <ayourtch@gmail.com> | 2020-01-27 20:55:12 +0000 |
commit | 664c9613ac5485859c8307d66f6b2d5bc0f4fc43 (patch) | |
tree | 0c7046b6c7f2f100e5b410c4521ce174ad753853 /src/plugins | |
parent | 0c514f0d76762bbd408fd41f2799343facbb8e02 (diff) |
nsim: enable output scheduling on main thread
Type: fix
Ticket: VPP-1813
Change-Id: I5d47cb9bc7eb7f3c8485e3b42f0701e81d87ba2a
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
(cherry picked from commit c0c4eec3bc309bcc656eade82f17754875f9ed7c)
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/nsim/nsim.c | 30 | ||||
-rw-r--r-- | src/plugins/nsim/nsim.h | 1 |
2 files changed, 29 insertions, 2 deletions
diff --git a/src/plugins/nsim/nsim.c b/src/plugins/nsim/nsim.c index 5bc9eaecdd6..c6414905018 100644 --- a/src/plugins/nsim/nsim.c +++ b/src/plugins/nsim/nsim.c @@ -182,7 +182,8 @@ nsim_configure (nsim_main_t * nsm, f64 bandwidth, f64 delay, f64 packet_size, vec_validate (nsm->wheel_by_thread, num_workers); /* Initialize the output scheduler wheels */ - for (i = num_workers ? 1 : 0; i < num_workers + 1; i++) + i = (!nsm->poll_main_thread && num_workers) ? 1 : 0; + for (; i < num_workers + 1; i++) { nsim_wheel_t *wp; @@ -205,7 +206,8 @@ nsim_configure (nsim_main_t * nsm, f64 bandwidth, f64 delay, f64 packet_size, vlib_worker_thread_barrier_sync (vm); /* turn on the ring scrapers */ - for (i = num_workers ? 1 : 0; i < num_workers + 1; i++) + i = (!nsm->poll_main_thread && num_workers) ? 1 : 0; + for (; i < num_workers + 1; i++) { vlib_main_t *this_vm = vlib_mains[i]; @@ -287,6 +289,28 @@ nsim_cross_connect_enable_disable_command_fn (vlib_main_t * vm, return 0; } +static clib_error_t * +nsim_config (vlib_main_t * vm, unformat_input_t * input) +{ + nsim_main_t *nsm = &nsim_main; + + while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) + { + if (unformat (input, "poll-main-thread")) + { + nsm->poll_main_thread = 1; + } + else + { + return clib_error_return (0, "unknown input '%U'", + format_unformat_error, input); + } + } + return 0; +} + +VLIB_CONFIG_FUNCTION (nsim_config, "nsim"); + /*? * Enable or disable network simulation cross-connect on two interfaces * The network simulator must have already been configured, see @@ -584,6 +608,8 @@ set_nsim_command_fn (vlib_main_t * vm, return clib_error_return (0, "drop fraction must be between zero and 1"); } + else if (unformat (input, "poll-main-thread")) + nsm->poll_main_thread = 1; else break; } diff --git a/src/plugins/nsim/nsim.h b/src/plugins/nsim/nsim.h index 6afe32dc7f7..0ed9b251fbc 100644 --- a/src/plugins/nsim/nsim.h +++ b/src/plugins/nsim/nsim.h @@ -68,6 +68,7 @@ typedef struct f64 bandwidth; f64 packet_size; f64 drop_fraction; + u32 poll_main_thread; u64 mmap_size; |