mem: instrument allocator for ASan
[dpdk.git] / doc / guides / sample_app_ug / qos_metering.rst
index 2e8e017..e710155 100644 (file)
@@ -48,7 +48,7 @@ The application execution command line is as below:
 
 .. code-block:: console
 
-    ./qos_meter [EAL options] -- -p PORTMASK
+    ./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).
@@ -61,34 +61,20 @@ Explanation
 
 Selecting one of the metering modes is done with these defines:
 
-.. code-block:: c
-
-    #define APP_MODE_FWD   0
-    #define APP_MODE_SRTCM_COLOR_BLIND  1
-    #define APP_MODE_SRTCM_COLOR_AWARE  2
-    #define APP_MODE_TRTCM_COLOR_BLIND  3
-    #define APP_MODE_TRTCM_COLOR_AWARE  4
-
-    #define APP_MODE  APP_MODE_SRTCM_COLOR_BLIND
+.. 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:
 
-.. code-block:: c
-
-    struct rte_meter_srtcm_params app_srtcm_params[] = {
-
-        {.cir = 1000000 * 46, .cbs = 2048, .ebs = 2048},
-
-    };
-
-    struct rte_meter_trtcm_params app_trtcm_params[] = {
-
-        {.cir = 1000000 * 46, .pir = 1500000 * 46, .cbs = 2048, .pbs = 2048},
-
-    };
+.. 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:
@@ -120,14 +106,10 @@ and green, the expected output traffic should be marked as shown in the followin
 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:
 
-.. code-block:: c
-
-    int policer_table[e_RTE_METER_COLORS][e_RTE_METER_COLORS] =
-    {
-       { GREEN, RED, RED},
-       { DROP, YELLOW, RED},
-       { DROP, DROP, RED}
-    };
+.. 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.
@@ -151,5 +133,5 @@ In this particular case:
 *   For the rest of the cases, the color is changed to red.
 
 .. note::
-    * In color blind mode, first row GREEN colour is only valid.
+    * In color blind mode, first row GREEN color is only valid.
     * To drop the packet, policer_table action has to be set to DROP.