Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/macppc/dev Use ring buffer on tx side, too.



details:   https://anonhg.NetBSD.org/src/rev/12880779bd5e
branches:  trunk
changeset: 484119:12880779bd5e
user:      tsubai <tsubai%NetBSD.org@localhost>
date:      Sun Mar 26 09:15:17 2000 +0000

description:
Use ring buffer on tx side, too.

diffstat:

 sys/arch/macppc/dev/if_gm.c    |  40 +++++++++++++++++++++++-----------------
 sys/arch/macppc/dev/if_gmreg.h |   7 ++++---
 2 files changed, 27 insertions(+), 20 deletions(-)

diffs (113 lines):

diff -r c10c3966b77e -r 12880779bd5e sys/arch/macppc/dev/if_gm.c
--- a/sys/arch/macppc/dev/if_gm.c       Sun Mar 26 08:58:11 2000 +0000
+++ b/sys/arch/macppc/dev/if_gm.c       Sun Mar 26 09:15:17 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_gm.c,v 1.3 2000/03/23 06:40:34 thorpej Exp $        */
+/*     $NetBSD: if_gm.c,v 1.4 2000/03/26 09:15:17 tsubai Exp $ */
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -339,7 +339,7 @@
        if (status & GMAC_INT_RXDONE)
                gmac_rint(sc);
 
-       if (status & GMAC_INT_TXDONE)
+       if (status & GMAC_INT_TXEMPTY)
                gmac_tint(sc);
 
        return 1;
@@ -350,17 +350,9 @@
        struct gmac_softc *sc;
 {
        struct ifnet *ifp = &sc->sc_if;
-       volatile struct gmac_dma *dp;
-       int i;
-
-       i = gmac_read_reg(sc, GMAC_TXDMACOMPLETE);
-       dp = &sc->sc_txlist[i];
-       dp->cmd = 0;                            /* to be safe */
-       __asm __volatile ("sync");
 
        ifp->if_flags &= ~IFF_OACTIVE;
        ifp->if_timer = 0;
-       ifp->if_opackets++;
        gmac_start(ifp);
 }
 
@@ -484,8 +476,6 @@
                if (m == 0)
                        break;
 
-               ifp->if_flags |= IFF_OACTIVE;
-
                /* 5 seconds to watch for failing to transmit */
                ifp->if_timer = 5;
                ifp->if_opackets++;             /* # of pkts */
@@ -515,6 +505,14 @@
                if (ifp->if_bpf)
                        bpf_tap(ifp->if_bpf, buff, tlen);
 #endif
+
+               i++;
+               if (i == NTXBUF)
+                       i = 0;
+               if (i == gmac_read_reg(sc, GMAC_TXDMACOMPLETE)) {
+                       ifp->if_flags |= IFF_OACTIVE;
+                       break;
+               }
        }
 }
 
@@ -649,10 +647,18 @@
 
        gmac_write_reg(sc, GMAC_SLOTTIME, 0x40);
 
-       /* XXX */
-       gmac_write_reg(sc, GMAC_TXMACCONFIG, 0);
-       gmac_write_reg(sc, GMAC_XIFCONFIG, 5);
-       gmac_write_reg(sc, GMAC_MACCTRLCONFIG, 0);
+       if (IFM_OPTIONS(sc->sc_mii.mii_media_active) & IFM_FDX) {
+               gmac_write_reg(sc, GMAC_TXMACCONFIG, 6);
+               gmac_write_reg(sc, GMAC_XIFCONFIG, 1);
+       } else {
+               gmac_write_reg(sc, GMAC_TXMACCONFIG, 0);
+               gmac_write_reg(sc, GMAC_XIFCONFIG, 5);
+       }
+
+       if (0)  /* g-bit? */
+               gmac_write_reg(sc, GMAC_MACCTRLCONFIG, 3);
+       else
+               gmac_write_reg(sc, GMAC_MACCTRLCONFIG, 0);
 }
 
 void
@@ -678,7 +684,7 @@
        gmac_start_txdma(sc);
        gmac_start_rxdma(sc);
 
-       gmac_write_reg(sc, GMAC_INTMASK, ~(GMAC_INT_TXDONE | GMAC_INT_RXDONE));
+       gmac_write_reg(sc, GMAC_INTMASK, ~(GMAC_INT_TXEMPTY | GMAC_INT_RXDONE));
 
        ifp->if_flags |= IFF_RUNNING;
        ifp->if_flags &= ~IFF_OACTIVE;
diff -r c10c3966b77e -r 12880779bd5e sys/arch/macppc/dev/if_gmreg.h
--- a/sys/arch/macppc/dev/if_gmreg.h    Sun Mar 26 08:58:11 2000 +0000
+++ b/sys/arch/macppc/dev/if_gmreg.h    Sun Mar 26 09:15:17 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_gmreg.h,v 1.1 2000/02/27 18:00:55 tsubai Exp $      */
+/*     $NetBSD: if_gmreg.h,v 1.2 2000/03/26 09:15:17 tsubai Exp $      */
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -37,8 +37,9 @@
 #define GMAC_SOP       0x40000000      /* start of packet? */
 #define GMAC_LEN_MASK  0x00003fff
 
-#define GMAC_INT_TXDONE        0x04
-#define GMAC_INT_RXDONE        0x10
+#define GMAC_INT_TXEMPTY       0x02    /* TX ring empty */
+#define GMAC_INT_TXDONE                0x04
+#define GMAC_INT_RXDONE                0x10
 
 #define GMAC_RXMAC_PR  0x08
 



Home | Main Index | Thread Index | Old Index