From: David Hunt Date: Tue, 11 Feb 2020 10:50:08 +0000 (+0000) Subject: examples/power: fix ack for enable/disable turbo X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=1e3ec03d8ac118eaf5ef76036c0a24c598589add;p=dpdk.git examples/power: fix ack for enable/disable turbo 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") Cc: stable@dpdk.org Signed-off-by: David Hunt Acked-by: Lei Yao --- diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c index 090c2a98b0..1d00a6cf6c 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)