Home | History | Annotate | Line # | Download | only in ic
ath_netbsd.c revision 1.5.2.1
      1  1.5.2.1    yamt /*	$NetBSD: ath_netbsd.c,v 1.5.2.1 2006/02/18 15:39:04 yamt Exp $ */
      2  1.5.2.1    yamt 
      3      1.1  dyoung /*-
      4      1.1  dyoung  * Copyright (c) 2003, 2004 David Young
      5      1.1  dyoung  * All rights reserved.
      6      1.1  dyoung  *
      7      1.1  dyoung  * Redistribution and use in source and binary forms, with or without
      8      1.1  dyoung  * modification, are permitted provided that the following conditions
      9      1.1  dyoung  * are met:
     10      1.1  dyoung  * 1. Redistributions of source code must retain the above copyright
     11      1.1  dyoung  *    notice, this list of conditions and the following disclaimer.
     12      1.1  dyoung  * 2. Redistributions in binary form must reproduce the above copyright
     13      1.1  dyoung  *    notice, this list of conditions and the following disclaimer in the
     14      1.1  dyoung  *    documentation and/or other materials provided with the distribution.
     15      1.1  dyoung  * 3. The name of the author may not be used to endorse or promote products
     16      1.1  dyoung  *    derived from this software without specific prior written permission.
     17      1.1  dyoung  *
     18      1.1  dyoung  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     19      1.1  dyoung  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     20      1.1  dyoung  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     21      1.1  dyoung  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     22      1.1  dyoung  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     23      1.1  dyoung  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     24      1.1  dyoung  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     25      1.1  dyoung  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     26      1.1  dyoung  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     27      1.1  dyoung  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     28      1.1  dyoung  */
     29  1.5.2.1    yamt 
     30  1.5.2.1    yamt #include <sys/cdefs.h>
     31  1.5.2.1    yamt __KERNEL_RCSID(0, "$NetBSD: ath_netbsd.c,v 1.5.2.1 2006/02/18 15:39:04 yamt Exp $");
     32  1.5.2.1    yamt 
     33      1.1  dyoung #include <sys/param.h>
     34      1.1  dyoung #include <sys/types.h>
     35      1.1  dyoung #include <sys/errno.h>
     36      1.1  dyoung #include <sys/systm.h>
     37      1.1  dyoung #include <sys/sysctl.h>
     38      1.1  dyoung #include <sys/mbuf.h>
     39      1.1  dyoung #include <sys/malloc.h>
     40      1.1  dyoung #include <sys/lock.h>
     41      1.1  dyoung #include <sys/kernel.h>
     42      1.1  dyoung #include <sys/socket.h>
     43      1.1  dyoung #include <sys/sockio.h>
     44      1.1  dyoung #include <sys/sysctl.h>
     45      1.1  dyoung #include <sys/callout.h>
     46      1.1  dyoung #include <machine/bus.h>
     47      1.1  dyoung #include <machine/stdarg.h>
     48      1.1  dyoung #include <sys/endian.h>
     49      1.2  martin #include <sys/device.h>
     50      1.1  dyoung 
     51      1.1  dyoung #include <net/if.h>
     52      1.1  dyoung #include <net/if_dl.h>
     53      1.1  dyoung #include <net/if_media.h>
     54      1.1  dyoung #include <net/if_arp.h>
     55      1.1  dyoung #include <net/if_ether.h>
     56      1.1  dyoung #include <net/if_llc.h>
     57      1.1  dyoung 
     58      1.1  dyoung #include <net80211/ieee80211_netbsd.h>
     59      1.1  dyoung #include <net80211/ieee80211_var.h>
     60      1.1  dyoung #include <dev/ic/ath_netbsd.h>
     61      1.1  dyoung #include <dev/ic/athvar.h>
     62      1.3  dyoung 
     63      1.1  dyoung void
     64      1.1  dyoung device_printf(struct device dv, const char *fmt, ...)
     65      1.1  dyoung {
     66      1.1  dyoung         va_list ap;
     67      1.1  dyoung 
     68      1.1  dyoung         va_start(ap, fmt);
     69      1.1  dyoung         printf("%s: ", dv.dv_xname);
     70      1.1  dyoung         vprintf(fmt, ap);
     71      1.1  dyoung         va_end(ap);
     72      1.1  dyoung 	return;
     73      1.1  dyoung }
     74      1.1  dyoung 
     75      1.1  dyoung struct mbuf *
     76      1.1  dyoung m_defrag(struct mbuf *m0, int flags)
     77      1.1  dyoung {
     78      1.1  dyoung 	struct mbuf *m;
     79      1.1  dyoung 	MGETHDR(m, flags, MT_DATA);
     80      1.1  dyoung 	if (m == NULL)
     81      1.1  dyoung 		return NULL;
     82      1.1  dyoung 
     83      1.1  dyoung 	M_COPY_PKTHDR(m, m0);
     84      1.1  dyoung 	MCLGET(m, flags);
     85      1.1  dyoung 	if ((m->m_flags & M_EXT) == 0) {
     86      1.1  dyoung 		m_free(m);
     87      1.1  dyoung 		return NULL;
     88      1.1  dyoung 	}
     89      1.1  dyoung 	m_copydata(m0, 0, m0->m_pkthdr.len, mtod(m, caddr_t));
     90      1.1  dyoung 	m->m_len = m->m_pkthdr.len;
     91      1.1  dyoung 	return m;
     92      1.1  dyoung }
     93      1.1  dyoung 
     94      1.1  dyoung /*
     95      1.1  dyoung  * Setup sysctl(3) MIB, ath.*.
     96      1.1  dyoung  *
     97      1.1  dyoung  * TBD condition CTLFLAG_PERMANENT on being an LKM or not
     98      1.1  dyoung  */
     99      1.1  dyoung SYSCTL_SETUP(sysctl_ath, "sysctl ath subtree setup")
    100      1.1  dyoung {
    101      1.1  dyoung 	int rc;
    102      1.1  dyoung 	const struct sysctlnode *cnode, *rnode;
    103      1.1  dyoung 
    104      1.1  dyoung 	if ((rnode = ath_sysctl_treetop(clog)) == NULL)
    105      1.1  dyoung 		return;
    106      1.1  dyoung 
    107      1.1  dyoung 	if ((rc = SYSCTL_GLOBAL_INT(CTLFLAG_READWRITE, "dwell",
    108      1.1  dyoung 	    "channel dwell time (ms) for AP/station scanning",
    109      1.1  dyoung 	    dwelltime)) != 0)
    110      1.1  dyoung 		goto err;
    111      1.1  dyoung 
    112      1.1  dyoung 	if ((rc = SYSCTL_GLOBAL_INT(CTLFLAG_READWRITE, "calibrate",
    113      1.1  dyoung 	    "chip calibration interval (secs)", calinterval)) != 0)
    114      1.1  dyoung 		goto err;
    115      1.1  dyoung 
    116      1.1  dyoung 	if ((rc = SYSCTL_GLOBAL_INT(CTLFLAG_READWRITE, "outdoor",
    117      1.1  dyoung 	    "outdoor operation", outdoor)) != 0)
    118      1.1  dyoung 		goto err;
    119      1.1  dyoung 
    120      1.1  dyoung 	/* country code */
    121      1.1  dyoung 	if ((rc = SYSCTL_GLOBAL_INT(CTLFLAG_READWRITE,
    122      1.1  dyoung 	    "countrycode", "country code", countrycode)) != 0)
    123      1.1  dyoung 		goto err;
    124      1.1  dyoung 
    125      1.1  dyoung 	/* regulatory domain */
    126      1.1  dyoung 	if ((rc = SYSCTL_GLOBAL_INT(CTLFLAG_READONLY, "regdomain",
    127      1.1  dyoung 	    "regulatory domain", regdomain)) != 0)
    128      1.1  dyoung 		goto err;
    129      1.1  dyoung 
    130      1.1  dyoung 	if ((rc = SYSCTL_GLOBAL_INT(CTLFLAG_READWRITE, "debug",
    131      1.1  dyoung 	    "control debugging printfs", debug)) != 0)
    132      1.1  dyoung 		goto err;
    133      1.1  dyoung 
    134      1.1  dyoung 	return;
    135      1.1  dyoung err:
    136      1.1  dyoung 	printf("%s: sysctl_createv failed (rc = %d)\n", __func__, rc);
    137      1.1  dyoung }
    138      1.1  dyoung 
    139      1.1  dyoung static int
    140      1.1  dyoung ath_sysctl_slottime(SYSCTLFN_ARGS)
    141      1.1  dyoung {
    142      1.1  dyoung 	struct ath_softc *sc;
    143      1.1  dyoung 	struct sysctlnode node;
    144      1.1  dyoung 	u_int slottime;
    145      1.1  dyoung 	int error;
    146      1.1  dyoung 
    147      1.1  dyoung 	node = *rnode;
    148      1.1  dyoung 	sc = (struct ath_softc *)node.sysctl_data;
    149      1.1  dyoung 	slottime = ath_hal_getslottime(sc->sc_ah);
    150      1.1  dyoung 	node.sysctl_data = &slottime;
    151      1.1  dyoung 	error = sysctl_lookup(SYSCTLFN_CALL(&node));
    152      1.1  dyoung 	if (error || newp == NULL)
    153      1.1  dyoung 		return error;
    154      1.1  dyoung 	return !ath_hal_setslottime(sc->sc_ah, slottime) ? EINVAL : 0;
    155      1.1  dyoung }
    156      1.1  dyoung 
    157      1.1  dyoung static int
    158      1.1  dyoung ath_sysctl_acktimeout(SYSCTLFN_ARGS)
    159      1.1  dyoung {
    160      1.1  dyoung 	struct ath_softc *sc;
    161      1.1  dyoung 	struct sysctlnode node;
    162      1.1  dyoung 	u_int acktimeout;
    163      1.1  dyoung 	int error;
    164      1.1  dyoung 
    165      1.1  dyoung 	node = *rnode;
    166      1.1  dyoung 	sc = (struct ath_softc *)node.sysctl_data;
    167      1.1  dyoung 	acktimeout = ath_hal_getacktimeout(sc->sc_ah);
    168      1.1  dyoung 	node.sysctl_data = &acktimeout;
    169      1.1  dyoung 	error = sysctl_lookup(SYSCTLFN_CALL(&node));
    170      1.1  dyoung 	if (error || newp == NULL)
    171      1.1  dyoung 		return error;
    172      1.1  dyoung 	return !ath_hal_setacktimeout(sc->sc_ah, acktimeout) ? EINVAL : 0;
    173      1.1  dyoung }
    174      1.1  dyoung 
    175      1.1  dyoung static int
    176      1.1  dyoung ath_sysctl_ctstimeout(SYSCTLFN_ARGS)
    177      1.1  dyoung {
    178      1.1  dyoung 	struct ath_softc *sc;
    179      1.1  dyoung 	struct sysctlnode node;
    180      1.1  dyoung 	u_int ctstimeout;
    181      1.1  dyoung 	int error;
    182      1.1  dyoung 
    183      1.1  dyoung 	node = *rnode;
    184      1.1  dyoung 	sc = (struct ath_softc *)node.sysctl_data;
    185      1.1  dyoung 	ctstimeout = ath_hal_getctstimeout(sc->sc_ah);
    186      1.1  dyoung 	node.sysctl_data = &ctstimeout;
    187      1.1  dyoung 	error = sysctl_lookup(SYSCTLFN_CALL(&node));
    188      1.1  dyoung 	if (error || newp == NULL)
    189      1.1  dyoung 		return error;
    190      1.1  dyoung 	return !ath_hal_setctstimeout(sc->sc_ah, ctstimeout) ? EINVAL : 0;
    191      1.1  dyoung }
    192      1.1  dyoung 
    193      1.1  dyoung static int
    194      1.1  dyoung ath_sysctl_softled(SYSCTLFN_ARGS)
    195      1.1  dyoung {
    196      1.1  dyoung 	struct ath_softc *sc;
    197      1.1  dyoung 	struct sysctlnode node;
    198      1.1  dyoung 	int softled;
    199      1.1  dyoung 	int error;
    200      1.1  dyoung 
    201      1.1  dyoung 	node = *rnode;
    202      1.1  dyoung 	sc = (struct ath_softc *)node.sysctl_data;
    203      1.1  dyoung 	softled = sc->sc_softled;
    204      1.1  dyoung 	node.sysctl_data = &softled;
    205      1.1  dyoung 	error = sysctl_lookup(SYSCTLFN_CALL(&node));
    206      1.1  dyoung 	if (error || newp == NULL)
    207      1.1  dyoung 		return error;
    208      1.1  dyoung 	softled = (softled != 0);
    209      1.1  dyoung 	if (softled != sc->sc_softled) {
    210      1.1  dyoung 		if (softled) {
    211      1.1  dyoung 			/* NB: handle any sc_ledpin change */
    212      1.1  dyoung 			ath_hal_gpioCfgOutput(sc->sc_ah, sc->sc_ledpin);
    213      1.1  dyoung 			ath_hal_gpioset(sc->sc_ah, sc->sc_ledpin,
    214      1.1  dyoung 				!sc->sc_ledon);
    215      1.1  dyoung 		}
    216      1.1  dyoung 		sc->sc_softled = softled;
    217      1.1  dyoung 	}
    218      1.1  dyoung 	return 0;
    219      1.1  dyoung }
    220      1.1  dyoung 
    221      1.1  dyoung static int
    222      1.1  dyoung ath_sysctl_rxantenna(SYSCTLFN_ARGS)
    223      1.1  dyoung {
    224      1.1  dyoung 	struct ath_softc *sc;
    225      1.1  dyoung 	struct sysctlnode node;
    226      1.1  dyoung 	u_int defantenna;
    227      1.1  dyoung 	int error;
    228      1.1  dyoung 
    229      1.1  dyoung 	node = *rnode;
    230      1.1  dyoung 	sc = (struct ath_softc *)node.sysctl_data;
    231      1.1  dyoung 	defantenna = ath_hal_getdefantenna(sc->sc_ah);
    232      1.1  dyoung 	node.sysctl_data = &defantenna;
    233      1.1  dyoung 	error = sysctl_lookup(SYSCTLFN_CALL(&node));
    234      1.1  dyoung 	if (error || newp == NULL)
    235      1.1  dyoung 		return error;
    236      1.1  dyoung 	ath_hal_setdefantenna(sc->sc_ah, defantenna);
    237      1.1  dyoung 	return 0;
    238      1.1  dyoung }
    239      1.1  dyoung 
    240      1.1  dyoung static int
    241      1.1  dyoung ath_sysctl_diversity(SYSCTLFN_ARGS)
    242      1.1  dyoung {
    243      1.1  dyoung 	struct ath_softc *sc;
    244      1.1  dyoung 	struct sysctlnode node;
    245      1.1  dyoung 	u_int diversity;
    246      1.1  dyoung 	int error;
    247      1.1  dyoung 
    248      1.1  dyoung 	node = *rnode;
    249      1.1  dyoung 	sc = (struct ath_softc *)node.sysctl_data;
    250      1.1  dyoung 	diversity = sc->sc_diversity;
    251      1.1  dyoung 	node.sysctl_data = &diversity;
    252      1.1  dyoung 	error = sysctl_lookup(SYSCTLFN_CALL(&node));
    253      1.1  dyoung 	if (error || newp == NULL)
    254      1.1  dyoung 		return error;
    255      1.1  dyoung 	if (!ath_hal_setdiversity(sc->sc_ah, diversity))
    256      1.1  dyoung 		return EINVAL;
    257      1.1  dyoung 	sc->sc_diversity = diversity;
    258      1.1  dyoung 	return 0;
    259      1.1  dyoung }
    260      1.1  dyoung 
    261      1.1  dyoung static int
    262      1.1  dyoung ath_sysctl_diag(SYSCTLFN_ARGS)
    263      1.1  dyoung {
    264      1.1  dyoung 	struct ath_softc *sc;
    265      1.1  dyoung 	struct sysctlnode node;
    266      1.1  dyoung 	u_int32_t diag;
    267      1.1  dyoung 	int error;
    268      1.1  dyoung 
    269      1.1  dyoung 	node = *rnode;
    270      1.1  dyoung 	sc = (struct ath_softc *)node.sysctl_data;
    271      1.1  dyoung 	if (!ath_hal_getdiag(sc->sc_ah, &diag))
    272      1.1  dyoung 		return EINVAL;
    273      1.1  dyoung 	node.sysctl_data = &diag;
    274      1.1  dyoung 	error = sysctl_lookup(SYSCTLFN_CALL(&node));
    275      1.1  dyoung 	if (error || newp == NULL)
    276      1.1  dyoung 		return error;
    277      1.1  dyoung 	return !ath_hal_setdiag(sc->sc_ah, diag) ? EINVAL : 0;
    278      1.1  dyoung }
    279      1.1  dyoung 
    280      1.1  dyoung static int
    281      1.1  dyoung ath_sysctl_tpscale(SYSCTLFN_ARGS)
    282      1.1  dyoung {
    283      1.1  dyoung 	struct ath_softc *sc;
    284      1.1  dyoung 	struct sysctlnode node;
    285      1.1  dyoung 	u_int32_t scale;
    286      1.1  dyoung 	int error;
    287      1.1  dyoung 
    288      1.1  dyoung 	node = *rnode;
    289      1.1  dyoung 	sc = (struct ath_softc *)node.sysctl_data;
    290      1.1  dyoung 	ath_hal_gettpscale(sc->sc_ah, &scale);
    291      1.1  dyoung 	node.sysctl_data = &scale;
    292      1.1  dyoung 	error = sysctl_lookup(SYSCTLFN_CALL(&node));
    293      1.1  dyoung 	if (error || newp == NULL)
    294      1.1  dyoung 		return error;
    295      1.1  dyoung 	return !ath_hal_settpscale(sc->sc_ah, scale)
    296      1.1  dyoung 	    ? EINVAL
    297      1.1  dyoung 	    : ath_reset(&sc->sc_if);
    298      1.1  dyoung }
    299      1.1  dyoung 
    300      1.1  dyoung static int
    301      1.1  dyoung ath_sysctl_tpc(SYSCTLFN_ARGS)
    302      1.1  dyoung {
    303      1.1  dyoung 	struct ath_softc *sc;
    304      1.1  dyoung 	struct sysctlnode node;
    305      1.1  dyoung 	u_int tpc;
    306      1.1  dyoung 	int error;
    307      1.1  dyoung 
    308      1.1  dyoung 	node = *rnode;
    309      1.1  dyoung 	sc = (struct ath_softc *)node.sysctl_data;
    310      1.1  dyoung 	tpc = ath_hal_gettpc(sc->sc_ah);
    311      1.1  dyoung 	node.sysctl_data = &tpc;
    312      1.1  dyoung 	error = sysctl_lookup(SYSCTLFN_CALL(&node));
    313      1.1  dyoung 	if (error || newp == NULL)
    314      1.1  dyoung 		return error;
    315      1.1  dyoung 	return !ath_hal_settpc(sc->sc_ah, tpc) ? EINVAL : 0;
    316      1.1  dyoung }
    317      1.1  dyoung 
    318      1.4  dyoung const struct sysctlnode *
    319      1.3  dyoung ath_sysctl_instance(const char *dvname, struct sysctllog **log)
    320      1.3  dyoung {
    321      1.3  dyoung 	int rc;
    322      1.3  dyoung 	const struct sysctlnode *rnode;
    323      1.3  dyoung 
    324      1.3  dyoung 	if ((rc = sysctl_createv(log, 0, NULL, &rnode,
    325      1.3  dyoung 	    CTLFLAG_PERMANENT, CTLTYPE_NODE, "hw", NULL,
    326      1.3  dyoung 	    NULL, 0, NULL, 0, CTL_HW, CTL_EOL)) != 0)
    327      1.3  dyoung 		goto err;
    328      1.3  dyoung 
    329      1.3  dyoung 	if ((rc = sysctl_createv(log, 0, &rnode, &rnode,
    330      1.3  dyoung 	    CTLFLAG_PERMANENT, CTLTYPE_NODE, dvname,
    331      1.3  dyoung 	    SYSCTL_DESCR("ath information and options"),
    332      1.3  dyoung 	    NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL)) != 0)
    333      1.3  dyoung 		goto err;
    334      1.3  dyoung 
    335      1.3  dyoung 	return rnode;
    336      1.3  dyoung err:
    337      1.3  dyoung 	printf("%s: sysctl_createv failed, rc = %d\n", __func__, rc);
    338      1.3  dyoung 	return NULL;
    339      1.3  dyoung }
    340      1.3  dyoung 
    341      1.1  dyoung const struct sysctlnode *
    342      1.1  dyoung ath_sysctl_treetop(struct sysctllog **log)
    343      1.1  dyoung {
    344      1.1  dyoung 	int rc;
    345      1.1  dyoung 	const struct sysctlnode *rnode;
    346      1.1  dyoung 
    347      1.1  dyoung 	if ((rc = sysctl_createv(log, 0, NULL, &rnode,
    348      1.1  dyoung 	    CTLFLAG_PERMANENT, CTLTYPE_NODE, "hw", NULL,
    349      1.1  dyoung 	    NULL, 0, NULL, 0, CTL_HW, CTL_EOL)) != 0)
    350      1.1  dyoung 		goto err;
    351      1.1  dyoung 
    352      1.1  dyoung 	if ((rc = sysctl_createv(log, 0, &rnode, &rnode,
    353      1.1  dyoung 	    CTLFLAG_PERMANENT, CTLTYPE_NODE, "ath",
    354      1.1  dyoung 	    SYSCTL_DESCR("ath information and options"),
    355      1.1  dyoung 	    NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL)) != 0)
    356      1.1  dyoung 		goto err;
    357      1.1  dyoung 
    358      1.1  dyoung 	return rnode;
    359      1.1  dyoung err:
    360      1.1  dyoung 	printf("%s: sysctl_createv failed, rc = %d\n", __func__, rc);
    361      1.1  dyoung 	return NULL;
    362      1.1  dyoung }
    363      1.1  dyoung 
    364      1.1  dyoung void
    365      1.1  dyoung ath_sysctlattach(struct ath_softc *sc)
    366      1.1  dyoung {
    367      1.1  dyoung 	int rc;
    368      1.1  dyoung 	struct sysctllog **log = &sc->sc_sysctllog;
    369      1.1  dyoung 	const struct sysctlnode *cnode, *rnode;
    370      1.1  dyoung 
    371      1.1  dyoung 	ath_hal_getcountrycode(sc->sc_ah, &sc->sc_countrycode);
    372      1.1  dyoung 	ath_hal_getregdomain(sc->sc_ah, &sc->sc_regdomain);
    373      1.1  dyoung 	sc->sc_debug = ath_debug;
    374      1.1  dyoung 	sc->sc_txintrperiod = ATH_TXINTR_PERIOD;
    375      1.1  dyoung 
    376      1.3  dyoung 	if ((rnode = ath_sysctl_instance(sc->sc_dev.dv_xname, log)) == NULL)
    377      1.1  dyoung 		return;
    378      1.1  dyoung 
    379      1.1  dyoung 	if ((rc = SYSCTL_INT(0, countrycode, "EEPROM country code")) != 0)
    380      1.1  dyoung 		goto err;
    381      1.1  dyoung 
    382      1.1  dyoung 	if ((rc = SYSCTL_INT(0, regdomain, "EEPROM regdomain code")) != 0)
    383      1.1  dyoung 		goto err;
    384      1.1  dyoung 
    385      1.1  dyoung 	if ((rc = SYSCTL_INT(CTLFLAG_READWRITE, debug,
    386      1.1  dyoung 	    "control debugging printfs")) != 0)
    387      1.1  dyoung 		goto err;
    388      1.1  dyoung 
    389      1.1  dyoung #if 0
    390      1.1  dyoung 	/* channel dwell time (ms) for AP/station scanning */
    391      1.1  dyoung 	if ((rc = SYSCTL_INT(CTLFLAG_READWRITE, dwell,
    392      1.1  dyoung 	    "Channel dwell time (ms) for scanning")) != 0)
    393      1.1  dyoung 		goto err;
    394      1.1  dyoung #endif
    395      1.1  dyoung 
    396      1.1  dyoung 	if ((rc = SYSCTL_INT_SUBR(CTLFLAG_READWRITE, slottime,
    397      1.1  dyoung 	    "802.11 slot time (us)")) != 0)
    398      1.1  dyoung 		goto err;
    399      1.1  dyoung 	if ((rc = SYSCTL_INT_SUBR(CTLFLAG_READWRITE, acktimeout,
    400      1.1  dyoung 	    "802.11 ACK timeout (us)")) != 0)
    401      1.1  dyoung 		goto err;
    402      1.1  dyoung 	if ((rc = SYSCTL_INT_SUBR(CTLFLAG_READWRITE, ctstimeout,
    403      1.1  dyoung 	    "802.11 CTS timeout (us)")) != 0)
    404      1.1  dyoung 		goto err;
    405      1.1  dyoung 	if ((rc = SYSCTL_INT_SUBR(CTLFLAG_READWRITE, softled,
    406      1.1  dyoung 	    "enable/disable software LED support")) != 0)
    407      1.1  dyoung 		goto err;
    408      1.1  dyoung 	if ((rc = SYSCTL_INT(CTLFLAG_READWRITE, ledpin,
    409      1.1  dyoung 	    "GPIO pin connected to LED")) != 0)
    410      1.1  dyoung 		goto err;
    411      1.1  dyoung 	if ((rc = SYSCTL_INT(CTLFLAG_READWRITE, ledon,
    412      1.1  dyoung 	    "setting to turn LED on")) != 0)
    413      1.1  dyoung 		goto err;
    414      1.1  dyoung 	if ((rc = SYSCTL_INT(CTLFLAG_READWRITE, ledidle,
    415      1.1  dyoung 	    "idle time for inactivity LED (ticks)")) != 0)
    416      1.1  dyoung 		goto err;
    417      1.1  dyoung 	if ((rc = SYSCTL_INT(CTLFLAG_READWRITE, txantenna,
    418      1.1  dyoung 	    "tx antenna (0=auto)")) != 0)
    419      1.1  dyoung 		goto err;
    420      1.1  dyoung 	if ((rc = SYSCTL_INT_SUBR(CTLFLAG_READWRITE, rxantenna,
    421      1.1  dyoung 	    "default/rx antenna")) != 0)
    422      1.1  dyoung 		goto err;
    423      1.5   skrll 	if (ath_hal_hasdiversity(sc->sc_ah)) {
    424      1.1  dyoung 		if ((rc = SYSCTL_INT_SUBR(CTLFLAG_READWRITE, diversity,
    425      1.1  dyoung 		    "antenna diversity")) != 0)
    426      1.1  dyoung 			goto err;
    427      1.1  dyoung 	}
    428      1.1  dyoung 	if ((rc = SYSCTL_INT(CTLFLAG_READWRITE, txintrperiod,
    429      1.1  dyoung 	    "tx descriptor batching")) != 0)
    430      1.1  dyoung 		goto err;
    431      1.1  dyoung 	if ((rc = SYSCTL_INT_SUBR(CTLFLAG_READWRITE, diag,
    432      1.1  dyoung 	    "h/w diagnostic control")) != 0)
    433      1.1  dyoung 		goto err;
    434      1.1  dyoung 	if ((rc = SYSCTL_INT_SUBR(CTLFLAG_READWRITE, tpscale,
    435      1.1  dyoung 	    "tx power scaling")) != 0)
    436      1.1  dyoung 		goto err;
    437      1.5   skrll 	if (ath_hal_hastpc(sc->sc_ah)) {
    438      1.1  dyoung 		if ((rc = SYSCTL_INT_SUBR(CTLFLAG_READWRITE, tpc,
    439      1.1  dyoung 		    "enable/disable per-packet TPC")) != 0)
    440      1.1  dyoung 			goto err;
    441      1.1  dyoung 	}
    442      1.1  dyoung 	return;
    443      1.1  dyoung err:
    444      1.1  dyoung 	printf("%s: sysctl_createv failed, rc = %d\n", __func__, rc);
    445      1.1  dyoung }
    446