From owner-svn-src-all@FreeBSD.ORG Sun Jun 30 05:56:14 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 00ACA6AF; Sun, 30 Jun 2013 05:56:13 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CD50012DA; Sun, 30 Jun 2013 05:56:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5U5uDDb067154; Sun, 30 Jun 2013 05:56:13 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5U5uDYM067152; Sun, 30 Jun 2013 05:56:13 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201306300556.r5U5uDYM067152@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 30 Jun 2013 05:56:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r252404 - head/sys/dev/bge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 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: Sun, 30 Jun 2013 05:56:14 -0000 Author: yongari Date: Sun Jun 30 05:56:13 2013 New Revision: 252404 URL: http://svnweb.freebsd.org/changeset/base/252404 Log: Fix triggering false watchdog timeout as done in bce(4) when controller is in PAUSE state. Modified: head/sys/dev/bge/if_bge.c head/sys/dev/bge/if_bgereg.h Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Sun Jun 30 05:25:24 2013 (r252403) +++ head/sys/dev/bge/if_bge.c Sun Jun 30 05:56:13 2013 (r252404) @@ -5271,7 +5271,7 @@ bge_start_locked(struct ifnet *ifp) /* * Set a timeout in case the chip goes out to lunch. */ - sc->bge_timer = 5; + sc->bge_timer = BGE_TX_TIMEOUT; } } @@ -5776,12 +5776,40 @@ static void bge_watchdog(struct bge_softc *sc) { struct ifnet *ifp; + uint32_t status; BGE_LOCK_ASSERT(sc); if (sc->bge_timer == 0 || --sc->bge_timer) return; + /* If pause frames are active then don't reset the hardware. */ + if ((CSR_READ_4(sc, BGE_RX_MODE) & BGE_RXMODE_FLOWCTL_ENABLE) != 0) { + status = CSR_READ_4(sc, BGE_RX_STS); + if ((status & BGE_RXSTAT_REMOTE_XOFFED) != 0) { + /* + * If link partner has us in XOFF state then wait for + * the condition to clear. + */ + CSR_WRITE_4(sc, BGE_RX_STS, status); + sc->bge_timer = BGE_TX_TIMEOUT; + return; + } else if ((status & BGE_RXSTAT_RCVD_XOFF) != 0 && + (status & BGE_RXSTAT_RCVD_XON) != 0) { + /* + * If link partner has us in XOFF state then wait for + * the condition to clear. + */ + CSR_WRITE_4(sc, BGE_RX_STS, status); + sc->bge_timer = BGE_TX_TIMEOUT; + return; + } + /* + * Any other condition is unexpected and the controller + * should be reset. + */ + } + ifp = sc->bge_ifp; if_printf(ifp, "watchdog timeout -- resetting\n"); Modified: head/sys/dev/bge/if_bgereg.h ============================================================================== --- head/sys/dev/bge/if_bgereg.h Sun Jun 30 05:25:24 2013 (r252403) +++ head/sys/dev/bge/if_bgereg.h Sun Jun 30 05:56:13 2013 (r252404) @@ -2918,6 +2918,7 @@ struct bge_dmamap_arg { #define BGE_HWREV_TIGON_II 0x02 #define BGE_TIMEOUT 100000 #define BGE_TXCONS_UNSET 0xFFFF /* impossible value */ +#define BGE_TX_TIMEOUT 5 struct bge_bcom_hack { int reg;