summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2006-02-16 17:35:52 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2006-02-16 17:35:52 +0000
commitf58e8905010225058178f5ce055fcd580751dc18 (patch)
treed22b7fb3627df4841c042d464f33b24dbd0fdb53 /sys/dev/pci
parentff18dafa045c6fa286018a40158122c68f840dbe (diff)
- stop enabling/disabling interrupts in nfe_intr().
- store RX/TX settings in nfe_softc so we don't recompute them all the time. - fix h/w VLAN tagging flags.
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/if_nfe.c51
-rw-r--r--sys/dev/pci/if_nfereg.h8
-rw-r--r--sys/dev/pci/if_nfevar.h3
3 files changed, 20 insertions, 42 deletions
diff --git a/sys/dev/pci/if_nfe.c b/sys/dev/pci/if_nfe.c
index 55abd4c0b8d..465b4acb4c4 100644
--- a/sys/dev/pci/if_nfe.c
+++ b/sys/dev/pci/if_nfe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nfe.c,v 1.40 2006/02/15 20:21:27 brad Exp $ */
+/* $OpenBSD: if_nfe.c,v 1.41 2006/02/16 17:35:51 damien Exp $ */
/*-
* Copyright (c) 2006 Damien Bergamini <damien.bergamini@free.fr>
@@ -258,7 +258,6 @@ nfe_attach(struct device *parent, struct device *self, void *aux)
strlcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ);
ifp->if_capabilities = IFCAP_VLAN_MTU;
-
#if NVLAN > 0
if (sc->sc_flags & NFE_HW_VLAN)
ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING;
@@ -430,18 +429,10 @@ nfe_intr(void *arg)
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
uint32_t r;
- /* disable interrupts */
- NFE_WRITE(sc, NFE_IRQ_MASK, 0);
-
- r = NFE_READ(sc, NFE_IRQ_STATUS);
+ if ((r = NFE_READ(sc, NFE_IRQ_STATUS)) == 0)
+ return 0; /* not for us */
NFE_WRITE(sc, NFE_IRQ_STATUS, r);
- if (r == 0) {
- /* re-enable interrupts */
- NFE_WRITE(sc, NFE_IRQ_MASK, NFE_IRQ_WANTED);
- return 0;
- }
-
DPRINTFN(5, ("nfe_intr: interrupt register %x\n", r));
if (r & NFE_IRQ_LINK) {
@@ -458,9 +449,6 @@ nfe_intr(void *arg)
nfe_txeof(sc);
}
- /* re-enable interrupts */
- NFE_WRITE(sc, NFE_IRQ_MASK, NFE_IRQ_WANTED);
-
return 1;
}
@@ -992,7 +980,6 @@ nfe_start(struct ifnet *ifp)
struct nfe_softc *sc = ifp->if_softc;
int old = sc->txq.cur;
struct mbuf *m0;
- uint32_t txctl;
for (;;) {
IFQ_POLL(&ifp->if_snd, m0);
@@ -1020,18 +1007,8 @@ nfe_start(struct ifnet *ifp)
else
nfe_txdesc32_rsync(sc, old, sc->txq.cur, BUS_DMASYNC_PREWRITE);
- txctl = NFE_RXTX_KICKTX;
- if (sc->sc_flags & NFE_40BIT_ADDR)
- txctl |= NFE_RXTX_V3MAGIC;
- else if (sc->sc_flags & NFE_JUMBO_SUP)
- txctl |= NFE_RXTX_V2MAGIC;
-#ifdef NFE_CSUM
- if (sc->sc_flags & NFE_HW_CSUM)
- txctl |= NFE_RXTX_RXCHECK;
-#endif
-
/* kick Tx */
- NFE_WRITE(sc, NFE_RXTX_CTL, txctl);
+ NFE_WRITE(sc, NFE_RXTX_CTL, NFE_RXTX_KICKTX | sc->rxtxctl);
/*
* Set a timeout in case the chip goes out to lunch.
@@ -1056,7 +1033,7 @@ int
nfe_init(struct ifnet *ifp)
{
struct nfe_softc *sc = ifp->if_softc;
- uint32_t tmp, rxtxctl;
+ uint32_t tmp;
if (ifp->if_flags & IFF_RUNNING)
return 0;
@@ -1067,19 +1044,19 @@ nfe_init(struct ifnet *ifp)
NFE_WRITE(sc, NFE_TX_UNK, 0);
- rxtxctl = NFE_RXTX_BIT2;
+ sc->rxtxctl = NFE_RXTX_BIT2;
if (sc->sc_flags & NFE_40BIT_ADDR)
- rxtxctl |= NFE_RXTX_V3MAGIC;
+ sc->rxtxctl |= NFE_RXTX_V3MAGIC;
else if (sc->sc_flags & NFE_JUMBO_SUP)
- rxtxctl |= NFE_RXTX_V2MAGIC;
+ sc->rxtxctl |= NFE_RXTX_V2MAGIC;
#ifdef NFE_CSUM
if (sc->sc_flags & NFE_HW_CSUM)
- rxtxctl |= NFE_RXTX_RXCHECK;
+ sc->rxtxctl |= NFE_RXTX_RXCSUM;
#endif
- NFE_WRITE(sc, NFE_RXTX_CTL, NFE_RXTX_RESET | rxtxctl);
+ NFE_WRITE(sc, NFE_RXTX_CTL, NFE_RXTX_RESET | sc->rxtxctl);
DELAY(10);
- NFE_WRITE(sc, NFE_RXTX_CTL, rxtxctl);
+ NFE_WRITE(sc, NFE_RXTX_CTL, sc->rxtxctl);
NFE_WRITE(sc, NFE_SETUP_R6, 0);
@@ -1123,10 +1100,10 @@ nfe_init(struct ifnet *ifp)
NFE_WRITE(sc, NFE_SETUP_R4, NFE_R4_MAGIC);
NFE_WRITE(sc, NFE_WOL_CTL, NFE_WOL_MAGIC);
- rxtxctl &= ~NFE_RXTX_BIT2;
- NFE_WRITE(sc, NFE_RXTX_CTL, rxtxctl);
+ sc->rxtxctl &= ~NFE_RXTX_BIT2;
+ NFE_WRITE(sc, NFE_RXTX_CTL, sc->rxtxctl);
DELAY(10);
- NFE_WRITE(sc, NFE_RXTX_CTL, NFE_RXTX_BIT1 | rxtxctl);
+ NFE_WRITE(sc, NFE_RXTX_CTL, NFE_RXTX_BIT1 | sc->rxtxctl);
/* set Rx filter */
nfe_setmulti(sc);
diff --git a/sys/dev/pci/if_nfereg.h b/sys/dev/pci/if_nfereg.h
index 614aa8a4c12..34b2d7b3054 100644
--- a/sys/dev/pci/if_nfereg.h
+++ b/sys/dev/pci/if_nfereg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nfereg.h,v 1.12 2006/02/15 20:08:59 damien Exp $ */
+/* $OpenBSD: if_nfereg.h,v 1.13 2006/02/16 17:35:51 damien Exp $ */
/*-
* Copyright (c) 2005 Jonathan Gray <jsg@openbsd.org>
@@ -100,7 +100,7 @@
#define NFE_RXTX_RESET 0x0010
#define NFE_RXTX_VTAG_STRIP 0x0040
#define NFE_RXTX_VTAG_INSERT 0x0080
-#define NFE_RXTX_RXCHECK 0x0400
+#define NFE_RXTX_RXCSUM 0x0400
#define NFE_RXTX_V2MAGIC 0x2100
#define NFE_RXTX_V3MAGIC 0x2200
#define NFE_RXFILTER_MAGIC 0x007f0008
@@ -145,13 +145,13 @@ struct nfe_desc32 {
struct nfe_desc64 {
uint32_t physaddr[2];
uint32_t vtag;
+#define NFE_RX_VTAG (1 << 16)
+#define NFE_TX_VTAG (1 << 18)
uint16_t length;
uint16_t flags;
#define NFE_RX_FIXME_V2 0x4300
-#define NFE_RX_VTAG (1 << 0)
#define NFE_RX_VALID_V2 (1 << 13)
#define NFE_TX_ERROR_V2 0x5c04
-#define NFE_TX_VTAG (1 << 2)
#define NFE_TX_LASTFRAG_V2 (1 << 13)
} __packed;
diff --git a/sys/dev/pci/if_nfevar.h b/sys/dev/pci/if_nfevar.h
index f7ae53cb54e..07e167bbf58 100644
--- a/sys/dev/pci/if_nfevar.h
+++ b/sys/dev/pci/if_nfevar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nfevar.h,v 1.9 2006/02/15 19:36:46 damien Exp $ */
+/* $OpenBSD: if_nfevar.h,v 1.10 2006/02/16 17:35:51 damien Exp $ */
/*-
* Copyright (c) 2005 Jonathan Gray <jsg@openbsd.org>
@@ -83,6 +83,7 @@ struct nfe_softc {
#define NFE_HW_VLAN 0x08
#define NFE_USE_JUMBO 0x10
+ uint32_t rxtxctl;
uint8_t phyaddr;
struct nfe_tx_ring txq;