Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1.. include:: <isonum.txt>
2
3DPAA2 (Data Path Acceleration Architecture Gen2) Overview
4=========================================================
5
6:Copyright: |copy| 2015 Freescale Semiconductor Inc.
7:Copyright: |copy| 2018 NXP
8
9This document provides an overview of the Freescale DPAA2 architecture
10and how it is integrated into the Linux kernel.
11
12Introduction
13============
14
15DPAA2 is a hardware architecture designed for high-speeed network
16packet processing. DPAA2 consists of sophisticated mechanisms for
17processing Ethernet packets, queue management, buffer management,
18autonomous L2 switching, virtual Ethernet bridging, and accelerator
19(e.g. crypto) sharing.
20
21A DPAA2 hardware component called the Management Complex (or MC) manages the
22DPAA2 hardware resources. The MC provides an object-based abstraction for
23software drivers to use the DPAA2 hardware.
24The MC uses DPAA2 hardware resources such as queues, buffer pools, and
25network ports to create functional objects/devices such as network
26interfaces, an L2 switch, or accelerator instances.
27The MC provides memory-mapped I/O command interfaces (MC portals)
28which DPAA2 software drivers use to operate on DPAA2 objects.
29
30The diagram below shows an overview of the DPAA2 resource management
31architecture::
32
33 +--------------------------------------+
34 | OS |
35 | DPAA2 drivers |
36 | | |
37 +-----------------------------|--------+
38 |
39 | (create,discover,connect
40 | config,use,destroy)
41 |
42 DPAA2 |
43 +------------------------| mc portal |-+
44 | | |
45 | +- - - - - - - - - - - - -V- - -+ |
46 | | | |
47 | | Management Complex (MC) | |
48 | | | |
49 | +- - - - - - - - - - - - - - - -+ |
50 | |
51 | Hardware Hardware |
52 | Resources Objects |
53 | --------- ------- |
54 | -queues -DPRC |
55 | -buffer pools -DPMCP |
56 | -Eth MACs/ports -DPIO |
57 | -network interface -DPNI |
58 | profiles -DPMAC |
59 | -queue portals -DPBP |
60 | -MC portals ... |
61 | ... |
62 | |
63 +--------------------------------------+
64
65
66The MC mediates operations such as create, discover,
67connect, configuration, and destroy. Fast-path operations
68on data, such as packet transmit/receive, are not mediated by
69the MC and are done directly using memory mapped regions in
70DPIO objects.
71
72Overview of DPAA2 Objects
73=========================
74
75The section provides a brief overview of some key DPAA2 objects.
76A simple scenario is described illustrating the objects involved
77in creating a network interfaces.
78
79DPRC (Datapath Resource Container)
80----------------------------------
81
82A DPRC is a container object that holds all the other
83types of DPAA2 objects. In the example diagram below there
84are 8 objects of 5 types (DPMCP, DPIO, DPBP, DPNI, and DPMAC)
85in the container.
86
87::
88
89 +---------------------------------------------------------+
90 | DPRC |
91 | |
92 | +-------+ +-------+ +-------+ +-------+ +-------+ |
93 | | DPMCP | | DPIO | | DPBP | | DPNI | | DPMAC | |
94 | +-------+ +-------+ +-------+ +---+---+ +---+---+ |
95 | | DPMCP | | DPIO | |
96 | +-------+ +-------+ |
97 | | DPMCP | |
98 | +-------+ |
99 | |
100 +---------------------------------------------------------+
101
102From the point of view of an OS, a DPRC behaves similar to a plug and
103play bus, like PCI. DPRC commands can be used to enumerate the contents
104of the DPRC, discover the hardware objects present (including mappable
105regions and interrupts).
106
107::
108
109 DPRC.1 (bus)
110 |
111 +--+--------+-------+-------+-------+
112 | | | | |
113 DPMCP.1 DPIO.1 DPBP.1 DPNI.1 DPMAC.1
114 DPMCP.2 DPIO.2
115 DPMCP.3
116
117Hardware objects can be created and destroyed dynamically, providing
118the ability to hot plug/unplug objects in and out of the DPRC.
119
120A DPRC has a mappable MMIO region (an MC portal) that can be used
121to send MC commands. It has an interrupt for status events (like
122hotplug).
123All objects in a container share the same hardware "isolation context".
124This means that with respect to an IOMMU the isolation granularity
125is at the DPRC (container) level, not at the individual object
126level.
127
128DPRCs can be defined statically and populated with objects
129via a config file passed to the MC when firmware starts it.
130
131DPAA2 Objects for an Ethernet Network Interface
132-----------------------------------------------
133
134A typical Ethernet NIC is monolithic-- the NIC device contains TX/RX
135queuing mechanisms, configuration mechanisms, buffer management,
136physical ports, and interrupts. DPAA2 uses a more granular approach
137utilizing multiple hardware objects. Each object provides specialized
138functions. Groups of these objects are used by software to provide
139Ethernet network interface functionality. This approach provides
140efficient use of finite hardware resources, flexibility, and
141performance advantages.
142
143The diagram below shows the objects needed for a simple
144network interface configuration on a system with 2 CPUs.
145
146::
147
148 +---+---+ +---+---+
149 CPU0 CPU1
150 +---+---+ +---+---+
151 | |
152 +---+---+ +---+---+
153 DPIO DPIO
154 +---+---+ +---+---+
155 \ /
156 \ /
157 \ /
158 +---+---+
159 DPNI --- DPBP,DPMCP
160 +---+---+
161 |
162 |
163 +---+---+
164 DPMAC
165 +---+---+
166 |
167 port/PHY
168
169Below the objects are described. For each object a brief description
170is provided along with a summary of the kinds of operations the object
171supports and a summary of key resources of the object (MMIO regions
172and IRQs).
173
174DPMAC (Datapath Ethernet MAC)
175~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
176Represents an Ethernet MAC, a hardware device that connects to an Ethernet
177PHY and allows physical transmission and reception of Ethernet frames.
178
179- MMIO regions: none
180- IRQs: DPNI link change
181- commands: set link up/down, link config, get stats,
182 IRQ config, enable, reset
183
184DPNI (Datapath Network Interface)
185Contains TX/RX queues, network interface configuration, and RX buffer pool
186configuration mechanisms. The TX/RX queues are in memory and are identified
187by queue number.
188
189- MMIO regions: none
190- IRQs: link state
191- commands: port config, offload config, queue config,
192 parse/classify config, IRQ config, enable, reset
193
194DPIO (Datapath I/O)
195~~~~~~~~~~~~~~~~~~~
196Provides interfaces to enqueue and dequeue
197packets and do hardware buffer pool management operations. The DPAA2
198architecture separates the mechanism to access queues (the DPIO object)
199from the queues themselves. The DPIO provides an MMIO interface to
200enqueue/dequeue packets. To enqueue something a descriptor is written
201to the DPIO MMIO region, which includes the target queue number.
202There will typically be one DPIO assigned to each CPU. This allows all
203CPUs to simultaneously perform enqueue/dequeued operations. DPIOs are
204expected to be shared by different DPAA2 drivers.
205
206- MMIO regions: queue operations, buffer management
207- IRQs: data availability, congestion notification, buffer
208 pool depletion
209- commands: IRQ config, enable, reset
210
211DPBP (Datapath Buffer Pool)
212~~~~~~~~~~~~~~~~~~~~~~~~~~~
213Represents a hardware buffer pool.
214
215- MMIO regions: none
216- IRQs: none
217- commands: enable, reset
218
219DPMCP (Datapath MC Portal)
220~~~~~~~~~~~~~~~~~~~~~~~~~~
221Provides an MC command portal.
222Used by drivers to send commands to the MC to manage
223objects.
224
225- MMIO regions: MC command portal
226- IRQs: command completion
227- commands: IRQ config, enable, reset
228
229Object Connections
230==================
231Some objects have explicit relationships that must
232be configured:
233
234- DPNI <--> DPMAC
235- DPNI <--> DPNI
236- DPNI <--> L2-switch-port
237
238 A DPNI must be connected to something such as a DPMAC,
239 another DPNI, or L2 switch port. The DPNI connection
240 is made via a DPRC command.
241
242::
243
244 +-------+ +-------+
245 | DPNI | | DPMAC |
246 +---+---+ +---+---+
247 | |
248 +==========+
249
250- DPNI <--> DPBP
251
252 A network interface requires a 'buffer pool' (DPBP
253 object) which provides a list of pointers to memory
254 where received Ethernet data is to be copied. The
255 Ethernet driver configures the DPBPs associated with
256 the network interface.
257
258Interrupts
259==========
260All interrupts generated by DPAA2 objects are message
261interrupts. At the hardware level message interrupts
262generated by devices will normally have 3 components--
2631) a non-spoofable 'device-id' expressed on the hardware
264bus, 2) an address, 3) a data value.
265
266In the case of DPAA2 devices/objects, all objects in the
267same container/DPRC share the same 'device-id'.
268For ARM-based SoC this is the same as the stream ID.
269
270
271DPAA2 Linux Drivers Overview
272============================
273
274This section provides an overview of the Linux kernel drivers for
275DPAA2-- 1) the bus driver and associated "DPAA2 infrastructure"
276drivers and 2) functional object drivers (such as Ethernet).
277
278As described previously, a DPRC is a container that holds the other
279types of DPAA2 objects. It is functionally similar to a plug-and-play
280bus controller.
281Each object in the DPRC is a Linux "device" and is bound to a driver.
282The diagram below shows the Linux drivers involved in a networking
283scenario and the objects bound to each driver. A brief description
284of each driver follows.
285
286::
287
288 +------------+
289 | OS Network |
290 | Stack |
291 +------------+ +------------+
292 | Allocator |. . . . . . . | Ethernet |
293 |(DPMCP,DPBP)| | (DPNI) |
294 +-.----------+ +---+---+----+
295 . . ^ |
296 . . <data avail, | | <enqueue,
297 . . tx confirm> | | dequeue>
298 +-------------+ . | |
299 | DPRC driver | . +---+---V----+ +---------+
300 | (DPRC) | . . . . . .| DPIO driver| | MAC |
301 +----------+--+ | (DPIO) | | (DPMAC) |
302 | +------+-----+ +-----+---+
303 |<dev add/remove> | |
304 | | |
305 +--------+----------+ | +--+---+
306 | MC-bus driver | | | PHY |
307 | | | |driver|
308 | /bus/fsl-mc | | +--+---+
309 +-------------------+ | |
310 | |
311 ========================= HARDWARE =========|=================|======
312 DPIO |
313 | |
314 DPNI---DPBP |
315 | |
316 DPMAC |
317 | |
318 PHY ---------------+
319 ============================================|========================
320
321A brief description of each driver is provided below.
322
323MC-bus driver
324-------------
325The MC-bus driver is a platform driver and is probed from a
326node in the device tree (compatible "fsl,qoriq-mc") passed in by boot
327firmware. It is responsible for bootstrapping the DPAA2 kernel
328infrastructure.
329Key functions include:
330
331- registering a new bus type named "fsl-mc" with the kernel,
332 and implementing bus call-backs (e.g. match/uevent/dev_groups)
333- implementing APIs for DPAA2 driver registration and for device
334 add/remove
335- creates an MSI IRQ domain
336- doing a 'device add' to expose the 'root' DPRC, in turn triggering
337 a bind of the root DPRC to the DPRC driver
338
339The binding for the MC-bus device-tree node can be consulted at
340*Documentation/devicetree/bindings/misc/fsl,qoriq-mc.txt*.
341The sysfs bind/unbind interfaces for the MC-bus can be consulted at
342*Documentation/ABI/testing/sysfs-bus-fsl-mc*.
343
344DPRC driver
345-----------
346The DPRC driver is bound to DPRC objects and does runtime management
347of a bus instance. It performs the initial bus scan of the DPRC
348and handles interrupts for container events such as hot plug by
349re-scanning the DPRC.
350
351Allocator
352---------
353Certain objects such as DPMCP and DPBP are generic and fungible,
354and are intended to be used by other drivers. For example,
355the DPAA2 Ethernet driver needs:
356
357- DPMCPs to send MC commands, to configure network interfaces
358- DPBPs for network buffer pools
359
360The allocator driver registers for these allocatable object types
361and those objects are bound to the allocator when the bus is probed.
362The allocator maintains a pool of objects that are available for
363allocation by other DPAA2 drivers.
364
365DPIO driver
366-----------
367The DPIO driver is bound to DPIO objects and provides services that allow
368other drivers such as the Ethernet driver to enqueue and dequeue data for
369their respective objects.
370Key services include:
371
372- data availability notifications
373- hardware queuing operations (enqueue and dequeue of data)
374- hardware buffer pool management
375
376To transmit a packet the Ethernet driver puts data on a queue and
377invokes a DPIO API. For receive, the Ethernet driver registers
378a data availability notification callback. To dequeue a packet
379a DPIO API is used.
380There is typically one DPIO object per physical CPU for optimum
381performance, allowing different CPUs to simultaneously enqueue
382and dequeue data.
383
384The DPIO driver operates on behalf of all DPAA2 drivers
385active in the kernel-- Ethernet, crypto, compression,
386etc.
387
388Ethernet driver
389---------------
390The Ethernet driver is bound to a DPNI and implements the kernel
391interfaces needed to connect the DPAA2 network interface to
392the network stack.
393Each DPNI corresponds to a Linux network interface.
394
395MAC driver
396----------
397An Ethernet PHY is an off-chip, board specific component and is managed
398by the appropriate PHY driver via an mdio bus. The MAC driver
399plays a role of being a proxy between the PHY driver and the
400MC. It does this proxy via the MC commands to a DPMAC object.
401If the PHY driver signals a link change, the MAC driver notifies
402the MC via a DPMAC command. If a network interface is brought
403up or down, the MC notifies the DPMAC driver via an interrupt and
404the driver can take appropriate action.