dpaa.rst 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. .. SPDX-License-Identifier: GPL-2.0
  2. ==============================
  3. The QorIQ DPAA Ethernet Driver
  4. ==============================
  5. Authors:
  6. - Madalin Bucur <madalin.bucur@nxp.com>
  7. - Camelia Groza <camelia.groza@nxp.com>
  8. .. Contents
  9. - DPAA Ethernet Overview
  10. - DPAA Ethernet Supported SoCs
  11. - Configuring DPAA Ethernet in your kernel
  12. - DPAA Ethernet Frame Processing
  13. - DPAA Ethernet Features
  14. - DPAA IRQ Affinity and Receive Side Scaling
  15. - Debugging
  16. DPAA Ethernet Overview
  17. ======================
  18. DPAA stands for Data Path Acceleration Architecture and it is a
  19. set of networking acceleration IPs that are available on several
  20. generations of SoCs, both on PowerPC and ARM64.
  21. The Freescale DPAA architecture consists of a series of hardware blocks
  22. that support Ethernet connectivity. The Ethernet driver depends upon the
  23. following drivers in the Linux kernel:
  24. - Peripheral Access Memory Unit (PAMU) (* needed only for PPC platforms)
  25. drivers/iommu/fsl_*
  26. - Frame Manager (FMan)
  27. drivers/net/ethernet/freescale/fman
  28. - Queue Manager (QMan), Buffer Manager (BMan)
  29. drivers/soc/fsl/qbman
  30. A simplified view of the dpaa_eth interfaces mapped to FMan MACs::
  31. dpaa_eth /eth0\ ... /ethN\
  32. driver | | | |
  33. ------------- ---- ----------- ---- -------------
  34. -Ports / Tx Rx \ ... / Tx Rx \
  35. FMan | | | |
  36. -MACs | MAC0 | | MACN |
  37. / dtsec0 \ ... / dtsecN \ (or tgec)
  38. / \ / \(or memac)
  39. --------- -------------- --- -------------- ---------
  40. FMan, FMan Port, FMan SP, FMan MURAM drivers
  41. ---------------------------------------------------------
  42. FMan HW blocks: MURAM, MACs, Ports, SP
  43. ---------------------------------------------------------
  44. The dpaa_eth relation to the QMan, BMan and FMan::
  45. ________________________________
  46. dpaa_eth / eth0 \
  47. driver / \
  48. --------- -^- -^- -^- --- ---------
  49. QMan driver / \ / \ / \ \ / | BMan |
  50. |Rx | |Rx | |Tx | |Tx | | driver |
  51. --------- |Dfl| |Err| |Cnf| |FQs| | |
  52. QMan HW |FQ | |FQ | |FQs| | | | |
  53. / \ / \ / \ \ / | |
  54. --------- --- --- --- -v- ---------
  55. | FMan QMI | |
  56. | FMan HW FMan BMI | BMan HW |
  57. ----------------------- --------
  58. where the acronyms used above (and in the code) are:
  59. =============== ===========================================================
  60. DPAA Data Path Acceleration Architecture
  61. FMan DPAA Frame Manager
  62. QMan DPAA Queue Manager
  63. BMan DPAA Buffers Manager
  64. QMI QMan interface in FMan
  65. BMI BMan interface in FMan
  66. FMan SP FMan Storage Profiles
  67. MURAM Multi-user RAM in FMan
  68. FQ QMan Frame Queue
  69. Rx Dfl FQ default reception FQ
  70. Rx Err FQ Rx error frames FQ
  71. Tx Cnf FQ Tx confirmation FQs
  72. Tx FQs transmission frame queues
  73. dtsec datapath three speed Ethernet controller (10/100/1000 Mbps)
  74. tgec ten gigabit Ethernet controller (10 Gbps)
  75. memac multirate Ethernet MAC (10/100/1000/10000)
  76. =============== ===========================================================
  77. DPAA Ethernet Supported SoCs
  78. ============================
  79. The DPAA drivers enable the Ethernet controllers present on the following SoCs:
  80. PPC
  81. - P1023
  82. - P2041
  83. - P3041
  84. - P4080
  85. - P5020
  86. - P5040
  87. - T1023
  88. - T1024
  89. - T1040
  90. - T1042
  91. - T2080
  92. - T4240
  93. - B4860
  94. ARM
  95. - LS1043A
  96. - LS1046A
  97. Configuring DPAA Ethernet in your kernel
  98. ========================================
  99. To enable the DPAA Ethernet driver, the following Kconfig options are required::
  100. # common for arch/arm64 and arch/powerpc platforms
  101. CONFIG_FSL_DPAA=y
  102. CONFIG_FSL_FMAN=y
  103. CONFIG_FSL_DPAA_ETH=y
  104. CONFIG_FSL_XGMAC_MDIO=y
  105. # for arch/powerpc only
  106. CONFIG_FSL_PAMU=y
  107. # common options needed for the PHYs used on the RDBs
  108. CONFIG_VITESSE_PHY=y
  109. CONFIG_REALTEK_PHY=y
  110. CONFIG_AQUANTIA_PHY=y
  111. DPAA Ethernet Frame Processing
  112. ==============================
  113. On Rx, buffers for the incoming frames are retrieved from the buffers found
  114. in the dedicated interface buffer pool. The driver initializes and seeds these
  115. with one page buffers.
  116. On Tx, all transmitted frames are returned to the driver through Tx
  117. confirmation frame queues. The driver is then responsible for freeing the
  118. buffers. In order to do this properly, a backpointer is added to the buffer
  119. before transmission that points to the skb. When the buffer returns to the
  120. driver on a confirmation FQ, the skb can be correctly consumed.
  121. DPAA Ethernet Features
  122. ======================
  123. Currently the DPAA Ethernet driver enables the basic features required for
  124. a Linux Ethernet driver. The support for advanced features will be added
  125. gradually.
  126. The driver has Rx and Tx checksum offloading for UDP and TCP. Currently the Rx
  127. checksum offload feature is enabled by default and cannot be controlled through
  128. ethtool. Also, rx-flow-hash and rx-hashing was added. The addition of RSS
  129. provides a big performance boost for the forwarding scenarios, allowing
  130. different traffic flows received by one interface to be processed by different
  131. CPUs in parallel.
  132. The driver has support for multiple prioritized Tx traffic classes. Priorities
  133. range from 0 (lowest) to 3 (highest). These are mapped to HW workqueues with
  134. strict priority levels. Each traffic class contains NR_CPU TX queues. By
  135. default, only one traffic class is enabled and the lowest priority Tx queues
  136. are used. Higher priority traffic classes can be enabled with the mqprio
  137. qdisc. For example, all four traffic classes are enabled on an interface with
  138. the following command. Furthermore, skb priority levels are mapped to traffic
  139. classes as follows:
  140. * priorities 0 to 3 - traffic class 0 (low priority)
  141. * priorities 4 to 7 - traffic class 1 (medium-low priority)
  142. * priorities 8 to 11 - traffic class 2 (medium-high priority)
  143. * priorities 12 to 15 - traffic class 3 (high priority)
  144. ::
  145. tc qdisc add dev <int> root handle 1: \
  146. mqprio num_tc 4 map 0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 hw 1
  147. DPAA IRQ Affinity and Receive Side Scaling
  148. ==========================================
  149. Traffic coming on the DPAA Rx queues or on the DPAA Tx confirmation
  150. queues is seen by the CPU as ingress traffic on a certain portal.
  151. The DPAA QMan portal interrupts are affined each to a certain CPU.
  152. The same portal interrupt services all the QMan portal consumers.
  153. By default the DPAA Ethernet driver enables RSS, making use of the
  154. DPAA FMan Parser and Keygen blocks to distribute traffic on 128
  155. hardware frame queues using a hash on IP v4/v6 source and destination
  156. and L4 source and destination ports, in present in the received frame.
  157. When RSS is disabled, all traffic received by a certain interface is
  158. received on the default Rx frame queue. The default DPAA Rx frame
  159. queues are configured to put the received traffic into a pool channel
  160. that allows any available CPU portal to dequeue the ingress traffic.
  161. The default frame queues have the HOLDACTIVE option set, ensuring that
  162. traffic bursts from a certain queue are serviced by the same CPU.
  163. This ensures a very low rate of frame reordering. A drawback of this
  164. is that only one CPU at a time can service the traffic received by a
  165. certain interface when RSS is not enabled.
  166. To implement RSS, the DPAA Ethernet driver allocates an extra set of
  167. 128 Rx frame queues that are configured to dedicated channels, in a
  168. round-robin manner. The mapping of the frame queues to CPUs is now
  169. hardcoded, there is no indirection table to move traffic for a certain
  170. FQ (hash result) to another CPU. The ingress traffic arriving on one
  171. of these frame queues will arrive at the same portal and will always
  172. be processed by the same CPU. This ensures intra-flow order preservation
  173. and workload distribution for multiple traffic flows.
  174. RSS can be turned off for a certain interface using ethtool, i.e.::
  175. # ethtool -N fm1-mac9 rx-flow-hash tcp4 ""
  176. To turn it back on, one needs to set rx-flow-hash for tcp4/6 or udp4/6::
  177. # ethtool -N fm1-mac9 rx-flow-hash udp4 sfdn
  178. There is no independent control for individual protocols, any command
  179. run for one of tcp4|udp4|ah4|esp4|sctp4|tcp6|udp6|ah6|esp6|sctp6 is
  180. going to control the rx-flow-hashing for all protocols on that interface.
  181. Besides using the FMan Keygen computed hash for spreading traffic on the
  182. 128 Rx FQs, the DPAA Ethernet driver also sets the skb hash value when
  183. the NETIF_F_RXHASH feature is on (active by default). This can be turned
  184. on or off through ethtool, i.e.::
  185. # ethtool -K fm1-mac9 rx-hashing off
  186. # ethtool -k fm1-mac9 | grep hash
  187. receive-hashing: off
  188. # ethtool -K fm1-mac9 rx-hashing on
  189. Actual changes:
  190. receive-hashing: on
  191. # ethtool -k fm1-mac9 | grep hash
  192. receive-hashing: on
  193. Please note that Rx hashing depends upon the rx-flow-hashing being on
  194. for that interface - turning off rx-flow-hashing will also disable the
  195. rx-hashing (without ethtool reporting it as off as that depends on the
  196. NETIF_F_RXHASH feature flag).
  197. Debugging
  198. =========
  199. The following statistics are exported for each interface through ethtool:
  200. - interrupt count per CPU
  201. - Rx packets count per CPU
  202. - Tx packets count per CPU
  203. - Tx confirmed packets count per CPU
  204. - Tx S/G frames count per CPU
  205. - Tx error count per CPU
  206. - Rx error count per CPU
  207. - Rx error count per type
  208. - congestion related statistics:
  209. - congestion status
  210. - time spent in congestion
  211. - number of time the device entered congestion
  212. - dropped packets count per cause
  213. The driver also exports the following information in sysfs:
  214. - the FQ IDs for each FQ type
  215. /sys/devices/platform/soc/<addr>.fman/<addr>.ethernet/dpaa-ethernet.<id>/net/fm<nr>-mac<nr>/fqids
  216. - the ID of the buffer pool in use
  217. /sys/devices/platform/soc/<addr>.fman/<addr>.ethernet/dpaa-ethernet.<id>/net/fm<nr>-mac<nr>/bpids