Lines Matching refs:wvif

46 static void wfx_filter_beacon(struct wfx_vif *wvif, bool filter_beacon)  in wfx_filter_beacon()  argument
74 wfx_hif_beacon_filter_control(wvif, 0, 1); in wfx_filter_beacon()
76 wfx_hif_set_beacon_filter_table(wvif, ARRAY_SIZE(filter_ies), filter_ies); in wfx_filter_beacon()
77 wfx_hif_beacon_filter_control(wvif, HIF_BEACON_FILTER_ENABLE, 0); in wfx_filter_beacon()
87 struct wfx_vif *wvif = NULL; in wfx_configure_filter() local
105 while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { in wfx_configure_filter()
113 wfx_filter_beacon(wvif, filter_beacon); in wfx_configure_filter()
120 vif = wvif_to_vif(wvif); in wfx_configure_filter()
131 wfx_hif_set_rx_filter(wvif, filter_bssid, filter_prbreq); in wfx_configure_filter()
136 static int wfx_get_ps_timeout(struct wfx_vif *wvif, bool *enable_ps) in wfx_get_ps_timeout() argument
139 struct ieee80211_conf *conf = &wvif->wdev->hw->conf; in wfx_get_ps_timeout()
140 struct ieee80211_vif *vif = wvif_to_vif(wvif); in wfx_get_ps_timeout()
144 if (wdev_to_wvif(wvif->wdev, 0)) { in wfx_get_ps_timeout()
145 struct wfx_vif *wvif_ch0 = wdev_to_wvif(wvif->wdev, 0); in wfx_get_ps_timeout()
150 if (wdev_to_wvif(wvif->wdev, 1)) { in wfx_get_ps_timeout()
151 struct wfx_vif *wvif_ch1 = wdev_to_wvif(wvif->wdev, 1); in wfx_get_ps_timeout()
162 dev_info(wvif->wdev->dev, "ignoring requested PS mode"); in wfx_get_ps_timeout()
168 if (wfx_api_older_than(wvif->wdev, 3, 2)) in wfx_get_ps_timeout()
181 int wfx_update_pm(struct wfx_vif *wvif) in wfx_update_pm() argument
183 struct ieee80211_vif *vif = wvif_to_vif(wvif); in wfx_update_pm()
189 ps_timeout = wfx_get_ps_timeout(wvif, &ps); in wfx_update_pm()
193 if (wvif->uapsd_mask) in wfx_update_pm()
196 if (!wait_for_completion_timeout(&wvif->set_pm_mode_complete, TU_TO_JIFFIES(512))) in wfx_update_pm()
197 dev_warn(wvif->wdev->dev, "timeout while waiting of set_pm_mode_complete\n"); in wfx_update_pm()
198 return wfx_hif_set_pm(wvif, ps, ps_timeout); in wfx_update_pm()
206 struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; in wfx_conf_tx() local
207 int old_uapsd = wvif->uapsd_mask; in wfx_conf_tx()
212 assign_bit(queue, &wvif->uapsd_mask, params->uapsd); in wfx_conf_tx()
213 wfx_hif_set_edca_queue_params(wvif, queue, params); in wfx_conf_tx()
215 old_uapsd != wvif->uapsd_mask) { in wfx_conf_tx()
216 wfx_hif_set_uapsd_info(wvif, wvif->uapsd_mask); in wfx_conf_tx()
217 wfx_update_pm(wvif); in wfx_conf_tx()
226 struct wfx_vif *wvif = NULL; in wfx_set_rts_threshold() local
228 while ((wvif = wvif_iterate(wdev, wvif)) != NULL) in wfx_set_rts_threshold()
229 wfx_hif_rts_threshold(wvif, value); in wfx_set_rts_threshold()
233 void wfx_event_report_rssi(struct wfx_vif *wvif, u8 raw_rcpi_rssi) in wfx_event_report_rssi() argument
238 struct ieee80211_vif *vif = wvif_to_vif(wvif); in wfx_event_report_rssi()
252 struct wfx_vif *wvif = container_of(to_delayed_work(work), struct wfx_vif, in wfx_beacon_loss_work() local
254 struct ieee80211_vif *vif = wvif_to_vif(wvif); in wfx_beacon_loss_work()
263 struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; in wfx_set_default_unicast_key() local
265 wfx_hif_wep_default_key_id(wvif, idx); in wfx_set_default_unicast_key()
268 void wfx_reset(struct wfx_vif *wvif) in wfx_reset() argument
270 struct wfx_dev *wdev = wvif->wdev; in wfx_reset()
273 wfx_hif_reset(wvif, false); in wfx_reset()
274 wfx_tx_policy_init(wvif); in wfx_reset()
276 wfx_hif_set_block_ack_policy(wvif, 0xFF, 0xFF); in wfx_reset()
278 wvif->join_in_progress = false; in wfx_reset()
279 cancel_delayed_work_sync(&wvif->beacon_loss_work); in wfx_reset()
280 wvif = NULL; in wfx_reset()
281 while ((wvif = wvif_iterate(wdev, wvif)) != NULL) in wfx_reset()
282 wfx_update_pm(wvif); in wfx_reset()
287 struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; in wfx_sta_add() local
290 sta_priv->vif_id = wvif->id; in wfx_sta_add()
293 wfx_hif_set_mfp(wvif, sta->mfp, sta->mfp); in wfx_sta_add()
298 sta_priv->link_id = ffz(wvif->link_id_map); in wfx_sta_add()
299 wvif->link_id_map |= BIT(sta_priv->link_id); in wfx_sta_add()
302 wfx_hif_map_link(wvif, false, sta->addr, sta_priv->link_id, sta->mfp); in wfx_sta_add()
309 struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; in wfx_sta_remove() local
316 wfx_hif_map_link(wvif, true, sta->addr, sta_priv->link_id, false); in wfx_sta_remove()
317 wvif->link_id_map &= ~BIT(sta_priv->link_id); in wfx_sta_remove()
321 static int wfx_upload_ap_templates(struct wfx_vif *wvif) in wfx_upload_ap_templates() argument
323 struct ieee80211_vif *vif = wvif_to_vif(wvif); in wfx_upload_ap_templates()
326 skb = ieee80211_beacon_get(wvif->wdev->hw, vif, 0); in wfx_upload_ap_templates()
329 wfx_hif_set_template_frame(wvif, skb, HIF_TMPLT_BCN, API_RATE_INDEX_B_1MBPS); in wfx_upload_ap_templates()
332 skb = ieee80211_proberesp_get(wvif->wdev->hw, vif); in wfx_upload_ap_templates()
335 wfx_hif_set_template_frame(wvif, skb, HIF_TMPLT_PRBRES, API_RATE_INDEX_B_1MBPS); in wfx_upload_ap_templates()
340 static int wfx_set_mfp_ap(struct wfx_vif *wvif) in wfx_set_mfp_ap() argument
342 struct ieee80211_vif *vif = wvif_to_vif(wvif); in wfx_set_mfp_ap()
343 struct sk_buff *skb = ieee80211_beacon_get(wvif->wdev->hw, vif, 0); in wfx_set_mfp_ap()
374 wfx_hif_set_mfp(wvif, *ptr & BIT(7), *ptr & BIT(6)); in wfx_set_mfp_ap()
385 struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; in wfx_start_ap() local
386 struct wfx_dev *wdev = wvif->wdev; in wfx_start_ap()
389 wvif = NULL; in wfx_start_ap()
390 while ((wvif = wvif_iterate(wdev, wvif)) != NULL) in wfx_start_ap()
391 wfx_update_pm(wvif); in wfx_start_ap()
392 wvif = (struct wfx_vif *)vif->drv_priv; in wfx_start_ap()
393 wfx_upload_ap_templates(wvif); in wfx_start_ap()
394 ret = wfx_hif_start(wvif, &vif->bss_conf, wvif->channel); in wfx_start_ap()
397 return wfx_set_mfp_ap(wvif); in wfx_start_ap()
403 struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; in wfx_stop_ap() local
404 struct wfx_dev *wdev = wvif->wdev; in wfx_stop_ap()
406 wvif = NULL; in wfx_stop_ap()
407 while ((wvif = wvif_iterate(wdev, wvif)) != NULL) in wfx_stop_ap()
408 wfx_update_pm(wvif); in wfx_stop_ap()
409 wvif = (struct wfx_vif *)vif->drv_priv; in wfx_stop_ap()
410 wfx_reset(wvif); in wfx_stop_ap()
413 static void wfx_join(struct wfx_vif *wvif) in wfx_join() argument
415 struct ieee80211_vif *vif = wvif_to_vif(wvif); in wfx_join()
423 wfx_tx_lock_flush(wvif->wdev); in wfx_join()
425 bss = cfg80211_get_bss(wvif->wdev->hw->wiphy, wvif->channel, conf->bssid, NULL, 0, in wfx_join()
428 wfx_tx_unlock(wvif->wdev); in wfx_join()
443 cfg80211_put_bss(wvif->wdev->hw->wiphy, bss); in wfx_join()
445 wvif->join_in_progress = true; in wfx_join()
446 ret = wfx_hif_join(wvif, conf, wvif->channel, ssid, ssid_len); in wfx_join()
449 wfx_reset(wvif); in wfx_join()
455 wfx_filter_beacon(wvif, false); in wfx_join()
457 wfx_tx_unlock(wvif->wdev); in wfx_join()
460 static void wfx_join_finalize(struct wfx_vif *wvif, struct ieee80211_bss_conf *info) in wfx_join_finalize() argument
462 struct ieee80211_vif *vif = wvif_to_vif(wvif); in wfx_join_finalize()
477 wvif->join_in_progress = false; in wfx_join_finalize()
478 wfx_hif_set_association_mode(wvif, ampdu_density, greenfield, info->use_short_preamble); in wfx_join_finalize()
479 wfx_hif_keep_alive_period(wvif, 0); in wfx_join_finalize()
481 wfx_hif_set_bss_params(wvif, vif->cfg.aid, 7); in wfx_join_finalize()
482 wfx_hif_set_beacon_wakeup_period(wvif, 1, 1); in wfx_join_finalize()
483 wfx_update_pm(wvif); in wfx_join_finalize()
488 struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; in wfx_join_ibss() local
490 wfx_upload_ap_templates(wvif); in wfx_join_ibss()
491 wfx_join(wvif); in wfx_join_ibss()
497 struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; in wfx_leave_ibss() local
499 wfx_reset(wvif); in wfx_leave_ibss()
502 static void wfx_enable_beacon(struct wfx_vif *wvif, bool enable) in wfx_enable_beacon() argument
508 if (!enable && wfx_tx_queues_has_cab(wvif)) { in wfx_enable_beacon()
509 wvif->after_dtim_tx_allowed = true; in wfx_enable_beacon()
510 wfx_bh_request_tx(wvif->wdev); in wfx_enable_beacon()
512 wfx_hif_beacon_transmit(wvif, enable); in wfx_enable_beacon()
519 struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; in wfx_bss_info_changed() local
528 wfx_join(wvif); in wfx_bss_info_changed()
533 wfx_join_finalize(wvif, info); in wfx_bss_info_changed()
535 wfx_reset(wvif); in wfx_bss_info_changed()
543 wfx_hif_set_beacon_wakeup_period(wvif, info->dtim_period, info->dtim_period); in wfx_bss_info_changed()
545 wfx_filter_beacon(wvif, true); in wfx_bss_info_changed()
556 wfx_hif_set_arp_ipv4_filter(wvif, i, arp_addr); in wfx_bss_info_changed()
561 wfx_upload_ap_templates(wvif); in wfx_bss_info_changed()
564 wfx_enable_beacon(wvif, info->enable_beacon); in wfx_bss_info_changed()
567 wfx_hif_keep_alive_period(wvif, in wfx_bss_info_changed()
571 wfx_hif_erp_use_protection(wvif, info->use_cts_prot); in wfx_bss_info_changed()
574 wfx_hif_slot_time(wvif, info->use_short_slot ? 9 : 20); in wfx_bss_info_changed()
577 wfx_hif_set_rcpi_rssi_threshold(wvif, info->cqm_rssi_thold, info->cqm_rssi_hyst); in wfx_bss_info_changed()
580 wfx_hif_set_output_power(wvif, info->txpower); in wfx_bss_info_changed()
583 wfx_update_pm(wvif); in wfx_bss_info_changed()
588 static int wfx_update_tim(struct wfx_vif *wvif) in wfx_update_tim() argument
590 struct ieee80211_vif *vif = wvif_to_vif(wvif); in wfx_update_tim()
595 skb = ieee80211_beacon_get_tim(wvif->wdev->hw, vif, &tim_offset, in wfx_update_tim()
606 if (wfx_tx_queues_has_cab(wvif)) in wfx_update_tim()
612 wfx_hif_update_ie_beacon(wvif, tim_ptr, tim_length); in wfx_update_tim()
620 struct wfx_vif *wvif = container_of(work, struct wfx_vif, update_tim_work); in wfx_update_tim_work() local
622 wfx_update_tim(wvif); in wfx_update_tim_work()
629 struct wfx_vif *wvif = wdev_to_wvif(wdev, sta_dev->vif_id); in wfx_set_tim() local
631 if (!wvif) { in wfx_set_tim()
635 schedule_work(&wvif->update_tim_work); in wfx_set_tim()
639 void wfx_suspend_resume_mc(struct wfx_vif *wvif, enum sta_notify_cmd notify_cmd) in wfx_suspend_resume_mc() argument
647 if (mutex_is_locked(&wvif->wdev->scan_lock)) in wfx_suspend_resume_mc()
650 if (!wfx_tx_queues_has_cab(wvif) || wvif->after_dtim_tx_allowed) in wfx_suspend_resume_mc()
651 dev_warn(wvif->wdev->dev, "incorrect sequence (%d CAB in queue)", in wfx_suspend_resume_mc()
652 wfx_tx_queues_has_cab(wvif)); in wfx_suspend_resume_mc()
653 wvif->after_dtim_tx_allowed = true; in wfx_suspend_resume_mc()
654 wfx_bh_request_tx(wvif->wdev); in wfx_suspend_resume_mc()
689 struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; in wfx_assign_vif_chanctx() local
692 WARN(wvif->channel, "channel overwrite"); in wfx_assign_vif_chanctx()
693 wvif->channel = ch; in wfx_assign_vif_chanctx()
702 struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; in wfx_unassign_vif_chanctx() local
705 WARN(wvif->channel != ch, "channel mismatch"); in wfx_unassign_vif_chanctx()
706 wvif->channel = NULL; in wfx_unassign_vif_chanctx()
718 struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; in wfx_add_interface() local
736 wvif->wdev = wdev; in wfx_add_interface()
738 wvif->link_id_map = 1; /* link-id 0 is reserved for multicast */ in wfx_add_interface()
739 INIT_WORK(&wvif->update_tim_work, wfx_update_tim_work); in wfx_add_interface()
740 INIT_DELAYED_WORK(&wvif->beacon_loss_work, wfx_beacon_loss_work); in wfx_add_interface()
742 init_completion(&wvif->set_pm_mode_complete); in wfx_add_interface()
743 complete(&wvif->set_pm_mode_complete); in wfx_add_interface()
744 INIT_WORK(&wvif->tx_policy_upload_work, wfx_tx_policy_upload_work); in wfx_add_interface()
746 init_completion(&wvif->scan_complete); in wfx_add_interface()
747 INIT_WORK(&wvif->scan_work, wfx_hw_scan_work); in wfx_add_interface()
748 INIT_WORK(&wvif->remain_on_channel_work, wfx_remain_on_channel_work); in wfx_add_interface()
750 wfx_tx_queues_init(wvif); in wfx_add_interface()
751 wfx_tx_policy_init(wvif); in wfx_add_interface()
756 wvif->id = i; in wfx_add_interface()
762 wfx_hif_set_macaddr(wvif, vif->addr); in wfx_add_interface()
766 wvif = NULL; in wfx_add_interface()
767 while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { in wfx_add_interface()
770 wfx_hif_set_block_ack_policy(wvif, 0xFF, 0xFF); in wfx_add_interface()
772 wfx_hif_set_block_ack_policy(wvif, 0x00, 0x00); in wfx_add_interface()
780 struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; in wfx_remove_interface() local
782 wait_for_completion_timeout(&wvif->set_pm_mode_complete, msecs_to_jiffies(300)); in wfx_remove_interface()
783 wfx_tx_queues_check_empty(wvif); in wfx_remove_interface()
786 WARN(wvif->link_id_map != 1, "corrupted state"); in wfx_remove_interface()
788 wfx_hif_reset(wvif, false); in wfx_remove_interface()
789 wfx_hif_set_macaddr(wvif, NULL); in wfx_remove_interface()
790 wfx_tx_policy_init(wvif); in wfx_remove_interface()
792 cancel_delayed_work_sync(&wvif->beacon_loss_work); in wfx_remove_interface()
793 wdev->vif[wvif->id] = NULL; in wfx_remove_interface()
797 wvif = NULL; in wfx_remove_interface()
798 while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { in wfx_remove_interface()
801 wfx_hif_set_block_ack_policy(wvif, 0xFF, 0xFF); in wfx_remove_interface()
803 wfx_hif_set_block_ack_policy(wvif, 0x00, 0x00); in wfx_remove_interface()