Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci bge_txeof/bge_rxeof may be called with no pendin...



details:   https://anonhg.NetBSD.org/src/rev/797256b1ac3a
branches:  trunk
changeset: 1023260:797256b1ac3a
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Mon Aug 30 22:48:16 2021 +0000

description:
bge_txeof/bge_rxeof may be called with no pending descriptors, so skip
bus_dmamap_sync with len=0

diffstat:

 sys/dev/pci/if_bge.c |  20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diffs (48 lines):

diff -r 182e5908d668 -r 797256b1ac3a sys/dev/pci/if_bge.c
--- a/sys/dev/pci/if_bge.c      Mon Aug 30 22:47:24 2021 +0000
+++ b/sys/dev/pci/if_bge.c      Mon Aug 30 22:48:16 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bge.c,v 1.346 2020/07/02 09:07:10 msaitoh Exp $     */
+/*     $NetBSD: if_bge.c,v 1.347 2021/08/30 22:48:16 jmcneill Exp $    */
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.346 2020/07/02 09:07:10 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.347 2021/08/30 22:48:16 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -4430,9 +4430,11 @@
                tosync = -tosync;
        }
 
-       bus_dmamap_sync(sc->bge_dmatag, sc->bge_ring_map,
-           offset, tosync * sizeof (struct bge_rx_bd),
-           BUS_DMASYNC_POSTREAD);
+       if (tosync != 0) {
+               bus_dmamap_sync(sc->bge_dmatag, sc->bge_ring_map,
+                   offset, tosync * sizeof (struct bge_rx_bd),
+                   BUS_DMASYNC_POSTREAD);
+       }
 
        while (rx_cons != rx_prod) {
                struct bge_rx_bd        *cur_rx;
@@ -4603,9 +4605,11 @@
                tosync = -tosync;
        }
 
-       bus_dmamap_sync(sc->bge_dmatag, sc->bge_ring_map,
-           offset, tosync * sizeof (struct bge_tx_bd),
-           BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
+       if (tosync != 0) {
+               bus_dmamap_sync(sc->bge_dmatag, sc->bge_ring_map,
+                   offset, tosync * sizeof (struct bge_tx_bd),
+                   BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
+       }
 
        /*
         * Go through our tx ring and free mbufs for those



Home | Main Index | Thread Index | Old Index