net/virtio: fix rewriting LSC flag
authorJianfeng Tan <jianfeng.tan@intel.com>
Tue, 17 Jan 2017 07:10:21 +0000 (07:10 +0000)
committerYuanhan Liu <yuanhan.liu@linux.intel.com>
Tue, 17 Jan 2017 08:26:38 +0000 (09:26 +0100)
The LSC flag is decided according to if VIRTIO_NET_F_STATUS feature
is negotiated. Copy the PCI info after the judgement will rewrite
the correct result.

Fixes: 198ab33677c9 ("net/virtio: move device initialization in a function")
CC: stable@dpdk.org
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Tested-by: Lei Yao <lei.a.yao@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
drivers/net/virtio/virtio_ethdev.c

index 0a76cce..76d5fa9 100644 (file)
@@ -1208,18 +1208,17 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
        if (virtio_negotiate_features(hw, req_features) < 0)
                return -1;
 
+       if (eth_dev->device) {
+               pci_dev = RTE_DEV_TO_PCI(eth_dev->device);
+               rte_eth_copy_pci_info(eth_dev, pci_dev);
+       }
+
        /* If host does not support status then disable LSC */
        if (!vtpci_with_feature(hw, VIRTIO_NET_F_STATUS))
                eth_dev->data->dev_flags &= ~RTE_ETH_DEV_INTR_LSC;
        else
                eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_LSC;
 
-       if (eth_dev->device) {
-               pci_dev = RTE_DEV_TO_PCI(eth_dev->device);
-               rte_eth_copy_pci_info(eth_dev, pci_dev);
-               eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
-       }
-
        rx_func_get(eth_dev);
 
        /* Setting up rx_header size for the device */