summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2007-04-21 14:46:36 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2007-04-21 14:46:36 +0000
commita15fc989cfe3d7cf86bba16f3e21366e81ecc4cb (patch)
tree0b11c85cfed516f31715d422d5bfb3cf04773c2d
parent1e56b3ac8fc5e92487a2509de039383a922fbc98 (diff)
tht wants at least 128 bytes in the first physical segment of an rx buffer
for some reason, so i had some code in there that tried to guarantee that. however, newly allocated mbufs and clusters are physically contiguous and bigger than 128 bytes. therefore we dont need to do that check. while here check if there is enough space in the fifo before trying to fill any of it. this means we can skip dma syncs if we're not going to end up writing anything in the fifo.
-rw-r--r--sys/dev/pci/if_tht.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/sys/dev/pci/if_tht.c b/sys/dev/pci/if_tht.c
index 1a2de8d4d10..0e6b388edf8 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.43 2007/04/21 13:58:38 dlg Exp $ */
+/* $OpenBSD: if_tht.c,v 1.44 2007/04/21 14:46:35 dlg Exp $ */
/*
* Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
@@ -816,14 +816,15 @@ tht_rxf_fill(struct tht_softc *sc, int wait)
int bc;
int i;
+ if (tht_fifo_ready(sc, &sc->sc_rxf) <= THT_FIFO_DESC_LEN)
+ return;
+
tht_fifo_pre(sc, &sc->sc_txf);
for (;;) {
- if ((tht_fifo_ready(sc, &sc->sc_rxf) <= THT_FIFO_DESC_LEN) ||
- (pkt = tht_pkt_get(&sc->sc_rx_list)) == NULL)
+ if ((pkt = tht_pkt_get(&sc->sc_rx_list)) == NULL)
goto done;
-new_m:
MGETHDR(m, wait ? M_WAIT : M_DONTWAIT, MT_DATA);
if (m == NULL)
goto put_pkt;
@@ -839,12 +840,6 @@ new_m:
wait ? BUS_DMA_WAITOK : BUS_DMA_NOWAIT) != 0)
goto free_m;
- if (dmap->dm_segs[0].ds_len < THT_RXF_1ST_PDB_LEN) {
- bus_dmamap_unload(dmat, dmap);
- m_freem(m);
- goto new_m;
- }
-
bc = sizeof(rxf) + sizeof(pbd) * dmap->dm_nsegs;
rxf.bc = htole16(LWORDS(bc));
@@ -871,6 +866,9 @@ new_m:
bus_dmamap_sync(dmat, dmap, 0, dmap->dm_mapsize,
BUS_DMASYNC_PREREAD);
+
+ if (tht_fifo_ready(sc, &sc->sc_rxf) <= THT_FIFO_DESC_LEN)
+ goto done;
}
free_m: