[PATCH v1 2/2] ethdev: fix skip valid port in probing callback
Thomas Monjalon
thomas at monjalon.net
Mon Jan 13 09:16:48 CET 2025
13/01/2025 03:55, Huisong Li:
> The event callback in application may use the macro RTE_ETH_FOREACH_DEV to
> iterate over all enabled ports to do something(like, verifying the port id
> validity) when receive a probing event. If the ethdev state of a port is
> not RTE_ETH_DEV_UNUSED, this port will be considered as a valid port.
>
> However, this state is set to RTE_ETH_DEV_ATTACHED after pushing probing
> event. It means that probing callback will skip this port. But this
> assignment can not move to front of probing notification. See
> commit be8cd210379a ("ethdev: fix port probing notification")
>
> So this patch has to add a new state, RTE_ETH_DEV_ALLOCATED. Set the ethdev
> state to RTE_ETH_DEV_ALLOCATED before pushing probing event and set it to
> RTE_ETH_DEV_ATTACHED after definitely probed. And this port is valid if its
> device state is 'ALLOCATED' or 'ATTACHED'.
If you do that, changing the definition of eth_dev_find_free_port()
you allow the application using a port before probing is finished.
It is the same as changing the state to RTE_ETH_DEV_ATTACHED
before calling the event callback.
So this is a NACK.
Why do you need drivers to check the state of a notified device?
If it is RTE_ETH_EVENT_NEW, you know that's a new device,
there is nothing else to check.
More information about the dev
mailing list