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> > > --- > > drivers/net/mlx5/mlx5.c | 9 ++------- > > lib/librte_ethdev/rte_ethdev.c | 25 ++++++++++++------------- > > No strong opinion but should we separate patch for driver and the library, > logically both changes RTE_ETH_DEV_UNUSED check with macros, but there is no > dependency, I mean they are individual changes, driver patch will be valid on > its own.
This is the same change. I removed usage of RTE_ETH_DEV_UNUSED. By chance, it was used only in ethdev and mlx5. I don't feel the need to split because there are usages in different files. > > +#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."