All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Gaëtan Rivet" <gaetan.rivet@6wind.com>
To: Jan Blunck <jblunck@infradead.org>
Cc: dev <dev@dpdk.org>,
	Stephen Hemminger <stephen@networkplumber.org>,
	Maxime Coquelin <maxime.coquelin@redhat.com>,
	Jerin Jacob <jerin.jacob@caviumnetworks.com>,
	David Marchand <david.marchand@6wind.com>
Subject: Re: [PATCH 7/9] bus: add helper to find a bus from a device name
Date: Wed, 7 Jun 2017 22:03:31 +0200	[thread overview]
Message-ID: <20170607200331.GU18840@bidouze.vm.6wind.com> (raw)
In-Reply-To: <CALe+Z02cDRpsGLzPTfe25M8HQAKQzxpo16se5pwceCDQAYCzAQ@mail.gmail.com>

On Wed, Jun 07, 2017 at 07:28:07PM +0200, Jan Blunck wrote:
> On Wed, May 24, 2017 at 5:12 PM, Gaetan Rivet <gaetan.rivet@6wind.com> wrote:
> > Find which bus should be able to parse this device name into an internal
> > device representation.
> >
> 
> No, please don't add this. One should know to what bus a device
> belongs to before plugging it. Artificially encoding the parent bus
> into the device name is not the right thing to do. Please keep those
> things separate.
> 

The EAL has no way to know this currently. As you noted, it has to know
onto which bus a device belongs before plugging it.

> > Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
> > ---
> >  lib/librte_eal/bsdapp/eal/rte_eal_version.map   |  1 +
> >  lib/librte_eal/common/eal_common_bus.c          | 15 +++++++++++++++
> >  lib/librte_eal/common/include/rte_bus.h         | 12 ++++++++++++
> >  lib/librte_eal/linuxapp/eal/rte_eal_version.map |  1 +
> >  4 files changed, 29 insertions(+)
> >
> > diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> > index 3517d74..04fa882 100644
> > --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> > +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> > @@ -202,5 +202,6 @@ DPDK_17.08 {
> >         global:
> >
> >         rte_bus_from_name;
> > +       rte_bus_from_dev;
> >
> >  } DPDK_17.05;
> > diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c
> > index 7977190..08fff60 100644
> > --- a/lib/librte_eal/common/eal_common_bus.c
> > +++ b/lib/librte_eal/common/eal_common_bus.c
> > @@ -242,3 +242,18 @@ rte_bus_from_name(const char *str)
> >                 return NULL;
> >         return rte_bus_find(bus_cmp_name, str);
> >  }
> > +
> > +static int
> > +bus_can_parse(const struct rte_bus *bus, const void *_name)
> > +{
> > +       const char *name = _name;
> > +
> > +       return (bus->parse && !bus->parse(name, NULL));
> > +}
> > +
> > +/* find a bus capable of parsing a device description */
> > +struct rte_bus *
> > +rte_bus_from_dev(const char *str)
> > +{
> > +       return rte_bus_find(bus_can_parse, str);
> > +}
> > diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h
> > index 5b87ac4..0b48e66 100644
> > --- a/lib/librte_eal/common/include/rte_bus.h
> > +++ b/lib/librte_eal/common/include/rte_bus.h
> > @@ -251,6 +251,18 @@ struct rte_bus *rte_bus_find_by_device(const struct rte_device *dev);
> >  struct rte_bus *rte_bus_from_name(const char *str);
> >
> >  /**
> > + * Find a bus capable of identifying a device.
> > + *
> > + * @param str
> > + *   A device identifier (PCI address, virtual PMD name, ...).
> > + *
> > + * @return
> > + *   A valid bus structure if found.
> > + *   NULL if no bus is able to parse this device.
> > + */
> > +struct rte_bus *rte_bus_from_dev(const char *str);
> > +
> > +/**
> >   * Helper for Bus registration.
> >   * The constructor has higher priority than PMD constructors.
> >   */
> > diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> > index 6607acc..a5127d6 100644
> > --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> > +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> > @@ -206,5 +206,6 @@ DPDK_17.08 {
> >         global:
> >
> >         rte_bus_from_name;
> > +       rte_bus_from_dev;
> >
> >  } DPDK_17.05;
> > --
> > 2.1.4
> >

-- 
Gaëtan Rivet
6WIND

  reply	other threads:[~2017-06-07 20:03 UTC|newest]

Thread overview: 123+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-24 15:12 [PATCH 0/9] rte_bus parse API Gaetan Rivet
2017-05-24 15:12 ` [PATCH 1/9] bus: fix bus name registration Gaetan Rivet
2017-05-24 15:12 ` [PATCH 2/9] bus: verify bus name on registration Gaetan Rivet
2017-05-24 15:12 ` [PATCH 3/9] bus: introduce parsing functionality Gaetan Rivet
2017-05-24 15:12 ` [PATCH 4/9] vdev: implement parse bus operation Gaetan Rivet
2017-05-24 15:12 ` [PATCH 5/9] pci: " Gaetan Rivet
2017-05-24 15:12 ` [PATCH 6/9] bus: add helper to find bus from a name Gaetan Rivet
2017-05-24 15:12 ` [PATCH 7/9] bus: add helper to find a bus from a device name Gaetan Rivet
2017-06-07 17:28   ` Jan Blunck
2017-06-07 20:03     ` Gaëtan Rivet [this message]
2017-06-08 10:45       ` Jan Blunck
2017-06-08 11:36         ` Gaëtan Rivet
2017-06-08 11:40           ` Jan Blunck
2017-06-08 12:51             ` Gaëtan Rivet
2017-06-10  8:50               ` Jan Blunck
2017-06-12 14:21                 ` Gaëtan Rivet
2017-05-24 15:12 ` [PATCH 8/9] vdev: expose bus name Gaetan Rivet
2017-05-24 15:12 ` [PATCH 9/9] devargs: parse bus info Gaetan Rivet
2017-05-24 16:15 ` [PATCH v2 0/9] rte_bus parse API Gaetan Rivet
2017-05-24 16:15   ` [PATCH v2 1/9] bus: fix bus name registration Gaetan Rivet
2017-05-24 16:15   ` [PATCH v2 2/9] bus: verify bus name on registration Gaetan Rivet
2017-05-24 16:15   ` [PATCH v2 3/9] bus: introduce parsing functionality Gaetan Rivet
2017-05-24 16:15   ` [PATCH v2 4/9] vdev: implement parse bus operation Gaetan Rivet
2017-05-24 16:15   ` [PATCH v2 5/9] pci: " Gaetan Rivet
2017-05-24 16:15   ` [PATCH v2 6/9] bus: add helper to find bus from a name Gaetan Rivet
2017-05-24 16:15   ` [PATCH v2 7/9] bus: add helper to find a bus from a device name Gaetan Rivet
2017-05-24 16:15   ` [PATCH v2 8/9] vdev: expose bus name Gaetan Rivet
2017-05-24 16:15   ` [PATCH v2 9/9] devargs: parse bus info Gaetan Rivet
2017-06-01 10:08   ` [PATCH v3 0/9] rte_bus parse API Gaetan Rivet
2017-06-01 10:08     ` [PATCH v3 1/9] bus: fix bus name registration Gaetan Rivet
2017-06-01 10:08     ` [PATCH v3 2/9] bus: verify bus name on registration Gaetan Rivet
2017-06-01 10:08     ` [PATCH v3 3/9] bus: introduce parsing functionality Gaetan Rivet
2017-06-01 10:08     ` [PATCH v3 4/9] vdev: implement parse bus operation Gaetan Rivet
2017-06-01 10:08     ` [PATCH v3 5/9] pci: " Gaetan Rivet
2017-06-01 10:08     ` [PATCH v3 6/9] bus: add helper to find bus from a name Gaetan Rivet
2017-06-01 10:08     ` [PATCH v3 7/9] bus: add helper to find a bus from a device name Gaetan Rivet
2017-06-01 10:08     ` [PATCH v3 8/9] vdev: expose bus name Gaetan Rivet
2017-06-01 10:08     ` [PATCH v3 9/9] devargs: parse bus info Gaetan Rivet
2017-06-07 23:56     ` [PATCH v4 0/9] rte_bus parse API Gaetan Rivet
2017-06-07 23:56       ` [PATCH v4 1/9] bus: fix bus name registration Gaetan Rivet
2017-06-07 23:56       ` [PATCH v4 2/9] bus: verify bus name on registration Gaetan Rivet
2017-06-07 23:56       ` [PATCH v4 3/9] bus: introduce parsing functionality Gaetan Rivet
2017-06-07 23:56       ` [PATCH v4 4/9] vdev: implement parse bus operation Gaetan Rivet
2017-06-07 23:56       ` [PATCH v4 5/9] pci: " Gaetan Rivet
2017-06-07 23:56       ` [PATCH v4 6/9] bus: add helper to find a bus from a bus name Gaetan Rivet
2017-06-07 23:56       ` [PATCH v4 7/9] bus: add helper to find a bus from a device name Gaetan Rivet
2017-06-07 23:56       ` [PATCH v4 8/9] vdev: expose bus name Gaetan Rivet
2017-06-07 23:56       ` [PATCH v4 9/9] devargs: parse bus info Gaetan Rivet
2017-06-20 23:30       ` [PATCH v5 0/7] rte_bus parse API Gaetan Rivet
2017-06-20 23:30         ` [PATCH v5 1/7] bus: fix bus name registration Gaetan Rivet
2017-06-27 15:53           ` Bruce Richardson
2017-06-27 19:19           ` Jan Blunck
2017-07-04  1:05             ` Gaëtan Rivet
2017-06-20 23:30         ` [PATCH v5 2/7] bus: introduce parsing functionality Gaetan Rivet
2017-06-27 15:54           ` Bruce Richardson
2017-06-27 19:26           ` Jan Blunck
2017-07-04  1:35             ` Gaëtan Rivet
2017-06-20 23:30         ` [PATCH v5 3/7] vdev: implement parse bus operation Gaetan Rivet
2017-06-27 15:59           ` Bruce Richardson
2017-06-20 23:30         ` [PATCH v5 4/7] pci: " Gaetan Rivet
2017-06-27 16:18           ` Bruce Richardson
2017-06-20 23:30         ` [PATCH v5 5/7] bus: add helper to find a bus from a device name Gaetan Rivet
2017-06-27 16:26           ` Bruce Richardson
2017-06-27 18:55           ` Jan Blunck
2017-06-28 17:03             ` Thomas Monjalon
2017-06-29  7:56               ` Jan Blunck
2017-06-29  8:21                 ` Thomas Monjalon
2017-06-29 10:23                 ` Gaëtan Rivet
2017-06-29 10:30                   ` Richardson, Bruce
2017-06-20 23:30         ` [PATCH v5 6/7] vdev: expose bus name Gaetan Rivet
2017-06-20 23:30         ` [PATCH v5 7/7] devargs: parse bus info Gaetan Rivet
2017-06-27 16:01         ` [PATCH v5 0/7] rte_bus parse API Bruce Richardson
2017-07-04  0:58         ` [PATCH v6 0/6] " Gaetan Rivet
2017-07-04  0:58           ` [PATCH v6 1/6] bus: fix bus name registration Gaetan Rivet
2017-07-04 21:43             ` [PATCH] bus: fix driver registration Thomas Monjalon
2017-07-05  5:47               ` Shreyansh Jain
2017-07-05  6:01                 ` Shreyansh Jain
2017-07-04  0:58           ` [PATCH v6 2/6] bus: introduce parsing functionality Gaetan Rivet
2017-07-04  0:58           ` [PATCH v6 3/6] vdev: implement parse bus operation Gaetan Rivet
2017-07-04  0:58           ` [PATCH v6 4/6] pci: " Gaetan Rivet
2017-07-04  0:58           ` [PATCH v6 5/6] bus: add helper to find a bus from a device name Gaetan Rivet
2017-07-04 12:28             ` Gaëtan Rivet
2017-07-04  0:58           ` [PATCH v6 6/6] devargs: parse bus info Gaetan Rivet
2017-07-04 23:55           ` [PATCH v7 0/6] rte_bus parse API Gaetan Rivet
2017-07-04 23:55             ` [PATCH v7 1/6] bus: fix driver registration Gaetan Rivet
2017-07-05 13:03               ` Shreyansh Jain
2017-07-06  6:05               ` santosh
2017-07-04 23:55             ` [PATCH v7 2/6] bus: introduce parsing functionality Gaetan Rivet
2017-07-05 13:04               ` Shreyansh Jain
2017-07-06  9:19               ` santosh
2017-07-06 12:30                 ` Gaëtan Rivet
2017-07-06 13:12                   ` santosh
2017-07-06 13:30                     ` Gaëtan Rivet
2017-07-04 23:55             ` [PATCH v7 3/6] vdev: implement parse bus operation Gaetan Rivet
2017-07-05 13:16               ` Shreyansh Jain
2017-07-06  9:35               ` santosh
2017-07-04 23:55             ` [PATCH v7 4/6] pci: " Gaetan Rivet
2017-07-04 23:55             ` [PATCH v7 5/6] bus: add helper to find a bus from a device name Gaetan Rivet
2017-07-05 13:35               ` Shreyansh Jain
2017-07-05 13:45                 ` Gaëtan Rivet
2017-07-05 14:12                   ` Shreyansh Jain
2017-07-06 10:10                   ` Thomas Monjalon
2017-07-06 11:37                     ` Gaëtan Rivet
2017-07-04 23:55             ` [PATCH v7 6/6] devargs: parse bus info Gaetan Rivet
2017-07-05 18:03               ` Stephen Hemminger
2017-07-06  9:07               ` Shreyansh Jain
2017-07-06 10:00                 ` Gaëtan Rivet
2017-07-06 13:17                   ` Shreyansh Jain
2017-07-07  0:03             ` [PATCH v8 0/6] rte_bus parse API Gaetan Rivet
2017-07-07  0:03               ` [PATCH v8 1/6] bus: fix driver registration Gaetan Rivet
2017-07-07  0:03               ` [PATCH v8 2/6] bus: introduce parsing functionality Gaetan Rivet
2017-07-07  0:03               ` [PATCH v8 3/6] vdev: implement parse bus operation Gaetan Rivet
2017-07-07  0:03               ` [PATCH v8 4/6] pci: " Gaetan Rivet
2017-07-07  0:03               ` [PATCH v8 5/6] bus: add helper to find a bus from a device name Gaetan Rivet
2017-07-07  0:03               ` [PATCH v8 6/6] devargs: parse bus info Gaetan Rivet
2017-07-07  0:45                 ` Stephen Hemminger
2017-07-07  8:31                   ` Gaëtan Rivet
2017-07-08 20:31                     ` Thomas Monjalon
2017-07-08 20:30               ` [PATCH v8 0/6] rte_bus parse API Thomas Monjalon
2017-06-07 17:22 ` [PATCH 0/9] " Jan Blunck
2017-06-07 19:55   ` Gaëtan Rivet
2017-06-08 11:38     ` Jan Blunck
2017-06-08 13:04       ` Gaëtan Rivet

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=20170607200331.GU18840@bidouze.vm.6wind.com \
    --to=gaetan.rivet@6wind.com \
    --cc=david.marchand@6wind.com \
    --cc=dev@dpdk.org \
    --cc=jblunck@infradead.org \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=stephen@networkplumber.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.