summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDavid Hunt <david.hunt@intel.com>2019-07-16 12:11:12 +0100
committerThomas Monjalon <thomas@monjalon.net>2019-07-17 22:53:38 +0200
commitabeef65dfdefbaedd14464dd07a8eb5f6a6ebacf (patch)
tree1f26820bcdfca665ce1c6f55da9cb983b9415cc9 /examples
parentb55d8fec46ce1f2a152f3687abb3222f675ce73e (diff)
downloaddpdk-abeef65dfdefbaedd14464dd07a8eb5f6a6ebacf.zip
dpdk-abeef65dfdefbaedd14464dd07a8eb5f6a6ebacf.tar.gz
dpdk-abeef65dfdefbaedd14464dd07a8eb5f6a6ebacf.tar.xz
examples/power: fix policy handling for FIFO
While the core frequency scale-up and scale down all works fine with the fifo-per-core functionality, there was a gap for policy handling. When creating or destroying a policy, the core associated with the FIFO needs to be automatically added to the core list, so the policy is associated with the correct core. Fixes: 221e7026d521 ("examples/power: add FIFO per core for JSON interface") Signed-off-by: David Hunt <david.hunt@intel.com> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/vm_power_manager/channel_monitor.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
index 496772f..fe6088a 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -835,6 +835,8 @@ read_json_packet(struct channel_info *chan_info)
json_t *root;
json_error_t error;
const char *resource_name;
+ char *start, *end;
+ uint32_t n;
/* read opening brace to closing brace */
@@ -882,7 +884,27 @@ read_json_packet(struct channel_info *chan_info)
"Error validating JSON profile data\n");
break;
}
- process_request(&pkt, chan_info);
+ start = strstr(pkt.vm_name,
+ CHANNEL_MGR_FIFO_PATTERN_NAME);
+ if (start != NULL) {
+ /* move past pattern to start of fifo id */
+ start += strlen(CHANNEL_MGR_FIFO_PATTERN_NAME);
+
+ end = start;
+ n = (uint32_t)strtoul(start, &end, 10);
+
+ if (end[0] == '\0') {
+ /* Add core id to core list */
+ pkt.num_vcpu = 1;
+ pkt.vcpu_to_control[0] = n;
+ process_request(&pkt, chan_info);
+ } else {
+ RTE_LOG(ERR, CHANNEL_MONITOR,
+ "Cannot extract core id from fifo name\n");
+ }
+ } else {
+ process_request(&pkt, chan_info);
+ }
} else {
RTE_LOG(ERR, CHANNEL_MONITOR,
"JSON error on line %d: %s\n",