9a212dc06c
Currently the sample app user guides use hard coded code snippets,
this patch changes these to use literalinclude which will dynamically
update the snippets as changes are made to the code.
This was introduced in commit 413c75c33c
("doc: show how to include
code in guides"). Comments within the sample apps were updated to
accommodate this as part of this patch. This will help to ensure that
the code within the sample app user guides is up to date and not out
of sync with the actual code.
Signed-off-by: Conor Fogarty <conor.fogarty@intel.com>
Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
138 lines
5.7 KiB
ReStructuredText
138 lines
5.7 KiB
ReStructuredText
.. SPDX-License-Identifier: BSD-3-Clause
|
|
Copyright(c) 2010-2014 Intel Corporation.
|
|
|
|
QoS Metering Sample Application
|
|
===============================
|
|
|
|
The QoS meter sample application is an example that demonstrates the use of DPDK to provide QoS marking and metering,
|
|
as defined by RFC2697 for Single Rate Three Color Marker (srTCM) and RFC 2698 for Two Rate Three Color Marker (trTCM) algorithm.
|
|
|
|
Overview
|
|
--------
|
|
|
|
The application uses a single thread for reading the packets from the RX port,
|
|
metering, marking them with the appropriate color (green, yellow or red) and writing them to the TX port.
|
|
|
|
A policing scheme can be applied before writing the packets to the TX port by dropping or
|
|
changing the color of the packet in a static manner depending on both the input and output colors of the packets that are processed by the meter.
|
|
|
|
The operation mode can be selected as compile time out of the following options:
|
|
|
|
* Simple forwarding
|
|
|
|
* srTCM color blind
|
|
|
|
* srTCM color aware
|
|
|
|
* srTCM color blind
|
|
|
|
* srTCM color aware
|
|
|
|
Please refer to RFC2697 and RFC2698 for details about the srTCM and trTCM configurable parameters
|
|
(CIR, CBS and EBS for srTCM; CIR, PIR, CBS and PBS for trTCM).
|
|
|
|
The color blind modes are functionally equivalent with the color-aware modes when
|
|
all the incoming packets are colored as green.
|
|
|
|
Compiling the Application
|
|
-------------------------
|
|
|
|
To compile the sample application see :doc:`compiling`.
|
|
|
|
The application is located in the ``qos_meter`` sub-directory.
|
|
|
|
Running the Application
|
|
-----------------------
|
|
|
|
The application execution command line is as below:
|
|
|
|
.. code-block:: console
|
|
|
|
./dpdk-qos_meter [EAL options] -- -p PORTMASK
|
|
|
|
The application is constrained to use a single core in the EAL core mask and 2 ports only in the application port mask
|
|
(first port from the port mask is used for RX and the other port in the core mask is used for TX).
|
|
|
|
Refer to *DPDK Getting Started Guide* for general information on running applications and
|
|
the Environment Abstraction Layer (EAL) options.
|
|
|
|
Explanation
|
|
-----------
|
|
|
|
Selecting one of the metering modes is done with these defines:
|
|
|
|
.. literalinclude:: ../../../examples/qos_meter/main.c
|
|
:language: c
|
|
:start-after: Traffic metering configuration. 8<
|
|
:end-before: >8 End of traffic metering configuration.
|
|
|
|
To simplify debugging (for example, by using the traffic generator RX side MAC address based packet filtering feature),
|
|
the color is defined as the LSB byte of the destination MAC address.
|
|
|
|
The traffic meter parameters are configured in the application source code with following default values:
|
|
|
|
.. literalinclude:: ../../../examples/qos_meter/main.c
|
|
:language: c
|
|
:start-after: Traffic meter parameters are configured in the application. 8<
|
|
:end-before: >8 End of traffic meter parameters are configured in the application.
|
|
|
|
Assuming the input traffic is generated at line rate and all packets are 64 bytes Ethernet frames (IPv4 packet size of 46 bytes)
|
|
and green, the expected output traffic should be marked as shown in the following table:
|
|
|
|
.. _table_qos_metering_1:
|
|
|
|
.. table:: Output Traffic Marking
|
|
|
|
+-------------+------------------+-------------------+----------------+
|
|
| **Mode** | **Green (Mpps)** | **Yellow (Mpps)** | **Red (Mpps)** |
|
|
| | | | |
|
|
+=============+==================+===================+================+
|
|
| srTCM blind | 1 | 1 | 12.88 |
|
|
| | | | |
|
|
+-------------+------------------+-------------------+----------------+
|
|
| srTCM color | 1 | 1 | 12.88 |
|
|
| | | | |
|
|
+-------------+------------------+-------------------+----------------+
|
|
| trTCM blind | 1 | 0.5 | 13.38 |
|
|
| | | | |
|
|
+-------------+------------------+-------------------+----------------+
|
|
| trTCM color | 1 | 0.5 | 13.38 |
|
|
| | | | |
|
|
+-------------+------------------+-------------------+----------------+
|
|
| FWD | 14.88 | 0 | 0 |
|
|
| | | | |
|
|
+-------------+------------------+-------------------+----------------+
|
|
|
|
To set up the policing scheme as desired, it is necessary to modify the main.h source file,
|
|
where this policy is implemented as a static structure, as follows:
|
|
|
|
.. literalinclude:: ../../../examples/qos_meter/main.h
|
|
:language: c
|
|
:start-after: Policy implemented as a static structure. 8<
|
|
:end-before: >8 End of policy implemented as a static structure.
|
|
|
|
Where rows indicate the input color, columns indicate the output color,
|
|
and the value that is stored in the table indicates the action to be taken for that particular case.
|
|
|
|
There are four different actions:
|
|
|
|
* GREEN: The packet's color is changed to green.
|
|
|
|
* YELLOW: The packet's color is changed to yellow.
|
|
|
|
* RED: The packet's color is changed to red.
|
|
|
|
* DROP: The packet is dropped.
|
|
|
|
In this particular case:
|
|
|
|
* Every packet which input and output color are the same, keeps the same color.
|
|
|
|
* Every packet which color has improved is dropped (this particular case can't happen, so these values will not be used).
|
|
|
|
* For the rest of the cases, the color is changed to red.
|
|
|
|
.. note::
|
|
* In color blind mode, first row GREEN color is only valid.
|
|
* To drop the packet, policer_table action has to be set to DROP.
|