Lines Matching +full:multi +full:- +full:gas

1 // SPDX-License-Identifier: ISC
32 #define BRCMF_P2P_WILDCARD_SSID "DIRECT-"
33 #define BRCMF_P2P_WILDCARD_SSID_LEN (sizeof(BRCMF_P2P_WILDCARD_SSID) - 1)
65 #define P2P_INVALID_CHANNEL -1
91 #define P2PSD_ACTION_ID_GAS_IREQ 0x0a /* GAS Initial Request AF */
92 #define P2PSD_ACTION_ID_GAS_IRESP 0x0b /* GAS Initial Response AF */
93 #define P2PSD_ACTION_ID_GAS_CREQ 0x0c /* GAS Comeback Request AF */
94 #define P2PSD_ACTION_ID_GAS_CRESP 0x0d /* GAS Comeback Response AF */
101 * struct brcmf_p2p_disc_st_le - set discovery state in firmware.
114 * enum brcmf_p2p_disc_state - P2P discovery state values
117 * @WL_P2P_DISC_ST_LISTEN: P2P discovery off-channel for specified time.
127 * struct brcmf_p2p_scan_le - P2P specific scan request.
144 * struct brcmf_p2p_pub_act_frame - WiFi P2P Public Action Frame
149 * @oui_type: OUI type - P2P_VER
150 * @subtype: OUI subtype - P2P_TYPE_*
165 * struct brcmf_p2p_action_frame - WiFi P2P Action Frame
168 * @oui: OUI - P2P_OUI
169 * @type: OUI Type - P2P_VER
170 * @subtype: OUI Subtype - P2P_AF_*
184 * struct brcmf_p2psd_gas_pub_act_frame - Wi-Fi GAS Public Action Frame
189 * @query_data: Query Data. SD gas ireq SD gas iresp
199 * struct brcmf_config_af_params - Action Frame Parameters for tx.
202 * turn off mpc 0: off, 1: on, (-1): do nothing
213 * brcmf_p2p_is_pub_action() - true if p2p public type frame.
231 if (pact_frm->category == P2P_PUB_AF_CATEGORY && in brcmf_p2p_is_pub_action()
232 pact_frm->action == P2P_PUB_AF_ACTION && in brcmf_p2p_is_pub_action()
233 pact_frm->oui_type == P2P_VER && in brcmf_p2p_is_pub_action()
234 memcmp(pact_frm->oui, P2P_OUI, P2P_OUI_LEN) == 0) in brcmf_p2p_is_pub_action()
241 * brcmf_p2p_is_p2p_action() - true if p2p action type frame.
259 if (act_frm->category == P2P_AF_CATEGORY && in brcmf_p2p_is_p2p_action()
260 act_frm->type == P2P_VER && in brcmf_p2p_is_p2p_action()
261 memcmp(act_frm->oui, P2P_OUI, P2P_OUI_LEN) == 0) in brcmf_p2p_is_p2p_action()
268 * brcmf_p2p_is_gas_action() - true if p2p gas action type frame.
273 * Determine if action frame is p2p gas action type
286 if (sd_act_frm->category != P2PSD_ACTION_CATEGORY) in brcmf_p2p_is_gas_action()
289 if (sd_act_frm->action == P2PSD_ACTION_ID_GAS_IREQ || in brcmf_p2p_is_gas_action()
290 sd_act_frm->action == P2PSD_ACTION_ID_GAS_IRESP || in brcmf_p2p_is_gas_action()
291 sd_act_frm->action == P2PSD_ACTION_ID_GAS_CREQ || in brcmf_p2p_is_gas_action()
292 sd_act_frm->action == P2PSD_ACTION_ID_GAS_CRESP) in brcmf_p2p_is_gas_action()
299 * brcmf_p2p_print_actframe() - debug print routine.
321 switch (pact_frm->subtype) { in brcmf_p2p_print_actframe()
365 switch (act_frm->subtype) { in brcmf_p2p_print_actframe()
389 switch (sd_act_frm->action) { in brcmf_p2p_print_actframe()
391 brcmf_dbg(TRACE, "%s P2P GAS Initial Request\n", in brcmf_p2p_print_actframe()
395 brcmf_dbg(TRACE, "%s P2P GAS Initial Response\n", in brcmf_p2p_print_actframe()
399 brcmf_dbg(TRACE, "%s P2P GAS Comeback Request\n", in brcmf_p2p_print_actframe()
403 brcmf_dbg(TRACE, "%s P2P GAS Comeback Response\n", in brcmf_p2p_print_actframe()
407 brcmf_dbg(TRACE, "%s Unknown P2P GAS Frame\n", in brcmf_p2p_print_actframe()
424 * brcmf_p2p_set_firmware() - prepare firmware for peer-to-peer operation.
431 struct brcmf_pub *drvr = ifp->drvr; in brcmf_p2p_set_firmware()
454 * brcmf_p2p_generate_bss_mac() - derive mac addresses for P2P.
465 struct brcmf_if *pri_ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp; in brcmf_p2p_generate_bss_mac()
473 if (pri_ifp->mac_addr[0] & 0x02) { in brcmf_p2p_generate_bss_mac()
476 dev_addr = pri_ifp->mac_addr; in brcmf_p2p_generate_bss_mac()
485 eth_random_addr(p2p->dev_addr); in brcmf_p2p_generate_bss_mac()
487 memcpy(p2p->dev_addr, dev_addr, ETH_ALEN); in brcmf_p2p_generate_bss_mac()
490 p2p->dev_addr[0] |= 0x02; in brcmf_p2p_generate_bss_mac()
493 * BSSCFGs need to simultaneously co-exist, then this address must be in brcmf_p2p_generate_bss_mac()
496 memcpy(p2p->conn_int_addr, p2p->dev_addr, ETH_ALEN); in brcmf_p2p_generate_bss_mac()
497 p2p->conn_int_addr[0] |= 0x02; in brcmf_p2p_generate_bss_mac()
498 p2p->conn_int_addr[4] ^= 0x80; in brcmf_p2p_generate_bss_mac()
500 memcpy(p2p->conn2_int_addr, p2p->dev_addr, ETH_ALEN); in brcmf_p2p_generate_bss_mac()
501 p2p->conn2_int_addr[0] |= 0x02; in brcmf_p2p_generate_bss_mac()
502 p2p->conn2_int_addr[4] ^= 0x90; in brcmf_p2p_generate_bss_mac()
506 * brcmf_p2p_scan_is_p2p_request() - is cfg80211 scan request a P2P scan.
515 struct cfg80211_ssid *ssids = request->ssids; in brcmf_p2p_scan_is_p2p_request()
518 for (i = 0; i < request->n_ssids; i++) { in brcmf_p2p_scan_is_p2p_request()
531 * brcmf_p2p_set_discover_state - set discover state in firmware.
533 * @ifp: low-level interface object.
554 * brcmf_p2p_deinit_discovery() - disable P2P device discovery.
567 vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; in brcmf_p2p_deinit_discovery()
568 (void)brcmf_p2p_set_discover_state(vif->ifp, WL_P2P_DISC_ST_SCAN, 0, 0); in brcmf_p2p_deinit_discovery()
571 vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif; in brcmf_p2p_deinit_discovery()
572 (void)brcmf_fil_iovar_int_set(vif->ifp, "p2p_disc", 0); in brcmf_p2p_deinit_discovery()
578 * brcmf_p2p_enable_discovery() - initialize and configure discovery.
586 struct brcmf_pub *drvr = p2p->cfg->pub; in brcmf_p2p_enable_discovery()
591 vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; in brcmf_p2p_enable_discovery()
594 ret = -EPERM; in brcmf_p2p_enable_discovery()
598 if (test_bit(BRCMF_P2P_STATUS_ENABLED, &p2p->status)) { in brcmf_p2p_enable_discovery()
603 /* Re-initialize P2P Discovery in the firmware */ in brcmf_p2p_enable_discovery()
604 vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif; in brcmf_p2p_enable_discovery()
605 ret = brcmf_fil_iovar_int_set(vif->ifp, "p2p_disc", 1); in brcmf_p2p_enable_discovery()
610 vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; in brcmf_p2p_enable_discovery()
611 ret = brcmf_p2p_set_discover_state(vif->ifp, WL_P2P_DISC_ST_SCAN, 0, 0); in brcmf_p2p_enable_discovery()
618 * Set wsec to any non-zero value in the discovery bsscfg in brcmf_p2p_enable_discovery()
623 ret = brcmf_fil_bsscfg_int_set(vif->ifp, "wsec", AES_ENABLED); in brcmf_p2p_enable_discovery()
629 set_bit(BRCMF_P2P_STATUS_ENABLED, &p2p->status); in brcmf_p2p_enable_discovery()
635 * brcmf_p2p_escan() - initiate a P2P scan.
647 struct brcmf_pub *drvr = p2p->cfg->pub; in brcmf_p2p_escan()
662 return -ENOMEM; in brcmf_p2p_escan()
664 vif = p2p->bss_idx[bss_type].vif; in brcmf_p2p_escan()
667 ret = -EINVAL; in brcmf_p2p_escan()
671 sparams = &p2p_params->eparams.params_le; in brcmf_p2p_escan()
688 sparams->ssid_le.SSID_len = in brcmf_p2p_escan()
690 memcpy(sparams->ssid_le.SSID, BRCMF_P2P_WILDCARD_SSID, in brcmf_p2p_escan()
695 ret = -EINVAL; in brcmf_p2p_escan()
699 brcmf_p2p_set_discover_state(vif->ifp, search_state, 0, 0); in brcmf_p2p_escan()
704 p2p_params->type = 'E'; in brcmf_p2p_escan()
707 sparams->bss_type = DOT11_BSSTYPE_ANY; in brcmf_p2p_escan()
708 sparams->scan_type = BRCMF_SCANTYPE_ACTIVE; in brcmf_p2p_escan()
710 eth_broadcast_addr(sparams->bssid); in brcmf_p2p_escan()
711 sparams->home_time = cpu_to_le32(P2PAPI_SCAN_HOME_TIME_MS); in brcmf_p2p_escan()
721 else if (brcmf_get_vif_state_any(p2p->cfg, BRCMF_VIF_STATUS_CONNECTED)) in brcmf_p2p_escan()
722 active = -1; in brcmf_p2p_escan()
741 sparams->active_time = cpu_to_le32(active); in brcmf_p2p_escan()
742 sparams->nprobes = cpu_to_le32(nprobes); in brcmf_p2p_escan()
743 sparams->passive_time = cpu_to_le32(-1); in brcmf_p2p_escan()
744 sparams->channel_num = cpu_to_le32(num_chans & in brcmf_p2p_escan()
747 sparams->channel_list[i] = cpu_to_le16(chanspecs[i]); in brcmf_p2p_escan()
750 p2p_params->eparams.version = cpu_to_le32(BRCMF_ESCAN_REQ_VERSION); in brcmf_p2p_escan()
751 p2p_params->eparams.action = cpu_to_le16(WL_ESCAN_ACTION_START); in brcmf_p2p_escan()
752 p2p_params->eparams.sync_id = cpu_to_le16(0x1234); in brcmf_p2p_escan()
754 ret = brcmf_fil_bsscfg_data_set(vif->ifp, "p2p_scan", memblk, memsize); in brcmf_p2p_escan()
756 set_bit(BRCMF_SCAN_STATUS_BUSY, &p2p->cfg->scan_status); in brcmf_p2p_escan()
763 * brcmf_p2p_run_escan() - escan callback for peer-to-peer.
776 struct brcmf_p2p_info *p2p = &cfg->p2p; in brcmf_p2p_run_escan()
777 struct brcmf_pub *drvr = cfg->pub; in brcmf_p2p_run_escan()
788 err = -EINVAL; in brcmf_p2p_run_escan()
792 if (request->n_channels) { in brcmf_p2p_run_escan()
793 chanspecs = kcalloc(request->n_channels, sizeof(*chanspecs), in brcmf_p2p_run_escan()
796 err = -ENOMEM; in brcmf_p2p_run_escan()
799 vif = p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif; in brcmf_p2p_run_escan()
801 dev = vif->wdev.netdev; in brcmf_p2p_run_escan()
802 if (request->n_channels == 3 && in brcmf_p2p_run_escan()
803 request->channels[0]->hw_value == SOCIAL_CHAN_1 && in brcmf_p2p_run_escan()
804 request->channels[1]->hw_value == SOCIAL_CHAN_2 && in brcmf_p2p_run_escan()
805 request->channels[2]->hw_value == SOCIAL_CHAN_3) { in brcmf_p2p_run_escan()
810 vif->wdev.iftype == NL80211_IFTYPE_P2P_GO) { in brcmf_p2p_run_escan()
821 for (i = 0; i < request->n_channels; i++) { in brcmf_p2p_run_escan()
822 struct ieee80211_channel *chan = request->channels[i]; in brcmf_p2p_run_escan()
824 if (chan->flags & (IEEE80211_CHAN_RADAR | in brcmf_p2p_run_escan()
828 chanspecs[i] = channel_to_chanspec(&p2p->cfg->d11inf, in brcmf_p2p_run_escan()
831 num_nodfs, chan->hw_value, chanspecs[i]); in brcmf_p2p_run_escan()
846 * brcmf_p2p_find_listen_channel() - find listen channel in ie string.
877 return -EPERM; in brcmf_p2p_find_listen_channel()
882 * brcmf_p2p_scan_prep() - prepare scan based on request.
889 * escan .run() callback for peer-to-peer scanning.
896 struct brcmf_p2p_info *p2p = &cfg->p2p; in brcmf_p2p_scan_prep()
901 err = brcmf_p2p_find_listen_channel(request->ie, in brcmf_p2p_scan_prep()
902 request->ie_len); in brcmf_p2p_scan_prep()
906 p2p->afx_hdl.my_listen_chan = err; in brcmf_p2p_scan_prep()
908 clear_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status); in brcmf_p2p_scan_prep()
916 cfg->escan_info.run = brcmf_p2p_run_escan; in brcmf_p2p_scan_prep()
923 * brcmf_p2p_discover_listen() - set firmware to discover listen state.
933 struct brcmf_pub *drvr = p2p->cfg->pub; in brcmf_p2p_discover_listen()
938 vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; in brcmf_p2p_discover_listen()
941 err = -EPERM; in brcmf_p2p_discover_listen()
945 if (test_bit(BRCMF_P2P_STATUS_DISCOVER_LISTEN, &p2p->status)) { in brcmf_p2p_discover_listen()
953 p2p->cfg->d11inf.encchspec(&ch); in brcmf_p2p_discover_listen()
954 err = brcmf_p2p_set_discover_state(vif->ifp, WL_P2P_DISC_ST_LISTEN, in brcmf_p2p_discover_listen()
957 set_bit(BRCMF_P2P_STATUS_DISCOVER_LISTEN, &p2p->status); in brcmf_p2p_discover_listen()
958 p2p->remain_on_channel_cookie++; in brcmf_p2p_discover_listen()
966 * brcmf_p2p_remain_on_channel() - put device on channel and stay there.
979 struct brcmf_p2p_info *p2p = &cfg->p2p; in brcmf_p2p_remain_on_channel()
983 channel_nr = ieee80211_frequency_to_channel(channel->center_freq); in brcmf_p2p_remain_on_channel()
994 memcpy(&p2p->remain_on_channel, channel, sizeof(*channel)); in brcmf_p2p_remain_on_channel()
995 *cookie = p2p->remain_on_channel_cookie; in brcmf_p2p_remain_on_channel()
1004 * brcmf_p2p_notify_listen_complete() - p2p listen has completed.
1015 struct brcmf_cfg80211_info *cfg = ifp->drvr->config; in brcmf_p2p_notify_listen_complete()
1016 struct brcmf_p2p_info *p2p = &cfg->p2p; in brcmf_p2p_notify_listen_complete()
1020 &p2p->status)) { in brcmf_p2p_notify_listen_complete()
1022 &p2p->status)) { in brcmf_p2p_notify_listen_complete()
1024 &p2p->status); in brcmf_p2p_notify_listen_complete()
1026 complete(&p2p->wait_next_af); in brcmf_p2p_notify_listen_complete()
1029 cfg80211_remain_on_channel_expired(&ifp->vif->wdev, in brcmf_p2p_notify_listen_complete()
1030 p2p->remain_on_channel_cookie, in brcmf_p2p_notify_listen_complete()
1031 &p2p->remain_on_channel, in brcmf_p2p_notify_listen_complete()
1039 * brcmf_p2p_cancel_remain_on_channel() - cancel p2p listen state.
1054 * brcmf_p2p_act_frm_search() - search function for action frame.
1064 struct brcmf_pub *drvr = p2p->cfg->pub; in brcmf_p2p_act_frm_search()
1081 err = -ENOMEM; in brcmf_p2p_act_frm_search()
1087 p2p->cfg->d11inf.encchspec(&ch); in brcmf_p2p_act_frm_search()
1093 p2p->cfg->d11inf.encchspec(&ch); in brcmf_p2p_act_frm_search()
1096 p2p->cfg->d11inf.encchspec(&ch); in brcmf_p2p_act_frm_search()
1099 p2p->cfg->d11inf.encchspec(&ch); in brcmf_p2p_act_frm_search()
1111 * brcmf_p2p_afx_handler() - afx worker thread.
1122 struct brcmf_pub *drvr = p2p->cfg->pub; in brcmf_p2p_afx_handler()
1125 if (!afx_hdl->is_active) in brcmf_p2p_afx_handler()
1128 if (afx_hdl->is_listen && afx_hdl->my_listen_chan) in brcmf_p2p_afx_handler()
1130 err = brcmf_p2p_discover_listen(p2p, afx_hdl->my_listen_chan, in brcmf_p2p_afx_handler()
1133 err = brcmf_p2p_act_frm_search(p2p, afx_hdl->peer_listen_chan); in brcmf_p2p_afx_handler()
1138 &p2p->status)) in brcmf_p2p_afx_handler()
1139 complete(&afx_hdl->act_frm_scan); in brcmf_p2p_afx_handler()
1145 * brcmf_p2p_af_searching_channel() - search channel.
1152 struct afx_hdl *afx_hdl = &p2p->afx_hdl; in brcmf_p2p_af_searching_channel()
1158 pri_vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif; in brcmf_p2p_af_searching_channel()
1160 reinit_completion(&afx_hdl->act_frm_scan); in brcmf_p2p_af_searching_channel()
1161 set_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, &p2p->status); in brcmf_p2p_af_searching_channel()
1162 afx_hdl->is_active = true; in brcmf_p2p_af_searching_channel()
1163 afx_hdl->peer_chan = P2P_INVALID_CHANNEL; in brcmf_p2p_af_searching_channel()
1170 (afx_hdl->peer_chan == P2P_INVALID_CHANNEL)) { in brcmf_p2p_af_searching_channel()
1171 afx_hdl->is_listen = false; in brcmf_p2p_af_searching_channel()
1175 schedule_work(&afx_hdl->afx_work); in brcmf_p2p_af_searching_channel()
1176 wait_for_completion_timeout(&afx_hdl->act_frm_scan, in brcmf_p2p_af_searching_channel()
1178 if ((afx_hdl->peer_chan != P2P_INVALID_CHANNEL) || in brcmf_p2p_af_searching_channel()
1180 &p2p->status))) in brcmf_p2p_af_searching_channel()
1183 if (afx_hdl->my_listen_chan) { in brcmf_p2p_af_searching_channel()
1185 afx_hdl->my_listen_chan); in brcmf_p2p_af_searching_channel()
1187 afx_hdl->is_listen = true; in brcmf_p2p_af_searching_channel()
1188 schedule_work(&afx_hdl->afx_work); in brcmf_p2p_af_searching_channel()
1189 wait_for_completion_timeout(&afx_hdl->act_frm_scan, in brcmf_p2p_af_searching_channel()
1192 if ((afx_hdl->peer_chan != P2P_INVALID_CHANNEL) || in brcmf_p2p_af_searching_channel()
1194 &p2p->status))) in brcmf_p2p_af_searching_channel()
1201 if (test_bit(BRCMF_VIF_STATUS_CONNECTED, &pri_vif->sme_state) || in brcmf_p2p_af_searching_channel()
1202 test_bit(BRCMF_VIF_STATUS_CONNECTING, &pri_vif->sme_state)) in brcmf_p2p_af_searching_channel()
1207 afx_hdl->peer_chan); in brcmf_p2p_af_searching_channel()
1208 afx_hdl->is_active = false; in brcmf_p2p_af_searching_channel()
1210 clear_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, &p2p->status); in brcmf_p2p_af_searching_channel()
1212 return afx_hdl->peer_chan; in brcmf_p2p_af_searching_channel()
1217 * brcmf_p2p_scan_finding_common_channel() - was escan used for finding channel
1227 struct brcmf_p2p_info *p2p = &cfg->p2p; in brcmf_p2p_scan_finding_common_channel()
1228 struct afx_hdl *afx_hdl = &p2p->afx_hdl; in brcmf_p2p_scan_finding_common_channel()
1234 if (!test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, &p2p->status)) in brcmf_p2p_scan_finding_common_channel()
1239 if (afx_hdl->peer_chan == P2P_INVALID_CHANNEL) in brcmf_p2p_scan_finding_common_channel()
1240 complete(&afx_hdl->act_frm_scan); in brcmf_p2p_scan_finding_common_channel()
1244 ie = ((u8 *)bi) + le16_to_cpu(bi->ie_offset); in brcmf_p2p_scan_finding_common_channel()
1246 err = cfg80211_get_p2p_attr(ie, le32_to_cpu(bi->ie_length), in brcmf_p2p_scan_finding_common_channel()
1250 err = cfg80211_get_p2p_attr(ie, le32_to_cpu(bi->ie_length), in brcmf_p2p_scan_finding_common_channel()
1254 (ether_addr_equal(p2p_dev_addr, afx_hdl->tx_dst_addr))) { in brcmf_p2p_scan_finding_common_channel()
1255 if (!bi->ctl_ch) { in brcmf_p2p_scan_finding_common_channel()
1256 ch.chspec = le16_to_cpu(bi->chanspec); in brcmf_p2p_scan_finding_common_channel()
1257 cfg->d11inf.decchspec(&ch); in brcmf_p2p_scan_finding_common_channel()
1258 bi->ctl_ch = ch.control_ch_num; in brcmf_p2p_scan_finding_common_channel()
1260 afx_hdl->peer_chan = bi->ctl_ch; in brcmf_p2p_scan_finding_common_channel()
1262 afx_hdl->tx_dst_addr, afx_hdl->peer_chan); in brcmf_p2p_scan_finding_common_channel()
1263 complete(&afx_hdl->act_frm_scan); in brcmf_p2p_scan_finding_common_channel()
1269 * brcmf_p2p_abort_action_frame() - abort action frame.
1276 struct brcmf_p2p_info *p2p = &cfg->p2p; in brcmf_p2p_abort_action_frame()
1283 vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; in brcmf_p2p_abort_action_frame()
1284 err = brcmf_fil_bsscfg_data_set(vif->ifp, "actframe_abort", &int_val, in brcmf_p2p_abort_action_frame()
1293 * brcmf_p2p_stop_wait_next_action_frame() - finish scan if af tx complete.
1301 struct brcmf_p2p_info *p2p = &cfg->p2p; in brcmf_p2p_stop_wait_next_action_frame()
1302 struct brcmf_if *ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp; in brcmf_p2p_stop_wait_next_action_frame()
1305 if (test_bit(BRCMF_P2P_STATUS_SENDING_ACT_FRAME, &p2p->status) && in brcmf_p2p_stop_wait_next_action_frame()
1306 (test_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, &p2p->status) || in brcmf_p2p_stop_wait_next_action_frame()
1307 test_bit(BRCMF_P2P_STATUS_ACTION_TX_NOACK, &p2p->status))) { in brcmf_p2p_stop_wait_next_action_frame()
1312 if (p2p->af_sent_channel) { in brcmf_p2p_stop_wait_next_action_frame()
1320 &p2p->status)) { in brcmf_p2p_stop_wait_next_action_frame()
1329 * brcmf_p2p_gon_req_collision() - Check if go negotiaton collission
1339 struct brcmf_cfg80211_info *cfg = p2p->cfg; in brcmf_p2p_gon_req_collision()
1344 if (!test_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME, &p2p->status) || in brcmf_p2p_gon_req_collision()
1345 !p2p->gon_req_action) in brcmf_p2p_gon_req_collision()
1354 ifp = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif->ifp; in brcmf_p2p_gon_req_collision()
1355 if (memcmp(mac, ifp->mac_addr, ETH_ALEN) < 0) { in brcmf_p2p_gon_req_collision()
1357 p2p->block_gon_req_tx = true; in brcmf_p2p_gon_req_collision()
1362 &p2p->status)) in brcmf_p2p_gon_req_collision()
1363 complete(&p2p->afx_hdl.act_frm_scan); in brcmf_p2p_gon_req_collision()
1365 &p2p->status)) in brcmf_p2p_gon_req_collision()
1378 * brcmf_p2p_notify_action_frame_rx() - received action frame.
1389 struct brcmf_pub *drvr = ifp->drvr; in brcmf_p2p_notify_action_frame_rx()
1390 struct brcmf_cfg80211_info *cfg = drvr->config; in brcmf_p2p_notify_action_frame_rx()
1391 struct brcmf_p2p_info *p2p = &cfg->p2p; in brcmf_p2p_notify_action_frame_rx()
1392 struct afx_hdl *afx_hdl = &p2p->afx_hdl; in brcmf_p2p_notify_action_frame_rx()
1394 u32 mgmt_frame_len = e->datalen - sizeof(struct brcmf_rx_mgmt_data); in brcmf_p2p_notify_action_frame_rx()
1405 if (e->datalen < sizeof(*rxframe)) { in brcmf_p2p_notify_action_frame_rx()
1410 ch.chspec = be16_to_cpu(rxframe->chanspec); in brcmf_p2p_notify_action_frame_rx()
1411 cfg->d11inf.decchspec(&ch); in brcmf_p2p_notify_action_frame_rx()
1413 brcmf_dbg(INFO, "ifp->vif->mgmt_rx_reg %04x\n", ifp->vif->mgmt_rx_reg); in brcmf_p2p_notify_action_frame_rx()
1415 if ((ifp->vif->mgmt_rx_reg & BIT(mgmt_type)) == 0) in brcmf_p2p_notify_action_frame_rx()
1423 action = act_frm->subtype; in brcmf_p2p_notify_action_frame_rx()
1425 (brcmf_p2p_gon_req_collision(p2p, (u8 *)e->addr))) { in brcmf_p2p_notify_action_frame_rx()
1427 &p2p->status) && in brcmf_p2p_notify_action_frame_rx()
1428 (ether_addr_equal(afx_hdl->tx_dst_addr, e->addr))) { in brcmf_p2p_notify_action_frame_rx()
1429 afx_hdl->peer_chan = ch.control_ch_num; in brcmf_p2p_notify_action_frame_rx()
1431 afx_hdl->peer_chan); in brcmf_p2p_notify_action_frame_rx()
1432 complete(&afx_hdl->act_frm_scan); in brcmf_p2p_notify_action_frame_rx()
1442 clear_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status); in brcmf_p2p_notify_action_frame_rx()
1446 action = sd_act_frm->action; in brcmf_p2p_notify_action_frame_rx()
1449 if (test_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME, &p2p->status) && in brcmf_p2p_notify_action_frame_rx()
1450 (p2p->next_af_subtype == action)) { in brcmf_p2p_notify_action_frame_rx()
1453 &p2p->status); in brcmf_p2p_notify_action_frame_rx()
1462 return -ENOMEM; in brcmf_p2p_notify_action_frame_rx()
1464 memcpy(mgmt_frame->da, ifp->mac_addr, ETH_ALEN); in brcmf_p2p_notify_action_frame_rx()
1465 brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSSID, mgmt_frame->bssid, in brcmf_p2p_notify_action_frame_rx()
1467 memcpy(mgmt_frame->sa, e->addr, ETH_ALEN); in brcmf_p2p_notify_action_frame_rx()
1468 mgmt_frame->frame_control = cpu_to_le16(IEEE80211_STYPE_ACTION); in brcmf_p2p_notify_action_frame_rx()
1469 memcpy(mgmt_frame->u.body, frame, mgmt_frame_len); in brcmf_p2p_notify_action_frame_rx()
1477 wdev = &ifp->vif->wdev; in brcmf_p2p_notify_action_frame_rx()
1486 * brcmf_p2p_notify_action_tx_complete() - transmit action frame complete
1497 struct brcmf_cfg80211_info *cfg = ifp->drvr->config; in brcmf_p2p_notify_action_tx_complete()
1498 struct brcmf_p2p_info *p2p = &cfg->p2p; in brcmf_p2p_notify_action_tx_complete()
1501 e->event_code == BRCMF_E_ACTION_FRAME_OFF_CHAN_COMPLETE ? in brcmf_p2p_notify_action_tx_complete()
1503 e->status); in brcmf_p2p_notify_action_tx_complete()
1505 if (!test_bit(BRCMF_P2P_STATUS_SENDING_ACT_FRAME, &p2p->status)) in brcmf_p2p_notify_action_tx_complete()
1508 if (e->event_code == BRCMF_E_ACTION_FRAME_COMPLETE) { in brcmf_p2p_notify_action_tx_complete()
1509 if (e->status == BRCMF_E_STATUS_SUCCESS) { in brcmf_p2p_notify_action_tx_complete()
1511 &p2p->status); in brcmf_p2p_notify_action_tx_complete()
1512 if (!p2p->wait_for_offchan_complete) in brcmf_p2p_notify_action_tx_complete()
1513 complete(&p2p->send_af_done); in brcmf_p2p_notify_action_tx_complete()
1515 set_bit(BRCMF_P2P_STATUS_ACTION_TX_NOACK, &p2p->status); in brcmf_p2p_notify_action_tx_complete()
1523 complete(&p2p->send_af_done); in brcmf_p2p_notify_action_tx_complete()
1530 * brcmf_p2p_tx_action_frame() - send action frame over fil.
1544 struct brcmf_pub *drvr = p2p->cfg->pub; in brcmf_p2p_tx_action_frame()
1551 reinit_completion(&p2p->send_af_done); in brcmf_p2p_tx_action_frame()
1552 clear_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, &p2p->status); in brcmf_p2p_tx_action_frame()
1553 clear_bit(BRCMF_P2P_STATUS_ACTION_TX_NOACK, &p2p->status); in brcmf_p2p_tx_action_frame()
1556 p2p_af = (struct brcmf_p2p_action_frame *)af_params->action_frame.data; in brcmf_p2p_tx_action_frame()
1557 if (p2p_af->subtype == P2P_AF_PRESENCE_RSP) in brcmf_p2p_tx_action_frame()
1558 vif = p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif; in brcmf_p2p_tx_action_frame()
1560 vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; in brcmf_p2p_tx_action_frame()
1562 err = brcmf_fil_bsscfg_data_set(vif->ifp, "actframe", af_params, in brcmf_p2p_tx_action_frame()
1569 p2p->af_sent_channel = le32_to_cpu(af_params->channel); in brcmf_p2p_tx_action_frame()
1570 p2p->af_tx_sent_jiffies = jiffies; in brcmf_p2p_tx_action_frame()
1572 if (test_bit(BRCMF_P2P_STATUS_DISCOVER_LISTEN, &p2p->status) && in brcmf_p2p_tx_action_frame()
1573 p2p->af_sent_channel == in brcmf_p2p_tx_action_frame()
1574 ieee80211_frequency_to_channel(p2p->remain_on_channel.center_freq)) in brcmf_p2p_tx_action_frame()
1575 p2p->wait_for_offchan_complete = false; in brcmf_p2p_tx_action_frame()
1577 p2p->wait_for_offchan_complete = true; in brcmf_p2p_tx_action_frame()
1580 (p2p->wait_for_offchan_complete) ? in brcmf_p2p_tx_action_frame()
1581 "off-channel" : "on-channel"); in brcmf_p2p_tx_action_frame()
1583 wait_for_completion_timeout(&p2p->send_af_done, P2P_AF_MAX_WAIT_TIME); in brcmf_p2p_tx_action_frame()
1585 if (test_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, &p2p->status)) { in brcmf_p2p_tx_action_frame()
1588 err = -EIO; in brcmf_p2p_tx_action_frame()
1592 clear_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, &p2p->status); in brcmf_p2p_tx_action_frame()
1593 clear_bit(BRCMF_P2P_STATUS_ACTION_TX_NOACK, &p2p->status); in brcmf_p2p_tx_action_frame()
1601 * brcmf_p2p_pub_af_tx() - public action frame tx routine.
1613 struct brcmf_p2p_info *p2p = &cfg->p2p; in brcmf_p2p_pub_af_tx()
1614 struct brcmf_pub *drvr = cfg->pub; in brcmf_p2p_pub_af_tx()
1620 action_frame = &af_params->action_frame; in brcmf_p2p_pub_af_tx()
1621 act_frm = (struct brcmf_p2p_pub_act_frame *)(action_frame->data); in brcmf_p2p_pub_af_tx()
1623 config_af_params->extra_listen = true; in brcmf_p2p_pub_af_tx()
1625 switch (act_frm->subtype) { in brcmf_p2p_pub_af_tx()
1628 set_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status); in brcmf_p2p_pub_af_tx()
1629 config_af_params->mpc_onoff = 0; in brcmf_p2p_pub_af_tx()
1630 config_af_params->search_channel = true; in brcmf_p2p_pub_af_tx()
1631 p2p->next_af_subtype = act_frm->subtype + 1; in brcmf_p2p_pub_af_tx()
1632 p2p->gon_req_action = true; in brcmf_p2p_pub_af_tx()
1634 af_params->dwell_time = cpu_to_le32(P2P_AF_MED_DWELL_TIME); in brcmf_p2p_pub_af_tx()
1637 p2p->next_af_subtype = act_frm->subtype + 1; in brcmf_p2p_pub_af_tx()
1639 af_params->dwell_time = cpu_to_le32(P2P_AF_MED_DWELL_TIME); in brcmf_p2p_pub_af_tx()
1644 clear_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status); in brcmf_p2p_pub_af_tx()
1646 config_af_params->mpc_onoff = 1; in brcmf_p2p_pub_af_tx()
1648 af_params->dwell_time = cpu_to_le32(P2P_AF_MIN_DWELL_TIME); in brcmf_p2p_pub_af_tx()
1649 config_af_params->extra_listen = false; in brcmf_p2p_pub_af_tx()
1652 config_af_params->search_channel = true; in brcmf_p2p_pub_af_tx()
1653 p2p->next_af_subtype = act_frm->subtype + 1; in brcmf_p2p_pub_af_tx()
1655 af_params->dwell_time = cpu_to_le32(P2P_AF_MED_DWELL_TIME); in brcmf_p2p_pub_af_tx()
1659 af_params->dwell_time = cpu_to_le32(P2P_AF_MIN_DWELL_TIME); in brcmf_p2p_pub_af_tx()
1660 config_af_params->extra_listen = false; in brcmf_p2p_pub_af_tx()
1663 config_af_params->search_channel = true; in brcmf_p2p_pub_af_tx()
1664 p2p->next_af_subtype = act_frm->subtype + 1; in brcmf_p2p_pub_af_tx()
1666 af_params->dwell_time = cpu_to_le32(P2P_AF_LONG_DWELL_TIME); in brcmf_p2p_pub_af_tx()
1670 af_params->dwell_time = cpu_to_le32(P2P_AF_MIN_DWELL_TIME); in brcmf_p2p_pub_af_tx()
1671 config_af_params->extra_listen = false; in brcmf_p2p_pub_af_tx()
1674 ie_len = le16_to_cpu(action_frame->len) - in brcmf_p2p_pub_af_tx()
1676 if (cfg80211_get_p2p_attr(&act_frm->elts[0], ie_len, in brcmf_p2p_pub_af_tx()
1679 config_af_params->search_channel = true; in brcmf_p2p_pub_af_tx()
1680 config_af_params->mpc_onoff = 0; in brcmf_p2p_pub_af_tx()
1681 p2p->next_af_subtype = act_frm->subtype + 1; in brcmf_p2p_pub_af_tx()
1683 af_params->dwell_time = cpu_to_le32(P2P_AF_MED_DWELL_TIME); in brcmf_p2p_pub_af_tx()
1687 p2p->next_af_subtype = P2P_PAF_GON_REQ; in brcmf_p2p_pub_af_tx()
1689 af_params->dwell_time = cpu_to_le32(P2P_AF_MED_DWELL_TIME); in brcmf_p2p_pub_af_tx()
1690 config_af_params->extra_listen = false; in brcmf_p2p_pub_af_tx()
1694 act_frm->subtype); in brcmf_p2p_pub_af_tx()
1695 err = -EINVAL; in brcmf_p2p_pub_af_tx()
1704 (jiffies_to_msecs(jiffies - dwell_jiffies) > in brcmf_p2p_check_dwell_overflow()
1712 * brcmf_p2p_send_action_frame() - send action frame .
1722 struct brcmf_p2p_info *p2p = &cfg->p2p; in brcmf_p2p_send_action_frame()
1726 struct afx_hdl *afx_hdl = &p2p->afx_hdl; in brcmf_p2p_send_action_frame()
1727 struct brcmf_pub *drvr = cfg->pub; in brcmf_p2p_send_action_frame()
1738 u32 requested_dwell = le32_to_cpu(af_params->dwell_time); in brcmf_p2p_send_action_frame()
1739 action_frame = &af_params->action_frame; in brcmf_p2p_send_action_frame()
1740 action_frame_len = le16_to_cpu(action_frame->len); in brcmf_p2p_send_action_frame()
1742 brcmf_p2p_print_actframe(true, action_frame->data, action_frame_len); in brcmf_p2p_send_action_frame()
1744 /* Add the default dwell time. Dwell time to stay off-channel */ in brcmf_p2p_send_action_frame()
1747 af_params->dwell_time = cpu_to_le32(P2P_AF_DWELL_TIME); in brcmf_p2p_send_action_frame()
1749 category = action_frame->data[DOT11_ACTION_CAT_OFF]; in brcmf_p2p_send_action_frame()
1750 action = action_frame->data[DOT11_ACTION_ACT_OFF]; in brcmf_p2p_send_action_frame()
1753 p2p->next_af_subtype = P2P_PAF_SUBTYPE_INVALID; in brcmf_p2p_send_action_frame()
1754 p2p->gon_req_action = false; in brcmf_p2p_send_action_frame()
1757 config_af_params.mpc_onoff = -1; in brcmf_p2p_send_action_frame()
1761 if (brcmf_p2p_is_pub_action(action_frame->data, action_frame_len)) { in brcmf_p2p_send_action_frame()
1768 } else if (brcmf_p2p_is_gas_action(action_frame->data, in brcmf_p2p_send_action_frame()
1778 p2p->next_af_subtype = action + 1; in brcmf_p2p_send_action_frame()
1780 af_params->dwell_time = in brcmf_p2p_send_action_frame()
1785 af_params->dwell_time = in brcmf_p2p_send_action_frame()
1791 } else if (brcmf_p2p_is_p2p_action(action_frame->data, in brcmf_p2p_send_action_frame()
1805 &p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->sme_state)) in brcmf_p2p_send_action_frame()
1809 if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) in brcmf_p2p_send_action_frame()
1812 memcpy(afx_hdl->tx_dst_addr, action_frame->da, ETH_ALEN); in brcmf_p2p_send_action_frame()
1819 if (p2p->next_af_subtype != P2P_PAF_SUBTYPE_INVALID) { in brcmf_p2p_send_action_frame()
1821 set_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME, &p2p->status); in brcmf_p2p_send_action_frame()
1824 p2p->af_sent_channel = 0; in brcmf_p2p_send_action_frame()
1825 set_bit(BRCMF_P2P_STATUS_SENDING_ACT_FRAME, &p2p->status); in brcmf_p2p_send_action_frame()
1828 IS_P2P_SOCIAL_CHANNEL(le32_to_cpu(af_params->channel)) && in brcmf_p2p_send_action_frame()
1829 p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif->saved_ie.probe_req_ie_len) { in brcmf_p2p_send_action_frame()
1830 afx_hdl = &p2p->afx_hdl; in brcmf_p2p_send_action_frame()
1831 afx_hdl->peer_listen_chan = le32_to_cpu(af_params->channel); in brcmf_p2p_send_action_frame()
1847 af_params->channel = cpu_to_le32(afx_hdl->peer_chan); in brcmf_p2p_send_action_frame()
1854 while (!p2p->block_gon_req_tx && in brcmf_p2p_send_action_frame()
1857 if (af_params->channel) in brcmf_p2p_send_action_frame()
1868 clear_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status); in brcmf_p2p_send_action_frame()
1872 clear_bit(BRCMF_P2P_STATUS_SENDING_ACT_FRAME, &p2p->status); in brcmf_p2p_send_action_frame()
1879 if (ack && config_af_params.extra_listen && !p2p->block_gon_req_tx && in brcmf_p2p_send_action_frame()
1880 test_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME, &p2p->status) && in brcmf_p2p_send_action_frame()
1881 p2p->af_sent_channel == afx_hdl->my_listen_chan) { in brcmf_p2p_send_action_frame()
1882 delta_ms = jiffies_to_msecs(jiffies - p2p->af_tx_sent_jiffies); in brcmf_p2p_send_action_frame()
1883 if (le32_to_cpu(af_params->dwell_time) > delta_ms) in brcmf_p2p_send_action_frame()
1884 extra_listen_time = le32_to_cpu(af_params->dwell_time) - in brcmf_p2p_send_action_frame()
1890 &p2p->status); in brcmf_p2p_send_action_frame()
1892 le32_to_cpu(af_params->dwell_time), in brcmf_p2p_send_action_frame()
1896 p2p->af_sent_channel, in brcmf_p2p_send_action_frame()
1902 wait_for_completion_timeout(&p2p->wait_next_af, in brcmf_p2p_send_action_frame()
1906 &p2p->status); in brcmf_p2p_send_action_frame()
1910 if (p2p->block_gon_req_tx) { in brcmf_p2p_send_action_frame()
1914 p2p->block_gon_req_tx = false; in brcmf_p2p_send_action_frame()
1918 clear_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME, &p2p->status); in brcmf_p2p_send_action_frame()
1927 * brcmf_p2p_notify_rx_mgmt_p2p_probereq() - Event handler for p2p probe req.
1937 struct brcmf_cfg80211_info *cfg = ifp->drvr->config; in brcmf_p2p_notify_rx_mgmt_p2p_probereq()
1938 struct brcmf_p2p_info *p2p = &cfg->p2p; in brcmf_p2p_notify_rx_mgmt_p2p_probereq()
1939 struct afx_hdl *afx_hdl = &p2p->afx_hdl; in brcmf_p2p_notify_rx_mgmt_p2p_probereq()
1940 struct brcmf_cfg80211_vif *vif = ifp->vif; in brcmf_p2p_notify_rx_mgmt_p2p_probereq()
1948 brcmf_dbg(INFO, "Enter: event %d reason %d\n", e->event_code, in brcmf_p2p_notify_rx_mgmt_p2p_probereq()
1949 e->reason); in brcmf_p2p_notify_rx_mgmt_p2p_probereq()
1951 if (e->datalen < sizeof(*rxframe)) { in brcmf_p2p_notify_rx_mgmt_p2p_probereq()
1956 ch.chspec = be16_to_cpu(rxframe->chanspec); in brcmf_p2p_notify_rx_mgmt_p2p_probereq()
1957 cfg->d11inf.decchspec(&ch); in brcmf_p2p_notify_rx_mgmt_p2p_probereq()
1959 if (test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, &p2p->status) && in brcmf_p2p_notify_rx_mgmt_p2p_probereq()
1960 (ether_addr_equal(afx_hdl->tx_dst_addr, e->addr))) { in brcmf_p2p_notify_rx_mgmt_p2p_probereq()
1961 afx_hdl->peer_chan = ch.control_ch_num; in brcmf_p2p_notify_rx_mgmt_p2p_probereq()
1963 afx_hdl->peer_chan); in brcmf_p2p_notify_rx_mgmt_p2p_probereq()
1964 complete(&afx_hdl->act_frm_scan); in brcmf_p2p_notify_rx_mgmt_p2p_probereq()
1969 if (e->bsscfgidx == 0) in brcmf_p2p_notify_rx_mgmt_p2p_probereq()
1972 /* Filter any P2P probe reqs arriving during the GO-NEG Phase */ in brcmf_p2p_notify_rx_mgmt_p2p_probereq()
1973 if (test_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status)) { in brcmf_p2p_notify_rx_mgmt_p2p_probereq()
1974 brcmf_dbg(INFO, "Filtering P2P probe_req in GO-NEG phase\n"); in brcmf_p2p_notify_rx_mgmt_p2p_probereq()
1979 brcmf_dbg(INFO, "vif->mgmt_rx_reg %04x\n", vif->mgmt_rx_reg); in brcmf_p2p_notify_rx_mgmt_p2p_probereq()
1981 if ((vif->mgmt_rx_reg & BIT(mgmt_type)) == 0) in brcmf_p2p_notify_rx_mgmt_p2p_probereq()
1985 mgmt_frame_len = e->datalen - sizeof(*rxframe); in brcmf_p2p_notify_rx_mgmt_p2p_probereq()
1991 cfg80211_rx_mgmt(&vif->wdev, freq, 0, mgmt_frame, mgmt_frame_len, 0); in brcmf_p2p_notify_rx_mgmt_p2p_probereq()
1993 brcmf_dbg(INFO, "mgmt_frame_len (%d) , e->datalen (%d), chanspec (%04x), freq (%d)\n", in brcmf_p2p_notify_rx_mgmt_p2p_probereq()
1994 mgmt_frame_len, e->datalen, ch.chspec, freq); in brcmf_p2p_notify_rx_mgmt_p2p_probereq()
2001 * brcmf_p2p_get_current_chanspec() - Get current operation channel.
2015 ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp; in brcmf_p2p_get_current_chanspec()
2025 *chanspec = le16_to_cpu(bi->chanspec); in brcmf_p2p_get_current_chanspec()
2035 p2p->cfg->d11inf.encchspec(&ch); in brcmf_p2p_get_current_chanspec()
2040 * brcmf_p2p_ifchange - Change a P2P Role.
2048 struct brcmf_p2p_info *p2p = &cfg->p2p; in brcmf_p2p_ifchange()
2049 struct brcmf_pub *drvr = cfg->pub; in brcmf_p2p_ifchange()
2057 vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif; in brcmf_p2p_ifchange()
2060 return -EPERM; in brcmf_p2p_ifchange()
2062 brcmf_notify_escan_complete(cfg, vif->ifp, true, true); in brcmf_p2p_ifchange()
2063 vif = p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif; in brcmf_p2p_ifchange()
2066 return -EPERM; in brcmf_p2p_ifchange()
2068 brcmf_set_mpc(vif->ifp, 0); in brcmf_p2p_ifchange()
2077 memcpy(if_request.addr, p2p->conn_int_addr, sizeof(if_request.addr)); in brcmf_p2p_ifchange()
2080 err = brcmf_fil_iovar_data_set(vif->ifp, "p2p_ifupd", &if_request, in brcmf_p2p_ifchange()
2092 return -EIO; in brcmf_p2p_ifchange()
2095 err = brcmf_fil_cmd_int_set(vif->ifp, BRCMF_C_SET_SCB_TIMEOUT, in brcmf_p2p_ifchange()
2125 struct brcmf_cfg80211_info *cfg = wdev_to_cfg(&vif->wdev); in brcmf_p2p_disable_p2p_if()
2128 const u8 *addr = vif->wdev.netdev->dev_addr; in brcmf_p2p_disable_p2p_if()
2135 struct brcmf_cfg80211_info *cfg = wdev_to_cfg(&vif->wdev); in brcmf_p2p_release_p2p_if()
2138 const u8 *addr = vif->wdev.netdev->dev_addr; in brcmf_p2p_release_p2p_if()
2144 * brcmf_p2p_create_p2pdev() - create a P2P_DEVICE virtual interface.
2154 struct brcmf_pub *drvr = p2p->cfg->pub; in brcmf_p2p_create_p2pdev()
2161 if (p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif) in brcmf_p2p_create_p2pdev()
2162 return ERR_PTR(-ENOSPC); in brcmf_p2p_create_p2pdev()
2164 p2p_vif = brcmf_alloc_vif(p2p->cfg, NL80211_IFTYPE_P2P_DEVICE); in brcmf_p2p_create_p2pdev()
2170 pri_ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp; in brcmf_p2p_create_p2pdev()
2173 if (addr && ether_addr_equal(addr, pri_ifp->mac_addr)) { in brcmf_p2p_create_p2pdev()
2175 err = -EINVAL; in brcmf_p2p_create_p2pdev()
2180 brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr); in brcmf_p2p_create_p2pdev()
2182 brcmf_cfg80211_arm_vif_event(p2p->cfg, p2p_vif); in brcmf_p2p_create_p2pdev()
2190 brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL); in brcmf_p2p_create_p2pdev()
2195 err = brcmf_cfg80211_wait_vif_event(p2p->cfg, BRCMF_E_IF_ADD, in brcmf_p2p_create_p2pdev()
2197 brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL); in brcmf_p2p_create_p2pdev()
2201 err = -EIO; in brcmf_p2p_create_p2pdev()
2206 p2p_ifp = p2p_vif->ifp; in brcmf_p2p_create_p2pdev()
2207 p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = p2p_vif; in brcmf_p2p_create_p2pdev()
2208 memcpy(p2p_ifp->mac_addr, p2p->dev_addr, ETH_ALEN); in brcmf_p2p_create_p2pdev()
2209 memcpy(&p2p_vif->wdev.address, p2p->dev_addr, sizeof(p2p->dev_addr)); in brcmf_p2p_create_p2pdev()
2218 WARN_ON(p2p_ifp->bsscfgidx != bsscfgidx); in brcmf_p2p_create_p2pdev()
2220 init_completion(&p2p->send_af_done); in brcmf_p2p_create_p2pdev()
2221 INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler); in brcmf_p2p_create_p2pdev()
2222 init_completion(&p2p->afx_hdl.act_frm_scan); in brcmf_p2p_create_p2pdev()
2223 init_completion(&p2p->wait_next_af); in brcmf_p2p_create_p2pdev()
2225 return &p2p_vif->wdev; in brcmf_p2p_create_p2pdev()
2238 return -ENODEV; in brcmf_p2p_get_conn_idx()
2241 if (!cfg->p2p.bss_idx[i].vif) { in brcmf_p2p_get_conn_idx()
2244 brcmf_err("Multi p2p not supported"); in brcmf_p2p_get_conn_idx()
2245 return -EIO; in brcmf_p2p_get_conn_idx()
2250 return -EIO; in brcmf_p2p_get_conn_idx()
2254 * brcmf_p2p_add_vif() - create a new P2P virtual interface.
2269 struct brcmf_pub *drvr = cfg->pub; in brcmf_p2p_add_vif()
2277 return ERR_PTR(-EBUSY); in brcmf_p2p_add_vif()
2289 return brcmf_p2p_create_p2pdev(&cfg->p2p, wiphy, in brcmf_p2p_add_vif()
2290 params->macaddr); in brcmf_p2p_add_vif()
2292 return ERR_PTR(-EOPNOTSUPP); in brcmf_p2p_add_vif()
2303 p2p_intf_addr = cfg->p2p.conn_int_addr; in brcmf_p2p_add_vif()
2305 p2p_intf_addr = cfg->p2p.conn2_int_addr; in brcmf_p2p_add_vif()
2307 err = -EINVAL; in brcmf_p2p_add_vif()
2310 err = brcmf_p2p_request_p2p_if(&cfg->p2p, ifp, in brcmf_p2p_add_vif()
2325 err = -EIO; in brcmf_p2p_add_vif()
2330 ifp = vif->ifp; in brcmf_p2p_add_vif()
2333 err = -ENOENT; in brcmf_p2p_add_vif()
2337 strscpy(ifp->ndev->name, name, sizeof(ifp->ndev->name)); in brcmf_p2p_add_vif()
2338 ifp->ndev->name_assign_type = name_assign_type; in brcmf_p2p_add_vif()
2342 free_netdev(ifp->ndev); in brcmf_p2p_add_vif()
2346 cfg->p2p.bss_idx[connidx].vif = vif; in brcmf_p2p_add_vif()
2354 return &ifp->vif->wdev; in brcmf_p2p_add_vif()
2362 * brcmf_p2p_del_vif() - delete a P2P virtual interface.
2370 struct brcmf_p2p_info *p2p = &cfg->p2p; in brcmf_p2p_del_vif()
2379 iftype = vif->wdev.iftype; in brcmf_p2p_del_vif()
2383 if (test_bit(BRCMF_VIF_STATUS_DISCONNECTING, &vif->sme_state)) in brcmf_p2p_del_vif()
2393 if (!p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif) in brcmf_p2p_del_vif()
2395 brcmf_p2p_cancel_remain_on_channel(vif->ifp); in brcmf_p2p_del_vif()
2400 return -ENOTSUPP; in brcmf_p2p_del_vif()
2403 clear_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status); in brcmf_p2p_del_vif()
2407 wait_for_completion_timeout(&cfg->vif_disabled, in brcmf_p2p_del_vif()
2420 err = -EIO; in brcmf_p2p_del_vif()
2424 brcmf_remove_interface(vif->ifp, true); in brcmf_p2p_del_vif()
2428 if (vif == p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif) in brcmf_p2p_del_vif()
2429 p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = NULL; in brcmf_p2p_del_vif()
2430 if (vif == p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION2].vif) in brcmf_p2p_del_vif()
2431 p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION2].vif = NULL; in brcmf_p2p_del_vif()
2443 vif = ifp->vif; in brcmf_p2p_ifp_removed()
2444 cfg = wdev_to_cfg(&vif->wdev); in brcmf_p2p_ifp_removed()
2445 cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL; in brcmf_p2p_ifp_removed()
2448 wiphy_lock(cfg->wiphy); in brcmf_p2p_ifp_removed()
2449 cfg80211_unregister_wdev(&vif->wdev); in brcmf_p2p_ifp_removed()
2450 wiphy_unlock(cfg->wiphy); in brcmf_p2p_ifp_removed()
2453 cfg80211_unregister_wdev(&vif->wdev); in brcmf_p2p_ifp_removed()
2461 struct brcmf_p2p_info *p2p = &cfg->p2p; in brcmf_p2p_start_device()
2466 mutex_lock(&cfg->usr_sync); in brcmf_p2p_start_device()
2469 set_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state); in brcmf_p2p_start_device()
2470 mutex_unlock(&cfg->usr_sync); in brcmf_p2p_start_device()
2477 struct brcmf_p2p_info *p2p = &cfg->p2p; in brcmf_p2p_stop_device()
2485 if (p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif == vif) { in brcmf_p2p_stop_device()
2486 mutex_lock(&cfg->usr_sync); in brcmf_p2p_stop_device()
2488 (void)brcmf_p2p_set_discover_state(vif->ifp, in brcmf_p2p_stop_device()
2491 clear_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state); in brcmf_p2p_stop_device()
2492 mutex_unlock(&cfg->usr_sync); in brcmf_p2p_stop_device()
2497 * brcmf_p2p_attach() - attach for P2P.
2504 struct brcmf_pub *drvr = cfg->pub; in brcmf_p2p_attach()
2510 p2p = &cfg->p2p; in brcmf_p2p_attach()
2511 p2p->cfg = cfg; in brcmf_p2p_attach()
2513 pri_ifp = brcmf_get_ifp(cfg->pub, 0); in brcmf_p2p_attach()
2514 p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif = pri_ifp->vif; in brcmf_p2p_attach()
2523 p2p->p2pdev_dynamically = true; in brcmf_p2p_attach()
2529 * brcmf_p2p_detach() - detach P2P.
2537 vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; in brcmf_p2p_detach()
2539 brcmf_p2p_cancel_remain_on_channel(vif->ifp); in brcmf_p2p_detach()
2541 brcmf_remove_interface(vif->ifp, false); in brcmf_p2p_detach()