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_pmd_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/
20 Due to external dependencies, this driver is disabled by default. It must
21 be enabled manually by setting relevant configuration option manually.
22 Please refer to `Config File Options`_ section for further details.
28 Features of the MVPP2 PMD are:
38 - Multicast MAC filter
46 - :ref:`Extended stats <extstats>`
49 - :ref:`QoS <qossupport>`
50 - :ref:`Flow API <flowapi>`
51 - :ref:`Traffic metering and policing <mtrapi>`
52 - :ref:`Traffic Management API <tmapi>`
57 - Number of lcores is limited to 9 by MUSDK internal design. If more lcores
58 need to be allocated, locking will have to be considered. Number of available
59 lcores can be changed via ``MRVL_MUSDK_HIFS_RESERVED`` define in
60 ``mrvl_ethdev.c`` source file.
62 - Flushing vlans added for filtering is not possible due to MUSDK missing
63 functionality. Current workaround is to reset board so that PPv2 has a
64 chance to start in a sane state.
66 - MUSDK architecture does not support changing configuration in run time.
67 All necessary configurations should be done before first dev_start().
69 - RX queue start/stop is not supported.
71 - Current implementation does not support replacement of buffers in the HW buffer pool
72 at run time, so it is responsibility of the application to ensure that MTU does not exceed the configured buffer size.
74 - Configuring TX flow control currently is not supported.
76 - In current implementation, mechanism for acknowledging transmitted packets (``tx_done_cleanup``) is not supported.
78 - Running more than one DPDK-MUSDK application simultaneously is not supported.
84 - Custom Linux Kernel sources
86 .. code-block:: console
88 git clone https://github.com/MarvellEmbeddedProcessors/linux-marvell.git -b linux-4.4.120-armada-18.09
90 - Out of tree `mvpp2x_sysfs` kernel module sources
92 .. code-block:: console
94 git clone https://github.com/MarvellEmbeddedProcessors/mvpp2x-marvell.git -b mvpp2x-armada-18.09
96 - MUSDK (Marvell User-Space SDK) sources
98 .. code-block:: console
100 git clone https://github.com/MarvellEmbeddedProcessors/musdk-marvell.git -b musdk-armada-18.09
102 MUSDK is a light-weight library that provides direct access to Marvell's
103 PPv2 (Packet Processor v2). Alternatively prebuilt MUSDK library can be
104 requested from `Marvell Extranet <https://extranet.marvell.com>`_. Once
105 approval has been granted, library can be found by typing ``musdk`` in
108 To get better understanding of the library one can consult documentation
109 available in the ``doc`` top level directory of the MUSDK sources.
113 Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup
120 The following options can be modified in the ``config`` file.
122 - ``CONFIG_RTE_LIBRTE_MVPP2_PMD`` (default ``n``)
124 Toggle compilation of the librte mvpp2 driver.
128 When MVPP2 PMD is enabled ``CONFIG_RTE_LIBRTE_MVNETA_PMD`` must be disabled
134 Driver needs precompiled MUSDK library during compilation.
136 .. code-block:: console
138 export CROSS_COMPILE=<toolchain>/bin/aarch64-linux-gnu-
140 ./configure --host=aarch64-linux-gnu
143 MUSDK will be installed to `usr/local` under current directory.
144 For the detailed build instructions please consult ``doc/musdk_get_started.txt``.
146 Before the DPDK build process the environmental variable ``LIBMUSDK_PATH`` with
147 the path to the MUSDK installation directory needs to be exported.
149 For additional instructions regarding DPDK cross compilation please refer to :doc:`Cross compile DPDK for ARM64 <../linux_gsg/cross_build_dpdk_for_arm64>`.
151 .. code-block:: console
153 export LIBMUSDK_PATH=<musdk>/usr/local
154 export CROSS=<toolchain>/bin/aarch64-linux-gnu-
155 export RTE_KERNELDIR=<kernel-dir>
156 export RTE_TARGET=arm64-armv8a-linux-gcc
158 make config T=arm64-armv8a-linux-gcc
159 sed -i "s/MVNETA_PMD=y/MVNETA_PMD=n/" build/.config
160 sed -i "s/MVPP2_PMD=n/MVPP2_PMD=y/" build/.config
166 MVPP2 PMD requires extra out of tree kernel modules to function properly.
167 `musdk_cma` sources are part of the MUSDK. Please consult
168 ``doc/musdk_get_started.txt`` for the detailed build instructions.
169 For `mvpp2x_sysfs` please consult ``Documentation/pp22_sysfs.txt`` for the
170 detailed build instructions.
172 .. code-block:: console
175 insmod mvpp2x_sysfs.ko
177 Additionally interfaces used by DPDK application need to be put up:
179 .. code-block:: console
184 In order to run testpmd example application following command can be used:
186 .. code-block:: console
188 ./testpmd --vdev=eth_mvpp2,iface=eth0,iface=eth2 -c 7 -- \
189 --burst=128 --txd=2048 --rxd=1024 --rxq=2 --txq=2 --nb-cores=2 \
197 MVPP2 PMD supports the following extended statistics:
199 - ``rx_bytes``: number of RX bytes
200 - ``rx_packets``: number of RX packets
201 - ``rx_unicast_packets``: number of RX unicast packets
202 - ``rx_errors``: number of RX MAC errors
203 - ``rx_fullq_dropped``: number of RX packets dropped due to full RX queue
204 - ``rx_bm_dropped``: number of RX packets dropped due to no available buffers in the HW pool
205 - ``rx_early_dropped``: number of RX packets that were early dropped
206 - ``rx_fifo_dropped``: number of RX packets dropped due to RX fifo overrun
207 - ``rx_cls_dropped``: number of RX packets dropped by classifier
208 - ``tx_bytes``: number of TX bytes
209 - ``tx_packets``: number of TX packets
210 - ``tx_unicast_packets``: number of TX unicast packets
211 - ``tx_errors``: number of TX MAC errors
219 QoS configuration is done through external configuration file. Path to the
220 file must be given as `cfg` in driver's vdev parameter list.
225 .. code-block:: console
227 [policer <policer_id>]
228 token_unit = <token_unit>
234 [port <portnum> default]
235 default_tc = <default_tc>
236 mapping_priority = <mapping_priority>
238 rate_limit_enable = <rate_limit_enable>
239 rate_limit = <rate_limit>
240 burst_size = <burst_size>
242 default_policer = <policer_id>
244 [port <portnum> tc <traffic_class>]
245 rxq = <rx_queue_list>
248 default_color = <default_color>
250 [port <portnum> tc <traffic_class>]
251 rxq = <rx_queue_list>
255 [port <portnum> txq <txqnum>]
256 sched_mode = <sched_mode>
257 wrr_weight = <wrr_weight>
259 rate_limit_enable = <rate_limit_enable>
260 rate_limit = <rate_limit>
261 burst_size = <burst_size>
265 - ``<portnum>``: DPDK Port number (0..n).
267 - ``<default_tc>``: Default traffic class (e.g. 0)
269 - ``<mapping_priority>``: QoS priority for mapping (`ip`, `vlan`, `ip/vlan` or `vlan/ip`).
271 - ``<traffic_class>``: Traffic Class to be configured.
273 - ``<rx_queue_list>``: List of DPDK RX queues (e.g. 0 1 3-4)
275 - ``<pcp_list>``: List of PCP values to handle in particular TC (e.g. 0 1 3-4 7).
277 - ``<dscp_list>``: List of DSCP values to handle in particular TC (e.g. 0-12 32-48 63).
279 - ``<default_policer>``: Id of the policer configuration section to be used as default.
281 - ``<policer_id>``: Id of the policer configuration section (0..31).
283 - ``<token_unit>``: Policer token unit (`bytes` or `packets`).
285 - ``<color_mode>``: Policer color mode (`aware` or `blind`).
287 - ``<cir>``: Committed information rate in unit of kilo bits per second (data rate) or packets per second.
289 - ``<cbs>``: Committed burst size in unit of kilo bytes or number of packets.
291 - ``<ebs>``: Excess burst size in unit of kilo bytes or number of packets.
293 - ``<default_color>``: Default color for specific tc.
295 - ``<rate_limit_enable>``: Enables per port or per txq rate limiting (`0`/`1` to disable/enable).
297 - ``<rate_limit>``: Committed information rate, in kilo bits per second.
299 - ``<burst_size>``: Committed burst size, in kilo bytes.
301 - ``<sched_mode>``: Egress scheduler mode (`wrr` or `sp`).
303 - ``<wrr_weight>``: Txq weight.
305 Setting PCP/DSCP values for the default TC is not required. All PCP/DSCP
306 values not assigned explicitly to particular TC will be handled by the
309 Configuration file example
310 ^^^^^^^^^^^^^^^^^^^^^^^^^^
312 .. code-block:: console
323 mapping_priority = ip
325 rate_limit_enable = 1
350 mapping_priority = vlan/ip
367 rate_limit_enable = 1
374 .. code-block:: console
376 ./testpmd --vdev=eth_mvpp2,iface=eth0,iface=eth2,cfg=/home/user/mrvl.conf \
377 -c 7 -- -i -a --disable-hw-vlan-strip --rxq=3 --txq=3
384 PPv2 offers packet classification capabilities via classifier engine which
385 can be configured via generic flow API offered by DPDK.
387 The :ref:`flow_isolated_mode` is supported.
389 For an additional description please refer to DPDK :doc:`../prog_guide/rte_flow`.
391 Supported flow actions
392 ~~~~~~~~~~~~~~~~~~~~~~
394 Following flow action items are supported by the driver:
402 Following flow items and their respective fields are supported by the driver:
420 * destination address
427 * destination address
439 Classifier match engine
440 ~~~~~~~~~~~~~~~~~~~~~~~
442 Classifier has an internal match engine which can be configured to
443 operate in either exact or maskable mode.
445 Mode is selected upon creation of the first unique flow rule as follows:
447 * maskable, if key size is up to 8 bytes.
448 * exact, otherwise, i.e for keys bigger than 8 bytes.
450 Where the key size equals the number of bytes of all fields specified
453 .. table:: Examples of key size calculation
455 +----------------------------------------------------------------------------+-------------------+-------------+
456 | Flow pattern | Key size in bytes | Used engine |
457 +============================================================================+===================+=============+
458 | ETH (destination MAC) / VLAN (VID) | 6 + 2 = 8 | Maskable |
459 +----------------------------------------------------------------------------+-------------------+-------------+
460 | VLAN (VID) / IPV4 (source address) | 2 + 4 = 6 | Maskable |
461 +----------------------------------------------------------------------------+-------------------+-------------+
462 | TCP (source port, destination port) | 2 + 2 = 4 | Maskable |
463 +----------------------------------------------------------------------------+-------------------+-------------+
464 | VLAN (priority) / IPV4 (source address) | 1 + 4 = 5 | Maskable |
465 +----------------------------------------------------------------------------+-------------------+-------------+
466 | IPV4 (destination address) / UDP (source port, destination port) | 6 + 2 + 2 = 10 | Exact |
467 +----------------------------------------------------------------------------+-------------------+-------------+
468 | VLAN (VID) / IPV6 (flow label, destination address) | 2 + 3 + 16 = 21 | Exact |
469 +----------------------------------------------------------------------------+-------------------+-------------+
470 | IPV4 (DSCP, source address, destination address) | 1 + 4 + 4 = 9 | Exact |
471 +----------------------------------------------------------------------------+-------------------+-------------+
472 | IPV6 (flow label, source address, destination address) | 3 + 16 + 16 = 35 | Exact |
473 +----------------------------------------------------------------------------+-------------------+-------------+
475 From the user perspective maskable mode means that masks specified
476 via flow rules are respected. In case of exact match mode, masks
477 which do not provide exact matching (all bits masked) are ignored.
479 If the flow matches more than one classifier rule the first
480 (with the lowest index) matched takes precedence.
482 Flow rules usage example
483 ~~~~~~~~~~~~~~~~~~~~~~~~
485 Before proceeding run testpmd user application:
487 .. code-block:: console
489 ./testpmd --vdev=eth_mvpp2,iface=eth0,iface=eth2 -c 3 -- -i --p 3 -a --disable-hw-vlan-strip
494 .. code-block:: console
496 testpmd> flow create 0 ingress pattern eth src is 10:11:12:13:14:15 / end actions drop / end
498 In this case key size is 6 bytes thus maskable type is selected. Testpmd
499 will set mask to ff:ff:ff:ff:ff:ff i.e traffic explicitly matching
500 above rule will be dropped.
505 .. code-block:: console
507 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
509 In this case key size is 8 bytes thus maskable type is selected.
510 Flows which have IPv4 source addresses ranging from 10.10.10.0 to 10.10.10.255
511 and tcp source port set to 16 will be dropped.
516 .. code-block:: console
518 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
520 In this case key size is 10 bytes thus exact type is selected.
521 Even though each item has partial mask set, masks will be ignored.
522 As a result only flows with VID set to 16 and IPv4 source and destination
523 addresses set to 10.10.1.1 and 11.11.11.1 respectively will be dropped.
528 Following limitations need to be taken into account while creating flow rules:
530 * For IPv4 exact match type the key size must be up to 12 bytes.
531 * For IPv6 exact match type the key size must be up to 36 bytes.
532 * Following fields cannot be partially masked (all masks are treated as
539 * TCP/UDP: source port, destination port
541 * Only one classifier table can be created thus all rules in the table
542 have to match table format. Table format is set during creation of
543 the first unique flow rule.
544 * Up to 5 fields can be specified per flow rule.
545 * Up to 20 flow rules can be added.
547 For additional information about classifier please consult
548 ``doc/musdk_cls_user_guide.txt``.
552 Traffic metering and policing
553 -----------------------------
555 MVPP2 PMD supports DPDK traffic metering and policing that allows the following:
557 1. Meter ingress traffic.
559 3. Gather statistics.
561 For an additional description please refer to DPDK :doc:`Traffic Metering and Policing API <../prog_guide/traffic_metering_and_policing>`.
563 The policer objects defined by this feature can work with the default policer defined via config file as described in :ref:`QoS Support <qossupport>`.
568 The following capabilities are not supported:
570 - MTR object meter DSCP table update
571 - MTR object policer action update
572 - MTR object enabled statistics
577 1. Run testpmd user app:
579 .. code-block:: console
581 ./testpmd --vdev=eth_mvpp2,iface=eth0,iface=eth2 -c 6 -- -i -p 3 -a --txd 1024 --rxd 1024
583 2. Create meter profile:
585 .. code-block:: console
587 testpmd> add port meter profile 0 0 srtcm_rfc2697 2000 256 256
591 .. code-block:: console
593 testpmd> create port meter 0 0 0 yes d d d 0 1 0
595 4. Create flow rule witch meter attached:
597 .. code-block:: console
599 testpmd> flow create 0 ingress pattern ipv4 src is 10.10.10.1 / end actions meter mtr_id 0 / end
601 For a detailed usage description please refer to "Traffic Metering and Policing" section in DPDK :doc:`Testpmd Runtime Functions <../testpmd_app_ug/testpmd_funcs>`.
607 Traffic Management API
608 ----------------------
610 MVPP2 PMD supports generic DPDK Traffic Management API which allows to
611 configure the following features:
613 1. Hierarchical scheduling
615 3. Congestion management
618 Internally TM is represented by a hierarchy (tree) of nodes.
619 Node which has a parent is called a leaf whereas node without
620 parent is called a non-leaf (root).
621 MVPP2 PMD supports two level hierarchy where level 0 represents ports and level 1 represents tx queues of a given port.
623 .. figure:: img/mvpp2_tm.*
625 Nodes hold following types of settings:
627 - for egress scheduler configuration: weight
628 - for egress rate limiter: private shaper
629 - bitmask indicating which statistics counters will be read
631 Hierarchy is always constructed from the top, i.e first a root node is added
632 then some number of leaf nodes. Number of leaf nodes cannot exceed number
633 of configured tx queues.
635 After hierarchy is complete it can be committed.
638 For an additional description please refer to DPDK :doc:`Traffic Management API <../prog_guide/traffic_management>`.
643 The following capabilities are not supported:
645 - Traffic manager WRED profile and WRED context
646 - Traffic manager shared shaper update
647 - Traffic manager packet marking
648 - Maximum number of levels in hierarchy is 2
649 - Currently dynamic change of a hierarchy is not supported
654 For a detailed usage description please refer to "Traffic Management" section in DPDK :doc:`Testpmd Runtime Functions <../testpmd_app_ug/testpmd_funcs>`.
656 1. Run testpmd as follows:
658 .. code-block:: console
660 ./testpmd --vdev=net_mrvl,iface=eth0,iface=eth2,cfg=./qos_config -c 7 -- \
661 -i -p 3 --disable-hw-vlan-strip --rxq 3 --txq 3 --txd 1024 --rxd 1024
665 .. code-block:: console
667 testpmd> port stop all
669 3. Add shaper profile:
671 .. code-block:: console
673 testpmd> add port tm node shaper profile 0 0 900000 70000 0
675 Parameters have following meaning::
678 0 - Id of a new shaper profile.
679 900000 - Shaper rate in bytes/s.
680 70000 - Bucket size in bytes.
681 0 - Packet length adjustment - ignored.
683 4. Add non-leaf node for port 0:
685 .. code-block:: console
687 testpmd> add port tm nonleaf node 0 3 -1 0 0 0 0 0 1 3 0
689 Parameters have following meaning::
692 3 - Id of a new node.
693 -1 - Indicate that root does not have a parent.
694 0 - Priority of the node.
695 0 - Weight of the node.
696 0 - Id of a level. Since this is a root 0 is passed.
697 0 - Id of the shaper profile.
698 0 - Number of SP priorities.
699 3 - Enable statistics for both number of transmitted packets and bytes.
700 0 - Number of shared shapers.
702 5. Add leaf node for tx queue 0:
704 .. code-block:: console
706 testpmd> add port tm leaf node 0 0 3 0 30 1 -1 0 0 1 0
708 Parameters have following meaning::
711 0 - Id of a new node.
712 3 - Id of the parent node.
713 0 - Priority of a node.
715 1 - Id of a level. Since this is a leaf node 1 is passed.
716 -1 - Id of a shaper. -1 indicates that shaper is not attached.
717 0 - Congestion management is not supported.
718 0 - Congestion management is not supported.
719 1 - Enable statistics counter for number of transmitted packets.
720 0 - Number of shared shapers.
722 6. Add leaf node for tx queue 1:
724 .. code-block:: console
726 testpmd> add port tm leaf node 0 1 3 0 60 1 -1 0 0 1 0
728 Parameters have following meaning::
731 1 - Id of a new node.
732 3 - Id of the parent node.
733 0 - Priority of a node.
735 1 - Id of a level. Since this is a leaf node 1 is passed.
736 -1 - Id of a shaper. -1 indicates that shaper is not attached.
737 0 - Congestion management is not supported.
738 0 - Congestion management is not supported.
739 1 - Enable statistics counter for number of transmitted packets.
740 0 - Number of shared shapers.
742 7. Add leaf node for tx queue 2:
744 .. code-block:: console
746 testpmd> add port tm leaf node 0 2 3 0 99 1 -1 0 0 1 0
748 Parameters have following meaning::
751 2 - Id of a new node.
752 3 - Id of the parent node.
753 0 - Priority of a node.
755 1 - Id of a level. Since this is a leaf node 1 is passed.
756 -1 - Id of a shaper. -1 indicates that shaper is not attached.
757 0 - Congestion management is not supported.
758 0 - Congestion management is not supported.
759 1 - Enable statistics counter for number of transmitted packets.
760 0 - Number of shared shapers.
764 .. code-block:: console
766 testpmd> port tm hierarchy commit 0 no
768 Parameters have following meaning::
771 no - Do not flush TM hierarchy if commit fails.
775 .. code-block:: console
777 testpmd> port start all
781 10. Enable forwarding
783 .. code-block:: console