altera_tse.txt 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. Altera Triple-Speed Ethernet MAC driver
  2. Copyright (C) 2008-2014 Altera Corporation
  3. This is the driver for the Altera Triple-Speed Ethernet (TSE) controllers
  4. using the SGDMA and MSGDMA soft DMA IP components. The driver uses the
  5. platform bus to obtain component resources. The designs used to test this
  6. driver were built for a Cyclone(R) V SOC FPGA board, a Cyclone(R) V FPGA board,
  7. and tested with ARM and NIOS processor hosts seperately. The anticipated use
  8. cases are simple communications between an embedded system and an external peer
  9. for status and simple configuration of the embedded system.
  10. For more information visit www.altera.com and www.rocketboards.org. Support
  11. forums for the driver may be found on www.rocketboards.org, and a design used
  12. to test this driver may be found there as well. Support is also available from
  13. the maintainer of this driver, found in MAINTAINERS.
  14. The Triple-Speed Ethernet, SGDMA, and MSGDMA components are all soft IP
  15. components that can be assembled and built into an FPGA using the Altera
  16. Quartus toolchain. Quartus 13.1 and 14.0 were used to build the design that
  17. this driver was tested against. The sopc2dts tool is used to create the
  18. device tree for the driver, and may be found at rocketboards.org.
  19. The driver probe function examines the device tree and determines if the
  20. Triple-Speed Ethernet instance is using an SGDMA or MSGDMA component. The
  21. probe function then installs the appropriate set of DMA routines to
  22. initialize, setup transmits, receives, and interrupt handling primitives for
  23. the respective configurations.
  24. The SGDMA component is to be deprecated in the near future (over the next 1-2
  25. years as of this writing in early 2014) in favor of the MSGDMA component.
  26. SGDMA support is included for existing designs and reference in case a
  27. developer wishes to support their own soft DMA logic and driver support. Any
  28. new designs should not use the SGDMA.
  29. The SGDMA supports only a single transmit or receive operation at a time, and
  30. therefore will not perform as well compared to the MSGDMA soft IP. Please
  31. visit www.altera.com for known, documented SGDMA errata.
  32. Scatter-gather DMA is not supported by the SGDMA or MSGDMA at this time.
  33. Scatter-gather DMA will be added to a future maintenance update to this
  34. driver.
  35. Jumbo frames are not supported at this time.
  36. The driver limits PHY operations to 10/100Mbps, and has not yet been fully
  37. tested for 1Gbps. This support will be added in a future maintenance update.
  38. 1) Kernel Configuration
  39. The kernel configuration option is ALTERA_TSE:
  40. Device Drivers ---> Network device support ---> Ethernet driver support --->
  41. Altera Triple-Speed Ethernet MAC support (ALTERA_TSE)
  42. 2) Driver parameters list:
  43. debug: message level (0: no output, 16: all);
  44. dma_rx_num: Number of descriptors in the RX list (default is 64);
  45. dma_tx_num: Number of descriptors in the TX list (default is 64).
  46. 3) Command line options
  47. Driver parameters can be also passed in command line by using:
  48. altera_tse=dma_rx_num:128,dma_tx_num:512
  49. 4) Driver information and notes
  50. 4.1) Transmit process
  51. When the driver's transmit routine is called by the kernel, it sets up a
  52. transmit descriptor by calling the underlying DMA transmit routine (SGDMA or
  53. MSGDMA), and initites a transmit operation. Once the transmit is complete, an
  54. interrupt is driven by the transmit DMA logic. The driver handles the transmit
  55. completion in the context of the interrupt handling chain by recycling
  56. resource required to send and track the requested transmit operation.
  57. 4.2) Receive process
  58. The driver will post receive buffers to the receive DMA logic during driver
  59. intialization. Receive buffers may or may not be queued depending upon the
  60. underlying DMA logic (MSGDMA is able queue receive buffers, SGDMA is not able
  61. to queue receive buffers to the SGDMA receive logic). When a packet is
  62. received, the DMA logic generates an interrupt. The driver handles a receive
  63. interrupt by obtaining the DMA receive logic status, reaping receive
  64. completions until no more receive completions are available.
  65. 4.3) Interrupt Mitigation
  66. The driver is able to mitigate the number of its DMA interrupts
  67. using NAPI for receive operations. Interrupt mitigation is not yet supported
  68. for transmit operations, but will be added in a future maintenance release.
  69. 4.4) Ethtool support
  70. Ethtool is supported. Driver statistics and internal errors can be taken using:
  71. ethtool -S ethX command. It is possible to dump registers etc.
  72. 4.5) PHY Support
  73. The driver is compatible with PAL to work with PHY and GPHY devices.
  74. 4.7) List of source files:
  75. o Kconfig
  76. o Makefile
  77. o altera_tse_main.c: main network device driver
  78. o altera_tse_ethtool.c: ethtool support
  79. o altera_tse.h: private driver structure and common definitions
  80. o altera_msgdma.h: MSGDMA implementation function definitions
  81. o altera_sgdma.h: SGDMA implementation function definitions
  82. o altera_msgdma.c: MSGDMA implementation
  83. o altera_sgdma.c: SGDMA implementation
  84. o altera_sgdmahw.h: SGDMA register and descriptor definitions
  85. o altera_msgdmahw.h: MSGDMA register and descriptor definitions
  86. o altera_utils.c: Driver utility functions
  87. o altera_utils.h: Driver utility function definitions
  88. 5) Debug Information
  89. The driver exports debug information such as internal statistics,
  90. debug information, MAC and DMA registers etc.
  91. A user may use the ethtool support to get statistics:
  92. e.g. using: ethtool -S ethX (that shows the statistics counters)
  93. or sees the MAC registers: e.g. using: ethtool -d ethX
  94. The developer can also use the "debug" module parameter to get
  95. further debug information.
  96. 6) Statistics Support
  97. The controller and driver support a mix of IEEE standard defined statistics,
  98. RFC defined statistics, and driver or Altera defined statistics. The four
  99. specifications containing the standard definitions for these statistics are
  100. as follows:
  101. o IEEE 802.3-2012 - IEEE Standard for Ethernet.
  102. o RFC 2863 found at http://www.rfc-editor.org/rfc/rfc2863.txt.
  103. o RFC 2819 found at http://www.rfc-editor.org/rfc/rfc2819.txt.
  104. o Altera Triple Speed Ethernet User Guide, found at http://www.altera.com
  105. The statistics supported by the TSE and the device driver are as follows:
  106. "tx_packets" is equivalent to aFramesTransmittedOK defined in IEEE 802.3-2012,
  107. Section 5.2.2.1.2. This statistics is the count of frames that are successfully
  108. transmitted.
  109. "rx_packets" is equivalent to aFramesReceivedOK defined in IEEE 802.3-2012,
  110. Section 5.2.2.1.5. This statistic is the count of frames that are successfully
  111. received. This count does not include any error packets such as CRC errors,
  112. length errors, or alignment errors.
  113. "rx_crc_errors" is equivalent to aFrameCheckSequenceErrors defined in IEEE
  114. 802.3-2012, Section 5.2.2.1.6. This statistic is the count of frames that are
  115. an integral number of bytes in length and do not pass the CRC test as the frame
  116. is received.
  117. "rx_align_errors" is equivalent to aAlignmentErrors defined in IEEE 802.3-2012,
  118. Section 5.2.2.1.7. This statistic is the count of frames that are not an
  119. integral number of bytes in length and do not pass the CRC test as the frame is
  120. received.
  121. "tx_bytes" is equivalent to aOctetsTransmittedOK defined in IEEE 802.3-2012,
  122. Section 5.2.2.1.8. This statistic is the count of data and pad bytes
  123. successfully transmitted from the interface.
  124. "rx_bytes" is equivalent to aOctetsReceivedOK defined in IEEE 802.3-2012,
  125. Section 5.2.2.1.14. This statistic is the count of data and pad bytes
  126. successfully received by the controller.
  127. "tx_pause" is equivalent to aPAUSEMACCtrlFramesTransmitted defined in IEEE
  128. 802.3-2012, Section 30.3.4.2. This statistic is a count of PAUSE frames
  129. transmitted from the network controller.
  130. "rx_pause" is equivalent to aPAUSEMACCtrlFramesReceived defined in IEEE
  131. 802.3-2012, Section 30.3.4.3. This statistic is a count of PAUSE frames
  132. received by the network controller.
  133. "rx_errors" is equivalent to ifInErrors defined in RFC 2863. This statistic is
  134. a count of the number of packets received containing errors that prevented the
  135. packet from being delivered to a higher level protocol.
  136. "tx_errors" is equivalent to ifOutErrors defined in RFC 2863. This statistic
  137. is a count of the number of packets that could not be transmitted due to errors.
  138. "rx_unicast" is equivalent to ifInUcastPkts defined in RFC 2863. This
  139. statistic is a count of the number of packets received that were not addressed
  140. to the broadcast address or a multicast group.
  141. "rx_multicast" is equivalent to ifInMulticastPkts defined in RFC 2863. This
  142. statistic is a count of the number of packets received that were addressed to
  143. a multicast address group.
  144. "rx_broadcast" is equivalent to ifInBroadcastPkts defined in RFC 2863. This
  145. statistic is a count of the number of packets received that were addressed to
  146. the broadcast address.
  147. "tx_discards" is equivalent to ifOutDiscards defined in RFC 2863. This
  148. statistic is the number of outbound packets not transmitted even though an
  149. error was not detected. An example of a reason this might occur is to free up
  150. internal buffer space.
  151. "tx_unicast" is equivalent to ifOutUcastPkts defined in RFC 2863. This
  152. statistic counts the number of packets transmitted that were not addressed to
  153. a multicast group or broadcast address.
  154. "tx_multicast" is equivalent to ifOutMulticastPkts defined in RFC 2863. This
  155. statistic counts the number of packets transmitted that were addressed to a
  156. multicast group.
  157. "tx_broadcast" is equivalent to ifOutBroadcastPkts defined in RFC 2863. This
  158. statistic counts the number of packets transmitted that were addressed to a
  159. broadcast address.
  160. "ether_drops" is equivalent to etherStatsDropEvents defined in RFC 2819.
  161. This statistic counts the number of packets dropped due to lack of internal
  162. controller resources.
  163. "rx_total_bytes" is equivalent to etherStatsOctets defined in RFC 2819.
  164. This statistic counts the total number of bytes received by the controller,
  165. including error and discarded packets.
  166. "rx_total_packets" is equivalent to etherStatsPkts defined in RFC 2819.
  167. This statistic counts the total number of packets received by the controller,
  168. including error, discarded, unicast, multicast, and broadcast packets.
  169. "rx_undersize" is equivalent to etherStatsUndersizePkts defined in RFC 2819.
  170. This statistic counts the number of correctly formed packets received less
  171. than 64 bytes long.
  172. "rx_oversize" is equivalent to etherStatsOversizePkts defined in RFC 2819.
  173. This statistic counts the number of correctly formed packets greater than 1518
  174. bytes long.
  175. "rx_64_bytes" is equivalent to etherStatsPkts64Octets defined in RFC 2819.
  176. This statistic counts the total number of packets received that were 64 octets
  177. in length.
  178. "rx_65_127_bytes" is equivalent to etherStatsPkts65to127Octets defined in RFC
  179. 2819. This statistic counts the total number of packets received that were
  180. between 65 and 127 octets in length inclusive.
  181. "rx_128_255_bytes" is equivalent to etherStatsPkts128to255Octets defined in
  182. RFC 2819. This statistic is the total number of packets received that were
  183. between 128 and 255 octets in length inclusive.
  184. "rx_256_511_bytes" is equivalent to etherStatsPkts256to511Octets defined in
  185. RFC 2819. This statistic is the total number of packets received that were
  186. between 256 and 511 octets in length inclusive.
  187. "rx_512_1023_bytes" is equivalent to etherStatsPkts512to1023Octets defined in
  188. RFC 2819. This statistic is the total number of packets received that were
  189. between 512 and 1023 octets in length inclusive.
  190. "rx_1024_1518_bytes" is equivalent to etherStatsPkts1024to1518Octets define
  191. in RFC 2819. This statistic is the total number of packets received that were
  192. between 1024 and 1518 octets in length inclusive.
  193. "rx_gte_1519_bytes" is a statistic defined specific to the behavior of the
  194. Altera TSE. This statistics counts the number of received good and errored
  195. frames between the length of 1519 and the maximum frame length configured
  196. in the frm_length register. See the Altera TSE User Guide for More details.
  197. "rx_jabbers" is equivalent to etherStatsJabbers defined in RFC 2819. This
  198. statistic is the total number of packets received that were longer than 1518
  199. octets, and had either a bad CRC with an integral number of octets (CRC Error)
  200. or a bad CRC with a non-integral number of octets (Alignment Error).
  201. "rx_runts" is equivalent to etherStatsFragments defined in RFC 2819. This
  202. statistic is the total number of packets received that were less than 64 octets
  203. in length and had either a bad CRC with an integral number of octets (CRC
  204. error) or a bad CRC with a non-integral number of octets (Alignment Error).