[dpdk-dev] [PATCH v2 7/7] app/testpmd: verify mtu with rte_eth_dev_info_get()

Ferruh Yigit ferruh.yigit at intel.com
Mon Mar 25 15:20:32 CET 2019


On 3/22/2019 1:01 PM, Ian Stokes wrote:
> This commit uses the mtu fields populated in rte_eth_dev_info_get()
> to validate the mtu value being passed in port_mtu_set().
> 
> Signed-off-by: Ian Stokes <ian.stokes at intel.com>

For patch title, I think 'rte_eth_dev_info_get()' is implementation detail here,
what we are verifying mtu against min/max MTU information provided by PMDs.
What do you think something like:
app/testpmd: verify MTU with PMD provided limits

> ---
>  app/test-pmd/config.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index b9e5dd923..6ca97d0e7 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -1063,9 +1063,13 @@ void
>  port_mtu_set(portid_t port_id, uint16_t mtu)
>  {
>  	int diag;
> +	struct rte_eth_dev_info dev_info;
>  
>  	if (port_id_is_invalid(port_id, ENABLED_WARN))
>  		return;
> +	rte_eth_dev_info_get(port_id, &dev_info);
> +	if (mtu > dev_info.max_mtu || mtu < dev_info.min_mtu)
> +		return;

This fails silently, I think better to put a log for failure.

>  	diag = rte_eth_dev_set_mtu(port_id, mtu);
>  	if (diag == 0)
>  		return;
> 



More information about the dev mailing list