Thread (122 messages) 122 messages, 8 authors, 2016-02-03

Re: [PATCH v5 8/9] virtio: add 1.0 support

From: Yuanhan Liu <hidden>
Date: 2016-01-27 03:45:49

On Thu, Jan 21, 2016 at 12:49:10PM +0100, Thomas Monjalon wrote:
2016-01-19 16:12, Yuanhan Liu:
quoted
 int
 vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw)
 {
-       hw->vtpci_ops = &legacy_ops;
+       hw->dev = dev;
+
+       /*
+        * Try if we can succeed reading virtio pci caps, which exists
+        * only on modern pci device. If failed, we fallback to legacy
+        * virtio handling.
+        */
+       if (virtio_read_caps(dev, hw) == 0) {
+               PMD_INIT_LOG(INFO, "modern virtio pci detected.");
+               hw->vtpci_ops = &modern_ops;
+               hw->modern    = 1;
+               dev->driver->drv_flags |= RTE_PCI_DRV_INTR_LSC;
+               return 0;
+       }
RTE_PCI_DRV_INTR_LSC is already set by virtio_resource_init_by_uio().
We don't go that far here. Here we just detect if it's a modern virtio
device. And if yes, we do some modern initiations, and return.

virtio_resource_init_by_uio() is invoked when virtio_read_caps() fails.
Do you mean interrupt was not supported with legacy virtio?
Nope. this patch set changes nothing on legacy virtio support.

	--yliu
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help