X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=VNFs%2FDPPD-PROX%2Frun.c;h=c05f0a9ff9e2cb9f58063bb824d49cf76a0cb386;hb=ba394f91bd74cd2f0dac04dfbcece5b3cb461f3e;hp=971d71480a573a5b5998fb9f67500ea9ab760fb4;hpb=4eca0440aee462f842567d5ef8b8796c27f4dd1b;p=samplevnf.git diff --git a/VNFs/DPPD-PROX/run.c b/VNFs/DPPD-PROX/run.c index 971d7148..c05f0a9f 100644 --- a/VNFs/DPPD-PROX/run.c +++ b/VNFs/DPPD-PROX/run.c @@ -37,6 +37,7 @@ #include "input.h" #include "input_curses.h" #include "input_conn.h" +#include "handle_master.h" static int needs_refresh; static uint64_t update_interval; @@ -77,8 +78,11 @@ static void update_link_states(void) port_cfg = &prox_port_cfg[portid]; rte_eth_link_get_nowait(portid, &link); - port_cfg->link_up = link.link_status; port_cfg->link_speed = link.link_speed; + if (port_cfg->link_up != link.link_status) { + port_cfg->link_up = link.link_status; + plog_info("port %d: Link speed now %d Mbps\n", portid, link.link_speed); + } } } @@ -127,7 +131,10 @@ static void busy_wait_until(uint64_t deadline) static void multiplexed_input_stats(uint64_t deadline) { - input_proc_until(deadline); + if (deadline) + input_proc_until(deadline); + else + input_proc(); if (needs_refresh) { needs_refresh = 0; @@ -164,6 +171,7 @@ void __attribute__((noreturn)) run(uint32_t flags) uint64_t cur_tsc; uint64_t next_update; uint64_t stop_tsc = 0; + int ret = 0; const uint64_t update_interval_threshold = usec_to_tsc(1); if (flags & DSF_LISTEN_TCP) @@ -209,20 +217,57 @@ void __attribute__((noreturn)) run(uint32_t flags) cmd_rx_tx_info(); print_warnings(); - while (stop_prox == 0) { - - if (update_interval < update_interval_threshold) - busy_wait_until(next_update); - else - multiplexed_input_stats(next_update); - - next_update += update_interval; - - stats_update(stats_cons_flags); - stats_cons_notify(); - - if (stop_tsc && rte_rdtsc() >= stop_tsc) { - stop_prox = 1; + struct task_master *task = (struct task_master *)lcore_cfg[prox_cfg.master].tasks_all[0]; + if (handle_ctrl_plane) { + while (stop_prox == 0) { + ret = 1; + // Run ctrl plane for max 10 msec to let screen and keyboard updates + if (prox_cfg.flags & DSF_CTRL_PLANE_ENABLED) { + uint64_t ctrl_plane_update = rte_rdtsc() + msec_to_tsc(10); + while ((ret) && (rte_rdtsc() < ctrl_plane_update)) + ret = handle_ctrl_plane(lcore_cfg[prox_cfg.master].tasks_all[0], NULL, 0); + } + multiplexed_input_stats(0); + if (rte_rdtsc() < next_update) + continue; + next_update += update_interval; + stats_update(stats_cons_flags); + stats_cons_notify(); + + if (stop_tsc && rte_rdtsc() >= stop_tsc) { + stop_prox = 1; + } + if ((prox_cfg.heartbeat_tsc) && (prox_cfg.heartbeat_timeout) && (rte_rdtsc() >= prox_cfg.heartbeat_tsc)) { + plog_info("Stopping to handle client as heartbeat timed out\n"); + stop_core_all(-1); + stop_handling_client(); + req_refresh(); + prox_cfg.heartbeat_tsc = 0; + } + } + } else { + while (stop_prox == 0) { + + if (update_interval < update_interval_threshold) + busy_wait_until(next_update); + else + multiplexed_input_stats(next_update); + + next_update += update_interval; + + stats_update(stats_cons_flags); + stats_cons_notify(); + + if (stop_tsc && rte_rdtsc() >= stop_tsc) { + stop_prox = 1; + } + if ((prox_cfg.heartbeat_tsc) && (prox_cfg.heartbeat_timeout) && (rte_rdtsc() >= prox_cfg.heartbeat_tsc)) { + plog_info("Stopping to handle client as heartbeat timed out\n"); + stop_core_all(-1); + stop_handling_client(); + req_refresh(); + prox_cfg.heartbeat_tsc = 0; + } } }