1131a75b6SHemant Agrawal.. SPDX-License-Identifier: BSD-3-Clause 2ac624068SGagandeep Singh Copyright 2016,2020-2021 NXP 3846a8305SHemant Agrawal 4846a8305SHemant Agrawal 5846a8305SHemant AgrawalDPAA2 Poll Mode Driver 6846a8305SHemant Agrawal====================== 7846a8305SHemant Agrawal 88809f78cSBruce RichardsonThe DPAA2 NIC PMD (**librte_net_dpaa2**) provides poll mode driver 9846a8305SHemant Agrawalsupport for the inbuilt NIC found in the **NXP DPAA2** SoC family. 10846a8305SHemant Agrawal 11846a8305SHemant AgrawalMore information can be found at `NXP Official Website 12846a8305SHemant Agrawal<http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/qoriq-arm-processors:QORIQ-ARM>`_. 13846a8305SHemant Agrawal 14846a8305SHemant AgrawalNXP DPAA2 (Data Path Acceleration Architecture Gen2) 15846a8305SHemant Agrawal---------------------------------------------------- 16846a8305SHemant Agrawal 17846a8305SHemant AgrawalThis section provides an overview of the NXP DPAA2 architecture 18846a8305SHemant Agrawaland how it is integrated into the DPDK. 19846a8305SHemant Agrawal 20846a8305SHemant AgrawalContents summary 21846a8305SHemant Agrawal 22846a8305SHemant Agrawal- DPAA2 overview 23846a8305SHemant Agrawal- Overview of DPAA2 objects 24846a8305SHemant Agrawal- DPAA2 driver architecture overview 25846a8305SHemant Agrawal 264bbee28bSAkhil Goyal.. _dpaa2_overview: 274bbee28bSAkhil Goyal 28846a8305SHemant AgrawalDPAA2 Overview 29846a8305SHemant Agrawal~~~~~~~~~~~~~~ 30846a8305SHemant Agrawal 31846a8305SHemant AgrawalReference: `FSL MC BUS in Linux Kernel <https://www.kernel.org/doc/readme/drivers-staging-fsl-mc-README.txt>`_. 32846a8305SHemant Agrawal 33846a8305SHemant AgrawalDPAA2 is a hardware architecture designed for high-speed network 34846a8305SHemant Agrawalpacket processing. DPAA2 consists of sophisticated mechanisms for 35846a8305SHemant Agrawalprocessing Ethernet packets, queue management, buffer management, 36846a8305SHemant Agrawalautonomous L2 switching, virtual Ethernet bridging, and accelerator 37846a8305SHemant Agrawal(e.g. crypto) sharing. 38846a8305SHemant Agrawal 39846a8305SHemant AgrawalA DPAA2 hardware component called the Management Complex (or MC) manages the 40846a8305SHemant AgrawalDPAA2 hardware resources. The MC provides an object-based abstraction for 41846a8305SHemant Agrawalsoftware drivers to use the DPAA2 hardware. 42846a8305SHemant Agrawal 43846a8305SHemant AgrawalThe MC uses DPAA2 hardware resources such as queues, buffer pools, and 44846a8305SHemant Agrawalnetwork ports to create functional objects/devices such as network 45846a8305SHemant Agrawalinterfaces, an L2 switch, or accelerator instances. 46846a8305SHemant Agrawal 47846a8305SHemant AgrawalThe MC provides memory-mapped I/O command interfaces (MC portals) 48846a8305SHemant Agrawalwhich DPAA2 software drivers use to operate on DPAA2 objects: 49846a8305SHemant Agrawal 50846a8305SHemant AgrawalThe diagram below shows an overview of the DPAA2 resource management 51846a8305SHemant Agrawalarchitecture: 52846a8305SHemant Agrawal 53846a8305SHemant Agrawal.. code-block:: console 54846a8305SHemant Agrawal 55846a8305SHemant Agrawal +--------------------------------------+ 56846a8305SHemant Agrawal | OS | 57846a8305SHemant Agrawal | DPAA2 drivers | 58846a8305SHemant Agrawal | | | 59846a8305SHemant Agrawal +-----------------------------|--------+ 60846a8305SHemant Agrawal | 61846a8305SHemant Agrawal | (create,discover,connect 62846a8305SHemant Agrawal | config,use,destroy) 63846a8305SHemant Agrawal | 64846a8305SHemant Agrawal DPAA2 | 65846a8305SHemant Agrawal +------------------------| mc portal |-+ 66846a8305SHemant Agrawal | | | 67846a8305SHemant Agrawal | +- - - - - - - - - - - - -V- - -+ | 68846a8305SHemant Agrawal | | | | 69846a8305SHemant Agrawal | | Management Complex (MC) | | 70846a8305SHemant Agrawal | | | | 71846a8305SHemant Agrawal | +- - - - - - - - - - - - - - - -+ | 72846a8305SHemant Agrawal | | 73846a8305SHemant Agrawal | Hardware Hardware | 74846a8305SHemant Agrawal | Resources Objects | 75846a8305SHemant Agrawal | --------- ------- | 76846a8305SHemant Agrawal | -queues -DPRC | 77846a8305SHemant Agrawal | -buffer pools -DPMCP | 78846a8305SHemant Agrawal | -Eth MACs/ports -DPIO | 79846a8305SHemant Agrawal | -network interface -DPNI | 80846a8305SHemant Agrawal | profiles -DPMAC | 81846a8305SHemant Agrawal | -queue portals -DPBP | 82846a8305SHemant Agrawal | -MC portals ... | 83846a8305SHemant Agrawal | ... | 84846a8305SHemant Agrawal | | 85846a8305SHemant Agrawal +--------------------------------------+ 86846a8305SHemant Agrawal 87846a8305SHemant AgrawalThe MC mediates operations such as create, discover, 88846a8305SHemant Agrawalconnect, configuration, and destroy. Fast-path operations 89846a8305SHemant Agrawalon data, such as packet transmit/receive, are not mediated by 90846a8305SHemant Agrawalthe MC and are done directly using memory mapped regions in 91846a8305SHemant AgrawalDPIO objects. 92846a8305SHemant Agrawal 93846a8305SHemant AgrawalOverview of DPAA2 Objects 94846a8305SHemant Agrawal~~~~~~~~~~~~~~~~~~~~~~~~~ 95846a8305SHemant Agrawal 96846a8305SHemant AgrawalThe section provides a brief overview of some key DPAA2 objects. 97846a8305SHemant AgrawalA simple scenario is described illustrating the objects involved 98846a8305SHemant Agrawalin creating a network interfaces. 99846a8305SHemant Agrawal 100846a8305SHemant AgrawalDPRC (Datapath Resource Container) 101846a8305SHemant Agrawal 102846a8305SHemant Agrawal A DPRC is a container object that holds all the other 103846a8305SHemant Agrawal types of DPAA2 objects. In the example diagram below there 104846a8305SHemant Agrawal are 8 objects of 5 types (DPMCP, DPIO, DPBP, DPNI, and DPMAC) 105846a8305SHemant Agrawal in the container. 106846a8305SHemant Agrawal 107846a8305SHemant Agrawal.. code-block:: console 108846a8305SHemant Agrawal 109846a8305SHemant Agrawal +---------------------------------------------------------+ 110846a8305SHemant Agrawal | DPRC | 111846a8305SHemant Agrawal | | 112846a8305SHemant Agrawal | +-------+ +-------+ +-------+ +-------+ +-------+ | 113846a8305SHemant Agrawal | | DPMCP | | DPIO | | DPBP | | DPNI | | DPMAC | | 114846a8305SHemant Agrawal | +-------+ +-------+ +-------+ +---+---+ +---+---+ | 115846a8305SHemant Agrawal | | DPMCP | | DPIO | | 116846a8305SHemant Agrawal | +-------+ +-------+ | 117846a8305SHemant Agrawal | | DPMCP | | 118846a8305SHemant Agrawal | +-------+ | 119846a8305SHemant Agrawal | | 120846a8305SHemant Agrawal +---------------------------------------------------------+ 121846a8305SHemant Agrawal 122846a8305SHemant AgrawalFrom the point of view of an OS, a DPRC behaves similar to a plug and 123846a8305SHemant Agrawalplay bus, like PCI. DPRC commands can be used to enumerate the contents 124846a8305SHemant Agrawalof the DPRC, discover the hardware objects present (including mappable 125846a8305SHemant Agrawalregions and interrupts). 126846a8305SHemant Agrawal 127846a8305SHemant Agrawal.. code-block:: console 128846a8305SHemant Agrawal 129846a8305SHemant Agrawal DPRC.1 (bus) 130846a8305SHemant Agrawal | 131846a8305SHemant Agrawal +--+--------+-------+-------+-------+ 132846a8305SHemant Agrawal | | | | | 133846a8305SHemant Agrawal DPMCP.1 DPIO.1 DPBP.1 DPNI.1 DPMAC.1 134846a8305SHemant Agrawal DPMCP.2 DPIO.2 135846a8305SHemant Agrawal DPMCP.3 136846a8305SHemant Agrawal 137846a8305SHemant AgrawalHardware objects can be created and destroyed dynamically, providing 138846a8305SHemant Agrawalthe ability to hot plug/unplug objects in and out of the DPRC. 139846a8305SHemant Agrawal 140846a8305SHemant AgrawalA DPRC has a mappable MMIO region (an MC portal) that can be used 141846a8305SHemant Agrawalto send MC commands. It has an interrupt for status events (like 142846a8305SHemant Agrawalhotplug). 143846a8305SHemant Agrawal 144846a8305SHemant AgrawalAll objects in a container share the same hardware "isolation context". 145846a8305SHemant AgrawalThis means that with respect to an IOMMU the isolation granularity 146846a8305SHemant Agrawalis at the DPRC (container) level, not at the individual object 147846a8305SHemant Agrawallevel. 148846a8305SHemant Agrawal 149846a8305SHemant AgrawalDPRCs can be defined statically and populated with objects 150846a8305SHemant Agrawalvia a config file passed to the MC when firmware starts 151846a8305SHemant Agrawalit. There is also a Linux user space tool called "restool" 152846a8305SHemant Agrawalthat can be used to create/destroy containers and objects 153846a8305SHemant Agrawaldynamically. 154846a8305SHemant Agrawal 155846a8305SHemant AgrawalDPAA2 Objects for an Ethernet Network Interface 156846a8305SHemant Agrawal~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 157846a8305SHemant Agrawal 158846a8305SHemant AgrawalA typical Ethernet NIC is monolithic-- the NIC device contains TX/RX 159846a8305SHemant Agrawalqueuing mechanisms, configuration mechanisms, buffer management, 160846a8305SHemant Agrawalphysical ports, and interrupts. DPAA2 uses a more granular approach 161846a8305SHemant Agrawalutilizing multiple hardware objects. Each object provides specialized 162846a8305SHemant Agrawalfunctions. Groups of these objects are used by software to provide 163846a8305SHemant AgrawalEthernet network interface functionality. This approach provides 164846a8305SHemant Agrawalefficient use of finite hardware resources, flexibility, and 165846a8305SHemant Agrawalperformance advantages. 166846a8305SHemant Agrawal 167846a8305SHemant AgrawalThe diagram below shows the objects needed for a simple 168846a8305SHemant Agrawalnetwork interface configuration on a system with 2 CPUs. 169846a8305SHemant Agrawal 170846a8305SHemant Agrawal.. code-block:: console 171846a8305SHemant Agrawal 172846a8305SHemant Agrawal +---+---+ +---+---+ 173846a8305SHemant Agrawal CPU0 CPU1 174846a8305SHemant Agrawal +---+---+ +---+---+ 175846a8305SHemant Agrawal | | 176846a8305SHemant Agrawal +---+---+ +---+---+ 177846a8305SHemant Agrawal DPIO DPIO 178846a8305SHemant Agrawal +---+---+ +---+---+ 179846a8305SHemant Agrawal \ / 180846a8305SHemant Agrawal \ / 181846a8305SHemant Agrawal \ / 182846a8305SHemant Agrawal +---+---+ 183846a8305SHemant Agrawal DPNI --- DPBP,DPMCP 184846a8305SHemant Agrawal +---+---+ 185846a8305SHemant Agrawal | 186846a8305SHemant Agrawal | 187846a8305SHemant Agrawal +---+---+ 188846a8305SHemant Agrawal DPMAC 189846a8305SHemant Agrawal +---+---+ 190846a8305SHemant Agrawal | 191846a8305SHemant Agrawal port/PHY 192846a8305SHemant Agrawal 193846a8305SHemant AgrawalBelow the objects are described. For each object a brief description 194846a8305SHemant Agrawalis provided along with a summary of the kinds of operations the object 195846a8305SHemant Agrawalsupports and a summary of key resources of the object (MMIO regions 196846a8305SHemant Agrawaland IRQs). 197846a8305SHemant Agrawal 198846a8305SHemant AgrawalDPMAC (Datapath Ethernet MAC): represents an Ethernet MAC, a 199846a8305SHemant Agrawalhardware device that connects to an Ethernet PHY and allows 200846a8305SHemant Agrawalphysical transmission and reception of Ethernet frames. 201846a8305SHemant Agrawal 202846a8305SHemant Agrawal- MMIO regions: none 203846a8305SHemant Agrawal- IRQs: DPNI link change 204846a8305SHemant Agrawal- commands: set link up/down, link config, get stats, IRQ config, enable, reset 205846a8305SHemant Agrawal 206846a8305SHemant AgrawalDPNI (Datapath Network Interface): contains TX/RX queues, 207846a8305SHemant Agrawalnetwork interface configuration, and RX buffer pool configuration 208846a8305SHemant Agrawalmechanisms. The TX/RX queues are in memory and are identified by 209846a8305SHemant Agrawalqueue number. 210846a8305SHemant Agrawal 211846a8305SHemant Agrawal- MMIO regions: none 212846a8305SHemant Agrawal- IRQs: link state 213846a8305SHemant Agrawal- commands: port config, offload config, queue config, parse/classify config, IRQ config, enable, reset 214846a8305SHemant Agrawal 215846a8305SHemant AgrawalDPIO (Datapath I/O): provides interfaces to enqueue and dequeue 216846a8305SHemant Agrawalpackets and do hardware buffer pool management operations. The DPAA2 217846a8305SHemant Agrawalarchitecture separates the mechanism to access queues (the DPIO object) 218846a8305SHemant Agrawalfrom the queues themselves. The DPIO provides an MMIO interface to 219846a8305SHemant Agrawalenqueue/dequeue packets. To enqueue something a descriptor is written 220846a8305SHemant Agrawalto the DPIO MMIO region, which includes the target queue number. 221846a8305SHemant AgrawalThere will typically be one DPIO assigned to each CPU. This allows all 222846a8305SHemant AgrawalCPUs to simultaneously perform enqueue/dequeued operations. DPIOs are 223846a8305SHemant Agrawalexpected to be shared by different DPAA2 drivers. 224846a8305SHemant Agrawal 225846a8305SHemant Agrawal- MMIO regions: queue operations, buffer management 226846a8305SHemant Agrawal- IRQs: data availability, congestion notification, buffer pool depletion 227846a8305SHemant Agrawal- commands: IRQ config, enable, reset 228846a8305SHemant Agrawal 229846a8305SHemant AgrawalDPBP (Datapath Buffer Pool): represents a hardware buffer 230846a8305SHemant Agrawalpool. 231846a8305SHemant Agrawal 232846a8305SHemant Agrawal- MMIO regions: none 233846a8305SHemant Agrawal- IRQs: none 234846a8305SHemant Agrawal- commands: enable, reset 235846a8305SHemant Agrawal 236846a8305SHemant AgrawalDPMCP (Datapath MC Portal): provides an MC command portal. 237846a8305SHemant AgrawalUsed by drivers to send commands to the MC to manage 238846a8305SHemant Agrawalobjects. 239846a8305SHemant Agrawal 240846a8305SHemant Agrawal- MMIO regions: MC command portal 241846a8305SHemant Agrawal- IRQs: command completion 242846a8305SHemant Agrawal- commands: IRQ config, enable, reset 243846a8305SHemant Agrawal 244846a8305SHemant AgrawalObject Connections 245846a8305SHemant Agrawal~~~~~~~~~~~~~~~~~~ 246846a8305SHemant Agrawal 247846a8305SHemant AgrawalSome objects have explicit relationships that must 248846a8305SHemant Agrawalbe configured: 249846a8305SHemant Agrawal 250846a8305SHemant Agrawal- DPNI <--> DPMAC 251846a8305SHemant Agrawal- DPNI <--> DPNI 252846a8305SHemant Agrawal- DPNI <--> L2-switch-port 253846a8305SHemant Agrawal 254846a8305SHemant AgrawalA DPNI must be connected to something such as a DPMAC, 255846a8305SHemant Agrawalanother DPNI, or L2 switch port. The DPNI connection 256846a8305SHemant Agrawalis made via a DPRC command. 257846a8305SHemant Agrawal 258846a8305SHemant Agrawal.. code-block:: console 259846a8305SHemant Agrawal 260846a8305SHemant Agrawal +-------+ +-------+ 261846a8305SHemant Agrawal | DPNI | | DPMAC | 262846a8305SHemant Agrawal +---+---+ +---+---+ 263846a8305SHemant Agrawal | | 264846a8305SHemant Agrawal +==========+ 265846a8305SHemant Agrawal 266846a8305SHemant Agrawal- DPNI <--> DPBP 267846a8305SHemant Agrawal 268846a8305SHemant AgrawalA network interface requires a 'buffer pool' (DPBP object) which provides 269846a8305SHemant Agrawala list of pointers to memory where received Ethernet data is to be copied. 270846a8305SHemant AgrawalThe Ethernet driver configures the DPBPs associated with the network 271846a8305SHemant Agrawalinterface. 272846a8305SHemant Agrawal 273846a8305SHemant AgrawalInterrupts 274846a8305SHemant Agrawal~~~~~~~~~~ 275846a8305SHemant Agrawal 276846a8305SHemant AgrawalAll interrupts generated by DPAA2 objects are message 277846a8305SHemant Agrawalinterrupts. At the hardware level message interrupts 278846a8305SHemant Agrawalgenerated by devices will normally have 3 components-- 279846a8305SHemant Agrawal1) a non-spoofable 'device-id' expressed on the hardware 280846a8305SHemant Agrawalbus, 2) an address, 3) a data value. 281846a8305SHemant Agrawal 282846a8305SHemant AgrawalIn the case of DPAA2 devices/objects, all objects in the 283846a8305SHemant Agrawalsame container/DPRC share the same 'device-id'. 284846a8305SHemant AgrawalFor ARM-based SoC this is the same as the stream ID. 285846a8305SHemant Agrawal 286846a8305SHemant Agrawal 287846a8305SHemant AgrawalDPAA2 DPDK - Poll Mode Driver Overview 288846a8305SHemant Agrawal-------------------------------------- 289846a8305SHemant Agrawal 290846a8305SHemant AgrawalThis section provides an overview of the drivers for 291846a8305SHemant AgrawalDPAA2-- 1) the bus driver and associated "DPAA2 infrastructure" 292846a8305SHemant Agrawaldrivers and 2) functional object drivers (such as Ethernet). 293846a8305SHemant Agrawal 294846a8305SHemant AgrawalAs described previously, a DPRC is a container that holds the other 295846a8305SHemant Agrawaltypes of DPAA2 objects. It is functionally similar to a plug-and-play 296846a8305SHemant Agrawalbus controller. 297846a8305SHemant Agrawal 298846a8305SHemant AgrawalEach object in the DPRC is a Linux "device" and is bound to a driver. 299846a8305SHemant AgrawalThe diagram below shows the dpaa2 drivers involved in a networking 300846a8305SHemant Agrawalscenario and the objects bound to each driver. A brief description 301846a8305SHemant Agrawalof each driver follows. 302846a8305SHemant Agrawal 3031736219bSSachin Saxena.. code-block:: console 304846a8305SHemant Agrawal 305846a8305SHemant Agrawal 306846a8305SHemant Agrawal +------------+ 307846a8305SHemant Agrawal | DPDK DPAA2 | 308846a8305SHemant Agrawal | PMD | 309846a8305SHemant Agrawal +------------+ +------------+ 310846a8305SHemant Agrawal | Ethernet |.......| Mempool | 311846a8305SHemant Agrawal . . . . . . . . . | (DPNI) | | (DPBP) | 312846a8305SHemant Agrawal . +---+---+----+ +-----+------+ 313846a8305SHemant Agrawal . ^ | . 314846a8305SHemant Agrawal . | |<enqueue, . 315846a8305SHemant Agrawal . | | dequeue> . 316846a8305SHemant Agrawal . | | . 317846a8305SHemant Agrawal . +---+---V----+ . 318846a8305SHemant Agrawal . . . . . . . . . . .| DPIO driver| . 319846a8305SHemant Agrawal . . | (DPIO) | . 320846a8305SHemant Agrawal . . +-----+------+ . 321846a8305SHemant Agrawal . . | QBMAN | . 322846a8305SHemant Agrawal . . | Driver | . 323846a8305SHemant Agrawal +----+------+-------+ +-----+----- | . 324846a8305SHemant Agrawal | dpaa2 bus | | . 325846a8305SHemant Agrawal | VFIO fslmc-bus |....................|..................... 326846a8305SHemant Agrawal | | | 327846a8305SHemant Agrawal | /bus/fslmc | | 328846a8305SHemant Agrawal +-------------------+ | 329846a8305SHemant Agrawal | 330846a8305SHemant Agrawal ========================== HARDWARE =====|======================= 331846a8305SHemant Agrawal DPIO 332846a8305SHemant Agrawal | 333846a8305SHemant Agrawal DPNI---DPBP 334846a8305SHemant Agrawal | 335846a8305SHemant Agrawal DPMAC 336846a8305SHemant Agrawal | 337846a8305SHemant Agrawal PHY 338846a8305SHemant Agrawal =========================================|======================== 339846a8305SHemant Agrawal 340846a8305SHemant Agrawal 341846a8305SHemant AgrawalA brief description of each driver is provided below. 342846a8305SHemant Agrawal 343846a8305SHemant AgrawalDPAA2 bus driver 344846a8305SHemant Agrawal~~~~~~~~~~~~~~~~ 345846a8305SHemant Agrawal 346846a8305SHemant AgrawalThe DPAA2 bus driver is a rte_bus driver which scans the fsl-mc bus. 347846a8305SHemant AgrawalKey functions include: 348846a8305SHemant Agrawal 349846a8305SHemant Agrawal- Reading the container and setting up vfio group 350846a8305SHemant Agrawal- Scanning and parsing the various MC objects and adding them to 351846a8305SHemant Agrawal their respective device list. 352846a8305SHemant Agrawal 353846a8305SHemant AgrawalAdditionally, it also provides the object driver for generic MC objects. 354846a8305SHemant Agrawal 355846a8305SHemant AgrawalDPIO driver 356846a8305SHemant Agrawal~~~~~~~~~~~ 357846a8305SHemant Agrawal 358846a8305SHemant AgrawalThe DPIO driver is bound to DPIO objects and provides services that allow 359846a8305SHemant Agrawalother drivers such as the Ethernet driver to enqueue and dequeue data for 360846a8305SHemant Agrawaltheir respective objects. 361846a8305SHemant AgrawalKey services include: 362846a8305SHemant Agrawal 363846a8305SHemant Agrawal- Data availability notifications 364846a8305SHemant Agrawal- Hardware queuing operations (enqueue and dequeue of data) 365846a8305SHemant Agrawal- Hardware buffer pool management 366846a8305SHemant Agrawal 367846a8305SHemant AgrawalTo transmit a packet the Ethernet driver puts data on a queue and 368846a8305SHemant Agrawalinvokes a DPIO API. For receive, the Ethernet driver registers 369846a8305SHemant Agrawala data availability notification callback. To dequeue a packet 370846a8305SHemant Agrawala DPIO API is used. 371846a8305SHemant Agrawal 372846a8305SHemant AgrawalThere is typically one DPIO object per physical CPU for optimum 373846a8305SHemant Agrawalperformance, allowing different CPUs to simultaneously enqueue 374846a8305SHemant Agrawaland dequeue data. 375846a8305SHemant Agrawal 376846a8305SHemant AgrawalThe DPIO driver operates on behalf of all DPAA2 drivers 377846a8305SHemant Agrawalactive -- Ethernet, crypto, compression, etc. 378846a8305SHemant Agrawal 379846a8305SHemant AgrawalDPBP based Mempool driver 380846a8305SHemant Agrawal~~~~~~~~~~~~~~~~~~~~~~~~~ 381846a8305SHemant Agrawal 382d629b7b5SJohn McNamaraThe DPBP driver is bound to a DPBP objects and provides services to 383846a8305SHemant Agrawalcreate a hardware offloaded packet buffer mempool. 384846a8305SHemant Agrawal 385846a8305SHemant AgrawalDPAA2 NIC Driver 386846a8305SHemant Agrawal~~~~~~~~~~~~~~~~ 387846a8305SHemant AgrawalThe Ethernet driver is bound to a DPNI and implements the kernel 388846a8305SHemant Agrawalinterfaces needed to connect the DPAA2 network interface to 389846a8305SHemant Agrawalthe network stack. 390846a8305SHemant Agrawal 391846a8305SHemant AgrawalEach DPNI corresponds to a DPDK network interface. 392846a8305SHemant Agrawal 393846a8305SHemant AgrawalFeatures 394846a8305SHemant Agrawal^^^^^^^^ 395846a8305SHemant Agrawal 396846a8305SHemant AgrawalFeatures of the DPAA2 PMD are: 397846a8305SHemant Agrawal 398846a8305SHemant Agrawal- Multiple queues for TX and RX 399846a8305SHemant Agrawal- Receive Side Scaling (RSS) 40041dae1e0SHemant Agrawal- MAC/VLAN filtering 401846a8305SHemant Agrawal- Packet type information 402846a8305SHemant Agrawal- Checksum offload 403846a8305SHemant Agrawal- Promiscuous mode 40441dae1e0SHemant Agrawal- Multicast mode 40541dae1e0SHemant Agrawal- Port hardware statistics 40641dae1e0SHemant Agrawal- Jumbo frames 40741dae1e0SHemant Agrawal- Link flow control 40841dae1e0SHemant Agrawal- Scattered and gather for TX and RX 409ac624068SGagandeep Singh- :ref:`Traffic Management API <dptmapi>` 410ac624068SGagandeep Singh 411846a8305SHemant Agrawal 412846a8305SHemant AgrawalSupported DPAA2 SoCs 413846a8305SHemant Agrawal-------------------- 414b84c1087SHemant Agrawal- LX2160A 415846a8305SHemant Agrawal- LS2084A/LS2044A 416846a8305SHemant Agrawal- LS2088A/LS2048A 417846a8305SHemant Agrawal- LS1088A/LS1048A 418846a8305SHemant Agrawal 419846a8305SHemant AgrawalPrerequisites 420846a8305SHemant Agrawal------------- 421846a8305SHemant Agrawal 422b84c1087SHemant AgrawalSee :doc:`../platform/dpaa2` for setup information 423846a8305SHemant Agrawal 424846a8305SHemant Agrawal- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment. 425846a8305SHemant Agrawal 426846a8305SHemant Agrawal.. note:: 427846a8305SHemant Agrawal 428846a8305SHemant Agrawal Some part of fslmc bus code (mc flib - object library) routines are 429eb6d5a0aSHemant Agrawal dual licensed (BSD & GPLv2), however they are used as BSD in DPDK in userspace. 430846a8305SHemant Agrawal 431846a8305SHemant Agrawal 4324c322f1fSShreyansh JainDriver compilation and testing 4334c322f1fSShreyansh Jain------------------------------ 434846a8305SHemant Agrawal 4354c322f1fSShreyansh JainRefer to the document :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>` 4364c322f1fSShreyansh Jainfor details. 437846a8305SHemant Agrawal 4384c322f1fSShreyansh Jain#. Running testpmd: 439846a8305SHemant Agrawal 4404c322f1fSShreyansh Jain Follow instructions available in the document 4414c322f1fSShreyansh Jain :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>` 4424c322f1fSShreyansh Jain to run testpmd. 443846a8305SHemant Agrawal 4444c322f1fSShreyansh Jain Example output: 445846a8305SHemant Agrawal 446846a8305SHemant Agrawal .. code-block:: console 447846a8305SHemant Agrawal 44868d99d00SCiara Power ./dpdk-testpmd -c 0xff -n 1 -- -i --portmask=0x3 --nb-cores=1 --no-flush-rx 449846a8305SHemant Agrawal 450846a8305SHemant Agrawal ..... 451846a8305SHemant Agrawal EAL: Registered [pci] bus. 452846a8305SHemant Agrawal EAL: Registered [fslmc] bus. 453846a8305SHemant Agrawal EAL: Detected 8 lcore(s) 454846a8305SHemant Agrawal EAL: Probing VFIO support... 455846a8305SHemant Agrawal EAL: VFIO support initialized 456846a8305SHemant Agrawal ..... 457846a8305SHemant Agrawal PMD: DPAA2: Processing Container = dprc.2 458846a8305SHemant Agrawal EAL: fslmc: DPRC contains = 51 devices 459846a8305SHemant Agrawal EAL: fslmc: Bus scan completed 460846a8305SHemant Agrawal ..... 461846a8305SHemant Agrawal Configuring Port 0 (socket 0) 462846a8305SHemant Agrawal Port 0: 00:00:00:00:00:01 463846a8305SHemant Agrawal Configuring Port 1 (socket 0) 464846a8305SHemant Agrawal Port 1: 00:00:00:00:00:02 465846a8305SHemant Agrawal ..... 466846a8305SHemant Agrawal Checking link statuses... 467846a8305SHemant Agrawal Port 0 Link Up - speed 10000 Mbps - full-duplex 468846a8305SHemant Agrawal Port 1 Link Up - speed 10000 Mbps - full-duplex 469846a8305SHemant Agrawal Done 470846a8305SHemant Agrawal testpmd> 471846a8305SHemant Agrawal 472a3a997f0SHemant Agrawal 473a3a997f0SHemant Agrawal* Use dev arg option ``drv_loopback=1`` to loopback packets at 474a3a997f0SHemant Agrawal driver level. Any packet received will be reflected back by the 475b2702df2SHemant Agrawal driver on same port. e.g. ``fslmc:dpni.1,drv_loopback=1`` 476a3a997f0SHemant Agrawal 47720191ab3SNipun Gupta* Use dev arg option ``drv_no_prefetch=1`` to disable prefetching 47820191ab3SNipun Gupta of the packet pull command which is issued in the previous cycle. 47920191ab3SNipun Gupta e.g. ``fslmc:dpni.1,drv_no_prefetch=1`` 48020191ab3SNipun Gupta 4818d21c563SHemant Agrawal* Use dev arg option ``drv_tx_conf=1`` to enable TX confirmation mode. 4828d21c563SHemant Agrawal In this mode tx conf queues need to be polled to free the buffers. 4838d21c563SHemant Agrawal e.g. ``fslmc:dpni.1,drv_tx_conf=1`` 4848d21c563SHemant Agrawal 4854690a611SNipun Gupta* Use dev arg option ``drv_error_queue=1`` to enable Packets in Error queue. 4864690a611SNipun Gupta DPAA2 hardware drops the error packet in hardware. This option enables the 4874690a611SNipun Gupta hardware to not drop the error packet and let the driver dump the error 4884690a611SNipun Gupta packets, so that user can check what is wrong with those packets. 4894690a611SNipun Gupta e.g. ``fslmc:dpni.1,drv_error_queue=1`` 4904690a611SNipun Gupta 491a10a988aSShreyansh JainEnabling logs 492a10a988aSShreyansh Jain------------- 493a10a988aSShreyansh Jain 494a10a988aSShreyansh JainFor enabling logging for DPAA2 PMD, following log-level prefix can be used: 495a10a988aSShreyansh Jain 496a10a988aSShreyansh Jain .. code-block:: console 497a10a988aSShreyansh Jain 498a0173139SStephen Hemminger <dpdk app> <EAL args> --log-level=bus.fslmc:<level> -- ... 499a10a988aSShreyansh Jain 500a10a988aSShreyansh JainUsing ``bus.fslmc`` as log matching criteria, all FSLMC bus logs can be enabled 501a10a988aSShreyansh Jainwhich are lower than logging ``level``. 502a10a988aSShreyansh Jain 503a10a988aSShreyansh Jain Or 504a10a988aSShreyansh Jain 505a10a988aSShreyansh Jain .. code-block:: console 506a10a988aSShreyansh Jain 507a0173139SStephen Hemminger <dpdk app> <EAL args> --log-level=pmd.net.dpaa2:<level> -- ... 508a10a988aSShreyansh Jain 5099631253fSFerruh YigitUsing ``pmd.net.dpaa2`` as log matching criteria, all PMD logs can be enabled 510a10a988aSShreyansh Jainwhich are lower than logging ``level``. 511a10a988aSShreyansh Jain 512db27370bSStephen HemmingerAllowing & Blocking 513db27370bSStephen Hemminger------------------- 51450245be0SHemant Agrawal 515db27370bSStephen HemmingerFor blocking a DPAA2 device, following commands can be used. 51650245be0SHemant Agrawal 51750245be0SHemant Agrawal .. code-block:: console 51850245be0SHemant Agrawal 51950245be0SHemant Agrawal <dpdk app> <EAL args> -b "fslmc:dpni.x" -- ... 52050245be0SHemant Agrawal 52150245be0SHemant AgrawalWhere x is the device object id as configured in resource container. 52250245be0SHemant Agrawal 523db27370bSStephen HemmingerRunning secondary debug app without blocklist 5247807a4fdSRohit Raj--------------------------------------------- 5257807a4fdSRohit Raj 5267807a4fdSRohit Rajdpaa2 hardware imposes limits on some H/W access devices like Management 5277807a4fdSRohit RajControl Port and H/W portal. This causes issue in their shared usages in 5287807a4fdSRohit Rajcase of multi-process applications. It can overcome by using 529db27370bSStephen Hemmingerallowlist/blocklist in primary and secondary applications. 5307807a4fdSRohit Raj 5317807a4fdSRohit RajIn order to ease usage of standard debugging apps like dpdk-procinfo, dpaa2 5327807a4fdSRohit Rajdriver reserves extra Management Control Port and H/W portal which can be 5337807a4fdSRohit Rajused by debug application to debug any existing application without 534db27370bSStephen Hemmingerblocking these devices in primary process. 5357807a4fdSRohit Raj 536846a8305SHemant AgrawalLimitations 537846a8305SHemant Agrawal----------- 538846a8305SHemant Agrawal 539846a8305SHemant AgrawalPlatform Requirement 540846a8305SHemant Agrawal~~~~~~~~~~~~~~~~~~~~ 541846a8305SHemant AgrawalDPAA2 drivers for DPDK can only work on NXP SoCs as listed in the 542846a8305SHemant Agrawal``Supported DPAA2 SoCs``. 543846a8305SHemant Agrawal 544846a8305SHemant AgrawalMaximum packet length 545846a8305SHemant Agrawal~~~~~~~~~~~~~~~~~~~~~ 546846a8305SHemant Agrawal 547846a8305SHemant AgrawalThe DPAA2 SoC family support a maximum of a 10240 jumbo frame. The value 5481bb4a528SFerruh Yigitis fixed and cannot be changed. So, even when the ``rxmode.mtu`` 549846a8305SHemant Agrawalmember of ``struct rte_eth_conf`` is set to a value lower than 10240, frames 550846a8305SHemant Agrawalup to 10240 bytes can still reach the host interface. 55141dae1e0SHemant Agrawal 55241dae1e0SHemant AgrawalOther Limitations 55341dae1e0SHemant Agrawal~~~~~~~~~~~~~~~~~ 55441dae1e0SHemant Agrawal 55541dae1e0SHemant Agrawal- RSS hash key cannot be modified. 55641dae1e0SHemant Agrawal- RSS RETA cannot be configured. 557ac624068SGagandeep Singh 558ac624068SGagandeep Singh.. _dptmapi: 559ac624068SGagandeep Singh 560ac624068SGagandeep SinghTraffic Management API 561ac624068SGagandeep Singh---------------------- 562ac624068SGagandeep Singh 563ac624068SGagandeep SinghDPAA2 PMD supports generic DPDK Traffic Management API which allows to 564ac624068SGagandeep Singhconfigure the following features: 565ac624068SGagandeep Singh 566443b949eSDavid Marchand#. Hierarchical scheduling 567443b949eSDavid Marchand 568443b949eSDavid Marchand#. Traffic shaping 569ac624068SGagandeep Singh 570ac624068SGagandeep SinghInternally TM is represented by a hierarchy (tree) of nodes. 571ac624068SGagandeep SinghNode which has a parent is called a leaf whereas node without 572ac624068SGagandeep Singhparent is called a non-leaf (root). 573ac624068SGagandeep Singh 574ac624068SGagandeep SinghNodes hold following types of settings: 575ac624068SGagandeep Singh 576ac624068SGagandeep Singh- for egress scheduler configuration: weight 577ac624068SGagandeep Singh- for egress rate limiter: private shaper 578ac624068SGagandeep Singh 579ac624068SGagandeep SinghHierarchy is always constructed from the top, i.e first a root node is added 580ac624068SGagandeep Singhthen some number of leaf nodes. Number of leaf nodes cannot exceed number 581ac624068SGagandeep Singhof configured tx queues. 582ac624068SGagandeep Singh 583ac624068SGagandeep SinghAfter hierarchy is complete it can be committed. 584ac624068SGagandeep Singh 585*41dd9a6bSDavid YoungFor an additional description please refer to DPDK :doc:`../prog_guide/ethdev/traffic_management`. 586ac624068SGagandeep Singh 587ac624068SGagandeep SinghSupported Features 588ac624068SGagandeep Singh~~~~~~~~~~~~~~~~~~ 589ac624068SGagandeep Singh 590ac624068SGagandeep SinghThe following capabilities are supported: 591ac624068SGagandeep Singh 59272100f0dSGagandeep Singh- Level0 (root node), Level1 and Level2 are supported. 593ac624068SGagandeep Singh- 1 private shaper at root node (port level) is supported. 594ac624068SGagandeep Singh- 8 TX queues per port supported (1 channel per port) 595ac624068SGagandeep Singh- Both SP and WFQ scheduling mechanisms are supported on all 8 queues. 596ac624068SGagandeep Singh- Congestion notification is supported. It means if there is congestion on 597ac624068SGagandeep Singh the network, DPDK driver will not enqueue any packet (no taildrop or WRED) 598ac624068SGagandeep Singh 599ac624068SGagandeep Singh User can also check node, level capabilities using testpmd commands. 600ac624068SGagandeep Singh 601ac624068SGagandeep SinghUsage example 602ac624068SGagandeep Singh~~~~~~~~~~~~~ 603ac624068SGagandeep Singh 604*41dd9a6bSDavid YoungFor a detailed usage description please refer to "Traffic Management" section in DPDK :doc:`../testpmd_app_ug/testpmd_funcs`. 605ac624068SGagandeep Singh 606443b949eSDavid Marchand#. Run testpmd as follows: 607ac624068SGagandeep Singh 608ac624068SGagandeep Singh .. code-block:: console 609ac624068SGagandeep Singh 610ac624068SGagandeep Singh ./dpdk-testpmd -c 0xf -n 1 -- -i --portmask 0x3 --nb-cores=1 --txq=4 --rxq=4 611ac624068SGagandeep Singh 612443b949eSDavid Marchand#. Stop all ports: 613ac624068SGagandeep Singh 614ac624068SGagandeep Singh .. code-block:: console 615ac624068SGagandeep Singh 616ac624068SGagandeep Singh testpmd> port stop all 617ac624068SGagandeep Singh 618443b949eSDavid Marchand#. Add shaper profile: 619ac624068SGagandeep Singh 620ac624068SGagandeep Singh One port level shaper and strict priority on all 4 queues of port 0: 621ac624068SGagandeep Singh 622ac624068SGagandeep Singh .. code-block:: console 623ac624068SGagandeep Singh 624ac624068SGagandeep Singh add port tm node shaper profile 0 1 104857600 64 100 0 0 625ac624068SGagandeep Singh add port tm nonleaf node 0 8 -1 0 1 0 1 1 1 0 626ac624068SGagandeep Singh add port tm leaf node 0 0 8 0 1 1 -1 0 0 0 0 627ac624068SGagandeep Singh add port tm leaf node 0 1 8 1 1 1 -1 0 0 0 0 628ac624068SGagandeep Singh add port tm leaf node 0 2 8 2 1 1 -1 0 0 0 0 629ac624068SGagandeep Singh add port tm leaf node 0 3 8 3 1 1 -1 0 0 0 0 630ac624068SGagandeep Singh port tm hierarchy commit 0 no 631ac624068SGagandeep Singh 632ac624068SGagandeep Singh or 633ac624068SGagandeep Singh 634ac624068SGagandeep Singh One port level shaper and WFQ on all 4 queues of port 0: 635ac624068SGagandeep Singh 636ac624068SGagandeep Singh .. code-block:: console 637ac624068SGagandeep Singh 638ac624068SGagandeep Singh add port tm node shaper profile 0 1 104857600 64 100 0 0 639ac624068SGagandeep Singh add port tm nonleaf node 0 8 -1 0 1 0 1 1 1 0 640ac624068SGagandeep Singh add port tm leaf node 0 0 8 0 200 1 -1 0 0 0 0 641ac624068SGagandeep Singh add port tm leaf node 0 1 8 0 300 1 -1 0 0 0 0 642ac624068SGagandeep Singh add port tm leaf node 0 2 8 0 400 1 -1 0 0 0 0 643ac624068SGagandeep Singh add port tm leaf node 0 3 8 0 500 1 -1 0 0 0 0 644ac624068SGagandeep Singh port tm hierarchy commit 0 no 645ac624068SGagandeep Singh 646443b949eSDavid Marchand#. Create flows as per the source IP addresses: 647ac624068SGagandeep Singh 648ac624068SGagandeep Singh .. code-block:: console 649ac624068SGagandeep Singh 650ac624068SGagandeep Singh flow create 1 group 0 priority 1 ingress pattern ipv4 src is \ 651ac624068SGagandeep Singh 10.10.10.1 / end actions queue index 0 / end 652ac624068SGagandeep Singh flow create 1 group 0 priority 2 ingress pattern ipv4 src is \ 653ac624068SGagandeep Singh 10.10.10.2 / end actions queue index 1 / end 654ac624068SGagandeep Singh flow create 1 group 0 priority 3 ingress pattern ipv4 src is \ 655ac624068SGagandeep Singh 10.10.10.3 / end actions queue index 2 / end 656ac624068SGagandeep Singh flow create 1 group 0 priority 4 ingress pattern ipv4 src is \ 657ac624068SGagandeep Singh 10.10.10.4 / end actions queue index 3 / end 658ac624068SGagandeep Singh 659443b949eSDavid Marchand#. Start all ports 660ac624068SGagandeep Singh 661ac624068SGagandeep Singh .. code-block:: console 662ac624068SGagandeep Singh 663ac624068SGagandeep Singh testpmd> port start all 664ac624068SGagandeep Singh 665ac624068SGagandeep Singh 666ac624068SGagandeep Singh 667443b949eSDavid Marchand#. Enable forwarding 668ac624068SGagandeep Singh 669ac624068SGagandeep Singh .. code-block:: console 670ac624068SGagandeep Singh 671ac624068SGagandeep Singh testpmd> start 672ac624068SGagandeep Singh 673443b949eSDavid Marchand#. Inject the traffic on port1 as per the configured flows, you will see shaped and scheduled forwarded traffic on port0 674