net/vmxnet3: return correct value for VMXNET3_CMD_GET_DID_* command

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 (5.x+)
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>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
Miao Yan 2015-12-22 22:06:08 -08:00 committed by Jason Wang
parent fde58177aa
commit c469669ef7

View File

@ -1650,6 +1650,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;
@ -1693,6 +1701,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;