Lines Matching full:adapter

24 	struct mwifiex_adapter *adapter = priv->adapter;  in mwifiex_add_bss_prio_tbl()  local
26 struct mwifiex_bss_prio_tbl *tbl = adapter->bss_prio_tbl; in mwifiex_add_bss_prio_tbl()
44 struct mwifiex_adapter *adapter = from_timer(adapter, t, wakeup_timer); in wakeup_timer_fn() local
46 mwifiex_dbg(adapter, ERROR, "Firmware wakeup failed\n"); in wakeup_timer_fn()
47 adapter->hw_status = MWIFIEX_HW_STATUS_RESET; in wakeup_timer_fn()
48 mwifiex_cancel_all_pending_cmd(adapter); in wakeup_timer_fn()
50 if (adapter->if_ops.card_reset) in wakeup_timer_fn()
51 adapter->if_ops.card_reset(adapter); in wakeup_timer_fn()
56 struct mwifiex_adapter *adapter = in fw_dump_work() local
59 mwifiex_upload_device_dump(adapter); in fw_dump_work()
160 * This function allocates buffers for members of the adapter
167 static int mwifiex_allocate_adapter(struct mwifiex_adapter *adapter) in mwifiex_allocate_adapter() argument
172 ret = mwifiex_alloc_cmd_buffer(adapter); in mwifiex_allocate_adapter()
174 mwifiex_dbg(adapter, ERROR, in mwifiex_allocate_adapter()
180 adapter->sleep_cfm = in mwifiex_allocate_adapter()
184 if (!adapter->sleep_cfm) { in mwifiex_allocate_adapter()
185 mwifiex_dbg(adapter, ERROR, in mwifiex_allocate_adapter()
190 skb_reserve(adapter->sleep_cfm, INTF_HEADER_LEN); in mwifiex_allocate_adapter()
196 * This function initializes the adapter structure and sets default
197 * values to the members of adapter.
202 static void mwifiex_init_adapter(struct mwifiex_adapter *adapter) in mwifiex_init_adapter() argument
206 skb_put(adapter->sleep_cfm, sizeof(struct mwifiex_opt_sleep_confirm)); in mwifiex_init_adapter()
208 adapter->cmd_sent = false; in mwifiex_init_adapter()
210 if (adapter->iface_type == MWIFIEX_SDIO) in mwifiex_init_adapter()
211 adapter->data_sent = true; in mwifiex_init_adapter()
213 adapter->data_sent = false; in mwifiex_init_adapter()
215 if (adapter->iface_type == MWIFIEX_USB) in mwifiex_init_adapter()
216 adapter->intf_hdr_len = 0; in mwifiex_init_adapter()
218 adapter->intf_hdr_len = INTF_HEADER_LEN; in mwifiex_init_adapter()
220 adapter->cmd_resp_received = false; in mwifiex_init_adapter()
221 adapter->event_received = false; in mwifiex_init_adapter()
222 adapter->data_received = false; in mwifiex_init_adapter()
224 clear_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags); in mwifiex_init_adapter()
226 adapter->hw_status = MWIFIEX_HW_STATUS_INITIALIZING; in mwifiex_init_adapter()
228 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM; in mwifiex_init_adapter()
229 adapter->ps_state = PS_STATE_AWAKE; in mwifiex_init_adapter()
230 adapter->need_to_wakeup = false; in mwifiex_init_adapter()
232 adapter->scan_mode = HostCmd_BSS_MODE_ANY; in mwifiex_init_adapter()
233 adapter->specific_scan_time = MWIFIEX_SPECIFIC_SCAN_CHAN_TIME; in mwifiex_init_adapter()
234 adapter->active_scan_time = MWIFIEX_ACTIVE_SCAN_CHAN_TIME; in mwifiex_init_adapter()
235 adapter->passive_scan_time = MWIFIEX_PASSIVE_SCAN_CHAN_TIME; in mwifiex_init_adapter()
236 adapter->scan_chan_gap_time = MWIFIEX_DEF_SCAN_CHAN_GAP_TIME; in mwifiex_init_adapter()
238 adapter->scan_probes = 1; in mwifiex_init_adapter()
240 adapter->multiple_dtim = 1; in mwifiex_init_adapter()
242 adapter->local_listen_interval = 0; /* default value in firmware in mwifiex_init_adapter()
245 adapter->is_deep_sleep = false; in mwifiex_init_adapter()
247 adapter->delay_null_pkt = false; in mwifiex_init_adapter()
248 adapter->delay_to_ps = 1000; in mwifiex_init_adapter()
249 adapter->enhanced_ps_mode = PS_MODE_AUTO; in mwifiex_init_adapter()
251 adapter->gen_null_pkt = false; /* Disable NULL Pkg generation by in mwifiex_init_adapter()
253 adapter->pps_uapsd_mode = false; /* Disable pps/uapsd mode by in mwifiex_init_adapter()
255 adapter->pm_wakeup_card_req = false; in mwifiex_init_adapter()
257 adapter->pm_wakeup_fw_try = false; in mwifiex_init_adapter()
259 adapter->curr_tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K; in mwifiex_init_adapter()
261 clear_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags); in mwifiex_init_adapter()
262 adapter->hs_cfg.conditions = cpu_to_le32(HS_CFG_COND_DEF); in mwifiex_init_adapter()
263 adapter->hs_cfg.gpio = HS_CFG_GPIO_DEF; in mwifiex_init_adapter()
264 adapter->hs_cfg.gap = HS_CFG_GAP_DEF; in mwifiex_init_adapter()
265 adapter->hs_activated = false; in mwifiex_init_adapter()
267 memset(adapter->event_body, 0, sizeof(adapter->event_body)); in mwifiex_init_adapter()
268 adapter->hw_dot_11n_dev_cap = 0; in mwifiex_init_adapter()
269 adapter->hw_dev_mcs_support = 0; in mwifiex_init_adapter()
270 adapter->sec_chan_offset = 0; in mwifiex_init_adapter()
271 adapter->adhoc_11n_enabled = false; in mwifiex_init_adapter()
273 mwifiex_wmm_init(adapter); in mwifiex_init_adapter()
274 atomic_set(&adapter->tx_hw_pending, 0); in mwifiex_init_adapter()
277 adapter->sleep_cfm->data; in mwifiex_init_adapter()
278 memset(sleep_cfm_buf, 0, adapter->sleep_cfm->len); in mwifiex_init_adapter()
280 sleep_cfm_buf->size = cpu_to_le16(adapter->sleep_cfm->len); in mwifiex_init_adapter()
285 memset(&adapter->sleep_period, 0, sizeof(adapter->sleep_period)); in mwifiex_init_adapter()
286 adapter->tx_lock_flag = false; in mwifiex_init_adapter()
287 adapter->null_pkt_interval = 0; in mwifiex_init_adapter()
288 adapter->fw_bands = 0; in mwifiex_init_adapter()
289 adapter->config_bands = 0; in mwifiex_init_adapter()
290 adapter->adhoc_start_band = 0; in mwifiex_init_adapter()
291 adapter->fw_release_number = 0; in mwifiex_init_adapter()
292 adapter->fw_cap_info = 0; in mwifiex_init_adapter()
293 memset(&adapter->upld_buf, 0, sizeof(adapter->upld_buf)); in mwifiex_init_adapter()
294 adapter->event_cause = 0; in mwifiex_init_adapter()
295 adapter->region_code = 0; in mwifiex_init_adapter()
296 adapter->bcn_miss_time_out = DEFAULT_BCN_MISS_TIMEOUT; in mwifiex_init_adapter()
297 adapter->adhoc_awake_period = 0; in mwifiex_init_adapter()
298 memset(&adapter->arp_filter, 0, sizeof(adapter->arp_filter)); in mwifiex_init_adapter()
299 adapter->arp_filter_size = 0; in mwifiex_init_adapter()
300 adapter->max_mgmt_ie_index = MAX_MGMT_IE_INDEX; in mwifiex_init_adapter()
301 adapter->mfg_mode = mfg_mode; in mwifiex_init_adapter()
302 adapter->key_api_major_ver = 0; in mwifiex_init_adapter()
303 adapter->key_api_minor_ver = 0; in mwifiex_init_adapter()
304 eth_broadcast_addr(adapter->perm_addr); in mwifiex_init_adapter()
305 adapter->iface_limit.sta_intf = MWIFIEX_MAX_STA_NUM; in mwifiex_init_adapter()
306 adapter->iface_limit.uap_intf = MWIFIEX_MAX_UAP_NUM; in mwifiex_init_adapter()
307 adapter->iface_limit.p2p_intf = MWIFIEX_MAX_P2P_NUM; in mwifiex_init_adapter()
308 adapter->active_scan_triggered = false; in mwifiex_init_adapter()
309 timer_setup(&adapter->wakeup_timer, wakeup_timer_fn, 0); in mwifiex_init_adapter()
310 adapter->devdump_len = 0; in mwifiex_init_adapter()
311 INIT_DELAYED_WORK(&adapter->devdump_work, fw_dump_work); in mwifiex_init_adapter()
331 struct mwifiex_adapter *adapter) in mwifiex_wake_up_net_dev_queue() argument
333 spin_lock_bh(&adapter->queue_lock); in mwifiex_wake_up_net_dev_queue()
335 spin_unlock_bh(&adapter->queue_lock); in mwifiex_wake_up_net_dev_queue()
342 struct mwifiex_adapter *adapter) in mwifiex_stop_net_dev_queue() argument
344 spin_lock_bh(&adapter->queue_lock); in mwifiex_stop_net_dev_queue()
346 spin_unlock_bh(&adapter->queue_lock); in mwifiex_stop_net_dev_queue()
352 static void mwifiex_invalidate_lists(struct mwifiex_adapter *adapter) in mwifiex_invalidate_lists() argument
357 list_del(&adapter->cmd_free_q); in mwifiex_invalidate_lists()
358 list_del(&adapter->cmd_pending_q); in mwifiex_invalidate_lists()
359 list_del(&adapter->scan_pending_q); in mwifiex_invalidate_lists()
361 for (i = 0; i < adapter->priv_num; i++) in mwifiex_invalidate_lists()
362 list_del(&adapter->bss_prio_tbl[i].bss_prio_head); in mwifiex_invalidate_lists()
364 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_invalidate_lists()
365 if (adapter->priv[i]) { in mwifiex_invalidate_lists()
366 priv = adapter->priv[i]; in mwifiex_invalidate_lists()
378 * This function performs cleanup for adapter structure.
387 mwifiex_adapter_cleanup(struct mwifiex_adapter *adapter) in mwifiex_adapter_cleanup() argument
389 del_timer(&adapter->wakeup_timer); in mwifiex_adapter_cleanup()
390 cancel_delayed_work_sync(&adapter->devdump_work); in mwifiex_adapter_cleanup()
391 mwifiex_cancel_all_pending_cmd(adapter); in mwifiex_adapter_cleanup()
392 wake_up_interruptible(&adapter->cmd_wait_q.wait); in mwifiex_adapter_cleanup()
393 wake_up_interruptible(&adapter->hs_activate_wait_q); in mwifiex_adapter_cleanup()
396 void mwifiex_free_cmd_buffers(struct mwifiex_adapter *adapter) in mwifiex_free_cmd_buffers() argument
398 mwifiex_invalidate_lists(adapter); in mwifiex_free_cmd_buffers()
401 mwifiex_dbg(adapter, INFO, "info: free cmd buffer\n"); in mwifiex_free_cmd_buffers()
402 mwifiex_free_cmd_buffer(adapter); in mwifiex_free_cmd_buffers()
404 if (adapter->sleep_cfm) in mwifiex_free_cmd_buffers()
405 dev_kfree_skb_any(adapter->sleep_cfm); in mwifiex_free_cmd_buffers()
412 int mwifiex_init_lock_list(struct mwifiex_adapter *adapter) in mwifiex_init_lock_list() argument
417 spin_lock_init(&adapter->int_lock); in mwifiex_init_lock_list()
418 spin_lock_init(&adapter->main_proc_lock); in mwifiex_init_lock_list()
419 spin_lock_init(&adapter->mwifiex_cmd_lock); in mwifiex_init_lock_list()
420 spin_lock_init(&adapter->queue_lock); in mwifiex_init_lock_list()
421 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_init_lock_list()
422 if (adapter->priv[i]) { in mwifiex_init_lock_list()
423 priv = adapter->priv[i]; in mwifiex_init_lock_list()
432 INIT_LIST_HEAD(&adapter->cmd_free_q); in mwifiex_init_lock_list()
434 INIT_LIST_HEAD(&adapter->cmd_pending_q); in mwifiex_init_lock_list()
436 INIT_LIST_HEAD(&adapter->scan_pending_q); in mwifiex_init_lock_list()
438 spin_lock_init(&adapter->cmd_free_q_lock); in mwifiex_init_lock_list()
439 spin_lock_init(&adapter->cmd_pending_q_lock); in mwifiex_init_lock_list()
440 spin_lock_init(&adapter->scan_pending_q_lock); in mwifiex_init_lock_list()
441 spin_lock_init(&adapter->rx_proc_lock); in mwifiex_init_lock_list()
443 skb_queue_head_init(&adapter->rx_data_q); in mwifiex_init_lock_list()
444 skb_queue_head_init(&adapter->tx_data_q); in mwifiex_init_lock_list()
446 for (i = 0; i < adapter->priv_num; ++i) { in mwifiex_init_lock_list()
447 INIT_LIST_HEAD(&adapter->bss_prio_tbl[i].bss_prio_head); in mwifiex_init_lock_list()
448 spin_lock_init(&adapter->bss_prio_tbl[i].bss_prio_lock); in mwifiex_init_lock_list()
451 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_init_lock_list()
452 if (!adapter->priv[i]) in mwifiex_init_lock_list()
454 priv = adapter->priv[i]; in mwifiex_init_lock_list()
478 * - Allocate adapter structure
479 * - Initialize the adapter structure
481 * - Add BSS priority tables to the adapter structure
485 int mwifiex_init_fw(struct mwifiex_adapter *adapter) in mwifiex_init_fw() argument
492 adapter->hw_status = MWIFIEX_HW_STATUS_INITIALIZING; in mwifiex_init_fw()
494 /* Allocate memory for member of adapter structure */ in mwifiex_init_fw()
495 ret = mwifiex_allocate_adapter(adapter); in mwifiex_init_fw()
499 /* Initialize adapter structure */ in mwifiex_init_fw()
500 mwifiex_init_adapter(adapter); in mwifiex_init_fw()
502 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_init_fw()
503 if (adapter->priv[i]) { in mwifiex_init_fw()
504 priv = adapter->priv[i]; in mwifiex_init_fw()
512 if (adapter->mfg_mode) { in mwifiex_init_fw()
513 adapter->hw_status = MWIFIEX_HW_STATUS_READY; in mwifiex_init_fw()
516 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_init_fw()
517 if (adapter->priv[i]) { in mwifiex_init_fw()
518 ret = mwifiex_sta_init_cmd(adapter->priv[i], in mwifiex_init_fw()
531 spin_lock_bh(&adapter->cmd_pending_q_lock); in mwifiex_init_fw()
532 is_cmd_pend_q_empty = list_empty(&adapter->cmd_pending_q); in mwifiex_init_fw()
533 spin_unlock_bh(&adapter->cmd_pending_q_lock); in mwifiex_init_fw()
536 if (mwifiex_main_process(adapter) != -1) in mwifiex_init_fw()
539 adapter->hw_status = MWIFIEX_HW_STATUS_READY; in mwifiex_init_fw()
554 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_delete_bss_prio_tbl() local
559 for (i = 0; i < adapter->priv_num; ++i) { in mwifiex_delete_bss_prio_tbl()
560 head = &adapter->bss_prio_tbl[i].bss_prio_head; in mwifiex_delete_bss_prio_tbl()
561 lock = &adapter->bss_prio_tbl[i].bss_prio_lock; in mwifiex_delete_bss_prio_tbl()
562 mwifiex_dbg(adapter, INFO, in mwifiex_delete_bss_prio_tbl()
573 mwifiex_dbg(adapter, INFO, in mwifiex_delete_bss_prio_tbl()
605 * - Free the adapter
609 mwifiex_shutdown_drv(struct mwifiex_adapter *adapter) in mwifiex_shutdown_drv() argument
616 if (adapter->hw_status == MWIFIEX_HW_STATUS_NOT_READY) in mwifiex_shutdown_drv()
620 if (adapter->curr_cmd) { in mwifiex_shutdown_drv()
621 mwifiex_dbg(adapter, WARN, in mwifiex_shutdown_drv()
623 del_timer_sync(&adapter->cmd_timer); in mwifiex_shutdown_drv()
624 mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); in mwifiex_shutdown_drv()
625 adapter->curr_cmd = NULL; in mwifiex_shutdown_drv()
629 mwifiex_dbg(adapter, MSG, in mwifiex_shutdown_drv()
633 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_shutdown_drv()
634 if (adapter->priv[i]) { in mwifiex_shutdown_drv()
635 priv = adapter->priv[i]; in mwifiex_shutdown_drv()
643 atomic_set(&adapter->tx_queued, 0); in mwifiex_shutdown_drv()
644 while ((skb = skb_dequeue(&adapter->tx_data_q))) in mwifiex_shutdown_drv()
645 mwifiex_write_data_complete(adapter, skb, 0, 0); in mwifiex_shutdown_drv()
647 spin_lock_bh(&adapter->rx_proc_lock); in mwifiex_shutdown_drv()
649 while ((skb = skb_dequeue(&adapter->rx_data_q))) { in mwifiex_shutdown_drv()
652 atomic_dec(&adapter->rx_pending); in mwifiex_shutdown_drv()
653 priv = adapter->priv[rx_info->bss_num]; in mwifiex_shutdown_drv()
660 spin_unlock_bh(&adapter->rx_proc_lock); in mwifiex_shutdown_drv()
662 mwifiex_adapter_cleanup(adapter); in mwifiex_shutdown_drv()
664 adapter->hw_status = MWIFIEX_HW_STATUS_NOT_READY; in mwifiex_shutdown_drv()
679 int mwifiex_dnld_fw(struct mwifiex_adapter *adapter, in mwifiex_dnld_fw() argument
686 ret = adapter->if_ops.check_fw_status(adapter, poll_num); in mwifiex_dnld_fw()
688 mwifiex_dbg(adapter, MSG, in mwifiex_dnld_fw()
694 if (adapter->if_ops.check_winner_status) { in mwifiex_dnld_fw()
695 adapter->winner = 0; in mwifiex_dnld_fw()
696 ret = adapter->if_ops.check_winner_status(adapter); in mwifiex_dnld_fw()
700 mwifiex_dbg(adapter, MSG, in mwifiex_dnld_fw()
705 if (!adapter->winner) { in mwifiex_dnld_fw()
706 mwifiex_dbg(adapter, MSG, in mwifiex_dnld_fw()
714 ret = adapter->if_ops.prog_fw(adapter, pmfw); in mwifiex_dnld_fw()
716 mwifiex_dbg(adapter, ERROR, in mwifiex_dnld_fw()
724 ret = adapter->if_ops.check_fw_status(adapter, poll_num); in mwifiex_dnld_fw()
726 mwifiex_dbg(adapter, ERROR, in mwifiex_dnld_fw()