[dpdk-dev] [PATCH v1] app/testpmd: fix dynamic config error for max-pkt-len

Li, Xiaoyun xiaoyun.li at intel.com
Wed Dec 23 03:27:25 CET 2020


Hi
Comments inline

> -----Original Message-----
> From: dev <dev-bounces at dpdk.org> On Behalf Of Steve Yang
> Sent: Tuesday, December 22, 2020 16:14
> To: dev at dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu at intel.com>; Xing, Beilei <beilei.xing at intel.com>;
> Iremonger, Bernard <bernard.iremonger at intel.com>; Yang, SteveX
> <stevex.yang at intel.com>
> Subject: [dpdk-dev] [PATCH v1] app/testpmd: fix dynamic config error for max-
> pkt-len
> 
> When 'max-pkt-len' value caused the 'rx_offloads' flag change, the all offloads
> of rx queues ('rx_conf[qid].offloads') weren't synchronized, that will cause the
> offloads check failed with 'rx_queue_offload_capa'
> within 'rte_eth_rx_queue_setup'.
> 
> Apply rx offloads configuration once it changed when 'max-pkt-len'
> command parsed.

Grammar and tense inconsistence...
You can phrase like the following:

Configuring 'max-pkt-len' would change 'rx_offloads' in dev_conf while rx_conf.offloads of each queue still kept the old value.
It would cause the failure of offloads check in ''rte_eth_rx_queue_setup'.

This patch applied rx offloads configuration for each queue once it changed.

> 
> Fixes: 384161e00627 ("app/testpmd: adjust on the fly VLAN configuration")
> 
> Signed-off-by: Steve Yang <stevex.yang at intel.com>
> ---
>  app/test-pmd/cmdline.c | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> 2ccbaa039e..d72a40d7de 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -1902,7 +1902,23 @@ cmd_config_max_pkt_len_parsed(void
> *parsed_result,
>  				rx_offloads |=
> DEV_RX_OFFLOAD_JUMBO_FRAME;
>  			else
>  				rx_offloads &=
> ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> -			port->dev_conf.rxmode.offloads = rx_offloads;

I understand what you're doing here. But I think there's a better place to do this.
This config cmd will call init_port_config() later. And rxtx_port_config() will be called in it.
I think you should do this in rxtx_port_config().
Check if rx_conf  is equal to dev_conf, and if it's not consistent, apply dev_conf.

Although if you insist on your way doing this, there're some issues too. See below.

> +
> +			if (rx_offloads != port->dev_conf.rxmode.offloads) {
> +				uint16_t k;
> +				int ret;
> +
> +				port->dev_conf.rxmode.offloads = rx_offloads;
> +				/* Apply Rx offloads configuration */
> +				ret = eth_dev_info_get_print_err(pid,
> +							&port->dev_info);
> +				if (ret != 0)
> +					rte_exit(EXIT_FAILURE,
> +					    "rte_eth_dev_info_get() failed\n");

rte_exit if for the main process of the application not for cmdline.
Because rte_exit will just terminate the application and return to the shell. You wouldn't want that.
You only needs to 'return;' or maybe printf a error message and return.

> +
> +				for (k = 0;

Why are you using 'k'? There's no problem of this just looks a bit weird. There's no 'i' used in this function so why not just use 'i'.

> +				     k < port->dev_info.nb_rx_queues; k++)
> +					port->rx_conf[k].offloads =
> rx_offloads;
> +			}
>  		} else {
>  			printf("Unknown parameter\n");
>  			return;
> --
> 2.17.1



More information about the dev mailing list