diff mbox series

[v3,1/7] ethdev: add meter color flow matching item

Message ID 20220601034408.2579943-2-akozyrev@nvidia.com (mailing list archive)
State New
Delegated to: Andrew Rybchenko
Headers show
Series ethdev: separate metering and marking from policing | expand

Checks

Context Check Description
ci/iol-testing warning apply patch failure
ci/checkpatch success coding style OK

Commit Message

Alexander Kozyrev June 1, 2022, 3:44 a.m. UTC
Provide an ability to use a Color Marker set by a Meter
as a matching item in Flow API. The Color Marker reflects
the metering result by setting the metadata for a
packet to a particular codepoint: green, yellow or red.

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 doc/guides/prog_guide/rte_flow.rst     |  7 +++++++
 doc/guides/rel_notes/release_22_07.rst |  4 ++++
 lib/ethdev/rte_flow.c                  |  1 +
 lib/ethdev/rte_flow.h                  | 24 ++++++++++++++++++++++++
 4 files changed, 36 insertions(+)

Comments

Ori Kam June 1, 2022, 8:44 a.m. UTC | #1
Hi Alexander,

> -----Original Message-----
> From: Alexander Kozyrev <akozyrev@nvidia.com>
> Sent: Wednesday, June 1, 2022 6:44 AM
> To: dev@dpdk.org
> Subject: [PATCH v3 1/7] ethdev: add meter color flow matching item
> 
> Provide an ability to use a Color Marker set by a Meter
> as a matching item in Flow API. The Color Marker reflects
> the metering result by setting the metadata for a
> packet to a particular codepoint: green, yellow or red.
> 
> Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
> ---
>  doc/guides/prog_guide/rte_flow.rst     |  7 +++++++
>  doc/guides/rel_notes/release_22_07.rst |  4 ++++
>  lib/ethdev/rte_flow.c                  |  1 +
>  lib/ethdev/rte_flow.h                  | 24 ++++++++++++++++++++++++
>  4 files changed, 36 insertions(+)
> 
> diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
> index 588914b231..018def1033 100644
> --- a/doc/guides/prog_guide/rte_flow.rst
> +++ b/doc/guides/prog_guide/rte_flow.rst
> @@ -1651,6 +1651,13 @@ Matches a PPP header.
>  - ``proto_id``: PPP protocol identifier.
>  - Default ``mask`` matches addr, ctrl, proto_id.
> 
> +Item: ``METER_COLOR``
> +^^^^^^^^^^^^^^^^^^^^^
> +
> +Matches Color Marker set by a Meter.
> +
> +- ``color``: Metering color marker.
> +
>  Actions
>  ~~~~~~~
> 
> diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst
> index 0ed4f92820..c1804bc74f 100644
> --- a/doc/guides/rel_notes/release_22_07.rst
> +++ b/doc/guides/rel_notes/release_22_07.rst
> @@ -69,6 +69,10 @@ New Features
>    Added an API which can get the number of in-flight packets in
>    vhost async data path without using lock.
> 
> +* **Extended Metering and Marking support in the Flow API.**
> +
> +  * Added METER_COLOR item to match Color Marker set by a Meter.
> +
>  * **Updated Intel iavf driver.**
> 
>    * Added Tx QoS queue rate limitation support.
> diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
> index 2c35a2f13e..07d7e998c0 100644
> --- a/lib/ethdev/rte_flow.c
> +++ b/lib/ethdev/rte_flow.c
> @@ -161,6 +161,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
>  			rte_flow_item_flex_conv),
>  	MK_FLOW_ITEM(L2TPV2, sizeof(struct rte_flow_item_l2tpv2)),
>  	MK_FLOW_ITEM(PPP, sizeof(struct rte_flow_item_ppp)),
> +	MK_FLOW_ITEM(METER_COLOR, sizeof(struct rte_flow_item_meter_color)),
>  };
> 
>  /** Generate flow_action[] entry. */
> diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
> index d8827dd184..75ec6621ac 100644
> --- a/lib/ethdev/rte_flow.h
> +++ b/lib/ethdev/rte_flow.h
> @@ -671,6 +671,14 @@ enum rte_flow_item_type {
>  	 * See struct rte_flow_item_gre_opt.
>  	 */
>  	RTE_FLOW_ITEM_TYPE_GRE_OPTION,
> +
> +	/**
> +	 * Matches Meter Color Marker.
> +	 *
> +	 * See struct rte_flow_item_meter_color.
> +	 */
> +
> +	RTE_FLOW_ITEM_TYPE_METER_COLOR,
>  };
> 
>  /**
> @@ -2201,6 +2209,22 @@ struct rte_flow_item_flex_conf {
>  	uint32_t nb_outputs;
>  };
> 
> +/**
> + * RTE_FLOW_ITEM_TYPE_METER_COLOR.
> + *
> + * Matches Color Marker set by a Meter.
> + */
> +struct rte_flow_item_meter_color {
> +	enum rte_color color; /**< Meter color marker. */
> +};
> +
> +/** Default mask for RTE_FLOW_ITEM_TYPE_METER_COLOR. */
> +#ifndef __cplusplus
> +static const struct rte_flow_item_meter_color rte_flow_item_meter_color_mask = {
> +	.color = RTE_COLORS,
> +};
> +#endif
> +
>  /**
>   * Action types.
>   *
> --
> 2.18.2

Acked-by: Ori Kam <orika@nvidia.com>
Best,
Ori
Andrew Rybchenko June 9, 2022, 12:18 p.m. UTC | #2
On 6/1/22 06:44, Alexander Kozyrev wrote:
> Provide an ability to use a Color Marker set by a Meter
> as a matching item in Flow API. The Color Marker reflects
> the metering result by setting the metadata for a
> packet to a particular codepoint: green, yellow or red.
> 
> Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>

Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>

One nit below. Please, fix in the next version if required.

[snip]

> diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst
> index 0ed4f92820..c1804bc74f 100644
> --- a/doc/guides/rel_notes/release_22_07.rst
> +++ b/doc/guides/rel_notes/release_22_07.rst
> @@ -69,6 +69,10 @@ New Features
>     Added an API which can get the number of in-flight packets in
>     vhost async data path without using lock.
>   
> +* **Extended Metering and Marking support in the Flow API.**
> +
> +  * Added METER_COLOR item to match Color Marker set by a Meter.
> +

It should be nearby ethdev features.

>   * **Updated Intel iavf driver.**
>   
>     * Added Tx QoS queue rate limitation support.

[snip]
diff mbox series

Patch

diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 588914b231..018def1033 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1651,6 +1651,13 @@  Matches a PPP header.
 - ``proto_id``: PPP protocol identifier.
 - Default ``mask`` matches addr, ctrl, proto_id.
 
+Item: ``METER_COLOR``
+^^^^^^^^^^^^^^^^^^^^^
+
+Matches Color Marker set by a Meter.
+
+- ``color``: Metering color marker.
+
 Actions
 ~~~~~~~
 
diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst
index 0ed4f92820..c1804bc74f 100644
--- a/doc/guides/rel_notes/release_22_07.rst
+++ b/doc/guides/rel_notes/release_22_07.rst
@@ -69,6 +69,10 @@  New Features
   Added an API which can get the number of in-flight packets in
   vhost async data path without using lock.
 
+* **Extended Metering and Marking support in the Flow API.**
+
+  * Added METER_COLOR item to match Color Marker set by a Meter.
+
 * **Updated Intel iavf driver.**
 
   * Added Tx QoS queue rate limitation support.
diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index 2c35a2f13e..07d7e998c0 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -161,6 +161,7 @@  static const struct rte_flow_desc_data rte_flow_desc_item[] = {
 			rte_flow_item_flex_conv),
 	MK_FLOW_ITEM(L2TPV2, sizeof(struct rte_flow_item_l2tpv2)),
 	MK_FLOW_ITEM(PPP, sizeof(struct rte_flow_item_ppp)),
+	MK_FLOW_ITEM(METER_COLOR, sizeof(struct rte_flow_item_meter_color)),
 };
 
 /** Generate flow_action[] entry. */
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index d8827dd184..75ec6621ac 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -671,6 +671,14 @@  enum rte_flow_item_type {
 	 * See struct rte_flow_item_gre_opt.
 	 */
 	RTE_FLOW_ITEM_TYPE_GRE_OPTION,
+
+	/**
+	 * Matches Meter Color Marker.
+	 *
+	 * See struct rte_flow_item_meter_color.
+	 */
+
+	RTE_FLOW_ITEM_TYPE_METER_COLOR,
 };
 
 /**
@@ -2201,6 +2209,22 @@  struct rte_flow_item_flex_conf {
 	uint32_t nb_outputs;
 };
 
+/**
+ * RTE_FLOW_ITEM_TYPE_METER_COLOR.
+ *
+ * Matches Color Marker set by a Meter.
+ */
+struct rte_flow_item_meter_color {
+	enum rte_color color; /**< Meter color marker. */
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_METER_COLOR. */
+#ifndef __cplusplus
+static const struct rte_flow_item_meter_color rte_flow_item_meter_color_mask = {
+	.color = RTE_COLORS,
+};
+#endif
+
 /**
  * Action types.
  *