aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ffec
Commit message (Collapse)AuthorAgeFilesLines
* if_ffec: fix MAC address bootverbose printGary Bisson2024-10-311-1/+1
| | | | | | | | | Remove extraneous colon at the end. Pull Request: https://github.com/freebsd/freebsd-src/pull/1479 Signed-off-by: Gary Bisson <gary.bisson@ezurio.com> (cherry picked from commit 6a7aa5530c0d860c98c982968ac27728daaac7aa)
* if_ffec: fix imx6sx compatible flagsGary Bisson2024-10-311-1/+2
| | | | | | | | | | | | | | | | The i.MX 6 SoloX does support Gigabit and AVB features as can be seen in its technical reference manual [1] or even Linux kernel [2]. Fixes: 94bc2117b4a ("Add i.MX 8M Quad support") [1] https://www.nxp.com/webapp/Download?colCode=IMX6SXRM [2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/net/ethernet/freescale/fec_main.c?h=linux-6.6.y#n206 Pull Request: https://github.com/freebsd/freebsd-src/pull/1479 Signed-off-by: Gary Bisson <gary.bisson@ezurio.com> (cherry picked from commit c222619cd4807e9e0274e6fadcbe259cf5cabc26)
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-232-4/+0
| | | | | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/ Similar commit in current: (cherry picked from commit 685dc743dc3b)
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-07-252-2/+2
| | | | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix (cherry picked from commit 4d846d260e2b9a3d4d0a701462568268cbfe7a5b)
* if_ffec: free the dmamem allocation in detachMitchell Horne2022-07-041-2/+4
| | | | | | | | | | | | Calling bus_dmamap_destroy() for a mapping which was allocated with bus_dmamem_alloc() will result in a panic. This change is not run-time tested, but I identified the issue while implementing the analogous method in if_dwc(4), using this implementation as the template. MFC after: 1 week Sponsored by: The FreeBSD Foundation (cherry picked from commit 8757d0fca9e6a9e174bc87728e296e5338d30eb7)
* if_ffec: fix some misleading indentationMitchell Horne2022-07-041-1/+1
| | | | (cherry picked from commit b93985c11a6e7c7dd5fcaca8db6f4847a0126991)
* ffec: Fix a common typo in a source code commentGordon Bergling2022-06-101-1/+1
| | | | | | - s/independant/independent/ (cherry picked from commit d3e0919b564d0f0267758d33c5de8008526f61a5)
* Add i.MX 8M Quad supportOleksandr Tymoshenko2020-07-011-0/+1
| | | | | | | | | | | | | | | | | - Add CCM driver and clocks implementations for i.MX 8M - Add GPC driver for iMX8 - Add clock tree for i.MX 8M Quad - Add clocks support and new compat strings (where required) for existing i.MX 6 UART, I2C, and GPIO drivers - Enable aarch64-compatible drivers form i.MX 6 in arm64 GENERIC kernel config - Add dtb/imx8 kernel module with DTBs for Nitrogen8M and iMX8MQ EVK With this patch both Nitrogen8M and iMX8MQ EVK boot with NFS root up to multiuser login prompt Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D25274 Notes: svn path=/head/; revision=362817
* Convert to if_foreach_llmaddr() KPI.Gleb Smirnoff2019-10-211-12/+14
| | | | Notes: svn path=/head/; revision=353846
* Fix possible NULL pointer dereference in ffec_alloc_mbufcl().Andrey V. Elsukov2018-09-211-1/+2
| | | | | | | | | PR: 231514 Approved by: re (kib) MFC after: 1 week Notes: svn path=/head/; revision=338857
* ifnet: Replace if_addr_lock rwlock with epoch + mutexMatt Macy2018-05-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Run on LLNW canaries and tested by pho@ gallatin: Using a 14-core, 28-HTT single socket E5-2697 v3 with a 40GbE MLX5 based ConnectX 4-LX NIC, I see an almost 12% improvement in received packet rate, and a larger improvement in bytes delivered all the way to userspace. When the host receiving 64 streams of netperf -H $DUT -t UDP_STREAM -- -m 1, I see, using nstat -I mce0 1 before the patch: InMpps OMpps InGbs OGbs err TCP Est %CPU syscalls csw irq GBfree 4.98 0.00 4.42 0.00 4235592 33 83.80 4720653 2149771 1235 247.32 4.73 0.00 4.20 0.00 4025260 33 82.99 4724900 2139833 1204 247.32 4.72 0.00 4.20 0.00 4035252 33 82.14 4719162 2132023 1264 247.32 4.71 0.00 4.21 0.00 4073206 33 83.68 4744973 2123317 1347 247.32 4.72 0.00 4.21 0.00 4061118 33 80.82 4713615 2188091 1490 247.32 4.72 0.00 4.21 0.00 4051675 33 85.29 4727399 2109011 1205 247.32 4.73 0.00 4.21 0.00 4039056 33 84.65 4724735 2102603 1053 247.32 After the patch InMpps OMpps InGbs OGbs err TCP Est %CPU syscalls csw irq GBfree 5.43 0.00 4.20 0.00 3313143 33 84.96 5434214 1900162 2656 245.51 5.43 0.00 4.20 0.00 3308527 33 85.24 5439695 1809382 2521 245.51 5.42 0.00 4.19 0.00 3316778 33 87.54 5416028 1805835 2256 245.51 5.42 0.00 4.19 0.00 3317673 33 90.44 5426044 1763056 2332 245.51 5.42 0.00 4.19 0.00 3314839 33 88.11 5435732 1792218 2499 245.52 5.44 0.00 4.19 0.00 3293228 33 91.84 5426301 1668597 2121 245.52 Similarly, netperf reports 230Mb/s before the patch, and 270Mb/s after the patch Reviewed by: gallatin Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D15366 Notes: svn path=/head/; revision=333813
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-272-0/+4
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326255
* Split the hardware type enum and the hw feature flags bits into separateIan Lepore2017-10-281-16/+22
| | | | | | | | | | | | fields in the softc; they're ORed together in the ofw_compat_data. I already caught myself doing 'sc->fectype == <enum val>' without masking out the feature bits in one place, and that's sure to happen again. Glomming them together is convenient for storing them in the ofw_compat_data array, but there's no reason to keep them together in the softc. Notes: svn path=/head/; revision=325065
* Use the 16-bit receive shift feature in ffec hardware that supports it.Ian Lepore2017-10-281-33/+44
| | | | | | | | | | | | | When available, enabling this feature causes the hardware to write data to the receive buffer starting at a 16-bit offset from the start address. This eliminates the need to copy the data after receiving to re-align the protocol headers to a 32-bit boundary. PR: 222634 Submitted by: sebastian.huber@embedded-brains.de Notes: svn path=/head/; revision=325063
* Support up to 3 IRQs in the ffec driver.Ian Lepore2017-10-281-21/+36
| | | | | | | | | | | | | | | | | Newer hardware splits the interrupts onto 3 different irq lines, but the docs barely mention that there are multiple interrupts, and do not detail how they're split up. The code now supports 1-3 irqs, and uses the same interrupt service routine to handle all of them. I modified the submitted changes to use bus_alloc_resources() instead of using loops to allocate each irq separately. Thus, blame any bugs on me (I can't actually test on imx7 hardware). PR: 222634 Submitted by: sebastian.huber@embedded-brains.de Notes: svn path=/head/; revision=325061
* Avoid AXI bus issues due to a MAC reset on imx6sx and imx7.Ian Lepore2017-10-281-2/+15
| | | | | | | | | | | | | | | | When the FEC is connected to the AXI bus (indicated by AVB flag), a MAC reset while a bus transaction is pending can hang the bus. Instead of resetting, turn off the ENABLE bit, which allows the hardware to complete any in-progress transfers (appending a bad CRC to any partial packet) and release the AXI bus. This could probably be done unconditionally for all hardware variants, but that hasn't been tested. PR: 222634 Submitted by: sebastian.huber@embedded-brains.de Notes: svn path=/head/; revision=325056
* Add FECFLAG_AVB variant flag to support new features on imx7.Ian Lepore2017-10-282-8/+18
| | | | | | | | | | | | | | | | | | | | | This flag is analogous to the Linux driver FEC_QUIRK_HAS_AVB. It indicates an FEC with support for Audio Video Bridging (AVB). This indicator is used for various other parts in the Linux driver (drivers/net/ethernet/freescale/fec_main.c). Use it to customize the receive/transmit buffer alignment. The receive buffer alignment increased to 64-bytes on the i.MX 6SoloX and i.MX 7Dual. There are no hard alignment restrictions for transmit buffers on these chips. Fix the ffec_softc::fectype type to provide enough storage for the feature flags. PR: 222634 Submitted by: sebastian.huber@embedded-brains.de Notes: svn path=/head/; revision=325055
* Increase the alignment of the rx/tx descriptor ring buffers to 64 bytes.Ian Lepore2017-10-281-1/+1
| | | | | | | | | | | 16 was the correct alignment for older hardware, but the imx7 requires 64-byte alignment, which is a fine value to use on all systems. PR: 222634 Submitted by: sebastian.huber@embedded-brains.de Notes: svn path=/head/; revision=325054
* Convert from local code and constants for mac<->phy connection type to newIan Lepore2017-06-111-25/+13
| | | | | | | common fdt helper code. Notes: svn path=/head/; revision=319818
* if_ffec bugfixes related to harvesting of hardware-maintained statistics...Ian Lepore2017-06-101-33/+43
| | | | | | | | | | | | | | | | | | | | | | | | | After harvesting the hardware statistics counters and summing them into the interface stats, properly clear the hardware counters back to zero. On imx5 and earlier hardware it is necessary to disable collection of stats while writing zeroes to all the registers. On imx6 and newer it turns out it's not even possible to write zeroes, instead you have to toggle a special "zero everything" control bit in a register. Count incoming packets with a bad start frame delim as input errors, and incoming packets dropped due to no fifo space as input drops. Remove all code related to harvesting the hardware stats less often than once per second. It turns out the 32-bit stats registers are backed by 16-bit counters under the hood, and they can easily roll over if you only harvest them once every 3 seconds like the old code was doing. Now we just read all the regs once a second. The combination of not properly zeroing the stats registers and 16-bit counters sometimes wrapping between harvest calls resulted in basically unusable statistics before these changes. Notes: svn path=/head/; revision=319811
* Add imx6ul SoC support, and get the PHY number from the FDT data. If thereIan Lepore2017-04-161-2/+8
| | | | | | | | | | | | | is no phy-handle property, fall back to using MII_PHY_ANY. This still doesn't support an mdio bus with multiple PHYs on it, or the possibility that the PHY being used by this instance of ffec is on the mdio bus of some other instance (which is now a possibility with imx6ul). Adding that support will require changes in fdt_get_phyaddr(), which is currently making some assumptions that don't work with modern fdt data. Notes: svn path=/head/; revision=316996
* Add definitions for the IEEE-1588 registers.Ian Lepore2017-02-181-0/+21
| | | | Notes: svn path=/head/; revision=313918
* Fix erronious mixed use of tx/rx variables/constants in the same expression.Ian Lepore2016-05-271-3/+3
| | | | | | | Pointed out by jmcneill; other instances found by grep -iE 'rx.*tx|tx.*rx' Notes: svn path=/head/; revision=300878
* Add busdma sync ops before reading and after modifying the descriptor rings.Ian Lepore2014-11-241-0/+10
| | | | | | | | | | | | | | This was previously working by accident because BUSDMA_COHERENT_MEMORY has always been set to strongly-ordered on arm. Now we're moving towards normal-uncacheable (what might be called write-combining on other platforms) and using the proper sync ops will be more important. Of course, that opens the question of just what is the "proper" sync op for shared concurrent dma access as opposed to accesses where the handoff of control of the memory has well-defined sequence points that match the available busdma sync operations. Notes: svn path=/head/; revision=274967
* Mechanically convert to if_inc_counter().Gleb Smirnoff2014-09-181-18/+16
| | | | Notes: svn path=/head/; revision=271826
* Use define from if_var.h to access a field inside struct if_data,Gleb Smirnoff2014-08-301-1/+1
| | | | | | | | | that resides in struct ifnet. Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=270856
* Fix another bug in multicast filtering. i.MX uses 6 bits from MSB inHiroki Sato2014-03-081-2/+3
| | | | | | | | | | LE CRC32 for the hash value, not the lowest 6 bits in BE CRC32. Tested by: Takanori Sawada PR: arm/187179 Notes: svn path=/head/; revision=262929
* Fix multicast filtering.Hiroki Sato2014-03-041-1/+1
| | | | | | | | Submitted by: Takanori Sawada PR: arm/187179 Notes: svn path=/head/; revision=262728
* Follow r261352 by updating all drivers which are children of simplebusIan Lepore2014-02-021-0/+3
| | | | | | | | | | | | | | | | to check the status property in their probe routines. Simplebus used to only instantiate its children whose status="okay" but that was improper behavior, fixed in r261352. Now that it doesn't check anymore and probes all its children; the children all have to do the check because really only the children know how to properly interpret their status property strings. Right now all existing drivers only understand "okay" versus something- that's-not-okay, so they all use the new ofw_bus_status_okay() helper. Notes: svn path=/head/; revision=261410
* ENET on Vybrid Family SoC don't advertise its media capabilitiesRuslan Bukin2014-01-041-3/+5
| | | | | | | | | | | themselves properly, so force auto-negotiation. Tested on mvf600. Reviewed by: ian Notes: svn path=/head/; revision=260256
* Fix undefined behavior: (1 << 31) is not defined as 1 is an int and thisEitan Adler2013-11-301-5/+5
| | | | | | | | | | | | | | | | shifts into the sign bit. Instead use (1U << 31) which gets the expected result. This fix is not ideal as it assumes a 32 bit int, but does fix the issue for most cases. A similar change was made in OpenBSD. Discussed with: -arch, rdivacky Reviewed by: cperciva Notes: svn path=/head/; revision=258780
* Switch to using ofw_bus_search_compatible() table-driven compat lookup.Ian Lepore2013-10-261-23/+42
| | | | | | | Add compat strings for Freescale Vybrid family SoCs. Notes: svn path=/head/; revision=257167
* Mask out non-address bits in the mac address register, for properIan Lepore2013-10-221-2/+1
| | | | | | | | | detection of an all-zeroes address. Also remove a misplaced return. Reviewed by: br@ Notes: svn path=/head/; revision=256919
* Add a driver for the Freescale Fast Ethernet Controller found on variousIan Lepore2013-10-202-0/+2043
Freescale SoCs including the i.MX series. This also works for the newer SoCs with the ENET gigabit controller, but doesn't use any of the new hardware features other than enabling gigabit speed. Notes: svn path=/head/; revision=256806