DPDK patches and discussions
 help / color / mirror / Atom feed
From: Declan Doherty <declan.doherty@intel.com>
To: dev@dpdk.org
Cc: Ferruh Yigit <ferruh.yigit@intel.com>,
	Declan Doherty <declan.doherty@intel.com>
Subject: [dpdk-dev] [PATCH v7 3/4] ethdev: add mark flow item to rte_flow_item_types
Date: Thu, 26 Apr 2018 18:29:18 +0100	[thread overview]
Message-ID: <20180426172919.8450-4-declan.doherty@intel.com> (raw)
In-Reply-To: <20180426172919.8450-1-declan.doherty@intel.com>

Introduces a new action type RTE_FLOW_ITEM_TYPE_MARK which enables
flow patterns to specify arbitrary integer values to match aginst
set by the RTE_FLOW_ACTION_TYPE_MARK action in previously matched
flows.

Add support for specification of new MARK flow item in testpmd's cli.
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/prog_guide/rte_flow.rst          | 30 +++++++++++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  4 ++++
 lib/librte_ether/rte_flow.h                 | 29 ++++++++++++++++++++++++++++
 4 files changed, 85 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 6e9fa5d7c..1ac04a0ab 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -91,6 +91,8 @@ enum index {
 	ITEM_PHY_PORT_INDEX,
 	ITEM_PORT_ID,
 	ITEM_PORT_ID_ID,
+	ITEM_MARK,
+	ITEM_MARK_ID,
 	ITEM_RAW,
 	ITEM_RAW_RELATIVE,
 	ITEM_RAW_SEARCH,
@@ -494,6 +496,7 @@ static const enum index next_item[] = {
 	ITEM_VF,
 	ITEM_PHY_PORT,
 	ITEM_PORT_ID,
+	ITEM_MARK,
 	ITEM_RAW,
 	ITEM_ETH,
 	ITEM_VLAN,
@@ -555,6 +558,12 @@ static const enum index item_port_id[] = {
 	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,
@@ -1289,6 +1298,19 @@ static const struct token token_list[] = {
 		.next = NEXT(item_port_id, NEXT_ENTRY(UNSIGNED), item_param),
 		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_port_id, id)),
 	},
+	[ITEM_MARK] = {
+		.name = "mark",
+		.help = "match traffic against value set in previously matched rule",
+		.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/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 92e0f89ad..5b23778c7 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -656,6 +656,36 @@ representor" depending on the kind of underlying device).
    | ``mask`` | ``id``   | zeroed to match any port ID |
    +----------+----------+-----------------------------+
 
+Item: ``MARK``
+^^^^^^^^^^^^^^
+
+Matches an arbitrary integer value which was set using the ``MARK`` action in
+a previously matched rule.
+
+This item can only specified once as a match criteria as the ``MARK`` action can
+only be specified once in a flow action.
+
+Note the value of MARK field is arbitrary and application defined.
+
+Depending on the underlying implementation the MARK item may be supported on
+the physical device, with virtual groups in the PMD or not at all.
+
+- Default ``mask`` matches any integer value.
+
+.. _table_rte_flow_item_mark:
+
+.. table:: MARK
+
+   +----------+----------+---------------------------+
+   | Field    | Subfield | Value                     |
+   +==========+==========+===========================+
+   | ``spec`` | ``id``   | integer value             |
+   +----------+--------------------------------------+
+   | ``last`` | ``id``   | upper range value         |
+   +----------+----------+---------------------------+
+   | ``mask`` | ``id``   | zeroed to match any value |
+   +----------+----------+---------------------------+
+
 Data matching item types
 ~~~~~~~~~~~~~~~~~~~~~~~~
 
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 260d044d5..013a40549 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -3240,6 +3240,10 @@ This section lists supported pattern items and their attributes, if any.
 
   - ``id {unsigned}``: DPDK port ID.
 
+- ``mark``: match value set in previously matched flow rule using the mark action.
+
+  - ``id {unsigned}``: arbitrary integer value.
+
 - ``raw``: match an arbitrary byte string.
 
   - ``relative {boolean}``: look for pattern after the previous item.
diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h
index 17c1c4a89..d390bbf5a 100644
--- a/lib/librte_ether/rte_flow.h
+++ b/lib/librte_ether/rte_flow.h
@@ -406,6 +406,13 @@ enum rte_flow_item_type {
 	 * See struct rte_flow_item_icmp6_nd_opt_tla_eth.
 	 */
 	RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH,
+
+	/**
+	 * Matches specified mark field.
+	 *
+	 * See struct rte_flow_item_mark.
+	 */
+	RTE_FLOW_ITEM_TYPE_MARK,
 };
 
 /**
@@ -1148,6 +1155,28 @@ rte_flow_item_icmp6_nd_opt_tla_eth_mask = {
 };
 #endif
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * RTE_FLOW_ITEM_TYPE_MARK
+ *
+ * Matches an arbitrary integer value which was set using the ``MARK`` action
+ * in a previously matched rule.
+ *
+ * This item can only be specified once as a match criteria as the ``MARK``
+ * action can only be specified once in a flow action.
+ *
+ * This value is arbitrary and application-defined. Maximum allowed value
+ * depends on the underlying implementation.
+ *
+ * Depending on the underlying implementation the MARK item may be supported on
+ * the physical device, with virtual groups in the PMD or not at all.
+ */
+struct rte_flow_item_mark {
+	uint32_t id; /**< Integer value to match against. */
+};
+
 /**
  * Matching pattern item definition.
  *
-- 
2.14.3

  parent reply	other threads:[~2018-04-26 17:37 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-26 12:08 [dpdk-dev] [PATCH v6 0/4] additions to support tunnel encap/decap Declan Doherty
2018-04-26 12:08 ` [dpdk-dev] [PATCH v6 1/4] ethdev: Add tunnel encap/decap actions Declan Doherty
2018-04-26 12:08 ` [dpdk-dev] [PATCH v6 2/4] ethdev: Add group JUMP action Declan Doherty
2018-04-26 12:08 ` [dpdk-dev] [PATCH v6 3/4] ethdev: add mark flow item to rte_flow_item_types Declan Doherty
2018-04-26 12:08 ` [dpdk-dev] [PATCH v6 4/4] ethdev: add shared counter support to rte_flow Declan Doherty
2018-04-26 14:06   ` Ori Kam
2018-04-26 14:27     ` Ferruh Yigit
2018-04-26 14:43       ` Ori Kam
2018-04-26 14:48         ` Doherty, Declan
2018-04-26 17:29 ` [dpdk-dev] [PATCH v7 0/4] " Declan Doherty
2018-04-26 17:29   ` [dpdk-dev] [PATCH v7 1/4] ethdev: Add tunnel encap/decap actions Declan Doherty
2018-04-26 17:29   ` [dpdk-dev] [PATCH v7 2/4] ethdev: Add group JUMP action Declan Doherty
2018-04-26 18:54     ` Thomas Monjalon
2018-04-27 12:24       ` Ferruh Yigit
2018-04-26 17:29   ` Declan Doherty [this message]
2018-04-26 18:52     ` [dpdk-dev] [PATCH v7 3/4] ethdev: add mark flow item to rte_flow_item_types Thomas Monjalon
2018-04-27 12:24       ` Ferruh Yigit
2018-04-26 17:29   ` [dpdk-dev] [PATCH v7 4/4] ethdev: add shared counter support to rte_flow Declan Doherty
2018-04-26 18:55     ` Thomas Monjalon
2018-04-27 12:25       ` Ferruh Yigit
2018-04-27 14:52         ` Ferruh Yigit
2018-04-26 20:58   ` [dpdk-dev] [PATCH v7 0/4] " Ferruh Yigit
2018-04-27 20:18 ` [dpdk-dev] [PATCH v6 0/4] additions to support tunnel encap/decap Michael Wildt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180426172919.8450-4-declan.doherty@intel.com \
    --to=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).