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()
163 * This function allocates buffers for members of the adapter
170 static int mwifiex_allocate_adapter(struct mwifiex_adapter *adapter) in mwifiex_allocate_adapter() argument
175 ret = mwifiex_alloc_cmd_buffer(adapter); in mwifiex_allocate_adapter()
177 mwifiex_dbg(adapter, ERROR, in mwifiex_allocate_adapter()
183 adapter->sleep_cfm = in mwifiex_allocate_adapter()
187 if (!adapter->sleep_cfm) { in mwifiex_allocate_adapter()
188 mwifiex_dbg(adapter, ERROR, in mwifiex_allocate_adapter()
193 skb_reserve(adapter->sleep_cfm, INTF_HEADER_LEN); in mwifiex_allocate_adapter()
199 * This function initializes the adapter structure and sets default
200 * values to the members of adapter.
205 static void mwifiex_init_adapter(struct mwifiex_adapter *adapter) in mwifiex_init_adapter() argument
209 skb_put(adapter->sleep_cfm, sizeof(struct mwifiex_opt_sleep_confirm)); in mwifiex_init_adapter()
211 adapter->cmd_sent = false; in mwifiex_init_adapter()
213 if (adapter->iface_type == MWIFIEX_SDIO) in mwifiex_init_adapter()
214 adapter->data_sent = true; in mwifiex_init_adapter()
216 adapter->data_sent = false; in mwifiex_init_adapter()
218 if (adapter->iface_type == MWIFIEX_USB) in mwifiex_init_adapter()
219 adapter->intf_hdr_len = 0; in mwifiex_init_adapter()
221 adapter->intf_hdr_len = INTF_HEADER_LEN; in mwifiex_init_adapter()
223 adapter->cmd_resp_received = false; in mwifiex_init_adapter()
224 adapter->event_received = false; in mwifiex_init_adapter()
225 adapter->data_received = false; in mwifiex_init_adapter()
226 adapter->assoc_resp_received = false; in mwifiex_init_adapter()
227 adapter->priv_link_lost = NULL; in mwifiex_init_adapter()
228 adapter->host_mlme_link_lost = false; in mwifiex_init_adapter()
230 clear_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags); in mwifiex_init_adapter()
232 adapter->hw_status = MWIFIEX_HW_STATUS_INITIALIZING; in mwifiex_init_adapter()
234 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM; in mwifiex_init_adapter()
235 adapter->ps_state = PS_STATE_AWAKE; in mwifiex_init_adapter()
236 adapter->need_to_wakeup = false; in mwifiex_init_adapter()
238 adapter->scan_mode = HostCmd_BSS_MODE_ANY; in mwifiex_init_adapter()
239 adapter->specific_scan_time = MWIFIEX_SPECIFIC_SCAN_CHAN_TIME; in mwifiex_init_adapter()
240 adapter->active_scan_time = MWIFIEX_ACTIVE_SCAN_CHAN_TIME; in mwifiex_init_adapter()
241 adapter->passive_scan_time = MWIFIEX_PASSIVE_SCAN_CHAN_TIME; in mwifiex_init_adapter()
242 adapter->scan_chan_gap_time = MWIFIEX_DEF_SCAN_CHAN_GAP_TIME; in mwifiex_init_adapter()
244 adapter->scan_probes = 1; in mwifiex_init_adapter()
246 adapter->multiple_dtim = 1; in mwifiex_init_adapter()
248 adapter->local_listen_interval = 0; /* default value in firmware in mwifiex_init_adapter()
251 adapter->is_deep_sleep = false; in mwifiex_init_adapter()
253 adapter->delay_null_pkt = false; in mwifiex_init_adapter()
254 adapter->delay_to_ps = 1000; in mwifiex_init_adapter()
255 adapter->enhanced_ps_mode = PS_MODE_AUTO; in mwifiex_init_adapter()
257 adapter->gen_null_pkt = false; /* Disable NULL Pkg generation by in mwifiex_init_adapter()
259 adapter->pps_uapsd_mode = false; /* Disable pps/uapsd mode by in mwifiex_init_adapter()
261 adapter->pm_wakeup_card_req = false; in mwifiex_init_adapter()
263 adapter->pm_wakeup_fw_try = false; in mwifiex_init_adapter()
265 adapter->curr_tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K; in mwifiex_init_adapter()
267 clear_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags); in mwifiex_init_adapter()
268 adapter->hs_cfg.conditions = cpu_to_le32(HS_CFG_COND_DEF); in mwifiex_init_adapter()
269 adapter->hs_cfg.gpio = HS_CFG_GPIO_DEF; in mwifiex_init_adapter()
270 adapter->hs_cfg.gap = HS_CFG_GAP_DEF; in mwifiex_init_adapter()
271 adapter->hs_activated = false; in mwifiex_init_adapter()
273 memset(adapter->event_body, 0, sizeof(adapter->event_body)); in mwifiex_init_adapter()
274 adapter->hw_dot_11n_dev_cap = 0; in mwifiex_init_adapter()
275 adapter->hw_dev_mcs_support = 0; in mwifiex_init_adapter()
276 adapter->sec_chan_offset = 0; in mwifiex_init_adapter()
277 adapter->adhoc_11n_enabled = false; in mwifiex_init_adapter()
279 mwifiex_wmm_init(adapter); in mwifiex_init_adapter()
280 atomic_set(&adapter->tx_hw_pending, 0); in mwifiex_init_adapter()
283 adapter->sleep_cfm->data; in mwifiex_init_adapter()
284 memset(sleep_cfm_buf, 0, adapter->sleep_cfm->len); in mwifiex_init_adapter()
286 sleep_cfm_buf->size = cpu_to_le16(adapter->sleep_cfm->len); in mwifiex_init_adapter()
291 memset(&adapter->sleep_period, 0, sizeof(adapter->sleep_period)); in mwifiex_init_adapter()
292 adapter->tx_lock_flag = false; in mwifiex_init_adapter()
293 adapter->null_pkt_interval = 0; in mwifiex_init_adapter()
294 adapter->fw_bands = 0; in mwifiex_init_adapter()
295 adapter->config_bands = 0; in mwifiex_init_adapter()
296 adapter->adhoc_start_band = 0; in mwifiex_init_adapter()
297 adapter->fw_release_number = 0; in mwifiex_init_adapter()
298 adapter->fw_cap_info = 0; in mwifiex_init_adapter()
299 memset(&adapter->upld_buf, 0, sizeof(adapter->upld_buf)); in mwifiex_init_adapter()
300 adapter->event_cause = 0; in mwifiex_init_adapter()
301 adapter->region_code = 0; in mwifiex_init_adapter()
302 adapter->bcn_miss_time_out = DEFAULT_BCN_MISS_TIMEOUT; in mwifiex_init_adapter()
303 adapter->adhoc_awake_period = 0; in mwifiex_init_adapter()
304 memset(&adapter->arp_filter, 0, sizeof(adapter->arp_filter)); in mwifiex_init_adapter()
305 adapter->arp_filter_size = 0; in mwifiex_init_adapter()
306 adapter->max_mgmt_ie_index = MAX_MGMT_IE_INDEX; in mwifiex_init_adapter()
307 adapter->mfg_mode = mfg_mode; in mwifiex_init_adapter()
308 adapter->key_api_major_ver = 0; in mwifiex_init_adapter()
309 adapter->key_api_minor_ver = 0; in mwifiex_init_adapter()
310 eth_broadcast_addr(adapter->perm_addr); in mwifiex_init_adapter()
311 adapter->iface_limit.sta_intf = MWIFIEX_MAX_STA_NUM; in mwifiex_init_adapter()
312 adapter->iface_limit.uap_intf = MWIFIEX_MAX_UAP_NUM; in mwifiex_init_adapter()
313 adapter->iface_limit.p2p_intf = MWIFIEX_MAX_P2P_NUM; in mwifiex_init_adapter()
314 adapter->active_scan_triggered = false; in mwifiex_init_adapter()
315 timer_setup(&adapter->wakeup_timer, wakeup_timer_fn, 0); in mwifiex_init_adapter()
316 adapter->devdump_len = 0; in mwifiex_init_adapter()
317 INIT_DELAYED_WORK(&adapter->devdump_work, fw_dump_work); in mwifiex_init_adapter()
337 struct mwifiex_adapter *adapter) in mwifiex_wake_up_net_dev_queue() argument
339 spin_lock_bh(&adapter->queue_lock); in mwifiex_wake_up_net_dev_queue()
341 spin_unlock_bh(&adapter->queue_lock); in mwifiex_wake_up_net_dev_queue()
348 struct mwifiex_adapter *adapter) in mwifiex_stop_net_dev_queue() argument
350 spin_lock_bh(&adapter->queue_lock); in mwifiex_stop_net_dev_queue()
352 spin_unlock_bh(&adapter->queue_lock); in mwifiex_stop_net_dev_queue()
358 static void mwifiex_invalidate_lists(struct mwifiex_adapter *adapter) in mwifiex_invalidate_lists() argument
363 list_del(&adapter->cmd_free_q); in mwifiex_invalidate_lists()
364 list_del(&adapter->cmd_pending_q); in mwifiex_invalidate_lists()
365 list_del(&adapter->scan_pending_q); in mwifiex_invalidate_lists()
367 for (i = 0; i < adapter->priv_num; i++) in mwifiex_invalidate_lists()
368 list_del(&adapter->bss_prio_tbl[i].bss_prio_head); in mwifiex_invalidate_lists()
370 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_invalidate_lists()
371 priv = adapter->priv[i]; in mwifiex_invalidate_lists()
382 * This function performs cleanup for adapter structure.
391 mwifiex_adapter_cleanup(struct mwifiex_adapter *adapter) in mwifiex_adapter_cleanup() argument
393 del_timer(&adapter->wakeup_timer); in mwifiex_adapter_cleanup()
394 cancel_delayed_work_sync(&adapter->devdump_work); in mwifiex_adapter_cleanup()
395 mwifiex_cancel_all_pending_cmd(adapter); in mwifiex_adapter_cleanup()
396 wake_up_interruptible(&adapter->cmd_wait_q.wait); in mwifiex_adapter_cleanup()
397 wake_up_interruptible(&adapter->hs_activate_wait_q); in mwifiex_adapter_cleanup()
400 void mwifiex_free_cmd_buffers(struct mwifiex_adapter *adapter) in mwifiex_free_cmd_buffers() argument
402 mwifiex_invalidate_lists(adapter); in mwifiex_free_cmd_buffers()
405 mwifiex_dbg(adapter, INFO, "info: free cmd buffer\n"); in mwifiex_free_cmd_buffers()
406 mwifiex_free_cmd_buffer(adapter); in mwifiex_free_cmd_buffers()
408 if (adapter->sleep_cfm) in mwifiex_free_cmd_buffers()
409 dev_kfree_skb_any(adapter->sleep_cfm); in mwifiex_free_cmd_buffers()
416 int mwifiex_init_lock_list(struct mwifiex_adapter *adapter) in mwifiex_init_lock_list() argument
421 spin_lock_init(&adapter->int_lock); in mwifiex_init_lock_list()
422 spin_lock_init(&adapter->main_proc_lock); in mwifiex_init_lock_list()
423 spin_lock_init(&adapter->mwifiex_cmd_lock); in mwifiex_init_lock_list()
424 spin_lock_init(&adapter->queue_lock); in mwifiex_init_lock_list()
425 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_init_lock_list()
426 priv = adapter->priv[i]; in mwifiex_init_lock_list()
434 INIT_LIST_HEAD(&adapter->cmd_free_q); in mwifiex_init_lock_list()
436 INIT_LIST_HEAD(&adapter->cmd_pending_q); in mwifiex_init_lock_list()
438 INIT_LIST_HEAD(&adapter->scan_pending_q); in mwifiex_init_lock_list()
440 spin_lock_init(&adapter->cmd_free_q_lock); in mwifiex_init_lock_list()
441 spin_lock_init(&adapter->cmd_pending_q_lock); in mwifiex_init_lock_list()
442 spin_lock_init(&adapter->scan_pending_q_lock); in mwifiex_init_lock_list()
443 spin_lock_init(&adapter->rx_proc_lock); in mwifiex_init_lock_list()
445 skb_queue_head_init(&adapter->rx_data_q); in mwifiex_init_lock_list()
446 skb_queue_head_init(&adapter->tx_data_q); in mwifiex_init_lock_list()
448 for (i = 0; i < adapter->priv_num; ++i) { in mwifiex_init_lock_list()
449 INIT_LIST_HEAD(&adapter->bss_prio_tbl[i].bss_prio_head); in mwifiex_init_lock_list()
450 spin_lock_init(&adapter->bss_prio_tbl[i].bss_prio_lock); in mwifiex_init_lock_list()
453 for (i = 0; i < adapter->priv_num; 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 priv = adapter->priv[i]; in mwifiex_init_fw()
510 if (adapter->mfg_mode) { in mwifiex_init_fw()
511 adapter->hw_status = MWIFIEX_HW_STATUS_READY; in mwifiex_init_fw()
514 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_init_fw()
515 ret = mwifiex_sta_init_cmd(adapter->priv[i], in mwifiex_init_fw()
524 spin_lock_bh(&adapter->cmd_pending_q_lock); in mwifiex_init_fw()
525 is_cmd_pend_q_empty = list_empty(&adapter->cmd_pending_q); in mwifiex_init_fw()
526 spin_unlock_bh(&adapter->cmd_pending_q_lock); in mwifiex_init_fw()
529 if (mwifiex_main_process(adapter) != -1) in mwifiex_init_fw()
532 adapter->hw_status = MWIFIEX_HW_STATUS_READY; in mwifiex_init_fw()
547 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_delete_bss_prio_tbl() local
552 for (i = 0; i < adapter->priv_num; ++i) { in mwifiex_delete_bss_prio_tbl()
553 head = &adapter->bss_prio_tbl[i].bss_prio_head; in mwifiex_delete_bss_prio_tbl()
554 lock = &adapter->bss_prio_tbl[i].bss_prio_lock; in mwifiex_delete_bss_prio_tbl()
555 mwifiex_dbg(adapter, INFO, in mwifiex_delete_bss_prio_tbl()
566 mwifiex_dbg(adapter, INFO, in mwifiex_delete_bss_prio_tbl()
598 * - Free the adapter
602 mwifiex_shutdown_drv(struct mwifiex_adapter *adapter) in mwifiex_shutdown_drv() argument
609 if (adapter->hw_status == MWIFIEX_HW_STATUS_NOT_READY) in mwifiex_shutdown_drv()
613 if (adapter->curr_cmd) { in mwifiex_shutdown_drv()
614 mwifiex_dbg(adapter, WARN, in mwifiex_shutdown_drv()
616 del_timer_sync(&adapter->cmd_timer); in mwifiex_shutdown_drv()
617 mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); in mwifiex_shutdown_drv()
618 adapter->curr_cmd = NULL; in mwifiex_shutdown_drv()
622 mwifiex_dbg(adapter, MSG, in mwifiex_shutdown_drv()
626 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_shutdown_drv()
627 priv = adapter->priv[i]; in mwifiex_shutdown_drv()
634 atomic_set(&adapter->tx_queued, 0); in mwifiex_shutdown_drv()
635 while ((skb = skb_dequeue(&adapter->tx_data_q))) in mwifiex_shutdown_drv()
636 mwifiex_write_data_complete(adapter, skb, 0, 0); in mwifiex_shutdown_drv()
638 spin_lock_bh(&adapter->rx_proc_lock); in mwifiex_shutdown_drv()
640 while ((skb = skb_dequeue(&adapter->rx_data_q))) { in mwifiex_shutdown_drv()
643 atomic_dec(&adapter->rx_pending); in mwifiex_shutdown_drv()
644 priv = adapter->priv[rx_info->bss_num]; in mwifiex_shutdown_drv()
651 spin_unlock_bh(&adapter->rx_proc_lock); in mwifiex_shutdown_drv()
653 mwifiex_adapter_cleanup(adapter); in mwifiex_shutdown_drv()
655 adapter->hw_status = MWIFIEX_HW_STATUS_NOT_READY; in mwifiex_shutdown_drv()
670 int mwifiex_dnld_fw(struct mwifiex_adapter *adapter, in mwifiex_dnld_fw() argument
677 ret = adapter->if_ops.check_fw_status(adapter, poll_num); in mwifiex_dnld_fw()
679 mwifiex_dbg(adapter, MSG, in mwifiex_dnld_fw()
685 if (adapter->if_ops.check_winner_status) { in mwifiex_dnld_fw()
686 adapter->winner = 0; in mwifiex_dnld_fw()
687 ret = adapter->if_ops.check_winner_status(adapter); in mwifiex_dnld_fw()
691 mwifiex_dbg(adapter, MSG, in mwifiex_dnld_fw()
696 if (!adapter->winner) { in mwifiex_dnld_fw()
697 mwifiex_dbg(adapter, MSG, in mwifiex_dnld_fw()
705 ret = adapter->if_ops.prog_fw(adapter, pmfw); in mwifiex_dnld_fw()
707 mwifiex_dbg(adapter, ERROR, in mwifiex_dnld_fw()
715 ret = adapter->if_ops.check_fw_status(adapter, poll_num); in mwifiex_dnld_fw()
717 mwifiex_dbg(adapter, ERROR, in mwifiex_dnld_fw()