aboutsummaryrefslogtreecommitdiffstats
path: root/doc/guides/nics/mvpp2.rst
blob: 82b9383ec41b756c0dbee39a496fd28c75741192 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
..  BSD LICENSE
    Copyright(c) 2017 Marvell International Ltd.
    Copyright(c) 2017 Semihalf.
    All rights reserved.

    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions
    are met:

      * Redistributions of source code must retain the above copyright
        notice, this list of conditions and the following disclaimer.
      * Redistributions in binary form must reproduce the above copyright
        notice, this list of conditions and the following disclaimer in
        the documentation and/or other materials provided with the
        distribution.
      * Neither the name of the copyright holder nor the names of its
        contributors may be used to endorse or promote products derived
        from this software without specific prior written permission.

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

.. _mvpp2_poll_mode_driver:

MVPP2 Poll Mode Driver
======================

The MVPP2 PMD (librte_pmd_mvpp2) provides poll mode driver support
for the Marvell PPv2 (Packet Processor v2) 1/10 Gbps adapter.

Detailed information about SoCs that use PPv2 can be obtained here:

* https://www.marvell.com/embedded-processors/armada-70xx/
* https://www.marvell.com/embedded-processors/armada-80xx/

.. Note::

   Due to external dependencies, this driver is disabled by default. It must
   be enabled manually by setting relevant configuration option manually.
   Please refer to `Config File Options`_ section for further details.


Features
--------

Features of the MVPP2 PMD are:

- Speed capabilities
- Link status
- Tx Queue start/stop
- MTU update
- Jumbo frame
- Promiscuous mode
- Allmulticast mode
- Unicast MAC filter
- Multicast MAC filter
- RSS hash
- VLAN filter
- CRC offload
- L3 checksum offload
- L4 checksum offload
- Packet type parsing
- Basic stats
- :ref:`Extended stats <extstats>`
- RX flow control
- Scattered TX frames
- :ref:`QoS <qossupport>`
- :ref:`Flow API <flowapi>`
- :ref:`Traffic metering and policing <mtrapi>`
- :ref:`Traffic Management API <tmapi>`

Limitations
-----------

- Number of lcores is limited to 9 by MUSDK internal design. If more lcores
  need to be allocated, locking will have to be considered. Number of available
  lcores can be changed via ``MRVL_MUSDK_HIFS_RESERVED`` define in
  ``mrvl_ethdev.c`` source file.

- Flushing vlans added for filtering is not possible due to MUSDK missing
  functionality. Current workaround is to reset board so that PPv2 has a
  chance to start in a sane state.

- MUSDK architecture does not support changing configuration in run time.
  All nessesary configurations should be done before first dev_start().

- RX queue start/stop is not supported.

- Current implementation does not support replacement of buffers in the HW buffer pool
  at run time, so it is responsibility of the application to ensure that MTU does not exceed the configured buffer size.

- Configuring TX flow control currently is not supported.

- In current implementation, mechanism for acknowledging transmitted packets (``tx_done_cleanup``) is not supported.

- Running more than one DPDK-MUSDK application simultaneously is not supported.


Prerequisites
-------------

- Custom Linux Kernel sources

  .. code-block:: console

     git clone https://github.com/MarvellEmbeddedProcessors/linux-marvell.git -b linux-4.4.120-armada-18.09

- Out of tree `mvpp2x_sysfs` kernel module sources

  .. code-block:: console

     git clone https://github.com/MarvellEmbeddedProcessors/mvpp2x-marvell.git -b mvpp2x-armada-18.09

- MUSDK (Marvell User-Space SDK) sources

  .. code-block:: console

     git clone https://github.com/MarvellEmbeddedProcessors/musdk-marvell.git -b musdk-armada-18.09

  MUSDK is a light-weight library that provides direct access to Marvell's
  PPv2 (Packet Processor v2). Alternatively prebuilt MUSDK library can be
  requested from `Marvell Extranet <https://extranet.marvell.com>`_. Once
  approval has been granted, library can be found by typing ``musdk`` in
  the search box.

  To get better understanding of the library one can consult documentation
  available in the ``doc`` top level directory of the MUSDK sources.

- DPDK environment

  Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup
  DPDK environment.


Config File Options
-------------------

The following options can be modified in the ``config`` file.

- ``CONFIG_RTE_LIBRTE_MVPP2_PMD`` (default ``n``)

    Toggle compilation of the librte mvpp2 driver.

    .. Note::

       When MVPP2 PMD is enabled ``CONFIG_RTE_LIBRTE_MVNETA_PMD`` must be disabled


Building DPDK
-------------

Driver needs precompiled MUSDK library during compilation.

.. code-block:: console

   export CROSS_COMPILE=<toolchain>/bin/aarch64-linux-gnu-
   ./bootstrap
   ./configure --host=aarch64-linux-gnu
   make install

MUSDK will be installed to `usr/local` under current directory.
For the detailed build instructions please consult ``doc/musdk_get_started.txt``.

Before the DPDK build process the environmental variable ``LIBMUSDK_PATH`` with
the path to the MUSDK installation directory needs to be exported.

For additional instructions regarding DPDK cross compilation please refer to :doc:`Cross compile DPDK for ARM64 <../linux_gsg/cross_build_dpdk_for_arm64>`.

.. code-block:: console

   export LIBMUSDK_PATH=<musdk>/usr/local
   export CROSS=<toolchain>/bin/aarch64-linux-gnu-
   export RTE_KERNELDIR=<kernel-dir>
   export RTE_TARGET=arm64-armv8a-linuxapp-gcc

   make config T=arm64-armv8a-linuxapp-gcc
   sed -i "s/MVNETA_PMD=y/MVNETA_PMD=n/" build/.config
   sed -i "s/MVPP2_PMD=n/MVPP2_PMD=y/" build/.config
   make

Usage Example
-------------

MVPP2 PMD requires extra out of tree kernel modules to function properly.
`musdk_cma` sources are part of the MUSDK. Please consult
``doc/musdk_get_started.txt`` for the detailed build instructions.
For `mvpp2x_sysfs` please consult ``Documentation/pp22_sysfs.txt`` for the
detailed build instructions.

.. code-block:: console

   insmod musdk_cma.ko
   insmod mvpp2x_sysfs.ko

Additionally interfaces used by DPDK application need to be put up:

.. code-block:: console

   ip link set eth0 up
   ip link set eth2 up

In order to run testpmd example application following command can be used:

.. code-block:: console

   ./testpmd --vdev=eth_mvpp2,iface=eth0,iface=eth2 -c 7 -- \
     --burst=128 --txd=2048 --rxd=1024 --rxq=2 --txq=2  --nb-cores=2 \
     -i -a --rss-udp

.. _extstats:

Extended stats
--------------

MVPP2 PMD supports the following extended statistics:

	- ``rx_bytes``:	number of RX bytes
	- ``rx_packets``: number of RX packets
	- ``rx_unicast_packets``: number of RX unicast packets
	- ``rx_errors``: number of RX MAC errors
	- ``rx_fullq_dropped``: number of RX packets dropped due to full RX queue
	- ``rx_bm_dropped``: number of RX packets dropped due to no available buffers in the HW pool
	- ``rx_early_dropped``: number of RX packets that were early dropped
	- ``rx_fifo_dropped``: number of RX packets dropped due to RX fifo overrun
	- ``rx_cls_dropped``: number of RX packets dropped by classifier
	- ``tx_bytes``: number of TX bytes
	- ``tx_packets``: number of TX packets
	- ``tx_unicast_packets``: number of TX unicast packets
	- ``tx_errors``: number of TX MAC errors


.. _qossupport:

QoS Configuration
-----------------

QoS configuration is done through external configuration file. Path to the
file must be given as `cfg` in driver's vdev parameter list.

Configuration syntax
~~~~~~~~~~~~~~~~~~~~

.. code-block:: console

   [policer <policer_id>]
   token_unit = <token_unit>
   color = <color_mode>
   cir = <cir>
   ebs = <ebs>
   cbs = <cbs>

   [port <portnum> default]
   default_tc = <default_tc>
   mapping_priority = <mapping_priority>

   rate_limit_enable = <rate_limit_enable>
   rate_limit = <rate_limit>
   burst_size = <burst_size>

   default_policer = <policer_id>

   [port <portnum> tc <traffic_class>]
   rxq = <rx_queue_list>
   pcp = <pcp_list>
   dscp = <dscp_list>
   default_color = <default_color>

   [port <portnum> tc <traffic_class>]
   rxq = <rx_queue_list>
   pcp = <pcp_list>
   dscp = <dscp_list>

   [port <portnum> txq <txqnum>]
   sched_mode = <sched_mode>
   wrr_weight = <wrr_weight>

   rate_limit_enable = <rate_limit_enable>
   rate_limit = <rate_limit>
   burst_size = <burst_size>

Where:

- ``<portnum>``: DPDK Port number (0..n).

- ``<default_tc>``: Default traffic class (e.g. 0)

- ``<mapping_priority>``: QoS priority for mapping (`ip`, `vlan`, `ip/vlan` or `vlan/ip`).

- ``<traffic_class>``: Traffic Class to be configured.

- ``<rx_queue_list>``: List of DPDK RX queues (e.g. 0 1 3-4)

- ``<pcp_list>``: List of PCP values to handle in particular TC (e.g. 0 1 3-4 7).

- ``<dscp_list>``: List of DSCP values to handle in particular TC (e.g. 0-12 32-48 63).

- ``<default_policer>``: Id of the policer configuration section to be used as default.

- ``<policer_id>``: Id of the policer configuration section (0..31).

- ``<token_unit>``: Policer token unit (`bytes` or `packets`).

- ``<color_mode>``: Policer color mode (`aware` or `blind`).

- ``<cir>``: Committed information rate in unit of kilo bits per second (data rate) or packets per second.

- ``<cbs>``: Committed burst size in unit of kilo bytes or number of packets.

- ``<ebs>``: Excess burst size in unit of kilo bytes or number of packets.

- ``<default_color>``: Default color for specific tc.

- ``<rate_limit_enable>``: Enables per port or per txq rate limiting (`0`/`1` to disable/enable).

- ``<rate_limit>``: Committed information rate, in kilo bits per second.

- ``<burst_size>``: Committed burst size, in kilo bytes.

- ``<sched_mode>``: Egress scheduler mode (`wrr` or `sp`).

- ``<wrr_weight>``: Txq weight.

Setting PCP/DSCP values for the default TC is not required. All PCP/DSCP
values not assigned explicitly to particular TC will be handled by the
default TC.

Configuration file example
^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: console

   [policer 0]
   token_unit = bytes
   color = blind
   cir = 100000
   ebs = 64
   cbs = 64

   [port 0 default]
   default_tc = 0
   mapping_priority = ip

   rate_limit_enable = 1
   rate_limit = 1000
   burst_size = 2000

   [port 0 tc 0]
   rxq = 0 1

   [port 0 txq 0]
   sched_mode = wrr
   wrr_weight = 10

   [port 0 txq 1]
   sched_mode = wrr
   wrr_weight = 100

   [port 0 txq 2]
   sched_mode = sp

   [port 0 tc 1]
   rxq = 2
   pcp = 5 6 7
   dscp = 26-38

   [port 1 default]
   default_tc = 0
   mapping_priority = vlan/ip

   default_policer = 0

   [port 1 tc 0]
   rxq = 0
   dscp = 10

   [port 1 tc 1]
   rxq = 1
   dscp = 11-20

   [port 1 tc 2]
   rxq = 2
   dscp = 30

   [port 1 txq 0]
   rate_limit_enable = 1
   rate_limit = 10000
   burst_size = 2000

Usage example
^^^^^^^^^^^^^

.. code-block:: console

   ./testpmd --vdev=eth_mvpp2,iface=eth0,iface=eth2,cfg=/home/user/mrvl.conf \
     -c 7 -- -i -a --disable-hw-vlan-strip --rxq=3 --txq=3

.. _flowapi:

Flow API
--------

PPv2 offers packet classification capabilities via classifier engine which
can be configured via generic flow API offered by DPDK.
For an additional description please refer to DPDK :ref:`Generic flow API <Generic_flow_API>`.

Supported flow actions
~~~~~~~~~~~~~~~~~~~~~~

Following flow action items are supported by the driver:

* DROP
* QUEUE

Supported flow items
~~~~~~~~~~~~~~~~~~~~

Following flow items and their respective fields are supported by the driver:

* ETH

  * source MAC
  * destination MAC
  * ethertype

* VLAN

  * PCP
  * VID

* IPV4

  * DSCP
  * protocol
  * source address
  * destination address

* IPV6

  * flow label
  * next header
  * source address
  * destination address

* UDP

  * source port
  * destination port

* TCP

  * source port
  * destination port

Classifier match engine
~~~~~~~~~~~~~~~~~~~~~~~

Classifier has an internal match engine which can be configured to
operate in either exact or maskable mode.

Mode is selected upon creation of the first unique flow rule as follows:

* maskable, if key size is up to 8 bytes.
* exact, otherwise, i.e for keys bigger than 8 bytes.

Where the key size equals the number of bytes of all fields specified
in the flow items.

.. table:: Examples of key size calculation

   +----------------------------------------------------------------------------+-------------------+-------------+
   | Flow pattern                                                               | Key size in bytes | Used engine |
   +============================================================================+===================+=============+
   | ETH (destination MAC) / VLAN (VID)                                         | 6 + 2 = 8         | Maskable    |
   +----------------------------------------------------------------------------+-------------------+-------------+
   | VLAN (VID) / IPV4 (source address)                                         | 2 + 4 = 6         | Maskable    |
   +----------------------------------------------------------------------------+-------------------+-------------+
   | TCP (source port, destination port)                                        | 2 + 2 = 4         | Maskable    |
   +----------------------------------------------------------------------------+-------------------+-------------+
   | VLAN (priority) / IPV4 (source address)                                    | 1 + 4 = 5         | Maskable    |
   +----------------------------------------------------------------------------+-------------------+-------------+
   | IPV4 (destination address) / UDP (source port, destination port)           | 6 + 2 + 2 = 10    | Exact       |
   +----------------------------------------------------------------------------+-------------------+-------------+
   | VLAN (VID) / IPV6 (flow label, destination address)                        | 2 + 3 + 16 = 21   | Exact       |
   +----------------------------------------------------------------------------+-------------------+-------------+
   | IPV4 (DSCP, source address, destination address)                           | 1 + 4 + 4 = 9     | Exact       |
   +----------------------------------------------------------------------------+-------------------+-------------+
   | IPV6 (flow label, source address, destination address)                     | 3 + 16 + 16 = 35  | Exact       |
   +----------------------------------------------------------------------------+-------------------+-------------+

From the user perspective maskable mode means that masks specified
via flow rules are respected. In case of exact match mode, masks
which do not provide exact matching (all bits masked) are ignored.

If the flow matches more than one classifier rule the first
(with the lowest index) matched takes precedence.

Flow rules usage example
~~~~~~~~~~~~~~~~~~~~~~~~

Before proceeding run testpmd user application:

.. code-block:: console

   ./testpmd --vdev=eth_mvpp2,iface=eth0,iface=eth2 -c 3 -- -i --p 3 -a --disable-hw-vlan-strip

Example #1
^^^^^^^^^^

.. code-block:: console

   testpmd> flow create 0 ingress pattern eth src is 10:11:12:13:14:15 / end actions drop / end

In this case key size is 6 bytes thus maskable type is selected. Testpmd
will set mask to ff:ff:ff:ff:ff:ff i.e traffic explicitly matching
above rule will be dropped.

Example #2
^^^^^^^^^^

.. code-block:: console

   testpmd> flow create 0 ingress pattern ipv4 src spec 10.10.10.0 src mask 255.255.255.0 / tcp src spec 0x10 src mask 0x10 / end action drop / end

In this case key size is 8 bytes thus maskable type is selected.
Flows which have IPv4 source addresses ranging from 10.10.10.0 to 10.10.10.255
and tcp source port set to 16 will be dropped.

Example #3
^^^^^^^^^^

.. code-block:: console

   testpmd> flow create 0 ingress pattern vlan vid spec 0x10 vid mask 0x10 / ipv4 src spec 10.10.1.1 src mask 255.255.0.0 dst spec 11.11.11.1 dst mask 255.255.255.0 / end actions drop / end

In this case key size is 10 bytes thus exact type is selected.
Even though each item has partial mask set, masks will be ignored.
As a result only flows with VID set to 16 and IPv4 source and destination
addresses set to 10.10.1.1 and 11.11.11.1 respectively will be dropped.

Limitations
~~~~~~~~~~~

Following limitations need to be taken into account while creating flow rules:

* For IPv4 exact match type the key size must be up to 12 bytes.
* For IPv6 exact match type the key size must be up to 36 bytes.
* Following fields cannot be partially masked (all masks are treated as
  if they were exact):

  * ETH: ethertype
  * VLAN: PCP, VID
  * IPv4: protocol
  * IPv6: next header
  * TCP/UDP: source port, destination port

* Only one classifier table can be created thus all rules in the table
  have to match table format. Table format is set during creation of
  the first unique flow rule.
* Up to 5 fields can be specified per flow rule.
* Up to 20 flow rules can be added.

For additional information about classifier please consult
``doc/musdk_cls_user_guide.txt``.

.. _mtrapi:

Traffic metering and policing
-----------------------------

MVPP2 PMD supports DPDK traffic metering and policing that allows the following:

1. Meter ingress traffic.
2. Do policing.
3. Gather statistics.

For an additional description please refer to DPDK :doc:`Traffic Metering and Policing API <../prog_guide/traffic_metering_and_policing>`.

The policer objects defined by this feature can work with the default policer defined via config file as described in :ref:`QoS Support <qossupport>`.

Limitations
~~~~~~~~~~~

The following capabilities are not supported:

- MTR object meter DSCP table update
- MTR object policer action update
- MTR object enabled statistics

Usage example
~~~~~~~~~~~~~

1. Run testpmd user app:

   .. code-block:: console

		./testpmd --vdev=eth_mvpp2,iface=eth0,iface=eth2 -c 6 -- -i -p 3 -a --txd 1024 --rxd 1024

2. Create meter profile:

   .. code-block:: console

		testpmd> add port meter profile 0 0 srtcm_rfc2697 2000 256 256

3. Create meter:

   .. code-block:: console

		testpmd> create port meter 0 0 0 yes d d d 0 1 0

4. Create flow rule witch meter attached:

   .. code-block:: console

		testpmd> flow create 0 ingress pattern ipv4 src is 10.10.10.1 / end actions meter mtr_id 0 / end

For a detailed usage description please refer to "Traffic Metering and Policing" section in DPDK :doc:`Testpmd Runtime Functions <../testpmd_app_ug/testpmd_funcs>`.



.. _tmapi:

Traffic Management API
----------------------

MVPP2 PMD supports generic DPDK Traffic Management API which allows to
configure the following features:

1. Hierarchical scheduling
2. Traffic shaping
3. Congestion management
4. Packet marking

Internally TM is represented by a hierarchy (tree) of nodes.
Node which has a parent is called a leaf whereas node without
parent is called a non-leaf (root).
MVPP2 PMD supports two level hierarchy where level 0 represents ports and level 1 represents tx queues of a given port.

.. figure:: img/mvpp2_tm.svg

Nodes hold following types of settings:

- for egress scheduler configuration: weight
- for egress rate limiter: private shaper
- bitmask indicating which statistics counters will be read

Hierarchy is always constructed from the top, i.e first a root node is added
then some number of leaf nodes. Number of leaf nodes cannot exceed number
of configured tx queues.

After hierarchy is complete it can be committed.


For an additional description please refer to DPDK :doc:`Traffic Management API <../prog_guide/traffic_management>`.

Limitations
~~~~~~~~~~~

The following capabilities are not supported:

- Traffic manager WRED profile and WRED context
- Traffic manager shared shaper update
- Traffic manager packet marking
- Maximum number of levels in hierarchy is 2
- Currently dynamic change of a hierarchy is not supported

Usage example
~~~~~~~~~~~~~

For a detailed usage description please refer to "Traffic Management" section in DPDK :doc:`Testpmd Runtime Functions <../testpmd_app_ug/testpmd_funcs>`.

1. Run testpmd as follows:

   .. code-block:: console

		./testpmd --vdev=net_mrvl,iface=eth0,iface=eth2,cfg=./qos_config -c 7 -- \
		-i -p 3 --disable-hw-vlan-strip --rxq 3 --txq 3 --txd 1024 --rxd 1024

2. Stop all ports:

   .. code-block:: console

		testpmd> port stop all

3. Add shaper profile:

   .. code-block:: console

		testpmd> add port tm node shaper profile 0 0 900000 70000 0

   Parameters have following meaning::

		0       - Id of a port.
		0       - Id of a new shaper profile.
		900000  - Shaper rate in bytes/s.
		70000   - Bucket size in bytes.
		0       - Packet length adjustment - ignored.

4. Add non-leaf node for port 0:

   .. code-block:: console

		testpmd> add port tm nonleaf node 0 3 -1 0 0 0 0 0 1 3 0

   Parameters have following meaning::

		 0  - Id of a port
		 3  - Id of a new node.
		-1  - Indicate that root does not have a parent.
		 0  - Priority of the node.
		 0  - Weight of the node.
		 0  - Id of a level. Since this is a root 0 is passed.
		 0  - Id of the shaper profile.
		 0  - Number of SP priorities.
		 3  - Enable statistics for both number of transmitted packets and bytes.
		 0  - Number of shared shapers.

5. Add leaf node for tx queue 0:

   .. code-block:: console

		testpmd> add port tm leaf node 0 0 3 0 30 1 -1 0 0 1 0

   Parameters have following meaning::

		 0  - Id of a port.
		 0  - Id of a new node.
		 3  - Id of the parent node.
		 0  - Priority of a node.
		 30 - WRR weight.
		 1  - Id of a level. Since this is a leaf node 1 is passed.
		-1  - Id of a shaper. -1 indicates that shaper is not attached.
		 0  - Congestion management is not supported.
		 0  - Congestion management is not supported.
		 1  - Enable statistics counter for number of transmitted packets.
		 0  - Number of shared shapers.

6. Add leaf node for tx queue 1:

   .. code-block:: console

	testpmd> add port tm leaf node 0 1 3 0 60 1 -1 0 0 1 0

   Parameters have following meaning::

		 0  - Id of a port.
		 1  - Id of a new node.
		 3  - Id of the parent node.
		 0  - Priority of a node.
		 60 - WRR weight.
		 1  - Id of a level. Since this is a leaf node 1 is passed.
		-1  - Id of a shaper. -1 indicates that shaper is not attached.
		 0  - Congestion management is not supported.
		 0  - Congestion management is not supported.
		 1  - Enable statistics counter for number of transmitted packets.
		 0  - Number of shared shapers.

7. Add leaf node for tx queue 2:

   .. code-block:: console

		testpmd> add port tm leaf node 0 2 3 0 99 1 -1 0 0 1 0

   Parameters have following meaning::

		 0  - Id of a port.
		 2  - Id of a new node.
		 3  - Id of the parent node.
		 0  - Priority of a node.
		 99 - WRR weight.
		 1  - Id of a level. Since this is a leaf node 1 is passed.
		-1  - Id of a shaper. -1 indicates that shaper is not attached.
		 0  - Congestion management is not supported.
		 0  - Congestion management is not supported.
		 1  - Enable statistics counter for number of transmitted packets.
		 0  - Number of shared shapers.

8. Commit hierarchy:

   .. code-block:: console

		testpmd> port tm hierarchy commit 0 no

  Parameters have following meaning::

		0  - Id of a port.
		no - Do not flush TM hierarchy if commit fails.

9. Start all ports

   .. code-block:: console

		testpmd> port start all



10. Enable forwarding

   .. code-block:: console

		testpmd> start