[dpdk-dev] [PATCH 4/5] app/testpmd: add configuration for udp port tunnel type

Rasesh Mody rasesh.mody at cavium.com
Fri Nov 24 21:35:44 CET 2017


From: Shahed Shaikh <shahed.shaikh at cavium.com>

Replace rx_vxlan_port command with rx_tunnel_udp_port to support both VXLAN
and GENEVE udp ports.

Signed-off-by: Shahed Shaikh <shahed.shaikh at cavium.com>
---
 app/test-pmd/cmdline.c |   28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index f71d963..4b5a8cd 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -402,11 +402,11 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"imac-tenid|imac|omac-imac-tenid|oip|iip) (tenant_id) (queue_id)\n"
 			"   remove a tunnel filter of a port.\n\n"
 
-			"rx_vxlan_port add (udp_port) (port_id)\n"
-			"    Add an UDP port for VXLAN packet filter on a port\n\n"
+			"rx_tunnel_udp_port add vxlan|geneve (udp_port) (port_id)\n"
+			"    Add an UDP port for VXLAN/GENEVE packet filter on a port\n\n"
 
-			"rx_vxlan_port rm (udp_port) (port_id)\n"
-			"    Remove an UDP port for VXLAN packet filter on a port\n\n"
+			"rx_tunnel_udp_port rm vxlan|geneve (udp_port) (port_id)\n"
+			"    Remove an UDP port for VXLAN/GENEVE packet filter on a port\n\n"
 
 			"tx_vlan set (port_id) vlan_id[, vlan_id_outer]\n"
 			"    Set hardware insertion of VLAN IDs (single or double VLAN "
@@ -7984,6 +7984,8 @@ struct cmd_tunnel_filter_result {
 		tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_NVGRE;
 	else if (!strcmp(res->tunnel_type, "ipingre"))
 		tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_IP_IN_GRE;
+	else if (!strcmp(res->tunnel_type, "geneve"))
+		tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_GENEVE;
 	else {
 		printf("The tunnel type %s not supported.\n", res->tunnel_type);
 		return;
@@ -8029,7 +8031,7 @@ struct cmd_tunnel_filter_result {
 	ip_value);
 cmdline_parse_token_string_t cmd_tunnel_filter_tunnel_type =
 	TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result,
-	tunnel_type, "vxlan#nvgre#ipingre");
+	tunnel_type, "vxlan#nvgre#ipingre#geneve");
 
 cmdline_parse_token_string_t cmd_tunnel_filter_filter_type =
 	TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result,
@@ -8046,7 +8048,7 @@ struct cmd_tunnel_filter_result {
 	.f = cmd_tunnel_filter_parsed,
 	.data = (void *)0,
 	.help_str = "tunnel_filter add|rm <port_id> <outer_mac> <inner_mac> "
-		"<ip> <inner_vlan> vxlan|nvgre|ipingre oip|iip|imac-ivlan|"
+		"<ip> <inner_vlan> vxlan|nvgre|ipingre|geneve oip|iip|imac-ivlan|"
 		"imac-ivlan-tenid|imac-tenid|imac|omac-imac-tenid <tenant_id> "
 		"<queue_id>: Add/Rm tunnel filter of a port",
 	.tokens = {
@@ -8069,6 +8071,7 @@ struct cmd_tunnel_filter_result {
 struct cmd_tunnel_udp_config {
 	cmdline_fixed_string_t cmd;
 	cmdline_fixed_string_t what;
+	cmdline_fixed_string_t tunnel_type;
 	uint16_t udp_port;
 	portid_t port_id;
 };
@@ -8084,9 +8087,12 @@ struct cmd_tunnel_udp_config {
 
 	tunnel_udp.udp_port = res->udp_port;
 
-	if (!strcmp(res->cmd, "rx_vxlan_port"))
+	if (!strcmp(res->tunnel_type, "vxlan"))
 		tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN;
 
+	if (!strcmp(res->tunnel_type, "geneve"))
+		tunnel_udp.prot_type = RTE_TUNNEL_TYPE_GENEVE;
+
 	if (!strcmp(res->what, "add"))
 		ret = rte_eth_dev_udp_tunnel_port_add(res->port_id,
 						      &tunnel_udp);
@@ -8100,10 +8106,13 @@ struct cmd_tunnel_udp_config {
 
 cmdline_parse_token_string_t cmd_tunnel_udp_config_cmd =
 	TOKEN_STRING_INITIALIZER(struct cmd_tunnel_udp_config,
-				cmd, "rx_vxlan_port");
+				cmd, "rx_tunnel_udp_port");
 cmdline_parse_token_string_t cmd_tunnel_udp_config_what =
 	TOKEN_STRING_INITIALIZER(struct cmd_tunnel_udp_config,
 				what, "add#rm");
+cmdline_parse_token_string_t cmd_tunnel_udp_config_tunnel_type =
+	TOKEN_STRING_INITIALIZER(struct cmd_tunnel_udp_config,
+				tunnel_type, "vxlan#geneve");
 cmdline_parse_token_num_t cmd_tunnel_udp_config_udp_port =
 	TOKEN_NUM_INITIALIZER(struct cmd_tunnel_udp_config,
 				udp_port, UINT16);
@@ -8114,11 +8123,12 @@ struct cmd_tunnel_udp_config {
 cmdline_parse_inst_t cmd_tunnel_udp_config = {
 	.f = cmd_tunnel_udp_config_parsed,
 	.data = (void *)0,
-	.help_str = "rx_vxlan_port add|rm <udp_port> <port_id>: "
+	.help_str = "rx_tunnel_udp_port add|rm vxlan|geneve <udp_port> <port_id>: "
 		"Add/Remove a tunneling UDP port filter",
 	.tokens = {
 		(void *)&cmd_tunnel_udp_config_cmd,
 		(void *)&cmd_tunnel_udp_config_what,
+		(void *)&cmd_tunnel_udp_config_tunnel_type,
 		(void *)&cmd_tunnel_udp_config_udp_port,
 		(void *)&cmd_tunnel_udp_config_port_id,
 		NULL,
-- 
1.7.10.3



More information about the dev mailing list