On Mon, 01 Apr 2019 17:17:35 +0200 Thomas Monjalon <tho...@monjalon.net> wrote:
> 01/04/2019 16:58, Stephen Hemminger: > > On Mon, 1 Apr 2019 04:26:57 +0200 > > Thomas Monjalon <tho...@monjalon.net> wrote: > > > > > diff --git a/lib/librte_ethdev/rte_ethdev.c > > > b/lib/librte_ethdev/rte_ethdev.c > > > index 10bdfb37e..33cffc498 100644 > > > --- a/lib/librte_ethdev/rte_ethdev.c > > > +++ b/lib/librte_ethdev/rte_ethdev.c > > > @@ -330,8 +330,7 @@ uint16_t > > > rte_eth_find_next(uint16_t port_id) > > > { > > > while (port_id < RTE_MAX_ETHPORTS && > > > - rte_eth_devices[port_id].state != RTE_ETH_DEV_ATTACHED && > > > - rte_eth_devices[port_id].state != RTE_ETH_DEV_REMOVED) > > > + rte_eth_devices[port_id].state == RTE_ETH_DEV_UNUSED) > > > > For some applications that iterate over ports this is a hot path. > > Really? > > > What about keeping an unused port bit mask and using ffs (in the future)? > > I don't understand your proposal. Please could you elaborate? > > Do you agree on this patch anyway? I have seen some applications spend lots of time doing: RTE_ETH_FOREACH_DEV(portid) { If ethdev kept a bitmask for unused ports then it could use the find first set instruction. Maybe the better way is to just fix the application to use its own bitmask of ports instead.