15630257fSFerruh Yigit.. SPDX-License-Identifier: BSD-3-Clause 25630257fSFerruh Yigit Copyright(c) 2010-2014 Intel Corporation. 3d0dff9baSBernard Iremonger 4d0dff9baSBernard IremongerQoS Scheduler Sample Application 5d0dff9baSBernard Iremonger================================ 6d0dff9baSBernard Iremonger 7e0c7c473SSiobhan ButlerThe QoS sample application demonstrates the use of the DPDK to provide QoS scheduling. 8d0dff9baSBernard Iremonger 9d0dff9baSBernard IremongerOverview 10d0dff9baSBernard Iremonger-------- 11d0dff9baSBernard Iremonger 12d0dff9baSBernard IremongerThe architecture of the QoS scheduler application is shown in the following figure. 13d0dff9baSBernard Iremonger 144a22e6eeSJohn McNamara.. _figure_qos_sched_app_arch: 15d0dff9baSBernard Iremonger 164a22e6eeSJohn McNamara.. figure:: img/qos_sched_app_arch.* 17d0dff9baSBernard Iremonger 184a22e6eeSJohn McNamara QoS Scheduler Application Architecture 19d0dff9baSBernard Iremonger 20d0dff9baSBernard Iremonger 21d0dff9baSBernard IremongerThere are two flavors of the runtime execution for this application, 22d0dff9baSBernard Iremongerwith two or three threads per each packet flow configuration being used. 23d0dff9baSBernard IremongerThe RX thread reads packets from the RX port, 24d0dff9baSBernard Iremongerclassifies the packets based on the double VLAN (outer and inner) and 25694fd2cbSJasvinder Singhthe lower byte of the IP destination address and puts them into the ring queue. 26d0dff9baSBernard IremongerThe worker thread dequeues the packets from the ring and calls the QoS scheduler enqueue/dequeue functions. 27d0dff9baSBernard IremongerIf a separate TX core is used, these are sent to the TX ring. 28d0dff9baSBernard IremongerOtherwise, they are sent directly to the TX port. 29d0dff9baSBernard IremongerThe TX thread, if present, reads from the TX ring and write the packets to the TX port. 30d0dff9baSBernard Iremonger 31d0dff9baSBernard IremongerCompiling the Application 32d0dff9baSBernard Iremonger------------------------- 33d0dff9baSBernard Iremonger 347cacb056SHerakliusz LipiecTo compile the sample application see :doc:`compiling`. 35d0dff9baSBernard Iremonger 367cacb056SHerakliusz LipiecThe application is located in the ``qos_sched`` sub-directory. 37d0dff9baSBernard Iremonger 38d0dff9baSBernard Iremonger .. note:: 39d0dff9baSBernard Iremonger 40218c4e68SBruce Richardson This application is intended as a linux only. 41d0dff9baSBernard Iremonger 42d0dff9baSBernard Iremonger.. note:: 43d0dff9baSBernard Iremonger 44ec487c18SMegha Ajmera Number of grinders is currently set to 8. 45ec487c18SMegha Ajmera This can be modified by specifying RTE_SCHED_PORT_N_GRINDERS=N 46ec487c18SMegha Ajmera in CFLAGS, where N is number of grinders. 47ec487c18SMegha Ajmera 48d0dff9baSBernard IremongerRunning the Application 49d0dff9baSBernard Iremonger----------------------- 50d0dff9baSBernard Iremonger 51d0dff9baSBernard Iremonger.. note:: 52d0dff9baSBernard Iremonger 53d0dff9baSBernard Iremonger In order to run the application, a total of at least 4 54d0dff9baSBernard Iremonger G of huge pages must be set up for each of the used sockets (depending on the cores in use). 55d0dff9baSBernard Iremonger 56d0dff9baSBernard IremongerThe application has a number of command line options: 57d0dff9baSBernard Iremonger 58d0dff9baSBernard Iremonger.. code-block:: console 59d0dff9baSBernard Iremonger 60e2a94f9aSCiara Power ./<build_dir>/examples/dpdk-qos_sched [EAL options] -- <APP PARAMS> 61d0dff9baSBernard Iremonger 62d0dff9baSBernard IremongerMandatory application parameters include: 63d0dff9baSBernard Iremonger 64d0dff9baSBernard Iremonger* --pfc "RX PORT, TX PORT, RX LCORE, WT LCORE, TX CORE": Packet flow configuration. 65d0dff9baSBernard Iremonger Multiple pfc entities can be configured in the command line, 66d0dff9baSBernard Iremonger having 4 or 5 items (if TX core defined or not). 67d0dff9baSBernard Iremonger 68d0dff9baSBernard IremongerOptional application parameters include: 69d0dff9baSBernard Iremonger 70d0dff9baSBernard Iremonger* -i: It makes the application to start in the interactive mode. 71d0dff9baSBernard Iremonger In this mode, the application shows a command line that can be used for obtaining statistics while 72d0dff9baSBernard Iremonger scheduling is taking place (see interactive mode below for more information). 73d0dff9baSBernard Iremonger 74cb056611SStephen Hemminger* --mnc n: Main core index (the default value is 1). 75d0dff9baSBernard Iremonger 76d0dff9baSBernard Iremonger* --rsz "A, B, C": Ring sizes: 77d0dff9baSBernard Iremonger 78d0dff9baSBernard Iremonger* A = Size (in number of buffer descriptors) of each of the NIC RX rings read 79d0dff9baSBernard Iremonger by the I/O RX lcores (the default value is 128). 80d0dff9baSBernard Iremonger 81d0dff9baSBernard Iremonger* B = Size (in number of elements) of each of the software rings used 82d0dff9baSBernard Iremonger by the I/O RX lcores to send packets to worker lcores (the default value is 8192). 83d0dff9baSBernard Iremonger 84d0dff9baSBernard Iremonger* C = Size (in number of buffer descriptors) of each of the NIC TX rings written 85d0dff9baSBernard Iremonger by worker lcores (the default value is 256) 86d0dff9baSBernard Iremonger 87d0dff9baSBernard Iremonger* --bsz "A, B, C, D": Burst sizes 88d0dff9baSBernard Iremonger 89d0dff9baSBernard Iremonger* A = I/O RX lcore read burst size from the NIC RX (the default value is 64) 90d0dff9baSBernard Iremonger 91d0dff9baSBernard Iremonger* B = I/O RX lcore write burst size to the output software rings, 92d0dff9baSBernard Iremonger worker lcore read burst size from input software rings,QoS enqueue size (the default value is 64) 93d0dff9baSBernard Iremonger 94*47fbbfe7SBruce Richardson* C = QoS dequeue size (the default value is 63) 95d0dff9baSBernard Iremonger 96d0dff9baSBernard Iremonger* D = Worker lcore write burst size to the NIC TX (the default value is 64) 97d0dff9baSBernard Iremonger 98d0dff9baSBernard Iremonger* --msz M: Mempool size (in number of mbufs) for each pfc (default 2097152) 99d0dff9baSBernard Iremonger 100d0dff9baSBernard Iremonger* --rth "A, B, C": The RX queue threshold parameters 101d0dff9baSBernard Iremonger 102d0dff9baSBernard Iremonger* A = RX prefetch threshold (the default value is 8) 103d0dff9baSBernard Iremonger 104d0dff9baSBernard Iremonger* B = RX host threshold (the default value is 8) 105d0dff9baSBernard Iremonger 106d0dff9baSBernard Iremonger* C = RX write-back threshold (the default value is 4) 107d0dff9baSBernard Iremonger 108d0dff9baSBernard Iremonger* --tth "A, B, C": TX queue threshold parameters 109d0dff9baSBernard Iremonger 110d0dff9baSBernard Iremonger* A = TX prefetch threshold (the default value is 36) 111d0dff9baSBernard Iremonger 112d0dff9baSBernard Iremonger* B = TX host threshold (the default value is 0) 113d0dff9baSBernard Iremonger 114d0dff9baSBernard Iremonger* C = TX write-back threshold (the default value is 0) 115d0dff9baSBernard Iremonger 116d0dff9baSBernard Iremonger* --cfg FILE: Profile configuration to load 117d0dff9baSBernard Iremonger 118e0c7c473SSiobhan ButlerRefer to *DPDK Getting Started Guide* for general information on running applications and 119d0dff9baSBernard Iremongerthe Environment Abstraction Layer (EAL) options. 120d0dff9baSBernard Iremonger 121d0dff9baSBernard IremongerThe profile configuration file defines all the port/subport/pipe/traffic class/queue parameters 122d0dff9baSBernard Iremongerneeded for the QoS scheduler configuration. 123d0dff9baSBernard Iremonger 124d0dff9baSBernard IremongerThe profile file has the following format: 125d0dff9baSBernard Iremonger 1269a212dc0SConor Fogarty.. literalinclude:: ../../../examples/qos_sched/profile.cfg 1279a212dc0SConor Fogarty :start-after: Data Plane Development Kit (DPDK) Programmer's Guide 128694fd2cbSJasvinder Singh 129d0dff9baSBernard IremongerInteractive mode 130d0dff9baSBernard Iremonger~~~~~~~~~~~~~~~~ 131d0dff9baSBernard Iremonger 132d0dff9baSBernard IremongerThese are the commands that are currently working under the command line interface: 133d0dff9baSBernard Iremonger 134d0dff9baSBernard Iremonger* Control Commands 135d0dff9baSBernard Iremonger 136d0dff9baSBernard Iremonger* --quit: Quits the application. 137d0dff9baSBernard Iremonger 138d0dff9baSBernard Iremonger* General Statistics 139d0dff9baSBernard Iremonger 140d0dff9baSBernard Iremonger * stats app: Shows a table with in-app calculated statistics. 141d0dff9baSBernard Iremonger 142d0dff9baSBernard Iremonger * stats port X subport Y: For a specific subport, it shows the number of packets that 143d0dff9baSBernard Iremonger went through the scheduler properly and the number of packets that were dropped. 144d0dff9baSBernard Iremonger The same information is shown in bytes. 145d0dff9baSBernard Iremonger The information is displayed in a table separating it in different traffic classes. 146d0dff9baSBernard Iremonger 147d0dff9baSBernard Iremonger * stats port X subport Y pipe Z: For a specific pipe, it shows the number of packets that 148d0dff9baSBernard Iremonger went through the scheduler properly and the number of packets that were dropped. 149d0dff9baSBernard Iremonger The same information is shown in bytes. 150d0dff9baSBernard Iremonger This information is displayed in a table separating it in individual queues. 151d0dff9baSBernard Iremonger 152d0dff9baSBernard Iremonger* Average queue size 153d0dff9baSBernard Iremonger 154d0dff9baSBernard IremongerAll of these commands work the same way, averaging the number of packets throughout a specific subset of queues. 155d0dff9baSBernard Iremonger 156d0dff9baSBernard IremongerTwo parameters can be configured for this prior to calling any of these commands: 157d0dff9baSBernard Iremonger 158d0dff9baSBernard Iremonger * qavg n X: n is the number of times that the calculation will take place. 159d0dff9baSBernard Iremonger Bigger numbers provide higher accuracy. The default value is 10. 160d0dff9baSBernard Iremonger 161d0dff9baSBernard Iremonger * qavg period X: period is the number of microseconds that will be allowed between each calculation. 162d0dff9baSBernard Iremonger The default value is 100. 163d0dff9baSBernard Iremonger 164d0dff9baSBernard IremongerThe commands that can be used for measuring average queue size are: 165d0dff9baSBernard Iremonger 166d0dff9baSBernard Iremonger* qavg port X subport Y: Show average queue size per subport. 167d0dff9baSBernard Iremonger 168d0dff9baSBernard Iremonger* qavg port X subport Y tc Z: Show average queue size per subport for a specific traffic class. 169d0dff9baSBernard Iremonger 170d0dff9baSBernard Iremonger* qavg port X subport Y pipe Z: Show average queue size per pipe. 171d0dff9baSBernard Iremonger 172d0dff9baSBernard Iremonger* qavg port X subport Y pipe Z tc A: Show average queue size per pipe for a specific traffic class. 173d0dff9baSBernard Iremonger 174d0dff9baSBernard Iremonger* qavg port X subport Y pipe Z tc A q B: Show average queue size of a specific queue. 175d0dff9baSBernard Iremonger 176d0dff9baSBernard IremongerExample 177d0dff9baSBernard Iremonger~~~~~~~ 178d0dff9baSBernard Iremonger 179d0dff9baSBernard IremongerThe following is an example command with a single packet flow configuration: 180d0dff9baSBernard Iremonger 181d0dff9baSBernard Iremonger.. code-block:: console 182d0dff9baSBernard Iremonger 183e2a94f9aSCiara Power ./<build_dir>/examples/dpdk-qos_sched -l 1,5,7 -n 4 -- --pfc "3,2,5,7" --cfg ./profile.cfg 184d0dff9baSBernard Iremonger 185d0dff9baSBernard IremongerThis example uses a single packet flow configuration which creates one RX thread on lcore 5 reading 186d0dff9baSBernard Iremongerfrom port 3 and a worker thread on lcore 7 writing to port 2. 187d0dff9baSBernard Iremonger 188d0dff9baSBernard IremongerAnother example with 2 packet flow configurations using different ports but sharing the same core for QoS scheduler is given below: 189d0dff9baSBernard Iremonger 190d0dff9baSBernard Iremonger.. code-block:: console 191d0dff9baSBernard Iremonger 192e2a94f9aSCiara Power ./<build_dir>/examples/dpdk-qos_sched -l 1,2,6,7 -n 4 -- --pfc "3,2,2,6,7" --pfc "1,0,2,6,7" --cfg ./profile.cfg 193d0dff9baSBernard Iremonger 194d0dff9baSBernard IremongerNote that independent cores for the packet flow configurations for each of the RX, WT and TX thread are also supported, 195d0dff9baSBernard Iremongerproviding flexibility to balance the work. 196d0dff9baSBernard Iremonger 197cb056611SStephen HemmingerThe EAL coremask/corelist is constrained to contain the default main core 1 and the RX, WT and TX cores only. 198d0dff9baSBernard Iremonger 199d0dff9baSBernard IremongerExplanation 200d0dff9baSBernard Iremonger----------- 201d0dff9baSBernard Iremonger 202d0dff9baSBernard IremongerThe Port/Subport/Pipe/Traffic Class/Queue are the hierarchical entities in a typical QoS application: 203d0dff9baSBernard Iremonger 204d0dff9baSBernard Iremonger* A subport represents a predefined group of users. 205d0dff9baSBernard Iremonger 206d0dff9baSBernard Iremonger* A pipe represents an individual user/subscriber. 207d0dff9baSBernard Iremonger 208d0dff9baSBernard Iremonger* A traffic class is the representation of a different traffic type with a specific loss rate, 209d0dff9baSBernard Iremonger delay and jitter requirements; such as data voice, video or data transfers. 210d0dff9baSBernard Iremonger 211d0dff9baSBernard Iremonger* A queue hosts packets from one or multiple connections of the same type belonging to the same user. 212d0dff9baSBernard Iremonger 213d0dff9baSBernard IremongerThe traffic flows that need to be configured are application dependent. 214d0dff9baSBernard IremongerThis application classifies based on the QinQ double VLAN tags and the IP destination address as indicated in the following table. 215d0dff9baSBernard Iremonger 2168c9a3374SJohn McNamara.. _table_qos_scheduler_1: 217d0dff9baSBernard Iremonger 2188c9a3374SJohn McNamara.. table:: Entity Types 219d0dff9baSBernard Iremonger 220d0dff9baSBernard Iremonger +----------------+-------------------------+--------------------------------------------------+----------------------------------+ 221d0dff9baSBernard Iremonger | **Level Name** | **Siblings per Parent** | **QoS Functional Description** | **Selected By** | 222d0dff9baSBernard Iremonger | | | | | 223d0dff9baSBernard Iremonger +================+=========================+==================================================+==================================+ 224d0dff9baSBernard Iremonger | Port | - | Ethernet port | Physical port | 225d0dff9baSBernard Iremonger | | | | | 226d0dff9baSBernard Iremonger +----------------+-------------------------+--------------------------------------------------+----------------------------------+ 227d0dff9baSBernard Iremonger | Subport | Config (8) | Traffic shaped (token bucket) | Outer VLAN tag | 228d0dff9baSBernard Iremonger | | | | | 229d0dff9baSBernard Iremonger +----------------+-------------------------+--------------------------------------------------+----------------------------------+ 230d0dff9baSBernard Iremonger | Pipe | Config (4k) | Traffic shaped (token bucket) | Inner VLAN tag | 231d0dff9baSBernard Iremonger | | | | | 232d0dff9baSBernard Iremonger +----------------+-------------------------+--------------------------------------------------+----------------------------------+ 233694fd2cbSJasvinder Singh | Traffic Class | 13 | TCs of the same pipe services in strict priority | Destination IP address (0.0.0.X) | 234d0dff9baSBernard Iremonger | | | | | 235d0dff9baSBernard Iremonger +----------------+-------------------------+--------------------------------------------------+----------------------------------+ 236694fd2cbSJasvinder Singh | Queue | High Priority TC: 1, | Queue of lowest priority traffic | Destination IP address (0.0.0.X) | 237694fd2cbSJasvinder Singh | | Lowest Priority TC: 4 | class (Best effort) serviced in WRR | | 238d0dff9baSBernard Iremonger +----------------+-------------------------+--------------------------------------------------+----------------------------------+ 239d0dff9baSBernard Iremonger 240e0c7c473SSiobhan ButlerPlease refer to the "QoS Scheduler" chapter in the *DPDK Programmer's Guide* for more information about these parameters. 241