[dpdk-dev] [PATCH v2 09/12] testpmd: extend commands for fdir's tunnel id input set

Jingjing Wu jingjing.wu at intel.com
Wed Mar 2 12:30:04 CET 2016


This patch extended commands for filter's input set changing.
It added GRE/Vxlan Tunnel as filter's input fields.

Signed-off-by: Jingjing Wu <jingjing.wu at intel.com>
---
 app/test-pmd/cmdline.c                      | 27 +++++++++++++++++++++------
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 22 ++++++++++++++++------
 2 files changed, 37 insertions(+), 12 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 5787f57..9cba2cc 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -643,7 +643,8 @@ static void cmd_help_long_parsed(void *parsed_result,
 			" flow (ipv4-other|ipv4-frag|ipv6-other|ipv6-frag)"
 			" src (src_ip_address) dst (dst_ip_address)"
 			" tos (tos_value) proto (proto_value) ttl (ttl_value)"
-			" vlan (vlan_value) flexbytes (flexbytes_value)"
+			" vlan (vlan_value) (NVGRE|VxLAN|GRE|Notunnel)"
+			" (tunnel_id_value) flexbytes (flexbytes_value)"
 			" (drop|fwd) pf|vf(vf_id) queue (queue_id)"
 			" fd_id (fd_id_value)\n"
 			"    Add/Del an IP type flow director filter.\n\n"
@@ -653,7 +654,8 @@ static void cmd_help_long_parsed(void *parsed_result,
 			" src (src_ip_address) (src_port)"
 			" dst (dst_ip_address) (dst_port)"
 			" tos (tos_value) ttl (ttl_value)"
-			" vlan (vlan_value) flexbytes (flexbytes_value)"
+			" vlan (vlan_value) (NVGRE|VxLAN|GRE|Notunnel)"
+			" (tunnel_id_value) flexbytes (flexbytes_value)"
 			" (drop|fwd) pf|vf(vf_id) queue (queue_id)"
 			" fd_id (fd_id_value)\n"
 			"    Add/Del an UDP/TCP type flow director filter.\n\n"
@@ -665,6 +667,7 @@ static void cmd_help_long_parsed(void *parsed_result,
 			" tag (verification_tag) "
 			" tos (tos_value) ttl (ttl_value)"
 			" vlan (vlan_value)"
+			" (NVGRE|VxLAN|GRE|Notunnel) (tunnel_id_value)"
 			" flexbytes (flexbytes_value) (drop|fwd)"
 			" pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value)\n"
 			"    Add/Del a SCTP type flow director filter.\n\n"
@@ -751,7 +754,8 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"dst-ipv6|ipv4-tos|ipv4-proto|ipv4-ttl|ipv6-tc|"
 			"ipv6-next-header|ipv6-hop-limits|udp-src-port|"
 			"udp-dst-port|tcp-src-port|tcp-dst-port|"
-			"sctp-src-port|sctp-dst-port|sctp-veri-tag|none)"
+			"sctp-src-port|sctp-dst-port|sctp-veri-tag|"
+			"udp-key|gre-key|none)"
 			" (select|add)\n"
 			"    Set the input set for FDir.\n\n"
 		);
@@ -8094,6 +8098,7 @@ str2fdir_tunneltype(char *string)
 	} tunneltype_str[] = {
 		{"NVGRE", RTE_FDIR_TUNNEL_TYPE_NVGRE},
 		{"VxLAN", RTE_FDIR_TUNNEL_TYPE_VXLAN},
+		{"GRE",   RTE_FDIR_TUNNEL_TYPE_GRE},
 	};
 
 	for (i = 0; i < RTE_DIM(tunneltype_str); i++) {
@@ -8265,6 +8270,10 @@ cmd_flow_director_filter_parsed(void *parsed_result,
 		   RTE_ETH_FDIR_MAX_FLEXLEN);
 
 	entry.input.flow_ext.vlan_tci = rte_cpu_to_be_16(res->vlan_value);
+	entry.input.flow.tunnel_flow.tunnel_type =
+		str2fdir_tunneltype(res->tunnel_type);
+	entry.input.flow.tunnel_flow.tunnel_id =
+			rte_cpu_to_be_32(res->tunnel_id_value);
 
 	entry.action.flex_off = 0;  /*use 0 by default */
 	if (!strcmp(res->drop, "drop"))
@@ -8428,7 +8437,7 @@ cmdline_parse_token_string_t cmd_flow_director_tunnel =
 				 tunnel, "tunnel");
 cmdline_parse_token_string_t cmd_flow_director_tunnel_type =
 	TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
-				 tunnel_type, "NVGRE#VxLAN");
+				 tunnel_type, "NVGRE#VxLAN#GRE#Notunnel");
 cmdline_parse_token_string_t cmd_flow_director_tunnel_id =
 	TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
 				 tunnel_id, "tunnel-id");
@@ -8460,6 +8469,8 @@ cmdline_parse_inst_t cmd_add_del_ip_flow_director = {
 		(void *)&cmd_flow_director_ttl_value,
 		(void *)&cmd_flow_director_vlan,
 		(void *)&cmd_flow_director_vlan_value,
+		(void *)&cmd_flow_director_tunnel_type,
+		(void *)&cmd_flow_director_tunnel_id_value,
 		(void *)&cmd_flow_director_flexbytes,
 		(void *)&cmd_flow_director_flexbytes_value,
 		(void *)&cmd_flow_director_drop,
@@ -8496,6 +8507,8 @@ cmdline_parse_inst_t cmd_add_del_udp_flow_director = {
 		(void *)&cmd_flow_director_ttl_value,
 		(void *)&cmd_flow_director_vlan,
 		(void *)&cmd_flow_director_vlan_value,
+		(void *)&cmd_flow_director_tunnel_type,
+		(void *)&cmd_flow_director_tunnel_id_value,
 		(void *)&cmd_flow_director_flexbytes,
 		(void *)&cmd_flow_director_flexbytes_value,
 		(void *)&cmd_flow_director_drop,
@@ -8534,6 +8547,8 @@ cmdline_parse_inst_t cmd_add_del_sctp_flow_director = {
 		(void *)&cmd_flow_director_ttl_value,
 		(void *)&cmd_flow_director_vlan,
 		(void *)&cmd_flow_director_vlan_value,
+		(void *)&cmd_flow_director_tunnel_type,
+		(void *)&cmd_flow_director_tunnel_id_value,
 		(void *)&cmd_flow_director_flexbytes,
 		(void *)&cmd_flow_director_flexbytes_value,
 		(void *)&cmd_flow_director_drop,
@@ -9613,7 +9628,7 @@ cmdline_parse_token_string_t cmd_set_fdir_input_set_field =
 	"ipv4-tos#ipv4-proto#ipv4-ttl#ipv6-tc#ipv6-next-header#"
 	"ipv6-hop-limits#udp-src-port#udp-dst-port#"
 	"tcp-src-port#tcp-dst-port#sctp-src-port#sctp-dst-port#"
-	"sctp-veri-tag#none");
+	"sctp-veri-tag#udp-key#gre-key#none");
 cmdline_parse_token_string_t cmd_set_fdir_input_set_select =
 	TOKEN_STRING_INITIALIZER(struct cmd_set_fdir_input_set_result,
 	select, "select#add");
@@ -9628,7 +9643,7 @@ cmdline_parse_inst_t cmd_set_fdir_input_set = {
 	"ipv4-tos|ipv4-proto|ipv4-ttl|ipv6-tc|ipv6-next-header|"
 	"ipv6-hop-limits|udp-src-port|udp-dst-port|"
 	"tcp-src-port|tcp-dst-port|sctp-src-port|sctp-dst-port|"
-	"sctp-veri-tag|none select|add",
+	"sctp-veri-tag|udp-key|gre-key|none select|add",
 	.tokens = {
 		(void *)&cmd_set_fdir_input_set_cmd,
 		(void *)&cmd_set_fdir_input_set_port_id,
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index f59e63e..417ddde 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -1681,7 +1681,8 @@ Different NICs may have different capabilities, command show port fdir (port_id)
                         flow (ipv4-other|ipv4-frag|ipv6-other|ipv6-frag) \
                         src (src_ip_address) dst (dst_ip_address) \
                         tos (tos_value) proto (proto_value) ttl (ttl_value) \
-                        vlan (vlan_value) flexbytes (flexbytes_value) \
+                        vlan (vlan_value) (NVGRE|VxLAN|GRE|Notunnel) \
+                        (tunnel_id_value) flexbytes (flexbytes_value) \
                         (drop|fwd) pf|vf(vf_id) queue (queue_id) \
                         fd_id (fd_id_value)
 
@@ -1690,7 +1691,8 @@ Different NICs may have different capabilities, command show port fdir (port_id)
                         src (src_ip_address) (src_port) \
                         dst (dst_ip_address) (dst_port) \
                         tos (tos_value) ttl (ttl_value) \
-                        vlan (vlan_value) flexbytes (flexbytes_value) \
+                        vlan (vlan_value) (NVGRE|VxLAN|GRE|Notunnel) \
+                        (tunnel_id_value) flexbytes (flexbytes_value) \
                         (drop|fwd) queue pf|vf(vf_id) (queue_id) \
                         fd_id (fd_id_value)
 
@@ -1700,6 +1702,7 @@ Different NICs may have different capabilities, command show port fdir (port_id)
                         dst (dst_ip_address) (dst_port) \
                         tos (tos_value) ttl (ttl_value) \
                         tag (verification_tag) vlan (vlan_value) \
+                        (NVGRE|VxLAN|GRE|Notunnel) (tunnel_id_value) \
                         flexbytes (flexbytes_value) (drop|fwd) \
                         pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value)
 
@@ -1722,15 +1725,21 @@ Different NICs may have different capabilities, command show port fdir (port_id)
 For example, to add an ipv4-udp flow type filter::
 
    testpmd> flow_director_filter 0 add flow ipv4-udp src 2.2.2.3 32 \
-            dst 2.2.2.5 33 tos 2 ttl 40 vlan 0x1 flexbytes (0x88,0x48) \
-            fwd pf queue 1 fd_id 1
+            dst 2.2.2.5 33  tos 2 ttl 40 vlan 0x1 Notunnel 0 \
+            flexbytes (0x88,0x48) fwd pf queue 1 fd_id 1
 
 For example, add an ipv4-other flow type filter::
 
    testpmd> flow_director_filter 0 add flow ipv4-other src 2.2.2.3 \
-             dst 2.2.2.5 tos 2 proto 20 ttl 40 vlan 0x1 \
+             dst 2.2.2.5  tos 2 proto 20 ttl 40 vlan 0x1 Notunnel 0 \
              flexbytes (0x88,0x48) fwd pf queue 1 fd_id 1
 
+For example, add a ipv4-other flow type filter with GRE key 0x0a0b0c0d:
+
+   testpmd> flow_director_filter 0 add flow ipv4-other src 2.2.2.3 \
+            dst 2.2.2.5 tos 2 proto 20 ttl 40 vlan 0x1 GRE 0x0a0b0c0d \
+            flexbytes (0x88,0x48) fwd pf queue 1 fd_id 1
+
 flush_flow_director
 ~~~~~~~~~~~~~~~~~~~
 
@@ -1861,6 +1870,7 @@ For example, to add source IP to hash input set for flow type of ipv4-udp on por
 set_fdir_input_set
 ~~~~~~~~~~~~~~~~~~
 
+
 The Flow Director filters can match the different fields for different type of packet, i.e. specific input set
 on per flow type and the flexible payload. This command can be used to change input set for each flow type.
 
@@ -1871,7 +1881,7 @@ Set the input set for flow director::
    l2_payload) (ethertype|src-ipv4|dst-ipv4|src-ipv6|dst-ipv6|ipv4-tos| \
    ipv4-proto|ipv4-ttl|ipv6-tc|ipv6-next-header|ipv6-hop-limits| \
    tudp-src-port|udp-dst-port|cp-src-port|tcp-dst-port|sctp-src-port| \
-   sctp-dst-port|sctp-veri-tag|none) (select|add)
+   sctp-dst-port|sctp-veri-tag|udp-key|gre-key|none) (select|add)
 
 For example to add source IP to FD input set for flow type of ipv4-udp on port 0::
 
-- 
2.4.0



More information about the dev mailing list