[dpdk-dev] [PATCH] drivers/net: add generic ethdev macro to get PCI device

Ferruh Yigit ferruh.yigit at intel.com
Fri May 5 11:44:11 CEST 2017


On 5/5/2017 1:44 AM, Lu, Wenzhuo wrote:
> Hi,
> 
>> -----Original Message-----
>> From: Yigit, Ferruh
>> Sent: Thursday, May 4, 2017 9:08 PM
>> To: Thomas Monjalon; Shepard Siegel; Ed Czeck; John Miller; Legacy, Allain
>> (Wind River); Peters, Matt (Wind River); Lu, Wenzhuo; Zhang, Helin; Wu,
>> Jingjing; Ananyev, Konstantin; Andrew Rybchenko
>> Cc: dev at dpdk.org; Yigit, Ferruh
>> Subject: [PATCH] drivers/net: add generic ethdev macro to get PCI device
>>
>> Instead of many PMD define their own macro, define a generic one in ethdev
>> and use that in PMDs.
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit at intel.com>
> Acked-by: Wenzhuo Lu <wenzhuo.lu at intel.com>
> 
> BTW, there're RTE_DEV_TO_PCI(dev->device) in many places, maybe we can replace them by the new macro RTE_ETH_DEV_TO_PCI.

Net drivers use it always as RTE_DEV_TO_PCI(dev->device), since they all
have eth_dev references, not rte_device.

So there are two options, either convert all usages to
RTE_DEV_TO_PCI(eth_dev->device) or RTE_ETH_DEV_TO_PCI(eth_dev)

I think RTE_ETH_DEV_TO_PCI(eth_dev) is better since it hides
eth_dev->device detail, which is not required in this context. And it
reflects the intention better, get pci from eth device.

I will update the patch to convert those usages too.

Thanks,
ferruh


More information about the dev mailing list