Lines Matching +full:dsd +full:- +full:path

1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* ZD1211 USB-WLAN driver for Linux
4 * Copyright (C) 2005-2007 Ulrich Kunitz <kune@deine-taler.de>
5 * Copyright (C) 2006-2007 Daniel Drake <dsd@gentoo.org>
6 * Copyright (C) 2006-2007 Michael Wu <flamingice@sourmilk.net>
7 * Copyright (C) 2007-2008 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
86 * - packet is sent using 4 different rates
87 * - 1st rate is index 3 (ie 11 Mbits)
88 * - 2nd rate is index 2 (ie 5.5 Mbits)
89 * - 3rd rate is index 1 (ie 2 Mbits)
90 * - 4th rate is index 0 (ie 1 Mbits)
141 if (regdomain == reg_map->reg) { in zd_reg2alpha2()
142 alpha2[0] = reg_map->alpha2[0]; in zd_reg2alpha2()
143 alpha2[1] = reg_map->alpha2[1]; in zd_reg2alpha2()
172 r = zd_chip_read_mac_addr_fw(&mac->chip, addr); in zd_mac_preinit_hw()
185 struct zd_chip *chip = &mac->chip; in zd_mac_init_hw()
201 spin_lock_irq(&mac->lock); in zd_mac_init_hw()
202 mac->regdomain = mac->default_regdomain = default_regdomain; in zd_mac_init_hw()
203 spin_unlock_irq(&mac->lock); in zd_mac_init_hw()
211 r = zd_reg2alpha2(mac->regdomain, alpha2); in zd_mac_init_hw()
215 r = regulatory_hint(hw->wiphy, alpha2); in zd_mac_init_hw()
225 zd_chip_clear(&mac->chip); in zd_mac_clear()
234 spin_lock_irqsave(&mac->lock, flags); in set_rx_filter()
235 if (mac->pass_ctrl) in set_rx_filter()
237 spin_unlock_irqrestore(&mac->lock, flags); in set_rx_filter()
239 return zd_iowrite32(&mac->chip, CR_RX_FILTER, filter); in set_rx_filter()
246 if (!mac->vif) in set_mac_and_bssid()
247 return -1; in set_mac_and_bssid()
249 r = zd_write_mac_addr(&mac->chip, mac->vif->addr); in set_mac_and_bssid()
256 if (mac->type != NL80211_IFTYPE_AP) in set_mac_and_bssid()
259 return zd_write_bssid(&mac->chip, mac->vif->addr); in set_mac_and_bssid()
266 return zd_chip_set_multicast_hash(&mac->chip, &hash); in set_mc_hash()
272 struct zd_chip *chip = &mac->chip; in zd_op_start()
273 struct zd_usb *usb = &chip->usb; in zd_op_start()
276 if (!usb->initialized) { in zd_op_start()
317 set_bit(ZD_DEVICE_RUNNING, &mac->flags); in zd_op_start()
332 struct zd_chip *chip = &mac->chip; in zd_op_stop()
334 struct sk_buff_head *ack_wait_queue = &mac->ack_wait_queue; in zd_op_stop()
336 clear_bit(ZD_DEVICE_RUNNING, &mac->flags); in zd_op_stop()
367 spin_lock_irq(&mac->lock); in zd_restore_settings()
368 multicast_hash = mac->multicast_hash; in zd_restore_settings()
369 short_preamble = mac->short_preamble; in zd_restore_settings()
370 beacon_interval = mac->beacon.interval; in zd_restore_settings()
371 beacon_period = mac->beacon.period; in zd_restore_settings()
372 channel = mac->channel; in zd_restore_settings()
373 spin_unlock_irq(&mac->lock); in zd_restore_settings()
381 r = zd_chip_set_channel(&mac->chip, channel); in zd_restore_settings()
390 r = zd_chip_set_multicast_hash(&mac->chip, &multicast_hash); in zd_restore_settings()
397 if (mac->type == NL80211_IFTYPE_MESH_POINT || in zd_restore_settings()
398 mac->type == NL80211_IFTYPE_ADHOC || in zd_restore_settings()
399 mac->type == NL80211_IFTYPE_AP) { in zd_restore_settings()
400 if (mac->vif != NULL) { in zd_restore_settings()
401 beacon = ieee80211_beacon_get(mac->hw, mac->vif, 0); in zd_restore_settings()
403 zd_mac_config_beacon(mac->hw, beacon, false); in zd_restore_settings()
406 zd_set_beacon_interval(&mac->chip, beacon_interval, in zd_restore_settings()
407 beacon_period, mac->type); in zd_restore_settings()
409 spin_lock_irq(&mac->lock); in zd_restore_settings()
410 mac->beacon.last_update = jiffies; in zd_restore_settings()
411 spin_unlock_irq(&mac->lock); in zd_restore_settings()
418 * zd_mac_tx_status - reports tx status of a packet if required
420 * @skb: a sk-buffer
442 success = !tx_status->failure; in zd_mac_tx_status()
443 retry = tx_status->retry + success; in zd_mac_tx_status()
448 info->flags |= IEEE80211_TX_STAT_ACK; in zd_mac_tx_status()
451 info->flags &= ~IEEE80211_TX_STAT_ACK; in zd_mac_tx_status()
454 first_idx = info->status.rates[0].idx; in zd_mac_tx_status()
457 ZD_ASSERT(1 <= retry && retry <= retries->count); in zd_mac_tx_status()
459 info->status.rates[0].idx = retries->rate[0]; in zd_mac_tx_status()
460 info->status.rates[0].count = 1; // (retry > 1 ? 2 : 1); in zd_mac_tx_status()
462 for (i=1; i<IEEE80211_TX_MAX_RATES-1 && i<retry; i++) { in zd_mac_tx_status()
463 info->status.rates[i].idx = retries->rate[i]; in zd_mac_tx_status()
464 info->status.rates[i].count = 1; // ((i==retry-1) && success ? 1:2); in zd_mac_tx_status()
467 info->status.rates[i].idx = retries->rate[retry - 1]; in zd_mac_tx_status()
468 info->status.rates[i].count = 1; // (success ? 1:2); in zd_mac_tx_status()
471 info->status.rates[i].idx = -1; /* terminate */ in zd_mac_tx_status()
473 info->status.ack_signal = zd_check_signal(hw, ackssi); in zd_mac_tx_status()
478 * zd_mac_tx_failed - callback for failed frames
487 struct ieee80211_hw * hw = zd_usb_to_hw(urb->context); in zd_mac_tx_failed()
489 struct sk_buff_head *q = &mac->ack_wait_queue; in zd_mac_tx_failed()
491 struct tx_status *tx_status = (struct tx_status *)urb->transfer_buffer; in zd_mac_tx_failed()
493 int success = !tx_status->failure; in zd_mac_tx_failed()
494 int retry = tx_status->retry + success; in zd_mac_tx_failed()
498 spin_lock_irqsave(&q->lock, flags); in zd_mac_tx_failed()
512 if (tx_status->failure && mac->ack_pending && in zd_mac_tx_failed()
517 tx_hdr = (struct ieee80211_hdr *)skb->data; in zd_mac_tx_failed()
520 if (unlikely(!ether_addr_equal(tx_hdr->addr1, tx_status->mac))) in zd_mac_tx_failed()
526 first_idx = info->status.rates[0].idx; in zd_mac_tx_failed()
529 if (retry <= 0 || retry > retries->count) in zd_mac_tx_failed()
532 final_idx = retries->rate[retry - 1]; in zd_mac_tx_failed()
535 if (final_rate != tx_status->rate) { in zd_mac_tx_failed()
547 mac->ack_pending ? mac->ack_signal : 0, in zd_mac_tx_failed()
549 mac->ack_pending = 0; in zd_mac_tx_failed()
553 spin_unlock_irqrestore(&q->lock, flags); in zd_mac_tx_failed()
557 * zd_mac_tx_to_dev - callback for USB layer
569 struct ieee80211_hw *hw = info->rate_driver_data[0]; in zd_mac_tx_to_dev()
576 (info->flags & IEEE80211_TX_CTL_NO_ACK))) { in zd_mac_tx_to_dev()
582 struct sk_buff_head *q = &mac->ack_wait_queue; in zd_mac_tx_to_dev()
587 mac->ack_pending ? mac->ack_signal : 0, in zd_mac_tx_to_dev()
589 mac->ack_pending = 0; in zd_mac_tx_to_dev()
597 * the zd-rate values. in zd_calc_tx_length_us()
620 return -EINVAL; in zd_calc_tx_length_us()
647 * - if backoff needed, enable bit 0 in cs_set_control()
648 * - if burst (backoff not needed) disable bit 0 in cs_set_control()
651 cs->control = 0; in cs_set_control()
654 if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) in cs_set_control()
655 cs->control |= ZD_CS_NEED_RANDOM_BACKOFF; in cs_set_control()
658 if (info->flags & IEEE80211_TX_CTL_NO_ACK) in cs_set_control()
659 cs->control |= ZD_CS_NO_ACK; in cs_set_control()
661 /* PS-POLL */ in cs_set_control()
662 if (ieee80211_is_pspoll(header->frame_control)) in cs_set_control()
663 cs->control |= ZD_CS_PS_POLL_FRAME; in cs_set_control()
665 if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) in cs_set_control()
666 cs->control |= ZD_CS_RTS; in cs_set_control()
668 if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) in cs_set_control()
669 cs->control |= ZD_CS_SELF_CTS; in cs_set_control()
676 if (!mac->beacon.cur_beacon) in zd_mac_match_cur_beacon()
679 if (mac->beacon.cur_beacon->len != beacon->len) in zd_mac_match_cur_beacon()
682 return !memcmp(beacon->data, mac->beacon.cur_beacon->data, beacon->len); in zd_mac_match_cur_beacon()
687 ZD_ASSERT(mutex_is_locked(&mac->chip.mutex)); in zd_mac_free_cur_beacon_locked()
689 kfree_skb(mac->beacon.cur_beacon); in zd_mac_free_cur_beacon_locked()
690 mac->beacon.cur_beacon = NULL; in zd_mac_free_cur_beacon_locked()
695 mutex_lock(&mac->chip.mutex); in zd_mac_free_cur_beacon()
697 mutex_unlock(&mac->chip.mutex); in zd_mac_free_cur_beacon()
707 u32 full_len = beacon->len + 4; in zd_mac_config_beacon()
711 mutex_lock(&mac->chip.mutex); in zd_mac_config_beacon()
720 num_cmds = 1 + zd_chip_is_zd1211b(&mac->chip) + full_len; in zd_mac_config_beacon()
724 r = -ENOMEM; in zd_mac_config_beacon()
728 r = zd_iowrite32_locked(&mac->chip, 0, CR_BCN_FIFO_SEMAPHORE); in zd_mac_config_beacon()
731 r = zd_ioread32_locked(&mac->chip, &tmp, CR_BCN_FIFO_SEMAPHORE); in zd_mac_config_beacon()
735 r = -EBUSY; in zd_mac_config_beacon()
742 r = zd_ioread32_locked(&mac->chip, &tmp, CR_BCN_FIFO_SEMAPHORE); in zd_mac_config_beacon()
752 r = -ETIMEDOUT; in zd_mac_config_beacon()
760 ioreqs[req_pos].value = full_len - 1; in zd_mac_config_beacon()
762 if (zd_chip_is_zd1211b(&mac->chip)) { in zd_mac_config_beacon()
764 ioreqs[req_pos].value = full_len - 1; in zd_mac_config_beacon()
768 for (j = 0 ; j < beacon->len; j++) { in zd_mac_config_beacon()
770 ioreqs[req_pos].value = *((u8 *)(beacon->data + j)); in zd_mac_config_beacon()
782 r = zd_iowrite32a_locked(&mac->chip, ioreqs, num_cmds); in zd_mac_config_beacon()
790 ret = zd_iowrite32_locked(&mac->chip, 1, CR_BCN_FIFO_SEMAPHORE); in zd_mac_config_beacon()
793 ret = -ETIMEDOUT; in zd_mac_config_beacon()
798 ret = zd_iowrite32_locked(&mac->chip, 1, CR_BCN_FIFO_SEMAPHORE); in zd_mac_config_beacon()
817 mac->beacon.cur_beacon = beacon; in zd_mac_config_beacon()
824 r = zd_iowrite32_locked(&mac->chip, 0x00000400 | (full_len << 19), in zd_mac_config_beacon()
830 mutex_unlock(&mac->chip.mutex); in zd_mac_config_beacon()
838 mutex_unlock(&mac->chip.mutex); in zd_mac_config_beacon()
844 usb_queue_reset_device(mac->chip.usb.intf); in zd_mac_config_beacon()
853 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; in fill_ctrlset()
854 unsigned int frag_len = skb->len + FCS_LEN; in fill_ctrlset()
867 if (!ieee80211_is_pspoll(hdr->frame_control)) in fill_ctrlset()
868 hdr->duration_id = 0; in fill_ctrlset()
870 txrate = ieee80211_get_tx_rate(mac->hw, info); in fill_ctrlset()
872 cs->modulation = txrate->hw_value; in fill_ctrlset()
873 if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) in fill_ctrlset()
874 cs->modulation = txrate->hw_value_short; in fill_ctrlset()
876 cs->tx_length = cpu_to_le16(frag_len); in fill_ctrlset()
885 cs->packet_length = cpu_to_le16(zd_chip_is_zd1211b(&mac->chip) ? in fill_ctrlset()
886 packet_length - frag_len : packet_length); in fill_ctrlset()
890 * - transmit frame length in microseconds in fill_ctrlset()
891 * - seems to be derived from frame length in fill_ctrlset()
892 * - see Cal_Us_Service() in zdinlinef.h in fill_ctrlset()
893 * - if macp->bTxBurstEnable is enabled, then multiply by 4 in fill_ctrlset()
894 * - bTxBurstEnable is never set in the vendor driver in fill_ctrlset()
897 * - "for PLCP configuration" in fill_ctrlset()
898 * - always 0 except in some situations at 802.11b 11M in fill_ctrlset()
899 * - see line 53 of zdinlinef.h in fill_ctrlset()
901 cs->service = 0; in fill_ctrlset()
902 r = zd_calc_tx_length_us(&cs->service, ZD_RATE(cs->modulation), in fill_ctrlset()
903 le16_to_cpu(cs->tx_length)); in fill_ctrlset()
906 cs->current_length = cpu_to_le16(r); in fill_ctrlset()
907 cs->next_frame_length = 0; in fill_ctrlset()
913 * zd_op_tx - transmits a network frame to the device
935 info->rate_driver_data[0] = hw; in zd_op_tx()
937 r = zd_usb_tx(&mac->chip.usb, skb); in zd_op_tx()
947 * filter_ack - filters incoming packets for acknowledgements
970 if (!ieee80211_is_ack(rx_hdr->frame_control)) in filter_ack()
973 q = &mac->ack_wait_queue; in filter_ack()
974 spin_lock_irqsave(&q->lock, flags); in filter_ack()
980 if (mac->ack_pending && skb_queue_is_first(q, skb)) in filter_ack()
983 tx_hdr = (struct ieee80211_hdr *)skb->data; in filter_ack()
984 if (likely(ether_addr_equal(tx_hdr->addr2, rx_hdr->addr1))) in filter_ack()
995 mac->ack_pending ? mac->ack_signal : 0, in filter_ack()
997 mac->ack_pending = 0; in filter_ack()
1000 mac->ack_pending = 1; in filter_ack()
1001 mac->ack_signal = stats->signal; in filter_ack()
1003 /* Prevent pending tx-packet on AP-mode */ in filter_ack()
1004 if (mac->type == NL80211_IFTYPE_AP) { in filter_ack()
1006 zd_mac_tx_status(hw, skb, mac->ack_signal, NULL); in filter_ack()
1007 mac->ack_pending = 0; in filter_ack()
1011 spin_unlock_irqrestore(&q->lock, flags); in filter_ack()
1029 return -EINVAL; in zd_mac_rx()
1039 * situation may change once we implement some kind of DMA-into-skb in zd_mac_rx()
1040 * RX path. */ in zd_mac_rx()
1044 (buffer + (length - sizeof(struct rx_status))); in zd_mac_rx()
1045 if (status->frame_status & ZD_RX_ERROR) { in zd_mac_rx()
1046 if (mac->pass_failed_fcs && in zd_mac_rx()
1047 (status->frame_status & ZD_RX_CRC32_ERROR)) { in zd_mac_rx()
1051 return -EINVAL; in zd_mac_rx()
1055 stats.freq = zd_channels[_zd_chip_get_channel(&mac->chip) - 1].center_freq; in zd_mac_rx()
1057 stats.signal = zd_check_signal(hw, status->signal_strength); in zd_mac_rx()
1062 for (i = 0; i < mac->band.n_bitrates; i++) in zd_mac_rx()
1063 if (rate == mac->band.bitrates[i].hw_value) in zd_mac_rx()
1066 length -= ZD_PLCP_HEADER_SIZE + sizeof(struct rx_status); in zd_mac_rx()
1076 && !mac->pass_ctrl) in zd_mac_rx()
1084 return -ENOMEM; in zd_mac_rx()
1104 if (mac->type != NL80211_IFTYPE_UNSPECIFIED) in zd_op_add_interface()
1105 return -EOPNOTSUPP; in zd_op_add_interface()
1107 switch (vif->type) { in zd_op_add_interface()
1113 mac->type = vif->type; in zd_op_add_interface()
1116 return -EOPNOTSUPP; in zd_op_add_interface()
1119 mac->vif = vif; in zd_op_add_interface()
1128 mac->type = NL80211_IFTYPE_UNSPECIFIED; in zd_op_remove_interface()
1129 mac->vif = NULL; in zd_op_remove_interface()
1130 zd_set_beacon_interval(&mac->chip, 0, 0, NL80211_IFTYPE_UNSPECIFIED); in zd_op_remove_interface()
1131 zd_write_mac_addr(&mac->chip, NULL); in zd_op_remove_interface()
1139 struct ieee80211_conf *conf = &hw->conf; in zd_op_config()
1141 spin_lock_irq(&mac->lock); in zd_op_config()
1142 mac->channel = conf->chandef.chan->hw_value; in zd_op_config()
1143 spin_unlock_irq(&mac->lock); in zd_op_config()
1145 return zd_chip_set_channel(&mac->chip, conf->chandef.chan->hw_value); in zd_op_config()
1152 if (!test_bit(ZD_DEVICE_RUNNING, &mac->flags)) in zd_beacon_done()
1154 if (!mac->vif || mac->vif->type != NL80211_IFTYPE_AP) in zd_beacon_done()
1158 * Send out buffered broad- and multicast frames. in zd_beacon_done()
1160 while (!ieee80211_queue_stopped(mac->hw, 0)) { in zd_beacon_done()
1161 skb = ieee80211_get_buffered_bc(mac->hw, mac->vif); in zd_beacon_done()
1164 zd_op_tx(mac->hw, NULL, skb); in zd_beacon_done()
1170 beacon = ieee80211_beacon_get(mac->hw, mac->vif, 0); in zd_beacon_done()
1172 zd_mac_config_beacon(mac->hw, beacon, true); in zd_beacon_done()
1174 spin_lock_irq(&mac->lock); in zd_beacon_done()
1175 mac->beacon.last_update = jiffies; in zd_beacon_done()
1176 spin_unlock_irq(&mac->lock); in zd_beacon_done()
1185 spin_lock_irqsave(&mac->lock, flags); in zd_process_intr()
1186 int_status = le16_to_cpu(*(__le16 *)(mac->intr_buffer + 4)); in zd_process_intr()
1187 spin_unlock_irqrestore(&mac->lock, flags); in zd_process_intr()
1196 zd_chip_enable_hwint(&mac->chip); in zd_process_intr()
1210 dev_dbg_f(zd_mac_dev(mac), "mc addr %pM\n", ha->addr); in zd_op_prepare_multicast()
1211 zd_mc_add_addr(&hash, ha->addr); in zd_op_prepare_multicast()
1247 spin_lock_irqsave(&mac->lock, flags); in zd_op_configure_filter()
1248 mac->pass_failed_fcs = !!(*new_flags & FIF_FCSFAIL); in zd_op_configure_filter()
1249 mac->pass_ctrl = !!(*new_flags & FIF_CONTROL); in zd_op_configure_filter()
1250 mac->multicast_hash = hash; in zd_op_configure_filter()
1251 spin_unlock_irqrestore(&mac->lock, flags); in zd_op_configure_filter()
1253 zd_chip_set_multicast_hash(&mac->chip, &hash); in zd_op_configure_filter()
1273 mutex_lock(&mac->chip.mutex); in set_rts_cts()
1274 zd_chip_set_rts_cts_rate_locked(&mac->chip, short_preamble); in set_rts_cts()
1275 mutex_unlock(&mac->chip.mutex); in set_rts_cts()
1288 if (mac->type == NL80211_IFTYPE_MESH_POINT || in zd_op_bss_info_changed()
1289 mac->type == NL80211_IFTYPE_ADHOC || in zd_op_bss_info_changed()
1290 mac->type == NL80211_IFTYPE_AP) { in zd_op_bss_info_changed()
1297 zd_chip_disable_hwint(&mac->chip); in zd_op_bss_info_changed()
1299 zd_chip_enable_hwint(&mac->chip); in zd_op_bss_info_changed()
1307 if (bss_conf->enable_beacon) { in zd_op_bss_info_changed()
1308 period = bss_conf->dtim_period; in zd_op_bss_info_changed()
1309 interval = bss_conf->beacon_int; in zd_op_bss_info_changed()
1312 spin_lock_irq(&mac->lock); in zd_op_bss_info_changed()
1313 mac->beacon.period = period; in zd_op_bss_info_changed()
1314 mac->beacon.interval = interval; in zd_op_bss_info_changed()
1315 mac->beacon.last_update = jiffies; in zd_op_bss_info_changed()
1316 spin_unlock_irq(&mac->lock); in zd_op_bss_info_changed()
1318 zd_set_beacon_interval(&mac->chip, interval, period, in zd_op_bss_info_changed()
1319 mac->type); in zd_op_bss_info_changed()
1322 associated = is_valid_ether_addr(bss_conf->bssid); in zd_op_bss_info_changed()
1324 spin_lock_irq(&mac->lock); in zd_op_bss_info_changed()
1325 mac->associated = associated; in zd_op_bss_info_changed()
1326 spin_unlock_irq(&mac->lock); in zd_op_bss_info_changed()
1331 spin_lock_irq(&mac->lock); in zd_op_bss_info_changed()
1332 mac->short_preamble = bss_conf->use_short_preamble; in zd_op_bss_info_changed()
1333 spin_unlock_irq(&mac->lock); in zd_op_bss_info_changed()
1335 set_rts_cts(mac, bss_conf->use_short_preamble); in zd_op_bss_info_changed()
1342 return zd_chip_get_tsf(&mac->chip); in zd_op_get_tsf()
1370 dev_dbg_f(&intf->dev, "out of memory\n"); in zd_mac_alloc_hw()
1377 spin_lock_init(&mac->lock); in zd_mac_alloc_hw()
1378 mac->hw = hw; in zd_mac_alloc_hw()
1380 mac->type = NL80211_IFTYPE_UNSPECIFIED; in zd_mac_alloc_hw()
1382 memcpy(mac->channels, zd_channels, sizeof(zd_channels)); in zd_mac_alloc_hw()
1383 memcpy(mac->rates, zd_rates, sizeof(zd_rates)); in zd_mac_alloc_hw()
1384 mac->band.n_bitrates = ARRAY_SIZE(zd_rates); in zd_mac_alloc_hw()
1385 mac->band.bitrates = mac->rates; in zd_mac_alloc_hw()
1386 mac->band.n_channels = ARRAY_SIZE(zd_channels); in zd_mac_alloc_hw()
1387 mac->band.channels = mac->channels; in zd_mac_alloc_hw()
1389 hw->wiphy->bands[NL80211_BAND_2GHZ] = &mac->band; in zd_mac_alloc_hw()
1396 hw->wiphy->interface_modes = in zd_mac_alloc_hw()
1402 wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); in zd_mac_alloc_hw()
1404 hw->max_signal = 100; in zd_mac_alloc_hw()
1405 hw->queues = 1; in zd_mac_alloc_hw()
1406 hw->extra_tx_headroom = sizeof(struct zd_ctrlset); in zd_mac_alloc_hw()
1411 hw->max_rates = IEEE80211_TX_MAX_RATES; in zd_mac_alloc_hw()
1412 hw->max_rate_tries = 18; /* 9 rates * 2 retries/rate */ in zd_mac_alloc_hw()
1414 skb_queue_head_init(&mac->ack_wait_queue); in zd_mac_alloc_hw()
1415 mac->ack_pending = 0; in zd_mac_alloc_hw()
1417 zd_chip_init(&mac->chip, hw, intf); in zd_mac_alloc_hw()
1420 INIT_WORK(&mac->process_intr, zd_process_intr); in zd_mac_alloc_hw()
1422 SET_IEEE80211_DEV(hw, &intf->dev); in zd_mac_alloc_hw()
1436 if (!test_bit(ZD_DEVICE_RUNNING, &mac->flags)) in beacon_watchdog_handler()
1438 if (mac->type != NL80211_IFTYPE_AP || !mac->vif) in beacon_watchdog_handler()
1441 spin_lock_irq(&mac->lock); in beacon_watchdog_handler()
1442 interval = mac->beacon.interval; in beacon_watchdog_handler()
1443 period = mac->beacon.period; in beacon_watchdog_handler()
1444 timeout = mac->beacon.last_update + in beacon_watchdog_handler()
1446 spin_unlock_irq(&mac->lock); in beacon_watchdog_handler()
1454 zd_chip_disable_hwint(&mac->chip); in beacon_watchdog_handler()
1456 beacon = ieee80211_beacon_get(mac->hw, mac->vif, 0); in beacon_watchdog_handler()
1460 zd_mac_config_beacon(mac->hw, beacon, false); in beacon_watchdog_handler()
1463 zd_set_beacon_interval(&mac->chip, interval, period, mac->type); in beacon_watchdog_handler()
1465 zd_chip_enable_hwint(&mac->chip); in beacon_watchdog_handler()
1467 spin_lock_irq(&mac->lock); in beacon_watchdog_handler()
1468 mac->beacon.last_update = jiffies; in beacon_watchdog_handler()
1469 spin_unlock_irq(&mac->lock); in beacon_watchdog_handler()
1473 queue_delayed_work(zd_workqueue, &mac->beacon.watchdog_work, in beacon_watchdog_handler()
1479 INIT_DELAYED_WORK(&mac->beacon.watchdog_work, beacon_watchdog_handler); in beacon_init()
1486 mac->beacon.last_update = jiffies; in beacon_enable()
1487 queue_delayed_work(zd_workqueue, &mac->beacon.watchdog_work, in beacon_enable()
1494 cancel_delayed_work_sync(&mac->beacon.watchdog_work); in beacon_disable()
1505 struct zd_chip *chip = &mac->chip; in link_led_handler()
1509 if (!test_bit(ZD_DEVICE_RUNNING, &mac->flags)) in link_led_handler()
1512 spin_lock_irq(&mac->lock); in link_led_handler()
1513 is_associated = mac->associated; in link_led_handler()
1514 spin_unlock_irq(&mac->lock); in link_led_handler()
1522 queue_delayed_work(zd_workqueue, &mac->housekeeping.link_led_work, in link_led_handler()
1528 INIT_DELAYED_WORK(&mac->housekeeping.link_led_work, link_led_handler); in housekeeping_init()
1534 queue_delayed_work(zd_workqueue, &mac->housekeeping.link_led_work, in housekeeping_enable()
1541 cancel_delayed_work_sync(&mac->housekeeping.link_led_work); in housekeeping_disable()
1542 zd_chip_control_leds(&mac->chip, ZD_LED_OFF); in housekeeping_disable()