Skip to contentSkip to conversation

app/testpmd: remove useless check

PATCH Applied Yuan Wang 3 participants 4 messages Oct 12, 2022 – Oct 17, 2022

lore
Share & tools
lore

Yuan Wang

author
#0 lore raw

PATCH 1/1 app/testpmd: remove useless check

Protocol header sequence checking is supported in the ethdev library, the application does not need to do it again.

Coverity issue: 381396

Fixes 52e2e7edcf48 ("app/testpmd: add protocol-based buffer split")
---
 app/test-pmd/cmdline.c    | 6 ++----
 app/test-pmd/parameters.c | 2 +-
 app/test-pmd/testpmd.h    | 2 +-
 3 files changed, 4 insertions(+), 6 deletions(-)
app/test-pmd/cmdline.c +2 -4
index 17be2de402..29e4b2329b 100644
@@ -3440,7 +3440,7 @@ get_ptype(char *value)
 
 unsigned int
 parse_hdrs_list(const char *str, const char *item_name, unsigned int max_items,
-				unsigned int *parsed_items, int check_hdrs_sequence)
+				unsigned int *parsed_items)
 {
 	unsigned int nb_item;
 	char *cur;
@@ -3462,8 +3462,6 @@ parse_hdrs_list(const char *str, const char *item_name, unsigned int max_items,
 		fprintf(stderr, "Number of %s = %u > %u (maximum items)\n",
 			item_name, nb_item + 1, max_items);
 	free(str2);
-	if (!check_hdrs_sequence)
-		return nb_item;
 	return nb_item;
 }
 
@@ -3854,7 +3852,7 @@ cmd_set_rxhdrs_parsed(void *parsed_result,
 
 	res = parsed_result;
 	nb_segs = parse_hdrs_list(res->values, "segment hdrs",
-				  MAX_SEGS_BUFFER_SPLIT, seg_hdrs, 0);
+				  MAX_SEGS_BUFFER_SPLIT, seg_hdrs);
 	if (nb_segs > 0)
 		set_rx_pkt_hdrs(seg_hdrs, nb_segs);
 	cmd_reconfig_device_queue(RTE_PORT_ALL, 0, 1);
app/test-pmd/parameters.c +1 -1
index ff760460ec..5b305c833c 100644
@@ -1272,7 +1272,7 @@ launch_args_parse(int argc, char** argv)
 				nb_segs = parse_hdrs_list
 						(optarg, "rxpkt segments",
 						MAX_SEGS_BUFFER_SPLIT,
-						seg_hdrs, 0);
+						seg_hdrs);
 				if (nb_segs > 0)
 					set_rx_pkt_hdrs(seg_hdrs, nb_segs);
 				else
app/test-pmd/testpmd.h +1 -1
index e65be323b8..0b99339df8 100644
@@ -854,7 +854,7 @@ unsigned int parse_item_list(const char *str, const char *item_name,
 			unsigned int *parsed_items, int check_unique_values);
 unsigned int parse_hdrs_list(const char *str, const char *item_name,
 			unsigned int max_item,
-			unsigned int *parsed_items, int check_unique_values);
+			unsigned int *parsed_items);
 void launch_args_parse(int argc, char** argv);
 void cmd_reconfig_device_queue(portid_t id, uint8_t dev, uint8_t queue);
 void cmdline_read_from_file(const char *filename);
Signature · 1 line
2.25.1
#1 lore raw

Thanks for the patch Yuan.

Quoted 2 lines · Yuan Wang

Protocol header sequence checking is supported in the ethdev library, the application does not need to do it again.

I would like to rephrase the patch title to make it more specific. Like "remove useless check" to "remove unused parameter in rx hdr split" or something like that, to specify the patch.

Quoted 68 lines

Coverity issue: 381396

Fixes 52e2e7edcf48 ("app/testpmd: add protocol-based buffer split")
---
  app/test-pmd/cmdline.c    | 6 ++----
  app/test-pmd/parameters.c | 2 +-
  app/test-pmd/testpmd.h    | 2 +-
  3 files changed, 4 insertions(+), 6 deletions(-)
app/test-pmd/cmdline.c +2 -4
index 17be2de402..29e4b2329b 100644
@@ -3440,7 +3440,7 @@ get_ptype(char *value)
 
  unsigned int
  parse_hdrs_list(const char *str, const char *item_name, unsigned int max_items,
-				unsigned int *parsed_items, int check_hdrs_sequence)
+				unsigned int *parsed_items)
  {
  	unsigned int nb_item;
  	char *cur;
@@ -3462,8 +3462,6 @@ parse_hdrs_list(const char *str, const char *item_name, unsigned int max_items,
  		fprintf(stderr, "Number of %s = %u > %u (maximum items)\n",
  			item_name, nb_item + 1, max_items);
  	free(str2);
-	if (!check_hdrs_sequence)
-		return nb_item;
  	return nb_item;
  }
 
@@ -3854,7 +3852,7 @@ cmd_set_rxhdrs_parsed(void *parsed_result,
 
  	res = parsed_result;
  	nb_segs = parse_hdrs_list(res->values, "segment hdrs",
-				  MAX_SEGS_BUFFER_SPLIT, seg_hdrs, 0);
+				  MAX_SEGS_BUFFER_SPLIT, seg_hdrs);
  	if (nb_segs > 0)
  		set_rx_pkt_hdrs(seg_hdrs, nb_segs);
  	cmd_reconfig_device_queue(RTE_PORT_ALL, 0, 1);
app/test-pmd/parameters.c +1 -1
index ff760460ec..5b305c833c 100644
@@ -1272,7 +1272,7 @@ launch_args_parse(int argc, char** argv)
  				nb_segs = parse_hdrs_list
  						(optarg, "rxpkt segments",
  						MAX_SEGS_BUFFER_SPLIT,
-						seg_hdrs, 0);
+						seg_hdrs);
  				if (nb_segs > 0)
  					set_rx_pkt_hdrs(seg_hdrs, nb_segs);
  				else
app/test-pmd/testpmd.h +1 -1
index e65be323b8..0b99339df8 100644
@@ -854,7 +854,7 @@ unsigned int parse_item_list(const char *str, const char *item_name,
  			unsigned int *parsed_items, int check_unique_values);
  unsigned int parse_hdrs_list(const char *str, const char *item_name,
  			unsigned int max_item,
-			unsigned int *parsed_items, int check_unique_values);
+			unsigned int *parsed_items);
  void launch_args_parse(int argc, char** argv);
  void cmd_reconfig_device_queue(portid_t id, uint8_t dev, uint8_t queue);
  void cmdline_read_from_file(const char *filename);
#2 lore raw

Hi Singh,

Quoted 11 lines

-----Original Message-----
From: Singh, Aman Deep <[email protected]>
Sent: Friday, October 14, 2022 5:37 PM
To: Wang, YuanX <[email protected]>; Zhang, Yuying <[email protected]>
Cc: [email protected]; Ding, Xuan <[email protected]>; Tang, Yaqi <[email protected]>
Subject: Re: [PATCH] app/testpmd: remove useless check

Thanks for the patch Yuan.

Quoted 7 lines
Quoted 2 lines · Yuan Wang

Protocol header sequence checking is supported in the ethdev library, the application does not need to do it again.

I would like to rephrase the patch title to make it more specific. Like "remove useless check" to "remove unused parameter in rx hdr split" or something like that, to specify the patch.

Thank you for the correction, please feel free to fix when merging.

Thanks,
Yuan

Quoted 77 lines
Quoted 17 lines

Coverity issue: 381396

Fixes 52e2e7edcf48 ("app/testpmd: add protocol-based buffer split")
---
  app/test-pmd/cmdline.c    | 6 ++----
  app/test-pmd/parameters.c | 2 +-
  app/test-pmd/testpmd.h    | 2 +-
  3 files changed, 4 insertions(+), 6 deletions(-)
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0 -0

17be2de402..29e4b2329b 100644

app/test-pmd/cmdline.c get_ptype(char *value) · line 3442

Quoted 3 lines
app/test-pmd/cmdline.c +0 -0
@@ -3440,7 +3440,7 @@ get_ptype(char *value)
 
  unsigned int
  parse_hdrs_list(const char *str, const char *item_name, unsigned int

max_items,

app/test-pmd/cmdline.c get_ptype(char *value) · line 3443

Quoted 1 line
app/test-pmd/cmdline.c +0 -1
-				unsigned int *parsed_items, int

check_hdrs_sequence)

app/test-pmd/cmdline.c parse_hdrs_list(const char *str, const char

Quoted 5 lines
app/test-pmd/cmdline.c +1 -0
+				unsigned int *parsed_items)
  {
  	unsigned int nb_item;
  	char *cur;
@@ -3462,8 +3462,6 @@ parse_hdrs_list(const char *str, const char

*item_name, unsigned int max_items,

app/test-pmd/cmdline.c parse_hdrs_list(const char *str, const char · line 3462

Quoted 1 line
app/test-pmd/cmdline.c +0 -0
  		fprintf(stderr, "Number of %s = %u > %u (maximum

items)\n",

app/test-pmd/testpmd.h unsigned int parse_item_list(const char *str, const

Quoted 34 lines
app/test-pmd/cmdline.c +1 -3
  			item_name, nb_item + 1, max_items);
  	free(str2);
-	if (!check_hdrs_sequence)
-		return nb_item;
  	return nb_item;
  }
 
@@ -3854,7 +3852,7 @@ cmd_set_rxhdrs_parsed(void *parsed_result,
 
  	res = parsed_result;
  	nb_segs = parse_hdrs_list(res->values, "segment hdrs",
-				  MAX_SEGS_BUFFER_SPLIT, seg_hdrs, 0);
+				  MAX_SEGS_BUFFER_SPLIT, seg_hdrs);
  	if (nb_segs > 0)
  		set_rx_pkt_hdrs(seg_hdrs, nb_segs);
  	cmd_reconfig_device_queue(RTE_PORT_ALL, 0, 1); diff --git

a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index ff760460ec..5b305c833c 100644

app/test-pmd/parameters.c +1 -1
@@ -1272,7 +1272,7 @@ launch_args_parse(int argc, char** argv)
  				nb_segs = parse_hdrs_list
  						(optarg, "rxpkt segments",
  						MAX_SEGS_BUFFER_SPLIT,
-						seg_hdrs, 0);
+						seg_hdrs);
  				if (nb_segs > 0)
  					set_rx_pkt_hdrs(seg_hdrs, nb_segs);
  				else
app/test-pmd/testpmd.h index renamed from app/test-pmd/testpmd.h +0 -0

e65be323b8..0b99339df8 100644

app/test-pmd/testpmd.h +0 -0
@@ -854,7 +854,7 @@ unsigned int parse_item_list(const char *str, const

char *item_name,

app/test-pmd/testpmd.h unsigned int parse_item_list(const char *str, const · line 854

Quoted 1 line
app/test-pmd/testpmd.h +0 -0
  			unsigned int *parsed_items, int

check_unique_values);

app/test-pmd/testpmd.h unsigned int parse_item_list(const char *str, const char *item_name,

Quoted 3 lines
app/test-pmd/testpmd.h +0 -1
  unsigned int parse_hdrs_list(const char *str, const char *item_name,
  			unsigned int max_item,
-			unsigned int *parsed_items, int

check_unique_values);

app/test-pmd/testpmd.h unsigned int parse_item_list(const char *str, const char *item_name,

Quoted 3 lines
app/test-pmd/testpmd.h +1 -0
+			unsigned int *parsed_items);
  void launch_args_parse(int argc, char** argv);
  void cmd_reconfig_device_queue(portid_t id, uint8_t dev, uint8_t

queue);

Quoted 1 line
app/test-pmd/testpmd.h +0 -0
  void cmdline_read_from_file(const char *filename);
#3 lore raw
Quoted 17 lines · YuanX

Hi Singh,

Quoted 15 lines

-----Original Message-----
From: Singh, Aman Deep <[email protected]>
Sent: Friday, October 14, 2022 5:37 PM
To: Wang, YuanX <[email protected]>; Zhang, Yuying <[email protected]>
Cc: [email protected]; Ding, Xuan <[email protected]>; Tang, Yaqi <[email protected]>
Subject: Re: [PATCH] app/testpmd: remove useless check

Thanks for the patch Yuan.

Quoted 2 lines · Yuan Wang

Protocol header sequence checking is supported in the ethdev library, the application does not need to do it again.

Quoted 8 lines
Quoted 3 lines

I would like to rephrase the patch title to make it more specific. Like "remove useless check" to "remove unused parameter in rx hdr split" or something like that, to specify the patch.

Thank you for the correction, please feel free to fix when merging.

Thanks,
Yuan

Done

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