[PATCH v2] app/testpmd : fix testpmd quit error

Ferruh Yigit ferruh.yigit at intel.com
Fri Mar 4 17:18:57 CET 2022


On 3/4/2022 2:37 AM, wenxuanx.wu at intel.com wrote:
> From: wenxuan wu <wenxuanx.wu at intel.com>
> 
> When testpmd use func get_eth_dev_info() while related resource
> had been released.
> 

Is 'eth_dev_info_get_print_err()' fails at this stage?
What resource is released, the 'slave_port' itself?

And there may be another logic wrong, it shouldn't try
to detect if a released port is bonding port or not.

> Change the logic of func port_is_bonding_slave, this func
> eth_dev_info_get_print_err while pf is released would result
> in this error. Use ports instead to avoid this bug.
> 

This relies to application level stored value to decide about
port, not sure if this is reliable.

> Fixes: 0a0821bcf312 ("app/testpmd: remove most uses of internal ethdev array")
> Cc: stable at dpdk.org
> 
> Signed-off-by: wenxuan wu <wenxuanx.wu at intel.com>
> ---
>   app/test-pmd/testpmd.c | 12 +-----------
>   1 file changed, 1 insertion(+), 11 deletions(-)
> 
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index e1da961311..37038c9183 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -3824,19 +3824,9 @@ void clear_port_slave_flag(portid_t slave_pid)
>   uint8_t port_is_bonding_slave(portid_t slave_pid)
>   {
>   	struct rte_port *port;
> -	struct rte_eth_dev_info dev_info;
> -	int ret;
>   
>   	port = &ports[slave_pid];
> -	ret = eth_dev_info_get_print_err(slave_pid, &dev_info);
> -	if (ret != 0) {
> -		TESTPMD_LOG(ERR,
> -			"Failed to get device info for port id %d,"
> -			"cannot determine if the port is a bonded slave",
> -			slave_pid);
> -		return 0;
> -	}
> -	if ((*dev_info.dev_flags & RTE_ETH_DEV_BONDED_SLAVE) || (port->slave_flag == 1))
> +	if ((*port->dev_info.dev_flags & RTE_ETH_DEV_BONDED_SLAVE) || (port->slave_flag == 1))
>   		return 1;
>   	return 0;
>   }



More information about the dev mailing list