Lines Matching refs:wlvif
44 static void wl1271_free_ap_keys(struct wl1271 *wl, struct wl12xx_vif *wlvif);
46 static int wl12xx_set_authorized(struct wl1271 *wl, struct wl12xx_vif *wlvif) in wl12xx_set_authorized() argument
50 if (WARN_ON(wlvif->bss_type != BSS_TYPE_STA_BSS)) in wl12xx_set_authorized()
53 if (!test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) in wl12xx_set_authorized()
56 if (test_and_set_bit(WLVIF_FLAG_STA_STATE_SENT, &wlvif->flags)) in wl12xx_set_authorized()
59 ret = wl12xx_cmd_set_peer_state(wl, wlvif, wlvif->sta.hlid); in wl12xx_set_authorized()
80 static int wl1271_set_rx_streaming(struct wl1271 *wl, struct wl12xx_vif *wlvif, in wl1271_set_rx_streaming() argument
86 ret = wl1271_acx_ps_rx_streaming(wl, wlvif, enable); in wl1271_set_rx_streaming()
91 set_bit(WLVIF_FLAG_RX_STREAMING_STARTED, &wlvif->flags); in wl1271_set_rx_streaming()
93 clear_bit(WLVIF_FLAG_RX_STREAMING_STARTED, &wlvif->flags); in wl1271_set_rx_streaming()
102 int wl1271_recalc_rx_streaming(struct wl1271 *wl, struct wl12xx_vif *wlvif) in wl1271_recalc_rx_streaming() argument
108 if (!test_bit(WLVIF_FLAG_RX_STREAMING_STARTED, &wlvif->flags)) in wl1271_recalc_rx_streaming()
113 test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags) && in wl1271_recalc_rx_streaming()
116 ret = wl1271_set_rx_streaming(wl, wlvif, true); in wl1271_recalc_rx_streaming()
118 ret = wl1271_set_rx_streaming(wl, wlvif, false); in wl1271_recalc_rx_streaming()
120 del_timer_sync(&wlvif->rx_streaming_timer); in wl1271_recalc_rx_streaming()
129 struct wl12xx_vif *wlvif = container_of(work, struct wl12xx_vif, in wl1271_rx_streaming_enable_work() local
131 struct wl1271 *wl = wlvif->wl; in wl1271_rx_streaming_enable_work()
135 if (test_bit(WLVIF_FLAG_RX_STREAMING_STARTED, &wlvif->flags) || in wl1271_rx_streaming_enable_work()
136 !test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags) || in wl1271_rx_streaming_enable_work()
148 ret = wl1271_set_rx_streaming(wl, wlvif, true); in wl1271_rx_streaming_enable_work()
153 mod_timer(&wlvif->rx_streaming_timer, in wl1271_rx_streaming_enable_work()
166 struct wl12xx_vif *wlvif = container_of(work, struct wl12xx_vif, in wl1271_rx_streaming_disable_work() local
168 struct wl1271 *wl = wlvif->wl; in wl1271_rx_streaming_disable_work()
172 if (!test_bit(WLVIF_FLAG_RX_STREAMING_STARTED, &wlvif->flags)) in wl1271_rx_streaming_disable_work()
179 ret = wl1271_set_rx_streaming(wl, wlvif, false); in wl1271_rx_streaming_disable_work()
192 struct wl12xx_vif *wlvif = from_timer(wlvif, t, rx_streaming_timer); in wl1271_rx_streaming_timer() local
193 struct wl1271 *wl = wlvif->wl; in wl1271_rx_streaming_timer()
194 ieee80211_queue_work(wl->hw, &wlvif->rx_streaming_disable_work); in wl1271_rx_streaming_timer()
212 struct wl12xx_vif *wlvif = container_of(work, struct wl12xx_vif, in wlcore_rc_update_work() local
214 struct wl1271 *wl = wlvif->wl; in wlcore_rc_update_work()
215 struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); in wlcore_rc_update_work()
227 ret = wl1271_acx_set_ht_capabilities(wl, &wlvif->rc_ht_cap, in wlcore_rc_update_work()
228 true, wlvif->sta.hlid); in wlcore_rc_update_work()
232 wlcore_hw_sta_rc_update(wl, wlvif); in wlcore_rc_update_work()
330 struct wl12xx_vif *wlvif, in wl12xx_irq_ps_regulate_link() argument
342 wl12xx_ps_link_end(wl, wlvif, hlid); in wl12xx_irq_ps_regulate_link()
355 wl12xx_ps_link_start(wl, wlvif, hlid, true); in wl12xx_irq_ps_regulate_link()
359 struct wl12xx_vif *wlvif, in wl12xx_irq_update_links_status() argument
375 for_each_set_bit(hlid, wlvif->ap.sta_hlid_map, wl->num_links) in wl12xx_irq_update_links_status()
376 wl12xx_irq_ps_regulate_link(wl, wlvif, hlid, in wl12xx_irq_update_links_status()
382 struct wl12xx_vif *wlvif; in wlcore_fw_status() local
474 wl12xx_for_each_wlvif_ap(wl, wlvif) { in wlcore_fw_status()
475 wl12xx_irq_update_links_status(wl, wlvif, status); in wlcore_fw_status()
850 static void wlcore_save_freed_pkts(struct wl1271 *wl, struct wl12xx_vif *wlvif, in wlcore_save_freed_pkts() argument
863 if (wlvif->encryption_type == KEY_GEM) in wlcore_save_freed_pkts()
871 struct wl12xx_vif *wlvif, in wlcore_save_freed_pkts_addr() argument
875 struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); in wlcore_save_freed_pkts_addr()
884 wlcore_save_freed_pkts(wl, wlvif, hlid, sta); in wlcore_save_freed_pkts_addr()
921 struct wl12xx_vif *wlvif; in wl1271_recovery_work() local
956 wlvif = list_first_entry(&wl->wlvif_list, in wl1271_recovery_work()
958 vif = wl12xx_wlvif_to_vif(wlvif); in wl1271_recovery_work()
960 if (wlvif->bss_type == BSS_TYPE_STA_BSS && in wl1271_recovery_work()
961 test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) { in wl1271_recovery_work()
962 wlcore_save_freed_pkts_addr(wl, wlvif, wlvif->sta.hlid, in wl1271_recovery_work()
1206 struct wl12xx_vif *wlvif = NULL; in wl1271_op_tx() local
1217 wlvif = wl12xx_vif_to_data(vif); in wl1271_op_tx()
1221 hlid = wl12xx_tx_get_hlid(wl, wlvif, skb, control->sta); in wl1271_op_tx()
1231 (!test_bit(hlid, wlvif->links_map)) || in wl1271_op_tx()
1232 (wlcore_is_queue_stopped_locked(wl, wlvif, q) && in wl1271_op_tx()
1233 !wlcore_is_queue_stopped_by_reason_locked(wl, wlvif, q, in wl1271_op_tx()
1245 wlvif->tx_queue_count[q]++; in wl1271_op_tx()
1251 if (wlvif->tx_queue_count[q] >= WL1271_TX_QUEUE_HIGH_WATERMARK && in wl1271_op_tx()
1252 !wlcore_is_queue_stopped_by_reason_locked(wl, wlvif, q, in wl1271_op_tx()
1255 wlcore_stop_queue_locked(wl, wlvif, q, in wl1271_op_tx()
1614 struct wl12xx_vif *wlvif, in wl1271_configure_suspend_sta() argument
1619 if (!test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) in wl1271_configure_suspend_sta()
1632 ret = wl1271_acx_wake_up_conditions(wl, wlvif, in wl1271_configure_suspend_sta()
1644 struct wl12xx_vif *wlvif, in wl1271_configure_suspend_ap() argument
1649 if (!test_bit(WLVIF_FLAG_AP_STARTED, &wlvif->flags)) in wl1271_configure_suspend_ap()
1652 ret = wl1271_acx_beacon_filter_opt(wl, wlvif, true); in wl1271_configure_suspend_ap()
1666 struct wl12xx_vif *wlvif, in wl1271_configure_suspend() argument
1669 if (wlvif->bss_type == BSS_TYPE_STA_BSS) in wl1271_configure_suspend()
1670 return wl1271_configure_suspend_sta(wl, wlvif, wow); in wl1271_configure_suspend()
1671 if (wlvif->bss_type == BSS_TYPE_AP_BSS) in wl1271_configure_suspend()
1672 return wl1271_configure_suspend_ap(wl, wlvif, wow); in wl1271_configure_suspend()
1676 static void wl1271_configure_resume(struct wl1271 *wl, struct wl12xx_vif *wlvif) in wl1271_configure_resume() argument
1679 bool is_ap = wlvif->bss_type == BSS_TYPE_AP_BSS; in wl1271_configure_resume()
1680 bool is_sta = wlvif->bss_type == BSS_TYPE_STA_BSS; in wl1271_configure_resume()
1685 if ((is_sta && !test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) || in wl1271_configure_resume()
1686 (is_ap && !test_bit(WLVIF_FLAG_AP_STARTED, &wlvif->flags))) in wl1271_configure_resume()
1698 ret = wl1271_acx_wake_up_conditions(wl, wlvif, in wl1271_configure_resume()
1707 ret = wl1271_acx_beacon_filter_opt(wl, wlvif, false); in wl1271_configure_resume()
1715 struct wl12xx_vif *wlvif; in wl1271_op_suspend() local
1739 wl12xx_for_each_wlvif(wl, wlvif) { in wl1271_op_suspend()
1740 if (wlcore_is_p2p_mgmt(wlvif)) in wl1271_op_suspend()
1743 ret = wl1271_configure_suspend(wl, wlvif, wow); in wl1271_op_suspend()
1794 struct wl12xx_vif *wlvif; in wl1271_op_resume() local
1849 wl12xx_for_each_wlvif(wl, wlvif) { in wl1271_op_resume()
1850 if (wlcore_is_p2p_mgmt(wlvif)) in wl1271_op_resume()
1853 wl1271_configure_resume(wl, wlvif); in wl1271_op_resume()
2027 struct wl12xx_vif *wlvif; in wlcore_channel_switch_work() local
2031 wlvif = container_of(dwork, struct wl12xx_vif, channel_switch_work); in wlcore_channel_switch_work()
2032 wl = wlvif->wl; in wlcore_channel_switch_work()
2034 wl1271_info("channel switch failed (role_id: %d).", wlvif->role_id); in wlcore_channel_switch_work()
2042 if (!test_and_clear_bit(WLVIF_FLAG_CS_PROGRESS, &wlvif->flags)) in wlcore_channel_switch_work()
2045 vif = wl12xx_wlvif_to_vif(wlvif); in wlcore_channel_switch_work()
2052 wl12xx_cmd_stop_channel_switch(wl, wlvif); in wlcore_channel_switch_work()
2065 struct wl12xx_vif *wlvif; in wlcore_connection_loss_work() local
2068 wlvif = container_of(dwork, struct wl12xx_vif, connection_loss_work); in wlcore_connection_loss_work()
2069 wl = wlvif->wl; in wlcore_connection_loss_work()
2071 wl1271_info("Connection loss work (role_id: %d).", wlvif->role_id); in wlcore_connection_loss_work()
2079 if (!test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) in wlcore_connection_loss_work()
2082 vif = wl12xx_wlvif_to_vif(wlvif); in wlcore_connection_loss_work()
2092 struct wl12xx_vif *wlvif; in wlcore_pending_auth_complete_work() local
2097 wlvif = container_of(dwork, struct wl12xx_vif, in wlcore_pending_auth_complete_work()
2099 wl = wlvif->wl; in wlcore_pending_auth_complete_work()
2114 if (!time_after(time_spare, wlvif->pending_auth_reply_time)) in wlcore_pending_auth_complete_work()
2122 wlcore_update_inconn_sta(wl, wlvif, NULL, false); in wlcore_pending_auth_complete_work()
2172 static u8 wl12xx_get_role_type(struct wl1271 *wl, struct wl12xx_vif *wlvif) in wl12xx_get_role_type() argument
2174 struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); in wl12xx_get_role_type()
2176 switch (wlvif->bss_type) { in wl12xx_get_role_type()
2178 if (wlvif->p2p) in wl12xx_get_role_type()
2186 if (wlvif->p2p) in wl12xx_get_role_type()
2195 wl1271_error("invalid bss_type: %d", wlvif->bss_type); in wl12xx_get_role_type()
2202 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wl12xx_init_vif_data() local
2206 memset(wlvif, 0, offsetof(struct wl12xx_vif, persistent)); in wl12xx_init_vif_data()
2210 wlvif->p2p = 1; in wl12xx_init_vif_data()
2214 wlvif->bss_type = BSS_TYPE_STA_BSS; in wl12xx_init_vif_data()
2217 wlvif->bss_type = BSS_TYPE_IBSS; in wl12xx_init_vif_data()
2220 wlvif->p2p = 1; in wl12xx_init_vif_data()
2224 wlvif->bss_type = BSS_TYPE_AP_BSS; in wl12xx_init_vif_data()
2227 wlvif->bss_type = MAX_BSS_TYPE; in wl12xx_init_vif_data()
2231 wlvif->role_id = WL12XX_INVALID_ROLE_ID; in wl12xx_init_vif_data()
2232 wlvif->dev_role_id = WL12XX_INVALID_ROLE_ID; in wl12xx_init_vif_data()
2233 wlvif->dev_hlid = WL12XX_INVALID_LINK_ID; in wl12xx_init_vif_data()
2235 if (wlvif->bss_type == BSS_TYPE_STA_BSS || in wl12xx_init_vif_data()
2236 wlvif->bss_type == BSS_TYPE_IBSS) { in wl12xx_init_vif_data()
2238 wlvif->sta.hlid = WL12XX_INVALID_LINK_ID; in wl12xx_init_vif_data()
2239 wl12xx_allocate_rate_policy(wl, &wlvif->sta.basic_rate_idx); in wl12xx_init_vif_data()
2240 wl12xx_allocate_rate_policy(wl, &wlvif->sta.ap_rate_idx); in wl12xx_init_vif_data()
2241 wl12xx_allocate_rate_policy(wl, &wlvif->sta.p2p_rate_idx); in wl12xx_init_vif_data()
2242 wlcore_allocate_klv_template(wl, &wlvif->sta.klv_template_id); in wl12xx_init_vif_data()
2243 wlvif->basic_rate_set = CONF_TX_RATE_MASK_BASIC; in wl12xx_init_vif_data()
2244 wlvif->basic_rate = CONF_TX_RATE_MASK_BASIC; in wl12xx_init_vif_data()
2245 wlvif->rate_set = CONF_TX_RATE_MASK_BASIC; in wl12xx_init_vif_data()
2248 wlvif->ap.bcast_hlid = WL12XX_INVALID_LINK_ID; in wl12xx_init_vif_data()
2249 wlvif->ap.global_hlid = WL12XX_INVALID_LINK_ID; in wl12xx_init_vif_data()
2250 wl12xx_allocate_rate_policy(wl, &wlvif->ap.mgmt_rate_idx); in wl12xx_init_vif_data()
2251 wl12xx_allocate_rate_policy(wl, &wlvif->ap.bcast_rate_idx); in wl12xx_init_vif_data()
2254 &wlvif->ap.ucast_rate_idx[i]); in wl12xx_init_vif_data()
2255 wlvif->basic_rate_set = CONF_TX_ENABLED_RATES; in wl12xx_init_vif_data()
2261 wlvif->basic_rate = CONF_TX_ENABLED_RATES; in wl12xx_init_vif_data()
2263 wlvif->rate_set = CONF_TX_ENABLED_RATES; in wl12xx_init_vif_data()
2266 wlvif->bitrate_masks[NL80211_BAND_2GHZ] = wl->conf.tx.basic_rate; in wl12xx_init_vif_data()
2267 wlvif->bitrate_masks[NL80211_BAND_5GHZ] = wl->conf.tx.basic_rate_5; in wl12xx_init_vif_data()
2268 wlvif->beacon_int = WL1271_DEFAULT_BEACON_INT; in wl12xx_init_vif_data()
2274 wlvif->band = wl->band; in wl12xx_init_vif_data()
2275 wlvif->channel = wl->channel; in wl12xx_init_vif_data()
2276 wlvif->power_level = wl->power_level; in wl12xx_init_vif_data()
2277 wlvif->channel_type = wl->channel_type; in wl12xx_init_vif_data()
2279 INIT_WORK(&wlvif->rx_streaming_enable_work, in wl12xx_init_vif_data()
2281 INIT_WORK(&wlvif->rx_streaming_disable_work, in wl12xx_init_vif_data()
2283 INIT_WORK(&wlvif->rc_update_work, wlcore_rc_update_work); in wl12xx_init_vif_data()
2284 INIT_DELAYED_WORK(&wlvif->channel_switch_work, in wl12xx_init_vif_data()
2286 INIT_DELAYED_WORK(&wlvif->connection_loss_work, in wl12xx_init_vif_data()
2288 INIT_DELAYED_WORK(&wlvif->pending_auth_complete_work, in wl12xx_init_vif_data()
2290 INIT_LIST_HEAD(&wlvif->list); in wl12xx_init_vif_data()
2292 timer_setup(&wlvif->rx_streaming_timer, wl1271_rx_streaming_timer, 0); in wl12xx_init_vif_data()
2365 static bool wl12xx_dev_role_started(struct wl12xx_vif *wlvif) in wl12xx_dev_role_started() argument
2367 return wlvif->dev_hlid != WL12XX_INVALID_LINK_ID; in wl12xx_dev_role_started()
2415 struct wl12xx_vif *wlvif; in wl12xx_force_active_psm() local
2417 wl12xx_for_each_wlvif_sta(wl, wlvif) { in wl12xx_force_active_psm()
2418 wl1271_ps_set_mode(wl, wlvif, STATION_POWER_SAVE_MODE); in wl12xx_force_active_psm()
2448 struct wl12xx_vif *wlvif) in wlcore_allocate_hw_queue_base() argument
2450 struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); in wlcore_allocate_hw_queue_base()
2468 wlvif->hw_queue_base = vif->hw_queue[0]; in wlcore_allocate_hw_queue_base()
2471 wlvif->hw_queue_base); in wlcore_allocate_hw_queue_base()
2482 wlvif->hw_queue_base = q_base * NUM_TX_QUEUES; in wlcore_allocate_hw_queue_base()
2484 wlvif->hw_queue_base); in wlcore_allocate_hw_queue_base()
2487 wl->queue_stop_reasons[wlvif->hw_queue_base + i] = 0; in wlcore_allocate_hw_queue_base()
2489 vif->hw_queue[i] = wlvif->hw_queue_base + i; in wlcore_allocate_hw_queue_base()
2494 if (wlvif->bss_type == BSS_TYPE_AP_BSS) in wlcore_allocate_hw_queue_base()
2496 wlvif->hw_queue_base / NUM_TX_QUEUES; in wlcore_allocate_hw_queue_base()
2507 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wl1271_op_add_interface() local
2534 test_bit(WLVIF_FLAG_INITIALIZED, &wlvif->flags)) { in wl1271_op_add_interface()
2544 wlvif->wl = wl; in wl1271_op_add_interface()
2545 role_type = wl12xx_get_role_type(wl, wlvif); in wl1271_op_add_interface()
2551 ret = wlcore_allocate_hw_queue_base(wl, wlvif); in wl1271_op_add_interface()
2587 if (!wlcore_is_p2p_mgmt(wlvif)) { in wl1271_op_add_interface()
2589 role_type, &wlvif->role_id); in wl1271_op_add_interface()
2599 &wlvif->dev_role_id); in wl1271_op_add_interface()
2604 ret = wl1271_sta_hw_init(wl, wlvif); in wl1271_op_add_interface()
2609 list_add(&wlvif->list, &wl->wlvif_list); in wl1271_op_add_interface()
2610 set_bit(WLVIF_FLAG_INITIALIZED, &wlvif->flags); in wl1271_op_add_interface()
2612 if (wlvif->bss_type == BSS_TYPE_AP_BSS) in wl1271_op_add_interface()
2629 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in __wl1271_op_remove_interface() local
2631 bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS); in __wl1271_op_remove_interface()
2635 if (!test_and_clear_bit(WLVIF_FLAG_INITIALIZED, &wlvif->flags)) in __wl1271_op_remove_interface()
2645 wl->scan_wlvif == wlvif) { in __wl1271_op_remove_interface()
2663 if (wl->sched_vif == wlvif) in __wl1271_op_remove_interface()
2677 if (wlvif->bss_type == BSS_TYPE_STA_BSS || in __wl1271_op_remove_interface()
2678 wlvif->bss_type == BSS_TYPE_IBSS) { in __wl1271_op_remove_interface()
2679 if (wl12xx_dev_role_started(wlvif)) in __wl1271_op_remove_interface()
2680 wl12xx_stop_dev(wl, wlvif); in __wl1271_op_remove_interface()
2683 if (!wlcore_is_p2p_mgmt(wlvif)) { in __wl1271_op_remove_interface()
2684 ret = wl12xx_cmd_role_disable(wl, &wlvif->role_id); in __wl1271_op_remove_interface()
2690 ret = wl12xx_cmd_role_disable(wl, &wlvif->dev_role_id); in __wl1271_op_remove_interface()
2701 wl12xx_tx_reset_wlvif(wl, wlvif); in __wl1271_op_remove_interface()
2704 wlvif->dev_hlid = WL12XX_INVALID_LINK_ID; in __wl1271_op_remove_interface()
2706 if (wlvif->bss_type == BSS_TYPE_STA_BSS || in __wl1271_op_remove_interface()
2707 wlvif->bss_type == BSS_TYPE_IBSS) { in __wl1271_op_remove_interface()
2708 wlvif->sta.hlid = WL12XX_INVALID_LINK_ID; in __wl1271_op_remove_interface()
2709 wl12xx_free_rate_policy(wl, &wlvif->sta.basic_rate_idx); in __wl1271_op_remove_interface()
2710 wl12xx_free_rate_policy(wl, &wlvif->sta.ap_rate_idx); in __wl1271_op_remove_interface()
2711 wl12xx_free_rate_policy(wl, &wlvif->sta.p2p_rate_idx); in __wl1271_op_remove_interface()
2712 wlcore_free_klv_template(wl, &wlvif->sta.klv_template_id); in __wl1271_op_remove_interface()
2714 wlvif->ap.bcast_hlid = WL12XX_INVALID_LINK_ID; in __wl1271_op_remove_interface()
2715 wlvif->ap.global_hlid = WL12XX_INVALID_LINK_ID; in __wl1271_op_remove_interface()
2716 wl12xx_free_rate_policy(wl, &wlvif->ap.mgmt_rate_idx); in __wl1271_op_remove_interface()
2717 wl12xx_free_rate_policy(wl, &wlvif->ap.bcast_rate_idx); in __wl1271_op_remove_interface()
2720 &wlvif->ap.ucast_rate_idx[i]); in __wl1271_op_remove_interface()
2721 wl1271_free_ap_keys(wl, wlvif); in __wl1271_op_remove_interface()
2724 dev_kfree_skb(wlvif->probereq); in __wl1271_op_remove_interface()
2725 wlvif->probereq = NULL; in __wl1271_op_remove_interface()
2726 if (wl->last_wlvif == wlvif) in __wl1271_op_remove_interface()
2728 list_del(&wlvif->list); in __wl1271_op_remove_interface()
2729 memset(wlvif->ap.sta_hlid_map, 0, sizeof(wlvif->ap.sta_hlid_map)); in __wl1271_op_remove_interface()
2730 wlvif->role_id = WL12XX_INVALID_ROLE_ID; in __wl1271_op_remove_interface()
2731 wlvif->dev_role_id = WL12XX_INVALID_ROLE_ID; in __wl1271_op_remove_interface()
2765 del_timer_sync(&wlvif->rx_streaming_timer); in __wl1271_op_remove_interface()
2766 cancel_work_sync(&wlvif->rx_streaming_enable_work); in __wl1271_op_remove_interface()
2767 cancel_work_sync(&wlvif->rx_streaming_disable_work); in __wl1271_op_remove_interface()
2768 cancel_work_sync(&wlvif->rc_update_work); in __wl1271_op_remove_interface()
2769 cancel_delayed_work_sync(&wlvif->connection_loss_work); in __wl1271_op_remove_interface()
2770 cancel_delayed_work_sync(&wlvif->channel_switch_work); in __wl1271_op_remove_interface()
2771 cancel_delayed_work_sync(&wlvif->pending_auth_complete_work); in __wl1271_op_remove_interface()
2780 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wl1271_op_remove_interface() local
2788 !test_bit(WLVIF_FLAG_INITIALIZED, &wlvif->flags)) in wl1271_op_remove_interface()
2796 if (iter != wlvif) in wl1271_op_remove_interface()
2802 WARN_ON(iter != wlvif); in wl1271_op_remove_interface()
2830 static int wlcore_join(struct wl1271 *wl, struct wl12xx_vif *wlvif) in wlcore_join() argument
2833 bool is_ibss = (wlvif->bss_type == BSS_TYPE_IBSS); in wlcore_join()
2844 if (test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) in wlcore_join()
2848 wlvif->encryption_type = KEY_NONE; in wlcore_join()
2851 ret = wl12xx_cmd_role_start_ibss(wl, wlvif); in wlcore_join()
2853 ret = wl12xx_cmd_role_start_sta(wl, wlvif); in wlcore_join()
2858 static int wl1271_ssid_set(struct wl12xx_vif *wlvif, struct sk_buff *skb, in wl1271_ssid_set() argument
2876 wlvif->ssid_len = ssid_len; in wl1271_ssid_set()
2877 memcpy(wlvif->ssid, ptr+2, ssid_len); in wl1271_ssid_set()
2881 static int wlcore_set_ssid(struct wl1271 *wl, struct wl12xx_vif *wlvif) in wlcore_set_ssid() argument
2883 struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); in wlcore_set_ssid()
2888 if (wlvif->bss_type != BSS_TYPE_STA_BSS) in wlcore_set_ssid()
2897 wl1271_ssid_set(wlvif, skb, ieoffset); in wlcore_set_ssid()
2903 static int wlcore_set_assoc(struct wl1271 *wl, struct wl12xx_vif *wlvif, in wlcore_set_assoc() argument
2910 wlvif->aid = bss_conf->aid; in wlcore_set_assoc()
2911 wlvif->channel_type = cfg80211_get_chandef_type(&bss_conf->chandef); in wlcore_set_assoc()
2912 wlvif->beacon_int = bss_conf->beacon_int; in wlcore_set_assoc()
2913 wlvif->wmm_enabled = bss_conf->qos; in wlcore_set_assoc()
2915 set_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags); in wlcore_set_assoc()
2923 ret = wl1271_cmd_build_ps_poll(wl, wlvif, wlvif->aid); in wlcore_set_assoc()
2930 dev_kfree_skb(wlvif->probereq); in wlcore_set_assoc()
2931 wlvif->probereq = wl1271_cmd_build_ap_probe_req(wl, in wlcore_set_assoc()
2932 wlvif, in wlcore_set_assoc()
2936 wl1271_ssid_set(wlvif, wlvif->probereq, ieoffset); in wlcore_set_assoc()
2939 ret = wl1271_acx_conn_monit_params(wl, wlvif, true); in wlcore_set_assoc()
2949 ret = wl1271_acx_keep_alive_mode(wl, wlvif, true); in wlcore_set_assoc()
2953 ret = wl1271_acx_aid(wl, wlvif, wlvif->aid); in wlcore_set_assoc()
2957 ret = wl12xx_cmd_build_klv_null_data(wl, wlvif); in wlcore_set_assoc()
2961 ret = wl1271_acx_keep_alive_config(wl, wlvif, in wlcore_set_assoc()
2962 wlvif->sta.klv_template_id, in wlcore_set_assoc()
2971 ret = wl1271_ps_set_mode(wl, wlvif, STATION_ACTIVE_MODE); in wlcore_set_assoc()
2976 wlvif->rate_set = in wlcore_set_assoc()
2979 wlvif->band); in wlcore_set_assoc()
2980 ret = wl1271_acx_sta_rate_policies(wl, wlvif); in wlcore_set_assoc()
2988 static int wlcore_unset_assoc(struct wl1271 *wl, struct wl12xx_vif *wlvif) in wlcore_unset_assoc() argument
2991 bool sta = wlvif->bss_type == BSS_TYPE_STA_BSS; in wlcore_unset_assoc()
2995 !test_and_clear_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) in wlcore_unset_assoc()
3000 test_and_clear_bit(WLVIF_FLAG_IBSS_JOINED, &wlvif->flags)) in wlcore_unset_assoc()
3005 wlvif->aid = 0; in wlcore_unset_assoc()
3008 dev_kfree_skb(wlvif->probereq); in wlcore_unset_assoc()
3009 wlvif->probereq = NULL; in wlcore_unset_assoc()
3012 ret = wl1271_acx_conn_monit_params(wl, wlvif, false); in wlcore_unset_assoc()
3017 ret = wl1271_acx_keep_alive_mode(wl, wlvif, false); in wlcore_unset_assoc()
3022 ret = wl1271_acx_beacon_filter_opt(wl, wlvif, false); in wlcore_unset_assoc()
3027 if (test_and_clear_bit(WLVIF_FLAG_CS_PROGRESS, &wlvif->flags)) { in wlcore_unset_assoc()
3028 struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); in wlcore_unset_assoc()
3030 wl12xx_cmd_stop_channel_switch(wl, wlvif); in wlcore_unset_assoc()
3032 cancel_delayed_work(&wlvif->channel_switch_work); in wlcore_unset_assoc()
3036 wl1271_acx_keep_alive_config(wl, wlvif, in wlcore_unset_assoc()
3037 wlvif->sta.klv_template_id, in wlcore_unset_assoc()
3043 static void wl1271_set_band_rate(struct wl1271 *wl, struct wl12xx_vif *wlvif) in wl1271_set_band_rate() argument
3045 wlvif->basic_rate_set = wlvif->bitrate_masks[wlvif->band]; in wl1271_set_band_rate()
3046 wlvif->rate_set = wlvif->basic_rate_set; in wl1271_set_band_rate()
3049 static void wl1271_sta_handle_idle(struct wl1271 *wl, struct wl12xx_vif *wlvif, in wl1271_sta_handle_idle() argument
3052 bool cur_idle = !test_bit(WLVIF_FLAG_ACTIVE, &wlvif->flags); in wl1271_sta_handle_idle()
3058 clear_bit(WLVIF_FLAG_ACTIVE, &wlvif->flags); in wl1271_sta_handle_idle()
3061 if (wl->sched_vif == wlvif) in wl1271_sta_handle_idle()
3062 wl->ops->sched_scan_stop(wl, wlvif); in wl1271_sta_handle_idle()
3064 set_bit(WLVIF_FLAG_ACTIVE, &wlvif->flags); in wl1271_sta_handle_idle()
3068 static int wl12xx_config_vif(struct wl1271 *wl, struct wl12xx_vif *wlvif, in wl12xx_config_vif() argument
3073 if (wlcore_is_p2p_mgmt(wlvif)) in wl12xx_config_vif()
3076 if (conf->power_level != wlvif->power_level) { in wl12xx_config_vif()
3077 ret = wl1271_acx_tx_power(wl, wlvif, conf->power_level); in wl12xx_config_vif()
3081 wlvif->power_level = conf->power_level; in wl12xx_config_vif()
3090 struct wl12xx_vif *wlvif; in wl1271_op_config() local
3114 wl12xx_for_each_wlvif(wl, wlvif) { in wl1271_op_config()
3115 ret = wl12xx_config_vif(wl, wlvif, conf, changed); in wl1271_op_config()
3176 struct wl12xx_vif *wlvif; in wl1271_op_configure_filter() local
3195 wl12xx_for_each_wlvif(wl, wlvif) { in wl1271_op_configure_filter()
3196 if (wlcore_is_p2p_mgmt(wlvif)) in wl1271_op_configure_filter()
3199 if (wlvif->bss_type != BSS_TYPE_AP_BSS) { in wl1271_op_configure_filter()
3201 ret = wl1271_acx_group_address_tbl(wl, wlvif, in wl1271_op_configure_filter()
3205 ret = wl1271_acx_group_address_tbl(wl, wlvif, in wl1271_op_configure_filter()
3218 if (wlvif->bss_type == BSS_TYPE_AP_BSS) { in wl1271_op_configure_filter()
3220 ret = wl1271_acx_group_address_tbl(wl, wlvif, in wl1271_op_configure_filter()
3244 static int wl1271_record_ap_key(struct wl1271 *wl, struct wl12xx_vif *wlvif, in wl1271_record_ap_key() argument
3262 if (wlvif->ap.recorded_keys[i] == NULL) in wl1271_record_ap_key()
3265 if (wlvif->ap.recorded_keys[i]->id == id) { in wl1271_record_ap_key()
3287 wlvif->ap.recorded_keys[i] = ap_key; in wl1271_record_ap_key()
3291 static void wl1271_free_ap_keys(struct wl1271 *wl, struct wl12xx_vif *wlvif) in wl1271_free_ap_keys() argument
3296 kfree(wlvif->ap.recorded_keys[i]); in wl1271_free_ap_keys()
3297 wlvif->ap.recorded_keys[i] = NULL; in wl1271_free_ap_keys()
3301 static int wl1271_ap_init_hwenc(struct wl1271 *wl, struct wl12xx_vif *wlvif) in wl1271_ap_init_hwenc() argument
3309 if (wlvif->ap.recorded_keys[i] == NULL) in wl1271_ap_init_hwenc()
3312 key = wlvif->ap.recorded_keys[i]; in wl1271_ap_init_hwenc()
3315 hlid = wlvif->ap.bcast_hlid; in wl1271_ap_init_hwenc()
3317 ret = wl1271_cmd_set_ap_key(wl, wlvif, KEY_ADD_OR_REPLACE, in wl1271_ap_init_hwenc()
3330 ret = wl12xx_cmd_set_default_wep_key(wl, wlvif->default_key, in wl1271_ap_init_hwenc()
3331 wlvif->ap.bcast_hlid); in wl1271_ap_init_hwenc()
3337 wl1271_free_ap_keys(wl, wlvif); in wl1271_ap_init_hwenc()
3341 static int wl1271_set_key(struct wl1271 *wl, struct wl12xx_vif *wlvif, in wl1271_set_key() argument
3348 bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS); in wl1271_set_key()
3358 hlid = wlvif->ap.bcast_hlid; in wl1271_set_key()
3361 if (!test_bit(WLVIF_FLAG_AP_STARTED, &wlvif->flags)) { in wl1271_set_key()
3369 ret = wl1271_record_ap_key(wl, wlvif, id, in wl1271_set_key()
3374 ret = wl1271_cmd_set_ap_key(wl, wlvif, action, in wl1271_set_key()
3404 wlvif->sta.hlid == WL12XX_INVALID_LINK_ID) in wl1271_set_key()
3407 ret = wl1271_cmd_set_sta_key(wl, wlvif, action, in wl1271_set_key()
3469 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wlcore_set_key() local
3485 if (wlvif->bss_type == BSS_TYPE_AP_BSS) in wlcore_set_key()
3490 hlid = wlvif->ap.bcast_hlid; in wlcore_set_key()
3493 hlid = wlvif->sta.hlid; in wlcore_set_key()
3529 ret = wl1271_set_key(wl, wlvif, KEY_ADD_OR_REPLACE, in wlcore_set_key()
3542 if (wlvif->bss_type == BSS_TYPE_STA_BSS && in wlcore_set_key()
3544 wlvif->encryption_type != key_type) { in wlcore_set_key()
3545 wlvif->encryption_type = key_type; in wlcore_set_key()
3546 ret = wl1271_cmd_build_arp_rsp(wl, wlvif); in wlcore_set_key()
3555 ret = wl1271_set_key(wl, wlvif, KEY_REMOVE, in wlcore_set_key()
3579 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wl1271_op_set_default_key_idx() local
3600 wlvif->default_key = key_idx; in wl1271_op_set_default_key_idx()
3603 if (wlvif->encryption_type == KEY_WEP) { in wl1271_op_set_default_key_idx()
3606 wlvif->sta.hlid); in wl1271_op_set_default_key_idx()
3701 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wl1271_op_cancel_hw_scan() local
3722 ret = wl->ops->scan_stop(wl, wlvif); in wl1271_op_cancel_hw_scan()
3754 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wl1271_op_sched_scan_start() local
3770 ret = wl->ops->sched_scan_start(wl, wlvif, req, ies); in wl1271_op_sched_scan_start()
3774 wl->sched_vif = wlvif; in wl1271_op_sched_scan_start()
3788 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wl1271_op_sched_scan_stop() local
3802 wl->ops->sched_scan_stop(wl, wlvif); in wl1271_op_sched_scan_stop()
3844 struct wl12xx_vif *wlvif; in wl1271_op_set_rts_threshold() local
3858 wl12xx_for_each_wlvif(wl, wlvif) { in wl1271_op_set_rts_threshold()
3859 ret = wl1271_acx_rts_threshold(wl, wlvif, value); in wl1271_op_set_rts_threshold()
3906 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wl1271_ap_set_probe_resp_tmpl() local
3914 ret = wl1271_cmd_template_set(wl, wlvif->role_id, in wl1271_ap_set_probe_resp_tmpl()
3925 set_bit(WLVIF_FLAG_AP_PROBE_RESP_SET, &wlvif->flags); in wl1271_ap_set_probe_resp_tmpl()
3937 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wl1271_ap_set_probe_resp_tmpl_legacy() local
3944 if (wlvif->ssid_len > 0) in wl1271_ap_set_probe_resp_tmpl_legacy()
3945 return wl1271_cmd_template_set(wl, wlvif->role_id, in wl1271_ap_set_probe_resp_tmpl_legacy()
3982 return wl1271_cmd_template_set(wl, wlvif->role_id, in wl1271_ap_set_probe_resp_tmpl_legacy()
3994 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wl1271_bss_erp_info_changed() local
3999 ret = wl1271_acx_slot(wl, wlvif, SLOT_TIME_SHORT); in wl1271_bss_erp_info_changed()
4001 ret = wl1271_acx_slot(wl, wlvif, SLOT_TIME_LONG); in wl1271_bss_erp_info_changed()
4010 wl1271_acx_set_preamble(wl, wlvif, ACX_PREAMBLE_SHORT); in wl1271_bss_erp_info_changed()
4012 wl1271_acx_set_preamble(wl, wlvif, ACX_PREAMBLE_LONG); in wl1271_bss_erp_info_changed()
4017 ret = wl1271_acx_cts_protect(wl, wlvif, in wl1271_bss_erp_info_changed()
4020 ret = wl1271_acx_cts_protect(wl, wlvif, in wl1271_bss_erp_info_changed()
4036 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wlcore_set_beacon_template() local
4051 ret = wl1271_ssid_set(wlvif, beacon, ieoffset); in wlcore_set_beacon_template()
4056 min_rate = wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set); in wlcore_set_beacon_template()
4059 ret = wl1271_cmd_template_set(wl, wlvif->role_id, tmpl_id, in wlcore_set_beacon_template()
4068 wlvif->wmm_enabled = in wlcore_set_beacon_template()
4078 if (test_bit(WLVIF_FLAG_AP_PROBE_RESP_SET, &wlvif->flags)) in wlcore_set_beacon_template()
4104 ret = wl1271_cmd_template_set(wl, wlvif->role_id, in wlcore_set_beacon_template()
4123 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wl1271_bss_beacon_info_changed() local
4124 bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS); in wl1271_bss_beacon_info_changed()
4131 wlvif->beacon_int = bss_conf->beacon_int; in wl1271_bss_beacon_info_changed()
4135 u32 rate = wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set); in wl1271_bss_beacon_info_changed()
4146 &wlvif->flags)) { in wl1271_bss_beacon_info_changed()
4147 ret = wlcore_hw_dfs_master_restart(wl, wlvif); in wl1271_bss_beacon_info_changed()
4164 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wl1271_bss_info_changed_ap() local
4170 wlvif->basic_rate_set = wl1271_tx_enabled_rates_get(wl, rates, in wl1271_bss_info_changed_ap()
4171 wlvif->band); in wl1271_bss_info_changed_ap()
4172 wlvif->basic_rate = wl1271_tx_min_rate_get(wl, in wl1271_bss_info_changed_ap()
4173 wlvif->basic_rate_set); in wl1271_bss_info_changed_ap()
4175 ret = wl1271_init_ap_rates(wl, wlvif); in wl1271_bss_info_changed_ap()
4188 wlvif->basic_rate, in wl1271_bss_info_changed_ap()
4205 if (!test_bit(WLVIF_FLAG_AP_STARTED, &wlvif->flags)) { in wl1271_bss_info_changed_ap()
4206 ret = wl12xx_cmd_role_start_ap(wl, wlvif); in wl1271_bss_info_changed_ap()
4210 ret = wl1271_ap_init_hwenc(wl, wlvif); in wl1271_bss_info_changed_ap()
4214 set_bit(WLVIF_FLAG_AP_STARTED, &wlvif->flags); in wl1271_bss_info_changed_ap()
4218 if (test_bit(WLVIF_FLAG_AP_STARTED, &wlvif->flags)) { in wl1271_bss_info_changed_ap()
4223 if (test_bit(wlvif->role_id, wl->roc_map)) in wl1271_bss_info_changed_ap()
4224 wl12xx_croc(wl, wlvif->role_id); in wl1271_bss_info_changed_ap()
4226 ret = wl12xx_cmd_role_stop_ap(wl, wlvif); in wl1271_bss_info_changed_ap()
4230 clear_bit(WLVIF_FLAG_AP_STARTED, &wlvif->flags); in wl1271_bss_info_changed_ap()
4232 &wlvif->flags); in wl1271_bss_info_changed_ap()
4245 ret = wl1271_acx_set_ht_information(wl, wlvif, in wl1271_bss_info_changed_ap()
4257 static int wlcore_set_bssid(struct wl1271 *wl, struct wl12xx_vif *wlvif, in wlcore_set_bssid() argument
4270 wlvif->beacon_int = bss_conf->beacon_int; in wlcore_set_bssid()
4272 wlvif->basic_rate_set = in wlcore_set_bssid()
4274 wlvif->band); in wlcore_set_bssid()
4275 wlvif->basic_rate = in wlcore_set_bssid()
4277 wlvif->basic_rate_set); in wlcore_set_bssid()
4280 wlvif->rate_set = in wlcore_set_bssid()
4283 wlvif->band); in wlcore_set_bssid()
4286 if (wl->sched_vif == wlvif) in wlcore_set_bssid()
4287 wl->ops->sched_scan_stop(wl, wlvif); in wlcore_set_bssid()
4289 ret = wl1271_acx_sta_rate_policies(wl, wlvif); in wlcore_set_bssid()
4293 ret = wl12xx_cmd_build_null_data(wl, wlvif); in wlcore_set_bssid()
4297 ret = wl1271_build_qos_null_data(wl, wl12xx_wlvif_to_vif(wlvif)); in wlcore_set_bssid()
4301 wlcore_set_ssid(wl, wlvif); in wlcore_set_bssid()
4303 set_bit(WLVIF_FLAG_IN_USE, &wlvif->flags); in wlcore_set_bssid()
4308 static int wlcore_clear_bssid(struct wl1271 *wl, struct wl12xx_vif *wlvif) in wlcore_clear_bssid() argument
4313 wl1271_set_band_rate(wl, wlvif); in wlcore_clear_bssid()
4314 wlvif->basic_rate = wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set); in wlcore_clear_bssid()
4316 ret = wl1271_acx_sta_rate_policies(wl, wlvif); in wlcore_clear_bssid()
4320 if (wlvif->bss_type == BSS_TYPE_STA_BSS && in wlcore_clear_bssid()
4321 test_bit(WLVIF_FLAG_IN_USE, &wlvif->flags)) { in wlcore_clear_bssid()
4322 ret = wl12xx_cmd_role_stop_sta(wl, wlvif); in wlcore_clear_bssid()
4327 clear_bit(WLVIF_FLAG_IN_USE, &wlvif->flags); in wlcore_clear_bssid()
4336 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wl1271_bss_info_changed_sta() local
4338 bool is_ibss = (wlvif->bss_type == BSS_TYPE_IBSS); in wl1271_bss_info_changed_sta()
4355 set_bit(WLVIF_FLAG_IBSS_JOINED, &wlvif->flags); in wl1271_bss_info_changed_sta()
4358 wlcore_unset_assoc(wl, wlvif); in wl1271_bss_info_changed_sta()
4359 wl12xx_cmd_role_stop_sta(wl, wlvif); in wl1271_bss_info_changed_sta()
4378 wl1271_sta_handle_idle(wl, wlvif, bss_conf->idle); in wl1271_bss_info_changed_sta()
4384 ret = wl1271_acx_rssi_snr_trigger(wl, wlvif, enable, in wl1271_bss_info_changed_sta()
4389 wlvif->rssi_thold = bss_conf->cqm_rssi_thold; in wl1271_bss_info_changed_sta()
4400 sta_rate_set = sta->deflink.supp_rates[wlvif->band]; in wl1271_bss_info_changed_sta()
4414 ret = wlcore_set_bssid(wl, wlvif, bss_conf, in wl1271_bss_info_changed_sta()
4422 ret = wlcore_clear_bssid(wl, wlvif); in wl1271_bss_info_changed_sta()
4434 wlvif->basic_rate_set = in wl1271_bss_info_changed_sta()
4436 wlvif->band); in wl1271_bss_info_changed_sta()
4437 wlvif->basic_rate = in wl1271_bss_info_changed_sta()
4439 wlvif->basic_rate_set); in wl1271_bss_info_changed_sta()
4442 wlvif->rate_set = CONF_TX_IBSS_DEFAULT_RATES; in wl1271_bss_info_changed_sta()
4443 ret = wl1271_acx_sta_rate_policies(wl, wlvif); in wl1271_bss_info_changed_sta()
4451 ret = wl1271_acx_beacon_filter_opt(wl, wlvif, true); in wl1271_bss_info_changed_sta()
4461 ret = wlcore_join(wl, wlvif); in wl1271_bss_info_changed_sta()
4470 ret = wlcore_set_assoc(wl, wlvif, bss_conf, in wl1271_bss_info_changed_sta()
4475 if (test_bit(WLVIF_FLAG_STA_AUTHORIZED, &wlvif->flags)) in wl1271_bss_info_changed_sta()
4476 wl12xx_set_authorized(wl, wlvif); in wl1271_bss_info_changed_sta()
4478 wlcore_unset_assoc(wl, wlvif); in wl1271_bss_info_changed_sta()
4484 test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags) && in wl1271_bss_info_changed_sta()
4485 !test_bit(WLVIF_FLAG_IN_PS, &wlvif->flags)) { in wl1271_bss_info_changed_sta()
4499 ret = wl1271_ps_set_mode(wl, wlvif, ps_mode); in wl1271_bss_info_changed_sta()
4504 test_bit(WLVIF_FLAG_IN_PS, &wlvif->flags)) { in wl1271_bss_info_changed_sta()
4507 ret = wl1271_ps_set_mode(wl, wlvif, in wl1271_bss_info_changed_sta()
4522 wlvif->rate_set, in wl1271_bss_info_changed_sta()
4523 wlvif->sta.hlid); in wl1271_bss_info_changed_sta()
4531 ret = wl1271_acx_set_ht_information(wl, wlvif, in wl1271_bss_info_changed_sta()
4545 wlvif->sta.qos = bss_conf->qos; in wl1271_bss_info_changed_sta()
4546 WARN_ON(wlvif->bss_type != BSS_TYPE_STA_BSS); in wl1271_bss_info_changed_sta()
4549 wlvif->ip_addr = addr; in wl1271_bss_info_changed_sta()
4556 ret = wl1271_cmd_build_arp_rsp(wl, wlvif); in wl1271_bss_info_changed_sta()
4562 ret = wl1271_acx_arp_ip_filter(wl, wlvif, in wl1271_bss_info_changed_sta()
4567 wlvif->ip_addr = 0; in wl1271_bss_info_changed_sta()
4568 ret = wl1271_acx_arp_ip_filter(wl, wlvif, 0, addr); in wl1271_bss_info_changed_sta()
4585 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wl1271_op_bss_info_changed() local
4586 bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS); in wl1271_op_bss_info_changed()
4590 wlvif->role_id, (int)changed); in wl1271_op_bss_info_changed()
4597 cancel_delayed_work_sync(&wlvif->connection_loss_work); in wl1271_op_bss_info_changed()
4608 if (unlikely(!test_bit(WLVIF_FLAG_INITIALIZED, &wlvif->flags))) in wl1271_op_bss_info_changed()
4616 bss_conf->txpower != wlvif->power_level) { in wl1271_op_bss_info_changed()
4618 ret = wl1271_acx_tx_power(wl, wlvif, bss_conf->txpower); in wl1271_op_bss_info_changed()
4622 wlvif->power_level = bss_conf->txpower; in wl1271_op_bss_info_changed()
4659 struct wl12xx_vif *wlvif; in wlcore_op_change_chanctx() local
4674 wl12xx_for_each_wlvif(wl, wlvif) { in wlcore_op_change_chanctx()
4675 struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); in wlcore_op_change_chanctx()
4686 wlvif->bss_type == BSS_TYPE_AP_BSS && in wlcore_op_change_chanctx()
4687 ctx->radar_enabled && !wlvif->radar_enabled && in wlcore_op_change_chanctx()
4690 wlcore_hw_set_cac(wl, wlvif, true); in wlcore_op_change_chanctx()
4691 wlvif->radar_enabled = true; in wlcore_op_change_chanctx()
4706 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wlcore_op_assign_vif_chanctx() local
4713 wlvif->role_id, channel, in wlcore_op_assign_vif_chanctx()
4722 if (unlikely(!test_bit(WLVIF_FLAG_INITIALIZED, &wlvif->flags))) in wlcore_op_assign_vif_chanctx()
4729 wlvif->band = ctx->def.chan->band; in wlcore_op_assign_vif_chanctx()
4730 wlvif->channel = channel; in wlcore_op_assign_vif_chanctx()
4731 wlvif->channel_type = cfg80211_get_chandef_type(&ctx->def); in wlcore_op_assign_vif_chanctx()
4734 wl1271_set_band_rate(wl, wlvif); in wlcore_op_assign_vif_chanctx()
4739 wlcore_hw_set_cac(wl, wlvif, true); in wlcore_op_assign_vif_chanctx()
4740 wlvif->radar_enabled = true; in wlcore_op_assign_vif_chanctx()
4756 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wlcore_op_unassign_vif_chanctx() local
4761 wlvif->role_id, in wlcore_op_unassign_vif_chanctx()
4772 if (unlikely(!test_bit(WLVIF_FLAG_INITIALIZED, &wlvif->flags))) in wlcore_op_unassign_vif_chanctx()
4779 if (wlvif->radar_enabled) { in wlcore_op_unassign_vif_chanctx()
4781 wlcore_hw_set_cac(wl, wlvif, false); in wlcore_op_unassign_vif_chanctx()
4782 wlvif->radar_enabled = false; in wlcore_op_unassign_vif_chanctx()
4792 struct wl12xx_vif *wlvif, in __wlcore_switch_vif_chan() argument
4800 wlvif->role_id, wlvif->channel, channel, in __wlcore_switch_vif_chan()
4803 if (WARN_ON_ONCE(wlvif->bss_type != BSS_TYPE_AP_BSS)) in __wlcore_switch_vif_chan()
4806 WARN_ON(!test_bit(WLVIF_FLAG_BEACON_DISABLED, &wlvif->flags)); in __wlcore_switch_vif_chan()
4808 if (wlvif->radar_enabled) { in __wlcore_switch_vif_chan()
4810 wlcore_hw_set_cac(wl, wlvif, false); in __wlcore_switch_vif_chan()
4811 wlvif->radar_enabled = false; in __wlcore_switch_vif_chan()
4814 wlvif->band = new_ctx->def.chan->band; in __wlcore_switch_vif_chan()
4815 wlvif->channel = channel; in __wlcore_switch_vif_chan()
4816 wlvif->channel_type = cfg80211_get_chandef_type(&new_ctx->def); in __wlcore_switch_vif_chan()
4821 wlcore_hw_set_cac(wl, wlvif, true); in __wlcore_switch_vif_chan()
4822 wlvif->radar_enabled = true; in __wlcore_switch_vif_chan()
4848 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vifs[i].vif); in wlcore_op_switch_vif_chanctx() local
4850 ret = __wlcore_switch_vif_chan(wl, wlvif, vifs[i].new_ctx); in wlcore_op_switch_vif_chanctx()
4868 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wl1271_op_conf_tx() local
4872 if (wlcore_is_p2p_mgmt(wlvif)) in wl1271_op_conf_tx()
4884 if (!test_bit(WLVIF_FLAG_INITIALIZED, &wlvif->flags)) in wl1271_op_conf_tx()
4895 ret = wl1271_acx_ac_cfg(wl, wlvif, wl1271_tx_get_queue(queue), in wl1271_op_conf_tx()
4901 ret = wl1271_acx_tid_cfg(wl, wlvif, wl1271_tx_get_queue(queue), in wl1271_op_conf_tx()
4922 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wl1271_op_get_tsf() local
4937 ret = wl12xx_acx_tsf_info(wl, wlvif, &mactime); in wl1271_op_get_tsf()
4964 struct wl12xx_vif *wlvif, in wl1271_allocate_sta() argument
4977 ret = wl12xx_allocate_link(wl, wlvif, &wl_sta->hlid); in wl1271_allocate_sta()
4986 set_bit(wl_sta->hlid, wlvif->ap.sta_hlid_map); in wl1271_allocate_sta()
4992 void wl1271_free_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 hlid) in wl1271_free_sta() argument
4994 if (!test_bit(hlid, wlvif->ap.sta_hlid_map)) in wl1271_free_sta()
4997 clear_bit(hlid, wlvif->ap.sta_hlid_map); in wl1271_free_sta()
5005 wlcore_save_freed_pkts_addr(wl, wlvif, hlid, wl->links[hlid].addr); in wl1271_free_sta()
5007 wl12xx_free_link(wl, wlvif, &hlid); in wl1271_free_sta()
5019 struct wl12xx_vif *wlvif, in wl12xx_sta_add() argument
5028 ret = wl1271_allocate_sta(wl, wlvif, sta); in wl12xx_sta_add()
5035 ret = wl12xx_cmd_add_peer(wl, wlvif, sta, hlid); in wl12xx_sta_add()
5037 wl1271_free_sta(wl, wlvif, hlid); in wl12xx_sta_add()
5043 struct wl12xx_vif *wlvif, in wl12xx_sta_remove() argument
5053 if (WARN_ON(!test_bit(id, wlvif->ap.sta_hlid_map))) in wl12xx_sta_remove()
5056 ret = wl12xx_cmd_remove_peer(wl, wlvif, wl_sta->hlid); in wl12xx_sta_remove()
5060 wl1271_free_sta(wl, wlvif, wl_sta->hlid); in wl12xx_sta_remove()
5065 struct wl12xx_vif *wlvif) in wlcore_roc_if_possible() argument
5071 if (WARN_ON(wlvif->role_id == WL12XX_INVALID_ROLE_ID)) in wlcore_roc_if_possible()
5074 wl12xx_roc(wl, wlvif, wlvif->role_id, wlvif->band, wlvif->channel); in wlcore_roc_if_possible()
5083 void wlcore_update_inconn_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif, in wlcore_update_inconn_sta() argument
5090 if (!wlvif->ap_pending_auth_reply && in wlcore_update_inconn_sta()
5091 !wlvif->inconn_count) in wlcore_update_inconn_sta()
5092 wlcore_roc_if_possible(wl, wlvif); in wlcore_update_inconn_sta()
5096 wlvif->inconn_count++; in wlcore_update_inconn_sta()
5098 wlvif->ap_pending_auth_reply = true; in wlcore_update_inconn_sta()
5104 if (WARN_ON(!wl_sta && !wlvif->ap_pending_auth_reply)) in wlcore_update_inconn_sta()
5107 if (WARN_ON(wl_sta && !wlvif->inconn_count)) in wlcore_update_inconn_sta()
5112 wlvif->inconn_count--; in wlcore_update_inconn_sta()
5114 wlvif->ap_pending_auth_reply = false; in wlcore_update_inconn_sta()
5117 if (!wlvif->inconn_count && !wlvif->ap_pending_auth_reply && in wlcore_update_inconn_sta()
5118 test_bit(wlvif->role_id, wl->roc_map)) in wlcore_update_inconn_sta()
5119 wl12xx_croc(wl, wlvif->role_id); in wlcore_update_inconn_sta()
5124 struct wl12xx_vif *wlvif, in wl12xx_update_sta_state() argument
5130 bool is_ap = wlvif->bss_type == BSS_TYPE_AP_BSS; in wl12xx_update_sta_state()
5131 bool is_sta = wlvif->bss_type == BSS_TYPE_STA_BSS; in wl12xx_update_sta_state()
5140 ret = wl12xx_sta_add(wl, wlvif, sta); in wl12xx_update_sta_state()
5144 wlcore_update_inconn_sta(wl, wlvif, wl_sta, true); in wl12xx_update_sta_state()
5152 wl12xx_sta_remove(wl, wlvif, sta); in wl12xx_update_sta_state()
5154 wlcore_update_inconn_sta(wl, wlvif, wl_sta, false); in wl12xx_update_sta_state()
5160 ret = wl12xx_cmd_set_peer_state(wl, wlvif, wl_sta->hlid); in wl12xx_update_sta_state()
5165 ret = wl12xx_cmd_add_peer(wl, wlvif, sta, wl_sta->hlid); in wl12xx_update_sta_state()
5175 wlcore_update_inconn_sta(wl, wlvif, wl_sta, false); in wl12xx_update_sta_state()
5181 set_bit(WLVIF_FLAG_STA_AUTHORIZED, &wlvif->flags); in wl12xx_update_sta_state()
5182 ret = wl12xx_set_authorized(wl, wlvif); in wl12xx_update_sta_state()
5190 clear_bit(WLVIF_FLAG_STA_AUTHORIZED, &wlvif->flags); in wl12xx_update_sta_state()
5191 clear_bit(WLVIF_FLAG_STA_STATE_SENT, &wlvif->flags); in wl12xx_update_sta_state()
5198 wlcore_save_freed_pkts(wl, wlvif, wlvif->sta.hlid, sta); in wl12xx_update_sta_state()
5199 wlvif->total_freed_pkts = 0; in wl12xx_update_sta_state()
5206 wlvif->total_freed_pkts = wl_sta->total_freed_pkts; in wl12xx_update_sta_state()
5213 if (test_bit(wlvif->role_id, wl->roc_map)) in wl12xx_update_sta_state()
5214 wl12xx_croc(wl, wlvif->role_id); in wl12xx_update_sta_state()
5222 WARN_ON(wlvif->role_id == WL12XX_INVALID_ROLE_ID); in wl12xx_update_sta_state()
5223 wl12xx_roc(wl, wlvif, wlvif->role_id, in wl12xx_update_sta_state()
5224 wlvif->band, wlvif->channel); in wl12xx_update_sta_state()
5237 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wl12xx_op_sta_state() local
5254 ret = wl12xx_update_sta_state(wl, wlvif, sta, old_state, new_state); in wl12xx_op_sta_state()
5270 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wl1271_op_ampdu_action() local
5292 if (wlvif->bss_type == BSS_TYPE_STA_BSS) { in wl1271_op_ampdu_action()
5293 hlid = wlvif->sta.hlid; in wl1271_op_ampdu_action()
5294 } else if (wlvif->bss_type == BSS_TYPE_AP_BSS) { in wl1271_op_ampdu_action()
5315 if (!wlvif->ba_support || !wlvif->ba_allowed) { in wl1271_op_ampdu_action()
5394 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wl12xx_set_bitrate_mask() local
5405 wlvif->bitrate_masks[i] = in wl12xx_set_bitrate_mask()
5413 if (wlvif->bss_type == BSS_TYPE_STA_BSS && in wl12xx_set_bitrate_mask()
5414 !test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) { in wl12xx_set_bitrate_mask()
5420 wl1271_set_band_rate(wl, wlvif); in wl12xx_set_bitrate_mask()
5421 wlvif->basic_rate = in wl12xx_set_bitrate_mask()
5422 wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set); in wl12xx_set_bitrate_mask()
5423 ret = wl1271_acx_sta_rate_policies(wl, wlvif); in wl12xx_set_bitrate_mask()
5439 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wl12xx_op_channel_switch() local
5449 if (test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) in wl12xx_op_channel_switch()
5462 if (test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) { in wl12xx_op_channel_switch()
5465 ret = wl->ops->channel_switch(wl, wlvif, ch_switch); in wl12xx_op_channel_switch()
5469 set_bit(WLVIF_FLAG_CS_PROGRESS, &wlvif->flags); in wl12xx_op_channel_switch()
5472 delay_usec = ieee80211_tu_to_usec(wlvif->beacon_int) * in wl12xx_op_channel_switch()
5474 ieee80211_queue_delayed_work(hw, &wlvif->channel_switch_work, in wl12xx_op_channel_switch()
5488 struct wl12xx_vif *wlvif, in wlcore_get_beacon_ie() argument
5493 ieee80211_beacon_get(wl->hw, wl12xx_wlvif_to_vif(wlvif)); in wlcore_get_beacon_ie()
5503 static int wlcore_get_csa_count(struct wl1271 *wl, struct wl12xx_vif *wlvif, in wlcore_get_csa_count() argument
5509 ie = wlcore_get_beacon_ie(wl, wlvif, WLAN_EID_CHANNEL_SWITCH); in wlcore_get_csa_count()
5524 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wlcore_op_channel_switch_beacon() local
5533 wlvif->role_id); in wlcore_op_channel_switch_beacon()
5535 ret = wlcore_get_csa_count(wl, wlvif, &ch_switch.count); in wlcore_op_channel_switch_beacon()
5552 ret = wl->ops->channel_switch(wl, wlvif, &ch_switch); in wlcore_op_channel_switch_beacon()
5556 set_bit(WLVIF_FLAG_CS_PROGRESS, &wlvif->flags); in wlcore_op_channel_switch_beacon()
5579 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wlcore_op_remain_on_channel() local
5586 channel, wlvif->role_id); in wlcore_op_remain_on_channel()
5605 ret = wl12xx_start_dev(wl, wlvif, chan->band, channel); in wlcore_op_remain_on_channel()
5622 struct wl12xx_vif *wlvif; in __wlcore_roc_completed() local
5629 wlvif = wl12xx_vif_to_data(wl->roc_vif); in __wlcore_roc_completed()
5631 if (!test_bit(WLVIF_FLAG_INITIALIZED, &wlvif->flags)) in __wlcore_roc_completed()
5634 ret = wl12xx_stop_dev(wl, wlvif); in __wlcore_roc_completed()
5709 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wlcore_op_sta_rc_update() local
5717 wlvif->rc_update_bw = sta->deflink.bandwidth; in wlcore_op_sta_rc_update()
5718 memcpy(&wlvif->rc_ht_cap, &sta->deflink.ht_cap, in wlcore_op_sta_rc_update()
5720 ieee80211_queue_work(hw, &wlvif->rc_update_work); in wlcore_op_sta_rc_update()
5729 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); in wlcore_op_sta_statistics() local
5744 ret = wlcore_acx_average_rssi(wl, wlvif, &rssi_dbm); in wlcore_op_sta_statistics()
6616 struct wl12xx_vif *wlvif; in wlcore_runtime_suspend() local
6627 wl12xx_for_each_wlvif(wl, wlvif) { in wlcore_runtime_suspend()
6628 if (!test_bit(WLVIF_FLAG_IN_PS, &wlvif->flags) && in wlcore_runtime_suspend()
6629 test_bit(WLVIF_FLAG_IN_USE, &wlvif->flags)) in wlcore_runtime_suspend()