1 .. SPDX-License-Identifier: BSD-3-Clause
2 Copyright(c) 2017 Marvell International Ltd.
3 Copyright(c) 2017 Semihalf.
5 .. _mvpp2_poll_mode_driver:
10 The MVPP2 PMD (**librte_net_mvpp2**) provides poll mode driver support
11 for the Marvell PPv2 (Packet Processor v2) 1/10 Gbps adapter.
13 Detailed information about SoCs that use PPv2 can be obtained here:
15 * https://www.marvell.com/embedded-processors/armada-70xx/
16 * https://www.marvell.com/embedded-processors/armada-80xx/
22 Features of the MVPP2 PMD are:
32 - Multicast MAC filter
40 - :ref:`Extended stats <extstats>`
43 - :ref:`QoS <extconf>`
44 - :ref:`Flow API <flowapi>`
45 - :ref:`Traffic metering and policing <mtrapi>`
46 - :ref:`Traffic Management API <tmapi>`
51 - Number of lcores is limited to 9 by MUSDK internal design. If more lcores
52 need to be allocated, locking will have to be considered. Number of available
53 lcores can be changed via ``MRVL_MUSDK_HIFS_RESERVED`` define in
54 ``mrvl_ethdev.c`` source file.
56 - Flushing vlans added for filtering is not possible due to MUSDK missing
57 functionality. Current workaround is to reset board so that PPv2 has a
58 chance to start in a sane state.
60 - MUSDK architecture does not support changing configuration in run time.
61 All necessary configurations should be done before first dev_start().
63 - RX queue start/stop is not supported.
65 - Current implementation does not support replacement of buffers in the HW buffer pool
66 at run time, so it is responsibility of the application to ensure that MTU does not exceed the configured buffer size.
68 - Configuring TX flow control currently is not supported.
70 - In current implementation, mechanism for acknowledging transmitted packets (``tx_done_cleanup``) is not supported.
72 - Running more than one DPDK-MUSDK application simultaneously is not supported.
78 - Custom Linux Kernel sources
80 .. code-block:: console
82 git clone https://github.com/MarvellEmbeddedProcessors/linux-marvell.git -b linux-4.4.120-armada-18.09
84 - Out of tree `mvpp2x_sysfs` kernel module sources
86 .. code-block:: console
88 git clone https://github.com/MarvellEmbeddedProcessors/mvpp2x-marvell.git -b mvpp2x-armada-18.09
90 - MUSDK (Marvell User-Space SDK) sources
92 .. code-block:: console
94 git clone https://github.com/MarvellEmbeddedProcessors/musdk-marvell.git -b musdk-release-SDK-10.3.5.0-PR2
96 MUSDK is a light-weight library that provides direct access to Marvell's
97 PPv2 (Packet Processor v2). Alternatively prebuilt MUSDK library can be
98 requested from `Marvell Extranet <https://extranet.marvell.com>`_. Once
99 approval has been granted, library can be found by typing ``musdk`` in
102 To get better understanding of the library one can consult documentation
103 available in the ``doc`` top level directory of the MUSDK sources.
107 Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup
114 Driver needs precompiled MUSDK library during compilation.
116 .. code-block:: console
118 export CROSS_COMPILE=<toolchain>/bin/aarch64-linux-gnu-
120 ./configure --host=aarch64-linux-gnu
123 MUSDK will be installed to `usr/local` under current directory.
124 For the detailed build instructions please consult ``doc/musdk_get_started.txt``.
130 Add path to libmusdk.pc in PKG_CONFIG_PATH environment variable.
132 .. code-block:: console
134 export PKG_CONFIG_PATH=$<musdk_install_dir>/lib/pkgconfig/:$PKG_CONFIG_PATH
136 meson build --cross-file config/arm/arm64_armada_linux_gcc
143 MVPP2 PMD requires extra out of tree kernel modules to function properly.
144 `musdk_cma` sources are part of the MUSDK. Please consult
145 ``doc/musdk_get_started.txt`` for the detailed build instructions.
146 For `mvpp2x_sysfs` please consult ``Documentation/pp22_sysfs.txt`` for the
147 detailed build instructions.
149 .. code-block:: console
152 insmod mvpp2x_sysfs.ko
154 Additionally interfaces used by DPDK application need to be put up:
156 .. code-block:: console
161 In order to run testpmd example application following command can be used:
163 .. code-block:: console
165 ./dpdk-testpmd --vdev=eth_mvpp2,iface=eth0,iface=eth2 -c 7 -- \
166 --burst=128 --txd=2048 --rxd=1024 --rxq=2 --txq=2 --nb-cores=2 \
174 MVPP2 PMD supports the following extended statistics:
176 - ``rx_bytes``: number of RX bytes
177 - ``rx_packets``: number of RX packets
178 - ``rx_unicast_packets``: number of RX unicast packets
179 - ``rx_errors``: number of RX MAC errors
180 - ``rx_fullq_dropped``: number of RX packets dropped due to full RX queue
181 - ``rx_bm_dropped``: number of RX packets dropped due to no available buffers in the HW pool
182 - ``rx_early_dropped``: number of RX packets that were early dropped
183 - ``rx_fifo_dropped``: number of RX packets dropped due to RX fifo overrun
184 - ``rx_cls_dropped``: number of RX packets dropped by classifier
185 - ``tx_bytes``: number of TX bytes
186 - ``tx_packets``: number of TX packets
187 - ``tx_unicast_packets``: number of TX unicast packets
188 - ``tx_errors``: number of TX MAC errors
193 External Configuration
194 ----------------------
196 Several driver configuration (e.g. QoS) can be done through external configuration file. Path to the
197 file must be given as `cfg` in driver's vdev parameter list.
202 .. code-block:: console
204 [policer <policer_id>]
205 token_unit = <token_unit>
211 [parser udf <udf_id>]
218 [port <portnum> default]
219 start_hdr = <start_hdr>
220 default_tc = <default_tc>
221 mapping_priority = <mapping_priority>
223 rate_limit_enable = <rate_limit_enable>
224 rate_limit = <rate_limit>
225 burst_size = <burst_size>
227 default_policer = <policer_id>
229 [port <portnum> tc <traffic_class>]
230 rxq = <rx_queue_list>
233 default_color = <default_color>
235 [port <portnum> tc <traffic_class>]
236 rxq = <rx_queue_list>
240 [port <portnum> txq <txqnum>]
241 sched_mode = <sched_mode>
242 wrr_weight = <wrr_weight>
244 rate_limit_enable = <rate_limit_enable>
245 rate_limit = <rate_limit>
246 burst_size = <burst_size>
250 - ``<udf_id>``: Logical UDF id.
252 - ``<proto>``: Indicate the preceding hdr before the UDF header (`eth` or `udp`).
254 - ``<field>``: Indicate the field of the <proto> hdr (`type` (eth) or `dport` (udp).
256 - ``<key>``: UDF key in string format starting with '0x'.
258 - ``<mask>``: UDF mask in string format starting with '0x'.
260 - ``<offset>``: Starting UDF offset from the <proto> hdr.
262 - ``<portnum>``: DPDK Port number (0..n).
264 - ``<start_hdr>``: Indicate what is the start header mode (`none` (eth), `dsa`, or `ext_dsa`).
266 - ``<default_tc>``: Default traffic class (e.g. 0)
268 - ``<mapping_priority>``: QoS priority for mapping (`ip`, `vlan`, `ip/vlan` or `vlan/ip`).
270 - ``<traffic_class>``: Traffic Class to be configured.
272 - ``<rx_queue_list>``: List of DPDK RX queues (e.g. 0 1 3-4)
274 - ``<pcp_list>``: List of PCP values to handle in particular TC (e.g. 0 1 3-4 7).
276 - ``<dscp_list>``: List of DSCP values to handle in particular TC (e.g. 0-12 32-48 63).
278 - ``<default_policer>``: Id of the policer configuration section to be used as default.
280 - ``<policer_id>``: Id of the policer configuration section (0..31).
282 - ``<token_unit>``: Policer token unit (`bytes` or `packets`).
284 - ``<color_mode>``: Policer color mode (`aware` or `blind`).
286 - ``<cir>``: Committed information rate in unit of kilo bits per second (data rate) or packets per second.
288 - ``<cbs>``: Committed burst size in unit of kilo bytes or number of packets.
290 - ``<ebs>``: Excess burst size in unit of kilo bytes or number of packets.
292 - ``<default_color>``: Default color for specific tc.
294 - ``<rate_limit_enable>``: Enables per port or per txq rate limiting (`0`/`1` to disable/enable).
296 - ``<rate_limit>``: Committed information rate, in kilo bits per second.
298 - ``<burst_size>``: Committed burst size, in kilo bytes.
300 - ``<sched_mode>``: Egress scheduler mode (`wrr` or `sp`).
302 - ``<wrr_weight>``: Txq weight.
304 Setting PCP/DSCP values for the default TC is not required. All PCP/DSCP
305 values not assigned explicitly to particular TC will be handled by the
308 Configuration file example
309 ^^^^^^^^^^^^^^^^^^^^^^^^^^
311 .. code-block:: console
322 mapping_priority = ip
324 rate_limit_enable = 1
349 mapping_priority = vlan/ip
366 rate_limit_enable = 1
370 Configuration file example with UDF
371 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
373 .. code-block:: console
385 .. code-block:: console
387 ./dpdk-testpmd --vdev=eth_mvpp2,iface=eth0,iface=eth2,cfg=/home/user/mrvl.conf \
388 -c 7 -- -i -a --disable-hw-vlan-strip --rxq=3 --txq=3
395 PPv2 offers packet classification capabilities via classifier engine which
396 can be configured via generic flow API offered by DPDK.
398 The :ref:`flow_isolated_mode` is supported.
400 For an additional description please refer to DPDK :doc:`../prog_guide/rte_flow`.
402 Supported flow actions
403 ~~~~~~~~~~~~~~~~~~~~~~
405 Following flow action items are supported by the driver:
414 Following flow items and their respective fields are supported by the driver:
432 * destination address
439 * destination address
451 Classifier match engine
452 ~~~~~~~~~~~~~~~~~~~~~~~
454 Classifier has an internal match engine which can be configured to
455 operate in either exact or maskable mode.
457 Mode is selected upon creation of the first unique flow rule as follows:
459 * maskable, if key size is up to 8 bytes.
460 * exact, otherwise, i.e for keys bigger than 8 bytes.
462 Where the key size equals the number of bytes of all fields specified
465 .. table:: Examples of key size calculation
467 +----------------------------------------------------------------------------+-------------------+-------------+
468 | Flow pattern | Key size in bytes | Used engine |
469 +============================================================================+===================+=============+
470 | ETH (destination MAC) / VLAN (VID) | 6 + 2 = 8 | Maskable |
471 +----------------------------------------------------------------------------+-------------------+-------------+
472 | VLAN (VID) / IPV4 (source address) | 2 + 4 = 6 | Maskable |
473 +----------------------------------------------------------------------------+-------------------+-------------+
474 | TCP (source port, destination port) | 2 + 2 = 4 | Maskable |
475 +----------------------------------------------------------------------------+-------------------+-------------+
476 | VLAN (priority) / IPV4 (source address) | 1 + 4 = 5 | Maskable |
477 +----------------------------------------------------------------------------+-------------------+-------------+
478 | IPV4 (destination address) / UDP (source port, destination port) | 6 + 2 + 2 = 10 | Exact |
479 +----------------------------------------------------------------------------+-------------------+-------------+
480 | VLAN (VID) / IPV6 (flow label, destination address) | 2 + 3 + 16 = 21 | Exact |
481 +----------------------------------------------------------------------------+-------------------+-------------+
482 | IPV4 (DSCP, source address, destination address) | 1 + 4 + 4 = 9 | Exact |
483 +----------------------------------------------------------------------------+-------------------+-------------+
484 | IPV6 (flow label, source address, destination address) | 3 + 16 + 16 = 35 | Exact |
485 +----------------------------------------------------------------------------+-------------------+-------------+
487 From the user perspective maskable mode means that masks specified
488 via flow rules are respected. In case of exact match mode, masks
489 which do not provide exact matching (all bits masked) are ignored.
491 If the flow matches more than one classifier rule the first
492 (with the lowest index) matched takes precedence.
494 Flow rules usage example
495 ~~~~~~~~~~~~~~~~~~~~~~~~
497 Before proceeding run testpmd user application:
499 .. code-block:: console
501 ./dpdk-testpmd --vdev=eth_mvpp2,iface=eth0,iface=eth2 -c 3 -- -i --p 3 -a --disable-hw-vlan-strip
506 .. code-block:: console
508 testpmd> flow create 0 ingress pattern eth src is 10:11:12:13:14:15 / end actions drop / end
510 In this case key size is 6 bytes thus maskable type is selected. Testpmd
511 will set mask to ff:ff:ff:ff:ff:ff i.e traffic explicitly matching
512 above rule will be dropped.
517 .. code-block:: console
519 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
521 In this case key size is 8 bytes thus maskable type is selected.
522 Flows which have IPv4 source addresses ranging from 10.10.10.0 to 10.10.10.255
523 and tcp source port set to 16 will be dropped.
528 .. code-block:: console
530 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
532 In this case key size is 10 bytes thus exact type is selected.
533 Even though each item has partial mask set, masks will be ignored.
534 As a result only flows with VID set to 16 and IPv4 source and destination
535 addresses set to 10.10.1.1 and 11.11.11.1 respectively will be dropped.
540 Following limitations need to be taken into account while creating flow rules:
542 * For IPv4 exact match type the key size must be up to 12 bytes.
543 * For IPv6 exact match type the key size must be up to 36 bytes.
544 * Following fields cannot be partially masked (all masks are treated as
551 * TCP/UDP: source port, destination port
553 * Only one classifier table can be created thus all rules in the table
554 have to match table format. Table format is set during creation of
555 the first unique flow rule.
556 * Up to 5 fields can be specified per flow rule.
557 * Up to 20 flow rules can be added.
559 For additional information about classifier please consult
560 ``doc/musdk_cls_user_guide.txt``.
564 Traffic metering and policing
565 -----------------------------
567 MVPP2 PMD supports DPDK traffic metering and policing that allows the following:
569 1. Meter ingress traffic.
571 3. Gather statistics.
573 For an additional description please refer to DPDK :doc:`Traffic Metering and Policing API <../prog_guide/traffic_metering_and_policing>`.
575 The policer objects defined by this feature can work with the default policer defined via config file as described in :ref:`QoS Support <extconf>`.
580 The following capabilities are not supported:
582 - MTR object meter DSCP table update
583 - MTR object policer action update
584 - MTR object enabled statistics
589 1. Run testpmd user app:
591 .. code-block:: console
593 ./dpdk-testpmd --vdev=eth_mvpp2,iface=eth0,iface=eth2 -c 6 -- -i -p 3 -a --txd 1024 --rxd 1024
595 2. Create meter profile:
597 .. code-block:: console
599 testpmd> add port meter profile 0 0 srtcm_rfc2697 2000 256 256
603 .. code-block:: console
605 testpmd> create port meter 0 0 0 yes d d d 0 1 0
607 4. Create flow rule witch meter attached:
609 .. code-block:: console
611 testpmd> flow create 0 ingress pattern ipv4 src is 10.10.10.1 / end actions meter mtr_id 0 / end
613 For a detailed usage description please refer to "Traffic Metering and Policing" section in DPDK :doc:`Testpmd Runtime Functions <../testpmd_app_ug/testpmd_funcs>`.
619 Traffic Management API
620 ----------------------
622 MVPP2 PMD supports generic DPDK Traffic Management API which allows to
623 configure the following features:
625 1. Hierarchical scheduling
627 3. Congestion management
630 Internally TM is represented by a hierarchy (tree) of nodes.
631 Node which has a parent is called a leaf whereas node without
632 parent is called a non-leaf (root).
633 MVPP2 PMD supports two level hierarchy where level 0 represents ports and level 1 represents tx queues of a given port.
635 .. figure:: img/mvpp2_tm.*
637 Nodes hold following types of settings:
639 - for egress scheduler configuration: weight
640 - for egress rate limiter: private shaper
641 - bitmask indicating which statistics counters will be read
643 Hierarchy is always constructed from the top, i.e first a root node is added
644 then some number of leaf nodes. Number of leaf nodes cannot exceed number
645 of configured tx queues.
647 After hierarchy is complete it can be committed.
650 For an additional description please refer to DPDK :doc:`Traffic Management API <../prog_guide/traffic_management>`.
655 The following capabilities are not supported:
657 - Traffic manager WRED profile and WRED context
658 - Traffic manager shared shaper update
659 - Traffic manager packet marking
660 - Maximum number of levels in hierarchy is 2
661 - Currently dynamic change of a hierarchy is not supported
666 For a detailed usage description please refer to "Traffic Management" section in DPDK :doc:`Testpmd Runtime Functions <../testpmd_app_ug/testpmd_funcs>`.
668 1. Run testpmd as follows:
670 .. code-block:: console
672 ./dpdk-testpmd --vdev=net_mrvl,iface=eth0,iface=eth2,cfg=./qos_config -c 7 -- \
673 -i -p 3 --disable-hw-vlan-strip --rxq 3 --txq 3 --txd 1024 --rxd 1024
677 .. code-block:: console
679 testpmd> port stop all
681 3. Add shaper profile:
683 .. code-block:: console
685 testpmd> add port tm node shaper profile 0 0 900000 70000 0
687 Parameters have following meaning::
690 0 - Id of a new shaper profile.
691 900000 - Shaper rate in bytes/s.
692 70000 - Bucket size in bytes.
693 0 - Packet length adjustment - ignored.
695 4. Add non-leaf node for port 0:
697 .. code-block:: console
699 testpmd> add port tm nonleaf node 0 3 -1 0 0 0 0 0 1 3 0
701 Parameters have following meaning::
704 3 - Id of a new node.
705 -1 - Indicate that root does not have a parent.
706 0 - Priority of the node.
707 0 - Weight of the node.
708 0 - Id of a level. Since this is a root 0 is passed.
709 0 - Id of the shaper profile.
710 0 - Number of SP priorities.
711 3 - Enable statistics for both number of transmitted packets and bytes.
712 0 - Number of shared shapers.
714 5. Add leaf node for tx queue 0:
716 .. code-block:: console
718 testpmd> add port tm leaf node 0 0 3 0 30 1 -1 0 0 1 0
720 Parameters have following meaning::
723 0 - Id of a new node.
724 3 - Id of the parent node.
725 0 - Priority of a node.
727 1 - Id of a level. Since this is a leaf node 1 is passed.
728 -1 - Id of a shaper. -1 indicates that shaper is not attached.
729 0 - Congestion management is not supported.
730 0 - Congestion management is not supported.
731 1 - Enable statistics counter for number of transmitted packets.
732 0 - Number of shared shapers.
734 6. Add leaf node for tx queue 1:
736 .. code-block:: console
738 testpmd> add port tm leaf node 0 1 3 0 60 1 -1 0 0 1 0
740 Parameters have following meaning::
743 1 - Id of a new node.
744 3 - Id of the parent node.
745 0 - Priority of a node.
747 1 - Id of a level. Since this is a leaf node 1 is passed.
748 -1 - Id of a shaper. -1 indicates that shaper is not attached.
749 0 - Congestion management is not supported.
750 0 - Congestion management is not supported.
751 1 - Enable statistics counter for number of transmitted packets.
752 0 - Number of shared shapers.
754 7. Add leaf node for tx queue 2:
756 .. code-block:: console
758 testpmd> add port tm leaf node 0 2 3 0 99 1 -1 0 0 1 0
760 Parameters have following meaning::
763 2 - Id of a new node.
764 3 - Id of the parent node.
765 0 - Priority of a node.
767 1 - Id of a level. Since this is a leaf node 1 is passed.
768 -1 - Id of a shaper. -1 indicates that shaper is not attached.
769 0 - Congestion management is not supported.
770 0 - Congestion management is not supported.
771 1 - Enable statistics counter for number of transmitted packets.
772 0 - Number of shared shapers.
776 .. code-block:: console
778 testpmd> port tm hierarchy commit 0 no
780 Parameters have following meaning::
783 no - Do not flush TM hierarchy if commit fails.
787 .. code-block:: console
789 testpmd> port start all
793 10. Enable forwarding
795 .. code-block:: console