[dpdk-dev] [PATCH 4/4] [PATCH 4/4] virtio: Fixes the VIRTIO_PCI_CONFIG macro to use the correct offset to the Virtio header

Alan Carew alan.carew at intel.com
Thu Jun 5 16:39:19 CEST 2014


This final patch address the issue of not being able to determine the correct
offet when MSI-X is disabled.

Signed-off-by: Alan Carew <alan.carew at intel.com>
---
 lib/librte_pmd_virtio/virtio_ethdev.c |    1 +
 lib/librte_pmd_virtio/virtio_pci.h    |    4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c b/lib/librte_pmd_virtio/virtio_ethdev.c
index c2b4dfb..819e7d7 100644
--- a/lib/librte_pmd_virtio/virtio_ethdev.c
+++ b/lib/librte_pmd_virtio/virtio_ethdev.c
@@ -719,6 +719,7 @@ eth_virtio_dev_init(__rte_unused struct eth_driver *eth_drv,
 	}
 #endif
 	hw->io_base = (uint32_t)(uintptr_t)pci_dev->mem_resource[0].addr;
+	hw->intr_mode = pci_dev->intr_mode;
 
 	/* Reset the device although not necessary at startup */
 	vtpci_reset(hw);
diff --git a/lib/librte_pmd_virtio/virtio_pci.h b/lib/librte_pmd_virtio/virtio_pci.h
index 96443c7..7b3d0ef 100644
--- a/lib/librte_pmd_virtio/virtio_pci.h
+++ b/lib/librte_pmd_virtio/virtio_pci.h
@@ -44,6 +44,7 @@
 #endif
 
 #include <rte_ethdev.h>
+#include <rte_pci_dev_feature_defs.h>
 
 struct virtqueue;
 
@@ -177,6 +178,7 @@ struct virtio_hw {
 	uint16_t    subsystem_device_id;
 	uint16_t    subsystem_vendor_id;
 	uint8_t     revision_id;
+	enum        igbuio_intr_mode  intr_mode;
 	uint8_t     mac_addr[ETHER_ADDR_LEN];
 	int         adapter_stopped;
 	struct      rte_eth_stats eth_stats;
@@ -201,7 +203,7 @@ struct virtio_net_config {
  * The remaining space is defined by each driver as the per-driver
  * configuration space.
  */
-#define VIRTIO_PCI_CONFIG(hw) (((hw)->guest_features & VIRTIO_PCI_FLAG_MSIX) ? 24 : 20)
+#define VIRTIO_PCI_CONFIG(hw) (((hw)->intr_mode == IGBUIO_MSIX_INTR_MODE) ? 24 : 20)
 
 /*
  * How many bits to shift physical queue address written to QUEUE_PFN.
-- 
1.7.0.7



More information about the dev mailing list