summaryrefslogtreecommitdiffstats
path: root/sys/dev/xl
diff options
context:
space:
mode:
authoryongari <yongari@FreeBSD.org>2011-05-06 23:01:29 +0000
committeryongari <yongari@FreeBSD.org>2011-05-06 23:01:29 +0000
commita3f2c28a339dfd746b86161020b35cadc809359b (patch)
treebbfdf853e0c68716e118778b28e0c00bdc0da9fe /sys/dev/xl
parent9225850fe6baa34b67bf215d1803274a0133589d (diff)
downloadFreeBSD-src-a3f2c28a339dfd746b86161020b35cadc809359b.zip
FreeBSD-src-a3f2c28a339dfd746b86161020b35cadc809359b.tar.gz
Change xl_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. While here, remove unnecessary local variable initialization.
Diffstat (limited to 'sys/dev/xl')
-rw-r--r--sys/dev/xl/if_xl.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/sys/dev/xl/if_xl.c b/sys/dev/xl/if_xl.c
index 15438a5..e9384f8 100644
--- a/sys/dev/xl/if_xl.c
+++ b/sys/dev/xl/if_xl.c
@@ -1944,7 +1944,7 @@ xl_rxeof(struct xl_softc *sc)
struct mbuf *m;
struct ifnet *ifp = sc->xl_ifp;
struct xl_chain_onefrag *cur_rx;
- int total_len = 0;
+ int total_len;
int rx_npkts = 0;
u_int32_t rxstat;
@@ -1963,6 +1963,7 @@ again:
cur_rx = sc->xl_cdata.xl_rx_head;
sc->xl_cdata.xl_rx_head = cur_rx->xl_next;
total_len = rxstat & XL_RXSTAT_LENMASK;
+ rx_npkts++;
/*
* Since we have told the chip to allow large frames,
@@ -2047,7 +2048,6 @@ again:
XL_UNLOCK(sc);
(*ifp->if_input)(ifp, m);
XL_LOCK(sc);
- rx_npkts++;
/*
* If we are running from the taskqueue, the interface
@@ -2283,11 +2283,7 @@ xl_intr(void *arg)
break;
if (status & XL_STAT_UP_COMPLETE) {
- int curpkts;
-
- curpkts = ifp->if_ipackets;
- xl_rxeof(sc);
- if (curpkts == ifp->if_ipackets) {
+ if (xl_rxeof(sc) == 0) {
while (xl_rx_resync(sc))
xl_rxeof(sc);
}
OpenPOWER on IntegriCloud