app/testpmd: fix GTP PSC raw processing

Message ID 20220630125055.19719-1-getelson@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Andrew Rybchenko
Headers
Series app/testpmd: fix GTP PSC raw processing |

Checks

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

Commit Message

Etelson, Gregory June 30, 2022, 12:50 p.m. UTC
Fix GTP PSP extension size initialization.
Clear input buffer.

cc: stable@dpdk.org

Fixes: c65282c9aa31 ("app/testpmd: fix GTP PSC raw processing")
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

Singh, Aman Deep July 1, 2022, 1:42 p.m. UTC | #1
Hi Gregory,


On 6/30/2022 6:20 PM, Gregory Etelson wrote:
> Fix GTP PSP extension size initialization.
> Clear input buffer.
>
> cc: stable@dpdk.org
>
> Fixes: c65282c9aa31 ("app/testpmd: fix GTP PSC raw processing")
> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> ---
>   app/test-pmd/cmdline_flow.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index 6cb1173385..7f50028eb7 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -11030,10 +11030,12 @@ cmd_set_raw_parsed(const struct buffer *in)
>   				const struct rte_flow_item_gtp_psc
>   					*opt = item->spec;
>   				struct rte_gtp_psc_generic_hdr *hdr;
> -
> -				*total_size += RTE_ALIGN(sizeof(hdr),
> +				size_t hdr_size = RTE_ALIGN(sizeof(*hdr),
>   							 sizeof(int32_t));

we missed sizeof(*hdr), last time. Ok now.

> +
> +				*total_size += hdr_size;
>   				hdr = (typeof(hdr))(data_tail - (*total_size));
> +				memset(hdr, 0, hdr_size);

Is this memset adding a value here ?

>   				*hdr = opt->hdr;
>   				hdr->ext_hdr_len = 1;
>   				gtp_psc = i;
  
Etelson, Gregory July 1, 2022, 3:23 p.m. UTC | #2
Hello,

> > --- a/app/test-pmd/cmdline_flow.c
> > +++ b/app/test-pmd/cmdline_flow.c
> > @@ -11030,10 +11030,12 @@ cmd_set_raw_parsed(const struct buffer
> *in)
> >                               const struct rte_flow_item_gtp_psc
> >                                       *opt = item->spec;
> >                               struct rte_gtp_psc_generic_hdr *hdr;
> > -
> > -                             *total_size += RTE_ALIGN(sizeof(hdr),
> > +                             size_t hdr_size = RTE_ALIGN(sizeof(*hdr),
> >                                                        sizeof(int32_t));
> 
> we missed sizeof(*hdr), last time. Ok now.
> 
> > +
> > +                             *total_size += hdr_size;
> >                               hdr = (typeof(hdr))(data_tail - (*total_size));
> > +                             memset(hdr, 0, hdr_size);
> 
> Is this memset adding a value here ?
> 

Size of struct rte_gtp_psc_generic_hdr is 3 bytes. In a packet the structure is padded 
with one extra byte for 32bits aligned value. The extra byte content is not covered by 
the GTP_PSC flow item configuration. Application must explicitly put 0 in that byte.
The patch zeros entire 32bits.

> >                               *hdr = opt->hdr;
> >                               hdr->ext_hdr_len = 1;
> >                               gtp_psc = i;
  
Singh, Aman Deep July 4, 2022, 9:08 a.m. UTC | #3
On 6/30/2022 6:20 PM, Gregory Etelson wrote:
> Fix GTP PSP extension size initialization.
> Clear input buffer.
>
> cc: stable@dpdk.org
>
> Fixes: c65282c9aa31 ("app/testpmd: fix GTP PSC raw processing")
> Signed-off-by: Gregory Etelson <getelson@nvidia.com>

Acked-by: Aman Singh<aman.deep.singh@intel.com>

> ---
>
  
Andrew Rybchenko July 6, 2022, 2:28 p.m. UTC | #4
On 7/4/22 12:08, Singh, Aman Deep wrote:
> 
> 
> On 6/30/2022 6:20 PM, Gregory Etelson wrote:
>> Fix GTP PSP extension size initialization.
>> Clear input buffer.
>>
>> cc: stable@dpdk.org
>>
>> Fixes: c65282c9aa31 ("app/testpmd: fix GTP PSC raw processing")

Incorrect order:
Fixes: ...
Cc: ...

>> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> 
> Acked-by: Aman Singh<aman.deep.singh@intel.com>

Missing space before e-mail above.

Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
  

Patch

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 6cb1173385..7f50028eb7 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -11030,10 +11030,12 @@  cmd_set_raw_parsed(const struct buffer *in)
 				const struct rte_flow_item_gtp_psc
 					*opt = item->spec;
 				struct rte_gtp_psc_generic_hdr *hdr;
-
-				*total_size += RTE_ALIGN(sizeof(hdr),
+				size_t hdr_size = RTE_ALIGN(sizeof(*hdr),
 							 sizeof(int32_t));
+
+				*total_size += hdr_size;
 				hdr = (typeof(hdr))(data_tail - (*total_size));
+				memset(hdr, 0, hdr_size);
 				*hdr = opt->hdr;
 				hdr->ext_hdr_len = 1;
 				gtp_psc = i;