Lines Matching refs:adapter

59 	struct mwifiex_adapter *adapter;  in mwifiex_register()  local
62 adapter = kzalloc(sizeof(struct mwifiex_adapter), GFP_KERNEL); in mwifiex_register()
63 if (!adapter) in mwifiex_register()
66 *padapter = adapter; in mwifiex_register()
67 adapter->dev = dev; in mwifiex_register()
68 adapter->card = card; in mwifiex_register()
71 memmove(&adapter->if_ops, if_ops, sizeof(struct mwifiex_if_ops)); in mwifiex_register()
72 adapter->debug_mask = debug_mask; in mwifiex_register()
75 if (adapter->if_ops.init_if) in mwifiex_register()
76 if (adapter->if_ops.init_if(adapter)) in mwifiex_register()
79 adapter->priv_num = 0; in mwifiex_register()
83 adapter->priv[i] = in mwifiex_register()
85 if (!adapter->priv[i]) in mwifiex_register()
88 adapter->priv[i]->adapter = adapter; in mwifiex_register()
89 adapter->priv_num++; in mwifiex_register()
91 mwifiex_init_lock_list(adapter); in mwifiex_register()
93 timer_setup(&adapter->cmd_timer, mwifiex_cmd_timeout_func, 0); in mwifiex_register()
98 mwifiex_dbg(adapter, ERROR, in mwifiex_register()
101 for (i = 0; i < adapter->priv_num; i++) in mwifiex_register()
102 kfree(adapter->priv[i]); in mwifiex_register()
104 kfree(adapter); in mwifiex_register()
119 static int mwifiex_unregister(struct mwifiex_adapter *adapter) in mwifiex_unregister() argument
123 if (adapter->if_ops.cleanup_if) in mwifiex_unregister()
124 adapter->if_ops.cleanup_if(adapter); in mwifiex_unregister()
126 timer_shutdown_sync(&adapter->cmd_timer); in mwifiex_unregister()
129 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_unregister()
130 if (adapter->priv[i]) { in mwifiex_unregister()
131 mwifiex_free_curr_bcn(adapter->priv[i]); in mwifiex_unregister()
132 kfree(adapter->priv[i]); in mwifiex_unregister()
136 if (adapter->nd_info) { in mwifiex_unregister()
137 for (i = 0 ; i < adapter->nd_info->n_matches ; i++) in mwifiex_unregister()
138 kfree(adapter->nd_info->matches[i]); in mwifiex_unregister()
139 kfree(adapter->nd_info); in mwifiex_unregister()
140 adapter->nd_info = NULL; in mwifiex_unregister()
143 kfree(adapter->regd); in mwifiex_unregister()
145 kfree(adapter); in mwifiex_unregister()
149 void mwifiex_queue_main_work(struct mwifiex_adapter *adapter) in mwifiex_queue_main_work() argument
153 spin_lock_irqsave(&adapter->main_proc_lock, flags); in mwifiex_queue_main_work()
154 if (adapter->mwifiex_processing) { in mwifiex_queue_main_work()
155 adapter->more_task_flag = true; in mwifiex_queue_main_work()
156 spin_unlock_irqrestore(&adapter->main_proc_lock, flags); in mwifiex_queue_main_work()
158 spin_unlock_irqrestore(&adapter->main_proc_lock, flags); in mwifiex_queue_main_work()
159 queue_work(adapter->workqueue, &adapter->main_work); in mwifiex_queue_main_work()
164 static void mwifiex_queue_rx_work(struct mwifiex_adapter *adapter) in mwifiex_queue_rx_work() argument
166 spin_lock_bh(&adapter->rx_proc_lock); in mwifiex_queue_rx_work()
167 if (adapter->rx_processing) { in mwifiex_queue_rx_work()
168 spin_unlock_bh(&adapter->rx_proc_lock); in mwifiex_queue_rx_work()
170 spin_unlock_bh(&adapter->rx_proc_lock); in mwifiex_queue_rx_work()
171 queue_work(adapter->rx_workqueue, &adapter->rx_work); in mwifiex_queue_rx_work()
175 static int mwifiex_process_rx(struct mwifiex_adapter *adapter) in mwifiex_process_rx() argument
180 spin_lock_bh(&adapter->rx_proc_lock); in mwifiex_process_rx()
181 if (adapter->rx_processing || adapter->rx_locked) { in mwifiex_process_rx()
182 spin_unlock_bh(&adapter->rx_proc_lock); in mwifiex_process_rx()
185 adapter->rx_processing = true; in mwifiex_process_rx()
186 spin_unlock_bh(&adapter->rx_proc_lock); in mwifiex_process_rx()
190 while ((skb = skb_dequeue(&adapter->rx_data_q))) { in mwifiex_process_rx()
191 atomic_dec(&adapter->rx_pending); in mwifiex_process_rx()
192 if ((adapter->delay_main_work || in mwifiex_process_rx()
193 adapter->iface_type == MWIFIEX_USB) && in mwifiex_process_rx()
194 (atomic_read(&adapter->rx_pending) < LOW_RX_PENDING)) { in mwifiex_process_rx()
195 if (adapter->if_ops.submit_rem_rx_urbs) in mwifiex_process_rx()
196 adapter->if_ops.submit_rem_rx_urbs(adapter); in mwifiex_process_rx()
197 adapter->delay_main_work = false; in mwifiex_process_rx()
198 mwifiex_queue_main_work(adapter); in mwifiex_process_rx()
202 if (adapter->if_ops.deaggr_pkt) in mwifiex_process_rx()
203 adapter->if_ops.deaggr_pkt(adapter, skb); in mwifiex_process_rx()
206 mwifiex_handle_rx_packet(adapter, skb); in mwifiex_process_rx()
209 spin_lock_bh(&adapter->rx_proc_lock); in mwifiex_process_rx()
210 adapter->rx_processing = false; in mwifiex_process_rx()
211 spin_unlock_bh(&adapter->rx_proc_lock); in mwifiex_process_rx()
217 static void maybe_quirk_fw_disable_ds(struct mwifiex_adapter *adapter) in maybe_quirk_fw_disable_ds() argument
219 struct mwifiex_private *priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA); in maybe_quirk_fw_disable_ds()
222 if (test_and_set_bit(MWIFIEX_IS_REQUESTING_FW_VEREXT, &adapter->work_flags)) in maybe_quirk_fw_disable_ds()
229 mwifiex_dbg(priv->adapter, MSG, in maybe_quirk_fw_disable_ds()
249 int mwifiex_main_process(struct mwifiex_adapter *adapter) in mwifiex_main_process() argument
254 spin_lock_irqsave(&adapter->main_proc_lock, flags); in mwifiex_main_process()
257 if (adapter->mwifiex_processing || adapter->main_locked) { in mwifiex_main_process()
258 adapter->more_task_flag = true; in mwifiex_main_process()
259 spin_unlock_irqrestore(&adapter->main_proc_lock, flags); in mwifiex_main_process()
262 adapter->mwifiex_processing = true; in mwifiex_main_process()
263 spin_unlock_irqrestore(&adapter->main_proc_lock, flags); in mwifiex_main_process()
267 if (adapter->hw_status == MWIFIEX_HW_STATUS_NOT_READY) in mwifiex_main_process()
277 if (atomic_read(&adapter->rx_pending) >= HIGH_RX_PENDING && in mwifiex_main_process()
278 adapter->iface_type != MWIFIEX_USB) { in mwifiex_main_process()
279 adapter->delay_main_work = true; in mwifiex_main_process()
280 mwifiex_queue_rx_work(adapter); in mwifiex_main_process()
285 if (adapter->int_status) { in mwifiex_main_process()
286 if (adapter->hs_activated) in mwifiex_main_process()
287 mwifiex_process_hs_config(adapter); in mwifiex_main_process()
288 if (adapter->if_ops.process_int_status) in mwifiex_main_process()
289 adapter->if_ops.process_int_status(adapter); in mwifiex_main_process()
292 if (adapter->rx_work_enabled && adapter->data_received) in mwifiex_main_process()
293 mwifiex_queue_rx_work(adapter); in mwifiex_main_process()
296 if ((adapter->ps_state == PS_STATE_SLEEP) && in mwifiex_main_process()
297 (adapter->pm_wakeup_card_req && in mwifiex_main_process()
298 !adapter->pm_wakeup_fw_try) && in mwifiex_main_process()
299 (is_command_pending(adapter) || in mwifiex_main_process()
300 !skb_queue_empty(&adapter->tx_data_q) || in mwifiex_main_process()
301 !mwifiex_bypass_txlist_empty(adapter) || in mwifiex_main_process()
302 !mwifiex_wmm_lists_empty(adapter))) { in mwifiex_main_process()
303 adapter->pm_wakeup_fw_try = true; in mwifiex_main_process()
304 mod_timer(&adapter->wakeup_timer, jiffies + (HZ*3)); in mwifiex_main_process()
305 adapter->if_ops.wakeup(adapter); in mwifiex_main_process()
309 if (IS_CARD_RX_RCVD(adapter)) { in mwifiex_main_process()
310 adapter->data_received = false; in mwifiex_main_process()
311 adapter->pm_wakeup_fw_try = false; in mwifiex_main_process()
312 del_timer(&adapter->wakeup_timer); in mwifiex_main_process()
313 if (adapter->ps_state == PS_STATE_SLEEP) in mwifiex_main_process()
314 adapter->ps_state = PS_STATE_AWAKE; in mwifiex_main_process()
317 if (adapter->pm_wakeup_fw_try) in mwifiex_main_process()
319 if (adapter->ps_state == PS_STATE_PRE_SLEEP) in mwifiex_main_process()
320 mwifiex_check_ps_cond(adapter); in mwifiex_main_process()
322 if (adapter->ps_state != PS_STATE_AWAKE) in mwifiex_main_process()
324 if (adapter->tx_lock_flag) { in mwifiex_main_process()
325 if (adapter->iface_type == MWIFIEX_USB) { in mwifiex_main_process()
326 if (!adapter->usb_mc_setup) in mwifiex_main_process()
332 if ((!adapter->scan_chan_gap_enabled && in mwifiex_main_process()
333 adapter->scan_processing) || adapter->data_sent || in mwifiex_main_process()
335 (mwifiex_get_priv(adapter, in mwifiex_main_process()
337 (mwifiex_wmm_lists_empty(adapter) && in mwifiex_main_process()
338 mwifiex_bypass_txlist_empty(adapter) && in mwifiex_main_process()
339 skb_queue_empty(&adapter->tx_data_q))) { in mwifiex_main_process()
340 if (adapter->cmd_sent || adapter->curr_cmd || in mwifiex_main_process()
342 (mwifiex_get_priv(adapter, in mwifiex_main_process()
344 (!is_command_pending(adapter))) in mwifiex_main_process()
350 if (adapter->event_received) { in mwifiex_main_process()
351 adapter->event_received = false; in mwifiex_main_process()
352 mwifiex_process_event(adapter); in mwifiex_main_process()
356 if (adapter->cmd_resp_received) { in mwifiex_main_process()
357 adapter->cmd_resp_received = false; in mwifiex_main_process()
358 mwifiex_process_cmdresp(adapter); in mwifiex_main_process()
361 if (adapter->hw_status == MWIFIEX_HW_STATUS_INIT_DONE) { in mwifiex_main_process()
362 adapter->hw_status = MWIFIEX_HW_STATUS_READY; in mwifiex_main_process()
363 mwifiex_init_fw_complete(adapter); in mwifiex_main_process()
364 maybe_quirk_fw_disable_ds(adapter); in mwifiex_main_process()
370 if (adapter->ps_state == PS_STATE_PRE_SLEEP) in mwifiex_main_process()
371 mwifiex_check_ps_cond(adapter); in mwifiex_main_process()
376 if ((adapter->ps_state == PS_STATE_SLEEP) || in mwifiex_main_process()
377 (adapter->ps_state == PS_STATE_PRE_SLEEP) || in mwifiex_main_process()
378 (adapter->ps_state == PS_STATE_SLEEP_CFM)) { in mwifiex_main_process()
382 if (adapter->tx_lock_flag) { in mwifiex_main_process()
383 if (adapter->iface_type == MWIFIEX_USB) { in mwifiex_main_process()
384 if (!adapter->usb_mc_setup) in mwifiex_main_process()
390 if (!adapter->cmd_sent && !adapter->curr_cmd && in mwifiex_main_process()
392 (mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA))) { in mwifiex_main_process()
393 if (mwifiex_exec_next_cmd(adapter) == -1) { in mwifiex_main_process()
402 if (adapter->iface_type == MWIFIEX_USB && in mwifiex_main_process()
403 adapter->usb_mc_setup) in mwifiex_main_process()
406 if ((adapter->scan_chan_gap_enabled || in mwifiex_main_process()
407 !adapter->scan_processing) && in mwifiex_main_process()
408 !adapter->data_sent && in mwifiex_main_process()
409 !skb_queue_empty(&adapter->tx_data_q)) { in mwifiex_main_process()
410 if (adapter->hs_activated_manually) { in mwifiex_main_process()
411 mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY), in mwifiex_main_process()
413 adapter->hs_activated_manually = false; in mwifiex_main_process()
416 mwifiex_process_tx_queue(adapter); in mwifiex_main_process()
417 if (adapter->hs_activated) { in mwifiex_main_process()
419 &adapter->work_flags); in mwifiex_main_process()
422 (adapter, MWIFIEX_BSS_ROLE_ANY), in mwifiex_main_process()
427 if ((adapter->scan_chan_gap_enabled || in mwifiex_main_process()
428 !adapter->scan_processing) && in mwifiex_main_process()
429 !adapter->data_sent && in mwifiex_main_process()
430 !mwifiex_bypass_txlist_empty(adapter) && in mwifiex_main_process()
432 (mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA))) { in mwifiex_main_process()
433 if (adapter->hs_activated_manually) { in mwifiex_main_process()
434 mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY), in mwifiex_main_process()
436 adapter->hs_activated_manually = false; in mwifiex_main_process()
439 mwifiex_process_bypass_tx(adapter); in mwifiex_main_process()
440 if (adapter->hs_activated) { in mwifiex_main_process()
442 &adapter->work_flags); in mwifiex_main_process()
445 (adapter, MWIFIEX_BSS_ROLE_ANY), in mwifiex_main_process()
450 if ((adapter->scan_chan_gap_enabled || in mwifiex_main_process()
451 !adapter->scan_processing) && in mwifiex_main_process()
452 !adapter->data_sent && !mwifiex_wmm_lists_empty(adapter) && in mwifiex_main_process()
454 (mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA))) { in mwifiex_main_process()
455 if (adapter->hs_activated_manually) { in mwifiex_main_process()
456 mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY), in mwifiex_main_process()
458 adapter->hs_activated_manually = false; in mwifiex_main_process()
461 mwifiex_wmm_process_tx(adapter); in mwifiex_main_process()
462 if (adapter->hs_activated) { in mwifiex_main_process()
464 &adapter->work_flags); in mwifiex_main_process()
467 (adapter, MWIFIEX_BSS_ROLE_ANY), in mwifiex_main_process()
472 if (adapter->delay_null_pkt && !adapter->cmd_sent && in mwifiex_main_process()
473 !adapter->curr_cmd && !is_command_pending(adapter) && in mwifiex_main_process()
474 (mwifiex_wmm_lists_empty(adapter) && in mwifiex_main_process()
475 mwifiex_bypass_txlist_empty(adapter) && in mwifiex_main_process()
476 skb_queue_empty(&adapter->tx_data_q))) { in mwifiex_main_process()
478 (mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA), in mwifiex_main_process()
481 adapter->delay_null_pkt = false; in mwifiex_main_process()
482 adapter->ps_state = PS_STATE_SLEEP; in mwifiex_main_process()
488 spin_lock_irqsave(&adapter->main_proc_lock, flags); in mwifiex_main_process()
489 if (adapter->more_task_flag) { in mwifiex_main_process()
490 adapter->more_task_flag = false; in mwifiex_main_process()
491 spin_unlock_irqrestore(&adapter->main_proc_lock, flags); in mwifiex_main_process()
494 adapter->mwifiex_processing = false; in mwifiex_main_process()
495 spin_unlock_irqrestore(&adapter->main_proc_lock, flags); in mwifiex_main_process()
507 static void mwifiex_free_adapter(struct mwifiex_adapter *adapter) in mwifiex_free_adapter() argument
509 if (!adapter) { in mwifiex_free_adapter()
514 mwifiex_unregister(adapter); in mwifiex_free_adapter()
522 static void mwifiex_terminate_workqueue(struct mwifiex_adapter *adapter) in mwifiex_terminate_workqueue() argument
524 if (adapter->workqueue) { in mwifiex_terminate_workqueue()
525 destroy_workqueue(adapter->workqueue); in mwifiex_terminate_workqueue()
526 adapter->workqueue = NULL; in mwifiex_terminate_workqueue()
529 if (adapter->rx_workqueue) { in mwifiex_terminate_workqueue()
530 destroy_workqueue(adapter->rx_workqueue); in mwifiex_terminate_workqueue()
531 adapter->rx_workqueue = NULL; in mwifiex_terminate_workqueue()
546 struct mwifiex_adapter *adapter = context; in _mwifiex_fw_dpc() local
550 struct completion *fw_done = adapter->fw_done; in _mwifiex_fw_dpc()
553 mwifiex_dbg(adapter, ERROR, in _mwifiex_fw_dpc()
554 "Failed to get firmware %s\n", adapter->fw_name); in _mwifiex_fw_dpc()
559 adapter->firmware = firmware; in _mwifiex_fw_dpc()
560 fw.fw_buf = (u8 *) adapter->firmware->data; in _mwifiex_fw_dpc()
561 fw.fw_len = adapter->firmware->size; in _mwifiex_fw_dpc()
563 if (adapter->if_ops.dnld_fw) { in _mwifiex_fw_dpc()
564 ret = adapter->if_ops.dnld_fw(adapter, &fw); in _mwifiex_fw_dpc()
566 ret = mwifiex_dnld_fw(adapter, &fw); in _mwifiex_fw_dpc()
572 mwifiex_dbg(adapter, MSG, "WLAN FW is active\n"); in _mwifiex_fw_dpc()
575 if ((request_firmware(&adapter->cal_data, cal_data_cfg, in _mwifiex_fw_dpc()
576 adapter->dev)) < 0) in _mwifiex_fw_dpc()
577 mwifiex_dbg(adapter, ERROR, in _mwifiex_fw_dpc()
582 if (adapter->if_ops.enable_int) { in _mwifiex_fw_dpc()
583 if (adapter->if_ops.enable_int(adapter)) in _mwifiex_fw_dpc()
587 adapter->init_wait_q_woken = false; in _mwifiex_fw_dpc()
588 ret = mwifiex_init_fw(adapter); in _mwifiex_fw_dpc()
592 adapter->hw_status = MWIFIEX_HW_STATUS_READY; in _mwifiex_fw_dpc()
596 if (!adapter->mfg_mode) { in _mwifiex_fw_dpc()
597 wait_event_interruptible(adapter->init_wait_q, in _mwifiex_fw_dpc()
598 adapter->init_wait_q_woken); in _mwifiex_fw_dpc()
599 if (adapter->hw_status != MWIFIEX_HW_STATUS_READY) in _mwifiex_fw_dpc()
603 if (!adapter->wiphy) { in _mwifiex_fw_dpc()
604 if (mwifiex_register_cfg80211(adapter)) { in _mwifiex_fw_dpc()
605 mwifiex_dbg(adapter, ERROR, in _mwifiex_fw_dpc()
611 if (mwifiex_init_channel_scan_gap(adapter)) { in _mwifiex_fw_dpc()
612 mwifiex_dbg(adapter, ERROR, in _mwifiex_fw_dpc()
623 wiphy_lock(adapter->wiphy); in _mwifiex_fw_dpc()
625 wdev = mwifiex_add_virtual_intf(adapter->wiphy, "mlan%d", NET_NAME_ENUM, in _mwifiex_fw_dpc()
628 mwifiex_dbg(adapter, ERROR, in _mwifiex_fw_dpc()
630 wiphy_unlock(adapter->wiphy); in _mwifiex_fw_dpc()
636 wdev = mwifiex_add_virtual_intf(adapter->wiphy, "uap%d", NET_NAME_ENUM, in _mwifiex_fw_dpc()
639 mwifiex_dbg(adapter, ERROR, in _mwifiex_fw_dpc()
641 wiphy_unlock(adapter->wiphy); in _mwifiex_fw_dpc()
648 wdev = mwifiex_add_virtual_intf(adapter->wiphy, "p2p%d", NET_NAME_ENUM, in _mwifiex_fw_dpc()
651 mwifiex_dbg(adapter, ERROR, in _mwifiex_fw_dpc()
653 wiphy_unlock(adapter->wiphy); in _mwifiex_fw_dpc()
658 wiphy_unlock(adapter->wiphy); in _mwifiex_fw_dpc()
661 mwifiex_drv_get_driver_version(adapter, fmt, sizeof(fmt) - 1); in _mwifiex_fw_dpc()
662 mwifiex_dbg(adapter, MSG, "driver_version = %s\n", fmt); in _mwifiex_fw_dpc()
663 adapter->is_up = true; in _mwifiex_fw_dpc()
667 vfree(adapter->chan_stats); in _mwifiex_fw_dpc()
669 wiphy_unregister(adapter->wiphy); in _mwifiex_fw_dpc()
670 wiphy_free(adapter->wiphy); in _mwifiex_fw_dpc()
672 if (adapter->if_ops.disable_int) in _mwifiex_fw_dpc()
673 adapter->if_ops.disable_int(adapter); in _mwifiex_fw_dpc()
675 mwifiex_dbg(adapter, ERROR, in _mwifiex_fw_dpc()
677 if (adapter->if_ops.unregister_dev) in _mwifiex_fw_dpc()
678 adapter->if_ops.unregister_dev(adapter); in _mwifiex_fw_dpc()
680 set_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags); in _mwifiex_fw_dpc()
681 mwifiex_terminate_workqueue(adapter); in _mwifiex_fw_dpc()
683 if (adapter->hw_status == MWIFIEX_HW_STATUS_READY) { in _mwifiex_fw_dpc()
685 mwifiex_shutdown_drv(adapter); in _mwifiex_fw_dpc()
686 mwifiex_free_cmd_buffers(adapter); in _mwifiex_fw_dpc()
691 if (adapter->cal_data) { in _mwifiex_fw_dpc()
692 release_firmware(adapter->cal_data); in _mwifiex_fw_dpc()
693 adapter->cal_data = NULL; in _mwifiex_fw_dpc()
695 if (adapter->firmware) { in _mwifiex_fw_dpc()
696 release_firmware(adapter->firmware); in _mwifiex_fw_dpc()
697 adapter->firmware = NULL; in _mwifiex_fw_dpc()
700 if (adapter->irq_wakeup >= 0) in _mwifiex_fw_dpc()
701 device_init_wakeup(adapter->dev, false); in _mwifiex_fw_dpc()
702 mwifiex_free_adapter(adapter); in _mwifiex_fw_dpc()
719 static int mwifiex_init_hw_fw(struct mwifiex_adapter *adapter, in mwifiex_init_hw_fw() argument
728 strscpy(adapter->fw_name, MFG_FIRMWARE, in mwifiex_init_hw_fw()
729 sizeof(adapter->fw_name)); in mwifiex_init_hw_fw()
732 ret = request_firmware_nowait(THIS_MODULE, 1, adapter->fw_name, in mwifiex_init_hw_fw()
733 adapter->dev, GFP_KERNEL, adapter, in mwifiex_init_hw_fw()
736 ret = request_firmware(&adapter->firmware, in mwifiex_init_hw_fw()
737 adapter->fw_name, in mwifiex_init_hw_fw()
738 adapter->dev); in mwifiex_init_hw_fw()
742 mwifiex_dbg(adapter, ERROR, "request_firmware%s error %d\n", in mwifiex_init_hw_fw()
773 mwifiex_dbg(priv->adapter, INFO, in mwifiex_close()
781 mwifiex_dbg(priv->adapter, INFO, in mwifiex_close()
799 ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info) && in mwifiex_bypass_tx_queue()
801 mwifiex_dbg(priv->adapter, DATA, in mwifiex_bypass_tx_queue()
822 mwifiex_dbg(priv->adapter, DATA, in mwifiex_queue_tx_pkt()
828 atomic_inc(&priv->adapter->tx_pending); in mwifiex_queue_tx_pkt()
829 atomic_inc(&priv->adapter->bypass_tx_pending); in mwifiex_queue_tx_pkt()
832 atomic_inc(&priv->adapter->tx_pending); in mwifiex_queue_tx_pkt()
836 mwifiex_queue_main_work(priv->adapter); in mwifiex_queue_tx_pkt()
893 mwifiex_dbg(priv->adapter, DATA, in mwifiex_hard_start_xmit()
897 if (test_bit(MWIFIEX_SURPRISE_REMOVED, &priv->adapter->work_flags)) { in mwifiex_hard_start_xmit()
903 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_hard_start_xmit()
910 mwifiex_dbg(priv->adapter, DATA, in mwifiex_hard_start_xmit()
917 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_hard_start_xmit()
925 mwifiex_dbg(priv->adapter, INFO, in mwifiex_hard_start_xmit()
940 priv->adapter->fw_api_ver == MWIFIEX_FW_V15)) in mwifiex_hard_start_xmit()
954 if (ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info) && in mwifiex_hard_start_xmit()
957 if (priv->adapter->auto_tdls && priv->check_tdls_tx) in mwifiex_hard_start_xmit()
987 } else if (priv->adapter->priv[0] != priv) { in mwifiex_set_mac_address()
1002 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_set_mac_address()
1053 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_tx_timeout()
1060 priv->adapter->if_ops.card_reset) { in mwifiex_tx_timeout()
1061 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_tx_timeout()
1064 priv->adapter->if_ops.card_reset(priv->adapter); in mwifiex_tx_timeout()
1068 void mwifiex_multi_chan_resync(struct mwifiex_adapter *adapter) in mwifiex_multi_chan_resync() argument
1070 struct usb_card_rec *card = adapter->card; in mwifiex_multi_chan_resync()
1078 mwifiex_dbg(adapter, WARN, "pending data urb in sys\n"); in mwifiex_multi_chan_resync()
1085 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_multi_chan_resync()
1089 mwifiex_dbg(adapter, ERROR, in mwifiex_multi_chan_resync()
1094 void mwifiex_upload_device_dump(struct mwifiex_adapter *adapter) in mwifiex_upload_device_dump() argument
1099 mwifiex_dbg(adapter, MSG, in mwifiex_upload_device_dump()
1101 dev_coredumpv(adapter->dev, adapter->devdump_data, adapter->devdump_len, in mwifiex_upload_device_dump()
1103 mwifiex_dbg(adapter, MSG, in mwifiex_upload_device_dump()
1110 adapter->devdump_data = NULL; in mwifiex_upload_device_dump()
1111 adapter->devdump_len = 0; in mwifiex_upload_device_dump()
1115 void mwifiex_drv_info_dump(struct mwifiex_adapter *adapter) in mwifiex_drv_info_dump() argument
1126 mwifiex_dbg(adapter, MSG, "===mwifiex driverinfo dump start===\n"); in mwifiex_drv_info_dump()
1128 p = adapter->devdump_data; in mwifiex_drv_info_dump()
1133 mwifiex_drv_get_driver_version(adapter, drv_version, in mwifiex_drv_info_dump()
1137 if (adapter->iface_type == MWIFIEX_USB) { in mwifiex_drv_info_dump()
1138 cardp = (struct usb_card_rec *)adapter->card; in mwifiex_drv_info_dump()
1152 atomic_read(&adapter->tx_pending)); in mwifiex_drv_info_dump()
1154 atomic_read(&adapter->rx_pending)); in mwifiex_drv_info_dump()
1156 if (adapter->iface_type == MWIFIEX_SDIO) { in mwifiex_drv_info_dump()
1157 sdio_card = (struct sdio_mmc_card *)adapter->card; in mwifiex_drv_info_dump()
1164 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_drv_info_dump()
1165 if (!adapter->priv[i] || !adapter->priv[i]->netdev) in mwifiex_drv_info_dump()
1167 priv = adapter->priv[i]; in mwifiex_drv_info_dump()
1192 if (adapter->iface_type == MWIFIEX_SDIO || in mwifiex_drv_info_dump()
1193 adapter->iface_type == MWIFIEX_PCIE) { in mwifiex_drv_info_dump()
1195 adapter->iface_type == MWIFIEX_SDIO ? in mwifiex_drv_info_dump()
1197 if (adapter->if_ops.reg_dump) in mwifiex_drv_info_dump()
1198 p += adapter->if_ops.reg_dump(adapter, p); in mwifiex_drv_info_dump()
1203 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_drv_info_dump()
1204 if (!adapter->priv[i] || !adapter->priv[i]->netdev) in mwifiex_drv_info_dump()
1206 priv = adapter->priv[i]; in mwifiex_drv_info_dump()
1216 mwifiex_dbg(adapter, MSG, "===mwifiex driverinfo dump end===\n"); in mwifiex_drv_info_dump()
1217 adapter->devdump_len = p - (char *)adapter->devdump_data; in mwifiex_drv_info_dump()
1221 void mwifiex_prepare_fw_dump_info(struct mwifiex_adapter *adapter) in mwifiex_prepare_fw_dump_info() argument
1227 for (idx = 0; idx < adapter->num_mem_types; idx++) { in mwifiex_prepare_fw_dump_info()
1229 &adapter->mem_type_mapping_tbl[idx]; in mwifiex_prepare_fw_dump_info()
1240 if (dump_len + 1 + adapter->devdump_len > MWIFIEX_FW_DUMP_SIZE) { in mwifiex_prepare_fw_dump_info()
1242 fw_dump_ptr = vzalloc(dump_len + 1 + adapter->devdump_len); in mwifiex_prepare_fw_dump_info()
1243 mwifiex_dbg(adapter, MSG, "Realloc device dump data.\n"); in mwifiex_prepare_fw_dump_info()
1245 vfree(adapter->devdump_data); in mwifiex_prepare_fw_dump_info()
1246 mwifiex_dbg(adapter, ERROR, in mwifiex_prepare_fw_dump_info()
1251 memmove(fw_dump_ptr, adapter->devdump_data, in mwifiex_prepare_fw_dump_info()
1252 adapter->devdump_len); in mwifiex_prepare_fw_dump_info()
1253 vfree(adapter->devdump_data); in mwifiex_prepare_fw_dump_info()
1254 adapter->devdump_data = fw_dump_ptr; in mwifiex_prepare_fw_dump_info()
1257 fw_dump_ptr = (char *)adapter->devdump_data + adapter->devdump_len; in mwifiex_prepare_fw_dump_info()
1259 for (idx = 0; idx < adapter->num_mem_types; idx++) { in mwifiex_prepare_fw_dump_info()
1261 &adapter->mem_type_mapping_tbl[idx]; in mwifiex_prepare_fw_dump_info()
1281 adapter->devdump_len = fw_dump_ptr - (char *)adapter->devdump_data; in mwifiex_prepare_fw_dump_info()
1283 for (idx = 0; idx < adapter->num_mem_types; idx++) { in mwifiex_prepare_fw_dump_info()
1285 &adapter->mem_type_mapping_tbl[idx]; in mwifiex_prepare_fw_dump_info()
1363 ether_addr_copy(priv->curr_addr, priv->adapter->perm_addr); in mwifiex_init_priv_params()
1376 int is_command_pending(struct mwifiex_adapter *adapter) in is_command_pending() argument
1380 spin_lock_bh(&adapter->cmd_pending_q_lock); in is_command_pending()
1381 is_cmd_pend_q_empty = list_empty(&adapter->cmd_pending_q); in is_command_pending()
1382 spin_unlock_bh(&adapter->cmd_pending_q_lock); in is_command_pending()
1394 struct mwifiex_adapter *adapter = in mwifiex_rx_work_queue() local
1397 if (test_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags)) in mwifiex_rx_work_queue()
1399 mwifiex_process_rx(adapter); in mwifiex_rx_work_queue()
1410 struct mwifiex_adapter *adapter = in mwifiex_main_work_queue() local
1413 if (test_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags)) in mwifiex_main_work_queue()
1415 mwifiex_main_process(adapter); in mwifiex_main_work_queue()
1419 static void mwifiex_uninit_sw(struct mwifiex_adapter *adapter) in mwifiex_uninit_sw() argument
1427 if (adapter->if_ops.disable_int) in mwifiex_uninit_sw()
1428 adapter->if_ops.disable_int(adapter); in mwifiex_uninit_sw()
1430 set_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags); in mwifiex_uninit_sw()
1431 mwifiex_terminate_workqueue(adapter); in mwifiex_uninit_sw()
1432 adapter->int_status = 0; in mwifiex_uninit_sw()
1435 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_uninit_sw()
1436 priv = adapter->priv[i]; in mwifiex_uninit_sw()
1438 mwifiex_stop_net_dev_queue(priv->netdev, adapter); in mwifiex_uninit_sw()
1445 mwifiex_dbg(adapter, CMD, "cmd: calling mwifiex_shutdown_drv...\n"); in mwifiex_uninit_sw()
1446 mwifiex_shutdown_drv(adapter); in mwifiex_uninit_sw()
1447 mwifiex_dbg(adapter, CMD, "cmd: mwifiex_shutdown_drv done\n"); in mwifiex_uninit_sw()
1449 if (atomic_read(&adapter->rx_pending) || in mwifiex_uninit_sw()
1450 atomic_read(&adapter->tx_pending) || in mwifiex_uninit_sw()
1451 atomic_read(&adapter->cmd_pending)) { in mwifiex_uninit_sw()
1452 mwifiex_dbg(adapter, ERROR, in mwifiex_uninit_sw()
1455 atomic_read(&adapter->rx_pending), in mwifiex_uninit_sw()
1456 atomic_read(&adapter->tx_pending), in mwifiex_uninit_sw()
1457 atomic_read(&adapter->cmd_pending)); in mwifiex_uninit_sw()
1460 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_uninit_sw()
1461 priv = adapter->priv[i]; in mwifiex_uninit_sw()
1473 wiphy_lock(adapter->wiphy); in mwifiex_uninit_sw()
1474 mwifiex_del_virtual_intf(adapter->wiphy, &priv->wdev); in mwifiex_uninit_sw()
1475 wiphy_unlock(adapter->wiphy); in mwifiex_uninit_sw()
1480 wiphy_unregister(adapter->wiphy); in mwifiex_uninit_sw()
1481 wiphy_free(adapter->wiphy); in mwifiex_uninit_sw()
1482 adapter->wiphy = NULL; in mwifiex_uninit_sw()
1484 vfree(adapter->chan_stats); in mwifiex_uninit_sw()
1485 mwifiex_free_cmd_buffers(adapter); in mwifiex_uninit_sw()
1491 int mwifiex_shutdown_sw(struct mwifiex_adapter *adapter) in mwifiex_shutdown_sw() argument
1495 if (!adapter) in mwifiex_shutdown_sw()
1498 wait_for_completion(adapter->fw_done); in mwifiex_shutdown_sw()
1500 reinit_completion(adapter->fw_done); in mwifiex_shutdown_sw()
1502 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_shutdown_sw()
1507 mwifiex_uninit_sw(adapter); in mwifiex_shutdown_sw()
1508 adapter->is_up = false; in mwifiex_shutdown_sw()
1510 if (adapter->if_ops.down_dev) in mwifiex_shutdown_sw()
1511 adapter->if_ops.down_dev(adapter); in mwifiex_shutdown_sw()
1521 mwifiex_reinit_sw(struct mwifiex_adapter *adapter) in mwifiex_reinit_sw() argument
1525 mwifiex_init_lock_list(adapter); in mwifiex_reinit_sw()
1526 if (adapter->if_ops.up_dev) in mwifiex_reinit_sw()
1527 adapter->if_ops.up_dev(adapter); in mwifiex_reinit_sw()
1529 adapter->hw_status = MWIFIEX_HW_STATUS_INITIALIZING; in mwifiex_reinit_sw()
1530 clear_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags); in mwifiex_reinit_sw()
1531 init_waitqueue_head(&adapter->init_wait_q); in mwifiex_reinit_sw()
1532 clear_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags); in mwifiex_reinit_sw()
1533 adapter->hs_activated = false; in mwifiex_reinit_sw()
1534 clear_bit(MWIFIEX_IS_CMD_TIMEDOUT, &adapter->work_flags); in mwifiex_reinit_sw()
1535 init_waitqueue_head(&adapter->hs_activate_wait_q); in mwifiex_reinit_sw()
1536 init_waitqueue_head(&adapter->cmd_wait_q.wait); in mwifiex_reinit_sw()
1537 adapter->cmd_wait_q.status = 0; in mwifiex_reinit_sw()
1538 adapter->scan_wait_q_woken = false; in mwifiex_reinit_sw()
1540 if ((num_possible_cpus() > 1) || adapter->iface_type == MWIFIEX_USB) in mwifiex_reinit_sw()
1541 adapter->rx_work_enabled = true; in mwifiex_reinit_sw()
1543 adapter->workqueue = in mwifiex_reinit_sw()
1546 if (!adapter->workqueue) in mwifiex_reinit_sw()
1549 INIT_WORK(&adapter->main_work, mwifiex_main_work_queue); in mwifiex_reinit_sw()
1551 if (adapter->rx_work_enabled) { in mwifiex_reinit_sw()
1552 adapter->rx_workqueue = alloc_workqueue("MWIFIEX_RX_WORK_QUEUE", in mwifiex_reinit_sw()
1556 if (!adapter->rx_workqueue) in mwifiex_reinit_sw()
1558 INIT_WORK(&adapter->rx_work, mwifiex_rx_work_queue); in mwifiex_reinit_sw()
1565 mwifiex_dbg(adapter, INFO, "%s, mwifiex_init_hw_fw()...\n", __func__); in mwifiex_reinit_sw()
1567 if (mwifiex_init_hw_fw(adapter, false)) { in mwifiex_reinit_sw()
1568 mwifiex_dbg(adapter, ERROR, in mwifiex_reinit_sw()
1574 ret = _mwifiex_fw_dpc(adapter->firmware, adapter); in mwifiex_reinit_sw()
1579 mwifiex_dbg(adapter, INFO, "%s, successful\n", __func__); in mwifiex_reinit_sw()
1584 mwifiex_dbg(adapter, ERROR, "info: %s: unregister device\n", __func__); in mwifiex_reinit_sw()
1585 if (adapter->if_ops.unregister_dev) in mwifiex_reinit_sw()
1586 adapter->if_ops.unregister_dev(adapter); in mwifiex_reinit_sw()
1589 set_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags); in mwifiex_reinit_sw()
1590 mwifiex_terminate_workqueue(adapter); in mwifiex_reinit_sw()
1591 if (adapter->hw_status == MWIFIEX_HW_STATUS_READY) { in mwifiex_reinit_sw()
1592 mwifiex_dbg(adapter, ERROR, in mwifiex_reinit_sw()
1594 mwifiex_shutdown_drv(adapter); in mwifiex_reinit_sw()
1595 mwifiex_free_cmd_buffers(adapter); in mwifiex_reinit_sw()
1598 complete_all(adapter->fw_done); in mwifiex_reinit_sw()
1599 mwifiex_dbg(adapter, INFO, "%s, error\n", __func__); in mwifiex_reinit_sw()
1607 struct mwifiex_adapter *adapter = priv; in mwifiex_irq_wakeup_handler() local
1609 dev_dbg(adapter->dev, "%s: wake by wifi", __func__); in mwifiex_irq_wakeup_handler()
1610 adapter->wake_by_wifi = true; in mwifiex_irq_wakeup_handler()
1614 pm_wakeup_event(adapter->dev, 0); in mwifiex_irq_wakeup_handler()
1620 static void mwifiex_probe_of(struct mwifiex_adapter *adapter) in mwifiex_probe_of() argument
1623 struct device *dev = adapter->dev; in mwifiex_probe_of()
1628 adapter->dt_node = dev->of_node; in mwifiex_probe_of()
1629 adapter->irq_wakeup = irq_of_parse_and_map(adapter->dt_node, 0); in mwifiex_probe_of()
1630 if (!adapter->irq_wakeup) { in mwifiex_probe_of()
1635 ret = devm_request_irq(dev, adapter->irq_wakeup, in mwifiex_probe_of()
1637 "wifi_wake", adapter); in mwifiex_probe_of()
1640 adapter->irq_wakeup, ret); in mwifiex_probe_of()
1644 disable_irq(adapter->irq_wakeup); in mwifiex_probe_of()
1652 adapter->irq_wakeup = -1; in mwifiex_probe_of()
1673 struct mwifiex_adapter *adapter; in mwifiex_add_card() local
1675 if (mwifiex_register(card, dev, if_ops, (void **)&adapter)) { in mwifiex_add_card()
1680 mwifiex_probe_of(adapter); in mwifiex_add_card()
1682 adapter->iface_type = iface_type; in mwifiex_add_card()
1683 adapter->fw_done = fw_done; in mwifiex_add_card()
1685 adapter->hw_status = MWIFIEX_HW_STATUS_INITIALIZING; in mwifiex_add_card()
1686 clear_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags); in mwifiex_add_card()
1687 init_waitqueue_head(&adapter->init_wait_q); in mwifiex_add_card()
1688 clear_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags); in mwifiex_add_card()
1689 adapter->hs_activated = false; in mwifiex_add_card()
1690 init_waitqueue_head(&adapter->hs_activate_wait_q); in mwifiex_add_card()
1691 init_waitqueue_head(&adapter->cmd_wait_q.wait); in mwifiex_add_card()
1692 adapter->cmd_wait_q.status = 0; in mwifiex_add_card()
1693 adapter->scan_wait_q_woken = false; in mwifiex_add_card()
1695 if ((num_possible_cpus() > 1) || adapter->iface_type == MWIFIEX_USB) in mwifiex_add_card()
1696 adapter->rx_work_enabled = true; in mwifiex_add_card()
1698 adapter->workqueue = in mwifiex_add_card()
1701 if (!adapter->workqueue) in mwifiex_add_card()
1704 INIT_WORK(&adapter->main_work, mwifiex_main_work_queue); in mwifiex_add_card()
1706 if (adapter->rx_work_enabled) { in mwifiex_add_card()
1707 adapter->rx_workqueue = alloc_workqueue("MWIFIEX_RX_WORK_QUEUE", in mwifiex_add_card()
1711 if (!adapter->rx_workqueue) in mwifiex_add_card()
1714 INIT_WORK(&adapter->rx_work, mwifiex_rx_work_queue); in mwifiex_add_card()
1719 if (adapter->if_ops.register_dev(adapter)) { in mwifiex_add_card()
1724 if (mwifiex_init_hw_fw(adapter, true)) { in mwifiex_add_card()
1733 if (adapter->if_ops.unregister_dev) in mwifiex_add_card()
1734 adapter->if_ops.unregister_dev(adapter); in mwifiex_add_card()
1736 set_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags); in mwifiex_add_card()
1737 mwifiex_terminate_workqueue(adapter); in mwifiex_add_card()
1738 if (adapter->hw_status == MWIFIEX_HW_STATUS_READY) { in mwifiex_add_card()
1740 mwifiex_shutdown_drv(adapter); in mwifiex_add_card()
1741 mwifiex_free_cmd_buffers(adapter); in mwifiex_add_card()
1744 if (adapter->irq_wakeup >= 0) in mwifiex_add_card()
1745 device_init_wakeup(adapter->dev, false); in mwifiex_add_card()
1746 mwifiex_free_adapter(adapter); in mwifiex_add_card()
1765 int mwifiex_remove_card(struct mwifiex_adapter *adapter) in mwifiex_remove_card() argument
1767 if (!adapter) in mwifiex_remove_card()
1770 if (adapter->is_up) in mwifiex_remove_card()
1771 mwifiex_uninit_sw(adapter); in mwifiex_remove_card()
1773 if (adapter->irq_wakeup >= 0) in mwifiex_remove_card()
1774 device_init_wakeup(adapter->dev, false); in mwifiex_remove_card()
1777 mwifiex_dbg(adapter, INFO, in mwifiex_remove_card()
1779 if (adapter->if_ops.unregister_dev) in mwifiex_remove_card()
1780 adapter->if_ops.unregister_dev(adapter); in mwifiex_remove_card()
1782 mwifiex_dbg(adapter, INFO, in mwifiex_remove_card()
1784 mwifiex_free_adapter(adapter); in mwifiex_remove_card()
1790 void _mwifiex_dbg(const struct mwifiex_adapter *adapter, int mask, in _mwifiex_dbg() argument
1796 if (!(adapter->debug_mask & mask)) in _mwifiex_dbg()
1804 if (adapter->dev) in _mwifiex_dbg()
1805 dev_info(adapter->dev, "%pV", &vaf); in _mwifiex_dbg()