History log of /src/sys/dev/ic/dwc_gmac.c |
Revision | | Date | Author | Comments |
1.96 |
| 16-Feb-2025 |
jakllsch | dwc_gmac: ETHER_ALIGN receive descriptors
|
1.95 |
| 07-Sep-2024 |
andvar | spelling and grammar fixes, mainly in comments.
|
1.94 |
| 11-Aug-2024 |
riastradh | awge(4): Narrow scope of `core' lock and rename to mcast lock.
Sprinkle locking notes.
Proposed at:
https://mail-index.netbsd.org/source-changes-d/2024/08/10/msg014251.html
Comment-only changes from the updated patch at:
https://mail-index.netbsd.org/source-changes-d/2024/08/10/msg014252.html
|
1.93 |
| 10-Aug-2024 |
skrll | awge(4): MP improvements
Remove the non-MP-safe scaffolding and make the locking less coarse.
|
1.92 |
| 10-Aug-2024 |
skrll | Sprinkle some const
|
1.91 |
| 27-Jul-2024 |
skrll | Handle GMAC_MAC_Version's that include USERVER.
|
1.90 |
| 14-Jul-2024 |
skrll | Improve and add new debug output
|
1.89 |
| 14-Jul-2024 |
skrll | Fix some bus_dmamap_sync calls. - ensure new descriptors are written before handing ownership of the first in the list to the device. - ensure descriptors are sync'ed before dumping them in dwc_gmac_dump_[rt]x_desc - don't sync the TX packet buffer twice (and not after we've passed ownership of its TX descriptor)
Change some variable names to better reflect what they are while I'm here.
|
1.88 |
| 05-Jul-2024 |
rin | sys: Drop redundant NULL check before m_freem(9)
m_freem(9) safely has accepted NULL argument at least since 4.2BSD: https://www.tuhs.org/cgi-bin/utree.pl?file=4.2BSD/usr/src/sys/sys/uipc_mbuf.c
Compile-tested on amd64/ALL.
Suggested by knakahara@
|
1.87 |
| 16-Jun-2024 |
skrll | Misc whitespace
|
1.86 |
| 14-Mar-2024 |
jakllsch | Use ether_crc32_be() instead of having a local bitrev32() function to munge ether_crc32_le() output when programming multicast filter.
|
1.85 |
| 03-Mar-2024 |
skrll | Reorder the bus_dmamap_sync sync operations
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD to BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE
for consistency.
|
1.84 |
| 03-Mar-2024 |
skrll | More KNF (whitespace around binary operators)
|
1.83 |
| 27-Feb-2024 |
skrll | Enforce the device 32 bit DMA limitation via bus_dmatag_subregion if bus can address more than 4GB.
|
1.82 |
| 27-Feb-2024 |
skrll | KNF - spaces around binary operators.
|
1.81 |
| 11-Feb-2024 |
skrll | Fix spello in debug output
|
1.80 |
| 20-Dec-2023 |
skrll | Remove unnecssary #include
|
1.79 |
| 01-Aug-2023 |
mrg | fix simple mis-matched function prototype and definitions.
most of these are like, eg
void foo(int[2]);
with either of these
void foo(int*) { ... } void foo(int[]) { ... }
in some cases (such as stat or utimes* calls found in our header files), we now match standard definition from opengroup.
found by GCC 12.
|
1.78 |
| 18-Sep-2022 |
thorpej | Eliminate use of IFF_OACTIVE.
|
1.77 |
| 09-Aug-2022 |
sekiya | Turn off AWIN_GMAC_MAC_CONF_ACS, so that all received packets retain FCS bytes.
ether_input() can now trust M_HASFCS to accurately represent the packet contents.
Discussed on tech-net@
|
1.76 |
| 05-Aug-2022 |
sekiya | Do not unilaterally set M_HASFCS; this breaks protocols that lack CRC bytes (such as AppleTalk).
Instead, remove/preserve the final four bytes in the packet ourselves on a per- protocol basis, as we do in arch/arm/xscale/ixp425_if_npe.c (and dev/ic/gem.c, and so forth).
|
1.75 |
| 11-Sep-2021 |
andvar | Add missing double p and d for stopped and overriden accordingly. Fix few more typos along the way, mainly in copy-pasted comments.
|
1.74 |
| 16-Jun-2021 |
riastradh | if_attach and if_initialize cannot fail, don't test return value
These were originally made failable back in 2017 when if_initialize allocated a softint in every interface for link state changes, so that it could fail gracefully instead of panicking:
https://mail-index.NetBSD.org/source-changes/2017/10/23/msg089053.html
However, this spawned many seldom- or never-tested error branches, which are risky to have around. And that softint in every interface has since been replaced by a single global workqueue, because link state changes require thread context but not low latency or high throughput:
https://mail-index.NetBSD.org/source-changes/2020/02/06/msg113759.html
So there is no longer any reason for if_initialize to fail. (The subroutine if_stats_init can't fail because percpu_alloc can't fail either.)
There is a snag: the softint_establish in if_percpuq_create could fail, potentially leading to bad consequences later on trying to use the softint. This change doesn't introduce any new bugs because of the snag -- if_percpuq_attach was already broken. However, the snag can be better addressed without spawning error branches, either by using a single softint or making softints less scarce.
(Separate commit will change the signatures of if_attach and if_initialize to return void, scheduled to ride whatever is the next convenient kernel bump.)
Patch and testing on amd64 and evbmips64-eb by maya@; commit message soliloquy, and compile-testing on evbppc/i386/earmv7hf, by me.
|
1.73 |
| 13-May-2021 |
msaitoh | Cast to uint32_t to avoid undefined behavior in dwc_gmac_write_hwaddr(). Found by kUBSan.
|
1.72 |
| 31-Dec-2020 |
ryo | branches: 1.72.4; 1.72.6; extend the timeout value. dwc_gmac_reset() sometimes takes more time.
|
1.71 |
| 27-Jun-2020 |
jmcneill | branches: 1.71.2; prop_data_data_nocopy -> prop_data_value
|
1.70 |
| 17-May-2020 |
chs | Mask all the MMC counter interrupts if the MMC module is present.
|
1.69 |
| 29-Jan-2020 |
thorpej | Adopt <net/if_stats.h>.
|
1.68 |
| 19-Oct-2019 |
tnn | branches: 1.68.2; awge: drop redundant m_adj(). Handled via uipc_mbuf.c r1.235 instead.
|
1.67 |
| 15-Oct-2019 |
tnn | correct pointer arithmetics
|
1.66 |
| 15-Oct-2019 |
tnn | awge: fix issue that caused rx packets to be corrupt with DIAGNOSTIC kernel
It seems the hardware can only reliably do rx DMA to addresses that are dcache size aligned. This is hinted at by some GMAC data sheets but hard to find an authoritative source.
on non-DIAGNOSTIC kernels we always implicitly get MCLBYTES-aligned mbuf data pointers, but with the reintroduction of POOL_REDZONE for DIAGNOSTIC we can get 8-byte alignment due to redzone padding. So align rx pointers to 64 bytes which should be good for both arm32 and aarch64.
While here change some bus_dmamap_load() to bus_dmamap_load_mbuf() and add one missing bus_dmamap_sync(). Also fixes the code to not assume that MCLBYTES == AWGE_MAX_PACKET. User may override MCLSHIFT in kernel config.
|
1.65 |
| 13-Sep-2019 |
msaitoh | if_flags is neither int nor short. It's unsigned short.
|
1.64 |
| 21-Jul-2019 |
mrg | branches: 1.64.2; move DWCGMAC_MPSAFE into dwc_gmac_var.h and introduce an additional define that is 0 or FDT_INTR_MPSAFE that the frontends can use when passing to fdtbus_intr_establish().
with NET_MPSAFE enabled, this avoids hangs seen on rock64, as well as finishing the MPSAFE port for this driver.
XXX: still don't know why the existing hangs occur.
|
1.63 |
| 08-Jul-2019 |
msaitoh | Add rnd(9) support.
|
1.62 |
| 23-May-2019 |
msaitoh | Whitespace fix (mainly tabify).
|
1.61 |
| 23-May-2019 |
msaitoh | -No functional change: - KNF - u_int*_t -> uint*_t.
|
1.60 |
| 15-May-2019 |
ozaki-r | Store IFF_ALLMULTI in ec_flags instead of if_flags to avoid data races
IFF_ALLMULTI is set/unset to if_flags via if_mcast_op. To avoid data races on if_flags, IFNET_LOCK was added for if_mcast_op. Unfortunately it produces a deadlock so we want to remove added IFNET_LOCK by avoiding the data races by another approach.
This fix introduces ec_flags to struct ethercom and stores IFF_ALLMULTI to it. ec_flags is protected by ETHER_LOCK and thus IFNET_LOCK is no longer necessary for if_mcast_op. Note that the fix is applied only to MP-safe drivers that the data races matter.
In the kernel, IFF_ALLMULTI is set by a driver and used by the driver itself. So changing the storing place doesn't break anything. One exception is ioctl(SIOCGIFFLAGS); we have to include IFF_ALLMULTI in a result if needed to export the flag as well as before.
A upcoming commit will remove IFNET_LOCK.
PR kern/54189
|
1.59 |
| 15-Apr-2019 |
ozaki-r | Protect ether_multi list
Fix this driver because it can set IFEF_MPSAFE.
|
1.58 |
| 07-Mar-2019 |
msaitoh | Fix previous. Pass phy_id correctly.
|
1.57 |
| 23-Feb-2019 |
martin | Pass the phy ID to dwc_gmac_attach.
|
1.56 |
| 22-Jan-2019 |
msaitoh | Change MII PHY read/write API from:
int (*mii_readreg_t)(device_t, int, int); void (*mii_writereg_t)(device_t, int, int, int); to:
int (*mii_readreg_t)(device_t, int, int, uint16_t *); int (*mii_writereg_t)(device_t, int, int, uint16_t);
Now we can test if a read/write operation failed or not by the return value.
In 802.3 spec says that the PHY shall not respond to read/write transaction to the unimplemented register(22.2.4.3). Detecting timeout can be used to check whether a register is implemented or not (if the register conforms to the spec). ukphy(4) can be used this for MII_MMDACR and MII_MMDAADR.
Note that I noticed that the following code do infinite loop in the read/wirte function. If it accesses unimplemented PHY register, it will hang. It should be fixed:
arm/at91/at91emac.c arm/ep93xx/epe.c arm/omap/omapl1x_emac.c mips/ralink/ralink_eth.c arch/powerpc/booke/dev/pq3etsec.c(read) dev/cadence/if_cemac.c <- hkenken dev/ic/lan9118.c
Tested with the following device:
axe+ukphy axe+rgephy axen+rgephy (tested by Andrius V) wm+atphy wm+ukphy wm+igphy wm+ihphy wm+makphy sk+makphy sk+brgphy sk+gentbi msk+makphy sip+icsphy sip+ukphy re+rgephy bge+brgphy bnx+brgphy gsip+gphyter rtk+rlphy fxp+inphy (tested by Andrius V) tlp+acphy ex+exphy epic+qsphy vge+ciphy (tested by Andrius V) vr+ukphy (tested by Andrius V) vte+ukphy (tested by Andrius V)
Not tested (MAC): arm:at91emac arm:cemac arm:epe arm:geminigmac arm:enet arm:cpsw arm:emac(omac) arm:emac(sunxi) arm:npe evbppc:temac macppc:bm macppc:gm mips:aumac mips:ae mips:cnmac mips:reth mips:sbmac playstation2:smap powerpc:tsec powerpc:emac(ibm4xx) sgimips:mec sparc:be sf ne(ax88190, dl10019) awge ep gem hme smsh mtd sm age alc ale bce cas et jme lii nfe pcn ste stge tl xi aue mue smsc udav url
Not tested (PHY): amhphy bmtphy dmphy etphy glxtphy ikphy iophy lxtphy nsphyter pnaphy rdcphy sqphy tlphy tqphy urlphy
|
1.55 |
| 08-Oct-2018 |
martin | Bring back support for enhanced descriptor format in newer core versions. Fix a few endian bugs and check the main core version before trying to read the hardware feature mask. Only read the hardware feature register if core version reported is >= 3.5 (all my older hardware reports 0). With some hints and patches from jared, and ok from aymeric
|
1.54 |
| 28-Sep-2018 |
aymeric | Revert the recent support for enhanced descriptors until a viable solution is found.
It broke at least Cubietruck, Orange Pi One, and maybe Rock64 ethernets in different ways. Unfortunately it works on my Olinuxino Micro and Lime 2 so I can't reproduce the bugs for now.
Should fix PR#53637
|
1.53 |
| 17-Sep-2018 |
aymeric | Add support for the enhanced descriptors feature.
This makes "recent" dwc gmac controllers, as found e.g. on the Cyclone V, work. The change was also tested working on an Allwinner A20 which doesn't have the feature.
No negative reaction on port-arm.
|
1.52 |
| 18-Jul-2018 |
sevan | Be consistent among ethernet drivers on the convention for printing ethernet addresses.
NFC
|
1.51 |
| 30-Jun-2018 |
jmcneill | dwc_gmac_attach: return non-zero on failure
|
1.50 |
| 26-Jun-2018 |
msaitoh | branches: 1.50.2; Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same as FreeBSD.
This change also fixes a bug that the direction is misunderstand on some environment by passing the direction to bpf_mtap*() instead of checking m->m_pkthdr.rcvif.
|
1.49 |
| 18-Jun-2018 |
jmcneill | Write MAC address high register before low register. Apparently the hardware updates the filter when the low register is written.
|
1.48 |
| 18-Jun-2018 |
jmcneill | Clear IFF_RUNNING | IFF_OACTIVE when stopping interface.
|
1.47 |
| 17-Jun-2018 |
jmcneill | Avoid calling bus_dmamap_sync with len=0
|
1.46 |
| 16-Jun-2018 |
jmcneill | Add flag for disabling store-and-forward mode, and a callback for notifying bus glue that the link speed has changed.
|
1.45 |
| 21-Dec-2017 |
martin | branches: 1.45.2; Don't KASSERT that we are MPSAFE if ! DWCGMAC_MPSAFE
|
1.44 |
| 19-Dec-2017 |
ozaki-r | Don't set IFEF_MPSAFE unless NET_MPSAFE at this point
Because recent investigations show that interfaces with IFEF_MPSAFE need to follow additional restrictions to work with the flag safely. We should enable it on an interface by default only if the interface surely satisfies the restrictions, which are described in if.h.
Note that enabling IFEF_MPSAFE solely gains a few benefit on performance because the network stack is still serialized by the big kernel locks by default.
|
1.43 |
| 16-Nov-2017 |
ozaki-r | branches: 1.43.2; Unify IFEF_*_MPSAFE into IFEF_MPSAFE
There are already two flags for if_output and if_start, however, it seems such MPSAFE flags are eventually needed for all if_XXX operations. Having discrete flags for each operation is wasteful of if_extflags bits. So let's unify the flags into one: IFEF_MPSAFE.
Fortunately IFEF_*_MPSAFE flags have never been included in any releases, so we can change them without breaking backward compatibility of the releases (though the kernel version of -current should be bumped).
Note that if an interface have both MP-safe and non-MP-safe operations at a time, we have to set the IFEF_MPSAFE flag and let callees of non-MP-safe opeartions take the kernel lock.
Proposed on tech-kern@ and tech-net@
|
1.42 |
| 23-Oct-2017 |
jakllsch | We don't need '&mii', but just 'mii' for mii_detach().
|
1.41 |
| 23-Oct-2017 |
msaitoh | - If if_initialize() failed in the attach function, free resources and return. - Add missing dwc_gmac_free_dma_rings() and mutex_destroy() when attach failed.
|
1.40 |
| 20-Feb-2017 |
ozaki-r | branches: 1.40.6; Apply deferred if_start to more drivers
|
1.39 |
| 23-Jan-2017 |
skrll | Use our ipq... sorry martin
|
1.38 |
| 21-Jan-2017 |
skrll | Merge from nick-nhusb - some MPification
|
1.37 |
| 15-Dec-2016 |
ozaki-r | branches: 1.37.2; Move bpf_mtap and if_ipackets++ on Rx of each driver to percpuq if_input
The benefits of the change are: - We can reduce codes - We can provide the same behavior between drivers - Where/When if_ipackets is counted up - Note that some drivers still update packet statistics in their own way (periodical update) - Moved bpf_mtap run in softint - This makes it easy to MP-ify bpf
Proposed on tech-kern and tech-net
|
1.36 |
| 10-Jun-2016 |
ozaki-r | branches: 1.36.2; Introduce m_set_rcvif and m_reset_rcvif
The API is used to set (or reset) a received interface of a mbuf. They are counterpart of m_get_rcvif, which will come in another commit, hide internal of rcvif operation, and reduce the diff of the upcoming change.
No functional change.
|
1.35 |
| 09-Feb-2016 |
ozaki-r | Introduce softint-based if_input
This change intends to run the whole network stack in softint context (or normal LWP), not hardware interrupt context. Note that the work is still incomplete by this change; to that end, we also have to softint-ify if_link_state_change (and bpf) which can still run in hardware interrupt.
This change softint-ifies at ifp->if_input that is called from each device driver (and ieee80211_input) to ensure Layer 2 runs in softint (e.g., ether_input and bridge_input). To this end, we provide a framework (called percpuq) that utlizes softint(9) and percpu ifqueues. With this patch, rxintr of most drivers just queues received packets and schedules a softint, and the softint dequeues packets and does rest packet processing.
To minimize changes to each driver, percpuq is allocated in struct ifnet for now and that is initialized by default (in if_attach). We probably have to move percpuq to softc of each driver, but it's future work. At this point, only wm(4) has percpuq in its softc as a reference implementation.
Additional information including performance numbers can be found in the thread at tech-kern@ and tech-net@: http://mail-index.netbsd.org/tech-kern/2016/01/14/msg019997.html
Acknowledgment: riastradh@ greatly helped this work. Thank you very much!
|
1.34 |
| 21-Aug-2015 |
jmcneill | No need to BUS_DMASYNC_PREREAD the transmit data buffer. Fixes "NFS writes being corrupted?" issue on ODROID-C1 as seen on port-arm.
|
1.33 |
| 12-Jun-2015 |
tnn | Supports ETHERCAP_VLAN_MTU. ok martin@ PR#49967
|
1.32 |
| 23-Feb-2015 |
martin | Apply patch from FUKAUMI Naoki to fix ring buffer handling when the ring fills completely.
|
1.31 |
| 08-Jan-2015 |
jmcneill | fix a couple txq fencepost issues, from FUKAUMI Naoki <fun@naobsd.org>
|
1.30 |
| 05-Jan-2015 |
martin | Fix index vs. count confusion when syncing a range of newly queued TX descriptors. Pointed out by "naobsd" in private chat.
|
1.29 |
| 07-Dec-2014 |
jmcneill | if we dont have a mac address, make one up
|
1.28 |
| 28-Nov-2014 |
martin | branches: 1.28.2; After handling an interrupt, try to handle more packets as we may have space in the descriptor ring now. Pointed out by Jared.
|
1.27 |
| 23-Nov-2014 |
matt | Fix bus_dmamap_sync usage.
|
1.26 |
| 23-Nov-2014 |
martin | Revert previous change to dwc_gmac_txintr() - while it looks strange at first sight (and sorry I didn't spot it when reviewing), it is a small optimization and actually correct. Add a comment explaining it.
|
1.25 |
| 22-Nov-2014 |
jmcneill | - Add MII flow control support - Set "disable jabber" and "auto padding/CRC stripping" bits in MAC conf - Write intr mask to intr mask register, not status - Setup both TX and RX burst modes - Setup both TX and RX store & forward modes - Correct an issue with the "end" descriptor passed to dwc_gmac_txdesc_sync in dwc_gmac_tx_intr
ok martin@
|
1.24 |
| 27-Oct-2014 |
skrll | branches: 1.24.2; Typo in comment
|
1.23 |
| 26-Oct-2014 |
joerg | Typo
|
1.22 |
| 26-Oct-2014 |
martin | Greatly simplify ioctl handling by fully relying on ether_ioctl and a ifflags-change callback, together with a shadow copy of the last active interface flags. Fix ALLMULTI vs. PROMISC handling. Fix mac hash filter calculation by reversing the crc bits (pointed out by Jared).
|
1.21 |
| 25-Oct-2014 |
joerg | Fix typo. Use format string.
|
1.20 |
| 21-Oct-2014 |
jmcneill | multicast hash filter support
|
1.19 |
| 20-Oct-2014 |
matt | Set M_HASFCS does the frame does include the FCS in the length.
|
1.18 |
| 20-Oct-2014 |
jmcneill | add $NetBSD$ to top of files
|
1.17 |
| 20-Oct-2014 |
martin | Cosmetics - block interrupts while enabling different interrupt sources.
|
1.16 |
| 20-Oct-2014 |
martin | Consistently set the RX descriptors controll word - do not disable RX interrupt and set chain mode. Now it does not run off the end of the ring after 512 packets any more.
|
1.15 |
| 20-Oct-2014 |
martin | Cleanup debug code a bit.
|
1.14 |
| 19-Oct-2014 |
jmcneill | if we read an insane mac address from the chip, dont attach
|
1.13 |
| 19-Oct-2014 |
jmcneill | only set PR bit in frame filter if IFF_PROMISC is set, and set PM bit if IFF_ALLMULTI is set
|
1.12 |
| 19-Oct-2014 |
jmcneill | fix inverted logic with AWIN_GMAC_MAC_CONF_MIISEL bit; my cubieboard2 can talk to the network now!
|
1.11 |
| 19-Oct-2014 |
martin | Add more MAC filter setup, some DMA burst configuration (from jmcneill), actually enable RX interrupts (spotted by jmcneill), add RX handling code and debug code.
|
1.10 |
| 13-Oct-2014 |
martin | Do not flush/restart the TX engine after queuing packets, but instead keep it running (it will stall when out of descriptors), and inform it about new descriptors available by writing to the TXPOLL request register. Add more debugging code.
|
1.9 |
| 13-Oct-2014 |
martin | When link status changes, update MAC configuration accordingly.
|
1.8 |
| 08-Oct-2014 |
martin | More interrupt handling, more debug code, less magic numbers.
|
1.7 |
| 14-Sep-2014 |
martin | Add (disabled) debug code. Fix DMA descriptor link initialization.
|
1.6 |
| 14-Sep-2014 |
martin | Cleanup and __BIT()ify
|
1.5 |
| 11-Sep-2014 |
martin | Simplify device property handling by moving it into the core driver. Overriding the MAC address now works again.
|
1.4 |
| 09-Sep-2014 |
martin | Remove debug printf, now that MII status changes work
|
1.3 |
| 09-Sep-2014 |
martin | Make the MII clock variable and passed in from the frontend.
|
1.2 |
| 09-Sep-2014 |
martin | Fix MII setup and interrupt handling, from Robert Swindell.
|
1.1 |
| 08-Sep-2014 |
martin | Add work-in-progress driver for the Designware GMAC core, found on some allwinner chips.
|
1.24.2.8 |
| 31-Aug-2015 |
snj | Pull up following revision(s) (requested by jmcneill in ticket #958): sys/dev/ic/dwc_gmac.c: revision 1.34 No need to BUS_DMASYNC_PREREAD the transmit data buffer. Fixes "NFS writes being corrupted?" issue on ODROID-C1 as seen on port-arm.
|
1.24.2.7 |
| 27-Feb-2015 |
snj | Pull up following revision(s) (requested by martin in ticket #546): sys/dev/ic/dwc_gmac.c: revision 1.32 Apply patch from FUKAUMI Naoki to fix ring buffer handling when the ring fills completely.
|
1.24.2.6 |
| 03-Feb-2015 |
bouyer | Pull up following revision(s) (requested by snj in ticket #481): sys/dev/ic/dwc_gmac_var.h: revision 1.6 sys/dev/ic/dwc_gmac_reg.h: revision 1.13 sys/dev/ic/dwc_gmac.c: revision 1.25 sys/dev/ic/dwc_gmac.c: revision 1.26 sys/dev/ic/dwc_gmac.c: revision 1.28 sys/dev/ic/dwc_gmac.c: revision 1.31 - Add MII flow control support - Set "disable jabber" and "auto padding/CRC stripping" bits in MAC conf - Write intr mask to intr mask register, not status - Setup both TX and RX burst modes - Setup both TX and RX store & forward modes - Correct an issue with the "end" descriptor passed to dwc_gmac_txdesc_sync in dwc_gmac_tx_intr ok martin@ Revert previous change to dwc_gmac_txintr() - while it looks strange at first sight (and sorry I didn't spot it when reviewing), it is a small optimization and actually correct. Add a comment explaining it. After handling an interrupt, try to handle more packets as we may have space in the descriptor ring now. Pointed out by Jared. fix a couple txq fencepost issues, from FUKAUMI Naoki <fun@naobsd.org>
|
1.24.2.5 |
| 07-Jan-2015 |
msaitoh | Pull up following revision(s) (requested by martin in ticket #383): sys/dev/ic/dwc_gmac.c: revision 1.30 Fix index vs. count confusion when syncing a range of newly queued TX descriptors. Pointed out by FUKAUMI Naoki in private chat.
|
1.24.2.4 |
| 09-Dec-2014 |
martin | Pull up following revision(s) (requested by jmcneill in ticket #300): sys/dev/ic/dwc_gmac.c: revision 1.29 if we dont have a mac address, make one up
|
1.24.2.3 |
| 25-Nov-2014 |
snj | Pull up following revision(s) (requested by jmcneill in ticket #259): sys/dev/ic/dwc_gmac.c: revision 1.27 Fix bus_dmamap_sync usage.
|
1.24.2.2 |
| 09-Nov-2014 |
snj | Pull up following revision(s) (requested by martin in ticket #189): sys/dev/ic/dwc_gmac.c: revision 1.1-1.24 sys/dev/ic/dwc_gmac_reg.h: revision 1.1-1.12 sys/dev/ic/dwc_gmac_var.h: revision 1.1-1.5 Add support for Synopsis Designware GMAC ethernet core, as found on various Allwiner boards and used by the awge(4) driver.
|
1.24.2.1 |
| 27-Oct-2014 |
snj | file dwc_gmac.c was added on branch netbsd-7 on 2014-11-09 19:06:57 +0000
|
1.28.2.12 |
| 28-Aug-2017 |
skrll | Sync with HEAD
|
1.28.2.11 |
| 05-Feb-2017 |
skrll | Sync with HEAD
|
1.28.2.10 |
| 15-Jul-2016 |
skrll | Protect sc_if_flags in dwc_gmac_ifflags_cb with the lock
|
1.28.2.9 |
| 15-Jul-2016 |
skrll | Define/assert IFEF_START_MPSAFE
|
1.28.2.8 |
| 09-Jul-2016 |
skrll | Sync with HEAD
|
1.28.2.7 |
| 16-Jun-2016 |
skrll | Fix indent botch that crept in
|
1.28.2.6 |
| 12-Jun-2016 |
skrll | Oops... use the ipq we created.
|
1.28.2.5 |
| 12-Jun-2016 |
skrll | Fix locking botch
|
1.28.2.4 |
| 12-Jun-2016 |
skrll | First pass at making this driver and attachments NET_MPSAFE aware.
I've not tested this yet.
|
1.28.2.3 |
| 19-Mar-2016 |
skrll | Sync with HEAD
|
1.28.2.2 |
| 22-Sep-2015 |
skrll | Sync with HEAD
|
1.28.2.1 |
| 06-Apr-2015 |
skrll | Sync with HEAD
|
1.36.2.2 |
| 20-Mar-2017 |
pgoyette | Sync with HEAD
|
1.36.2.1 |
| 07-Jan-2017 |
pgoyette | Sync with HEAD. (Note that most of these changes are simply $NetBSD$ tag issues.)
|
1.37.2.1 |
| 21-Apr-2017 |
bouyer | Sync with HEAD
|
1.40.6.5 |
| 12-Aug-2022 |
martin | Pull up following revision(s) (requested by sekiya in ticket #1755):
sys/dev/ic/dwc_gmac.c: revision 1.76-1.77
Turn off AWIN_GMAC_MAC_CONF_ACS, so that all received packets retain FCS bytes. ether_input() can now trust M_HASFCS to accurately represent the packet contents.
Discussed on tech-net@
|
1.40.6.4 |
| 18-Jun-2018 |
martin | Pull up following revision(s) (requested by jmcneill in ticket #885):
sys/dev/ic/dwc_gmac.c: revision 1.47
Avoid calling bus_dmamap_sync with len=0
|
1.40.6.3 |
| 13-Jan-2018 |
snj | Pull up following revision(s) (requested by martin in ticket #456): sys/dev/ic/dwc_gmac.c: 1.45 Don't KASSERT that we are MPSAFE if ! DWCGMAC_MPSAFE
|
1.40.6.2 |
| 02-Jan-2018 |
snj | Pull up following revision(s) (requested by ozaki-r in ticket #456): sys/arch/arm/sunxi/sunxi_emac.c: 1.9 sys/dev/ic/dwc_gmac.c: 1.43-1.44 sys/dev/pci/if_iwm.c: 1.75 sys/dev/pci/if_wm.c: 1.543 sys/dev/pci/ixgbe/ixgbe.c: 1.112 sys/dev/pci/ixgbe/ixv.c: 1.74 sys/kern/sys_socket.c: 1.75 sys/net/agr/if_agr.c: 1.43 sys/net/bpf.c: 1.219 sys/net/if.c: 1.397, 1.399, 1.401-1.403, 1.406-1.410, 1.412-1.416 sys/net/if.h: 1.242-1.247, 1.250, 1.252-1.257 sys/net/if_bridge.c: 1.140 via patch, 1.142-1.146 sys/net/if_etherip.c: 1.40 sys/net/if_ethersubr.c: 1.243, 1.246 sys/net/if_faith.c: 1.57 sys/net/if_gif.c: 1.132 sys/net/if_l2tp.c: 1.15, 1.17 sys/net/if_loop.c: 1.98-1.101 sys/net/if_media.c: 1.35 sys/net/if_pppoe.c: 1.131-1.132 sys/net/if_spppsubr.c: 1.176-1.177 sys/net/if_tun.c: 1.142 sys/net/if_vlan.c: 1.107, 1.109, 1.114-1.121 sys/net/npf/npf_ifaddr.c: 1.3 sys/net/npf/npf_os.c: 1.8-1.9 sys/net/rtsock.c: 1.230 sys/netcan/if_canloop.c: 1.3-1.5 sys/netinet/if_arp.c: 1.255 sys/netinet/igmp.c: 1.65 sys/netinet/in.c: 1.210-1.211 sys/netinet/in_pcb.c: 1.180 sys/netinet/ip_carp.c: 1.92, 1.94 sys/netinet/ip_flow.c: 1.81 sys/netinet/ip_input.c: 1.362 sys/netinet/ip_mroute.c: 1.147 sys/netinet/ip_output.c: 1.283, 1.285, 1.287 sys/netinet6/frag6.c: 1.61 sys/netinet6/in6.c: 1.251, 1.255 sys/netinet6/in6_pcb.c: 1.162 sys/netinet6/ip6_flow.c: 1.35 sys/netinet6/ip6_input.c: 1.183 sys/netinet6/ip6_output.c: 1.196 sys/netinet6/mld6.c: 1.90 sys/netinet6/nd6.c: 1.239-1.240 sys/netinet6/nd6_nbr.c: 1.139 sys/netinet6/nd6_rtr.c: 1.136 sys/netipsec/ipsec_output.c: 1.65 sys/rump/net/lib/libnetinet/netinet_component.c: 1.9-1.10 kmem_intr_free kmem_intr_[z]alloced memory the underlying pools are the same but api-wise those should match Unify IFEF_*_MPSAFE into IFEF_MPSAFE There are already two flags for if_output and if_start, however, it seems such MPSAFE flags are eventually needed for all if_XXX operations. Having discrete flags for each operation is wasteful of if_extflags bits. So let's unify the flags into one: IFEF_MPSAFE. Fortunately IFEF_*_MPSAFE flags have never been included in any releases, so we can change them without breaking backward compatibility of the releases (though the kernel version of -current should be bumped). Note that if an interface have both MP-safe and non-MP-safe operations at a time, we have to set the IFEF_MPSAFE flag and let callees of non-MP-safe opeartions take the kernel lock. Proposed on tech-kern@ and tech-net@ Provide macros for softnet_lock and KERNEL_LOCK hiding NET_MPSAFE switch It reduces C&P codes such as "#ifndef NET_MPSAFE KERNEL_LOCK(1, NULL); ..." scattered all over the source code and makes it easy to identify remaining KERNEL_LOCK and/or softnet_lock that are held even if NET_MPSAFE. No functional change Hold KERNEL_LOCK on if_ioctl selectively based on IFEF_MPSAFE If IFEF_MPSAFE is set, hold the lock and otherwise don't hold. This change requires additions of KERNEL_LOCK to subsequence functions from if_ioctl such as ifmedia_ioctl and ifioctl_common to protect non-MP-safe components. Proposed on tech-kern@ and tech-net@ Ensure to hold if_ioctl_lock when calling if_flags_set Fix locking against myself on ifpromisc vlan_unconfig_locked could be called with holding if_ioctl_lock. Ensure to not turn on IFF_RUNNING of an interface until its initialization completes And ensure to turn off it before destruction as per IFF_RUNNING's description "resource allocated". (The description is a bit doubtful though, I believe the change is still proper.) Ensure to hold if_ioctl_lock on if_up and if_down One exception for if_down is if_detach; in the case the lock isn't needed because it's guaranteed that no other one can access ifp at that point. Make if_link_queue MP-safe if IFEF_MPSAFE if_link_queue is a queue to store events of link state changes, which is used to pass events from (typically) an interrupt handler to if_link_state_change softint. The queue was protected by KERNEL_LOCK so far, but if IFEF_MPSAFE is enabled, it becomes unsafe because (perhaps) an interrupt handler of an interface with IFEF_MPSAFE doesn't take KERNEL_LOCK. Protect it by a spin mutex. Additionally with this change KERNEL_LOCK of if_link_state_change softint is omitted if NET_MPSAFE is enabled. Note that the spin mutex is now ifp->if_snd.ifq_lock as well as the case of if_timer (see the comment). Use IFADDR_WRITER_FOREACH instead of IFADDR_READER_FOREACH At that point no other one modifies the list so IFADDR_READER_FOREACH is unnecessary. Use of IFADDR_READER_FOREACH is harmless in general though, if we try to detect contract violations of pserialize, using it violates the contract. So avoid using it makes life easy. Ensure to call if_addr_init with holding if_ioctl_lock Get rid of outdated comments Fix build of kernels without ether By throwing out if_enable_vlan_mtu and if_disable_vlan_mtu that created a unnecessary dependency from if.c to if_ethersubr.c. PR kern/52790 Rename IFNET_LOCK to IFNET_GLOBAL_LOCK IFNET_LOCK will be used in another lock, if_ioctl_lock (might be renamed then). Wrap if_ioctl_lock with IFNET_* macros (NFC) Also if_ioctl_lock perhaps needs to be renamed to something because it's now not just for ioctl... Reorder some destruction routines in if_detach - Destroy if_ioctl_lock at the end of the if_detach because it's used in various destruction routines - Move psref_target_destroy after pr_purgeif because we want to use psref in pr_purgeif (otherwise destruction procedures can be tricky) Ensure to call if_mcast_op with holding IFNET_LOCK Note that CARP doesn't deal with IFNET_LOCK yet. Remove IFNET_GLOBAL_LOCK where it's unnecessary because IFNET_LOCK is held Describe which lock is used to protect each member variable of struct ifnet Requested by skrll@ Write a guideline for converting an interface to IFEF_MPSAFE Requested by skrll@ Note that IFNET_LOCK must not be held in softint Don't set IFEF_MPSAFE unless NET_MPSAFE at this point Because recent investigations show that interfaces with IFEF_MPSAFE need to follow additional restrictions to work with the flag safely. We should enable it on an interface by default only if the interface surely satisfies the restrictions, which are described in if.h. Note that enabling IFEF_MPSAFE solely gains a few benefit on performance because the network stack is still serialized by the big kernel locks by default.
|
1.40.6.1 |
| 10-Dec-2017 |
snj | Pull up following revision(s) (requested by msaitoh in ticket #427): sys/arch/amiga/dev/if_bah_zbus.c: 1.17 sys/arch/arm/broadcom/bcm53xx_eth.c: 1.30 sys/arch/powerpc/booke/dev/pq3etsec.c: 1.32 sys/arch/usermode/dev/if_veth.c: 1.9 sys/dev/ic/an.c: 1.66 sys/dev/ic/athn.c: 1.17 sys/dev/ic/atw.c: 1.162 sys/dev/ic/bwi.c: 1.33 sys/dev/ic/dwc_gmac.c: 1.41-1.42 sys/dev/ic/malo.c: 1.10 sys/dev/ic/rt2560.c: 1.31 sys/dev/ic/rt2661.c: 1.36 sys/dev/ic/rt2860.c: 1.29 sys/dev/ic/rtw.c: 1.127 sys/dev/ic/rtwvar.h: 1.46 sys/dev/ic/smc90cx6.c: 1.71 sys/dev/ic/smc90cx6var.h: 1.12 sys/dev/ic/wi.c: 1.244 sys/dev/pci/if_ipw.c: 1.66 sys/dev/pci/if_iwi.c: 1.104 sys/dev/pci/if_iwm.c: 1.76 sys/dev/pci/if_iwn.c: 1.86 sys/dev/pci/if_rtwn.c: 1.13 sys/dev/pci/if_wm.c: 1.541 sys/dev/pci/if_wpi.c: 1.79 sys/dev/pci/ixgbe/ixgbe.c: 1.106 sys/dev/pci/ixgbe/ixv.c: 1.73 via patch sys/dev/pcmcia/if_malo_pcmcia.c: 1.15 sys/dev/scsipi/if_se.c: 1.95 sys/dev/usb/if_upl.c: 1.60 sys/net/if.c: 1.396 sys/net/if.h: 1.241 sys/net/if_arc.h: 1.23 sys/net/if_arcsubr.c: 1.78 sys/net/if_bridge.c: 1.136-1.137 sys/net/if_etherip.c: 1.39 sys/net/if_faith.c: 1.56 sys/net/if_gif.c: 1.131 sys/net/if_loop.c: 1.96 sys/net/if_mpls.c: 1.30 sys/net/if_pppoe.c: 1.129 sys/net/if_srt.c: 1.27 sys/net/if_stf.c: 1.102 sys/net/if_tap.c: 1.100 sys/net/if_vlan.c: 1.105 sys/netinet/ip_carp.c: 1.91 sys/rump/net/lib/libshmif/if_shmem.c: 1.73-1.74 sys/rump/net/lib/libvirtif/if_virt.c: 1.55-1.56 if_initalize() and if_attach() failed when resource allocation failed (e.g. allocating softint). Without this change, it panics. It's bad because resource shortage really occured when a lot of pseudo interface is created. To avoid this problem, don't panic and change return value of if_initialize() and if_attach() to int. Caller fanction will be recover from error cleanly by checking the return value. Return if bah_attach_subr() failed. If if_attach() failed in the attach function, return. - If if_initialize() failed in the attach function, free resources and return. - Add some missing frees in bridge_clone_destroy(). - KNF If error occured in bcmeth_ccb_attach(), free resources and return. If error occured in pq3etsec_attach(), free resources and return. If error occured in the attach function, free resources and return. - If if_initialize() failed in athn_attach(), free resources and return. - Add missing pmf_event_deregister() in athn_detach(). - Free resources correctly on some errors in atw_attach(). - Use apint*() insread of printf() in the attach function. If if_initialize() failed in the attach function, return. - If if_initialize() failed in the attach function, free resources and return. - Add missing dwc_gmac_free_dma_rings() and mutex_destroy() when attach failed. - If if_initialize() failed in the attach function, free resources and return. - ifp is always not NULL in iwi_detach(). Check correctly with ifp->if_softc. - If if_initialize() failed in the attach function, free resources and return. - Fix error path in the attach function correctly. If if_initialize() failed in the attach function, free resources and return. If if_attach() failed in the attach function, free resources and return. - If if_initialize() failed in the attach function, free resources and return. - KNF - If if_attach() failed in the attach function, free resources and return. - KNF Fix compile error. Fix compile error. We don't need '&mii', but just 'mii' for mii_detach(). Don't free sc_rthash twice
|
1.43.2.2 |
| 03-Dec-2017 |
jdolecek | update from HEAD
|
1.43.2.1 |
| 16-Nov-2017 |
jdolecek | file dwc_gmac.c was added on branch tls-maxphys on 2017-12-03 11:37:03 +0000
|
1.45.2.5 |
| 26-Jan-2019 |
pgoyette | Sync with HEAD
|
1.45.2.4 |
| 20-Oct-2018 |
pgoyette | Sync with head
|
1.45.2.3 |
| 30-Sep-2018 |
pgoyette | Ssync with HEAD
|
1.45.2.2 |
| 28-Jul-2018 |
pgoyette | Sync with HEAD
|
1.45.2.1 |
| 25-Jun-2018 |
pgoyette | Sync with HEAD
|
1.50.2.3 |
| 13-Apr-2020 |
martin | Mostly merge changes from HEAD upto 20200411
|
1.50.2.2 |
| 08-Apr-2020 |
martin | Merge changes from current as of 20200406
|
1.50.2.1 |
| 10-Jun-2019 |
christos | Sync with HEAD
|
1.64.2.2 |
| 12-Aug-2022 |
martin | Pull up following revision(s) (requested by sekiya in ticket #1499):
sys/dev/ic/dwc_gmac.c: revision 1.76-1.77
Turn off AWIN_GMAC_MAC_CONF_ACS, so that all received packets retain FCS bytes. ether_input() can now trust M_HASFCS to accurately represent the packet contents.
Discussed on tech-net@
|
1.64.2.1 |
| 11-Aug-2020 |
martin | Pull up following revision(s) (requested by mrg in ticket #1045):
sys/kern/uipc_mbuf.c: revision 1.235 sys/dev/ic/dwc_gmac.c: revision 1.70 sys/dev/ic/dwc_gmac_reg.h: revision 1.20 sys/dev/ic/dwc_gmac.c: revision 1.66 sys/dev/ic/dwc_gmac.c: revision 1.67 sys/dev/ic/dwc_gmac.c: revision 1.68
awge: fix issue that caused rx packets to be corrupt with DIAGNOSTIC kernel
It seems the hardware can only reliably do rx DMA to addresses that are dcache size aligned. This is hinted at by some GMAC data sheets but hard to find an authoritative source.
on non-DIAGNOSTIC kernels we always implicitly get MCLBYTES-aligned mbuf data pointers, but with the reintroduction of POOL_REDZONE for DIAGNOSTIC we can get 8-byte alignment due to redzone padding. So align rx pointers to 64 bytes which should be good for both arm32 and aarch64. While here change some bus_dmamap_load() to bus_dmamap_load_mbuf() and add one missing bus_dmamap_sync(). Also fixes the code to not assume that MCLBYTES == AWGE_MAX_PACKET. User may override MCLSHIFT in kernel config. correct pointer arithmetics
mcl_cache: align items to COHERENCY_UNIT
Because we do cache incoherent DMA to/from mbufs we cannot safely share share cache lines with adjacent items that may be concurrently accessed.
awge: drop redundant m_adj(). Handled via uipc_mbuf.c r1.235 instead.
Mask all the MMC counter interrupts if the MMC module is present.
|
1.68.2.1 |
| 29-Feb-2020 |
ad | Sync with head.
|
1.71.2.1 |
| 03-Jan-2021 |
thorpej | Sync w/ HEAD.
|
1.72.6.1 |
| 31-May-2021 |
cjep | sync with head
|
1.72.4.1 |
| 17-Jun-2021 |
thorpej | Sync w/ HEAD.
|