Lines Matching +full:hw +full:- +full:channels

1 // SPDX-License-Identifier: GPL-2.0-or-later
4 Copyright (C) 2004 - 2010 Ivo van Doorn <IvDoorn@gmail.com>
34 if (rt2x00dev->intf_sta_count) in rt2x00lib_get_bssidx()
36 return vif->addr[5] & (rt2x00dev->ops->max_ap_intf - 1); in rt2x00lib_get_bssidx()
51 if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) in rt2x00lib_enable_radio()
63 rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_ON); in rt2x00lib_enable_radio()
67 rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_IRQ_ON); in rt2x00lib_enable_radio()
72 set_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags); in rt2x00lib_enable_radio()
90 if (!test_and_clear_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) in rt2x00lib_disable_radio()
104 rt2x00queue_stop_queue(rt2x00dev->bcn); in rt2x00lib_disable_radio()
109 rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_OFF); in rt2x00lib_disable_radio()
110 rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_IRQ_OFF); in rt2x00lib_disable_radio()
127 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) in rt2x00lib_intf_scheduled_iter()
130 if (test_and_clear_bit(DELAYED_UPDATE_BEACON, &intf->delayed_flags)) { in rt2x00lib_intf_scheduled_iter()
131 mutex_lock(&intf->beacon_skb_mutex); in rt2x00lib_intf_scheduled_iter()
133 mutex_unlock(&intf->beacon_skb_mutex); in rt2x00lib_intf_scheduled_iter()
146 ieee80211_iterate_active_interfaces(rt2x00dev->hw, in rt2x00lib_intf_scheduled()
157 if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) in rt2x00lib_autowakeup()
160 if (rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_AWAKE)) in rt2x00lib_autowakeup()
162 clear_bit(CONFIG_POWERSAVING, &rt2x00dev->flags); in rt2x00lib_autowakeup()
176 * Only AP mode interfaces do broad- and multicast buffering in rt2x00lib_bc_buffer_iter()
178 if (vif->type != NL80211_IFTYPE_AP) in rt2x00lib_bc_buffer_iter()
182 * Send out buffered broad- and multicast frames in rt2x00lib_bc_buffer_iter()
184 skb = ieee80211_get_buffered_bc(rt2x00dev->hw, vif); in rt2x00lib_bc_buffer_iter()
186 rt2x00mac_tx(rt2x00dev->hw, &control, skb); in rt2x00lib_bc_buffer_iter()
187 skb = ieee80211_get_buffered_bc(rt2x00dev->hw, vif); in rt2x00lib_bc_buffer_iter()
196 if (vif->type != NL80211_IFTYPE_AP && in rt2x00lib_beaconupdate_iter()
197 vif->type != NL80211_IFTYPE_ADHOC && in rt2x00lib_beaconupdate_iter()
198 vif->type != NL80211_IFTYPE_MESH_POINT) in rt2x00lib_beaconupdate_iter()
212 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) in rt2x00lib_beacondone()
217 rt2x00dev->hw, IEEE80211_IFACE_ITER_RESUME_ALL, in rt2x00lib_beacondone()
229 rt2x00dev->hw, IEEE80211_IFACE_ITER_RESUME_ALL, in rt2x00lib_beacondone()
236 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) in rt2x00lib_pretbtt()
241 rt2x00dev->hw, IEEE80211_IFACE_ITER_RESUME_ALL, in rt2x00lib_pretbtt()
248 set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); in rt2x00lib_dmastart()
255 set_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags); in rt2x00lib_dmadone()
256 clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); in rt2x00lib_dmadone()
263 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; in rt2x00lib_txdone_bar_status()
264 struct ieee80211_bar *bar = (void *) entry->skb->data; in rt2x00lib_txdone_bar_status()
268 if (likely(!ieee80211_is_back_req(bar->frame_control))) in rt2x00lib_txdone_bar_status()
277 * Instead the RX-path will scan for incoming BAs and set the in rt2x00lib_txdone_bar_status()
286 list_for_each_entry_rcu(bar_entry, &rt2x00dev->bar_list, list) { in rt2x00lib_txdone_bar_status()
287 if (bar_entry->entry != entry) in rt2x00lib_txdone_bar_status()
290 spin_lock_bh(&rt2x00dev->bar_list_lock); in rt2x00lib_txdone_bar_status()
292 ret = bar_entry->block_acked; in rt2x00lib_txdone_bar_status()
294 list_del_rcu(&bar_entry->list); in rt2x00lib_txdone_bar_status()
295 spin_unlock_bh(&rt2x00dev->bar_list_lock); in rt2x00lib_txdone_bar_status()
314 rate_idx = skbdesc->tx_rate_idx; in rt2x00lib_fill_tx_status()
315 rate_flags = skbdesc->tx_rate_flags; in rt2x00lib_fill_tx_status()
316 retry_rates = test_bit(TXDONE_FALLBACK, &txdesc->flags) ? in rt2x00lib_fill_tx_status()
317 (txdesc->retry + 1) : 1; in rt2x00lib_fill_tx_status()
322 memset(&tx_info->status, 0, sizeof(tx_info->status)); in rt2x00lib_fill_tx_status()
323 tx_info->status.ack_signal = 0; in rt2x00lib_fill_tx_status()
332 tx_info->status.rates[i].idx = rate_idx - i; in rt2x00lib_fill_tx_status()
333 tx_info->status.rates[i].flags = rate_flags; in rt2x00lib_fill_tx_status()
335 if (rate_idx - i == 0) { in rt2x00lib_fill_tx_status()
340 tx_info->status.rates[i].count = retry_rates - i; in rt2x00lib_fill_tx_status()
344 tx_info->status.rates[i].count = 1; in rt2x00lib_fill_tx_status()
346 if (i < (IEEE80211_TX_MAX_RATES - 1)) in rt2x00lib_fill_tx_status()
347 tx_info->status.rates[i].idx = -1; /* terminate */ in rt2x00lib_fill_tx_status()
349 if (test_bit(TXDONE_NO_ACK_REQ, &txdesc->flags)) in rt2x00lib_fill_tx_status()
350 tx_info->flags |= IEEE80211_TX_CTL_NO_ACK; in rt2x00lib_fill_tx_status()
352 if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK)) { in rt2x00lib_fill_tx_status()
354 tx_info->flags |= IEEE80211_TX_STAT_ACK; in rt2x00lib_fill_tx_status()
356 rt2x00dev->low_level_stats.dot11ACKFailureCount++; in rt2x00lib_fill_tx_status()
364 * by the hw we could provide the real ampdu_len to mac80211 in rt2x00lib_fill_tx_status()
368 if (test_bit(TXDONE_AMPDU, &txdesc->flags) || in rt2x00lib_fill_tx_status()
369 tx_info->flags & IEEE80211_TX_CTL_AMPDU) { in rt2x00lib_fill_tx_status()
370 tx_info->flags |= IEEE80211_TX_STAT_AMPDU | in rt2x00lib_fill_tx_status()
372 tx_info->status.ampdu_len = 1; in rt2x00lib_fill_tx_status()
373 tx_info->status.ampdu_ack_len = success ? 1 : 0; in rt2x00lib_fill_tx_status()
378 rt2x00dev->low_level_stats.dot11RTSSuccessCount++; in rt2x00lib_fill_tx_status()
380 rt2x00dev->low_level_stats.dot11RTSFailureCount++; in rt2x00lib_fill_tx_status()
390 entry->skb = NULL; in rt2x00lib_clear_entry()
391 entry->flags = 0; in rt2x00lib_clear_entry()
393 rt2x00dev->ops->lib->clear_entry(entry); in rt2x00lib_clear_entry()
404 spin_lock_bh(&entry->queue->tx_lock); in rt2x00lib_clear_entry()
405 if (!rt2x00queue_threshold(entry->queue)) in rt2x00lib_clear_entry()
406 rt2x00queue_unpause_queue(entry->queue); in rt2x00lib_clear_entry()
407 spin_unlock_bh(&entry->queue->tx_lock); in rt2x00lib_clear_entry()
413 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; in rt2x00lib_txdone_nomatch()
414 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); in rt2x00lib_txdone_nomatch()
426 skbdesc->flags &= ~SKBDESC_DESC_IN_SKB; in rt2x00lib_txdone_nomatch()
430 * we are going to overwrite the skb->cb array. in rt2x00lib_txdone_nomatch()
441 test_bit(TXDONE_SUCCESS, &txdesc->flags); in rt2x00lib_txdone_nomatch()
443 if (!test_bit(TXDONE_UNKNOWN, &txdesc->flags)) { in rt2x00lib_txdone_nomatch()
447 rt2x00dev->link.qual.tx_success += success; in rt2x00lib_txdone_nomatch()
448 rt2x00dev->link.qual.tx_failed += !success; in rt2x00lib_txdone_nomatch()
452 ieee80211_tx_status_noskb(rt2x00dev->hw, skbdesc->sta, &txinfo); in rt2x00lib_txdone_nomatch()
455 dev_kfree_skb_any(entry->skb); in rt2x00lib_txdone_nomatch()
463 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; in rt2x00lib_txdone()
464 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb); in rt2x00lib_txdone()
465 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); in rt2x00lib_txdone()
466 u8 skbdesc_flags = skbdesc->flags; in rt2x00lib_txdone()
478 skb_pull(entry->skb, rt2x00dev->extra_tx_headroom); in rt2x00lib_txdone()
483 skbdesc->flags &= ~SKBDESC_DESC_IN_SKB; in rt2x00lib_txdone()
488 header_length = ieee80211_get_hdrlen_from_skb(entry->skb); in rt2x00lib_txdone()
494 rt2x00queue_remove_l2pad(entry->skb, header_length); in rt2x00lib_txdone()
503 rt2x00crypto_tx_insert_iv(entry->skb, header_length); in rt2x00lib_txdone()
507 * we are going to overwrite the skb->cb array. in rt2x00lib_txdone()
518 test_bit(TXDONE_SUCCESS, &txdesc->flags) || in rt2x00lib_txdone()
519 test_bit(TXDONE_UNKNOWN, &txdesc->flags); in rt2x00lib_txdone()
524 rt2x00dev->link.qual.tx_success += success; in rt2x00lib_txdone()
525 rt2x00dev->link.qual.tx_failed += !success; in rt2x00lib_txdone()
537 ieee80211_tx_status_skb(rt2x00dev->hw, entry->skb); in rt2x00lib_txdone()
539 ieee80211_tx_status_ni(rt2x00dev->hw, entry->skb); in rt2x00lib_txdone()
541 dev_kfree_skb_any(entry->skb); in rt2x00lib_txdone()
565 pos = (u8 *)mgmt->u.beacon.variable; in rt2x00lib_find_ie()
585 if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) in rt2x00lib_sleep()
592 if (!test_bit(CONFIG_POWERSAVING, &rt2x00dev->flags)) in rt2x00lib_sleep()
593 rt2x00lib_config(rt2x00dev, &rt2x00dev->hw->conf, in rt2x00lib_sleep()
602 struct ieee80211_bar *ba = (void *)skb->data; in rt2x00lib_rxdone_check_ba()
604 if (likely(!ieee80211_is_back(ba->frame_control))) in rt2x00lib_rxdone_check_ba()
607 if (rxdesc->size < sizeof(*ba) + FCS_LEN) in rt2x00lib_rxdone_check_ba()
611 list_for_each_entry_rcu(entry, &rt2x00dev->bar_list, list) { in rt2x00lib_rxdone_check_ba()
613 if (ba->start_seq_num != entry->start_seq_num) in rt2x00lib_rxdone_check_ba()
620 if (!TID_CHECK(ba->control, entry->control)) in rt2x00lib_rxdone_check_ba()
625 if (!ether_addr_equal_64bits(ba->ra, entry->ta)) in rt2x00lib_rxdone_check_ba()
628 if (!ether_addr_equal_64bits(ba->ta, entry->ra)) in rt2x00lib_rxdone_check_ba()
632 spin_lock_bh(&rt2x00dev->bar_list_lock); in rt2x00lib_rxdone_check_ba()
633 entry->block_acked = 1; in rt2x00lib_rxdone_check_ba()
634 spin_unlock_bh(&rt2x00dev->bar_list_lock); in rt2x00lib_rxdone_check_ba()
645 struct ieee80211_hdr *hdr = (void *) skb->data; in rt2x00lib_rxdone_check_ps()
654 if (likely(!ieee80211_is_beacon(hdr->frame_control) || in rt2x00lib_rxdone_check_ps()
655 !(rt2x00dev->hw->conf.flags & IEEE80211_CONF_PS))) in rt2x00lib_rxdone_check_ps()
659 if (skb->len <= 40 + FCS_LEN) in rt2x00lib_rxdone_check_ps()
663 if (!(rxdesc->dev_flags & RXDONE_MY_BSS) || in rt2x00lib_rxdone_check_ps()
664 !rt2x00dev->aid) in rt2x00lib_rxdone_check_ps()
667 rt2x00dev->last_beacon = jiffies; in rt2x00lib_rxdone_check_ps()
669 tim = rt2x00lib_find_ie(skb->data, skb->len - FCS_LEN, WLAN_EID_TIM); in rt2x00lib_rxdone_check_ps()
682 cam = ieee80211_check_tim(tim_ie, tim_len, rt2x00dev->aid); in rt2x00lib_rxdone_check_ps()
685 cam |= (tim_ie->bitmap_ctrl & 0x01); in rt2x00lib_rxdone_check_ps()
687 if (!cam && !test_bit(CONFIG_POWERSAVING, &rt2x00dev->flags)) in rt2x00lib_rxdone_check_ps()
688 queue_work(rt2x00dev->workqueue, &rt2x00dev->sleep_work); in rt2x00lib_rxdone_check_ps()
697 int signal = rxdesc->signal; in rt2x00lib_rxdone_read_signal()
698 int type = (rxdesc->dev_flags & RXDONE_SIGNAL_MASK); in rt2x00lib_rxdone_read_signal()
700 switch (rxdesc->rate_mode) { in rt2x00lib_rxdone_read_signal()
704 * For non-HT rates the MCS value needs to contain the in rt2x00lib_rxdone_read_signal()
707 if (rxdesc->dev_flags & RXDONE_SIGNAL_MCS) in rt2x00lib_rxdone_read_signal()
708 signal = RATE_MCS(rxdesc->rate_mode, signal); in rt2x00lib_rxdone_read_signal()
710 sband = &rt2x00dev->bands[rt2x00dev->curr_band]; in rt2x00lib_rxdone_read_signal()
711 for (i = 0; i < sband->n_bitrates; i++) { in rt2x00lib_rxdone_read_signal()
712 rate = rt2x00_get_rate(sband->bitrates[i].hw_value); in rt2x00lib_rxdone_read_signal()
714 (rate->plcp == signal)) || in rt2x00lib_rxdone_read_signal()
716 (rate->bitrate == signal)) || in rt2x00lib_rxdone_read_signal()
718 (rate->mcs == signal))) { in rt2x00lib_rxdone_read_signal()
733 rxdesc->rate_mode, signal, type); in rt2x00lib_rxdone_read_signal()
739 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; in rt2x00lib_rxdone()
746 if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) || in rt2x00lib_rxdone()
747 !test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) in rt2x00lib_rxdone()
750 if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags)) in rt2x00lib_rxdone()
770 rt2x00dev->ops->lib->fill_rxdone(entry, &rxdesc); in rt2x00lib_rxdone()
777 rxdesc.size > entry->queue->data_size)) { in rt2x00lib_rxdone()
779 rxdesc.size, entry->queue->data_size); in rt2x00lib_rxdone()
780 dev_kfree_skb(entry->skb); in rt2x00lib_rxdone()
788 header_length = ieee80211_get_hdrlen_from_skb(entry->skb); in rt2x00lib_rxdone()
798 rt2x00crypto_rx_insert_iv(entry->skb, header_length, in rt2x00lib_rxdone()
803 rt2x00queue_remove_l2pad(entry->skb, header_length); in rt2x00lib_rxdone()
806 skb_trim(entry->skb, rxdesc.size); in rt2x00lib_rxdone()
820 rt2x00lib_rxdone_check_ps(rt2x00dev, entry->skb, &rxdesc); in rt2x00lib_rxdone()
826 rt2x00lib_rxdone_check_ba(rt2x00dev, entry->skb, &rxdesc); in rt2x00lib_rxdone()
831 rt2x00link_update_stats(rt2x00dev, entry->skb, &rxdesc); in rt2x00lib_rxdone()
839 rx_status = IEEE80211_SKB_RXCB(entry->skb); in rt2x00lib_rxdone()
842 * properly. The skb->cb array was used for driver in rt2x00lib_rxdone()
848 rx_status->mactime = rxdesc.timestamp; in rt2x00lib_rxdone()
849 rx_status->band = rt2x00dev->curr_band; in rt2x00lib_rxdone()
850 rx_status->freq = rt2x00dev->curr_freq; in rt2x00lib_rxdone()
851 rx_status->rate_idx = rate_idx; in rt2x00lib_rxdone()
852 rx_status->signal = rxdesc.rssi; in rt2x00lib_rxdone()
853 rx_status->flag = rxdesc.flags; in rt2x00lib_rxdone()
854 rx_status->enc_flags = rxdesc.enc_flags; in rt2x00lib_rxdone()
855 rx_status->encoding = rxdesc.encoding; in rt2x00lib_rxdone()
856 rx_status->bw = rxdesc.bw; in rt2x00lib_rxdone()
857 rx_status->antenna = rt2x00dev->link.ant.active.rx; in rt2x00lib_rxdone()
859 ieee80211_rx_ni(rt2x00dev->hw, entry->skb); in rt2x00lib_rxdone()
865 entry->skb = skb; in rt2x00lib_rxdone()
868 entry->flags = 0; in rt2x00lib_rxdone()
870 if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) && in rt2x00lib_rxdone()
871 test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) in rt2x00lib_rxdone()
872 rt2x00dev->ops->lib->clear_entry(entry); in rt2x00lib_rxdone()
971 entry->band = channel <= 14 ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ; in rt2x00lib_channel()
972 entry->center_freq = ieee80211_channel_to_frequency(channel, in rt2x00lib_channel()
973 entry->band); in rt2x00lib_channel()
974 entry->hw_value = value; in rt2x00lib_channel()
975 entry->max_power = tx_power; in rt2x00lib_channel()
976 entry->max_antenna_gain = 0xff; in rt2x00lib_channel()
982 entry->flags = 0; in rt2x00lib_rate()
983 entry->bitrate = rate->bitrate; in rt2x00lib_rate()
984 entry->hw_value = index; in rt2x00lib_rate()
985 entry->hw_value_short = index; in rt2x00lib_rate()
987 if (rate->flags & DEV_RATE_SHORT_PREAMBLE) in rt2x00lib_rate()
988 entry->flags |= IEEE80211_RATE_SHORT_PREAMBLE; in rt2x00lib_rate()
993 of_get_mac_address(rt2x00dev->dev->of_node, eeprom_mac_addr); in rt2x00lib_set_mac_address()
1005 struct ieee80211_hw *hw = rt2x00dev->hw; in rt2x00lib_probe_hw_modes() local
1006 struct ieee80211_channel *channels; in rt2x00lib_probe_hw_modes() local
1012 if (spec->supported_rates & SUPPORT_RATE_CCK) in rt2x00lib_probe_hw_modes()
1014 if (spec->supported_rates & SUPPORT_RATE_OFDM) in rt2x00lib_probe_hw_modes()
1017 channels = kcalloc(spec->num_channels, sizeof(*channels), GFP_KERNEL); in rt2x00lib_probe_hw_modes()
1018 if (!channels) in rt2x00lib_probe_hw_modes()
1019 return -ENOMEM; in rt2x00lib_probe_hw_modes()
1034 for (i = 0; i < spec->num_channels; i++) { in rt2x00lib_probe_hw_modes()
1035 rt2x00lib_channel(&channels[i], in rt2x00lib_probe_hw_modes()
1036 spec->channels[i].channel, in rt2x00lib_probe_hw_modes()
1037 spec->channels_info[i].max_power, i); in rt2x00lib_probe_hw_modes()
1043 * Channels: 2.4 GHz in rt2x00lib_probe_hw_modes()
1045 if (spec->supported_bands & SUPPORT_BAND_2GHZ) { in rt2x00lib_probe_hw_modes()
1046 rt2x00dev->bands[NL80211_BAND_2GHZ].n_channels = 14; in rt2x00lib_probe_hw_modes()
1047 rt2x00dev->bands[NL80211_BAND_2GHZ].n_bitrates = num_rates; in rt2x00lib_probe_hw_modes()
1048 rt2x00dev->bands[NL80211_BAND_2GHZ].channels = channels; in rt2x00lib_probe_hw_modes()
1049 rt2x00dev->bands[NL80211_BAND_2GHZ].bitrates = rates; in rt2x00lib_probe_hw_modes()
1050 hw->wiphy->bands[NL80211_BAND_2GHZ] = in rt2x00lib_probe_hw_modes()
1051 &rt2x00dev->bands[NL80211_BAND_2GHZ]; in rt2x00lib_probe_hw_modes()
1052 memcpy(&rt2x00dev->bands[NL80211_BAND_2GHZ].ht_cap, in rt2x00lib_probe_hw_modes()
1053 &spec->ht, sizeof(spec->ht)); in rt2x00lib_probe_hw_modes()
1059 * Channels: OFDM, UNII, HiperLAN2. in rt2x00lib_probe_hw_modes()
1061 if (spec->supported_bands & SUPPORT_BAND_5GHZ) { in rt2x00lib_probe_hw_modes()
1062 rt2x00dev->bands[NL80211_BAND_5GHZ].n_channels = in rt2x00lib_probe_hw_modes()
1063 spec->num_channels - 14; in rt2x00lib_probe_hw_modes()
1064 rt2x00dev->bands[NL80211_BAND_5GHZ].n_bitrates = in rt2x00lib_probe_hw_modes()
1065 num_rates - 4; in rt2x00lib_probe_hw_modes()
1066 rt2x00dev->bands[NL80211_BAND_5GHZ].channels = &channels[14]; in rt2x00lib_probe_hw_modes()
1067 rt2x00dev->bands[NL80211_BAND_5GHZ].bitrates = &rates[4]; in rt2x00lib_probe_hw_modes()
1068 hw->wiphy->bands[NL80211_BAND_5GHZ] = in rt2x00lib_probe_hw_modes()
1069 &rt2x00dev->bands[NL80211_BAND_5GHZ]; in rt2x00lib_probe_hw_modes()
1070 memcpy(&rt2x00dev->bands[NL80211_BAND_5GHZ].ht_cap, in rt2x00lib_probe_hw_modes()
1071 &spec->ht, sizeof(spec->ht)); in rt2x00lib_probe_hw_modes()
1077 kfree(channels); in rt2x00lib_probe_hw_modes()
1079 return -ENOMEM; in rt2x00lib_probe_hw_modes()
1084 if (test_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags)) in rt2x00lib_remove_hw()
1085 ieee80211_unregister_hw(rt2x00dev->hw); in rt2x00lib_remove_hw()
1087 if (likely(rt2x00dev->hw->wiphy->bands[NL80211_BAND_2GHZ])) { in rt2x00lib_remove_hw()
1088 kfree(rt2x00dev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels); in rt2x00lib_remove_hw()
1089 kfree(rt2x00dev->hw->wiphy->bands[NL80211_BAND_2GHZ]->bitrates); in rt2x00lib_remove_hw()
1090 rt2x00dev->hw->wiphy->bands[NL80211_BAND_2GHZ] = NULL; in rt2x00lib_remove_hw()
1091 rt2x00dev->hw->wiphy->bands[NL80211_BAND_5GHZ] = NULL; in rt2x00lib_remove_hw()
1094 kfree(rt2x00dev->spec.channels_info); in rt2x00lib_remove_hw()
1095 kfree(rt2x00dev->chan_survey); in rt2x00lib_remove_hw()
1113 struct hw_mode_spec *spec = &rt2x00dev->spec; in rt2x00lib_probe_hw()
1116 if (test_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags)) in rt2x00lib_probe_hw()
1120 * Initialize HW modes. in rt2x00lib_probe_hw()
1127 * Initialize HW fields. in rt2x00lib_probe_hw()
1129 rt2x00dev->hw->queues = rt2x00dev->ops->tx_queues; in rt2x00lib_probe_hw()
1134 rt2x00dev->hw->extra_tx_headroom = in rt2x00lib_probe_hw()
1136 rt2x00dev->extra_tx_headroom); in rt2x00lib_probe_hw()
1142 rt2x00dev->hw->extra_tx_headroom += RT2X00_L2PAD_SIZE; in rt2x00lib_probe_hw()
1144 rt2x00dev->hw->extra_tx_headroom += RT2X00_ALIGN_SIZE; in rt2x00lib_probe_hw()
1149 rt2x00dev->hw->sta_data_size = sizeof(struct rt2x00_sta); in rt2x00lib_probe_hw()
1163 roundup_pow_of_two(rt2x00dev->ops->tx_queues * in rt2x00lib_probe_hw()
1164 rt2x00dev->tx->limit * in rt2x00lib_probe_hw()
1167 status = kfifo_alloc(&rt2x00dev->txstatus_fifo, kfifo_size, in rt2x00lib_probe_hw()
1179 if (rt2x00dev->ops->lib->taskletname) { \ in rt2x00lib_probe_hw()
1180 tasklet_setup(&rt2x00dev->taskletname, \ in rt2x00lib_probe_hw()
1181 rt2x00dev->ops->lib->taskletname); \ in rt2x00lib_probe_hw()
1192 ieee80211_create_tpt_led_trigger(rt2x00dev->hw, in rt2x00lib_probe_hw()
1198 * Register HW. in rt2x00lib_probe_hw()
1200 status = ieee80211_register_hw(rt2x00dev->hw); in rt2x00lib_probe_hw()
1204 set_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags); in rt2x00lib_probe_hw()
1214 if (!test_and_clear_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags)) in rt2x00lib_uninitialize()
1224 * Allow the HW to uninitialize. in rt2x00lib_uninitialize()
1226 rt2x00dev->ops->lib->uninitialize(rt2x00dev); in rt2x00lib_uninitialize()
1238 if (test_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags)) in rt2x00lib_initialize()
1251 status = rt2x00dev->ops->lib->initialize(rt2x00dev); in rt2x00lib_initialize()
1257 set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags); in rt2x00lib_initialize()
1287 rt2x00dev->intf_ap_count = 0; in rt2x00lib_start()
1288 rt2x00dev->intf_sta_count = 0; in rt2x00lib_start()
1289 rt2x00dev->intf_associated = 0; in rt2x00lib_start()
1290 rt2x00dev->intf_beaconing = 0; in rt2x00lib_start()
1297 set_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags); in rt2x00lib_start()
1305 if (!test_and_clear_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) in rt2x00lib_stop()
1314 rt2x00dev->intf_ap_count = 0; in rt2x00lib_stop()
1315 rt2x00dev->intf_sta_count = 0; in rt2x00lib_stop()
1316 rt2x00dev->intf_associated = 0; in rt2x00lib_stop()
1317 rt2x00dev->intf_beaconing = 0; in rt2x00lib_stop()
1325 if (rt2x00dev->ops->max_ap_intf < 2) in rt2x00lib_set_if_combinations()
1331 if_limit = &rt2x00dev->if_limits_ap; in rt2x00lib_set_if_combinations()
1332 if_limit->max = rt2x00dev->ops->max_ap_intf; in rt2x00lib_set_if_combinations()
1333 if_limit->types = BIT(NL80211_IFTYPE_AP); in rt2x00lib_set_if_combinations()
1335 if_limit->types |= BIT(NL80211_IFTYPE_MESH_POINT); in rt2x00lib_set_if_combinations()
1341 if_combination = &rt2x00dev->if_combinations[IF_COMB_AP]; in rt2x00lib_set_if_combinations()
1342 if_combination->limits = if_limit; in rt2x00lib_set_if_combinations()
1343 if_combination->n_limits = 1; in rt2x00lib_set_if_combinations()
1344 if_combination->max_interfaces = if_limit->max; in rt2x00lib_set_if_combinations()
1345 if_combination->num_different_channels = 1; in rt2x00lib_set_if_combinations()
1350 rt2x00dev->hw->wiphy->iface_combinations = rt2x00dev->if_combinations; in rt2x00lib_set_if_combinations()
1351 rt2x00dev->hw->wiphy->n_iface_combinations = 1; in rt2x00lib_set_if_combinations()
1356 if (WARN_ON(!rt2x00dev->tx)) in rt2x00dev_extra_tx_headroom()
1360 return rt2x00dev->tx[0].winfo_size + rt2x00dev->tx[0].desc_size; in rt2x00dev_extra_tx_headroom()
1362 return rt2x00dev->tx[0].winfo_size; in rt2x00dev_extra_tx_headroom()
1370 int retval = -ENOMEM; in rt2x00lib_probe_dev()
1380 if (rt2x00dev->ops->drv_data_size > 0) { in rt2x00lib_probe_dev()
1381 rt2x00dev->drv_data = kzalloc(rt2x00dev->ops->drv_data_size, in rt2x00lib_probe_dev()
1383 if (!rt2x00dev->drv_data) { in rt2x00lib_probe_dev()
1384 retval = -ENOMEM; in rt2x00lib_probe_dev()
1389 spin_lock_init(&rt2x00dev->irqmask_lock); in rt2x00lib_probe_dev()
1390 mutex_init(&rt2x00dev->csr_mutex); in rt2x00lib_probe_dev()
1391 mutex_init(&rt2x00dev->conf_mutex); in rt2x00lib_probe_dev()
1392 INIT_LIST_HEAD(&rt2x00dev->bar_list); in rt2x00lib_probe_dev()
1393 spin_lock_init(&rt2x00dev->bar_list_lock); in rt2x00lib_probe_dev()
1394 hrtimer_init(&rt2x00dev->txstatus_timer, CLOCK_MONOTONIC, in rt2x00lib_probe_dev()
1397 set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); in rt2x00lib_probe_dev()
1400 * Make room for rt2x00_intf inside the per-interface in rt2x00lib_probe_dev()
1403 rt2x00dev->hw->vif_data_size = sizeof(struct rt2x00_intf); in rt2x00lib_probe_dev()
1409 rt2x00dev->hw->wiphy->addr_mask[ETH_ALEN - 1] = in rt2x00lib_probe_dev()
1410 (rt2x00dev->ops->max_ap_intf - 1); in rt2x00lib_probe_dev()
1415 rt2x00dev->workqueue = in rt2x00lib_probe_dev()
1416 alloc_ordered_workqueue("%s", 0, wiphy_name(rt2x00dev->hw->wiphy)); in rt2x00lib_probe_dev()
1417 if (!rt2x00dev->workqueue) { in rt2x00lib_probe_dev()
1418 retval = -ENOMEM; in rt2x00lib_probe_dev()
1422 INIT_WORK(&rt2x00dev->intf_work, rt2x00lib_intf_scheduled); in rt2x00lib_probe_dev()
1423 INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup); in rt2x00lib_probe_dev()
1424 INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep); in rt2x00lib_probe_dev()
1429 retval = rt2x00dev->ops->lib->probe_hw(rt2x00dev); in rt2x00lib_probe_dev()
1443 rt2x00dev->extra_tx_headroom = rt2x00dev_extra_tx_headroom(rt2x00dev); in rt2x00lib_probe_dev()
1450 rt2x00dev->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); in rt2x00lib_probe_dev()
1451 if (rt2x00dev->bcn->limit > 0) in rt2x00lib_probe_dev()
1452 rt2x00dev->hw->wiphy->interface_modes |= in rt2x00lib_probe_dev()
1459 rt2x00dev->hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; in rt2x00lib_probe_dev()
1461 wiphy_ext_feature_set(rt2x00dev->hw->wiphy, in rt2x00lib_probe_dev()
1469 rt2x00_err(rt2x00dev, "Failed to initialize hw\n"); in rt2x00lib_probe_dev()
1497 clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); in rt2x00lib_remove_dev()
1513 cancel_work_sync(&rt2x00dev->intf_work); in rt2x00lib_remove_dev()
1514 cancel_delayed_work_sync(&rt2x00dev->autowakeup_work); in rt2x00lib_remove_dev()
1515 cancel_work_sync(&rt2x00dev->sleep_work); in rt2x00lib_remove_dev()
1517 hrtimer_cancel(&rt2x00dev->txstatus_timer); in rt2x00lib_remove_dev()
1522 tasklet_kill(&rt2x00dev->txstatus_tasklet); in rt2x00lib_remove_dev()
1523 tasklet_kill(&rt2x00dev->pretbtt_tasklet); in rt2x00lib_remove_dev()
1524 tasklet_kill(&rt2x00dev->tbtt_tasklet); in rt2x00lib_remove_dev()
1525 tasklet_kill(&rt2x00dev->rxdone_tasklet); in rt2x00lib_remove_dev()
1526 tasklet_kill(&rt2x00dev->autowake_tasklet); in rt2x00lib_remove_dev()
1533 if (rt2x00dev->workqueue) in rt2x00lib_remove_dev()
1534 destroy_workqueue(rt2x00dev->workqueue); in rt2x00lib_remove_dev()
1539 kfifo_free(&rt2x00dev->txstatus_fifo); in rt2x00lib_remove_dev()
1565 kfree(rt2x00dev->drv_data); in rt2x00lib_remove_dev()
1579 if (!test_and_clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) in rt2x00lib_suspend()
1604 if (rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_SLEEP)) in rt2x00lib_suspend()
1624 set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); in rt2x00lib_resume()