[dpdk-dev] [PATCH v2 01/44] bus/vdev: add helper to get vdev from eth dev

Maxime Coquelin maxime.coquelin at redhat.com
Mon Jan 25 11:53:51 CET 2021



On 1/20/21 1:56 AM, Thomas Monjalon wrote:
> 19/01/2021 22:24, Maxime Coquelin:
>> This patch adds an helper macro to get the rte_vdev_device
>> pointer from a rte_eth_dev pointer.
>>
>> This is similar to RTE_ETH_DEV_TO_PCI().
> [...]
>> --- a/drivers/bus/vdev/rte_bus_vdev.h
>> +++ b/drivers/bus/vdev/rte_bus_vdev.h
>> @@ -34,6 +34,8 @@ struct rte_vdev_device {
>> +#define RTE_ETH_DEV_TO_VDEV(eth_dev)	RTE_DEV_TO_VDEV((eth_dev)->device)
> 
> Why these macros (vdev and PCI) are not in ethdev?
> 
> 

I think because that would put a dependency on vdev & pci bus drivers in
ethdev library.

Indeed, RTE_DEV_TO_VDEV needs to know about rte_vdev_device layout:

#define RTE_DEV_TO_VDEV(ptr) \
	container_of(ptr, struct rte_vdev_device, device)

Regards,
Maxime



More information about the dev mailing list