Commit Graph

21 Commits

Author SHA1 Message Date
Justin Hibbits
b7459fb0ad Mechanically convert genet(4) to IfAPI
Sponsored by:	Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D37832
2023-01-31 16:26:34 -05:00
Mike Karels
234c1463a7 genet: add another case where headers need pullup
Wake On LAN packets sent by wake(8) via BPF are lost if txcsum is
enabled.  These fall into the "other protocol" case where gen_parse_tx
did nothing.  Add code to shift up to gen_tx_hdr_min bytes of the
packet along with the Ethernet header in this case.
2022-10-29 07:52:57 -05:00
Warner Losh
b66e766d57 genet: cnt here is write only and can be removed
Sponsored by:		Netflix
2022-10-25 10:57:29 -06:00
John Baldwin
82d4dc0621 arm/arm64 broadcom: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-09 14:26:44 -07:00
Mike Karels
1de9aa4d4f genet: fix output packet corruption in uncommon case
The code for the "shift" block in the COPY macro set the pointer for
the next copy block to the wrong value.  In this case, the link-layer
header would be overwritten by the network-layer header.  This case is
difficult or impossible to exercise in the current driver without
changing the value of the hw.genet.tx_hdr_min sysctl.  Correct the
pointer.  While here, remove a line in the macro that was marked
"unneeded", which was actually wrong.

PR:		263824
Submitted by:	jiahali@blackberry.com
MFC after:	2 weeks
2022-05-09 08:46:06 -05:00
John Baldwin
3e38757d4c Remove unused miibus_devclass and miibus_fdt_devclass. 2022-05-06 15:39:28 -07:00
Mike Karels
8f45652b6b genet: fix problems with interface down/up
The genet interface did not resume operation correctly after doing
ifconfig down then up.  The down/reset procedure did not clear the
RUNNING flag, and did not reset enough of the hardware state.  This
patch is modeled on OpenBSD code, with a call to gen_reset added
to reset the controller completely.  Regularize the parameter to
gen_dma_disable() while here.

PR:             263091
Submitted by:	jiahali@blackberry.com
2022-04-14 14:10:13 -05:00
Mike Karels
184291b0a5 genet: pullup minimum header amount for IPv4
The genet driver (RPi4 Ethernet) had code to pull headers into the
first mbuf if there was only an Ethernet header there.  This was
originally needed for ICMPv6 replies, then for forwarded IPv6/TCP.
Now a situation has been found where it is needed for IPv4, when
using NAT with IPFW.  Generalize to do this for all protocols.
Rather than using an IPv6-related definition for the length, move
the length to a variable that can be set with sysctl
(hw.genet.tx_hdr_min).  Move an old tunable to a new RDTUN variable
with a better name.

PR:		25607
MFC after:	3 days
Reviewers:	emaste
Differential Revision: https://reviews.freebsd.org/D30831
2021-06-26 11:04:02 -05:00
Mike Karels
13604fb0fd genet: Fix potential crash during attach
As pointed out in the bug, the genet driver (RPi4 Ethernet) was
attaching the interrupts before the data structures were fully
initialized, causing a crash if an interrupt came in during the
attach.  Fix by reordering code blocks.

PR:		256334
Reported by:	< ghuckriede at blackberry.com >
Reviewed by:	< ghuckriede at blackberry.com > (informally)
MFC after:	3 days
2021-06-20 11:17:13 -05:00
Mark Johnston
f66a1f4074 genet: Use device_t in preference to struct device *
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-04-12 09:31:58 -04:00
Mike Karels
2bdcf62377 genet: Fix problem with forwarding some TCP/IPv6 packets
TCP/IPv6 packets to be forwarded can be laid out with only the Ethernet
header in the first mbuf, and these packets are lost.  There was a
previous hack to pullup ICMPv6 packets with such a layout for the
same reason.  Generalize, and pullup any IPv6 packets with only the
Ethernet header in the first mbuf.  Possibly this should also include
IPv4, but that situation has not been observed to fail.

PR:		254060
Reported by:	denis at h3q.com
MFC after:	3 days
2021-03-17 19:25:43 -05:00
Emmanuel Vadot
cb00fc7c4d arm64: genet: Add bcm2711-genet-v5 compatible
Later dtb from the RPI Foundation removed the brcm,genet-v5 compatible
for some unknown reason, add brcm,bcm2711-genet-v5 to the list of compatible
device for if_genet
2021-01-05 20:50:43 +01:00
Mateusz Guzik
50cedfede3 arm64: clean up empty lines in .c and .h files 2020-09-01 21:18:06 +00:00
Mike Karels
349eddbd07 Add support for bcm54213PE in brgphy.
This chip is used in the Rasperry Pi 4, and is supported by the if_genet
driver. Currently we use the ukphy mii driver, this patch switches over
to the brgphy mii driver instead. To support the rgmii-rxid phy mode,
which is now the default in the Linux dtb, we add support for clock
skewing.

These changes are taken from OpenBSD and NetBSD, except for the bailout
in brgphy_bcm54xx_clock_delay() in rgmii mode, which was found necessary
after testing.

Submitted by:	Robert Crowston, crowston at protomail.com
Differential Revision:	https://reviews.freebsd.org/D25251
2020-06-18 23:57:10 +00:00
Mike Karels
51cefda170 genet: workaround for problem with ICMPv6 echo replies
The ICMPv6 echo reply is constructed with the IPv6 header too close to
the beginning of a packet for an Ethernet header to be prepended, so we
end up with an mbuf containing just the Ethernet header.  The GENET
controller doesn't seem to handle this, with or without transmit checksum
offload.  At least until we have chip documentation, do a pullup to
satisfy the chip.  Hopefully this can be fixed properly in the future.
2020-05-30 02:09:36 +00:00
Mike Karels
0add2a5229 genet: fix issues with transmit checksum offload
Fix problem with ICMP echo replies: check only deferred data checksum
flags, and not the received checksum status bits, when checking whether
a packet has a deferred checksum; otherwise echo replies are corrupted
because the received checksum status bits are still present.

Fix some unhandled cases in packet shuffling for checksum offload.
2020-05-30 02:02:34 +00:00
Mike Karels
2cd0c52978 Add genet driver for Raspberry Pi 4B Ethernet
Add driver for Broadcom "GENET" version 5, as found in BCM-2711 on
Raspberry Pi 4B. The driver is derived in part from the bcmgenet.c
driver in NetBSD, along with bcmgenetreg.h.

Reviewed by:	manu
Obtained from:	in part from NetBSD
Relnotes:	yes, note addition
Differential Revision:	https://reviews.freebsd.org/D24436
2020-04-22 00:42:10 +00:00
Wojciech Macek
36c1a37655 Add MDIO PHY driver for NS2 ARM64 platform.
Obtained from:         Semihalf
Authored by:           Kornel Duleba <mindal@semihalf.com>
Approved by:           wma
Differential Revision: https://reviews.freebsd.org/D21335
2020-04-06 05:48:58 +00:00
Oleksandr Tymoshenko
745c4aa5e8 Make BRCM2837 port conform FreeBSD/ARM64 guidelines
- Rename SOC_BCM2837 to SOC_BRCM_BCM2837, put it to opt_soc.h
- do not use files.XXX files, just move required sources to
    conf/files.arm64 and make them depend on soc_brcm_bcm2837

Suggested by: andrew
2016-10-14 22:23:03 +00:00
Oleksandr Tymoshenko
65de32210c Remove redundant kern_clocksource.c. It is already in conf/files.arm64
Reported by:	andrew
2016-10-14 17:40:48 +00:00
Oleksandr Tymoshenko
563193fd0c Add initial Raspberry Pi 3 support
RPI3 kernel config builds kernel compatible with latest upstream device
tree and firmware: https://github.com/raspberrypi/firmware/tree/master/boot
As of today it's 597c662a613df1144a6bc43e5f4505d83bd748ca

Default console is PL01x, so pi3-disable-bt dt overlay should be configured
in config.txt and stock U-Boot should be patched to use proper serial port.

Yet unsupported: SMP, VCHIQ, RNG driver. RNG requires some work due to
upstream device tree incompatibility.

Multiple people contributed to this work over time: db@, loos@, manu@
2016-10-14 03:37:35 +00:00