1.\" Copyright (c) 2021 Michael J. Karels 2.\" 3.\" Redistribution and use in source and binary forms, with or without 4.\" modification, are permitted provided that the following conditions 5.\" are met: 6.\" 1. Redistributions of source code must retain the above copyright 7.\" notice, this list of conditions and the following disclaimer. 8.\" 2. Redistributions in binary form must reproduce the above copyright 9.\" notice, this list of conditions and the following disclaimer in the 10.\" documentation and/or other materials provided with the distribution. 11.\" 12.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 13.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 15.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 16.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 17.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 18.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 19.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 20.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 21.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 22.\" SUCH DAMAGE. 23.\" 24.Dd December 8, 2021 25.Dt GENET 4 26.Os 27.Sh NAME 28.Nm genet 29.Nd "Raspberry Pi 4 / BCM2711 Gigabit Ethernet controller driver" 30.Sh SYNOPSIS 31To compile this driver into the kernel, 32place the following lines in the 33kernel configuration file: 34.Bd -ragged -offset indent 35.Cd "device miibus" 36.Cd "device genet" 37.Ed 38.Sh DESCRIPTION 39The 40.Nm 41driver supports the BCM2711 Ethernet controller 42as found on the Raspberry Pi 4. 43.Pp 44The following features are supported in the 45.Nm 46driver in 47.Fx : 48.Pp 49.Bl -item -offset indent -compact 50.It 51IP/TCP/UDP checksum offload for IPv4 and IPv6 52.It 5310/100/1000Mbps operation in full-duplex mode 54.It 5510/100Mbps operation in half-duplex mode 56.El 57.Pp 58Note that the operation of transmit checksum offload is coupled 59for IPv4 and IPv6; to disable it, both must be disabled even if both 60address families are not in use. 61.Pp 62The 63.Nm 64driver supports the following media types: 65.Bl -tag -width ".Cm 10baseT/UTP" 66.It Cm autoselect 67Enable autoselection of the media type and options. 68The user can manually override 69the autoselected mode by adding media options to 70.Xr rc.conf 5 . 71.It Cm 10baseT/UTP 72Set 10Mbps operation. 73The 74.Xr ifconfig 8 75.Cm mediaopt 76option can also be used to select either 77.Cm full-duplex 78or 79.Cm half-duplex 80modes. 81.It Cm 100baseTX 82Set 100Mbps (Fast Ethernet) operation. 83The 84.Xr ifconfig 8 85.Cm mediaopt 86option can also be used to select either 87.Cm full-duplex 88or 89.Cm half-duplex 90modes. 91.It Cm 1000baseT 92Set 1000baseT operation over twisted pair. 93Only 94.Cm full-duplex 95mode is supported. 96.El 97.Pp 98The 99.Nm 100driver supports the following media options set with the 101.Cm mediaopt 102option to the 103.Xr ifconfig 8 104command: 105.Bl -tag -width ".Cm full-duplex" 106.It Cm full-duplex 107Force full duplex operation. 108.It Cm half-duplex 109Force half duplex operation. 110.El 111.Pp 112For more information on configuring this device, see 113.Xr ifconfig 8 . 114.Sh HARDWARE 115The 116.Nm 117driver supports the Ethernet controller portion of the Broadcom BCM2711 118on the Raspberry Pi 4 Model B and related systems. 119It utilizes the BCM54213PE PHY. 120.Sh LOADER TUNABLES 121Tunables can be set at the 122.Xr loader 8 123prompt before booting the kernel or stored in 124.Xr loader.conf 5 . 125The following loader tunable variable is available, and is also 126available as a read-only 127.Xr sysctl 8 128variable: 129.Bl -tag -width indent 130.It Va hw.genet.rx_batch 131The maximum number of packets to pass to the link-layer input routine 132at one time. 133The default is 16. 134.El 135.Sh SYSCTL VARIABLES 136The following variable is available as a 137.Xr sysctl 8 138variable: 139.Bl -tag -width indent 140.It Va hw.genet.tx_hdr_min 141When the driver is given an output packet in a buffer chain 142in which the first buffer contains only the Ethernet header, 143the number of bytes of the packet to add to the Ethernet header 144in the first buffer. 145Certain packets may be lost if this value is too small. 146The default value is 56, and is sufficient for the observed cases to date. 147.El 148.Sh DIAGNOSTICS 149The 150.Nm 151driver has no diagnostics that are likely in normal operation. 152However, when the 153.Cm debug 154option is set with 155.Xr ifconfig 8 , 156most failures that cause packet loss in the transmit and receive paths 157cause a cryptic diagnostic message naming the failure. 158These messages generally make sense only when looking at the driver source. 159.Sh SEE ALSO 160.Xr altq 4 , 161.Xr arp 4 , 162.Xr miibus 4 , 163.Xr netintro 4 , 164.Xr ng_ether 4 , 165.Xr vlan 4 , 166.Xr ifconfig 8 167.Sh HISTORY 168The 169.Nm 170device driver first appeared in 171.Fx 13.0 . 172.Sh AUTHORS 173The 174.Nm 175driver was written by 176.An Mike Karels Aq Mt karels@freebsd.org . 177Portions are derived from the bcmgenet driver in 178.Nx 179by Jared McNeill, 180and parts of the structure and common code are from the awg driver 181for the Allwinner EMAC by Jared McNeill. 182