From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <hzhan75@shecgisg004.sh.intel.com>
Received: from mga02.intel.com (mga02.intel.com [134.134.136.20])
 by dpdk.org (Postfix) with ESMTP id EAFD08E6F
 for <dev@dpdk.org>; Thu, 24 Sep 2015 09:16:32 +0200 (CEST)
Received: from fmsmga001.fm.intel.com ([10.253.24.23])
 by orsmga101.jf.intel.com with ESMTP; 24 Sep 2015 00:16:33 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.17,579,1437462000"; d="scan'208";a="796225548"
Received: from shvmail01.sh.intel.com ([10.239.29.42])
 by fmsmga001.fm.intel.com with ESMTP; 24 Sep 2015 00:16:31 -0700
Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com
 [10.239.29.89])
 by shvmail01.sh.intel.com with ESMTP id t8O7GSw7020708;
 Thu, 24 Sep 2015 15:16:28 +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
 t8O7GO5Z020822; Thu, 24 Sep 2015 15:16:26 +0800
Received: (from hzhan75@localhost)
 by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t8O7GOex020818;
 Thu, 24 Sep 2015 15:16:24 +0800
From: Helin Zhang <helin.zhang@intel.com>
To: dev@dpdk.org
Date: Thu, 24 Sep 2015 15:16:19 +0800
Message-Id: <1443078979-20774-3-git-send-email-helin.zhang@intel.com>
X-Mailer: git-send-email 1.7.4.1
In-Reply-To: <1443078979-20774-1-git-send-email-helin.zhang@intel.com>
References: <1443078979-20774-1-git-send-email-helin.zhang@intel.com>
Cc: yulong.pei@intel.com
Subject: [dpdk-dev] [PATCH 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 <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 24 Sep 2015 07:16:33 -0000

Test commands are added to support selecting differnt length of
GRE key.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Signed-off-by: Andrey Chilikin <andrey.chilikin@intel.com>
---
 app/test-pmd/cmdline.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 06bc26e..50003c8 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6623,6 +6623,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 <port_id> gre-key-len <number>",
+	.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;
@@ -9122,6 +9173,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,
-- 
1.9.3