[dpdk-dev] app/testpmd: do not enable Rx offloads by default

Message ID 1516695081-178919-1-git-send-email-motih@mellanox.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Moti Haimovsky Jan. 23, 2018, 8:11 a.m. UTC
  Removed the hardcoded preconfigured Rx offload configuration from
testpmd.
Testers who wish to use these offloads will now have to explicitly
write them in the command-line when running testpmd.

Motivation:
Some PMDs such at the mlx4 may not implement all the offloads.
After the offload API rework assuming no offload is enabled by default,
  commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API")
  commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") trying
to enable a not supported offload is clearly an error which will cause
configuration failing.

Considering that testpmd is an application to test the PMD, it should
not fail on a configuration which was not explicitly requested.
The behavior of this test application is then turned to an opt-in
model.

Signed-off-by: Moti Haimovsky <motih@mellanox.com>
---
 app/test-pmd/testpmd.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
  

Comments

Wenzhuo Lu Jan. 25, 2018, 1:11 a.m. UTC | #1
Hi Moti,


> -----Original Message-----
> From: Moti Haimovsky [mailto:motih@mellanox.com]
> Sent: Tuesday, January 23, 2018 4:11 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; thomas@monjalon.net
> Cc: dev@dpdk.org; Moti Haimovsky <motih@mellanox.com>
> Subject: [PATCH] app/testpmd: do not enable Rx offloads by default
> 
> Removed the hardcoded preconfigured Rx offload configuration from
> testpmd.
> Testers who wish to use these offloads will now have to explicitly write them
> in the command-line when running testpmd.
> 
> Motivation:
> Some PMDs such at the mlx4 may not implement all the offloads.
> After the offload API rework assuming no offload is enabled by default,
>   commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API")
>   commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") trying to
> enable a not supported offload is clearly an error which will cause
> configuration failing.
> 
> Considering that testpmd is an application to test the PMD, it should not fail
> on a configuration which was not explicitly requested.
> The behavior of this test application is then turned to an opt-in model.
> 
> Signed-off-by: Moti Haimovsky <motih@mellanox.com>
> ---
>  app/test-pmd/testpmd.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
> 5dc8cca..a082352 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -305,9 +305,7 @@ struct fwd_engine * fwd_engines[] = {
>   */
>  struct rte_eth_rxmode rx_mode = {
>  	.max_rx_pkt_len = ETHER_MAX_LEN, /**< Default maximum frame
> length. */
> -	.offloads = (DEV_RX_OFFLOAD_VLAN_FILTER |
> -		     DEV_RX_OFFLOAD_VLAN_STRIP |
> -		     DEV_RX_OFFLOAD_CRC_STRIP),
> +	.offloads = 0,
Change the default behavior may trigger other problems. I think TX offload could be a good reference. Get the capability and check what's supported first, then ignore the not supported functions with printing a warning but not block anything...

>  	.ignore_offload_bitfield = 1,
>  };
> 
> --
> 1.8.3.1
  
Thomas Monjalon Jan. 25, 2018, 9:04 a.m. UTC | #2
25/01/2018 02:11, Lu, Wenzhuo:
> > --- a/app/test-pmd/testpmd.c
> > +++ b/app/test-pmd/testpmd.c
> > @@ -305,9 +305,7 @@ struct fwd_engine * fwd_engines[] = {
> >   */
> >  struct rte_eth_rxmode rx_mode = {
> >  	.max_rx_pkt_len = ETHER_MAX_LEN, /**< Default maximum frame
> > length. */
> > -	.offloads = (DEV_RX_OFFLOAD_VLAN_FILTER |
> > -		     DEV_RX_OFFLOAD_VLAN_STRIP |
> > -		     DEV_RX_OFFLOAD_CRC_STRIP),
> > +	.offloads = 0,
> 
> Change the default behavior may trigger other problems. I think TX offload could be a good reference. Get the capability and check what's supported first, then ignore the not supported functions with printing a warning but not block anything...

I agree that we should check the capabilities before requesting an offload.
But I disagree on another point: we should not enable an offload if the
user did not request it explicitly. It makes things unclear.
This is a testing tool, it should be close to the ethdev API behavior.

Why these offload flags are silently enabled?
  
Stephen Hemminger Jan. 25, 2018, 4:01 p.m. UTC | #3
On Thu, 25 Jan 2018 10:04:11 +0100
Thomas Monjalon <thomas@monjalon.net> wrote:

> 25/01/2018 02:11, Lu, Wenzhuo:
> > > --- a/app/test-pmd/testpmd.c
> > > +++ b/app/test-pmd/testpmd.c
> > > @@ -305,9 +305,7 @@ struct fwd_engine * fwd_engines[] = {
> > >   */
> > >  struct rte_eth_rxmode rx_mode = {
> > >  	.max_rx_pkt_len = ETHER_MAX_LEN, /**< Default maximum frame
> > > length. */
> > > -	.offloads = (DEV_RX_OFFLOAD_VLAN_FILTER |
> > > -		     DEV_RX_OFFLOAD_VLAN_STRIP |
> > > -		     DEV_RX_OFFLOAD_CRC_STRIP),
> > > +	.offloads = 0,  
> > 
> > Change the default behavior may trigger other problems. I think TX offload could be a good reference. Get the capability and check what's supported first, then ignore the not supported functions with printing a warning but not block anything...  
> 
> I agree that we should check the capabilities before requesting an offload.
> But I disagree on another point: we should not enable an offload if the
> user did not request it explicitly. It makes things unclear.
> This is a testing tool, it should be close to the ethdev API behavior.
> 
> Why these offload flags are silently enabled?

Also all virtual devices ignore CRC strip.
  
Wenzhuo Lu Jan. 26, 2018, 7:30 a.m. UTC | #4
Hi Thomas,

> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Thursday, January 25, 2018 5:04 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Cc: Moti Haimovsky <motih@mellanox.com>; dev@dpdk.org;
> shahafs@mellanox.com; Yigit, Ferruh <ferruh.yigit@intel.com>
> Subject: Re: [PATCH] app/testpmd: do not enable Rx offloads by default
> 
> 25/01/2018 02:11, Lu, Wenzhuo:
> > > --- a/app/test-pmd/testpmd.c
> > > +++ b/app/test-pmd/testpmd.c
> > > @@ -305,9 +305,7 @@ struct fwd_engine * fwd_engines[] = {
> > >   */
> > >  struct rte_eth_rxmode rx_mode = {
> > >  	.max_rx_pkt_len = ETHER_MAX_LEN, /**< Default maximum frame
> > > length. */
> > > -	.offloads = (DEV_RX_OFFLOAD_VLAN_FILTER |
> > > -		     DEV_RX_OFFLOAD_VLAN_STRIP |
> > > -		     DEV_RX_OFFLOAD_CRC_STRIP),
> > > +	.offloads = 0,
> >
> > Change the default behavior may trigger other problems. I think TX offload
> could be a good reference. Get the capability and check what's supported
> first, then ignore the not supported functions with printing a warning but
> not block anything...
> 
> I agree that we should check the capabilities before requesting an offload.
> But I disagree on another point: we should not enable an offload if the user
> did not request it explicitly. It makes things unclear.
> This is a testing tool, it should be close to the ethdev API behavior.
> 
> Why these offload flags are silently enabled?
I don't think it's silently. It's a global configuration. In this case, testpmd is the user, it does request it explicitly. If it's not so explicit, maybe we can consider moving all the configuration to a specific configure file.
Talking about why it's enabled by default. Hard to figure out the history. To my opinion, the original designer wants to simulate the common case.
  
Wenzhuo Lu Jan. 26, 2018, 7:31 a.m. UTC | #5
Hi Stephen,


> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Friday, January 26, 2018 12:02 AM
> To: Thomas Monjalon <thomas@monjalon.net>
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Moti Haimovsky
> <motih@mellanox.com>; dev@dpdk.org; shahafs@mellanox.com; Yigit,
> Ferruh <ferruh.yigit@intel.com>
> Subject: Re: [dpdk-dev] [PATCH] app/testpmd: do not enable Rx offloads by
> default
> 
> On Thu, 25 Jan 2018 10:04:11 +0100
> Thomas Monjalon <thomas@monjalon.net> wrote:
> 
> > 25/01/2018 02:11, Lu, Wenzhuo:
> > > > --- a/app/test-pmd/testpmd.c
> > > > +++ b/app/test-pmd/testpmd.c
> > > > @@ -305,9 +305,7 @@ struct fwd_engine * fwd_engines[] = {
> > > >   */
> > > >  struct rte_eth_rxmode rx_mode = {
> > > >  	.max_rx_pkt_len = ETHER_MAX_LEN, /**< Default maximum frame
> > > > length. */
> > > > -	.offloads = (DEV_RX_OFFLOAD_VLAN_FILTER |
> > > > -		     DEV_RX_OFFLOAD_VLAN_STRIP |
> > > > -		     DEV_RX_OFFLOAD_CRC_STRIP),
> > > > +	.offloads = 0,
> > >
> > > Change the default behavior may trigger other problems. I think TX
> offload could be a good reference. Get the capability and check what's
> supported first, then ignore the not supported functions with printing a
> warning but not block anything...
> >
> > I agree that we should check the capabilities before requesting an offload.
> > But I disagree on another point: we should not enable an offload if
> > the user did not request it explicitly. It makes things unclear.
> > This is a testing tool, it should be close to the ethdev API behavior.
> >
> > Why these offload flags are silently enabled?
> 
> Also all virtual devices ignore CRC strip.
Look like it's the case the device ignores the flag if it doesn't have the capability.
  
Thomas Monjalon Jan. 26, 2018, 7:48 a.m. UTC | #6
26/01/2018 08:30, Lu, Wenzhuo:
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > 25/01/2018 02:11, Lu, Wenzhuo:
> > > > --- a/app/test-pmd/testpmd.c
> > > > +++ b/app/test-pmd/testpmd.c
> > > > @@ -305,9 +305,7 @@ struct fwd_engine * fwd_engines[] = {
> > > >   */
> > > >  struct rte_eth_rxmode rx_mode = {
> > > >  	.max_rx_pkt_len = ETHER_MAX_LEN, /**< Default maximum frame
> > > > length. */
> > > > -	.offloads = (DEV_RX_OFFLOAD_VLAN_FILTER |
> > > > -		     DEV_RX_OFFLOAD_VLAN_STRIP |
> > > > -		     DEV_RX_OFFLOAD_CRC_STRIP),
> > > > +	.offloads = 0,
> > >
> > > Change the default behavior may trigger other problems. I think TX offload
> > could be a good reference. Get the capability and check what's supported
> > first, then ignore the not supported functions with printing a warning but
> > not block anything...
> > 
> > I agree that we should check the capabilities before requesting an offload.
> > But I disagree on another point: we should not enable an offload if the user
> > did not request it explicitly. It makes things unclear.
> > This is a testing tool, it should be close to the ethdev API behavior.
> > 
> > Why these offload flags are silently enabled?
> 
> I don't think it's silently. It's a global configuration. In this case, testpmd is the user, it does request it explicitly. If it's not so explicit, maybe we can consider moving all the configuration to a specific configure file.
> Talking about why it's enabled by default. Hard to figure out the history. To my opinion, the original designer wants to simulate the common case.

Please do not justify a design mistake by history.

This is a test tool, so we don't care about the common case.
A test tool should not try to guess the best configuration.
Only the user should decide the configuration to apply,
and the default should be empty, as the API is.
  
Thomas Monjalon Jan. 26, 2018, 7:49 a.m. UTC | #7
26/01/2018 08:31, Lu, Wenzhuo:
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> > On Thu, 25 Jan 2018 10:04:11 +0100
> > Thomas Monjalon <thomas@monjalon.net> wrote:
> > > 25/01/2018 02:11, Lu, Wenzhuo:
> > > > > --- a/app/test-pmd/testpmd.c
> > > > > +++ b/app/test-pmd/testpmd.c
> > > > > @@ -305,9 +305,7 @@ struct fwd_engine * fwd_engines[] = {
> > > > >   */
> > > > >  struct rte_eth_rxmode rx_mode = {
> > > > >  	.max_rx_pkt_len = ETHER_MAX_LEN, /**< Default maximum frame
> > > > > length. */
> > > > > -	.offloads = (DEV_RX_OFFLOAD_VLAN_FILTER |
> > > > > -		     DEV_RX_OFFLOAD_VLAN_STRIP |
> > > > > -		     DEV_RX_OFFLOAD_CRC_STRIP),
> > > > > +	.offloads = 0,
> > > >
> > > > Change the default behavior may trigger other problems. I think TX
> > offload could be a good reference. Get the capability and check what's
> > supported first, then ignore the not supported functions with printing a
> > warning but not block anything...
> > >
> > > I agree that we should check the capabilities before requesting an offload.
> > > But I disagree on another point: we should not enable an offload if
> > > the user did not request it explicitly. It makes things unclear.
> > > This is a testing tool, it should be close to the ethdev API behavior.
> > >
> > > Why these offload flags are silently enabled?
> > 
> > Also all virtual devices ignore CRC strip.
> Look like it's the case the device ignores the flag if it doesn't have the capability.

It is a wrong behaviour!
If a configuration cannot be applied, it must be an error.
  
Wenzhuo Lu Jan. 26, 2018, 8:06 a.m. UTC | #8
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Friday, January 26, 2018 3:48 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Cc: Moti Haimovsky <motih@mellanox.com>; dev@dpdk.org;
> shahafs@mellanox.com; Yigit, Ferruh <ferruh.yigit@intel.com>
> Subject: Re: [PATCH] app/testpmd: do not enable Rx offloads by default
> 
> 26/01/2018 08:30, Lu, Wenzhuo:
> > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > 25/01/2018 02:11, Lu, Wenzhuo:
> > > > > --- a/app/test-pmd/testpmd.c
> > > > > +++ b/app/test-pmd/testpmd.c
> > > > > @@ -305,9 +305,7 @@ struct fwd_engine * fwd_engines[] = {
> > > > >   */
> > > > >  struct rte_eth_rxmode rx_mode = {
> > > > >  	.max_rx_pkt_len = ETHER_MAX_LEN, /**< Default maximum
> frame
> > > > > length. */
> > > > > -	.offloads = (DEV_RX_OFFLOAD_VLAN_FILTER |
> > > > > -		     DEV_RX_OFFLOAD_VLAN_STRIP |
> > > > > -		     DEV_RX_OFFLOAD_CRC_STRIP),
> > > > > +	.offloads = 0,
> > > >
> > > > Change the default behavior may trigger other problems. I think TX
> > > > offload
> > > could be a good reference. Get the capability and check what's
> > > supported first, then ignore the not supported functions with
> > > printing a warning but not block anything...
> > >
> > > I agree that we should check the capabilities before requesting an offload.
> > > But I disagree on another point: we should not enable an offload if
> > > the user did not request it explicitly. It makes things unclear.
> > > This is a testing tool, it should be close to the ethdev API behavior.
> > >
> > > Why these offload flags are silently enabled?
> >
> > I don't think it's silently. It's a global configuration. In this case, testpmd is
> the user, it does request it explicitly. If it's not so explicit, maybe we can
> consider moving all the configuration to a specific configure file.
> > Talking about why it's enabled by default. Hard to figure out the history.
> To my opinion, the original designer wants to simulate the common case.
> 
> Please do not justify a design mistake by history.
> 
> This is a test tool, so we don't care about the common case.
> A test tool should not try to guess the best configuration.
> Only the user should decide the configuration to apply, and the default
> should be empty, as the API is.
I see the divergence. You think testpmd is a tool, so it should be white paper as the tool users may suppose it is.
I think testpmd is an example to let the APP developers know how to use DPDK. So any pre-configuration is acceptable.
  
Thomas Monjalon Jan. 26, 2018, 8:35 a.m. UTC | #9
26/01/2018 09:06, Lu, Wenzhuo:
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > 26/01/2018 08:30, Lu, Wenzhuo:
> > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > > 25/01/2018 02:11, Lu, Wenzhuo:
> > > > > > --- a/app/test-pmd/testpmd.c
> > > > > > +++ b/app/test-pmd/testpmd.c
> > > > > > @@ -305,9 +305,7 @@ struct fwd_engine * fwd_engines[] = {
> > > > > >   */
> > > > > >  struct rte_eth_rxmode rx_mode = {
> > > > > >  	.max_rx_pkt_len = ETHER_MAX_LEN, /**< Default maximum
> > frame
> > > > > > length. */
> > > > > > -	.offloads = (DEV_RX_OFFLOAD_VLAN_FILTER |
> > > > > > -		     DEV_RX_OFFLOAD_VLAN_STRIP |
> > > > > > -		     DEV_RX_OFFLOAD_CRC_STRIP),
> > > > > > +	.offloads = 0,
> > > > >
> > > > > Change the default behavior may trigger other problems. I think TX
> > > > > offload
> > > > could be a good reference. Get the capability and check what's
> > > > supported first, then ignore the not supported functions with
> > > > printing a warning but not block anything...
> > > >
> > > > I agree that we should check the capabilities before requesting an offload.
> > > > But I disagree on another point: we should not enable an offload if
> > > > the user did not request it explicitly. It makes things unclear.
> > > > This is a testing tool, it should be close to the ethdev API behavior.
> > > >
> > > > Why these offload flags are silently enabled?
> > >
> > > I don't think it's silently. It's a global configuration. In this case, testpmd is
> > the user, it does request it explicitly. If it's not so explicit, maybe we can
> > consider moving all the configuration to a specific configure file.
> > > Talking about why it's enabled by default. Hard to figure out the history.
> > To my opinion, the original designer wants to simulate the common case.
> > 
> > Please do not justify a design mistake by history.
> > 
> > This is a test tool, so we don't care about the common case.
> > A test tool should not try to guess the best configuration.
> > Only the user should decide the configuration to apply, and the default
> > should be empty, as the API is.
> 
> I see the divergence. You think testpmd is a tool, so it should be white paper as the tool users may suppose it is.
> I think testpmd is an example to let the APP developers know how to use DPDK. So any pre-configuration is acceptable.

Ah ah ah :)
No
Examples are in examples/ directory.
  
Shahaf Shuler Jan. 27, 2018, 6:14 p.m. UTC | #10
Friday, January 26, 2018 10:36 AM, Thomas Monjalon:
> 26/01/2018 09:06, Lu, Wenzhuo:
> > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > 26/01/2018 08:30, Lu, Wenzhuo:
> > > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > > > 25/01/2018 02:11, Lu, Wenzhuo:
> > > > > Why these offload flags are silently enabled?
> > > >
> > > > I don't think it's silently. It's a global configuration. In this
> > > > case, testpmd is
> > > the user, it does request it explicitly. If it's not so explicit,
> > > maybe we can consider moving all the configuration to a specific
> configure file.
> > > > Talking about why it's enabled by default. Hard to figure out the history.
> > > To my opinion, the original designer wants to simulate the common case.
> > >
> > > Please do not justify a design mistake by history.
> > >
> > > This is a test tool, so we don't care about the common case.
> > > A test tool should not try to guess the best configuration.
> > > Only the user should decide the configuration to apply, and the
> > > default should be empty, as the API is.
> >
> > I see the divergence. You think testpmd is a tool, so it should be white
> paper as the tool users may suppose it is.
> > I think testpmd is an example to let the APP developers know how to use
> DPDK. So any pre-configuration is acceptable.

If so, then what this patch shows that it is not such a good example to application writers. 
Application should not set offloads that are not supported by the PMD. Pre-configuration is OK, but adjustment is a must according to the PMD caps. 
I think that many PMD have a wrong behavior due to it. They are forced to silently drop un-supported offload configuration (to enable testpmd to run on top of them).
This will end up, for example, in application which expects to have the VLAN tag in the mbuf (because the configuration passed successfully), while in fact it will be always in the packet headers. 

I didn't change it on my series because I wanted to convert the application "as is" from the old to the new offloads API,  however I do think a change is needed here.

 
> 
> Ah ah ah :)
> No
> Examples are in examples/ directory.
  

Patch

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 5dc8cca..a082352 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -305,9 +305,7 @@  struct fwd_engine * fwd_engines[] = {
  */
 struct rte_eth_rxmode rx_mode = {
 	.max_rx_pkt_len = ETHER_MAX_LEN, /**< Default maximum frame length. */
-	.offloads = (DEV_RX_OFFLOAD_VLAN_FILTER |
-		     DEV_RX_OFFLOAD_VLAN_STRIP |
-		     DEV_RX_OFFLOAD_CRC_STRIP),
+	.offloads = 0,
 	.ignore_offload_bitfield = 1,
 };