aboutsummaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
authorBud Grise <griseb@cisco.com>2016-02-24 16:09:05 -0500
committerGerrit Code Review <gerrit@fd.io>2016-03-04 22:08:53 +0000
commit02301ef86375c7deb2aca6a6a77bd50aa7ebe1b7 (patch)
tree1c9509339f7a95baa49d7047f41624b165a7ac2e /vnet
parent2375fbd89d3605878f670f2f7bb371becb2011e7 (diff)
Allow dpdk linkstate and stat polling intervals to be set dynamically.
Change-Id: I6aa662e060f7ce01a4dd80ae2498dc91a8b65a8e Signed-off-by: Todd Foggoa (tfoggoa) <tfoggoa@cisco.com>
Diffstat (limited to 'vnet')
-rw-r--r--vnet/vnet/devices/dpdk/dpdk.h13
-rw-r--r--vnet/vnet/devices/dpdk/init.c35
2 files changed, 43 insertions, 5 deletions
diff --git a/vnet/vnet/devices/dpdk/dpdk.h b/vnet/vnet/devices/dpdk/dpdk.h
index e0ab0c581c2..77b19baff03 100644
--- a/vnet/vnet/devices/dpdk/dpdk.h
+++ b/vnet/vnet/devices/dpdk/dpdk.h
@@ -269,8 +269,11 @@ typedef struct {
#define DPDK_TX_RING_SIZE (4 * 1024)
-#define DPDK_STATS_POLL_INTERVAL 10.0
-#define DPDK_LINK_POLL_INTERVAL 3.0
+#define DPDK_STATS_POLL_INTERVAL (10.0)
+#define DPDK_MIN_STATS_POLL_INTERVAL (0.001) /* 1msec */
+
+#define DPDK_LINK_POLL_INTERVAL (3.0)
+#define DPDK_MIN_LINK_POLL_INTERVAL (0.001) /* 1msec */
typedef struct {
CLIB_CACHE_LINE_ALIGN_MARK(cacheline0);
@@ -389,6 +392,10 @@ typedef struct {
int input_cpu_first_index;
int input_cpu_count;
+ /* control interval of dpdk link state and stat polling */
+ f64 link_state_poll_interval;
+ f64 stat_poll_interval;
+
/* convenience */
vlib_main_t * vlib_main;
vnet_main_t * vnet_main;
@@ -486,6 +493,8 @@ void increment_efd_drop_counter (vlib_main_t * vm, u32 counter_index, u32 count)
vm->error_main.counters[my_n->error_heap_index+counter_index] += count;
}
+int dpdk_set_stat_poll_interval (f64 interval);
+int dpdk_set_link_state_poll_interval (f64 interval);
void dpdk_update_link_state (dpdk_device_t * xd, f64 now);
void dpdk_device_lock_init(dpdk_device_t * xd);
void dpdk_device_lock_free(dpdk_device_t * xd);
diff --git a/vnet/vnet/devices/dpdk/init.c b/vnet/vnet/devices/dpdk/init.c
index 668120cff0a..bcfaf25750a 100644
--- a/vnet/vnet/devices/dpdk/init.c
+++ b/vnet/vnet/devices/dpdk/init.c
@@ -1643,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) */
@@ -1652,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)
@@ -1675,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)
{
@@ -1803,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;