[dpdk-dev] [PATCH v4 2/6] ethdev: add iterator to match devargs input

Ferruh Yigit ferruh.yigit at intel.com
Tue Oct 16 12:58:47 CEST 2018


On 10/9/2018 11:33 PM, Thomas Monjalon wrote:
> The iterator will return the ethdev port ids matching a devargs string.
> It is recommended to use the macro RTE_ETH_FOREACH_MATCHING_DEV()
> for usage convenience.
> 
> The class string is prefixed with '+' in order to skip the validation
> of the parameter keys. It is tolerated for the compatibility with
> the old (current) syntax where all parameters (bus, class and driver)
> are mixed in the same string without any delimiter.
> Thanks to this compatibility prefix, the driver parameters will be
> skipped during the ethdev parsing, and not considered invalid.
> 
> A macro is introduced in rte_common.h to workaround a const field.
> This hack is needed to free const strings in the iterator.
> It is preferred to keep the const for these fields, because it gives
> a hint that they are not changed at each iteration.
> 
> Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
> Reviewed-by: Andrew Rybchenko <arybchenko at solarflare.com>

<...>

> @@ -237,6 +237,9 @@ EXPERIMENTAL {
>  	rte_eth_dev_owner_unset;
>  	rte_eth_dev_rx_offload_name;
>  	rte_eth_dev_tx_offload_name;
> +	rte_eth_iterator_cleanup;
> +	rte_eth_iterator_init;
> +	rte_eth_iterator_next;

It would be great to add some unit test for these APIs, it would both show how
they are used and verify this functionality with all that "+" trick etc..

Similar to previous patch, vdev iterator.

Is it too late to add some unit test for these functionality?



More information about the dev mailing list