[v2] app/testpmd: fix protocol headers display for Rx buffer split

Message ID 20221018145012.914586-1-yuanx.wang@intel.com (mailing list archive)
State Changes Requested, archived
Delegated to: Andrew Rybchenko
Headers
Series [v2] app/testpmd: fix protocol headers display for Rx buffer split |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS

Commit Message

Wang, YuanX Oct. 18, 2022, 2:50 p.m. UTC
  The "show config rxhdrs" cmd displays the configured protocol headers
that are used for protocol-based buffer split.
However, it shows "inner-ipv6" as "inner-ipv4".

This patch fixes that by adjusting the order of condition judgments.

Fixes: 52e2e7edcf48 ("app/testpmd: add protocol-based buffer split")

Signed-off-by: Yuan Wang <yuanx.wang@intel.com>
Tested-by: Yaqi Tang <yaqi.tang@intel.com>

---
v2: add fixline.

---
 app/test-pmd/config.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
  

Comments

Wang, YuanX Oct. 28, 2022, 2:04 a.m. UTC | #1
Hi All,

Could you please review and provide suggestions if any.

Thanks,
Yuan

> -----Original Message-----
> From: Wang, YuanX <yuanx.wang@intel.com>
> Sent: Tuesday, October 18, 2022 10:50 PM
> To: andrew.rybchenko@oktetlabs.ru; Singh, Aman Deep
> <aman.deep.singh@intel.com>; Zhang, Yuying <yuying.zhang@intel.com>
> Cc: dev@dpdk.org; Ding, Xuan <xuan.ding@intel.com>; Tang, Yaqi
> <yaqi.tang@intel.com>; Wang, YuanX <yuanx.wang@intel.com>
> Subject: [PATCH v2] app/testpmd: fix protocol headers display for Rx buffer
> split
> 
> The "show config rxhdrs" cmd displays the configured protocol headers that
> are used for protocol-based buffer split.
> However, it shows "inner-ipv6" as "inner-ipv4".
> 
> This patch fixes that by adjusting the order of condition judgments.
> 
> Fixes: 52e2e7edcf48 ("app/testpmd: add protocol-based buffer split")
> 
> Signed-off-by: Yuan Wang <yuanx.wang@intel.com>
> Tested-by: Yaqi Tang <yaqi.tang@intel.com>
> 
> ---
> v2: add fixline.
> 
> ---
>  app/test-pmd/config.c | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index
> 0f7dbd698f..82fbbc9944 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -4937,15 +4937,6 @@ static const char *get_ptype_str(uint32_t ptype)
>  	else if ((ptype & RTE_PTYPE_L2_ETHER) == RTE_PTYPE_L2_ETHER)
>  		return "eth";
> 
> -	else if ((ptype & (RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
> RTE_PTYPE_INNER_L4_TCP)) ==
> -		(RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
> RTE_PTYPE_INNER_L4_TCP))
> -		return "inner-ipv4-tcp";
> -	else if ((ptype & (RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
> RTE_PTYPE_INNER_L4_UDP)) ==
> -		(RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
> RTE_PTYPE_INNER_L4_UDP))
> -		return "inner-ipv4-udp";
> -	else if ((ptype & (RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
> RTE_PTYPE_INNER_L4_SCTP)) ==
> -		(RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
> RTE_PTYPE_INNER_L4_SCTP))
> -		return "inner-ipv4-sctp";
>  	else if ((ptype & (RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
> RTE_PTYPE_INNER_L4_TCP)) ==
>  		(RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
> RTE_PTYPE_INNER_L4_TCP))
>  		return "inner-ipv6-tcp";
> @@ -4955,18 +4946,27 @@ static const char *get_ptype_str(uint32_t ptype)
>  	else if ((ptype & (RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
> RTE_PTYPE_INNER_L4_SCTP)) ==
>  		(RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
> RTE_PTYPE_INNER_L4_SCTP))
>  		return "inner-ipv6-sctp";
> +	else if ((ptype & (RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
> RTE_PTYPE_INNER_L4_TCP)) ==
> +		(RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
> RTE_PTYPE_INNER_L4_TCP))
> +		return "inner-ipv4-tcp";
> +	else if ((ptype & (RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
> RTE_PTYPE_INNER_L4_UDP)) ==
> +		(RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
> RTE_PTYPE_INNER_L4_UDP))
> +		return "inner-ipv4-udp";
> +	else if ((ptype & (RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
> RTE_PTYPE_INNER_L4_SCTP)) ==
> +		(RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
> RTE_PTYPE_INNER_L4_SCTP))
> +		return "inner-ipv4-sctp";
>  	else if ((ptype & RTE_PTYPE_INNER_L4_TCP) ==
> RTE_PTYPE_INNER_L4_TCP)
>  		return "inner-tcp";
>  	else if ((ptype & RTE_PTYPE_INNER_L4_UDP) ==
> RTE_PTYPE_INNER_L4_UDP)
>  		return "inner-udp";
>  	else if ((ptype & RTE_PTYPE_INNER_L4_SCTP) ==
> RTE_PTYPE_INNER_L4_SCTP)
>  		return "inner-sctp";
> +	else if ((ptype & RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN) ==
> +		RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN)
> +		return "inner-ipv6";
>  	else if ((ptype & RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN) ==
>  		RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)
>  		return "inner-ipv4";
> -	else if ((ptype & RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN) ==
> -		RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)
> -		return "inner-ipv6";
>  	else if ((ptype & RTE_PTYPE_INNER_L2_ETHER) ==
> RTE_PTYPE_INNER_L2_ETHER)
>  		return "inner-eth";
>  	else if ((ptype & RTE_PTYPE_TUNNEL_GRENAT) ==
> RTE_PTYPE_TUNNEL_GRENAT)
> --
> 2.25.1
  
Andrew Rybchenko Nov. 6, 2022, 9:58 a.m. UTC | #2
On 10/18/22 17:50, Yuan Wang wrote:
> The "show config rxhdrs" cmd displays the configured protocol headers
> that are used for protocol-based buffer split.
> However, it shows "inner-ipv6" as "inner-ipv4".
> 
> This patch fixes that by adjusting the order of condition judgments.
> 
> Fixes: 52e2e7edcf48 ("app/testpmd: add protocol-based buffer split")
> 
> Signed-off-by: Yuan Wang <yuanx.wang@intel.com>
> Tested-by: Yaqi Tang <yaqi.tang@intel.com>
> 
> ---
> v2: add fixline.
> 
> ---
>   app/test-pmd/config.c | 24 ++++++++++++------------
>   1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index 0f7dbd698f..82fbbc9944 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -4937,15 +4937,6 @@ static const char *get_ptype_str(uint32_t ptype)
>   	else if ((ptype & RTE_PTYPE_L2_ETHER) == RTE_PTYPE_L2_ETHER)
>   		return "eth";
>   
> -	else if ((ptype & (RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_TCP)) ==
> -		(RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_TCP))

I realize that the patch solves the problem, but it is still
wrong. Why are RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN and
RTE_PTYPE_INNER_L4_TCP used as masks instead of
RTE_PTYPE_L3_MASK and RTE_PTYPE_L4_MASK?

It is simply incorrect from the very beginning and all
conditions must be fixed to use appropriate masks instead.
  
Wang, YuanX Nov. 7, 2022, 5:55 a.m. UTC | #3
Hi Andrew,

> -----Original Message-----
> From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Sent: Sunday, November 6, 2022 5:58 PM
> To: Wang, YuanX <yuanx.wang@intel.com>; Singh, Aman Deep
> <aman.deep.singh@intel.com>; Zhang, Yuying <yuying.zhang@intel.com>
> Cc: dev@dpdk.org; Ding, Xuan <xuan.ding@intel.com>; Tang, Yaqi
> <yaqi.tang@intel.com>
> Subject: Re: [PATCH v2] app/testpmd: fix protocol headers display for Rx
> buffer split
> 
> On 10/18/22 17:50, Yuan Wang wrote:
> > The "show config rxhdrs" cmd displays the configured protocol headers
> > that are used for protocol-based buffer split.
> > However, it shows "inner-ipv6" as "inner-ipv4".
> >
> > This patch fixes that by adjusting the order of condition judgments.
> >
> > Fixes: 52e2e7edcf48 ("app/testpmd: add protocol-based buffer split")
> >
> > Signed-off-by: Yuan Wang <yuanx.wang@intel.com>
> > Tested-by: Yaqi Tang <yaqi.tang@intel.com>
> >
> > ---
> > v2: add fixline.
> >
> > ---
> >   app/test-pmd/config.c | 24 ++++++++++++------------
> >   1 file changed, 12 insertions(+), 12 deletions(-)
> >
> > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index
> > 0f7dbd698f..82fbbc9944 100644
> > --- a/app/test-pmd/config.c
> > +++ b/app/test-pmd/config.c
> > @@ -4937,15 +4937,6 @@ static const char *get_ptype_str(uint32_t ptype)
> >   	else if ((ptype & RTE_PTYPE_L2_ETHER) == RTE_PTYPE_L2_ETHER)
> >   		return "eth";
> >
> > -	else if ((ptype & (RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
> RTE_PTYPE_INNER_L4_TCP)) ==
> > -		(RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN |
> RTE_PTYPE_INNER_L4_TCP))
> 
> I realize that the patch solves the problem, but it is still wrong. Why are
> RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN and
> RTE_PTYPE_INNER_L4_TCP used as masks instead of RTE_PTYPE_L3_MASK
> and RTE_PTYPE_L4_MASK?
> 
> It is simply incorrect from the very beginning and all conditions must be fixed
> to use appropriate masks instead.

Thanks for your comments. I will update the patch with the appropriate mask.

Thanks,
Yuan
  

Patch

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 0f7dbd698f..82fbbc9944 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -4937,15 +4937,6 @@  static const char *get_ptype_str(uint32_t ptype)
 	else if ((ptype & RTE_PTYPE_L2_ETHER) == RTE_PTYPE_L2_ETHER)
 		return "eth";
 
-	else if ((ptype & (RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_TCP)) ==
-		(RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_TCP))
-		return "inner-ipv4-tcp";
-	else if ((ptype & (RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_UDP)) ==
-		(RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_UDP))
-		return "inner-ipv4-udp";
-	else if ((ptype & (RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_SCTP)) ==
-		(RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_SCTP))
-		return "inner-ipv4-sctp";
 	else if ((ptype & (RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_TCP)) ==
 		(RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_TCP))
 		return "inner-ipv6-tcp";
@@ -4955,18 +4946,27 @@  static const char *get_ptype_str(uint32_t ptype)
 	else if ((ptype & (RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_SCTP)) ==
 		(RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_SCTP))
 		return "inner-ipv6-sctp";
+	else if ((ptype & (RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_TCP)) ==
+		(RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_TCP))
+		return "inner-ipv4-tcp";
+	else if ((ptype & (RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_UDP)) ==
+		(RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_UDP))
+		return "inner-ipv4-udp";
+	else if ((ptype & (RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_SCTP)) ==
+		(RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_SCTP))
+		return "inner-ipv4-sctp";
 	else if ((ptype & RTE_PTYPE_INNER_L4_TCP) == RTE_PTYPE_INNER_L4_TCP)
 		return "inner-tcp";
 	else if ((ptype & RTE_PTYPE_INNER_L4_UDP) == RTE_PTYPE_INNER_L4_UDP)
 		return "inner-udp";
 	else if ((ptype & RTE_PTYPE_INNER_L4_SCTP) == RTE_PTYPE_INNER_L4_SCTP)
 		return "inner-sctp";
+	else if ((ptype & RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN) ==
+		RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN)
+		return "inner-ipv6";
 	else if ((ptype & RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN) ==
 		RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)
 		return "inner-ipv4";
-	else if ((ptype & RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN) ==
-		RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)
-		return "inner-ipv6";
 	else if ((ptype & RTE_PTYPE_INNER_L2_ETHER) == RTE_PTYPE_INNER_L2_ETHER)
 		return "inner-eth";
 	else if ((ptype & RTE_PTYPE_TUNNEL_GRENAT) == RTE_PTYPE_TUNNEL_GRENAT)