Skip to contentSkip to conversation

virtio: fix link state regression

PATCH RESEND In review Stephen Hemminger 2 participants 2 messages Dec 4, 2015 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 virtio: fix link state regression

Support for link state interrupt was broken on virtio by

commit bda66c418c85 ("ethdev: add device fields from PCI layer")

This is caused because the actual value of drv_flags is not set until after the resource_init has figured out whether it is using UIO or direct I/O instructions.

---

There maybe other drivers with the same problem. It would have been better to move the structure elements (and break ABI) rather than assume it safe to copy them.

 drivers/net/virtio/virtio_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/virtio/virtio_ethdev.c +2 -2
index 74c00ee..8e12804 100644
@@ -1289,11 +1289,11 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
 
 	pci_dev = eth_dev->pci_dev;
 
-	rte_eth_copy_pci_info(eth_dev, pci_dev);
-
 	if (virtio_resource_init(pci_dev) < 0)
 		return -1;
 
+	rte_eth_copy_pci_info(eth_dev, pci_dev);
+
 	hw->use_msix = virtio_has_msix(&pci_dev->addr);
 	hw->io_base = (uint32_t)(uintptr_t)pci_dev->mem_resource[0].addr;
 
Signature · 1 line
2.1.4
#1 lore raw

Hi Stephen,

Quoted 48 lines

-----Original Message-----
From: Stephen Hemminger [mailto:[email protected]]
Sent: Friday, December 4, 2015 3:59 PM
To: Xie, Huawei <[email protected]>; [email protected]; Iremonger, Bernard <[email protected]>
Cc: [email protected]; Stephen Hemminger <[email protected]>
Subject: [PATCH resend] virtio: fix link state regression

Support for link state interrupt was broken on virtio by

commit bda66c418c85 ("ethdev: add device fields from PCI layer")

This is caused because the actual value of drv_flags is not set until after the resource_init has figured out whether it is using UIO or direct I/O instructions.

---

There maybe other drivers with the same problem. It would have been better to move the structure elements (and break ABI) rather than assume it safe to copy them.

 drivers/net/virtio/virtio_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/virtio/virtio_ethdev.c +2 -2
index 74c00ee..8e12804 100644
@@ -1289,11 +1289,11 @@ eth_virtio_dev_init(struct rte_eth_dev
 *eth_dev)
 
 	pci_dev = eth_dev->pci_dev;
 
-	rte_eth_copy_pci_info(eth_dev, pci_dev);
-
 	if (virtio_resource_init(pci_dev) < 0)
 		return -1;
 
+	rte_eth_copy_pci_info(eth_dev, pci_dev);
+
 	hw->use_msix = virtio_has_msix(&pci_dev->addr);
 	hw->io_base = (uint32_t)(uintptr_t)pci_dev-
Quoted 1 line

mem_resource[0].addr;

Quoted 2 lines

--
2.1.4

I think the call to rte_eth_copy_pci_info() needs to be a bit later. After the following code:

	/* If host does not support status then disable LSC */
	if (!vtpci_with_feature(hw, VIRTIO_NET_F_STATUS))
		pci_dev->driver->drv_flags &= ~RTE_PCI_DRV_INTR_LSC;

I have submitted a patch for this earlier today

http://dpdk.org/dev/patchwork/patch/9345/

Regards,

Bernard.