2 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer,
10 * without modification.
11 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12 * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
13 * redistribution must be conditioned upon including a substantially
14 * similar Disclaimer requirement for further binary redistribution.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
20 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
22 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27 * THE POSSIBILITY OF SUCH DAMAGES.
30 #include <sys/cdefs.h>
33 * Driver for the Atheros Wireless LAN controller.
35 * This software is derived from work of Atsushi Onoe; his contribution
36 * is greatly appreciated.
43 #include <sys/param.h>
44 #include <sys/systm.h>
45 #include <sys/sysctl.h>
47 #include <sys/malloc.h>
49 #include <sys/mutex.h>
50 #include <sys/kernel.h>
51 #include <sys/socket.h>
52 #include <sys/sockio.h>
53 #include <sys/errno.h>
54 #include <sys/callout.h>
56 #include <sys/endian.h>
57 #include <sys/kthread.h>
58 #include <sys/taskqueue.h>
62 #include <net/if_var.h>
63 #include <net/if_dl.h>
64 #include <net/if_media.h>
65 #include <net/if_types.h>
66 #include <net/if_arp.h>
67 #include <net/ethernet.h>
68 #include <net/if_llc.h>
70 #include <netproto/802_11/ieee80211_var.h>
71 #include <netproto/802_11/ieee80211_regdomain.h>
72 #ifdef IEEE80211_SUPPORT_SUPERG
73 #include <netproto/802_11/ieee80211_superg.h>
75 #ifdef IEEE80211_SUPPORT_TDMA
76 #include <netproto/802_11/ieee80211_tdma.h>
82 #include <netinet/in.h>
83 #include <netinet/if_ether.h>
86 #include <dev/netif/ath/ath/if_athvar.h>
87 #include <dev/netif/ath/ath_hal/ah_devid.h> /* XXX for softled */
88 #include <dev/netif/ath/ath_hal/ah_diagcodes.h>
90 #include <dev/netif/ath/ath/if_ath_debug.h>
91 #include <dev/netif/ath/ath/if_ath_led.h>
92 #include <dev/netif/ath/ath/if_ath_misc.h>
93 #include <dev/netif/ath/ath/if_ath_tx.h>
94 #include <dev/netif/ath/ath/if_ath_sysctl.h>
97 #include <dev/netif/ath/ath_tx99/ath_tx99.h>
101 #include <dev/netif/ath/ath/if_ath_alq.h>
105 ath_sysctl_slottime(SYSCTL_HANDLER_ARGS)
107 struct ath_softc *sc = arg1;
108 u_int slottime = ath_hal_getslottime(sc->sc_ah);
111 error = sysctl_handle_int(oidp, &slottime, 0, req);
112 if (error || !req->newptr)
114 return !ath_hal_setslottime(sc->sc_ah, slottime) ? EINVAL : 0;
118 ath_sysctl_acktimeout(SYSCTL_HANDLER_ARGS)
120 struct ath_softc *sc = arg1;
121 u_int acktimeout = ath_hal_getacktimeout(sc->sc_ah);
124 error = sysctl_handle_int(oidp, &acktimeout, 0, req);
125 if (error || !req->newptr)
127 return !ath_hal_setacktimeout(sc->sc_ah, acktimeout) ? EINVAL : 0;
131 ath_sysctl_ctstimeout(SYSCTL_HANDLER_ARGS)
133 struct ath_softc *sc = arg1;
134 u_int ctstimeout = ath_hal_getctstimeout(sc->sc_ah);
137 error = sysctl_handle_int(oidp, &ctstimeout, 0, req);
138 if (error || !req->newptr)
140 return !ath_hal_setctstimeout(sc->sc_ah, ctstimeout) ? EINVAL : 0;
144 ath_sysctl_softled(SYSCTL_HANDLER_ARGS)
146 struct ath_softc *sc = arg1;
147 int softled = sc->sc_softled;
150 error = sysctl_handle_int(oidp, &softled, 0, req);
151 if (error || !req->newptr)
153 softled = (softled != 0);
154 if (softled != sc->sc_softled) {
156 /* NB: handle any sc_ledpin change */
159 sc->sc_softled = softled;
165 ath_sysctl_ledpin(SYSCTL_HANDLER_ARGS)
167 struct ath_softc *sc = arg1;
168 int ledpin = sc->sc_ledpin;
171 error = sysctl_handle_int(oidp, &ledpin, 0, req);
172 if (error || !req->newptr)
174 if (ledpin != sc->sc_ledpin) {
175 sc->sc_ledpin = ledpin;
176 if (sc->sc_softled) {
184 ath_sysctl_hardled(SYSCTL_HANDLER_ARGS)
186 struct ath_softc *sc = arg1;
187 int hardled = sc->sc_hardled;
190 error = sysctl_handle_int(oidp, &hardled, 0, req);
191 if (error || !req->newptr)
193 hardled = (hardled != 0);
194 if (hardled != sc->sc_hardled) {
196 /* NB: handle any sc_ledpin change */
199 sc->sc_hardled = hardled;
205 ath_sysctl_txantenna(SYSCTL_HANDLER_ARGS)
207 struct ath_softc *sc = arg1;
208 u_int txantenna = ath_hal_getantennaswitch(sc->sc_ah);
211 error = sysctl_handle_int(oidp, &txantenna, 0, req);
212 if (!error && req->newptr) {
213 /* XXX assumes 2 antenna ports */
214 if (txantenna < HAL_ANT_VARIABLE || txantenna > HAL_ANT_FIXED_B)
216 ath_hal_setantennaswitch(sc->sc_ah, txantenna);
218 * NB: with the switch locked this isn't meaningful,
219 * but set it anyway so things like radiotap get
220 * consistent info in their data.
222 sc->sc_txantenna = txantenna;
228 ath_sysctl_rxantenna(SYSCTL_HANDLER_ARGS)
230 struct ath_softc *sc = arg1;
231 u_int defantenna = ath_hal_getdefantenna(sc->sc_ah);
234 error = sysctl_handle_int(oidp, &defantenna, 0, req);
235 if (!error && req->newptr)
236 ath_hal_setdefantenna(sc->sc_ah, defantenna);
241 ath_sysctl_diversity(SYSCTL_HANDLER_ARGS)
243 struct ath_softc *sc = arg1;
244 u_int diversity = ath_hal_getdiversity(sc->sc_ah);
247 error = sysctl_handle_int(oidp, &diversity, 0, req);
248 if (error || !req->newptr)
250 if (!ath_hal_setdiversity(sc->sc_ah, diversity))
252 sc->sc_diversity = diversity;
257 ath_sysctl_diag(SYSCTL_HANDLER_ARGS)
259 struct ath_softc *sc = arg1;
263 if (!ath_hal_getdiag(sc->sc_ah, &diag))
265 error = sysctl_handle_int(oidp, &diag, 0, req);
266 if (error || !req->newptr)
268 return !ath_hal_setdiag(sc->sc_ah, diag) ? EINVAL : 0;
272 ath_sysctl_tpscale(SYSCTL_HANDLER_ARGS)
274 struct ath_softc *sc = arg1;
275 struct ifnet *ifp = sc->sc_ifp;
279 (void) ath_hal_gettpscale(sc->sc_ah, &scale);
280 error = sysctl_handle_int(oidp, &scale, 0, req);
281 if (error || !req->newptr)
283 return !ath_hal_settpscale(sc->sc_ah, scale) ? EINVAL :
284 (ifp->if_drv_flags & IFF_DRV_RUNNING) ?
285 ath_reset(ifp, ATH_RESET_NOLOSS) : 0;
289 ath_sysctl_tpc(SYSCTL_HANDLER_ARGS)
291 struct ath_softc *sc = arg1;
292 u_int tpc = ath_hal_gettpc(sc->sc_ah);
295 error = sysctl_handle_int(oidp, &tpc, 0, req);
296 if (error || !req->newptr)
298 return !ath_hal_settpc(sc->sc_ah, tpc) ? EINVAL : 0;
302 ath_sysctl_rfkill(SYSCTL_HANDLER_ARGS)
304 struct ath_softc *sc = arg1;
305 struct ifnet *ifp = sc->sc_ifp;
306 struct ath_hal *ah = sc->sc_ah;
307 u_int rfkill = ath_hal_getrfkill(ah);
310 error = sysctl_handle_int(oidp, &rfkill, 0, req);
311 if (error || !req->newptr)
313 if (rfkill == ath_hal_getrfkill(ah)) /* unchanged */
315 if (!ath_hal_setrfkill(ah, rfkill))
317 return (ifp->if_drv_flags & IFF_DRV_RUNNING) ?
318 ath_reset(ifp, ATH_RESET_FULL) : 0;
322 ath_sysctl_txagg(SYSCTL_HANDLER_ARGS)
324 struct ath_softc *sc = arg1;
329 error = sysctl_handle_int(oidp, ¶m, 0, req);
330 if (error || !req->newptr)
336 printf("no tx bufs (empty list): %d\n", sc->sc_stats.ast_tx_getnobuf);
337 printf("no tx bufs (was busy): %d\n", sc->sc_stats.ast_tx_getbusybuf);
339 printf("aggr single packet: %d\n",
340 sc->sc_aggr_stats.aggr_single_pkt);
341 printf("aggr single packet w/ BAW closed: %d\n",
342 sc->sc_aggr_stats.aggr_baw_closed_single_pkt);
343 printf("aggr non-baw packet: %d\n",
344 sc->sc_aggr_stats.aggr_nonbaw_pkt);
345 printf("aggr aggregate packet: %d\n",
346 sc->sc_aggr_stats.aggr_aggr_pkt);
347 printf("aggr single packet low hwq: %d\n",
348 sc->sc_aggr_stats.aggr_low_hwq_single_pkt);
349 printf("aggr single packet RTS aggr limited: %d\n",
350 sc->sc_aggr_stats.aggr_rts_aggr_limited);
351 printf("aggr sched, no work: %d\n",
352 sc->sc_aggr_stats.aggr_sched_nopkt);
353 for (i = 0; i < 64; i++) {
354 printf("%2d: %10d ", i, sc->sc_aggr_stats.aggr_pkts[i]);
360 for (i = 0; i < HAL_NUM_TX_QUEUES; i++) {
361 if (ATH_TXQ_SETUP(sc, i)) {
362 printf("HW TXQ %d: axq_depth=%d, axq_aggr_depth=%d, "
363 "axq_fifo_depth=%d, holdingbf=%p\n",
365 sc->sc_txq[i].axq_depth,
366 sc->sc_txq[i].axq_aggr_depth,
367 sc->sc_txq[i].axq_fifo_depth,
368 sc->sc_txq[i].axq_holdingbf);
374 TAILQ_FOREACH(bf, &sc->sc_txbuf, bf_list) {
375 if (bf->bf_flags & ATH_BUF_BUSY) {
376 printf("Busy: %d\n", t);
381 ATH_TXBUF_UNLOCK(sc);
382 printf("Total TX buffers: %d; Total TX buffers busy: %d (%d)\n",
383 t, i, sc->sc_txbuf_cnt);
387 TAILQ_FOREACH(bf, &sc->sc_txbuf_mgmt, bf_list) {
388 if (bf->bf_flags & ATH_BUF_BUSY) {
389 printf("Busy: %d\n", t);
394 ATH_TXBUF_UNLOCK(sc);
395 printf("Total mgmt TX buffers: %d; Total mgmt TX buffers busy: %d\n",
399 for (i = 0; i < 2; i++) {
400 printf("%d: fifolen: %d/%d; head=%d; tail=%d\n",
402 sc->sc_rxedma[i].m_fifo_depth,
403 sc->sc_rxedma[i].m_fifolen,
404 sc->sc_rxedma[i].m_fifo_head,
405 sc->sc_rxedma[i].m_fifo_tail);
408 TAILQ_FOREACH(bf, &sc->sc_rxbuf, bf_list) {
411 printf("Total RX buffers in free list: %d buffers\n",
419 ath_sysctl_rfsilent(SYSCTL_HANDLER_ARGS)
421 struct ath_softc *sc = arg1;
425 (void) ath_hal_getrfsilent(sc->sc_ah, &rfsilent);
426 error = sysctl_handle_int(oidp, &rfsilent, 0, req);
427 if (error || !req->newptr)
429 if (!ath_hal_setrfsilent(sc->sc_ah, rfsilent))
431 sc->sc_rfsilentpin = rfsilent & 0x1c;
432 sc->sc_rfsilentpol = (rfsilent & 0x2) != 0;
437 ath_sysctl_tpack(SYSCTL_HANDLER_ARGS)
439 struct ath_softc *sc = arg1;
443 (void) ath_hal_gettpack(sc->sc_ah, &tpack);
444 error = sysctl_handle_int(oidp, &tpack, 0, req);
445 if (error || !req->newptr)
447 return !ath_hal_settpack(sc->sc_ah, tpack) ? EINVAL : 0;
451 ath_sysctl_tpcts(SYSCTL_HANDLER_ARGS)
453 struct ath_softc *sc = arg1;
457 (void) ath_hal_gettpcts(sc->sc_ah, &tpcts);
458 error = sysctl_handle_int(oidp, &tpcts, 0, req);
459 if (error || !req->newptr)
461 return !ath_hal_settpcts(sc->sc_ah, tpcts) ? EINVAL : 0;
465 ath_sysctl_intmit(SYSCTL_HANDLER_ARGS)
467 struct ath_softc *sc = arg1;
470 intmit = ath_hal_getintmit(sc->sc_ah);
471 error = sysctl_handle_int(oidp, &intmit, 0, req);
472 if (error || !req->newptr)
475 /* reusing error; 1 here means "good"; 0 means "fail" */
476 error = ath_hal_setintmit(sc->sc_ah, intmit);
481 * Reset the hardware here - disabling ANI in the HAL
482 * doesn't reset ANI related registers, so it'll leave
483 * things in an inconsistent state.
485 if (sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING)
486 ath_reset(sc->sc_ifp, ATH_RESET_NOLOSS);
491 #ifdef IEEE80211_SUPPORT_TDMA
493 ath_sysctl_setcca(SYSCTL_HANDLER_ARGS)
495 struct ath_softc *sc = arg1;
498 setcca = sc->sc_setcca;
499 error = sysctl_handle_int(oidp, &setcca, 0, req);
500 if (error || !req->newptr)
502 sc->sc_setcca = (setcca != 0);
505 #endif /* IEEE80211_SUPPORT_TDMA */
508 ath_sysctl_forcebstuck(SYSCTL_HANDLER_ARGS)
510 struct ath_softc *sc = arg1;
514 error = sysctl_handle_int(oidp, &val, 0, req);
515 if (error || !req->newptr)
520 taskqueue_enqueue_fast(sc->sc_tq, &sc->sc_bstucktask);
526 ath_sysctl_hangcheck(SYSCTL_HANDLER_ARGS)
528 struct ath_softc *sc = arg1;
531 uint32_t mask = 0xffffffff;
534 struct ath_hal *ah = sc->sc_ah;
536 error = sysctl_handle_int(oidp, &val, 0, req);
537 if (error || !req->newptr)
542 /* Do a hang check */
543 if (!ath_hal_getdiagstate(ah, HAL_DIAG_CHECK_HANGS,
545 (void *) &sp, &rsize))
547 device_printf(sc->sc_dev, "%s: sp=0x%08x\n", __func__, *sp);
555 ath_sysctl_alq_log(SYSCTL_HANDLER_ARGS)
557 struct ath_softc *sc = arg1;
560 enable = (sc->sc_alq.sc_alq_isactive);
562 error = sysctl_handle_int(oidp, &enable, 0, req);
563 if (error || !req->newptr)
566 error = if_ath_alq_start(&sc->sc_alq);
568 error = if_ath_alq_stop(&sc->sc_alq);
573 * Attach the ALQ debugging if required.
576 ath_sysctl_alq_attach(struct ath_softc *sc)
578 struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev);
579 struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev);
580 struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree);
582 tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "alq", CTLFLAG_RD,
583 NULL, "Atheros ALQ logging parameters");
584 child = SYSCTL_CHILDREN(tree);
586 SYSCTL_ADD_STRING(ctx, child, OID_AUTO, "filename",
587 CTLFLAG_RW, sc->sc_alq.sc_alq_filename, 0, "ALQ filename");
589 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
590 "enable", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
591 ath_sysctl_alq_log, "I", "");
593 SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
594 "debugmask", CTLFLAG_RW, &sc->sc_alq.sc_alq_debug, 0,
597 SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
598 "numlost", CTLFLAG_RW, &sc->sc_alq.sc_alq_numlost, 0,
601 #endif /* ATH_DEBUG_ALQ */
604 ath_sysctlattach(struct ath_softc *sc)
606 struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev);
607 struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev);
608 struct ath_hal *ah = sc->sc_ah;
610 SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
611 "countrycode", CTLFLAG_RD, &sc->sc_eecc, 0,
612 "EEPROM country code");
613 SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
614 "regdomain", CTLFLAG_RD, &sc->sc_eerd, 0,
615 "EEPROM regdomain code");
617 SYSCTL_ADD_QUAD(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
618 "debug", CTLFLAG_RW, &sc->sc_debug,
619 "control debugging printfs");
622 SYSCTL_ADD_QUAD(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
623 "ktrdebug", CTLFLAG_RW, &sc->sc_ktrdebug,
624 "control debugging KTR");
625 #endif /* ATH_DEBUG_ALQ */
626 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
627 "slottime", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
628 ath_sysctl_slottime, "I", "802.11 slot time (us)");
629 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
630 "acktimeout", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
631 ath_sysctl_acktimeout, "I", "802.11 ACK timeout (us)");
632 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
633 "ctstimeout", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
634 ath_sysctl_ctstimeout, "I", "802.11 CTS timeout (us)");
636 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
637 "softled", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
638 ath_sysctl_softled, "I", "enable/disable software LED support");
639 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
640 "ledpin", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
641 ath_sysctl_ledpin, "I", "GPIO pin connected to LED");
642 SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
643 "ledon", CTLFLAG_RW, &sc->sc_ledon, 0,
644 "setting to turn LED on");
645 SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
646 "ledidle", CTLFLAG_RW, &sc->sc_ledidle, 0,
647 "idle time for inactivity LED (ticks)");
649 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
650 "hardled", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
651 ath_sysctl_hardled, "I", "enable/disable hardware LED support");
652 /* XXX Laziness - configure pins, then flip hardled off/on */
653 SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
654 "led_net_pin", CTLFLAG_RW, &sc->sc_led_net_pin, 0,
655 "MAC Network LED pin, or -1 to disable");
656 SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
657 "led_pwr_pin", CTLFLAG_RW, &sc->sc_led_pwr_pin, 0,
658 "MAC Power LED pin, or -1 to disable");
660 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
661 "txantenna", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
662 ath_sysctl_txantenna, "I", "antenna switch");
663 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
664 "rxantenna", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
665 ath_sysctl_rxantenna, "I", "default/rx antenna");
666 if (ath_hal_hasdiversity(ah))
667 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
668 "diversity", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
669 ath_sysctl_diversity, "I", "antenna diversity");
670 sc->sc_txintrperiod = ATH_TXINTR_PERIOD;
671 SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
672 "txintrperiod", CTLFLAG_RW, &sc->sc_txintrperiod, 0,
673 "tx descriptor batching");
674 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
675 "diag", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
676 ath_sysctl_diag, "I", "h/w diagnostic control");
677 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
678 "tpscale", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
679 ath_sysctl_tpscale, "I", "tx power scaling");
680 if (ath_hal_hastpc(ah)) {
681 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
682 "tpc", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
683 ath_sysctl_tpc, "I", "enable/disable per-packet TPC");
684 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
685 "tpack", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
686 ath_sysctl_tpack, "I", "tx power for ack frames");
687 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
688 "tpcts", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
689 ath_sysctl_tpcts, "I", "tx power for cts frames");
691 if (ath_hal_hasrfsilent(ah)) {
692 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
693 "rfsilent", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
694 ath_sysctl_rfsilent, "I", "h/w RF silent config");
695 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
696 "rfkill", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
697 ath_sysctl_rfkill, "I", "enable/disable RF kill switch");
700 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
701 "txagg", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
702 ath_sysctl_txagg, "I", "");
704 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
705 "forcebstuck", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
706 ath_sysctl_forcebstuck, "I", "");
708 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
709 "hangcheck", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
710 ath_sysctl_hangcheck, "I", "");
712 if (ath_hal_hasintmit(ah)) {
713 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
714 "intmit", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
715 ath_sysctl_intmit, "I", "interference mitigation");
717 sc->sc_monpass = HAL_RXERR_DECRYPT | HAL_RXERR_MIC;
718 SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
719 "monpass", CTLFLAG_RW, &sc->sc_monpass, 0,
720 "mask of error frames to pass when monitoring");
722 SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
723 "hwq_limit_nonaggr", CTLFLAG_RW, &sc->sc_hwq_limit_nonaggr, 0,
724 "Hardware non-AMPDU queue depth before software-queuing TX frames");
725 SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
726 "hwq_limit_aggr", CTLFLAG_RW, &sc->sc_hwq_limit_aggr, 0,
727 "Hardware AMPDU queue depth before software-queuing TX frames");
728 SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
729 "tid_hwq_lo", CTLFLAG_RW, &sc->sc_tid_hwq_lo, 0,
731 SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
732 "tid_hwq_hi", CTLFLAG_RW, &sc->sc_tid_hwq_hi, 0,
735 /* Aggregate length twiddles */
736 SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
737 "aggr_limit", CTLFLAG_RW, &sc->sc_aggr_limit, 0,
738 "Maximum A-MPDU size, or 0 for 'default'");
739 SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
740 "rts_aggr_limit", CTLFLAG_RW, &sc->sc_rts_aggr_limit, 0,
741 "Maximum A-MPDU size for RTS-protected frames, or '0' "
743 SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
744 "delim_min_pad", CTLFLAG_RW, &sc->sc_delim_min_pad, 0,
745 "Enforce a minimum number of delimiters per A-MPDU "
748 SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
749 "txq_data_minfree", CTLFLAG_RW, &sc->sc_txq_data_minfree,
750 0, "Minimum free buffers before adding a data frame"
752 SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
753 "txq_mcastq_maxdepth", CTLFLAG_RW,
754 &sc->sc_txq_mcastq_maxdepth, 0,
755 "Maximum buffer depth for multicast/broadcast frames");
756 SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
757 "txq_node_maxdepth", CTLFLAG_RW,
758 &sc->sc_txq_node_maxdepth, 0,
759 "Maximum buffer depth for a single node");
762 SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
763 "cabq_enable", CTLFLAG_RW,
764 &sc->sc_cabq_enable, 0,
765 "Whether to transmit on the CABQ or not");
768 #ifdef IEEE80211_SUPPORT_TDMA
769 if (ath_hal_macversion(ah) > 0x78) {
770 sc->sc_tdmadbaprep = 2;
771 SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
772 "dbaprep", CTLFLAG_RW, &sc->sc_tdmadbaprep, 0,
773 "TDMA DBA preparation time");
774 sc->sc_tdmaswbaprep = 10;
775 SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
776 "swbaprep", CTLFLAG_RW, &sc->sc_tdmaswbaprep, 0,
777 "TDMA SWBA preparation time");
778 SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
779 "guardtime", CTLFLAG_RW, &sc->sc_tdmaguard, 0,
780 "TDMA slot guard time");
781 SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
782 "superframe", CTLFLAG_RD, &sc->sc_tdmabintval, 0,
783 "TDMA calculated super frame");
784 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
785 "setcca", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
786 ath_sysctl_setcca, "I", "enable CCA control");
791 ath_sysctl_alq_attach(sc);
796 ath_sysctl_clearstats(SYSCTL_HANDLER_ARGS)
798 struct ath_softc *sc = arg1;
802 error = sysctl_handle_int(oidp, &val, 0, req);
803 if (error || !req->newptr)
806 return 0; /* Not clearing the stats is still valid */
807 memset(&sc->sc_stats, 0, sizeof(sc->sc_stats));
808 memset(&sc->sc_aggr_stats, 0, sizeof(sc->sc_aggr_stats));
809 memset(&sc->sc_intr_stats, 0, sizeof(sc->sc_intr_stats));
816 ath_sysctl_stats_attach_rxphyerr(struct ath_softc *sc, struct sysctl_oid_list *parent)
818 struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev);
819 struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev);
820 struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree);
824 tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "rx_phy_err", CTLFLAG_RD, NULL, "Per-code RX PHY Errors");
825 child = SYSCTL_CHILDREN(tree);
826 for (i = 0; i < 64; i++) {
827 snprintf(sn, sizeof(sn), "%d", i);
828 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, sn, CTLFLAG_RD, &sc->sc_stats.ast_rx_phy[i], 0, "");
833 ath_sysctl_stats_attach_intr(struct ath_softc *sc,
834 struct sysctl_oid_list *parent)
836 struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev);
837 struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev);
838 struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree);
842 tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "sync_intr",
843 CTLFLAG_RD, NULL, "Sync interrupt statistics");
844 child = SYSCTL_CHILDREN(tree);
845 for (i = 0; i < 32; i++) {
846 snprintf(sn, sizeof(sn), "%d", i);
847 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, sn, CTLFLAG_RD,
848 &sc->sc_intr_stats.sync_intr[i], 0, "");
853 ath_sysctl_stats_attach(struct ath_softc *sc)
855 struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev);
856 struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev);
857 struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree);
859 /* Create "clear" node */
860 SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
861 "clear_stats", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
862 ath_sysctl_clearstats, "I", "clear stats");
864 /* Create stats node */
865 tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "stats", CTLFLAG_RD,
867 child = SYSCTL_CHILDREN(tree);
869 /* This was generated from if_athioctl.h */
871 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_watchdog", CTLFLAG_RD,
872 &sc->sc_stats.ast_watchdog, 0, "device reset by watchdog");
873 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_hardware", CTLFLAG_RD,
874 &sc->sc_stats.ast_hardware, 0, "fatal hardware error interrupts");
875 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_bmiss", CTLFLAG_RD,
876 &sc->sc_stats.ast_bmiss, 0, "beacon miss interrupts");
877 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_bmiss_phantom", CTLFLAG_RD,
878 &sc->sc_stats.ast_bmiss_phantom, 0, "beacon miss interrupts");
879 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_bstuck", CTLFLAG_RD,
880 &sc->sc_stats.ast_bstuck, 0, "beacon stuck interrupts");
881 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rxorn", CTLFLAG_RD,
882 &sc->sc_stats.ast_rxorn, 0, "rx overrun interrupts");
883 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rxeol", CTLFLAG_RD,
884 &sc->sc_stats.ast_rxeol, 0, "rx eol interrupts");
885 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_txurn", CTLFLAG_RD,
886 &sc->sc_stats.ast_txurn, 0, "tx underrun interrupts");
887 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_mib", CTLFLAG_RD,
888 &sc->sc_stats.ast_mib, 0, "mib interrupts");
889 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_intrcoal", CTLFLAG_RD,
890 &sc->sc_stats.ast_intrcoal, 0, "interrupts coalesced");
891 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_packets", CTLFLAG_RD,
892 &sc->sc_stats.ast_tx_packets, 0, "packet sent on the interface");
893 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_mgmt", CTLFLAG_RD,
894 &sc->sc_stats.ast_tx_mgmt, 0, "management frames transmitted");
895 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_discard", CTLFLAG_RD,
896 &sc->sc_stats.ast_tx_discard, 0, "frames discarded prior to assoc");
897 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_qstop", CTLFLAG_RD,
898 &sc->sc_stats.ast_tx_qstop, 0, "output stopped 'cuz no buffer");
899 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_encap", CTLFLAG_RD,
900 &sc->sc_stats.ast_tx_encap, 0, "tx encapsulation failed");
901 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_nonode", CTLFLAG_RD,
902 &sc->sc_stats.ast_tx_nonode, 0, "tx failed 'cuz no node");
903 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_nombuf", CTLFLAG_RD,
904 &sc->sc_stats.ast_tx_nombuf, 0, "tx failed 'cuz no mbuf");
905 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_nomcl", CTLFLAG_RD,
906 &sc->sc_stats.ast_tx_nomcl, 0, "tx failed 'cuz no cluster");
907 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_linear", CTLFLAG_RD,
908 &sc->sc_stats.ast_tx_linear, 0, "tx linearized to cluster");
909 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_nodata", CTLFLAG_RD,
910 &sc->sc_stats.ast_tx_nodata, 0, "tx discarded empty frame");
911 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_busdma", CTLFLAG_RD,
912 &sc->sc_stats.ast_tx_busdma, 0, "tx failed for dma resrcs");
913 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_xretries", CTLFLAG_RD,
914 &sc->sc_stats.ast_tx_xretries, 0, "tx failed 'cuz too many retries");
915 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_fifoerr", CTLFLAG_RD,
916 &sc->sc_stats.ast_tx_fifoerr, 0, "tx failed 'cuz FIFO underrun");
917 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_filtered", CTLFLAG_RD,
918 &sc->sc_stats.ast_tx_filtered, 0, "tx failed 'cuz xmit filtered");
919 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_shortretry", CTLFLAG_RD,
920 &sc->sc_stats.ast_tx_shortretry, 0, "tx on-chip retries (short)");
921 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_longretry", CTLFLAG_RD,
922 &sc->sc_stats.ast_tx_longretry, 0, "tx on-chip retries (long)");
923 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_badrate", CTLFLAG_RD,
924 &sc->sc_stats.ast_tx_badrate, 0, "tx failed 'cuz bogus xmit rate");
925 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_noack", CTLFLAG_RD,
926 &sc->sc_stats.ast_tx_noack, 0, "tx frames with no ack marked");
927 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_rts", CTLFLAG_RD,
928 &sc->sc_stats.ast_tx_rts, 0, "tx frames with rts enabled");
929 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_cts", CTLFLAG_RD,
930 &sc->sc_stats.ast_tx_cts, 0, "tx frames with cts enabled");
931 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_shortpre", CTLFLAG_RD,
932 &sc->sc_stats.ast_tx_shortpre, 0, "tx frames with short preamble");
933 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_altrate", CTLFLAG_RD,
934 &sc->sc_stats.ast_tx_altrate, 0, "tx frames with alternate rate");
935 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_protect", CTLFLAG_RD,
936 &sc->sc_stats.ast_tx_protect, 0, "tx frames with protection");
937 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_ctsburst", CTLFLAG_RD,
938 &sc->sc_stats.ast_tx_ctsburst, 0, "tx frames with cts and bursting");
939 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_ctsext", CTLFLAG_RD,
940 &sc->sc_stats.ast_tx_ctsext, 0, "tx frames with cts extension");
941 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_nombuf", CTLFLAG_RD,
942 &sc->sc_stats.ast_rx_nombuf, 0, "rx setup failed 'cuz no mbuf");
943 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_busdma", CTLFLAG_RD,
944 &sc->sc_stats.ast_rx_busdma, 0, "rx setup failed for dma resrcs");
945 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_orn", CTLFLAG_RD,
946 &sc->sc_stats.ast_rx_orn, 0, "rx failed 'cuz of desc overrun");
947 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_crcerr", CTLFLAG_RD,
948 &sc->sc_stats.ast_rx_crcerr, 0, "rx failed 'cuz of bad CRC");
949 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_fifoerr", CTLFLAG_RD,
950 &sc->sc_stats.ast_rx_fifoerr, 0, "rx failed 'cuz of FIFO overrun");
951 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_badcrypt", CTLFLAG_RD,
952 &sc->sc_stats.ast_rx_badcrypt, 0, "rx failed 'cuz decryption");
953 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_badmic", CTLFLAG_RD,
954 &sc->sc_stats.ast_rx_badmic, 0, "rx failed 'cuz MIC failure");
955 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_phyerr", CTLFLAG_RD,
956 &sc->sc_stats.ast_rx_phyerr, 0, "rx failed 'cuz of PHY err");
957 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_tooshort", CTLFLAG_RD,
958 &sc->sc_stats.ast_rx_tooshort, 0, "rx discarded 'cuz frame too short");
959 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_toobig", CTLFLAG_RD,
960 &sc->sc_stats.ast_rx_toobig, 0, "rx discarded 'cuz frame too large");
961 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_packets", CTLFLAG_RD,
962 &sc->sc_stats.ast_rx_packets, 0, "packet recv on the interface");
963 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_mgt", CTLFLAG_RD,
964 &sc->sc_stats.ast_rx_mgt, 0, "management frames received");
965 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_ctl", CTLFLAG_RD,
966 &sc->sc_stats.ast_rx_ctl, 0, "rx discarded 'cuz ctl frame");
967 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_be_xmit", CTLFLAG_RD,
968 &sc->sc_stats.ast_be_xmit, 0, "beacons transmitted");
969 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_be_nombuf", CTLFLAG_RD,
970 &sc->sc_stats.ast_be_nombuf, 0, "beacon setup failed 'cuz no mbuf");
971 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_per_cal", CTLFLAG_RD,
972 &sc->sc_stats.ast_per_cal, 0, "periodic calibration calls");
973 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_per_calfail", CTLFLAG_RD,
974 &sc->sc_stats.ast_per_calfail, 0, "periodic calibration failed");
975 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_per_rfgain", CTLFLAG_RD,
976 &sc->sc_stats.ast_per_rfgain, 0, "periodic calibration rfgain reset");
977 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rate_calls", CTLFLAG_RD,
978 &sc->sc_stats.ast_rate_calls, 0, "rate control checks");
979 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rate_raise", CTLFLAG_RD,
980 &sc->sc_stats.ast_rate_raise, 0, "rate control raised xmit rate");
981 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rate_drop", CTLFLAG_RD,
982 &sc->sc_stats.ast_rate_drop, 0, "rate control dropped xmit rate");
983 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_ant_defswitch", CTLFLAG_RD,
984 &sc->sc_stats.ast_ant_defswitch, 0, "rx/default antenna switches");
985 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_ant_txswitch", CTLFLAG_RD,
986 &sc->sc_stats.ast_ant_txswitch, 0, "tx antenna switches");
987 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_cabq_xmit", CTLFLAG_RD,
988 &sc->sc_stats.ast_cabq_xmit, 0, "cabq frames transmitted");
989 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_cabq_busy", CTLFLAG_RD,
990 &sc->sc_stats.ast_cabq_busy, 0, "cabq found busy");
991 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_raw", CTLFLAG_RD,
992 &sc->sc_stats.ast_tx_raw, 0, "tx frames through raw api");
993 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_ff_txok", CTLFLAG_RD,
994 &sc->sc_stats.ast_ff_txok, 0, "fast frames tx'd successfully");
995 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_ff_txerr", CTLFLAG_RD,
996 &sc->sc_stats.ast_ff_txerr, 0, "fast frames tx'd w/ error");
997 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_ff_rx", CTLFLAG_RD,
998 &sc->sc_stats.ast_ff_rx, 0, "fast frames rx'd");
999 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_ff_flush", CTLFLAG_RD,
1000 &sc->sc_stats.ast_ff_flush, 0, "fast frames flushed from staging q");
1001 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_qfull", CTLFLAG_RD,
1002 &sc->sc_stats.ast_tx_qfull, 0, "tx dropped 'cuz of queue limit");
1003 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_nobuf", CTLFLAG_RD,
1004 &sc->sc_stats.ast_tx_nobuf, 0, "tx dropped 'cuz no ath buffer");
1005 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tdma_update", CTLFLAG_RD,
1006 &sc->sc_stats.ast_tdma_update, 0, "TDMA slot timing updates");
1007 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tdma_timers", CTLFLAG_RD,
1008 &sc->sc_stats.ast_tdma_timers, 0, "TDMA slot update set beacon timers");
1009 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tdma_tsf", CTLFLAG_RD,
1010 &sc->sc_stats.ast_tdma_tsf, 0, "TDMA slot update set TSF");
1011 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tdma_ack", CTLFLAG_RD,
1012 &sc->sc_stats.ast_tdma_ack, 0, "TDMA tx failed 'cuz ACK required");
1013 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_raw_fail", CTLFLAG_RD,
1014 &sc->sc_stats.ast_tx_raw_fail, 0, "raw tx failed 'cuz h/w down");
1015 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_nofrag", CTLFLAG_RD,
1016 &sc->sc_stats.ast_tx_nofrag, 0, "tx dropped 'cuz no ath frag buffer");
1017 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_be_missed", CTLFLAG_RD,
1018 &sc->sc_stats.ast_be_missed, 0, "number of -missed- beacons");
1019 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_ani_cal", CTLFLAG_RD,
1020 &sc->sc_stats.ast_ani_cal, 0, "number of ANI polls");
1021 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_agg", CTLFLAG_RD,
1022 &sc->sc_stats.ast_rx_agg, 0, "number of aggregate frames received");
1024 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_halfgi", CTLFLAG_RD,
1025 &sc->sc_stats.ast_rx_halfgi, 0, "number of frames received with half-GI");
1026 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_2040", CTLFLAG_RD,
1027 &sc->sc_stats.ast_rx_2040, 0, "number of HT/40 frames received");
1028 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_pre_crc_err", CTLFLAG_RD,
1029 &sc->sc_stats.ast_rx_pre_crc_err, 0, "number of delimeter-CRC errors detected");
1030 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_post_crc_err", CTLFLAG_RD,
1031 &sc->sc_stats.ast_rx_post_crc_err, 0, "number of post-delimiter CRC errors detected");
1032 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_decrypt_busy_err", CTLFLAG_RD,
1033 &sc->sc_stats.ast_rx_decrypt_busy_err, 0, "number of frames received w/ busy decrypt engine");
1034 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_hi_rx_chain", CTLFLAG_RD,
1035 &sc->sc_stats.ast_rx_hi_rx_chain, 0, "");
1036 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_htprotect", CTLFLAG_RD,
1037 &sc->sc_stats.ast_tx_htprotect, 0, "HT tx frames with protection");
1038 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_hitqueueend", CTLFLAG_RD,
1039 &sc->sc_stats.ast_rx_hitqueueend, 0, "RX hit queue end");
1040 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_timeout", CTLFLAG_RD,
1041 &sc->sc_stats.ast_tx_timeout, 0, "TX Global Timeout");
1042 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_cst", CTLFLAG_RD,
1043 &sc->sc_stats.ast_tx_cst, 0, "TX Carrier Sense Timeout");
1044 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_xtxop", CTLFLAG_RD,
1045 &sc->sc_stats.ast_tx_xtxop, 0, "TX exceeded TXOP");
1046 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_timerexpired", CTLFLAG_RD,
1047 &sc->sc_stats.ast_tx_timerexpired, 0, "TX exceeded TX_TIMER register");
1048 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_desccfgerr", CTLFLAG_RD,
1049 &sc->sc_stats.ast_tx_desccfgerr, 0, "TX Descriptor Cfg Error");
1050 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_swretries", CTLFLAG_RD,
1051 &sc->sc_stats.ast_tx_swretries, 0, "TX software retry count");
1052 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_swretrymax", CTLFLAG_RD,
1053 &sc->sc_stats.ast_tx_swretrymax, 0, "TX software retry max reached");
1055 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_data_underrun", CTLFLAG_RD,
1056 &sc->sc_stats.ast_tx_data_underrun, 0, "");
1057 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_delim_underrun", CTLFLAG_RD,
1058 &sc->sc_stats.ast_tx_delim_underrun, 0, "");
1059 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_aggr_failall", CTLFLAG_RD,
1060 &sc->sc_stats.ast_tx_aggr_failall, 0,
1061 "Number of aggregate TX failures (whole frame)");
1062 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_aggr_ok", CTLFLAG_RD,
1063 &sc->sc_stats.ast_tx_aggr_ok, 0,
1064 "Number of aggregate TX OK completions (subframe)");
1065 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_aggr_fail", CTLFLAG_RD,
1066 &sc->sc_stats.ast_tx_aggr_fail, 0,
1067 "Number of aggregate TX failures (subframe)");
1069 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_intr", CTLFLAG_RD,
1070 &sc->sc_stats.ast_rx_intr, 0, "RX interrupts");
1071 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_intr", CTLFLAG_RD,
1072 &sc->sc_stats.ast_tx_intr, 0, "TX interrupts");
1073 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_mcastq_overflow",
1074 CTLFLAG_RD, &sc->sc_stats.ast_tx_mcastq_overflow, 0,
1075 "Number of multicast frames exceeding maximum mcast queue depth");
1076 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_keymiss", CTLFLAG_RD,
1077 &sc->sc_stats.ast_rx_keymiss, 0, "");
1078 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_swfiltered", CTLFLAG_RD,
1079 &sc->sc_stats.ast_tx_swfiltered, 0, "");
1080 SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_stbc",
1081 CTLFLAG_RD, &sc->sc_stats.ast_rx_stbc, 0,
1082 "Number of STBC frames received");
1084 /* Attach the RX phy error array */
1085 ath_sysctl_stats_attach_rxphyerr(sc, child);
1087 /* Attach the interrupt statistics array */
1088 ath_sysctl_stats_attach_intr(sc, child);
1092 * This doesn't necessarily belong here (because it's HAL related, not
1096 ath_sysctl_hal_attach(struct ath_softc *sc)
1098 struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev);
1099 struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev);
1100 struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree);
1102 tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "hal", CTLFLAG_RD,
1103 NULL, "Atheros HAL parameters");
1104 child = SYSCTL_CHILDREN(tree);
1106 sc->sc_ah->ah_config.ah_debug = 0;
1107 SYSCTL_ADD_INT(ctx, child, OID_AUTO, "debug", CTLFLAG_RW,
1108 &sc->sc_ah->ah_config.ah_debug, 0, "Atheros HAL debugging printfs");
1110 sc->sc_ah->ah_config.ah_ar5416_biasadj = 0;
1111 SYSCTL_ADD_INT(ctx, child, OID_AUTO, "ar5416_biasadj", CTLFLAG_RW,
1112 &sc->sc_ah->ah_config.ah_ar5416_biasadj, 0,
1113 "Enable 2GHz AR5416 direction sensitivity bias adjust");
1115 sc->sc_ah->ah_config.ah_dma_beacon_response_time = 2;
1116 SYSCTL_ADD_INT(ctx, child, OID_AUTO, "dma_brt", CTLFLAG_RW,
1117 &sc->sc_ah->ah_config.ah_dma_beacon_response_time, 0,
1118 "Atheros HAL DMA beacon response time");
1120 sc->sc_ah->ah_config.ah_sw_beacon_response_time = 10;
1121 SYSCTL_ADD_INT(ctx, child, OID_AUTO, "sw_brt", CTLFLAG_RW,
1122 &sc->sc_ah->ah_config.ah_sw_beacon_response_time, 0,
1123 "Atheros HAL software beacon response time");
1125 sc->sc_ah->ah_config.ah_additional_swba_backoff = 0;
1126 SYSCTL_ADD_INT(ctx, child, OID_AUTO, "swba_backoff", CTLFLAG_RW,
1127 &sc->sc_ah->ah_config.ah_additional_swba_backoff, 0,
1128 "Atheros HAL additional SWBA backoff time");
1130 sc->sc_ah->ah_config.ah_force_full_reset = 0;
1131 SYSCTL_ADD_INT(ctx, child, OID_AUTO, "force_full_reset", CTLFLAG_RW,
1132 &sc->sc_ah->ah_config.ah_force_full_reset, 0,
1133 "Force full chip reset rather than a warm reset");
1136 * This is initialised by the driver.
1138 SYSCTL_ADD_INT(ctx, child, OID_AUTO, "serialise_reg_war", CTLFLAG_RW,
1139 &sc->sc_ah->ah_config.ah_serialise_reg_war, 0,
1140 "Force register access serialisation");