Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sandpoint/stand/netboot always have even numbered d...



details:   https://anonhg.NetBSD.org/src/rev/b941928b4074
branches:  trunk
changeset: 760697:b941928b4074
user:      nisimura <nisimura%NetBSD.org@localhost>
date:      Tue Jan 11 09:45:25 2011 +0000

description:
always have even numbered descriptors to avoid ones belong to Tx/Rx
share the same cacheline even for 32B cacheline CPU. These six are
provisional code stocks and untested.

diffstat:

 sys/arch/sandpoint/stand/netboot/kse.c |  13 +++++++------
 sys/arch/sandpoint/stand/netboot/nvt.c |  13 +++++++------
 sys/arch/sandpoint/stand/netboot/pcn.c |  13 +++++++------
 sys/arch/sandpoint/stand/netboot/sip.c |  13 +++++++------
 sys/arch/sandpoint/stand/netboot/sme.c |  13 +++++++------
 sys/arch/sandpoint/stand/netboot/wm.c  |  17 +++++++++--------
 6 files changed, 44 insertions(+), 38 deletions(-)

diffs (truncated from 346 to 300 lines):

diff -r d5dd6b695a5d -r b941928b4074 sys/arch/sandpoint/stand/netboot/kse.c
--- a/sys/arch/sandpoint/stand/netboot/kse.c    Tue Jan 11 09:32:50 2011 +0000
+++ b/sys/arch/sandpoint/stand/netboot/kse.c    Tue Jan 11 09:45:25 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kse.c,v 1.4 2010/05/02 13:36:30 phx Exp $ */
+/* $NetBSD: kse.c,v 1.5 2011/01/11 09:45:25 nisimura Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -100,10 +100,10 @@
 #define FRAMESIZE      1536
 
 struct local {
-       struct desc txd;
+       struct desc txd[2];
        struct desc rxd[2];
        uint8_t rxstore[2][FRAMESIZE];
-       unsigned csr, rx;
+       unsigned csr, tx, rx;
 };
 
 static void mii_dealan(struct local *, unsigned);
@@ -162,7 +162,7 @@
                printf("\n");
        }
 
-       txd = &l->txd;
+       txd = &l->txd[0];
        rxd = &l->rxd[0];
        rxd[0].xd0 = htole32(R0_OWN);
        rxd[0].xd1 = htole32(FRAMESIZE);
@@ -172,7 +172,7 @@
        rxd[1].xd1 = htole32(R1_RER | FRAMESIZE);
        rxd[1].xd2 = htole32(VTOPHYS(l->rxstore[1]));
        rxd[1].xd3 = htole32(VTOPHYS(&rxd[0]));
-       l->rx = 0;
+       l->tx = l->rx = 0;
 
        CSR_WRITE_4(l, TDLB, VTOPHYS(txd));
        CSR_WRITE_4(l, RDLB, VTOPHYS(rxd));
@@ -191,7 +191,7 @@
        unsigned txstat, loop;
 
        wbinv(buf, len);
-       txd = &l->txd;
+       txd = &l->txd[l->tx];
        txd->xd2 = htole32(VTOPHYS(buf));
        txd->xd1 = htole32(T1_FS | T1_LS | (len & T1_TBS_MASK));
        txd->xd0 = htole32(T0_OWN);
@@ -208,6 +208,7 @@
        printf("xmit failed\n");
        return -1;
   done:
+       l->tx ^= 1;
        return len;
 }
 
diff -r d5dd6b695a5d -r b941928b4074 sys/arch/sandpoint/stand/netboot/nvt.c
--- a/sys/arch/sandpoint/stand/netboot/nvt.c    Tue Jan 11 09:32:50 2011 +0000
+++ b/sys/arch/sandpoint/stand/netboot/nvt.c    Tue Jan 11 09:45:25 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nvt.c,v 1.18 2010/05/02 13:36:30 phx Exp $ */
+/* $NetBSD: nvt.c,v 1.19 2011/01/11 09:45:25 nisimura Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -139,10 +139,10 @@
 #define FRAMESIZE      1536
 
 struct local {
-       struct desc txd;
+       struct desc txd[2];
        struct desc rxd[2];
        uint8_t rxstore[2][FRAMESIZE];
-       unsigned csr, rx;
+       unsigned csr, tx, rx;
        unsigned phy, bmsr, anlpar;
        unsigned ctl0;
 };
@@ -210,7 +210,7 @@
                printf("-FDX");
        printf("\n");
 
-       txd = &l->txd;
+       txd = &l->txd[0];
        rxd = &l->rxd[0];
        rxd[0].xd0 = htole32(R0_OWN);
        rxd[0].xd1 = htole32(FRAMESIZE << 16);
@@ -221,7 +221,7 @@
        rxd[1].xd2 = htole32(FRAMESIZE << 16);
        rxd[1].xd3 = htole32(VTOPHYS(&rxd[0]));
        wbinv(l, sizeof(struct local));
-       l->rx = 0;
+       l->tx = l->rx = 0;
 
        /* enable transmitter and receiver */
        l->ctl0 = CTL0_TXON | CTL0_RXON | CTL0_START;
@@ -250,7 +250,7 @@
        if (len < 60)
                len = 60; /* needs to stretch to ETHER_MIN_LEN - 4 */
        wbinv(buf, len);
-       txd = &l->txd;
+       txd = &l->txd[l->tx];
        txd->xd3 = htole32(txd);
        txd->xd2 = htole32(VTOPHYS(buf));
        txd->xd1 = htole32(T1_STP | T1_EDP | len);
@@ -267,6 +267,7 @@
        printf("xmit failed\n");
        return -1;
   done:
+       l->tx ^= 1;
        return len;
 }
 
diff -r d5dd6b695a5d -r b941928b4074 sys/arch/sandpoint/stand/netboot/pcn.c
--- a/sys/arch/sandpoint/stand/netboot/pcn.c    Tue Jan 11 09:32:50 2011 +0000
+++ b/sys/arch/sandpoint/stand/netboot/pcn.c    Tue Jan 11 09:45:25 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pcn.c,v 1.17 2010/05/02 13:36:30 phx Exp $ */
+/* $NetBSD: pcn.c,v 1.18 2011/01/11 09:45:25 nisimura Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -116,10 +116,10 @@
 #define FRAMESIZE      1536
 
 struct local {
-       struct desc txd;
+       struct desc txd[2];
        struct desc rxd[2];
        uint8_t rxstore[2][FRAMESIZE];
-       unsigned csr, rx;
+       unsigned csr, tx, rx;
        unsigned phy, bmsr, anlpar;
 };
 
@@ -179,13 +179,13 @@
                printf("-FDX");
        printf("\n");
 
-       txd = &l->txd;
+       txd = &l->txd[0];
        rxd = &l->rxd[0];
        rxd[0].xd0 = htole32(VTOPHYS(l->rxstore[0]));
        rxd[0].xd1 = htole32(R1_OWN | R1_ONES | FRAMESIZE);
        rxd[1].xd0 = htole32(VTOPHYS(l->rxstore[1]));
        rxd[1].xd1 = htole32(R1_OWN | R1_ONES | FRAMESIZE);
-       l->rx = 0;
+       l->tx = l->rx = 0;
 
        ib = &initblock;
        ib->init_mode = htole32((0 << 28) | (1 << 20) | 0);
@@ -226,8 +226,8 @@
        int tlen;
 
        wbinv(buf, len);
+       txd = &l->txd[l->tx];
        tlen = (-len) & T1_FLMASK; /* two's complement */
-       txd = &l->txd;
        txd->xd0 = htole32(VTOPHYS(buf));
        txd->xd1 = htole32(T1_OWN | T1_STP | T1_ENP | T1_ONES | tlen);
        wbinv(txd, sizeof(struct desc));
@@ -242,6 +242,7 @@
        printf("xmit failed\n");
        return -1;
   done:
+       l->tx ^= 1;
        return len;
 }
 
diff -r d5dd6b695a5d -r b941928b4074 sys/arch/sandpoint/stand/netboot/sip.c
--- a/sys/arch/sandpoint/stand/netboot/sip.c    Tue Jan 11 09:32:50 2011 +0000
+++ b/sys/arch/sandpoint/stand/netboot/sip.c    Tue Jan 11 09:45:25 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sip.c,v 1.17 2010/05/02 13:36:31 phx Exp $ */
+/* $NetBSD: sip.c,v 1.18 2011/01/11 09:45:25 nisimura Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -98,10 +98,10 @@
 #define FRAMESIZE      1536
 
 struct local {
-       struct desc txd;
+       struct desc txd[2];
        struct desc rxd[2];
        uint8_t store[2][FRAMESIZE];
-       unsigned csr, rx;
+       unsigned csr, tx, rx;
        unsigned phy, bmsr, anlpar;
        unsigned cr;
 };
@@ -191,7 +191,7 @@
                printf("-FDX");
        printf("\n");
 
-       txd = &l->txd;
+       txd = &l->txd[0];
        txd->xd0 = htole32(VTOPHYS(txd));
        rxd = l->rxd;
        rxd[0].xd0 = htole32(VTOPHYS(&rxd[1]));
@@ -201,7 +201,7 @@
        rxd[1].xd1 = htole32(XD1_OWN | FRAMESIZE);
        rxd[1].xd2 = htole32(VTOPHYS(l->store[1]));
        wbinv(l, sizeof(struct local));
-       l->rx = 0;
+       l->tx = l->rx = 0;
 
        CSR_WRITE(l, SIP_RFCR, 0);
        CSR_WRITE(l, SIP_RFDR, (en[1] << 8) | en[0]);
@@ -235,7 +235,7 @@
        unsigned loop;
 
        wbinv(buf, len);
-       txd = &l->txd;
+       txd = &l->txd[l->tx];
        txd->xd2 = htole32(VTOPHYS(buf));
        txd->xd1 = htole32(XD1_OWN | (len & 0xfff));
        wbinv(txd, sizeof(struct desc));
@@ -250,6 +250,7 @@
        printf("xmit failed\n");
        return -1;
   done:
+       l->tx ^= 1;
        return len;
 }
 
diff -r d5dd6b695a5d -r b941928b4074 sys/arch/sandpoint/stand/netboot/sme.c
--- a/sys/arch/sandpoint/stand/netboot/sme.c    Tue Jan 11 09:32:50 2011 +0000
+++ b/sys/arch/sandpoint/stand/netboot/sme.c    Tue Jan 11 09:45:25 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sme.c,v 1.3 2010/05/02 13:36:31 phx Exp $ */
+/* $NetBSD: sme.c,v 1.4 2011/01/11 09:45:25 nisimura Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -91,10 +91,10 @@
 #define FRAMESIZE      1536
 
 struct local {
-       struct desc txd;
+       struct desc txd[2];
        struct desc rxd[2];
        uint8_t rxstore[2][FRAMESIZE];
-       unsigned csr, rx;
+       unsigned csr, tx, rx;
        unsigned phy, bmsr, anlpar;
 };
 
@@ -154,7 +154,7 @@
                printf("-FDX");
        printf("\n");
 
-       txd = &l->txd;
+       txd = &l->txd[0];
        rxd = &l->rxd[0];
        rxd[0].xd0 = htole32(R0_OWN);
        rxd[0].xd1 = htole32(R1_RCH | FRAMESIZE);
@@ -164,7 +164,7 @@
        rxd[1].xd1 = htole32(R1_RER | FRAMESIZE);
        rxd[1].xd2 = htole32(VTOPHYS(l->rxstore[1]));
        /* R1_RER neglects xd3 */
-       l->rx = 0;
+       l->tx = l->rx = 0;
 
        wbinv(l, sizeof(struct local));
 
@@ -190,7 +190,7 @@
 
        /* send a single frame with no T1_TER|T1_TCH designation */
        wbinv(buf, len);
-       txd = &l->txd;
+       txd = &l->txd[l->tx];
        txd->xd2 = htole32(VTOPHYS(buf));
        txd->xd1 = htole32(T1_FS | T1_LS | (len & T1_FL));
        txd->xd0 = htole32(T0_OWN | (len & T0_FL) << 16);
@@ -209,6 +209,7 @@
        printf("xmit failed\n");
        return -1;
   done:
+       l->tx ^= 1;
        return len;
 }
 
diff -r d5dd6b695a5d -r b941928b4074 sys/arch/sandpoint/stand/netboot/wm.c
--- a/sys/arch/sandpoint/stand/netboot/wm.c     Tue Jan 11 09:32:50 2011 +0000
+++ b/sys/arch/sandpoint/stand/netboot/wm.c     Tue Jan 11 09:45:25 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wm.c,v 1.11 2010/05/02 13:36:31 phx Exp $ */
+/* $NetBSD: wm.c,v 1.12 2011/01/11 09:45:25 nisimura Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -104,10 +104,10 @@
 #define FRAMESIZE      1536
 
 struct local {
-       struct tdesc txd;
+       struct tdesc txd[2];
        struct rdesc rxd[2];



Home | Main Index | Thread Index | Old Index