Lines Matching defs:sc

267 static int	uath_rx_data_xfer(struct uath_softc *sc);
425 uath_open_pipes(struct uath_softc *sc)
435 altif_data = uath_lookup_alt_if(sc->sc_udev, UATH_CONFIG_NO,
450 ep_node = uath_lookup_ep_data(sc->sc_dev, sc->sc_udev,
459 err = usb_pipe_open(sc->sc_dev, &ep_node->ep_descr,
460 &policy, USB_FLAGS_SLEEP, &sc->rx_cmd_pipe);
469 ep_node = uath_lookup_ep_data(sc->sc_dev, sc->sc_udev,
479 err = usb_pipe_open(sc->sc_dev, &ep_node->ep_descr,
480 &policy, USB_FLAGS_SLEEP, &sc->tx_cmd_pipe);
488 ep_node = uath_lookup_ep_data(sc->sc_dev, sc->sc_udev,
498 err = usb_pipe_open(sc->sc_dev, &ep_node->ep_descr,
499 &policy, USB_FLAGS_SLEEP, &sc->rx_data_pipe);
507 ep_node = uath_lookup_ep_data(sc->sc_dev, sc->sc_udev,
517 err = usb_pipe_open(sc->sc_dev, &ep_node->ep_descr,
518 &policy, USB_FLAGS_SLEEP, &sc->tx_data_pipe);
528 uath_close_pipes(sc);
533 uath_close_pipes(struct uath_softc *sc)
537 if (sc->rx_cmd_pipe != NULL) {
538 usb_pipe_reset(sc->sc_dev, sc->rx_cmd_pipe, flags, NULL, 0);
539 usb_pipe_close(sc->sc_dev, sc->rx_cmd_pipe, flags, NULL, 0);
540 sc->rx_cmd_pipe = NULL;
543 if (sc->tx_cmd_pipe != NULL) {
544 usb_pipe_reset(sc->sc_dev, sc->tx_cmd_pipe, flags, NULL, 0);
545 usb_pipe_close(sc->sc_dev, sc->tx_cmd_pipe, flags, NULL, 0);
546 sc->tx_cmd_pipe = NULL;
549 if (sc->rx_data_pipe != NULL) {
550 usb_pipe_reset(sc->sc_dev, sc->rx_data_pipe, flags, NULL, 0);
551 usb_pipe_close(sc->sc_dev, sc->rx_data_pipe, flags, NULL, 0);
552 sc->rx_data_pipe = NULL;
555 if (sc->tx_data_pipe != NULL) {
556 usb_pipe_reset(sc->sc_dev, sc->tx_data_pipe, flags, NULL, 0);
557 usb_pipe_close(sc->sc_dev, sc->tx_data_pipe, flags, NULL, 0);
558 sc->tx_data_pipe = NULL;
640 uath_fw_send(struct uath_softc *sc, usb_pipe_handle_t pipe,
647 send_req = usb_alloc_bulk_req(sc->sc_dev, len, USB_FLAGS_SLEEP);
669 uath_fw_ack(struct uath_softc *sc, int len)
676 req = usb_alloc_bulk_req(sc->sc_dev, len, USB_FLAGS_SLEEP);
685 req->bulk_client_private = (usb_opaque_t)sc;
690 err = usb_pipe_bulk_xfer(sc->rx_cmd_pipe, req, USB_FLAGS_SLEEP);
756 uath_loadfirmware(struct uath_softc *sc)
808 err = uath_fw_send(sc, sc->tx_cmd_pipe, &txblock,
817 err = uath_fw_send(sc, sc->tx_data_pipe, fw_index, mlen);
825 err = uath_fw_ack(sc, sizeof (struct uath_fwblock));
846 uath_alloc_cmd_list(struct uath_softc *sc, struct uath_cmd cmds[],
854 cmd->sc = sc; /* backpointer for callbacks */
872 uath_init_cmd_list(struct uath_softc *sc)
876 sc->sc_cmdid = sc->rx_cmd_queued = sc->tx_cmd_queued = 0;
878 if (uath_rx_cmd_xfer(sc) != UATH_SUCCESS) {
900 uath_host_available(struct uath_softc *sc)
909 return (uath_cmd_read(sc, WDCMSG_HOST_AVAILABLE,
914 uath_get_capability(struct uath_softc *sc, uint32_t cap, uint32_t *val)
919 err = uath_cmd_read(sc, WDCMSG_TARGET_GET_CAPABILITY, &cap,
929 uath_get_devcap(struct uath_softc *sc)
931 struct uath_devcap *cap = &sc->sc_devcap;
934 uath_get_capability(sc, CAP_TARGET_VERSION,
936 uath_get_capability(sc, CAP_TARGET_REVISION,
938 uath_get_capability(sc, CAP_MAC_VERSION,
940 uath_get_capability(sc, CAP_MAC_REVISION,
942 uath_get_capability(sc, CAP_PHY_REVISION,
944 uath_get_capability(sc, CAP_ANALOG_5GHz_REVISION,
946 uath_get_capability(sc, CAP_ANALOG_2GHz_REVISION,
948 uath_get_capability(sc, CAP_REG_DOMAIN,
950 uath_get_capability(sc, CAP_REG_CAP_BITS,
954 /* uath_get_capability(sc, CAP_COUNTRY_CODE, cap->countryCode); */
956 uath_get_capability(sc, CAP_WIRELESS_MODES,
958 uath_get_capability(sc, CAP_CHAN_SPREAD_SUPPORT,
960 uath_get_capability(sc, CAP_COMPRESS_SUPPORT,
962 uath_get_capability(sc, CAP_BURST_SUPPORT,
964 uath_get_capability(sc, CAP_FAST_FRAMES_SUPPORT,
966 uath_get_capability(sc, CAP_CHAP_TUNING_SUPPORT,
968 uath_get_capability(sc, CAP_TURBOG_SUPPORT,
970 uath_get_capability(sc, CAP_TURBO_PRIME_SUPPORT,
972 uath_get_capability(sc, CAP_DEVICE_TYPE,
974 uath_get_capability(sc, CAP_WME_SUPPORT,
976 uath_get_capability(sc, CAP_TOTAL_QUEUES,
978 uath_get_capability(sc, CAP_CONNECTION_ID_MAX,
981 uath_get_capability(sc, CAP_LOW_5GHZ_CHAN,
983 uath_get_capability(sc, CAP_HIGH_5GHZ_CHAN,
985 uath_get_capability(sc, CAP_LOW_2GHZ_CHAN,
987 uath_get_capability(sc, CAP_HIGH_2GHZ_CHAN,
989 uath_get_capability(sc, CAP_TWICE_ANTENNAGAIN_5G,
991 uath_get_capability(sc, CAP_TWICE_ANTENNAGAIN_2G,
994 uath_get_capability(sc, CAP_CIPHER_AES_CCM,
996 uath_get_capability(sc, CAP_CIPHER_TKIP,
998 uath_get_capability(sc, CAP_MIC_TKIP,
1006 uath_get_status(struct uath_softc *sc, uint32_t which, void *odata, int olen)
1011 err = uath_cmd_read(sc, WDCMSG_TARGET_GET_STATUS,
1020 uath_get_devstatus(struct uath_softc *sc, uint8_t macaddr[IEEE80211_ADDR_LEN])
1025 err = uath_get_status(sc, ST_MAC_ADDR, macaddr, IEEE80211_ADDR_LEN);
1032 err = uath_get_status(sc, ST_SERIAL_NUMBER,
1033 &sc->sc_serial[0], sizeof (sc->sc_serial));
1113 uath_cmd_read(struct uath_softc *sc, uint32_t code, const void *idata,
1117 return (uath_cmdsend(sc, code, idata, ilen, odata, olen, flags));
1121 uath_cmd_write(struct uath_softc *sc, uint32_t code, const void *data,
1125 return (uath_cmdsend(sc, code, data, len, NULL, 0, flags));
1132 uath_cmdsend(struct uath_softc *sc, uint32_t code, const void *idata, int ilen,
1140 cmd = &sc->sc_cmd[sc->sc_cmdid];
1167 err = uath_tx_cmd_xfer(sc, sc->tx_cmd_pipe, cmd->buf, cmd->buflen);
1174 sc->sc_cmdid = (sc->sc_cmdid + 1) % UATH_CMD_LIST_COUNT;
1178 uath_cmd_lock_init(&sc->rlock);
1179 err = uath_cmd_lock_wait(&sc->rlock, 2000000);
1194 uath_cmd_lock_destroy(&sc->rlock);
1205 struct uath_softc *sc = (struct uath_softc *)req->bulk_client_private;
1212 sc->tx_cmd_queued);
1215 sc->sc_tx_err++;
1217 mutex_enter(&sc->sc_txlock_cmd);
1218 sc->tx_cmd_queued--;
1219 mutex_exit(&sc->sc_txlock_cmd);
1224 uath_tx_cmd_xfer(struct uath_softc *sc,
1231 send_req = usb_alloc_bulk_req(sc->sc_dev, len, USB_FLAGS_SLEEP);
1233 send_req->bulk_client_private = (usb_opaque_t)sc;
1253 mutex_enter(&sc->sc_txlock_cmd);
1254 sc->tx_cmd_queued++;
1255 mutex_exit(&sc->sc_txlock_cmd);
1260 uath_cmdeof(struct uath_softc *sc, struct uath_cmd *cmd)
1349 uath_cmd_lock_signal(&sc->rlock);
1371 uath_cmd_lock_signal(&sc->rlock);
1391 struct uath_softc *sc = (struct uath_softc *)req->bulk_client_private;
1402 sc->rx_cmd_queued);
1430 cmd = &sc->sc_cmd[0];
1432 cmd = &sc->sc_cmd[hdr->msgid];
1435 uath_cmdeof(sc, cmd);
1436 (void) uath_rx_cmd_xfer(sc);
1438 mutex_enter(&sc->sc_rxlock_cmd);
1439 sc->rx_cmd_queued--;
1440 mutex_exit(&sc->sc_rxlock_cmd);
1446 uath_rx_cmd_xfer(struct uath_softc *sc)
1451 req = usb_alloc_bulk_req(sc->sc_dev, UATH_MAX_CMDSZ, USB_FLAGS_SLEEP);
1459 req->bulk_client_private = (usb_opaque_t)sc;
1468 err = usb_pipe_bulk_xfer(sc->rx_cmd_pipe, req, USB_FLAGS_NOSLEEP);
1476 mutex_enter(&sc->sc_rxlock_cmd);
1477 sc->rx_cmd_queued++;
1478 mutex_exit(&sc->sc_rxlock_cmd);
1483 uath_init_data_queue(struct uath_softc *sc)
1485 sc->tx_data_queued = sc->rx_data_queued = 0;
1492 struct uath_softc *sc = (struct uath_softc *)req->bulk_client_private;
1493 struct ieee80211com *ic = &sc->sc_ic;
1500 sc->tx_data_queued);
1503 sc->sc_tx_err++;
1505 mutex_enter(&sc->sc_txlock_data);
1506 sc->tx_data_queued--;
1508 if (sc->sc_need_sched) {
1509 sc->sc_need_sched = 0;
1513 mutex_exit(&sc->sc_txlock_data);
1518 uath_tx_data_xfer(struct uath_softc *sc, mblk_t *mp)
1523 req = usb_alloc_bulk_req(sc->sc_dev, 0, USB_FLAGS_SLEEP);
1533 req->bulk_client_private = (usb_opaque_t)sc;
1541 if ((err = usb_pipe_bulk_xfer(sc->tx_data_pipe, req, 0)) !=
1550 sc->tx_data_queued++;
1558 struct uath_softc *sc = (struct uath_softc *)req->bulk_client_private;
1559 struct ieee80211com *ic = &sc->sc_ic;
1569 mutex_enter(&sc->sc_rxlock_data);
1576 sc->rx_data_queued);
1584 sc->sc_rx_err++;
1593 sc->sc_rx_err++;
1601 UATH_RESET_INTRX(sc);
1602 sc->sc_rx_err++;
1606 if (chunk->seqnum != sc->sc_intrx_nextnum) {
1609 chunk->seqnum, sc->sc_intrx_nextnum);
1610 UATH_STAT_INC(sc, st_badchunkseqnum);
1611 UATH_RESET_INTRX(sc);
1612 sc->sc_rx_err++;
1624 UATH_STAT_INC(sc, st_multichunk);
1630 sc->sc_intrx_nextnum++;
1654 UATH_STAT_INC(sc, st_toobigrxpkt);
1658 uath_update_rxstat(sc, BE_32(desc->status));
1665 sc->sc_rx_nobuf++;
1680 sc->rx_data_queued--;
1683 mutex_exit(&sc->sc_rxlock_data);
1684 if (UATH_IS_RUNNING(sc) && !UATH_IS_SUSPEND(sc)) {
1685 (void) uath_rx_data_xfer(sc);
1690 uath_rx_data_xfer(struct uath_softc *sc)
1695 req = usb_alloc_bulk_req(sc->sc_dev,
1706 req->bulk_client_private = (usb_opaque_t)sc;
1713 err = usb_pipe_bulk_xfer(sc->rx_data_pipe, req, 0);
1721 mutex_enter(&sc->sc_rxlock_data);
1722 sc->rx_data_queued++;
1723 mutex_exit(&sc->sc_rxlock_data);
1728 uath_update_rxstat(struct uath_softc *sc, uint32_t status)
1733 UATH_STAT_INC(sc, st_stopinprogress);
1736 UATH_STAT_INC(sc, st_crcerr);
1739 UATH_STAT_INC(sc, st_phyerr);
1742 UATH_STAT_INC(sc, st_decrypt_crcerr);
1745 UATH_STAT_INC(sc, st_decrypt_micerr);
1748 UATH_STAT_INC(sc, st_decomperr);
1751 UATH_STAT_INC(sc, st_keyerr);
1754 UATH_STAT_INC(sc, st_err);
1764 struct uath_softc *sc = arg;
1765 struct ieee80211com *ic = &sc->sc_ic;
1770 sc->sc_scan_id = 0;
1774 uath_create_connection(struct uath_softc *sc, uint32_t connid)
1777 struct ieee80211com *ic = &sc->sc_ic;
1801 err = uath_cmd_write(sc, WDCMSG_CREATE_CONNECTION, &create,
1807 uath_set_rates(struct uath_softc *sc, const struct ieee80211_rateset *rs)
1821 err = uath_cmd_write(sc, WDCMSG_SET_BASIC_RATE,
1827 uath_write_associd(struct uath_softc *sc)
1829 struct ieee80211com *ic = &sc->sc_ic;
1839 err = uath_cmd_write(sc, WDCMSG_WRITE_ASSOCID, &associd,
1845 uath_set_ledsteady(struct uath_softc *sc, int lednum, int ledmode)
1857 err = uath_cmd_write(sc, WDCMSG_SET_LED_STEADY, &led, sizeof (led), 0);
1862 uath_set_ledblink(struct uath_softc *sc, int lednum, int ledmode,
1878 err = uath_cmd_write(sc, WDCMSG_SET_LED_BLINK,
1887 struct uath_softc *sc = (struct uath_softc *)ic;
1896 if (sc->sc_scan_id != 0) {
1897 (void) untimeout(sc->sc_scan_id);
1898 sc->sc_scan_id = 0;
1901 UATH_LOCK(sc);
1903 if (UATH_IS_DISCONNECT(sc) && (nstate != IEEE80211_S_INIT)) {
1904 UATH_UNLOCK(sc);
1908 if (UATH_IS_SUSPEND(sc) && (nstate != IEEE80211_S_INIT)) {
1909 UATH_UNLOCK(sc);
1917 (void) uath_set_ledstate(sc, 0);
1921 if (uath_switch_channel(sc, ic->ic_curchan) != UATH_SUCCESS) {
1926 sc->sc_scan_id = timeout(uath_next_scan, (void *)sc,
1931 uath_config(sc, CFG_USER_RTS_THRESHOLD, ic->ic_rtsthreshold);
1933 if (uath_switch_channel(sc, ni->in_chan) != 0) {
1938 if (uath_create_connection(sc, UATH_ID_BSS) != 0) {
1945 if (uath_set_rates(sc, &ni->in_rates) != 0) {
1954 (void) uath_set_ledstate(sc, 1);
1964 if (uath_write_associd(sc) != 0) {
1970 (void) uath_set_ledsteady(sc, UATH_LED_LINK, UATH_LED_ON);
1972 (void) uath_set_ledblink(sc, UATH_LED_ACTIVITY,
1975 (void) uath_set_ledstate(sc, 1);
1979 UATH_UNLOCK(sc);
1981 err = sc->sc_newstate(ic, nstate, arg);
1988 struct uath_softc *sc = (struct uath_softc *)ic;
2001 mutex_enter(&sc->sc_txlock_data);
2003 if (UATH_IS_SUSPEND(sc)) {
2008 if (sc->tx_data_queued > UATH_TX_DATA_LIST_COUNT) {
2013 sc->sc_need_sched = 1;
2015 sc->sc_tx_nobuf++;
2081 desc->msgid = sc->sc_msgid; /* don't care about endianness */
2114 (void) uath_tx_data_xfer(sc, m);
2116 sc->sc_msgid = (sc->sc_msgid + 1) % UATH_TX_DATA_LIST_COUNT;
2129 mutex_exit(&sc->sc_txlock_data);
2136 struct uath_softc *sc;
2144 sc = ddi_get_soft_state(uath_soft_state_p, ddi_get_instance(devinfo));
2145 ASSERT(sc != NULL);
2146 ic = (struct ieee80211com *)&sc->sc_ic;
2148 if (!UATH_IS_RECONNECT(sc)) {
2149 err = uath_open_pipes(sc);
2156 err = uath_loadfirmware(sc);
2163 uath_close_pipes(sc);
2164 usb_client_detach(sc->sc_dev, sc->sc_udev);
2167 err = usb_reset_device(sc->sc_dev, USB_RESET_LVL_DEFAULT);
2179 err = usb_get_dev_data(devinfo, &sc->sc_udev,
2182 sc->sc_udev = NULL;
2187 vendor_id = sc->sc_udev->dev_descr->idVendor;
2188 product_id = sc->sc_udev->dev_descr->idProduct;
2189 sc->dev_flags = uath_lookup(vendor_id, product_id);
2190 if (sc->dev_flags == UATH_FLAG_ERR) {
2197 vendor_id, product_id, sc->dev_flags);
2199 UATH_LOCK(sc);
2200 sc->sc_flags |= UATH_FLAG_RECONNECT;
2201 UATH_UNLOCK(sc);
2204 err = uath_open_pipes(sc);
2214 err = uath_alloc_cmd_list(sc, sc->sc_cmd, UATH_CMD_LIST_COUNT,
2222 err = uath_init_cmd_list(sc);
2232 err = uath_host_available(sc);
2239 err = uath_get_devcap(sc);
2246 err = uath_get_devstatus(sc, ic->ic_macaddr);
2253 err = usb_check_same_device(sc->sc_dev, NULL, USB_LOG_L2, -1,
2261 err = uath_init(sc);
2268 UATH_LOCK(sc);
2269 sc->sc_flags &= ~UATH_FLAG_RECONNECT;
2270 sc->sc_flags &= ~UATH_FLAG_DISCONNECT;
2271 sc->sc_flags |= UATH_FLAG_RUNNING;
2272 UATH_UNLOCK(sc);
2281 struct uath_softc *sc;
2288 sc = ddi_get_soft_state(uath_soft_state_p, ddi_get_instance(devinfo));
2289 ASSERT(sc != NULL);
2291 if (sc->sc_flags & UATH_FLAG_RECONNECT) {
2294 uath_close_pipes(sc);
2298 UATH_LOCK(sc);
2299 sc->sc_flags |= UATH_FLAG_DISCONNECT;
2300 UATH_UNLOCK(sc);
2302 ic = (struct ieee80211com *)&sc->sc_ic;
2305 UATH_LOCK(sc);
2306 sc->sc_flags &= ~UATH_FLAG_RUNNING; /* STOP */
2307 UATH_UNLOCK(sc);
2310 uath_free_cmd_list(sc->sc_cmd, UATH_CMD_LIST_COUNT);
2313 uath_close_pipes(sc);
2322 uath_dataflush(struct uath_softc *sc)
2346 desc->msgid = sc->sc_msgid; /* don't care about endianness */
2355 err = uath_fw_send(sc, sc->tx_data_pipe, buf,
2364 sc->sc_msgid = (sc->sc_msgid + 1) % UATH_TX_DATA_LIST_COUNT;
2370 uath_cmdflush(struct uath_softc *sc)
2372 return (uath_cmd_write(sc, WDCMSG_FLUSH, NULL, 0, 0));
2376 uath_flush(struct uath_softc *sc)
2380 err = uath_dataflush(sc);
2384 err = uath_cmdflush(sc);
2394 uath_set_ledstate(struct uath_softc *sc, int connected)
2402 err = uath_cmd_write(sc, WDCMSG_SET_LED_STATE,
2408 uath_config_multi(struct uath_softc *sc, uint32_t reg, const void *data,
2419 err = uath_cmd_write(sc, WDCMSG_TARGET_SET_CONFIG, &write,
2429 uath_config(struct uath_softc *sc, uint32_t reg, uint32_t val)
2438 err = uath_cmd_write(sc, WDCMSG_TARGET_SET_CONFIG, &write,
2448 uath_switch_channel(struct uath_softc *sc, struct ieee80211_channel *c)
2453 err = uath_set_chan(sc, c);
2461 err = uath_reset_tx_queues(sc);
2469 err = uath_wme_init(sc);
2476 err = uath_set_ledstate(sc, 0);
2483 err = uath_flush(sc);
2495 uath_set_rxfilter(struct uath_softc *sc, uint32_t bits, uint32_t op)
2505 return ((uath_cmd_write(sc, WDCMSG_RX_FILTER, &rxfilter,
2510 uath_set_chan(struct uath_softc *sc, struct ieee80211_channel *c)
2512 struct ieee80211com *ic = &sc->sc_ic;
2539 return (uath_cmd_write(sc, WDCMSG_RESET, &reset, sizeof (reset), 0));
2543 uath_reset_tx_queues(struct uath_softc *sc)
2549 err = uath_cmd_write(sc, WDCMSG_RELEASE_TX_QUEUE, &qid,
2558 uath_wme_init(struct uath_softc *sc)
2583 err = uath_cmd_write(sc, WDCMSG_SETUP_TX_QUEUE, &qinfo,
2594 struct uath_softc *sc = (struct uath_softc *)arg;
2597 (void) uath_flush(sc);
2600 (void) uath_set_ledstate(sc, 0);
2603 (void) uath_cmd_write(sc, WDCMSG_TARGET_STOP, NULL, 0, 0);
2606 usb_pipe_reset(sc->sc_dev, sc->rx_data_pipe, USB_FLAGS_SLEEP, NULL, 0);
2607 usb_pipe_reset(sc->sc_dev, sc->tx_data_pipe, USB_FLAGS_SLEEP, NULL, 0);
2608 usb_pipe_reset(sc->sc_dev, sc->tx_cmd_pipe, USB_FLAGS_SLEEP, NULL, 0);
2614 struct uath_softc *sc = arg;
2615 struct ieee80211com *ic = &sc->sc_ic;
2619 if (UATH_IS_RUNNING(sc))
2620 uath_stop_locked(sc);
2622 uath_init_data_queue(sc);
2625 sc->sc_intrx_nextnum = sc->sc_msgid = 0;
2628 (void) uath_cmd_write(sc, WDCMSG_BIND, &val, sizeof (val), 0);
2631 (void) uath_config_multi(sc, CFG_MAC_ADDR,
2635 uath_config(sc, CFG_RATE_CONTROL_ENABLE, 0x00000001);
2636 uath_config(sc, CFG_DIVERSITY_CTL, 0x00000001);
2637 uath_config(sc, CFG_ABOLT, 0x0000003f);
2638 uath_config(sc, CFG_WME_ENABLED, 0x00000001);
2640 uath_config(sc, CFG_SERVICE_TYPE, 1);
2641 uath_config(sc, CFG_TP_SCALE, 0x00000000);
2642 uath_config(sc, CFG_TPC_HALF_DBM5, 0x0000003c);
2643 uath_config(sc, CFG_TPC_HALF_DBM2, 0x0000003c);
2644 uath_config(sc, CFG_OVERRD_TX_POWER, 0x00000000);
2645 uath_config(sc, CFG_GMODE_PROTECTION, 0x00000000);
2646 uath_config(sc, CFG_GMODE_PROTECT_RATE_INDEX, 0x00000003);
2647 uath_config(sc, CFG_PROTECTION_TYPE, 0x00000000);
2648 uath_config(sc, CFG_MODE_CTS, 0x00000002);
2650 err = uath_cmd_read(sc, WDCMSG_TARGET_START, NULL, 0,
2663 err = uath_switch_channel(sc, ic->ic_curchan);
2671 (void) uath_cmd_write(sc, WDCMSG_SET_PWR_MODE, &val, sizeof (val), 0);
2673 (void) uath_cmd_write(sc, WDCMSG_RESET_KEY_CACHE, NULL, 0, 0);
2676 err = uath_rx_data_xfer(sc);
2685 (void) uath_set_rxfilter(sc, 0x0, UATH_FILTER_OP_INIT);
2686 (void) uath_set_rxfilter(sc,
2694 uath_stop_locked(sc);
2699 uath_init(struct uath_softc *sc)
2703 UATH_LOCK(sc);
2704 err = uath_init_locked(sc);
2708 UATH_UNLOCK(sc);
2711 UATH_UNLOCK(sc);
2716 uath_stop(struct uath_softc *sc)
2721 UATH_LOCK(sc);
2722 uath_stop_locked(sc);
2723 UATH_UNLOCK(sc);
2727 uath_resume(struct uath_softc *sc)
2735 if (usb_check_same_device(sc->sc_dev, NULL, USB_LOG_L2, -1,
2745 err = uath_init_cmd_list(sc);
2752 err = uath_init(sc);
2756 uath_stop(sc);
2760 ieee80211_new_state(&sc->sc_ic, IEEE80211_S_INIT, -1);
2761 UATH_LOCK(sc);
2762 sc->sc_flags &= ~UATH_FLAG_SUSPEND;
2763 sc->sc_flags |= UATH_FLAG_RUNNING;
2764 UATH_UNLOCK(sc);
2770 struct uath_softc *sc = (struct uath_softc *)arg;
2771 struct ieee80211com *ic = &sc->sc_ic;
2777 err = uath_init(sc);
2781 uath_stop(sc);
2787 UATH_LOCK(sc);
2788 sc->sc_flags |= UATH_FLAG_RUNNING;
2789 UATH_UNLOCK(sc);
2796 struct uath_softc *sc = (struct uath_softc *)arg;
2797 struct ieee80211com *ic = &sc->sc_ic;
2801 if (!UATH_IS_DISCONNECT(sc))
2802 uath_stop(sc);
2804 UATH_LOCK(sc);
2805 sc->sc_flags &= ~UATH_FLAG_RUNNING;
2806 UATH_UNLOCK(sc);
2812 struct uath_softc *sc = (struct uath_softc *)arg;
2813 struct ieee80211com *ic = &sc->sc_ic;
2817 UATH_LOCK(sc);
2820 if (UATH_IS_RUNNING(sc)) {
2821 UATH_UNLOCK(sc);
2822 (void) uath_init(sc);
2825 UATH_LOCK(sc);
2829 UATH_UNLOCK(sc);
2860 struct uath_softc *sc = (struct uath_softc *)arg;
2861 struct ieee80211com *ic = &sc->sc_ic;
2866 UATH_LOCK(sc);
2868 if (ic->ic_des_esslen && UATH_IS_RUNNING(sc)) {
2869 UATH_UNLOCK(sc);
2870 (void) uath_init(sc);
2872 UATH_LOCK(sc);
2876 UATH_UNLOCK(sc);
2884 struct uath_softc *sc = (struct uath_softc *)arg;
2887 err = ieee80211_getprop(&sc->sc_ic, pr_name, wldp_pr_num,
2896 struct uath_softc *sc = (struct uath_softc *)arg;
2898 ieee80211_propinfo(&sc->sc_ic, pr_name, wldp_pr_num, prh);
2904 struct uath_softc *sc = (struct uath_softc *)arg;
2905 struct ieee80211com *ic = &sc->sc_ic;
2909 UATH_LOCK(sc);
2919 *val = sc->sc_tx_nobuf;
2922 *val = sc->sc_rx_nobuf;
2925 *val = sc->sc_rx_err;
2941 *val = sc->sc_tx_err;
2944 *val = sc->sc_tx_retries;
2956 UATH_UNLOCK(sc);
2959 UATH_UNLOCK(sc);
2962 UATH_UNLOCK(sc);
2970 struct uath_softc *sc = (struct uath_softc *)arg;
2971 struct ieee80211com *ic = &sc->sc_ic;
2980 UATH_IS_SUSPEND(sc)) {
3002 struct uath_softc *sc;
3016 sc = ddi_get_soft_state(uath_soft_state_p,
3018 ASSERT(sc != NULL);
3019 uath_resume(sc);
3033 sc = ddi_get_soft_state(uath_soft_state_p, instance);
3034 ic = (ieee80211com_t *)&sc->sc_ic;
3035 sc->sc_dev = devinfo;
3044 err = usb_get_dev_data(devinfo, &sc->sc_udev, USB_PARSE_LVL_ALL, 0);
3046 sc->sc_udev = NULL;
3052 vendor_id = sc->sc_udev->dev_descr->idVendor;
3053 product_id = sc->sc_udev->dev_descr->idProduct;
3054 sc->dev_flags = uath_lookup(vendor_id, product_id);
3055 if (sc->dev_flags == UATH_FLAG_ERR) {
3063 vendor_id, product_id, sc->dev_flags);
3069 err = uath_open_pipes(sc);
3076 if (sc->dev_flags & UATH_FLAG_PRE_FIRMWARE) {
3077 err = uath_loadfirmware(sc);
3085 uath_close_pipes(sc);
3086 usb_client_detach(sc->sc_dev, sc->sc_udev);
3103 mutex_init(&sc->sc_genlock, NULL, MUTEX_DRIVER, NULL);
3104 mutex_init(&sc->sc_rxlock_cmd, NULL, MUTEX_DRIVER, NULL);
3105 mutex_init(&sc->sc_txlock_cmd, NULL, MUTEX_DRIVER, NULL);
3106 mutex_init(&sc->sc_rxlock_data, NULL, MUTEX_DRIVER, NULL);
3107 mutex_init(&sc->sc_txlock_data, NULL, MUTEX_DRIVER, NULL);
3112 err = uath_alloc_cmd_list(sc, sc->sc_cmd, UATH_CMD_LIST_COUNT,
3120 err = uath_init_cmd_list(sc);
3130 err = uath_host_available(sc);
3137 err = uath_get_devcap(sc);
3144 err = uath_get_devstatus(sc, ic->ic_macaddr);
3192 sc->sc_newstate = ic->ic_newstate;
3197 sc->sc_flags = 0;
3214 macp->m_driver = sc;
3262 uath_free_cmd_list(sc->sc_cmd, UATH_CMD_LIST_COUNT);
3264 mutex_destroy(&sc->sc_genlock);
3265 mutex_destroy(&sc->sc_rxlock_cmd);
3266 mutex_destroy(&sc->sc_rxlock_data);
3267 mutex_destroy(&sc->sc_txlock_cmd);
3268 mutex_destroy(&sc->sc_txlock_data);
3270 uath_close_pipes(sc);
3272 usb_client_detach(sc->sc_dev, sc->sc_udev);
3281 struct uath_softc *sc;
3283 sc = ddi_get_soft_state(uath_soft_state_p, ddi_get_instance(devinfo));
3284 ASSERT(sc != NULL);
3290 if (UATH_IS_RUNNING(sc)) {
3291 ieee80211_new_state(&sc->sc_ic, IEEE80211_S_INIT, -1);
3292 uath_stop(sc);
3294 UATH_LOCK(sc);
3295 sc->sc_flags &= ~UATH_FLAG_RUNNING;
3296 sc->sc_flags |= UATH_FLAG_SUSPEND;
3297 UATH_UNLOCK(sc);
3303 if (sc->dev_flags & UATH_FLAG_PRE_FIRMWARE) {
3309 if (!UATH_IS_DISCONNECT(sc) && UATH_IS_RUNNING(sc))
3310 uath_stop(sc);
3312 uath_free_cmd_list(sc->sc_cmd, UATH_CMD_LIST_COUNT);
3314 if (mac_disable(sc->sc_ic.ic_mach) != 0)
3320 if (mac_unregister(sc->sc_ic.ic_mach) != 0)
3326 ieee80211_detach(&sc->sc_ic);
3329 uath_close_pipes(sc);
3332 mutex_destroy(&sc->sc_genlock);
3333 mutex_destroy(&sc->sc_rxlock_cmd);
3334 mutex_destroy(&sc->sc_rxlock_data);
3335 mutex_destroy(&sc->sc_txlock_cmd);
3336 mutex_destroy(&sc->sc_txlock_data);
3339 usb_client_detach(devinfo, sc->sc_udev);
3340 sc->sc_udev = NULL;