• Home
  • Raw
  • Download

Lines Matching refs:adapter

71 	struct mwifiex_adapter *adapter;  in mwifiex_register()  local
74 adapter = kzalloc(sizeof(struct mwifiex_adapter), GFP_KERNEL); in mwifiex_register()
75 if (!adapter) in mwifiex_register()
78 *padapter = adapter; in mwifiex_register()
79 adapter->dev = dev; in mwifiex_register()
80 adapter->card = card; in mwifiex_register()
83 memmove(&adapter->if_ops, if_ops, sizeof(struct mwifiex_if_ops)); in mwifiex_register()
84 adapter->debug_mask = debug_mask; in mwifiex_register()
87 if (adapter->if_ops.init_if) in mwifiex_register()
88 if (adapter->if_ops.init_if(adapter)) in mwifiex_register()
91 adapter->priv_num = 0; in mwifiex_register()
95 adapter->priv[i] = in mwifiex_register()
97 if (!adapter->priv[i]) in mwifiex_register()
100 adapter->priv[i]->adapter = adapter; in mwifiex_register()
101 adapter->priv_num++; in mwifiex_register()
103 mwifiex_init_lock_list(adapter); in mwifiex_register()
105 timer_setup(&adapter->cmd_timer, mwifiex_cmd_timeout_func, 0); in mwifiex_register()
110 mwifiex_dbg(adapter, ERROR, in mwifiex_register()
113 for (i = 0; i < adapter->priv_num; i++) in mwifiex_register()
114 kfree(adapter->priv[i]); in mwifiex_register()
116 kfree(adapter); in mwifiex_register()
131 static int mwifiex_unregister(struct mwifiex_adapter *adapter) in mwifiex_unregister() argument
135 if (adapter->if_ops.cleanup_if) in mwifiex_unregister()
136 adapter->if_ops.cleanup_if(adapter); in mwifiex_unregister()
138 del_timer_sync(&adapter->cmd_timer); in mwifiex_unregister()
141 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_unregister()
142 if (adapter->priv[i]) { in mwifiex_unregister()
143 mwifiex_free_curr_bcn(adapter->priv[i]); in mwifiex_unregister()
144 kfree(adapter->priv[i]); in mwifiex_unregister()
148 if (adapter->nd_info) { in mwifiex_unregister()
149 for (i = 0 ; i < adapter->nd_info->n_matches ; i++) in mwifiex_unregister()
150 kfree(adapter->nd_info->matches[i]); in mwifiex_unregister()
151 kfree(adapter->nd_info); in mwifiex_unregister()
152 adapter->nd_info = NULL; in mwifiex_unregister()
155 kfree(adapter->regd); in mwifiex_unregister()
157 kfree(adapter); in mwifiex_unregister()
161 void mwifiex_queue_main_work(struct mwifiex_adapter *adapter) in mwifiex_queue_main_work() argument
165 spin_lock_irqsave(&adapter->main_proc_lock, flags); in mwifiex_queue_main_work()
166 if (adapter->mwifiex_processing) { in mwifiex_queue_main_work()
167 adapter->more_task_flag = true; in mwifiex_queue_main_work()
168 spin_unlock_irqrestore(&adapter->main_proc_lock, flags); in mwifiex_queue_main_work()
170 spin_unlock_irqrestore(&adapter->main_proc_lock, flags); in mwifiex_queue_main_work()
171 queue_work(adapter->workqueue, &adapter->main_work); in mwifiex_queue_main_work()
176 static void mwifiex_queue_rx_work(struct mwifiex_adapter *adapter) in mwifiex_queue_rx_work() argument
178 spin_lock_bh(&adapter->rx_proc_lock); in mwifiex_queue_rx_work()
179 if (adapter->rx_processing) { in mwifiex_queue_rx_work()
180 spin_unlock_bh(&adapter->rx_proc_lock); in mwifiex_queue_rx_work()
182 spin_unlock_bh(&adapter->rx_proc_lock); in mwifiex_queue_rx_work()
183 queue_work(adapter->rx_workqueue, &adapter->rx_work); in mwifiex_queue_rx_work()
187 static int mwifiex_process_rx(struct mwifiex_adapter *adapter) in mwifiex_process_rx() argument
192 spin_lock_bh(&adapter->rx_proc_lock); in mwifiex_process_rx()
193 if (adapter->rx_processing || adapter->rx_locked) { in mwifiex_process_rx()
194 spin_unlock_bh(&adapter->rx_proc_lock); in mwifiex_process_rx()
197 adapter->rx_processing = true; in mwifiex_process_rx()
198 spin_unlock_bh(&adapter->rx_proc_lock); in mwifiex_process_rx()
202 while ((skb = skb_dequeue(&adapter->rx_data_q))) { in mwifiex_process_rx()
203 atomic_dec(&adapter->rx_pending); in mwifiex_process_rx()
204 if ((adapter->delay_main_work || in mwifiex_process_rx()
205 adapter->iface_type == MWIFIEX_USB) && in mwifiex_process_rx()
206 (atomic_read(&adapter->rx_pending) < LOW_RX_PENDING)) { in mwifiex_process_rx()
207 if (adapter->if_ops.submit_rem_rx_urbs) in mwifiex_process_rx()
208 adapter->if_ops.submit_rem_rx_urbs(adapter); in mwifiex_process_rx()
209 adapter->delay_main_work = false; in mwifiex_process_rx()
210 mwifiex_queue_main_work(adapter); in mwifiex_process_rx()
214 if (adapter->if_ops.deaggr_pkt) in mwifiex_process_rx()
215 adapter->if_ops.deaggr_pkt(adapter, skb); in mwifiex_process_rx()
218 mwifiex_handle_rx_packet(adapter, skb); in mwifiex_process_rx()
221 spin_lock_bh(&adapter->rx_proc_lock); in mwifiex_process_rx()
222 adapter->rx_processing = false; in mwifiex_process_rx()
223 spin_unlock_bh(&adapter->rx_proc_lock); in mwifiex_process_rx()
244 int mwifiex_main_process(struct mwifiex_adapter *adapter) in mwifiex_main_process() argument
249 spin_lock_irqsave(&adapter->main_proc_lock, flags); in mwifiex_main_process()
252 if (adapter->mwifiex_processing || adapter->main_locked) { in mwifiex_main_process()
253 adapter->more_task_flag = true; in mwifiex_main_process()
254 spin_unlock_irqrestore(&adapter->main_proc_lock, flags); in mwifiex_main_process()
257 adapter->mwifiex_processing = true; in mwifiex_main_process()
258 spin_unlock_irqrestore(&adapter->main_proc_lock, flags); in mwifiex_main_process()
262 if (adapter->hw_status == MWIFIEX_HW_STATUS_NOT_READY) in mwifiex_main_process()
272 if (atomic_read(&adapter->rx_pending) >= HIGH_RX_PENDING && in mwifiex_main_process()
273 adapter->iface_type != MWIFIEX_USB) { in mwifiex_main_process()
274 adapter->delay_main_work = true; in mwifiex_main_process()
275 mwifiex_queue_rx_work(adapter); in mwifiex_main_process()
280 if (adapter->int_status) { in mwifiex_main_process()
281 if (adapter->hs_activated) in mwifiex_main_process()
282 mwifiex_process_hs_config(adapter); in mwifiex_main_process()
283 if (adapter->if_ops.process_int_status) in mwifiex_main_process()
284 adapter->if_ops.process_int_status(adapter); in mwifiex_main_process()
287 if (adapter->rx_work_enabled && adapter->data_received) in mwifiex_main_process()
288 mwifiex_queue_rx_work(adapter); in mwifiex_main_process()
291 if ((adapter->ps_state == PS_STATE_SLEEP) && in mwifiex_main_process()
292 (adapter->pm_wakeup_card_req && in mwifiex_main_process()
293 !adapter->pm_wakeup_fw_try) && in mwifiex_main_process()
294 (is_command_pending(adapter) || in mwifiex_main_process()
295 !skb_queue_empty(&adapter->tx_data_q) || in mwifiex_main_process()
296 !mwifiex_bypass_txlist_empty(adapter) || in mwifiex_main_process()
297 !mwifiex_wmm_lists_empty(adapter))) { in mwifiex_main_process()
298 adapter->pm_wakeup_fw_try = true; in mwifiex_main_process()
299 mod_timer(&adapter->wakeup_timer, jiffies + (HZ*3)); in mwifiex_main_process()
300 adapter->if_ops.wakeup(adapter); in mwifiex_main_process()
304 if (IS_CARD_RX_RCVD(adapter)) { in mwifiex_main_process()
305 adapter->data_received = false; in mwifiex_main_process()
306 adapter->pm_wakeup_fw_try = false; in mwifiex_main_process()
307 del_timer(&adapter->wakeup_timer); in mwifiex_main_process()
308 if (adapter->ps_state == PS_STATE_SLEEP) in mwifiex_main_process()
309 adapter->ps_state = PS_STATE_AWAKE; in mwifiex_main_process()
312 if (adapter->pm_wakeup_fw_try) in mwifiex_main_process()
314 if (adapter->ps_state == PS_STATE_PRE_SLEEP) in mwifiex_main_process()
315 mwifiex_check_ps_cond(adapter); in mwifiex_main_process()
317 if (adapter->ps_state != PS_STATE_AWAKE) in mwifiex_main_process()
319 if (adapter->tx_lock_flag) { in mwifiex_main_process()
320 if (adapter->iface_type == MWIFIEX_USB) { in mwifiex_main_process()
321 if (!adapter->usb_mc_setup) in mwifiex_main_process()
327 if ((!adapter->scan_chan_gap_enabled && in mwifiex_main_process()
328 adapter->scan_processing) || adapter->data_sent || in mwifiex_main_process()
330 (mwifiex_get_priv(adapter, in mwifiex_main_process()
332 (mwifiex_wmm_lists_empty(adapter) && in mwifiex_main_process()
333 mwifiex_bypass_txlist_empty(adapter) && in mwifiex_main_process()
334 skb_queue_empty(&adapter->tx_data_q))) { in mwifiex_main_process()
335 if (adapter->cmd_sent || adapter->curr_cmd || in mwifiex_main_process()
337 (mwifiex_get_priv(adapter, in mwifiex_main_process()
339 (!is_command_pending(adapter))) in mwifiex_main_process()
345 if (adapter->event_received) { in mwifiex_main_process()
346 adapter->event_received = false; in mwifiex_main_process()
347 mwifiex_process_event(adapter); in mwifiex_main_process()
351 if (adapter->cmd_resp_received) { in mwifiex_main_process()
352 adapter->cmd_resp_received = false; in mwifiex_main_process()
353 mwifiex_process_cmdresp(adapter); in mwifiex_main_process()
356 if (adapter->hw_status == MWIFIEX_HW_STATUS_INIT_DONE) { in mwifiex_main_process()
357 adapter->hw_status = MWIFIEX_HW_STATUS_READY; in mwifiex_main_process()
358 mwifiex_init_fw_complete(adapter); in mwifiex_main_process()
364 if (adapter->ps_state == PS_STATE_PRE_SLEEP) in mwifiex_main_process()
365 mwifiex_check_ps_cond(adapter); in mwifiex_main_process()
370 if ((adapter->ps_state == PS_STATE_SLEEP) || in mwifiex_main_process()
371 (adapter->ps_state == PS_STATE_PRE_SLEEP) || in mwifiex_main_process()
372 (adapter->ps_state == PS_STATE_SLEEP_CFM)) { in mwifiex_main_process()
376 if (adapter->tx_lock_flag) { in mwifiex_main_process()
377 if (adapter->iface_type == MWIFIEX_USB) { in mwifiex_main_process()
378 if (!adapter->usb_mc_setup) in mwifiex_main_process()
384 if (!adapter->cmd_sent && !adapter->curr_cmd && in mwifiex_main_process()
386 (mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA))) { in mwifiex_main_process()
387 if (mwifiex_exec_next_cmd(adapter) == -1) { in mwifiex_main_process()
396 if (adapter->iface_type == MWIFIEX_USB && in mwifiex_main_process()
397 adapter->usb_mc_setup) in mwifiex_main_process()
400 if ((adapter->scan_chan_gap_enabled || in mwifiex_main_process()
401 !adapter->scan_processing) && in mwifiex_main_process()
402 !adapter->data_sent && in mwifiex_main_process()
403 !skb_queue_empty(&adapter->tx_data_q)) { in mwifiex_main_process()
404 mwifiex_process_tx_queue(adapter); in mwifiex_main_process()
405 if (adapter->hs_activated) { in mwifiex_main_process()
407 &adapter->work_flags); in mwifiex_main_process()
410 (adapter, MWIFIEX_BSS_ROLE_ANY), in mwifiex_main_process()
415 if ((adapter->scan_chan_gap_enabled || in mwifiex_main_process()
416 !adapter->scan_processing) && in mwifiex_main_process()
417 !adapter->data_sent && in mwifiex_main_process()
418 !mwifiex_bypass_txlist_empty(adapter) && in mwifiex_main_process()
420 (mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA))) { in mwifiex_main_process()
421 mwifiex_process_bypass_tx(adapter); in mwifiex_main_process()
422 if (adapter->hs_activated) { in mwifiex_main_process()
424 &adapter->work_flags); in mwifiex_main_process()
427 (adapter, MWIFIEX_BSS_ROLE_ANY), in mwifiex_main_process()
432 if ((adapter->scan_chan_gap_enabled || in mwifiex_main_process()
433 !adapter->scan_processing) && in mwifiex_main_process()
434 !adapter->data_sent && !mwifiex_wmm_lists_empty(adapter) && in mwifiex_main_process()
436 (mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA))) { in mwifiex_main_process()
437 mwifiex_wmm_process_tx(adapter); in mwifiex_main_process()
438 if (adapter->hs_activated) { in mwifiex_main_process()
440 &adapter->work_flags); in mwifiex_main_process()
443 (adapter, MWIFIEX_BSS_ROLE_ANY), in mwifiex_main_process()
448 if (adapter->delay_null_pkt && !adapter->cmd_sent && in mwifiex_main_process()
449 !adapter->curr_cmd && !is_command_pending(adapter) && in mwifiex_main_process()
450 (mwifiex_wmm_lists_empty(adapter) && in mwifiex_main_process()
451 mwifiex_bypass_txlist_empty(adapter) && in mwifiex_main_process()
452 skb_queue_empty(&adapter->tx_data_q))) { in mwifiex_main_process()
454 (mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA), in mwifiex_main_process()
457 adapter->delay_null_pkt = false; in mwifiex_main_process()
458 adapter->ps_state = PS_STATE_SLEEP; in mwifiex_main_process()
464 spin_lock_irqsave(&adapter->main_proc_lock, flags); in mwifiex_main_process()
465 if (adapter->more_task_flag) { in mwifiex_main_process()
466 adapter->more_task_flag = false; in mwifiex_main_process()
467 spin_unlock_irqrestore(&adapter->main_proc_lock, flags); in mwifiex_main_process()
470 adapter->mwifiex_processing = false; in mwifiex_main_process()
471 spin_unlock_irqrestore(&adapter->main_proc_lock, flags); in mwifiex_main_process()
483 static void mwifiex_free_adapter(struct mwifiex_adapter *adapter) in mwifiex_free_adapter() argument
485 if (!adapter) { in mwifiex_free_adapter()
490 mwifiex_unregister(adapter); in mwifiex_free_adapter()
498 static void mwifiex_terminate_workqueue(struct mwifiex_adapter *adapter) in mwifiex_terminate_workqueue() argument
500 if (adapter->workqueue) { in mwifiex_terminate_workqueue()
501 flush_workqueue(adapter->workqueue); in mwifiex_terminate_workqueue()
502 destroy_workqueue(adapter->workqueue); in mwifiex_terminate_workqueue()
503 adapter->workqueue = NULL; in mwifiex_terminate_workqueue()
506 if (adapter->rx_workqueue) { in mwifiex_terminate_workqueue()
507 flush_workqueue(adapter->rx_workqueue); in mwifiex_terminate_workqueue()
508 destroy_workqueue(adapter->rx_workqueue); in mwifiex_terminate_workqueue()
509 adapter->rx_workqueue = NULL; in mwifiex_terminate_workqueue()
524 struct mwifiex_adapter *adapter = context; in _mwifiex_fw_dpc() local
528 struct completion *fw_done = adapter->fw_done; in _mwifiex_fw_dpc()
531 mwifiex_dbg(adapter, ERROR, in _mwifiex_fw_dpc()
532 "Failed to get firmware %s\n", adapter->fw_name); in _mwifiex_fw_dpc()
537 adapter->firmware = firmware; in _mwifiex_fw_dpc()
538 fw.fw_buf = (u8 *) adapter->firmware->data; in _mwifiex_fw_dpc()
539 fw.fw_len = adapter->firmware->size; in _mwifiex_fw_dpc()
541 if (adapter->if_ops.dnld_fw) { in _mwifiex_fw_dpc()
542 ret = adapter->if_ops.dnld_fw(adapter, &fw); in _mwifiex_fw_dpc()
544 ret = mwifiex_dnld_fw(adapter, &fw); in _mwifiex_fw_dpc()
550 mwifiex_dbg(adapter, MSG, "WLAN FW is active\n"); in _mwifiex_fw_dpc()
553 if ((request_firmware(&adapter->cal_data, cal_data_cfg, in _mwifiex_fw_dpc()
554 adapter->dev)) < 0) in _mwifiex_fw_dpc()
555 mwifiex_dbg(adapter, ERROR, in _mwifiex_fw_dpc()
560 if (adapter->if_ops.enable_int) { in _mwifiex_fw_dpc()
561 if (adapter->if_ops.enable_int(adapter)) in _mwifiex_fw_dpc()
565 adapter->init_wait_q_woken = false; in _mwifiex_fw_dpc()
566 ret = mwifiex_init_fw(adapter); in _mwifiex_fw_dpc()
570 adapter->hw_status = MWIFIEX_HW_STATUS_READY; in _mwifiex_fw_dpc()
574 if (!adapter->mfg_mode) { in _mwifiex_fw_dpc()
575 wait_event_interruptible(adapter->init_wait_q, in _mwifiex_fw_dpc()
576 adapter->init_wait_q_woken); in _mwifiex_fw_dpc()
577 if (adapter->hw_status != MWIFIEX_HW_STATUS_READY) in _mwifiex_fw_dpc()
581 if (!adapter->wiphy) { in _mwifiex_fw_dpc()
582 if (mwifiex_register_cfg80211(adapter)) { in _mwifiex_fw_dpc()
583 mwifiex_dbg(adapter, ERROR, in _mwifiex_fw_dpc()
589 if (mwifiex_init_channel_scan_gap(adapter)) { in _mwifiex_fw_dpc()
590 mwifiex_dbg(adapter, ERROR, in _mwifiex_fw_dpc()
602 wdev = mwifiex_add_virtual_intf(adapter->wiphy, "mlan%d", NET_NAME_ENUM, in _mwifiex_fw_dpc()
605 mwifiex_dbg(adapter, ERROR, in _mwifiex_fw_dpc()
612 wdev = mwifiex_add_virtual_intf(adapter->wiphy, "uap%d", NET_NAME_ENUM, in _mwifiex_fw_dpc()
615 mwifiex_dbg(adapter, ERROR, in _mwifiex_fw_dpc()
623 wdev = mwifiex_add_virtual_intf(adapter->wiphy, "p2p%d", NET_NAME_ENUM, in _mwifiex_fw_dpc()
626 mwifiex_dbg(adapter, ERROR, in _mwifiex_fw_dpc()
634 mwifiex_drv_get_driver_version(adapter, fmt, sizeof(fmt) - 1); in _mwifiex_fw_dpc()
635 mwifiex_dbg(adapter, MSG, "driver_version = %s\n", fmt); in _mwifiex_fw_dpc()
636 adapter->is_up = true; in _mwifiex_fw_dpc()
640 vfree(adapter->chan_stats); in _mwifiex_fw_dpc()
642 wiphy_unregister(adapter->wiphy); in _mwifiex_fw_dpc()
643 wiphy_free(adapter->wiphy); in _mwifiex_fw_dpc()
645 if (adapter->if_ops.disable_int) in _mwifiex_fw_dpc()
646 adapter->if_ops.disable_int(adapter); in _mwifiex_fw_dpc()
648 mwifiex_dbg(adapter, ERROR, in _mwifiex_fw_dpc()
650 if (adapter->if_ops.unregister_dev) in _mwifiex_fw_dpc()
651 adapter->if_ops.unregister_dev(adapter); in _mwifiex_fw_dpc()
653 set_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags); in _mwifiex_fw_dpc()
654 mwifiex_terminate_workqueue(adapter); in _mwifiex_fw_dpc()
656 if (adapter->hw_status == MWIFIEX_HW_STATUS_READY) { in _mwifiex_fw_dpc()
658 mwifiex_shutdown_drv(adapter); in _mwifiex_fw_dpc()
659 mwifiex_free_cmd_buffers(adapter); in _mwifiex_fw_dpc()
664 if (adapter->cal_data) { in _mwifiex_fw_dpc()
665 release_firmware(adapter->cal_data); in _mwifiex_fw_dpc()
666 adapter->cal_data = NULL; in _mwifiex_fw_dpc()
668 if (adapter->firmware) { in _mwifiex_fw_dpc()
669 release_firmware(adapter->firmware); in _mwifiex_fw_dpc()
670 adapter->firmware = NULL; in _mwifiex_fw_dpc()
673 if (adapter->irq_wakeup >= 0) in _mwifiex_fw_dpc()
674 device_init_wakeup(adapter->dev, false); in _mwifiex_fw_dpc()
675 mwifiex_free_adapter(adapter); in _mwifiex_fw_dpc()
692 static int mwifiex_init_hw_fw(struct mwifiex_adapter *adapter, in mwifiex_init_hw_fw() argument
701 if (strlcpy(adapter->fw_name, MFG_FIRMWARE, in mwifiex_init_hw_fw()
702 sizeof(adapter->fw_name)) >= in mwifiex_init_hw_fw()
703 sizeof(adapter->fw_name)) { in mwifiex_init_hw_fw()
710 ret = request_firmware_nowait(THIS_MODULE, 1, adapter->fw_name, in mwifiex_init_hw_fw()
711 adapter->dev, GFP_KERNEL, adapter, in mwifiex_init_hw_fw()
714 ret = request_firmware(&adapter->firmware, in mwifiex_init_hw_fw()
715 adapter->fw_name, in mwifiex_init_hw_fw()
716 adapter->dev); in mwifiex_init_hw_fw()
720 mwifiex_dbg(adapter, ERROR, "request_firmware%s error %d\n", in mwifiex_init_hw_fw()
751 mwifiex_dbg(priv->adapter, INFO, in mwifiex_close()
759 mwifiex_dbg(priv->adapter, INFO, in mwifiex_close()
777 ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info) && in mwifiex_bypass_tx_queue()
779 mwifiex_dbg(priv->adapter, DATA, in mwifiex_bypass_tx_queue()
800 mwifiex_dbg(priv->adapter, DATA, in mwifiex_queue_tx_pkt()
806 atomic_inc(&priv->adapter->tx_pending); in mwifiex_queue_tx_pkt()
807 atomic_inc(&priv->adapter->bypass_tx_pending); in mwifiex_queue_tx_pkt()
810 atomic_inc(&priv->adapter->tx_pending); in mwifiex_queue_tx_pkt()
814 mwifiex_queue_main_work(priv->adapter); in mwifiex_queue_tx_pkt()
871 mwifiex_dbg(priv->adapter, DATA, in mwifiex_hard_start_xmit()
875 if (test_bit(MWIFIEX_SURPRISE_REMOVED, &priv->adapter->work_flags)) { in mwifiex_hard_start_xmit()
881 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_hard_start_xmit()
888 mwifiex_dbg(priv->adapter, DATA, in mwifiex_hard_start_xmit()
895 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_hard_start_xmit()
903 mwifiex_dbg(priv->adapter, INFO, in mwifiex_hard_start_xmit()
918 priv->adapter->fw_api_ver == MWIFIEX_FW_V15)) in mwifiex_hard_start_xmit()
932 if (ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info) && in mwifiex_hard_start_xmit()
935 if (priv->adapter->auto_tdls && priv->check_tdls_tx) in mwifiex_hard_start_xmit()
965 } else if (priv->adapter->priv[0] != priv) { in mwifiex_set_mac_address()
980 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_set_mac_address()
1031 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_tx_timeout()
1038 priv->adapter->if_ops.card_reset) { in mwifiex_tx_timeout()
1039 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_tx_timeout()
1042 priv->adapter->if_ops.card_reset(priv->adapter); in mwifiex_tx_timeout()
1046 void mwifiex_multi_chan_resync(struct mwifiex_adapter *adapter) in mwifiex_multi_chan_resync() argument
1048 struct usb_card_rec *card = adapter->card; in mwifiex_multi_chan_resync()
1056 mwifiex_dbg(adapter, WARN, "pending data urb in sys\n"); in mwifiex_multi_chan_resync()
1063 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_multi_chan_resync()
1067 mwifiex_dbg(adapter, ERROR, in mwifiex_multi_chan_resync()
1072 void mwifiex_upload_device_dump(struct mwifiex_adapter *adapter) in mwifiex_upload_device_dump() argument
1077 mwifiex_dbg(adapter, MSG, in mwifiex_upload_device_dump()
1079 dev_coredumpv(adapter->dev, adapter->devdump_data, adapter->devdump_len, in mwifiex_upload_device_dump()
1081 mwifiex_dbg(adapter, MSG, in mwifiex_upload_device_dump()
1088 adapter->devdump_data = NULL; in mwifiex_upload_device_dump()
1089 adapter->devdump_len = 0; in mwifiex_upload_device_dump()
1093 void mwifiex_drv_info_dump(struct mwifiex_adapter *adapter) in mwifiex_drv_info_dump() argument
1104 mwifiex_dbg(adapter, MSG, "===mwifiex driverinfo dump start===\n"); in mwifiex_drv_info_dump()
1106 p = adapter->devdump_data; in mwifiex_drv_info_dump()
1111 mwifiex_drv_get_driver_version(adapter, drv_version, in mwifiex_drv_info_dump()
1115 if (adapter->iface_type == MWIFIEX_USB) { in mwifiex_drv_info_dump()
1116 cardp = (struct usb_card_rec *)adapter->card; in mwifiex_drv_info_dump()
1130 atomic_read(&adapter->tx_pending)); in mwifiex_drv_info_dump()
1132 atomic_read(&adapter->rx_pending)); in mwifiex_drv_info_dump()
1134 if (adapter->iface_type == MWIFIEX_SDIO) { in mwifiex_drv_info_dump()
1135 sdio_card = (struct sdio_mmc_card *)adapter->card; in mwifiex_drv_info_dump()
1142 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_drv_info_dump()
1143 if (!adapter->priv[i] || !adapter->priv[i]->netdev) in mwifiex_drv_info_dump()
1145 priv = adapter->priv[i]; in mwifiex_drv_info_dump()
1170 if (adapter->iface_type == MWIFIEX_SDIO || in mwifiex_drv_info_dump()
1171 adapter->iface_type == MWIFIEX_PCIE) { in mwifiex_drv_info_dump()
1173 adapter->iface_type == MWIFIEX_SDIO ? in mwifiex_drv_info_dump()
1175 if (adapter->if_ops.reg_dump) in mwifiex_drv_info_dump()
1176 p += adapter->if_ops.reg_dump(adapter, p); in mwifiex_drv_info_dump()
1181 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_drv_info_dump()
1182 if (!adapter->priv[i] || !adapter->priv[i]->netdev) in mwifiex_drv_info_dump()
1184 priv = adapter->priv[i]; in mwifiex_drv_info_dump()
1194 mwifiex_dbg(adapter, MSG, "===mwifiex driverinfo dump end===\n"); in mwifiex_drv_info_dump()
1195 adapter->devdump_len = p - (char *)adapter->devdump_data; in mwifiex_drv_info_dump()
1199 void mwifiex_prepare_fw_dump_info(struct mwifiex_adapter *adapter) in mwifiex_prepare_fw_dump_info() argument
1205 for (idx = 0; idx < adapter->num_mem_types; idx++) { in mwifiex_prepare_fw_dump_info()
1207 &adapter->mem_type_mapping_tbl[idx]; in mwifiex_prepare_fw_dump_info()
1218 if (dump_len + 1 + adapter->devdump_len > MWIFIEX_FW_DUMP_SIZE) { in mwifiex_prepare_fw_dump_info()
1220 fw_dump_ptr = vzalloc(dump_len + 1 + adapter->devdump_len); in mwifiex_prepare_fw_dump_info()
1221 mwifiex_dbg(adapter, MSG, "Realloc device dump data.\n"); in mwifiex_prepare_fw_dump_info()
1223 vfree(adapter->devdump_data); in mwifiex_prepare_fw_dump_info()
1224 mwifiex_dbg(adapter, ERROR, in mwifiex_prepare_fw_dump_info()
1229 memmove(fw_dump_ptr, adapter->devdump_data, in mwifiex_prepare_fw_dump_info()
1230 adapter->devdump_len); in mwifiex_prepare_fw_dump_info()
1231 vfree(adapter->devdump_data); in mwifiex_prepare_fw_dump_info()
1232 adapter->devdump_data = fw_dump_ptr; in mwifiex_prepare_fw_dump_info()
1235 fw_dump_ptr = (char *)adapter->devdump_data + adapter->devdump_len; in mwifiex_prepare_fw_dump_info()
1237 for (idx = 0; idx < adapter->num_mem_types; idx++) { in mwifiex_prepare_fw_dump_info()
1239 &adapter->mem_type_mapping_tbl[idx]; in mwifiex_prepare_fw_dump_info()
1259 adapter->devdump_len = fw_dump_ptr - (char *)adapter->devdump_data; in mwifiex_prepare_fw_dump_info()
1261 for (idx = 0; idx < adapter->num_mem_types; idx++) { in mwifiex_prepare_fw_dump_info()
1263 &adapter->mem_type_mapping_tbl[idx]; in mwifiex_prepare_fw_dump_info()
1341 ether_addr_copy(priv->curr_addr, priv->adapter->perm_addr); in mwifiex_init_priv_params()
1354 int is_command_pending(struct mwifiex_adapter *adapter) in is_command_pending() argument
1358 spin_lock_bh(&adapter->cmd_pending_q_lock); in is_command_pending()
1359 is_cmd_pend_q_empty = list_empty(&adapter->cmd_pending_q); in is_command_pending()
1360 spin_unlock_bh(&adapter->cmd_pending_q_lock); in is_command_pending()
1372 struct mwifiex_adapter *adapter = in mwifiex_rx_work_queue() local
1375 if (test_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags)) in mwifiex_rx_work_queue()
1377 mwifiex_process_rx(adapter); in mwifiex_rx_work_queue()
1388 struct mwifiex_adapter *adapter = in mwifiex_main_work_queue() local
1391 if (test_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags)) in mwifiex_main_work_queue()
1393 mwifiex_main_process(adapter); in mwifiex_main_work_queue()
1397 static void mwifiex_uninit_sw(struct mwifiex_adapter *adapter) in mwifiex_uninit_sw() argument
1405 if (adapter->if_ops.disable_int) in mwifiex_uninit_sw()
1406 adapter->if_ops.disable_int(adapter); in mwifiex_uninit_sw()
1408 set_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags); in mwifiex_uninit_sw()
1409 mwifiex_terminate_workqueue(adapter); in mwifiex_uninit_sw()
1410 adapter->int_status = 0; in mwifiex_uninit_sw()
1413 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_uninit_sw()
1414 priv = adapter->priv[i]; in mwifiex_uninit_sw()
1416 mwifiex_stop_net_dev_queue(priv->netdev, adapter); in mwifiex_uninit_sw()
1423 mwifiex_dbg(adapter, CMD, "cmd: calling mwifiex_shutdown_drv...\n"); in mwifiex_uninit_sw()
1424 mwifiex_shutdown_drv(adapter); in mwifiex_uninit_sw()
1425 mwifiex_dbg(adapter, CMD, "cmd: mwifiex_shutdown_drv done\n"); in mwifiex_uninit_sw()
1427 if (atomic_read(&adapter->rx_pending) || in mwifiex_uninit_sw()
1428 atomic_read(&adapter->tx_pending) || in mwifiex_uninit_sw()
1429 atomic_read(&adapter->cmd_pending)) { in mwifiex_uninit_sw()
1430 mwifiex_dbg(adapter, ERROR, in mwifiex_uninit_sw()
1433 atomic_read(&adapter->rx_pending), in mwifiex_uninit_sw()
1434 atomic_read(&adapter->tx_pending), in mwifiex_uninit_sw()
1435 atomic_read(&adapter->cmd_pending)); in mwifiex_uninit_sw()
1438 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_uninit_sw()
1439 priv = adapter->priv[i]; in mwifiex_uninit_sw()
1445 mwifiex_del_virtual_intf(adapter->wiphy, &priv->wdev); in mwifiex_uninit_sw()
1449 wiphy_unregister(adapter->wiphy); in mwifiex_uninit_sw()
1450 wiphy_free(adapter->wiphy); in mwifiex_uninit_sw()
1451 adapter->wiphy = NULL; in mwifiex_uninit_sw()
1453 vfree(adapter->chan_stats); in mwifiex_uninit_sw()
1454 mwifiex_free_cmd_buffers(adapter); in mwifiex_uninit_sw()
1460 int mwifiex_shutdown_sw(struct mwifiex_adapter *adapter) in mwifiex_shutdown_sw() argument
1464 if (!adapter) in mwifiex_shutdown_sw()
1467 wait_for_completion(adapter->fw_done); in mwifiex_shutdown_sw()
1469 reinit_completion(adapter->fw_done); in mwifiex_shutdown_sw()
1471 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_shutdown_sw()
1476 mwifiex_uninit_sw(adapter); in mwifiex_shutdown_sw()
1477 adapter->is_up = false; in mwifiex_shutdown_sw()
1479 if (adapter->if_ops.down_dev) in mwifiex_shutdown_sw()
1480 adapter->if_ops.down_dev(adapter); in mwifiex_shutdown_sw()
1490 mwifiex_reinit_sw(struct mwifiex_adapter *adapter) in mwifiex_reinit_sw() argument
1494 mwifiex_init_lock_list(adapter); in mwifiex_reinit_sw()
1495 if (adapter->if_ops.up_dev) in mwifiex_reinit_sw()
1496 adapter->if_ops.up_dev(adapter); in mwifiex_reinit_sw()
1498 adapter->hw_status = MWIFIEX_HW_STATUS_INITIALIZING; in mwifiex_reinit_sw()
1499 clear_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags); in mwifiex_reinit_sw()
1500 init_waitqueue_head(&adapter->init_wait_q); in mwifiex_reinit_sw()
1501 clear_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags); in mwifiex_reinit_sw()
1502 adapter->hs_activated = false; in mwifiex_reinit_sw()
1503 clear_bit(MWIFIEX_IS_CMD_TIMEDOUT, &adapter->work_flags); in mwifiex_reinit_sw()
1504 init_waitqueue_head(&adapter->hs_activate_wait_q); in mwifiex_reinit_sw()
1505 init_waitqueue_head(&adapter->cmd_wait_q.wait); in mwifiex_reinit_sw()
1506 adapter->cmd_wait_q.status = 0; in mwifiex_reinit_sw()
1507 adapter->scan_wait_q_woken = false; in mwifiex_reinit_sw()
1509 if ((num_possible_cpus() > 1) || adapter->iface_type == MWIFIEX_USB) in mwifiex_reinit_sw()
1510 adapter->rx_work_enabled = true; in mwifiex_reinit_sw()
1512 adapter->workqueue = in mwifiex_reinit_sw()
1515 if (!adapter->workqueue) in mwifiex_reinit_sw()
1518 INIT_WORK(&adapter->main_work, mwifiex_main_work_queue); in mwifiex_reinit_sw()
1520 if (adapter->rx_work_enabled) { in mwifiex_reinit_sw()
1521 adapter->rx_workqueue = alloc_workqueue("MWIFIEX_RX_WORK_QUEUE", in mwifiex_reinit_sw()
1525 if (!adapter->rx_workqueue) in mwifiex_reinit_sw()
1527 INIT_WORK(&adapter->rx_work, mwifiex_rx_work_queue); in mwifiex_reinit_sw()
1534 mwifiex_dbg(adapter, INFO, "%s, mwifiex_init_hw_fw()...\n", __func__); in mwifiex_reinit_sw()
1536 if (mwifiex_init_hw_fw(adapter, false)) { in mwifiex_reinit_sw()
1537 mwifiex_dbg(adapter, ERROR, in mwifiex_reinit_sw()
1543 ret = _mwifiex_fw_dpc(adapter->firmware, adapter); in mwifiex_reinit_sw()
1548 mwifiex_dbg(adapter, INFO, "%s, successful\n", __func__); in mwifiex_reinit_sw()
1553 mwifiex_dbg(adapter, ERROR, "info: %s: unregister device\n", __func__); in mwifiex_reinit_sw()
1554 if (adapter->if_ops.unregister_dev) in mwifiex_reinit_sw()
1555 adapter->if_ops.unregister_dev(adapter); in mwifiex_reinit_sw()
1558 set_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags); in mwifiex_reinit_sw()
1559 mwifiex_terminate_workqueue(adapter); in mwifiex_reinit_sw()
1560 if (adapter->hw_status == MWIFIEX_HW_STATUS_READY) { in mwifiex_reinit_sw()
1561 mwifiex_dbg(adapter, ERROR, in mwifiex_reinit_sw()
1563 mwifiex_shutdown_drv(adapter); in mwifiex_reinit_sw()
1564 mwifiex_free_cmd_buffers(adapter); in mwifiex_reinit_sw()
1567 complete_all(adapter->fw_done); in mwifiex_reinit_sw()
1568 mwifiex_dbg(adapter, INFO, "%s, error\n", __func__); in mwifiex_reinit_sw()
1576 struct mwifiex_adapter *adapter = priv; in mwifiex_irq_wakeup_handler() local
1578 dev_dbg(adapter->dev, "%s: wake by wifi", __func__); in mwifiex_irq_wakeup_handler()
1579 adapter->wake_by_wifi = true; in mwifiex_irq_wakeup_handler()
1583 pm_wakeup_event(adapter->dev, 0); in mwifiex_irq_wakeup_handler()
1589 static void mwifiex_probe_of(struct mwifiex_adapter *adapter) in mwifiex_probe_of() argument
1592 struct device *dev = adapter->dev; in mwifiex_probe_of()
1597 adapter->dt_node = dev->of_node; in mwifiex_probe_of()
1598 adapter->irq_wakeup = irq_of_parse_and_map(adapter->dt_node, 0); in mwifiex_probe_of()
1599 if (!adapter->irq_wakeup) { in mwifiex_probe_of()
1604 ret = devm_request_irq(dev, adapter->irq_wakeup, in mwifiex_probe_of()
1606 "wifi_wake", adapter); in mwifiex_probe_of()
1609 adapter->irq_wakeup, ret); in mwifiex_probe_of()
1613 disable_irq(adapter->irq_wakeup); in mwifiex_probe_of()
1621 adapter->irq_wakeup = -1; in mwifiex_probe_of()
1642 struct mwifiex_adapter *adapter; in mwifiex_add_card() local
1644 if (mwifiex_register(card, dev, if_ops, (void **)&adapter)) { in mwifiex_add_card()
1649 mwifiex_probe_of(adapter); in mwifiex_add_card()
1651 adapter->iface_type = iface_type; in mwifiex_add_card()
1652 adapter->fw_done = fw_done; in mwifiex_add_card()
1654 adapter->hw_status = MWIFIEX_HW_STATUS_INITIALIZING; in mwifiex_add_card()
1655 clear_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags); in mwifiex_add_card()
1656 init_waitqueue_head(&adapter->init_wait_q); in mwifiex_add_card()
1657 clear_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags); in mwifiex_add_card()
1658 adapter->hs_activated = false; in mwifiex_add_card()
1659 init_waitqueue_head(&adapter->hs_activate_wait_q); in mwifiex_add_card()
1660 init_waitqueue_head(&adapter->cmd_wait_q.wait); in mwifiex_add_card()
1661 adapter->cmd_wait_q.status = 0; in mwifiex_add_card()
1662 adapter->scan_wait_q_woken = false; in mwifiex_add_card()
1664 if ((num_possible_cpus() > 1) || adapter->iface_type == MWIFIEX_USB) in mwifiex_add_card()
1665 adapter->rx_work_enabled = true; in mwifiex_add_card()
1667 adapter->workqueue = in mwifiex_add_card()
1670 if (!adapter->workqueue) in mwifiex_add_card()
1673 INIT_WORK(&adapter->main_work, mwifiex_main_work_queue); in mwifiex_add_card()
1675 if (adapter->rx_work_enabled) { in mwifiex_add_card()
1676 adapter->rx_workqueue = alloc_workqueue("MWIFIEX_RX_WORK_QUEUE", in mwifiex_add_card()
1680 if (!adapter->rx_workqueue) in mwifiex_add_card()
1683 INIT_WORK(&adapter->rx_work, mwifiex_rx_work_queue); in mwifiex_add_card()
1688 if (adapter->if_ops.register_dev(adapter)) { in mwifiex_add_card()
1693 if (mwifiex_init_hw_fw(adapter, true)) { in mwifiex_add_card()
1702 if (adapter->if_ops.unregister_dev) in mwifiex_add_card()
1703 adapter->if_ops.unregister_dev(adapter); in mwifiex_add_card()
1705 set_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags); in mwifiex_add_card()
1706 mwifiex_terminate_workqueue(adapter); in mwifiex_add_card()
1707 if (adapter->hw_status == MWIFIEX_HW_STATUS_READY) { in mwifiex_add_card()
1709 mwifiex_shutdown_drv(adapter); in mwifiex_add_card()
1710 mwifiex_free_cmd_buffers(adapter); in mwifiex_add_card()
1713 if (adapter->irq_wakeup >= 0) in mwifiex_add_card()
1714 device_init_wakeup(adapter->dev, false); in mwifiex_add_card()
1715 mwifiex_free_adapter(adapter); in mwifiex_add_card()
1734 int mwifiex_remove_card(struct mwifiex_adapter *adapter) in mwifiex_remove_card() argument
1736 if (!adapter) in mwifiex_remove_card()
1739 if (adapter->is_up) in mwifiex_remove_card()
1740 mwifiex_uninit_sw(adapter); in mwifiex_remove_card()
1742 if (adapter->irq_wakeup >= 0) in mwifiex_remove_card()
1743 device_init_wakeup(adapter->dev, false); in mwifiex_remove_card()
1746 mwifiex_dbg(adapter, INFO, in mwifiex_remove_card()
1748 if (adapter->if_ops.unregister_dev) in mwifiex_remove_card()
1749 adapter->if_ops.unregister_dev(adapter); in mwifiex_remove_card()
1751 mwifiex_dbg(adapter, INFO, in mwifiex_remove_card()
1753 mwifiex_free_adapter(adapter); in mwifiex_remove_card()
1759 void _mwifiex_dbg(const struct mwifiex_adapter *adapter, int mask, in _mwifiex_dbg() argument
1765 if (!(adapter->debug_mask & mask)) in _mwifiex_dbg()
1773 if (adapter->dev) in _mwifiex_dbg()
1774 dev_info(adapter->dev, "%pV", &vaf); in _mwifiex_dbg()