Author: yongari
Date: Fri May  6 23:01:29 2011
New Revision: 221564
URL: http://svn.freebsd.org/changeset/base/221564

Log:
  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.

Modified:
  head/sys/dev/xl/if_xl.c

Modified: head/sys/dev/xl/if_xl.c
==============================================================================
--- head/sys/dev/xl/if_xl.c     Fri May  6 22:55:53 2011        (r221563)
+++ head/sys/dev/xl/if_xl.c     Fri May  6 23:01:29 2011        (r221564)
@@ -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);
                        }
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to