svn commit: r220083 - stable/8/sys/dev/dc
Pyun YongHyeon
yongari at FreeBSD.org
Mon Mar 28 00:13:42 UTC 2011
Author: yongari
Date: Mon Mar 28 00:13:41 2011
New Revision: 220083
URL: http://svn.freebsd.org/changeset/base/220083
Log:
MFC r219701:
Remove too expensive bus_dmamap_sync(9) call in dc_rx_resync().
With this change, driver may not notice updated descriptor status
change when bounce buffers are active. However, rxeof() in next run
will handle the synchronization.
Change dc_rxeof() a bit to return the number of processed frames in
RX descriptor ring. Previously it returned the number of frames
that were successfully passed to upper stack which in turn means it
ignored frames that were discarded due to errors. The number of
processed frames in RX descriptor ring is used to detect whether
driver is out of sync with controller's current descriptor pointer.
Returning number of processed frames reduces unnecessary (probably
wrong) re-synchronization.
Reviewed by: marius
Modified:
stable/8/sys/dev/dc/if_dc.c
Directory Properties:
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/cddl/contrib/opensolaris/ (props changed)
stable/8/sys/contrib/dev/acpica/ (props changed)
stable/8/sys/contrib/pf/ (props changed)
Modified: stable/8/sys/dev/dc/if_dc.c
==============================================================================
--- stable/8/sys/dev/dc/if_dc.c Sun Mar 27 23:46:52 2011 (r220082)
+++ stable/8/sys/dev/dc/if_dc.c Mon Mar 28 00:13:41 2011 (r220083)
@@ -2790,8 +2790,6 @@ dc_rx_resync(struct dc_softc *sc)
pos = sc->dc_cdata.dc_rx_prod;
for (i = 0; i < DC_RX_LIST_CNT; i++) {
- bus_dmamap_sync(sc->dc_rx_ltag, sc->dc_rx_lmap,
- BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
cur_rx = &sc->dc_ldata.dc_rx_list[pos];
if (!(le32toh(cur_rx->dc_status) & DC_RXSTAT_OWN))
break;
@@ -2862,6 +2860,7 @@ dc_rxeof(struct dc_softc *sc)
bus_dmamap_sync(sc->dc_rx_mtag, sc->dc_cdata.dc_rx_map[i],
BUS_DMASYNC_POSTREAD);
total_len = DC_RXBYTES(rxstat);
+ rx_npkts++;
if (sc->dc_flags & DC_PNIC_RX_BUG_WAR) {
if ((rxstat & DC_WHOLEFRAME) != DC_WHOLEFRAME) {
@@ -2939,7 +2938,6 @@ dc_rxeof(struct dc_softc *sc)
DC_UNLOCK(sc);
(*ifp->if_input)(ifp, m);
DC_LOCK(sc);
- rx_npkts++;
}
sc->dc_cdata.dc_rx_prod = i;
@@ -3263,7 +3261,7 @@ dc_intr(void *arg)
struct dc_softc *sc;
struct ifnet *ifp;
uint32_t r, status;
- int curpkts, n;
+ int n;
sc = arg;
@@ -3293,9 +3291,7 @@ dc_intr(void *arg)
CSR_WRITE_4(sc, DC_ISR, status);
if (status & DC_ISR_RX_OK) {
- curpkts = ifp->if_ipackets;
- dc_rxeof(sc);
- if (curpkts == ifp->if_ipackets) {
+ if (dc_rxeof(sc) == 0) {
while (dc_rx_resync(sc))
dc_rxeof(sc);
}
@@ -3319,9 +3315,7 @@ dc_intr(void *arg)
|| (status & DC_ISR_RX_NOBUF)) {
r = CSR_READ_4(sc, DC_FRAMESDISCARDED);
ifp->if_ierrors += (r & 0xffff) + ((r >> 17) & 0x7ff);
- curpkts = ifp->if_ipackets;
- dc_rxeof(sc);
- if (curpkts == ifp->if_ipackets) {
+ if (dc_rxeof(sc) == 0) {
while (dc_rx_resync(sc))
dc_rxeof(sc);
}
More information about the svn-src-stable
mailing list