aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/dwc
Commit message (Collapse)AuthorAgeFilesLines
* sys: Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-231-1/+0
| | | | | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/ Similar commit in current: (cherry picked from commit 031beb4e239b)
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-231-2/+0
| | | | | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/ Similar commit in current: (cherry picked from commit 685dc743dc3b)
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-232-4/+0
| | | | | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/ Similar commit in current: (cherry picked from commit 95ee2897e98f)
* if_dwc: fix reinitialization with changed MACJiahao LI2022-09-161-5/+6
| | | | | | | | | | | | It was observed that on RockPro64 hardware, the dwc interface is unable to receive packets after being assigned a new MAC address. The fix is simply to call mii_mediachg() before touching any device registers in dwc_init_locked(). This is consistent with what the OpenBSD driver does. PR: 263820 MFC after: 1 week (cherry picked from commit 6501fcdc0a97faa3c59f6ece314bf7754303db6f)
* if_dwc: avoid duplicate packet countsMitchell Horne2022-07-041-12/+0
| | | | | | | | | | | | | | | | | | | We already increment the unicast IPACKETS and OPACKETS counters in the rx/tx paths, respectively. Multicast packets are counted in the generic ethernet code. Therefore, we shouldn't increment these counters in dwc_harvest_stats(). Drop the early return from dwc_rxfinish_one() so that we still count received packets with e.g. a checksum error. PR: 263817 Reported by: Jiahao LI <jiahali@blackberry.com> Reviewed by: manu MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35499 (cherry picked from commit 9718759043ec2ef36f12b15963194b866d731b5b)
* if_dwc: add detach methodMitchell Horne2022-07-041-0/+88
| | | | | | | | | | | It can be useful for testing. Reviewed by: manu MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35496 (cherry picked from commit 27b39e58b39edb76a4bffdfe730edfe6bc22f329)
* if_dwc: enable RX checksum offload featureJiahao Li2022-07-042-0/+22
| | | | | | | | | | | | We claim support in ifcaps, but don't actually enable it. PR: 263886 Reviewed by: manu MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35498 (cherry picked from commit 35c9edab4169f99de7e8fcada6d9b499c8405f87)
* if_dwc: consistently use if.c helper methodsMitchell Horne2022-07-041-21/+21
| | | | | | | | | | | And if_t rather than struct ifnet *. No functional change intended. Reviewed by: manu MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35497 (cherry picked from commit ca01879004d4fe49c2617f15048a52281963d0ac)
* if_dwc: Plug set but not used variableEmmanuel Vadot2022-05-161-2/+0
| | | | | | Sponsored by: Beckhoff Automation GmbH & Co. KG (cherry picked from commit 79778f86922582c44a777c98f54b6f7cf842cbed)
* dwc: Make ext_resources non-optionalEmmanuel Vadot2022-05-161-6/+0
| | | | | | | | | | EXT_RESOURCES have been introduced in 12-CURRENT and all supported releases have it enabled in their kernel config. MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D33820 (cherry picked from commit a5339ba3ff147618e21f45a11f062ccb9fadafb2)
* dwc: Support phy mode MIIEmmanuel Vadot2022-03-042-4/+8
| | | | | | | | | | | | Some board use dwc phy in MII mode, so do not fail to attach if this is the case. Only rockchip code uses the phy mode to program some custom syscon register. PR: 260848 MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG (cherry picked from commit da6252a6a099e6253207b69960e6762ce3cca0f8)
* dwc: Release resources when attach failsEmmanuel Vadot2022-03-041-2/+9
| | | | | | | | PR: 259282 MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG (cherry picked from commit 30f16ad460e2f9631484d04f067d80ee578473bc)
* dwc: Use mii_fdt functionEmmanuel Vadot2021-07-221-5/+12
| | | | | | | | Use the helper function to get phy mode and configure dwc accordingly. Reviewed by: ian (cherry picked from commit f77d8d10115b0863cc3dfd6e1746c02847d6569d)
* [if_dwc] add support for multi-descriptor packets in TX pathOleksandr Tymoshenko2020-12-232-43/+116
| | | | | | | | | | | Original if_dwc driver used m_defrag as an implementation shortcut but on 1000Mb networks it affects performance. Implement multi-descriptor support for TX path. Tested on RK3399-Firefly, patch adds ~15% of network throughput. Reviewed By: manu Differential Revision: https://reviews.freebsd.org/D27520
* if_dwc: Honor snps,pbl propertyEmmanuel Vadot2020-12-032-4/+7
| | | | | | | | | | | | DTS node can have this property which configure the burst length for both TX and RX if it's the same. This unbreak if_dwc on Allwinner A20 and possibly other boards that uses this prop. Reported by: qroxana <qroxana@mail.ru> Notes: svn path=/head/; revision=368299
* if_dwc: Correctly configure the DMA engine based on the fdt propertiesEmmanuel Vadot2020-11-222-6/+21
| | | | | | | | | | Do not hardcode what we setup for the DMA engine configuration but lookup the fdt properties and configuring accordingly. Use a default value of 8 for the burst dma length for both TX and RX, this is what we used for TX before. Notes: svn path=/head/; revision=367940
* if_dwc: Add checksum offloading supportEmmanuel Vadot2020-11-201-8/+44
| | | | Notes: svn path=/head/; revision=367888
* if_dwc: Add flow control supportEmmanuel Vadot2020-11-202-0/+17
| | | | Notes: svn path=/head/; revision=367887
* if_dwc: Use if_ function where appropriateEmmanuel Vadot2020-11-201-28/+28
| | | | | | | No functional changes intended Notes: svn path=/head/; revision=367885
* if_dwc: Reorder functions and sort them by usageEmmanuel Vadot2020-11-201-624/+658
| | | | | | | No functional changes intended Notes: svn path=/head/; revision=367884
* if_dwc: dwc_get_hwaddr cannot fail, change return to voidEmmanuel Vadot2020-11-201-7/+2
| | | | | | | No functional changes intended Notes: svn path=/head/; revision=367882
* if_dwc: Add dwc_stop_dma and use it in dwc_stop_lockedEmmanuel Vadot2020-11-201-16/+25
| | | | | | | No functional changes intended Notes: svn path=/head/; revision=367881
* if_dwc: Use dwc_enable_mac in dwc_stop_lockedEmmanuel Vadot2020-11-201-4/+1
| | | | | | | No functional changes intended Notes: svn path=/head/; revision=367879
* if_dwc: Add a function to enable/disable the mac tx/rxEmmanuel Vadot2020-11-201-2/+17
| | | | | | | No functional changes intended Notes: svn path=/head/; revision=367878
* if_dwc: Use if_setdrvflagbits to notify that we are runningEmmanuel Vadot2020-11-201-2/+2
| | | | | | | No functional changes intended Notes: svn path=/head/; revision=367876
* if_dwc: Split init code into sub functionEmmanuel Vadot2020-11-201-21/+40
| | | | | | | | | Be clear of what we enable or init. No functional changes intended Notes: svn path=/head/; revision=367875
* Fix armv{6,7} build after r364088Li-Wen Hsu2020-08-111-1/+2
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=364098
* Improve Rockchip's integration of if_dwcOleksandr Tymoshenko2020-08-104-1/+42
| | | | | | | | | | | | | - Do not rely on U-Boot for clocks configuration, enable and set frequencies in the driver's attach method. - Adjust MAC settings according to detected linespeed on RK3399 and RK3328. - Add support for RMII PHY mode on RK3328. Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D26006 Notes: svn path=/head/; revision=364088
* Improve if_dwc:Michal Meloun2020-06-192-62/+103
| | | | | | | | | | | - refactorize packet receive path. Make sure that we don't leak mbufs and/or that we don't create holes in RX descriptor ring - slightly simplify handling with TX descriptors MFC after: 4 weeks Notes: svn path=/head/; revision=362415
* Finish renaming in if_dwc.Michal Meloun2020-06-193-10/+11
| | | | | | | | | | | | By using DWC TRM terminology, normal descriptor format should be named extended and alternate descriptor format should be named normal. Should not been functional change. MFC after: 4 weeks Notes: svn path=/head/; revision=362405
* Use naming nomenclature used in DesignWare TRM.Michal Meloun2020-06-191-47/+114
| | | | | | | | | | | | | | | Use naming nomenclature used in DesignWare TRM. This driver was written by using Altera (now Intel) documentation for Arria FPGA manual. Unfortunately this manual used very different (and in some cases opposite naming) for registers and descriptor fields. Unfortunately, this makes future expansion extremely hard. Should not been functional change. MFC after: 4 weeks Notes: svn path=/head/; revision=362399
* Fix style(9). Strip write only variables.Michal Meloun2020-04-292-13/+5
| | | | | | | | | Not a functional change. MFC after: 1 week Notes: svn path=/head/; revision=360467
* Convert to if_foreach_llmaddr() KPI.Gleb Smirnoff2019-10-211-24/+34
| | | | Notes: svn path=/head/; revision=353843
* dwc: Add more delay for chip resetEmmanuel Vadot2019-09-281-6/+3
| | | | | | | | | | | | On rockchip board it seems that the value in the DTS are not enough for reseting the chip, I don't know if the value are really incorrect or if DELAY is not precise enough or if the rockchip gpio driver have some "lag" of some kind or not. For now just add more delay. Notes: svn path=/head/; revision=352852
* 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
* EXTRES: Add OF node as argument to all <foo>_get_by_ofw_<bar>() functions.Michal Meloun2016-07-101-2/+2
| | | | | | | | | | | In some cases, the driver must handle given properties located in specific OF subnode. Instead of creating duplicate set of function, add 'node' as argument to existing functions, defaulting it to device OF node. MFC after: 3 weeks Notes: svn path=/head/; revision=302528
* Fix an issue with multicast hash filters on Amlogic and Allwinner boards.Jared McNeill2016-06-122-8/+13
| | | | | | | | | | | | For DWC_GMAC_ALT_DESC implementations, the multicast hash table has only 64 entries. Instead of 8 registers starting at 0x500, a pair of registers at 0x08 and 0x0c are used instead. Approved by: re (hrs) Submitted by: Guy Yur <guyyur@gmail.com> Notes: svn path=/head/; revision=301841
* Multicast filters on DWC_GMAC_ALT_DESC type implementations use a differentJared McNeill2016-06-081-9/+21
| | | | | | | | | | hash register setup. In addition, strip trailing FCS in receive path. Reviewed by: loos Differential Revision: https://reviews.freebsd.org/D6653 Notes: svn path=/head/; revision=301693
* Set txbuf_map array size to TX_DESC_COUNT instead of RX_DESC_COUNT.Jared McNeill2016-04-291-1/+1
| | | | Notes: svn path=/head/; revision=298816
* sys/dev: use our nitems() macro when it is avaliable through param.h.Pedro F. Giffuni2016-04-191-1/+1
| | | | | | | | | | No functional change, only trivial cases are done in this sweep, Drivers that can get further enhancements will be done independently. Discussed in: freebsd-current Notes: svn path=/head/; revision=298307
* Convert Allwinner port to extres clk/hwreset/regulator APIs.Jared McNeill2016-04-061-0/+40
| | | | | | | | | Reviewed by: andrew, gonzo, Emmanuel Vadot <manu@bidouilliste.com> Approved by: gonzo (mentor) Differential Revision: https://reviews.freebsd.org/D5752 Notes: svn path=/head/; revision=297627
* Add support for resetting the PHY via GPIO.Jared McNeill2016-03-031-0/+64
| | | | | | | | | | Submitted by: Emmanuel Vadot <manu@bidouilliste.com> Reviewed by: andrew, jmcneill Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D5505 Notes: svn path=/head/; revision=296365
* Fix the build by adding the alternate descriptors and MII clock defines.Luiz Otavio O Souza2015-09-201-0/+28
| | | | | | | This obviously should be in the last commit. Notes: svn path=/head/; revision=288024
* Add alternate descriptors support for if_dwc.Luiz Otavio O Souza2015-09-203-67/+217
| | | | | | | | | | | | | | | | | | | | | This also adds a newbus interface that allows a SoC to override the following settings: - if_dwc specific SoC initialization; - if_dwc descriptor type; - if_dwc MII clock. This seems to be an old version of the hardware descriptors but it is still in use in a few SoCs (namely Allwinner A20 and Amlogic at least). Tested on Cubieboard2 and Banana pi. Tested for regressions on Altera Cyclone by br@ (old version). Obtained from: NetBSD Notes: svn path=/head/; revision=288023
* Remove unnecessary includes and, while here, sort them.Luiz Otavio O Souza2015-09-201-14/+7
| | | | Notes: svn path=/head/; revision=288022
* Do not call mii_mediachg() from NIC interrupt handler.Luiz Otavio O Souza2015-09-121-3/+1
| | | | | | | | | This fixes the link instability on banana pi (A20). Suggested by: yongari Notes: svn path=/head/; revision=287716
* When initializing the (unused) TX descriptors it is not necessary set theLuiz Otavio O Souza2015-07-061-3/+1
| | | | | | | | | chain bit. Obtained from: NetBSD Notes: svn path=/head/; revision=285211
* Use uint32_t consistently to store registers values.Luiz Otavio O Souza2015-07-062-39/+25
| | | | | | | | | | | Always use unsigned numbers to avoid undefined behavior on (1 << 31). Remove unused variables and some stray semicolons. No functional changes. Notes: svn path=/head/; revision=285209
* Fix the sent packets statistics for if_dwc.Luiz Otavio O Souza2015-07-061-0/+1
| | | | Notes: svn path=/head/; revision=285192
* Fix wrong variable name in the previous commit.Luiz Otavio O Souza2015-06-031-1/+1
| | | | | | | | Pointy hat to: loos Reported by: araujo Notes: svn path=/head/; revision=283949