summaryrefslogtreecommitdiffstats
path: root/sys/dev/fdt/if_fec.c
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2019-02-01 00:51:07 +0000
committerpatrick <patrick@openbsd.org>2019-02-01 00:51:07 +0000
commit019e33a84ce826539f78619818b12da8001bf31c (patch)
tree8b64704334e8183e8254b3292c47da44307b18d4 /sys/dev/fdt/if_fec.c
parentBump version number to be able to distinguish bootloaders with softraid (diff)
downloadwireguard-openbsd-019e33a84ce826539f78619818b12da8001bf31c.tar.xz
wireguard-openbsd-019e33a84ce826539f78619818b12da8001bf31c.zip
Fix lost interrupts in fec(4). Apparently the tick that talks to the
phy to check the media status did not only ack the MII interrupt, but also all the others. Thus it could happen that the TX completion was not seen by the interrupt handler, leading to full TX queues. Also, the fec(4) interrupt handler acked more than it handles, thus possibly also acking the MII interrupt. Found with bluhm@ on his new arm64 regression setup. ok bluhm@
Diffstat (limited to '')
-rw-r--r--sys/dev/fdt/if_fec.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/dev/fdt/if_fec.c b/sys/dev/fdt/if_fec.c
index f6ca5a9706c..efb02d0355b 100644
--- a/sys/dev/fdt/if_fec.c
+++ b/sys/dev/fdt/if_fec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_fec.c,v 1.6 2018/08/06 10:52:30 patrick Exp $ */
+/* $OpenBSD: if_fec.c,v 1.7 2019/02/01 00:51:07 patrick Exp $ */
/*
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
*
@@ -914,6 +914,7 @@ fec_intr(void *arg)
status = HREAD4(sc, ENET_EIR);
/* Acknowledge the interrupts we are about to handle. */
+ status &= (ENET_EIR_RXF | ENET_EIR_TXF);
HWRITE4(sc, ENET_EIR, status);
/*
@@ -1012,7 +1013,7 @@ fec_miibus_readreg(struct device *dev, int phy, int reg)
int r = 0;
struct fec_softc *sc = (struct fec_softc *)dev;
- HSET4(sc, ENET_EIR, ENET_EIR_MII);
+ HWRITE4(sc, ENET_EIR, ENET_EIR_MII);
bus_space_write_4(sc->sc_iot, sc->sc_ioh, ENET_MMFR,
ENET_MMFR_ST | ENET_MMFR_OP_RD | ENET_MMFR_TA |
@@ -1030,7 +1031,7 @@ fec_miibus_writereg(struct device *dev, int phy, int reg, int val)
{
struct fec_softc *sc = (struct fec_softc *)dev;
- HSET4(sc, ENET_EIR, ENET_EIR_MII);
+ HWRITE4(sc, ENET_EIR, ENET_EIR_MII);
bus_space_write_4(sc->sc_iot, sc->sc_ioh, ENET_MMFR,
ENET_MMFR_ST | ENET_MMFR_OP_WR | ENET_MMFR_TA |