From: Jerin Jacob Date: Sat, 7 Aug 2021 08:21:08 +0000 (+0530) Subject: doc: add traffic metering API walk-through X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=44f44b803b5a77befe3c59d44369bf27aac62141;p=dpdk.git doc: add traffic metering API walk-through Added a diagram to document meter library components and added text for steps performed by the application to configure the traffic meter and policing library. Signed-off-by: Jerin Jacob Acked-by: Cristian Dumitrescu --- diff --git a/doc/guides/prog_guide/img/rte_mtr_meter_chaining.svg b/doc/guides/prog_guide/img/rte_mtr_meter_chaining.svg new file mode 100644 index 0000000000..7214c5dc2b --- /dev/null +++ b/doc/guides/prog_guide/img/rte_mtr_meter_chaining.svg @@ -0,0 +1,1600 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + RTE_FLOW_ITEM + + RTE_FLOW_ACTION_TYPE_METER + + + + + RED + + YELLOW + + GREEN + + RTE_FLOW_ACTION + + RTE_FLOW_ACTION + + RTE_FLOW_ACTION + + RED + + YELLOW + + GREEN + + RTE_FLOW_ACTION + + RTE_FLOW_ACTION + + RTE_FLOW_ACTION + + + CIR + + CBS + + EBS + + PIR + + PBS + + EIR + + + + CIR + + CBS + + EBS + + PIR + + PBS + + EIR + + + RED + + YELLOW + + GREEN + + RTE_FLOW_ACTION + + RTE_FLOW_ACTION + + RTE_FLOW_ACTION + + + + CIR + + CBS + + EBS + + PIR + + PBS + + EIR + + + RED + + YELLOW + + GREEN + + RTE_FLOW_ACTION_METER + + RTE_FLOW_ACTION + + RTE_FLOW_ACTION + + + + + + + + + + + + + + diff --git a/doc/guides/prog_guide/traffic_metering_and_policing.rst b/doc/guides/prog_guide/traffic_metering_and_policing.rst index c0537e653c..ceb5a96488 100644 --- a/doc/guides/prog_guide/traffic_metering_and_policing.rst +++ b/doc/guides/prog_guide/traffic_metering_and_policing.rst @@ -20,6 +20,7 @@ The main features are: and RFC 4115 Two Rate Three Color Marker (trTCM) * Policer actions (per meter output color): recolor, drop * Statistics (per policer output color) +* Chaining multiple meter objects Configuration steps ------------------- @@ -64,3 +65,43 @@ The processing done for each input packet hitting an MTR object is: * Statistics: The set of counters maintained for each MTR object is configurable and subject to the implementation support. This set includes the number of packets and bytes dropped or passed for each output color. + +API walk-through +---------------- + +.. _figure_rte_mtr_chaining: + +.. figure:: img/rte_mtr_meter_chaining.* + + Meter components + +This section will introduce the reader to the critical APIs to use +the traffic meter and policing library. + +In general, the application performs the following steps to configure the +traffic meter and policing library. + +#. Application gets the meter driver capabilities using ``rte_mtr_capabilities_get()``. +#. The application creates the required meter profiles by using the + ``rte_mtr_meter_profile_add()`` API function. +#. The application creates the required meter policies by using the + ``rte_mtr_meter_policy_add()`` API function. +#. The application creates a meter object using the ``rte_mtr_create()`` API + function. One of the previously created meter profile + (``struct rte_mtr_params::meter_profile_id``) and meter policy + (``struct rte_mtr_params::meter_policy_id``) are provided as arguments + at this step. +#. The application enables the meter object execution as part of the flow action + processing by calling the ``rte_flow_create()`` API function with one of the + flow action set to ``RTE_FLOW_ACTION_TYPE_METER`` and the associated + meter object ID set to this meter object. +#. The API allows chaining the meter objects to create complex metering topology + by the following methods. + + * Adding multiple flow actions of the type ``RTE_FLOW_ACTION_TYPE_METER`` to + the same flow. + Each of the meter action typically refers to a different meter object. + + * Adding one (or multiple) actions of the type ``RTE_FLOW_ACTION_TYPE_METER`` + to the list of meter actions (``struct rte_mtr_meter_policy_params::actions``) + specified per color as show in :numref:`figure_rte_mtr_chaining`. diff --git a/lib/ethdev/rte_mtr.h b/lib/ethdev/rte_mtr.h index dc246dd7af..40df0888c8 100644 --- a/lib/ethdev/rte_mtr.h +++ b/lib/ethdev/rte_mtr.h @@ -219,7 +219,7 @@ struct rte_mtr_meter_policy_params { * @see enum rte_mtr_stats_type */ struct rte_mtr_params { - /** Meter profile ID. */ + /** Meter profile ID. @see rte_mtr_meter_profile_add() */ uint32_t meter_profile_id; /** Meter input color in case of MTR object chaining. When non-zero: if @@ -259,7 +259,7 @@ struct rte_mtr_params { */ uint64_t stats_mask; - /** Meter policy ID. */ + /** Meter policy ID. @see rte_mtr_meter_policy_add() */ uint32_t meter_policy_id; };