From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id D8B62A0679 for ; Thu, 28 Mar 2019 12:30:12 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D606B1B163; Thu, 28 Mar 2019 12:30:11 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 7A73B1B150; Thu, 28 Mar 2019 12:30:10 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Mar 2019 04:30:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,280,1549958400"; d="scan'208";a="218352901" Received: from mhajkowx-mobl.ger.corp.intel.com ([10.104.116.174]) by orsmga001.jf.intel.com with ESMTP; 28 Mar 2019 04:30:02 -0700 From: Hajkowski To: david.hunt@intel.com Cc: dev@dpdk.org, Marcin Hajkowski , stable@dpdk.org Date: Thu, 28 Mar 2019 12:28:41 +0100 Message-Id: <20190328112841.13848-1-marcinx.hajkowski@intel.com> X-Mailer: git-send-email 2.20.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] examples/guest_cli: fix hardcoded lcoreid 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" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190328112841.l26hsvLASy83l8jMpPAmdxCA3D65sSzVOLook34Q4i8@z> From: Marcin Hajkowski In current implementation lcoreid 1 is used regardless of currently available cores. This change introduce dynamic core selection for sending policy. Fixes: d191f08533 ("examples/guest_cli: add send policy to host") Cc: stable@dpdk.org Signed-off-by: Marcin Hajkowski --- .../vm_power_manager/guest_cli/vm_power_cli_guest.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c index 2d9e7689a..bd3cee904 100644 --- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c +++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c @@ -188,8 +188,16 @@ static inline int send_policy(struct channel_packet *pkt) { int ret; + unsigned int lcore_id; - ret = rte_power_guest_channel_send_msg(pkt, 1); + /* Get first enabled lcore. */ + lcore_id = rte_get_next_lcore(-1, + 0, + 0); + if (lcore_id == RTE_MAX_LCORE) + return -1; + + ret = rte_power_guest_channel_send_msg(pkt, lcore_id); if (ret == 0) return 1; RTE_LOG(DEBUG, POWER, "Error sending message: %s\n", -- 2.17.2