Lines Matching +full:max +full:- +full:bitrate
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()
108 rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_OFF); in rt2x00lib_disable_radio()
109 rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_IRQ_OFF); in rt2x00lib_disable_radio()
126 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) in rt2x00lib_intf_scheduled_iter()
129 if (test_and_clear_bit(DELAYED_UPDATE_BEACON, &intf->delayed_flags)) { in rt2x00lib_intf_scheduled_iter()
130 mutex_lock(&intf->beacon_skb_mutex); in rt2x00lib_intf_scheduled_iter()
132 mutex_unlock(&intf->beacon_skb_mutex); in rt2x00lib_intf_scheduled_iter()
145 ieee80211_iterate_active_interfaces(rt2x00dev->hw, in rt2x00lib_intf_scheduled()
156 if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) in rt2x00lib_autowakeup()
159 if (rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_AWAKE)) in rt2x00lib_autowakeup()
161 clear_bit(CONFIG_POWERSAVING, &rt2x00dev->flags); in rt2x00lib_autowakeup()
175 * Only AP mode interfaces do broad- and multicast buffering in rt2x00lib_bc_buffer_iter()
177 if (vif->type != NL80211_IFTYPE_AP) in rt2x00lib_bc_buffer_iter()
181 * Send out buffered broad- and multicast frames in rt2x00lib_bc_buffer_iter()
183 skb = ieee80211_get_buffered_bc(rt2x00dev->hw, vif); in rt2x00lib_bc_buffer_iter()
185 rt2x00mac_tx(rt2x00dev->hw, &control, skb); in rt2x00lib_bc_buffer_iter()
186 skb = ieee80211_get_buffered_bc(rt2x00dev->hw, vif); in rt2x00lib_bc_buffer_iter()
195 if (vif->type != NL80211_IFTYPE_AP && in rt2x00lib_beaconupdate_iter()
196 vif->type != NL80211_IFTYPE_ADHOC && in rt2x00lib_beaconupdate_iter()
197 vif->type != NL80211_IFTYPE_MESH_POINT && in rt2x00lib_beaconupdate_iter()
198 vif->type != NL80211_IFTYPE_WDS) 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()
338 * number of max retries was reached. 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()
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(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()
778 rt2x00_err(rt2x00dev, "Wrong frame size %d max %d\n", 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()
809 * Translate the signal to the correct bitrate index. 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()
882 .bitrate = 10,
889 .bitrate = 20,
896 .bitrate = 55,
903 .bitrate = 110,
910 .bitrate = 60,
917 .bitrate = 90,
924 .bitrate = 120,
931 .bitrate = 180,
938 .bitrate = 240,
945 .bitrate = 360,
952 .bitrate = 480,
959 .bitrate = 540,
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()
995 mac_addr = of_get_mac_address(rt2x00dev->dev->of_node); in rt2x00lib_set_mac_address()
1009 struct ieee80211_hw *hw = rt2x00dev->hw; in rt2x00lib_probe_hw_modes()
1016 if (spec->supported_rates & SUPPORT_RATE_CCK) in rt2x00lib_probe_hw_modes()
1018 if (spec->supported_rates & SUPPORT_RATE_OFDM) in rt2x00lib_probe_hw_modes()
1021 channels = kcalloc(spec->num_channels, sizeof(*channels), GFP_KERNEL); in rt2x00lib_probe_hw_modes()
1023 return -ENOMEM; in rt2x00lib_probe_hw_modes()
1038 for (i = 0; i < spec->num_channels; i++) { in rt2x00lib_probe_hw_modes()
1040 spec->channels[i].channel, in rt2x00lib_probe_hw_modes()
1041 spec->channels_info[i].max_power, i); in rt2x00lib_probe_hw_modes()
1049 if (spec->supported_bands & SUPPORT_BAND_2GHZ) { in rt2x00lib_probe_hw_modes()
1050 rt2x00dev->bands[NL80211_BAND_2GHZ].n_channels = 14; in rt2x00lib_probe_hw_modes()
1051 rt2x00dev->bands[NL80211_BAND_2GHZ].n_bitrates = num_rates; in rt2x00lib_probe_hw_modes()
1052 rt2x00dev->bands[NL80211_BAND_2GHZ].channels = channels; in rt2x00lib_probe_hw_modes()
1053 rt2x00dev->bands[NL80211_BAND_2GHZ].bitrates = rates; in rt2x00lib_probe_hw_modes()
1054 hw->wiphy->bands[NL80211_BAND_2GHZ] = in rt2x00lib_probe_hw_modes()
1055 &rt2x00dev->bands[NL80211_BAND_2GHZ]; in rt2x00lib_probe_hw_modes()
1056 memcpy(&rt2x00dev->bands[NL80211_BAND_2GHZ].ht_cap, in rt2x00lib_probe_hw_modes()
1057 &spec->ht, sizeof(spec->ht)); in rt2x00lib_probe_hw_modes()
1065 if (spec->supported_bands & SUPPORT_BAND_5GHZ) { in rt2x00lib_probe_hw_modes()
1066 rt2x00dev->bands[NL80211_BAND_5GHZ].n_channels = in rt2x00lib_probe_hw_modes()
1067 spec->num_channels - 14; in rt2x00lib_probe_hw_modes()
1068 rt2x00dev->bands[NL80211_BAND_5GHZ].n_bitrates = in rt2x00lib_probe_hw_modes()
1069 num_rates - 4; in rt2x00lib_probe_hw_modes()
1070 rt2x00dev->bands[NL80211_BAND_5GHZ].channels = &channels[14]; in rt2x00lib_probe_hw_modes()
1071 rt2x00dev->bands[NL80211_BAND_5GHZ].bitrates = &rates[4]; in rt2x00lib_probe_hw_modes()
1072 hw->wiphy->bands[NL80211_BAND_5GHZ] = in rt2x00lib_probe_hw_modes()
1073 &rt2x00dev->bands[NL80211_BAND_5GHZ]; in rt2x00lib_probe_hw_modes()
1074 memcpy(&rt2x00dev->bands[NL80211_BAND_5GHZ].ht_cap, in rt2x00lib_probe_hw_modes()
1075 &spec->ht, sizeof(spec->ht)); in rt2x00lib_probe_hw_modes()
1083 return -ENOMEM; in rt2x00lib_probe_hw_modes()
1088 if (test_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags)) in rt2x00lib_remove_hw()
1089 ieee80211_unregister_hw(rt2x00dev->hw); in rt2x00lib_remove_hw()
1091 if (likely(rt2x00dev->hw->wiphy->bands[NL80211_BAND_2GHZ])) { in rt2x00lib_remove_hw()
1092 kfree(rt2x00dev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels); in rt2x00lib_remove_hw()
1093 kfree(rt2x00dev->hw->wiphy->bands[NL80211_BAND_2GHZ]->bitrates); in rt2x00lib_remove_hw()
1094 rt2x00dev->hw->wiphy->bands[NL80211_BAND_2GHZ] = NULL; in rt2x00lib_remove_hw()
1095 rt2x00dev->hw->wiphy->bands[NL80211_BAND_5GHZ] = NULL; in rt2x00lib_remove_hw()
1098 kfree(rt2x00dev->spec.channels_info); in rt2x00lib_remove_hw()
1103 struct hw_mode_spec *spec = &rt2x00dev->spec; in rt2x00lib_probe_hw()
1106 if (test_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags)) in rt2x00lib_probe_hw()
1119 rt2x00dev->hw->queues = rt2x00dev->ops->tx_queues; in rt2x00lib_probe_hw()
1124 rt2x00dev->hw->extra_tx_headroom = in rt2x00lib_probe_hw()
1126 rt2x00dev->extra_tx_headroom); in rt2x00lib_probe_hw()
1132 rt2x00dev->hw->extra_tx_headroom += RT2X00_L2PAD_SIZE; in rt2x00lib_probe_hw()
1134 rt2x00dev->hw->extra_tx_headroom += RT2X00_ALIGN_SIZE; in rt2x00lib_probe_hw()
1139 rt2x00dev->hw->sta_data_size = sizeof(struct rt2x00_sta); in rt2x00lib_probe_hw()
1153 roundup_pow_of_two(rt2x00dev->ops->tx_queues * in rt2x00lib_probe_hw()
1154 rt2x00dev->tx->limit * in rt2x00lib_probe_hw()
1157 status = kfifo_alloc(&rt2x00dev->txstatus_fifo, kfifo_size, in rt2x00lib_probe_hw()
1169 if (rt2x00dev->ops->lib->taskletname) { \ in rt2x00lib_probe_hw()
1170 tasklet_setup(&rt2x00dev->taskletname, \ in rt2x00lib_probe_hw()
1171 rt2x00dev->ops->lib->taskletname); \ in rt2x00lib_probe_hw()
1185 status = ieee80211_register_hw(rt2x00dev->hw); in rt2x00lib_probe_hw()
1189 set_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags); in rt2x00lib_probe_hw()
1199 if (!test_and_clear_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags)) in rt2x00lib_uninitialize()
1211 rt2x00dev->ops->lib->uninitialize(rt2x00dev); in rt2x00lib_uninitialize()
1223 if (test_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags)) in rt2x00lib_initialize()
1236 status = rt2x00dev->ops->lib->initialize(rt2x00dev); in rt2x00lib_initialize()
1242 set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags); in rt2x00lib_initialize()
1272 rt2x00dev->intf_ap_count = 0; in rt2x00lib_start()
1273 rt2x00dev->intf_sta_count = 0; in rt2x00lib_start()
1274 rt2x00dev->intf_associated = 0; in rt2x00lib_start()
1281 set_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags); in rt2x00lib_start()
1289 if (!test_and_clear_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) in rt2x00lib_stop()
1298 rt2x00dev->intf_ap_count = 0; in rt2x00lib_stop()
1299 rt2x00dev->intf_sta_count = 0; in rt2x00lib_stop()
1300 rt2x00dev->intf_associated = 0; in rt2x00lib_stop()
1308 if (rt2x00dev->ops->max_ap_intf < 2) in rt2x00lib_set_if_combinations()
1314 if_limit = &rt2x00dev->if_limits_ap; in rt2x00lib_set_if_combinations()
1315 if_limit->max = rt2x00dev->ops->max_ap_intf; in rt2x00lib_set_if_combinations()
1316 if_limit->types = BIT(NL80211_IFTYPE_AP); in rt2x00lib_set_if_combinations()
1318 if_limit->types |= BIT(NL80211_IFTYPE_MESH_POINT); in rt2x00lib_set_if_combinations()
1324 if_combination = &rt2x00dev->if_combinations[IF_COMB_AP]; in rt2x00lib_set_if_combinations()
1325 if_combination->limits = if_limit; in rt2x00lib_set_if_combinations()
1326 if_combination->n_limits = 1; in rt2x00lib_set_if_combinations()
1327 if_combination->max_interfaces = if_limit->max; in rt2x00lib_set_if_combinations()
1328 if_combination->num_different_channels = 1; in rt2x00lib_set_if_combinations()
1333 rt2x00dev->hw->wiphy->iface_combinations = rt2x00dev->if_combinations; in rt2x00lib_set_if_combinations()
1334 rt2x00dev->hw->wiphy->n_iface_combinations = 1; in rt2x00lib_set_if_combinations()
1339 if (WARN_ON(!rt2x00dev->tx)) in rt2x00dev_extra_tx_headroom()
1343 return rt2x00dev->tx[0].winfo_size + rt2x00dev->tx[0].desc_size; in rt2x00dev_extra_tx_headroom()
1345 return rt2x00dev->tx[0].winfo_size; in rt2x00dev_extra_tx_headroom()
1353 int retval = -ENOMEM; in rt2x00lib_probe_dev()
1363 if (rt2x00dev->ops->drv_data_size > 0) { in rt2x00lib_probe_dev()
1364 rt2x00dev->drv_data = kzalloc(rt2x00dev->ops->drv_data_size, in rt2x00lib_probe_dev()
1366 if (!rt2x00dev->drv_data) { in rt2x00lib_probe_dev()
1367 retval = -ENOMEM; in rt2x00lib_probe_dev()
1372 spin_lock_init(&rt2x00dev->irqmask_lock); in rt2x00lib_probe_dev()
1373 mutex_init(&rt2x00dev->csr_mutex); in rt2x00lib_probe_dev()
1374 mutex_init(&rt2x00dev->conf_mutex); in rt2x00lib_probe_dev()
1375 INIT_LIST_HEAD(&rt2x00dev->bar_list); in rt2x00lib_probe_dev()
1376 spin_lock_init(&rt2x00dev->bar_list_lock); in rt2x00lib_probe_dev()
1377 hrtimer_init(&rt2x00dev->txstatus_timer, CLOCK_MONOTONIC, in rt2x00lib_probe_dev()
1380 set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); in rt2x00lib_probe_dev()
1383 * Make room for rt2x00_intf inside the per-interface in rt2x00lib_probe_dev()
1386 rt2x00dev->hw->vif_data_size = sizeof(struct rt2x00_intf); in rt2x00lib_probe_dev()
1392 rt2x00dev->hw->wiphy->addr_mask[ETH_ALEN - 1] = in rt2x00lib_probe_dev()
1393 (rt2x00dev->ops->max_ap_intf - 1); in rt2x00lib_probe_dev()
1398 rt2x00dev->workqueue = in rt2x00lib_probe_dev()
1399 alloc_ordered_workqueue("%s", 0, wiphy_name(rt2x00dev->hw->wiphy)); in rt2x00lib_probe_dev()
1400 if (!rt2x00dev->workqueue) { in rt2x00lib_probe_dev()
1401 retval = -ENOMEM; in rt2x00lib_probe_dev()
1405 INIT_WORK(&rt2x00dev->intf_work, rt2x00lib_intf_scheduled); in rt2x00lib_probe_dev()
1406 INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup); in rt2x00lib_probe_dev()
1407 INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep); in rt2x00lib_probe_dev()
1412 retval = rt2x00dev->ops->lib->probe_hw(rt2x00dev); in rt2x00lib_probe_dev()
1426 rt2x00dev->extra_tx_headroom = rt2x00dev_extra_tx_headroom(rt2x00dev); in rt2x00lib_probe_dev()
1433 rt2x00dev->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); in rt2x00lib_probe_dev()
1434 if (rt2x00dev->bcn->limit > 0) in rt2x00lib_probe_dev()
1435 rt2x00dev->hw->wiphy->interface_modes |= in rt2x00lib_probe_dev()
1445 rt2x00dev->hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; in rt2x00lib_probe_dev()
1447 wiphy_ext_feature_set(rt2x00dev->hw->wiphy, in rt2x00lib_probe_dev()
1483 clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); in rt2x00lib_remove_dev()
1499 cancel_work_sync(&rt2x00dev->intf_work); in rt2x00lib_remove_dev()
1500 cancel_delayed_work_sync(&rt2x00dev->autowakeup_work); in rt2x00lib_remove_dev()
1501 cancel_work_sync(&rt2x00dev->sleep_work); in rt2x00lib_remove_dev()
1503 hrtimer_cancel(&rt2x00dev->txstatus_timer); in rt2x00lib_remove_dev()
1508 tasklet_kill(&rt2x00dev->txstatus_tasklet); in rt2x00lib_remove_dev()
1509 tasklet_kill(&rt2x00dev->pretbtt_tasklet); in rt2x00lib_remove_dev()
1510 tasklet_kill(&rt2x00dev->tbtt_tasklet); in rt2x00lib_remove_dev()
1511 tasklet_kill(&rt2x00dev->rxdone_tasklet); in rt2x00lib_remove_dev()
1512 tasklet_kill(&rt2x00dev->autowake_tasklet); in rt2x00lib_remove_dev()
1519 if (rt2x00dev->workqueue) in rt2x00lib_remove_dev()
1520 destroy_workqueue(rt2x00dev->workqueue); in rt2x00lib_remove_dev()
1525 kfifo_free(&rt2x00dev->txstatus_fifo); in rt2x00lib_remove_dev()
1551 kfree(rt2x00dev->drv_data); in rt2x00lib_remove_dev()
1565 if (!test_and_clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) in rt2x00lib_suspend()
1590 if (rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_SLEEP)) in rt2x00lib_suspend()
1610 set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); in rt2x00lib_resume()