X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=vnet%2Fvnet%2Fdevices%2Fdpdk%2Finit.c;h=bcfaf25750a6732aecce160b2010493f709067c6;hb=02301ef86375c7deb2aca6a6a77bd50aa7ebe1b7;hp=e8fe554c32fcecabc41897fcaed0b733731bee14;hpb=dc03cf4eb4d2cb515d79d26f7b4cdef174ffa677;p=vpp.git diff --git a/vnet/vnet/devices/dpdk/init.c b/vnet/vnet/devices/dpdk/init.c index e8fe554c32f..bcfaf25750a 100644 --- a/vnet/vnet/devices/dpdk/init.c +++ b/vnet/vnet/devices/dpdk/init.c @@ -963,7 +963,6 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input) u8 no_pci = 0; u8 no_huge = 0; u8 huge_dir = 0; - u8 dump_physmem = 0; u8 file_prefix = 0; u8 * socket_mem = 0; @@ -1030,8 +1029,6 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input) } #endif - else if (unformat (input, "dump-physmem")) - dump_physmem = 1; else if (unformat (input, "num-mbufs %d", &dm->num_mbufs)) ; else if (unformat (input, "max-tx-queues %d", &dm->max_tx_queues)) @@ -1414,16 +1411,6 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input) dm->eal_init_args_str = format(dm->eal_init_args_str, "%s ", dm->eal_init_args[i]); - if (CLIB_DEBUG > 0) - { - int ix; - - clib_warning ("DPDK eal init args:\n"); - for (ix=0; ixeal_init_args); ix++) { - clib_warning (" %s\n", dm->eal_init_args[ix]); - } - } - ret = rte_eal_init(vec_len(dm->eal_init_args), (char **) dm->eal_init_args); /* lazy umount hugepages */ @@ -1433,10 +1420,8 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input) return clib_error_return (0, "rte_eal_init returned %d", ret); /* Dump the physical memory layout prior to creating the mbuf_pool */ - if (dump_physmem) { - fprintf(stdout, "DPDK physical memory layout:\n"); - rte_dump_physmem_layout(stdout); - } + fprintf(stdout, "DPDK physical memory layout:\n"); + rte_dump_physmem_layout(stdout); /* main thread 1st */ error = vlib_buffer_pool_create(vm, dm->num_mbufs, MBUF_SIZE, rte_socket_id()); @@ -1658,7 +1643,13 @@ dpdk_process (vlib_main_t * vm, while (1) { - vlib_process_wait_for_event_or_clock (vm, 5.0); + /* + * check each time through the loop in case intervals are changed + */ + f64 min_wait = dm->link_state_poll_interval < dm->stat_poll_interval ? + dm->link_state_poll_interval : dm->stat_poll_interval; + + vlib_process_wait_for_event_or_clock (vm, min_wait); if (dpdk_get_admin_up_down_in_progress()) /* skip the poll if an admin up down is in progress (on any interface) */ @@ -1667,9 +1658,9 @@ dpdk_process (vlib_main_t * vm, vec_foreach (xd, dm->devices) { f64 now = vlib_time_now (vm); - if ((now - xd->time_last_stats_update) >= DPDK_STATS_POLL_INTERVAL) + if ((now - xd->time_last_stats_update) >= dm->stat_poll_interval) dpdk_update_counters (xd, now); - if ((now - xd->time_last_link_update) >= DPDK_LINK_POLL_INTERVAL) + if ((now - xd->time_last_link_update) >= dm->link_state_poll_interval) dpdk_update_link_state (xd, now); if (xd->dev_type == VNET_DPDK_DEV_VHOST_USER) @@ -1690,6 +1681,26 @@ VLIB_REGISTER_NODE (dpdk_process_node,static) = { .process_log2_n_stack_bytes = 17, }; +int dpdk_set_stat_poll_interval (f64 interval) +{ + if (interval < DPDK_MIN_STATS_POLL_INTERVAL) + return (VNET_API_ERROR_INVALID_VALUE); + + dpdk_main.stat_poll_interval = interval; + + return 0; +} + +int dpdk_set_link_state_poll_interval (f64 interval) +{ + if (interval < DPDK_MIN_LINK_POLL_INTERVAL) + return (VNET_API_ERROR_INVALID_VALUE); + + dpdk_main.link_state_poll_interval = interval; + + return 0; +} + clib_error_t * dpdk_init (vlib_main_t * vm) { @@ -1818,6 +1829,9 @@ _(rte_nicvf_pmd_init) | IP_BUFFER_L4_CHECKSUM_COMPUTED | IP_BUFFER_L4_CHECKSUM_CORRECT); + dm->stat_poll_interval = DPDK_STATS_POLL_INTERVAL; + dm->link_state_poll_interval = DPDK_LINK_POLL_INTERVAL; + /* init CLI */ if ((error = vlib_call_init_function (vm, dpdk_cli_init))) return error;