[PATCH v3 5/7] bus: factorize devargs lookup
Thomas Monjalon
thomas at monjalon.net
Mon Apr 13 21:48:25 CEST 2026
13/04/2026 21:18, Thomas Monjalon:
> 07/04/2026 13:52, David Marchand:
> > Each bus reimplements some similar devargs lookup code.
> >
> > The differences are in how some bus (PCI, VMBUS etc...) normalizes the
> > device names. We can't use the .parse existing handler from outside the
> > bus code itself, as the size of the bus specific device location address
> > is unknown.
> > Introduce a bus specific helper to compare two device names and
> > hide this ugly detail.
>
> I agree with introducing a new bus helper.
>
> [...]
> > + /* The name in the devargs is usually prefixed with <bus>: */
>
> Is it usually prefixed or always prefixed?
>
> > + if (strncmp(devargs_name, bus_name, strlen(bus_name)) == 0)
> > + devargs_name += strlen(bus_name) + 1;
>
> If I understand well, if it is prefixed with bus name,
> it is assumed that a colon character will follow.
In the function rte_bus_find_devargs(), there is this comment:
+ /* The name in the devargs is usually prefixed with : */
+ if (strncmp(devargs_name, bus_name, strlen(bus_name)) == 0)
+ devargs_name += strlen(bus_name) + 1;
I think you mean "prefixed with <bus>:".
> [...]
> > +/**
> > + * Bus specific device name comparison function.
> > + * Bus can normalize the names of devices using an internal representation.
> > + * This helper makes it possible to check whether two names refer to the same device.
> > + *
> > + * @param[in] name1
> > + * device name
> > + * @param[in] name2
> > + * device name
> > + *
> > + * @return
> > + * 0 if the two names refer to the same device.
> > + * !0 otherwise.
> > + */
> > +typedef int (*rte_bus_devname_compare_t)(const char *name1, const char *name2);
>
> The helper compares internal representation of the device, not the names.
> The function should be rte_bus_dev_compare_t.
More information about the dev
mailing list