[dpdk-dev] [PATCH 1/3] net/virtio: fix dev detachable flag

Yuanhan Liu yuanhan.liu at linux.intel.com
Wed Feb 22 03:34:23 CET 2017


On Mon, Feb 20, 2017 at 10:04:45PM +0800, hanxueluo at 126.com wrote:
> From: Huanle Han <hanxueluo at gmail.com>
> 
> The dev detachable flag was removed by
> commit f229eb4 ("net/virtio: fix rewriting LSC flag").
> 
> Signed-off-by: Huanle Han <hanxueluo at gmail.com>
> ---
>  drivers/net/virtio/virtio_ethdev.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index 4dc03b9..8465e1a 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -1336,6 +1336,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
>  	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;

This is a partial fix. The major issue here is rte_eth_copy_pci_info has
an undocumented side effect: it resets the dev_flags unconditionally. 

Removing such reset should be able to fix it: it also looks like the right
fix to me. Thomas, Ferruh?

If not, we could at least call rte_eth_copy_pci_info() at eth_virtio_dev_init(),
before we set any dev_flags bits.

	--yliu


More information about the dev mailing list