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 <jerinj@marvell.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
This commit is contained in:
Jerin Jacob 2021-08-07 13:51:08 +05:30 committed by Thomas Monjalon
parent a2a43d3a3d
commit 44f44b803b
3 changed files with 1643 additions and 2 deletions

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 125 KiB

View File

@ -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`.

View File

@ -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;
};