[rtems-libbsd commit] if_dwc: Fix a possible interrupt starvation

Sebastian Huber sebh at rtems.org
Fri Sep 11 09:56:19 UTC 2015


Module:    rtems-libbsd
Branch:    4.11
Commit:    64f61637b8db7d8b1b19ca87b4f4cfa80dcbc439
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=64f61637b8db7d8b1b19ca87b4f4cfa80dcbc439

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Sep  7 08:34:34 2015 +0200

if_dwc: Fix a possible interrupt starvation

---

 freebsd/sys/dev/dwc/if_dwc.c | 27 ++++++++++++---------------
 freebsd/sys/dev/dwc/if_dwc.h |  1 +
 2 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/freebsd/sys/dev/dwc/if_dwc.c b/freebsd/sys/dev/dwc/if_dwc.c
index 359226d..a3716a1 100644
--- a/freebsd/sys/dev/dwc/if_dwc.c
+++ b/freebsd/sys/dev/dwc/if_dwc.c
@@ -1014,25 +1014,22 @@ dwc_intr(void *arg)
 	}
 
 	reg = READ4(sc, DMA_STATUS);
-	if (reg & DMA_STATUS_NIS) {
-		if (reg & DMA_STATUS_RI)
-			dwc_rxfinish_locked(sc);
+	WRITE4(sc, DMA_STATUS, reg & DMA_STATUS_INTR_MASK);
 
-		if (reg & DMA_STATUS_TI)
-			dwc_txfinish_locked(sc);
-	}
+	if (reg & (DMA_STATUS_RI | DMA_STATUS_RU))
+		dwc_rxfinish_locked(sc);
 
-	if (reg & DMA_STATUS_AIS) {
-		if (reg & DMA_STATUS_FBI) {
-			/* Fatal bus error */
-			device_printf(sc->dev,
-			    "Ethernet DMA error, restarting controller.\n");
-			dwc_stop_locked(sc);
-			dwc_init_locked(sc);
-		}
+	if (reg & DMA_STATUS_TI)
+		dwc_txfinish_locked(sc);
+
+	if (reg & DMA_STATUS_FBI) {
+		/* Fatal bus error */
+		device_printf(sc->dev,
+		    "Ethernet DMA error, restarting controller.\n");
+		dwc_stop_locked(sc);
+		dwc_init_locked(sc);
 	}
 
-	WRITE4(sc, DMA_STATUS, reg & DMA_STATUS_INTR_MASK);
 	DWC_UNLOCK(sc);
 }
 
diff --git a/freebsd/sys/dev/dwc/if_dwc.h b/freebsd/sys/dev/dwc/if_dwc.h
index aa5c973..2ba9860 100644
--- a/freebsd/sys/dev/dwc/if_dwc.h
+++ b/freebsd/sys/dev/dwc/if_dwc.h
@@ -220,6 +220,7 @@
 #define	 DMA_STATUS_NIS		(1 << 16)
 #define	 DMA_STATUS_AIS		(1 << 15)
 #define	 DMA_STATUS_FBI		(1 << 13)
+#define	 DMA_STATUS_RU		(1 << 7)
 #define	 DMA_STATUS_RI		(1 << 6)
 #define	 DMA_STATUS_TI		(1 << 0)
 #define	 DMA_STATUS_INTR_MASK	0x1ffff



More information about the vc mailing list