Back to home page

OSCL-LXR

 
 

    


0001 .. SPDX-License-Identifier: GPL-2.0
0002 
0003 .. include:: <isonum.txt>
0004 
0005 =======================================
0006 Altera Triple-Speed Ethernet MAC driver
0007 =======================================
0008 
0009 Copyright |copy| 2008-2014 Altera Corporation
0010 
0011 This is the driver for the Altera Triple-Speed Ethernet (TSE) controllers
0012 using the SGDMA and MSGDMA soft DMA IP components. The driver uses the
0013 platform bus to obtain component resources. The designs used to test this
0014 driver were built for a Cyclone(R) V SOC FPGA board, a Cyclone(R) V FPGA board,
0015 and tested with ARM and NIOS processor hosts separately. The anticipated use
0016 cases are simple communications between an embedded system and an external peer
0017 for status and simple configuration of the embedded system.
0018 
0019 For more information visit www.altera.com and www.rocketboards.org. Support
0020 forums for the driver may be found on www.rocketboards.org, and a design used
0021 to test this driver may be found there as well. Support is also available from
0022 the maintainer of this driver, found in MAINTAINERS.
0023 
0024 The Triple-Speed Ethernet, SGDMA, and MSGDMA components are all soft IP
0025 components that can be assembled and built into an FPGA using the Altera
0026 Quartus toolchain. Quartus 13.1 and 14.0 were used to build the design that
0027 this driver was tested against. The sopc2dts tool is used to create the
0028 device tree for the driver, and may be found at rocketboards.org.
0029 
0030 The driver probe function examines the device tree and determines if the
0031 Triple-Speed Ethernet instance is using an SGDMA or MSGDMA component. The
0032 probe function then installs the appropriate set of DMA routines to
0033 initialize, setup transmits, receives, and interrupt handling primitives for
0034 the respective configurations.
0035 
0036 The SGDMA component is to be deprecated in the near future (over the next 1-2
0037 years as of this writing in early 2014) in favor of the MSGDMA component.
0038 SGDMA support is included for existing designs and reference in case a
0039 developer wishes to support their own soft DMA logic and driver support. Any
0040 new designs should not use the SGDMA.
0041 
0042 The SGDMA supports only a single transmit or receive operation at a time, and
0043 therefore will not perform as well compared to the MSGDMA soft IP. Please
0044 visit www.altera.com for known, documented SGDMA errata.
0045 
0046 Scatter-gather DMA is not supported by the SGDMA or MSGDMA at this time.
0047 Scatter-gather DMA will be added to a future maintenance update to this
0048 driver.
0049 
0050 Jumbo frames are not supported at this time.
0051 
0052 The driver limits PHY operations to 10/100Mbps, and has not yet been fully
0053 tested for 1Gbps. This support will be added in a future maintenance update.
0054 
0055 1. Kernel Configuration
0056 =======================
0057 
0058 The kernel configuration option is ALTERA_TSE:
0059 
0060  Device Drivers ---> Network device support ---> Ethernet driver support --->
0061  Altera Triple-Speed Ethernet MAC support (ALTERA_TSE)
0062 
0063 2. Driver parameters list
0064 =========================
0065 
0066         - debug: message level (0: no output, 16: all);
0067         - dma_rx_num: Number of descriptors in the RX list (default is 64);
0068         - dma_tx_num: Number of descriptors in the TX list (default is 64).
0069 
0070 3. Command line options
0071 =======================
0072 
0073 Driver parameters can be also passed in command line by using::
0074 
0075         altera_tse=dma_rx_num:128,dma_tx_num:512
0076 
0077 4. Driver information and notes
0078 ===============================
0079 
0080 4.1. Transmit process
0081 ---------------------
0082 When the driver's transmit routine is called by the kernel, it sets up a
0083 transmit descriptor by calling the underlying DMA transmit routine (SGDMA or
0084 MSGDMA), and initiates a transmit operation. Once the transmit is complete, an
0085 interrupt is driven by the transmit DMA logic. The driver handles the transmit
0086 completion in the context of the interrupt handling chain by recycling
0087 resource required to send and track the requested transmit operation.
0088 
0089 4.2. Receive process
0090 --------------------
0091 The driver will post receive buffers to the receive DMA logic during driver
0092 initialization. Receive buffers may or may not be queued depending upon the
0093 underlying DMA logic (MSGDMA is able queue receive buffers, SGDMA is not able
0094 to queue receive buffers to the SGDMA receive logic). When a packet is
0095 received, the DMA logic generates an interrupt. The driver handles a receive
0096 interrupt by obtaining the DMA receive logic status, reaping receive
0097 completions until no more receive completions are available.
0098 
0099 4.3. Interrupt Mitigation
0100 -------------------------
0101 The driver is able to mitigate the number of its DMA interrupts
0102 using NAPI for receive operations. Interrupt mitigation is not yet supported
0103 for transmit operations, but will be added in a future maintenance release.
0104 
0105 4.4) Ethtool support
0106 --------------------
0107 Ethtool is supported. Driver statistics and internal errors can be taken using:
0108 ethtool -S ethX command. It is possible to dump registers etc.
0109 
0110 4.5) PHY Support
0111 ----------------
0112 The driver is compatible with PAL to work with PHY and GPHY devices.
0113 
0114 4.7) List of source files:
0115 --------------------------
0116  - Kconfig
0117  - Makefile
0118  - altera_tse_main.c: main network device driver
0119  - altera_tse_ethtool.c: ethtool support
0120  - altera_tse.h: private driver structure and common definitions
0121  - altera_msgdma.h: MSGDMA implementation function definitions
0122  - altera_sgdma.h: SGDMA implementation function definitions
0123  - altera_msgdma.c: MSGDMA implementation
0124  - altera_sgdma.c: SGDMA implementation
0125  - altera_sgdmahw.h: SGDMA register and descriptor definitions
0126  - altera_msgdmahw.h: MSGDMA register and descriptor definitions
0127  - altera_utils.c: Driver utility functions
0128  - altera_utils.h: Driver utility function definitions
0129 
0130 5. Debug Information
0131 ====================
0132 
0133 The driver exports debug information such as internal statistics,
0134 debug information, MAC and DMA registers etc.
0135 
0136 A user may use the ethtool support to get statistics:
0137 e.g. using: ethtool -S ethX (that shows the statistics counters)
0138 or sees the MAC registers: e.g. using: ethtool -d ethX
0139 
0140 The developer can also use the "debug" module parameter to get
0141 further debug information.
0142 
0143 6. Statistics Support
0144 =====================
0145 
0146 The controller and driver support a mix of IEEE standard defined statistics,
0147 RFC defined statistics, and driver or Altera defined statistics. The four
0148 specifications containing the standard definitions for these statistics are
0149 as follows:
0150 
0151  - IEEE 802.3-2012 - IEEE Standard for Ethernet.
0152  - RFC 2863 found at http://www.rfc-editor.org/rfc/rfc2863.txt.
0153  - RFC 2819 found at http://www.rfc-editor.org/rfc/rfc2819.txt.
0154  - Altera Triple Speed Ethernet User Guide, found at http://www.altera.com
0155 
0156 The statistics supported by the TSE and the device driver are as follows:
0157 
0158 "tx_packets" is equivalent to aFramesTransmittedOK defined in IEEE 802.3-2012,
0159 Section 5.2.2.1.2. This statistics is the count of frames that are successfully
0160 transmitted.
0161 
0162 "rx_packets" is equivalent to aFramesReceivedOK defined in IEEE 802.3-2012,
0163 Section 5.2.2.1.5. This statistic is the count of frames that are successfully
0164 received. This count does not include any error packets such as CRC errors,
0165 length errors, or alignment errors.
0166 
0167 "rx_crc_errors" is equivalent to aFrameCheckSequenceErrors defined in IEEE
0168 802.3-2012, Section 5.2.2.1.6. This statistic is the count of frames that are
0169 an integral number of bytes in length and do not pass the CRC test as the frame
0170 is received.
0171 
0172 "rx_align_errors" is equivalent to aAlignmentErrors defined in IEEE 802.3-2012,
0173 Section 5.2.2.1.7. This statistic is the count of frames that are not an
0174 integral number of bytes in length and do not pass the CRC test as the frame is
0175 received.
0176 
0177 "tx_bytes" is equivalent to aOctetsTransmittedOK defined in IEEE 802.3-2012,
0178 Section 5.2.2.1.8. This statistic is the count of data and pad bytes
0179 successfully transmitted from the interface.
0180 
0181 "rx_bytes" is equivalent to aOctetsReceivedOK defined in IEEE 802.3-2012,
0182 Section 5.2.2.1.14. This statistic is the count of data and pad bytes
0183 successfully received by the controller.
0184 
0185 "tx_pause" is equivalent to aPAUSEMACCtrlFramesTransmitted defined in IEEE
0186 802.3-2012, Section 30.3.4.2. This statistic is a count of PAUSE frames
0187 transmitted from the network controller.
0188 
0189 "rx_pause" is equivalent to aPAUSEMACCtrlFramesReceived defined in IEEE
0190 802.3-2012, Section 30.3.4.3. This statistic is a count of PAUSE frames
0191 received by the network controller.
0192 
0193 "rx_errors" is equivalent to ifInErrors defined in RFC 2863. This statistic is
0194 a count of the number of packets received containing errors that prevented the
0195 packet from being delivered to a higher level protocol.
0196 
0197 "tx_errors" is equivalent to ifOutErrors defined in RFC 2863. This statistic
0198 is a count of the number of packets that could not be transmitted due to errors.
0199 
0200 "rx_unicast" is equivalent to ifInUcastPkts defined in RFC 2863. This
0201 statistic is a count of the number of packets received that were not addressed
0202 to the broadcast address or a multicast group.
0203 
0204 "rx_multicast" is equivalent to ifInMulticastPkts defined in RFC 2863. This
0205 statistic is a count of the number of packets received that were addressed to
0206 a multicast address group.
0207 
0208 "rx_broadcast" is equivalent to ifInBroadcastPkts defined in RFC 2863. This
0209 statistic is a count of the number of packets received that were addressed to
0210 the broadcast address.
0211 
0212 "tx_discards" is equivalent to ifOutDiscards defined in RFC 2863. This
0213 statistic is the number of outbound packets not transmitted even though an
0214 error was not detected. An example of a reason this might occur is to free up
0215 internal buffer space.
0216 
0217 "tx_unicast" is equivalent to ifOutUcastPkts defined in RFC 2863. This
0218 statistic counts the number of packets transmitted that were not addressed to
0219 a multicast group or broadcast address.
0220 
0221 "tx_multicast" is equivalent to ifOutMulticastPkts defined in RFC 2863. This
0222 statistic counts the number of packets transmitted that were addressed to a
0223 multicast group.
0224 
0225 "tx_broadcast" is equivalent to ifOutBroadcastPkts defined in RFC 2863. This
0226 statistic counts the number of packets transmitted that were addressed to a
0227 broadcast address.
0228 
0229 "ether_drops" is equivalent to etherStatsDropEvents defined in RFC 2819.
0230 This statistic counts the number of packets dropped due to lack of internal
0231 controller resources.
0232 
0233 "rx_total_bytes" is equivalent to etherStatsOctets defined in RFC 2819.
0234 This statistic counts the total number of bytes received by the controller,
0235 including error and discarded packets.
0236 
0237 "rx_total_packets" is equivalent to etherStatsPkts defined in RFC 2819.
0238 This statistic counts the total number of packets received by the controller,
0239 including error, discarded, unicast, multicast, and broadcast packets.
0240 
0241 "rx_undersize" is equivalent to etherStatsUndersizePkts defined in RFC 2819.
0242 This statistic counts the number of correctly formed packets received less
0243 than 64 bytes long.
0244 
0245 "rx_oversize" is equivalent to etherStatsOversizePkts defined in RFC 2819.
0246 This statistic counts the number of correctly formed packets greater than 1518
0247 bytes long.
0248 
0249 "rx_64_bytes" is equivalent to etherStatsPkts64Octets defined in RFC 2819.
0250 This statistic counts the total number of packets received that were 64 octets
0251 in length.
0252 
0253 "rx_65_127_bytes" is equivalent to etherStatsPkts65to127Octets defined in RFC
0254 2819. This statistic counts the total number of packets received that were
0255 between 65 and 127 octets in length inclusive.
0256 
0257 "rx_128_255_bytes" is equivalent to etherStatsPkts128to255Octets defined in
0258 RFC 2819. This statistic is the total number of packets received that were
0259 between 128 and 255 octets in length inclusive.
0260 
0261 "rx_256_511_bytes" is equivalent to etherStatsPkts256to511Octets defined in
0262 RFC 2819. This statistic is the total number of packets received that were
0263 between 256 and 511 octets in length inclusive.
0264 
0265 "rx_512_1023_bytes" is equivalent to etherStatsPkts512to1023Octets defined in
0266 RFC 2819. This statistic is the total number of packets received that were
0267 between 512 and 1023 octets in length inclusive.
0268 
0269 "rx_1024_1518_bytes" is equivalent to etherStatsPkts1024to1518Octets define
0270 in RFC 2819. This statistic is the total number of packets received that were
0271 between 1024 and 1518 octets in length inclusive.
0272 
0273 "rx_gte_1519_bytes" is a statistic defined specific to the behavior of the
0274 Altera TSE. This statistics counts the number of received good and errored
0275 frames between the length of 1519 and the maximum frame length configured
0276 in the frm_length register. See the Altera TSE User Guide for More details.
0277 
0278 "rx_jabbers" is equivalent to etherStatsJabbers defined in RFC 2819. This
0279 statistic is the total number of packets received that were longer than 1518
0280 octets, and had either a bad CRC with an integral number of octets (CRC Error)
0281 or a bad CRC with a non-integral number of octets (Alignment Error).
0282 
0283 "rx_runts" is equivalent to etherStatsFragments defined in RFC 2819. This
0284 statistic is the total number of packets received that were less than 64 octets
0285 in length and had either a bad CRC with an integral number of octets (CRC
0286 error) or a bad CRC with a non-integral number of octets (Alignment Error).