From owner-svn-src-all@FreeBSD.ORG Sun Mar 13 08:28:21 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 82A13106564A; Sun, 13 Mar 2011 08:28:21 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5608B8FC0C; Sun, 13 Mar 2011 08:28:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p2D8SLp5047009; Sun, 13 Mar 2011 08:28:21 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2D8SLPc047007; Sun, 13 Mar 2011 08:28:21 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201103130828.p2D8SLPc047007@svn.freebsd.org> From: Adrian Chadd Date: Sun, 13 Mar 2011 08:28:21 +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: r219589 - head/sys/mips/atheros 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: Sun, 13 Mar 2011 08:28:21 -0000 Author: adrian Date: Sun Mar 13 08:28:21 2011 New Revision: 219589 URL: http://svn.freebsd.org/changeset/base/219589 Log: Commit FIFO configuration fixes from OpenWRT. This fixes performance issues with if_arge on the AR913x and AR724x. Reference: https://dev.openwrt.org/ticket/6754 Submitted by: Luiz Otavio O Souza Modified: head/sys/mips/atheros/if_arge.c Modified: head/sys/mips/atheros/if_arge.c ============================================================================== --- head/sys/mips/atheros/if_arge.c Sun Mar 13 08:23:59 2011 (r219588) +++ head/sys/mips/atheros/if_arge.c Sun Mar 13 08:28:21 2011 (r219589) @@ -79,6 +79,7 @@ MODULE_DEPEND(arge, miibus, 1, 1, 1); #include #include +#include #include #undef ARGE_DEBUG @@ -400,8 +401,18 @@ arge_attach(device_t dev) ARGE_WRITE(sc, AR71XX_MAC_FIFO_CFG0, FIFO_CFG0_ALL << FIFO_CFG0_ENABLE_SHIFT); - ARGE_WRITE(sc, AR71XX_MAC_FIFO_CFG1, 0x0fff0000); - ARGE_WRITE(sc, AR71XX_MAC_FIFO_CFG2, 0x00001fff); + + switch (ar71xx_soc) { + case AR71XX_SOC_AR7240: + case AR71XX_SOC_AR7241: + case AR71XX_SOC_AR7242: + ARGE_WRITE(sc, AR71XX_MAC_FIFO_CFG1, 0x0010ffff); + ARGE_WRITE(sc, AR71XX_MAC_FIFO_CFG2, 0x015500aa); + break; + default: + ARGE_WRITE(sc, AR71XX_MAC_FIFO_CFG1, 0x0fff0000); + ARGE_WRITE(sc, AR71XX_MAC_FIFO_CFG2, 0x00001fff); + } ARGE_WRITE(sc, AR71XX_MAC_FIFO_RX_FILTMATCH, FIFO_RX_FILTMATCH_DEFAULT); @@ -663,6 +674,7 @@ static void arge_set_pll(struct arge_softc *sc, int media, int duplex) { uint32_t cfg, ifcontrol, rx_filtmask; + uint32_t fifo_tx; int if_speed; cfg = ARGE_READ(sc, AR71XX_MAC_CFG2); @@ -701,13 +713,25 @@ arge_set_pll(struct arge_softc *sc, int "Unknown media %d\n", media); } - ARGE_WRITE(sc, AR71XX_MAC_FIFO_TX_THRESHOLD, - 0x008001ff); + switch (ar71xx_soc) { + case AR71XX_SOC_AR7240: + case AR71XX_SOC_AR7241: + case AR71XX_SOC_AR7242: + fifo_tx = 0x01f00140; + break; + case AR71XX_SOC_AR9130: + case AR71XX_SOC_AR9132: + fifo_tx = 0x00780fff; + break; + default: + fifo_tx = 0x008001ff; + } ARGE_WRITE(sc, AR71XX_MAC_CFG2, cfg); ARGE_WRITE(sc, AR71XX_MAC_IFCONTROL, ifcontrol); ARGE_WRITE(sc, AR71XX_MAC_FIFO_RX_FILTMASK, rx_filtmask); + ARGE_WRITE(sc, AR71XX_MAC_FIFO_TX_THRESHOLD, fifo_tx); /* set PLL registers */ if (sc->arge_mac_unit == 0)