18/04/2019 14:47, Thomas Monjalon: > 18/04/2019 13:50, Ferruh Yigit: > > On 4/17/2019 11:59 PM, Thomas Monjalon wrote: > > > Some port iterations are manually checking against RTE_ETH_DEV_UNUSED > > > instead of using the iterators based on rte_eth_find_next(). > > > > > > A new macro RTE_ETH_FOREACH_VALID_DEV() is introduced, but kept private > > > because there should be no need of iterating over all devices in the API. > > > The public iterators have additional filters for ownership, parent device > > > or sibling ports. > > > > > > Signed-off-by: Thomas Monjalon <tho...@monjalon.net> > > > --- > > > +#define RTE_ETH_FOREACH_VALID_DEV(port_id) \ > > > + for (port_id = rte_eth_find_next(0); \ > > > + port_id < RTE_MAX_ETHPORTS; \ > > > + port_id = rte_eth_find_next(port_id + 1)) > > > + > > > > What do you think adding some documentation to the new macro, specially I > > think > > documenting the difference between "RTE_ETH_FOREACH_DEV" and this one can be > > good otherwise it may confuse people that "RTE_ETH_FOREACH_DEV" iterates on > > invalid devices too? > > This one is not part of the API. > I am not sure what I can document more than "iterating all valid ports"? > About RTE_ETH_FOREACH_DEV, it is already documented: > "Macro to iterate over all enabled and ownerless ethdev ports."
OK, let's add a comment to explain the difference: /* * Macro to iterate over all valid ports for internal usage. * Note: RTE_ETH_FOREACH_DEV is different because filtering owned ports. */