Lines Matching refs:adapter

58 	struct mwifiex_adapter *adapter;  in mwifiex_register()  local
61 adapter = kzalloc(sizeof(struct mwifiex_adapter), GFP_KERNEL); in mwifiex_register()
62 if (!adapter) in mwifiex_register()
65 *padapter = adapter; in mwifiex_register()
66 adapter->card = card; in mwifiex_register()
69 memmove(&adapter->if_ops, if_ops, sizeof(struct mwifiex_if_ops)); in mwifiex_register()
70 adapter->debug_mask = debug_mask; in mwifiex_register()
73 if (adapter->if_ops.init_if) in mwifiex_register()
74 if (adapter->if_ops.init_if(adapter)) in mwifiex_register()
77 adapter->priv_num = 0; in mwifiex_register()
81 adapter->priv[i] = in mwifiex_register()
83 if (!adapter->priv[i]) in mwifiex_register()
86 adapter->priv[i]->adapter = adapter; in mwifiex_register()
87 adapter->priv_num++; in mwifiex_register()
89 mwifiex_init_lock_list(adapter); in mwifiex_register()
91 setup_timer(&adapter->cmd_timer, mwifiex_cmd_timeout_func, in mwifiex_register()
92 (unsigned long)adapter); in mwifiex_register()
97 mwifiex_dbg(adapter, ERROR, in mwifiex_register()
100 for (i = 0; i < adapter->priv_num; i++) in mwifiex_register()
101 kfree(adapter->priv[i]); in mwifiex_register()
103 kfree(adapter); in mwifiex_register()
118 static int mwifiex_unregister(struct mwifiex_adapter *adapter) in mwifiex_unregister() argument
122 if (adapter->if_ops.cleanup_if) in mwifiex_unregister()
123 adapter->if_ops.cleanup_if(adapter); in mwifiex_unregister()
125 del_timer_sync(&adapter->cmd_timer); in mwifiex_unregister()
128 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_unregister()
129 if (adapter->priv[i]) { in mwifiex_unregister()
130 mwifiex_free_curr_bcn(adapter->priv[i]); in mwifiex_unregister()
131 kfree(adapter->priv[i]); in mwifiex_unregister()
135 vfree(adapter->chan_stats); in mwifiex_unregister()
136 kfree(adapter); in mwifiex_unregister()
140 void mwifiex_queue_main_work(struct mwifiex_adapter *adapter) in mwifiex_queue_main_work() argument
144 spin_lock_irqsave(&adapter->main_proc_lock, flags); in mwifiex_queue_main_work()
145 if (adapter->mwifiex_processing) { in mwifiex_queue_main_work()
146 adapter->more_task_flag = true; in mwifiex_queue_main_work()
147 spin_unlock_irqrestore(&adapter->main_proc_lock, flags); in mwifiex_queue_main_work()
149 spin_unlock_irqrestore(&adapter->main_proc_lock, flags); in mwifiex_queue_main_work()
150 queue_work(adapter->workqueue, &adapter->main_work); in mwifiex_queue_main_work()
155 static void mwifiex_queue_rx_work(struct mwifiex_adapter *adapter) in mwifiex_queue_rx_work() argument
159 spin_lock_irqsave(&adapter->rx_proc_lock, flags); in mwifiex_queue_rx_work()
160 if (adapter->rx_processing) { in mwifiex_queue_rx_work()
161 spin_unlock_irqrestore(&adapter->rx_proc_lock, flags); in mwifiex_queue_rx_work()
163 spin_unlock_irqrestore(&adapter->rx_proc_lock, flags); in mwifiex_queue_rx_work()
164 queue_work(adapter->rx_workqueue, &adapter->rx_work); in mwifiex_queue_rx_work()
168 static int mwifiex_process_rx(struct mwifiex_adapter *adapter) in mwifiex_process_rx() argument
174 spin_lock_irqsave(&adapter->rx_proc_lock, flags); in mwifiex_process_rx()
175 if (adapter->rx_processing || adapter->rx_locked) { in mwifiex_process_rx()
176 spin_unlock_irqrestore(&adapter->rx_proc_lock, flags); in mwifiex_process_rx()
179 adapter->rx_processing = true; in mwifiex_process_rx()
180 spin_unlock_irqrestore(&adapter->rx_proc_lock, flags); in mwifiex_process_rx()
184 while ((skb = skb_dequeue(&adapter->rx_data_q))) { in mwifiex_process_rx()
185 atomic_dec(&adapter->rx_pending); in mwifiex_process_rx()
186 if ((adapter->delay_main_work || in mwifiex_process_rx()
187 adapter->iface_type == MWIFIEX_USB) && in mwifiex_process_rx()
188 (atomic_read(&adapter->rx_pending) < LOW_RX_PENDING)) { in mwifiex_process_rx()
189 if (adapter->if_ops.submit_rem_rx_urbs) in mwifiex_process_rx()
190 adapter->if_ops.submit_rem_rx_urbs(adapter); in mwifiex_process_rx()
191 adapter->delay_main_work = false; in mwifiex_process_rx()
192 mwifiex_queue_main_work(adapter); in mwifiex_process_rx()
196 if (adapter->if_ops.deaggr_pkt) in mwifiex_process_rx()
197 adapter->if_ops.deaggr_pkt(adapter, skb); in mwifiex_process_rx()
200 mwifiex_handle_rx_packet(adapter, skb); in mwifiex_process_rx()
203 spin_lock_irqsave(&adapter->rx_proc_lock, flags); in mwifiex_process_rx()
204 adapter->rx_processing = false; in mwifiex_process_rx()
205 spin_unlock_irqrestore(&adapter->rx_proc_lock, flags); in mwifiex_process_rx()
226 int mwifiex_main_process(struct mwifiex_adapter *adapter) in mwifiex_main_process() argument
231 spin_lock_irqsave(&adapter->main_proc_lock, flags); in mwifiex_main_process()
234 if (adapter->mwifiex_processing || adapter->main_locked) { in mwifiex_main_process()
235 adapter->more_task_flag = true; in mwifiex_main_process()
236 spin_unlock_irqrestore(&adapter->main_proc_lock, flags); in mwifiex_main_process()
239 adapter->mwifiex_processing = true; in mwifiex_main_process()
240 spin_unlock_irqrestore(&adapter->main_proc_lock, flags); in mwifiex_main_process()
244 if ((adapter->hw_status == MWIFIEX_HW_STATUS_CLOSING) || in mwifiex_main_process()
245 (adapter->hw_status == MWIFIEX_HW_STATUS_NOT_READY)) in mwifiex_main_process()
255 if (atomic_read(&adapter->rx_pending) >= HIGH_RX_PENDING && in mwifiex_main_process()
256 adapter->iface_type != MWIFIEX_USB) { in mwifiex_main_process()
257 adapter->delay_main_work = true; in mwifiex_main_process()
258 mwifiex_queue_rx_work(adapter); in mwifiex_main_process()
263 if (adapter->int_status) { in mwifiex_main_process()
264 if (adapter->hs_activated) in mwifiex_main_process()
265 mwifiex_process_hs_config(adapter); in mwifiex_main_process()
266 if (adapter->if_ops.process_int_status) in mwifiex_main_process()
267 adapter->if_ops.process_int_status(adapter); in mwifiex_main_process()
270 if (adapter->rx_work_enabled && adapter->data_received) in mwifiex_main_process()
271 mwifiex_queue_rx_work(adapter); in mwifiex_main_process()
274 if ((adapter->ps_state == PS_STATE_SLEEP) && in mwifiex_main_process()
275 (adapter->pm_wakeup_card_req && in mwifiex_main_process()
276 !adapter->pm_wakeup_fw_try) && in mwifiex_main_process()
277 (is_command_pending(adapter) || in mwifiex_main_process()
278 !skb_queue_empty(&adapter->tx_data_q) || in mwifiex_main_process()
279 !mwifiex_bypass_txlist_empty(adapter) || in mwifiex_main_process()
280 !mwifiex_wmm_lists_empty(adapter))) { in mwifiex_main_process()
281 adapter->pm_wakeup_fw_try = true; in mwifiex_main_process()
282 mod_timer(&adapter->wakeup_timer, jiffies + (HZ*3)); in mwifiex_main_process()
283 adapter->if_ops.wakeup(adapter); in mwifiex_main_process()
287 if (IS_CARD_RX_RCVD(adapter)) { in mwifiex_main_process()
288 adapter->data_received = false; in mwifiex_main_process()
289 adapter->pm_wakeup_fw_try = false; in mwifiex_main_process()
290 del_timer(&adapter->wakeup_timer); in mwifiex_main_process()
291 if (adapter->ps_state == PS_STATE_SLEEP) in mwifiex_main_process()
292 adapter->ps_state = PS_STATE_AWAKE; in mwifiex_main_process()
295 if (adapter->pm_wakeup_fw_try) in mwifiex_main_process()
297 if (adapter->ps_state != PS_STATE_AWAKE) in mwifiex_main_process()
299 if (adapter->tx_lock_flag) { in mwifiex_main_process()
300 if (adapter->iface_type == MWIFIEX_USB) { in mwifiex_main_process()
301 if (!adapter->usb_mc_setup) in mwifiex_main_process()
307 if ((!adapter->scan_chan_gap_enabled && in mwifiex_main_process()
308 adapter->scan_processing) || adapter->data_sent || in mwifiex_main_process()
310 (mwifiex_get_priv(adapter, in mwifiex_main_process()
312 (mwifiex_wmm_lists_empty(adapter) && in mwifiex_main_process()
313 mwifiex_bypass_txlist_empty(adapter) && in mwifiex_main_process()
314 skb_queue_empty(&adapter->tx_data_q))) { in mwifiex_main_process()
315 if (adapter->cmd_sent || adapter->curr_cmd || in mwifiex_main_process()
317 (mwifiex_get_priv(adapter, in mwifiex_main_process()
319 (!is_command_pending(adapter))) in mwifiex_main_process()
325 if (adapter->event_received) { in mwifiex_main_process()
326 adapter->event_received = false; in mwifiex_main_process()
327 mwifiex_process_event(adapter); in mwifiex_main_process()
331 if (adapter->cmd_resp_received) { in mwifiex_main_process()
332 adapter->cmd_resp_received = false; in mwifiex_main_process()
333 mwifiex_process_cmdresp(adapter); in mwifiex_main_process()
336 if (adapter->hw_status == MWIFIEX_HW_STATUS_INIT_DONE) { in mwifiex_main_process()
337 adapter->hw_status = MWIFIEX_HW_STATUS_READY; in mwifiex_main_process()
338 mwifiex_init_fw_complete(adapter); in mwifiex_main_process()
344 if (adapter->ps_state == PS_STATE_PRE_SLEEP) { in mwifiex_main_process()
345 if (!adapter->cmd_sent && !adapter->curr_cmd) in mwifiex_main_process()
346 mwifiex_check_ps_cond(adapter); in mwifiex_main_process()
352 if ((adapter->ps_state == PS_STATE_SLEEP) || in mwifiex_main_process()
353 (adapter->ps_state == PS_STATE_PRE_SLEEP) || in mwifiex_main_process()
354 (adapter->ps_state == PS_STATE_SLEEP_CFM)) { in mwifiex_main_process()
358 if (adapter->tx_lock_flag) { in mwifiex_main_process()
359 if (adapter->iface_type == MWIFIEX_USB) { in mwifiex_main_process()
360 if (!adapter->usb_mc_setup) in mwifiex_main_process()
366 if (!adapter->cmd_sent && !adapter->curr_cmd && in mwifiex_main_process()
368 (mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA))) { in mwifiex_main_process()
369 if (mwifiex_exec_next_cmd(adapter) == -1) { in mwifiex_main_process()
378 if (adapter->iface_type == MWIFIEX_USB && in mwifiex_main_process()
379 adapter->usb_mc_setup) in mwifiex_main_process()
382 if ((adapter->scan_chan_gap_enabled || in mwifiex_main_process()
383 !adapter->scan_processing) && in mwifiex_main_process()
384 !adapter->data_sent && in mwifiex_main_process()
385 !skb_queue_empty(&adapter->tx_data_q)) { in mwifiex_main_process()
386 mwifiex_process_tx_queue(adapter); in mwifiex_main_process()
387 if (adapter->hs_activated) { in mwifiex_main_process()
388 adapter->is_hs_configured = false; in mwifiex_main_process()
391 (adapter, MWIFIEX_BSS_ROLE_ANY), in mwifiex_main_process()
396 if ((adapter->scan_chan_gap_enabled || in mwifiex_main_process()
397 !adapter->scan_processing) && in mwifiex_main_process()
398 !adapter->data_sent && in mwifiex_main_process()
399 !mwifiex_bypass_txlist_empty(adapter) && in mwifiex_main_process()
401 (mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA))) { in mwifiex_main_process()
402 mwifiex_process_bypass_tx(adapter); in mwifiex_main_process()
403 if (adapter->hs_activated) { in mwifiex_main_process()
404 adapter->is_hs_configured = false; in mwifiex_main_process()
407 (adapter, MWIFIEX_BSS_ROLE_ANY), in mwifiex_main_process()
412 if ((adapter->scan_chan_gap_enabled || in mwifiex_main_process()
413 !adapter->scan_processing) && in mwifiex_main_process()
414 !adapter->data_sent && !mwifiex_wmm_lists_empty(adapter) && in mwifiex_main_process()
416 (mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA))) { in mwifiex_main_process()
417 mwifiex_wmm_process_tx(adapter); in mwifiex_main_process()
418 if (adapter->hs_activated) { in mwifiex_main_process()
419 adapter->is_hs_configured = false; in mwifiex_main_process()
422 (adapter, MWIFIEX_BSS_ROLE_ANY), in mwifiex_main_process()
427 if (adapter->delay_null_pkt && !adapter->cmd_sent && in mwifiex_main_process()
428 !adapter->curr_cmd && !is_command_pending(adapter) && in mwifiex_main_process()
429 (mwifiex_wmm_lists_empty(adapter) && in mwifiex_main_process()
430 mwifiex_bypass_txlist_empty(adapter) && in mwifiex_main_process()
431 skb_queue_empty(&adapter->tx_data_q))) { in mwifiex_main_process()
433 (mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA), in mwifiex_main_process()
436 adapter->delay_null_pkt = false; in mwifiex_main_process()
437 adapter->ps_state = PS_STATE_SLEEP; in mwifiex_main_process()
443 spin_lock_irqsave(&adapter->main_proc_lock, flags); in mwifiex_main_process()
444 if (adapter->more_task_flag) { in mwifiex_main_process()
445 adapter->more_task_flag = false; in mwifiex_main_process()
446 spin_unlock_irqrestore(&adapter->main_proc_lock, flags); in mwifiex_main_process()
449 adapter->mwifiex_processing = false; in mwifiex_main_process()
450 spin_unlock_irqrestore(&adapter->main_proc_lock, flags); in mwifiex_main_process()
453 if (adapter->hw_status == MWIFIEX_HW_STATUS_CLOSING) in mwifiex_main_process()
454 mwifiex_shutdown_drv(adapter); in mwifiex_main_process()
465 static void mwifiex_free_adapter(struct mwifiex_adapter *adapter) in mwifiex_free_adapter() argument
467 if (!adapter) { in mwifiex_free_adapter()
472 mwifiex_unregister(adapter); in mwifiex_free_adapter()
480 static void mwifiex_terminate_workqueue(struct mwifiex_adapter *adapter) in mwifiex_terminate_workqueue() argument
482 flush_workqueue(adapter->workqueue); in mwifiex_terminate_workqueue()
483 destroy_workqueue(adapter->workqueue); in mwifiex_terminate_workqueue()
484 adapter->workqueue = NULL; in mwifiex_terminate_workqueue()
486 if (adapter->rx_workqueue) { in mwifiex_terminate_workqueue()
487 flush_workqueue(adapter->rx_workqueue); in mwifiex_terminate_workqueue()
488 destroy_workqueue(adapter->rx_workqueue); in mwifiex_terminate_workqueue()
489 adapter->rx_workqueue = NULL; in mwifiex_terminate_workqueue()
505 struct mwifiex_adapter *adapter = context; in mwifiex_fw_dpc() local
507 struct semaphore *sem = adapter->card_sem; in mwifiex_fw_dpc()
512 mwifiex_dbg(adapter, ERROR, in mwifiex_fw_dpc()
513 "Failed to get firmware %s\n", adapter->fw_name); in mwifiex_fw_dpc()
518 adapter->firmware = firmware; in mwifiex_fw_dpc()
519 fw.fw_buf = (u8 *) adapter->firmware->data; in mwifiex_fw_dpc()
520 fw.fw_len = adapter->firmware->size; in mwifiex_fw_dpc()
522 if (adapter->if_ops.dnld_fw) in mwifiex_fw_dpc()
523 ret = adapter->if_ops.dnld_fw(adapter, &fw); in mwifiex_fw_dpc()
525 ret = mwifiex_dnld_fw(adapter, &fw); in mwifiex_fw_dpc()
529 mwifiex_dbg(adapter, MSG, "WLAN FW is active\n"); in mwifiex_fw_dpc()
532 if ((request_firmware(&adapter->cal_data, cal_data_cfg, in mwifiex_fw_dpc()
533 adapter->dev)) < 0) in mwifiex_fw_dpc()
534 mwifiex_dbg(adapter, ERROR, in mwifiex_fw_dpc()
539 if (adapter->if_ops.enable_int) { in mwifiex_fw_dpc()
540 if (adapter->if_ops.enable_int(adapter)) in mwifiex_fw_dpc()
544 adapter->init_wait_q_woken = false; in mwifiex_fw_dpc()
545 ret = mwifiex_init_fw(adapter); in mwifiex_fw_dpc()
549 adapter->hw_status = MWIFIEX_HW_STATUS_READY; in mwifiex_fw_dpc()
553 wait_event_interruptible(adapter->init_wait_q, in mwifiex_fw_dpc()
554 adapter->init_wait_q_woken); in mwifiex_fw_dpc()
555 if (adapter->hw_status != MWIFIEX_HW_STATUS_READY) in mwifiex_fw_dpc()
558 priv = adapter->priv[MWIFIEX_BSS_ROLE_STA]; in mwifiex_fw_dpc()
559 if (mwifiex_register_cfg80211(adapter)) { in mwifiex_fw_dpc()
560 mwifiex_dbg(adapter, ERROR, in mwifiex_fw_dpc()
565 if (mwifiex_init_channel_scan_gap(adapter)) { in mwifiex_fw_dpc()
566 mwifiex_dbg(adapter, ERROR, in mwifiex_fw_dpc()
578 wdev = mwifiex_add_virtual_intf(adapter->wiphy, "mlan%d", NET_NAME_ENUM, in mwifiex_fw_dpc()
581 mwifiex_dbg(adapter, ERROR, in mwifiex_fw_dpc()
588 wdev = mwifiex_add_virtual_intf(adapter->wiphy, "uap%d", NET_NAME_ENUM, in mwifiex_fw_dpc()
591 mwifiex_dbg(adapter, ERROR, in mwifiex_fw_dpc()
599 wdev = mwifiex_add_virtual_intf(adapter->wiphy, "p2p%d", NET_NAME_ENUM, in mwifiex_fw_dpc()
603 mwifiex_dbg(adapter, ERROR, in mwifiex_fw_dpc()
611 mwifiex_drv_get_driver_version(adapter, fmt, sizeof(fmt) - 1); in mwifiex_fw_dpc()
612 mwifiex_dbg(adapter, MSG, "driver_version = %s\n", fmt); in mwifiex_fw_dpc()
616 wiphy_unregister(adapter->wiphy); in mwifiex_fw_dpc()
617 wiphy_free(adapter->wiphy); in mwifiex_fw_dpc()
619 if (adapter->if_ops.disable_int) in mwifiex_fw_dpc()
620 adapter->if_ops.disable_int(adapter); in mwifiex_fw_dpc()
622 mwifiex_dbg(adapter, ERROR, in mwifiex_fw_dpc()
624 if (adapter->if_ops.unregister_dev) in mwifiex_fw_dpc()
625 adapter->if_ops.unregister_dev(adapter); in mwifiex_fw_dpc()
627 if (adapter->hw_status == MWIFIEX_HW_STATUS_READY) { in mwifiex_fw_dpc()
629 adapter->init_wait_q_woken = false; in mwifiex_fw_dpc()
631 if (mwifiex_shutdown_drv(adapter) == -EINPROGRESS) in mwifiex_fw_dpc()
632 wait_event_interruptible(adapter->init_wait_q, in mwifiex_fw_dpc()
633 adapter->init_wait_q_woken); in mwifiex_fw_dpc()
635 adapter->surprise_removed = true; in mwifiex_fw_dpc()
636 mwifiex_terminate_workqueue(adapter); in mwifiex_fw_dpc()
639 if (adapter->cal_data) { in mwifiex_fw_dpc()
640 release_firmware(adapter->cal_data); in mwifiex_fw_dpc()
641 adapter->cal_data = NULL; in mwifiex_fw_dpc()
643 if (adapter->firmware) { in mwifiex_fw_dpc()
644 release_firmware(adapter->firmware); in mwifiex_fw_dpc()
645 adapter->firmware = NULL; in mwifiex_fw_dpc()
648 mwifiex_free_adapter(adapter); in mwifiex_fw_dpc()
656 static int mwifiex_init_hw_fw(struct mwifiex_adapter *adapter) in mwifiex_init_hw_fw() argument
660 ret = request_firmware_nowait(THIS_MODULE, 1, adapter->fw_name, in mwifiex_init_hw_fw()
661 adapter->dev, GFP_KERNEL, adapter, in mwifiex_init_hw_fw()
664 mwifiex_dbg(adapter, ERROR, in mwifiex_init_hw_fw()
691 mwifiex_dbg(priv->adapter, INFO, in mwifiex_close()
710 ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info) && in mwifiex_bypass_tx_queue()
712 mwifiex_dbg(priv->adapter, DATA, in mwifiex_bypass_tx_queue()
733 mwifiex_dbg(priv->adapter, DATA, in mwifiex_queue_tx_pkt()
739 atomic_inc(&priv->adapter->tx_pending); in mwifiex_queue_tx_pkt()
740 atomic_inc(&priv->adapter->bypass_tx_pending); in mwifiex_queue_tx_pkt()
743 atomic_inc(&priv->adapter->tx_pending); in mwifiex_queue_tx_pkt()
747 mwifiex_queue_main_work(priv->adapter); in mwifiex_queue_tx_pkt()
805 mwifiex_dbg(priv->adapter, DATA, in mwifiex_hard_start_xmit()
809 if (priv->adapter->surprise_removed) { in mwifiex_hard_start_xmit()
815 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_hard_start_xmit()
822 mwifiex_dbg(priv->adapter, DATA, in mwifiex_hard_start_xmit()
829 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_hard_start_xmit()
837 mwifiex_dbg(priv->adapter, INFO, in mwifiex_hard_start_xmit()
852 priv->adapter->fw_api_ver == MWIFIEX_FW_V15)) in mwifiex_hard_start_xmit()
866 if (ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info) && in mwifiex_hard_start_xmit()
869 if (priv->adapter->auto_tdls && priv->check_tdls_tx) in mwifiex_hard_start_xmit()
897 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_set_mac_address()
936 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_tx_timeout()
943 priv->adapter->if_ops.card_reset) { in mwifiex_tx_timeout()
944 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_tx_timeout()
947 priv->adapter->if_ops.card_reset(priv->adapter); in mwifiex_tx_timeout()
951 void mwifiex_multi_chan_resync(struct mwifiex_adapter *adapter) in mwifiex_multi_chan_resync() argument
953 struct usb_card_rec *card = adapter->card; in mwifiex_multi_chan_resync()
961 mwifiex_dbg(adapter, WARN, "pending data urb in sys\n"); in mwifiex_multi_chan_resync()
968 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); in mwifiex_multi_chan_resync()
972 mwifiex_dbg(adapter, ERROR, in mwifiex_multi_chan_resync()
977 void mwifiex_drv_info_dump(struct mwifiex_adapter *adapter) in mwifiex_drv_info_dump() argument
988 if (adapter->drv_info_dump) { in mwifiex_drv_info_dump()
989 vfree(adapter->drv_info_dump); in mwifiex_drv_info_dump()
990 adapter->drv_info_dump = NULL; in mwifiex_drv_info_dump()
991 adapter->drv_info_size = 0; in mwifiex_drv_info_dump()
994 mwifiex_dbg(adapter, MSG, "===mwifiex driverinfo dump start===\n"); in mwifiex_drv_info_dump()
996 adapter->drv_info_dump = vzalloc(MWIFIEX_DRV_INFO_SIZE_MAX); in mwifiex_drv_info_dump()
998 if (!adapter->drv_info_dump) in mwifiex_drv_info_dump()
1001 p = (char *)(adapter->drv_info_dump); in mwifiex_drv_info_dump()
1004 mwifiex_drv_get_driver_version(adapter, drv_version, in mwifiex_drv_info_dump()
1008 if (adapter->iface_type == MWIFIEX_USB) { in mwifiex_drv_info_dump()
1009 cardp = (struct usb_card_rec *)adapter->card; in mwifiex_drv_info_dump()
1023 atomic_read(&adapter->tx_pending)); in mwifiex_drv_info_dump()
1025 atomic_read(&adapter->rx_pending)); in mwifiex_drv_info_dump()
1027 if (adapter->iface_type == MWIFIEX_SDIO) { in mwifiex_drv_info_dump()
1028 sdio_card = (struct sdio_mmc_card *)adapter->card; in mwifiex_drv_info_dump()
1035 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_drv_info_dump()
1036 if (!adapter->priv[i] || !adapter->priv[i]->netdev) in mwifiex_drv_info_dump()
1038 priv = adapter->priv[i]; in mwifiex_drv_info_dump()
1063 if (adapter->iface_type == MWIFIEX_SDIO) { in mwifiex_drv_info_dump()
1065 if (adapter->if_ops.reg_dump) in mwifiex_drv_info_dump()
1066 p += adapter->if_ops.reg_dump(adapter, p); in mwifiex_drv_info_dump()
1072 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_drv_info_dump()
1073 if (!adapter->priv[i] || !adapter->priv[i]->netdev) in mwifiex_drv_info_dump()
1075 priv = adapter->priv[i]; in mwifiex_drv_info_dump()
1083 adapter->drv_info_size = p - adapter->drv_info_dump; in mwifiex_drv_info_dump()
1084 mwifiex_dbg(adapter, MSG, "===mwifiex driverinfo dump end===\n"); in mwifiex_drv_info_dump()
1088 void mwifiex_upload_device_dump(struct mwifiex_adapter *adapter) in mwifiex_upload_device_dump() argument
1094 adapter->drv_info_size + in mwifiex_upload_device_dump()
1097 for (idx = 0; idx < adapter->num_mem_types; idx++) { in mwifiex_upload_device_dump()
1099 &adapter->mem_type_mapping_tbl[idx]; in mwifiex_upload_device_dump()
1119 mwifiex_dbg(adapter, MSG, in mwifiex_upload_device_dump()
1124 memcpy(fw_dump_ptr, adapter->drv_info_dump, adapter->drv_info_size); in mwifiex_upload_device_dump()
1125 fw_dump_ptr += adapter->drv_info_size; in mwifiex_upload_device_dump()
1129 for (idx = 0; idx < adapter->num_mem_types; idx++) { in mwifiex_upload_device_dump()
1131 &adapter->mem_type_mapping_tbl[idx]; in mwifiex_upload_device_dump()
1154 dev_coredumpv(adapter->dev, dump_data, dump_len, GFP_KERNEL); in mwifiex_upload_device_dump()
1155 mwifiex_dbg(adapter, MSG, in mwifiex_upload_device_dump()
1159 for (idx = 0; idx < adapter->num_mem_types; idx++) { in mwifiex_upload_device_dump()
1161 &adapter->mem_type_mapping_tbl[idx]; in mwifiex_upload_device_dump()
1170 if (adapter->drv_info_dump) { in mwifiex_upload_device_dump()
1171 vfree(adapter->drv_info_dump); in mwifiex_upload_device_dump()
1172 adapter->drv_info_dump = NULL; in mwifiex_upload_device_dump()
1173 adapter->drv_info_size = 0; in mwifiex_upload_device_dump()
1244 ether_addr_copy(priv->curr_addr, priv->adapter->perm_addr); in mwifiex_init_priv_params()
1258 int is_command_pending(struct mwifiex_adapter *adapter) in is_command_pending() argument
1263 spin_lock_irqsave(&adapter->cmd_pending_q_lock, flags); in is_command_pending()
1264 is_cmd_pend_q_empty = list_empty(&adapter->cmd_pending_q); in is_command_pending()
1265 spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, flags); in is_command_pending()
1277 struct mwifiex_adapter *adapter = in mwifiex_rx_work_queue() local
1280 if (adapter->surprise_removed) in mwifiex_rx_work_queue()
1282 mwifiex_process_rx(adapter); in mwifiex_rx_work_queue()
1293 struct mwifiex_adapter *adapter = in mwifiex_main_work_queue() local
1296 if (adapter->surprise_removed) in mwifiex_main_work_queue()
1298 mwifiex_main_process(adapter); in mwifiex_main_work_queue()
1318 struct mwifiex_adapter *adapter; in mwifiex_add_card() local
1323 if (mwifiex_register(card, if_ops, (void **)&adapter)) { in mwifiex_add_card()
1328 adapter->iface_type = iface_type; in mwifiex_add_card()
1329 adapter->card_sem = sem; in mwifiex_add_card()
1331 adapter->hw_status = MWIFIEX_HW_STATUS_INITIALIZING; in mwifiex_add_card()
1332 adapter->surprise_removed = false; in mwifiex_add_card()
1333 init_waitqueue_head(&adapter->init_wait_q); in mwifiex_add_card()
1334 adapter->is_suspended = false; in mwifiex_add_card()
1335 adapter->hs_activated = false; in mwifiex_add_card()
1336 init_waitqueue_head(&adapter->hs_activate_wait_q); in mwifiex_add_card()
1337 init_waitqueue_head(&adapter->cmd_wait_q.wait); in mwifiex_add_card()
1338 adapter->cmd_wait_q.status = 0; in mwifiex_add_card()
1339 adapter->scan_wait_q_woken = false; in mwifiex_add_card()
1341 if ((num_possible_cpus() > 1) || adapter->iface_type == MWIFIEX_USB) { in mwifiex_add_card()
1342 adapter->rx_work_enabled = true; in mwifiex_add_card()
1346 adapter->workqueue = in mwifiex_add_card()
1349 if (!adapter->workqueue) in mwifiex_add_card()
1352 INIT_WORK(&adapter->main_work, mwifiex_main_work_queue); in mwifiex_add_card()
1354 if (adapter->rx_work_enabled) { in mwifiex_add_card()
1355 adapter->rx_workqueue = alloc_workqueue("MWIFIEX_RX_WORK_QUEUE", in mwifiex_add_card()
1359 if (!adapter->rx_workqueue) in mwifiex_add_card()
1362 INIT_WORK(&adapter->rx_work, mwifiex_rx_work_queue); in mwifiex_add_card()
1367 if (adapter->if_ops.register_dev(adapter)) { in mwifiex_add_card()
1372 if (mwifiex_init_hw_fw(adapter)) { in mwifiex_add_card()
1381 if (adapter->if_ops.unregister_dev) in mwifiex_add_card()
1382 adapter->if_ops.unregister_dev(adapter); in mwifiex_add_card()
1383 if (adapter->hw_status == MWIFIEX_HW_STATUS_READY) { in mwifiex_add_card()
1385 adapter->init_wait_q_woken = false; in mwifiex_add_card()
1387 if (mwifiex_shutdown_drv(adapter) == -EINPROGRESS) in mwifiex_add_card()
1388 wait_event_interruptible(adapter->init_wait_q, in mwifiex_add_card()
1389 adapter->init_wait_q_woken); in mwifiex_add_card()
1392 adapter->surprise_removed = true; in mwifiex_add_card()
1393 mwifiex_terminate_workqueue(adapter); in mwifiex_add_card()
1395 mwifiex_free_adapter(adapter); in mwifiex_add_card()
1416 int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem) in mwifiex_remove_card() argument
1424 if (!adapter) in mwifiex_remove_card()
1429 if (adapter->if_ops.disable_int) in mwifiex_remove_card()
1430 adapter->if_ops.disable_int(adapter); in mwifiex_remove_card()
1432 adapter->surprise_removed = true; in mwifiex_remove_card()
1434 mwifiex_terminate_workqueue(adapter); in mwifiex_remove_card()
1437 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_remove_card()
1438 priv = adapter->priv[i]; in mwifiex_remove_card()
1440 mwifiex_stop_net_dev_queue(priv->netdev, adapter); in mwifiex_remove_card()
1446 mwifiex_dbg(adapter, CMD, in mwifiex_remove_card()
1448 adapter->init_wait_q_woken = false; in mwifiex_remove_card()
1450 if (mwifiex_shutdown_drv(adapter) == -EINPROGRESS) in mwifiex_remove_card()
1451 wait_event_interruptible(adapter->init_wait_q, in mwifiex_remove_card()
1452 adapter->init_wait_q_woken); in mwifiex_remove_card()
1453 mwifiex_dbg(adapter, CMD, in mwifiex_remove_card()
1455 if (atomic_read(&adapter->rx_pending) || in mwifiex_remove_card()
1456 atomic_read(&adapter->tx_pending) || in mwifiex_remove_card()
1457 atomic_read(&adapter->cmd_pending)) { in mwifiex_remove_card()
1458 mwifiex_dbg(adapter, ERROR, in mwifiex_remove_card()
1461 atomic_read(&adapter->rx_pending), in mwifiex_remove_card()
1462 atomic_read(&adapter->tx_pending), in mwifiex_remove_card()
1463 atomic_read(&adapter->cmd_pending)); in mwifiex_remove_card()
1466 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_remove_card()
1467 priv = adapter->priv[i]; in mwifiex_remove_card()
1475 mwifiex_del_virtual_intf(adapter->wiphy, &priv->wdev); in mwifiex_remove_card()
1479 wiphy_unregister(adapter->wiphy); in mwifiex_remove_card()
1480 wiphy_free(adapter->wiphy); in mwifiex_remove_card()
1483 mwifiex_dbg(adapter, INFO, in mwifiex_remove_card()
1485 if (adapter->if_ops.unregister_dev) in mwifiex_remove_card()
1486 adapter->if_ops.unregister_dev(adapter); in mwifiex_remove_card()
1488 mwifiex_dbg(adapter, INFO, in mwifiex_remove_card()
1490 mwifiex_free_adapter(adapter); in mwifiex_remove_card()
1499 void _mwifiex_dbg(const struct mwifiex_adapter *adapter, int mask, in _mwifiex_dbg() argument
1505 if (!adapter->dev || !(adapter->debug_mask & mask)) in _mwifiex_dbg()
1513 dev_info(adapter->dev, "%pV", &vaf); in _mwifiex_dbg()