[dpdk-dev] [PATCH v4 4/4] virtio: return 1 to tell the upper layer we don't take over this device

Thomas Monjalon thomas.monjalon at 6wind.com
Tue Mar 1 08:16:51 CET 2016


Hi Huawei,

2016-02-26 09:53, Huawei Xie:
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -1,4 +1,5 @@
>  /*-
> +

This new line seems useless :)

>   *   BSD LICENSE
>   *
[...]
> @@ -1037,8 +1039,11 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
>  
>  	pci_dev = eth_dev->pci_dev;
>  
> -	if (vtpci_init(pci_dev, hw) < 0)
> -		return -1;
> +	ret = vtpci_init(pci_dev, hw);
> +	if (ret) {
> +		rte_free(eth_dev->data->mac_addrs);

The freeing seems not related to this patch.

> +		return ret;
> +	}
[...]
>  	PMD_INIT_LOG(INFO, "trying with legacy virtio pci.");
> -	if (legacy_virtio_resource_init(dev, hw) < 0)
> +	if (legacy_virtio_resource_init(dev, hw) < 0) {
> +		if (dev->kdrv == RTE_KDRV_UNKNOWN) {
> +			PMD_INIT_LOG(INFO,
> +				"skip kernel managed virtio device.");
> +			return 1;
> +		}
>  		return -1;
> +	}

You cannot skip a device if it was whitelisted.
I think you should check RTE_DEVTYPE_WHITELISTED_PCI and throw an error
in this case.



More information about the dev mailing list