Lines Matching refs:rt2x00dev
27 u32 rt2x00lib_get_bssidx(struct rt2x00_dev *rt2x00dev, in rt2x00lib_get_bssidx() argument
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()
43 int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev) in rt2x00lib_enable_radio() argument
51 if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) in rt2x00lib_enable_radio()
57 rt2x00queue_init_queues(rt2x00dev); 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()
69 rt2x00leds_led_radio(rt2x00dev, true); in rt2x00lib_enable_radio()
70 rt2x00led_led_activity(rt2x00dev, true); in rt2x00lib_enable_radio()
72 set_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags); in rt2x00lib_enable_radio()
77 rt2x00queue_start_queues(rt2x00dev); in rt2x00lib_enable_radio()
78 rt2x00link_start_tuner(rt2x00dev); in rt2x00lib_enable_radio()
83 rt2x00link_start_watchdog(rt2x00dev); in rt2x00lib_enable_radio()
88 void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev) in rt2x00lib_disable_radio() argument
90 if (!test_and_clear_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) in rt2x00lib_disable_radio()
96 rt2x00link_stop_watchdog(rt2x00dev); in rt2x00lib_disable_radio()
101 rt2x00link_stop_tuner(rt2x00dev); in rt2x00lib_disable_radio()
102 rt2x00queue_stop_queues(rt2x00dev); in rt2x00lib_disable_radio()
103 rt2x00queue_flush_queues(rt2x00dev, true); 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()
111 rt2x00led_led_activity(rt2x00dev, false); in rt2x00lib_disable_radio()
112 rt2x00leds_led_radio(rt2x00dev, false); in rt2x00lib_disable_radio()
118 struct rt2x00_dev *rt2x00dev = data; in rt2x00lib_intf_scheduled_iter() local
127 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) in rt2x00lib_intf_scheduled_iter()
132 rt2x00queue_update_beacon(rt2x00dev, vif); in rt2x00lib_intf_scheduled_iter()
139 struct rt2x00_dev *rt2x00dev = in rt2x00lib_intf_scheduled() local
146 ieee80211_iterate_active_interfaces(rt2x00dev->hw, in rt2x00lib_intf_scheduled()
149 rt2x00dev); in rt2x00lib_intf_scheduled()
154 struct rt2x00_dev *rt2x00dev = in rt2x00lib_autowakeup() local
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()
161 rt2x00_err(rt2x00dev, "Device failed to wakeup\n"); in rt2x00lib_autowakeup()
162 clear_bit(CONFIG_POWERSAVING, &rt2x00dev->flags); in rt2x00lib_autowakeup()
172 struct rt2x00_dev *rt2x00dev = data; in rt2x00lib_bc_buffer_iter() local
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()
194 struct rt2x00_dev *rt2x00dev = data; in rt2x00lib_beaconupdate_iter() local
206 WARN_ON(rt2x00_is_usb(rt2x00dev)); in rt2x00lib_beaconupdate_iter()
207 rt2x00queue_update_beacon(rt2x00dev, vif); in rt2x00lib_beaconupdate_iter()
210 void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev) in rt2x00lib_beacondone() argument
212 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) in rt2x00lib_beacondone()
217 rt2x00dev->hw, IEEE80211_IFACE_ITER_RESUME_ALL, in rt2x00lib_beacondone()
218 rt2x00lib_bc_buffer_iter, rt2x00dev); in rt2x00lib_beacondone()
224 if (rt2x00_has_cap_pre_tbtt_interrupt(rt2x00dev)) in rt2x00lib_beacondone()
229 rt2x00dev->hw, IEEE80211_IFACE_ITER_RESUME_ALL, in rt2x00lib_beacondone()
230 rt2x00lib_beaconupdate_iter, rt2x00dev); in rt2x00lib_beacondone()
234 void rt2x00lib_pretbtt(struct rt2x00_dev *rt2x00dev) in rt2x00lib_pretbtt() argument
236 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) in rt2x00lib_pretbtt()
241 rt2x00dev->hw, IEEE80211_IFACE_ITER_RESUME_ALL, in rt2x00lib_pretbtt()
242 rt2x00lib_beaconupdate_iter, rt2x00dev); in rt2x00lib_pretbtt()
263 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; in rt2x00lib_txdone_bar_status() local
286 list_for_each_entry_rcu(bar_entry, &rt2x00dev->bar_list, list) { in rt2x00lib_txdone_bar_status()
290 spin_lock_bh(&rt2x00dev->bar_list_lock); in rt2x00lib_txdone_bar_status()
295 spin_unlock_bh(&rt2x00dev->bar_list_lock); in rt2x00lib_txdone_bar_status()
305 static void rt2x00lib_fill_tx_status(struct rt2x00_dev *rt2x00dev, in rt2x00lib_fill_tx_status() argument
356 rt2x00dev->low_level_stats.dot11ACKFailureCount++; 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()
384 static void rt2x00lib_clear_entry(struct rt2x00_dev *rt2x00dev, in rt2x00lib_clear_entry() argument
393 rt2x00dev->ops->lib->clear_entry(entry); in rt2x00lib_clear_entry()
413 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; in rt2x00lib_txdone_nomatch() local
432 rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TXDONE, entry); 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()
450 rt2x00lib_fill_tx_status(rt2x00dev, &txinfo, skbdesc, txdesc, in rt2x00lib_txdone_nomatch()
452 ieee80211_tx_status_noskb(rt2x00dev->hw, skbdesc->sta, &txinfo); in rt2x00lib_txdone_nomatch()
456 rt2x00lib_clear_entry(rt2x00dev, entry); in rt2x00lib_txdone_nomatch()
463 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; in rt2x00lib_txdone() local
478 skb_pull(entry->skb, rt2x00dev->extra_tx_headroom); in rt2x00lib_txdone()
493 if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_L2PAD)) in rt2x00lib_txdone()
502 if (rt2x00_has_cap_hw_crypto(rt2x00dev)) in rt2x00lib_txdone()
509 rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TXDONE, entry); in rt2x00lib_txdone()
524 rt2x00dev->link.qual.tx_success += success; in rt2x00lib_txdone()
525 rt2x00dev->link.qual.tx_failed += !success; in rt2x00lib_txdone()
527 rt2x00lib_fill_tx_status(rt2x00dev, tx_info, skbdesc, txdesc, success); in rt2x00lib_txdone()
536 if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_TASKLET_CONTEXT)) 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()
544 rt2x00lib_clear_entry(rt2x00dev, entry); in rt2x00lib_txdone()
582 struct rt2x00_dev *rt2x00dev = in rt2x00lib_sleep() local
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()
597 static void rt2x00lib_rxdone_check_ba(struct rt2x00_dev *rt2x00dev, in rt2x00lib_rxdone_check_ba() argument
611 list_for_each_entry_rcu(entry, &rt2x00dev->bar_list, list) { in rt2x00lib_rxdone_check_ba()
632 spin_lock_bh(&rt2x00dev->bar_list_lock); in rt2x00lib_rxdone_check_ba()
634 spin_unlock_bh(&rt2x00dev->bar_list_lock); in rt2x00lib_rxdone_check_ba()
641 static void rt2x00lib_rxdone_check_ps(struct rt2x00_dev *rt2x00dev, in rt2x00lib_rxdone_check_ps() argument
655 !(rt2x00dev->hw->conf.flags & IEEE80211_CONF_PS))) in rt2x00lib_rxdone_check_ps()
664 !rt2x00dev->aid) in rt2x00lib_rxdone_check_ps()
667 rt2x00dev->last_beacon = jiffies; in rt2x00lib_rxdone_check_ps()
682 cam = ieee80211_check_tim(tim_ie, tim_len, rt2x00dev->aid); 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()
691 static int rt2x00lib_rxdone_read_signal(struct rt2x00_dev *rt2x00dev, in rt2x00lib_rxdone_read_signal() argument
710 sband = &rt2x00dev->bands[rt2x00dev->curr_band]; in rt2x00lib_rxdone_read_signal()
732 …rt2x00_warn(rt2x00dev, "Frame received with unrecognized signal, mode=0x%.4x, signal=0x%.4x, type=… in rt2x00lib_rxdone_read_signal()
739 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; in rt2x00lib_rxdone() local
746 if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) || in rt2x00lib_rxdone()
747 !test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) in rt2x00lib_rxdone()
770 rt2x00dev->ops->lib->fill_rxdone(entry, &rxdesc); in rt2x00lib_rxdone()
778 rt2x00_err(rt2x00dev, "Wrong frame size %d max %d\n", in rt2x00lib_rxdone()
811 rate_idx = rt2x00lib_rxdone_read_signal(rt2x00dev, &rxdesc); 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()
832 rt2x00debug_update_crypto(rt2x00dev, &rxdesc); in rt2x00lib_rxdone()
833 rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_RXDONE, entry); in rt2x00lib_rxdone()
849 rx_status->band = rt2x00dev->curr_band; in rt2x00lib_rxdone()
850 rx_status->freq = rt2x00dev->curr_freq; 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()
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()
991 void rt2x00lib_set_mac_address(struct rt2x00_dev *rt2x00dev, u8 *eeprom_mac_addr) in rt2x00lib_set_mac_address() argument
993 of_get_mac_address(rt2x00dev->dev->of_node, eeprom_mac_addr); in rt2x00lib_set_mac_address()
997 rt2x00_eeprom_dbg(rt2x00dev, "MAC: %pM\n", eeprom_mac_addr); in rt2x00lib_set_mac_address()
1002 static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev, in rt2x00lib_probe_hw_modes() argument
1005 struct ieee80211_hw *hw = rt2x00dev->hw; 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()
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()
1062 rt2x00dev->bands[NL80211_BAND_5GHZ].n_channels = in rt2x00lib_probe_hw_modes()
1064 rt2x00dev->bands[NL80211_BAND_5GHZ].n_bitrates = 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()
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()
1078 rt2x00_err(rt2x00dev, "Allocation ieee80211 modes failed\n"); in rt2x00lib_probe_hw_modes()
1082 static void rt2x00lib_remove_hw(struct rt2x00_dev *rt2x00dev) in rt2x00lib_remove_hw() argument
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()
1098 static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev) in rt2x00lib_probe_hw() argument
1100 struct hw_mode_spec *spec = &rt2x00dev->spec; in rt2x00lib_probe_hw()
1103 if (test_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags)) in rt2x00lib_probe_hw()
1109 status = rt2x00lib_probe_hw_modes(rt2x00dev, spec); in rt2x00lib_probe_hw()
1116 rt2x00dev->hw->queues = rt2x00dev->ops->tx_queues; in rt2x00lib_probe_hw()
1121 rt2x00dev->hw->extra_tx_headroom = in rt2x00lib_probe_hw()
1123 rt2x00dev->extra_tx_headroom); in rt2x00lib_probe_hw()
1128 if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_L2PAD)) in rt2x00lib_probe_hw()
1129 rt2x00dev->hw->extra_tx_headroom += RT2X00_L2PAD_SIZE; in rt2x00lib_probe_hw()
1130 else if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_DMA)) in rt2x00lib_probe_hw()
1131 rt2x00dev->hw->extra_tx_headroom += RT2X00_ALIGN_SIZE; in rt2x00lib_probe_hw()
1136 rt2x00dev->hw->sta_data_size = sizeof(struct rt2x00_sta); in rt2x00lib_probe_hw()
1141 if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_TXSTATUS_FIFO)) { in rt2x00lib_probe_hw()
1150 roundup_pow_of_two(rt2x00dev->ops->tx_queues * in rt2x00lib_probe_hw()
1151 rt2x00dev->tx->limit * in rt2x00lib_probe_hw()
1154 status = kfifo_alloc(&rt2x00dev->txstatus_fifo, kfifo_size, in rt2x00lib_probe_hw()
1166 if (rt2x00dev->ops->lib->taskletname) { \ in rt2x00lib_probe_hw()
1167 tasklet_setup(&rt2x00dev->taskletname, \ in rt2x00lib_probe_hw()
1168 rt2x00dev->ops->lib->taskletname); \ in rt2x00lib_probe_hw()
1182 status = ieee80211_register_hw(rt2x00dev->hw); in rt2x00lib_probe_hw()
1186 set_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags); in rt2x00lib_probe_hw()
1194 static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev) in rt2x00lib_uninitialize() argument
1196 if (!test_and_clear_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags)) in rt2x00lib_uninitialize()
1202 if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_DELAYED_RFKILL)) in rt2x00lib_uninitialize()
1203 rt2x00rfkill_unregister(rt2x00dev); in rt2x00lib_uninitialize()
1208 rt2x00dev->ops->lib->uninitialize(rt2x00dev); in rt2x00lib_uninitialize()
1213 rt2x00queue_uninitialize(rt2x00dev); in rt2x00lib_uninitialize()
1216 static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev) in rt2x00lib_initialize() argument
1220 if (test_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags)) in rt2x00lib_initialize()
1226 status = rt2x00queue_initialize(rt2x00dev); in rt2x00lib_initialize()
1233 status = rt2x00dev->ops->lib->initialize(rt2x00dev); in rt2x00lib_initialize()
1235 rt2x00queue_uninitialize(rt2x00dev); in rt2x00lib_initialize()
1239 set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags); in rt2x00lib_initialize()
1244 if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_DELAYED_RFKILL)) in rt2x00lib_initialize()
1245 rt2x00rfkill_register(rt2x00dev); in rt2x00lib_initialize()
1250 int rt2x00lib_start(struct rt2x00_dev *rt2x00dev) in rt2x00lib_start() argument
1258 retval = rt2x00lib_load_firmware(rt2x00dev); in rt2x00lib_start()
1265 retval = rt2x00lib_initialize(rt2x00dev); in rt2x00lib_start()
1269 rt2x00dev->intf_ap_count = 0; in rt2x00lib_start()
1270 rt2x00dev->intf_sta_count = 0; in rt2x00lib_start()
1271 rt2x00dev->intf_associated = 0; in rt2x00lib_start()
1272 rt2x00dev->intf_beaconing = 0; in rt2x00lib_start()
1275 retval = rt2x00lib_enable_radio(rt2x00dev); in rt2x00lib_start()
1279 set_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags); in rt2x00lib_start()
1285 void rt2x00lib_stop(struct rt2x00_dev *rt2x00dev) in rt2x00lib_stop() argument
1287 if (!test_and_clear_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) in rt2x00lib_stop()
1294 rt2x00lib_disable_radio(rt2x00dev); in rt2x00lib_stop()
1296 rt2x00dev->intf_ap_count = 0; in rt2x00lib_stop()
1297 rt2x00dev->intf_sta_count = 0; in rt2x00lib_stop()
1298 rt2x00dev->intf_associated = 0; in rt2x00lib_stop()
1299 rt2x00dev->intf_beaconing = 0; in rt2x00lib_stop()
1302 static inline void rt2x00lib_set_if_combinations(struct rt2x00_dev *rt2x00dev) in rt2x00lib_set_if_combinations() argument
1307 if (rt2x00dev->ops->max_ap_intf < 2) in rt2x00lib_set_if_combinations()
1313 if_limit = &rt2x00dev->if_limits_ap; in rt2x00lib_set_if_combinations()
1314 if_limit->max = rt2x00dev->ops->max_ap_intf; in rt2x00lib_set_if_combinations()
1323 if_combination = &rt2x00dev->if_combinations[IF_COMB_AP]; in rt2x00lib_set_if_combinations()
1332 rt2x00dev->hw->wiphy->iface_combinations = rt2x00dev->if_combinations; in rt2x00lib_set_if_combinations()
1333 rt2x00dev->hw->wiphy->n_iface_combinations = 1; in rt2x00lib_set_if_combinations()
1336 static unsigned int rt2x00dev_extra_tx_headroom(struct rt2x00_dev *rt2x00dev) in rt2x00dev_extra_tx_headroom() argument
1338 if (WARN_ON(!rt2x00dev->tx)) in rt2x00dev_extra_tx_headroom()
1341 if (rt2x00_is_usb(rt2x00dev)) in rt2x00dev_extra_tx_headroom()
1342 return rt2x00dev->tx[0].winfo_size + rt2x00dev->tx[0].desc_size; in rt2x00dev_extra_tx_headroom()
1344 return rt2x00dev->tx[0].winfo_size; in rt2x00dev_extra_tx_headroom()
1350 int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) in rt2x00lib_probe_dev() argument
1357 rt2x00lib_set_if_combinations(rt2x00dev); in rt2x00lib_probe_dev()
1362 if (rt2x00dev->ops->drv_data_size > 0) { in rt2x00lib_probe_dev()
1363 rt2x00dev->drv_data = kzalloc(rt2x00dev->ops->drv_data_size, in rt2x00lib_probe_dev()
1365 if (!rt2x00dev->drv_data) { in rt2x00lib_probe_dev()
1371 spin_lock_init(&rt2x00dev->irqmask_lock); in rt2x00lib_probe_dev()
1372 mutex_init(&rt2x00dev->csr_mutex); in rt2x00lib_probe_dev()
1373 mutex_init(&rt2x00dev->conf_mutex); in rt2x00lib_probe_dev()
1374 INIT_LIST_HEAD(&rt2x00dev->bar_list); in rt2x00lib_probe_dev()
1375 spin_lock_init(&rt2x00dev->bar_list_lock); in rt2x00lib_probe_dev()
1376 hrtimer_init(&rt2x00dev->txstatus_timer, CLOCK_MONOTONIC, in rt2x00lib_probe_dev()
1379 set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); in rt2x00lib_probe_dev()
1385 rt2x00dev->hw->vif_data_size = sizeof(struct rt2x00_intf); in rt2x00lib_probe_dev()
1391 rt2x00dev->hw->wiphy->addr_mask[ETH_ALEN - 1] = in rt2x00lib_probe_dev()
1392 (rt2x00dev->ops->max_ap_intf - 1); in rt2x00lib_probe_dev()
1397 rt2x00dev->workqueue = in rt2x00lib_probe_dev()
1398 alloc_ordered_workqueue("%s", 0, wiphy_name(rt2x00dev->hw->wiphy)); in rt2x00lib_probe_dev()
1399 if (!rt2x00dev->workqueue) { in rt2x00lib_probe_dev()
1404 INIT_WORK(&rt2x00dev->intf_work, rt2x00lib_intf_scheduled); in rt2x00lib_probe_dev()
1405 INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup); in rt2x00lib_probe_dev()
1406 INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep); in rt2x00lib_probe_dev()
1411 retval = rt2x00dev->ops->lib->probe_hw(rt2x00dev); in rt2x00lib_probe_dev()
1413 rt2x00_err(rt2x00dev, "Failed to allocate device\n"); in rt2x00lib_probe_dev()
1420 retval = rt2x00queue_allocate(rt2x00dev); in rt2x00lib_probe_dev()
1425 rt2x00dev->extra_tx_headroom = rt2x00dev_extra_tx_headroom(rt2x00dev); in rt2x00lib_probe_dev()
1432 rt2x00dev->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); in rt2x00lib_probe_dev()
1433 if (rt2x00dev->bcn->limit > 0) in rt2x00lib_probe_dev()
1434 rt2x00dev->hw->wiphy->interface_modes |= in rt2x00lib_probe_dev()
1441 rt2x00dev->hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; in rt2x00lib_probe_dev()
1443 wiphy_ext_feature_set(rt2x00dev->hw->wiphy, in rt2x00lib_probe_dev()
1449 retval = rt2x00lib_probe_hw(rt2x00dev); in rt2x00lib_probe_dev()
1451 rt2x00_err(rt2x00dev, "Failed to initialize hw\n"); in rt2x00lib_probe_dev()
1458 rt2x00link_register(rt2x00dev); in rt2x00lib_probe_dev()
1459 rt2x00leds_register(rt2x00dev); in rt2x00lib_probe_dev()
1460 rt2x00debug_register(rt2x00dev); in rt2x00lib_probe_dev()
1465 if (!rt2x00_has_cap_flag(rt2x00dev, REQUIRE_DELAYED_RFKILL)) in rt2x00lib_probe_dev()
1466 rt2x00rfkill_register(rt2x00dev); in rt2x00lib_probe_dev()
1471 rt2x00lib_remove_dev(rt2x00dev); in rt2x00lib_probe_dev()
1477 void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev) in rt2x00lib_remove_dev() argument
1479 clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); in rt2x00lib_remove_dev()
1484 if (!rt2x00_has_cap_flag(rt2x00dev, REQUIRE_DELAYED_RFKILL)) in rt2x00lib_remove_dev()
1485 rt2x00rfkill_unregister(rt2x00dev); in rt2x00lib_remove_dev()
1490 rt2x00lib_disable_radio(rt2x00dev); in rt2x00lib_remove_dev()
1495 cancel_work_sync(&rt2x00dev->intf_work); in rt2x00lib_remove_dev()
1496 cancel_delayed_work_sync(&rt2x00dev->autowakeup_work); in rt2x00lib_remove_dev()
1497 cancel_work_sync(&rt2x00dev->sleep_work); in rt2x00lib_remove_dev()
1499 hrtimer_cancel(&rt2x00dev->txstatus_timer); in rt2x00lib_remove_dev()
1504 tasklet_kill(&rt2x00dev->txstatus_tasklet); in rt2x00lib_remove_dev()
1505 tasklet_kill(&rt2x00dev->pretbtt_tasklet); in rt2x00lib_remove_dev()
1506 tasklet_kill(&rt2x00dev->tbtt_tasklet); in rt2x00lib_remove_dev()
1507 tasklet_kill(&rt2x00dev->rxdone_tasklet); in rt2x00lib_remove_dev()
1508 tasklet_kill(&rt2x00dev->autowake_tasklet); in rt2x00lib_remove_dev()
1513 rt2x00lib_uninitialize(rt2x00dev); in rt2x00lib_remove_dev()
1515 if (rt2x00dev->workqueue) in rt2x00lib_remove_dev()
1516 destroy_workqueue(rt2x00dev->workqueue); in rt2x00lib_remove_dev()
1521 kfifo_free(&rt2x00dev->txstatus_fifo); in rt2x00lib_remove_dev()
1526 rt2x00debug_deregister(rt2x00dev); in rt2x00lib_remove_dev()
1527 rt2x00leds_unregister(rt2x00dev); in rt2x00lib_remove_dev()
1532 rt2x00lib_remove_hw(rt2x00dev); in rt2x00lib_remove_dev()
1537 rt2x00lib_free_firmware(rt2x00dev); in rt2x00lib_remove_dev()
1542 rt2x00queue_free(rt2x00dev); in rt2x00lib_remove_dev()
1547 kfree(rt2x00dev->drv_data); in rt2x00lib_remove_dev()
1554 int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev) in rt2x00lib_suspend() argument
1556 rt2x00_dbg(rt2x00dev, "Going to sleep\n"); in rt2x00lib_suspend()
1561 if (!test_and_clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) in rt2x00lib_suspend()
1567 rt2x00lib_uninitialize(rt2x00dev); in rt2x00lib_suspend()
1572 rt2x00leds_suspend(rt2x00dev); in rt2x00lib_suspend()
1573 rt2x00debug_deregister(rt2x00dev); in rt2x00lib_suspend()
1586 if (rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_SLEEP)) in rt2x00lib_suspend()
1587 rt2x00_warn(rt2x00dev, "Device failed to enter sleep state, continue suspending\n"); in rt2x00lib_suspend()
1593 int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev) in rt2x00lib_resume() argument
1595 rt2x00_dbg(rt2x00dev, "Waking up\n"); in rt2x00lib_resume()
1600 rt2x00debug_register(rt2x00dev); in rt2x00lib_resume()
1601 rt2x00leds_resume(rt2x00dev); in rt2x00lib_resume()
1606 set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); in rt2x00lib_resume()