From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 760EFA051C; Tue, 11 Feb 2020 11:50:31 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0C9F12BF1; Tue, 11 Feb 2020 11:50:30 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 58A3D2BD3; Tue, 11 Feb 2020 11:50:27 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Feb 2020 02:50:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,428,1574150400"; d="scan'208";a="256438126" Received: from silpixa00399952.ir.intel.com (HELO silpixa00399952.ger.corp.intel.com) ([10.237.222.38]) by fmsmga004.fm.intel.com with ESMTP; 11 Feb 2020 02:50:25 -0800 From: David Hunt To: dev@dpdk.org, david.hunt@intel.com Cc: lei.a.yao@intel.com, stable@dpdk.org Date: Tue, 11 Feb 2020 10:50:08 +0000 Message-Id: <20200211105008.4540-1-david.hunt@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] examples/power: fix ack for enable/disable turbo 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" When a VM sends a command through virtio-serial to enable/disable turbo, it is successfully enabled or disabled, yet the response to the VM is NACK. This is because all the library frequency change APIs return 1 for success (change in frequency), 0 for success (no change in frequency) and -1 for failure. However the turbo enable/disable APIs just return 0 for success and -1 for failure. Fix the handling of the return code to treat ">= 0" as success, and send an ACK. Only send NACK when < 0 (failure). Fixes: 0de94bcac7fc ("examples/vm_power: send confirmation cmd to guest") Signed-off-by: David Hunt --- examples/vm_power_manager/channel_monitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c index 090c2a98b..1d00a6cf6 100644 --- a/examples/vm_power_manager/channel_monitor.c +++ b/examples/vm_power_manager/channel_monitor.c @@ -868,7 +868,7 @@ process_request(struct channel_packet *pkt, struct channel_info *chan_info) if (valid_unit) { ret = send_ack_for_received_cmd(pkt, chan_info, - scale_res > 0 ? + scale_res >= 0 ? CPU_POWER_CMD_ACK : CPU_POWER_CMD_NACK); if (ret < 0) -- 2.17.1