DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [RFC 0/5] rte_flow extension for vSwitch acceleration
@ 2017-12-20 21:34 Qi Zhang
  2017-12-20 21:34 ` [dpdk-dev] [RFC 1/5] version: 17.11.0 Qi Zhang
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Qi Zhang @ 2017-12-20 21:34 UTC (permalink / raw)
  To: adrien.mazarguil; +Cc: dev, declan.doherty, Qi Zhang

This patch extend rte_flow API.
The purpose is to provide comfortable programming interface for virtual switch
software (such as OVS) to take advantage of incoming device's vSwitch acceleration
capability when using DPDK as data plane.

Below is summary of changes:

1. Support to specify flow's destination as an ethdev interface.

Add action RTE_FLOW_ACTION_TYPE_ETHDEV_PORT, use port_id as the identification
of the destitation. A typical use case is, with a smart NIC used for vSwitch
acceleration, flow is defined to redirect packet between switch port that is
managed by a Port Representor.
See patch for Port Representor: http://dpdk.org/dev/patchwork/patch/31458/

2. Enhanced flow statistics query.
Enhanced action RTE_FLOW_ACTION_COUNT by adding last hit timestamp tracking which is
the requirement from OVS.

3. Add flow timeout support as the requirement from OVS
Application is able to
a) Setup the time duration of a flow, the flow is expected to be deleted automatically
when timeout.
b) Ping a flow to check if it is active or not.
c) Register a callback function when a flow is deleted due to timeout.

4. Add protocol headers which will be supported by incoming device.

New protocal headers include IPV4 ARP, IPV6 ICMP , IPV6 extent header.

5. Add packet modification actions which will be supported by incoming device.

Add new actions that be used to modify packet content with generic semantic:

RTE_FLOW_ACTION_TYPE_FIELD_UPDATE: update specific field of packet
RTE_FLWO_ACTION_TYPE_FIELD_INCREMENT: increament specific field of packet
RTE_FLWO_ACTION_TYPE_FIELD_DECREMENT: decreament specific field of packet
RTE_FLWO_ACTION_TYPE_FIELD_COPY: copy data from one field to another in packet.

All action use struct rte_flow_item parameter to match the pattern that going
to be modified, if no pattern match, the action just be skipped.
These action are non-terminating action. they will not impact the fate of the
packets, since pattern match is expected to be performed before packet be modified.

Note:
The RFC patch is based on v17.11.
Testpmd command line support is not included. 

Qi Zhang (4):
  ether: add flow action to redirect packet in a switch domain
  ether: add flow last hit query support
  ether: Add flow timeout support
  ether: add packet modification aciton in rte_flow

Thomas Monjalon (1):
  version: 17.11.0

 doc/guides/prog_guide/rte_flow.rst          | 148 +++++++++++++++++++++++++++
 lib/librte_eal/common/include/rte_version.h |   4 +-
 lib/librte_ether/rte_flow.c                 |  38 +++++++
 lib/librte_ether/rte_flow.h                 | 149 +++++++++++++++++++++++++++-
 lib/librte_ether/rte_flow_driver.h          |  12 +++
 pkg/dpdk.spec                               |   2 +-
 6 files changed, 349 insertions(+), 4 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [RFC 1/5] version: 17.11.0
  2017-12-20 21:34 [dpdk-dev] [RFC 0/5] rte_flow extension for vSwitch acceleration Qi Zhang
@ 2017-12-20 21:34 ` Qi Zhang
  2017-12-21  9:07   ` De Lara Guarch, Pablo
  2017-12-20 21:34 ` [dpdk-dev] [RFC 2/5] ether: add flow action to redirect packet in a switch domain Qi Zhang
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: Qi Zhang @ 2017-12-20 21:34 UTC (permalink / raw)
  To: adrien.mazarguil; +Cc: dev, declan.doherty, Thomas Monjalon

From: Thomas Monjalon <thomas@monjalon.net>

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 lib/librte_eal/common/include/rte_version.h | 4 ++--
 pkg/dpdk.spec                               | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_version.h b/lib/librte_eal/common/include/rte_version.h
index fa01807..b176f65 100644
--- a/lib/librte_eal/common/include/rte_version.h
+++ b/lib/librte_eal/common/include/rte_version.h
@@ -71,14 +71,14 @@ extern "C" {
 /**
  * Extra string to be appended to version number
  */
-#define RTE_VER_SUFFIX "-rc"
+#define RTE_VER_SUFFIX ""
 
 /**
  * Patch release number
  *   0-15 = release candidates
  *   16   = release
  */
-#define RTE_VER_RELEASE 4
+#define RTE_VER_RELEASE 16
 
 /**
  * Macro to compute a version number usable for comparisons
diff --git a/pkg/dpdk.spec b/pkg/dpdk.spec
index fd1b5ef..6a41fc7 100644
--- a/pkg/dpdk.spec
+++ b/pkg/dpdk.spec
@@ -30,7 +30,7 @@
 # OF THE POSSIBILITY OF SUCH DAMAGE.
 
 Name: dpdk
-Version: 17.08
+Version: 17.11
 Release: 1
 Packager: packaging@6wind.com
 URL: http://dpdk.org
-- 
2.7.4

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [RFC 2/5] ether: add flow action to redirect packet in a switch domain
  2017-12-20 21:34 [dpdk-dev] [RFC 0/5] rte_flow extension for vSwitch acceleration Qi Zhang
  2017-12-20 21:34 ` [dpdk-dev] [RFC 1/5] version: 17.11.0 Qi Zhang
@ 2017-12-20 21:34 ` Qi Zhang
  2017-12-20 21:34 ` [dpdk-dev] [RFC 3/5] ether: add flow last hit query support Qi Zhang
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Qi Zhang @ 2017-12-20 21:34 UTC (permalink / raw)
  To: adrien.mazarguil; +Cc: dev, declan.doherty, Qi Zhang

Add action RTE_FLOW_ACTION_TYPE_SWITCH_PORT, it can be used to redirect
a packet to a network interface that connect to the same switch domain,
rte_ethdev's port_id is used as an identification of the destination.
A typical use case is: with a smart NIC for vSwitch acceleration, flow
is defined to forward packets between the switch port that is managed by
Port Representor.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 doc/guides/prog_guide/rte_flow.rst | 22 ++++++++++++++++++++++
 lib/librte_ether/rte_flow.h        | 19 ++++++++++++++++++-
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index d158be5..dcea2f6 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1474,6 +1474,28 @@ fields in the pattern items.
    | 1     | END      |
    +-------+----------+
 
+Action: ``PORT``
+^^^^^^^^^^^^^^^^
+
+Redirect packets to an interface that connect to the same switch domain.
+
+The desitnation should be managed by a rte_ethdev instance, port_id is
+the identification of the destination. A typical use case is to define
+a flow that redirect packet to a interface that mananged by a Port
+Representor.
+
+- Terminating by default.
+
+.. _table_rte_flow_action_port:
+
+.. table:: PORT
+
+   +--------------+-----------------------------------+
+   | Field        | Value                             |
+   +==============+===================================+
+   | ``port_id``  | identification of the destination |
+   +--------------+-----------------------------------+
+
 Negative types
 ~~~~~~~~~~~~~~
 
diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h
index 47c88ea..91706e2 100644
--- a/lib/librte_ether/rte_flow.h
+++ b/lib/librte_ether/rte_flow.h
@@ -1008,7 +1008,14 @@ enum rte_flow_action_type {
 	 *
 	 * See struct rte_flow_action_security.
 	 */
-	RTE_FLOW_ACTION_TYPE_SECURITY
+	RTE_FLOW_ACTION_TYPE_SECURITY,
+
+	/**
+	 * Redirect packets to a network interface in the same switch domain.
+	 *
+	 * See struct rte_flow_action_port.
+	 */
+	RTE_FLOW_ACTION_TYPE_PORT,
 };
 
 /**
@@ -1146,6 +1153,16 @@ struct rte_flow_action_security {
 	void *security_session; /**< Pointer to security session structure. */
 };
 
+/** RTE_FLOW_ACTION_TYPE_PORT
+ *
+ * Redirect packets to a network interface in the same switch domain.
+ *
+ * Terminateing by default.
+ */
+struct rte_flow_action_port {
+       uint16_t port_id; /**< identification of the forward destination. */
+};
+
 /**
  * Definition of a single action.
  *
-- 
2.7.4

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [RFC 3/5] ether: add flow last hit query support
  2017-12-20 21:34 [dpdk-dev] [RFC 0/5] rte_flow extension for vSwitch acceleration Qi Zhang
  2017-12-20 21:34 ` [dpdk-dev] [RFC 1/5] version: 17.11.0 Qi Zhang
  2017-12-20 21:34 ` [dpdk-dev] [RFC 2/5] ether: add flow action to redirect packet in a switch domain Qi Zhang
@ 2017-12-20 21:34 ` Qi Zhang
  2017-12-20 21:34 ` [dpdk-dev] [RFC 4/5] ether: Add flow timeout support Qi Zhang
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Qi Zhang @ 2017-12-20 21:34 UTC (permalink / raw)
  To: adrien.mazarguil; +Cc: dev, declan.doherty, Qi Zhang

Enhanced the action RTE_FLOW_TYPE_ACTION_COUNT, number of milliseconds since
last hit can be queried.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 lib/librte_ether/rte_flow.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h
index 91706e2..8e902f0 100644
--- a/lib/librte_ether/rte_flow.h
+++ b/lib/librte_ether/rte_flow.h
@@ -1052,9 +1052,11 @@ struct rte_flow_query_count {
 	uint32_t reset:1; /**< Reset counters after query [in]. */
 	uint32_t hits_set:1; /**< hits field is set [out]. */
 	uint32_t bytes_set:1; /**< bytes field is set [out]. */
+	uint32_t last_hit_set:1; /**< last_hit field is set [out]. */
 	uint32_t reserved:29; /**< Reserved, must be zero [in, out]. */
 	uint64_t hits; /**< Number of hits for this rule [out]. */
 	uint64_t bytes; /**< Number of bytes through this rule [out]. */
+	uint64_t last_hit; /**< Number of milliseconds since last hit [out]. */
 };
 
 /**
-- 
2.7.4

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [RFC 4/5] ether: Add flow timeout support
  2017-12-20 21:34 [dpdk-dev] [RFC 0/5] rte_flow extension for vSwitch acceleration Qi Zhang
                   ` (2 preceding siblings ...)
  2017-12-20 21:34 ` [dpdk-dev] [RFC 3/5] ether: add flow last hit query support Qi Zhang
@ 2017-12-20 21:34 ` Qi Zhang
  2017-12-20 21:34 ` [dpdk-dev] [RFC 5/5] ether: add packet modification aciton in rte_flow Qi Zhang
  2018-01-02  8:12 ` [dpdk-dev] [RFC 0/5] rte_flow extension for vSwitch acceleration Nelio Laranjeiro
  5 siblings, 0 replies; 9+ messages in thread
From: Qi Zhang @ 2017-12-20 21:34 UTC (permalink / raw)
  To: adrien.mazarguil; +Cc: dev, declan.doherty, Qi Zhang

Add new APIs to support flow timeout, application is able to
1. Setup the time duration of a flow, the flow is expected to be deleted
automatically when timeout.
2. Ping a flow to check if it is active or not.
3. Register a callback function when a flow is deleted due to timeout.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 doc/guides/prog_guide/rte_flow.rst | 37 ++++++++++++++++++++++++++++
 lib/librte_ether/rte_flow.c        | 38 +++++++++++++++++++++++++++++
 lib/librte_ether/rte_flow.h        | 49 ++++++++++++++++++++++++++++++++++++++
 lib/librte_ether/rte_flow_driver.h | 12 ++++++++++
 4 files changed, 136 insertions(+)

diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index dcea2f6..1a242fc 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -181,6 +181,14 @@ directions. At least one direction must be specified.
 Specifying both directions at once for a given rule is not recommended but
 may be valid in a few cases (e.g. shared counters).
 
+Attribute: Timeout
+^^^^^^^^^^^^^^^^^^
+
+Two kinds of timeout can be assigned to a flow rule. For "hard timeout", flow
+rule will be deleted when specific time duration  passed since it's creation.
+For "idle timeout", flow rule will be deleted when no packet hit in the given
+time duration.
+
 Pattern item
 ~~~~~~~~~~~~
 
@@ -1695,6 +1703,35 @@ definition.
                   void *data,
                   struct rte_flow_error *error);
 
+Is Active
+~~~~~~~~~
+
+Check if a flow is still active or not.
+
+It is possible a flow is be deleted automatically due to timeout, this function
+help to check if a flow is still exist.
+
+.. code-block:: c
+
+   int
+   rte_flow_is_active(uint8_t port_id,
+                      struct rte_flow *flow,
+                      uint8_t *active,
+                      struct rte_flow_error* error);
+
+Auto Delete Callback Set
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+Register a callback function when flow is automatically deleted due to timeout.
+
+.. code-block:: c
+
+   int
+   rte_flow_auto_delete_callback_set(uint8_t port_id,
+                                     struct rte_flow *flow,
+                                     void (*callback)(struct rte_flow *),
+                                     struct rte_flow_error *error);
+
 Arguments:
 
 - ``port_id``: port identifier of Ethernet device.
diff --git a/lib/librte_ether/rte_flow.c b/lib/librte_ether/rte_flow.c
index 6659063..650c5a5 100644
--- a/lib/librte_ether/rte_flow.c
+++ b/lib/librte_ether/rte_flow.c
@@ -425,3 +425,41 @@ rte_flow_copy(struct rte_flow_desc *desc, size_t len,
 	}
 	return 0;
 }
+
+/** Check if a flow is stiall active or not. */
+int
+rte_flow_is_active(uint8_t port_id,
+		   struct rte_flow* flow,
+		   uint8_t *active,
+		   struct rte_flow_error* error)
+{
+	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error);
+
+	if (unlikely(!ops))
+		return -rte_errno;
+	if (likely(!!ops->is_active))
+		return ops->is_active(dev, flow, active, error);
+	return -rte_flow_error_set(error, ENOSYS,
+				   RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+				   NULL, rte_strerror(ENOSYS));
+}
+
+/** Register a callback function when flow is automatically deleted. */
+int
+rte_flow_auto_delete_callback_set(uint8_t port_id,
+				  struct rte_flow* flow,
+				  void (*callback)(struct rte_flow *),
+				  struct rte_flow_error* error)
+{
+	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error);
+
+	if (unlikely(!ops))
+		return -rte_errno;
+	if (likely(!!ops->auto_delete_callback_set))
+		return ops->auto_delete_callback_set(dev, flow, callback, error);
+	return -rte_flow_error_set(error, ENOSYS,
+				   RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+				   NULL, rte_strerror(ENOSYS));
+}
diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h
index 8e902f0..e09e07f 100644
--- a/lib/librte_ether/rte_flow.h
+++ b/lib/librte_ether/rte_flow.h
@@ -97,6 +97,10 @@ struct rte_flow_attr {
 	uint32_t ingress:1; /**< Rule applies to ingress traffic. */
 	uint32_t egress:1; /**< Rule applies to egress traffic. */
 	uint32_t reserved:30; /**< Reserved, must be zero. */
+	uint32_t hard_timeout;
+	/**< If !0, flow will be deleted after given number of seconds. */
+	uint32_t idle_timeout;
+	/**< If !0, flow will be deleted if no packet hit in given seconds. */
 };
 
 /**
@@ -1491,6 +1495,51 @@ rte_flow_copy(struct rte_flow_desc *fd, size_t len,
 	      const struct rte_flow_item *items,
 	      const struct rte_flow_action *actions);
 
+/**
+ * Check if a flow is still active or not.
+ *
+ * @param port_id
+ *   Port identifier of Ethernet device.
+ * @param flow
+ *   Flow rule to check.
+ * @param[out] active
+ *   0 for not active, 1 for active.
+ * @param[out] error
+ *   Perform verbose error reporting if not NULL. PMDs initialize this
+ *   structure in case of error only.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
+ */
+int
+rte_flow_is_active(uint8_t port_id,
+		   struct rte_flow *flow,
+		   uint8_t *active,
+		   struct rte_flow_error *error);
+
+/**
+ * Register a callback function when flow is automatically deleted
+ * due to timeout
+ *
+ * @param port_id
+ *   Port identifier of Ethernet device.
+ * @param flow
+ *   Flow rule to track.
+ * @param callback
+ *   The callback function.
+ * @param[out] error
+ *   Perform verbose error reporting if not NULL. PMDs initialize this
+ *   structure in case of error only.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
+ */
+int
+rte_flow_auto_delete_callback_set(uint8_t port_id,
+				  struct rte_flow *flow,
+				  void (*callback)(struct rte_flow *),
+				  struct rte_flow_error *error);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/librte_ether/rte_flow_driver.h b/lib/librte_ether/rte_flow_driver.h
index 254d1cb..862d8ab 100644
--- a/lib/librte_ether/rte_flow_driver.h
+++ b/lib/librte_ether/rte_flow_driver.h
@@ -124,6 +124,18 @@ struct rte_flow_ops {
 		(struct rte_eth_dev *,
 		 int,
 		 struct rte_flow_error *);
+	/** See rte_flow_ping(). */
+	int (*is_active)
+		(struct rte_eth_dev *,
+		 struct rte_flow *,
+		 uint8_t *,
+		 struct rte_flow_error *);
+	/** See rte_flow_delete(). */
+	int (*auto_delete_callback_set)
+		(struct rte_eth_dev *,
+		 struct rte_flow *,
+		 void (*)(struct rte_flow *),
+		 struct rte_flow_error *);
 };
 
 /**
-- 
2.7.4

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [RFC 5/5] ether: add packet modification aciton in rte_flow
  2017-12-20 21:34 [dpdk-dev] [RFC 0/5] rte_flow extension for vSwitch acceleration Qi Zhang
                   ` (3 preceding siblings ...)
  2017-12-20 21:34 ` [dpdk-dev] [RFC 4/5] ether: Add flow timeout support Qi Zhang
@ 2017-12-20 21:34 ` Qi Zhang
  2018-01-02  8:12 ` [dpdk-dev] [RFC 0/5] rte_flow extension for vSwitch acceleration Nelio Laranjeiro
  5 siblings, 0 replies; 9+ messages in thread
From: Qi Zhang @ 2017-12-20 21:34 UTC (permalink / raw)
  To: adrien.mazarguil; +Cc: dev, declan.doherty, Qi Zhang

Add new actions that be used to modify packet content with generic semantic:

RTE_FLOW_ACTION_TYPE_FIELD_UPDATE: update specific field of packet
RTE_FLWO_ACTION_TYPE_FIELD_INCREMENT: increament specific field of packet
RTE_FLWO_ACTION_TYPE_FIELD_DECREMENT: decreament specific field of packet
RTE_FLWO_ACTION_TYPE_FIELD_COPY: copy data from one field to another in packet.

All action use struct rte_flow_item parameter to match the pattern that going
to be modified, if no pattern match, the action just be skipped.

These action are non-terminating action. they will not impact the fate of the
packets.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 doc/guides/prog_guide/rte_flow.rst | 89 ++++++++++++++++++++++++++++++++++++++
 lib/librte_ether/rte_flow.h        | 79 +++++++++++++++++++++++++++++++++
 2 files changed, 168 insertions(+)

diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 1a242fc..b706a78 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1504,6 +1504,95 @@ Representor.
    | ``port_id``  | identification of the destination |
    +--------------+-----------------------------------+
 
+Action: ``FILED_UPDATE``
+^^^^^^^^^^^^^^^^^^^^^^^
+
+Update specific field of the packet.
+
+- Non-terminating by default.
+
+.. _table_rte_flow_action_field_update:
+
+.. table:: FIELD_UPDATE
+
+   +-----------+---------------------------------------------------------+
+   | Field     | Value                                                   |
+   +===========+=========================================================+
+   | ``item``  | item->type: specify the pattern to modify               |
+   |           | item->spec: specify the new value to update             |
+   |           | item->mask: specify which part of the pattern to update |
+   |           | item->last: ignored                                     |
+   +-----------+---------------------------------------------------------+
+   | ``layer`` | 0 means outermost matched pattern,                      |
+   |           | 1 means next-to-outermost and so on ...                 |
+   +-----------+---------------------------------------------------------+
+
+Action: ``FILED_INCREMENT``
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Increment 1 on specific field of the packet.
+
+- Non-terminating by default.
+
+.. _table_rte_flow_action_field_increment:
+
+.. table:: FIELD_INCREMENT
+
+   +-----------+---------------------------------------------------------+
+   | Field     | Value                                                   |
+   +===========+=========================================================+
+   | ``item``  | item->type: specify the pattern to modify               |
+   |           | item->spec: ignored                                     |
+   |           | item->mask: specify which part of the pattern to update |
+   |           | item->last: ignored                                     |
+   +-----------+---------------------------------------------------------+
+   | ``layer`` | 0 means outermost matched pattern,                      |
+   |           | 1 means next-to-outermost and so on ...                 |
+   +-----------+---------------------------------------------------------+
+
+Action: ``FIELD_DECREMENT``
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Decrement 1 on specific field of the packet.
+
+Paramenter is same is FIELD_INCREMENT.
+
+-Non-terminating by default.
+
+ACTION: ``FIELD_COPY``
+^^^^^^^^^^^^^^^^^^^^^^
+
+Copy data of one field to another of the packet.
+
+-Non-terminating by default.
+
+.. _table_rte_flow_action_field_increment:
+
+.. table:: FIELD_COPY
+
+   +-----------------+-----------------------------------------------------------------+
+   | Field           | Value                                                           |
+   +=================+=================================================================+
+   | ``src_item``    | src_item->type: match the pattern that data will be copy from   |
+   |                 | src_item->spec: ignored                                         |
+   |                 | src_item->mask: specify which part of the pattern to copy       |
+   |                 | src_item->last: ignored                                         |
+   +-----------------+-----------------------------------------------------------------+
+   | ``src_layer``   | layer of src_item                                               |
+   |                 | 0 means outermost matched pattern,                              |
+   |                 | 1 means next-to-outermost and so on ...                         |
+   +-----------------+-----------------------------------------------------------------+
+   | ``dst_item``    | dst_item->type: match the pattern that data will be copy to     |
+   |                 | dst_item->spec: ignored                                         |
+   |                 | dst_item->mask: specify which part of the pattern to be update  |
+   |                 |                 it must match src_item->mask.                   |
+   |                 | dst_item->last: ignored                                         |
+   +-----------------+-----------------------------------------------------------------+
+   | ``dst_layer``   | layer of dst_item                                               |
+   |                 | 0 means outermost matched pattern,                              |
+   |                 | 1 means next-to-outermost and so on ...                         |
+   +-----------------+-----------------------------------------------------------------+
+
 Negative types
 ~~~~~~~~~~~~~~
 
diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h
index e09e07f..c3796ed 100644
--- a/lib/librte_ether/rte_flow.h
+++ b/lib/librte_ether/rte_flow.h
@@ -1020,6 +1020,34 @@ enum rte_flow_action_type {
 	 * See struct rte_flow_action_port.
 	 */
 	RTE_FLOW_ACTION_TYPE_PORT,
+
+	/**
+	 * Update specific field of the packet.
+	 *
+	 * See struct rte_flow_item_type_field_update.
+	 */
+	RTE_FLOW_ACTION_TYPE_FILED_UPDATE,
+
+	/**
+	 * Increment specific field of the packet.
+	 *
+	 * See struct rte_flow_item_type_field_increment.
+	 */
+	RTE_FLOW_ACTION_TYPE_FIELD_INCREMENT,
+
+	/**
+	 * Decrement specific field of the packet.
+	 *
+	 * See struct rte_flow_item_type_field_decrement.
+	 */
+	RTE_FLOW_ACTION_TYPE_FIELD_DECREMENT,
+
+	/**
+	 * Copy data of one field to another of the packet.
+	 *
+	 * See struct rte_flow_item_type_field_copy.
+	 */
+	RTE_FLOW_ACTION_TYPE_FIELD_COPY,
 };
 
 /**
@@ -1169,6 +1197,57 @@ struct rte_flow_action_port {
        uint16_t port_id; /**< identification of the forward destination. */
 };
 
+/** RTE_FLOW_ACTION_TYPE_FIELD_UPDATE
+ *
+ * Update specific field of the packet.
+ *
+ * Typical usage: update mac/ip address.
+ */
+struct rte_flow_action_field_update {
+	const struct rte_flow_item *item; /**< specify the data to modify. */
+	uint8_t layer;
+	/**< 0 means outermost matched pattern, 1 means next-to-outermost... */
+};
+
+/** RTE_FLOW_ACTION_TYPE_FIELD_INCREMENT
+ *
+ * Increment 1 on specific field of the packet.
+ *
+ * Typical usage: increase TTL
+ */
+struct rte_flow_action_field_increment {
+	const struct rte_flow_item *item; /**< specify the data to modify. */
+	uint8_t layer;
+	/**< 0 means outermost matched pattern, 1 means next-to-outermost... */
+};
+
+/** RTE_FLOW_ACTION_TYPE_FIELD_DECREMENT
+ *
+ * Decrement 1 on specific field of the packet.
+ *
+ * Typical usage: Decrease TTL
+ */
+struct rte_flow_action_field_decrement {
+	const struct rte_flow_item *item; /**< Specify the data to modify. */
+	uint8_t layer;
+	/**< 0 means outermost matched pattern, 1 means next-to-outermost... */
+};
+
+/** RTE_FLOW_ACTION_TYPE_FIELD_COPY
+ *
+ * Copy data from one field to another of the packet.
+ *
+ * Typical usage: TTL copy-in / copy-out
+ */
+struct rte_flow_action_field_copy {
+	const struct rte_flow_item *src_item; /**< Specify the data copy from */
+	uint8_t src_layer;
+	/**< 0 means outermost matched pattern, 1 means next-to-outermost... */
+	const struct rte_flow_item *dst_item; /**< Specify the data copy to */
+	uint8_t dst_layer;
+	/**< 0 means outermost matched pattern, 1 means next-to-outermost... */
+};
+
 /**
  * Definition of a single action.
  *
-- 
2.7.4

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [RFC 1/5] version: 17.11.0
  2017-12-20 21:34 ` [dpdk-dev] [RFC 1/5] version: 17.11.0 Qi Zhang
@ 2017-12-21  9:07   ` De Lara Guarch, Pablo
  2017-12-21  9:13     ` Zhang, Qi Z
  0 siblings, 1 reply; 9+ messages in thread
From: De Lara Guarch, Pablo @ 2017-12-21  9:07 UTC (permalink / raw)
  To: Zhang, Qi Z, adrien.mazarguil; +Cc: dev, Doherty, Declan, Thomas Monjalon

Hi Qi,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Qi Zhang
> Sent: Wednesday, December 20, 2017 9:35 PM
> To: adrien.mazarguil@6wind.com
> Cc: dev@dpdk.org; Doherty, Declan <declan.doherty@intel.com>; Thomas
> Monjalon <thomas@monjalon.net>
> Subject: [dpdk-dev] [RFC 1/5] version: 17.11.0
> 
> From: Thomas Monjalon <thomas@monjalon.net>
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
>  lib/librte_eal/common/include/rte_version.h | 4 ++--
>  pkg/dpdk.spec                               | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)

Your patchset should not change these files.

Regards,
Pablo

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [RFC 1/5] version: 17.11.0
  2017-12-21  9:07   ` De Lara Guarch, Pablo
@ 2017-12-21  9:13     ` Zhang, Qi Z
  0 siblings, 0 replies; 9+ messages in thread
From: Zhang, Qi Z @ 2017-12-21  9:13 UTC (permalink / raw)
  To: De Lara Guarch, Pablo, adrien.mazarguil
  Cc: dev, Doherty, Declan, Thomas Monjalon

Sorry, there is some mistake
Please ignore, I will resend everything as v2

Regards
Qi

> -----Original Message-----
> From: De Lara Guarch, Pablo
> Sent: Thursday, December 21, 2017 5:07 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; adrien.mazarguil@6wind.com
> Cc: dev@dpdk.org; Doherty, Declan <declan.doherty@intel.com>; Thomas
> Monjalon <thomas@monjalon.net>
> Subject: RE: [dpdk-dev] [RFC 1/5] version: 17.11.0
> 
> Hi Qi,
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Qi Zhang
> > Sent: Wednesday, December 20, 2017 9:35 PM
> > To: adrien.mazarguil@6wind.com
> > Cc: dev@dpdk.org; Doherty, Declan <declan.doherty@intel.com>; Thomas
> > Monjalon <thomas@monjalon.net>
> > Subject: [dpdk-dev] [RFC 1/5] version: 17.11.0
> >
> > From: Thomas Monjalon <thomas@monjalon.net>
> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > ---
> >  lib/librte_eal/common/include/rte_version.h | 4 ++--
> >  pkg/dpdk.spec                               | 2 +-
> >  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> Your patchset should not change these files.
> 
> Regards,
> Pablo

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [RFC 0/5] rte_flow extension for vSwitch acceleration
  2017-12-20 21:34 [dpdk-dev] [RFC 0/5] rte_flow extension for vSwitch acceleration Qi Zhang
                   ` (4 preceding siblings ...)
  2017-12-20 21:34 ` [dpdk-dev] [RFC 5/5] ether: add packet modification aciton in rte_flow Qi Zhang
@ 2018-01-02  8:12 ` Nelio Laranjeiro
  5 siblings, 0 replies; 9+ messages in thread
From: Nelio Laranjeiro @ 2018-01-02  8:12 UTC (permalink / raw)
  To: Qi Zhang; +Cc: adrien.mazarguil, dev, declan.doherty

Hi Zhang,

On Wed, Dec 20, 2017 at 04:34:44PM -0500, Qi Zhang wrote:
> This patch extend rte_flow API.
> The purpose is to provide comfortable programming interface for virtual switch
> software (such as OVS) to take advantage of incoming device's vSwitch acceleration
> capability when using DPDK as data plane.
> 
> Below is summary of changes:
> 
> 1. Support to specify flow's destination as an ethdev interface.
> 
> Add action RTE_FLOW_ACTION_TYPE_ETHDEV_PORT, use port_id as the identification
> of the destitation. A typical use case is, with a smart NIC used for vSwitch
> acceleration, flow is defined to redirect packet between switch port that is
> managed by a Port Representor.
> See patch for Port Representor: http://dpdk.org/dev/patchwork/patch/31458/
> 
> 2. Enhanced flow statistics query.
> Enhanced action RTE_FLOW_ACTION_COUNT by adding last hit timestamp tracking which is
> the requirement from OVS.

Seems this introduce a regression for drop flows and for hardware unable
to timestamp packets which are already using the count action.
Why not using the timestamp API in conjunction with the mark id action?

> 3. Add flow timeout support as the requirement from OVS
> Application is able to
> a) Setup the time duration of a flow, the flow is expected to be deleted automatically
> when timeout.
> b) Ping a flow to check if it is active or not.
> c) Register a callback function when a flow is deleted due to timeout.
> 
> 4. Add protocol headers which will be supported by incoming device.
> 
> New protocal headers include IPV4 ARP, IPV6 ICMP , IPV6 extent header.
> 
> 5. Add packet modification actions which will be supported by incoming device.
> 
> Add new actions that be used to modify packet content with generic semantic:
> 
> RTE_FLOW_ACTION_TYPE_FIELD_UPDATE: update specific field of packet
> RTE_FLWO_ACTION_TYPE_FIELD_INCREMENT: increament specific field of packet
> RTE_FLWO_ACTION_TYPE_FIELD_DECREMENT: decreament specific field of packet
> RTE_FLWO_ACTION_TYPE_FIELD_COPY: copy data from one field to another in packet.
> 
> All action use struct rte_flow_item parameter to match the pattern that going
> to be modified, if no pattern match, the action just be skipped.
> These action are non-terminating action. they will not impact the fate of the
> packets, since pattern match is expected to be performed before packet be modified.
> 
> Note:
> The RFC patch is based on v17.11.
> Testpmd command line support is not included. 
> 
> Qi Zhang (4):
>   ether: add flow action to redirect packet in a switch domain
>   ether: add flow last hit query support
>   ether: Add flow timeout support
>   ether: add packet modification aciton in rte_flow
> 
> Thomas Monjalon (1):
>   version: 17.11.0
> 
>  doc/guides/prog_guide/rte_flow.rst          | 148 +++++++++++++++++++++++++++
>  lib/librte_eal/common/include/rte_version.h |   4 +-
>  lib/librte_ether/rte_flow.c                 |  38 +++++++
>  lib/librte_ether/rte_flow.h                 | 149 +++++++++++++++++++++++++++-
>  lib/librte_ether/rte_flow_driver.h          |  12 +++
>  pkg/dpdk.spec                               |   2 +-
>  6 files changed, 349 insertions(+), 4 deletions(-)
> 
> -- 
> 2.7.4
> 

Regards,

-- 
Nélio Laranjeiro
6WIND

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-01-02  8:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-20 21:34 [dpdk-dev] [RFC 0/5] rte_flow extension for vSwitch acceleration Qi Zhang
2017-12-20 21:34 ` [dpdk-dev] [RFC 1/5] version: 17.11.0 Qi Zhang
2017-12-21  9:07   ` De Lara Guarch, Pablo
2017-12-21  9:13     ` Zhang, Qi Z
2017-12-20 21:34 ` [dpdk-dev] [RFC 2/5] ether: add flow action to redirect packet in a switch domain Qi Zhang
2017-12-20 21:34 ` [dpdk-dev] [RFC 3/5] ether: add flow last hit query support Qi Zhang
2017-12-20 21:34 ` [dpdk-dev] [RFC 4/5] ether: Add flow timeout support Qi Zhang
2017-12-20 21:34 ` [dpdk-dev] [RFC 5/5] ether: add packet modification aciton in rte_flow Qi Zhang
2018-01-02  8:12 ` [dpdk-dev] [RFC 0/5] rte_flow extension for vSwitch acceleration Nelio Laranjeiro

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).