Lines Matching defs:wlvif
310 int wl12xx_allocate_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid)
322 __set_bit(link, wlvif->links_map);
333 wl->links[link].wlvif = wlvif;
344 * Take saved value for total freed packets from wlvif, in case this is
347 if (wlvif->bss_type != BSS_TYPE_AP_BSS)
348 wl->links[link].total_freed_pkts = wlvif->total_freed_pkts;
356 void wl12xx_free_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid)
366 __clear_bit(*hlid, wlvif->links_map);
380 wl->links[*hlid].wlvif = NULL;
382 if (wlvif->bss_type == BSS_TYPE_AP_BSS &&
383 *hlid == wlvif->ap.bcast_hlid) {
386 * save the total freed packets in the wlvif, in case this is
389 wlvif->total_freed_pkts = wl->links[*hlid].total_freed_pkts;
395 if (wlvif->encryption_type == KEY_GEM)
399 wlvif->total_freed_pkts += sqn_padding;
428 struct wl12xx_vif *wlvif,
441 wl1271_debug(DEBUG_CMD, "cmd role start dev %d", wlvif->dev_role_id);
443 cmd->role_id = wlvif->dev_role_id;
448 if (wlvif->dev_hlid == WL12XX_INVALID_LINK_ID) {
449 ret = wl12xx_allocate_link(wl, wlvif, &wlvif->dev_hlid);
453 cmd->device.hlid = wlvif->dev_hlid;
454 cmd->device.session = wl->session_ids[wlvif->dev_hlid];
469 wl12xx_free_link(wl, wlvif, &wlvif->dev_hlid);
479 struct wl12xx_vif *wlvif)
484 if (WARN_ON(wlvif->dev_hlid == WL12XX_INVALID_LINK_ID))
495 cmd->role_id = wlvif->dev_role_id;
505 wl12xx_free_link(wl, wlvif, &wlvif->dev_hlid);
514 int wl12xx_cmd_role_start_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif)
516 struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif);
527 wl1271_debug(DEBUG_CMD, "cmd role start sta %d", wlvif->role_id);
529 cmd->role_id = wlvif->role_id;
530 if (wlvif->band == NL80211_BAND_5GHZ)
532 cmd->channel = wlvif->channel;
533 cmd->sta.basic_rate_set = cpu_to_le32(wlvif->basic_rate_set);
534 cmd->sta.beacon_interval = cpu_to_le16(wlvif->beacon_int);
536 cmd->sta.ssid_len = wlvif->ssid_len;
537 memcpy(cmd->sta.ssid, wlvif->ssid, wlvif->ssid_len);
541 wlcore_hw_sta_get_ap_rate_mask(wl, wlvif);
542 if (wlvif->p2p)
547 cmd->channel_type = wlcore_get_native_channel_type(wlvif->channel_type);
549 if (wlvif->sta.hlid == WL12XX_INVALID_LINK_ID) {
550 ret = wl12xx_allocate_link(wl, wlvif, &wlvif->sta.hlid);
554 cmd->sta.hlid = wlvif->sta.hlid;
555 cmd->sta.session = wl->session_ids[wlvif->sta.hlid];
566 wlvif->role_id, cmd->sta.hlid, cmd->sta.session,
567 wlvif->basic_rate_set, wlvif->rate_set);
575 wlvif->sta.role_chan_type = wlvif->channel_type;
580 wl12xx_free_link(wl, wlvif, &wlvif->sta.hlid);
590 int wl12xx_cmd_role_stop_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif)
595 if (WARN_ON(wlvif->sta.hlid == WL12XX_INVALID_LINK_ID))
604 wl1271_debug(DEBUG_CMD, "cmd role stop sta %d", wlvif->role_id);
606 cmd->role_id = wlvif->role_id;
616 wl12xx_free_link(wl, wlvif, &wlvif->sta.hlid);
625 int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif)
628 struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif);
633 wl1271_debug(DEBUG_CMD, "cmd role start ap %d", wlvif->role_id);
638 if (wlvif->ssid_len == 0 && !bss_conf->hidden_ssid) {
651 ret = wl12xx_allocate_link(wl, wlvif, &wlvif->ap.global_hlid);
655 ret = wl12xx_allocate_link(wl, wlvif, &wlvif->ap.bcast_hlid);
660 wl->links[wlvif->ap.bcast_hlid].total_freed_pkts =
661 wlvif->total_freed_pkts;
663 cmd->role_id = wlvif->role_id;
666 cmd->ap.global_hlid = wlvif->ap.global_hlid;
667 cmd->ap.broadcast_hlid = wlvif->ap.bcast_hlid;
668 cmd->ap.global_session_id = wl->session_ids[wlvif->ap.global_hlid];
669 cmd->ap.bcast_session_id = wl->session_ids[wlvif->ap.bcast_hlid];
670 cmd->ap.basic_rate_set = cpu_to_le32(wlvif->basic_rate_set);
671 cmd->ap.beacon_interval = cpu_to_le16(wlvif->beacon_int);
676 cmd->ap.wmm = wlvif->wmm_enabled;
677 cmd->channel = wlvif->channel;
678 cmd->channel_type = wlcore_get_native_channel_type(wlvif->channel_type);
683 cmd->ap.ssid_len = wlvif->ssid_len;
684 memcpy(cmd->ap.ssid, wlvif->ssid, wlvif->ssid_len);
692 wlcore_hw_ap_get_mimo_wide_rate_mask(wl, wlvif);
693 if (wlvif->p2p)
701 switch (wlvif->band) {
709 wl1271_warning("ap start - unknown band: %d", (int)wlvif->band);
723 wl12xx_free_link(wl, wlvif, &wlvif->ap.bcast_hlid);
726 wl12xx_free_link(wl, wlvif, &wlvif->ap.global_hlid);
735 int wl12xx_cmd_role_stop_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif)
746 wl1271_debug(DEBUG_CMD, "cmd role stop ap %d", wlvif->role_id);
748 cmd->role_id = wlvif->role_id;
756 wl12xx_free_link(wl, wlvif, &wlvif->ap.bcast_hlid);
757 wl12xx_free_link(wl, wlvif, &wlvif->ap.global_hlid);
766 int wl12xx_cmd_role_start_ibss(struct wl1271 *wl, struct wl12xx_vif *wlvif)
768 struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif);
779 wl1271_debug(DEBUG_CMD, "cmd role start ibss %d", wlvif->role_id);
781 cmd->role_id = wlvif->role_id;
782 if (wlvif->band == NL80211_BAND_5GHZ)
784 cmd->channel = wlvif->channel;
785 cmd->ibss.basic_rate_set = cpu_to_le32(wlvif->basic_rate_set);
786 cmd->ibss.beacon_interval = cpu_to_le16(wlvif->beacon_int);
789 cmd->ibss.ssid_len = wlvif->ssid_len;
790 memcpy(cmd->ibss.ssid, wlvif->ssid, wlvif->ssid_len);
792 cmd->sta.local_rates = cpu_to_le32(wlvif->rate_set);
794 if (wlvif->sta.hlid == WL12XX_INVALID_LINK_ID) {
795 ret = wl12xx_allocate_link(wl, wlvif, &wlvif->sta.hlid);
799 cmd->ibss.hlid = wlvif->sta.hlid;
800 cmd->ibss.remote_rates = cpu_to_le32(wlvif->rate_set);
804 wlvif->role_id, cmd->sta.hlid, cmd->sta.session,
805 wlvif->basic_rate_set, wlvif->rate_set);
820 wl12xx_free_link(wl, wlvif, &wlvif->sta.hlid);
989 int wl1271_cmd_ps_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1003 ps_params->role_id = wlvif->role_id;
1038 /* during initialization wlvif is NULL */
1063 int wl12xx_cmd_build_null_data(struct wl1271 *wl, struct wl12xx_vif *wlvif)
1071 if (wlvif->bss_type == BSS_TYPE_IBSS) {
1076 wl12xx_wlvif_to_vif(wlvif),
1084 ret = wl1271_cmd_template_set(wl, wlvif->role_id,
1086 wlvif->basic_rate);
1098 struct wl12xx_vif *wlvif)
1100 struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif);
1108 ret = wl1271_cmd_template_set(wl, wlvif->role_id, CMD_TEMPL_KLV,
1110 wlvif->sta.klv_template_id,
1111 wlvif->basic_rate);
1122 int wl1271_cmd_build_ps_poll(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1125 struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif);
1133 ret = wl1271_cmd_template_set(wl, wlvif->role_id,
1135 skb->len, 0, wlvif->basic_rate_set);
1142 int wl12xx_cmd_build_probe_req(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1148 struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif);
1174 rate = wl1271_tx_min_rate_get(wl, wlvif->bitrate_masks[band]);
1191 struct wl12xx_vif *wlvif,
1194 struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif);
1205 rate = wl1271_tx_min_rate_get(wl, wlvif->bitrate_masks[wlvif->band]);
1206 if (wlvif->band == NL80211_BAND_2GHZ)
1207 ret = wl1271_cmd_template_set(wl, wlvif->role_id,
1211 ret = wl1271_cmd_template_set(wl, wlvif->role_id,
1222 int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, struct wl12xx_vif *wlvif)
1226 struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif);
1257 tmpl->sender_ip = wlvif->ip_addr;
1260 switch (wlvif->encryption_type) {
1275 wlvif->encryption_type);
1286 if (wlvif->sta.qos)
1293 if (wlvif->sta.qos)
1297 if (wlvif->encryption_type != KEY_NONE)
1305 ret = wl1271_cmd_template_set(wl, wlvif->role_id, CMD_TEMPL_ARP_RSP,
1307 wlvif->basic_rate);
1315 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
1331 return wl1271_cmd_template_set(wl, wlvif->role_id,
1334 wlvif->basic_rate);
1368 int wl1271_cmd_set_sta_key(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1377 if (wlvif->sta.hlid == WL12XX_INVALID_LINK_ID)
1386 cmd->hlid = wlvif->sta.hlid;
1437 int wl1271_cmd_set_ap_key(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1450 if (hlid == wlvif->ap.bcast_hlid) {
1501 int wl12xx_cmd_set_peer_state(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1519 if (wlvif->bss_type == BSS_TYPE_STA_BSS)
1520 cmd->wmm = wlvif->wmm_enabled;
1535 int wl12xx_cmd_add_peer(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1557 cmd->role_id = wlvif->role_id;
1568 sta_rates = sta->deflink.supp_rates[wlvif->band];
1576 wlvif->band));
1594 int wl12xx_cmd_remove_peer(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1613 cmd->role_id = wlvif->role_id;
1833 static int wl12xx_cmd_roc(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1860 wl1271_error("roc - unknown band: %d", (int)wlvif->band);
1907 int wl12xx_roc(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 role_id,
1915 ret = wl12xx_cmd_roc(wl, wlvif, role_id, band, channel);
1948 int wl12xx_cmd_stop_channel_switch(struct wl1271 *wl, struct wl12xx_vif *wlvif)
1961 cmd->role_id = wlvif->role_id;
1977 int wl12xx_start_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1982 if (WARN_ON(!(wlvif->bss_type == BSS_TYPE_STA_BSS ||
1983 wlvif->bss_type == BSS_TYPE_IBSS)))
1987 if (!wlcore_is_p2p_mgmt(wlvif)) {
1989 wl12xx_wlvif_to_vif(wlvif)->addr,
1991 &wlvif->dev_role_id);
1996 ret = wl12xx_cmd_role_start_dev(wl, wlvif, band, channel);
2000 ret = wl12xx_roc(wl, wlvif, wlvif->dev_role_id, band, channel);
2007 wl12xx_cmd_role_stop_dev(wl, wlvif);
2009 if (!wlcore_is_p2p_mgmt(wlvif))
2010 wl12xx_cmd_role_disable(wl, &wlvif->dev_role_id);
2016 int wl12xx_stop_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif)
2020 if (WARN_ON(!(wlvif->bss_type == BSS_TYPE_STA_BSS ||
2021 wlvif->bss_type == BSS_TYPE_IBSS)))
2029 if (test_bit(wlvif->dev_role_id, wl->roc_map)) {
2030 ret = wl12xx_croc(wl, wlvif->dev_role_id);
2035 ret = wl12xx_cmd_role_stop_dev(wl, wlvif);
2039 if (!wlcore_is_p2p_mgmt(wlvif)) {
2040 ret = wl12xx_cmd_role_disable(wl, &wlvif->dev_role_id);
2049 int wlcore_cmd_generic_cfg(struct wl1271 *wl, struct wl12xx_vif *wlvif,
2057 wlvif->role_id, feature, enable, value);
2063 cmd->role_id = wlvif->role_id;