Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Clear IFF_OACTIVE in genet_txintr (bug introduced...



details:   https://anonhg.NetBSD.org/src/rev/f9dae7ad9ae0
branches:  trunk
changeset: 1022866:f9dae7ad9ae0
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Tue Aug 10 15:28:44 2021 +0000

description:
Clear IFF_OACTIVE in genet_txintr (bug introduced in r1.8) and don't
sync DMA maps with size 0.

diffstat:

 sys/dev/ic/bcmgenet.c |  21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diffs (55 lines):

diff -r 197ad45e3646 -r f9dae7ad9ae0 sys/dev/ic/bcmgenet.c
--- a/sys/dev/ic/bcmgenet.c     Tue Aug 10 10:43:42 2021 +0000
+++ b/sys/dev/ic/bcmgenet.c     Tue Aug 10 15:28:44 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bcmgenet.c,v 1.9 2021/05/03 10:28:26 rin Exp $ */
+/* $NetBSD: bcmgenet.c,v 1.10 2021/08/10 15:28:44 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -34,7 +34,7 @@
 #include "opt_ddb.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.9 2021/05/03 10:28:26 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.10 2021/08/10 15:28:44 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -726,9 +726,11 @@
                }
 
                /* unload map before it gets loaded in setup_rxbuf */
-               bus_dmamap_sync(sc->sc_rx.buf_tag, sc->sc_rx.buf_map[index].map,
-                   0, sc->sc_rx.buf_map[index].map->dm_mapsize,
-                   BUS_DMASYNC_POSTREAD);
+               if (sc->sc_rx.buf_map[index].map->dm_mapsize > 0) {
+                       bus_dmamap_sync(sc->sc_rx.buf_tag, sc->sc_rx.buf_map[index].map,
+                           0, sc->sc_rx.buf_map[index].map->dm_mapsize,
+                           BUS_DMASYNC_POSTREAD);
+               }
                bus_dmamap_unload(sc->sc_rx.buf_tag, sc->sc_rx.buf_map[index].map);
                sc->sc_rx.buf_map[index].mbuf = NULL;
 
@@ -778,15 +780,18 @@
                bmap = &sc->sc_tx.buf_map[i];
                if (bmap->mbuf != NULL) {
                        /* XXX first segment already unloads */
-                       bus_dmamap_sync(sc->sc_tx.buf_tag, bmap->map,
-                           0, bmap->map->dm_mapsize,
-                           BUS_DMASYNC_POSTWRITE);
+                       if (bmap->map->dm_mapsize > 0) {
+                               bus_dmamap_sync(sc->sc_tx.buf_tag, bmap->map,
+                                   0, bmap->map->dm_mapsize,
+                                   BUS_DMASYNC_POSTWRITE);
+                       }
                        bus_dmamap_unload(sc->sc_tx.buf_tag, bmap->map);
                        m_freem(bmap->mbuf);
                        bmap->mbuf = NULL;
                        ++pkts;
                }
 
+               ifp->if_flags &= ~IFF_OACTIVE;
                i = TX_NEXT(i);
                sc->sc_tx.cidx = (sc->sc_tx.cidx + 1) & 0xffff;
        }



Home | Main Index | Thread Index | Old Index