diff options
author | glebius <glebius@FreeBSD.org> | 2005-12-18 20:26:12 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2005-12-18 20:26:12 +0000 |
commit | 0c6bbde2f786c9f83d748c1fdeddac2b582a4ed4 (patch) | |
tree | a1b2d8fbaba5376d69e6d5d7f27cf2fbbb295cad /sys/dev/bge | |
parent | 8d6f05d58bc7dda5a91170bff51023509aa82558 (diff) | |
download | FreeBSD-src-0c6bbde2f786c9f83d748c1fdeddac2b582a4ed4.zip FreeBSD-src-0c6bbde2f786c9f83d748c1fdeddac2b582a4ed4.tar.gz |
Since BGE_MBX_TX_HOST_PROD0_LO register is write-only to software,
we can cache its value in the softc. Eliminates one PCI register
write per call to bge_start().
A 1.8% speedup for UDP_RR test on my old box.
Obtained from: NetBSD(jonathan) via delphij
Diffstat (limited to 'sys/dev/bge')
-rw-r--r-- | sys/dev/bge/if_bge.c | 14 | ||||
-rw-r--r-- | sys/dev/bge/if_bgereg.h | 1 |
2 files changed, 11 insertions, 4 deletions
diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c index 16fc559..e380e26 100644 --- a/sys/dev/bge/if_bge.c +++ b/sys/dev/bge/if_bge.c @@ -947,11 +947,15 @@ bge_init_tx_ring(sc) sc->bge_txcnt = 0; sc->bge_tx_saved_considx = 0; - CSR_WRITE_4(sc, BGE_MBX_TX_HOST_PROD0_LO, 0); + /* Initialize transmit producer index for host-memory send ring. */ + sc->bge_tx_prodidx = 0; + CSR_WRITE_4(sc, BGE_MBX_TX_HOST_PROD0_LO, sc->bge_tx_prodidx); + /* 5700 b2 errata */ if (sc->bge_chiprev == BGE_CHIPREV_5700_BX) - CSR_WRITE_4(sc, BGE_MBX_TX_HOST_PROD0_LO, 0); + CSR_WRITE_4(sc, BGE_MBX_TX_HOST_PROD0_LO, sc->bge_tx_prodidx); + /* NIC-memory send ring not used; initialize to zero. */ CSR_WRITE_4(sc, BGE_MBX_TX_NIC_PROD0_LO, 0); /* 5700 b2 errata */ if (sc->bge_chiprev == BGE_CHIPREV_5700_BX) @@ -3040,7 +3044,7 @@ bge_start_locked(ifp) { struct bge_softc *sc; struct mbuf *m_head = NULL; - u_int32_t prodidx = 0; + uint32_t prodidx; int count = 0; sc = ifp->if_softc; @@ -3048,7 +3052,7 @@ bge_start_locked(ifp) if (!sc->bge_link || IFQ_DRV_IS_EMPTY(&ifp->if_snd)) return; - prodidx = CSR_READ_4(sc, BGE_MBX_TX_HOST_PROD0_LO); + prodidx = sc->bge_tx_prodidx; while(sc->bge_cdata.bge_tx_chain[prodidx] == NULL) { IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); @@ -3108,6 +3112,8 @@ bge_start_locked(ifp) if (sc->bge_chiprev == BGE_CHIPREV_5700_BX) CSR_WRITE_4(sc, BGE_MBX_TX_HOST_PROD0_LO, prodidx); + sc->bge_tx_prodidx = prodidx; + /* * Set a timeout in case the chip goes out to lunch. */ diff --git a/sys/dev/bge/if_bgereg.h b/sys/dev/bge/if_bgereg.h index e894e63..9deb959 100644 --- a/sys/dev/bge/if_bgereg.h +++ b/sys/dev/bge/if_bgereg.h @@ -2416,6 +2416,7 @@ struct bge_softc { u_int32_t bge_stat_ticks; u_int32_t bge_rx_coal_ticks; u_int32_t bge_tx_coal_ticks; + u_int32_t bge_tx_prodidx; u_int32_t bge_rx_max_coal_bds; u_int32_t bge_tx_max_coal_bds; u_int32_t bge_tx_buf_ratio; |