Lines Matching +full:ext +full:- +full:fem +full:- +full:name
3 /*-
98 device_printf(sc->sc_dev, __VA_ARGS__); \
217 .name = "otus",
275 if (uaa->usb_mode != USB_MODE_HOST || in otus_match()
276 uaa->info.bIfaceIndex != 0 || in otus_match()
277 uaa->info.bConfigIndex != 0) in otus_match()
292 sc->sc_udev = uaa->device; in otus_attach()
293 sc->sc_dev = self; in otus_attach()
295 mtx_init(&sc->sc_mtx, device_get_nameunit(self), MTX_NETWORK_LOCK, in otus_attach()
298 TIMEOUT_TASK_INIT(taskqueue_thread, &sc->scan_to, 0, otus_next_scan, sc); in otus_attach()
299 TIMEOUT_TASK_INIT(taskqueue_thread, &sc->calib_to, 0, otus_calibrate_to, sc); in otus_attach()
300 TASK_INIT(&sc->tx_task, 0, otus_tx_task, sc); in otus_attach()
301 mbufq_init(&sc->sc_snd, ifqmaxlen); in otus_attach()
304 error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, in otus_attach()
305 otus_config, OTUS_N_XFER, sc, &sc->sc_mtx); in otus_attach()
307 device_printf(sc->sc_dev, in otus_attach()
314 device_printf(sc->sc_dev, "%s: could not open pipes\n", in otus_attach()
328 mtx_destroy(&sc->sc_mtx); in otus_attach()
336 struct ieee80211com *ic = &sc->sc_ic; in otus_detach()
340 usbd_transfer_unsetup(sc->sc_xfer, OTUS_N_XFER); in otus_detach()
342 taskqueue_drain_timeout(taskqueue_thread, &sc->scan_to); in otus_detach()
343 taskqueue_drain_timeout(taskqueue_thread, &sc->calib_to); in otus_detach()
344 taskqueue_drain(taskqueue_thread, &sc->tx_task); in otus_detach()
349 usb_rem_wait_task(sc->sc_udev, &sc->sc_task); in otus_detach()
351 usbd_ref_wait(sc->sc_udev); in otus_detach()
355 mtx_destroy(&sc->sc_mtx); in otus_detach()
367 otus_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, in otus_vap_create()
375 if (!TAILQ_EMPTY(&ic->ic_vaps)) /* only one at a time */ in otus_vap_create()
379 vap = &uvp->vap; in otus_vap_create()
381 if (ieee80211_vap_setup(ic, vap, name, unit, opmode, in otus_vap_create()
389 uvp->newstate = vap->iv_newstate; in otus_vap_create()
390 vap->iv_newstate = otus_newstate; in otus_vap_create()
392 vap->iv_ampdu_density = IEEE80211_HTCAP_MPDUDENSITY_8; in otus_vap_create()
393 vap->iv_ampdu_rxmax = IEEE80211_HTCAP_MAXRXAMPDU_64K; in otus_vap_create()
400 ic->ic_opmode = opmode; in otus_vap_create()
418 struct otus_softc *sc = ic->ic_softc; in otus_parent()
421 if (ic->ic_nrunning > 0) { in otus_parent()
422 if (!sc->sc_running) { in otus_parent()
428 } else if (sc->sc_running) in otus_parent()
442 while ((m = mbufq_dequeue(&sc->sc_snd)) != NULL) { in otus_drain_mbufq()
443 ni = (struct ieee80211_node *) m->m_pkthdr.rcvif; in otus_drain_mbufq()
444 m->m_pkthdr.rcvif = NULL; in otus_drain_mbufq()
454 taskqueue_enqueue(taskqueue_thread, &sc->tx_task); in otus_tx_start()
460 struct otus_softc *sc = ic->ic_softc; in otus_transmit()
464 if (! sc->sc_running) { in otus_transmit()
470 error = mbufq_enqueue(&sc->sc_snd, m); in otus_transmit()
496 while ((m = mbufq_dequeue(&sc->sc_snd)) != NULL) { in _otus_start()
501 mbufq_prepend(&sc->sc_snd, m); in _otus_start()
505 ni = (struct ieee80211_node *)m->m_pkthdr.rcvif; in _otus_start()
506 m->m_pkthdr.rcvif = NULL; in _otus_start()
511 if_inc_counter(ni->ni_vap->iv_ifp, in _otus_start()
535 struct ieee80211com *ic= ni->ni_ic; in otus_raw_xmit()
536 struct otus_softc *sc = ic->ic_softc; in otus_raw_xmit()
542 if (! sc->sc_running) { in otus_raw_xmit()
578 struct otus_softc *sc = ic->ic_softc; in otus_set_channel()
581 ic->ic_curchan->ic_freq); in otus_set_channel()
584 (void) otus_set_chan(sc, ic->ic_curchan, 0); in otus_set_channel()
592 /* For now, no A-MPDU TX support in the driver */ in otus_ampdu_enable()
613 struct otus_softc *sc = ic->ic_softc; in otus_update_mcast()
621 struct ieee80211com *ic = &sc->sc_ic; in otus_attachhook()
629 device_printf(sc->sc_dev, "%s: could not load %s firmware\n", in otus_attachhook()
640 device_printf(sc->sc_dev, "%s: could not load %s firmware\n", in otus_attachhook()
653 if (usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx, &req, NULL, in otus_attachhook()
656 device_printf(sc->sc_dev, in otus_attachhook()
666 device_printf(sc->sc_dev, in otus_attachhook()
672 device_printf(sc->sc_dev, in otus_attachhook()
681 device_printf(sc->sc_dev, in otus_attachhook()
689 sc->txmask = sc->eeprom.baseEepHeader.txMask; in otus_attachhook()
690 sc->rxmask = sc->eeprom.baseEepHeader.rxMask; in otus_attachhook()
691 sc->capflags = sc->eeprom.baseEepHeader.opCapFlags; in otus_attachhook()
692 IEEE80211_ADDR_COPY(ic->ic_macaddr, sc->eeprom.baseEepHeader.macAddr); in otus_attachhook()
693 sc->sc_led_newstate = otus_led_newstate_type3; /* XXX */ in otus_attachhook()
695 if (sc->txmask == 0x5) in otus_attachhook()
696 ic->ic_txstream = 2; in otus_attachhook()
698 ic->ic_txstream = 1; in otus_attachhook()
700 if (sc->rxmask == 0x5) in otus_attachhook()
701 ic->ic_rxstream = 2; in otus_attachhook()
703 ic->ic_rxstream = 1; in otus_attachhook()
705 device_printf(sc->sc_dev, in otus_attachhook()
707 (sc->capflags & AR5416_OPFLAGS_11A) ? in otus_attachhook()
708 0x9104 : ((sc->txmask == 0x5) ? 0x9102 : 0x9101), in otus_attachhook()
709 (sc->txmask == 0x5) ? 2 : 1, (sc->rxmask == 0x5) ? 2 : 1, in otus_attachhook()
710 ether_sprintf(ic->ic_macaddr)); in otus_attachhook()
712 ic->ic_softc = sc; in otus_attachhook()
713 ic->ic_name = device_get_nameunit(sc->sc_dev); in otus_attachhook()
714 ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */ in otus_attachhook()
715 ic->ic_opmode = IEEE80211_M_STA; /* default to BSS mode */ in otus_attachhook()
718 ic->ic_caps = in otus_attachhook()
726 IEEE80211_C_FF | /* Atheros fast-frames supported. */ in otus_attachhook()
728 IEEE80211_C_SWAMSDUTX | /* Do software A-MSDU TX */ in otus_attachhook()
731 ic->ic_htcaps = in otus_attachhook()
740 otus_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans, in otus_attachhook()
741 ic->ic_channels); in otus_attachhook()
744 ic->ic_raw_xmit = otus_raw_xmit; in otus_attachhook()
745 ic->ic_scan_start = otus_scan_start; in otus_attachhook()
746 ic->ic_scan_end = otus_scan_end; in otus_attachhook()
747 ic->ic_set_channel = otus_set_channel; in otus_attachhook()
748 ic->ic_getradiocaps = otus_getradiocaps; in otus_attachhook()
749 ic->ic_vap_create = otus_vap_create; in otus_attachhook()
750 ic->ic_vap_delete = otus_vap_delete; in otus_attachhook()
751 ic->ic_update_mcast = otus_update_mcast; in otus_attachhook()
752 ic->ic_update_promisc = otus_update_mcast; in otus_attachhook()
753 ic->ic_parent = otus_parent; in otus_attachhook()
754 ic->ic_transmit = otus_transmit; in otus_attachhook()
755 ic->ic_update_chw = otus_update_chw; in otus_attachhook()
756 ic->ic_ampdu_enable = otus_ampdu_enable; in otus_attachhook()
757 ic->ic_wme.wme_update = otus_updateedca; in otus_attachhook()
758 ic->ic_newassoc = otus_newassoc; in otus_attachhook()
759 ic->ic_node_alloc = otus_node_alloc; in otus_attachhook()
762 ic->ic_set_key = otus_set_key; in otus_attachhook()
763 ic->ic_delete_key = otus_delete_key; in otus_attachhook()
766 ieee80211_radiotap_attach(ic, &sc->sc_txtap.wt_ihdr, in otus_attachhook()
767 sizeof(sc->sc_txtap), OTUS_TX_RADIOTAP_PRESENT, in otus_attachhook()
768 &sc->sc_rxtap.wr_ihdr, sizeof(sc->sc_rxtap), in otus_attachhook()
778 struct otus_softc *sc = ic->ic_softc; in otus_getradiocaps()
783 if (sc->eeprom.baseEepHeader.opCapFlags & AR5416_OPFLAGS_11G) { in otus_getradiocaps()
790 if (sc->eeprom.baseEepHeader.opCapFlags & AR5416_OPFLAGS_11A) { in otus_getradiocaps()
794 &ar_chans[14], nitems(ar_chans) - 14, bands, 0); in otus_getradiocaps()
799 otus_load_firmware(struct otus_softc *sc, const char *name, uint32_t addr) in otus_load_firmware() argument
809 if ((fw = firmware_get(name)) == NULL) { in otus_load_firmware()
810 device_printf(sc->sc_dev, in otus_load_firmware()
811 "%s: failed loadfirmware of file %s\n", __func__, name); in otus_load_firmware()
821 ptr = __DECONST(char *, fw->data); in otus_load_firmware()
822 size = fw->datasize; in otus_load_firmware()
829 if (usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx, in otus_load_firmware()
836 size -= mlen; in otus_load_firmware()
843 device_printf(sc->sc_dev, in otus_load_firmware()
844 "%s: %s: error=%d\n", __func__, name, error); in otus_load_firmware()
860 device_printf(sc->sc_dev, in otus_open_pipes()
867 device_printf(sc->sc_dev, "%s: could not allocate Tx xfers\n", in otus_open_pipes()
873 device_printf(sc->sc_dev, "%s: could not allocate Rx xfers\n", in otus_open_pipes()
880 usbd_transfer_start(sc->sc_xfer[OTUS_BULK_RX]); in otus_open_pipes()
881 usbd_transfer_start(sc->sc_xfer[OTUS_BULK_IRQ]); in otus_open_pipes()
899 usbd_transfer_unsetup(sc->sc_xfer, OTUS_N_XFER); in otus_close_pipes()
911 if (dp->buf != NULL) { in otus_free_cmd_list()
912 free(dp->buf, M_USBDEV); in otus_free_cmd_list()
913 dp->buf = NULL; in otus_free_cmd_list()
926 dp->buf = malloc(maxsz, M_USBDEV, M_NOWAIT | M_ZERO); in otus_alloc_cmd_list()
927 dp->odata = NULL; in otus_alloc_cmd_list()
928 if (dp->buf == NULL) { in otus_alloc_cmd_list()
929 device_printf(sc->sc_dev, in otus_alloc_cmd_list()
947 error = otus_alloc_cmd_list(sc, sc->sc_cmd, OTUS_CMD_LIST_COUNT, in otus_alloc_tx_cmd_list()
952 STAILQ_INIT(&sc->sc_cmd_active); in otus_alloc_tx_cmd_list()
953 STAILQ_INIT(&sc->sc_cmd_inactive); in otus_alloc_tx_cmd_list()
954 STAILQ_INIT(&sc->sc_cmd_pending); in otus_alloc_tx_cmd_list()
955 STAILQ_INIT(&sc->sc_cmd_waiting); in otus_alloc_tx_cmd_list()
958 STAILQ_INSERT_HEAD(&sc->sc_cmd_inactive, &sc->sc_cmd[i], in otus_alloc_tx_cmd_list()
972 STAILQ_INIT(&sc->sc_cmd_active); in otus_free_tx_cmd_list()
973 STAILQ_INIT(&sc->sc_cmd_inactive); in otus_free_tx_cmd_list()
974 STAILQ_INIT(&sc->sc_cmd_pending); in otus_free_tx_cmd_list()
975 STAILQ_INIT(&sc->sc_cmd_waiting); in otus_free_tx_cmd_list()
977 otus_free_cmd_list(sc, sc->sc_cmd, OTUS_CMD_LIST_COUNT); in otus_free_tx_cmd_list()
988 dp->sc = sc; in otus_alloc_list()
989 dp->m = NULL; in otus_alloc_list()
990 dp->buf = malloc(maxsz, M_USBDEV, M_NOWAIT | M_ZERO); in otus_alloc_list()
991 if (dp->buf == NULL) { in otus_alloc_list()
992 device_printf(sc->sc_dev, in otus_alloc_list()
997 dp->ni = NULL; in otus_alloc_list()
1011 error = otus_alloc_list(sc, sc->sc_rx, OTUS_RX_LIST_COUNT, in otus_alloc_rx_list()
1016 STAILQ_INIT(&sc->sc_rx_active); in otus_alloc_rx_list()
1017 STAILQ_INIT(&sc->sc_rx_inactive); in otus_alloc_rx_list()
1020 STAILQ_INSERT_HEAD(&sc->sc_rx_inactive, &sc->sc_rx[i], next); in otus_alloc_rx_list()
1030 error = otus_alloc_list(sc, sc->sc_tx, OTUS_TX_LIST_COUNT, in otus_alloc_tx_list()
1035 STAILQ_INIT(&sc->sc_tx_inactive); in otus_alloc_tx_list()
1038 STAILQ_INIT(&sc->sc_tx_active[i]); in otus_alloc_tx_list()
1039 STAILQ_INIT(&sc->sc_tx_pending[i]); in otus_alloc_tx_list()
1043 STAILQ_INSERT_HEAD(&sc->sc_tx_inactive, &sc->sc_tx[i], next); in otus_alloc_tx_list()
1055 STAILQ_INIT(&sc->sc_tx_inactive); in otus_free_tx_list()
1058 STAILQ_INIT(&sc->sc_tx_active[i]); in otus_free_tx_list()
1059 STAILQ_INIT(&sc->sc_tx_pending[i]); in otus_free_tx_list()
1062 otus_free_list(sc, sc->sc_tx, OTUS_TX_LIST_COUNT); in otus_free_tx_list()
1069 STAILQ_INIT(&sc->sc_rx_inactive); in otus_free_rx_list()
1070 STAILQ_INIT(&sc->sc_rx_active); in otus_free_rx_list()
1072 otus_free_list(sc, sc->sc_rx, OTUS_RX_LIST_COUNT); in otus_free_rx_list()
1083 if (dp->buf != NULL) { in otus_free_list()
1084 free(dp->buf, M_USBDEV); in otus_free_list()
1085 dp->buf = NULL; in otus_free_list()
1087 if (dp->ni != NULL) { in otus_free_list()
1088 ieee80211_free_node(dp->ni); in otus_free_list()
1089 dp->ni = NULL; in otus_free_list()
1099 bf = STAILQ_FIRST(&sc->sc_tx_inactive); in _otus_getbuf()
1101 STAILQ_REMOVE_HEAD(&sc->sc_tx_inactive, next); in _otus_getbuf()
1124 STAILQ_INSERT_TAIL(&sc->sc_tx_inactive, bf, next); in otus_freebuf()
1132 bf = STAILQ_FIRST(&sc->sc_cmd_inactive); in _otus_get_txcmd()
1134 STAILQ_REMOVE_HEAD(&sc->sc_cmd_inactive, next_cmd); in _otus_get_txcmd()
1149 device_printf(sc->sc_dev, "%s: no tx cmd buffers\n", in otus_get_txcmd()
1160 STAILQ_INSERT_TAIL(&sc->sc_cmd_inactive, bf, next_cmd); in otus_free_txcmd()
1169 if (usbd_is_dying(sc->sc_udev)) in otus_next_scan()
1172 usbd_ref_incr(sc->sc_udev); in otus_next_scan()
1174 if (sc->sc_ic.ic_state == IEEE80211_S_SCAN) in otus_next_scan()
1175 ieee80211_next_scan(&sc->sc_ic.ic_if); in otus_next_scan()
1177 usbd_ref_decr(sc->sc_udev); in otus_next_scan()
1185 struct ieee80211com *ic = vap->iv_ic; in otus_newstate()
1186 struct otus_softc *sc = ic->ic_softc; in otus_newstate()
1189 ostate = vap->iv_state; in otus_newstate()
1190 OTUS_DPRINTF(sc, OTUS_DEBUG_STATE, "%s: %s -> %s\n", __func__, in otus_newstate()
1206 if (ic->ic_opmode == IEEE80211_M_STA) { in otus_newstate()
1213 &sc->calib_to, hz); in otus_newstate()
1222 sc->sc_led_newstate(sc); in otus_newstate()
1226 return (uvp->newstate(vap, nstate, arg)); in otus_newstate()
1239 /* Always bulk-out a multiple of 4 bytes. */ in otus_cmd()
1242 device_printf(sc->sc_dev, "%s: command (0x%02x) size (%d) > %d\n", in otus_cmd()
1252 device_printf(sc->sc_dev, "%s: failed to get buf\n", in otus_cmd()
1257 hdr = (struct ar_cmd_hdr *)cmd->buf; in otus_cmd()
1258 hdr->code = code; in otus_cmd()
1259 hdr->len = ilen; in otus_cmd()
1260 hdr->token = ++sc->token; /* Don't care about endianness. */ in otus_cmd()
1261 cmd->token = hdr->token; in otus_cmd()
1267 __func__, code, ilen, hdr->token); in otus_cmd()
1269 cmd->odata = odata; in otus_cmd()
1270 cmd->odatalen = odatalen; in otus_cmd()
1271 cmd->buflen = xferlen; in otus_cmd()
1274 STAILQ_INSERT_TAIL(&sc->sc_cmd_pending, cmd, next_cmd); in otus_cmd()
1275 usbd_transfer_start(sc->sc_xfer[OTUS_BULK_CMD]); in otus_cmd()
1278 error = msleep(cmd, &sc->sc_mtx, PCATCH, "otuscmd", hz); in otus_cmd()
1288 device_printf(sc->sc_dev, in otus_cmd()
1301 sc->write_buf[sc->write_idx].reg = htole32(reg); in otus_write()
1302 sc->write_buf[sc->write_idx].val = htole32(val); in otus_write()
1304 if (++sc->write_idx > (AR_MAX_WRITE_IDX-1)) in otus_write()
1315 if (sc->write_idx == 0) in otus_write_barrier()
1320 sc->write_idx); in otus_write_barrier()
1322 error = otus_cmd(sc, AR_CMD_WREG, sc->write_buf, in otus_write_barrier()
1323 sizeof (sc->write_buf[0]) * sc->write_idx, NULL, 0); in otus_write_barrier()
1324 sc->write_idx = 0; in otus_write_barrier()
1346 eep = (uint8_t *)&sc->eeprom; in otus_read_eeprom()
1348 for (i = 0; i < sizeof (sc->eeprom) / 32; i++) { in otus_read_eeprom()
1362 struct ieee80211com *ic = ni->ni_ic; in otus_newassoc()
1363 struct otus_softc *sc = ic->ic_softc; in otus_newassoc()
1367 isnew, ether_sprintf(ni->ni_macaddr)); in otus_newassoc()
1369 on->tx_done = 0; in otus_newassoc()
1370 on->tx_err = 0; in otus_newassoc()
1371 on->tx_retries = 0; in otus_newassoc()
1384 hdr->code, hdr->len, hdr->token); in otus_cmd_handle_response()
1390 while ((cmd = STAILQ_FIRST(&sc->sc_cmd_waiting)) != NULL) { in otus_cmd_handle_response()
1391 STAILQ_REMOVE_HEAD(&sc->sc_cmd_waiting, next_cmd); in otus_cmd_handle_response()
1396 (int) hdr->token, in otus_cmd_handle_response()
1397 (int) cmd->token); in otus_cmd_handle_response()
1398 if (hdr->token == cmd->token) { in otus_cmd_handle_response()
1400 if (cmd->odata != NULL) { in otus_cmd_handle_response()
1401 if (hdr->len != cmd->odatalen) { in otus_cmd_handle_response()
1402 device_printf(sc->sc_dev, in otus_cmd_handle_response()
1405 (int) hdr->code, in otus_cmd_handle_response()
1406 (int) hdr->len, in otus_cmd_handle_response()
1407 (int) cmd->odatalen); in otus_cmd_handle_response()
1409 memcpy(cmd->odata, &hdr[1], in otus_cmd_handle_response()
1410 MIN(cmd->odatalen, hdr->len)); in otus_cmd_handle_response()
1415 STAILQ_INSERT_TAIL(&sc->sc_cmd_inactive, cmd, next_cmd); in otus_cmd_handle_response()
1422 struct ieee80211com *ic = &sc->sc_ic; in otus_cmd_rxeof()
1433 if (__predict_false(sizeof (*hdr) + hdr->len > len || in otus_cmd_rxeof()
1434 sizeof (*hdr) + hdr->len > 64)) { in otus_cmd_rxeof()
1436 "cmd too large %d\n", hdr->len); in otus_cmd_rxeof()
1443 hdr->code); in otus_cmd_rxeof()
1450 if ((hdr->code & 0xc0) != 0xc0) { in otus_cmd_rxeof()
1456 switch (hdr->code & 0x3f) { in otus_cmd_rxeof()
1464 ni = ieee80211_find_node(&ic->ic_sta, tx->macaddr); in otus_cmd_rxeof()
1466 device_printf(sc->sc_dev, in otus_cmd_rxeof()
1469 ether_sprintf(tx->macaddr)); in otus_cmd_rxeof()
1475 ether_sprintf(tx->macaddr), le16toh(tx->status), in otus_cmd_rxeof()
1476 le32toh(tx->phy)); in otus_cmd_rxeof()
1478 switch (le16toh(tx->status)) { in otus_cmd_rxeof()
1482 ieee80211_ratectl_tx_complete(ni->ni_vap, ni, in otus_cmd_rxeof()
1491 OTUS_NODE(ni)->tx_retries++; in otus_cmd_rxeof()
1494 OTUS_NODE(ni)->tx_err++; in otus_cmd_rxeof()
1504 * This is "tell driver to reset baseband" from ar9170-fw. in otus_cmd_rxeof()
1508 * reaches '5' - I guess the firmware authors thought that in otus_cmd_rxeof()
1512 device_printf(sc->sc_dev, in otus_cmd_rxeof()
1515 hdr->code, hdr->len); in otus_cmd_rxeof()
1522 * This may be a single MPDU, or it may be a sub-frame from an A-MPDU.
1528 struct ieee80211com *ic = &sc->sc_ic; in otus_sub_rxeof()
1540 device_printf(sc->sc_dev, "%s: %*D\n", in otus_sub_rxeof()
1541 __func__, len, buf, "-"); in otus_sub_rxeof()
1545 * Before any data path stuff - check to see if this is a command in otus_sub_rxeof()
1548 * All bits in the PLCP header are set to 1 for non-MPDU. in otus_sub_rxeof()
1553 len - AR_PLCP_HDR_LEN); in otus_sub_rxeof()
1558 * First step - get the status for the given frame. in otus_sub_rxeof()
1560 * an A-MPDU subframe. in otus_sub_rxeof()
1564 "%s: sub-xfer too short (no mac_status) (len %d)\n", in otus_sub_rxeof()
1566 counter_u64_add(ic->ic_ierrors, 1); in otus_sub_rxeof()
1574 mac_status = (struct ar_rx_macstatus *)(buf + len - sizeof(*mac_status)); in otus_sub_rxeof()
1575 len -= sizeof(*mac_status); in otus_sub_rxeof()
1578 __func__, mac_status->status); in otus_sub_rxeof()
1581 * Next - check the MAC status before doing anything else. in otus_sub_rxeof()
1584 * from both into sc->ar_last_rx_plcp[] so it can be reused. in otus_sub_rxeof()
1586 if (((mac_status->status & AR_RX_STATUS_MPDU_MASK) == AR_RX_STATUS_MPDU_SINGLE) || in otus_sub_rxeof()
1587 ((mac_status->status & AR_RX_STATUS_MPDU_MASK) == AR_RX_STATUS_MPDU_FIRST)) { in otus_sub_rxeof()
1594 "%s sub-xfer too short (no mac+plcp) (len %d\n)", in otus_sub_rxeof()
1596 counter_u64_add(ic->ic_ierrors, 1); in otus_sub_rxeof()
1599 memcpy(sc->ar_last_rx_plcp, buf, AR_PLCP_HDR_LEN); in otus_sub_rxeof()
1606 len -= AR_PLCP_HDR_LEN; in otus_sub_rxeof()
1610 * Next - see if we have a PHY status. in otus_sub_rxeof()
1612 * The PHY status is at the end of the final A-MPDU subframe in otus_sub_rxeof()
1618 if (((mac_status->status & AR_RX_STATUS_MPDU_MASK) == AR_RX_STATUS_MPDU_SINGLE) || in otus_sub_rxeof()
1619 ((mac_status->status & AR_RX_STATUS_MPDU_MASK) == AR_RX_STATUS_MPDU_LAST)) { in otus_sub_rxeof()
1622 "%s sub-xfer too short (no phy status) (len %d\n)", in otus_sub_rxeof()
1624 counter_u64_add(ic->ic_ierrors, 1); in otus_sub_rxeof()
1634 (buf + len - sizeof(*phy_status)); in otus_sub_rxeof()
1635 len -= sizeof(*phy_status); in otus_sub_rxeof()
1647 if (__predict_false((mac_status->error & ~AR_RX_ERROR_BAD_RA) != 0)) { in otus_sub_rxeof()
1648 OTUS_DPRINTF(sc, OTUS_DEBUG_RXDONE, "error frame 0x%02x\n", mac_status->error); in otus_sub_rxeof()
1649 if (mac_status->error & AR_RX_ERROR_FCS) { in otus_sub_rxeof()
1651 } else if (mac_status->error & AR_RX_ERROR_MMIC) { in otus_sub_rxeof()
1654 ieee80211_notify_michael_failure(ni->ni_vap, wh, keyidx); in otus_sub_rxeof()
1656 device_printf(sc->sc_dev, "%s: MIC failure\n", __func__); in otus_sub_rxeof()
1658 counter_u64_add(ic->ic_ierrors, 1); in otus_sub_rxeof()
1677 counter_u64_add(ic->ic_ierrors, 1); in otus_sub_rxeof()
1681 len -= IEEE80211_CRC_LEN; /* strip 802.11 FCS */ in otus_sub_rxeof()
1693 counter_u64_add(ic->ic_ierrors, 1); in otus_sub_rxeof()
1699 device_printf(sc->sc_dev, "%s: failed m_get2() (len=%d)\n", in otus_sub_rxeof()
1701 counter_u64_add(ic->ic_ierrors, 1); in otus_sub_rxeof()
1707 m->m_pkthdr.len = m->m_len = len; in otus_sub_rxeof()
1715 if (m->m_len < IEEE80211_MIN_LEN) { in otus_sub_rxeof()
1724 rxs.c_nf = sc->sc_nf[0]; /* XXX chain 0 != combined rssi/nf */ in otus_sub_rxeof()
1727 rxs.c_rssi = phy_status->rssi; in otus_sub_rxeof()
1731 counter_u64_add(ic->ic_ierrors, 1); in otus_sub_rxeof()
1736 STAILQ_INSERT_TAIL(&rxq->mq_head, m, m_stailqpkt); in otus_sub_rxeof()
1742 rxi.rxi_rssi = tail->rssi; in otus_sub_rxeof()
1756 caddr_t buf = data->buf; in otus_rxeof()
1767 device_printf(sc->sc_dev, "%s: %*D\n", in otus_rxeof()
1768 __func__, len, buf, "-"); in otus_rxeof()
1773 if (__predict_false(head->tag != htole16(AR_RX_HEAD_TAG))) { in otus_rxeof()
1775 "tag not valid 0x%x\n", le16toh(head->tag)); in otus_rxeof()
1778 hlen = le16toh(head->len); in otus_rxeof()
1786 /* Process sub-xfer. */ in otus_rxeof()
1789 /* Next sub-xfer is aligned on a 32-bit boundary. */ in otus_rxeof()
1796 len -= hlen; in otus_rxeof()
1805 struct ieee80211com *ic = &sc->sc_ic; in otus_bulk_rx_callback()
1817 device_printf(sc->sc_dev, "%s: called; state=%d; error=%d\n", in otus_bulk_rx_callback()
1825 data = STAILQ_FIRST(&sc->sc_rx_active); in otus_bulk_rx_callback()
1828 STAILQ_REMOVE_HEAD(&sc->sc_rx_active, next); in otus_bulk_rx_callback()
1830 STAILQ_INSERT_TAIL(&sc->sc_rx_inactive, data, next); in otus_bulk_rx_callback()
1838 data = STAILQ_FIRST(&sc->sc_rx_inactive); in otus_bulk_rx_callback()
1843 STAILQ_REMOVE_HEAD(&sc->sc_rx_inactive, next); in otus_bulk_rx_callback()
1844 STAILQ_INSERT_TAIL(&sc->sc_rx_active, data, next); in otus_bulk_rx_callback()
1845 usbd_xfer_set_frame_data(xfer, 0, data->buf, in otus_bulk_rx_callback()
1859 if (ni->ni_flags & IEEE80211_NODE_HT) in otus_bulk_rx_callback()
1860 m->m_flags |= M_AMPDU; in otus_bulk_rx_callback()
1873 data = STAILQ_FIRST(&sc->sc_rx_active); in otus_bulk_rx_callback()
1875 STAILQ_REMOVE_HEAD(&sc->sc_rx_active, next); in otus_bulk_rx_callback()
1876 STAILQ_INSERT_TAIL(&sc->sc_rx_inactive, data, next); in otus_bulk_rx_callback()
1880 counter_u64_add(ic->ic_ierrors, 1); in otus_bulk_rx_callback()
1897 if (sc->sc_tx_n_active == 0) { in otus_txeof()
1898 device_printf(sc->sc_dev, in otus_txeof()
1902 sc->sc_tx_n_active--; in otus_txeof()
1905 if (data->m) { in otus_txeof()
1908 ieee80211_tx_complete(data->ni, data->m, 0); in otus_txeof()
1909 data->m = NULL; in otus_txeof()
1910 data->ni = NULL; in otus_txeof()
1923 __func__, cmd, cmd->odata); in otus_txcmdeof()
1926 * Non-response commands still need wakeup so the caller in otus_txcmdeof()
1930 if (cmd->odata) { in otus_txcmdeof()
1931 STAILQ_INSERT_TAIL(&sc->sc_cmd_waiting, cmd, next_cmd); in otus_txcmdeof()
1943 struct ieee80211com *ic = &sc->sc_ic; in otus_bulk_tx_callback()
1950 data = STAILQ_FIRST(&sc->sc_tx_active[which]); in otus_bulk_tx_callback()
1955 STAILQ_REMOVE_HEAD(&sc->sc_tx_active[which], next); in otus_bulk_tx_callback()
1961 data = STAILQ_FIRST(&sc->sc_tx_pending[which]); in otus_bulk_tx_callback()
1965 sc->sc_tx_n_active = 0; in otus_bulk_tx_callback()
1968 STAILQ_REMOVE_HEAD(&sc->sc_tx_pending[which], next); in otus_bulk_tx_callback()
1969 STAILQ_INSERT_TAIL(&sc->sc_tx_active[which], data, next); in otus_bulk_tx_callback()
1970 usbd_xfer_set_frame_data(xfer, 0, data->buf, data->buflen); in otus_bulk_tx_callback()
1974 sc->sc_tx_n_active++; in otus_bulk_tx_callback()
1977 data = STAILQ_FIRST(&sc->sc_tx_active[which]); in otus_bulk_tx_callback()
1979 STAILQ_REMOVE_HEAD(&sc->sc_tx_active[which], next); in otus_bulk_tx_callback()
1983 counter_u64_add(ic->ic_oerrors, 1); in otus_bulk_tx_callback()
1996 * threshold, ensure we age fast-frames out so they're in otus_bulk_tx_callback()
1999 if (sc->sc_tx_n_active < 2) { in otus_bulk_tx_callback()
2000 /* XXX ew - net80211 should defer this for us! */ in otus_bulk_tx_callback()
2018 struct ieee80211com *ic = &sc->sc_ic; in otus_bulk_cmd_callback()
2026 cmd = STAILQ_FIRST(&sc->sc_cmd_active); in otus_bulk_cmd_callback()
2031 STAILQ_REMOVE_HEAD(&sc->sc_cmd_active, next_cmd); in otus_bulk_cmd_callback()
2036 cmd = STAILQ_FIRST(&sc->sc_cmd_pending); in otus_bulk_cmd_callback()
2042 STAILQ_REMOVE_HEAD(&sc->sc_cmd_pending, next_cmd); in otus_bulk_cmd_callback()
2043 STAILQ_INSERT_TAIL(&sc->sc_cmd_active, cmd, next_cmd); in otus_bulk_cmd_callback()
2044 usbd_xfer_set_frame_data(xfer, 0, cmd->buf, cmd->buflen); in otus_bulk_cmd_callback()
2046 "%s: submitting transfer %p; buf=%p, buflen=%d\n", __func__, cmd, cmd->buf, cmd->buflen); in otus_bulk_cmd_callback()
2050 cmd = STAILQ_FIRST(&sc->sc_cmd_active); in otus_bulk_cmd_callback()
2052 STAILQ_REMOVE_HEAD(&sc->sc_cmd_active, next_cmd); in otus_bulk_cmd_callback()
2122 is_2ghz = !! (IEEE80211_IS_CHAN_2GHZ(sc->sc_ic.ic_curchan)); in otus_rate_to_hw_rate()
2157 device_printf(sc->sc_dev, "%s: unknown rate '%d'\n", in otus_rate_to_hw_rate()
2192 struct ieee80211_ratectl_tx_stats *txs = &sc->sc_txs; in otus_tx_update_ratectl()
2195 txs->flags = IEEE80211_RATECTL_TX_STATS_NODE | in otus_tx_update_ratectl()
2197 txs->ni = ni; in otus_tx_update_ratectl()
2198 txs->nframes = on->tx_done; in otus_tx_update_ratectl()
2199 txs->nsuccess = on->tx_done - on->tx_err; in otus_tx_update_ratectl()
2200 txs->nretries = on->tx_retries; in otus_tx_update_ratectl()
2202 ieee80211_ratectl_tx_update(ni->ni_vap, txs); in otus_tx_update_ratectl()
2203 on->tx_done = on->tx_err = on->tx_retries = 0; in otus_tx_update_ratectl()
2211 * ac = params->ibp_pri & 3;
2212 * rate = params->ibp_rate0;
2213 * params->ibp_flags & IEEE80211_BPF_NOACK
2214 * params->ibp_flags & IEEE80211_BPF_RTS
2215 * params->ibp_flags & IEEE80211_BPF_CTS
2216 * tx->rts_ntries = params->ibp_try1;
2217 * tx->data_ntries = params->ibp_try0;
2223 const struct ieee80211_txparam *tp = ni->ni_txparms; in otus_tx()
2224 struct ieee80211com *ic = &sc->sc_ic; in otus_tx()
2225 struct ieee80211vap *vap = ni->ni_vap; in otus_tx()
2235 if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { in otus_tx()
2238 device_printf(sc->sc_dev, in otus_tx()
2248 xferlen = sizeof (*head) + m->m_pkthdr.len; in otus_tx()
2250 device_printf(sc->sc_dev, in otus_tx()
2262 qos = ((const struct ieee80211_qosframe *)wh)->i_qos[0]; in otus_tx()
2270 type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; in otus_tx()
2271 ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1); in otus_tx()
2275 rate = otus_rate_to_hw_rate(sc, params->ibp_rate0); in otus_tx()
2276 else if (!!(m->m_flags & M_EAPOL) || type != IEEE80211_FC0_TYPE_DATA) in otus_tx()
2277 rate = otus_rate_to_hw_rate(sc, tp->mgmtrate); in otus_tx()
2279 rate = otus_rate_to_hw_rate(sc, tp->mcastrate); in otus_tx()
2280 else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) in otus_tx()
2281 rate = otus_rate_to_hw_rate(sc, tp->ucastrate); in otus_tx()
2284 rate = otus_rate_to_hw_rate(sc, ni->ni_txrate); in otus_tx()
2299 if (m->m_pkthdr.len + IEEE80211_CRC_LEN >= vap->iv_rtsthreshold) in otus_tx()
2302 if (ic->ic_htprotmode == IEEE80211_PROT_RTSCTS) in otus_tx()
2304 } else if (ic->ic_flags & IEEE80211_F_USEPROT) { in otus_tx()
2305 if (ic->ic_protmode == IEEE80211_PROT_CTSONLY) in otus_tx()
2307 else if (ic->ic_protmode == IEEE80211_PROT_RTSCTS) in otus_tx()
2316 phyctl |= AR_TX_PHY_ANTMSK(sc->txmask); in otus_tx()
2323 phyctl |= AR_TX_PHY_ANTMSK(sc->txmask); in otus_tx()
2326 phyctl |= AR_TX_PHY_ANTMSK(sc->txmask); in otus_tx()
2334 OTUS_NODE(ni)->tx_done++; in otus_tx()
2337 head = (struct ar_tx_head *)data->buf; in otus_tx()
2338 head->len = htole16(m->m_pkthdr.len + IEEE80211_CRC_LEN); in otus_tx()
2339 head->macctl = htole16(macctl); in otus_tx()
2340 head->phyctl = htole32(phyctl); in otus_tx()
2342 m_copydata(m, 0, m->m_pkthdr.len, (caddr_t)&head[1]); in otus_tx()
2344 data->buflen = xferlen; in otus_tx()
2345 data->ni = ni; in otus_tx()
2346 data->m = m; in otus_tx()
2350 __func__, m, data, le16toh(head->len), macctl, phyctl, in otus_tx()
2351 (int) rate, (int) ni->ni_txrate); in otus_tx()
2354 STAILQ_INSERT_TAIL(&sc->sc_tx_pending[OTUS_BULK_TX], data, next); in otus_tx()
2355 usbd_transfer_start(sc->sc_xfer[OTUS_BULK_TX]); in otus_tx()
2375 hashes[1] |= 1 << (val - 32); in otus_hash_maddr()
2383 struct ieee80211com *ic = &sc->sc_ic; in otus_set_multi()
2387 if (ic->ic_allmulti > 0 || ic->ic_promisc > 0 || in otus_set_multi()
2388 ic->ic_opmode == IEEE80211_M_MONITOR) { in otus_set_multi()
2395 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) in otus_set_multi()
2396 if_foreach_llmaddr(vap->iv_ifp, otus_hash_maddr, in otus_set_multi()
2402 bit = enm->enm_addrlo[5] >> 2; in otus_set_multi()
2406 hashes[1] |= 1 << (bit - 32); in otus_set_multi()
2425 struct otus_softc *sc = ic->ic_softc; in otus_updateedca()
2430 * when scheduling this so we have a more time-correct view in otus_updateedca()
2442 #define EXP2(val) ((1 << (val)) - 1) in otus_updateedca_locked()
2445 struct ieee80211com *ic = &sc->sc_ic; in otus_updateedca_locked()
2500 struct ieee80211com *ic = &sc->sc_ic; in otus_updateslot()
2598 return sc->phy_vals[i]; in otus_phy_get_def()
2603 * Update PHY's programming based on vendor-specific data stored in EEPROM.
2604 * This is for FEM-type devices only.
2613 eep = &sc->eeprom.modalHeader[0]; in otus_set_board_values()
2615 eep = &sc->eeprom.modalHeader[1]; in otus_set_board_values()
2620 tmp = le32toh(eep->antCtrlCommon); in otus_set_board_values()
2623 tmp = le32toh(eep->antCtrlChain[0]); in otus_set_board_values()
2626 tmp = le32toh(eep->antCtrlChain[1]); in otus_set_board_values()
2629 if (1 /* sc->sc_sco == AR_SCO_SCN */) { in otus_set_board_values()
2632 tmp |= (eep->switchSettling & 0x7f) << 7; in otus_set_board_values()
2638 tmp |= eep->pgaDesiredSize << 8 | eep->adcDesiredSize; in otus_set_board_values()
2641 tmp = eep->txEndToXpaOff << 24 | eep->txEndToXpaOff << 16 | in otus_set_board_values()
2642 eep->txFrameToXpaOn << 8 | eep->txFrameToXpaOn; in otus_set_board_values()
2647 tmp |= eep->txEndToRxOn << 16; in otus_set_board_values()
2652 tmp |= (eep->thresh62 & 0x7f) << 12; in otus_set_board_values()
2657 tmp |= (eep->txRxAttenCh[0] & 0x3f) << 12; in otus_set_board_values()
2662 tmp |= (eep->txRxAttenCh[1] & 0x3f) << 12; in otus_set_board_values()
2667 tmp |= (eep->rxTxMarginCh[0] & 0x3f) << 18; in otus_set_board_values()
2670 tmp |= (eep->bswMargin[0] & 0xf) << 10; in otus_set_board_values()
2676 tmp |= (eep->rxTxMarginCh[1] & 0x3f) << 18; in otus_set_board_values()
2681 tmp |= (eep->iqCalICh[0] & 0x3f) << 5 | (eep->iqCalQCh[0] & 0x1f); in otus_set_board_values()
2686 tmp |= (eep->iqCalICh[1] & 0x3f) << 5 | (eep->iqCalQCh[1] & 0x1f); in otus_set_board_values()
2691 tmp |= (eep->xpd & 0xf) << 16; in otus_set_board_values()
2717 sc->phy_vals = vals; in otus_program_phy()
2719 if (sc->eeprom.baseEepHeader.deviceType == 0x80) /* FEM */ in otus_program_phy()
2763 chansel = (c->ic_freq - 4800) / 5; in otus_set_rf_bank4()
2770 if (c->ic_freq == 2484) { /* CH 14 */ in otus_set_rf_bank4()
2772 chansel = 10 + (c->ic_freq - 2274) / 5; in otus_set_rf_bank4()
2774 chansel = 16 + (c->ic_freq - 2272) / 5; in otus_set_rf_bank4()
2780 /* Write bits 0-4 of d0 and d1. */ in otus_set_rf_bank4()
2783 /* Write bits 5-7 of d0 and d1. */ in otus_set_rf_bank4()
2798 /* exponent = 14 - floor(log2(coeff)) */ in otus_get_delta_slope()
2799 for (exp = 31; exp > 0; exp--) in otus_get_delta_slope()
2803 exp = 14 - (exp - COEFF_SCALE_SHIFT); in otus_get_delta_slope()
2806 man = coeff + (1 << (COEFF_SCALE_SHIFT - exp - 1)); in otus_get_delta_slope()
2808 *mantissa = man >> (COEFF_SCALE_SHIFT - exp); in otus_get_delta_slope()
2809 *exponent = exp - 16; in otus_get_delta_slope()
2816 struct ieee80211com *ic = &sc->sc_ic; in otus_set_chan()
2828 "setting channel %d (%dMHz)\n", chan, c->ic_freq); in otus_set_chan()
2846 if (sc->bb_reset || c->ic_flags != sc->sc_curchan->ic_flags) { in otus_set_chan()
2850 otus_write(sc, AR_PWR_REG_RESET, sc->bb_reset ? 0x800 : 0x400); in otus_set_chan()
2856 sc->bb_reset = 0; in otus_set_chan()
2859 device_printf(sc->sc_dev, in otus_set_chan()
2873 device_printf(sc->sc_dev, in otus_set_chan()
2886 tmp = (sc->txmask == 0x5) ? 0x340 : 0x240; in otus_set_chan()
2892 cmd.freq = htole32((uint32_t)c->ic_freq * 1000); in otus_set_chan()
2896 coeff = (100 << 24) / c->ic_freq; in otus_set_chan()
2920 sc->bb_reset = 1; in otus_set_chan()
2924 device_printf(sc->sc_dev, "calibration status=0x%x\n", in otus_set_chan()
2927 /* Sign-extend 9-bit NF values. */ in otus_set_chan()
2928 device_printf(sc->sc_dev, in otus_set_chan()
2931 device_printf(sc->sc_dev, in otus_set_chan()
2932 "noisefloor ext chain %d=%d\n", i, in otus_set_chan()
2938 sc->sc_nf[i] = ((((int32_t)le32toh(rsp.nf[i])) << 4) >> 23); in otus_set_chan()
2940 sc->sc_curchan = c; in otus_set_chan()
2950 struct otus_softc *sc = ic->ic_softc; in otus_set_key()
2954 if ((ic->ic_if.if_flags & (IFF_UP | IFF_RUNNING)) != in otus_set_key()
2960 cmd.associd = (ni != NULL) ? ni->ni_associd : 0; in otus_set_key()
2969 struct ieee80211_key *k = &cmd->key; in otus_set_key_cb()
2975 if (k->k_flags & IEEE80211_KEY_GROUP) { in otus_set_key_cb()
2976 key.uid = htole16(k->k_id); in otus_set_key_cb()
2977 IEEE80211_ADDR_COPY(key.macaddr, sc->sc_ic.ic_myaddr); in otus_set_key_cb()
2980 key.uid = htole16(OTUS_UID(cmd->associd)); in otus_set_key_cb()
2981 IEEE80211_ADDR_COPY(key.macaddr, ni->ni_macaddr); in otus_set_key_cb()
2985 switch (k->k_cipher) { in otus_set_key_cb()
3002 memcpy(key.key, k->k_key, MIN(k->k_len, 16)); in otus_set_key_cb()
3004 if (error != 0 || k->k_cipher != IEEE80211_CIPHER_TKIP) in otus_set_key_cb()
3009 memcpy(key.key, k->k_key + 16, 16); in otus_set_key_cb()
3017 struct otus_softc *sc = ic->ic_softc; in otus_delete_key()
3020 if (!(ic->ic_if.if_flags & IFF_RUNNING) || in otus_delete_key()
3021 ic->ic_state != IEEE80211_S_RUN) in otus_delete_key()
3026 cmd.associd = (ni != NULL) ? ni->ni_associd : 0; in otus_delete_key()
3034 struct ieee80211_key *k = &cmd->key; in otus_delete_key_cb()
3037 if (k->k_flags & IEEE80211_KEY_GROUP) in otus_delete_key_cb()
3038 uid = htole32(k->k_id); in otus_delete_key_cb()
3040 uid = htole32(OTUS_UID(cmd->associd)); in otus_delete_key_cb()
3055 device_printf(sc->sc_dev, "%s: called\n", __func__); in otus_calibrate_to()
3056 struct ieee80211com *ic = &sc->sc_ic; in otus_calibrate_to()
3059 if (usbd_is_dying(sc->sc_udev)) in otus_calibrate_to()
3062 usbd_ref_incr(sc->sc_udev); in otus_calibrate_to()
3064 ni = ic->ic_bss; in otus_calibrate_to()
3065 ieee80211_amrr_choose(&sc->amrr, ni, &((struct otus_node *)ni)->amn); in otus_calibrate_to()
3067 if (!usbd_is_dying(sc->sc_udev)) in otus_calibrate_to()
3068 timeout_add_sec(&sc->calib_to, 1); in otus_calibrate_to()
3070 usbd_ref_decr(sc->sc_udev); in otus_calibrate_to()
3099 /* Default single-LED. */
3104 device_printf(sc->sc_dev, "%s: TODO\n", __func__); in otus_led_newstate_type1()
3107 /* NETGEAR, dual-LED. */
3112 device_printf(sc->sc_dev, "%s: TODO\n", __func__); in otus_led_newstate_type2()
3115 /* NETGEAR, single-LED/3 colors (blue, red, purple.) */
3120 struct ieee80211com *ic = &sc->sc_ic; in otus_led_newstate_type3()
3121 struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); in otus_led_newstate_type3()
3123 uint32_t state = sc->led_state; in otus_led_newstate_type3()
3129 } else if (vap->iv_state == IEEE80211_S_INIT) { in otus_led_newstate_type3()
3131 } else if (vap->iv_state == IEEE80211_S_RUN) { in otus_led_newstate_type3()
3133 if (IEEE80211_IS_CHAN_2GHZ(sc->sc_curchan)) in otus_led_newstate_type3()
3140 if (IEEE80211_IS_CHAN_2GHZ(sc->sc_curchan)) in otus_led_newstate_type3()
3145 if (state != sc->led_state) { in otus_led_newstate_type3()
3148 sc->led_state = state; in otus_led_newstate_type3()
3161 struct ieee80211com *ic = &sc->sc_ic; in otus_set_operating_mode()
3175 * address assigned, ensure it gets reset to all-zero. in otus_set_operating_mode()
3178 vap = TAILQ_FIRST(&ic->ic_vaps); in otus_set_operating_mode()
3179 macaddr = vap ? vap->iv_myaddr : ic->ic_macaddr; in otus_set_operating_mode()
3181 switch (ic->ic_opmode) { in otus_set_operating_mode()
3184 ni = ieee80211_ref_node(vap->iv_bss); in otus_set_operating_mode()
3185 IEEE80211_ADDR_COPY(bssid, ni->ni_bssid); in otus_set_operating_mode()
3220 // struct ieee80211com *ic = &sc->sc_ic; in otus_set_rx_filter()
3225 if (ic->ic_allmulti > 0 || ic->ic_promisc > 0 || in otus_set_rx_filter()
3226 ic->ic_opmode == IEEE80211_M_MONITOR) { in otus_set_rx_filter()
3240 struct ieee80211com *ic = &sc->sc_ic; in otus_init()
3253 device_printf(sc->sc_dev, in otus_init()
3262 sc->bb_reset = 1; /* Force cold reset. */ in otus_init()
3264 if ((error = otus_set_chan(sc, ic->ic_curchan, 0)) != 0) { in otus_init()
3266 device_printf(sc->sc_dev, in otus_init()
3275 sc->sc_running = 1; in otus_init()
3291 sc->sc_running = 0; in otus_stop()
3292 sc->sc_tx_timer = 0; in otus_stop()
3295 taskqueue_drain_timeout(taskqueue_thread, &sc->scan_to); in otus_stop()
3296 taskqueue_drain_timeout(taskqueue_thread, &sc->calib_to); in otus_stop()
3297 taskqueue_drain(taskqueue_thread, &sc->tx_task); in otus_stop()
3300 sc->sc_running = 0; in otus_stop()