Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Avoid calling bus_dmamap_sync with len=0



details:   https://anonhg.NetBSD.org/src/rev/da1c35892aba
branches:  trunk
changeset: 323500:da1c35892aba
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Jun 17 13:12:25 2018 +0000

description:
Avoid calling bus_dmamap_sync with len=0

diffstat:

 sys/dev/ic/dwc_gmac.c |  16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diffs (37 lines):

diff -r 0982647b3884 -r da1c35892aba sys/dev/ic/dwc_gmac.c
--- a/sys/dev/ic/dwc_gmac.c     Sun Jun 17 11:52:38 2018 +0000
+++ b/sys/dev/ic/dwc_gmac.c     Sun Jun 17 13:12:25 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.46 2018/06/16 00:15:00 jmcneill Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.47 2018/06/17 13:12:25 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.46 2018/06/16 00:15:00 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.47 2018/06/17 13:12:25 jmcneill Exp $");
 
 /* #define     DWC_GMAC_DEBUG  1 */
 
@@ -635,11 +635,13 @@
            TX_DESC_OFFSET(start),
            TX_DESC_OFFSET(AWGE_TX_RING_COUNT)-TX_DESC_OFFSET(start),
            ops);
-       /* sync from start of ring to 'end' */
-       bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map,
-           TX_DESC_OFFSET(0),
-           TX_DESC_OFFSET(end)-TX_DESC_OFFSET(0),
-           ops);
+       if (TX_DESC_OFFSET(end) - TX_DESC_OFFSET(0) > 0) {
+               /* sync from start of ring to 'end' */
+               bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map,
+                   TX_DESC_OFFSET(0),
+                   TX_DESC_OFFSET(end)-TX_DESC_OFFSET(0),
+                   ops);
+       }
 }
 
 static void



Home | Main Index | Thread Index | Old Index