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()
211 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) in rt2x00lib_beacondone()
216 rt2x00dev->hw, IEEE80211_IFACE_ITER_RESUME_ALL, in rt2x00lib_beacondone()
228 rt2x00dev->hw, IEEE80211_IFACE_ITER_RESUME_ALL, in rt2x00lib_beacondone()
235 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) in rt2x00lib_pretbtt()
240 rt2x00dev->hw, IEEE80211_IFACE_ITER_RESUME_ALL, in rt2x00lib_pretbtt()
247 set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); in rt2x00lib_dmastart()
254 set_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags); in rt2x00lib_dmadone()
255 clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); in rt2x00lib_dmadone()
262 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; in rt2x00lib_txdone_bar_status()
263 struct ieee80211_bar *bar = (void *) entry->skb->data; in rt2x00lib_txdone_bar_status()
267 if (likely(!ieee80211_is_back_req(bar->frame_control))) in rt2x00lib_txdone_bar_status()
276 * Instead the RX-path will scan for incoming BAs and set the in rt2x00lib_txdone_bar_status()
285 list_for_each_entry_rcu(bar_entry, &rt2x00dev->bar_list, list) { in rt2x00lib_txdone_bar_status()
286 if (bar_entry->entry != entry) in rt2x00lib_txdone_bar_status()
289 spin_lock_bh(&rt2x00dev->bar_list_lock); in rt2x00lib_txdone_bar_status()
291 ret = bar_entry->block_acked; in rt2x00lib_txdone_bar_status()
293 list_del_rcu(&bar_entry->list); in rt2x00lib_txdone_bar_status()
294 spin_unlock_bh(&rt2x00dev->bar_list_lock); in rt2x00lib_txdone_bar_status()
313 rate_idx = skbdesc->tx_rate_idx; in rt2x00lib_fill_tx_status()
314 rate_flags = skbdesc->tx_rate_flags; in rt2x00lib_fill_tx_status()
315 retry_rates = test_bit(TXDONE_FALLBACK, &txdesc->flags) ? in rt2x00lib_fill_tx_status()
316 (txdesc->retry + 1) : 1; in rt2x00lib_fill_tx_status()
321 memset(&tx_info->status, 0, sizeof(tx_info->status)); in rt2x00lib_fill_tx_status()
322 tx_info->status.ack_signal = 0; in rt2x00lib_fill_tx_status()
331 tx_info->status.rates[i].idx = rate_idx - i; in rt2x00lib_fill_tx_status()
332 tx_info->status.rates[i].flags = rate_flags; in rt2x00lib_fill_tx_status()
334 if (rate_idx - i == 0) { in rt2x00lib_fill_tx_status()
337 * number of max retries was reached. in rt2x00lib_fill_tx_status()
339 tx_info->status.rates[i].count = retry_rates - i; in rt2x00lib_fill_tx_status()
343 tx_info->status.rates[i].count = 1; in rt2x00lib_fill_tx_status()
345 if (i < (IEEE80211_TX_MAX_RATES - 1)) in rt2x00lib_fill_tx_status()
346 tx_info->status.rates[i].idx = -1; /* terminate */ in rt2x00lib_fill_tx_status()
348 if (test_bit(TXDONE_NO_ACK_REQ, &txdesc->flags)) in rt2x00lib_fill_tx_status()
349 tx_info->flags |= IEEE80211_TX_CTL_NO_ACK; in rt2x00lib_fill_tx_status()
351 if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK)) { in rt2x00lib_fill_tx_status()
353 tx_info->flags |= IEEE80211_TX_STAT_ACK; in rt2x00lib_fill_tx_status()
355 rt2x00dev->low_level_stats.dot11ACKFailureCount++; in rt2x00lib_fill_tx_status()
367 if (test_bit(TXDONE_AMPDU, &txdesc->flags) || in rt2x00lib_fill_tx_status()
368 tx_info->flags & IEEE80211_TX_CTL_AMPDU) { in rt2x00lib_fill_tx_status()
369 tx_info->flags |= IEEE80211_TX_STAT_AMPDU | in rt2x00lib_fill_tx_status()
371 tx_info->status.ampdu_len = 1; in rt2x00lib_fill_tx_status()
372 tx_info->status.ampdu_ack_len = success ? 1 : 0; in rt2x00lib_fill_tx_status()
377 rt2x00dev->low_level_stats.dot11RTSSuccessCount++; in rt2x00lib_fill_tx_status()
379 rt2x00dev->low_level_stats.dot11RTSFailureCount++; in rt2x00lib_fill_tx_status()
389 entry->skb = NULL; in rt2x00lib_clear_entry()
390 entry->flags = 0; in rt2x00lib_clear_entry()
392 rt2x00dev->ops->lib->clear_entry(entry); in rt2x00lib_clear_entry()
403 spin_lock_bh(&entry->queue->tx_lock); in rt2x00lib_clear_entry()
404 if (!rt2x00queue_threshold(entry->queue)) in rt2x00lib_clear_entry()
405 rt2x00queue_unpause_queue(entry->queue); in rt2x00lib_clear_entry()
406 spin_unlock_bh(&entry->queue->tx_lock); in rt2x00lib_clear_entry()
412 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; in rt2x00lib_txdone_nomatch()
413 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); in rt2x00lib_txdone_nomatch()
425 skbdesc->flags &= ~SKBDESC_DESC_IN_SKB; in rt2x00lib_txdone_nomatch()
429 * we are going to overwrite the skb->cb array. in rt2x00lib_txdone_nomatch()
440 test_bit(TXDONE_SUCCESS, &txdesc->flags); in rt2x00lib_txdone_nomatch()
442 if (!test_bit(TXDONE_UNKNOWN, &txdesc->flags)) { in rt2x00lib_txdone_nomatch()
446 rt2x00dev->link.qual.tx_success += success; in rt2x00lib_txdone_nomatch()
447 rt2x00dev->link.qual.tx_failed += !success; in rt2x00lib_txdone_nomatch()
451 ieee80211_tx_status_noskb(rt2x00dev->hw, skbdesc->sta, &txinfo); in rt2x00lib_txdone_nomatch()
454 dev_kfree_skb_any(entry->skb); in rt2x00lib_txdone_nomatch()
462 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; in rt2x00lib_txdone()
463 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb); in rt2x00lib_txdone()
464 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); in rt2x00lib_txdone()
465 u8 skbdesc_flags = skbdesc->flags; in rt2x00lib_txdone()
477 skb_pull(entry->skb, rt2x00dev->extra_tx_headroom); in rt2x00lib_txdone()
482 skbdesc->flags &= ~SKBDESC_DESC_IN_SKB; in rt2x00lib_txdone()
487 header_length = ieee80211_get_hdrlen_from_skb(entry->skb); in rt2x00lib_txdone()
493 rt2x00queue_remove_l2pad(entry->skb, header_length); in rt2x00lib_txdone()
502 rt2x00crypto_tx_insert_iv(entry->skb, header_length); in rt2x00lib_txdone()
506 * we are going to overwrite the skb->cb array. in rt2x00lib_txdone()
517 test_bit(TXDONE_SUCCESS, &txdesc->flags) || in rt2x00lib_txdone()
518 test_bit(TXDONE_UNKNOWN, &txdesc->flags); in rt2x00lib_txdone()
523 rt2x00dev->link.qual.tx_success += success; in rt2x00lib_txdone()
524 rt2x00dev->link.qual.tx_failed += !success; in rt2x00lib_txdone()
536 ieee80211_tx_status(rt2x00dev->hw, entry->skb); in rt2x00lib_txdone()
538 ieee80211_tx_status_ni(rt2x00dev->hw, entry->skb); in rt2x00lib_txdone()
540 dev_kfree_skb_any(entry->skb); in rt2x00lib_txdone()
564 pos = (u8 *)mgmt->u.beacon.variable; in rt2x00lib_find_ie()
584 if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) in rt2x00lib_sleep()
591 if (!test_bit(CONFIG_POWERSAVING, &rt2x00dev->flags)) in rt2x00lib_sleep()
592 rt2x00lib_config(rt2x00dev, &rt2x00dev->hw->conf, in rt2x00lib_sleep()
601 struct ieee80211_bar *ba = (void *)skb->data; in rt2x00lib_rxdone_check_ba()
603 if (likely(!ieee80211_is_back(ba->frame_control))) in rt2x00lib_rxdone_check_ba()
606 if (rxdesc->size < sizeof(*ba) + FCS_LEN) in rt2x00lib_rxdone_check_ba()
610 list_for_each_entry_rcu(entry, &rt2x00dev->bar_list, list) { in rt2x00lib_rxdone_check_ba()
612 if (ba->start_seq_num != entry->start_seq_num) in rt2x00lib_rxdone_check_ba()
619 if (!TID_CHECK(ba->control, entry->control)) in rt2x00lib_rxdone_check_ba()
624 if (!ether_addr_equal_64bits(ba->ra, entry->ta)) in rt2x00lib_rxdone_check_ba()
627 if (!ether_addr_equal_64bits(ba->ta, entry->ra)) in rt2x00lib_rxdone_check_ba()
631 spin_lock_bh(&rt2x00dev->bar_list_lock); in rt2x00lib_rxdone_check_ba()
632 entry->block_acked = 1; in rt2x00lib_rxdone_check_ba()
633 spin_unlock_bh(&rt2x00dev->bar_list_lock); in rt2x00lib_rxdone_check_ba()
644 struct ieee80211_hdr *hdr = (void *) skb->data; in rt2x00lib_rxdone_check_ps()
653 if (likely(!ieee80211_is_beacon(hdr->frame_control) || in rt2x00lib_rxdone_check_ps()
654 !(rt2x00dev->hw->conf.flags & IEEE80211_CONF_PS))) in rt2x00lib_rxdone_check_ps()
658 if (skb->len <= 40 + FCS_LEN) in rt2x00lib_rxdone_check_ps()
662 if (!(rxdesc->dev_flags & RXDONE_MY_BSS) || in rt2x00lib_rxdone_check_ps()
663 !rt2x00dev->aid) in rt2x00lib_rxdone_check_ps()
666 rt2x00dev->last_beacon = jiffies; in rt2x00lib_rxdone_check_ps()
668 tim = rt2x00lib_find_ie(skb->data, skb->len - FCS_LEN, WLAN_EID_TIM); in rt2x00lib_rxdone_check_ps()
681 cam = ieee80211_check_tim(tim_ie, tim_len, rt2x00dev->aid); in rt2x00lib_rxdone_check_ps()
684 cam |= (tim_ie->bitmap_ctrl & 0x01); in rt2x00lib_rxdone_check_ps()
686 if (!cam && !test_bit(CONFIG_POWERSAVING, &rt2x00dev->flags)) in rt2x00lib_rxdone_check_ps()
687 queue_work(rt2x00dev->workqueue, &rt2x00dev->sleep_work); in rt2x00lib_rxdone_check_ps()
696 int signal = rxdesc->signal; in rt2x00lib_rxdone_read_signal()
697 int type = (rxdesc->dev_flags & RXDONE_SIGNAL_MASK); in rt2x00lib_rxdone_read_signal()
699 switch (rxdesc->rate_mode) { in rt2x00lib_rxdone_read_signal()
703 * For non-HT rates the MCS value needs to contain the in rt2x00lib_rxdone_read_signal()
706 if (rxdesc->dev_flags & RXDONE_SIGNAL_MCS) in rt2x00lib_rxdone_read_signal()
707 signal = RATE_MCS(rxdesc->rate_mode, signal); in rt2x00lib_rxdone_read_signal()
709 sband = &rt2x00dev->bands[rt2x00dev->curr_band]; in rt2x00lib_rxdone_read_signal()
710 for (i = 0; i < sband->n_bitrates; i++) { in rt2x00lib_rxdone_read_signal()
711 rate = rt2x00_get_rate(sband->bitrates[i].hw_value); in rt2x00lib_rxdone_read_signal()
713 (rate->plcp == signal)) || in rt2x00lib_rxdone_read_signal()
715 (rate->bitrate == signal)) || in rt2x00lib_rxdone_read_signal()
717 (rate->mcs == signal))) { in rt2x00lib_rxdone_read_signal()
732 rxdesc->rate_mode, signal, type); in rt2x00lib_rxdone_read_signal()
738 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; in rt2x00lib_rxdone()
745 if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) || in rt2x00lib_rxdone()
746 !test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) in rt2x00lib_rxdone()
749 if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags)) in rt2x00lib_rxdone()
769 rt2x00dev->ops->lib->fill_rxdone(entry, &rxdesc); in rt2x00lib_rxdone()
776 rxdesc.size > entry->queue->data_size)) { in rt2x00lib_rxdone()
777 rt2x00_err(rt2x00dev, "Wrong frame size %d max %d\n", in rt2x00lib_rxdone()
778 rxdesc.size, entry->queue->data_size); in rt2x00lib_rxdone()
779 dev_kfree_skb(entry->skb); in rt2x00lib_rxdone()
787 header_length = ieee80211_get_hdrlen_from_skb(entry->skb); in rt2x00lib_rxdone()
797 rt2x00crypto_rx_insert_iv(entry->skb, header_length, in rt2x00lib_rxdone()
802 rt2x00queue_remove_l2pad(entry->skb, header_length); in rt2x00lib_rxdone()
805 skb_trim(entry->skb, rxdesc.size); in rt2x00lib_rxdone()
808 * Translate the signal to the correct bitrate index. in rt2x00lib_rxdone()
819 rt2x00lib_rxdone_check_ps(rt2x00dev, entry->skb, &rxdesc); in rt2x00lib_rxdone()
825 rt2x00lib_rxdone_check_ba(rt2x00dev, entry->skb, &rxdesc); in rt2x00lib_rxdone()
830 rt2x00link_update_stats(rt2x00dev, entry->skb, &rxdesc); in rt2x00lib_rxdone()
838 rx_status = IEEE80211_SKB_RXCB(entry->skb); in rt2x00lib_rxdone()
841 * properly. The skb->cb array was used for driver in rt2x00lib_rxdone()
847 rx_status->mactime = rxdesc.timestamp; in rt2x00lib_rxdone()
848 rx_status->band = rt2x00dev->curr_band; in rt2x00lib_rxdone()
849 rx_status->freq = rt2x00dev->curr_freq; in rt2x00lib_rxdone()
850 rx_status->rate_idx = rate_idx; in rt2x00lib_rxdone()
851 rx_status->signal = rxdesc.rssi; in rt2x00lib_rxdone()
852 rx_status->flag = rxdesc.flags; in rt2x00lib_rxdone()
853 rx_status->enc_flags = rxdesc.enc_flags; in rt2x00lib_rxdone()
854 rx_status->encoding = rxdesc.encoding; in rt2x00lib_rxdone()
855 rx_status->bw = rxdesc.bw; in rt2x00lib_rxdone()
856 rx_status->antenna = rt2x00dev->link.ant.active.rx; in rt2x00lib_rxdone()
858 ieee80211_rx_ni(rt2x00dev->hw, entry->skb); in rt2x00lib_rxdone()
864 entry->skb = skb; in rt2x00lib_rxdone()
867 entry->flags = 0; in rt2x00lib_rxdone()
869 if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) && in rt2x00lib_rxdone()
870 test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) in rt2x00lib_rxdone()
871 rt2x00dev->ops->lib->clear_entry(entry); in rt2x00lib_rxdone()
881 .bitrate = 10,
888 .bitrate = 20,
895 .bitrate = 55,
902 .bitrate = 110,
909 .bitrate = 60,
916 .bitrate = 90,
923 .bitrate = 120,
930 .bitrate = 180,
937 .bitrate = 240,
944 .bitrate = 360,
951 .bitrate = 480,
958 .bitrate = 540,
970 entry->band = channel <= 14 ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ; in rt2x00lib_channel()
971 entry->center_freq = ieee80211_channel_to_frequency(channel, in rt2x00lib_channel()
972 entry->band); in rt2x00lib_channel()
973 entry->hw_value = value; in rt2x00lib_channel()
974 entry->max_power = tx_power; in rt2x00lib_channel()
975 entry->max_antenna_gain = 0xff; in rt2x00lib_channel()
981 entry->flags = 0; in rt2x00lib_rate()
982 entry->bitrate = rate->bitrate; in rt2x00lib_rate()
983 entry->hw_value = index; in rt2x00lib_rate()
984 entry->hw_value_short = index; in rt2x00lib_rate()
986 if (rate->flags & DEV_RATE_SHORT_PREAMBLE) in rt2x00lib_rate()
987 entry->flags |= IEEE80211_RATE_SHORT_PREAMBLE; in rt2x00lib_rate()
992 of_get_mac_address(rt2x00dev->dev->of_node, eeprom_mac_addr); in rt2x00lib_set_mac_address()
1004 struct ieee80211_hw *hw = rt2x00dev->hw; in rt2x00lib_probe_hw_modes()
1011 if (spec->supported_rates & SUPPORT_RATE_CCK) in rt2x00lib_probe_hw_modes()
1013 if (spec->supported_rates & SUPPORT_RATE_OFDM) in rt2x00lib_probe_hw_modes()
1016 channels = kcalloc(spec->num_channels, sizeof(*channels), GFP_KERNEL); in rt2x00lib_probe_hw_modes()
1018 return -ENOMEM; in rt2x00lib_probe_hw_modes()
1033 for (i = 0; i < spec->num_channels; i++) { in rt2x00lib_probe_hw_modes()
1035 spec->channels[i].channel, in rt2x00lib_probe_hw_modes()
1036 spec->channels_info[i].max_power, i); in rt2x00lib_probe_hw_modes()
1044 if (spec->supported_bands & SUPPORT_BAND_2GHZ) { in rt2x00lib_probe_hw_modes()
1045 rt2x00dev->bands[NL80211_BAND_2GHZ].n_channels = 14; in rt2x00lib_probe_hw_modes()
1046 rt2x00dev->bands[NL80211_BAND_2GHZ].n_bitrates = num_rates; in rt2x00lib_probe_hw_modes()
1047 rt2x00dev->bands[NL80211_BAND_2GHZ].channels = channels; in rt2x00lib_probe_hw_modes()
1048 rt2x00dev->bands[NL80211_BAND_2GHZ].bitrates = rates; in rt2x00lib_probe_hw_modes()
1049 hw->wiphy->bands[NL80211_BAND_2GHZ] = in rt2x00lib_probe_hw_modes()
1050 &rt2x00dev->bands[NL80211_BAND_2GHZ]; in rt2x00lib_probe_hw_modes()
1051 memcpy(&rt2x00dev->bands[NL80211_BAND_2GHZ].ht_cap, in rt2x00lib_probe_hw_modes()
1052 &spec->ht, sizeof(spec->ht)); in rt2x00lib_probe_hw_modes()
1060 if (spec->supported_bands & SUPPORT_BAND_5GHZ) { in rt2x00lib_probe_hw_modes()
1061 rt2x00dev->bands[NL80211_BAND_5GHZ].n_channels = in rt2x00lib_probe_hw_modes()
1062 spec->num_channels - 14; in rt2x00lib_probe_hw_modes()
1063 rt2x00dev->bands[NL80211_BAND_5GHZ].n_bitrates = in rt2x00lib_probe_hw_modes()
1064 num_rates - 4; in rt2x00lib_probe_hw_modes()
1065 rt2x00dev->bands[NL80211_BAND_5GHZ].channels = &channels[14]; in rt2x00lib_probe_hw_modes()
1066 rt2x00dev->bands[NL80211_BAND_5GHZ].bitrates = &rates[4]; in rt2x00lib_probe_hw_modes()
1067 hw->wiphy->bands[NL80211_BAND_5GHZ] = in rt2x00lib_probe_hw_modes()
1068 &rt2x00dev->bands[NL80211_BAND_5GHZ]; in rt2x00lib_probe_hw_modes()
1069 memcpy(&rt2x00dev->bands[NL80211_BAND_5GHZ].ht_cap, in rt2x00lib_probe_hw_modes()
1070 &spec->ht, sizeof(spec->ht)); in rt2x00lib_probe_hw_modes()
1078 return -ENOMEM; in rt2x00lib_probe_hw_modes()
1083 if (test_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags)) in rt2x00lib_remove_hw()
1084 ieee80211_unregister_hw(rt2x00dev->hw); in rt2x00lib_remove_hw()
1086 if (likely(rt2x00dev->hw->wiphy->bands[NL80211_BAND_2GHZ])) { in rt2x00lib_remove_hw()
1087 kfree(rt2x00dev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels); in rt2x00lib_remove_hw()
1088 kfree(rt2x00dev->hw->wiphy->bands[NL80211_BAND_2GHZ]->bitrates); in rt2x00lib_remove_hw()
1089 rt2x00dev->hw->wiphy->bands[NL80211_BAND_2GHZ] = NULL; in rt2x00lib_remove_hw()
1090 rt2x00dev->hw->wiphy->bands[NL80211_BAND_5GHZ] = NULL; in rt2x00lib_remove_hw()
1093 kfree(rt2x00dev->spec.channels_info); in rt2x00lib_remove_hw()
1111 struct hw_mode_spec *spec = &rt2x00dev->spec; in rt2x00lib_probe_hw()
1114 if (test_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags)) in rt2x00lib_probe_hw()
1127 rt2x00dev->hw->queues = rt2x00dev->ops->tx_queues; in rt2x00lib_probe_hw()
1132 rt2x00dev->hw->extra_tx_headroom = in rt2x00lib_probe_hw()
1134 rt2x00dev->extra_tx_headroom); in rt2x00lib_probe_hw()
1140 rt2x00dev->hw->extra_tx_headroom += RT2X00_L2PAD_SIZE; in rt2x00lib_probe_hw()
1142 rt2x00dev->hw->extra_tx_headroom += RT2X00_ALIGN_SIZE; in rt2x00lib_probe_hw()
1147 rt2x00dev->hw->sta_data_size = sizeof(struct rt2x00_sta); in rt2x00lib_probe_hw()
1161 roundup_pow_of_two(rt2x00dev->ops->tx_queues * in rt2x00lib_probe_hw()
1162 rt2x00dev->tx->limit * in rt2x00lib_probe_hw()
1165 status = kfifo_alloc(&rt2x00dev->txstatus_fifo, kfifo_size, in rt2x00lib_probe_hw()
1177 if (rt2x00dev->ops->lib->taskletname) { \ in rt2x00lib_probe_hw()
1178 tasklet_setup(&rt2x00dev->taskletname, \ in rt2x00lib_probe_hw()
1179 rt2x00dev->ops->lib->taskletname); \ in rt2x00lib_probe_hw()
1190 ieee80211_create_tpt_led_trigger(rt2x00dev->hw, in rt2x00lib_probe_hw()
1198 status = ieee80211_register_hw(rt2x00dev->hw); in rt2x00lib_probe_hw()
1202 set_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags); in rt2x00lib_probe_hw()
1212 if (!test_and_clear_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags)) in rt2x00lib_uninitialize()
1224 rt2x00dev->ops->lib->uninitialize(rt2x00dev); in rt2x00lib_uninitialize()
1236 if (test_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags)) in rt2x00lib_initialize()
1249 status = rt2x00dev->ops->lib->initialize(rt2x00dev); in rt2x00lib_initialize()
1255 set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags); in rt2x00lib_initialize()
1285 rt2x00dev->intf_ap_count = 0; in rt2x00lib_start()
1286 rt2x00dev->intf_sta_count = 0; in rt2x00lib_start()
1287 rt2x00dev->intf_associated = 0; in rt2x00lib_start()
1294 set_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags); in rt2x00lib_start()
1302 if (!test_and_clear_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) in rt2x00lib_stop()
1311 rt2x00dev->intf_ap_count = 0; in rt2x00lib_stop()
1312 rt2x00dev->intf_sta_count = 0; in rt2x00lib_stop()
1313 rt2x00dev->intf_associated = 0; in rt2x00lib_stop()
1321 if (rt2x00dev->ops->max_ap_intf < 2) in rt2x00lib_set_if_combinations()
1327 if_limit = &rt2x00dev->if_limits_ap; in rt2x00lib_set_if_combinations()
1328 if_limit->max = rt2x00dev->ops->max_ap_intf; in rt2x00lib_set_if_combinations()
1329 if_limit->types = BIT(NL80211_IFTYPE_AP); in rt2x00lib_set_if_combinations()
1331 if_limit->types |= BIT(NL80211_IFTYPE_MESH_POINT); in rt2x00lib_set_if_combinations()
1337 if_combination = &rt2x00dev->if_combinations[IF_COMB_AP]; in rt2x00lib_set_if_combinations()
1338 if_combination->limits = if_limit; in rt2x00lib_set_if_combinations()
1339 if_combination->n_limits = 1; in rt2x00lib_set_if_combinations()
1340 if_combination->max_interfaces = if_limit->max; in rt2x00lib_set_if_combinations()
1341 if_combination->num_different_channels = 1; in rt2x00lib_set_if_combinations()
1346 rt2x00dev->hw->wiphy->iface_combinations = rt2x00dev->if_combinations; in rt2x00lib_set_if_combinations()
1347 rt2x00dev->hw->wiphy->n_iface_combinations = 1; in rt2x00lib_set_if_combinations()
1352 if (WARN_ON(!rt2x00dev->tx)) in rt2x00dev_extra_tx_headroom()
1356 return rt2x00dev->tx[0].winfo_size + rt2x00dev->tx[0].desc_size; in rt2x00dev_extra_tx_headroom()
1358 return rt2x00dev->tx[0].winfo_size; in rt2x00dev_extra_tx_headroom()
1366 int retval = -ENOMEM; in rt2x00lib_probe_dev()
1376 if (rt2x00dev->ops->drv_data_size > 0) { in rt2x00lib_probe_dev()
1377 rt2x00dev->drv_data = kzalloc(rt2x00dev->ops->drv_data_size, in rt2x00lib_probe_dev()
1379 if (!rt2x00dev->drv_data) { in rt2x00lib_probe_dev()
1380 retval = -ENOMEM; in rt2x00lib_probe_dev()
1385 spin_lock_init(&rt2x00dev->irqmask_lock); in rt2x00lib_probe_dev()
1386 mutex_init(&rt2x00dev->csr_mutex); in rt2x00lib_probe_dev()
1387 mutex_init(&rt2x00dev->conf_mutex); in rt2x00lib_probe_dev()
1388 INIT_LIST_HEAD(&rt2x00dev->bar_list); in rt2x00lib_probe_dev()
1389 spin_lock_init(&rt2x00dev->bar_list_lock); in rt2x00lib_probe_dev()
1390 hrtimer_init(&rt2x00dev->txstatus_timer, CLOCK_MONOTONIC, in rt2x00lib_probe_dev()
1393 set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); in rt2x00lib_probe_dev()
1396 * Make room for rt2x00_intf inside the per-interface in rt2x00lib_probe_dev()
1399 rt2x00dev->hw->vif_data_size = sizeof(struct rt2x00_intf); in rt2x00lib_probe_dev()
1405 rt2x00dev->hw->wiphy->addr_mask[ETH_ALEN - 1] = in rt2x00lib_probe_dev()
1406 (rt2x00dev->ops->max_ap_intf - 1); in rt2x00lib_probe_dev()
1411 rt2x00dev->workqueue = in rt2x00lib_probe_dev()
1412 alloc_ordered_workqueue("%s", 0, wiphy_name(rt2x00dev->hw->wiphy)); in rt2x00lib_probe_dev()
1413 if (!rt2x00dev->workqueue) { in rt2x00lib_probe_dev()
1414 retval = -ENOMEM; in rt2x00lib_probe_dev()
1418 INIT_WORK(&rt2x00dev->intf_work, rt2x00lib_intf_scheduled); in rt2x00lib_probe_dev()
1419 INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup); in rt2x00lib_probe_dev()
1420 INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep); in rt2x00lib_probe_dev()
1425 retval = rt2x00dev->ops->lib->probe_hw(rt2x00dev); in rt2x00lib_probe_dev()
1439 rt2x00dev->extra_tx_headroom = rt2x00dev_extra_tx_headroom(rt2x00dev); in rt2x00lib_probe_dev()
1446 rt2x00dev->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); in rt2x00lib_probe_dev()
1447 if (rt2x00dev->bcn->limit > 0) in rt2x00lib_probe_dev()
1448 rt2x00dev->hw->wiphy->interface_modes |= in rt2x00lib_probe_dev()
1455 rt2x00dev->hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; in rt2x00lib_probe_dev()
1457 wiphy_ext_feature_set(rt2x00dev->hw->wiphy, in rt2x00lib_probe_dev()
1493 clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); in rt2x00lib_remove_dev()
1509 cancel_work_sync(&rt2x00dev->intf_work); in rt2x00lib_remove_dev()
1510 cancel_delayed_work_sync(&rt2x00dev->autowakeup_work); in rt2x00lib_remove_dev()
1511 cancel_work_sync(&rt2x00dev->sleep_work); in rt2x00lib_remove_dev()
1513 hrtimer_cancel(&rt2x00dev->txstatus_timer); in rt2x00lib_remove_dev()
1518 tasklet_kill(&rt2x00dev->txstatus_tasklet); in rt2x00lib_remove_dev()
1519 tasklet_kill(&rt2x00dev->pretbtt_tasklet); in rt2x00lib_remove_dev()
1520 tasklet_kill(&rt2x00dev->tbtt_tasklet); in rt2x00lib_remove_dev()
1521 tasklet_kill(&rt2x00dev->rxdone_tasklet); in rt2x00lib_remove_dev()
1522 tasklet_kill(&rt2x00dev->autowake_tasklet); in rt2x00lib_remove_dev()
1529 if (rt2x00dev->workqueue) in rt2x00lib_remove_dev()
1530 destroy_workqueue(rt2x00dev->workqueue); in rt2x00lib_remove_dev()
1535 kfifo_free(&rt2x00dev->txstatus_fifo); in rt2x00lib_remove_dev()
1561 kfree(rt2x00dev->drv_data); in rt2x00lib_remove_dev()
1575 if (!test_and_clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) in rt2x00lib_suspend()
1600 if (rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_SLEEP)) in rt2x00lib_suspend()
1620 set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); in rt2x00lib_resume()