From patchwork Tue Nov 3 16:28:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Helin" X-Patchwork-Id: 8602 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 7074D8E9B; Tue, 3 Nov 2015 17:29:21 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id AB2018E9B for ; Tue, 3 Nov 2015 17:29:19 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP; 03 Nov 2015 08:28:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,239,1444719600"; d="scan'208";a="593282316" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by FMSMGA003.fm.intel.com with ESMTP; 03 Nov 2015 08:28:46 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id tA3GSjkW017415; Wed, 4 Nov 2015 00:28:45 +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 tA3GSf8b030034; Wed, 4 Nov 2015 00:28:43 +0800 Received: (from hzhan75@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id tA3GSfQt030030; Wed, 4 Nov 2015 00:28:41 +0800 From: Helin Zhang To: dev@dpdk.org Date: Wed, 4 Nov 2015 00:28:36 +0800 Message-Id: <1446568116-29985-3-git-send-email-helin.zhang@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1446568116-29985-1-git-send-email-helin.zhang@intel.com> References: <1446476869-22378-1-git-send-email-helin.zhang@intel.com> <1446568116-29985-1-git-send-email-helin.zhang@intel.com> Subject: [dpdk-dev] [PATCH v6 2/2] app/testpmd: add test commands for selecting different GRE key sizes 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" Test commands are added to support selecting differnt length of GRE key. Signed-off-by: Helin Zhang Signed-off-by: Andrey Chilikin --- app/test-pmd/cmdline.c | 52 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 ++++++ 2 files changed, 63 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 6a384a2..1018379 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -6739,6 +6739,57 @@ cmdline_parse_inst_t cmd_tunnel_udp_config = { }, }; +/* *** GLOBAL CONFIG *** */ +struct cmd_global_config_result { + cmdline_fixed_string_t cmd; + uint8_t port_id; + cmdline_fixed_string_t cfg_type; + uint8_t len; +}; + +static void +cmd_global_config_parsed(void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_global_config_result *res = parsed_result; + struct rte_eth_global_cfg conf; + int ret; + + memset(&conf, 0, sizeof(conf)); + conf.cfg_type = RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN; + conf.cfg.gre_key_len = res->len; + ret = rte_eth_dev_filter_ctrl(res->port_id, RTE_ETH_FILTER_NONE, + RTE_ETH_FILTER_SET, &conf); + if (ret != 0) + printf("Global config error\n"); +} + +cmdline_parse_token_string_t cmd_global_config_cmd = + TOKEN_STRING_INITIALIZER(struct cmd_global_config_result, cmd, + "global_config"); +cmdline_parse_token_num_t cmd_global_config_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_global_config_result, port_id, UINT8); +cmdline_parse_token_string_t cmd_global_config_type = + TOKEN_STRING_INITIALIZER(struct cmd_global_config_result, + cfg_type, "gre-key-len"); +cmdline_parse_token_num_t cmd_global_config_gre_key_len = + TOKEN_NUM_INITIALIZER(struct cmd_global_config_result, + len, UINT8); + +cmdline_parse_inst_t cmd_global_config = { + .f = cmd_global_config_parsed, + .data = (void *)NULL, + .help_str = "global_config gre-key-len ", + .tokens = { + (void *)&cmd_global_config_cmd, + (void *)&cmd_global_config_port_id, + (void *)&cmd_global_config_type, + (void *)&cmd_global_config_gre_key_len, + NULL, + }, +}; + /* *** CONFIGURE VM MIRROR VLAN/POOL RULE *** */ struct cmd_set_mirror_mask_result { cmdline_fixed_string_t set; @@ -9579,6 +9630,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_vf_rate_limit, (cmdline_parse_inst_t *)&cmd_tunnel_filter, (cmdline_parse_inst_t *)&cmd_tunnel_udp_config, + (cmdline_parse_inst_t *)&cmd_global_config, (cmdline_parse_inst_t *)&cmd_set_mirror_mask, (cmdline_parse_inst_t *)&cmd_set_mirror_link, (cmdline_parse_inst_t *)&cmd_reset_mirror_rule, diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 75b0a57..957f889 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -1812,3 +1812,14 @@ Set the input set for Fdir:: For example to add source IP to FD input set for flow type of ipv4 on port 0:: testpmd> set_fdir_input_set 0 ipv4 src-ipv4 add + +global_config +~~~~~~~~~~~~~ + +Set different GRE key length for input set:: + + global_config (port_id) gre-key-len (number in bytes) + +For example to set GRE key length for input set to 4 bytes on port 0:: + + testpmd> global_config 0 gre-key-len 4