From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <declan.doherty@intel.com>
Received: from mga04.intel.com (mga04.intel.com [192.55.52.120])
 by dpdk.org (Postfix) with ESMTP id 1DCB472FB
 for <dev@dpdk.org>; Wed, 18 Apr 2018 23:13:41 +0200 (CEST)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga004.fm.intel.com ([10.253.24.48])
 by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 18 Apr 2018 14:13:41 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.48,466,1517904000"; d="scan'208";a="47271277"
Received: from dwdohert-ws.ir.intel.com ([163.33.210.60])
 by fmsmga004.fm.intel.com with ESMTP; 18 Apr 2018 14:13:38 -0700
From: Declan Doherty <declan.doherty@intel.com>
To: dev@dpdk.org
Cc: Alex Rosenbaum <alexr@mellanox.com>, Ferruh Yigit <ferruh.yigit@intel.com>,
 Thomas Monjalon <thomas@monjalon.net>,
 Shahaf Shuler <shahafs@mellanox.com>, Qi Zhang <qi.z.zhang@intel.com>,
 Alejandro Lucero <alejandro.lucero@netronome.com>,
 Andrew Rybchenko <arybchenko@solarflare.com>,
 Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>,
 Remy Horton <remy.horton@intel.com>,
 John McNamara <john.mcnamara@intel.com>, Rony Efraim <ronye@mellanox.com>,
 Jingjing Wu <jingjing.wu@intel.com>, Wenzhuo Lu <wenzhuo.lu@intel.com>,
 Vincent Jardin <vincent.jardin@6wind.com>,
 Yuanhan Liu <yliu@fridaylinux.org>,
 Bruce Richardson <bruce.richardson@intel.com>,
 Konstantin Ananyev <konstantin.ananyev@intel.com>,
 Zhihong Wang <zhihong.wang@intel.com>,
 Declan Doherty <declan.doherty@intel.com>
Date: Wed, 18 Apr 2018 22:04:22 +0100
Message-Id: <20180418210423.13847-6-declan.doherty@intel.com>
X-Mailer: git-send-email 2.14.3
In-Reply-To: <20180418210423.13847-1-declan.doherty@intel.com>
References: <1523017443-12414-1-git-send-email-declan.doherty@intel.com>
 <20180418210423.13847-1-declan.doherty@intel.com>
Subject: [dpdk-dev] [PATCH v4 5/6] testpmd: add support for MARK flow item
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://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: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 18 Apr 2018 21:13:42 -0000

Add support for specificaiton of new MARK flow item in testpmd's cli,
and update testpmd documentation to describe new MARK flow item support.

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
---
 app/test-pmd/cmdline_flow.c                 | 22 ++++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  4 ++++
 2 files changed, 26 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 93e9a240d..e6284ce11 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -87,6 +87,8 @@ enum index {
 	ITEM_VF_ID,
 	ITEM_PORT,
 	ITEM_PORT_INDEX,
+	ITEM_MARK,
+	ITEM_MARK_ID,
 	ITEM_RAW,
 	ITEM_RAW_RELATIVE,
 	ITEM_RAW_SEARCH,
@@ -419,6 +421,7 @@ static const enum index next_item[] = {
 	ITEM_PF,
 	ITEM_VF,
 	ITEM_PORT,
+	ITEM_MARK,
 	ITEM_RAW,
 	ITEM_ETH,
 	ITEM_VLAN,
@@ -465,6 +468,12 @@ static const enum index item_port[] = {
 	ZERO,
 };
 
+static const enum index item_mark[] = {
+	ITEM_MARK_ID,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index item_raw[] = {
 	ITEM_RAW_RELATIVE,
 	ITEM_RAW_SEARCH,
@@ -1041,6 +1050,19 @@ static const struct token token_list[] = {
 		.next = NEXT(item_port, NEXT_ENTRY(UNSIGNED), item_param),
 		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_port, index)),
 	},
+	[ITEM_MARK] = {
+		.name = "mark",
+		.help = "match packets against value set in previous group",
+		.priv = PRIV_ITEM(MARK, sizeof(struct rte_flow_item_mark)),
+		.next = NEXT(item_mark),
+		.call = parse_vc,
+	},
+	[ITEM_MARK_ID] = {
+		.name = "id",
+		.help = "Integer value to match against",
+		.next = NEXT(item_mark, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_mark, id)),
+	},
 	[ITEM_RAW] = {
 		.name = "raw",
 		.help = "match an arbitrary byte string",
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 7ecd602da..2b5ade4a8 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -3211,6 +3211,10 @@ This section lists supported pattern items and their attributes, if any.
 
   - ``index {unsigned}``: physical port index.
 
+- ``mark``: match value set in previously matched flow in higher priority group.
+
+  - ``id {unsigned}``: arbitrary integer value.
+
 - ``raw``: match an arbitrary byte string.
 
   - ``relative {boolean}``: look for pattern after the previous item.
-- 
2.14.3