summaryrefslogtreecommitdiffstats
path: root/sys/dev/ti
diff options
context:
space:
mode:
authoryongari <yongari@FreeBSD.org>2011-11-07 22:11:38 +0000
committeryongari <yongari@FreeBSD.org>2011-11-07 22:11:38 +0000
commitab2f26b102bec132db8ea050e243e44d069c3509 (patch)
treec4c0382b4c6a2e5f49479724af21a320b773df50 /sys/dev/ti
parent422432aa2bc78e1119feab8d83ae6987a1ce1f0f (diff)
downloadFreeBSD-src-ab2f26b102bec132db8ea050e243e44d069c3509.zip
FreeBSD-src-ab2f26b102bec132db8ea050e243e44d069c3509.tar.gz
Track which ring was updated in RX handler and update only modified
ring. This should reduce unnecessary register accesses.
Diffstat (limited to 'sys/dev/ti')
-rw-r--r--sys/dev/ti/if_ti.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c
index f01b638..8ce82ce 100644
--- a/sys/dev/ti/if_ti.c
+++ b/sys/dev/ti/if_ti.c
@@ -2647,15 +2647,17 @@ ti_rxeof(struct ti_softc *sc)
struct ifnet *ifp;
bus_dmamap_t map;
struct ti_cmd_desc cmd;
+ int jumbocnt, minicnt, stdcnt;
TI_LOCK_ASSERT(sc);
ifp = sc->ti_ifp;
+ jumbocnt = minicnt = stdcnt = 0;
while (sc->ti_rx_saved_considx != sc->ti_return_prodidx.ti_idx) {
struct ti_rx_desc *cur_rx;
- struct mbuf *m = NULL;
uint32_t rxidx;
+ struct mbuf *m = NULL;
uint16_t vlan_tag = 0;
int have_tag = 0;
@@ -2670,7 +2672,7 @@ ti_rxeof(struct ti_softc *sc)
}
if (cur_rx->ti_flags & TI_BDFLAG_JUMBO_RING) {
-
+ jumbocnt++;
TI_INC(sc->ti_jumbo, TI_JUMBO_RX_RING_CNT);
m = sc->ti_cdata.ti_rx_jumbo_chain[rxidx];
sc->ti_cdata.ti_rx_jumbo_chain[rxidx] = NULL;
@@ -2700,6 +2702,7 @@ ti_rxeof(struct ti_softc *sc)
m_adj(m, cur_rx->ti_len - m->m_pkthdr.len);
#endif /* TI_PRIVATE_JUMBOS */
} else if (cur_rx->ti_flags & TI_BDFLAG_MINI_RING) {
+ minicnt++;
TI_INC(sc->ti_mini, TI_MINI_RX_RING_CNT);
m = sc->ti_cdata.ti_rx_mini_chain[rxidx];
sc->ti_cdata.ti_rx_mini_chain[rxidx] = NULL;
@@ -2719,6 +2722,7 @@ ti_rxeof(struct ti_softc *sc)
}
m->m_len = cur_rx->ti_len;
} else {
+ stdcnt++;
TI_INC(sc->ti_std, TI_STD_RX_RING_CNT);
m = sc->ti_cdata.ti_rx_std_chain[rxidx];
sc->ti_cdata.ti_rx_std_chain[rxidx] = NULL;
@@ -2774,9 +2778,12 @@ ti_rxeof(struct ti_softc *sc)
CSR_WRITE_4(sc, TI_GCR_RXRETURNCONS_IDX,
sc->ti_rx_saved_considx);
- TI_UPDATE_STDPROD(sc, sc->ti_std);
- TI_UPDATE_MINIPROD(sc, sc->ti_mini);
- TI_UPDATE_JUMBOPROD(sc, sc->ti_jumbo);
+ if (stdcnt > 0)
+ TI_UPDATE_STDPROD(sc, sc->ti_std);
+ if (minicnt > 0)
+ TI_UPDATE_MINIPROD(sc, sc->ti_mini);
+ if (jumbocnt > 0)
+ TI_UPDATE_JUMBOPROD(sc, sc->ti_jumbo);
}
static void
OpenPOWER on IntegriCloud