From patchwork Tue Jul 16 11:11:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hunt, David" X-Patchwork-Id: 56498 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0F3E82C6A; Tue, 16 Jul 2019 13:11:18 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id D740E2BF4 for ; Tue, 16 Jul 2019 13:11:16 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Jul 2019 04:11:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,498,1557212400"; d="scan'208";a="158108943" Received: from silpixa00399952.ir.intel.com (HELO silpixa00399952.ger.corp.intel.com) ([10.237.222.88]) by orsmga007.jf.intel.com with ESMTP; 16 Jul 2019 04:11:14 -0700 From: David Hunt To: dev@dpdk.org Cc: david.hunt@intel.com Date: Tue, 16 Jul 2019 12:11:12 +0100 Message-Id: <20190716111112.32427-1-david.hunt@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH v1] examples/power: fix policy handling for fifo X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" While the core frequency scale-up and scale down all works fine with the fifo-per-core functionaliry, 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 Acked-by: Anatoly Burakov --- examples/vm_power_manager/channel_monitor.c | 24 ++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c index 496772f8a..fe6088a18 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",