README.txt 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. Copyright (C) 2015 Freescale Semiconductor Inc.
  2. DPAA2 (Data Path Acceleration Architecture Gen2)
  3. ------------------------------------------------
  4. This document provides an overview of the Freescale DPAA2 architecture
  5. and how it is integrated into the Linux kernel.
  6. Contents summary
  7. -DPAA2 overview
  8. -Overview of DPAA2 objects
  9. -DPAA2 Linux driver architecture overview
  10. -bus driver
  11. -dprc driver
  12. -allocator
  13. -dpio driver
  14. -Ethernet
  15. -mac
  16. DPAA2 Overview
  17. --------------
  18. DPAA2 is a hardware architecture designed for high-speeed network
  19. packet processing. DPAA2 consists of sophisticated mechanisms for
  20. processing Ethernet packets, queue management, buffer management,
  21. autonomous L2 switching, virtual Ethernet bridging, and accelerator
  22. (e.g. crypto) sharing.
  23. A DPAA2 hardware component called the Management Complex (or MC) manages the
  24. DPAA2 hardware resources. The MC provides an object-based abstraction for
  25. software drivers to use the DPAA2 hardware.
  26. The MC uses DPAA2 hardware resources such as queues, buffer pools, and
  27. network ports to create functional objects/devices such as network
  28. interfaces, an L2 switch, or accelerator instances.
  29. The MC provides memory-mapped I/O command interfaces (MC portals)
  30. which DPAA2 software drivers use to operate on DPAA2 objects:
  31. +--------------------------------------+
  32. | OS |
  33. | DPAA2 drivers |
  34. | | |
  35. +-----------------------------|--------+
  36. |
  37. | (create,discover,connect
  38. | config,use,destroy)
  39. |
  40. DPAA2 |
  41. +------------------------| mc portal |-+
  42. | | |
  43. | +- - - - - - - - - - - - -V- - -+ |
  44. | | | |
  45. | | Management Complex (MC) | |
  46. | | | |
  47. | +- - - - - - - - - - - - - - - -+ |
  48. | |
  49. | Hardware Hardware |
  50. | Resources Objects |
  51. | --------- ------- |
  52. | -queues -DPRC |
  53. | -buffer pools -DPMCP |
  54. | -Eth MACs/ports -DPIO |
  55. | -network interface -DPNI |
  56. | profiles -DPMAC |
  57. | -queue portals -DPBP |
  58. | -MC portals ... |
  59. | ... |
  60. | |
  61. +--------------------------------------+
  62. The MC mediates operations such as create, discover,
  63. connect, configuration, and destroy. Fast-path operations
  64. on data, such as packet transmit/receive, are not mediated by
  65. the MC and are done directly using memory mapped regions in
  66. DPIO objects.
  67. Overview of DPAA2 Objects
  68. -------------------------
  69. The section provides a brief overview of some key objects
  70. in the DPAA2 hardware. A simple scenario is described illustrating
  71. the objects involved in creating a network interfaces.
  72. -DPRC (Datapath Resource Container)
  73. A DPRC is an container object that holds all the other
  74. types of DPAA2 objects. In the example diagram below there
  75. are 8 objects of 5 types (DPMCP, DPIO, DPBP, DPNI, and DPMAC)
  76. in the container.
  77. +---------------------------------------------------------+
  78. | DPRC |
  79. | |
  80. | +-------+ +-------+ +-------+ +-------+ +-------+ |
  81. | | DPMCP | | DPIO | | DPBP | | DPNI | | DPMAC | |
  82. | +-------+ +-------+ +-------+ +---+---+ +---+---+ |
  83. | | DPMCP | | DPIO | |
  84. | +-------+ +-------+ |
  85. | | DPMCP | |
  86. | +-------+ |
  87. | |
  88. +---------------------------------------------------------+
  89. From the point of view of an OS, a DPRC is bus-like. Like
  90. a plug-and-play bus, such as PCI, DPRC commands can be used to
  91. enumerate the contents of the DPRC, discover the hardware
  92. objects present (including mappable regions and interrupts).
  93. dprc.1 (bus)
  94. |
  95. +--+--------+-------+-------+-------+
  96. | | | | |
  97. dpmcp.1 dpio.1 dpbp.1 dpni.1 dpmac.1
  98. dpmcp.2 dpio.2
  99. dpmcp.3
  100. Hardware objects can be created and destroyed dynamically, providing
  101. the ability to hot plug/unplug objects in and out of the DPRC.
  102. A DPRC has a mappable mmio region (an MC portal) that can be used
  103. to send MC commands. It has an interrupt for status events (like
  104. hotplug).
  105. All objects in a container share the same hardware "isolation context".
  106. This means that with respect to an IOMMU the isolation granularity
  107. is at the DPRC (container) level, not at the individual object
  108. level.
  109. DPRCs can be defined statically and populated with objects
  110. via a config file passed to the MC when firmware starts
  111. it. There is also a Linux user space tool called "restool"
  112. that can be used to create/destroy containers and objects
  113. dynamically.
  114. -DPAA2 Objects for an Ethernet Network Interface
  115. A typical Ethernet NIC is monolithic-- the NIC device contains TX/RX
  116. queuing mechanisms, configuration mechanisms, buffer management,
  117. physical ports, and interrupts. DPAA2 uses a more granular approach
  118. utilizing multiple hardware objects. Each object has specialized
  119. functions, and are used together by software to provide Ethernet network
  120. interface functionality. This approach provides efficient use of finite
  121. hardware resources, flexibility, and performance advantages.
  122. The diagram below shows the objects needed for a simple
  123. network interface configuration on a system with 2 CPUs.
  124. +---+---+ +---+---+
  125. CPU0 CPU1
  126. +---+---+ +---+---+
  127. | |
  128. +---+---+ +---+---+
  129. DPIO DPIO
  130. +---+---+ +---+---+
  131. \ /
  132. \ /
  133. \ /
  134. +---+---+
  135. DPNI --- DPBP,DPMCP
  136. +---+---+
  137. |
  138. |
  139. +---+---+
  140. DPMAC
  141. +---+---+
  142. |
  143. port/PHY
  144. Below the objects are described. For each object a brief description
  145. is provided along with a summary of the kinds of operations the object
  146. supports and a summary of key resources of the object (mmio regions
  147. and irqs).
  148. -DPMAC (Datapath Ethernet MAC): represents an Ethernet MAC, a
  149. hardware device that connects to an Ethernet PHY and allows
  150. physical transmission and reception of Ethernet frames.
  151. -mmio regions: none
  152. -irqs: dpni link change
  153. -commands: set link up/down, link config, get stats,
  154. irq config, enable, reset
  155. -DPNI (Datapath Network Interface): contains TX/RX queues,
  156. network interface configuration, and rx buffer pool configuration
  157. mechanisms.
  158. -mmio regions: none
  159. -irqs: link state
  160. -commands: port config, offload config, queue config,
  161. parse/classify config, irq config, enable, reset
  162. -DPIO (Datapath I/O): provides interfaces to enqueue and dequeue
  163. packets and do hardware buffer pool management operations. For
  164. optimum performance there is typically DPIO per CPU. This allows
  165. each CPU to perform simultaneous enqueue/dequeue operations.
  166. -mmio regions: queue operations, buffer mgmt
  167. -irqs: data availability, congestion notification, buffer
  168. pool depletion
  169. -commands: irq config, enable, reset
  170. -DPBP (Datapath Buffer Pool): represents a hardware buffer
  171. pool.
  172. -mmio regions: none
  173. -irqs: none
  174. -commands: enable, reset
  175. -DPMCP (Datapath MC Portal): provides an MC command portal.
  176. Used by drivers to send commands to the MC to manage
  177. objects.
  178. -mmio regions: MC command portal
  179. -irqs: command completion
  180. -commands: irq config, enable, reset
  181. Object Connections
  182. ------------------
  183. Some objects have explicit relationships that must
  184. be configured:
  185. -DPNI <--> DPMAC
  186. -DPNI <--> DPNI
  187. -DPNI <--> L2-switch-port
  188. A DPNI must be connected to something such as a DPMAC,
  189. another DPNI, or L2 switch port. The DPNI connection
  190. is made via a DPRC command.
  191. +-------+ +-------+
  192. | DPNI | | DPMAC |
  193. +---+---+ +---+---+
  194. | |
  195. +==========+
  196. -DPNI <--> DPBP
  197. A network interface requires a 'buffer pool' (DPBP
  198. object) which provides a list of pointers to memory
  199. where received Ethernet data is to be copied. The
  200. Ethernet driver configures the DPBPs associated with
  201. the network interface.
  202. Interrupts
  203. ----------
  204. All interrupts generated by DPAA2 objects are message
  205. interrupts. At the hardware level message interrupts
  206. generated by devices will normally have 3 components--
  207. 1) a non-spoofable 'device-id' expressed on the hardware
  208. bus, 2) an address, 3) a data value.
  209. In the case of DPAA2 devices/objects, all objects in the
  210. same container/DPRC share the same 'device-id'.
  211. For ARM-based SoC this is the same as the stream ID.
  212. DPAA2 Linux Driver Overview
  213. ---------------------------
  214. This section provides an overview of the Linux kernel drivers for
  215. DPAA2-- 1) the bus driver and associated "DPAA2 infrastructure"
  216. drivers and 2) functional object drivers (such as Ethernet).
  217. As described previously, a DPRC is a container that holds the other
  218. types of DPAA2 objects. It is functionally similar to a plug-and-play
  219. bus controller.
  220. Each object in the DPRC is a Linux "device" and is bound to a driver.
  221. The diagram below shows the Linux drivers involved in a networking
  222. scenario and the objects bound to each driver. A brief description
  223. of each driver follows.
  224. +------------+
  225. | OS Network |
  226. | Stack |
  227. +------------+ +------------+
  228. | Allocator |. . . . . . . | Ethernet |
  229. |(dpmcp,dpbp)| | (dpni) |
  230. +-.----------+ +---+---+----+
  231. . . ^ |
  232. . . <data avail, | |<enqueue,
  233. . . tx confirm> | | dequeue>
  234. +-------------+ . | |
  235. | DPRC driver | . +---+---V----+ +---------+
  236. | (dprc) | . . . . . .| DPIO driver| | MAC |
  237. +----------+--+ | (dpio) | | (dpmac) |
  238. | +------+-----+ +-----+---+
  239. |<dev add/remove> | |
  240. | | |
  241. +----+--------------+ | +--+---+
  242. | mc-bus driver | | | PHY |
  243. | | | |driver|
  244. | /fsl-mc@80c000000 | | +--+---+
  245. +-------------------+ | |
  246. | |
  247. ================================ HARDWARE =========|=================|======
  248. DPIO |
  249. | |
  250. DPNI---DPBP |
  251. | |
  252. DPMAC |
  253. | |
  254. PHY ---------------+
  255. ===================================================|========================
  256. A brief description of each driver is provided below.
  257. mc-bus driver
  258. -------------
  259. The mc-bus driver is a platform driver and is probed from an
  260. "/fsl-mc@xxxx" node in the device tree passed in by boot firmware.
  261. It is responsible for bootstrapping the DPAA2 kernel infrastructure.
  262. Key functions include:
  263. -registering a new bus type named "fsl-mc" with the kernel,
  264. and implementing bus call-backs (e.g. match/uevent/dev_groups)
  265. -implemeting APIs for DPAA2 driver registration and for device
  266. add/remove
  267. -creates an MSI irq domain
  268. -do a device add of the 'root' DPRC device, which is needed
  269. to bootstrap things
  270. DPRC driver
  271. -----------
  272. The dprc-driver is bound DPRC objects and does runtime management
  273. of a bus instance. It performs the initial bus scan of the DPRC
  274. and handles interrupts for container events such as hot plug.
  275. Allocator
  276. ----------
  277. Certain objects such as DPMCP and DPBP are generic and fungible,
  278. and are intended to be used by other drivers. For example,
  279. the DPAA2 Ethernet driver needs:
  280. -DPMCPs to send MC commands, to configure network interfaces
  281. -DPBPs for network buffer pools
  282. The allocator driver registers for these allocatable object types
  283. and those objects are bound to the allocator when the bus is probed.
  284. The allocator maintains a pool of objects that are available for
  285. allocation by other DPAA2 drivers.
  286. DPIO driver
  287. -----------
  288. The DPIO driver is bound to DPIO objects and provides services that allow
  289. other drivers such as the Ethernet driver to receive and transmit data.
  290. Key services include:
  291. -data availability notifications
  292. -hardware queuing operations (enqueue and dequeue of data)
  293. -hardware buffer pool management
  294. There is typically one DPIO object per physical CPU for optimum
  295. performance, allowing each CPU to simultaneously enqueue
  296. and dequeue data.
  297. The DPIO driver operates on behalf of all DPAA2 drivers
  298. active in the kernel-- Ethernet, crypto, compression,
  299. etc.
  300. Ethernet
  301. --------
  302. The Ethernet driver is bound to a DPNI and implements the kernel
  303. interfaces needed to connect the DPAA2 network interface to
  304. the network stack.
  305. Each DPNI corresponds to a Linux network interface.
  306. MAC driver
  307. ----------
  308. An Ethernet PHY is an off-chip, board specific component and is managed
  309. by the appropriate PHY driver via an mdio bus. The MAC driver
  310. plays a role of being a proxy between the PHY driver and the
  311. MC. It does this proxy via the MC commands to a DPMAC object.