dpaa.txt 9.4 KB

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