DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Wenzhuo Lu <wenzhuo.lu@intel.com>,
	Beilei Xing <beilei.xing@intel.com>,
	Bernard Iremonger <bernard.iremonger@intel.com>
Cc: dev@dpdk.org, Steve Yang <stevex.yang@intel.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	Konstantin Ananyev <konstantin.ananyev@intel.com>,
	Olivier Matz <olivier.matz@6wind.com>,
	Lance Richardson <lance.richardson@broadcom.com>
Subject: Re: [dpdk-dev] [RFC] app/testpmd: fix MTU after device configure
Date: Wed, 11 Nov 2020 12:58:18 +0000
Message-ID: <5e5f6ac8-be14-4205-f520-69369ede9c51@intel.com> (raw)
In-Reply-To: <20201105180942.2938152-1-ferruh.yigit@intel.com>

On 11/5/2020 6:09 PM, Ferruh Yigit wrote:
> In 'rte_eth_dev_configure()', if 'DEV_RX_OFFLOAD_JUMBO_FRAME' is not set
> the max frame size is limited to 'RTE_ETHER_MAX_LEN' (1518).
> This is mistake because for the PMDs that has frame size bigger than
> "RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN" (18 bytes), the MTU becomes
> less than 1500, causing a valid frame with 1500 bytes payload to be
> dropped.
> 
> Since 'rte_eth_dev_set_mtu()' works as expected, it is called after
> 'rte_eth_dev_configure()' to fix the MTU.
> It may look redundant to set MTU after 'rte_eth_dev_configure()', both
> with default values, but it is not, the resulting MTU config can be
> different in the device based on frame overhead of the PMD.
> 
> And instead of setting the MTU to default value, it is first get via
> 'rte_eth_dev_get_mtu()' and set again, this is to cover cases MTU
> changed from testpmd command line.
> 
> 'rte_eth_dev_set_mtu()', '-ENOTSUP' error is ignored to prevent
> irrelevant warning messages for the virtual PMDs.
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
> Cc: Steve Yang <stevex.yang@intel.com>
> Cc: Thomas Monjalon <thomas@monjalon.net>
> Cc: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Cc: Konstantin Ananyev <konstantin.ananyev@intel.com>
> Cc: Olivier Matz <olivier.matz@6wind.com>
> Cc: Lance Richardson <lance.richardson@broadcom.com>
> ---
>   app/test-pmd/testpmd.c | 19 +++++++++++++++++++
>   1 file changed, 19 insertions(+)
> 
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 33fc0fddf5..48e9647fc7 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -2537,6 +2537,8 @@ start_port(portid_t pid)
>   		}
>   
>   		if (port->need_reconfig > 0) {
> +			uint16_t mtu = RTE_ETHER_MTU;
> +
>   			port->need_reconfig = 0;
>   
>   			if (flow_isolate_all) {
> @@ -2570,6 +2572,23 @@ start_port(portid_t pid)
>   				port->need_reconfig = 1;
>   				return -1;
>   			}
> +
> +			/*
> +			 * Workaround for rte_eth_dev_configure(), max_rx_pkt_len
> +			 * set MTU wrong for the PMDs that have frame overhead
> +			 * bigger than RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN.
> +			 * For a PMD that has 26 bytes overhead, rte_eth_dev_configure()
> +			 * can set MTU to max 1492, not to expected 1500 bytes.
> +			 * Using rte_eth_dev_set_mtu() to be able to set MTU correctly,
> +			 * default MTU value is 1500.
> +			 */
> +			diag = rte_eth_dev_get_mtu(pi, &mtu);
> +			if (diag)
> +				printf("Failed to get MTU for port %d\n", pi);
> +			diag = rte_eth_dev_set_mtu(pi, mtu);
> +			if (diag != 0 && diag != -ENOTSUP)
> +				printf("Failed to set MTU to %u for port %d\n",
> +						mtu, pi);
>   		}
>   		if (port->need_reconfig_queues > 0) {
>   			port->need_reconfig_queues = 0;
> 

Hi Steve,

Since your patch [1] for the fix reverted [2], can you please test above patch? 
If it works as expected I will send as actual patch.

Thanks,
ferruh

[1]
https://git.dpdk.org/dpdk/commit/?id=f6870a7ed6b3

[2]
https://git.dpdk.org/dpdk/commit/?id=13e0b599acfd


  reply	other threads:[~2020-11-11 12:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05 18:09 Ferruh Yigit
2020-11-11 12:58 ` Ferruh Yigit [this message]
2020-11-13 10:37 ` Zhang, Qi Z
2020-11-13 11:44 ` [dpdk-dev] [PATCH] " Ferruh Yigit
2020-11-13 14:53   ` Andrew Rybchenko
2020-11-13 16:01     ` Ferruh Yigit
2020-11-16 18:50   ` Ferruh Yigit
2020-11-16 20:24     ` Thomas Monjalon

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=5e5f6ac8-be14-4205-f520-69369ede9c51@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=lance.richardson@broadcom.com \
    --cc=olivier.matz@6wind.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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git