From owner-svn-src-all@FreeBSD.ORG Fri May 6 23:01:29 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 96C3B106566B; Fri, 6 May 2011 23:01:29 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 85B548FC13; Fri, 6 May 2011 23:01:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p46N1Tmw070457; Fri, 6 May 2011 23:01:29 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p46N1TRI070455; Fri, 6 May 2011 23:01:29 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201105062301.p46N1TRI070455@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 6 May 2011 23:01:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221564 - head/sys/dev/xl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 May 2011 23:01:29 -0000 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); }