DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/1] librte_pmd_virtio: Fix incorrect device specific header offset when MSI-X is disabled
@ 2014-06-16 11:10 Alan Carew
  2014-06-16 11:10 ` [dpdk-dev] [PATCH 1/1] " Alan Carew
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Carew @ 2014-06-16 11:10 UTC (permalink / raw)
  To: dev

Following discussion with Stephen Hemminger and Neil Horman:
http://dpdk.org/ml/archives/dev/2014-June/003139.html
http://dpdk.org/ml/archives/dev/2014-June/003333.html
http://dpdk.org/ml/archives/dev/2014-June/003295.html

There is no need for sysfs entries, instead localise the logic to
virtio_ethdev, I am basing this on Stephens effort to include
FreeBSD support.

Suggested-by: Neil Horman <nhorman@tuxdriver.com>
Suggested-by: Stephen Hemminger <stephen@networkplumber.org>

Alan Carew (1):
  librte_pmd_virtio: Fix incorrect device specific header offset when
    MSI-X is disabled

 config/common_bsdapp                  |  2 +-
 lib/librte_pmd_virtio/virtio_ethdev.c | 28 +++++++++++++++++++++++++++-
 lib/librte_pmd_virtio/virtio_pci.h    |  5 ++---
 3 files changed, 30 insertions(+), 5 deletions(-)

-- 
1.9.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dpdk-dev] [PATCH 1/1] librte_pmd_virtio: Fix incorrect device specific header offset when MSI-X is disabled
  2014-06-16 11:10 [dpdk-dev] [PATCH 0/1] librte_pmd_virtio: Fix incorrect device specific header offset when MSI-X is disabled Alan Carew
@ 2014-06-16 11:10 ` Alan Carew
  2014-07-22 13:10   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Carew @ 2014-06-16 11:10 UTC (permalink / raw)
  To: dev

Signed-off-by: Alan Carew <alan.carew@intel.com>
---
 config/common_bsdapp                  |  2 +-
 lib/librte_pmd_virtio/virtio_ethdev.c | 28 +++++++++++++++++++++++++++-
 lib/librte_pmd_virtio/virtio_pci.h    |  5 ++---
 3 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index ef8eeab..f7397ee 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -169,7 +169,7 @@ CONFIG_RTE_IXGBE_RX_OLFLAGS_DISABLE=n
 #
 # Compile burst-oriented VIRTIO PMD driver
 #
-CONFIG_RTE_LIBRTE_VIRTIO_PMD=n
+CONFIG_RTE_LIBRTE_VIRTIO_PMD=y
 CONFIG_RTE_LIBRTE_VIRTIO_DEBUG_INIT=n
 CONFIG_RTE_LIBRTE_VIRTIO_DEBUG_RX=n
 CONFIG_RTE_LIBRTE_VIRTIO_DEBUG_TX=n
diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c b/lib/librte_pmd_virtio/virtio_ethdev.c
index d0b419d..ecdf6f8 100644
--- a/lib/librte_pmd_virtio/virtio_ethdev.c
+++ b/lib/librte_pmd_virtio/virtio_ethdev.c
@@ -583,7 +583,8 @@ parse_sysfs_value(const char *filename, unsigned long *val)
 	return 0;
 }
 
-static int get_uio_dev(struct rte_pci_addr *loc, char *buf, unsigned int buflen)
+static
+int get_uio_dev(struct rte_pci_addr *loc, char *buf, unsigned int buflen)
 {
 	unsigned int uio_num;
 	struct dirent *e;
@@ -647,6 +648,30 @@ static int get_uio_dev(struct rte_pci_addr *loc, char *buf, unsigned int buflen)
 
 	return 0;
 }
+
+static int
+virtio_has_msix(const struct rte_pci_addr *loc)
+{
+	DIR *d;
+	char dirname[PATH_MAX];
+
+	rte_snprintf(dirname, sizeof(dirname),
+		     SYSFS_PCI_DEVICES "/" PCI_PRI_FMT "/msi_irqs",
+		     loc->domain, loc->bus, loc->devid, loc->function);
+
+	d = opendir(dirname);
+	if (d)
+		closedir(d);
+
+	return (d != NULL);
+}
+#else
+static int
+virtio_has_msix(const struct rte_pci_addr *loc __rte_unused)
+{
+	/* nic_uio does not enable interrupts, return 0 (false). */
+	return 0;
+}
 #endif
 
 /*
@@ -720,6 +745,7 @@ eth_virtio_dev_init(__rte_unused struct eth_driver *eth_drv,
 			     start, size);
 	}
 #endif
+	hw->use_msix = virtio_has_msix(&pci_dev->addr);
 	hw->io_base = (uint32_t)(uintptr_t)pci_dev->mem_resource[0].addr;
 
 	/* Reset the device although not necessary at startup */
diff --git a/lib/librte_pmd_virtio/virtio_pci.h b/lib/librte_pmd_virtio/virtio_pci.h
index 864b084..d27b734 100644
--- a/lib/librte_pmd_virtio/virtio_pci.h
+++ b/lib/librte_pmd_virtio/virtio_pci.h
@@ -177,6 +177,7 @@ struct virtio_hw {
 	uint16_t    subsystem_device_id;
 	uint16_t    subsystem_vendor_id;
 	uint8_t     revision_id;
+	uint8_t	    use_msix;
 	uint8_t     mac_addr[ETHER_ADDR_LEN];
 	int         adapter_stopped;
 	struct      rte_eth_stats eth_stats;
@@ -195,13 +196,11 @@ struct virtio_net_config {
 	uint16_t   max_virtqueue_pairs;
 } __attribute__((packed));
 
-/* Value indicated in device config */
-#define VIRTIO_PCI_FLAG_MSIX  0x0020
 /*
  * 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)->use_msix) ? 24 : 20)
 
 /*
  * How many bits to shift physical queue address written to QUEUE_PFN.
-- 
1.9.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH 1/1] librte_pmd_virtio: Fix incorrect device specific header offset when MSI-X is disabled
  2014-06-16 11:10 ` [dpdk-dev] [PATCH 1/1] " Alan Carew
@ 2014-07-22 13:10   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2014-07-22 13:10 UTC (permalink / raw)
  To: Alan Carew; +Cc: dev

2014-06-16 12:10, Alan Carew:
> Signed-off-by: Alan Carew <alan.carew@intel.com>

Applied for version 1.7.1.

Thanks
-- 
Thomas

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-07-22 13:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-16 11:10 [dpdk-dev] [PATCH 0/1] librte_pmd_virtio: Fix incorrect device specific header offset when MSI-X is disabled Alan Carew
2014-06-16 11:10 ` [dpdk-dev] [PATCH 1/1] " Alan Carew
2014-07-22 13:10   ` Thomas Monjalon

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).