diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2008-06-08 16:53:24 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2008-06-08 16:53:24 +0000 |
commit | 740b4269917fa4f714d266c1e4e6311575a9c9fa (patch) | |
tree | 4e23a49b467ae3910b1f224482bfc2ffdf00f68d /sys | |
parent | 0354e368456cd42e0e55bde02037f28866108fd0 (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.
ok reyk@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/if_ixgb.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/sys/dev/pci/if_ixgb.c b/sys/dev/pci/if_ixgb.c index d50e4a3a518..d2d88e1ca71 100644 --- a/sys/dev/pci/if_ixgb.c +++ b/sys/dev/pci/if_ixgb.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_ixgb.c,v 1.42 2008/06/08 16:20:27 reyk Exp $ */ +/* $OpenBSD: if_ixgb.c,v 1.43 2008/06/08 16:53:23 brad Exp $ */ #include <dev/pci/if_ixgb.h> @@ -303,6 +303,7 @@ ixgb_start(struct ifnet *ifp) { struct mbuf *m_head; struct ixgb_softc *sc = ifp->if_softc; + int post = 0; if ((ifp->if_flags & (IFF_OACTIVE | IFF_RUNNING)) != IFF_RUNNING) return; @@ -310,9 +311,12 @@ ixgb_start(struct ifnet *ifp) if (!sc->link_active) return; + bus_dmamap_sync(sc->txdma.dma_tag, sc->txdma.dma_map, 0, + sc->txdma.dma_map->dm_mapsize, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + for (;;) { IFQ_POLL(&ifp->if_snd, m_head); - if (m_head == NULL) break; @@ -331,7 +335,20 @@ ixgb_start(struct ifnet *ifp) /* Set timeout in case hardware has problems transmitting */ ifp->if_timer = IXGB_TX_TIMEOUT; + + post = 1; } + + bus_dmamap_sync(sc->txdma.dma_tag, sc->txdma.dma_map, 0, + sc->txdma.dma_map->dm_mapsize, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + /* + * Advance the Transmit Descriptor Tail (Tdt), + * this tells the E1000 that this frame + * is available to transmit. + */ + if (post) + IXGB_WRITE_REG(&sc->hw, TDT, sc->next_avail_tx_desc); } /********************************************************************* @@ -726,15 +743,6 @@ ixgb_encap(struct ixgb_softc *sc, struct mbuf *m_head) */ current_tx_desc->cmd_type_len |= htole32(IXGB_TX_DESC_CMD_EOP); - /* - * Advance the Transmit Descriptor Tail (Tdt), this tells the E1000 - * that this frame is available to transmit. - */ - bus_dmamap_sync(sc->txdma.dma_tag, sc->txdma.dma_map, 0, - sc->txdma.dma_map->dm_mapsize, - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - IXGB_WRITE_REG(&sc->hw, TDT, i); - return (0); fail: |