qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Miao Yan <yanmiaobest@gmail.com>
To: jasowang@redhat.com, dmitry@daynix.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH v2 2/4] net/vmxnet3: return correct value for VMXNET3_CMD_GET_DID_* command
Date: Mon, 21 Dec 2015 22:18:22 -0800	[thread overview]
Message-ID: <1450765104-26135-3-git-send-email-yanmiaobest@gmail.com> (raw)
In-Reply-To: <1450765104-26135-1-git-send-email-yanmiaobest@gmail.com>

VMXNET3_CMD_GET_DID_LO should return PCI ID of the device
and VMXNET3_CMD_GET_DID_HI should return vmxnet3 revision ID.

This behavior can be observed by the following steps:

1) run a Linux distro on esxi server
2) modify vmxnet3 Linux driver to read DID_HI and DID_LO:

  VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_DID_LO);
  lo =  VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD);

  VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_DID_HI);
  high =  VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD);
  pr_info("vmxnet3 DID lo: 0x%x, high: 0x%x\n", lo, high);

The kernel log will have something like the following message:

  [ 7005.111170] vmxnet3 DID lo: 0x7b0, high: 0x1

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
---
Changes in v2: 
 - update vmxnet3_handle_command not to print error when issuing these commands

 hw/net/vmxnet3.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
index 9185408..cddbf6d 100644
--- a/hw/net/vmxnet3.c
+++ b/hw/net/vmxnet3.c
@@ -1640,6 +1640,14 @@ static void vmxnet3_handle_command(VMXNET3State *s, uint64_t cmd)
                   "adaptive ring info flags");
         break;
 
+    case VMXNET3_CMD_GET_DID_LO:
+        VMW_CBPRN("Set: Get lower part of device ID");
+        break;
+
+    case VMXNET3_CMD_GET_DID_HI:
+        VMW_CBPRN("Set: Get upper part of device ID");
+        break;
+
     default:
         VMW_CBPRN("Received unknown command: %" PRIx64, cmd);
         break;
@@ -1683,6 +1691,14 @@ static uint64_t vmxnet3_get_command_status(VMXNET3State *s)
         ret = VMXNET3_DISABLE_ADAPTIVE_RING;
         break;
 
+    case VMXNET3_CMD_GET_DID_LO:
+        ret = PCI_DEVICE_ID_VMWARE_VMXNET3;
+        break;
+
+    case VMXNET3_CMD_GET_DID_HI:
+        ret = VMXNET3_DEVICE_REVISION;
+        break;
+
     default:
         VMW_WRPRN("Received request for unknown command: %x", s->last_command);
         ret = -1;
-- 
1.9.1

  parent reply	other threads:[~2015-12-22  6:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-22  6:18 [Qemu-devel] [PATCH v2 0/4] correct some register return values for vxmnet3 Miao Yan
2015-12-22  6:18 ` [Qemu-devel] [PATCH v2 1/4] net/vmxnet3: return 1 on device activation failure Miao Yan
2015-12-22 20:41   ` Shmulik Ladkani
2015-12-22 21:13     ` Shmulik Ladkani
2015-12-22  6:18 ` Miao Yan [this message]
2015-12-22 20:49   ` [Qemu-devel] [PATCH v2 2/4] net/vmxnet3: return correct value for VMXNET3_CMD_GET_DID_* command Shmulik Ladkani
2015-12-23  3:02     ` Miao Yan
2015-12-22 21:17   ` Shmulik Ladkani
2015-12-22  6:18 ` [Qemu-devel] [PATCH v2 3/4] net/vmxnet3: return correct value for VMXNET3_CMD_GET_DEV_EXTRA_INFO Miao Yan
2015-12-22 20:51   ` Shmulik Ladkani
2015-12-22  6:18 ` [Qemu-devel] [PATCH v2 4/4] net/vmxnet3: return 0 on unknown command Miao Yan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1450765104-26135-3-git-send-email-yanmiaobest@gmail.com \
    --to=yanmiaobest@gmail.com \
    --cc=dmitry@daynix.com \
    --cc=jasowang@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).