examples/power: fix ack for enable/disable turbo
authorDavid Hunt <david.hunt@intel.com>
Tue, 11 Feb 2020 10:50:08 +0000 (10:50 +0000)
committerDavid Marchand <david.marchand@redhat.com>
Thu, 13 Feb 2020 17:22:19 +0000 (18:22 +0100)
commit1e3ec03d8ac118eaf5ef76036c0a24c598589add
tree4ac13554bc494759214e615a025f80799a432420
parent2582bb980d287b05f378e5a4a467f217a5d63926
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 <david.hunt@intel.com>
Acked-by: Lei Yao <lei.a.yao@intel.com>
examples/vm_power_manager/channel_monitor.c