summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2008-06-08 20:58:43 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2008-06-08 20:58:43 +0000
commit1f4c2150b6d5d2dfb9d72754b06df28594301cae (patch)
treecf8889b7c622746f94d3ce99924795fc9e77423c /sys/dev/pci
parent2c57a9726dcd1d56791188ab7cac0a45ef2dbeae (diff)
dma sync the tx ring and post new packets to the chip once per call to
the start routine instead of once per packet. From ixgb(4), also works with ix(4)
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/if_ix.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/sys/dev/pci/if_ix.c b/sys/dev/pci/if_ix.c
index 5581aa60c2d..bb3ac276737 100644
--- a/sys/dev/pci/if_ix.c
+++ b/sys/dev/pci/if_ix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ix.c,v 1.3 2008/06/08 20:36:34 reyk Exp $ */
+/* $OpenBSD: if_ix.c,v 1.4 2008/06/08 20:58:42 reyk Exp $ */
/******************************************************************************
@@ -341,6 +341,7 @@ ixgbe_start_locked(struct tx_ring *txr, struct ifnet * ifp)
{
struct mbuf *m_head;
struct ix_softc *sc = txr->sc;
+ int post = 0;
if ((ifp->if_flags & (IFF_RUNNING|IFF_OACTIVE)) != IFF_RUNNING)
return;
@@ -348,9 +349,12 @@ ixgbe_start_locked(struct tx_ring *txr, struct ifnet * ifp)
if (!sc->link_active)
return;
+ bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, 0,
+ txr->txdma.dma_map->dm_mapsize,
+ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
+
for (;;) {
IFQ_POLL(&ifp->if_snd, m_head);
-
if (m_head == NULL)
break;
@@ -369,8 +373,21 @@ ixgbe_start_locked(struct tx_ring *txr, struct ifnet * ifp)
/* Set timeout in case hardware has problems transmitting */
txr->watchdog_timer = IXGBE_TX_TIMEOUT;
ifp->if_timer = IXGBE_TX_TIMEOUT;
+
+ post = 1;
}
- return;
+
+ bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map,
+ 0, txr->txdma.dma_map->dm_mapsize,
+ BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
+
+ /*
+ * Advance the Transmit Descriptor Tail (Tdt), this tells the
+ * hardware that this frame is available to transmit.
+ */
+ if (post)
+ IXGBE_WRITE_REG(&sc->hw, IXGBE_TDT(txr->me),
+ txr->next_avail_tx_desc);
}
@@ -941,15 +958,6 @@ ixgbe_encap(struct tx_ring *txr, struct mbuf *m_head)
/* Set the index of the descriptor that will be marked done */
txbuf = &txr->tx_buffers[first];
- bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map,
- 0, txr->txdma.dma_map->dm_mapsize,
- BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
-
- /*
- * Advance the Transmit Descriptor Tail (Tdt), this tells the
- * hardware that this frame is available to transmit.
- */
- IXGBE_WRITE_REG(&sc->hw, IXGBE_TDT(txr->me), i);
++txr->tx_packets;
return (0);