DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: SteveX Yang <stevex.yang@intel.com>, dev@dpdk.org
Cc: konstantin.ananyev@intel.com, beilei.xing@intel.com,
	wenzhuo.lu@intel.com, bernard.iremonger@intel.com,
	thomas@monjalon.net, andrew.rybchenko@oktetlabs.ru,
	qiming.yang@intel.com, qi.z.zhang@intel.com
Subject: Re: [dpdk-dev] [PATCH v6 1/2] app/testpmd: fix max rx packet length for VLAN packets
Date: Thu, 22 Oct 2020 17:22:24 +0100	[thread overview]
Message-ID: <d5824d4c-6106-a129-fae8-63e62253e7d0@intel.com> (raw)
In-Reply-To: <20201022084851.35134-2-stevex.yang@intel.com>

On 10/22/2020 9:48 AM, SteveX Yang wrote:
> When the max rx packet length is smaller than the sum of mtu size and
> ether overhead size, it should be enlarged, otherwise the VLAN packets
> will be dropped.
> 
> Fixes: 35b2d13fd6fd ("net: add rte prefix to ether defines")
> 
> Signed-off-by: SteveX Yang <stevex.yang@intel.com>
> ---
>   app/test-pmd/testpmd.c | 52 ++++++++++++++++++++++++++++++------------
>   1 file changed, 38 insertions(+), 14 deletions(-)
> 
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 33fc0fddf..9031c6145 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -1418,9 +1418,13 @@ init_config(void)
>   	unsigned int nb_mbuf_per_pool;
>   	lcoreid_t  lc_id;
>   	uint8_t port_per_socket[RTE_MAX_NUMA_NODES];
> +	struct rte_eth_dev_info *dev_info;
> +	struct rte_eth_conf *dev_conf;
>   	struct rte_gro_param gro_param;
>   	uint32_t gso_types;
>   	uint16_t data_size;
> +	uint16_t overhead_len;
> +	uint16_t frame_size;
>   	bool warning = 0;
>   	int k;
>   	int ret;
> @@ -1448,18 +1452,40 @@ init_config(void)
>   
>   	RTE_ETH_FOREACH_DEV(pid) {
>   		port = &ports[pid];
> +
> +		dev_info = &port->dev_info;
> +		dev_conf = &port->dev_conf;
> +
>   		/* Apply default TxRx configuration for all ports */
> -		port->dev_conf.txmode = tx_mode;
> -		port->dev_conf.rxmode = rx_mode;
> +		dev_conf->txmode = tx_mode;
> +		dev_conf->rxmode = rx_mode;

Hi Steve,

This patch does a small refactoring ('dev_info' & 'dev_conf') and a small 
update, but the refactoring shows the patch more complex than it actually is, if 
you think that is required can you please seperate these two?

>   
> -		ret = eth_dev_info_get_print_err(pid, &port->dev_info);
> +		ret = eth_dev_info_get_print_err(pid, dev_info);
>   		if (ret != 0)
>   			rte_exit(EXIT_FAILURE,
>   				 "rte_eth_dev_info_get() failed\n");
>   
> -		if (!(port->dev_info.tx_offload_capa &
> +		/*
> +		 * Update the max_rx_pkt_len to ensure that its size equals the
> +		 * sum of default mtu size and ether overhead length at least.
> +		 */

What about simplifying the above comment like:
" Update the max_rx_pkt_len to have MTU as RTE_ETHER_MTU "

> +		if (dev_info->max_rx_pktlen && dev_info->max_mtu)
> +			overhead_len =
> +				dev_info->max_rx_pktlen - dev_info->max_mtu;
> +		else
> +			overhead_len =
> +				RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
> +
> +		frame_size = RTE_ETHER_MTU + overhead_len;
> +		if (frame_size > RTE_ETHER_MAX_LEN) {
> +			dev_conf->rxmode.max_rx_pkt_len = frame_size;
> +			dev_conf->rxmode.offloads |=
> +				DEV_RX_OFFLOAD_JUMBO_FRAME;

I am not sure the jumbo frame asignment is always true.
'frame_size' can be bigger than 'RTE_ETHER_MAX_LEN', but mtu still can be <= 
1500. What about dropping this?

> +		}
> +
> +		if (!(dev_info->tx_offload_capa &
>   		      DEV_TX_OFFLOAD_MBUF_FAST_FREE))
> -			port->dev_conf.txmode.offloads &=
> +			dev_conf->txmode.offloads &=
>   				~DEV_TX_OFFLOAD_MBUF_FAST_FREE;
>   		if (numa_support) {
>   			if (port_numa[pid] != NUMA_NO_CONFIG)
> @@ -1478,13 +1504,11 @@ init_config(void)
>   		}
>   
>   		/* Apply Rx offloads configuration */
> -		for (k = 0; k < port->dev_info.max_rx_queues; k++)
> -			port->rx_conf[k].offloads =
> -				port->dev_conf.rxmode.offloads;
> +		for (k = 0; k < dev_info->max_rx_queues; k++)
> +			port->rx_conf[k].offloads = dev_conf->rxmode.offloads;
>   		/* Apply Tx offloads configuration */
> -		for (k = 0; k < port->dev_info.max_tx_queues; k++)
> -			port->tx_conf[k].offloads =
> -				port->dev_conf.txmode.offloads;
> +		for (k = 0; k < dev_info->max_tx_queues; k++)
> +			port->tx_conf[k].offloads = dev_conf->txmode.offloads;
>   
>   		/* set flag to initialize port/queue */
>   		port->need_reconfig = 1;
> @@ -1494,10 +1518,10 @@ init_config(void)
>   		/* Check for maximum number of segments per MTU. Accordingly
>   		 * update the mbuf data size.
>   		 */
> -		if (port->dev_info.rx_desc_lim.nb_mtu_seg_max != UINT16_MAX &&
> -				port->dev_info.rx_desc_lim.nb_mtu_seg_max != 0) {
> +		if (dev_info->rx_desc_lim.nb_mtu_seg_max != UINT16_MAX &&
> +				dev_info->rx_desc_lim.nb_mtu_seg_max != 0) {
>   			data_size = rx_mode.max_rx_pkt_len /
> -				port->dev_info.rx_desc_lim.nb_mtu_seg_max;
> +				dev_info->rx_desc_lim.nb_mtu_seg_max;
>   
>   			if ((data_size + RTE_PKTMBUF_HEADROOM) >
>   							mbuf_data_size[0]) {
> 


  reply	other threads:[~2020-10-22 16:22 UTC|newest]

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-16  5:52 [dpdk-dev] [PATCH v1 0/5] fix default max mtu size when device configured SteveX Yang
2020-09-16  5:52 ` [dpdk-dev] [PATCH v1 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default SteveX Yang
2020-09-16  5:52 ` [dpdk-dev] [PATCH v1 2/5] net/igc: " SteveX Yang
2020-09-16  5:52 ` [dpdk-dev] [PATCH v1 3/5] net/ice: " SteveX Yang
2020-09-16  5:52 ` [dpdk-dev] [PATCH v1 4/5] net/iavf: " SteveX Yang
2020-09-16  5:52 ` [dpdk-dev] [PATCH v1 5/5] net/i40e: " SteveX Yang
2020-09-16 14:41   ` Ananyev, Konstantin
     [not found]     ` <DM6PR11MB4362E5FF332551D12AA20017F93E0@DM6PR11MB4362.namprd11.prod.outlook.com>
2020-09-17 12:18       ` Ananyev, Konstantin
2020-09-22  1:23 ` [dpdk-dev] [PATCH v2 0/5] fix default max mtu size when device configured SteveX Yang
2020-09-22  1:23   ` [dpdk-dev] [PATCH v2 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default SteveX Yang
2020-09-22  1:23   ` [dpdk-dev] [PATCH v2 2/5] net/igc: " SteveX Yang
2020-09-22  1:23   ` [dpdk-dev] [PATCH v2 3/5] net/ice: " SteveX Yang
2020-09-22  1:23   ` [dpdk-dev] [PATCH v2 4/5] net/i40e: " SteveX Yang
2020-09-22 10:47     ` Ananyev, Konstantin
2020-09-22  1:23   ` [dpdk-dev] [PATCH v2 5/5] net/iavf: " SteveX Yang
2020-09-23  4:09   ` [dpdk-dev] [PATCH v3 0/5] fix default max mtu size when device configured SteveX Yang
2020-09-23  4:09     ` [dpdk-dev] [PATCH v3 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default SteveX Yang
2020-09-23  4:09     ` [dpdk-dev] [PATCH v3 2/5] net/igc: " SteveX Yang
2020-09-23  4:09     ` [dpdk-dev] [PATCH v3 3/5] net/ice: " SteveX Yang
2020-09-23  4:09     ` [dpdk-dev] [PATCH v3 4/5] net/i40e: " SteveX Yang
2020-09-23  4:09     ` [dpdk-dev] [PATCH v3 5/5] net/iavf: " SteveX Yang
2020-09-28  6:55     ` [dpdk-dev] [PATCH v4 0/5] fix default max mtu size when device configured SteveX Yang
2020-09-28  6:55       ` [dpdk-dev] [PATCH v4 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default SteveX Yang
2020-09-28  6:55       ` [dpdk-dev] [PATCH v4 2/5] net/igc: " SteveX Yang
2020-09-28  6:55       ` [dpdk-dev] [PATCH v4 3/5] net/ice: " SteveX Yang
2020-09-29 11:59         ` Zhang, Qi Z
2020-09-29 23:01           ` Ananyev, Konstantin
2020-09-30  0:34             ` Zhang, Qi Z
     [not found]               ` <DM6PR11MB4362515283D00E27A793E6B0F9330@DM6PR11MB4362.namprd11.prod.outlook.com>
2020-09-30  2:32                 ` Zhang, Qi Z
2020-10-14 15:38                   ` Ferruh Yigit
     [not found]                     ` <DM6PR11MB43628BBF9DCE7CC4D7C05AD8F91E0@DM6PR11MB4362.namprd11.prod.outlook.com>
2020-10-19 10:49                       ` Ananyev, Konstantin
2020-10-19 13:07                         ` Ferruh Yigit
2020-10-19 14:07                           ` Ananyev, Konstantin
2020-10-19 14:28                             ` Ananyev, Konstantin
2020-10-19 18:01                               ` Ferruh Yigit
2020-10-20  9:07                                 ` Ananyev, Konstantin
2020-10-20 12:29                                   ` Ferruh Yigit
2020-10-21  9:47                                     ` Ananyev, Konstantin
2020-10-21 10:36                                       ` Ferruh Yigit
2020-10-21 10:44                                         ` Ananyev, Konstantin
2020-10-21 10:53                                           ` Ferruh Yigit
2020-10-19 18:05                       ` Ferruh Yigit
     [not found]                         ` <DM6PR11MB4362F936BFC715BF6BABBAD0F91F0@DM6PR11MB4362.namprd11.prod.outlook.com>
2020-10-20  8:13                           ` Ferruh Yigit
2020-09-28  6:55       ` [dpdk-dev] [PATCH v4 4/5] net/i40e: " SteveX Yang
2020-09-28  6:55       ` [dpdk-dev] [PATCH v4 5/5] net/iavf: " SteveX Yang
2020-10-14  9:19       ` [dpdk-dev] [PATCH v5 0/5] fix default max mtu size when device configured SteveX Yang
2020-10-14  9:19         ` [dpdk-dev] [PATCH v5 1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default SteveX Yang
2020-10-14  9:19         ` [dpdk-dev] [PATCH v5 2/5] net/igc: " SteveX Yang
2020-10-14  9:19         ` [dpdk-dev] [PATCH v5 3/5] net/ice: " SteveX Yang
2020-10-14 11:35           ` Zhang, Qi Z
2020-10-14  9:19         ` [dpdk-dev] [PATCH v5 4/5] net/i40e: " SteveX Yang
2020-10-14 10:30           ` Ananyev, Konstantin
2020-10-14  9:19         ` [dpdk-dev] [PATCH v5 5/5] net/iavf: " SteveX Yang
2020-10-14 11:43         ` [dpdk-dev] [PATCH v5 0/5] fix default max mtu size when device configured Zhang, Qi Z
2020-10-22  8:48         ` [dpdk-dev] [PATCH v6 0/2] " SteveX Yang
2020-10-22  8:48           ` [dpdk-dev] [PATCH v6 1/2] app/testpmd: fix max rx packet length for VLAN packets SteveX Yang
2020-10-22 16:22             ` Ferruh Yigit [this message]
2020-10-22  8:48           ` [dpdk-dev] [PATCH v6 2/2] librte_ethdev: fix MTU size exceeds max rx packet length SteveX Yang
2020-10-22 16:31             ` Ferruh Yigit
2020-10-22 16:52             ` Ananyev, Konstantin
2020-10-28  3:03           ` [dpdk-dev] [PATCH v7 0/1] fix default max mtu size when device configured SteveX Yang
2020-10-28  3:03             ` [dpdk-dev] [PATCH v7 1/1] app/testpmd: fix max rx packet length for VLAN packets SteveX Yang
2020-10-29  8:41               ` Ferruh Yigit
2020-11-02  8:52             ` [dpdk-dev] [PATCH v8 0/2] fix default max mtu size when device configured SteveX Yang
2020-11-02  8:52               ` [dpdk-dev] [PATCH v8 1/2] app/testpmd: fix max rx packet length for VLAN packets SteveX Yang
2020-11-02 11:48                 ` Ferruh Yigit
2020-11-03 13:29                   ` Ferruh Yigit
2020-11-04 16:51                     ` Thomas Monjalon
2020-11-04 17:07                       ` Ferruh Yigit
2020-11-04 17:55                         ` Thomas Monjalon
2020-11-04 20:19                           ` Ferruh Yigit
2020-11-04 20:39                             ` Thomas Monjalon
2020-11-05  8:54                               ` Andrew Rybchenko
     [not found]                                 ` <DM6PR11MB43622CC5DF485DD034037CD3F9EE0@DM6PR11MB4362.namprd11.prod.outlook.com>
2020-11-05 10:37                                   ` Ferruh Yigit
2020-11-05 10:44                                     ` Thomas Monjalon
2020-11-05 10:48                                       ` Thomas Monjalon
2020-11-05 10:50                                         ` Ferruh Yigit
2020-11-05 13:52                                           ` Olivier Matz
2020-11-05 15:11                                             ` Lance Richardson
2020-11-05 15:56                                               ` Ferruh Yigit
2020-11-05 16:23                                                 ` Lance Richardson
2020-11-05 17:44                                                 ` [dpdk-dev] [PATCH 1/1] app/testpmd: revert max Rx packet length adjustment Thomas Monjalon
2020-11-05 18:02                                                   ` Lance Richardson
2020-11-05 18:11                                                   ` Ferruh Yigit
2020-11-05 18:18                                                     ` Thomas Monjalon
2020-11-05 10:49                                       ` [dpdk-dev] [PATCH v8 1/2] app/testpmd: fix max rx packet length for VLAN packets Ferruh Yigit
2020-11-02  8:52               ` [dpdk-dev] [PATCH v8 2/2] doc: annouce deprecation of jumbo frame flag condition SteveX Yang
2020-11-02 11:50                 ` Ferruh Yigit
2020-11-02 13:18                 ` Andrew Rybchenko
2020-11-02 13:58                   ` Ferruh Yigit
2020-11-02 16:05                     ` Ananyev, Konstantin
     [not found]                       ` <DM6PR11MB43625C5CF594BEDC9CE479F7F9110@DM6PR11MB4362.namprd11.prod.outlook.com>
2020-11-24 17:46                         ` Ferruh Yigit
2020-11-27 12:19                           ` Andrew Rybchenko
2020-11-27 17:08                             ` Bruce Richardson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d5824d4c-6106-a129-fae8-63e62253e7d0@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=beilei.xing@intel.com \
    --cc=bernard.iremonger@intel.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=stevex.yang@intel.com \
    --cc=thomas@monjalon.net \
    --cc=wenzhuo.lu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).