Lines Matching +full:timeout +full:- +full:tap +full:- +full:ms

1 /*-
5 * Copyright (c) 2013-2014 Kevin Lo
20 /*-
114 device_printf((_sc)->sc_dev, __VA_ARGS__); \
503 struct ieee80211_tx_ampdu *tap);
531 /* MCS - single stream */
541 /* MCS - 2 streams */
551 /* MCS - 3 streams */
663 .timeout = 5000, /* ms */
673 .timeout = 5000, /* ms */
683 .timeout = 5000, /* ms */
693 .timeout = 5000, /* ms */
703 .timeout = 5000, /* ms */
713 .timeout = 5000, /* ms */
732 if (uaa->dev_state != UAA_DEV_READY) in run_autoinst()
738 id = iface->idesc; in run_autoinst()
739 if (id == NULL || id->bInterfaceClass != UICLASS_MASS) in run_autoinst()
745 uaa->dev_state = UAA_DEV_EJECTING; in run_autoinst()
770 if (uaa->usb_mode != USB_MODE_HOST) in run_match()
772 if (uaa->info.bConfigIndex != 0) in run_match()
774 if (uaa->info.bIfaceIndex != RT2860_IFACE_INDEX) in run_match()
785 struct ieee80211com *ic = &sc->sc_ic; in run_attach()
791 sc->sc_udev = uaa->device; in run_attach()
792 sc->sc_dev = self; in run_attach()
794 sc->sc_flags |= RUN_FLAG_FWLOAD_NEEDED; in run_attach()
796 mtx_init(&sc->sc_mtx, device_get_nameunit(sc->sc_dev), in run_attach()
798 mbufq_init(&sc->sc_snd, ifqmaxlen); in run_attach()
802 error = usbd_transfer_setup(uaa->device, &iface_index, in run_attach()
803 sc->sc_xfer, run_config, RUN_N_XFER, sc, &sc->sc_mtx); in run_attach()
823 device_printf(sc->sc_dev, in run_attach()
824 "timeout waiting for NIC to initialize\n"); in run_attach()
828 sc->mac_ver = ver >> 16; in run_attach()
829 sc->mac_rev = ver & 0xffff; in run_attach()
834 device_printf(sc->sc_dev, in run_attach()
836 sc->mac_ver, sc->mac_rev, run_get_rf(sc->rf_rev), in run_attach()
837 sc->ntxchains, sc->nrxchains, ether_sprintf(ic->ic_macaddr)); in run_attach()
841 ic->ic_softc = sc; in run_attach()
842 ic->ic_name = device_get_nameunit(self); in run_attach()
843 ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */ in run_attach()
844 ic->ic_opmode = IEEE80211_M_STA; /* default to BSS mode */ in run_attach()
847 ic->ic_caps = in run_attach()
852 IEEE80211_C_WDS | /* 4-address traffic works */ in run_attach()
856 IEEE80211_C_SWAMSDUTX | /* Do software A-MSDU TX */ in run_attach()
857 IEEE80211_C_FF | /* Atheros fast-frames */ in run_attach()
864 if (sc->rf_rev != RT3070_RF_2020) { in run_attach()
865 device_printf(sc->sc_dev, "[HT] Enabling 802.11n\n"); in run_attach()
866 ic->ic_htcaps = in run_attach()
873 ic->ic_rxstream = sc->nrxchains; in run_attach()
874 ic->ic_txstream = sc->ntxchains; in run_attach()
877 ic->ic_cryptocaps = in run_attach()
883 ic->ic_flags |= IEEE80211_F_DATAPAD; in run_attach()
884 ic->ic_flags_ext |= IEEE80211_FEXT_SWBMISS; in run_attach()
885 ic->ic_flags_ext |= IEEE80211_FEXT_SEQNO_OFFLOAD; in run_attach()
887 run_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans, in run_attach()
888 ic->ic_channels); in run_attach()
892 ic->ic_scan_start = run_scan_start; in run_attach()
893 ic->ic_scan_end = run_scan_end; in run_attach()
894 ic->ic_set_channel = run_set_channel; in run_attach()
895 ic->ic_getradiocaps = run_getradiocaps; in run_attach()
896 ic->ic_node_alloc = run_node_alloc; in run_attach()
897 ic->ic_newassoc = run_newassoc; in run_attach()
898 ic->ic_updateslot = run_updateslot; in run_attach()
899 ic->ic_update_mcast = run_update_mcast; in run_attach()
900 ic->ic_wme.wme_update = run_wme_update; in run_attach()
901 ic->ic_raw_xmit = run_raw_xmit; in run_attach()
902 ic->ic_update_promisc = run_update_promisc; in run_attach()
903 ic->ic_vap_create = run_vap_create; in run_attach()
904 ic->ic_vap_delete = run_vap_delete; in run_attach()
905 ic->ic_transmit = run_transmit; in run_attach()
906 ic->ic_parent = run_parent; in run_attach()
907 ic->ic_update_chw = run_update_chw; in run_attach()
908 ic->ic_ampdu_enable = run_ampdu_enable; in run_attach()
911 &sc->sc_txtap.wt_ihdr, sizeof(sc->sc_txtap), in run_attach()
913 &sc->sc_rxtap.wr_ihdr, sizeof(sc->sc_rxtap), in run_attach()
916 TASK_INIT(&sc->cmdq_task, 0, run_cmdq_cb, sc); in run_attach()
917 TASK_INIT(&sc->ratectl_task, 0, run_ratectl_cb, sc); in run_attach()
918 usb_callout_init_mtx(&sc->ratectl_ch, &sc->sc_mtx, 0); in run_attach()
937 while ((m = mbufq_dequeue(&sc->sc_snd)) != NULL) { in run_drain_mbufq()
938 ni = (struct ieee80211_node *)m->m_pkthdr.rcvif; in run_drain_mbufq()
939 m->m_pkthdr.rcvif = NULL; in run_drain_mbufq()
949 struct ieee80211com *ic = &sc->sc_ic; in run_detach()
953 sc->sc_detached = 1; in run_detach()
957 usbd_transfer_unsetup(sc->sc_xfer, RUN_N_XFER); in run_detach()
960 sc->ratectl_run = RUN_RATECTL_OFF; in run_detach()
961 sc->cmdq_run = sc->cmdq_key_set = RUN_CMDQ_ABORT; in run_detach()
965 run_unsetup_tx_list(sc, &sc->sc_epq[i]); in run_detach()
971 if (sc->sc_ic.ic_softc == sc) { in run_detach()
973 usb_callout_drain(&sc->ratectl_ch); in run_detach()
974 ieee80211_draintask(ic, &sc->cmdq_task); in run_detach()
975 ieee80211_draintask(ic, &sc->ratectl_task); in run_detach()
979 mtx_destroy(&sc->sc_mtx); in run_detach()
990 struct run_softc *sc = ic->ic_softc; in run_vap_create()
995 if (sc->rvp_cnt >= RUN_VAP_MAX) { in run_vap_create()
996 device_printf(sc->sc_dev, "number of VAPs maxed out\n"); in run_vap_create()
1010 if (!TAILQ_EMPTY(&ic->ic_vaps)) in run_vap_create()
1014 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next){ in run_vap_create()
1015 if(vap->iv_opmode != IEEE80211_M_HOSTAP) in run_vap_create()
1022 device_printf(sc->sc_dev, in run_vap_create()
1028 device_printf(sc->sc_dev, "unknown opmode %d\n", opmode); in run_vap_create()
1033 vap = &rvp->vap; in run_vap_create()
1042 vap->iv_update_beacon = run_update_beacon; in run_vap_create()
1043 vap->iv_max_aid = RT2870_WCID_MAX; in run_vap_create()
1049 if (ic->ic_rxstream > 1) in run_vap_create()
1050 vap->iv_ampdu_rxmax = IEEE80211_HTCAP_MAXRXAMPDU_64K; in run_vap_create()
1052 vap->iv_ampdu_rxmax = IEEE80211_HTCAP_MAXRXAMPDU_32K; in run_vap_create()
1053 vap->iv_ampdu_density = IEEE80211_HTCAP_MPDUDENSITY_2; /* 2uS */ in run_vap_create()
1061 vap->iv_key_delete = (void *)run_key_delete; in run_vap_create()
1062 vap->iv_key_set = (void *)run_key_set; in run_vap_create()
1065 rvp->newstate = vap->iv_newstate; in run_vap_create()
1066 vap->iv_newstate = run_newstate; in run_vap_create()
1068 rvp->recv_mgmt = vap->iv_recv_mgmt; in run_vap_create()
1069 vap->iv_recv_mgmt = run_recv_mgmt; in run_vap_create()
1081 if((sc->rvp_bmap & 1 << i) == 0){ in run_vap_create()
1082 sc->rvp_bmap |= 1 << i; in run_vap_create()
1083 rvp->rvp_id = i; in run_vap_create()
1087 if (sc->rvp_cnt++ == 0) in run_vap_create()
1088 ic->ic_opmode = opmode; in run_vap_create()
1091 sc->cmdq_run = RUN_CMDQ_GO; in run_vap_create()
1094 rvp->rvp_id, sc->rvp_bmap, sc->rvp_cnt); in run_vap_create()
1110 ic = vap->iv_ic; in run_vap_delete()
1111 sc = ic->ic_softc; in run_vap_delete()
1115 m_freem(rvp->beacon_mbuf); in run_vap_delete()
1116 rvp->beacon_mbuf = NULL; in run_vap_delete()
1118 rvp_id = rvp->rvp_id; in run_vap_delete()
1119 sc->ratectl_run &= ~(1 << rvp_id); in run_vap_delete()
1120 sc->rvp_bmap &= ~(1 << rvp_id); in run_vap_delete()
1123 --sc->rvp_cnt; in run_vap_delete()
1127 vap, rvp_id, sc->rvp_bmap, sc->rvp_cnt); in run_vap_delete()
1139 * here is all-for-one taskqueue callback function. This function
1152 for (i = sc->cmdq_exec; sc->cmdq[i].func && pending; in run_cmdq_cb()
1153 i = sc->cmdq_exec, pending--) { in run_cmdq_cb()
1156 if (sc->cmdq_run == RUN_CMDQ_GO) { in run_cmdq_cb()
1161 if (sc->cmdq[i].arg0) in run_cmdq_cb()
1162 sc->cmdq[i].func(sc->cmdq[i].arg0); in run_cmdq_cb()
1164 sc->cmdq[i].func(&sc->cmdq[i]); in run_cmdq_cb()
1166 sc->cmdq[i].arg0 = NULL; in run_cmdq_cb()
1167 sc->cmdq[i].func = NULL; in run_cmdq_cb()
1168 sc->cmdq_exec++; in run_cmdq_cb()
1169 sc->cmdq_exec &= RUN_CMDQ_MASQ; in run_cmdq_cb()
1181 STAILQ_INIT(&pq->tx_qh); in run_setup_tx_list()
1182 STAILQ_INIT(&pq->tx_fh); in run_setup_tx_list()
1184 for (data = &pq->tx_data[0]; in run_setup_tx_list()
1185 data < &pq->tx_data[RUN_TX_RING_COUNT]; data++) { in run_setup_tx_list()
1186 data->sc = sc; in run_setup_tx_list()
1187 STAILQ_INSERT_TAIL(&pq->tx_fh, data, next); in run_setup_tx_list()
1189 pq->tx_nfree = RUN_TX_RING_COUNT; in run_setup_tx_list()
1198 pq->tx_nfree = 0; in run_unsetup_tx_list()
1199 STAILQ_INIT(&pq->tx_fh); in run_unsetup_tx_list()
1200 STAILQ_INIT(&pq->tx_qh); in run_unsetup_tx_list()
1203 for (data = &pq->tx_data[0]; in run_unsetup_tx_list()
1204 data < &pq->tx_data[RUN_TX_RING_COUNT]; data++) { in run_unsetup_tx_list()
1205 if (data->m != NULL) { in run_unsetup_tx_list()
1206 m_freem(data->m); in run_unsetup_tx_list()
1207 data->m = NULL; in run_unsetup_tx_list()
1209 if (data->ni != NULL) { in run_unsetup_tx_list()
1210 ieee80211_free_node(data->ni); in run_unsetup_tx_list()
1211 data->ni = NULL; in run_unsetup_tx_list()
1231 device_printf(sc->sc_dev, in run_load_microcode()
1236 if (fw->datasize != 8192) { in run_load_microcode()
1237 device_printf(sc->sc_dev, in run_load_microcode()
1245 * run-rt2870 (8KB) contains both, in run_load_microcode()
1249 base = fw->data; in run_load_microcode()
1250 if ((sc->mac_ver) != 0x2860 && in run_load_microcode()
1251 (sc->mac_ver) != 0x2872 && in run_load_microcode()
1252 (sc->mac_ver) != 0x3070) { in run_load_microcode()
1257 temp = fw->data; in run_load_microcode()
1260 device_printf(sc->sc_dev, "firmware checksum failed\n"); in run_load_microcode()
1266 if (sc->sc_flags & RUN_FLAG_FWLOAD_NEEDED) { in run_load_microcode()
1277 if ((error = usbd_do_request(sc->sc_udev, &sc->sc_mtx, &req, NULL)) in run_load_microcode()
1279 device_printf(sc->sc_dev, "firmware reset failed\n"); in run_load_microcode()
1300 device_printf(sc->sc_dev, in run_load_microcode()
1301 "timeout waiting for MCU to initialize\n"); in run_load_microcode()
1305 device_printf(sc->sc_dev, "firmware %s ver. %u.%u loaded\n", in run_load_microcode()
1306 (base == fw->data) ? "RT2870" : "RT3071", in run_load_microcode()
1324 return (usbd_do_request(sc->sc_udev, &sc->sc_mtx, &req, NULL)); in run_reset()
1336 while (ntries--) { in run_do_request()
1337 err = usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx, in run_do_request()
1338 req, data, 0, NULL, 250 /* ms */); in run_do_request()
1422 * firmware. Limit amount of data passed to 64-bytes at a in run_write_region_1()
1440 len -= delta; in run_write_region_1()
1469 /*- in run_efuse_read()
1470 * Read one 16-byte block into registers EFUSE_DATA[0-3]: in run_efuse_read()
1493 /* determine to which 32-bit register our 16-bit word belongs */ in run_efuse_read()
1494 reg = RT3070_EFUSE_DATA3 - (addr & 0xc); in run_efuse_read()
1504 /* Read 16-bit from eFUSE ROM for RT3xxx. */
1525 error = usbd_do_request(sc->sc_udev, &sc->sc_mtx, &req, &tmp); in run_eeprom_read_2()
1537 return sc->sc_srom_read(sc, addr, val); in run_srom_read()
1685 * Add `delta' (signed) to each 4-bit sub-word of a 32-bit word.
1686 * Used to adjust per-rate Tx power registers.
1734 addr = (sc->ntxchains == 3) ? RT3593_EEPROM_PWR2GHZ_BASE1 : in run_rt3593_get_txpower()
1737 sc->txpow1[i + 0] = (int8_t)(val & 0xff); in run_rt3593_get_txpower()
1738 sc->txpow1[i + 1] = (int8_t)(val >> 8); in run_rt3593_get_txpower()
1740 addr = (sc->ntxchains == 3) ? RT3593_EEPROM_PWR2GHZ_BASE2 : in run_rt3593_get_txpower()
1743 sc->txpow2[i + 0] = (int8_t)(val & 0xff); in run_rt3593_get_txpower()
1744 sc->txpow2[i + 1] = (int8_t)(val >> 8); in run_rt3593_get_txpower()
1746 if (sc->ntxchains == 3) { in run_rt3593_get_txpower()
1749 sc->txpow3[i + 0] = (int8_t)(val & 0xff); in run_rt3593_get_txpower()
1750 sc->txpow3[i + 1] = (int8_t)(val >> 8); in run_rt3593_get_txpower()
1755 if (sc->txpow1[i] > 31) in run_rt3593_get_txpower()
1756 sc->txpow1[i] = 5; in run_rt3593_get_txpower()
1757 if (sc->txpow2[i] > 31) in run_rt3593_get_txpower()
1758 sc->txpow2[i] = 5; in run_rt3593_get_txpower()
1759 if (sc->ntxchains == 3) { in run_rt3593_get_txpower()
1760 if (sc->txpow3[i] > 31) in run_rt3593_get_txpower()
1761 sc->txpow3[i] = 5; in run_rt3593_get_txpower()
1767 sc->txpow1[i + 14] = (int8_t)(val & 0xff); in run_rt3593_get_txpower()
1768 sc->txpow1[i + 15] = (int8_t)(val >> 8); in run_rt3593_get_txpower()
1771 sc->txpow2[i + 14] = (int8_t)(val & 0xff); in run_rt3593_get_txpower()
1772 sc->txpow2[i + 15] = (int8_t)(val >> 8); in run_rt3593_get_txpower()
1774 if (sc->ntxchains == 3) { in run_rt3593_get_txpower()
1777 sc->txpow3[i + 14] = (int8_t)(val & 0xff); in run_rt3593_get_txpower()
1778 sc->txpow3[i + 15] = (int8_t)(val >> 8); in run_rt3593_get_txpower()
1792 sc->txpow1[i + 0] = (int8_t)(val & 0xff); in run_get_txpower()
1793 sc->txpow1[i + 1] = (int8_t)(val >> 8); in run_get_txpower()
1795 if (sc->mac_ver != 0x5390) { in run_get_txpower()
1798 sc->txpow2[i + 0] = (int8_t)(val & 0xff); in run_get_txpower()
1799 sc->txpow2[i + 1] = (int8_t)(val >> 8); in run_get_txpower()
1804 if (sc->mac_ver >= 0x5390) { in run_get_txpower()
1805 if (sc->txpow1[i] < 0 || sc->txpow1[i] > 39) in run_get_txpower()
1806 sc->txpow1[i] = 5; in run_get_txpower()
1808 if (sc->txpow1[i] < 0 || sc->txpow1[i] > 31) in run_get_txpower()
1809 sc->txpow1[i] = 5; in run_get_txpower()
1811 if (sc->mac_ver > 0x5390) { in run_get_txpower()
1812 if (sc->txpow2[i] < 0 || sc->txpow2[i] > 39) in run_get_txpower()
1813 sc->txpow2[i] = 5; in run_get_txpower()
1814 } else if (sc->mac_ver < 0x5390) { in run_get_txpower()
1815 if (sc->txpow2[i] < 0 || sc->txpow2[i] > 31) in run_get_txpower()
1816 sc->txpow2[i] = 5; in run_get_txpower()
1820 rt2860_rf2850[i].chan, sc->txpow1[i], sc->txpow2[i]); in run_get_txpower()
1825 sc->txpow1[i + 14] = (int8_t)(val & 0xff); in run_get_txpower()
1826 sc->txpow1[i + 15] = (int8_t)(val >> 8); in run_get_txpower()
1829 sc->txpow2[i + 14] = (int8_t)(val & 0xff); in run_get_txpower()
1830 sc->txpow2[i + 15] = (int8_t)(val >> 8); in run_get_txpower()
1834 if (sc->mac_ver != 0x5592) { in run_get_txpower()
1835 if (sc->txpow1[14 + i] < -7 || sc->txpow1[14 + i] > 15) in run_get_txpower()
1836 sc->txpow1[14 + i] = 5; in run_get_txpower()
1837 if (sc->txpow2[14 + i] < -7 || sc->txpow2[14 + i] > 15) in run_get_txpower()
1838 sc->txpow2[14 + i] = 5; in run_get_txpower()
1842 rt2860_rf2850[14 + i].chan, sc->txpow1[14 + i], in run_get_txpower()
1843 sc->txpow2[14 + i]); in run_get_txpower()
1850 struct ieee80211com *ic = &sc->sc_ic; in run_read_eeprom()
1857 sc->sc_srom_read = run_eeprom_read_2; in run_read_eeprom()
1858 if (sc->mac_ver >= 0x3070) { in run_read_eeprom()
1861 if ((tmp & RT3070_SEL_EFUSE) || sc->mac_ver == 0x3593) in run_read_eeprom()
1862 sc->sc_srom_read = run_efuse_read_2; in run_read_eeprom()
1872 ic->ic_macaddr[0] = val & 0xff; in run_read_eeprom()
1873 ic->ic_macaddr[1] = val >> 8; in run_read_eeprom()
1875 ic->ic_macaddr[2] = val & 0xff; in run_read_eeprom()
1876 ic->ic_macaddr[3] = val >> 8; in run_read_eeprom()
1878 ic->ic_macaddr[4] = val & 0xff; in run_read_eeprom()
1879 ic->ic_macaddr[5] = val >> 8; in run_read_eeprom()
1881 if (sc->mac_ver < 0x3593) { in run_read_eeprom()
1885 sc->bbp[i].val = val & 0xff; in run_read_eeprom()
1886 sc->bbp[i].reg = val >> 8; in run_read_eeprom()
1888 "BBP%d=0x%02x\n", sc->bbp[i].reg, sc->bbp[i].val); in run_read_eeprom()
1890 if (sc->mac_ver >= 0x3071) { in run_read_eeprom()
1895 sc->rf[i].val = val & 0xff; in run_read_eeprom()
1896 sc->rf[i].reg = val >> 8; in run_read_eeprom()
1898 sc->rf[i].reg, sc->rf[i].val); in run_read_eeprom()
1904 run_srom_read(sc, (sc->mac_ver != 0x3593) ? RT2860_EEPROM_FREQ_LEDS : in run_read_eeprom()
1906 sc->freq = ((val & 0xff) != 0xff) ? val & 0xff : 0; in run_read_eeprom()
1908 sc->freq & 0xff); in run_read_eeprom()
1910 run_srom_read(sc, (sc->mac_ver != 0x3593) ? RT2860_EEPROM_FREQ_LEDS : in run_read_eeprom()
1914 sc->leds = val >> 8; in run_read_eeprom()
1915 run_srom_read(sc, (sc->mac_ver != 0x3593) ? RT2860_EEPROM_LED1 : in run_read_eeprom()
1916 RT3593_EEPROM_LED1, &sc->led[0]); in run_read_eeprom()
1917 run_srom_read(sc, (sc->mac_ver != 0x3593) ? RT2860_EEPROM_LED2 : in run_read_eeprom()
1918 RT3593_EEPROM_LED2, &sc->led[1]); in run_read_eeprom()
1919 run_srom_read(sc, (sc->mac_ver != 0x3593) ? RT2860_EEPROM_LED3 : in run_read_eeprom()
1920 RT3593_EEPROM_LED3, &sc->led[2]); in run_read_eeprom()
1923 sc->leds = 0x01; in run_read_eeprom()
1924 sc->led[0] = 0x5555; in run_read_eeprom()
1925 sc->led[1] = 0x2221; in run_read_eeprom()
1926 sc->led[2] = 0x5627; /* differs from RT2860 */ in run_read_eeprom()
1930 sc->leds, sc->led[0], sc->led[1], sc->led[2]); in run_read_eeprom()
1933 if (sc->mac_ver == 0x5390 || sc->mac_ver ==0x5392) in run_read_eeprom()
1939 device_printf(sc->sc_dev, in run_read_eeprom()
1941 if (sc->mac_ver == 0x3572) { in run_read_eeprom()
1943 sc->rf_rev = RT3070_RF_3052; in run_read_eeprom()
1944 sc->ntxchains = 2; in run_read_eeprom()
1945 sc->nrxchains = 2; in run_read_eeprom()
1946 } else if (sc->mac_ver >= 0x3070) { in run_read_eeprom()
1948 sc->rf_rev = RT3070_RF_3020; in run_read_eeprom()
1949 sc->ntxchains = 1; in run_read_eeprom()
1950 sc->nrxchains = 1; in run_read_eeprom()
1953 sc->rf_rev = RT2860_RF_2820; in run_read_eeprom()
1954 sc->ntxchains = 1; in run_read_eeprom()
1955 sc->nrxchains = 2; in run_read_eeprom()
1958 if (sc->mac_ver == 0x5390 || sc->mac_ver ==0x5392) { in run_read_eeprom()
1959 sc->rf_rev = val; in run_read_eeprom()
1962 sc->rf_rev = (val >> 8) & 0xf; in run_read_eeprom()
1963 sc->ntxchains = (val >> 4) & 0xf; in run_read_eeprom()
1964 sc->nrxchains = val & 0xf; in run_read_eeprom()
1967 sc->rf_rev, sc->ntxchains, sc->nrxchains); in run_read_eeprom()
1974 sc->patch_dac = (val >> 15) & 1; in run_read_eeprom()
1976 sc->ext_5ghz_lna = (val >> 3) & 1; in run_read_eeprom()
1977 sc->ext_2ghz_lna = (val >> 2) & 1; in run_read_eeprom()
1979 sc->calib_2ghz = sc->calib_5ghz = (val >> 1) & 1; in run_read_eeprom()
1981 sc->rfswitch = val & 1; in run_read_eeprom()
1985 if (sc->mac_ver == 0x3593) in run_read_eeprom()
1996 delta_2ghz = -delta_2ghz; in run_read_eeprom()
2002 delta_5ghz = -delta_5ghz; in run_read_eeprom()
2015 sc->txpow20mhz[ridx] = reg; in run_read_eeprom()
2016 sc->txpow40mhz_2ghz[ridx] = b4inc(reg, delta_2ghz); in run_read_eeprom()
2017 sc->txpow40mhz_5ghz[ridx] = b4inc(reg, delta_5ghz); in run_read_eeprom()
2021 "40MHz/5GHz=0x%08x\n", ridx, sc->txpow20mhz[ridx], in run_read_eeprom()
2022 sc->txpow40mhz_2ghz[ridx], sc->txpow40mhz_5ghz[ridx]); in run_read_eeprom()
2026 run_srom_read(sc, (sc->mac_ver != 0x3593) ? RT2860_EEPROM_RSSI1_2GHZ : in run_read_eeprom()
2028 sc->rssi_2ghz[0] = val & 0xff; /* Ant A */ in run_read_eeprom()
2029 sc->rssi_2ghz[1] = val >> 8; /* Ant B */ in run_read_eeprom()
2030 run_srom_read(sc, (sc->mac_ver != 0x3593) ? RT2860_EEPROM_RSSI2_2GHZ : in run_read_eeprom()
2032 if (sc->mac_ver >= 0x3070) { in run_read_eeprom()
2033 if (sc->mac_ver == 0x3593) { in run_read_eeprom()
2034 sc->txmixgain_2ghz = 0; in run_read_eeprom()
2035 sc->rssi_2ghz[2] = val & 0xff; /* Ant C */ in run_read_eeprom()
2042 sc->txmixgain_2ghz = val & 0x7; in run_read_eeprom()
2045 sc->txmixgain_2ghz); in run_read_eeprom()
2047 sc->rssi_2ghz[2] = val & 0xff; /* Ant C */ in run_read_eeprom()
2048 if (sc->mac_ver == 0x3593) in run_read_eeprom()
2050 sc->lna[2] = val >> 8; /* channel group 2 */ in run_read_eeprom()
2052 run_srom_read(sc, (sc->mac_ver != 0x3593) ? RT2860_EEPROM_RSSI1_5GHZ : in run_read_eeprom()
2054 sc->rssi_5ghz[0] = val & 0xff; /* Ant A */ in run_read_eeprom()
2055 sc->rssi_5ghz[1] = val >> 8; /* Ant B */ in run_read_eeprom()
2056 run_srom_read(sc, (sc->mac_ver != 0x3593) ? RT2860_EEPROM_RSSI2_5GHZ : in run_read_eeprom()
2058 if (sc->mac_ver == 0x3572) { in run_read_eeprom()
2064 sc->txmixgain_5ghz = val & 0x7; in run_read_eeprom()
2066 sc->txmixgain_5ghz); in run_read_eeprom()
2068 sc->rssi_5ghz[2] = val & 0xff; /* Ant C */ in run_read_eeprom()
2069 if (sc->mac_ver == 0x3593) { in run_read_eeprom()
2070 sc->txmixgain_5ghz = 0; in run_read_eeprom()
2073 sc->lna[3] = val >> 8; /* channel group 3 */ in run_read_eeprom()
2075 run_srom_read(sc, (sc->mac_ver != 0x3593) ? RT2860_EEPROM_LNA : in run_read_eeprom()
2077 sc->lna[0] = val & 0xff; /* channel group 0 */ in run_read_eeprom()
2078 sc->lna[1] = val >> 8; /* channel group 1 */ in run_read_eeprom()
2081 if (sc->lna[2] == 0 || sc->lna[2] == 0xff) { in run_read_eeprom()
2084 sc->lna[2] = sc->lna[1]; in run_read_eeprom()
2086 if (sc->lna[3] == 0 || sc->lna[3] == 0xff) { in run_read_eeprom()
2089 sc->lna[3] = sc->lna[1]; in run_read_eeprom()
2094 if (sc->rssi_2ghz[ant] < -10 || sc->rssi_2ghz[ant] > 10) { in run_read_eeprom()
2097 ant + 1, sc->rssi_2ghz[ant]); in run_read_eeprom()
2098 sc->rssi_2ghz[ant] = 0; in run_read_eeprom()
2100 if (sc->rssi_5ghz[ant] < -10 || sc->rssi_5ghz[ant] > 10) { in run_read_eeprom()
2103 ant + 1, sc->rssi_5ghz[ant]); in run_read_eeprom()
2104 sc->rssi_5ghz[ant] = 0; in run_read_eeprom()
2121 struct ieee80211com *ic = vap->iv_ic; in run_media_change()
2123 struct run_softc *sc = ic->ic_softc; in run_media_change()
2135 tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)]; in run_media_change()
2136 if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) { in run_media_change()
2141 rate = ic->ic_sup_rates[ic->ic_curmode]. in run_media_change()
2142 rs_rates[tp->ucastrate] & IEEE80211_RATE_VAL; in run_media_change()
2147 ni = ieee80211_ref_node(vap->iv_bss); in run_media_change()
2149 rn->fix_ridx = ridx; in run_media_change()
2151 rate, rn->fix_ridx); in run_media_change()
2171 struct ieee80211com *ic = vap->iv_ic; in run_newstate()
2172 struct run_softc *sc = ic->ic_softc; in run_newstate()
2178 uint8_t bid = 1 << rvp->rvp_id; in run_newstate()
2180 ostate = vap->iv_state; in run_newstate()
2181 RUN_DPRINTF(sc, RUN_DEBUG_STATE, "%s -> %s\n", in run_newstate()
2188 ratectl = sc->ratectl_run; /* remember current state */ in run_newstate()
2189 sc->ratectl_run = RUN_RATECTL_OFF; in run_newstate()
2190 usb_callout_stop(&sc->ratectl_ch); in run_newstate()
2205 sc->runbmap &= ~bid; in run_newstate()
2208 if (--sc->running == 0) in run_newstate()
2213 if (!(sc->runbmap & bid)) { in run_newstate()
2214 if(sc->running++) in run_newstate()
2216 sc->runbmap |= bid; in run_newstate()
2219 m_freem(rvp->beacon_mbuf); in run_newstate()
2220 rvp->beacon_mbuf = NULL; in run_newstate()
2222 switch (vap->iv_opmode) { in run_newstate()
2225 sc->ap_running |= bid; in run_newstate()
2226 ic->ic_opmode = vap->iv_opmode; in run_newstate()
2230 sc->adhoc_running |= bid; in run_newstate()
2231 if (!sc->ap_running) in run_newstate()
2232 ic->ic_opmode = vap->iv_opmode; in run_newstate()
2236 sc->sta_running |= bid; in run_newstate()
2237 if (!sc->ap_running && !sc->adhoc_running) in run_newstate()
2238 ic->ic_opmode = vap->iv_opmode; in run_newstate()
2246 ic->ic_opmode = vap->iv_opmode; in run_newstate()
2250 if (vap->iv_opmode != IEEE80211_M_MONITOR) { in run_newstate()
2253 if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) { in run_newstate()
2256 return (-1); in run_newstate()
2262 ni = ieee80211_ref_node(vap->iv_bss); in run_newstate()
2263 IEEE80211_ADDR_COPY(sc->sc_bssid, ni->ni_bssid); in run_newstate()
2264 run_set_bssid(sc, sc->sc_bssid); in run_newstate()
2269 tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)]; in run_newstate()
2270 if (tp->ucastrate == IEEE80211_FIXED_RATE_NONE) in run_newstate()
2277 (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan) ? in run_newstate()
2287 if ((sc->ratectl_run = ratectl) && restart_ratectl) in run_newstate()
2288 usb_callout_reset(&sc->ratectl_ch, hz, run_ratectl_to, sc); in run_newstate()
2293 return(rvp->newstate(vap, nstate, arg)); in run_newstate()
2300 struct run_softc *sc = ic->ic_softc; in run_wme_update()
2357 struct ieee80211vap *vap = cmdq->arg1; in run_key_set_cb()
2358 struct ieee80211_key *k = cmdq->k; in run_key_set_cb()
2359 struct ieee80211com *ic = vap->iv_ic; in run_key_set_cb()
2360 struct run_softc *sc = ic->ic_softc; in run_key_set_cb()
2362 u_int cipher = k->wk_cipher->ic_cipher; in run_key_set_cb()
2369 if (vap->iv_opmode == IEEE80211_M_HOSTAP) in run_key_set_cb()
2370 ni = ieee80211_find_vap_node(&ic->ic_sta, vap, cmdq->mac); in run_key_set_cb()
2372 ni = vap->iv_bss; in run_key_set_cb()
2373 associd = (ni != NULL) ? ni->ni_associd : 0; in run_key_set_cb()
2378 if(k->wk_keylen < 8) in run_key_set_cb()
2396 associd, k->wk_keyix, mode, in run_key_set_cb()
2397 (k->wk_flags & IEEE80211_KEY_GROUP) ? "group" : "pairwise", in run_key_set_cb()
2398 (k->wk_flags & IEEE80211_KEY_XMIT) ? "on" : "off", in run_key_set_cb()
2399 (k->wk_flags & IEEE80211_KEY_RECV) ? "on" : "off"); in run_key_set_cb()
2401 if (k->wk_flags & IEEE80211_KEY_GROUP) { in run_key_set_cb()
2403 base = RT2860_SKEY(RUN_VAP(vap)->rvp_id, k->wk_keyix); in run_key_set_cb()
2405 wcid = (vap->iv_opmode == IEEE80211_M_STA) ? in run_key_set_cb()
2411 if(run_write_region_1(sc, base, k->wk_key, 16)) in run_key_set_cb()
2413 if(run_write_region_1(sc, base + 16, &k->wk_key[16], 8)) /* wk_txmic */ in run_key_set_cb()
2415 if(run_write_region_1(sc, base + 24, &k->wk_key[24], 8)) /* wk_rxmic */ in run_key_set_cb()
2418 /* roundup len to 16-bit: XXX fix write_region_1() instead */ in run_key_set_cb()
2419 if(run_write_region_1(sc, base, k->wk_key, (k->wk_keylen + 1) & ~1)) in run_key_set_cb()
2423 if (!(k->wk_flags & IEEE80211_KEY_GROUP) || in run_key_set_cb()
2424 (k->wk_flags & (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV))) { in run_key_set_cb()
2428 iv[3] = vap->iv_def_txkey << 6; in run_key_set_cb()
2431 iv[0] = k->wk_keytsc >> 8; in run_key_set_cb()
2433 iv[2] = k->wk_keytsc; in run_key_set_cb()
2435 iv[0] = k->wk_keytsc; in run_key_set_cb()
2436 iv[1] = k->wk_keytsc >> 8; in run_key_set_cb()
2439 iv[3] = k->wk_keyix << 6 | IEEE80211_WEP_EXTIV; in run_key_set_cb()
2440 iv[4] = k->wk_keytsc >> 16; in run_key_set_cb()
2441 iv[5] = k->wk_keytsc >> 24; in run_key_set_cb()
2442 iv[6] = k->wk_keytsc >> 32; in run_key_set_cb()
2443 iv[7] = k->wk_keytsc >> 40; in run_key_set_cb()
2449 if (k->wk_flags & IEEE80211_KEY_GROUP) { in run_key_set_cb()
2453 attr &= ~(0xf << (k->wk_keyix * 4)); in run_key_set_cb()
2454 attr |= mode << (k->wk_keyix * 4); in run_key_set_cb()
2466 /* TODO create a pass-thru key entry? */ in run_key_set_cb()
2469 k->wk_pad = wcid; in run_key_set_cb()
2482 struct ieee80211com *ic = vap->iv_ic; in run_key_set()
2483 struct run_softc *sc = ic->ic_softc; in run_key_set()
2486 i = RUN_CMDQ_GET(&sc->cmdq_store); in run_key_set()
2488 sc->cmdq[i].func = run_key_set_cb; in run_key_set()
2489 sc->cmdq[i].arg0 = NULL; in run_key_set()
2490 sc->cmdq[i].arg1 = vap; in run_key_set()
2491 sc->cmdq[i].k = k; in run_key_set()
2492 IEEE80211_ADDR_COPY(sc->cmdq[i].mac, k->wk_macaddr); in run_key_set()
2493 ieee80211_runtask(ic, &sc->cmdq_task); in run_key_set()
2499 if (vap->iv_opmode == IEEE80211_M_HOSTAP) { in run_key_set()
2501 sc->cmdq_key_set = RUN_CMDQ_GO; in run_key_set()
2517 struct run_softc *sc = cmdq->arg1; in run_key_delete_cb()
2518 struct ieee80211_key *k = &cmdq->key; in run_key_delete_cb()
2524 if (k->wk_flags & IEEE80211_KEY_GROUP) { in run_key_delete_cb()
2528 attr &= ~(0xf << (k->wk_keyix * 4)); in run_key_delete_cb()
2533 "removing key for wcid %x\n", k->wk_pad); in run_key_delete_cb()
2535 wcid = k->wk_pad; in run_key_delete_cb()
2542 k->wk_pad = 0; in run_key_delete_cb()
2551 struct ieee80211com *ic = vap->iv_ic; in run_key_delete()
2552 struct run_softc *sc = ic->ic_softc; in run_key_delete()
2562 i = RUN_CMDQ_GET(&sc->cmdq_store); in run_key_delete()
2564 sc->cmdq[i].func = run_key_delete_cb; in run_key_delete()
2565 sc->cmdq[i].arg0 = NULL; in run_key_delete()
2566 sc->cmdq[i].arg1 = sc; in run_key_delete()
2567 k0 = &sc->cmdq[i].key; in run_key_delete()
2568 k0->wk_flags = k->wk_flags; in run_key_delete()
2569 k0->wk_keyix = k->wk_keyix; in run_key_delete()
2571 k0->wk_pad = k->wk_pad; in run_key_delete()
2572 ieee80211_runtask(ic, &sc->cmdq_task); in run_key_delete()
2583 ieee80211_runtask(&sc->sc_ic, &sc->ratectl_task); in run_ratectl_to()
2584 /* next timeout will be rescheduled in the callback task */ in run_ratectl_to()
2592 struct ieee80211com *ic = &sc->sc_ic; in run_ratectl_cb()
2593 struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); in run_ratectl_cb()
2598 if (sc->rvp_cnt > 1 || vap->iv_opmode != IEEE80211_M_STA) { in run_ratectl_cb()
2613 ieee80211_iterate_nodes(&ic->ic_sta, run_iter_func, sc); in run_ratectl_cb()
2616 if(sc->ratectl_run != RUN_RATECTL_OFF) in run_ratectl_cb()
2617 usb_callout_reset(&sc->ratectl_ch, hz, run_ratectl_to, sc); in run_ratectl_cb()
2647 * Even though each stat is Tx-complete-status like format, in run_drain_fifo()
2656 wstat = &(sc->wcid_stats[wcid]); in run_drain_fifo()
2661 counter_u64_add(sc->sc_ic.ic_oerrors, 1); in run_drain_fifo()
2669 if ((retry = pid -1 - mcs) > 0) { in run_drain_fifo()
2674 RUN_DPRINTF(sc, RUN_DEBUG_XMIT, "count=%d\n", sc->fifo_cnt); in run_drain_fifo()
2676 sc->fifo_cnt = 0; in run_drain_fifo()
2683 struct ieee80211_ratectl_tx_stats *txs = &sc->sc_txs; in run_iter_func()
2684 struct ieee80211vap *vap = ni->ni_vap; in run_iter_func()
2694 if (sc->rvp_cnt <= 1 && vap->iv_opmode == IEEE80211_M_STA && in run_iter_func()
2695 ni != vap->iv_bss) in run_iter_func()
2698 txs->flags = IEEE80211_RATECTL_TX_STATS_NODE | in run_iter_func()
2700 txs->ni = ni; in run_iter_func()
2701 if (sc->rvp_cnt <= 1 && (vap->iv_opmode == IEEE80211_M_IBSS || in run_iter_func()
2702 vap->iv_opmode == IEEE80211_M_STA)) { in run_iter_func()
2710 if_inc_counter(vap->iv_ifp, IFCOUNTER_OERRORS, in run_iter_func()
2713 txs->nretries = le16toh(sta[1].tx.retry); in run_iter_func()
2714 txs->nsuccess = le16toh(sta[1].tx.success); in run_iter_func()
2716 txs->nframes = txs->nretries + txs->nsuccess + in run_iter_func()
2721 txs->nretries, txs->nsuccess, le16toh(sta[0].error.fail)); in run_iter_func()
2723 wstat = &(sc->wcid_stats[RUN_AID2WCID(ni->ni_associd)]); in run_iter_func()
2725 if (wstat == &(sc->wcid_stats[0]) || in run_iter_func()
2726 wstat > &(sc->wcid_stats[RT2870_WCID_MAX])) in run_iter_func()
2729 txs->nretries = (*wstat)[RUN_RETRY]; in run_iter_func()
2730 txs->nsuccess = (*wstat)[RUN_SUCCESS]; in run_iter_func()
2731 txs->nframes = (*wstat)[RUN_TXCNT]; in run_iter_func()
2734 txs->nretries, txs->nframes, txs->nsuccess); in run_iter_func()
2746 rn->amrr_ridx = ridx; in run_iter_func()
2752 ieee80211_node_get_txrate_dot11rate(ni), rn->amrr_ridx); in run_iter_func()
2759 struct ieee80211_node *ni = cmdq->arg1; in run_newassoc_cb()
2760 struct run_softc *sc = ni->ni_vap->iv_ic->ic_softc; in run_newassoc_cb()
2761 uint8_t wcid = cmdq->wcid; in run_newassoc_cb()
2766 ni->ni_macaddr, IEEE80211_ADDR_LEN); in run_newassoc_cb()
2768 memset(&(sc->wcid_stats[wcid]), 0, sizeof(sc->wcid_stats[wcid])); in run_newassoc_cb()
2775 struct ieee80211vap *vap = ni->ni_vap; in run_newassoc()
2776 struct ieee80211com *ic = vap->iv_ic; in run_newassoc()
2777 struct run_softc *sc = ic->ic_softc; in run_newassoc()
2782 wcid = (vap->iv_opmode == IEEE80211_M_STA) ? in run_newassoc()
2783 1 : RUN_AID2WCID(ni->ni_associd); in run_newassoc()
2786 device_printf(sc->sc_dev, "wcid=%d out of range\n", wcid); in run_newassoc()
2791 if (isnew && ni->ni_associd != 0) { in run_newassoc()
2793 * This function could is called though timeout function. in run_newassoc()
2796 uint32_t cnt = RUN_CMDQ_GET(&sc->cmdq_store); in run_newassoc()
2798 sc->cmdq[cnt].func = run_newassoc_cb; in run_newassoc()
2799 sc->cmdq[cnt].arg0 = NULL; in run_newassoc()
2800 sc->cmdq[cnt].arg1 = ni; in run_newassoc()
2801 sc->cmdq[cnt].wcid = wcid; in run_newassoc()
2802 ieee80211_runtask(ic, &sc->cmdq_task); in run_newassoc()
2807 isnew, ni->ni_associd, ether_sprintf(ni->ni_macaddr)); in run_newassoc()
2809 rate = vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)].mgmtrate; in run_newassoc()
2814 rn->mgt_ridx = ridx; in run_newassoc()
2816 "rate=%d, mgmt_ridx=%d\n", rate, rn->mgt_ridx); in run_newassoc()
2819 if(sc->ratectl_run != RUN_RATECTL_OFF) in run_newassoc()
2820 usb_callout_reset(&sc->ratectl_ch, hz, run_ratectl_to, sc); in run_newassoc()
2832 if (sc->nrxchains > 1) { in run_maxrssi_chain()
2833 if (rxwi->rssi[1] > rxwi->rssi[rxchain]) in run_maxrssi_chain()
2835 if (sc->nrxchains > 2) in run_maxrssi_chain()
2836 if (rxwi->rssi[2] > rxwi->rssi[rxchain]) in run_maxrssi_chain()
2846 struct ieee80211vap *vap = ni->ni_vap; in run_recv_mgmt()
2847 struct run_softc *sc = vap->iv_ic->ic_softc; in run_recv_mgmt()
2851 rvp->recv_mgmt(ni, m, subtype, rxs, rssi, nf); in run_recv_mgmt()
2853 if (vap->iv_state == IEEE80211_S_RUN && in run_recv_mgmt()
2856 ni_tstamp = le64toh(ni->ni_tstamp.tsf); in run_recv_mgmt()
2874 struct ieee80211com *ic = &sc->sc_ic; in run_rx_frame()
2885 if (sc->mac_ver == 0x5592) in run_rx_frame()
2887 else if (sc->mac_ver == 0x3593) in run_rx_frame()
2899 len = le16toh(rxwi->len) & 0xfff; in run_rx_frame()
2901 if (__predict_false(len > dmalen - rxwisize)) { in run_rx_frame()
2909 flags = le32toh(rxd->flags); in run_rx_frame()
2923 m->m_data += rxwisize; in run_rx_frame()
2924 m->m_pkthdr.len = m->m_len = len; in run_rx_frame()
2928 if ((wh->i_fc[1] & IEEE80211_FC1_PROTECTED) != 0 && in run_rx_frame()
2930 wh->i_fc[1] &= ~IEEE80211_FC1_PROTECTED; in run_rx_frame()
2931 m->m_flags |= M_WEP; in run_rx_frame()
2940 if(ni && ni->ni_flags & IEEE80211_NODE_HT) { in run_rx_frame()
2941 m->m_flags |= M_AMPDU; in run_rx_frame()
2947 ieee80211_notify_michael_failure(ni->ni_vap, wh, in run_rx_frame()
2948 rxwi->keyidx); in run_rx_frame()
2955 rssi = rxwi->rssi[ant]; in run_rx_frame()
2959 struct run_rx_radiotap_header *tap = &sc->sc_rxtap; in run_rx_frame() local
2962 tap->wr_flags = 0; in run_rx_frame()
2964 tap->wr_flags |= IEEE80211_RADIOTAP_F_DATAPAD; in run_rx_frame()
2965 tap->wr_antsignal = rssi; in run_rx_frame()
2966 tap->wr_antenna = ant; in run_rx_frame()
2967 tap->wr_dbm_antsignal = run_rssi2dbm(sc, rssi, ant); in run_rx_frame()
2968 tap->wr_rate = 2; /* in case it can't be found below */ in run_rx_frame()
2970 run_get_tsf(sc, &tap->wr_tsf); in run_rx_frame()
2972 phy = le16toh(rxwi->phy); in run_rx_frame()
2976 case 0: tap->wr_rate = 2; break; in run_rx_frame()
2977 case 1: tap->wr_rate = 4; break; in run_rx_frame()
2978 case 2: tap->wr_rate = 11; break; in run_rx_frame()
2979 case 3: tap->wr_rate = 22; break; in run_rx_frame()
2982 tap->wr_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; in run_rx_frame()
2986 case 0: tap->wr_rate = 12; break; in run_rx_frame()
2987 case 1: tap->wr_rate = 18; break; in run_rx_frame()
2988 case 2: tap->wr_rate = 24; break; in run_rx_frame()
2989 case 3: tap->wr_rate = 36; break; in run_rx_frame()
2990 case 4: tap->wr_rate = 48; break; in run_rx_frame()
2991 case 5: tap->wr_rate = 72; break; in run_rx_frame()
2992 case 6: tap->wr_rate = 96; break; in run_rx_frame()
2993 case 7: tap->wr_rate = 108; break; in run_rx_frame()
3010 counter_u64_add(ic->ic_ierrors, 1); in run_rx_frame()
3017 struct ieee80211com *ic = &sc->sc_ic; in run_bulk_rx_callback()
3025 if (sc->mac_ver == 0x5592) in run_bulk_rx_callback()
3027 else if (sc->mac_ver == 0x3593) in run_bulk_rx_callback()
3045 m = sc->rx_m; in run_bulk_rx_callback()
3046 sc->rx_m = NULL; in run_bulk_rx_callback()
3051 if (sc->rx_m == NULL) { in run_bulk_rx_callback()
3052 sc->rx_m = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, in run_bulk_rx_callback()
3055 if (sc->rx_m == NULL) { in run_bulk_rx_callback()
3058 "could not allocate mbuf - idle with stall\n"); in run_bulk_rx_callback()
3059 counter_u64_add(ic->ic_ierrors, 1); in run_bulk_rx_callback()
3069 mtod(sc->rx_m, caddr_t), RUN_MAX_RXSZ); in run_bulk_rx_callback()
3080 device_printf(sc->sc_dev, "device timeout\n"); in run_bulk_rx_callback()
3081 counter_u64_add(ic->ic_ierrors, 1); in run_bulk_rx_callback()
3084 if (sc->rx_m != NULL) { in run_bulk_rx_callback()
3085 m_freem(sc->rx_m); in run_bulk_rx_callback()
3086 sc->rx_m = NULL; in run_bulk_rx_callback()
3098 m->m_pkthdr.len = m->m_len = xferlen; in run_bulk_rx_callback()
3104 if ((dmalen >= (uint32_t)-8) || (dmalen == 0) || in run_bulk_rx_callback()
3118 if ((xferlen -= dmalen + 8) <= 8) { in run_bulk_rx_callback()
3119 /* trim 32-bit DMA-len header */ in run_bulk_rx_callback()
3120 m->m_data += 4; in run_bulk_rx_callback()
3121 m->m_pkthdr.len = m->m_len -= 4; in run_bulk_rx_callback()
3131 counter_u64_add(ic->ic_ierrors, 1); in run_bulk_rx_callback()
3140 counter_u64_add(ic->ic_ierrors, 1); in run_bulk_rx_callback()
3143 m_copydata(m, 4 /* skip 32-bit DMA-len header */, in run_bulk_rx_callback()
3145 m0->m_pkthdr.len = m0->m_len = mbuf_len; in run_bulk_rx_callback()
3149 m->m_data += mbuf_len + 4; in run_bulk_rx_callback()
3150 m->m_pkthdr.len = m->m_len -= mbuf_len + 4; in run_bulk_rx_callback()
3167 ieee80211_tx_complete(data->ni, data->m, txerr); in run_tx_free()
3169 data->m = NULL; in run_tx_free()
3170 data->ni = NULL; in run_tx_free()
3172 STAILQ_INSERT_TAIL(&pq->tx_fh, data, next); in run_tx_free()
3173 pq->tx_nfree++; in run_tx_free()
3180 struct ieee80211com *ic = &sc->sc_ic; in run_bulk_tx_callbackN()
3184 struct run_endpoint_queue *pq = &sc->sc_epq[index]; in run_bulk_tx_callbackN()
3204 data = STAILQ_FIRST(&pq->tx_qh); in run_bulk_tx_callbackN()
3208 STAILQ_REMOVE_HEAD(&pq->tx_qh, next); in run_bulk_tx_callbackN()
3210 m = data->m; in run_bulk_tx_callbackN()
3211 size = (sc->mac_ver == 0x5592) ? in run_bulk_tx_callbackN()
3212 sizeof(data->desc) + sizeof(uint32_t) : sizeof(data->desc); in run_bulk_tx_callbackN()
3213 if ((m->m_pkthdr.len + in run_bulk_tx_callbackN()
3216 "data overflow, %u bytes\n", m->m_pkthdr.len); in run_bulk_tx_callbackN()
3222 usbd_copy_in(pc, 0, &data->desc, size); in run_bulk_tx_callbackN()
3223 usbd_m_copy_in(pc, size, m, 0, m->m_pkthdr.len); in run_bulk_tx_callbackN()
3224 size += m->m_pkthdr.len; in run_bulk_tx_callbackN()
3226 * Align end on a 4-byte boundary, pad 8 bytes (CRC + in run_bulk_tx_callbackN()
3227 * 4-byte padding), and be sure to zero those trailing in run_bulk_tx_callbackN()
3230 usbd_frame_zero(pc, size, ((-size) & 3) + 8); in run_bulk_tx_callbackN()
3231 size += ((-size) & 3) + 8; in run_bulk_tx_callbackN()
3233 vap = data->ni->ni_vap; in run_bulk_tx_callbackN()
3236 struct run_tx_radiotap_header *tap = &sc->sc_txtap; in run_bulk_tx_callbackN() local
3238 (struct rt2860_txwi *)(&data->desc + sizeof(struct rt2870_txd)); in run_bulk_tx_callbackN()
3245 tap->wt_flags = 0; in run_bulk_tx_callbackN()
3246 tap->wt_rate = rt2860_rates[data->ridx].rate; in run_bulk_tx_callbackN()
3247 tap->wt_hwqueue = index; in run_bulk_tx_callbackN()
3248 if (le16toh(txwi->phy) & RT2860_PHY_SHPRE) in run_bulk_tx_callbackN()
3249 tap->wt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; in run_bulk_tx_callbackN()
3251 tap->wt_flags |= IEEE80211_RADIOTAP_F_DATAPAD; in run_bulk_tx_callbackN()
3258 m->m_pkthdr.len, size, index); in run_bulk_tx_callbackN()
3274 if(data->ni != NULL) in run_bulk_tx_callbackN()
3275 vap = data->ni->ni_vap; in run_bulk_tx_callbackN()
3281 vap = TAILQ_FIRST(&ic->ic_vaps); in run_bulk_tx_callbackN()
3285 device_printf(sc->sc_dev, "device timeout\n"); in run_bulk_tx_callbackN()
3286 uint32_t i = RUN_CMDQ_GET(&sc->cmdq_store); in run_bulk_tx_callbackN()
3289 sc->cmdq[i].func = run_usb_timeout_cb; in run_bulk_tx_callbackN()
3290 sc->cmdq[i].arg0 = vap; in run_bulk_tx_callbackN()
3291 ieee80211_runtask(ic, &sc->cmdq_task); in run_bulk_tx_callbackN()
3297 * introduces a 50 ms delay: in run_bulk_tx_callbackN()
3307 if (pq->tx_nfree >= RUN_TX_RING_COUNT) { in run_bulk_tx_callbackN()
3354 struct mbuf *m = data->m; in run_set_tx_desc()
3355 struct ieee80211com *ic = &sc->sc_ic; in run_set_tx_desc()
3356 struct ieee80211vap *vap = data->ni->ni_vap; in run_set_tx_desc()
3362 uint8_t ridx = data->ridx; in run_set_tx_desc()
3368 txwisize = (sc->mac_ver == 0x5592) ? in run_set_tx_desc()
3370 xferlen = txwisize + m->m_pkthdr.len; in run_set_tx_desc()
3372 /* roundup to 32-bit alignment */ in run_set_tx_desc()
3375 txd = (struct rt2870_txd *)&data->desc; in run_set_tx_desc()
3376 txd->len = htole16(xferlen); in run_set_tx_desc()
3382 * are nicely aligned to 32-bit. So, no L2 padding. in run_set_tx_desc()
3391 txwi->len = htole16(m->m_pkthdr.len - pad); in run_set_tx_desc()
3395 (ic->ic_flags & IEEE80211_F_SHPREAMBLE)) in run_set_tx_desc()
3403 txwi->phy = htole16(mcs); in run_set_tx_desc()
3405 /* check if RTS/CTS or CTS-to-self protection is required */ in run_set_tx_desc()
3406 if (!IEEE80211_IS_MULTICAST(wh->i_addr1) && in run_set_tx_desc()
3407 ((m->m_pkthdr.len + IEEE80211_CRC_LEN > vap->iv_rtsthreshold) || in run_set_tx_desc()
3408 ((ic->ic_flags & IEEE80211_F_USEPROT) && in run_set_tx_desc()
3410 ((ic->ic_htprotmode == IEEE80211_PROT_RTSCTS) && in run_set_tx_desc()
3412 txwi->txop |= RT2860_TX_TXOP_HT; in run_set_tx_desc()
3414 txwi->txop |= RT2860_TX_TXOP_BACKOFF; in run_set_tx_desc()
3416 if (vap->iv_opmode != IEEE80211_M_STA && !IEEE80211_QOS_HAS_SEQ(wh)) in run_set_tx_desc()
3417 txwi->xflags |= RT2860_TX_NSEQ; in run_set_tx_desc()
3424 struct ieee80211com *ic = &sc->sc_ic; in run_tx()
3425 struct ieee80211vap *vap = ni->ni_vap; in run_tx()
3427 const struct ieee80211_txparam *tp = ni->ni_txparms; in run_tx()
3447 type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; in run_tx()
3452 * Update 03-14-2009: some devices like the Planex GW-US300MiniS in run_tx()
3473 if (IEEE80211_IS_MULTICAST(wh->i_addr1) || in run_tx()
3474 type != IEEE80211_FC0_TYPE_DATA || m->m_flags & M_EAPOL) { in run_tx()
3476 ridx = (ic->ic_curmode == IEEE80211_MODE_11A || ic->ic_curmode == IEEE80211_MODE_11NA) ? in run_tx()
3480 if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) in run_tx()
3481 ridx = rn->fix_ridx; in run_tx()
3483 ridx = rn->amrr_ridx; in run_tx()
3487 if (!IEEE80211_IS_MULTICAST(wh->i_addr1) && in run_tx()
3491 if (ic->ic_flags & IEEE80211_F_SHPREAMBLE) in run_tx()
3495 USETW(wh->i_dur, dur); in run_tx()
3499 if (sc->sc_epq[qid].tx_nfree < 3) { in run_tx()
3501 return (-1); in run_tx()
3504 data = STAILQ_FIRST(&sc->sc_epq[qid].tx_fh); in run_tx()
3505 STAILQ_REMOVE_HEAD(&sc->sc_epq[qid].tx_fh, next); in run_tx()
3506 sc->sc_epq[qid].tx_nfree--; in run_tx()
3508 txd = (struct rt2870_txd *)&data->desc; in run_tx()
3509 txd->flags = qflags; in run_tx()
3511 txwi->xflags = xflags; in run_tx()
3512 if (IEEE80211_IS_MULTICAST(wh->i_addr1)) in run_tx()
3513 txwi->wcid = 0; in run_tx()
3515 txwi->wcid = (vap->iv_opmode == IEEE80211_M_STA) ? in run_tx()
3516 1 : RUN_AID2WCID(ni->ni_associd); in run_tx()
3519 txwi->flags = 0; in run_tx()
3520 txwi->txop = 0; in run_tx()
3522 data->m = m; in run_tx()
3523 data->ni = ni; in run_tx()
3524 data->ridx = ridx; in run_tx()
3526 /* Assign sequence number now, regardless of A-MPDU TX or otherwise (for now) */ in run_tx()
3527 ieee80211_output_seqno_assign(ni, -1, m); in run_tx()
3534 * * TX_STA_CNT0 for all-TX-in-one stats. in run_tx()
3536 * To use FIFO stats, we need to store MCS into the driver-private in run_tx()
3544 if (sc->rvp_cnt > 1 || vap->iv_opmode == IEEE80211_M_HOSTAP || in run_tx()
3545 vap->iv_opmode == IEEE80211_M_MBSS) { in run_tx()
3547 txwi->len |= htole16(pid << RT2860_TX_PID_SHIFT); in run_tx()
3551 * USB devices, so we simulate FIFO-is-full interrupt here. in run_tx()
3552 * Ralink recommends to drain FIFO stats every 100 ms, but 16 slots in run_tx()
3561 if (sc->fifo_cnt++ == 10) { in run_tx()
3564 * with a non-sleepable lock, tcpinp. So, need to defer. in run_tx()
3566 uint32_t i = RUN_CMDQ_GET(&sc->cmdq_store); in run_tx()
3568 sc->cmdq[i].func = run_drain_fifo; in run_tx()
3569 sc->cmdq[i].arg0 = sc; in run_tx()
3570 ieee80211_runtask(ic, &sc->cmdq_task); in run_tx()
3574 STAILQ_INSERT_TAIL(&sc->sc_epq[qid].tx_qh, data, next); in run_tx()
3576 usbd_transfer_start(sc->sc_xfer[qid]); in run_tx()
3580 m->m_pkthdr.len + (int)(sizeof(struct rt2870_txd) + in run_tx()
3589 struct ieee80211com *ic = &sc->sc_ic; in run_tx_mgt()
3596 uint8_t ridx = rn->mgt_ridx; in run_tx_mgt()
3607 else if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) { in run_tx_mgt()
3610 dur = ieee80211_ack_duration(ic->ic_rt, rt2860_rates[ridx].rate, in run_tx_mgt()
3611 ic->ic_flags & IEEE80211_F_SHPREAMBLE); in run_tx_mgt()
3612 USETW(wh->i_dur, dur); in run_tx_mgt()
3615 if (sc->sc_epq[0].tx_nfree == 0) in run_tx_mgt()
3618 data = STAILQ_FIRST(&sc->sc_epq[0].tx_fh); in run_tx_mgt()
3619 STAILQ_REMOVE_HEAD(&sc->sc_epq[0].tx_fh, next); in run_tx_mgt()
3620 sc->sc_epq[0].tx_nfree--; in run_tx_mgt()
3622 txd = (struct rt2870_txd *)&data->desc; in run_tx_mgt()
3623 txd->flags = RT2860_TX_QSEL_EDCA; in run_tx_mgt()
3625 txwi->wcid = 0xff; in run_tx_mgt()
3626 txwi->flags = wflags; in run_tx_mgt()
3627 txwi->xflags = xflags; in run_tx_mgt()
3628 txwi->txop = 0; /* clear leftover garbage bits */ in run_tx_mgt()
3630 data->m = m; in run_tx_mgt()
3631 data->ni = ni; in run_tx_mgt()
3632 data->ridx = ridx; in run_tx_mgt()
3634 /* Assign sequence number now, regardless of A-MPDU TX or otherwise (for now) */ in run_tx_mgt()
3635 ieee80211_output_seqno_assign(ni, -1, m); in run_tx_mgt()
3640 m->m_pkthdr.len + (int)(sizeof(struct rt2870_txd) + in run_tx_mgt()
3643 STAILQ_INSERT_TAIL(&sc->sc_epq[0].tx_qh, data, next); in run_tx_mgt()
3645 usbd_transfer_start(sc->sc_xfer[0]); in run_tx_mgt()
3654 struct ieee80211com *ic = ni->ni_ic; in run_sendprot()
3667 if (sc->sc_epq[0].tx_nfree == 0) in run_sendprot()
3673 if_inc_counter(ni->ni_vap->iv_ifp, IFCOUNTER_OERRORS, 1); in run_sendprot()
3678 protrate = ieee80211_ctl_rate(ic->ic_rt, rate); in run_sendprot()
3684 data = STAILQ_FIRST(&sc->sc_epq[0].tx_fh); in run_sendprot()
3685 STAILQ_REMOVE_HEAD(&sc->sc_epq[0].tx_fh, next); in run_sendprot()
3686 sc->sc_epq[0].tx_nfree--; in run_sendprot()
3688 txd = (struct rt2870_txd *)&data->desc; in run_sendprot()
3689 txd->flags = RT2860_TX_QSEL_EDCA; in run_sendprot()
3691 txwi->wcid = 0xff; in run_sendprot()
3692 txwi->flags = wflags; in run_sendprot()
3693 txwi->xflags = xflags; in run_sendprot()
3694 txwi->txop = 0; /* clear leftover garbage bits */ in run_sendprot()
3696 data->m = mprot; in run_sendprot()
3697 data->ni = ieee80211_ref_node(ni); in run_sendprot()
3703 data->ridx = ridx; in run_sendprot()
3708 m->m_pkthdr.len, rate); in run_sendprot()
3710 STAILQ_INSERT_TAIL(&sc->sc_epq[0].tx_qh, data, next); in run_sendprot()
3712 usbd_transfer_start(sc->sc_xfer[0]); in run_sendprot()
3721 struct ieee80211com *ic = ni->ni_ic; in run_tx_param()
3735 rate = params->ibp_rate0; in run_tx_param()
3736 if (!ieee80211_isratevalid(ic->ic_rt, rate)) { in run_tx_param()
3741 if ((params->ibp_flags & IEEE80211_BPF_NOACK) == 0) in run_tx_param()
3743 if (params->ibp_flags & (IEEE80211_BPF_RTS|IEEE80211_BPF_CTS)) { in run_tx_param()
3745 params->ibp_flags & IEEE80211_BPF_RTS ? in run_tx_param()
3755 if (sc->sc_epq[0].tx_nfree == 0) { in run_tx_param()
3761 data = STAILQ_FIRST(&sc->sc_epq[0].tx_fh); in run_tx_param()
3762 STAILQ_REMOVE_HEAD(&sc->sc_epq[0].tx_fh, next); in run_tx_param()
3763 sc->sc_epq[0].tx_nfree--; in run_tx_param()
3765 txd = (struct rt2870_txd *)&data->desc; in run_tx_param()
3766 txd->flags = RT2860_TX_QSEL_EDCA; in run_tx_param()
3768 txwi->wcid = 0xff; in run_tx_param()
3769 txwi->xflags = xflags; in run_tx_param()
3770 txwi->txop = opflags; in run_tx_param()
3771 txwi->flags = 0; /* clear leftover garbage bits */ in run_tx_param()
3773 data->m = m; in run_tx_param()
3774 data->ni = ni; in run_tx_param()
3779 data->ridx = ridx; in run_tx_param()
3781 /* Assign sequence number now, regardless of A-MPDU TX or otherwise (for now) */ in run_tx_param()
3782 ieee80211_output_seqno_assign(ni, -1, m); in run_tx_param()
3787 m->m_pkthdr.len, rate); in run_tx_param()
3789 STAILQ_INSERT_TAIL(&sc->sc_epq[0].tx_qh, data, next); in run_tx_param()
3791 usbd_transfer_start(sc->sc_xfer[0]); in run_tx_param()
3800 struct run_softc *sc = ni->ni_ic->ic_softc; in run_raw_xmit()
3806 if (!(sc->sc_flags & RUN_RUNNING)) { in run_raw_xmit()
3839 struct run_softc *sc = ic->ic_softc; in run_transmit()
3843 if ((sc->sc_flags & RUN_RUNNING) == 0) { in run_transmit()
3847 error = mbufq_enqueue(&sc->sc_snd, m); in run_transmit()
3866 if ((sc->sc_flags & RUN_RUNNING) == 0) in run_start()
3869 while ((m = mbufq_dequeue(&sc->sc_snd)) != NULL) { in run_start()
3870 ni = (struct ieee80211_node *)m->m_pkthdr.rcvif; in run_start()
3872 mbufq_prepend(&sc->sc_snd, m); in run_start()
3881 struct run_softc *sc = ic->ic_softc; in run_parent()
3885 if (sc->sc_detached) { in run_parent()
3890 if (ic->ic_nrunning > 0) { in run_parent()
3891 if (!(sc->sc_flags & RUN_RUNNING)) { in run_parent()
3896 } else if ((sc->sc_flags & RUN_RUNNING) && sc->rvp_cnt <= 1) in run_parent()
4009 if (sc->mac_ver == 0x3572) { in run_set_agc()
4026 run_bbp_write(sc, 62, 0x37 - sc->lna[group]); in run_select_chan_group()
4027 run_bbp_write(sc, 63, 0x37 - sc->lna[group]); in run_select_chan_group()
4028 run_bbp_write(sc, 64, 0x37 - sc->lna[group]); in run_select_chan_group()
4029 if (sc->mac_ver < 0x3572) in run_select_chan_group()
4032 if (sc->mac_ver == 0x3593) { in run_select_chan_group()
4038 if (sc->ext_2ghz_lna) { in run_select_chan_group()
4039 if (sc->mac_ver >= 0x5390) in run_select_chan_group()
4046 if (sc->mac_ver == 0x5592) { in run_select_chan_group()
4064 } else if (sc->mac_ver >= 0x5390) in run_select_chan_group()
4068 (sc->mac_ver == 0x3593) ? 0x62 : 0x84); in run_select_chan_group()
4073 if (sc->mac_ver == 0x5592) { in run_select_chan_group()
4091 } else if (sc->mac_ver == 0x3572) in run_select_chan_group()
4095 (sc->mac_ver == 0x3593) ? 0x82 : 0xf2); in run_select_chan_group()
4096 if (sc->ext_5ghz_lna) in run_select_chan_group()
4109 if (sc->mac_ver == 0x3593) in run_select_chan_group()
4111 if (sc->nrxchains > 1) in run_select_chan_group()
4115 if (sc->ntxchains > 1) in run_select_chan_group()
4117 if (sc->mac_ver == 0x3593) { in run_select_chan_group()
4118 if (sc->ntxchains > 2) in run_select_chan_group()
4123 if (sc->ntxchains > 1) in run_select_chan_group()
4126 if (sc->mac_ver == 0x3572) { in run_select_chan_group()
4133 if (sc->mac_ver == 0x5592) { in run_select_chan_group()
4138 if (sc->mac_ver == 0x3593) { in run_select_chan_group()
4149 if (sc->mac_ver >= 0x3070) in run_select_chan_group()
4150 agc = 0x1c + sc->lna[0] * 2; in run_select_chan_group()
4152 agc = 0x2e + sc->lna[0]; in run_select_chan_group()
4154 if (sc->mac_ver == 0x5592) in run_select_chan_group()
4155 agc = 0x24 + sc->lna[group] * 2; in run_select_chan_group()
4156 else if (sc->mac_ver == 0x3572 || sc->mac_ver == 0x3593) in run_select_chan_group()
4157 agc = 0x22 + (sc->lna[group] * 5) / 3; in run_select_chan_group()
4159 agc = 0x32 + (sc->lna[group] * 5) / 3; in run_select_chan_group()
4176 if (sc->ntxchains == 1) in run_rt2870_set_chan()
4178 if (sc->nrxchains == 1) in run_rt2870_set_chan()
4180 else if (sc->nrxchains == 2) in run_rt2870_set_chan()
4184 txpow1 = sc->txpow1[i]; in run_rt2870_set_chan()
4185 txpow2 = sc->txpow2[i]; in run_rt2870_set_chan()
4189 r4 = (rfprog[i].r4 & ~(0x001f87c0)) | (sc->freq << 15); in run_rt2870_set_chan()
4246 txpow1 = sc->txpow1[i]; in run_rt3070_set_chan()
4247 txpow2 = sc->txpow2[i]; in run_rt3070_set_chan()
4272 if (sc->ntxchains == 1) in run_rt3070_set_chan()
4274 else if (sc->ntxchains == 2) in run_rt3070_set_chan()
4276 if (sc->nrxchains == 1) in run_rt3070_set_chan()
4278 else if (sc->nrxchains == 2) in run_rt3070_set_chan()
4284 rf = (rf & ~0x7f) | sc->freq; in run_rt3070_set_chan()
4289 rf = (rf & ~0x3f) | sc->rf24_20mhz; in run_rt3070_set_chan()
4292 rf = (rf & ~0x3f) | sc->rf24_20mhz; in run_rt3070_set_chan()
4312 txpow1 = sc->txpow1[i]; in run_rt3572_set_chan()
4313 txpow2 = sc->txpow2[i]; in run_rt3572_set_chan()
4316 run_bbp_write(sc, 25, sc->bbp25); in run_rt3572_set_chan()
4317 run_bbp_write(sc, 26, sc->bbp26); in run_rt3572_set_chan()
4354 if (sc->ntxchains == 1) in run_rt3572_set_chan()
4356 else if (sc->ntxchains == 2) in run_rt3572_set_chan()
4358 if (sc->nrxchains == 1) in run_rt3572_set_chan()
4360 else if (sc->nrxchains == 2) in run_rt3572_set_chan()
4366 rf = (rf & ~0x7f) | sc->freq; in run_rt3572_set_chan()
4370 rf = sc->rf24_20mhz; in run_rt3572_set_chan()
4392 rf = 0x48 | sc->txmixgain_2ghz; in run_rt3572_set_chan()
4394 rf = 0x78 | sc->txmixgain_5ghz; in run_rt3572_set_chan()
4461 txpow1 = sc->txpow1[i]; in run_rt3593_set_chan()
4462 txpow2 = sc->txpow2[i]; in run_rt3593_set_chan()
4463 txpow3 = (sc->ntxchains == 3) ? sc->txpow3[i] : 0; in run_rt3593_set_chan()
4466 run_bbp_write(sc, 25, sc->bbp25); in run_rt3593_set_chan()
4467 run_bbp_write(sc, 26, sc->bbp26); in run_rt3593_set_chan()
4505 if (sc->ntxchains == 3) in run_rt3593_set_chan()
4516 h20mhz = (sc->rf24_20mhz & 0x20) >> 5; in run_rt3593_set_chan()
4621 txpow1 = sc->txpow1[i]; in run_rt5390_set_chan()
4622 txpow2 = sc->txpow2[i]; in run_rt5390_set_chan()
4637 if (sc->mac_ver == 0x5392) { in run_rt5390_set_chan()
4648 if (sc->mac_ver == 0x5392) in run_rt5390_set_chan()
4652 if (sc->mac_ver != 0x5392) { in run_rt5390_set_chan()
4663 if (sc->mac_ver == 0x5392) { in run_rt5390_set_chan()
4665 if (sc->mac_rev >= 0x0223) { in run_rt5390_set_chan()
4694 if (sc->mac_rev >= 0x0502) { in run_rt5390_set_chan()
4737 txpow1 = sc->txpow1[i]; in run_rt5592_set_chan()
4738 txpow2 = sc->txpow2[i]; in run_rt5592_set_chan()
4747 run_rt3070_rf_write(sc, 8, freqs->n & 0xff); in run_rt5592_set_chan()
4750 rf |= ((freqs->n & 0x0100) >> 8) << 4; in run_rt5592_set_chan()
4756 rf |= (freqs->k & 0x0f); in run_rt5592_set_chan()
4762 rf |= ((freqs->m - 0x8) & 0x3) << 2; in run_rt5592_set_chan()
4766 rf |= (((freqs->m - 0x8) & 0x4) >> 2) << 7; in run_rt5592_set_chan()
4772 rf |= (freqs->r - 0x1); in run_rt5592_set_chan()
4790 * G-band bit<7:6>=1:0, bit<5:0> range from 0x0 ~ 0x27. in run_rt5592_set_chan()
4810 * A-band bit<7:6>=1:1, bit<5:0> range from 0x0 ~ 0x2b. in run_rt5592_set_chan()
4837 if (sc->ntxchains > 1) in run_rt5592_set_chan()
4839 if (sc->nrxchains > 1) in run_rt5592_set_chan()
4864 if (sc->rf_rev == RT5390_RF_5370) { in run_set_rx_antenna()
4873 if (sc->rf_rev == RT5390_RF_5370) { in run_set_rx_antenna()
4887 struct ieee80211com *ic = &sc->sc_ic; in run_set_chan()
4894 if (sc->mac_ver == 0x5592) in run_set_chan()
4896 else if (sc->mac_ver >= 0x5390) in run_set_chan()
4898 else if (sc->mac_ver == 0x3593) in run_set_chan()
4900 else if (sc->mac_ver == 0x3572) in run_set_chan()
4902 else if (sc->mac_ver >= 0x3070) in run_set_chan()
4923 if (sc->mac_ver >= 0x5392) in run_set_chan()
4932 struct run_softc *sc = ic->ic_softc; in run_set_channel()
4935 run_set_chan(sc, ic->ic_curchan); in run_set_channel()
4945 struct run_softc *sc = ic->ic_softc; in run_getradiocaps()
4951 if (sc->rf_rev != RT3070_RF_2020) in run_getradiocaps()
4957 if (sc->rf_rev == RT2860_RF_2750 || sc->rf_rev == RT2860_RF_2850 || in run_getradiocaps()
4958 sc->rf_rev == RT3070_RF_3052 || sc->rf_rev == RT3593_RF_3053 || in run_getradiocaps()
4959 sc->rf_rev == RT5592_RF_5592) { in run_getradiocaps()
4961 if (sc->rf_rev != RT3070_RF_2020) in run_getradiocaps()
4972 struct run_softc *sc = ic->ic_softc; in run_scan_start()
4988 struct run_softc *sc = ic->ic_softc; in run_scan_end()
4993 run_set_bssid(sc, sc->sc_bssid); in run_scan_end()
5002 * (non-sleepable thread)
5007 struct ieee80211com *ic = vap->iv_ic; in run_update_beacon()
5008 struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off; in run_update_beacon()
5009 struct ieee80211_node *ni = vap->iv_bss; in run_update_beacon()
5010 struct run_softc *sc = ic->ic_softc; in run_update_beacon()
5029 setbit(bo->bo_flags, item); in run_update_beacon()
5030 if (rvp->beacon_mbuf == NULL) { in run_update_beacon()
5031 rvp->beacon_mbuf = ieee80211_beacon_alloc(ni); in run_update_beacon()
5032 if (rvp->beacon_mbuf == NULL) in run_update_beacon()
5035 ieee80211_beacon_update(ni, rvp->beacon_mbuf, mcast); in run_update_beacon()
5037 i = RUN_CMDQ_GET(&sc->cmdq_store); in run_update_beacon()
5039 sc->cmdq[i].func = run_update_beacon_cb; in run_update_beacon()
5040 sc->cmdq[i].arg0 = vap; in run_update_beacon()
5041 ieee80211_runtask(ic, &sc->cmdq_task); in run_update_beacon()
5050 struct ieee80211_node *ni = vap->iv_bss; in run_update_beacon_cb()
5052 struct ieee80211com *ic = vap->iv_ic; in run_update_beacon_cb()
5053 struct run_softc *sc = ic->ic_softc; in run_update_beacon_cb()
5059 if (ni->ni_chan == IEEE80211_CHAN_ANYC) in run_update_beacon_cb()
5061 if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) in run_update_beacon_cb()
5068 if (rvp->beacon_mbuf == NULL) { in run_update_beacon_cb()
5069 rvp->beacon_mbuf = ieee80211_beacon_alloc(ni); in run_update_beacon_cb()
5070 if (rvp->beacon_mbuf == NULL) in run_update_beacon_cb()
5073 m = rvp->beacon_mbuf; in run_update_beacon_cb()
5077 txwi.len = htole16(m->m_pkthdr.len); in run_update_beacon_cb()
5080 ridx = (ic->ic_curmode == IEEE80211_MODE_11A) ? in run_update_beacon_cb()
5089 txwisize = (sc->mac_ver == 0x5592) ? in run_update_beacon_cb()
5091 run_write_region_1(sc, RT2860_BCN_BASE(rvp->rvp_id), (uint8_t *)&txwi, in run_update_beacon_cb()
5093 run_write_region_1(sc, RT2860_BCN_BASE(rvp->rvp_id) + txwisize, in run_update_beacon_cb()
5094 mtod(m, uint8_t *), (m->m_pkthdr.len + 1) & ~1); in run_update_beacon_cb()
5100 struct run_softc *sc = ic->ic_softc; in run_updateprot()
5103 i = RUN_CMDQ_GET(&sc->cmdq_store); in run_updateprot()
5105 sc->cmdq[i].func = run_updateprot_cb; in run_updateprot()
5106 sc->cmdq[i].arg0 = ic; in run_updateprot()
5107 ieee80211_runtask(ic, &sc->cmdq_task); in run_updateprot()
5114 struct run_softc *sc = ic->ic_softc; in run_updateprot_cb()
5119 tmp |= (ic->ic_curmode == IEEE80211_MODE_11A) ? in run_updateprot_cb()
5125 if (ic->ic_flags & IEEE80211_F_USEPROT) { in run_updateprot_cb()
5126 if (ic->ic_protmode == IEEE80211_PROT_RTSCTS) in run_updateprot_cb()
5128 else if (ic->ic_protmode == IEEE80211_PROT_CTSONLY) in run_updateprot_cb()
5138 struct run_softc *sc = vap->iv_ic->ic_softc; in run_usb_timeout_cb()
5142 if(vap->iv_state == IEEE80211_S_RUN && in run_usb_timeout_cb()
5143 vap->iv_opmode != IEEE80211_M_STA) in run_usb_timeout_cb()
5145 else if (vap->iv_state == IEEE80211_S_SCAN) { in run_usb_timeout_cb()
5147 "timeout caused by scan\n"); in run_usb_timeout_cb()
5152 "timeout by unknown cause\n"); in run_usb_timeout_cb()
5164 * can run into a livelock and start sending CTS-to-self frames like in run_reset_livelock()
5171 "CTS-to-self livelock detected\n"); in run_reset_livelock()
5187 if (sc->sc_ic.ic_promisc > 0) in run_update_promisc_locked()
5193 (sc->sc_ic.ic_promisc > 0) ? "entering" : "leaving"); in run_update_promisc_locked()
5199 struct run_softc *sc = ic->ic_softc; in run_update_promisc()
5201 if ((sc->sc_flags & RUN_RUNNING) == 0) in run_update_promisc()
5212 struct ieee80211com *ic = &sc->sc_ic; in run_enable_tsf_sync()
5213 struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); in run_enable_tsf_sync()
5217 RUN_VAP(vap)->rvp_id, ic->ic_opmode); in run_enable_tsf_sync()
5221 tmp |= vap->iv_bss->ni_intval * 16; in run_enable_tsf_sync()
5224 if (ic->ic_opmode == IEEE80211_M_STA) { in run_enable_tsf_sync()
5230 } else if (ic->ic_opmode == IEEE80211_M_IBSS) { in run_enable_tsf_sync()
5237 } else if (ic->ic_opmode == IEEE80211_M_HOSTAP || in run_enable_tsf_sync()
5238 ic->ic_opmode == IEEE80211_M_MBSS) { in run_enable_tsf_sync()
5288 OFDM(6) << 28 | /* 54->48 */ in run_enable_mrr()
5289 OFDM(5) << 24 | /* 48->36 */ in run_enable_mrr()
5290 OFDM(4) << 20 | /* 36->24 */ in run_enable_mrr()
5291 OFDM(3) << 16 | /* 24->18 */ in run_enable_mrr()
5292 OFDM(2) << 12 | /* 18->12 */ in run_enable_mrr()
5293 OFDM(1) << 8 | /* 12-> 9 */ in run_enable_mrr()
5294 OFDM(0) << 4 | /* 9-> 6 */ in run_enable_mrr()
5295 OFDM(0)); /* 6-> 6 */ in run_enable_mrr()
5298 CCK(2) << 12 | /* 11->5.5 */ in run_enable_mrr()
5299 CCK(1) << 8 | /* 5.5-> 2 */ in run_enable_mrr()
5300 CCK(0) << 4 | /* 2-> 1 */ in run_enable_mrr()
5301 CCK(0)); /* 1-> 1 */ in run_enable_mrr()
5309 struct ieee80211com *ic = &sc->sc_ic; in run_set_txpreamble()
5313 if (ic->ic_flags & IEEE80211_F_SHPREAMBLE) in run_set_txpreamble()
5323 struct ieee80211com *ic = &sc->sc_ic; in run_set_basicrates()
5326 if (ic->ic_curmode == IEEE80211_MODE_11B) in run_set_basicrates()
5328 else if (ic->ic_curmode == IEEE80211_MODE_11A) in run_set_basicrates()
5338 which | (sc->leds & 0x7f)); in run_set_leds()
5362 struct run_softc *sc = ic->ic_softc; in run_updateslot()
5365 i = RUN_CMDQ_GET(&sc->cmdq_store); in run_updateslot()
5367 sc->cmdq[i].func = run_updateslot_cb; in run_updateslot()
5368 sc->cmdq[i].arg0 = ic; in run_updateslot()
5369 ieee80211_runtask(ic, &sc->cmdq_task); in run_updateslot()
5379 struct run_softc *sc = ic->ic_softc; in run_updateslot_cb()
5396 struct ieee80211com *ic = &sc->sc_ic; in run_rssi2dbm()
5397 struct ieee80211_channel *c = ic->ic_curchan; in run_rssi2dbm()
5402 delta = sc->rssi_5ghz[rxchain]; in run_rssi2dbm()
5406 delta -= sc->lna[1]; in run_rssi2dbm()
5408 delta -= sc->lna[2]; in run_rssi2dbm()
5410 delta -= sc->lna[3]; in run_rssi2dbm()
5412 delta = sc->rssi_2ghz[rxchain] - sc->lna[0]; in run_rssi2dbm()
5414 return (-12 - delta - rssi); in run_rssi2dbm()
5425 if (sc->nrxchains > 1) in run_rt5390_bbp_init()
5432 if (sc->mac_ver == 0x5592) { in run_rt5390_bbp_init()
5447 if (sc->mac_ver == 0x5392) { in run_rt5390_bbp_init()
5461 if (sc->mac_ver == 0x5592 && sc->mac_rev >= 0x0221) { in run_rt5390_bbp_init()
5467 if (sc->mac_ver == 0x5390) in run_rt5390_bbp_init()
5492 if (sc->mac_ver >= 0x5390) in run_bbp_init()
5501 if (sc->mac_ver == 0x3593) { in run_bbp_init()
5510 if (sc->mac_ver == 0x2860 && sc->mac_rev != 0x0101) in run_bbp_init()
5513 if (sc->mac_ver >= 0x3070 && (sc->mac_ver != 0x3593 && in run_bbp_init()
5514 sc->mac_ver != 0x5592)) { in run_bbp_init()
5518 } else if (sc->mac_ver == 0x2860 && sc->mac_rev == 0x0100) { in run_bbp_init()
5539 if (sc->mac_ver == 0x3572) { in run_rt3070_rf_init()
5551 if (sc->mac_ver == 0x3070 && sc->mac_rev < 0x0201) { in run_rt3070_rf_init()
5561 } else if (sc->mac_ver == 0x3071) { in run_rt3070_rf_init()
5568 if (sc->mac_rev < 0x0211) in run_rt3070_rf_init()
5578 } else if (sc->mac_ver == 0x3572) { in run_rt3070_rf_init()
5587 if (sc->mac_rev < 0x0211 || !sc->patch_dac) { in run_rt3070_rf_init()
5600 sc->rf24_20mhz = 0x1f; /* default value */ in run_rt3070_rf_init()
5601 target = (sc->mac_ver < 0x3071) ? 0x16 : 0x13; in run_rt3070_rf_init()
5602 run_rt3070_filter_calib(sc, 0x07, target, &sc->rf24_20mhz); in run_rt3070_rf_init()
5611 sc->rf24_40mhz = 0x2f; /* default value */ in run_rt3070_rf_init()
5612 target = (sc->mac_ver < 0x3071) ? 0x19 : 0x15; in run_rt3070_rf_init()
5613 run_rt3070_filter_calib(sc, 0x27, target, &sc->rf24_40mhz); in run_rt3070_rf_init()
5619 if (sc->mac_ver == 0x3572) { in run_rt3070_rf_init()
5621 run_bbp_read(sc, 25, &sc->bbp25); in run_rt3070_rf_init()
5622 run_bbp_read(sc, 26, &sc->bbp26); in run_rt3070_rf_init()
5623 } else if (sc->mac_rev < 0x0201 || sc->mac_rev < 0x0211) in run_rt3070_rf_init()
5629 if (sc->mac_ver == 0x3070 || sc->mac_ver == 0x3071) { in run_rt3070_rf_init()
5632 if ((sc->mac_ver == 0x3070 || in run_rt3070_rf_init()
5633 (sc->mac_ver == 0x3071 && sc->mac_rev >= 0x0211)) && in run_rt3070_rf_init()
5634 !sc->ext_2ghz_lna) in run_rt3070_rf_init()
5636 mingain = (sc->mac_ver == 0x3070) ? 1 : 2; in run_rt3070_rf_init()
5637 if (sc->txmixgain_2ghz >= mingain) in run_rt3070_rf_init()
5638 rf = (rf & ~0x7) | sc->txmixgain_2ghz; in run_rt3070_rf_init()
5642 if (sc->mac_ver == 0x3071) { in run_rt3070_rf_init()
5658 if (sc->mac_ver == 0x3070 || sc->mac_ver == 0x3071) { in run_rt3070_rf_init()
5662 if (sc->mac_rev < 0x0211) in run_rt3070_rf_init()
5707 sc->rf24_20mhz = 0x1f; in run_rt3593_rf_init()
5708 sc->rf24_40mhz = 0x2f; in run_rt3593_rf_init()
5711 run_bbp_read(sc, 25, &sc->bbp25); in run_rt3593_rf_init()
5712 run_bbp_read(sc, 26, &sc->bbp26); in run_rt3593_rf_init()
5726 if (sc->mac_ver == 0x5390) { in run_rt5390_rf_init()
5737 if (sc->mac_ver == 0x5592) { in run_rt5390_rf_init()
5744 } else if (sc->mac_ver == 0x5392) { in run_rt5390_rf_init()
5749 if (sc->mac_rev >= 0x0223) { in run_rt5390_rf_init()
5762 if (sc->mac_rev >= 0x0502) { in run_rt5390_rf_init()
5772 sc->rf24_20mhz = 0x1f; /* default value */ in run_rt5390_rf_init()
5773 sc->rf24_40mhz = (sc->mac_ver == 0x5592) ? 0 : 0x2f; in run_rt5390_rf_init()
5775 if (sc->mac_rev < 0x0211) in run_rt5390_rf_init()
5822 delta = bbp55_pb - bbp55_sb; in run_rt3070_filter_calib()
5832 rf24--; /* backtrack */ in run_rt3070_filter_calib()
5853 if (sc->mac_ver == 0x3572) { in run_rt3070_rf_setup()
5855 if (sc->mac_rev >= 0x0201) in run_rt3070_rf_setup()
5859 if (sc->ntxchains == 1) in run_rt3070_rf_setup()
5861 if (sc->nrxchains == 1) in run_rt3070_rf_setup()
5865 if (sc->mac_rev >= 0x0211) { in run_rt3070_rf_setup()
5872 rf = (rf & ~0x07) | sc->txmixgain_2ghz; in run_rt3070_rf_setup()
5875 } else if (sc->mac_ver == 0x3071) { in run_rt3070_rf_setup()
5876 if (sc->mac_rev >= 0x0211) { in run_rt3070_rf_setup()
5886 if (sc->ntxchains == 1) in run_rt3070_rf_setup()
5888 if (sc->nrxchains == 1) in run_rt3070_rf_setup()
5893 if (sc->mac_rev < 0x0211) { in run_rt3070_rf_setup()
5895 sc->patch_dac ? 0x2c : 0x0f); in run_rt3070_rf_setup()
5899 } else if (sc->mac_ver == 0x3070) { in run_rt3070_rf_setup()
5900 if (sc->mac_rev >= 0x0201) { in run_rt3070_rf_setup()
5909 if (sc->mac_rev < 0x0201) { in run_rt3070_rf_setup()
5917 if (sc->mac_ver >= 0x3071) { in run_rt3070_rf_setup()
5919 if (sc->rf[i].reg == 0 || sc->rf[i].reg == 0xff) in run_rt3070_rf_setup()
5921 run_rt3070_rf_write(sc, sc->rf[i].reg, sc->rf[i].val); in run_rt3070_rf_setup()
5931 if (sc->mac_rev >= 0x0211) { in run_rt3593_rf_setup()
5936 if (sc->mac_rev < 0x0211) { in run_rt3593_rf_setup()
5938 sc->patch_dac ? 0x2c : 0x0f); in run_rt3593_rf_setup()
5947 ((sc->txmixgain_2ghz & 0x07) << 2); in run_rt3593_rf_setup()
5965 if (sc->nrxchains > 1) in run_rt3593_rf_setup()
6001 if (sc->mac_rev >= 0x0211) { in run_rt5390_rf_setup()
6005 if (sc->mac_ver != 0x5592) { in run_rt5390_rf_setup()
6013 if (sc->ntxchains == 1) in run_rt5390_rf_setup()
6015 if (sc->nrxchains == 1) in run_rt5390_rf_setup()
6033 if (sc->mac_ver != 0x5592) { in run_rt5390_rf_setup()
6035 if (sc->mac_rev < 0x0211) { in run_rt5390_rf_setup()
6037 sc->patch_dac ? 0x2c : 0x0f); in run_rt5390_rf_setup()
6046 struct ieee80211com *ic = &sc->sc_ic; in run_txrx_enable()
6066 /* enable Rx bulk aggregation (set timeout and limit) */ in run_txrx_enable()
6073 if (ic->ic_opmode != IEEE80211_M_MONITOR) { in run_txrx_enable()
6078 if (ic->ic_opmode == IEEE80211_M_STA) in run_txrx_enable()
6096 rf = (rf & ~0x7f) | (sc->freq & 0x7f); in run_adjust_freq_offset()
6106 struct ieee80211com *ic = &sc->sc_ic; in run_init_locked()
6107 struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); in run_init_locked()
6114 if (ic->ic_nrunning > 1) in run_init_locked()
6120 device_printf(sc->sc_dev, "could not load 8051 microcode\n"); in run_init_locked()
6135 run_setup_tx_list(sc, &sc->sc_epq[i]); in run_init_locked()
6137 run_set_macaddr(sc, vap ? vap->iv_myaddr : ic->ic_macaddr); in run_init_locked()
6147 device_printf(sc->sc_dev, "timeout waiting for DMA engine\n"); in run_init_locked()
6154 /* turn off PME_OEN to solve high-current issue */ in run_init_locked()
6163 device_printf(sc->sc_dev, "could not reset chipset\n"); in run_init_locked()
6171 if (sc->txpow20mhz[ridx] == 0xffffffff) in run_init_locked()
6173 run_write(sc, RT2860_TX_PWR_CFG(ridx), sc->txpow20mhz[ridx]); in run_init_locked()
6182 if (sc->mac_ver >= 0x5390) { in run_init_locked()
6185 if (sc->mac_ver >= 0x5392) { in run_init_locked()
6187 if (sc->mac_ver == 0x5592) { in run_init_locked()
6195 } else if (sc->mac_ver == 0x3593) { in run_init_locked()
6198 } else if (sc->mac_ver >= 0x3070) { in run_init_locked()
6221 device_printf(sc->sc_dev, "could not initialize BBP\n"); in run_init_locked()
6234 if (sc->cmdq_key_set != RUN_CMDQ_GO) { in run_init_locked()
6245 if (sc->mac_rev != 0x0101) in run_init_locked()
6251 /* write vendor-specific BBP values (from EEPROM) */ in run_init_locked()
6252 if (sc->mac_ver < 0x3593) { in run_init_locked()
6254 if (sc->bbp[i].reg == 0 || sc->bbp[i].reg == 0xff) in run_init_locked()
6256 run_bbp_write(sc, sc->bbp[i].reg, sc->bbp[i].val); in run_init_locked()
6261 if (sc->rf_rev == RT3070_RF_3020 || sc->rf_rev == RT5390_RF_5370) in run_init_locked()
6265 (void)run_mcu_cmd(sc, RT2860_MCU_CMD_LED1, sc->led[0]); in run_init_locked()
6266 (void)run_mcu_cmd(sc, RT2860_MCU_CMD_LED2, sc->led[1]); in run_init_locked()
6267 (void)run_mcu_cmd(sc, RT2860_MCU_CMD_LED3, sc->led[2]); in run_init_locked()
6269 if (sc->mac_ver >= 0x5390) in run_init_locked()
6271 else if (sc->mac_ver == 0x3593) in run_init_locked()
6273 else if (sc->mac_ver >= 0x3070) in run_init_locked()
6276 /* disable non-existing Rx chains */ in run_init_locked()
6279 if (sc->nrxchains == 2) in run_init_locked()
6281 else if (sc->nrxchains == 3) in run_init_locked()
6285 /* disable non-existing Tx chains */ in run_init_locked()
6287 if (sc->ntxchains == 1) in run_init_locked()
6291 if (sc->mac_ver >= 0x5390) in run_init_locked()
6293 else if (sc->mac_ver == 0x3593) in run_init_locked()
6295 else if (sc->mac_ver >= 0x3070) in run_init_locked()
6299 run_set_chan(sc, ic->ic_curchan); in run_init_locked()
6311 sc->sc_flags |= RUN_RUNNING; in run_init_locked()
6312 sc->cmdq_run = RUN_CMDQ_GO; in run_init_locked()
6315 usbd_xfer_set_stall(sc->sc_xfer[i]); in run_init_locked()
6317 usbd_transfer_start(sc->sc_xfer[RUN_BULK_RX]); in run_init_locked()
6338 if (sc->sc_flags & RUN_RUNNING) in run_stop()
6341 sc->sc_flags &= ~RUN_RUNNING; in run_stop()
6343 sc->ratectl_run = RUN_RATECTL_OFF; in run_stop()
6344 sc->cmdq_run = sc->cmdq_key_set; in run_stop()
6349 usbd_transfer_drain(sc->sc_xfer[i]); in run_stop()
6355 if (sc->rx_m != NULL) { in run_stop()
6356 m_free(sc->rx_m); in run_stop()
6357 sc->rx_m = NULL; in run_stop()
6374 device_printf(sc->sc_dev, "timeout waiting for DMA engine\n"); in run_stop()
6407 run_unsetup_tx_list(sc, &sc->sc_epq[i]); in run_stop()
6411 run_delay(struct run_softc *sc, u_int ms) in run_delay() argument
6413 usb_pause_mtx(mtx_owned(&sc->sc_mtx) ? in run_delay()
6414 &sc->sc_mtx : NULL, USB_MS_TO_TICKS(ms)); in run_delay()
6425 run_ampdu_enable(struct ieee80211_node *ni, struct ieee80211_tx_ampdu *tap) in run_ampdu_enable() argument
6428 /* For now, no A-MPDU TX support in the driver */ in run_ampdu_enable()