[dpdk-dev] [RFC 3/3] rte_flow: add new action for traffic metering and policing

Adrien Mazarguil adrien.mazarguil at 6wind.com
Thu Jun 1 17:13:35 CEST 2017


Hi Cristian,

On Tue, May 30, 2017 at 05:44:13PM +0100, Cristian Dumitrescu wrote:
> Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu at intel.com>
> ---
>  lib/librte_ether/rte_flow.h | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h
> index c47edbc..2942ca7 100644
> --- a/lib/librte_ether/rte_flow.h
> +++ b/lib/librte_ether/rte_flow.h
> @@ -881,6 +881,14 @@ enum rte_flow_action_type {
>  	 * See struct rte_flow_action_vf.
>  	 */
>  	RTE_FLOW_ACTION_TYPE_VF,
> +
> +	/**
> +	 * Traffic metering and policing (MTR).
> +	 *
> +	 * See struct rte_flow_action_meter.
> +	 * See file rte_mtr.h for MTR object configuration.
> +	 */
> +	RTE_FLOW_ACTION_TYPE_METER,
>  };
>  
>  /**
> @@ -974,6 +982,20 @@ struct rte_flow_action_vf {
>  };
>  
>  /**
> + * RTE_FLOW_ACTION_TYPE_METER
> + *
> + * Traffic metering and policing (MTR).
> + *
> + * Packets matched by items of this type can be either dropped or passed to the
> + * next item with their color set by the MTR object.
> + *
> + * Non-terminating by default.
> + */
> +struct rte_flow_action_meter {
> +	uint32_t mtr_id; /**< MTR object ID created with rte_mtr_create(). */
> +};
> +
> +/**
>   * Definition of a single action.
>   *
>   * A list of actions is terminated by a END action.

Assuming this action is provided to the underlying PMD, can you describe
what happens next; what is a PMD supposed to do when creating the flow rule
and the impact on its data path?

It looks like mtr_id is arbitrarily set by the user calling
rte_mtr_create(), which means the PMD has to look up the associated MTR
context somehow.

How about making the rte_mtr_create() API return an opaque rte_mtr object
pointer provided back to all API functions as well as through this action
instead, and not leave it up to the user?

-- 
Adrien Mazarguil
6WIND


More information about the dev mailing list