diff options
author | imp <imp@FreeBSD.org> | 2008-11-02 16:50:57 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2008-11-02 16:50:57 +0000 |
commit | 0beb2d81e4580fa6e05fafcc0418afdb96eb88c0 (patch) | |
tree | 7f4085b96195aab3aa8ffb4518e21aad5e8e2dee /sys | |
parent | ba374a2c728b61a2fe09ab45f2f870f80ec08e70 (diff) | |
download | FreeBSD-src-0beb2d81e4580fa6e05fafcc0418afdb96eb88c0.zip FreeBSD-src-0beb2d81e4580fa6e05fafcc0418afdb96eb88c0.tar.gz |
Make RL_TWISTER_ENABLE a tunable/sysctl. Eliminate it as an option.
Fix module build.
Submitted by: Kostik Belousov
Diffstat (limited to 'sys')
-rw-r--r-- | sys/conf/options | 3 | ||||
-rw-r--r-- | sys/modules/rl/Makefile | 2 | ||||
-rw-r--r-- | sys/pci/if_rl.c | 54 | ||||
-rw-r--r-- | sys/pci/if_rlreg.h | 5 |
4 files changed, 34 insertions, 30 deletions
diff --git a/sys/conf/options b/sys/conf/options index 137745b..0823c82 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -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 diff --git a/sys/modules/rl/Makefile b/sys/modules/rl/Makefile index c0323f9..e846579 100644 --- a/sys/modules/rl/Makefile +++ b/sys/modules/rl/Makefile @@ -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 <bsd.kmod.mk> diff --git a/sys/pci/if_rl.c b/sys/pci/if_rl.c index 0daea77..5ddf9a4 100644 --- a/sys/pci/if_rl.c +++ b/sys/pci/if_rl.c @@ -85,7 +85,6 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_KERNEL_OPTION_HEADERS #include "opt_device_polling.h" -#include "opt_rl.h" #endif #include <sys/param.h> @@ -97,6 +96,7 @@ __FBSDID("$FreeBSD$"); #include <sys/kernel.h> #include <sys/module.h> #include <sys/socket.h> +#include <sys/sysctl.h> #include <net/if.h> #include <net/if_arp.h> @@ -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 diff --git a/sys/pci/if_rlreg.h b/sys/pci/if_rlreg.h index f33eaed..fb17ac7 100644 --- a/sys/pci/if_rlreg.h +++ b/sys/pci/if_rlreg.h @@ -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; |