From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39490) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBGHY-000712-0Q for qemu-devel@nongnu.org; Tue, 22 Dec 2015 01:18:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aBGHV-00064k-St for qemu-devel@nongnu.org; Tue, 22 Dec 2015 01:18:47 -0500 Received: from mail-pf0-x22c.google.com ([2607:f8b0:400e:c00::22c]:34676) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBGHV-00064g-Nl for qemu-devel@nongnu.org; Tue, 22 Dec 2015 01:18:45 -0500 Received: by mail-pf0-x22c.google.com with SMTP id u7so54609847pfb.1 for ; Mon, 21 Dec 2015 22:18:45 -0800 (PST) From: Miao Yan Date: Mon, 21 Dec 2015 22:18:21 -0800 Message-Id: <1450765104-26135-2-git-send-email-yanmiaobest@gmail.com> In-Reply-To: <1450765104-26135-1-git-send-email-yanmiaobest@gmail.com> References: <1450765104-26135-1-git-send-email-yanmiaobest@gmail.com> Subject: [Qemu-devel] [PATCH v2 1/4] net/vmxnet3: return 1 on device activation failure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: jasowang@redhat.com, dmitry@daynix.com, qemu-devel@nongnu.org When reading device status, 0 means device is successfully activated and 1 means error. This behavior can be observed by the following steps: 1) run a Linux distro on esxi server 2) modify vmxnet3 Linux driver to give it an invalid address to 'adapter->shared_pa' which is the shared memory for guest/host communication This will trigger device activation failure and kernel log will have the following message: [ 7138.403256] vmxnet3 0000:03:00.0 eth1: Failed to activate dev: error 1 So return 1 on device activation failure instead of -1; Signed-off-by: Miao Yan --- hw/net/vmxnet3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c index e168285..9185408 100644 --- a/hw/net/vmxnet3.c +++ b/hw/net/vmxnet3.c @@ -1652,7 +1652,7 @@ static uint64_t vmxnet3_get_command_status(VMXNET3State *s) switch (s->last_command) { case VMXNET3_CMD_ACTIVATE_DEV: - ret = (s->device_active) ? 0 : -1; + ret = (s->device_active) ? 0 : 1; VMW_CFPRN("Device active: %" PRIx64, ret); break; -- 1.9.1