summaryrefslogtreecommitdiff
path: root/examples/vm_power_manager
diff options
context:
space:
mode:
authorDavid Hunt <david.hunt@intel.com>2018-07-13 15:22:58 +0100
committerThomas Monjalon <thomas@monjalon.net>2018-07-20 22:53:17 +0200
commitd42b1300ad0b5e5e4e7c19bcfb7a0b2733b6e7c9 (patch)
tree2398f7f46600c4cc0d8a8ef363d4cd20113fc78d /examples/vm_power_manager
parent6453b9284b64ffee841c73193ed26b1f3ebc5b99 (diff)
downloaddpdk-d42b1300ad0b5e5e4e7c19bcfb7a0b2733b6e7c9.zip
dpdk-d42b1300ad0b5e5e4e7c19bcfb7a0b2733b6e7c9.tar.gz
dpdk-d42b1300ad0b5e5e4e7c19bcfb7a0b2733b6e7c9.tar.xz
examples/vm_power: add thread for oob core monitor
Change the app to now require three cores, as the third core will be used to run the oob montoring thread. Signed-off-by: David Hunt <david.hunt@intel.com> Acked-by: Radu Nicolau <radu.nicolau@intel.com>
Diffstat (limited to 'examples/vm_power_manager')
-rw-r--r--examples/vm_power_manager/main.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c
index 613a40a..aef97b9 100644
--- a/examples/vm_power_manager/main.c
+++ b/examples/vm_power_manager/main.c
@@ -29,6 +29,7 @@
#include "channel_monitor.h"
#include "power_manager.h"
#include "vm_power_cli.h"
+#include "oob_monitor.h"
#include "parse.h"
#include <rte_pmd_ixgbe.h>
#include <rte_pmd_i40e.h>
@@ -267,6 +268,17 @@ run_monitor(__attribute__((unused)) void *arg)
return 0;
}
+static int
+run_core_monitor(__attribute__((unused)) void *arg)
+{
+ if (branch_monitor_init() < 0) {
+ printf("Unable to initialize core monitor\n");
+ return -1;
+ }
+ run_branch_monitor();
+ return 0;
+}
+
static void
sig_handler(int signo)
{
@@ -285,12 +297,15 @@ main(int argc, char **argv)
unsigned int nb_ports;
struct rte_mempool *mbuf_pool;
uint16_t portid;
+ struct core_info *ci;
ret = core_info_init();
if (ret < 0)
rte_panic("Cannot allocate core info\n");
+ ci = get_core_info();
+
ret = rte_eal_init(argc, argv);
if (ret < 0)
rte_panic("Cannot init EAL\n");
@@ -365,16 +380,23 @@ main(int argc, char **argv)
}
}
+ check_all_ports_link_status(enabled_port_mask);
+
lcore_id = rte_get_next_lcore(-1, 1, 0);
if (lcore_id == RTE_MAX_LCORE) {
- RTE_LOG(ERR, EAL, "A minimum of two cores are required to run "
+ RTE_LOG(ERR, EAL, "A minimum of three cores are required to run "
"application\n");
return 0;
}
-
- check_all_ports_link_status(enabled_port_mask);
+ printf("Running channel monitor on lcore id %d\n", lcore_id);
rte_eal_remote_launch(run_monitor, NULL, lcore_id);
+ lcore_id = rte_get_next_lcore(lcore_id, 1, 0);
+ if (lcore_id == RTE_MAX_LCORE) {
+ RTE_LOG(ERR, EAL, "A minimum of three cores are required to run "
+ "application\n");
+ return 0;
+ }
if (power_manager_init() < 0) {
printf("Unable to initialize power manager\n");
return -1;
@@ -383,8 +405,17 @@ main(int argc, char **argv)
printf("Unable to initialize channel manager\n");
return -1;
}
+
+ printf("Running core monitor on lcore id %d\n", lcore_id);
+ rte_eal_remote_launch(run_core_monitor, NULL, lcore_id);
+
run_cli(NULL);
+ branch_monitor_exit();
+
rte_eal_mp_wait_lcore();
+
+ free(ci->cd);
+
return 0;
}