[dpdk-stable] patch 'net/virtio: fix MAC address read' has been queued to stable release 17.05.2
Yuanhan Liu
yliu at fridaylinux.org
Mon Aug 21 11:30:54 CEST 2017
Hi,
FYI, your patch has been queued to stable release 17.05.2
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 08/24/17. So please
shout if anyone has objections.
Thanks.
--yliu
---
>From 6107ef3772656e42b831ee68f07ebfdda792c84c Mon Sep 17 00:00:00 2001
From: Jianfeng Tan <jianfeng.tan at intel.com>
Date: Fri, 28 Jul 2017 23:01:14 +0000
Subject: [PATCH] net/virtio: fix MAC address read
[ upstream commit cb482cb3a305f96d8155bbeb052344dde66ad8f2 ]
When virtio-net devices are bound to uio_pci_generic, we get
the wrong mac addr by virtio PMD. The wrong mac addr is a
addr that is 4-byte left shift of the correct addr.
It's a regression bug introduced by the cleanup patch below.
The condition of if we set use_msix should be if msix is
actually enabled. Only to check if there is a capability list
is not enough. For example, binding a transitional device
to uio_pci_device would trigger the wrong assignment of use_msix.
To correct that, we also check the flags of msix capability to
make sure it's enabled.
Fixes: ee1843bd8907 ("net/virtio: remove redundant MSI-X detection")
Reported-by: Vipin Varghese <vipin.varghese at intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan at intel.com>
Acked-by: Yuanhan Liu <yliu at fridaylinux.org>
---
drivers/net/virtio/virtio_pci.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index b7b3d61..f91ecb4 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -579,6 +579,8 @@ get_cfg_addr(struct rte_pci_device *dev, struct virtio_pci_cap *cap)
return base + offset;
}
+#define PCI_MSIX_ENABLE 0x8000
+
static int
virtio_read_caps(struct rte_pci_device *dev, struct virtio_hw *hw)
{
@@ -605,8 +607,17 @@ virtio_read_caps(struct rte_pci_device *dev, struct virtio_hw *hw)
break;
}
- if (cap.cap_vndr == PCI_CAP_ID_MSIX)
- hw->use_msix = 1;
+ if (cap.cap_vndr == PCI_CAP_ID_MSIX) {
+ /* Transitional devices would also have this capability,
+ * that's why we also check if msix is enabled.
+ * 1st byte is cap ID; 2nd byte is the position of next
+ * cap; next two bytes are the flags.
+ */
+ uint16_t flags = ((uint16_t *)&cap)[1];
+
+ if (flags & PCI_MSIX_ENABLE)
+ hw->use_msix = 1;
+ }
if (cap.cap_vndr != PCI_CAP_ID_VNDR) {
PMD_INIT_LOG(DEBUG,
--
2.7.4
More information about the stable
mailing list