[dpdk-dev] Accessing "device_id" from "rte_pci_device"

Rosen, Rami rami.rosen at intel.com
Tue Jul 24 21:22:58 CEST 2018


Hi, Santosh,

Indeed the following patch from Ferruh removed the 
rte_pci_device from the rte_eth_dev_info object, and instead added an 
object of rte_device:

http://patchwork.dpdk.org/patch/37654/

However, I see that the date that this patch was applied to dpdk-next-net/master is 
4/10/2018. Are you absolutely sure the patch is applied in dpdk-17.11? I checked in 17.11.3 (stable), and I do 
see struct rte_pci_device *pci_dev in struct rte_eth_dev_info.

It seems to me that the following snippet of code from DPDK-18.05 can do 
what you want:
dpdk-18.05/examples/ethtool/lib/rte_ethtool.c:
rte_ethtool_get_drvinfo()
{
....
	const struct rte_pci_device *pci_dev;
	...

       if (dev_info.device)
                bus = rte_bus_find_by_device(dev_info.device);
        if (bus && !strcmp(bus->name, "pci")) {
                pci_dev = RTE_DEV_TO_PCI(dev_info.device);
                snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),
                        "%04x:%02x:%02x.%x",
                        pci_dev->addr.domain, pci_dev->addr.bus,
                        pci_dev->addr.devid, pci_dev->addr.function);
        } else {
                        pci_dev->addr.devid, pci_dev->addr.function);

Regards,
Rami Rosen
Intel 


-----Original Message-----
From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of santhosh K.S
Sent: Tuesday, July 24, 2018 13:10
To: dev at dpdk.org
Subject: [dpdk-dev] Accessing "device_id" from "rte_pci_device"

Hi,

I'm currently trying to migrate our old DPDK 16.11 version to 17.11 release.

For this activity, I'm able to build the 17.11 DPDK successfully. When I try to use the new libs, I noticed that few of the struct members which we are using in our code is moved to some other struct.

In the 16.11 version we were using "*rte_eth_dev_info_get*" API to get the device_id information using "*rte_pci_device*" struct which was initialized inside the rte_eth_dev_info_get() API.

But now in 17.11 "*rte_pci_device" pointer * is not initialized inside the
ret_eth_dev_inf_get() API, that is because rte_pic_device is no longer a member of the struct "*rte_eth_dev*". Hence I'm not able to retrive the device_id from "*pci_dev->id.device_id*"

Can anyone please point me to an example code which illustrates the same?

I've already googled and got this link
<http://doc.dpdk.org/api-17.11/examples_2ethtool_2lib_2rte_ethtool_8c-example.html#a5>.
Which unfortunately doesn't show how to extract the *device_id*.

Best Regards,
Santy


More information about the dev mailing list