[dpdk-dev] testpmd: HW vlan command

Message ID 1423829023-32707-1-git-send-email-changchun.ouyang@intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Ouyang Changchun Feb. 13, 2015, 12:03 p.m. UTC
This patch enables testpmd user can config port hw_vlan with more fine granularity:
hw vlan filter, hw vlan strip, and hw vlan extend.

Don't remove the original command(hw-vlan) considering that some user still want to use
only one command to switch on/off all 3 options.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
 app/test-pmd/cmdline.c    | 36 +++++++++++++++++++++++++++++++++---
 app/test-pmd/parameters.c | 18 ++++++++++++++++++
 2 files changed, 51 insertions(+), 3 deletions(-)
  

Comments

De Lara Guarch, Pablo March 3, 2015, 11:52 p.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ouyang Changchun
> Sent: Friday, February 13, 2015 12:04 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] testpmd: HW vlan command
> 
> This patch enables testpmd user can config port hw_vlan with more fine
> granularity:
> hw vlan filter, hw vlan strip, and hw vlan extend.
> 
> Don't remove the original command(hw-vlan) considering that some user still
> want to use
> only one command to switch on/off all 3 options.
> 
> Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>

Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
  
Thomas Monjalon March 5, 2015, 10:48 a.m. UTC | #2
2015-03-03 23:52, De Lara Guarch, Pablo:
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ouyang Changchun
> > Sent: Friday, February 13, 2015 12:04 PM
> > To: dev@dpdk.org
> > Subject: [dpdk-dev] [PATCH] testpmd: HW vlan command
> > 
> > This patch enables testpmd user can config port hw_vlan with more fine
> > granularity:
> > hw vlan filter, hw vlan strip, and hw vlan extend.
> > 
> > Don't remove the original command(hw-vlan) considering that some user still
> > want to use
> > only one command to switch on/off all 3 options.
> > 
> > Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
> 
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Changchun, Pablo, now the rule should be to take care of documentation
and submit the according update in the same patch (if small) or the
same patchset.
Could you make a v2 please?

Thanks
  
Ouyang Changchun March 6, 2015, 8 a.m. UTC | #3
This patch enables testpmd user can config port hw_vlan with more fine granularity:
hw vlan filter, hw vlan strip, and hw vlan extend;

Update testpmd doc accordingly.

Changchun Ouyang (2):
  testpmd: HW vlan command
  doc: Update for new HW vlan command

 app/test-pmd/cmdline.c                      | 36 ++++++++++++++++++++++++++---
 app/test-pmd/parameters.c                   | 18 +++++++++++++++
 doc/guides/testpmd_app_ug/run_app.rst       | 12 ++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 33 ++++++++++++++++++++++++++
 4 files changed, 96 insertions(+), 3 deletions(-)
  
Ouyang Changchun March 6, 2015, 8:09 a.m. UTC | #4
> -----Original Message-----
> From: Ouyang, Changchun
> Sent: Friday, March 6, 2015 4:00 PM
> To: dev@dpdk.org
> Cc: Butler, Siobhan A; De Lara Guarch, Pablo; Cao, Waterman; Ouyang,
> Changchun
> Subject: [PATCH v2 0/2]
> 
> This patch enables testpmd user can config port hw_vlan with more fine
> granularity:
> hw vlan filter, hw vlan strip, and hw vlan extend;
> 
> Update testpmd doc accordingly.
> 
> Changchun Ouyang (2):
>   testpmd: HW vlan command
>   doc: Update for new HW vlan command
> 
>  app/test-pmd/cmdline.c                      | 36 ++++++++++++++++++++++++++---
>  app/test-pmd/parameters.c                   | 18 +++++++++++++++
>  doc/guides/testpmd_app_ug/run_app.rst       | 12 ++++++++++
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst | 33
> ++++++++++++++++++++++++++
>  4 files changed, 96 insertions(+), 3 deletions(-)
> 
> --
> 1.8.4.2

Self-nack it, due to missing subject.
Will send a v3 patch set.
  
Ouyang Changchun March 6, 2015, 8:10 a.m. UTC | #5
This patch enables testpmd user can config port hw_vlan with more fine granularity:
hw vlan filter, hw vlan strip, and hw vlan extend;

Update testpmd doc accordingly.

Changchun Ouyang (2):
  testpmd: HW vlan command
  doc: Update for new HW vlan command

 app/test-pmd/cmdline.c                      | 36 ++++++++++++++++++++++++++---
 app/test-pmd/parameters.c                   | 18 +++++++++++++++
 doc/guides/testpmd_app_ug/run_app.rst       | 12 ++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 33 ++++++++++++++++++++++++++
 4 files changed, 96 insertions(+), 3 deletions(-)
  
Thomas Monjalon March 9, 2015, 11:23 a.m. UTC | #6
> This patch enables testpmd user can config port hw_vlan with more fine granularity:
> hw vlan filter, hw vlan strip, and hw vlan extend;
> 
> Update testpmd doc accordingly.
> 
> Changchun Ouyang (2):
>   testpmd: HW vlan command
>   doc: Update for new HW vlan command

It may help in validation of this release.
Applied, thanks
  

Patch

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 590e427..99cc307 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -584,7 +584,8 @@  static void cmd_help_long_parsed(void *parsed_result,
 			"port config all max-pkt-len (value)\n"
 			"    Set the max packet length.\n\n"
 
-			"port config all (crc-strip|rx-cksum|hw-vlan|drop-en)"
+			"port config all (crc-strip|rx-cksum|hw-vlan|hw-vlan-filter|"
+			"hw-vlan-strip|hw-vlan-extend|drop-en)"
 			" (on|off)\n"
 			"    Set crc-strip/rx-checksum/hardware-vlan/drop_en"
 			" for ports.\n\n"
@@ -1327,6 +1328,33 @@  cmd_config_rx_mode_flag_parsed(void *parsed_result,
 			printf("Unknown parameter\n");
 			return;
 		}
+	} else if (!strcmp(res->name, "hw-vlan-filter")) {
+		if (!strcmp(res->value, "on"))
+			rx_mode.hw_vlan_filter = 1;
+		else if (!strcmp(res->value, "off"))
+			rx_mode.hw_vlan_filter = 0;
+		else {
+			printf("Unknown parameter\n");
+			return;
+		}
+	} else if (!strcmp(res->name, "hw-vlan-strip")) {
+		if (!strcmp(res->value, "on"))
+			rx_mode.hw_vlan_strip  = 1;
+		else if (!strcmp(res->value, "off"))
+			rx_mode.hw_vlan_strip  = 0;
+		else {
+			printf("Unknown parameter\n");
+			return;
+		}
+	} else if (!strcmp(res->name, "hw-vlan-extend")) {
+		if (!strcmp(res->value, "on"))
+			rx_mode.hw_vlan_extend = 1;
+		else if (!strcmp(res->value, "off"))
+			rx_mode.hw_vlan_extend = 0;
+		else {
+			printf("Unknown parameter\n");
+			return;
+		}
 	} else if (!strcmp(res->name, "drop-en")) {
 		if (!strcmp(res->value, "on"))
 			rx_drop_en = 1;
@@ -1355,7 +1383,8 @@  cmdline_parse_token_string_t cmd_config_rx_mode_flag_all =
 	TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag, all, "all");
 cmdline_parse_token_string_t cmd_config_rx_mode_flag_name =
 	TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag, name,
-					"crc-strip#rx-cksum#hw-vlan");
+					"crc-strip#rx-cksum#hw-vlan#"
+					"hw-vlan-filter#hw-vlan-strip#hw-vlan-extend");
 cmdline_parse_token_string_t cmd_config_rx_mode_flag_value =
 	TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag, value,
 							"on#off");
@@ -1363,7 +1392,8 @@  cmdline_parse_token_string_t cmd_config_rx_mode_flag_value =
 cmdline_parse_inst_t cmd_config_rx_mode_flag = {
 	.f = cmd_config_rx_mode_flag_parsed,
 	.data = NULL,
-	.help_str = "port config all crc-strip|rx-cksum|hw-vlan on|off",
+	.help_str = "port config all crc-strip|rx-cksum|hw-vlan|"
+		"hw-vlan-filter|hw-vlan-strip|hw-vlan-extend on|off",
 	.tokens = {
 		(void *)&cmd_config_rx_mode_flag_port,
 		(void *)&cmd_config_rx_mode_flag_keyword,
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index adf3203..04dc129 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -157,6 +157,9 @@  usage(char* progname)
 	printf("  --crc-strip: enable CRC stripping by hardware.\n");
 	printf("  --enable-rx-cksum: enable rx hardware checksum offload.\n");
 	printf("  --disable-hw-vlan: disable hardware vlan.\n");
+	printf("  --disable-hw-vlan-filter: disable hardware vlan filter.\n");
+	printf("  --disable-hw-vlan-strip: disable hardware vlan strip.\n");
+	printf("  --disable-hw-vlan-extend: disable hardware vlan extend.\n");
 	printf("  --enable-drop-en: enable per queue packet drop.\n");
 	printf("  --disable-rss: disable rss.\n");
 	printf("  --port-topology=N: set port topology (N: paired (default) or "
@@ -528,6 +531,9 @@  launch_args_parse(int argc, char** argv)
 		{ "crc-strip",                  0, 0, 0 },
 		{ "enable-rx-cksum",            0, 0, 0 },
 		{ "disable-hw-vlan",            0, 0, 0 },
+		{ "disable-hw-vlan-filter",     0, 0, 0 },
+		{ "disable-hw-vlan-strip",      0, 0, 0 },
+		{ "disable-hw-vlan-extend",     0, 0, 0 },
 		{ "enable-drop-en",            0, 0, 0 },
 		{ "disable-rss",                0, 0, 0 },
 		{ "port-topology",              1, 0, 0 },
@@ -778,6 +784,18 @@  launch_args_parse(int argc, char** argv)
 				rx_mode.hw_vlan_extend = 0;
 			}
 
+			if (!strcmp(lgopts[opt_idx].name,
+					"disable-hw-vlan-filter"))
+				rx_mode.hw_vlan_filter = 0;
+
+			if (!strcmp(lgopts[opt_idx].name,
+					"disable-hw-vlan-strip"))
+				rx_mode.hw_vlan_strip  = 0;
+
+			if (!strcmp(lgopts[opt_idx].name,
+					"disable-hw-vlan-extend"))
+				rx_mode.hw_vlan_extend = 0;
+
 			if (!strcmp(lgopts[opt_idx].name, "enable-drop-en"))
 				rx_drop_en = 1;