From owner-svn-src-head@FreeBSD.ORG Sun Nov 2 16:50:58 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CEA701065677; Sun, 2 Nov 2008 16:50:58 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5FE558FC0C; Sun, 2 Nov 2008 16:50:58 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mA2GowJp043369; Sun, 2 Nov 2008 16:50:58 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mA2GowCr043365; Sun, 2 Nov 2008 16:50:58 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811021650.mA2GowCr043365@svn.freebsd.org> From: Warner Losh Date: Sun, 2 Nov 2008 16:50:58 +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: r184559 - in head/sys: conf modules/rl pci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Nov 2008 16:50:59 -0000 Author: imp Date: Sun Nov 2 16:50:57 2008 New Revision: 184559 URL: http://svn.freebsd.org/changeset/base/184559 Log: Make RL_TWISTER_ENABLE a tunable/sysctl. Eliminate it as an option. Fix module build. Submitted by: Kostik Belousov Modified: head/sys/conf/options head/sys/modules/rl/Makefile head/sys/pci/if_rl.c head/sys/pci/if_rlreg.h Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Sun Nov 2 12:50:16 2008 (r184558) +++ head/sys/conf/options Sun Nov 2 16:50:57 2008 (r184559) @@ -672,9 +672,6 @@ ED_SIC opt_ed.h # bce driver BCE_DEBUG opt_bce.h -# rl driver -RL_TWISTER_ENABLE opt_rl.h - SOCKBUF_DEBUG opt_global.h # options for ubsec driver Modified: head/sys/modules/rl/Makefile ============================================================================== --- head/sys/modules/rl/Makefile Sun Nov 2 12:50:16 2008 (r184558) +++ head/sys/modules/rl/Makefile Sun Nov 2 16:50:57 2008 (r184559) @@ -3,7 +3,7 @@ .PATH: ${.CURDIR}/../../pci KMOD= if_rl -SRCS= if_rl.c device_if.h bus_if.h pci_if.h opt_rl.h +SRCS= if_rl.c device_if.h bus_if.h pci_if.h SRCS+= miibus_if.h .include Modified: head/sys/pci/if_rl.c ============================================================================== --- head/sys/pci/if_rl.c Sun Nov 2 12:50:16 2008 (r184558) +++ head/sys/pci/if_rl.c Sun Nov 2 16:50:57 2008 (r184559) @@ -85,7 +85,6 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_KERNEL_OPTION_HEADERS #include "opt_device_polling.h" -#include "opt_rl.h" #endif #include @@ -97,6 +96,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -801,14 +801,25 @@ rl_attach(device_t dev) struct ifnet *ifp; struct rl_softc *sc; struct rl_type *t; + struct sysctl_ctx_list *ctx; + struct sysctl_oid_list *children; int error = 0, i, rid; int unit; uint16_t rl_did = 0; + char tn[32]; sc = device_get_softc(dev); unit = device_get_unit(dev); sc->rl_dev = dev; + sc->rl_twister_enable = 0; + snprintf(tn, sizeof(tn), "dev.rl.%d.twister_enable", unit); + TUNABLE_INT_FETCH(tn, &sc->rl_twister_enable); + ctx = device_get_sysctl_ctx(sc->rl_dev); + children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->rl_dev)); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "twister_enable", CTLFLAG_RD, + &sc->rl_twister_enable, 0, ""); + mtx_init(&sc->rl_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF); callout_init_mtx(&sc->rl_stat_callout, &sc->rl_mtx, 0); @@ -1384,7 +1395,6 @@ rl_txeof(struct rl_softc *sc) sc->rl_watchdog_timer = 0; } -#ifdef RL_TWISTER_ENABLE static void rl_twister_update(struct rl_softc *sc) { @@ -1483,7 +1493,6 @@ rl_twister_update(struct rl_softc *sc) } } -#endif static void rl_tick(void *xsc) @@ -1506,19 +1515,19 @@ rl_tick(void *xsc) */ mii = device_get_softc(sc->rl_miibus); mii_tick(mii); -#ifdef RL_TWISTER_ENABLE - if (sc->rl_twister == DONE) + if (sc->rl_twister_enable) { + if (sc->rl_twister == DONE) + rl_watchdog(sc); + else + rl_twister_update(sc); + if (sc->rl_twister == DONE) + ticks = hz; + else + ticks = hz / 10; + } else { rl_watchdog(sc); - else - rl_twister_update(sc); - if (sc->rl_twister == DONE) ticks = hz; - else - ticks = hz / 10; -#else - rl_watchdog(sc); - ticks = hz; -#endif + } callout_reset(&sc->rl_stat_callout, ticks, rl_tick, sc); } @@ -1768,14 +1777,15 @@ rl_init_locked(struct rl_softc *sc) rl_stop(sc); rl_reset(sc); -#ifdef RL_TWISTER_ENABLE - /* - * Reset twister register tuning state. The twister registers - * and their tuning are undocumented, but are necessary to cope - * with bad links. rl_twister = DONE here will disable this entirely. - */ - sc->rl_twister = CHK_LINK; -#endif + if (sc->rl_twister_enable) { + /* + * Reset twister register tuning state. The twister + * registers and their tuning are undocumented, but + * are necessary to cope with bad links. rl_twister = + * DONE here will disable this entirely. + */ + sc->rl_twister = CHK_LINK; + } /* * Init our MAC address. Even though the chipset Modified: head/sys/pci/if_rlreg.h ============================================================================== --- head/sys/pci/if_rlreg.h Sun Nov 2 12:50:16 2008 (r184558) +++ head/sys/pci/if_rlreg.h Sun Nov 2 16:50:57 2008 (r184559) @@ -830,9 +830,7 @@ struct rl_list_data { bus_addr_t rl_tx_list_addr; }; -#ifdef RL_TWISTER_ENABLE enum rl_twist { DONE, CHK_LINK, FIND_ROW, SET_PARAM, RECHK_LONG, RETUNE }; -#endif struct rl_softc { struct ifnet *rl_ifp; /* interface info */ @@ -862,11 +860,10 @@ struct rl_softc { uint32_t rl_rxlenmask; int rl_testmode; int rl_if_flags; -#ifdef RL_TWISTER_ENABLE + int rl_twister_enable; enum rl_twist rl_twister; int rl_twist_row; int rl_twist_col; -#endif int suspended; /* 0 = normal 1 = suspended */ #ifdef DEVICE_POLLING int rxcycles;