From patchwork Wed Mar 9 05:42:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingjing Wu X-Patchwork-Id: 11239 X-Patchwork-Delegate: bruce.richardson@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 24C154CE4; Wed, 9 Mar 2016 06:43:31 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 0E3A44A63 for ; Wed, 9 Mar 2016 06:43:26 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP; 08 Mar 2016 21:43:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,310,1455004800"; d="scan'208";a="905676342" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga001.jf.intel.com with ESMTP; 08 Mar 2016 21:43:26 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id u295hNc0032417; Wed, 9 Mar 2016 13:43:23 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id u295hKHP014221; Wed, 9 Mar 2016 13:43:22 +0800 Received: (from wujingji@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id u295hK7D014217; Wed, 9 Mar 2016 13:43:20 +0800 From: Jingjing Wu To: bruce.richardson@intel.com Date: Wed, 9 Mar 2016 13:42:57 +0800 Message-Id: <1457502180-14124-10-git-send-email-jingjing.wu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1457502180-14124-1-git-send-email-jingjing.wu@intel.com> References: <1456918207-31696-1-git-send-email-jingjing.wu@intel.com> <1457502180-14124-1-git-send-email-jingjing.wu@intel.com> Cc: dev@dpdk.org Subject: [dpdk-dev] [PATCH v3 09/12] testpmd: extend flow director commands X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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::