Lines Matching +full:assoc +full:- +full:select

1 // SPDX-License-Identifier: ISC
49 #define WPA_CIPHER_WEP_40 1 /* WEP (40-bit) */
52 #define WPA_CIPHER_WEP_104 5 /* WEP (104-bit) */
56 #define RSN_AKM_PSK 2 /* Pre-shared Key */
58 #define RSN_AKM_SHA256_PSK 6 /* SHA256, Pre-shared Key */
91 (sizeof(struct brcmf_assoc_params_le) - sizeof(u16))
95 if (!test_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state)) { in check_vif_up()
97 vif->sme_state); in check_vif_up()
129 #define wl_a_rates_size (wl_g_rates_size - 4)
190 REG_RULE(2412-10, 2472+10, 40, 6, 20, 0),
192 /* IEEE 802.11 channel 14 - Only JP enables
195 REG_RULE(2484-10, 2484+10, 20, 6, 20, 0),
197 REG_RULE(5150-10, 5350+10, 160, 6, 20, 0),
199 REG_RULE(5470-10, 5850+10, 160, 6, 20, 0), }
257 ch->chan->center_freq, ch->center_freq1, ch->width); in chandef_to_chanspec()
258 ch_inf.chnum = ieee80211_frequency_to_channel(ch->center_freq1); in chandef_to_chanspec()
259 primary_offset = ch->chan->center_freq - ch->center_freq1; in chandef_to_chanspec()
260 switch (ch->width) { in chandef_to_chanspec()
275 if (primary_offset == -30) in chandef_to_chanspec()
277 else if (primary_offset == -10) in chandef_to_chanspec()
286 if (primary_offset == -70) in chandef_to_chanspec()
288 else if (primary_offset == -50) in chandef_to_chanspec()
290 else if (primary_offset == -30) in chandef_to_chanspec()
292 else if (primary_offset == -10) in chandef_to_chanspec()
309 switch (ch->chan->band) { in chandef_to_chanspec()
320 d11inf->encchspec(&ch_inf); in chandef_to_chanspec()
331 ch_inf.chnum = ieee80211_frequency_to_channel(ch->center_freq); in channel_to_chanspec()
333 d11inf->encchspec(&ch_inf); in channel_to_chanspec()
338 /* Traverse a string of 1-byte tag/1-byte length/variable-length value
350 int len = elt->len; in brcmf_parse_tlvs()
353 if ((elt->id == key) && (totlen >= (len + TLV_HDR_LEN))) in brcmf_parse_tlvs()
357 totlen -= (len + TLV_HDR_LEN); in brcmf_parse_tlvs()
382 *tlvs_len -= (int)(ie - *tlvs); in brcmf_tlv_has_ie()
426 list_for_each_entry(pos, &cfg->vif_list, list) in brcmf_vif_change_validate()
432 params.iftype_num[pos->wdev.iftype]++; in brcmf_vif_change_validate()
436 ret = cfg80211_check_combinations(cfg->wiphy, &params); in brcmf_vif_change_validate()
449 list_for_each_entry(pos, &cfg->vif_list, list) in brcmf_vif_add_validate()
450 params.iftype_num[pos->wdev.iftype]++; in brcmf_vif_add_validate()
453 return cfg80211_check_combinations(cfg->wiphy, &params); in brcmf_vif_add_validate()
459 key_le->index = cpu_to_le32(key->index); in convert_key_from_CPU()
460 key_le->len = cpu_to_le32(key->len); in convert_key_from_CPU()
461 key_le->algo = cpu_to_le32(key->algo); in convert_key_from_CPU()
462 key_le->flags = cpu_to_le32(key->flags); in convert_key_from_CPU()
463 key_le->rxiv.hi = cpu_to_le32(key->rxiv.hi); in convert_key_from_CPU()
464 key_le->rxiv.lo = cpu_to_le16(key->rxiv.lo); in convert_key_from_CPU()
465 key_le->iv_initialized = cpu_to_le32(key->iv_initialized); in convert_key_from_CPU()
466 memcpy(key_le->data, key->data, sizeof(key->data)); in convert_key_from_CPU()
467 memcpy(key_le->ea, key->ea, sizeof(key->ea)); in convert_key_from_CPU()
473 struct brcmf_pub *drvr = ifp->drvr; in send_key_to_dongle()
496 ifp = vif->ifp; in brcmf_cfg80211_update_proto_addr_mode()
498 if ((wdev->iftype == NL80211_IFTYPE_ADHOC) || in brcmf_cfg80211_update_proto_addr_mode()
499 (wdev->iftype == NL80211_IFTYPE_AP) || in brcmf_cfg80211_update_proto_addr_mode()
500 (wdev->iftype == NL80211_IFTYPE_P2P_GO)) in brcmf_cfg80211_update_proto_addr_mode()
501 brcmf_proto_configure_addr_mode(ifp->drvr, ifp->ifidx, in brcmf_cfg80211_update_proto_addr_mode()
504 brcmf_proto_configure_addr_mode(ifp->drvr, ifp->ifidx, in brcmf_cfg80211_update_proto_addr_mode()
516 if (!drvr->iflist[bsscfgidx]) in brcmf_get_first_free_bsscfgidx()
520 return -ENOMEM; in brcmf_get_first_free_bsscfgidx()
525 struct brcmf_pub *drvr = ifp->drvr; in brcmf_cfg80211_request_ap_if()
531 bsscfgidx = brcmf_get_first_free_bsscfgidx(ifp->drvr); in brcmf_cfg80211_request_ap_if()
548 * brcmf_ap_add_vif() - create a new AP virtual interface for multiple BSS
560 struct brcmf_pub *drvr = cfg->pub; in brcmf_ap_add_vif()
565 return ERR_PTR(-EBUSY); in brcmf_ap_add_vif()
587 err = -EIO; in brcmf_ap_add_vif()
592 ifp = vif->ifp; in brcmf_ap_add_vif()
595 err = -ENOENT; in brcmf_ap_add_vif()
599 strncpy(ifp->ndev->name, name, sizeof(ifp->ndev->name) - 1); in brcmf_ap_add_vif()
603 free_netdev(ifp->ndev); in brcmf_ap_add_vif()
607 return &ifp->vif->wdev; in brcmf_ap_add_vif()
618 iftype = vif->wdev.iftype; in brcmf_is_apmode()
624 return vif->wdev.iftype == NL80211_IFTYPE_ADHOC; in brcmf_is_ibssmode()
628 * brcmf_mon_add_vif() - create monitor mode virtual interface
642 if (cfg->pub->mon_if) { in brcmf_mon_add_vif()
643 err = -EEXIST; in brcmf_mon_add_vif()
655 err = -ENOMEM; in brcmf_mon_add_vif()
658 ndev->type = ARPHRD_IEEE80211_RADIOTAP; in brcmf_mon_add_vif()
659 ndev->ieee80211_ptr = &vif->wdev; in brcmf_mon_add_vif()
660 ndev->needs_free_netdev = true; in brcmf_mon_add_vif()
661 ndev->priv_destructor = brcmf_cfg80211_free_netdev; in brcmf_mon_add_vif()
662 SET_NETDEV_DEV(ndev, wiphy_dev(cfg->wiphy)); in brcmf_mon_add_vif()
665 ifp->vif = vif; in brcmf_mon_add_vif()
666 ifp->ndev = ndev; in brcmf_mon_add_vif()
667 ifp->drvr = cfg->pub; in brcmf_mon_add_vif()
669 vif->ifp = ifp; in brcmf_mon_add_vif()
670 vif->wdev.netdev = ndev; in brcmf_mon_add_vif()
674 brcmf_err("Failed to attach %s device\n", ndev->name); in brcmf_mon_add_vif()
679 cfg->pub->mon_if = ifp; in brcmf_mon_add_vif()
681 return &vif->wdev; in brcmf_mon_add_vif()
692 struct net_device *ndev = wdev->netdev; in brcmf_mon_del_vif()
694 ndev->netdev_ops->ndo_stop(ndev); in brcmf_mon_del_vif()
698 cfg->pub->mon_if = NULL; in brcmf_mon_del_vif()
710 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_add_iface()
726 return ERR_PTR(-EOPNOTSUPP); in brcmf_cfg80211_add_iface()
739 return ERR_PTR(-EINVAL); in brcmf_cfg80211_add_iface()
759 struct brcmf_pub *drvr = ifp->drvr; in brcmf_set_mpc()
762 if (check_vif_up(ifp->vif)) { in brcmf_set_mpc()
776 struct brcmf_pub *drvr = cfg->pub; in brcmf_notify_escan_complete()
787 scan_request = cfg->scan_request; in brcmf_notify_escan_complete()
788 cfg->scan_request = NULL; in brcmf_notify_escan_complete()
790 if (timer_pending(&cfg->escan_timeout)) in brcmf_notify_escan_complete()
791 del_timer_sync(&cfg->escan_timeout); in brcmf_notify_escan_complete()
802 params_le.active_time = cpu_to_le32(-1); in brcmf_notify_escan_complete()
803 params_le.passive_time = cpu_to_le32(-1); in brcmf_notify_escan_complete()
804 params_le.home_time = cpu_to_le32(-1); in brcmf_notify_escan_complete()
805 /* Scan is aborted by setting channel_list[0] to -1 */ in brcmf_notify_escan_complete()
806 params_le.channel_list[0] = cpu_to_le16(-1); in brcmf_notify_escan_complete()
807 /* E-Scan (or anyother type) can be aborted by SCAN */ in brcmf_notify_escan_complete()
817 * e-scan can be initiated internally in brcmf_notify_escan_complete()
820 if (cfg->int_escan_map) { in brcmf_notify_escan_complete()
822 cfg->int_escan_map); in brcmf_notify_escan_complete()
823 while (cfg->int_escan_map) { in brcmf_notify_escan_complete()
824 bucket = __ffs(cfg->int_escan_map); in brcmf_notify_escan_complete()
825 cfg->int_escan_map &= ~BIT(bucket); in brcmf_notify_escan_complete()
826 reqid = brcmf_pno_find_reqid_by_bucket(cfg->pno, in brcmf_notify_escan_complete()
844 if (!test_and_clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) in brcmf_notify_escan_complete()
854 struct net_device *ndev = wdev->netdev; in brcmf_cfg80211_del_ap_iface()
856 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_del_ap_iface()
860 brcmf_cfg80211_arm_vif_event(cfg, ifp->vif); in brcmf_cfg80211_del_ap_iface()
873 err = -EIO; in brcmf_cfg80211_del_ap_iface()
888 struct net_device *ndev = wdev->netdev; in brcmf_cfg80211_del_iface()
891 return -ENOTSUPP; in brcmf_cfg80211_del_iface()
895 return -EBUSY; in brcmf_cfg80211_del_iface()
898 if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status) && in brcmf_cfg80211_del_iface()
899 cfg->escan_info.ifp == netdev_priv(ndev)) in brcmf_cfg80211_del_iface()
906 switch (wdev->iftype) { in brcmf_cfg80211_del_iface()
912 return -EOPNOTSUPP; in brcmf_cfg80211_del_iface()
923 return -EINVAL; in brcmf_cfg80211_del_iface()
925 return -EOPNOTSUPP; in brcmf_cfg80211_del_iface()
935 struct brcmf_cfg80211_vif *vif = ifp->vif; in brcmf_cfg80211_change_iface()
936 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_change_iface()
941 brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, type=%d\n", ifp->bsscfgidx, in brcmf_cfg80211_change_iface()
953 ((vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT) || in brcmf_cfg80211_change_iface()
954 (vif->wdev.iftype == NL80211_IFTYPE_P2P_GO) || in brcmf_cfg80211_change_iface()
955 (vif->wdev.iftype == NL80211_IFTYPE_P2P_DEVICE))) { in brcmf_cfg80211_change_iface()
969 if (cfg->p2p.p2pdev_dynamically) in brcmf_cfg80211_change_iface()
970 return -EOPNOTSUPP; in brcmf_cfg80211_change_iface()
984 return -EOPNOTSUPP; in brcmf_cfg80211_change_iface()
996 err = -EINVAL; in brcmf_cfg80211_change_iface()
1012 err = -EAGAIN; in brcmf_cfg80211_change_iface()
1018 ndev->ieee80211_ptr->iftype = type; in brcmf_cfg80211_change_iface()
1020 brcmf_cfg80211_update_proto_addr_mode(&vif->wdev); in brcmf_cfg80211_change_iface()
1040 eth_broadcast_addr(params_le->bssid); in brcmf_escan_prep()
1041 params_le->bss_type = DOT11_BSSTYPE_ANY; in brcmf_escan_prep()
1042 params_le->scan_type = BRCMF_SCANTYPE_ACTIVE; in brcmf_escan_prep()
1043 params_le->channel_num = 0; in brcmf_escan_prep()
1044 params_le->nprobes = cpu_to_le32(-1); in brcmf_escan_prep()
1045 params_le->active_time = cpu_to_le32(-1); in brcmf_escan_prep()
1046 params_le->passive_time = cpu_to_le32(-1); in brcmf_escan_prep()
1047 params_le->home_time = cpu_to_le32(-1); in brcmf_escan_prep()
1048 memset(&params_le->ssid_le, 0, sizeof(params_le->ssid_le)); in brcmf_escan_prep()
1050 n_ssids = request->n_ssids; in brcmf_escan_prep()
1051 n_channels = request->n_channels; in brcmf_escan_prep()
1058 chanspec = channel_to_chanspec(&cfg->d11inf, in brcmf_escan_prep()
1059 request->channels[i]); in brcmf_escan_prep()
1061 request->channels[i]->hw_value, chanspec); in brcmf_escan_prep()
1062 params_le->channel_list[i] = cpu_to_le16(chanspec); in brcmf_escan_prep()
1077 cpu_to_le32(request->ssids[i].ssid_len); in brcmf_escan_prep()
1078 memcpy(ssid_le.SSID, request->ssids[i].ssid, in brcmf_escan_prep()
1079 request->ssids[i].ssid_len); in brcmf_escan_prep()
1090 params_le->scan_type = BRCMF_SCANTYPE_PASSIVE; in brcmf_escan_prep()
1093 params_le->channel_num = in brcmf_escan_prep()
1102 struct brcmf_pub *drvr = cfg->pub; in brcmf_run_escan()
1108 brcmf_dbg(SCAN, "E-SCAN START\n"); in brcmf_run_escan()
1112 params_size += sizeof(u32) * ((request->n_channels + 1) / 2); in brcmf_run_escan()
1115 params_size += sizeof(struct brcmf_ssid_le) * request->n_ssids; in brcmf_run_escan()
1120 err = -ENOMEM; in brcmf_run_escan()
1124 brcmf_escan_prep(cfg, &params->params_le, request); in brcmf_run_escan()
1125 params->version = cpu_to_le32(BRCMF_ESCAN_REQ_VERSION); in brcmf_run_escan()
1126 params->action = cpu_to_le16(WL_ESCAN_ACTION_START); in brcmf_run_escan()
1127 params->sync_id = cpu_to_le16(0x1234); in brcmf_run_escan()
1131 if (err == -EBUSY) in brcmf_run_escan()
1145 struct brcmf_cfg80211_info *cfg = ifp->drvr->config; in brcmf_do_escan()
1148 struct escan_info *escan = &cfg->escan_info; in brcmf_do_escan()
1151 escan->ifp = ifp; in brcmf_do_escan()
1152 escan->wiphy = cfg->wiphy; in brcmf_do_escan()
1153 escan->escan_state = WL_ESCAN_STATE_SCANNING; in brcmf_do_escan()
1156 results = (struct brcmf_scan_results *)cfg->escan_info.escan_buf; in brcmf_do_escan()
1157 results->version = 0; in brcmf_do_escan()
1158 results->count = 0; in brcmf_do_escan()
1159 results->buflen = WL_ESCAN_RESULTS_FIXED_SIZE; in brcmf_do_escan()
1161 err = escan->run(cfg, ifp, request); in brcmf_do_escan()
1171 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_scan()
1176 vif = container_of(request->wdev, struct brcmf_cfg80211_vif, wdev); in brcmf_cfg80211_scan()
1178 return -EIO; in brcmf_cfg80211_scan()
1180 if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { in brcmf_cfg80211_scan()
1182 cfg->scan_status); in brcmf_cfg80211_scan()
1183 return -EAGAIN; in brcmf_cfg80211_scan()
1185 if (test_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status)) { in brcmf_cfg80211_scan()
1187 cfg->scan_status); in brcmf_cfg80211_scan()
1188 return -EAGAIN; in brcmf_cfg80211_scan()
1190 if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) { in brcmf_cfg80211_scan()
1192 cfg->scan_status); in brcmf_cfg80211_scan()
1193 return -EAGAIN; in brcmf_cfg80211_scan()
1195 if (test_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state)) { in brcmf_cfg80211_scan()
1196 bphy_err(drvr, "Connecting: status (%lu)\n", vif->sme_state); in brcmf_cfg80211_scan()
1197 return -EAGAIN; in brcmf_cfg80211_scan()
1201 if (vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif) in brcmf_cfg80211_scan()
1202 vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY].vif; in brcmf_cfg80211_scan()
1206 cfg->scan_request = request; in brcmf_cfg80211_scan()
1207 set_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); in brcmf_cfg80211_scan()
1209 cfg->escan_info.run = brcmf_run_escan; in brcmf_cfg80211_scan()
1215 request->ie, request->ie_len); in brcmf_cfg80211_scan()
1219 err = brcmf_do_escan(vif->ifp, request); in brcmf_cfg80211_scan()
1224 mod_timer(&cfg->escan_timeout, in brcmf_cfg80211_scan()
1231 clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); in brcmf_cfg80211_scan()
1232 cfg->scan_request = NULL; in brcmf_cfg80211_scan()
1239 struct brcmf_pub *drvr = ifp->drvr; in brcmf_set_rts()
1252 struct brcmf_pub *drvr = ifp->drvr; in brcmf_set_frag()
1266 struct brcmf_pub *drvr = ifp->drvr; in brcmf_set_retry()
1286 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_set_wiphy_params()
1287 return -EIO; in brcmf_cfg80211_set_wiphy_params()
1290 (cfg->conf->rts_threshold != wiphy->rts_threshold)) { in brcmf_cfg80211_set_wiphy_params()
1291 cfg->conf->rts_threshold = wiphy->rts_threshold; in brcmf_cfg80211_set_wiphy_params()
1292 err = brcmf_set_rts(ndev, cfg->conf->rts_threshold); in brcmf_cfg80211_set_wiphy_params()
1297 (cfg->conf->frag_threshold != wiphy->frag_threshold)) { in brcmf_cfg80211_set_wiphy_params()
1298 cfg->conf->frag_threshold = wiphy->frag_threshold; in brcmf_cfg80211_set_wiphy_params()
1299 err = brcmf_set_frag(ndev, cfg->conf->frag_threshold); in brcmf_cfg80211_set_wiphy_params()
1304 && (cfg->conf->retry_long != wiphy->retry_long)) { in brcmf_cfg80211_set_wiphy_params()
1305 cfg->conf->retry_long = wiphy->retry_long; in brcmf_cfg80211_set_wiphy_params()
1306 err = brcmf_set_retry(ndev, cfg->conf->retry_long, true); in brcmf_cfg80211_set_wiphy_params()
1311 && (cfg->conf->retry_short != wiphy->retry_short)) { in brcmf_cfg80211_set_wiphy_params()
1312 cfg->conf->retry_short = wiphy->retry_short; in brcmf_cfg80211_set_wiphy_params()
1313 err = brcmf_set_retry(ndev, cfg->conf->retry_short, false); in brcmf_cfg80211_set_wiphy_params()
1332 switch (e->event_code) { in brcmf_map_fw_linkdown_reason()
1336 reason = e->reason; in brcmf_map_fw_linkdown_reason()
1348 struct brcmf_pub *drvr = ifp->drvr; in brcmf_set_pmk()
1371 struct brcmf_pub *drvr = ifp->drvr; in brcmf_set_sae_password()
1378 return -EINVAL; in brcmf_set_sae_password()
1396 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy); in brcmf_link_down()
1397 struct brcmf_pub *drvr = cfg->pub; in brcmf_link_down()
1398 bool bus_up = drvr->bus_if->state == BRCMF_BUS_UP; in brcmf_link_down()
1403 if (test_and_clear_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state)) { in brcmf_link_down()
1406 err = brcmf_fil_cmd_data_set(vif->ifp, in brcmf_link_down()
1413 if ((vif->wdev.iftype == NL80211_IFTYPE_STATION) || in brcmf_link_down()
1414 (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT)) in brcmf_link_down()
1415 cfg80211_disconnected(vif->wdev.netdev, reason, NULL, 0, in brcmf_link_down()
1418 clear_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state); in brcmf_link_down()
1419 clear_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status); in brcmf_link_down()
1421 if (vif->profile.use_fwsup != BRCMF_PROFILE_FWSUP_NONE) { in brcmf_link_down()
1423 brcmf_set_pmk(vif->ifp, NULL, 0); in brcmf_link_down()
1424 vif->profile.use_fwsup = BRCMF_PROFILE_FWSUP_NONE; in brcmf_link_down()
1435 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; in brcmf_cfg80211_join_ibss()
1436 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_join_ibss()
1446 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_join_ibss()
1447 return -EIO; in brcmf_cfg80211_join_ibss()
1449 if (params->ssid) in brcmf_cfg80211_join_ibss()
1450 brcmf_dbg(CONN, "SSID: %s\n", params->ssid); in brcmf_cfg80211_join_ibss()
1453 return -EOPNOTSUPP; in brcmf_cfg80211_join_ibss()
1456 set_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state); in brcmf_cfg80211_join_ibss()
1458 if (params->bssid) in brcmf_cfg80211_join_ibss()
1459 brcmf_dbg(CONN, "BSSID: %pM\n", params->bssid); in brcmf_cfg80211_join_ibss()
1463 if (params->chandef.chan) in brcmf_cfg80211_join_ibss()
1465 params->chandef.chan->center_freq); in brcmf_cfg80211_join_ibss()
1469 if (params->channel_fixed) in brcmf_cfg80211_join_ibss()
1474 if (params->ie && params->ie_len) in brcmf_cfg80211_join_ibss()
1475 brcmf_dbg(CONN, "ie len: %d\n", params->ie_len); in brcmf_cfg80211_join_ibss()
1479 if (params->beacon_interval) in brcmf_cfg80211_join_ibss()
1481 params->beacon_interval); in brcmf_cfg80211_join_ibss()
1485 if (params->basic_rates) in brcmf_cfg80211_join_ibss()
1486 brcmf_dbg(CONN, "basic rates: %08X\n", params->basic_rates); in brcmf_cfg80211_join_ibss()
1490 if (params->privacy) in brcmf_cfg80211_join_ibss()
1496 if (params->privacy) in brcmf_cfg80211_join_ibss()
1506 if (params->beacon_interval) in brcmf_cfg80211_join_ibss()
1507 bcnprd = params->beacon_interval; in brcmf_cfg80211_join_ibss()
1521 ssid_len = min_t(u32, params->ssid_len, IEEE80211_MAX_SSID_LEN); in brcmf_cfg80211_join_ibss()
1522 memcpy(join_params.ssid_le.SSID, params->ssid, ssid_len); in brcmf_cfg80211_join_ibss()
1527 if (params->bssid) { in brcmf_cfg80211_join_ibss()
1528 memcpy(join_params.params_le.bssid, params->bssid, ETH_ALEN); in brcmf_cfg80211_join_ibss()
1530 memcpy(profile->bssid, params->bssid, ETH_ALEN); in brcmf_cfg80211_join_ibss()
1533 eth_zero_addr(profile->bssid); in brcmf_cfg80211_join_ibss()
1537 if (params->chandef.chan) { in brcmf_cfg80211_join_ibss()
1540 cfg->channel = in brcmf_cfg80211_join_ibss()
1542 params->chandef.chan->center_freq); in brcmf_cfg80211_join_ibss()
1543 if (params->channel_fixed) { in brcmf_cfg80211_join_ibss()
1545 chanspec = chandef_to_chanspec(&cfg->d11inf, in brcmf_cfg80211_join_ibss()
1546 &params->chandef); in brcmf_cfg80211_join_ibss()
1554 target_channel = cfg->channel; in brcmf_cfg80211_join_ibss()
1562 cfg->channel = 0; in brcmf_cfg80211_join_ibss()
1564 cfg->ibss_starter = false; in brcmf_cfg80211_join_ibss()
1576 clear_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state); in brcmf_cfg80211_join_ibss()
1587 if (!check_vif_up(ifp->vif)) { in brcmf_cfg80211_leave_ibss()
1595 brcmf_link_down(ifp->vif, WLAN_REASON_DEAUTH_LEAVING, true); in brcmf_cfg80211_leave_ibss()
1608 struct brcmf_pub *drvr = ifp->drvr; in brcmf_set_wpa_version()
1613 if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_1) in brcmf_set_wpa_version()
1615 else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) in brcmf_set_wpa_version()
1617 else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_3) in brcmf_set_wpa_version()
1627 sec = &profile->sec; in brcmf_set_wpa_version()
1628 sec->wpa_versions = sme->crypto.wpa_versions; in brcmf_set_wpa_version()
1637 struct brcmf_pub *drvr = ifp->drvr; in brcmf_set_auth_type()
1642 switch (sme->auth_type) { in brcmf_set_auth_type()
1657 brcmf_dbg(CONN, "automatic, auth type (%d)\n", sme->auth_type); in brcmf_set_auth_type()
1666 sec = &profile->sec; in brcmf_set_auth_type()
1667 sec->auth_type = sme->auth_type; in brcmf_set_auth_type()
1677 struct brcmf_pub *drvr = ifp->drvr; in brcmf_set_wsec_mode()
1684 if (sme->crypto.n_ciphers_pairwise) { in brcmf_set_wsec_mode()
1685 switch (sme->crypto.ciphers_pairwise[0]) { in brcmf_set_wsec_mode()
1701 sme->crypto.ciphers_pairwise[0]); in brcmf_set_wsec_mode()
1702 return -EINVAL; in brcmf_set_wsec_mode()
1705 if (sme->crypto.cipher_group) { in brcmf_set_wsec_mode()
1706 switch (sme->crypto.cipher_group) { in brcmf_set_wsec_mode()
1722 sme->crypto.cipher_group); in brcmf_set_wsec_mode()
1723 return -EINVAL; in brcmf_set_wsec_mode()
1729 /* setting AES. WPS-2.0 allows no security */ in brcmf_set_wsec_mode()
1730 if (brcmf_find_wpsie(sme->ie, sme->ie_len) && !pval && !gval && in brcmf_set_wsec_mode()
1731 sme->privacy) in brcmf_set_wsec_mode()
1741 sec = &profile->sec; in brcmf_set_wsec_mode()
1742 sec->cipher_pairwise = sme->crypto.ciphers_pairwise[0]; in brcmf_set_wsec_mode()
1743 sec->cipher_group = sme->crypto.cipher_group; in brcmf_set_wsec_mode()
1752 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; in brcmf_set_key_mgmt()
1753 struct brcmf_pub *drvr = ifp->drvr; in brcmf_set_key_mgmt()
1764 profile->use_fwsup = BRCMF_PROFILE_FWSUP_NONE; in brcmf_set_key_mgmt()
1765 profile->is_ft = false; in brcmf_set_key_mgmt()
1767 if (!sme->crypto.n_akm_suites) in brcmf_set_key_mgmt()
1776 switch (sme->crypto.akm_suites[0]) { in brcmf_set_key_mgmt()
1779 if (sme->want_1x) in brcmf_set_key_mgmt()
1780 profile->use_fwsup = BRCMF_PROFILE_FWSUP_1X; in brcmf_set_key_mgmt()
1787 sme->crypto.cipher_group); in brcmf_set_key_mgmt()
1788 return -EINVAL; in brcmf_set_key_mgmt()
1791 switch (sme->crypto.akm_suites[0]) { in brcmf_set_key_mgmt()
1794 if (sme->want_1x) in brcmf_set_key_mgmt()
1795 profile->use_fwsup = BRCMF_PROFILE_FWSUP_1X; in brcmf_set_key_mgmt()
1799 if (sme->want_1x) in brcmf_set_key_mgmt()
1800 profile->use_fwsup = BRCMF_PROFILE_FWSUP_1X; in brcmf_set_key_mgmt()
1810 profile->is_ft = true; in brcmf_set_key_mgmt()
1811 if (sme->want_1x) in brcmf_set_key_mgmt()
1812 profile->use_fwsup = BRCMF_PROFILE_FWSUP_1X; in brcmf_set_key_mgmt()
1816 profile->is_ft = true; in brcmf_set_key_mgmt()
1820 sme->crypto.cipher_group); in brcmf_set_key_mgmt()
1821 return -EINVAL; in brcmf_set_key_mgmt()
1824 switch (sme->crypto.akm_suites[0]) { in brcmf_set_key_mgmt()
1827 if (sme->crypto.sae_pwd) { in brcmf_set_key_mgmt()
1829 profile->use_fwsup = BRCMF_PROFILE_FWSUP_SAE; in brcmf_set_key_mgmt()
1834 sme->crypto.cipher_group); in brcmf_set_key_mgmt()
1835 return -EINVAL; in brcmf_set_key_mgmt()
1839 if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_1X) in brcmf_set_key_mgmt()
1847 rsn_ie = brcmf_parse_tlvs((const u8 *)sme->ie, sme->ie_len, in brcmf_set_key_mgmt()
1852 ie_len = rsn_ie->len + TLV_HDR_LEN; in brcmf_set_key_mgmt()
1892 struct brcmf_pub *drvr = ifp->drvr; in brcmf_set_sharedkey()
1899 brcmf_dbg(CONN, "key len (%d)\n", sme->key_len); in brcmf_set_sharedkey()
1901 if (sme->key_len == 0) in brcmf_set_sharedkey()
1904 sec = &profile->sec; in brcmf_set_sharedkey()
1906 sec->wpa_versions, sec->cipher_pairwise); in brcmf_set_sharedkey()
1908 if (sec->wpa_versions & (NL80211_WPA_VERSION_1 | NL80211_WPA_VERSION_2 | in brcmf_set_sharedkey()
1912 if (!(sec->cipher_pairwise & in brcmf_set_sharedkey()
1917 key.len = (u32) sme->key_len; in brcmf_set_sharedkey()
1918 key.index = (u32) sme->key_idx; in brcmf_set_sharedkey()
1921 return -EINVAL; in brcmf_set_sharedkey()
1923 memcpy(key.data, sme->key, key.len); in brcmf_set_sharedkey()
1925 switch (sec->cipher_pairwise) { in brcmf_set_sharedkey()
1934 sme->crypto.ciphers_pairwise[0]); in brcmf_set_sharedkey()
1935 return -EINVAL; in brcmf_set_sharedkey()
1945 if (sec->auth_type == NL80211_AUTHTYPE_SHARED_KEY) { in brcmf_set_sharedkey()
1970 struct brcmf_pub *drvr = ifp->drvr; in brcmf_set_join_pref()
1978 if (bss_select->behaviour != NL80211_BSS_SELECT_ATTR_BAND_PREF) in brcmf_set_join_pref()
1981 switch (bss_select->behaviour) { in brcmf_set_join_pref()
1987 band = bss_select->param.band_pref; in brcmf_set_join_pref()
1993 band = bss_select->param.adjust.band; in brcmf_set_join_pref()
1995 join_pref_params[i].rssi_gain = bss_select->param.adjust.delta; in brcmf_set_join_pref()
2018 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; in brcmf_cfg80211_connect()
2019 struct ieee80211_channel *chan = sme->channel; in brcmf_cfg80211_connect()
2020 struct brcmf_pub *drvr = ifp->drvr; in brcmf_cfg80211_connect()
2033 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_connect()
2034 return -EIO; in brcmf_cfg80211_connect()
2036 if (!sme->ssid) { in brcmf_cfg80211_connect()
2038 return -EOPNOTSUPP; in brcmf_cfg80211_connect()
2041 if (ifp->vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY].vif) { in brcmf_cfg80211_connect()
2046 wpa_ie = brcmf_find_wpaie((u8 *)sme->ie, sme->ie_len); in brcmf_cfg80211_connect()
2049 ie_len = wpa_ie->len + TLV_HDR_LEN; in brcmf_cfg80211_connect()
2052 rsn_ie = brcmf_parse_tlvs((const u8 *)sme->ie, in brcmf_cfg80211_connect()
2053 sme->ie_len, in brcmf_cfg80211_connect()
2057 ie_len = rsn_ie->len + TLV_HDR_LEN; in brcmf_cfg80211_connect()
2063 err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG, in brcmf_cfg80211_connect()
2064 sme->ie, sme->ie_len); in brcmf_cfg80211_connect()
2066 bphy_err(drvr, "Set Assoc REQ IE Failed\n"); in brcmf_cfg80211_connect()
2068 brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n"); in brcmf_cfg80211_connect()
2070 set_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state); in brcmf_cfg80211_connect()
2073 cfg->channel = in brcmf_cfg80211_connect()
2074 ieee80211_frequency_to_channel(chan->center_freq); in brcmf_cfg80211_connect()
2075 chanspec = channel_to_chanspec(&cfg->d11inf, chan); in brcmf_cfg80211_connect()
2077 cfg->channel, chan->center_freq, chanspec); in brcmf_cfg80211_connect()
2079 cfg->channel = 0; in brcmf_cfg80211_connect()
2083 brcmf_dbg(INFO, "ie (%p), ie_len (%zd)\n", sme->ie, sme->ie_len); in brcmf_cfg80211_connect()
2091 sme->auth_type = brcmf_war_auth_type(ifp, sme->auth_type); in brcmf_cfg80211_connect()
2116 if (sme->crypto.psk && in brcmf_cfg80211_connect()
2117 profile->use_fwsup != BRCMF_PROFILE_FWSUP_SAE) { in brcmf_cfg80211_connect()
2118 if (WARN_ON(profile->use_fwsup != BRCMF_PROFILE_FWSUP_NONE)) { in brcmf_cfg80211_connect()
2119 err = -EINVAL; in brcmf_cfg80211_connect()
2123 profile->use_fwsup = BRCMF_PROFILE_FWSUP_PSK; in brcmf_cfg80211_connect()
2126 if (profile->use_fwsup != BRCMF_PROFILE_FWSUP_NONE) { in brcmf_cfg80211_connect()
2135 if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_PSK) in brcmf_cfg80211_connect()
2136 err = brcmf_set_pmk(ifp, sme->crypto.psk, in brcmf_cfg80211_connect()
2138 else if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_SAE) { in brcmf_cfg80211_connect()
2139 /* clean up user-space RSNE */ in brcmf_cfg80211_connect()
2141 bphy_err(drvr, "failed to clean up user-space RSNE\n"); in brcmf_cfg80211_connect()
2144 err = brcmf_set_sae_password(ifp, sme->crypto.sae_pwd, in brcmf_cfg80211_connect()
2145 sme->crypto.sae_pwd_len); in brcmf_cfg80211_connect()
2146 if (!err && sme->crypto.psk) in brcmf_cfg80211_connect()
2147 err = brcmf_set_pmk(ifp, sme->crypto.psk, in brcmf_cfg80211_connect()
2158 if (cfg->channel) in brcmf_cfg80211_connect()
2162 err = -ENOMEM; in brcmf_cfg80211_connect()
2165 ssid_len = min_t(u32, sme->ssid_len, IEEE80211_MAX_SSID_LEN); in brcmf_cfg80211_connect()
2166 ext_join_params->ssid_le.SSID_len = cpu_to_le32(ssid_len); in brcmf_cfg80211_connect()
2167 memcpy(&ext_join_params->ssid_le.SSID, sme->ssid, ssid_len); in brcmf_cfg80211_connect()
2170 ext_join_params->ssid_le.SSID, ssid_len); in brcmf_cfg80211_connect()
2173 ext_join_params->scan_le.scan_type = -1; in brcmf_cfg80211_connect()
2174 ext_join_params->scan_le.home_time = cpu_to_le32(-1); in brcmf_cfg80211_connect()
2176 if (sme->bssid) in brcmf_cfg80211_connect()
2177 memcpy(&ext_join_params->assoc_le.bssid, sme->bssid, ETH_ALEN); in brcmf_cfg80211_connect()
2179 eth_broadcast_addr(ext_join_params->assoc_le.bssid); in brcmf_cfg80211_connect()
2181 if (cfg->channel) { in brcmf_cfg80211_connect()
2182 ext_join_params->assoc_le.chanspec_num = cpu_to_le32(1); in brcmf_cfg80211_connect()
2184 ext_join_params->assoc_le.chanspec_list[0] = in brcmf_cfg80211_connect()
2190 ext_join_params->scan_le.active_time = in brcmf_cfg80211_connect()
2192 ext_join_params->scan_le.passive_time = in brcmf_cfg80211_connect()
2198 ext_join_params->scan_le.nprobes = in brcmf_cfg80211_connect()
2202 ext_join_params->scan_le.active_time = cpu_to_le32(-1); in brcmf_cfg80211_connect()
2203 ext_join_params->scan_le.passive_time = cpu_to_le32(-1); in brcmf_cfg80211_connect()
2204 ext_join_params->scan_le.nprobes = cpu_to_le32(-1); in brcmf_cfg80211_connect()
2207 brcmf_set_join_pref(ifp, &sme->bss_select); in brcmf_cfg80211_connect()
2220 memcpy(&join_params.ssid_le.SSID, sme->ssid, ssid_len); in brcmf_cfg80211_connect()
2223 if (sme->bssid) in brcmf_cfg80211_connect()
2224 memcpy(join_params.params_le.bssid, sme->bssid, ETH_ALEN); in brcmf_cfg80211_connect()
2228 if (cfg->channel) { in brcmf_cfg80211_connect()
2240 clear_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state); in brcmf_cfg80211_connect()
2251 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; in brcmf_cfg80211_disconnect()
2252 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_disconnect()
2257 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_disconnect()
2258 return -EIO; in brcmf_cfg80211_disconnect()
2260 clear_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state); in brcmf_cfg80211_disconnect()
2261 clear_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state); in brcmf_cfg80211_disconnect()
2264 memcpy(&scbval.ea, &profile->bssid, ETH_ALEN); in brcmf_cfg80211_disconnect()
2282 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_set_tx_power()
2288 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_set_tx_power()
2289 return -EIO; in brcmf_cfg80211_set_tx_power()
2297 bphy_err(drvr, "TX_POWER_FIXED - dbm is negative\n"); in brcmf_cfg80211_set_tx_power()
2298 err = -EINVAL; in brcmf_cfg80211_set_tx_power()
2308 err = -EINVAL; in brcmf_cfg80211_set_tx_power()
2332 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_get_tx_power()
2338 return -EIO; in brcmf_cfg80211_get_tx_power()
2340 err = brcmf_fil_iovar_int_get(vif->ifp, "qtxpower", &qdbm); in brcmf_cfg80211_get_tx_power()
2357 struct brcmf_pub *drvr = ifp->drvr; in brcmf_cfg80211_config_default_key()
2364 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_config_default_key()
2365 return -EIO; in brcmf_cfg80211_config_default_key()
2374 /* Just select a new current key */ in brcmf_cfg80211_config_default_key()
2397 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_del_key()
2398 return -EIO; in brcmf_cfg80211_del_key()
2402 return -EINVAL; in brcmf_cfg80211_del_key()
2405 key = &ifp->vif->profile.key[key_idx]; in brcmf_cfg80211_del_key()
2407 if (key->algo == CRYPTO_ALGO_OFF) { in brcmf_cfg80211_del_key()
2409 return -EINVAL; in brcmf_cfg80211_del_key()
2413 key->index = (u32)key_idx; in brcmf_cfg80211_del_key()
2414 key->flags = BRCMF_PRIMARY_KEY; in brcmf_cfg80211_del_key()
2430 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_add_key()
2440 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_add_key()
2441 return -EIO; in brcmf_cfg80211_add_key()
2446 return -EINVAL; in brcmf_cfg80211_add_key()
2449 if (params->key_len == 0) in brcmf_cfg80211_add_key()
2453 if (params->key_len > sizeof(key->data)) { in brcmf_cfg80211_add_key()
2454 bphy_err(drvr, "Too long key length (%u)\n", params->key_len); in brcmf_cfg80211_add_key()
2455 return -EINVAL; in brcmf_cfg80211_add_key()
2459 if (mac_addr && (params->cipher != WLAN_CIPHER_SUITE_WEP40) && in brcmf_cfg80211_add_key()
2460 (params->cipher != WLAN_CIPHER_SUITE_WEP104)) { in brcmf_cfg80211_add_key()
2465 key = &ifp->vif->profile.key[key_idx]; in brcmf_cfg80211_add_key()
2468 memcpy((char *)&key->ea, (void *)mac_addr, ETH_ALEN); in brcmf_cfg80211_add_key()
2469 key->len = params->key_len; in brcmf_cfg80211_add_key()
2470 key->index = key_idx; in brcmf_cfg80211_add_key()
2471 memcpy(key->data, params->key, key->len); in brcmf_cfg80211_add_key()
2473 key->flags = BRCMF_PRIMARY_KEY; in brcmf_cfg80211_add_key()
2475 if (params->seq && params->seq_len == 6) { in brcmf_cfg80211_add_key()
2479 ivptr = (u8 *)params->seq; in brcmf_cfg80211_add_key()
2480 key->rxiv.hi = (ivptr[5] << 24) | (ivptr[4] << 16) | in brcmf_cfg80211_add_key()
2482 key->rxiv.lo = (ivptr[1] << 8) | ivptr[0]; in brcmf_cfg80211_add_key()
2483 key->iv_initialized = true; in brcmf_cfg80211_add_key()
2486 switch (params->cipher) { in brcmf_cfg80211_add_key()
2488 key->algo = CRYPTO_ALGO_WEP1; in brcmf_cfg80211_add_key()
2493 key->algo = CRYPTO_ALGO_WEP128; in brcmf_cfg80211_add_key()
2498 if (!brcmf_is_apmode(ifp->vif)) { in brcmf_cfg80211_add_key()
2500 memcpy(keybuf, &key->data[24], sizeof(keybuf)); in brcmf_cfg80211_add_key()
2501 memcpy(&key->data[24], &key->data[16], sizeof(keybuf)); in brcmf_cfg80211_add_key()
2502 memcpy(&key->data[16], keybuf, sizeof(keybuf)); in brcmf_cfg80211_add_key()
2504 key->algo = CRYPTO_ALGO_TKIP; in brcmf_cfg80211_add_key()
2509 key->algo = CRYPTO_ALGO_AES_CCM; in brcmf_cfg80211_add_key()
2514 key->algo = CRYPTO_ALGO_AES_CCM; in brcmf_cfg80211_add_key()
2519 bphy_err(drvr, "Invalid cipher (0x%x)\n", params->cipher); in brcmf_cfg80211_add_key()
2520 err = -EINVAL; in brcmf_cfg80211_add_key()
2554 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; in brcmf_cfg80211_get_key()
2555 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_get_key()
2562 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_get_key()
2563 return -EIO; in brcmf_cfg80211_get_key()
2571 err = -EAGAIN; in brcmf_cfg80211_get_key()
2575 sec = &profile->sec; in brcmf_cfg80211_get_key()
2576 if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP40) { in brcmf_cfg80211_get_key()
2579 } else if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP104) { in brcmf_cfg80211_get_key()
2591 err = -EINVAL; in brcmf_cfg80211_get_key()
2614 return -EOPNOTSUPP; in brcmf_cfg80211_config_default_mgmt_key()
2620 struct brcmf_pub *drvr = ifp->drvr; in brcmf_cfg80211_reconfigure_wep()
2627 key = &ifp->vif->profile.key[key_idx]; in brcmf_cfg80211_reconfigure_wep()
2628 if ((key->algo == CRYPTO_ALGO_WEP1) || in brcmf_cfg80211_reconfigure_wep()
2629 (key->algo == CRYPTO_ALGO_WEP128)) in brcmf_cfg80211_reconfigure_wep()
2656 si->filled |= BIT_ULL(NL80211_STA_INFO_STA_FLAGS); in brcmf_convert_sta_flags()
2657 sfu = &si->sta_flags; in brcmf_convert_sta_flags()
2658 sfu->mask = BIT(NL80211_STA_FLAG_WME) | in brcmf_convert_sta_flags()
2663 sfu->set |= BIT(NL80211_STA_FLAG_WME); in brcmf_convert_sta_flags()
2665 sfu->set |= BIT(NL80211_STA_FLAG_AUTHENTICATED); in brcmf_convert_sta_flags()
2667 sfu->set |= BIT(NL80211_STA_FLAG_ASSOCIATED); in brcmf_convert_sta_flags()
2669 sfu->set |= BIT(NL80211_STA_FLAG_AUTHORIZED); in brcmf_convert_sta_flags()
2674 struct brcmf_pub *drvr = ifp->drvr; in brcmf_fill_bss_param()
2686 buf->len = cpu_to_le32(WL_BSS_INFO_MAX); in brcmf_fill_bss_param()
2693 si->filled |= BIT_ULL(NL80211_STA_INFO_BSS_PARAM); in brcmf_fill_bss_param()
2694 si->bss_param.beacon_interval = le16_to_cpu(buf->bss_le.beacon_period); in brcmf_fill_bss_param()
2695 si->bss_param.dtim_period = buf->bss_le.dtim_period; in brcmf_fill_bss_param()
2696 capability = le16_to_cpu(buf->bss_le.capability); in brcmf_fill_bss_param()
2698 si->bss_param.flags |= BSS_PARAM_FLAGS_CTS_PROT; in brcmf_fill_bss_param()
2700 si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE; in brcmf_fill_bss_param()
2702 si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME; in brcmf_fill_bss_param()
2712 struct brcmf_pub *drvr = ifp->drvr; in brcmf_cfg80211_get_station_ibss()
2725 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in brcmf_cfg80211_get_station_ibss()
2726 sinfo->txrate.legacy = rate * 5; in brcmf_cfg80211_get_station_ibss()
2736 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); in brcmf_cfg80211_get_station_ibss()
2737 sinfo->signal = rssi; in brcmf_cfg80211_get_station_ibss()
2745 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS) | in brcmf_cfg80211_get_station_ibss()
2749 sinfo->rx_packets = le32_to_cpu(pktcnt.rx_good_pkt); in brcmf_cfg80211_get_station_ibss()
2750 sinfo->rx_dropped_misc = le32_to_cpu(pktcnt.rx_bad_pkt); in brcmf_cfg80211_get_station_ibss()
2751 sinfo->tx_packets = le32_to_cpu(pktcnt.tx_good_pkt); in brcmf_cfg80211_get_station_ibss()
2752 sinfo->tx_failed = le32_to_cpu(pktcnt.tx_bad_pkt); in brcmf_cfg80211_get_station_ibss()
2763 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_get_station()
2775 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_get_station()
2776 return -EIO; in brcmf_cfg80211_get_station()
2778 if (brcmf_is_ibssmode(ifp->vif)) in brcmf_cfg80211_get_station()
2797 sinfo->filled = BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME); in brcmf_cfg80211_get_station()
2798 sinfo->inactive_time = le32_to_cpu(sta_info_le.idle) * 1000; in brcmf_cfg80211_get_station()
2801 sinfo->sta_flags.mask |= BIT(NL80211_STA_FLAG_TDLS_PEER); in brcmf_cfg80211_get_station()
2803 sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER); in brcmf_cfg80211_get_station()
2805 sinfo->sta_flags.set &= ~BIT(NL80211_STA_FLAG_TDLS_PEER); in brcmf_cfg80211_get_station()
2807 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CONNECTED_TIME); in brcmf_cfg80211_get_station()
2808 sinfo->connected_time = le32_to_cpu(sta_info_le.in); in brcmf_cfg80211_get_station()
2812 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED); in brcmf_cfg80211_get_station()
2813 sinfo->tx_failed = le32_to_cpu(sta_info_le.tx_failures); in brcmf_cfg80211_get_station()
2814 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS); in brcmf_cfg80211_get_station()
2815 sinfo->tx_packets = le32_to_cpu(sta_info_le.tx_pkts); in brcmf_cfg80211_get_station()
2816 sinfo->tx_packets += le32_to_cpu(sta_info_le.tx_mcast_pkts); in brcmf_cfg80211_get_station()
2817 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS); in brcmf_cfg80211_get_station()
2818 sinfo->rx_packets = le32_to_cpu(sta_info_le.rx_ucast_pkts); in brcmf_cfg80211_get_station()
2819 sinfo->rx_packets += le32_to_cpu(sta_info_le.rx_mcast_pkts); in brcmf_cfg80211_get_station()
2820 if (sinfo->tx_packets) { in brcmf_cfg80211_get_station()
2821 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in brcmf_cfg80211_get_station()
2822 sinfo->txrate.legacy = in brcmf_cfg80211_get_station()
2825 if (sinfo->rx_packets) { in brcmf_cfg80211_get_station()
2826 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BITRATE); in brcmf_cfg80211_get_station()
2827 sinfo->rxrate.legacy = in brcmf_cfg80211_get_station()
2831 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES); in brcmf_cfg80211_get_station()
2832 sinfo->tx_bytes = le64_to_cpu(sta_info_le.tx_tot_bytes); in brcmf_cfg80211_get_station()
2833 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES); in brcmf_cfg80211_get_station()
2834 sinfo->rx_bytes = le64_to_cpu(sta_info_le.rx_tot_bytes); in brcmf_cfg80211_get_station()
2840 sinfo->chain_signal_avg[count_rssi] = in brcmf_cfg80211_get_station()
2842 sinfo->chain_signal[count_rssi] = in brcmf_cfg80211_get_station()
2849 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL); in brcmf_cfg80211_get_station()
2850 sinfo->chains = count_rssi; in brcmf_cfg80211_get_station()
2852 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); in brcmf_cfg80211_get_station()
2854 sinfo->signal = total_rssi; in brcmf_cfg80211_get_station()
2856 &ifp->vif->sme_state)) { in brcmf_cfg80211_get_station()
2866 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); in brcmf_cfg80211_get_station()
2867 sinfo->signal = rssi; in brcmf_cfg80211_get_station()
2883 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_dump_station()
2889 cfg->assoclist.count = cpu_to_le32(BRCMF_MAX_ASSOCLIST); in brcmf_cfg80211_dump_station()
2891 &cfg->assoclist, in brcmf_cfg80211_dump_station()
2892 sizeof(cfg->assoclist)); in brcmf_cfg80211_dump_station()
2896 cfg->assoclist.count = 0; in brcmf_cfg80211_dump_station()
2897 return -EOPNOTSUPP; in brcmf_cfg80211_dump_station()
2900 if (idx < le32_to_cpu(cfg->assoclist.count)) { in brcmf_cfg80211_dump_station()
2901 memcpy(mac, cfg->assoclist.mac[idx], ETH_ALEN); in brcmf_cfg80211_dump_station()
2904 return -ENOENT; in brcmf_cfg80211_dump_station()
2915 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_set_power_mgmt()
2926 cfg->pwr_save = enabled; in brcmf_cfg80211_set_power_mgmt()
2927 if (!check_vif_up(ifp->vif)) { in brcmf_cfg80211_set_power_mgmt()
2934 /* Do not enable the power save after assoc if it is a p2p interface */ in brcmf_cfg80211_set_power_mgmt()
2935 if (ifp->vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT) { in brcmf_cfg80211_set_power_mgmt()
2943 if (err == -ENODEV) in brcmf_cfg80211_set_power_mgmt()
2963 struct brcmf_pub *drvr = cfg->pub; in brcmf_inform_single_bss()
2975 if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) { in brcmf_inform_single_bss()
2977 return -EINVAL; in brcmf_inform_single_bss()
2980 if (!bi->ctl_ch) { in brcmf_inform_single_bss()
2981 ch.chspec = le16_to_cpu(bi->chanspec); in brcmf_inform_single_bss()
2982 cfg->d11inf.decchspec(&ch); in brcmf_inform_single_bss()
2983 bi->ctl_ch = ch.control_ch_num; in brcmf_inform_single_bss()
2985 channel = bi->ctl_ch; in brcmf_inform_single_bss()
2997 notify_capability = le16_to_cpu(bi->capability); in brcmf_inform_single_bss()
2998 notify_interval = le16_to_cpu(bi->beacon_period); in brcmf_inform_single_bss()
2999 notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset); in brcmf_inform_single_bss()
3000 notify_ielen = le32_to_cpu(bi->ie_length); in brcmf_inform_single_bss()
3001 bss_data.signal = (s16)le16_to_cpu(bi->RSSI) * 100; in brcmf_inform_single_bss()
3003 brcmf_dbg(CONN, "bssid: %pM\n", bi->BSSID); in brcmf_inform_single_bss()
3011 (const u8 *)bi->BSSID, in brcmf_inform_single_bss()
3017 return -ENOMEM; in brcmf_inform_single_bss()
3028 return list->bss_info_le; in next_bss_le()
3030 le32_to_cpu(bss->length)); in next_bss_le()
3035 struct brcmf_pub *drvr = cfg->pub; in brcmf_inform_bss()
3041 bss_list = (struct brcmf_scan_results *)cfg->escan_info.escan_buf; in brcmf_inform_bss()
3042 if (bss_list->count != 0 && in brcmf_inform_bss()
3043 bss_list->version != BRCMF_BSS_INFO_VERSION) { in brcmf_inform_bss()
3045 bss_list->version); in brcmf_inform_bss()
3046 return -EOPNOTSUPP; in brcmf_inform_bss()
3048 brcmf_dbg(SCAN, "scanned AP count (%d)\n", bss_list->count); in brcmf_inform_bss()
3049 for (i = 0; i < bss_list->count; i++) { in brcmf_inform_bss()
3062 struct brcmf_pub *drvr = cfg->pub; in brcmf_inform_ibss()
3081 err = -ENOMEM; in brcmf_inform_ibss()
3096 ch.chspec = le16_to_cpu(bi->chanspec); in brcmf_inform_ibss()
3097 cfg->d11inf.decchspec(&ch); in brcmf_inform_ibss()
3100 band = wiphy->bands[NL80211_BAND_2GHZ]; in brcmf_inform_ibss()
3102 band = wiphy->bands[NL80211_BAND_5GHZ]; in brcmf_inform_ibss()
3104 freq = ieee80211_channel_to_frequency(ch.control_ch_num, band->band); in brcmf_inform_ibss()
3105 cfg->channel = freq; in brcmf_inform_ibss()
3108 notify_capability = le16_to_cpu(bi->capability); in brcmf_inform_ibss()
3109 notify_interval = le16_to_cpu(bi->beacon_period); in brcmf_inform_ibss()
3110 notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset); in brcmf_inform_ibss()
3111 notify_ielen = le32_to_cpu(bi->ie_length); in brcmf_inform_ibss()
3112 notify_signal = (s16)le16_to_cpu(bi->RSSI) * 100; in brcmf_inform_ibss()
3126 err = -ENOMEM; in brcmf_inform_ibss()
3144 struct brcmf_pub *drvr = cfg->pub; in brcmf_update_bss_info()
3152 if (brcmf_is_ibssmode(ifp->vif)) in brcmf_update_bss_info()
3155 *(__le32 *)cfg->extra_buf = cpu_to_le32(WL_EXTRA_BUF_MAX); in brcmf_update_bss_info()
3157 cfg->extra_buf, WL_EXTRA_BUF_MAX); in brcmf_update_bss_info()
3163 bi = (struct brcmf_bss_info_le *)(cfg->extra_buf + 4); in brcmf_update_bss_info()
3168 ie = ((u8 *)bi) + le16_to_cpu(bi->ie_offset); in brcmf_update_bss_info()
3169 ie_len = le32_to_cpu(bi->ie_length); in brcmf_update_bss_info()
3193 struct escan_info *escan = &cfg->escan_info; in brcmf_abort_scanning()
3195 set_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status); in brcmf_abort_scanning()
3196 if (cfg->int_escan_map || cfg->scan_request) { in brcmf_abort_scanning()
3197 escan->escan_state = WL_ESCAN_STATE_IDLE; in brcmf_abort_scanning()
3198 brcmf_notify_escan_complete(cfg, escan->ifp, true, true); in brcmf_abort_scanning()
3200 clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); in brcmf_abort_scanning()
3201 clear_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status); in brcmf_abort_scanning()
3211 brcmf_notify_escan_complete(cfg, cfg->escan_info.ifp, true, true); in brcmf_cfg80211_escan_timeout_worker()
3218 struct brcmf_pub *drvr = cfg->pub; in brcmf_escan_timeout()
3220 if (cfg->int_escan_map || cfg->scan_request) { in brcmf_escan_timeout()
3222 schedule_work(&cfg->escan_timeout_work); in brcmf_escan_timeout()
3233 ch_bss.chspec = le16_to_cpu(bss->chanspec); in brcmf_compare_update_same_bss()
3234 cfg->d11inf.decchspec(&ch_bss); in brcmf_compare_update_same_bss()
3235 ch_bss_info_le.chspec = le16_to_cpu(bss_info_le->chanspec); in brcmf_compare_update_same_bss()
3236 cfg->d11inf.decchspec(&ch_bss_info_le); in brcmf_compare_update_same_bss()
3238 if (!memcmp(&bss_info_le->BSSID, &bss->BSSID, ETH_ALEN) && in brcmf_compare_update_same_bss()
3240 bss_info_le->SSID_len == bss->SSID_len && in brcmf_compare_update_same_bss()
3241 !memcmp(bss_info_le->SSID, bss->SSID, bss_info_le->SSID_len)) { in brcmf_compare_update_same_bss()
3242 if ((bss->flags & BRCMF_BSS_RSSI_ON_CHANNEL) == in brcmf_compare_update_same_bss()
3243 (bss_info_le->flags & BRCMF_BSS_RSSI_ON_CHANNEL)) { in brcmf_compare_update_same_bss()
3244 s16 bss_rssi = le16_to_cpu(bss->RSSI); in brcmf_compare_update_same_bss()
3245 s16 bss_info_rssi = le16_to_cpu(bss_info_le->RSSI); in brcmf_compare_update_same_bss()
3248 * both on-channel or both off-channel in brcmf_compare_update_same_bss()
3251 bss->RSSI = bss_info_le->RSSI; in brcmf_compare_update_same_bss()
3252 } else if ((bss->flags & BRCMF_BSS_RSSI_ON_CHANNEL) && in brcmf_compare_update_same_bss()
3253 (bss_info_le->flags & BRCMF_BSS_RSSI_ON_CHANNEL) == 0) { in brcmf_compare_update_same_bss()
3254 /* preserve the on-channel rssi measurement in brcmf_compare_update_same_bss()
3257 bss->RSSI = bss_info_le->RSSI; in brcmf_compare_update_same_bss()
3258 bss->flags |= BRCMF_BSS_RSSI_ON_CHANNEL; in brcmf_compare_update_same_bss()
3269 struct brcmf_pub *drvr = ifp->drvr; in brcmf_cfg80211_escan_handler()
3270 struct brcmf_cfg80211_info *cfg = drvr->config; in brcmf_cfg80211_escan_handler()
3281 status = e->status; in brcmf_cfg80211_escan_handler()
3286 if (!test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { in brcmf_cfg80211_escan_handler()
3288 ifp->bsscfgidx); in brcmf_cfg80211_escan_handler()
3289 return -EPERM; in brcmf_cfg80211_escan_handler()
3294 if (e->datalen < sizeof(*escan_result_le)) { in brcmf_cfg80211_escan_handler()
3303 escan_buflen = le32_to_cpu(escan_result_le->buflen); in brcmf_cfg80211_escan_handler()
3305 escan_buflen > e->datalen || in brcmf_cfg80211_escan_handler()
3311 if (le16_to_cpu(escan_result_le->bss_count) != 1) { in brcmf_cfg80211_escan_handler()
3313 escan_result_le->bss_count); in brcmf_cfg80211_escan_handler()
3316 bss_info_le = &escan_result_le->bss_info_le; in brcmf_cfg80211_escan_handler()
3321 if (!cfg->int_escan_map && !cfg->scan_request) { in brcmf_cfg80211_escan_handler()
3326 bi_length = le32_to_cpu(bss_info_le->length); in brcmf_cfg80211_escan_handler()
3327 if (bi_length != escan_buflen - WL_ESCAN_RESULTS_FIXED_SIZE) { in brcmf_cfg80211_escan_handler()
3333 if (!(cfg_to_wiphy(cfg)->interface_modes & in brcmf_cfg80211_escan_handler()
3335 if (le16_to_cpu(bss_info_le->capability) & in brcmf_cfg80211_escan_handler()
3343 cfg->escan_info.escan_buf; in brcmf_cfg80211_escan_handler()
3344 if (bi_length > BRCMF_ESCAN_BUF_SIZE - list->buflen) { in brcmf_cfg80211_escan_handler()
3349 for (i = 0; i < list->count; i++) { in brcmf_cfg80211_escan_handler()
3352 le32_to_cpu(bss->length)) : list->bss_info_le; in brcmf_cfg80211_escan_handler()
3357 memcpy(&cfg->escan_info.escan_buf[list->buflen], bss_info_le, in brcmf_cfg80211_escan_handler()
3359 list->version = le32_to_cpu(bss_info_le->version); in brcmf_cfg80211_escan_handler()
3360 list->buflen += bi_length; in brcmf_cfg80211_escan_handler()
3361 list->count++; in brcmf_cfg80211_escan_handler()
3363 cfg->escan_info.escan_state = WL_ESCAN_STATE_IDLE; in brcmf_cfg80211_escan_handler()
3366 if (cfg->int_escan_map || cfg->scan_request) { in brcmf_cfg80211_escan_handler()
3380 brcmf_fweh_register(cfg->pub, BRCMF_E_ESCAN_RESULT, in brcmf_init_escan()
3382 cfg->escan_info.escan_state = WL_ESCAN_STATE_IDLE; in brcmf_init_escan()
3384 timer_setup(&cfg->escan_timeout, brcmf_escan_timeout, 0); in brcmf_init_escan()
3385 INIT_WORK(&cfg->escan_timeout_work, in brcmf_init_escan()
3395 n_netinfo * sizeof(req->channels[0]) + in brcmf_alloc_internal_escan_request()
3396 n_netinfo * sizeof(*req->ssids); in brcmf_alloc_internal_escan_request()
3400 req->wiphy = wiphy; in brcmf_alloc_internal_escan_request()
3401 req->ssids = (void *)(&req->channels[0]) + in brcmf_alloc_internal_escan_request()
3402 n_netinfo * sizeof(req->channels[0]); in brcmf_alloc_internal_escan_request()
3421 return -EINVAL; in brcmf_internal_escan_add_info()
3423 chan = ieee80211_get_channel(req->wiphy, freq); in brcmf_internal_escan_add_info()
3425 return -EINVAL; in brcmf_internal_escan_add_info()
3427 for (i = 0; i < req->n_channels; i++) { in brcmf_internal_escan_add_info()
3428 if (req->channels[i] == chan) in brcmf_internal_escan_add_info()
3431 if (i == req->n_channels) in brcmf_internal_escan_add_info()
3432 req->channels[req->n_channels++] = chan; in brcmf_internal_escan_add_info()
3434 for (i = 0; i < req->n_ssids; i++) { in brcmf_internal_escan_add_info()
3435 if (req->ssids[i].ssid_len == ssid_len && in brcmf_internal_escan_add_info()
3436 !memcmp(req->ssids[i].ssid, ssid, ssid_len)) in brcmf_internal_escan_add_info()
3439 if (i == req->n_ssids) { in brcmf_internal_escan_add_info()
3440 memcpy(req->ssids[req->n_ssids].ssid, ssid, ssid_len); in brcmf_internal_escan_add_info()
3441 req->ssids[req->n_ssids++].ssid_len = ssid_len; in brcmf_internal_escan_add_info()
3449 struct brcmf_cfg80211_info *cfg = ifp->drvr->config; in brcmf_start_internal_escan()
3452 if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { in brcmf_start_internal_escan()
3453 if (cfg->int_escan_map) in brcmf_start_internal_escan()
3455 cfg->int_escan_map); in brcmf_start_internal_escan()
3456 /* Abort any on-going scan */ in brcmf_start_internal_escan()
3461 set_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); in brcmf_start_internal_escan()
3462 cfg->escan_info.run = brcmf_run_escan; in brcmf_start_internal_escan()
3465 clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); in brcmf_start_internal_escan()
3468 cfg->int_escan_map = fwmap; in brcmf_start_internal_escan()
3478 switch (pfn_v1->version) { in brcmf_get_netinfo_array()
3504 struct brcmf_pub *drvr = ifp->drvr; in brcmf_notify_sched_scan_results()
3505 struct brcmf_cfg80211_info *cfg = drvr->config; in brcmf_notify_sched_scan_results()
3518 if (e->datalen < (sizeof(*pfn_result) + sizeof(*netinfo))) { in brcmf_notify_sched_scan_results()
3523 if (e->event_code == BRCMF_E_PFN_NET_LOST) { in brcmf_notify_sched_scan_results()
3529 result_count = le32_to_cpu(pfn_result->count); in brcmf_notify_sched_scan_results()
3530 status = le32_to_cpu(pfn_result->status); in brcmf_notify_sched_scan_results()
3543 datalen = e->datalen - ((void *)netinfo_start - (void *)pfn_result); in brcmf_notify_sched_scan_results()
3552 err = -ENOMEM; in brcmf_notify_sched_scan_results()
3560 if (netinfo->SSID_len > IEEE80211_MAX_SSID_LEN) in brcmf_notify_sched_scan_results()
3561 netinfo->SSID_len = IEEE80211_MAX_SSID_LEN; in brcmf_notify_sched_scan_results()
3563 netinfo->SSID, netinfo->channel); in brcmf_notify_sched_scan_results()
3564 bucket_map |= brcmf_pno_get_bucket_map(cfg->pno, netinfo); in brcmf_notify_sched_scan_results()
3566 netinfo->SSID, in brcmf_notify_sched_scan_results()
3567 netinfo->SSID_len, in brcmf_notify_sched_scan_results()
3568 netinfo->channel); in brcmf_notify_sched_scan_results()
3594 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_sched_scan_start()
3597 req->n_match_sets, req->n_ssids); in brcmf_cfg80211_sched_scan_start()
3599 if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) { in brcmf_cfg80211_sched_scan_start()
3601 cfg->scan_status); in brcmf_cfg80211_sched_scan_start()
3602 return -EAGAIN; in brcmf_cfg80211_sched_scan_start()
3605 if (req->n_match_sets <= 0) { in brcmf_cfg80211_sched_scan_start()
3607 req->n_match_sets); in brcmf_cfg80211_sched_scan_start()
3608 return -EINVAL; in brcmf_cfg80211_sched_scan_start()
3622 if (cfg->int_escan_map) in brcmf_cfg80211_sched_scan_stop()
3649 patternoffset = sizeof(*filter) - sizeof(filter->cmd) + masksize; in brcmf_config_wowl_pattern()
3654 return -ENOMEM; in brcmf_config_wowl_pattern()
3657 memcpy(filter->cmd, cmd, 4); in brcmf_config_wowl_pattern()
3658 filter->masksize = cpu_to_le32(masksize); in brcmf_config_wowl_pattern()
3659 filter->offset = cpu_to_le32(packet_offset); in brcmf_config_wowl_pattern()
3660 filter->patternoffset = cpu_to_le32(patternoffset); in brcmf_config_wowl_pattern()
3661 filter->patternsize = cpu_to_le32(patternsize); in brcmf_config_wowl_pattern()
3662 filter->type = cpu_to_le32(BRCMF_WOWL_PATTERN_TYPE_BITMAP); in brcmf_config_wowl_pattern()
3679 struct brcmf_pub *drvr = ifp->drvr; in brcmf_wowl_nd_results()
3680 struct brcmf_cfg80211_info *cfg = drvr->config; in brcmf_wowl_nd_results()
3686 if (e->datalen < (sizeof(*pfn_result) + sizeof(*netinfo))) { in brcmf_wowl_nd_results()
3693 if (e->event_code == BRCMF_E_PFN_NET_LOST) { in brcmf_wowl_nd_results()
3698 if (le32_to_cpu(pfn_result->count) < 1) { in brcmf_wowl_nd_results()
3700 le32_to_cpu(pfn_result->count)); in brcmf_wowl_nd_results()
3701 return -EINVAL; in brcmf_wowl_nd_results()
3705 if (netinfo->SSID_len > IEEE80211_MAX_SSID_LEN) in brcmf_wowl_nd_results()
3706 netinfo->SSID_len = IEEE80211_MAX_SSID_LEN; in brcmf_wowl_nd_results()
3707 memcpy(cfg->wowl.nd->ssid.ssid, netinfo->SSID, netinfo->SSID_len); in brcmf_wowl_nd_results()
3708 cfg->wowl.nd->ssid.ssid_len = netinfo->SSID_len; in brcmf_wowl_nd_results()
3709 cfg->wowl.nd->n_channels = 1; in brcmf_wowl_nd_results()
3710 cfg->wowl.nd->channels[0] = in brcmf_wowl_nd_results()
3711 ieee80211_channel_to_frequency(netinfo->channel, in brcmf_wowl_nd_results()
3712 netinfo->channel <= CH_MAX_2G_CHANNEL ? in brcmf_wowl_nd_results()
3714 cfg->wowl.nd_info->n_matches = 1; in brcmf_wowl_nd_results()
3715 cfg->wowl.nd_info->matches[0] = cfg->wowl.nd; in brcmf_wowl_nd_results()
3718 cfg->wowl.nd_data_completed = true; in brcmf_wowl_nd_results()
3719 wake_up(&cfg->wowl.nd_data_wait); in brcmf_wowl_nd_results()
3729 struct brcmf_pub *drvr = cfg->pub; in brcmf_report_wowl_wakeind()
3750 wakeup_data.pattern_idx = -1; in brcmf_report_wowl_wakeind()
3777 timeout = wait_event_timeout(cfg->wowl.nd_data_wait, in brcmf_report_wowl_wakeind()
3778 cfg->wowl.nd_data_completed, in brcmf_report_wowl_wakeind()
3783 wakeup_data.net_detect = cfg->wowl.nd_info; in brcmf_report_wowl_wakeind()
3792 cfg80211_report_wowlan_wakeup(&ifp->vif->wdev, wakeup, GFP_KERNEL); in brcmf_report_wowl_wakeind()
3811 if (cfg->wowl.active) { in brcmf_cfg80211_resume()
3818 cfg->wowl.pre_pmmode); in brcmf_cfg80211_resume()
3819 cfg->wowl.active = false; in brcmf_cfg80211_resume()
3820 if (cfg->wowl.nd_enabled) { in brcmf_cfg80211_resume()
3821 brcmf_cfg80211_sched_scan_stop(cfg->wiphy, ifp->ndev, 0); in brcmf_cfg80211_resume()
3822 brcmf_fweh_unregister(cfg->pub, BRCMF_E_PFN_NET_FOUND); in brcmf_cfg80211_resume()
3823 brcmf_fweh_register(cfg->pub, BRCMF_E_PFN_NET_FOUND, in brcmf_cfg80211_resume()
3825 cfg->wowl.nd_enabled = false; in brcmf_cfg80211_resume()
3843 brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_PM, &cfg->wowl.pre_pmmode); in brcmf_configure_wowl()
3847 if (wowl->disconnect) in brcmf_configure_wowl()
3849 if (wowl->magic_pkt) in brcmf_configure_wowl()
3851 if ((wowl->patterns) && (wowl->n_patterns)) { in brcmf_configure_wowl()
3853 for (i = 0; i < wowl->n_patterns; i++) { in brcmf_configure_wowl()
3855 (u8 *)wowl->patterns[i].pattern, in brcmf_configure_wowl()
3856 wowl->patterns[i].pattern_len, in brcmf_configure_wowl()
3857 (u8 *)wowl->patterns[i].mask, in brcmf_configure_wowl()
3858 wowl->patterns[i].pkt_offset); in brcmf_configure_wowl()
3861 if (wowl->nd_config) { in brcmf_configure_wowl()
3862 brcmf_cfg80211_sched_scan_start(cfg->wiphy, ifp->ndev, in brcmf_configure_wowl()
3863 wowl->nd_config); in brcmf_configure_wowl()
3866 cfg->wowl.nd_data_completed = false; in brcmf_configure_wowl()
3867 cfg->wowl.nd_enabled = true; in brcmf_configure_wowl()
3869 brcmf_fweh_unregister(cfg->pub, BRCMF_E_PFN_NET_FOUND); in brcmf_configure_wowl()
3870 brcmf_fweh_register(cfg->pub, BRCMF_E_PFN_NET_FOUND, in brcmf_configure_wowl()
3873 if (wowl->gtk_rekey_failure) in brcmf_configure_wowl()
3875 if (!test_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state)) in brcmf_configure_wowl()
3883 brcmf_bus_wowl_config(cfg->pub->bus_if, true); in brcmf_configure_wowl()
3884 cfg->wowl.active = true; in brcmf_configure_wowl()
3900 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_suspend()
3908 if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) in brcmf_cfg80211_suspend()
3912 brcmf_bus_wowl_config(cfg->pub->bus_if, false); in brcmf_cfg80211_suspend()
3913 list_for_each_entry(vif, &cfg->vif_list, list) { in brcmf_cfg80211_suspend()
3914 if (!test_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state)) in brcmf_cfg80211_suspend()
3938 cfg->scan_status = 0; in brcmf_cfg80211_suspend()
3950 pmk_list = &cfg->pmk_list; in brcmf_update_pmklist()
3951 npmk = le32_to_cpu(pmk_list->npmk); in brcmf_update_pmklist()
3955 brcmf_dbg(CONN, "PMK[%d]: %pM\n", i, &pmk_list->pmk[i].bssid); in brcmf_update_pmklist()
3969 struct brcmf_pmksa *pmk = &cfg->pmk_list.pmk[0]; in brcmf_cfg80211_set_pmksa()
3970 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_set_pmksa()
3975 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_set_pmksa()
3976 return -EIO; in brcmf_cfg80211_set_pmksa()
3978 npmk = le32_to_cpu(cfg->pmk_list.npmk); in brcmf_cfg80211_set_pmksa()
3980 if (!memcmp(pmksa->bssid, pmk[i].bssid, ETH_ALEN)) in brcmf_cfg80211_set_pmksa()
3983 memcpy(pmk[i].bssid, pmksa->bssid, ETH_ALEN); in brcmf_cfg80211_set_pmksa()
3984 memcpy(pmk[i].pmkid, pmksa->pmkid, WLAN_PMKID_LEN); in brcmf_cfg80211_set_pmksa()
3987 cfg->pmk_list.npmk = cpu_to_le32(npmk); in brcmf_cfg80211_set_pmksa()
3991 return -EINVAL; in brcmf_cfg80211_set_pmksa()
3994 brcmf_dbg(CONN, "set_pmksa - PMK bssid: %pM =\n", pmk[npmk].bssid); in brcmf_cfg80211_set_pmksa()
4009 struct brcmf_pmksa *pmk = &cfg->pmk_list.pmk[0]; in brcmf_cfg80211_del_pmksa()
4010 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_del_pmksa()
4015 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_del_pmksa()
4016 return -EIO; in brcmf_cfg80211_del_pmksa()
4018 brcmf_dbg(CONN, "del_pmksa - PMK bssid = %pM\n", pmksa->bssid); in brcmf_cfg80211_del_pmksa()
4020 npmk = le32_to_cpu(cfg->pmk_list.npmk); in brcmf_cfg80211_del_pmksa()
4022 if (!memcmp(pmksa->bssid, pmk[i].bssid, ETH_ALEN)) in brcmf_cfg80211_del_pmksa()
4026 for (; i < (npmk - 1); i++) { in brcmf_cfg80211_del_pmksa()
4032 cfg->pmk_list.npmk = cpu_to_le32(npmk - 1); in brcmf_cfg80211_del_pmksa()
4035 return -EINVAL; in brcmf_cfg80211_del_pmksa()
4053 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_flush_pmksa()
4054 return -EIO; in brcmf_cfg80211_flush_pmksa()
4056 memset(&cfg->pmk_list, 0, sizeof(cfg->pmk_list)); in brcmf_cfg80211_flush_pmksa()
4066 struct brcmf_pub *drvr = ifp->drvr; in brcmf_configure_opensecurity()
4082 /* set upper-layer auth */ in brcmf_configure_opensecurity()
4083 if (brcmf_is_ibssmode(ifp->vif)) in brcmf_configure_opensecurity()
4109 struct brcmf_pub *drvr = ifp->drvr; in brcmf_configure_wpaie()
4129 len = wpa_ie->len + TLV_HDR_LEN; in brcmf_configure_wpaie()
4139 err = -EINVAL; in brcmf_configure_wpaie()
4145 err = -EINVAL; in brcmf_configure_wpaie()
4167 err = -EINVAL; in brcmf_configure_wpaie()
4178 err = -EINVAL; in brcmf_configure_wpaie()
4184 err = -EINVAL; in brcmf_configure_wpaie()
4212 err = -EINVAL; in brcmf_configure_wpaie()
4218 err = -EINVAL; in brcmf_configure_wpaie()
4273 err = -EINVAL; in brcmf_configure_wpaie()
4338 /* set upper-layer auth */ in brcmf_configure_wpaie()
4363 if (ie->id != WLAN_EID_VENDOR_SPECIFIC) in brcmf_parse_vndr_ies()
4367 if (vndrie->len < (VS_IE_FIXED_HDR_LEN - TLV_HDR_LEN + 1)) { in brcmf_parse_vndr_ies()
4369 vndrie->len); in brcmf_parse_vndr_ies()
4373 if (!memcmp(vndrie->oui, (u8 *)WPA_OUI, TLV_OUI_LEN) && in brcmf_parse_vndr_ies()
4374 ((vndrie->oui_type == WPA_OUI_TYPE) || in brcmf_parse_vndr_ies()
4375 (vndrie->oui_type == WME_OUI_TYPE))) { in brcmf_parse_vndr_ies()
4380 parsed_info = &vndr_ies->ie_info[vndr_ies->count]; in brcmf_parse_vndr_ies()
4383 parsed_info->ie_ptr = (char *)vndrie; in brcmf_parse_vndr_ies()
4384 parsed_info->ie_len = vndrie->len + TLV_HDR_LEN; in brcmf_parse_vndr_ies()
4385 memcpy(&parsed_info->vndrie, vndrie, sizeof(*vndrie)); in brcmf_parse_vndr_ies()
4387 vndr_ies->count++; in brcmf_parse_vndr_ies()
4390 parsed_info->vndrie.oui, in brcmf_parse_vndr_ies()
4391 parsed_info->vndrie.oui_type); in brcmf_parse_vndr_ies()
4393 if (vndr_ies->count >= VNDR_IE_PARSE_LIMIT) in brcmf_parse_vndr_ies()
4396 remaining_len -= (ie->len + TLV_HDR_LEN); in brcmf_parse_vndr_ies()
4400 ie = (struct brcmf_tlv *)(((u8 *)ie) + ie->len + in brcmf_parse_vndr_ies()
4443 return -ENODEV; in brcmf_vif_set_mgmt_ie()
4444 ifp = vif->ifp; in brcmf_vif_set_mgmt_ie()
4445 drvr = ifp->drvr; in brcmf_vif_set_mgmt_ie()
4446 saved_ie = &vif->saved_ie; in brcmf_vif_set_mgmt_ie()
4448 brcmf_dbg(TRACE, "bsscfgidx %d, pktflag : 0x%02X\n", ifp->bsscfgidx, in brcmf_vif_set_mgmt_ie()
4452 return -ENOMEM; in brcmf_vif_set_mgmt_ie()
4456 mgmt_ie_buf = saved_ie->probe_req_ie; in brcmf_vif_set_mgmt_ie()
4457 mgmt_ie_len = &saved_ie->probe_req_ie_len; in brcmf_vif_set_mgmt_ie()
4458 mgmt_ie_buf_len = sizeof(saved_ie->probe_req_ie); in brcmf_vif_set_mgmt_ie()
4461 mgmt_ie_buf = saved_ie->probe_res_ie; in brcmf_vif_set_mgmt_ie()
4462 mgmt_ie_len = &saved_ie->probe_res_ie_len; in brcmf_vif_set_mgmt_ie()
4463 mgmt_ie_buf_len = sizeof(saved_ie->probe_res_ie); in brcmf_vif_set_mgmt_ie()
4466 mgmt_ie_buf = saved_ie->beacon_ie; in brcmf_vif_set_mgmt_ie()
4467 mgmt_ie_len = &saved_ie->beacon_ie_len; in brcmf_vif_set_mgmt_ie()
4468 mgmt_ie_buf_len = sizeof(saved_ie->beacon_ie); in brcmf_vif_set_mgmt_ie()
4471 mgmt_ie_buf = saved_ie->assoc_req_ie; in brcmf_vif_set_mgmt_ie()
4472 mgmt_ie_len = &saved_ie->assoc_req_ie_len; in brcmf_vif_set_mgmt_ie()
4473 mgmt_ie_buf_len = sizeof(saved_ie->assoc_req_ie); in brcmf_vif_set_mgmt_ie()
4476 mgmt_ie_buf = saved_ie->assoc_res_ie; in brcmf_vif_set_mgmt_ie()
4477 mgmt_ie_len = &saved_ie->assoc_res_ie_len; in brcmf_vif_set_mgmt_ie()
4478 mgmt_ie_buf_len = sizeof(saved_ie->assoc_res_ie); in brcmf_vif_set_mgmt_ie()
4481 err = -EPERM; in brcmf_vif_set_mgmt_ie()
4487 err = -ENOMEM; in brcmf_vif_set_mgmt_ie()
4498 memcpy(ptr + parsed_ie_buf_len, vndrie_info->ie_ptr, in brcmf_vif_set_mgmt_ie()
4499 vndrie_info->ie_len); in brcmf_vif_set_mgmt_ie()
4500 parsed_ie_buf_len += vndrie_info->ie_len; in brcmf_vif_set_mgmt_ie()
4520 vndrie_info->vndrie.id, in brcmf_vif_set_mgmt_ie()
4521 vndrie_info->vndrie.len, in brcmf_vif_set_mgmt_ie()
4522 vndrie_info->vndrie.oui); in brcmf_vif_set_mgmt_ie()
4525 vndrie_info->ie_ptr, in brcmf_vif_set_mgmt_ie()
4526 vndrie_info->ie_len, in brcmf_vif_set_mgmt_ie()
4545 if (remained_buf_len < (vndrie_info->vndrie.len + in brcmf_vif_set_mgmt_ie()
4551 remained_buf_len -= (vndrie_info->ie_len + in brcmf_vif_set_mgmt_ie()
4555 vndrie_info->vndrie.id, in brcmf_vif_set_mgmt_ie()
4556 vndrie_info->vndrie.len, in brcmf_vif_set_mgmt_ie()
4557 vndrie_info->vndrie.oui); in brcmf_vif_set_mgmt_ie()
4560 vndrie_info->ie_ptr, in brcmf_vif_set_mgmt_ie()
4561 vndrie_info->ie_len, in brcmf_vif_set_mgmt_ie()
4565 memcpy(ptr + (*mgmt_ie_len), vndrie_info->ie_ptr, in brcmf_vif_set_mgmt_ie()
4566 vndrie_info->ie_len); in brcmf_vif_set_mgmt_ie()
4567 *mgmt_ie_len += vndrie_info->ie_len; in brcmf_vif_set_mgmt_ie()
4597 memset(&vif->saved_ie, 0, sizeof(vif->saved_ie)); in brcmf_vif_clear_mgmt_ies()
4605 struct brcmf_pub *drvr = vif->ifp->drvr; in brcmf_config_ap_mgmt_ie()
4610 beacon->tail, beacon->tail_len); in brcmf_config_ap_mgmt_ie()
4619 beacon->proberesp_ies, in brcmf_config_ap_mgmt_ie()
4620 beacon->proberesp_ies_len); in brcmf_config_ap_mgmt_ie()
4626 /* Set Assoc Response IEs to FW */ in brcmf_config_ap_mgmt_ie()
4628 beacon->assocresp_ies, in brcmf_config_ap_mgmt_ie()
4629 beacon->assocresp_ies_len); in brcmf_config_ap_mgmt_ie()
4631 brcmf_err("Set Assoc Resp IE Failed\n"); in brcmf_config_ap_mgmt_ie()
4633 brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc Resp\n"); in brcmf_config_ap_mgmt_ie()
4648 rsn_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail, in brcmf_parse_configure_security()
4649 settings->beacon.tail_len, WLAN_EID_RSN); in brcmf_parse_configure_security()
4652 wpa_ie = brcmf_find_wpaie((u8 *)settings->beacon.tail, in brcmf_parse_configure_security()
4653 settings->beacon.tail_len); in brcmf_parse_configure_security()
4687 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_start_ap()
4688 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; in brcmf_cfg80211_start_ap()
4689 struct cfg80211_crypto_settings *crypto = &settings->crypto; in brcmf_cfg80211_start_ap()
4693 s32 err = -EPERM; in brcmf_cfg80211_start_ap()
4697 u16 chanspec = chandef_to_chanspec(&cfg->d11inf, &settings->chandef); in brcmf_cfg80211_start_ap()
4703 settings->chandef.chan->hw_value, in brcmf_cfg80211_start_ap()
4704 settings->chandef.center_freq1, settings->chandef.width, in brcmf_cfg80211_start_ap()
4705 settings->beacon_interval, settings->dtim_period); in brcmf_cfg80211_start_ap()
4707 settings->ssid, settings->ssid_len, settings->auth_type, in brcmf_cfg80211_start_ap()
4708 settings->inactivity_timeout); in brcmf_cfg80211_start_ap()
4709 dev_role = ifp->vif->wdev.iftype; in brcmf_cfg80211_start_ap()
4710 mbss = ifp->vif->mbss; in brcmf_cfg80211_start_ap()
4714 &ifp->vif->is_11d)) { in brcmf_cfg80211_start_ap()
4717 country_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail, in brcmf_cfg80211_start_ap()
4718 settings->beacon.tail_len, in brcmf_cfg80211_start_ap()
4725 if (settings->ssid == NULL || settings->ssid_len == 0) { in brcmf_cfg80211_start_ap()
4728 (u8 *)&settings->beacon.head[ie_offset], in brcmf_cfg80211_start_ap()
4729 settings->beacon.head_len - ie_offset, in brcmf_cfg80211_start_ap()
4731 if (!ssid_ie || ssid_ie->len > IEEE80211_MAX_SSID_LEN) in brcmf_cfg80211_start_ap()
4732 return -EINVAL; in brcmf_cfg80211_start_ap()
4734 memcpy(ssid_le.SSID, ssid_ie->data, ssid_ie->len); in brcmf_cfg80211_start_ap()
4735 ssid_le.SSID_len = cpu_to_le32(ssid_ie->len); in brcmf_cfg80211_start_ap()
4738 memcpy(ssid_le.SSID, settings->ssid, settings->ssid_len); in brcmf_cfg80211_start_ap()
4739 ssid_le.SSID_len = cpu_to_le32((u32)settings->ssid_len); in brcmf_cfg80211_start_ap()
4749 if ((supports_11d) && (is_11d != ifp->vif->is_11d)) { in brcmf_cfg80211_start_ap()
4758 if (settings->beacon_interval) { in brcmf_cfg80211_start_ap()
4760 settings->beacon_interval); in brcmf_cfg80211_start_ap()
4767 if (settings->dtim_period) { in brcmf_cfg80211_start_ap()
4769 settings->dtim_period); in brcmf_cfg80211_start_ap()
4778 ((ifp->ifidx == 0) || in brcmf_cfg80211_start_ap()
4795 } else if (WARN_ON(supports_11d && (is_11d != ifp->vif->is_11d))) { in brcmf_cfg80211_start_ap()
4796 /* Multiple-BSS should use same 11d configuration */ in brcmf_cfg80211_start_ap()
4797 err = -EINVAL; in brcmf_cfg80211_start_ap()
4829 if (crypto->psk) { in brcmf_cfg80211_start_ap()
4831 profile->use_fwauth |= BIT(BRCMF_PROFILE_FWAUTH_PSK); in brcmf_cfg80211_start_ap()
4832 err = brcmf_set_pmk(ifp, crypto->psk, in brcmf_cfg80211_start_ap()
4837 if (crypto->sae_pwd) { in brcmf_cfg80211_start_ap()
4839 profile->use_fwauth |= BIT(BRCMF_PROFILE_FWAUTH_SAE); in brcmf_cfg80211_start_ap()
4840 err = brcmf_set_sae_password(ifp, crypto->sae_pwd, in brcmf_cfg80211_start_ap()
4841 crypto->sae_pwd_len); in brcmf_cfg80211_start_ap()
4845 if (profile->use_fwauth == 0) in brcmf_cfg80211_start_ap()
4846 profile->use_fwauth = BIT(BRCMF_PROFILE_FWAUTH_NONE); in brcmf_cfg80211_start_ap()
4872 settings->hidden_ssid); in brcmf_cfg80211_start_ap()
4875 settings->hidden_ssid ? in brcmf_cfg80211_start_ap()
4903 bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx); in brcmf_cfg80211_start_ap()
4917 brcmf_config_ap_mgmt_ie(ifp->vif, &settings->beacon); in brcmf_cfg80211_start_ap()
4918 set_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); in brcmf_cfg80211_start_ap()
4933 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_stop_ap()
4934 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; in brcmf_cfg80211_stop_ap()
4941 if (ifp->vif->wdev.iftype == NL80211_IFTYPE_AP) { in brcmf_cfg80211_stop_ap()
4946 if (profile->use_fwauth != BIT(BRCMF_PROFILE_FWAUTH_NONE)) { in brcmf_cfg80211_stop_ap()
4947 if (profile->use_fwauth & BIT(BRCMF_PROFILE_FWAUTH_PSK)) in brcmf_cfg80211_stop_ap()
4949 if (profile->use_fwauth & BIT(BRCMF_PROFILE_FWAUTH_SAE)) in brcmf_cfg80211_stop_ap()
4951 profile->use_fwauth = BIT(BRCMF_PROFILE_FWAUTH_NONE); in brcmf_cfg80211_stop_ap()
4954 if (ifp->vif->mbss) { in brcmf_cfg80211_stop_ap()
4960 if (ifp->bsscfgidx == 0) in brcmf_cfg80211_stop_ap()
4977 ifp->vif->is_11d); in brcmf_cfg80211_stop_ap()
4983 brcmf_vif_clear_mgmt_ies(ifp->vif); in brcmf_cfg80211_stop_ap()
4985 bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx); in brcmf_cfg80211_stop_ap()
4994 clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); in brcmf_cfg80211_stop_ap()
5009 err = brcmf_config_ap_mgmt_ie(ifp->vif, info); in brcmf_cfg80211_change_beacon()
5019 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_del_station()
5024 if (!params->mac) in brcmf_cfg80211_del_station()
5025 return -EFAULT; in brcmf_cfg80211_del_station()
5027 brcmf_dbg(TRACE, "Enter %pM\n", params->mac); in brcmf_cfg80211_del_station()
5029 if (ifp->vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif) in brcmf_cfg80211_del_station()
5030 ifp = cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp; in brcmf_cfg80211_del_station()
5031 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_del_station()
5032 return -EIO; in brcmf_cfg80211_del_station()
5034 memcpy(&scbval.ea, params->mac, ETH_ALEN); in brcmf_cfg80211_del_station()
5035 scbval.val = cpu_to_le32(params->reason_code); in brcmf_cfg80211_del_station()
5051 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_change_station()
5056 params->sta_flags_mask, params->sta_flags_set); in brcmf_cfg80211_change_station()
5062 if (!(params->sta_flags_mask & BIT(NL80211_STA_FLAG_AUTHORIZED))) in brcmf_cfg80211_change_station()
5065 if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) in brcmf_cfg80211_change_station()
5072 bphy_err(drvr, "Setting SCB (de-)authorize failed, %d\n", err); in brcmf_cfg80211_change_station()
5086 vif->mgmt_rx_reg = upd->interface_stypes; in brcmf_cfg80211_update_mgmt_frame_registrations()
5095 struct ieee80211_channel *chan = params->chan; in brcmf_cfg80211_mgmt_tx()
5096 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_mgmt_tx()
5097 const u8 *buf = params->buf; in brcmf_cfg80211_mgmt_tx()
5098 size_t len = params->len; in brcmf_cfg80211_mgmt_tx()
5116 if (!ieee80211_is_mgmt(mgmt->frame_control)) { in brcmf_cfg80211_mgmt_tx()
5118 return -EPERM; in brcmf_cfg80211_mgmt_tx()
5123 if (ieee80211_is_probe_resp(mgmt->frame_control)) { in brcmf_cfg80211_mgmt_tx()
5132 /* "DIRECT-". Note in future supplicant will take */ in brcmf_cfg80211_mgmt_tx()
5137 ie_len = len - ie_offset; in brcmf_cfg80211_mgmt_tx()
5138 if (vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY].vif) in brcmf_cfg80211_mgmt_tx()
5139 vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif; in brcmf_cfg80211_mgmt_tx()
5146 } else if (ieee80211_is_action(mgmt->frame_control)) { in brcmf_cfg80211_mgmt_tx()
5149 err = -EINVAL; in brcmf_cfg80211_mgmt_tx()
5155 err = -ENOMEM; in brcmf_cfg80211_mgmt_tx()
5158 action_frame = &af_params->action_frame; in brcmf_cfg80211_mgmt_tx()
5160 action_frame->packet_id = cpu_to_le32(*cookie); in brcmf_cfg80211_mgmt_tx()
5162 memcpy(&action_frame->da[0], &mgmt->da[0], ETH_ALEN); in brcmf_cfg80211_mgmt_tx()
5163 memcpy(&af_params->bssid[0], &mgmt->bssid[0], ETH_ALEN); in brcmf_cfg80211_mgmt_tx()
5165 action_frame->len = cpu_to_le16(len - DOT11_MGMT_HDR_LEN); in brcmf_cfg80211_mgmt_tx()
5170 freq = chan->center_freq; in brcmf_cfg80211_mgmt_tx()
5172 brcmf_fil_cmd_int_get(vif->ifp, BRCMF_C_GET_CHANNEL, in brcmf_cfg80211_mgmt_tx()
5175 af_params->channel = cpu_to_le32(chan_nr); in brcmf_cfg80211_mgmt_tx()
5176 af_params->dwell_time = cpu_to_le32(params->wait); in brcmf_cfg80211_mgmt_tx()
5177 memcpy(action_frame->data, &buf[DOT11_MGMT_HDR_LEN], in brcmf_cfg80211_mgmt_tx()
5178 le16_to_cpu(action_frame->len)); in brcmf_cfg80211_mgmt_tx()
5181 *cookie, le16_to_cpu(action_frame->len), freq); in brcmf_cfg80211_mgmt_tx()
5190 brcmf_dbg(TRACE, "Unhandled, fc=%04x!!\n", mgmt->frame_control); in brcmf_cfg80211_mgmt_tx()
5205 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_cancel_remain_on_channel()
5211 vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif; in brcmf_cfg80211_cancel_remain_on_channel()
5214 err = -ENODEV; in brcmf_cfg80211_cancel_remain_on_channel()
5217 brcmf_p2p_cancel_remain_on_channel(vif->ifp); in brcmf_cfg80211_cancel_remain_on_channel()
5227 struct net_device *ndev = wdev->netdev; in brcmf_cfg80211_get_channel()
5228 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_get_channel()
5235 if (!ndev || drvr->bus_if->state != BRCMF_BUS_UP) in brcmf_cfg80211_get_channel()
5236 return -ENODEV; in brcmf_cfg80211_get_channel()
5245 cfg->d11inf.decchspec(&ch); in brcmf_cfg80211_get_channel()
5275 chandef->chan = ieee80211_get_channel(wiphy, freq); in brcmf_cfg80211_get_channel()
5276 chandef->width = width; in brcmf_cfg80211_get_channel()
5277 chandef->center_freq1 = ieee80211_channel_to_frequency(ch.chnum, band); in brcmf_cfg80211_get_channel()
5278 chandef->center_freq2 = 0; in brcmf_cfg80211_get_channel()
5295 return -EINVAL; in brcmf_cfg80211_crit_proto_start()
5298 set_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status); in brcmf_cfg80211_crit_proto_start()
5313 clear_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status); in brcmf_cfg80211_crit_proto_stop()
5320 switch (e->reason) { in brcmf_notify_tdls_peer_event()
5326 brcmf_proto_add_tdls_peer(ifp->drvr, ifp->ifidx, (u8 *)e->addr); in brcmf_notify_tdls_peer_event()
5330 brcmf_proto_delete_peer(ifp->drvr, ifp->ifidx, (u8 *)e->addr); in brcmf_notify_tdls_peer_event()
5353 ret = -EOPNOTSUPP; in brcmf_convert_nl80211_tdls_oper()
5363 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_tdls_oper()
5393 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_update_conn_params()
5401 err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG, in brcmf_cfg80211_update_conn_params()
5402 sme->ie, sme->ie_len); in brcmf_cfg80211_update_conn_params()
5404 bphy_err(drvr, "Set Assoc REQ IE Failed\n"); in brcmf_cfg80211_update_conn_params()
5406 brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n"); in brcmf_cfg80211_update_conn_params()
5417 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_set_rekey_data()
5422 brcmf_dbg(TRACE, "Enter, bssidx=%d\n", ifp->bsscfgidx); in brcmf_cfg80211_set_rekey_data()
5424 memcpy(gtk_le.kck, gtk->kck, sizeof(gtk_le.kck)); in brcmf_cfg80211_set_rekey_data()
5425 memcpy(gtk_le.kek, gtk->kek, sizeof(gtk_le.kek)); in brcmf_cfg80211_set_rekey_data()
5426 memcpy(gtk_le.replay_counter, gtk->replay_ctr, in brcmf_cfg80211_set_rekey_data()
5447 if (WARN_ON(ifp->vif->profile.use_fwsup != BRCMF_PROFILE_FWSUP_1X)) in brcmf_cfg80211_set_pmk()
5448 return -EINVAL; in brcmf_cfg80211_set_pmk()
5450 if (conf->pmk_len > BRCMF_WSEC_MAX_PSK_LEN) in brcmf_cfg80211_set_pmk()
5451 return -ERANGE; in brcmf_cfg80211_set_pmk()
5453 return brcmf_set_pmk(ifp, conf->pmk, conf->pmk_len); in brcmf_cfg80211_set_pmk()
5463 if (WARN_ON(ifp->vif->profile.use_fwsup != BRCMF_PROFILE_FWSUP_1X)) in brcmf_cfg80211_del_pmk()
5464 return -EINVAL; in brcmf_cfg80211_del_pmk()
5524 if (ops && settings->roamoff) in brcmf_cfg80211_get_ops()
5525 ops->update_connect_params = NULL; in brcmf_cfg80211_get_ops()
5536 struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); in brcmf_alloc_vif()
5542 return ERR_PTR(-ENOMEM); in brcmf_alloc_vif()
5544 vif->wdev.wiphy = cfg->wiphy; in brcmf_alloc_vif()
5545 vif->wdev.iftype = type; in brcmf_alloc_vif()
5547 brcmf_init_prof(&vif->profile); in brcmf_alloc_vif()
5552 list_for_each_entry(vif_walk, &cfg->vif_list, list) { in brcmf_alloc_vif()
5553 if (vif_walk->wdev.iftype == NL80211_IFTYPE_AP) { in brcmf_alloc_vif()
5558 vif->mbss = mbss; in brcmf_alloc_vif()
5561 list_add_tail(&vif->list, &cfg->vif_list); in brcmf_alloc_vif()
5567 list_del(&vif->list); in brcmf_free_vif()
5577 vif = ifp->vif; in brcmf_cfg80211_free_netdev()
5586 u32 event = e->event_code; in brcmf_is_linkup()
5587 u32 status = e->status; in brcmf_is_linkup()
5589 if ((vif->profile.use_fwsup == BRCMF_PROFILE_FWSUP_PSK || in brcmf_is_linkup()
5590 vif->profile.use_fwsup == BRCMF_PROFILE_FWSUP_SAE) && in brcmf_is_linkup()
5593 set_bit(BRCMF_VIF_STATUS_EAP_SUCCESS, &vif->sme_state); in brcmf_is_linkup()
5596 memcpy(vif->profile.bssid, e->addr, ETH_ALEN); in brcmf_is_linkup()
5597 if (vif->profile.use_fwsup != BRCMF_PROFILE_FWSUP_PSK && in brcmf_is_linkup()
5598 vif->profile.use_fwsup != BRCMF_PROFILE_FWSUP_SAE) in brcmf_is_linkup()
5601 set_bit(BRCMF_VIF_STATUS_ASSOC_SUCCESS, &vif->sme_state); in brcmf_is_linkup()
5604 if (test_bit(BRCMF_VIF_STATUS_EAP_SUCCESS, &vif->sme_state) && in brcmf_is_linkup()
5605 test_bit(BRCMF_VIF_STATUS_ASSOC_SUCCESS, &vif->sme_state)) { in brcmf_is_linkup()
5606 clear_bit(BRCMF_VIF_STATUS_EAP_SUCCESS, &vif->sme_state); in brcmf_is_linkup()
5607 clear_bit(BRCMF_VIF_STATUS_ASSOC_SUCCESS, &vif->sme_state); in brcmf_is_linkup()
5615 u32 event = e->event_code; in brcmf_is_linkdown()
5616 u16 flags = e->flags; in brcmf_is_linkdown()
5630 u32 event = e->event_code; in brcmf_is_nonetwork()
5631 u32 status = e->status; in brcmf_is_nonetwork()
5635 e->flags & BRCMF_EVENT_MSG_LINK ? "up" : "down"); in brcmf_is_nonetwork()
5658 kfree(conn_info->req_ie); in brcmf_clear_assoc_ies()
5659 conn_info->req_ie = NULL; in brcmf_clear_assoc_ies()
5660 conn_info->req_ie_len = 0; in brcmf_clear_assoc_ies()
5661 kfree(conn_info->resp_ie); in brcmf_clear_assoc_ies()
5662 conn_info->resp_ie = NULL; in brcmf_clear_assoc_ies()
5663 conn_info->resp_ie_len = 0; in brcmf_clear_assoc_ies()
5674 /* For those AC(s) with ACM flag set to 1, convert its 4-level priority in brcmf_map_prio_to_prec()
5675 * to an 8-level precedence which is the same as BE's in brcmf_map_prio_to_prec()
5678 cfg->ac_priority[prio] == cfg->ac_priority[PRIO_8021D_BE]) in brcmf_map_prio_to_prec()
5679 return cfg->ac_priority[prio] * 2; in brcmf_map_prio_to_prec()
5681 /* Conversion of 4-level priority to 8-level precedence */ in brcmf_map_prio_to_prec()
5684 return cfg->ac_priority[prio] * 2; in brcmf_map_prio_to_prec()
5686 return cfg->ac_priority[prio] * 2 + 1; in brcmf_map_prio_to_prec()
5698 return cfg->ac_priority[prio]; in brcmf_map_prio_to_aci()
5735 aifsn = acp->ACI & EDCF_AIFSN_MASK; in brcmf_wifi_prioritize_acparams()
5736 acm = (acp->ACI & EDCF_ACM_MASK) ? 1 : 0; in brcmf_wifi_prioritize_acparams()
5737 ecwmin = acp->ECW & EDCF_ECWMIN_MASK; in brcmf_wifi_prioritize_acparams()
5738 ecwmax = (acp->ECW & EDCF_ECWMAX_MASK) >> EDCF_ECWMAX_SHIFT; in brcmf_wifi_prioritize_acparams()
5797 brcmf_dbg(CONN, "Adj prio BE 0->%d, BK 1->%d, BK 2->%d, BE 3->%d\n", in brcmf_wifi_prioritize_acparams()
5800 brcmf_dbg(CONN, "Adj prio VI 4->%d, VI 5->%d, VO 6->%d, VO 7->%d\n", in brcmf_wifi_prioritize_acparams()
5807 struct brcmf_pub *drvr = cfg->pub; in brcmf_get_assoc_ies()
5818 cfg->extra_buf, WL_ASSOC_INFO_MAX); in brcmf_get_assoc_ies()
5820 bphy_err(drvr, "could not get assoc info (%d)\n", err); in brcmf_get_assoc_ies()
5824 (struct brcmf_cfg80211_assoc_ielen_le *)cfg->extra_buf; in brcmf_get_assoc_ies()
5825 req_len = le32_to_cpu(assoc_info->req_len); in brcmf_get_assoc_ies()
5826 resp_len = le32_to_cpu(assoc_info->resp_len); in brcmf_get_assoc_ies()
5829 cfg->extra_buf, in brcmf_get_assoc_ies()
5832 bphy_err(drvr, "could not get assoc req (%d)\n", err); in brcmf_get_assoc_ies()
5835 conn_info->req_ie_len = req_len; in brcmf_get_assoc_ies()
5836 conn_info->req_ie = in brcmf_get_assoc_ies()
5837 kmemdup(cfg->extra_buf, conn_info->req_ie_len, in brcmf_get_assoc_ies()
5839 if (!conn_info->req_ie) in brcmf_get_assoc_ies()
5840 conn_info->req_ie_len = 0; in brcmf_get_assoc_ies()
5842 conn_info->req_ie_len = 0; in brcmf_get_assoc_ies()
5843 conn_info->req_ie = NULL; in brcmf_get_assoc_ies()
5847 cfg->extra_buf, in brcmf_get_assoc_ies()
5850 bphy_err(drvr, "could not get assoc resp (%d)\n", err); in brcmf_get_assoc_ies()
5853 conn_info->resp_ie_len = resp_len; in brcmf_get_assoc_ies()
5854 conn_info->resp_ie = in brcmf_get_assoc_ies()
5855 kmemdup(cfg->extra_buf, conn_info->resp_ie_len, in brcmf_get_assoc_ies()
5857 if (!conn_info->resp_ie) in brcmf_get_assoc_ies()
5858 conn_info->resp_ie_len = 0; in brcmf_get_assoc_ies()
5869 cfg->ac_priority); in brcmf_get_assoc_ies()
5871 conn_info->resp_ie_len = 0; in brcmf_get_assoc_ies()
5872 conn_info->resp_ie = NULL; in brcmf_get_assoc_ies()
5875 conn_info->req_ie_len, conn_info->resp_ie_len); in brcmf_get_assoc_ies()
5886 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; in brcmf_bss_roaming_done()
5901 memcpy(profile->bssid, e->addr, ETH_ALEN); in brcmf_bss_roaming_done()
5906 err = -ENOMEM; in brcmf_bss_roaming_done()
5919 ch.chspec = le16_to_cpu(bi->chanspec); in brcmf_bss_roaming_done()
5920 cfg->d11inf.decchspec(&ch); in brcmf_bss_roaming_done()
5923 band = wiphy->bands[NL80211_BAND_2GHZ]; in brcmf_bss_roaming_done()
5925 band = wiphy->bands[NL80211_BAND_5GHZ]; in brcmf_bss_roaming_done()
5927 freq = ieee80211_channel_to_frequency(ch.control_ch_num, band->band); in brcmf_bss_roaming_done()
5934 roam_info.bssid = profile->bssid; in brcmf_bss_roaming_done()
5935 roam_info.req_ie = conn_info->req_ie; in brcmf_bss_roaming_done()
5936 roam_info.req_ie_len = conn_info->req_ie_len; in brcmf_bss_roaming_done()
5937 roam_info.resp_ie = conn_info->resp_ie; in brcmf_bss_roaming_done()
5938 roam_info.resp_ie_len = conn_info->resp_ie_len; in brcmf_bss_roaming_done()
5943 if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_1X && profile->is_ft) { in brcmf_bss_roaming_done()
5944 cfg80211_port_authorized(ndev, profile->bssid, GFP_KERNEL); in brcmf_bss_roaming_done()
5948 set_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state); in brcmf_bss_roaming_done()
5959 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; in brcmf_bss_connect_done()
5966 &ifp->vif->sme_state)) { in brcmf_bss_connect_done()
5972 &ifp->vif->sme_state); in brcmf_bss_connect_done()
5977 conn_params.bssid = profile->bssid; in brcmf_bss_connect_done()
5978 conn_params.req_ie = conn_info->req_ie; in brcmf_bss_connect_done()
5979 conn_params.req_ie_len = conn_info->req_ie_len; in brcmf_bss_connect_done()
5980 conn_params.resp_ie = conn_info->resp_ie; in brcmf_bss_connect_done()
5981 conn_params.resp_ie_len = conn_info->resp_ie_len; in brcmf_bss_connect_done()
5983 brcmf_dbg(CONN, "Report connect result - connection %s\n", in brcmf_bss_connect_done()
5995 struct brcmf_pub *drvr = cfg->pub; in brcmf_notify_connect_status_ap()
5997 u32 event = e->event_code; in brcmf_notify_connect_status_ap()
5998 u32 reason = e->reason; in brcmf_notify_connect_status_ap()
6006 complete(&cfg->vif_disabled); in brcmf_notify_connect_status_ap()
6013 bphy_err(drvr, "No IEs present in ASSOC/REASSOC_IND\n"); in brcmf_notify_connect_status_ap()
6014 return -EINVAL; in brcmf_notify_connect_status_ap()
6019 return -ENOMEM; in brcmf_notify_connect_status_ap()
6021 sinfo->assoc_req_ies = data; in brcmf_notify_connect_status_ap()
6022 sinfo->assoc_req_ies_len = e->datalen; in brcmf_notify_connect_status_ap()
6024 sinfo->generation = generation; in brcmf_notify_connect_status_ap()
6025 cfg80211_new_sta(ndev, e->addr, sinfo, GFP_KERNEL); in brcmf_notify_connect_status_ap()
6031 cfg80211_del_sta(ndev, e->addr, GFP_KERNEL); in brcmf_notify_connect_status_ap()
6040 struct brcmf_cfg80211_info *cfg = ifp->drvr->config; in brcmf_notify_connect_status()
6041 struct net_device *ndev = ifp->ndev; in brcmf_notify_connect_status()
6042 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; in brcmf_notify_connect_status()
6046 if ((e->event_code == BRCMF_E_DEAUTH) || in brcmf_notify_connect_status()
6047 (e->event_code == BRCMF_E_DEAUTH_IND) || in brcmf_notify_connect_status()
6048 (e->event_code == BRCMF_E_DISASSOC_IND) || in brcmf_notify_connect_status()
6049 ((e->event_code == BRCMF_E_LINK) && (!e->flags))) { in brcmf_notify_connect_status()
6050 brcmf_proto_delete_peer(ifp->drvr, ifp->ifidx, (u8 *)e->addr); in brcmf_notify_connect_status()
6053 if (brcmf_is_apmode(ifp->vif)) { in brcmf_notify_connect_status()
6055 } else if (brcmf_is_linkup(ifp->vif, e)) { in brcmf_notify_connect_status()
6057 if (brcmf_is_ibssmode(ifp->vif)) { in brcmf_notify_connect_status()
6058 brcmf_inform_ibss(cfg, ndev, e->addr); in brcmf_notify_connect_status()
6059 chan = ieee80211_get_channel(cfg->wiphy, cfg->channel); in brcmf_notify_connect_status()
6060 memcpy(profile->bssid, e->addr, ETH_ALEN); in brcmf_notify_connect_status()
6061 cfg80211_ibss_joined(ndev, e->addr, chan, GFP_KERNEL); in brcmf_notify_connect_status()
6063 &ifp->vif->sme_state); in brcmf_notify_connect_status()
6065 &ifp->vif->sme_state); in brcmf_notify_connect_status()
6071 if (!brcmf_is_ibssmode(ifp->vif) && in brcmf_notify_connect_status()
6073 &ifp->vif->sme_state)) { in brcmf_notify_connect_status()
6074 if (memcmp(profile->bssid, e->addr, ETH_ALEN)) in brcmf_notify_connect_status()
6078 brcmf_link_down(ifp->vif, in brcmf_notify_connect_status()
6080 e->event_code & in brcmf_notify_connect_status()
6086 complete(&cfg->vif_disabled); in brcmf_notify_connect_status()
6090 if (brcmf_is_ibssmode(ifp->vif)) in brcmf_notify_connect_status()
6092 &ifp->vif->sme_state); in brcmf_notify_connect_status()
6104 struct brcmf_cfg80211_info *cfg = ifp->drvr->config; in brcmf_notify_roaming_status()
6105 u32 event = e->event_code; in brcmf_notify_roaming_status()
6106 u32 status = e->status; in brcmf_notify_roaming_status()
6110 &ifp->vif->sme_state)) { in brcmf_notify_roaming_status()
6111 brcmf_bss_roaming_done(cfg, ifp->ndev, e); in brcmf_notify_roaming_status()
6113 brcmf_bss_connect_done(cfg, ifp->ndev, e, true); in brcmf_notify_roaming_status()
6125 u16 flags = e->flags; in brcmf_notify_mic_status()
6133 cfg80211_michael_mic_failure(ifp->ndev, (u8 *)&e->addr, key_type, -1, in brcmf_notify_mic_status()
6142 struct brcmf_cfg80211_info *cfg = ifp->drvr->config; in brcmf_notify_vif_event()
6144 struct brcmf_cfg80211_vif_event *event = &cfg->vif_event; in brcmf_notify_vif_event()
6148 ifevent->action, ifevent->flags, ifevent->ifidx, in brcmf_notify_vif_event()
6149 ifevent->bsscfgidx); in brcmf_notify_vif_event()
6151 spin_lock(&event->vif_event_lock); in brcmf_notify_vif_event()
6152 event->action = ifevent->action; in brcmf_notify_vif_event()
6153 vif = event->vif; in brcmf_notify_vif_event()
6155 switch (ifevent->action) { in brcmf_notify_vif_event()
6158 if (!cfg->vif_event.vif) { in brcmf_notify_vif_event()
6159 spin_unlock(&event->vif_event_lock); in brcmf_notify_vif_event()
6160 return -EBADF; in brcmf_notify_vif_event()
6163 ifp->vif = vif; in brcmf_notify_vif_event()
6164 vif->ifp = ifp; in brcmf_notify_vif_event()
6165 if (ifp->ndev) { in brcmf_notify_vif_event()
6166 vif->wdev.netdev = ifp->ndev; in brcmf_notify_vif_event()
6167 ifp->ndev->ieee80211_ptr = &vif->wdev; in brcmf_notify_vif_event()
6168 SET_NETDEV_DEV(ifp->ndev, wiphy_dev(cfg->wiphy)); in brcmf_notify_vif_event()
6170 spin_unlock(&event->vif_event_lock); in brcmf_notify_vif_event()
6171 wake_up(&event->vif_wq); in brcmf_notify_vif_event()
6175 spin_unlock(&event->vif_event_lock); in brcmf_notify_vif_event()
6178 wake_up(&event->vif_wq); in brcmf_notify_vif_event()
6182 spin_unlock(&event->vif_event_lock); in brcmf_notify_vif_event()
6183 wake_up(&event->vif_wq); in brcmf_notify_vif_event()
6187 spin_unlock(&event->vif_event_lock); in brcmf_notify_vif_event()
6190 return -EINVAL; in brcmf_notify_vif_event()
6195 conf->frag_threshold = (u32)-1; in brcmf_init_conf()
6196 conf->rts_threshold = (u32)-1; in brcmf_init_conf()
6197 conf->retry_short = (u32)-1; in brcmf_init_conf()
6198 conf->retry_long = (u32)-1; in brcmf_init_conf()
6203 brcmf_fweh_register(cfg->pub, BRCMF_E_LINK, in brcmf_register_event_handlers()
6205 brcmf_fweh_register(cfg->pub, BRCMF_E_DEAUTH_IND, in brcmf_register_event_handlers()
6207 brcmf_fweh_register(cfg->pub, BRCMF_E_DEAUTH, in brcmf_register_event_handlers()
6209 brcmf_fweh_register(cfg->pub, BRCMF_E_DISASSOC_IND, in brcmf_register_event_handlers()
6211 brcmf_fweh_register(cfg->pub, BRCMF_E_ASSOC_IND, in brcmf_register_event_handlers()
6213 brcmf_fweh_register(cfg->pub, BRCMF_E_REASSOC_IND, in brcmf_register_event_handlers()
6215 brcmf_fweh_register(cfg->pub, BRCMF_E_ROAM, in brcmf_register_event_handlers()
6217 brcmf_fweh_register(cfg->pub, BRCMF_E_MIC_ERROR, in brcmf_register_event_handlers()
6219 brcmf_fweh_register(cfg->pub, BRCMF_E_SET_SSID, in brcmf_register_event_handlers()
6221 brcmf_fweh_register(cfg->pub, BRCMF_E_PFN_NET_FOUND, in brcmf_register_event_handlers()
6223 brcmf_fweh_register(cfg->pub, BRCMF_E_IF, in brcmf_register_event_handlers()
6225 brcmf_fweh_register(cfg->pub, BRCMF_E_P2P_PROBEREQ_MSG, in brcmf_register_event_handlers()
6227 brcmf_fweh_register(cfg->pub, BRCMF_E_P2P_DISC_LISTEN_COMPLETE, in brcmf_register_event_handlers()
6229 brcmf_fweh_register(cfg->pub, BRCMF_E_ACTION_FRAME_RX, in brcmf_register_event_handlers()
6231 brcmf_fweh_register(cfg->pub, BRCMF_E_ACTION_FRAME_COMPLETE, in brcmf_register_event_handlers()
6233 brcmf_fweh_register(cfg->pub, BRCMF_E_ACTION_FRAME_OFF_CHAN_COMPLETE, in brcmf_register_event_handlers()
6235 brcmf_fweh_register(cfg->pub, BRCMF_E_PSK_SUP, in brcmf_register_event_handlers()
6241 kfree(cfg->conf); in brcmf_deinit_priv_mem()
6242 cfg->conf = NULL; in brcmf_deinit_priv_mem()
6243 kfree(cfg->extra_buf); in brcmf_deinit_priv_mem()
6244 cfg->extra_buf = NULL; in brcmf_deinit_priv_mem()
6245 kfree(cfg->wowl.nd); in brcmf_deinit_priv_mem()
6246 cfg->wowl.nd = NULL; in brcmf_deinit_priv_mem()
6247 kfree(cfg->wowl.nd_info); in brcmf_deinit_priv_mem()
6248 cfg->wowl.nd_info = NULL; in brcmf_deinit_priv_mem()
6249 kfree(cfg->escan_info.escan_buf); in brcmf_deinit_priv_mem()
6250 cfg->escan_info.escan_buf = NULL; in brcmf_deinit_priv_mem()
6255 cfg->conf = kzalloc(sizeof(*cfg->conf), GFP_KERNEL); in brcmf_init_priv_mem()
6256 if (!cfg->conf) in brcmf_init_priv_mem()
6258 cfg->extra_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL); in brcmf_init_priv_mem()
6259 if (!cfg->extra_buf) in brcmf_init_priv_mem()
6261 cfg->wowl.nd = kzalloc(sizeof(*cfg->wowl.nd) + sizeof(u32), GFP_KERNEL); in brcmf_init_priv_mem()
6262 if (!cfg->wowl.nd) in brcmf_init_priv_mem()
6264 cfg->wowl.nd_info = kzalloc(sizeof(*cfg->wowl.nd_info) + in brcmf_init_priv_mem()
6267 if (!cfg->wowl.nd_info) in brcmf_init_priv_mem()
6269 cfg->escan_info.escan_buf = kzalloc(BRCMF_ESCAN_BUF_SIZE, GFP_KERNEL); in brcmf_init_priv_mem()
6270 if (!cfg->escan_info.escan_buf) in brcmf_init_priv_mem()
6278 return -ENOMEM; in brcmf_init_priv_mem()
6285 cfg->scan_request = NULL; in wl_init_priv()
6286 cfg->pwr_save = true; in wl_init_priv()
6287 cfg->dongle_up = false; /* dongle is not up yet */ in wl_init_priv()
6292 mutex_init(&cfg->usr_sync); in wl_init_priv()
6294 brcmf_init_conf(cfg->conf); in wl_init_priv()
6295 brcmf_init_wmm_prio(cfg->ac_priority); in wl_init_priv()
6296 init_completion(&cfg->vif_disabled); in wl_init_priv()
6302 cfg->dongle_up = false; /* dongle down */ in wl_deinit_priv()
6309 init_waitqueue_head(&event->vif_wq); in init_vif_event()
6310 spin_lock_init(&event->vif_event_lock); in init_vif_event()
6315 struct brcmf_pub *drvr = ifp->drvr; in brcmf_dongle_roam()
6322 if (ifp->drvr->settings->roamoff) in brcmf_dongle_roam()
6332 /* Enable/Disable built-in roaming to allow supplicant to take care of in brcmf_dongle_roam()
6336 ifp->drvr->settings->roamoff ? "Off" : "On"); in brcmf_dongle_roam()
6338 ifp->drvr->settings->roamoff); in brcmf_dongle_roam()
6367 struct brcmf_pub *drvr = ifp->drvr; in brcmf_dongle_scantime()
6373 bphy_err(drvr, "Scan assoc time error (%d)\n", err); in brcmf_dongle_scantime()
6399 ht40_flag = channel->flags & IEEE80211_CHAN_NO_HT40; in brcmf_update_bw40_channel_flag()
6400 if (ch->sb == BRCMU_CHAN_SB_U) { in brcmf_update_bw40_channel_flag()
6402 channel->flags &= ~IEEE80211_CHAN_NO_HT40; in brcmf_update_bw40_channel_flag()
6403 channel->flags |= IEEE80211_CHAN_NO_HT40PLUS; in brcmf_update_bw40_channel_flag()
6409 channel->flags &= ~IEEE80211_CHAN_NO_HT40; in brcmf_update_bw40_channel_flag()
6411 channel->flags |= IEEE80211_CHAN_NO_HT40MINUS; in brcmf_update_bw40_channel_flag()
6419 struct brcmf_pub *drvr = cfg->pub; in brcmf_construct_chaninfo()
6434 return -ENOMEM; in brcmf_construct_chaninfo()
6445 band = wiphy->bands[NL80211_BAND_2GHZ]; in brcmf_construct_chaninfo()
6447 for (i = 0; i < band->n_channels; i++) in brcmf_construct_chaninfo()
6448 band->channels[i].flags = IEEE80211_CHAN_DISABLED; in brcmf_construct_chaninfo()
6449 band = wiphy->bands[NL80211_BAND_5GHZ]; in brcmf_construct_chaninfo()
6451 for (i = 0; i < band->n_channels; i++) in brcmf_construct_chaninfo()
6452 band->channels[i].flags = IEEE80211_CHAN_DISABLED; in brcmf_construct_chaninfo()
6454 total = le32_to_cpu(list->count); in brcmf_construct_chaninfo()
6456 ch.chspec = (u16)le32_to_cpu(list->element[i]); in brcmf_construct_chaninfo()
6457 cfg->d11inf.decchspec(&ch); in brcmf_construct_chaninfo()
6460 band = wiphy->bands[NL80211_BAND_2GHZ]; in brcmf_construct_chaninfo()
6462 band = wiphy->bands[NL80211_BAND_5GHZ]; in brcmf_construct_chaninfo()
6470 if (!(bw_cap[band->band] & WLC_BW_40MHZ_BIT) && in brcmf_construct_chaninfo()
6473 if (!(bw_cap[band->band] & WLC_BW_80MHZ_BIT) && in brcmf_construct_chaninfo()
6478 for (j = 0; j < band->n_channels; j++) { in brcmf_construct_chaninfo()
6479 if (band->channels[j].hw_value == ch.control_ch_num) { in brcmf_construct_chaninfo()
6480 channel = &band->channels[j]; in brcmf_construct_chaninfo()
6493 if (channel->orig_flags & IEEE80211_CHAN_DISABLED) in brcmf_construct_chaninfo()
6501 channel->flags &= ~IEEE80211_CHAN_NO_160MHZ; in brcmf_construct_chaninfo()
6504 channel->flags &= ~IEEE80211_CHAN_NO_80MHZ; in brcmf_construct_chaninfo()
6518 channel->flags = IEEE80211_CHAN_NO_HT40 | in brcmf_construct_chaninfo()
6522 cfg->d11inf.encchspec(&ch); in brcmf_construct_chaninfo()
6528 channel->flags |= in brcmf_construct_chaninfo()
6532 channel->flags |= in brcmf_construct_chaninfo()
6545 struct brcmf_pub *drvr = cfg->pub; in brcmf_enable_bw40_2g()
6578 return -ENOMEM; in brcmf_enable_bw40_2g()
6584 cfg->d11inf.encchspec(&ch); in brcmf_enable_bw40_2g()
6597 band = cfg_to_wiphy(cfg)->bands[NL80211_BAND_2GHZ]; in brcmf_enable_bw40_2g()
6599 num_chan = le32_to_cpu(list->count); in brcmf_enable_bw40_2g()
6601 ch.chspec = (u16)le32_to_cpu(list->element[i]); in brcmf_enable_bw40_2g()
6602 cfg->d11inf.decchspec(&ch); in brcmf_enable_bw40_2g()
6607 for (j = 0; j < band->n_channels; j++) { in brcmf_enable_bw40_2g()
6608 if (band->channels[j].hw_value == ch.control_ch_num) in brcmf_enable_bw40_2g()
6611 if (WARN_ON(j == band->n_channels)) in brcmf_enable_bw40_2g()
6614 brcmf_update_bw40_channel_flag(&band->channels[j], &ch); in brcmf_enable_bw40_2g()
6623 struct brcmf_pub *drvr = ifp->drvr; in brcmf_get_bwcap()
6666 band->ht_cap.ht_supported = true; in brcmf_update_ht_cap()
6667 if (bw_cap[band->band] & WLC_BW_40MHZ_BIT) { in brcmf_update_ht_cap()
6668 band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40; in brcmf_update_ht_cap()
6669 band->ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; in brcmf_update_ht_cap()
6671 band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_20; in brcmf_update_ht_cap()
6672 band->ht_cap.cap |= IEEE80211_HT_CAP_DSSSCCK40; in brcmf_update_ht_cap()
6673 band->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K; in brcmf_update_ht_cap()
6674 band->ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16; in brcmf_update_ht_cap()
6675 memset(band->ht_cap.mcs.rx_mask, 0xff, nchain); in brcmf_update_ht_cap()
6676 band->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; in brcmf_update_ht_cap()
6697 if (band->band == NL80211_BAND_2GHZ) in brcmf_update_vht_cap()
6700 band->vht_cap.vht_supported = true; in brcmf_update_vht_cap()
6702 band->vht_cap.cap |= IEEE80211_VHT_CAP_SHORT_GI_80; in brcmf_update_vht_cap()
6703 if (bw_cap[band->band] & WLC_BW_160MHZ_BIT) { in brcmf_update_vht_cap()
6704 band->vht_cap.cap |= IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; in brcmf_update_vht_cap()
6705 band->vht_cap.cap |= IEEE80211_VHT_CAP_SHORT_GI_160; in brcmf_update_vht_cap()
6707 /* all support 256-QAM */ in brcmf_update_vht_cap()
6709 band->vht_cap.vht_mcs.rx_mcs_map = mcs_map; in brcmf_update_vht_cap()
6710 band->vht_cap.vht_mcs.tx_mcs_map = mcs_map; in brcmf_update_vht_cap()
6714 band->vht_cap.cap |= IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE; in brcmf_update_vht_cap()
6716 band->vht_cap.cap |= IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE; in brcmf_update_vht_cap()
6718 band->vht_cap.cap |= IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE; in brcmf_update_vht_cap()
6720 band->vht_cap.cap |= IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE; in brcmf_update_vht_cap()
6723 band->vht_cap.cap |= in brcmf_update_vht_cap()
6725 band->vht_cap.cap |= ((txstreams - 1) << in brcmf_update_vht_cap()
6727 band->vht_cap.cap |= in brcmf_update_vht_cap()
6734 struct brcmf_pub *drvr = cfg->pub; in brcmf_setup_wiphybands()
6766 rxchain = rxchain & (rxchain - 1); in brcmf_setup_wiphybands()
6784 for (i = 0; i < ARRAY_SIZE(wiphy->bands); i++) { in brcmf_setup_wiphybands()
6785 band = wiphy->bands[i]; in brcmf_setup_wiphybands()
6839 * brcmf_setup_ifmodes() - determine interface modes and combinations.
6861 * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 1, 3 total
6862 * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
6867 * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 2, 3 total
6868 * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
6872 * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 2, AP <= 2,
6895 wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | in brcmf_setup_ifmodes()
6899 wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR); in brcmf_setup_ifmodes()
6901 wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) | in brcmf_setup_ifmodes()
6985 wiphy->n_iface_combinations = n_combos; in brcmf_setup_ifmodes()
6986 wiphy->iface_combinations = combo; in brcmf_setup_ifmodes()
6994 return -ENOMEM; in brcmf_setup_ifmodes()
7011 struct brcmf_pub *drvr = cfg->pub; in brcmf_wiphy_wowl_params()
7018 wiphy->wowlan = &brcmf_wowlan_support; in brcmf_wiphy_wowl_params()
7024 wowl->flags |= WIPHY_WOWLAN_NET_DETECT; in brcmf_wiphy_wowl_params()
7025 wowl->max_nd_match_sets = BRCMF_PNO_MAX_PFN_COUNT; in brcmf_wiphy_wowl_params()
7026 init_waitqueue_head(&cfg->wowl.nd_data_wait); in brcmf_wiphy_wowl_params()
7030 wowl->flags |= WIPHY_WOWLAN_SUPPORTS_GTK_REKEY; in brcmf_wiphy_wowl_params()
7031 wowl->flags |= WIPHY_WOWLAN_GTK_REKEY_FAILURE; in brcmf_wiphy_wowl_params()
7034 wiphy->wowlan = wowl; in brcmf_wiphy_wowl_params()
7040 struct brcmf_pub *drvr = ifp->drvr; in brcmf_setup_wiphy()
7049 wiphy->max_scan_ssids = WL_NUM_SCAN_MAX; in brcmf_setup_wiphy()
7050 wiphy->max_scan_ie_len = BRCMF_SCAN_IE_LEN_MAX; in brcmf_setup_wiphy()
7051 wiphy->max_num_pmkids = BRCMF_MAXPMKID; in brcmf_setup_wiphy()
7057 for (i = 0, combo = wiphy->iface_combinations; in brcmf_setup_wiphy()
7058 i < wiphy->n_iface_combinations; i++, combo++) { in brcmf_setup_wiphy()
7059 max_interfaces = max(max_interfaces, combo->max_interfaces); in brcmf_setup_wiphy()
7062 for (i = 0; i < max_interfaces && i < ARRAY_SIZE(drvr->addresses); in brcmf_setup_wiphy()
7064 u8 *addr = drvr->addresses[i].addr; in brcmf_setup_wiphy()
7066 memcpy(addr, drvr->mac, ETH_ALEN); in brcmf_setup_wiphy()
7069 addr[ETH_ALEN - 1] ^= i; in brcmf_setup_wiphy()
7072 wiphy->addresses = drvr->addresses; in brcmf_setup_wiphy()
7073 wiphy->n_addresses = i; in brcmf_setup_wiphy()
7075 wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; in brcmf_setup_wiphy()
7076 wiphy->cipher_suites = brcmf_cipher_suites; in brcmf_setup_wiphy()
7077 wiphy->n_cipher_suites = ARRAY_SIZE(brcmf_cipher_suites); in brcmf_setup_wiphy()
7079 wiphy->n_cipher_suites--; in brcmf_setup_wiphy()
7080 wiphy->bss_select_support = BIT(NL80211_BSS_SELECT_ATTR_RSSI) | in brcmf_setup_wiphy()
7084 wiphy->flags |= WIPHY_FLAG_NETNS_OK | in brcmf_setup_wiphy()
7090 wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS; in brcmf_setup_wiphy()
7091 if (!ifp->drvr->settings->roamoff) in brcmf_setup_wiphy()
7092 wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; in brcmf_setup_wiphy()
7109 wiphy->mgmt_stypes = brcmf_txrx_stypes; in brcmf_setup_wiphy()
7110 wiphy->max_remain_on_channel_duration = 5000; in brcmf_setup_wiphy()
7116 wiphy->vendor_commands = brcmf_vendor_cmds; in brcmf_setup_wiphy()
7117 wiphy->n_vendor_commands = BRCMF_VNDR_CMDS_LAST - 1; in brcmf_setup_wiphy()
7134 return -ENOMEM; in brcmf_setup_wiphy()
7136 band->channels = kmemdup(&__wl_2ghz_channels, in brcmf_setup_wiphy()
7139 if (!band->channels) { in brcmf_setup_wiphy()
7141 return -ENOMEM; in brcmf_setup_wiphy()
7144 band->n_channels = ARRAY_SIZE(__wl_2ghz_channels); in brcmf_setup_wiphy()
7145 wiphy->bands[NL80211_BAND_2GHZ] = band; in brcmf_setup_wiphy()
7151 return -ENOMEM; in brcmf_setup_wiphy()
7153 band->channels = kmemdup(&__wl_5ghz_channels, in brcmf_setup_wiphy()
7156 if (!band->channels) { in brcmf_setup_wiphy()
7158 return -ENOMEM; in brcmf_setup_wiphy()
7161 band->n_channels = ARRAY_SIZE(__wl_5ghz_channels); in brcmf_setup_wiphy()
7162 wiphy->bands[NL80211_BAND_5GHZ] = band; in brcmf_setup_wiphy()
7166 if (wiphy->bands[NL80211_BAND_5GHZ] && in brcmf_setup_wiphy()
7178 struct brcmf_pub *drvr = cfg->pub; in brcmf_config_dongle()
7185 if (cfg->dongle_up) in brcmf_config_dongle()
7189 wdev = ndev->ieee80211_ptr; in brcmf_config_dongle()
7197 power_mode = cfg->pwr_save ? PM_FAST : PM_OFF; in brcmf_config_dongle()
7207 err = brcmf_cfg80211_change_iface(wdev->wiphy, ndev, wdev->iftype, in brcmf_config_dongle()
7220 cfg->dongle_up = true; in brcmf_config_dongle()
7229 set_bit(BRCMF_VIF_STATUS_READY, &ifp->vif->sme_state); in __brcmf_cfg80211_up()
7231 return brcmf_config_dongle(ifp->drvr->config); in __brcmf_cfg80211_up()
7236 struct brcmf_cfg80211_info *cfg = ifp->drvr->config; in __brcmf_cfg80211_down()
7242 if (check_vif_up(ifp->vif)) { in __brcmf_cfg80211_down()
7243 brcmf_link_down(ifp->vif, WLAN_REASON_UNSPECIFIED, true); in __brcmf_cfg80211_down()
7253 clear_bit(BRCMF_VIF_STATUS_READY, &ifp->vif->sme_state); in __brcmf_cfg80211_down()
7261 struct brcmf_cfg80211_info *cfg = ifp->drvr->config; in brcmf_cfg80211_up()
7264 mutex_lock(&cfg->usr_sync); in brcmf_cfg80211_up()
7266 mutex_unlock(&cfg->usr_sync); in brcmf_cfg80211_up()
7274 struct brcmf_cfg80211_info *cfg = ifp->drvr->config; in brcmf_cfg80211_down()
7277 mutex_lock(&cfg->usr_sync); in brcmf_cfg80211_down()
7279 mutex_unlock(&cfg->usr_sync); in brcmf_cfg80211_down()
7286 struct wireless_dev *wdev = &ifp->vif->wdev; in brcmf_cfg80211_get_iftype()
7288 return wdev->iftype; in brcmf_cfg80211_get_iftype()
7296 list_for_each_entry(vif, &cfg->vif_list, list) { in brcmf_get_vif_state_any()
7297 if (test_bit(state, &vif->sme_state)) in brcmf_get_vif_state_any()
7308 spin_lock(&event->vif_event_lock); in vif_event_equals()
7309 evt_action = event->action; in vif_event_equals()
7310 spin_unlock(&event->vif_event_lock); in vif_event_equals()
7317 struct brcmf_cfg80211_vif_event *event = &cfg->vif_event; in brcmf_cfg80211_arm_vif_event()
7319 spin_lock(&event->vif_event_lock); in brcmf_cfg80211_arm_vif_event()
7320 event->vif = vif; in brcmf_cfg80211_arm_vif_event()
7321 event->action = 0; in brcmf_cfg80211_arm_vif_event()
7322 spin_unlock(&event->vif_event_lock); in brcmf_cfg80211_arm_vif_event()
7327 struct brcmf_cfg80211_vif_event *event = &cfg->vif_event; in brcmf_cfg80211_vif_event_armed()
7330 spin_lock(&event->vif_event_lock); in brcmf_cfg80211_vif_event_armed()
7331 armed = event->vif != NULL; in brcmf_cfg80211_vif_event_armed()
7332 spin_unlock(&event->vif_event_lock); in brcmf_cfg80211_vif_event_armed()
7340 struct brcmf_cfg80211_vif_event *event = &cfg->vif_event; in brcmf_cfg80211_wait_vif_event()
7342 return wait_event_timeout(event->vif_wq, in brcmf_cfg80211_wait_vif_event()
7354 country_codes = drvr->settings->country_codes; in brcmf_translate_country_code()
7357 return -EINVAL; in brcmf_translate_country_code()
7360 if ((alpha2[0] == ccreq->country_abbrev[0]) && in brcmf_translate_country_code()
7361 (alpha2[1] == ccreq->country_abbrev[1])) { in brcmf_translate_country_code()
7363 return -EAGAIN; in brcmf_translate_country_code()
7366 found_index = -1; in brcmf_translate_country_code()
7367 for (i = 0; i < country_codes->table_size; i++) { in brcmf_translate_country_code()
7368 cc = &country_codes->table[i]; in brcmf_translate_country_code()
7369 if ((cc->iso3166[0] == '\0') && (found_index == -1)) in brcmf_translate_country_code()
7371 if ((cc->iso3166[0] == alpha2[0]) && in brcmf_translate_country_code()
7372 (cc->iso3166[1] == alpha2[1])) { in brcmf_translate_country_code()
7377 if (found_index == -1) { in brcmf_translate_country_code()
7379 return -EINVAL; in brcmf_translate_country_code()
7382 ccreq->rev = cpu_to_le32(country_codes->table[found_index].rev); in brcmf_translate_country_code()
7383 memcpy(ccreq->ccode, country_codes->table[found_index].cc, in brcmf_translate_country_code()
7385 ccreq->country_abbrev[0] = alpha2[0]; in brcmf_translate_country_code()
7386 ccreq->country_abbrev[1] = alpha2[1]; in brcmf_translate_country_code()
7387 ccreq->country_abbrev[2] = 0; in brcmf_translate_country_code()
7396 struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); in brcmf_cfg80211_reg_notifier()
7397 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_reg_notifier()
7403 if (req->alpha2[0] == '0' && req->alpha2[1] == '0') in brcmf_cfg80211_reg_notifier()
7406 /* ignore non-ISO3166 country codes */ in brcmf_cfg80211_reg_notifier()
7408 if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') { in brcmf_cfg80211_reg_notifier()
7410 req->alpha2[0], req->alpha2[1]); in brcmf_cfg80211_reg_notifier()
7414 brcmf_dbg(TRACE, "Enter: initiator=%d, alpha=%c%c\n", req->initiator, in brcmf_cfg80211_reg_notifier()
7415 req->alpha2[0], req->alpha2[1]); in brcmf_cfg80211_reg_notifier()
7423 err = brcmf_translate_country_code(ifp->drvr, req->alpha2, &ccreq); in brcmf_cfg80211_reg_notifier()
7442 if (wiphy->iface_combinations) { in brcmf_free_wiphy()
7443 for (i = 0; i < wiphy->n_iface_combinations; i++) in brcmf_free_wiphy()
7444 kfree(wiphy->iface_combinations[i].limits); in brcmf_free_wiphy()
7446 kfree(wiphy->iface_combinations); in brcmf_free_wiphy()
7447 if (wiphy->bands[NL80211_BAND_2GHZ]) { in brcmf_free_wiphy()
7448 kfree(wiphy->bands[NL80211_BAND_2GHZ]->channels); in brcmf_free_wiphy()
7449 kfree(wiphy->bands[NL80211_BAND_2GHZ]); in brcmf_free_wiphy()
7451 if (wiphy->bands[NL80211_BAND_5GHZ]) { in brcmf_free_wiphy()
7452 kfree(wiphy->bands[NL80211_BAND_5GHZ]->channels); in brcmf_free_wiphy()
7453 kfree(wiphy->bands[NL80211_BAND_5GHZ]); in brcmf_free_wiphy()
7456 if (wiphy->wowlan != &brcmf_wowlan_support) in brcmf_free_wiphy()
7457 kfree(wiphy->wowlan); in brcmf_free_wiphy()
7465 struct wiphy *wiphy = drvr->wiphy; in brcmf_cfg80211_attach()
7466 struct net_device *ndev = brcmf_get_ifp(drvr, 0)->ndev; in brcmf_cfg80211_attach()
7485 cfg->wiphy = wiphy; in brcmf_cfg80211_attach()
7486 cfg->pub = drvr; in brcmf_cfg80211_attach()
7487 init_vif_event(&cfg->vif_event); in brcmf_cfg80211_attach()
7488 INIT_LIST_HEAD(&cfg->vif_list); in brcmf_cfg80211_attach()
7495 vif->ifp = ifp; in brcmf_cfg80211_attach()
7496 vif->wdev.netdev = ndev; in brcmf_cfg80211_attach()
7497 ndev->ieee80211_ptr = &vif->wdev; in brcmf_cfg80211_attach()
7498 SET_NETDEV_DEV(ndev, wiphy_dev(cfg->wiphy)); in brcmf_cfg80211_attach()
7506 ifp->vif = vif; in brcmf_cfg80211_attach()
7514 cfg->d11inf.io_type = (u8)io_type; in brcmf_cfg80211_attach()
7515 brcmu_d11_attach(&cfg->d11inf); in brcmf_cfg80211_attach()
7520 drvr->config = cfg; in brcmf_cfg80211_attach()
7527 wiphy->reg_notifier = brcmf_cfg80211_reg_notifier; in brcmf_cfg80211_attach()
7528 wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG; in brcmf_cfg80211_attach()
7535 if (wiphy->bands[NL80211_BAND_2GHZ]) { in brcmf_cfg80211_attach()
7536 cap = &wiphy->bands[NL80211_BAND_2GHZ]->ht_cap.cap; in brcmf_cfg80211_attach()
7541 ops->set_rekey_data = brcmf_cfg80211_set_rekey_data; in brcmf_cfg80211_attach()
7580 bphy_err(drvr, "BT-coex initialisation failed (%d)\n", err); in brcmf_cfg80211_attach()
7581 brcmf_p2p_detach(&cfg->p2p); in brcmf_cfg80211_attach()
7588 brcmf_p2p_detach(&cfg->p2p); in brcmf_cfg80211_attach()
7596 wiphy->flags &= ~WIPHY_FLAG_SUPPORTS_TDLS; in brcmf_cfg80211_attach()
7598 brcmf_fweh_register(cfg->pub, BRCMF_E_TDLS_PEER_EVENT, in brcmf_cfg80211_attach()
7603 /* (re-) activate FWEH event handling */ in brcmf_cfg80211_attach()
7612 wiphy->features |= NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR; in brcmf_cfg80211_attach()
7614 if (wiphy->wowlan && in brcmf_cfg80211_attach()
7615 wiphy->wowlan->flags & WIPHY_WOWLAN_NET_DETECT) in brcmf_cfg80211_attach()
7616 wiphy->features |= NL80211_FEATURE_ND_RANDOM_MAC_ADDR; in brcmf_cfg80211_attach()
7625 brcmf_p2p_detach(&cfg->p2p); in brcmf_cfg80211_attach()
7627 wiphy_unregister(cfg->wiphy); in brcmf_cfg80211_attach()
7631 ifp->vif = NULL; in brcmf_cfg80211_attach()
7645 wiphy_unregister(cfg->wiphy); in brcmf_cfg80211_detach()
7647 brcmf_free_wiphy(cfg->wiphy); in brcmf_cfg80211_detach()