DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [RFC] app/testpmd: fix MTU after device configure
@ 2020-11-05 18:09 Ferruh Yigit
  2020-11-11 12:58 ` Ferruh Yigit
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Ferruh Yigit @ 2020-11-05 18:09 UTC (permalink / raw)
  To: Wenzhuo Lu, Beilei Xing, Bernard Iremonger
  Cc: Ferruh Yigit, dev, Steve Yang, Thomas Monjalon, Andrew Rybchenko,
	Konstantin Ananyev, Olivier Matz, Lance Richardson

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;
-- 
2.26.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [RFC] app/testpmd: fix MTU after device configure
  2020-11-05 18:09 [dpdk-dev] [RFC] app/testpmd: fix MTU after device configure Ferruh Yigit
@ 2020-11-11 12:58 ` Ferruh Yigit
  2020-11-13 10:37 ` Zhang, Qi Z
  2020-11-13 11:44 ` [dpdk-dev] [PATCH] " Ferruh Yigit
  2 siblings, 0 replies; 8+ messages in thread
From: Ferruh Yigit @ 2020-11-11 12:58 UTC (permalink / raw)
  To: Wenzhuo Lu, Beilei Xing, Bernard Iremonger
  Cc: dev, Steve Yang, Thomas Monjalon, Andrew Rybchenko,
	Konstantin Ananyev, Olivier Matz, Lance Richardson

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [RFC] app/testpmd: fix MTU after device configure
  2020-11-05 18:09 [dpdk-dev] [RFC] app/testpmd: fix MTU after device configure Ferruh Yigit
  2020-11-11 12:58 ` Ferruh Yigit
@ 2020-11-13 10:37 ` Zhang, Qi Z
  2020-11-13 11:44 ` [dpdk-dev] [PATCH] " Ferruh Yigit
  2 siblings, 0 replies; 8+ messages in thread
From: Zhang, Qi Z @ 2020-11-13 10:37 UTC (permalink / raw)
  To: Yigit, Ferruh, Lu, Wenzhuo, Xing, Beilei, Iremonger, Bernard
  Cc: Yigit, Ferruh, dev, Yang, SteveX, Thomas Monjalon,
	Andrew Rybchenko, Ananyev, Konstantin, Olivier Matz,
	Lance Richardson



> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Ferruh Yigit
> Sent: Friday, November 6, 2020 2:10 AM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>; Iremonger, Bernard <bernard.iremonger@intel.com>
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; dev@dpdk.org; Yang, SteveX
> <stevex.yang@intel.com>; Thomas Monjalon <thomas@monjalon.net>;
> Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; Olivier Matz <olivier.matz@6wind.com>;
> Lance Richardson <lance.richardson@broadcom.com>
> Subject: [dpdk-dev] [RFC] app/testpmd: fix MTU after device configure
> 
> 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>

Reviewed-by: Qi Zhang <qi.z.zhang@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;
> --
> 2.26.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH] app/testpmd: fix MTU after device configure
  2020-11-05 18:09 [dpdk-dev] [RFC] app/testpmd: fix MTU after device configure Ferruh Yigit
  2020-11-11 12:58 ` Ferruh Yigit
  2020-11-13 10:37 ` Zhang, Qi Z
@ 2020-11-13 11:44 ` Ferruh Yigit
  2020-11-13 14:53   ` Andrew Rybchenko
  2020-11-16 18:50   ` Ferruh Yigit
  2 siblings, 2 replies; 8+ messages in thread
From: Ferruh Yigit @ 2020-11-13 11:44 UTC (permalink / raw)
  To: Wenzhuo Lu, Beilei Xing, Bernard Iremonger
  Cc: Ferruh Yigit, dev, Qi Zhang, Steve Yang, Thomas Monjalon,
	Andrew Rybchenko, Konstantin Ananyev, Olivier Matz,
	Lance Richardson

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>
Reviewed-by: Qi Zhang <qi.z.zhang@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;
-- 
2.26.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] app/testpmd: fix MTU after device configure
  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
  1 sibling, 1 reply; 8+ messages in thread
From: Andrew Rybchenko @ 2020-11-13 14:53 UTC (permalink / raw)
  To: Ferruh Yigit, Wenzhuo Lu, Beilei Xing, Bernard Iremonger
  Cc: dev, Qi Zhang, Steve Yang, Thomas Monjalon, Konstantin Ananyev,
	Olivier Matz, Lance Richardson, Igor Romanov

On 11/13/20 2:44 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>
> Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>

Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Tested-by: Igor Romanov <igor.romanov@oktetlabs.ru>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] app/testpmd: fix MTU after device configure
  2020-11-13 14:53   ` Andrew Rybchenko
@ 2020-11-13 16:01     ` Ferruh Yigit
  0 siblings, 0 replies; 8+ messages in thread
From: Ferruh Yigit @ 2020-11-13 16:01 UTC (permalink / raw)
  To: Andrew Rybchenko, Wenzhuo Lu, Beilei Xing, Bernard Iremonger
  Cc: dev, Qi Zhang, Steve Yang, Thomas Monjalon, Konstantin Ananyev,
	Olivier Matz, Lance Richardson, Igor Romanov

On 11/13/2020 2:53 PM, Andrew Rybchenko wrote:
> On 11/13/20 2:44 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>
>> Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
> 
> Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Tested-by: Igor Romanov <igor.romanov@oktetlabs.ru>
> 

Applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] app/testpmd: fix MTU after device configure
  2020-11-13 11:44 ` [dpdk-dev] [PATCH] " Ferruh Yigit
  2020-11-13 14:53   ` Andrew Rybchenko
@ 2020-11-16 18:50   ` Ferruh Yigit
  2020-11-16 20:24     ` Thomas Monjalon
  1 sibling, 1 reply; 8+ messages in thread
From: Ferruh Yigit @ 2020-11-16 18:50 UTC (permalink / raw)
  To: Wenzhuo Lu, Beilei Xing, Bernard Iremonger
  Cc: dev, Qi Zhang, Steve Yang, Thomas Monjalon, Andrew Rybchenko,
	Konstantin Ananyev, Olivier Matz, Lance Richardson,
	David Marchand

On 11/13/2020 11:44 AM, 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>
> Reviewed-by: Qi Zhang <qi.z.zhang@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;
> 

@David highlighted that 'scatter' tests are failing in the lab with this commit,
https://lab.dpdk.org/results/dashboard/patchsets/14492/

With above commit only 'mtu' is taken into account, so in testpmd both 
"--max-pkt-len=N" parameter and "port config all max-pkt-len #" command are no 
more working as expected. This seems the reason of the failure.

Technically it is possible to fix dts testcase by adding following commands:
port stop all
port config mtu 0 9000
port start all

But, there may be other side affects from "max-pkt-len" is not working in 
testpmd as expected. Reverting this one too can be safest option.

For now we need to live with the issue this patch is fixing, hopefully we can 
fix it in next release with fixing all testpmd, ethdev and drivers, there is a 
question about ethdev change if it will be an ABI break or not, we will see it.

And there is a longer term target to deprecate 'max_rx_pkt_len' and 'mtu' to 
unify them:
https://patches.dpdk.org/patch/81591/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] app/testpmd: fix MTU after device configure
  2020-11-16 18:50   ` Ferruh Yigit
@ 2020-11-16 20:24     ` Thomas Monjalon
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Monjalon @ 2020-11-16 20:24 UTC (permalink / raw)
  To: Qi Zhang, Ferruh Yigit
  Cc: Wenzhuo Lu, Beilei Xing, Bernard Iremonger, dev, Steve Yang,
	Andrew Rybchenko, Konstantin Ananyev, Olivier Matz,
	Lance Richardson, David Marchand

16/11/2020 19:50, Ferruh Yigit:
> On 11/13/2020 11:44 AM, 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>
> > Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
> > ---
> 
> @David highlighted that 'scatter' tests are failing in the lab with this commit,
> https://lab.dpdk.org/results/dashboard/patchsets/14492/

To be more precise, this error showed up in the CI even before
the patch was merged: https://patches.dpdk.org/patch/84132/
We should be more careful with the CI results before merging.

> With above commit only 'mtu' is taken into account, so in testpmd both 
> "--max-pkt-len=N" parameter and "port config all max-pkt-len #" command are no 
> more working as expected. This seems the reason of the failure.
> 
> Technically it is possible to fix dts testcase by adding following commands:
> port stop all
> port config mtu 0 9000
> port start all
> 
> But, there may be other side affects from "max-pkt-len" is not working in 
> testpmd as expected. Reverting this one too can be safest option.

Next fix will be the right one ;)



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-11-16 20:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-05 18:09 [dpdk-dev] [RFC] app/testpmd: fix MTU after device configure Ferruh Yigit
2020-11-11 12:58 ` Ferruh Yigit
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

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).