Lines Matching refs:adapter

36 	struct mwifiex_adapter *adapter = priv->adapter;  in mwifiex_add_bss_prio_tbl()  local
38 struct mwifiex_bss_prio_tbl *tbl = adapter->bss_prio_tbl; in mwifiex_add_bss_prio_tbl()
57 struct mwifiex_adapter *adapter = (struct mwifiex_adapter *)data; in wakeup_timer_fn() local
59 dev_err(adapter->dev, "Firmware wakeup failed\n"); in wakeup_timer_fn()
60 adapter->hw_status = MWIFIEX_HW_STATUS_RESET; in wakeup_timer_fn()
61 mwifiex_cancel_all_pending_cmd(adapter); in wakeup_timer_fn()
63 if (adapter->if_ops.card_reset) in wakeup_timer_fn()
64 adapter->if_ops.card_reset(adapter); in wakeup_timer_fn()
168 static int mwifiex_allocate_adapter(struct mwifiex_adapter *adapter) in mwifiex_allocate_adapter() argument
173 ret = mwifiex_alloc_cmd_buffer(adapter); in mwifiex_allocate_adapter()
175 dev_err(adapter->dev, "%s: failed to alloc cmd buffer\n", in mwifiex_allocate_adapter()
180 adapter->sleep_cfm = in mwifiex_allocate_adapter()
184 if (!adapter->sleep_cfm) { in mwifiex_allocate_adapter()
185 dev_err(adapter->dev, "%s: failed to alloc sleep cfm" in mwifiex_allocate_adapter()
189 skb_reserve(adapter->sleep_cfm, INTF_HEADER_LEN); in mwifiex_allocate_adapter()
201 static void mwifiex_init_adapter(struct mwifiex_adapter *adapter) in mwifiex_init_adapter() argument
205 skb_put(adapter->sleep_cfm, sizeof(struct mwifiex_opt_sleep_confirm)); in mwifiex_init_adapter()
207 adapter->cmd_sent = false; in mwifiex_init_adapter()
209 if (adapter->iface_type == MWIFIEX_SDIO) in mwifiex_init_adapter()
210 adapter->data_sent = true; in mwifiex_init_adapter()
212 adapter->data_sent = false; in mwifiex_init_adapter()
214 adapter->cmd_resp_received = false; in mwifiex_init_adapter()
215 adapter->event_received = false; in mwifiex_init_adapter()
216 adapter->data_received = false; in mwifiex_init_adapter()
218 adapter->surprise_removed = false; in mwifiex_init_adapter()
220 adapter->hw_status = MWIFIEX_HW_STATUS_INITIALIZING; in mwifiex_init_adapter()
222 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM; in mwifiex_init_adapter()
223 adapter->ps_state = PS_STATE_AWAKE; in mwifiex_init_adapter()
224 adapter->need_to_wakeup = false; in mwifiex_init_adapter()
226 adapter->scan_mode = HostCmd_BSS_MODE_ANY; in mwifiex_init_adapter()
227 adapter->specific_scan_time = MWIFIEX_SPECIFIC_SCAN_CHAN_TIME; in mwifiex_init_adapter()
228 adapter->active_scan_time = MWIFIEX_ACTIVE_SCAN_CHAN_TIME; in mwifiex_init_adapter()
229 adapter->passive_scan_time = MWIFIEX_PASSIVE_SCAN_CHAN_TIME; in mwifiex_init_adapter()
230 adapter->scan_chan_gap_time = MWIFIEX_DEF_SCAN_CHAN_GAP_TIME; in mwifiex_init_adapter()
232 adapter->scan_probes = 1; in mwifiex_init_adapter()
234 adapter->multiple_dtim = 1; in mwifiex_init_adapter()
236 adapter->local_listen_interval = 0; /* default value in firmware in mwifiex_init_adapter()
239 adapter->is_deep_sleep = false; in mwifiex_init_adapter()
241 adapter->delay_null_pkt = false; in mwifiex_init_adapter()
242 adapter->delay_to_ps = 1000; in mwifiex_init_adapter()
243 adapter->enhanced_ps_mode = PS_MODE_AUTO; in mwifiex_init_adapter()
245 adapter->gen_null_pkt = false; /* Disable NULL Pkg generation by in mwifiex_init_adapter()
247 adapter->pps_uapsd_mode = false; /* Disable pps/uapsd mode by in mwifiex_init_adapter()
249 adapter->pm_wakeup_card_req = false; in mwifiex_init_adapter()
251 adapter->pm_wakeup_fw_try = false; in mwifiex_init_adapter()
253 adapter->curr_tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K; in mwifiex_init_adapter()
255 adapter->is_hs_configured = false; in mwifiex_init_adapter()
256 adapter->hs_cfg.conditions = cpu_to_le32(HS_CFG_COND_DEF); in mwifiex_init_adapter()
257 adapter->hs_cfg.gpio = HS_CFG_GPIO_DEF; in mwifiex_init_adapter()
258 adapter->hs_cfg.gap = HS_CFG_GAP_DEF; in mwifiex_init_adapter()
259 adapter->hs_activated = false; in mwifiex_init_adapter()
261 memset(adapter->event_body, 0, sizeof(adapter->event_body)); in mwifiex_init_adapter()
262 adapter->hw_dot_11n_dev_cap = 0; in mwifiex_init_adapter()
263 adapter->hw_dev_mcs_support = 0; in mwifiex_init_adapter()
264 adapter->sec_chan_offset = 0; in mwifiex_init_adapter()
265 adapter->adhoc_11n_enabled = false; in mwifiex_init_adapter()
267 mwifiex_wmm_init(adapter); in mwifiex_init_adapter()
270 adapter->sleep_cfm->data; in mwifiex_init_adapter()
271 memset(sleep_cfm_buf, 0, adapter->sleep_cfm->len); in mwifiex_init_adapter()
273 sleep_cfm_buf->size = cpu_to_le16(adapter->sleep_cfm->len); in mwifiex_init_adapter()
278 memset(&adapter->sleep_params, 0, sizeof(adapter->sleep_params)); in mwifiex_init_adapter()
279 memset(&adapter->sleep_period, 0, sizeof(adapter->sleep_period)); in mwifiex_init_adapter()
280 adapter->tx_lock_flag = false; in mwifiex_init_adapter()
281 adapter->null_pkt_interval = 0; in mwifiex_init_adapter()
282 adapter->fw_bands = 0; in mwifiex_init_adapter()
283 adapter->config_bands = 0; in mwifiex_init_adapter()
284 adapter->adhoc_start_band = 0; in mwifiex_init_adapter()
285 adapter->scan_channels = NULL; in mwifiex_init_adapter()
286 adapter->fw_release_number = 0; in mwifiex_init_adapter()
287 adapter->fw_cap_info = 0; in mwifiex_init_adapter()
288 memset(&adapter->upld_buf, 0, sizeof(adapter->upld_buf)); in mwifiex_init_adapter()
289 adapter->event_cause = 0; in mwifiex_init_adapter()
290 adapter->region_code = 0; in mwifiex_init_adapter()
291 adapter->bcn_miss_time_out = DEFAULT_BCN_MISS_TIMEOUT; in mwifiex_init_adapter()
292 adapter->adhoc_awake_period = 0; in mwifiex_init_adapter()
293 memset(&adapter->arp_filter, 0, sizeof(adapter->arp_filter)); in mwifiex_init_adapter()
294 adapter->arp_filter_size = 0; in mwifiex_init_adapter()
295 adapter->max_mgmt_ie_index = MAX_MGMT_IE_INDEX; in mwifiex_init_adapter()
296 adapter->key_api_major_ver = 0; in mwifiex_init_adapter()
297 adapter->key_api_minor_ver = 0; in mwifiex_init_adapter()
298 eth_broadcast_addr(adapter->perm_addr); in mwifiex_init_adapter()
299 adapter->iface_limit.sta_intf = MWIFIEX_MAX_STA_NUM; in mwifiex_init_adapter()
300 adapter->iface_limit.uap_intf = MWIFIEX_MAX_UAP_NUM; in mwifiex_init_adapter()
301 adapter->iface_limit.p2p_intf = MWIFIEX_MAX_P2P_NUM; in mwifiex_init_adapter()
303 setup_timer(&adapter->wakeup_timer, wakeup_timer_fn, in mwifiex_init_adapter()
304 (unsigned long)adapter); in mwifiex_init_adapter()
324 struct mwifiex_adapter *adapter) in mwifiex_wake_up_net_dev_queue() argument
329 spin_lock_irqsave(&adapter->queue_lock, dev_queue_flags); in mwifiex_wake_up_net_dev_queue()
338 spin_unlock_irqrestore(&adapter->queue_lock, dev_queue_flags); in mwifiex_wake_up_net_dev_queue()
345 struct mwifiex_adapter *adapter) in mwifiex_stop_net_dev_queue() argument
350 spin_lock_irqsave(&adapter->queue_lock, dev_queue_flags); in mwifiex_stop_net_dev_queue()
359 spin_unlock_irqrestore(&adapter->queue_lock, dev_queue_flags); in mwifiex_stop_net_dev_queue()
366 static void mwifiex_free_lock_list(struct mwifiex_adapter *adapter) in mwifiex_free_lock_list() argument
372 list_del(&adapter->cmd_free_q); in mwifiex_free_lock_list()
373 list_del(&adapter->cmd_pending_q); in mwifiex_free_lock_list()
374 list_del(&adapter->scan_pending_q); in mwifiex_free_lock_list()
376 for (i = 0; i < adapter->priv_num; i++) in mwifiex_free_lock_list()
377 list_del(&adapter->bss_prio_tbl[i].bss_prio_head); in mwifiex_free_lock_list()
379 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_free_lock_list()
380 if (adapter->priv[i]) { in mwifiex_free_lock_list()
381 priv = adapter->priv[i]; in mwifiex_free_lock_list()
402 mwifiex_adapter_cleanup(struct mwifiex_adapter *adapter) in mwifiex_adapter_cleanup() argument
406 if (!adapter) { in mwifiex_adapter_cleanup()
411 del_timer(&adapter->wakeup_timer); in mwifiex_adapter_cleanup()
412 mwifiex_cancel_all_pending_cmd(adapter); in mwifiex_adapter_cleanup()
413 wake_up_interruptible(&adapter->cmd_wait_q.wait); in mwifiex_adapter_cleanup()
414 wake_up_interruptible(&adapter->hs_activate_wait_q); in mwifiex_adapter_cleanup()
417 mwifiex_free_lock_list(adapter); in mwifiex_adapter_cleanup()
420 dev_dbg(adapter->dev, "info: free cmd buffer\n"); in mwifiex_adapter_cleanup()
421 mwifiex_free_cmd_buffer(adapter); in mwifiex_adapter_cleanup()
423 for (idx = 0; idx < adapter->num_mem_types; idx++) { in mwifiex_adapter_cleanup()
425 &adapter->mem_type_mapping_tbl[idx]; in mwifiex_adapter_cleanup()
434 if (adapter->drv_info_dump) { in mwifiex_adapter_cleanup()
435 vfree(adapter->drv_info_dump); in mwifiex_adapter_cleanup()
436 adapter->drv_info_size = 0; in mwifiex_adapter_cleanup()
439 if (adapter->sleep_cfm) in mwifiex_adapter_cleanup()
440 dev_kfree_skb_any(adapter->sleep_cfm); in mwifiex_adapter_cleanup()
447 int mwifiex_init_lock_list(struct mwifiex_adapter *adapter) in mwifiex_init_lock_list() argument
452 spin_lock_init(&adapter->mwifiex_lock); in mwifiex_init_lock_list()
453 spin_lock_init(&adapter->int_lock); in mwifiex_init_lock_list()
454 spin_lock_init(&adapter->main_proc_lock); in mwifiex_init_lock_list()
455 spin_lock_init(&adapter->mwifiex_cmd_lock); in mwifiex_init_lock_list()
456 spin_lock_init(&adapter->queue_lock); in mwifiex_init_lock_list()
457 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_init_lock_list()
458 if (adapter->priv[i]) { in mwifiex_init_lock_list()
459 priv = adapter->priv[i]; in mwifiex_init_lock_list()
469 INIT_LIST_HEAD(&adapter->cmd_free_q); in mwifiex_init_lock_list()
471 INIT_LIST_HEAD(&adapter->cmd_pending_q); in mwifiex_init_lock_list()
473 INIT_LIST_HEAD(&adapter->scan_pending_q); in mwifiex_init_lock_list()
475 spin_lock_init(&adapter->cmd_free_q_lock); in mwifiex_init_lock_list()
476 spin_lock_init(&adapter->cmd_pending_q_lock); in mwifiex_init_lock_list()
477 spin_lock_init(&adapter->scan_pending_q_lock); in mwifiex_init_lock_list()
478 spin_lock_init(&adapter->rx_proc_lock); in mwifiex_init_lock_list()
480 skb_queue_head_init(&adapter->rx_data_q); in mwifiex_init_lock_list()
481 skb_queue_head_init(&adapter->tx_data_q); in mwifiex_init_lock_list()
483 for (i = 0; i < adapter->priv_num; ++i) { in mwifiex_init_lock_list()
484 INIT_LIST_HEAD(&adapter->bss_prio_tbl[i].bss_prio_head); in mwifiex_init_lock_list()
485 spin_lock_init(&adapter->bss_prio_tbl[i].bss_prio_lock); in mwifiex_init_lock_list()
488 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_init_lock_list()
489 if (!adapter->priv[i]) in mwifiex_init_lock_list()
491 priv = adapter->priv[i]; in mwifiex_init_lock_list()
521 int mwifiex_init_fw(struct mwifiex_adapter *adapter) in mwifiex_init_fw() argument
529 adapter->hw_status = MWIFIEX_HW_STATUS_INITIALIZING; in mwifiex_init_fw()
532 ret = mwifiex_allocate_adapter(adapter); in mwifiex_init_fw()
537 mwifiex_init_adapter(adapter); in mwifiex_init_fw()
539 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_init_fw()
540 if (adapter->priv[i]) { in mwifiex_init_fw()
541 priv = adapter->priv[i]; in mwifiex_init_fw()
550 if (adapter->if_ops.init_fw_port) { in mwifiex_init_fw()
551 if (adapter->if_ops.init_fw_port(adapter)) in mwifiex_init_fw()
555 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_init_fw()
556 if (adapter->priv[i]) { in mwifiex_init_fw()
557 ret = mwifiex_sta_init_cmd(adapter->priv[i], first_sta, in mwifiex_init_fw()
566 spin_lock_irqsave(&adapter->cmd_pending_q_lock, flags); in mwifiex_init_fw()
567 is_cmd_pend_q_empty = list_empty(&adapter->cmd_pending_q); in mwifiex_init_fw()
568 spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, flags); in mwifiex_init_fw()
571 if (mwifiex_main_process(adapter) != -1) in mwifiex_init_fw()
574 adapter->hw_status = MWIFIEX_HW_STATUS_READY; in mwifiex_init_fw()
589 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_delete_bss_prio_tbl() local
595 for (i = 0; i < adapter->priv_num; ++i) { in mwifiex_delete_bss_prio_tbl()
596 head = &adapter->bss_prio_tbl[i].bss_prio_head; in mwifiex_delete_bss_prio_tbl()
597 lock = &adapter->bss_prio_tbl[i].bss_prio_lock; in mwifiex_delete_bss_prio_tbl()
598 dev_dbg(adapter->dev, "info: delete BSS priority table," in mwifiex_delete_bss_prio_tbl()
612 dev_dbg(adapter->dev, "info: Delete " in mwifiex_delete_bss_prio_tbl()
647 mwifiex_shutdown_drv(struct mwifiex_adapter *adapter) in mwifiex_shutdown_drv() argument
656 if (adapter->hw_status == MWIFIEX_HW_STATUS_NOT_READY) in mwifiex_shutdown_drv()
659 adapter->hw_status = MWIFIEX_HW_STATUS_CLOSING; in mwifiex_shutdown_drv()
661 if (adapter->mwifiex_processing) { in mwifiex_shutdown_drv()
662 dev_warn(adapter->dev, "main process is still running\n"); in mwifiex_shutdown_drv()
667 if (adapter->curr_cmd) { in mwifiex_shutdown_drv()
668 dev_warn(adapter->dev, "curr_cmd is still in processing\n"); in mwifiex_shutdown_drv()
669 del_timer_sync(&adapter->cmd_timer); in mwifiex_shutdown_drv()
670 mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); in mwifiex_shutdown_drv()
671 adapter->curr_cmd = NULL; in mwifiex_shutdown_drv()
675 dev_dbg(adapter->dev, "info: shutdown mwifiex...\n"); in mwifiex_shutdown_drv()
678 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_shutdown_drv()
679 if (adapter->priv[i]) { in mwifiex_shutdown_drv()
680 priv = adapter->priv[i]; in mwifiex_shutdown_drv()
689 atomic_set(&adapter->tx_queued, 0); in mwifiex_shutdown_drv()
690 while ((skb = skb_dequeue(&adapter->tx_data_q))) in mwifiex_shutdown_drv()
691 mwifiex_write_data_complete(adapter, skb, 0, 0); in mwifiex_shutdown_drv()
693 spin_lock_irqsave(&adapter->rx_proc_lock, flags); in mwifiex_shutdown_drv()
695 while ((skb = skb_dequeue(&adapter->rx_data_q))) { in mwifiex_shutdown_drv()
698 atomic_dec(&adapter->rx_pending); in mwifiex_shutdown_drv()
699 priv = adapter->priv[rx_info->bss_num]; in mwifiex_shutdown_drv()
706 spin_unlock_irqrestore(&adapter->rx_proc_lock, flags); in mwifiex_shutdown_drv()
708 spin_lock(&adapter->mwifiex_lock); in mwifiex_shutdown_drv()
710 mwifiex_adapter_cleanup(adapter); in mwifiex_shutdown_drv()
712 spin_unlock(&adapter->mwifiex_lock); in mwifiex_shutdown_drv()
715 ret = mwifiex_shutdown_fw_complete(adapter); in mwifiex_shutdown_drv()
732 int mwifiex_dnld_fw(struct mwifiex_adapter *adapter, in mwifiex_dnld_fw() argument
738 if (adapter->if_ops.check_fw_status) { in mwifiex_dnld_fw()
739 adapter->winner = 0; in mwifiex_dnld_fw()
742 ret = adapter->if_ops.check_fw_status(adapter, poll_num); in mwifiex_dnld_fw()
744 dev_notice(adapter->dev, in mwifiex_dnld_fw()
752 if (!adapter->winner) { in mwifiex_dnld_fw()
753 dev_notice(adapter->dev, in mwifiex_dnld_fw()
761 ret = adapter->if_ops.prog_fw(adapter, pmfw); in mwifiex_dnld_fw()
763 dev_err(adapter->dev, "prog_fw failed ret=%#x\n", ret); in mwifiex_dnld_fw()
770 ret = adapter->if_ops.check_fw_status(adapter, poll_num); in mwifiex_dnld_fw()
772 dev_err(adapter->dev, "FW failed to be active in time\n"); in mwifiex_dnld_fw()