DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
To: David Marchand <david.marchand@6wind.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, Felix Marti <felix@chelsio.com>,
	Nirranjan Kirubaharan <nirranjan@chelsio.com>,
	Kumar Sanghvi <kumaras@chelsio.com>
Subject: Re: [dpdk-dev] [PATCH v2 1/3] nic_uio: Fix to allow any device to be bound to nic_uio
Date: Mon, 20 Jul 2015 17:37:27 +0530	[thread overview]
Message-ID: <20150720120725.GA3771@scalar.blr.asicdesigners.com> (raw)
In-Reply-To: <CALwxeUt5hFdpCjhizf1EPMV53+kXJ0VsM0p5yJ5W1udJf4oj5w@mail.gmail.com>

Hi David,

On Mon, Jul 20, 2015 at 09:43:57 +0200, David Marchand wrote:
>    Hum, what bothers me is that you do not rely on the same criteria to
>    re-attach the devices to nic_uio.
>    See below.
> 
>       lib/librte_eal/bsdapp/nic_uio/nic_uio.c | 48
>      +++++++++------------------------
>       1 file changed, 13 insertions(+), 35 deletions(-)
> 
>      diff --git a/lib/librte_eal/bsdapp/nic_uio/nic_uio.c
>      b/lib/librte_eal/bsdapp/nic_uio/nic_uio.c
>      index 2354e84..f868dc8 100644
>      --- a/lib/librte_eal/bsdapp/nic_uio/nic_uio.c
>      +++ b/lib/librte_eal/bsdapp/nic_uio/nic_uio.c
>      [snip]
>      @@ -195,11 +177,10 @@ nic_uio_probe (device_t dev)
>       {
>              int i;
> 
>      -       for (i = 0; i < NUM_DEVICES; i++)
>      -               if (pci_get_vendor(dev) == devices[i].vend &&
>      -                       pci_get_device(dev) == devices[i].dev) {
>      -
>      -                       device_set_desc(dev, "Intel(R) DPDK PCI
>      Device");
>      +       for (i = 0; i < num_detached; i++)
>      +               if (pci_get_vendor(dev) ==
>      pci_get_vendor(detached_devices[i]) &&
>      +                   pci_get_device(dev) ==
>      pci_get_device(detached_devices[i])) {
>      +                       device_set_desc(dev, "DPDK PCI Device");
>                              return BUS_PROBE_SPECIFIC;
>                      }
> 
>    When going through the probe stuff, the device vendor and type are used as
>    the matching criteria.
> 
>      @@ -256,7 +237,6 @@ static void
>       nic_uio_load(void)
>       {
>              uint32_t bus, device, function;
>      -       int i;
>              device_t dev;
>              char bdf_str[256];
>              char *token, *remaining;
>      @@ -295,17 +275,15 @@ nic_uio_load(void)
>                      if (dev == NULL)
>                              continue;
> 
>      -               for (i = 0; i < NUM_DEVICES; i++)
>      -                       if (pci_get_vendor(dev) == devices[i].vend &&
>      -                                       pci_get_device(dev) ==
>      devices[i].dev) {
>      -                                               if (num_detached <
>      MAX_DETACHED_DEVICES) {
>      -                                                     
>       printf("nic_uio_load: detaching and storing dev=%p\n", dev);
>      -                                                     
>       detached_devices[num_detached++] = dev;
>      -                                               } else
>      -                                                     
>       printf("nic_uio_load: reached MAX_DETACHED_DEVICES=%d. dev=%p won't be
>      reattached\n",
>      -                                                             
>       MAX_DETACHED_DEVICES, dev);
>      -                                               device_detach(dev);
>      -                       }
>      +               if (num_detached < MAX_DETACHED_DEVICES) {
>      +                       printf("nic_uio_load: detaching and storing
>      dev=%p\n",
>      +                              dev);
>      +                       detached_devices[num_detached++] = dev;
>      +               } else {
>      +                       printf("nic_uio_load: reached
>      MAX_DETACHED_DEVICES=%d. dev=%p won't be reattached\n",
>      +                              MAX_DETACHED_DEVICES, dev);
>      +               }
>      +               device_detach(dev);
>              }
>       }
> 
>    But here at init time, the bdfs informations are used to detach the pci
>    devices.
>    I would say this is safer we have the same criteria in both cases.
>    I think that the pci addresses are the best criteria since this is what
>    the user gives.
>    Don't we have them in the dev pointer ?

It looks like we can get them via pci_get_bus(), pci_get_slot(), and
pci_get_function().  Will add check for these 3 info instead of vendor
and device in probe to make it consistent.

> 
>    Btw, with this change, we would then be limited to MAX_DETACHED_DEVICES
>    devices even if 128 pci devices looks quite big enough to me.
>    This part could be reworked (later).
>    --
>    David Marchand

Thanks,
Rahul

  reply	other threads:[~2015-07-20 12:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-17 18:20 [dpdk-dev] [PATCH 0/3] cxgbe: Fix compilation and enable FreeBSD support for CXGBE PMD Rahul Lakkireddy
2015-07-17 18:20 ` [dpdk-dev] [PATCH 1/3] nic_uio: Fix to allow any device to be bound to nic_uio Rahul Lakkireddy
2015-07-19 23:23   ` Thomas Monjalon
2015-07-17 18:20 ` [dpdk-dev] [PATCH 2/3] cxgbe: Enable and fix FreeBSD compilation for CXGBE PMD Rahul Lakkireddy
2015-07-17 18:20 ` [dpdk-dev] [PATCH 3/3] doc: Update documentation to reflect FreeBSD support " Rahul Lakkireddy
2015-07-20  6:41 ` [dpdk-dev] [PATCH v2 0/3] cxgbe: Fix compilation and enable " Rahul Lakkireddy
2015-07-20  6:41   ` [dpdk-dev] [PATCH v2 1/3] nic_uio: Fix to allow any device to be bound to nic_uio Rahul Lakkireddy
2015-07-20  7:43     ` David Marchand
2015-07-20 12:07       ` Rahul Lakkireddy [this message]
2015-07-20  6:41   ` [dpdk-dev] [PATCH v2 2/3] cxgbe: Enable and fix FreeBSD compilation for CXGBE PMD Rahul Lakkireddy
2015-07-20  6:41   ` [dpdk-dev] [PATCH v2 3/3] doc: Update documentation to reflect FreeBSD support " Rahul Lakkireddy
2015-07-20 17:31   ` [dpdk-dev] [PATCH v3 0/3] cxgbe: Fix compilation and enable " Rahul Lakkireddy
2015-07-20 17:31     ` [dpdk-dev] [PATCH v3 1/3] nic_uio: Fix to allow any device to be bound to nic_uio Rahul Lakkireddy
2015-07-21  6:14       ` David Marchand
2015-07-20 17:31     ` [dpdk-dev] [PATCH v3 2/3] cxgbe: Enable and fix FreeBSD compilation for CXGBE PMD Rahul Lakkireddy
2015-07-20 17:31     ` [dpdk-dev] [PATCH v3 3/3] doc: Update documentation to reflect FreeBSD support " Rahul Lakkireddy
2015-07-21  9:40     ` [dpdk-dev] [PATCH v3 0/3] cxgbe: Fix compilation and enable " Bruce Richardson
2015-07-22 13:11       ` Thomas Monjalon

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=20150720120725.GA3771@scalar.blr.asicdesigners.com \
    --to=rahul.lakkireddy@chelsio.com \
    --cc=david.marchand@6wind.com \
    --cc=dev@dpdk.org \
    --cc=felix@chelsio.com \
    --cc=kumaras@chelsio.com \
    --cc=nirranjan@chelsio.com \
    /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).