Skip to contentSkip to conversation

app/testpmd: fix GTP PSC raw processing

PATCH Superseded Gregory Etelson 3 participants 7 messages Jun 30, 2022 – Jul 7, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/testpmd: fix GTP PSC raw processing

Fix GTP PSP extension size initialization.
Clear input buffer.

Fixes c65282c9aa31 ("app/testpmd: fix GTP PSC raw processing")
---
 app/test-pmd/cmdline_flow.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
app/test-pmd/cmdline_flow.c +4 -2
index 6cb1173385..7f50028eb7 100644
@@ -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;
Signature · 1 line
2.34.1
#1 lore raw

Hi Gregory,

Quoted 16 lines · Gregory Etelson

Fix GTP PSP extension size initialization.
Clear input buffer.

Fixes c65282c9aa31 ("app/testpmd: fix GTP PSC raw processing")
---
  app/test-pmd/cmdline_flow.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
app/test-pmd/cmdline_flow.c +0 -0
index 6cb1173385..7f50028eb7 100644

app/test-pmd/cmdline_flow.c cmd_set_raw_parsed(const struct buffer *in) · line 11034

Quoted 7 lines
app/test-pmd/cmdline_flow.c +1 -2
@@ -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.

app/test-pmd/cmdline_flow.c cmd_set_raw_parsed(const struct buffer *in) · line 11038

Quoted 4 lines
app/test-pmd/cmdline_flow.c +3 -0
+
+				*total_size += hdr_size;
  				hdr = (typeof(hdr))(data_tail - (*total_size));
+				memset(hdr, 0, hdr_size);

Is this memset adding a value here ?

Quoted 3 lines
app/test-pmd/cmdline_flow.c +0 -0
  				*hdr = opt->hdr;
  				hdr->ext_hdr_len = 1;
  				gtp_psc = i;
#2 lore raw

Hello,

Quoted 12 lines

app/test-pmd/cmdline_flow.c cmd_set_raw_parsed(const struct buffer

Quoted 3 lines
app/test-pmd/cmdline_flow.c +0 -0
@@ -11030,10 +11030,12 @@ cmd_set_raw_parsed(const struct buffer

*in)

app/test-pmd/cmdline_flow.c cmd_set_raw_parsed(const struct buffer *in) · line 11034

Quoted 7 lines
app/test-pmd/cmdline_flow.c +1 -2
                              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));
Quoted 9 lines

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

app/test-pmd/cmdline_flow.c cmd_set_raw_parsed(const struct buffer *in) · line 11038

Quoted 4 lines
app/test-pmd/cmdline_flow.c +3 -0
+
+                             *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.

Quoted 3 lines
Quoted 3 lines
app/test-pmd/cmdline_flow.c +0 -0
                              *hdr = opt->hdr;
                              hdr->ext_hdr_len = 1;
                              gtp_psc = i;
Reviewed-by
#4 lore raw
Quoted 9 lines · Aman Deep
Quoted 6 lines · Gregory Etelson

Fix GTP PSP extension size initialization.
Clear input buffer.

Fixes c65282c9aa31 ("app/testpmd: fix GTP PSC raw processing")

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

Quoted 3 lines
Quoted 1 line

Missing space before e-mail above.

#5 lore raw

PATCH v2 1/1 app/testpmd: fix GTP PSC raw processing

In reply to Gregory Etelson

Fix GTP PSP extension size initialization.
Clear input buffer.

Fixes c65282c9aa31 ("app/testpmd: fix GTP PSC raw processing")

---
v2: fix comment tags order.

---
 app/test-pmd/cmdline_flow.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
app/test-pmd/cmdline_flow.c +4 -2
index 6cb1173385..7f50028eb7 100644
@@ -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;
Signature · 1 line
2.34.1