DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/testpmd: add option to configure udp tunnel port
@ 2018-04-22 20:59 Rasesh Mody
  2018-04-25  9:52 ` Ferruh Yigit
  0 siblings, 1 reply; 3+ messages in thread
From: Rasesh Mody @ 2018-04-22 20:59 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: Shahed Shaikh, dev, Dept-EngDPDKDev, Rasesh Mody

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

This change adds a new option to "port config" command to
add udp tunnel port for VXLAN and GENEVE tunneling protocols.
This command can be extended for other tunneling protocols
listed in "enum rte_eth_tunnel_type" as and when needed.

usage:
port config <port_id> udp_tunnel_port add|rm vxlan|geneve <udp_port>

Signed-off-by: Shahed Shaikh <shahed.shaikh@cavium.com>
Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
---
 app/test-pmd/cmdline.c                      |   87 +++++++++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |    6 ++
 2 files changed, 93 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index d9b1435..fb2a42f 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -873,6 +873,9 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"port config (port_id) pctype (pctype_id) hash_inset|"
 			"fdir_inset|fdir_flx_inset clear all"
 			"    Clear RSS|FDIR|FDIR_FLX input set completely for some pctype\n\n"
+
+			"port config (port_id) udp_tunnel_port add|rm vxlan|geneve (udp_port)\n\n"
+			"    Add/remove UDP tunnel port for tunneling offload\n\n"
 		);
 	}
 
@@ -8413,6 +8416,89 @@ struct cmd_tunnel_udp_config {
 	},
 };
 
+struct cmd_config_tunnel_udp_port {
+	cmdline_fixed_string_t port;
+	cmdline_fixed_string_t config;
+	portid_t port_id;
+	cmdline_fixed_string_t udp_tunnel_port;
+	cmdline_fixed_string_t action;
+	cmdline_fixed_string_t tunnel_type;
+	uint16_t udp_port;
+};
+
+static void
+cmd_cfg_tunnel_udp_port_parsed(void *parsed_result,
+			       __attribute__((unused)) struct cmdline *cl,
+			       __attribute__((unused)) void *data)
+{
+	struct cmd_config_tunnel_udp_port *res = parsed_result;
+	struct rte_eth_udp_tunnel tunnel_udp;
+	int ret = 0;
+
+	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+		return;
+
+	tunnel_udp.udp_port = res->udp_port;
+
+	if (!strcmp(res->tunnel_type, "vxlan")) {
+		tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN;
+	} else if (!strcmp(res->tunnel_type, "geneve")) {
+		tunnel_udp.prot_type = RTE_TUNNEL_TYPE_GENEVE;
+	} else {
+		printf("Invalid tunnel type\n");
+		return;
+	}
+
+	if (!strcmp(res->action, "add"))
+		ret = rte_eth_dev_udp_tunnel_port_add(res->port_id,
+						      &tunnel_udp);
+	else
+		ret = rte_eth_dev_udp_tunnel_port_delete(res->port_id,
+							 &tunnel_udp);
+
+	if (ret < 0)
+		printf("udp tunneling port add error: (%s)\n", strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_config_tunnel_udp_port_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_config_tunnel_udp_port, port,
+				 "port");
+cmdline_parse_token_string_t cmd_config_tunnel_udp_port_config =
+	TOKEN_STRING_INITIALIZER(struct cmd_config_tunnel_udp_port, config,
+				 "config");
+cmdline_parse_token_num_t cmd_config_tunnel_udp_port_port_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_config_tunnel_udp_port, port_id,
+			      UINT16);
+cmdline_parse_token_string_t cmd_config_tunnel_udp_port_tunnel_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_config_tunnel_udp_port,
+				 udp_tunnel_port,
+				 "udp_tunnel_port");
+cmdline_parse_token_string_t cmd_config_tunnel_udp_port_action =
+	TOKEN_STRING_INITIALIZER(struct cmd_config_tunnel_udp_port, action,
+				 "add#rm");
+cmdline_parse_token_string_t cmd_config_tunnel_udp_port_tunnel_type =
+	TOKEN_STRING_INITIALIZER(struct cmd_config_tunnel_udp_port, tunnel_type,
+				 "vxlan#geneve");
+cmdline_parse_token_num_t cmd_config_tunnel_udp_port_value =
+	TOKEN_NUM_INITIALIZER(struct cmd_config_tunnel_udp_port, udp_port,
+			      UINT16);
+
+cmdline_parse_inst_t cmd_cfg_tunnel_udp_port = {
+	.f = cmd_cfg_tunnel_udp_port_parsed,
+	.data = NULL,
+	.help_str = "port config <port_id> udp_tunnel_port add|rm vxlan|geneve <udp_port>",
+	.tokens = {
+		(void *)&cmd_config_tunnel_udp_port_port,
+		(void *)&cmd_config_tunnel_udp_port_config,
+		(void *)&cmd_config_tunnel_udp_port_port_id,
+		(void *)&cmd_config_tunnel_udp_port_tunnel_port,
+		(void *)&cmd_config_tunnel_udp_port_action,
+		(void *)&cmd_config_tunnel_udp_port_tunnel_type,
+		(void *)&cmd_config_tunnel_udp_port_value,
+		NULL,
+	},
+};
+
 /* *** GLOBAL CONFIG *** */
 struct cmd_global_config_result {
 	cmdline_fixed_string_t cmd;
@@ -16369,6 +16455,7 @@ struct cmd_cmdfile_result {
 	(cmdline_parse_inst_t *)&cmd_del_port_tm_node,
 	(cmdline_parse_inst_t *)&cmd_set_port_tm_node_parent,
 	(cmdline_parse_inst_t *)&cmd_port_tm_hierarchy_commit,
+	(cmdline_parse_inst_t *)&cmd_cfg_tunnel_udp_port,
 	NULL,
 };
 
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index cb6f201..6e84f7a 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -1856,6 +1856,12 @@ where:
 * ``pctype_id``: hardware packet classification types.
 * ``field_idx``: hardware field index.
 
+port config udp_tunnel_port
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Add/remove UDP tunnel port for VXLAN/GENEVE tunneling protocols::
+    testpmd> port config (port_id) udp_tunnel_port add|rm vxlan|geneve (udp_port)
+
 Link Bonding Functions
 ----------------------
 
-- 
1.7.10.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] app/testpmd: add option to configure udp tunnel port
  2018-04-22 20:59 [dpdk-dev] [PATCH] app/testpmd: add option to configure udp tunnel port Rasesh Mody
@ 2018-04-25  9:52 ` Ferruh Yigit
  2018-04-25  9:53   ` Ferruh Yigit
  0 siblings, 1 reply; 3+ messages in thread
From: Ferruh Yigit @ 2018-04-25  9:52 UTC (permalink / raw)
  To: Rasesh Mody, wenzhuo.lu; +Cc: Shahed Shaikh, dev, Dept-EngDPDKDev

On 4/22/2018 9:59 PM, Rasesh Mody wrote:
> From: Shahed Shaikh <shahed.shaikh@cavium.com>
> 
> This change adds a new option to "port config" command to
> add udp tunnel port for VXLAN and GENEVE tunneling protocols.
> This command can be extended for other tunneling protocols
> listed in "enum rte_eth_tunnel_type" as and when needed.
> 
> usage:
> port config <port_id> udp_tunnel_port add|rm vxlan|geneve <udp_port>
> 
> Signed-off-by: Shahed Shaikh <shahed.shaikh@cavium.com>
> Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] app/testpmd: add option to configure udp tunnel port
  2018-04-25  9:52 ` Ferruh Yigit
@ 2018-04-25  9:53   ` Ferruh Yigit
  0 siblings, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2018-04-25  9:53 UTC (permalink / raw)
  To: Rasesh Mody, wenzhuo.lu; +Cc: Shahed Shaikh, dev, Dept-EngDPDKDev

On 4/25/2018 10:52 AM, Ferruh Yigit wrote:
> On 4/22/2018 9:59 PM, Rasesh Mody wrote:
>> From: Shahed Shaikh <shahed.shaikh@cavium.com>
>>
>> This change adds a new option to "port config" command to
>> add udp tunnel port for VXLAN and GENEVE tunneling protocols.
>> This command can be extended for other tunneling protocols
>> listed in "enum rte_eth_tunnel_type" as and when needed.
>>
>> usage:
>> port config <port_id> udp_tunnel_port add|rm vxlan|geneve <udp_port>
>>
>> Signed-off-by: Shahed Shaikh <shahed.shaikh@cavium.com>
>> Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
> 
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-04-25  9:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-22 20:59 [dpdk-dev] [PATCH] app/testpmd: add option to configure udp tunnel port Rasesh Mody
2018-04-25  9:52 ` Ferruh Yigit
2018-04-25  9:53   ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).