* [dpdk-users] Getting pci id using port id with latest DPDK
@ 2017-03-23 7:47 Mike Shang
2017-03-23 9:16 ` Shreyansh Jain
0 siblings, 1 reply; 2+ messages in thread
From: Mike Shang @ 2017-03-23 7:47 UTC (permalink / raw)
To: users
Hi,
I have legacy code that needs to get pci id using port id in order to make
different config for different pci device. In the past, we can do that with
a simple call to rte_eth_dev_info_get() and look into the pci_dev file in
rte_eth_dev_info structure. But with latest DPDK, rte_eth_dev_info_get() no
longer fills pci_dev after this commit (
http://dpdk.org/browse/dpdk/commit/lib/librte_ether/rte_ethdev.c?id=ae34410a8a8aff1b8382e16fcc89353648355be0
) Looks like the developers wanted to decouple pci device from a general
device.
Under such condition, how can I get the needed pci id from port id ? I scan
all function listed in rte_ethdev.h but didn't find such function. Maybe
there an indirect to do that? as a last resort, I can patch the dpdk source
code to make rte_eth_dev_info_get() fill pci_dev again but that may be the
last thing I would consider.....
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-users] Getting pci id using port id with latest DPDK
2017-03-23 7:47 [dpdk-users] Getting pci id using port id with latest DPDK Mike Shang
@ 2017-03-23 9:16 ` Shreyansh Jain
0 siblings, 0 replies; 2+ messages in thread
From: Shreyansh Jain @ 2017-03-23 9:16 UTC (permalink / raw)
To: Mike Shang; +Cc: users
> -----Original Message-----
> From: users [mailto:users-bounces@dpdk.org] On Behalf Of Mike Shang
> Sent: Thursday, March 23, 2017 1:17 PM
> To: users@dpdk.org
> Subject: [dpdk-users] Getting pci id using port id with latest DPDK
>
> Hi,
> I have legacy code that needs to get pci id using port id in order to make
> different config for different pci device. In the past, we can do that with
> a simple call to rte_eth_dev_info_get() and look into the pci_dev file in
> rte_eth_dev_info structure. But with latest DPDK, rte_eth_dev_info_get() no
> longer fills pci_dev after this commit (
> http://dpdk.org/browse/dpdk/commit/lib/librte_ether/rte_ethdev.c?id=ae34410a8
> a8aff1b8382e16fcc89353648355be0
> ) Looks like the developers wanted to decouple pci device from a general
> device.
Yes, that is right. The idea is to remove 'PCI' dependency on the librte layer and push that as drivers' scope (anywhere other than generic lib layer). (At least from those APIs which are not PCI specific)
> Under such condition, how can I get the needed pci id from port id ? I scan
> all function listed in rte_ethdev.h but didn't find such function. Maybe
> there an indirect to do that? as a last resort, I can patch the dpdk source
> code to make rte_eth_dev_info_get() fill pci_dev again but that may be the
> last thing I would consider.....
You are saying that for the device you are using this field is not populated? For example, if you look at drivers/net/ixgbe/ixgbe_ethdev.c:
--->8---
3313 static void
3314 ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
3315 {
3316 struct rte_pci_device *pci_dev = IXGBE_DEV_TO_PCI(dev);
3317 struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
3318 struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
3319
3320 dev_info->pci_dev = pci_dev;
--->8---
dev_info->pci_dev is being filled by the IXGBE driver.
Can you confirm which driver you are using which doesn't fill this information?
(I am on top of tree: 84aac97b4)
Also, see the commit ae34410a8a8aff1b8382e16fcc89353648355be0
--->8---
commit ae34410a8a8aff1b8382e16fcc89353648355be0
Author: Jan Blunck <jblunck@infradead.org>
Date: Fri Dec 23 16:58:10 2016 +0100
ethdev: move info filling of PCI into drivers
Only the drivers itself can decide if it could fill PCI information fields
of dev_info.
Signed-off-by: Jan Blunck <jblunck@infradead.org>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
...
...
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index fd95136..7237bcc 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -431,6 +431,7 @@ static void
bnx2x_dev_infos_get(struct rte_eth_dev *dev, __rte_unused struct rte_eth_dev_info *dev_info)
{
struct bnx2x_softc *sc = dev->data->dev_private;
+ dev_info->pci_dev = dev->pci_dev;
dev_info->max_rx_queues = sc->max_rx_queues;
dev_info->max_tx_queues = sc->max_tx_queues;
--->8---
-
Shreyansh
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-23 9:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-23 7:47 [dpdk-users] Getting pci id using port id with latest DPDK Mike Shang
2017-03-23 9:16 ` Shreyansh Jain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).