[dpdk-dev] [PATCH v7 1/2] eal: add uevent monitor for hot plug

Thomas Monjalon thomas at monjalon.net
Tue Jan 9 14:40:01 CET 2018


> >>>> --- a/lib/librte_eal/common/include/rte_bus.h
> >>>> +++ b/lib/librte_eal/common/include/rte_bus.h
> >>>>    /**
> >>>> + * Device iterator to find a device on a bus.
> >>>> + *
> >>>> + * This function returns an rte_device if one of those held by the bus
> >>>> + * matches the data passed as parameter.
> >>>> + *
> >>>> + * If the comparison function returns zero this function should stop iterating
> >>>> + * over any more devices. To continue a search the device of a previous search
> >>>> + * can be passed via the start parameter.
> >>>> + *
> >>>> + * @param cmp
> >>>> + *	the device name comparison function.
> >>>> + *
> >>>> + * @param data
> >>>> + *	Data to compare each device against.
> >>>> + *
> >>>> + * @param start
> >>>> + *	starting point for the iteration
> >>>> + *
> >>>> + * @return
> >>>> + *	The first device matching the data, NULL if none exists.
> >>>> + */
> >>>> +typedef struct rte_device *
> >>>> +(*rte_bus_find_device_by_name_t)(const struct rte_device *start,
> >>>> +			 rte_dev_cmp_name_t cmp,
> >>>> +			 const void *data);
> >>> Why is it needed? There is already rte_bus_find_device_t.
> >> because the rte_bus_find_device_t just find a device structure in the
> >> device list, but here need to find a device structure by device name
> >> which come from uevent info.
> > I don't understand how it is different?
> > Looking at the code, it is a copy/paste except it is dedicated
> > to name comparison.
> > You can remove rte_bus_find_device_by_name_t and provide a
> > comparison function which looks at name.
> i mean that if the device have been remove and then insertion, the 
> device have not construct when just got the device name from the uevent 
> massage,  so this case could i use the original find device function?

The device won't be in the list if it is not yet scanned.
Anyway your function checks the same list.

Let's stop this discussion for now and continue when the need for
this function is better explained in a separate patch.
You really need to introduce things one patch at a time and explain
why you introduce them in the message of each patch.
Thanks


More information about the dev mailing list