xref: /freebsd/share/man/man4/cgem.4 (revision ffc4f93e960d38b6f70d59409127f7562e40f916)
1facdd1cdSThomas Skibo.\"
2facdd1cdSThomas Skibo.\" Copyright (c) 2014 Thomas Skibo <thomasskibo@yahoo.com>
3facdd1cdSThomas Skibo.\" All rights reserved.
4facdd1cdSThomas Skibo.\"
5facdd1cdSThomas Skibo.\" Redistribution and use in source and binary forms, with or without
6facdd1cdSThomas Skibo.\" modification, are permitted provided that the following conditions
7facdd1cdSThomas Skibo.\" are met:
8facdd1cdSThomas Skibo.\" 1. Redistributions of source code must retain the above copyright
9facdd1cdSThomas Skibo.\"    notice, this list of conditions and the following disclaimer.
10facdd1cdSThomas Skibo.\" 2. The name of the author may not be used to endorse or promote products
11facdd1cdSThomas Skibo.\"    derived from this software without specific prior written permission.
12facdd1cdSThomas Skibo.\"
13facdd1cdSThomas Skibo.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14facdd1cdSThomas Skibo.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15facdd1cdSThomas Skibo.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16facdd1cdSThomas Skibo.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17facdd1cdSThomas Skibo.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18facdd1cdSThomas Skibo.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19facdd1cdSThomas Skibo.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20facdd1cdSThomas Skibo.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21facdd1cdSThomas Skibo.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22facdd1cdSThomas Skibo.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23facdd1cdSThomas Skibo.\" SUCH DAMAGE.
24facdd1cdSThomas Skibo.\"
25facdd1cdSThomas Skibo.Dd January 10, 2021
26facdd1cdSThomas Skibo.Dt CGEM 4
27facdd1cdSThomas Skibo.Os
28facdd1cdSThomas Skibo.Sh NAME
29facdd1cdSThomas Skibo.Nm cgem
30facdd1cdSThomas Skibo.Nd "Cadence GEM Gigabit Ethernet driver"
31facdd1cdSThomas Skibo.Sh SYNOPSIS
32facdd1cdSThomas SkiboTo compile this driver into the kernel,
33facdd1cdSThomas Skiboplace the following lines in your
34facdd1cdSThomas Skibokernel configuration file:
35facdd1cdSThomas Skibo.Bd -ragged -offset indent
36facdd1cdSThomas Skibo.Cd "device ether"
37facdd1cdSThomas Skibo.Cd "device miibus"
38facdd1cdSThomas Skibo.Cd "device cgem"
39facdd1cdSThomas Skibo.Ed
40facdd1cdSThomas Skibo.Sh DESCRIPTION
41facdd1cdSThomas SkiboThe
42facdd1cdSThomas Skibo.Nm
43facdd1cdSThomas Skibodriver provides support for the Cadence GEM (Gigabit Ethernet MAC).
44facdd1cdSThomas SkiboThe Cadence GEM is used in some SoC (System on a Chip) devices such as
45facdd1cdSThomas Skibothe Xilinx Zynq-7000, the Xilinx Zynq UltraScale+, and the SiFive
46facdd1cdSThomas SkiboHiFive Unleashed.
47facdd1cdSThomas Skibo.Pp
48facdd1cdSThomas SkiboThe
49facdd1cdSThomas Skibo.Nm
50facdd1cdSThomas Skibodriver supports the following media types:
51facdd1cdSThomas Skibo.Bl -tag -width ".Cm 10baseT/UTP"
52facdd1cdSThomas Skibo.It Cm autoselect
53facdd1cdSThomas SkiboEnable autoselection of the media type and options.
54facdd1cdSThomas SkiboThe user can manually override
55facdd1cdSThomas Skibothe autoselected mode using
56facdd1cdSThomas Skibo.Xr ifconfig 8
57facdd1cdSThomas Skiboor by adding media options to
58facdd1cdSThomas Skibo.Xr rc.conf 5 .
59facdd1cdSThomas Skibo.It Cm 10baseT/UTP
60facdd1cdSThomas SkiboSet 10Mbps operation.
61facdd1cdSThomas SkiboThe
62facdd1cdSThomas Skibo.Xr ifconfig 8
63facdd1cdSThomas Skibo.Cm mediaopt
64facdd1cdSThomas Skibooption can also be used to select either
65facdd1cdSThomas Skibo.Cm full-duplex
66facdd1cdSThomas Skiboor
67facdd1cdSThomas Skibo.Cm half-duplex
68facdd1cdSThomas Skibomodes.
69facdd1cdSThomas Skibo.It Cm 100baseTX
70facdd1cdSThomas SkiboSet 100Mbps (Fast Ethernet) operation.
71facdd1cdSThomas SkiboThe
72facdd1cdSThomas Skibo.Xr ifconfig 8
73facdd1cdSThomas Skibo.Cm mediaopt
74facdd1cdSThomas Skibooption can also be used to select either
75facdd1cdSThomas Skibo.Cm full-duplex
76facdd1cdSThomas Skiboor
77facdd1cdSThomas Skibo.Cm half-duplex
78facdd1cdSThomas Skibomodes.
79facdd1cdSThomas Skibo.It Cm 1000baseT
80facdd1cdSThomas SkiboSet 1000Mbps (Gigabit Ethernet) operation over twisted pair.
81facdd1cdSThomas SkiboThe GEM supports 1000Mbps in
82facdd1cdSThomas Skibo.Cm full-duplex
83facdd1cdSThomas Skibomode only.
84facdd1cdSThomas Skibo.El
85facdd1cdSThomas Skibo.Pp
86facdd1cdSThomas SkiboThe
87facdd1cdSThomas Skibo.Nm
88facdd1cdSThomas Skibodriver supports the following media options:
89facdd1cdSThomas Skibo.Bl -tag -width ".Cm full-duplex"
90facdd1cdSThomas Skibo.It Cm full-duplex
91facdd1cdSThomas SkiboForce full-duplex operation.
92facdd1cdSThomas Skibo.It Cm half-duplex
93facdd1cdSThomas SkiboForce half-duplex operation.
94facdd1cdSThomas Skibo.El
95facdd1cdSThomas Skibo.Pp
96facdd1cdSThomas SkiboThe driver provides support for TCP/UDP/IP checksum offloading (although
97facdd1cdSThomas Skibodisabled by default).
98facdd1cdSThomas SkiboThe device and driver also support 1536-byte frames for VLANs (vlanmtu).
99facdd1cdSThomas Skibo.Sh SYSCTL VARIABLES
100facdd1cdSThomas SkiboThe following variables are available as both
101facdd1cdSThomas Skibo.Xr sysctl 8
102facdd1cdSThomas Skibovariables and
103facdd1cdSThomas Skibo.Xr loader 8
104facdd1cdSThomas Skibotunables:
105facdd1cdSThomas Skibo.Bl -tag -width "xxxxxxxx"
106facdd1cdSThomas Skibo.It Va dev.cgem.%d.rxbufs
107facdd1cdSThomas SkiboThe number of receive buffers allocated to the hardware.
108facdd1cdSThomas SkiboThe default value is 256.
109facdd1cdSThomas SkiboThe maximum value is 511.
110facdd1cdSThomas SkiboIf this number is increased while the interface is UP, it will not
111facdd1cdSThomas Skibotake effect until the next packet is received.
112facdd1cdSThomas SkiboIf this number is decreased while the interface is UP, buffers will
113facdd1cdSThomas Skibonot be immediately removed from the receive buffer ring but the
114facdd1cdSThomas Skibonumber of buffers will decrease as packets are received until it
115facdd1cdSThomas Skiboreaches the new value.
116facdd1cdSThomas Skibo.It Va dev.cgem.%d.rxhangwar
117facdd1cdSThomas SkiboThis tunable enables a work-around to recover from receive hangs.
118facdd1cdSThomas SkiboThe default value is 1.
119facdd1cdSThomas SkiboSet to 0 to disable the work-around.
120facdd1cdSThomas Skibo.El
121facdd1cdSThomas Skibo.Pp
122facdd1cdSThomas SkiboThe following read-only variables are available as
123facdd1cdSThomas Skibo.Xr sysctl 8
124facdd1cdSThomas Skibovariables:
125facdd1cdSThomas Skibo.Bl -tag -width "xxxxxxxx"
126facdd1cdSThomas Skibo.It Va dev.cgem.%d._rxoverruns
127facdd1cdSThomas SkiboThis variable counts the number of receive packet buffer overrun interrupts.
128facdd1cdSThomas Skibo.It Va dev.cgem.%d._rxnobufs
129facdd1cdSThomas SkiboThis variable counts the number of interrupts due to the GEM buffer ring
130facdd1cdSThomas Skibogoing empty.
131facdd1cdSThomas Skibo.It Va dev.cgem.%d._rxdmamapfails
132facdd1cdSThomas SkiboThis variable is the number of times bus_dmamap_load_mbuf_sg(9) failed in
133facdd1cdSThomas Skibothe receive path.
134facdd1cdSThomas Skibo.It Va dev.cgem.%d._txfull
135facdd1cdSThomas SkiboThe number of times the GEM's transmit ring was full.
136facdd1cdSThomas Skibo.It Va dev.cgem.%d._txdmamapfails
137facdd1cdSThomas SkiboThis variable is the number of times bus_dmamap_load_mbuf_sg(9) failed in
138facdd1cdSThomas Skibothe transmit path.
139facdd1cdSThomas Skibo.It Va dev.cgem.%d._txdefrags
140facdd1cdSThomas SkiboThis variable is the number of times the driver needed to call m_defrag(9)
141facdd1cdSThomas Skibobecause a packet queued for transmit had too many DMA segments.
142facdd1cdSThomas Skibo.It Va dev.cgem.%d._txdefragfails
143facdd1cdSThomas SkiboThis variable is the number of times
144facdd1cdSThomas Skibo.Xr m_defrag 9
145facdd1cdSThomas Skibofailed.
146facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.*
147facdd1cdSThomas SkiboThe following variables are useful MAC counters supplied by the hardware:
148facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.tx_bytes
149facdd1cdSThomas SkiboA 64-bit counter of the number of bytes transmitted in frames without error.
150facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.tx_frames
151facdd1cdSThomas SkiboCounter of frames transmitted without error excluding pause frames.
152facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.tx_frames_bcast
153facdd1cdSThomas SkiboCounter of broadcast frames transmitted without error excluding
154facdd1cdSThomas Skibopause frames.
155facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.tx_frames_multi
156facdd1cdSThomas SkiboCounter of multicast frames transmitted without error excluding
157facdd1cdSThomas Skibopause frames.
158facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.tx_frames_pause
159facdd1cdSThomas SkiboCounter of pause frames transmitted without error.
160facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.tx_frames_64b
161facdd1cdSThomas SkiboCounter of 64 byte frames transmitted without error.
162facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.tx_frames_65to127b
163facdd1cdSThomas SkiboCounter of 65 to 127 byte frames transmitted without error.
164facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.tx_frames_128to255b
165facdd1cdSThomas SkiboCounter of 128 to 255 byte frames transmitted without error.
166facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.tx_frames_256to511b
167facdd1cdSThomas SkiboCounter of 256 to 511 byte frames transmitted without error.
168facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.tx_frames_512to1023b
169facdd1cdSThomas SkiboCounter of 512 to 1023 byte frames transmitted without error.
170facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.tx_frames_1024to1536b
171facdd1cdSThomas SkiboCounter of 1024 to 1536 byte frames transmitted without error.
172facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.tx_under_runs
173facdd1cdSThomas SkiboCounter of frames not transmitted due to a transmit underrun.
174facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.tx_single_collisn
175facdd1cdSThomas SkiboCounter of frames experiencing a single collision before being successfully
176facdd1cdSThomas Skibotransmitted.
177facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.tx_multi_collisn
178facdd1cdSThomas SkiboCounter of frames experiencing between 2 and 15 collisions before
179facdd1cdSThomas Skibobeing successfully transmitted.
180facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.tx_excsv_collisn
181facdd1cdSThomas SkiboCounter of frames that failed to transmit because they experienced 16
182facdd1cdSThomas Skibocollisions.
183facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.tx_late_collisn
184facdd1cdSThomas SkiboCounter of frames that experienced a late collision.
185facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.tx_deferred_frames
186facdd1cdSThomas SkiboCounter of frames experiencing deferral due to carrier sense being
187facdd1cdSThomas Skiboactive on their first attempt at transmission.
188facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.tx_carrier_sense_errs
189facdd1cdSThomas SkiboCounter of frames transmitted where carrier sense was not seen during
190facdd1cdSThomas Skibotransmission or where carrier sense was deasserted after being asserted
191facdd1cdSThomas Skiboin a transmit frame without collision.
192facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.rx_bytes
193facdd1cdSThomas SkiboA 64-bit counter of bytes received without error excluding pause
194facdd1cdSThomas Skiboframes.
195facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.rx_frames
196facdd1cdSThomas SkiboCounter of frames received without error excluding pause frames.
197facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.rx_frames_bcast
198facdd1cdSThomas SkiboCounter of broadcast frames receive without error excluding pause frames.
199facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.rx_frames_multi
200facdd1cdSThomas SkiboCounter of multicast frames receive without error excluding pause frames.
201facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.rx_frames_pause
202*ffc4f93eSBenedict ReuschlingCounter of pause frames received without error.
203facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.rx_frames_64b
204facdd1cdSThomas SkiboCounter of 64-byte frames received without error.
205facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.rx_frames_65to127b
206facdd1cdSThomas SkiboCounter of 65 to 127 byte frames received without error.
207facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.rx_frames_128to255b
208facdd1cdSThomas SkiboCounter of 128 to 255 byte frames received without error.
209facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.rx_frames_256to511b
210facdd1cdSThomas SkiboCounter of 256 to 511 byte frames received without error.
211facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.rx_frames_512to1023b
212facdd1cdSThomas SkiboCounter of 512 to 1023 byte frames received without error.
213facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.rx_frames_1024to1536b
214facdd1cdSThomas SkiboCounter of 1024 to 1536 byte frames received without error.
215facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.rx_frames_undersize
216facdd1cdSThomas SkiboCounter of frames received less than 64 bytes in length that
217facdd1cdSThomas Skibodo not also have either a CRC error or an alignment error.
218facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.rx_frames_oversize
219facdd1cdSThomas SkiboCounter of frames received exceeding 1536 bytes and do not also have either
220facdd1cdSThomas Skiboa CRC error or an alignment error.
221facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.rx_frames_jabber
222facdd1cdSThomas SkiboCounter of frames received exceeding 1536 bytes and also have either a CRC
223facdd1cdSThomas Skiboerror, an alignment error, or a receive symbol error.
224facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.rx_frames_fcs_errs
225facdd1cdSThomas SkiboCounter of frames received with a bad CRC and are between 64
226facdd1cdSThomas Skiboand 1536 bytes.
227facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.rx_frames_length_errs
228facdd1cdSThomas SkiboCounter of frames received that are shorter than that extracted
229facdd1cdSThomas Skibofrom the length field.
230facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.rx_symbol_errs
231facdd1cdSThomas SkiboCounter of receive symbol errors.
232facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.rx_align_errs
233facdd1cdSThomas SkiboCounter of received frames that are not an integral number of bytes.
234facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.rx_resource_errs
235facdd1cdSThomas SkiboCounter of frames successfully receive by the MAC but could not be
236facdd1cdSThomas Skibocopied to memory because no receive buffer was available.
237facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.rx_overrun_errs
238facdd1cdSThomas SkiboCounter of frames that are address recognized but were not copied
239facdd1cdSThomas Skiboto memory due to a receive overrun.
240facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.rx_frames_ip_hdr_csum_errs
241facdd1cdSThomas SkiboCounter of frames discarded due to an incorrect IP header checksum when
242facdd1cdSThomas Skibochecksum offloading is enabled.
243facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.rx_frames_tcp_csum_errs
244facdd1cdSThomas SkiboCounter of frames discarded due to an incorrect TCP checksum when
245facdd1cdSThomas Skibochecksum offloading is enabled.
246facdd1cdSThomas Skibo.It Va dev.cgem.%d.stats.rx_frames_udp_csum_errs
247facdd1cdSThomas SkiboCounter of frames discarded due to an incorrect UDP checksum when
248facdd1cdSThomas Skibochecksum offloading is enabled.
249facdd1cdSThomas Skibo.El
250facdd1cdSThomas Skibo.Sh SEE ALSO
251facdd1cdSThomas Skibo.Xr miibus 4 ,
252facdd1cdSThomas Skibo.Xr ifconfig 8
253facdd1cdSThomas Skibo.Rs
254facdd1cdSThomas Skibo.%T "Zynq-7000 SoC Technical Reference Manual (Xilinx doc UG585)"
255facdd1cdSThomas Skibo.%U http://www.xilinx.com/support/documentation/user_guides/\:ug585-Zynq-7000-TRM.pdf
256facdd1cdSThomas Skibo.Re
257facdd1cdSThomas Skibo.Sh HISTORY
258facdd1cdSThomas SkiboThe
259facdd1cdSThomas Skibo.Nm
260facdd1cdSThomas Skibodevice driver first appeared in
261facdd1cdSThomas Skibo.Fx 10.0 .
262facdd1cdSThomas Skibo.Sh AUTHORS
263facdd1cdSThomas SkiboThe
264facdd1cdSThomas Skibo.Nm
265facdd1cdSThomas Skibodriver and this manual page was written by
266facdd1cdSThomas Skibo.An Thomas Skibo Aq Mt thomasskibo@yahoo.com .
267facdd1cdSThomas Skibo.Sh BUGS
268facdd1cdSThomas SkiboThe GEM can perform TCP/UDP/IP checksum offloading.
269facdd1cdSThomas SkiboHowever, when transmit checksum offloading is enabled, the GEM generates and
270facdd1cdSThomas Skiboreplaces checksums for all packets it transmits.
271facdd1cdSThomas SkiboIn a system that is forwarding packets, the device could potentially correct
272facdd1cdSThomas Skibothe checksum of packet that was corrupted in transit.
273facdd1cdSThomas SkiboFor this reason, checksum offloading is disabled by default but can be
274facdd1cdSThomas Skiboenabled using ifconfig(8).
275facdd1cdSThomas Skibo.Pp
276facdd1cdSThomas SkiboWhen receive checksum offloading is enabled, the device will discard packets
277facdd1cdSThomas Skibowith bad TCP/UDP/IP checksums.
278facdd1cdSThomas SkiboThe bad packets will not be counted in any
279facdd1cdSThomas Skibo.Xr netstat 1
280facdd1cdSThomas Skibostatistics.
281facdd1cdSThomas SkiboThere are
282facdd1cdSThomas Skibo.Xr sysctl 8
283facdd1cdSThomas Skibovariables that count
284facdd1cdSThomas Skibopackets discarded by the hardware (see below).
285facdd1cdSThomas Skibo.Pp
286facdd1cdSThomas SkiboThe GEM used in the Zynq-7000 has a bug such that the receiver can
287facdd1cdSThomas Skibopotentially freeze up under a high load.
288facdd1cdSThomas SkiboThe issue is described in sec. 16.7
289facdd1cdSThomas Skibo"Known Issues" of the Zynq-7000 SoC Technical Reference Manual (Xilinx
290facdd1cdSThomas SkiboUG585 v1.7).
291facdd1cdSThomas SkiboThe
292facdd1cdSThomas Skibo.Nm
293facdd1cdSThomas Skibodriver implements the work-around suggested in the manual.
294facdd1cdSThomas SkiboIt is believed that the bug does not exist in the Zynq UltraScale+ and
295facdd1cdSThomas SkiboSiFive SoCs so the work-around is disabled in those instances and enabled
296facdd1cdSThomas Skiboin all others.
297facdd1cdSThomas SkiboThe work-around can be disabled by setting the
298facdd1cdSThomas Skibo.Va dev.cgem.%d.rxhangwar
299facdd1cdSThomas Skibo.Xr sysctl 8
300facdd1cdSThomas Skibovariable to 0.
301