[dpdk-dev] [PATCH v5 5/7] bus: add helper to find a bus from a device name

Thomas Monjalon thomas at monjalon.net
Thu Jun 29 10:21:56 CEST 2017


29/06/2017 09:56, Jan Blunck:
> On Wed, Jun 28, 2017 at 7:03 PM, Thomas Monjalon <thomas at monjalon.net> wrote:
> > 27/06/2017 20:55, Jan Blunck:
> >> On Wed, Jun 21, 2017 at 1:30 AM, Gaetan Rivet <gaetan.rivet at 6wind.com> wrote:
> >> >  /**
> >> > + * Find a bus capable of identifying a device.
> >> > + *
> >> > + * @param str
> >> > + *   A device identifier (PCI address, virtual PMD name, ...).
> >> > + *
> >> > + * @return
> >> > + *   A valid bus handle if found.
> >> > + *   NULL if no bus is able to parse this device.
> >> > + */
> >> > +struct rte_bus *rte_bus_from_dev(const char *str);
> >>
> >> I still don't agree with this. The bus name should be passed
> >> explicitly by the user of the API.
> >>
> >> NAK.
> >
> > Please explain why you think the bus name should be explicit.
> > If the bus is ambiguous, it can be explicited by the user.
> >
> > I see some good benefits in being tolerant with the bus/device
> > representation. It provides a smooth transition to the bus model.
> >
> 
> We build libraries. The applications we build with the help of those
> libraries get notified by the OS about device events. Those devices
> are chields of their parent bus. At the time the event is fired the OS
> already knows about:
> 
> - the bus name (parent)
> - the device name (child)
> - additional event parameters (environment)
> 
> Blame me that I probably spent too much time with Kay Sievers and
> GregKH to understand that device naming is easy to get wrong. Just
> look at the hyperv device names and how they switched to the UUID
> scheme. I don't think that hyperv is the only bus that uses UUID as
> device identification. We should not codify a policy of how to deduce
> a bus name from a given device name if that is knowledge that is
> already present externally. Otherwise I fear this part of the EAL will
> be subject to constant churn.

OK I understand your point that it is a weak identification.
It is as weak as what we have currently.
It works at least when we have only PCI and VDEV.
However it does not prevent to use a strong identification with
bus and parent names.
I see rte_bus_from_dev() as a helper to transition to the new strong
identification model. So we could remove it in few releases.
Does it make sense?


More information about the dev mailing list