Hi Alexander,
> -----Original Message----- > From: Alexander Kozyrev <akozy...@nvidia.com> > Sent: Sunday, May 22, 2022 1:51 PM > Subject: [PATCH v2 4/4] ethdev: add meter color mark flow action > > Create a new Flow API action: METER_MARK. > It Meters an IP packet stream and marks its packets with colors. > Unlike the METER action, it performs no policing at all. > A user has the flexibility to create any policies with the help of > the METER_COLOR item later, only meter profile is required here. I think required should be mandatory. > > Signed-off-by: Alexander Kozyrev <akozy...@nvidia.com> > --- > doc/guides/prog_guide/rte_flow.rst | 25 +++++++++++++++++++++++ > doc/guides/rel_notes/release_22_07.rst | 1 + > lib/ethdev/rte_flow.h | 28 ++++++++++++++++++++++++++ > 3 files changed, 54 insertions(+) > > diff --git a/doc/guides/prog_guide/rte_flow.rst > b/doc/guides/prog_guide/rte_flow.rst > index 018def1033..90f0ebc9bc 100644 > --- a/doc/guides/prog_guide/rte_flow.rst > +++ b/doc/guides/prog_guide/rte_flow.rst > @@ -3411,6 +3411,31 @@ This action is meant to use the same structure as > `Action: > PORT_REPRESENTOR`_. > > See also `Item: REPRESENTED_PORT`_. > > +Action: ``METER_MARK`` > +^^^^^^^^^^^^^^^^^^^^^^ > + > +Meters an IP packet stream and marks its packets with colors. > + > +Unlike the ``METER`` action, policing is optional and may be > +performed later with the help of the ``METER_COLOR`` item. > +The profile and/or policy objects have to be created > +using the rte_mtr_profile_add()/rte_mtr_policy_add() API. > +Pointers to these objects are used as action parameters > +and need to be retrieved using the rte_mtr_profile_get() API > +and rte_mtr_policy_get() API respectively. > + > +.. _table_rte_flow_action_meter_mark: > + > +.. table:: METER_MARK > + > + +------------------+----------------------+ > + | Field | Value | > + +==================+======================+ > + | ``profile`` | Meter profile object | > + +------------------+----------------------+ > + | ``policy`` | Meter policy object | > + +------------------+----------------------+ > + > Negative types > ~~~~~~~~~~~~~~ > > diff --git a/doc/guides/rel_notes/release_22_07.rst > b/doc/guides/rel_notes/release_22_07.rst > index 6d030bead5..fca7d07e4b 100644 > --- a/doc/guides/rel_notes/release_22_07.rst > +++ b/doc/guides/rel_notes/release_22_07.rst > @@ -74,6 +74,7 @@ New Features > * Added METER_COLOR item to match Color Marker set by a Meter. > * Added ability to set Color Marker via modify_field Flow API. > * Added Meter API to get a pointer to profile/policy by their ID. > + * Added METER_MARK action for Metering with lockless profile/policy access. > > * **Updated Intel iavf driver.** > > diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h > index 9754f6630a..bb16108f16 100644 > --- a/lib/ethdev/rte_flow.h > +++ b/lib/ethdev/rte_flow.h > @@ -2906,6 +2906,15 @@ enum rte_flow_action_type { > * @see struct rte_flow_action_ethdev > */ > RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT, > + > + /** > + * Traffic metering and marking (MTR). > + * the entity represented by the given ethdev. > + * > + * @see struct rte_flow_action_meter_mark > + * See file rte_mtr.h for MTR profile object configuration. > + */ > + RTE_FLOW_ACTION_TYPE_METER_MARK, > }; > > /** > @@ -3775,6 +3784,25 @@ struct rte_flow_action_modify_field { > uint32_t width; /**< Number of bits to use from a source field. */ > }; > > +/** > + * RTE_FLOW_ACTION_TYPE_METER_MARK > + * > + * Traffic metering and marking (MTR). > + * > + * Meters an IP packet stream and marks its packets either > + * green, yellow, or red according to the specified profile. > + * The policy is optional and may be specified for defining > + * subsequent actions based on a color asigned by MTR. > + * Alternatively, the METER_COLOR item may be used for this. > + */ > +struct rte_flow_action_meter_mark { > + > + /**< Profile config retrieved with rte_mtr_profile_get(). */ > + struct rte_flow_meter_profile *profile; > + /**< Profile config retrieved with rte_mtr_policy_get(). */ I think you mean Profile --> policy. > + struct rte_flow_meter_policy *policy; > +}; > + > /* Mbuf dynamic field offset for metadata. */ > extern int32_t rte_flow_dynf_metadata_offs; > > -- > 2.18.2 Best, Ori