[dpdk-dev] [PATCH v2] examples/multi_process/symmetric_mp: fix link check

Thomas Monjalon thomas at monjalon.net
Fri Apr 5 15:03:48 CEST 2019


27/03/2019 12:33, Akhil Goyal:
> link check is done for primary process for the ports
> which are given in the port mask and not the complete
> set of ports.
> 
> Fixes: d3641ae86313 ("examples: update link status checks")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Akhil Goyal <akhil.goyal at nxp.com>
> ---
>  		for (portid = 0; portid < port_num; portid++) {

The logic of this loop is wrong.
The port ids may be not contiguous.
Look at RTE_ETH_FOREACH_DEV* for such iteration.

> -			if ((port_mask & (1 << portid)) == 0)
> +			if ((mask & (1 << portid)) == 0)
>  				continue;
[...]
> -		check_all_ports_link_status((uint8_t)num_ports, (~0x0));
> +		check_all_ports_link_status(rte_eth_dev_count(), port_mask);

The function rte_eth_dev_count is deprecated.
It should be noticed when compiling.

On more comment, I think such wrong implementation is existing
in many examples:
% git grep -l 'check_all_ports_link_status(.*num'
	app/test/test_pmd_perf.c
	examples/link_status_interrupt/main.c
	examples/load_balancer/init.c
	examples/multi_process/client_server_mp/mp_server/init.c
	examples/multi_process/symmetric_mp/main.c
	examples/server_node_efd/server/init.c




More information about the dev mailing list