summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2007-04-25 13:27:31 +0000
committerdlg <dlg@openbsd.org>2007-04-25 13:27:31 +0000
commit5c0d4c98ca8966631c0f17a2af66bfa4425e633e (patch)
tree9db730385dba7febb0413aa1b85f273c4829f43e
parentadd some dprintfs to the fifo handlers. (diff)
downloadwireguard-openbsd-5c0d4c98ca8966631c0f17a2af66bfa4425e633e.tar.xz
wireguard-openbsd-5c0d4c98ca8966631c0f17a2af66bfa4425e633e.zip
hook the rx path up.
despite having written it without being able to test, there was only one real bug. i wasnt keeping track of the mbuf in the rx init path, so when the completion tried to use it, it was dereferencing random memory.
-rw-r--r--sys/dev/pci/if_tht.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/dev/pci/if_tht.c b/sys/dev/pci/if_tht.c
index 6c5dd702c51..5a04b517156 100644
--- a/sys/dev/pci/if_tht.c
+++ b/sys/dev/pci/if_tht.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tht.c,v 1.76 2007/04/25 12:52:22 dlg Exp $ */
+/* $OpenBSD: if_tht.c,v 1.77 2007/04/25 13:27:31 dlg Exp $ */
/*
* Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
@@ -260,7 +260,8 @@ int thtdebug = THT_D_FIFO | THT_D_TX | THT_D_RX | THT_D_INTR;
#define THT_IMR_DOWN(_p) (THT_REG_IMR_LINKCHG(_p))
#define THT_IMR_UP(_p) (THT_REG_IMR_LINKCHG(_p) | \
- THT_REG_IMR_TXF(0))
+ THT_REG_IMR_RXF(0) | THT_REG_IMR_TXF(0) | \
+ THT_REG_IMR_RXD(0))
/* hardware structures (we're using the 64 bit variants) */
@@ -825,6 +826,12 @@ tht_intr(void *arg)
ifp = &sc->sc_ac.ac_if;
if (ifp->if_flags & IFF_RUNNING) {
+ if (ISSET(isr, THT_REG_ISR_RXD(0)))
+ tht_rxd(sc);
+
+ if (ISSET(isr, THT_REG_ISR_RXF(0)))
+ tht_rxf_fill(sc, 0);
+
if (ISSET(isr, THT_REG_ISR_TXF(0)))
tht_txf(sc);
@@ -1187,8 +1194,9 @@ tht_rxf_fill(struct tht_softc *sc, int wait)
wait ? BUS_DMA_WAITOK : BUS_DMA_NOWAIT) != 0)
goto free_m;
- bc = sizeof(rxf) +
- sizeof(struct tht_pbd) * pkt->tp_dmap->dm_nsegs;
+ pkt->tp_m = m;
+
+ bc = sizeof(rxf) + sizeof(struct tht_pbd) * dmap->dm_nsegs;
rxf.bc = htole16(LWORDS(bc));
rxf.type = htole16(THT_RXF_TYPE);