DPDK usage discussions
 help / color / mirror / Atom feed
From: Shreyansh Jain <shreyansh.jain@nxp.com>
To: Mike Shang <mshang5@gmail.com>
Cc: "users@dpdk.org" <users@dpdk.org>
Subject: Re: [dpdk-users] Getting pci id using port id with latest DPDK
Date: Thu, 23 Mar 2017 09:16:56 +0000	[thread overview]
Message-ID: <VI1PR0401MB24647270B85BE5B3A32F9E7D903F0@VI1PR0401MB2464.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <CAB6_+Dzx6so0fjw110o4r2DeuA9ZSzeiun+xSx9YuBmjdTgbBg@mail.gmail.com>

> -----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

      reply	other threads:[~2017-03-23  9:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-23  7:47 Mike Shang
2017-03-23  9:16 ` Shreyansh Jain [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=VI1PR0401MB24647270B85BE5B3A32F9E7D903F0@VI1PR0401MB2464.eurprd04.prod.outlook.com \
    --to=shreyansh.jain@nxp.com \
    --cc=mshang5@gmail.com \
    --cc=users@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).