Lines Matching +full:arm +full:- +full:firmware +full:- +full:suite

1 // SPDX-License-Identifier: ISC
51 #define WPA_CIPHER_WEP_40 1 /* WEP (40-bit) */
54 #define WPA_CIPHER_WEP_104 5 /* WEP (104-bit) */
58 #define RSN_AKM_PSK 2 /* Pre-shared Key */
60 #define RSN_AKM_SHA256_PSK 6 /* SHA256, Pre-shared Key */
94 #define CHAN_NOISE_DUMMY (-80)
103 (sizeof(struct brcmf_assoc_params_le) - sizeof(u16))
106 (BRCMF_DCMD_MEDLEN / sizeof(__le32) - 1)
130 if (!test_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state)) { in check_vif_up()
132 vif->sme_state); in check_vif_up()
164 #define wl_a_rates_size (wl_g_rates_size - 4)
225 REG_RULE(2412-10, 2472+10, 40, 6, 20, 0),
227 /* IEEE 802.11 channel 14 - Only JP enables
230 REG_RULE(2484-10, 2484+10, 20, 6, 20, 0),
232 REG_RULE(5150-10, 5350+10, 160, 6, 20, 0),
234 REG_RULE(5470-10, 5850+10, 160, 6, 20, 0), }
240 * So the cipher suite AES_CMAC has to be the last one in the array, and when
334 ch->chan->center_freq, ch->center_freq1, ch->width); in chandef_to_chanspec()
335 ch_inf.chnum = ieee80211_frequency_to_channel(ch->center_freq1); in chandef_to_chanspec()
336 primary_offset = ch->chan->center_freq - ch->center_freq1; in chandef_to_chanspec()
337 switch (ch->width) { in chandef_to_chanspec()
352 if (primary_offset == -30) in chandef_to_chanspec()
354 else if (primary_offset == -10) in chandef_to_chanspec()
363 if (primary_offset == -70) in chandef_to_chanspec()
365 else if (primary_offset == -50) in chandef_to_chanspec()
367 else if (primary_offset == -30) in chandef_to_chanspec()
369 else if (primary_offset == -10) in chandef_to_chanspec()
386 switch (ch->chan->band) { in chandef_to_chanspec()
397 d11inf->encchspec(&ch_inf); in chandef_to_chanspec()
408 ch_inf.chnum = ieee80211_frequency_to_channel(ch->center_freq); in channel_to_chanspec()
410 d11inf->encchspec(&ch_inf); in channel_to_chanspec()
415 /* Traverse a string of 1-byte tag/1-byte length/variable-length value
427 int len = elt->len; in brcmf_parse_tlvs()
430 if ((elt->id == key) && (totlen >= (len + TLV_HDR_LEN))) in brcmf_parse_tlvs()
434 totlen -= (len + TLV_HDR_LEN); in brcmf_parse_tlvs()
459 *tlvs_len -= (int)(ie - *tlvs); in brcmf_tlv_has_ie()
503 list_for_each_entry(pos, &cfg->vif_list, list) in brcmf_vif_change_validate()
509 params.iftype_num[pos->wdev.iftype]++; in brcmf_vif_change_validate()
513 ret = cfg80211_check_combinations(cfg->wiphy, &params); in brcmf_vif_change_validate()
526 list_for_each_entry(pos, &cfg->vif_list, list) in brcmf_vif_add_validate()
527 params.iftype_num[pos->wdev.iftype]++; in brcmf_vif_add_validate()
530 return cfg80211_check_combinations(cfg->wiphy, &params); in brcmf_vif_add_validate()
536 key_le->index = cpu_to_le32(key->index); in convert_key_from_CPU()
537 key_le->len = cpu_to_le32(key->len); in convert_key_from_CPU()
538 key_le->algo = cpu_to_le32(key->algo); in convert_key_from_CPU()
539 key_le->flags = cpu_to_le32(key->flags); in convert_key_from_CPU()
540 key_le->rxiv.hi = cpu_to_le32(key->rxiv.hi); in convert_key_from_CPU()
541 key_le->rxiv.lo = cpu_to_le16(key->rxiv.lo); in convert_key_from_CPU()
542 key_le->iv_initialized = cpu_to_le32(key->iv_initialized); in convert_key_from_CPU()
543 memcpy(key_le->data, key->data, sizeof(key->data)); in convert_key_from_CPU()
544 memcpy(key_le->ea, key->ea, sizeof(key->ea)); in convert_key_from_CPU()
550 struct brcmf_pub *drvr = ifp->drvr; in send_key_to_dongle()
573 ifp = vif->ifp; in brcmf_cfg80211_update_proto_addr_mode()
575 if ((wdev->iftype == NL80211_IFTYPE_ADHOC) || in brcmf_cfg80211_update_proto_addr_mode()
576 (wdev->iftype == NL80211_IFTYPE_AP) || in brcmf_cfg80211_update_proto_addr_mode()
577 (wdev->iftype == NL80211_IFTYPE_P2P_GO)) in brcmf_cfg80211_update_proto_addr_mode()
578 brcmf_proto_configure_addr_mode(ifp->drvr, ifp->ifidx, in brcmf_cfg80211_update_proto_addr_mode()
581 brcmf_proto_configure_addr_mode(ifp->drvr, ifp->ifidx, in brcmf_cfg80211_update_proto_addr_mode()
593 if (!drvr->iflist[bsscfgidx]) in brcmf_get_first_free_bsscfgidx()
597 return -ENOMEM; in brcmf_get_first_free_bsscfgidx()
602 u8 mac_idx = ifp->drvr->sta_mac_idx; in brcmf_set_vif_sta_macaddr()
605 memcpy(mac_addr, ifp->mac_addr, ETH_ALEN); in brcmf_set_vif_sta_macaddr()
610 ifp->drvr->sta_mac_idx = mac_idx; in brcmf_set_vif_sta_macaddr()
664 /* get supported version from firmware side */ in brcmf_cfg80211_request_sta_if()
670 return -EOPNOTSUPP; in brcmf_cfg80211_request_sta_if()
694 err = -EOPNOTSUPP; in brcmf_cfg80211_request_sta_if()
701 return -EIO; in brcmf_cfg80211_request_sta_if()
713 struct brcmf_pub *drvr = ifp->drvr; in brcmf_cfg80211_request_ap_if()
757 /* get supported version from firmware side */ in brcmf_cfg80211_request_ap_if()
763 return -EOPNOTSUPP; in brcmf_cfg80211_request_ap_if()
784 err = -EOPNOTSUPP; in brcmf_cfg80211_request_ap_if()
792 bsscfgidx = brcmf_get_first_free_bsscfgidx(ifp->drvr); in brcmf_cfg80211_request_ap_if()
811 * brcmf_apsta_add_vif() - create a new AP or STA virtual interface
825 struct brcmf_pub *drvr = cfg->pub; in brcmf_apsta_add_vif()
830 return ERR_PTR(-EINVAL); in brcmf_apsta_add_vif()
833 return ERR_PTR(-EBUSY); in brcmf_apsta_add_vif()
844 err = brcmf_cfg80211_request_sta_if(ifp, params->macaddr); in brcmf_apsta_add_vif()
852 /* wait for firmware event */ in brcmf_apsta_add_vif()
858 err = -EIO; in brcmf_apsta_add_vif()
862 /* interface created in firmware */ in brcmf_apsta_add_vif()
863 ifp = vif->ifp; in brcmf_apsta_add_vif()
866 err = -ENOENT; in brcmf_apsta_add_vif()
870 strscpy(ifp->ndev->name, name, sizeof(ifp->ndev->name)); in brcmf_apsta_add_vif()
874 free_netdev(ifp->ndev); in brcmf_apsta_add_vif()
878 return &ifp->vif->wdev; in brcmf_apsta_add_vif()
889 iftype = vif->wdev.iftype; in brcmf_is_apmode()
895 return vif->wdev.iftype == NL80211_IFTYPE_ADHOC; in brcmf_is_ibssmode()
899 * brcmf_mon_add_vif() - create monitor mode virtual interface
913 if (cfg->pub->mon_if) { in brcmf_mon_add_vif()
914 err = -EEXIST; in brcmf_mon_add_vif()
926 err = -ENOMEM; in brcmf_mon_add_vif()
929 ndev->type = ARPHRD_IEEE80211_RADIOTAP; in brcmf_mon_add_vif()
930 ndev->ieee80211_ptr = &vif->wdev; in brcmf_mon_add_vif()
931 ndev->needs_free_netdev = true; in brcmf_mon_add_vif()
932 ndev->priv_destructor = brcmf_cfg80211_free_netdev; in brcmf_mon_add_vif()
933 SET_NETDEV_DEV(ndev, wiphy_dev(cfg->wiphy)); in brcmf_mon_add_vif()
936 ifp->vif = vif; in brcmf_mon_add_vif()
937 ifp->ndev = ndev; in brcmf_mon_add_vif()
938 ifp->drvr = cfg->pub; in brcmf_mon_add_vif()
940 vif->ifp = ifp; in brcmf_mon_add_vif()
941 vif->wdev.netdev = ndev; in brcmf_mon_add_vif()
945 brcmf_err("Failed to attach %s device\n", ndev->name); in brcmf_mon_add_vif()
950 cfg->pub->mon_if = ifp; in brcmf_mon_add_vif()
952 return &vif->wdev; in brcmf_mon_add_vif()
963 struct net_device *ndev = wdev->netdev; in brcmf_mon_del_vif()
965 ndev->netdev_ops->ndo_stop(ndev); in brcmf_mon_del_vif()
969 cfg->pub->mon_if = NULL; in brcmf_mon_del_vif()
981 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_add_iface()
996 return ERR_PTR(-EOPNOTSUPP); in brcmf_cfg80211_add_iface()
1010 return ERR_PTR(-EINVAL); in brcmf_cfg80211_add_iface()
1030 struct brcmf_pub *drvr = ifp->drvr; in brcmf_set_mpc()
1033 if (check_vif_up(ifp->vif)) { in brcmf_set_mpc()
1050 memcpy(&params_le->ssid_le, &params_v2_le->ssid_le, in brcmf_scan_params_v2_to_v1()
1051 sizeof(params_le->ssid_le)); in brcmf_scan_params_v2_to_v1()
1052 memcpy(&params_le->bssid, &params_v2_le->bssid, in brcmf_scan_params_v2_to_v1()
1053 sizeof(params_le->bssid)); in brcmf_scan_params_v2_to_v1()
1055 params_le->bss_type = params_v2_le->bss_type; in brcmf_scan_params_v2_to_v1()
1056 params_le->scan_type = le32_to_cpu(params_v2_le->scan_type); in brcmf_scan_params_v2_to_v1()
1057 params_le->nprobes = params_v2_le->nprobes; in brcmf_scan_params_v2_to_v1()
1058 params_le->active_time = params_v2_le->active_time; in brcmf_scan_params_v2_to_v1()
1059 params_le->passive_time = params_v2_le->passive_time; in brcmf_scan_params_v2_to_v1()
1060 params_le->home_time = params_v2_le->home_time; in brcmf_scan_params_v2_to_v1()
1061 params_le->channel_num = params_v2_le->channel_num; in brcmf_scan_params_v2_to_v1()
1063 ch = le32_to_cpu(params_v2_le->channel_num); in brcmf_scan_params_v2_to_v1()
1073 memcpy(&params_le->channel_list[0], in brcmf_scan_params_v2_to_v1()
1074 &params_v2_le->channel_list[0], params_size); in brcmf_scan_params_v2_to_v1()
1090 eth_broadcast_addr(params_le->bssid); in brcmf_escan_prep()
1094 params_le->version = cpu_to_le16(BRCMF_SCAN_PARAMS_VERSION_V2); in brcmf_escan_prep()
1095 params_le->bss_type = DOT11_BSSTYPE_ANY; in brcmf_escan_prep()
1096 params_le->scan_type = cpu_to_le32(BRCMF_SCANTYPE_ACTIVE); in brcmf_escan_prep()
1097 params_le->channel_num = 0; in brcmf_escan_prep()
1098 params_le->nprobes = cpu_to_le32(-1); in brcmf_escan_prep()
1099 params_le->active_time = cpu_to_le32(-1); in brcmf_escan_prep()
1100 params_le->passive_time = cpu_to_le32(-1); in brcmf_escan_prep()
1101 params_le->home_time = cpu_to_le32(-1); in brcmf_escan_prep()
1102 memset(&params_le->ssid_le, 0, sizeof(params_le->ssid_le)); in brcmf_escan_prep()
1107 params_le->channel_num = cpu_to_le32(1); in brcmf_escan_prep()
1108 params_le->channel_list[0] = cpu_to_le16(-1); in brcmf_escan_prep()
1109 params_le->length = cpu_to_le16(length); in brcmf_escan_prep()
1113 n_ssids = request->n_ssids; in brcmf_escan_prep()
1114 n_channels = request->n_channels; in brcmf_escan_prep()
1122 chanspec = channel_to_chanspec(&cfg->d11inf, in brcmf_escan_prep()
1123 request->channels[i]); in brcmf_escan_prep()
1125 request->channels[i]->hw_value, chanspec); in brcmf_escan_prep()
1126 params_le->channel_list[i] = cpu_to_le16(chanspec); in brcmf_escan_prep()
1143 cpu_to_le32(request->ssids[i].ssid_len); in brcmf_escan_prep()
1144 memcpy(ssid_le.SSID, request->ssids[i].ssid, in brcmf_escan_prep()
1145 request->ssids[i].ssid_len); in brcmf_escan_prep()
1156 params_le->scan_type = cpu_to_le32(BRCMF_SCANTYPE_PASSIVE); in brcmf_escan_prep()
1158 params_le->length = cpu_to_le16(length); in brcmf_escan_prep()
1160 params_le->channel_num = in brcmf_escan_prep()
1169 struct brcmf_pub *drvr = cfg->pub; in brcmf_notify_escan_complete()
1180 scan_request = cfg->scan_request; in brcmf_notify_escan_complete()
1181 cfg->scan_request = NULL; in brcmf_notify_escan_complete()
1183 timer_delete_sync(&cfg->escan_timeout); in brcmf_notify_escan_complete()
1187 brcmf_dbg(SCAN, "ABORT scan in firmware\n"); in brcmf_notify_escan_complete()
1191 /* E-Scan (or anyother type) can be aborted by SCAN */ in brcmf_notify_escan_complete()
1212 * e-scan can be initiated internally in brcmf_notify_escan_complete()
1215 if (cfg->int_escan_map) { in brcmf_notify_escan_complete()
1217 cfg->int_escan_map); in brcmf_notify_escan_complete()
1218 while (cfg->int_escan_map) { in brcmf_notify_escan_complete()
1219 bucket = __ffs(cfg->int_escan_map); in brcmf_notify_escan_complete()
1220 cfg->int_escan_map &= ~BIT(bucket); in brcmf_notify_escan_complete()
1221 reqid = brcmf_pno_find_reqid_by_bucket(cfg->pno, in brcmf_notify_escan_complete()
1239 if (!test_and_clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) in brcmf_notify_escan_complete()
1249 struct net_device *ndev = wdev->netdev; in brcmf_cfg80211_del_apsta_iface()
1251 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_del_apsta_iface()
1255 brcmf_cfg80211_arm_vif_event(cfg, ifp->vif); in brcmf_cfg80211_del_apsta_iface()
1263 /* wait for firmware event */ in brcmf_cfg80211_del_apsta_iface()
1268 err = -EIO; in brcmf_cfg80211_del_apsta_iface()
1283 struct net_device *ndev = wdev->netdev; in brcmf_cfg80211_del_iface()
1286 return -ENOTSUPP; in brcmf_cfg80211_del_iface()
1288 /* vif event pending in firmware */ in brcmf_cfg80211_del_iface()
1290 return -EBUSY; in brcmf_cfg80211_del_iface()
1293 if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status) && in brcmf_cfg80211_del_iface()
1294 cfg->escan_info.ifp == netdev_priv(ndev)) in brcmf_cfg80211_del_iface()
1301 switch (wdev->iftype) { in brcmf_cfg80211_del_iface()
1306 return -EOPNOTSUPP; in brcmf_cfg80211_del_iface()
1318 return -EINVAL; in brcmf_cfg80211_del_iface()
1320 return -EOPNOTSUPP; in brcmf_cfg80211_del_iface()
1330 struct brcmf_cfg80211_vif *vif = ifp->vif; in brcmf_cfg80211_change_iface()
1331 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_change_iface()
1336 brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, type=%d\n", ifp->bsscfgidx, in brcmf_cfg80211_change_iface()
1348 ((vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT) || in brcmf_cfg80211_change_iface()
1349 (vif->wdev.iftype == NL80211_IFTYPE_P2P_GO) || in brcmf_cfg80211_change_iface()
1350 (vif->wdev.iftype == NL80211_IFTYPE_P2P_DEVICE))) { in brcmf_cfg80211_change_iface()
1364 if (cfg->p2p.p2pdev_dynamically) in brcmf_cfg80211_change_iface()
1365 return -EOPNOTSUPP; in brcmf_cfg80211_change_iface()
1379 return -EOPNOTSUPP; in brcmf_cfg80211_change_iface()
1391 err = -EINVAL; in brcmf_cfg80211_change_iface()
1407 err = -EAGAIN; in brcmf_cfg80211_change_iface()
1413 ndev->ieee80211_ptr->iftype = type; in brcmf_cfg80211_change_iface()
1415 brcmf_cfg80211_update_proto_addr_mode(&vif->wdev); in brcmf_cfg80211_change_iface()
1427 struct brcmf_pub *drvr = cfg->pub; in brcmf_run_escan()
1433 brcmf_dbg(SCAN, "E-SCAN START\n"); in brcmf_run_escan()
1437 params_size += sizeof(u32) * ((request->n_channels + 1) / 2); in brcmf_run_escan()
1440 params_size += sizeof(struct brcmf_ssid_le) * request->n_ssids; in brcmf_run_escan()
1445 err = -ENOMEM; in brcmf_run_escan()
1449 brcmf_escan_prep(cfg, &params->params_v2_le, request); in brcmf_run_escan()
1451 params->version = cpu_to_le32(BRCMF_ESCAN_REQ_VERSION_V2); in brcmf_run_escan()
1456 params_size -= BRCMF_SCAN_PARAMS_V2_FIXED_SIZE; in brcmf_run_escan()
1460 err = -ENOMEM; in brcmf_run_escan()
1463 params_v1->version = cpu_to_le32(BRCMF_ESCAN_REQ_VERSION); in brcmf_run_escan()
1464 brcmf_scan_params_v2_to_v1(&params->params_v2_le, &params_v1->params_le); in brcmf_run_escan()
1469 params->action = cpu_to_le16(WL_ESCAN_ACTION_START); in brcmf_run_escan()
1470 params->sync_id = cpu_to_le16(0x1234); in brcmf_run_escan()
1474 if (err == -EBUSY) in brcmf_run_escan()
1489 struct brcmf_cfg80211_info *cfg = ifp->drvr->config; in brcmf_do_escan()
1492 struct escan_info *escan = &cfg->escan_info; in brcmf_do_escan()
1495 escan->ifp = ifp; in brcmf_do_escan()
1496 escan->wiphy = cfg->wiphy; in brcmf_do_escan()
1497 escan->escan_state = WL_ESCAN_STATE_SCANNING; in brcmf_do_escan()
1500 results = (struct brcmf_scan_results *)cfg->escan_info.escan_buf; in brcmf_do_escan()
1501 results->version = 0; in brcmf_do_escan()
1502 results->count = 0; in brcmf_do_escan()
1503 results->buflen = WL_ESCAN_RESULTS_FIXED_SIZE; in brcmf_do_escan()
1505 err = escan->run(cfg, ifp, request); in brcmf_do_escan()
1515 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_scan()
1520 vif = container_of(request->wdev, struct brcmf_cfg80211_vif, wdev); in brcmf_cfg80211_scan()
1522 return -EIO; in brcmf_cfg80211_scan()
1524 if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { in brcmf_cfg80211_scan()
1526 cfg->scan_status); in brcmf_cfg80211_scan()
1527 return -EAGAIN; in brcmf_cfg80211_scan()
1529 if (test_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status)) { in brcmf_cfg80211_scan()
1531 cfg->scan_status); in brcmf_cfg80211_scan()
1532 return -EAGAIN; in brcmf_cfg80211_scan()
1534 if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) { in brcmf_cfg80211_scan()
1536 cfg->scan_status); in brcmf_cfg80211_scan()
1537 return -EAGAIN; in brcmf_cfg80211_scan()
1539 if (test_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state)) { in brcmf_cfg80211_scan()
1540 bphy_err(drvr, "Connecting: status (%lu)\n", vif->sme_state); in brcmf_cfg80211_scan()
1541 return -EAGAIN; in brcmf_cfg80211_scan()
1545 if (vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif) in brcmf_cfg80211_scan()
1546 vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY].vif; in brcmf_cfg80211_scan()
1550 cfg->scan_request = request; in brcmf_cfg80211_scan()
1551 set_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); in brcmf_cfg80211_scan()
1553 cfg->escan_info.run = brcmf_run_escan; in brcmf_cfg80211_scan()
1559 request->ie, request->ie_len); in brcmf_cfg80211_scan()
1563 err = brcmf_do_escan(vif->ifp, request); in brcmf_cfg80211_scan()
1567 /* Arm scan timeout timer */ in brcmf_cfg80211_scan()
1568 mod_timer(&cfg->escan_timeout, in brcmf_cfg80211_scan()
1575 clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); in brcmf_cfg80211_scan()
1576 cfg->scan_request = NULL; in brcmf_cfg80211_scan()
1583 struct brcmf_pub *drvr = ifp->drvr; in brcmf_set_rts()
1596 struct brcmf_pub *drvr = ifp->drvr; in brcmf_set_frag()
1610 struct brcmf_pub *drvr = ifp->drvr; in brcmf_set_retry()
1630 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_set_wiphy_params()
1631 return -EIO; in brcmf_cfg80211_set_wiphy_params()
1634 (cfg->conf->rts_threshold != wiphy->rts_threshold)) { in brcmf_cfg80211_set_wiphy_params()
1635 cfg->conf->rts_threshold = wiphy->rts_threshold; in brcmf_cfg80211_set_wiphy_params()
1636 err = brcmf_set_rts(ndev, cfg->conf->rts_threshold); in brcmf_cfg80211_set_wiphy_params()
1641 (cfg->conf->frag_threshold != wiphy->frag_threshold)) { in brcmf_cfg80211_set_wiphy_params()
1642 cfg->conf->frag_threshold = wiphy->frag_threshold; in brcmf_cfg80211_set_wiphy_params()
1643 err = brcmf_set_frag(ndev, cfg->conf->frag_threshold); in brcmf_cfg80211_set_wiphy_params()
1648 && (cfg->conf->retry_long != wiphy->retry_long)) { in brcmf_cfg80211_set_wiphy_params()
1649 cfg->conf->retry_long = wiphy->retry_long; in brcmf_cfg80211_set_wiphy_params()
1650 err = brcmf_set_retry(ndev, cfg->conf->retry_long, true); in brcmf_cfg80211_set_wiphy_params()
1655 && (cfg->conf->retry_short != wiphy->retry_short)) { in brcmf_cfg80211_set_wiphy_params()
1656 cfg->conf->retry_short = wiphy->retry_short; in brcmf_cfg80211_set_wiphy_params()
1657 err = brcmf_set_retry(ndev, cfg->conf->retry_short, false); in brcmf_cfg80211_set_wiphy_params()
1676 switch (e->event_code) { in brcmf_map_fw_linkdown_reason()
1680 reason = e->reason; in brcmf_map_fw_linkdown_reason()
1692 struct brcmf_pub *drvr = ifp->drvr; in brcmf_set_wsec()
1699 return -EINVAL; in brcmf_set_wsec()
1709 /* store key material in firmware */ in brcmf_set_wsec()
1713 bphy_err(drvr, "failed to change PSK in firmware (len=%u)\n", in brcmf_set_wsec()
1728 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy); in brcmf_link_down()
1729 struct brcmf_pub *drvr = cfg->pub; in brcmf_link_down()
1730 bool bus_up = drvr->bus_if->state == BRCMF_BUS_UP; in brcmf_link_down()
1735 if (test_and_clear_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state)) { in brcmf_link_down()
1738 err = brcmf_fil_cmd_data_set(vif->ifp, in brcmf_link_down()
1745 if ((vif->wdev.iftype == NL80211_IFTYPE_STATION) || in brcmf_link_down()
1746 (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT)) in brcmf_link_down()
1747 cfg80211_disconnected(vif->wdev.netdev, reason, NULL, 0, in brcmf_link_down()
1750 clear_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state); in brcmf_link_down()
1751 clear_bit(BRCMF_VIF_STATUS_EAP_SUCCESS, &vif->sme_state); in brcmf_link_down()
1752 clear_bit(BRCMF_VIF_STATUS_ASSOC_SUCCESS, &vif->sme_state); in brcmf_link_down()
1753 clear_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status); in brcmf_link_down()
1755 if (vif->profile.use_fwsup != BRCMF_PROFILE_FWSUP_NONE) { in brcmf_link_down()
1757 brcmf_set_pmk(vif->ifp, NULL, 0); in brcmf_link_down()
1758 vif->profile.use_fwsup = BRCMF_PROFILE_FWSUP_NONE; in brcmf_link_down()
1769 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; in brcmf_cfg80211_join_ibss()
1770 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_join_ibss()
1780 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_join_ibss()
1781 return -EIO; in brcmf_cfg80211_join_ibss()
1783 if (params->ssid) in brcmf_cfg80211_join_ibss()
1784 brcmf_dbg(CONN, "SSID: %s\n", params->ssid); in brcmf_cfg80211_join_ibss()
1787 return -EOPNOTSUPP; in brcmf_cfg80211_join_ibss()
1790 set_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state); in brcmf_cfg80211_join_ibss()
1792 if (params->bssid) in brcmf_cfg80211_join_ibss()
1793 brcmf_dbg(CONN, "BSSID: %pM\n", params->bssid); in brcmf_cfg80211_join_ibss()
1797 if (params->chandef.chan) in brcmf_cfg80211_join_ibss()
1799 params->chandef.chan->center_freq); in brcmf_cfg80211_join_ibss()
1803 if (params->channel_fixed) in brcmf_cfg80211_join_ibss()
1808 if (params->ie && params->ie_len) in brcmf_cfg80211_join_ibss()
1809 brcmf_dbg(CONN, "ie len: %d\n", params->ie_len); in brcmf_cfg80211_join_ibss()
1813 if (params->beacon_interval) in brcmf_cfg80211_join_ibss()
1815 params->beacon_interval); in brcmf_cfg80211_join_ibss()
1819 if (params->basic_rates) in brcmf_cfg80211_join_ibss()
1820 brcmf_dbg(CONN, "basic rates: %08X\n", params->basic_rates); in brcmf_cfg80211_join_ibss()
1824 if (params->privacy) in brcmf_cfg80211_join_ibss()
1830 if (params->privacy) in brcmf_cfg80211_join_ibss()
1840 if (params->beacon_interval) in brcmf_cfg80211_join_ibss()
1841 bcnprd = params->beacon_interval; in brcmf_cfg80211_join_ibss()
1855 ssid_len = min_t(u32, params->ssid_len, IEEE80211_MAX_SSID_LEN); in brcmf_cfg80211_join_ibss()
1856 memcpy(join_params.ssid_le.SSID, params->ssid, ssid_len); in brcmf_cfg80211_join_ibss()
1861 if (params->bssid) { in brcmf_cfg80211_join_ibss()
1862 memcpy(join_params.params_le.bssid, params->bssid, ETH_ALEN); in brcmf_cfg80211_join_ibss()
1864 memcpy(profile->bssid, params->bssid, ETH_ALEN); in brcmf_cfg80211_join_ibss()
1867 eth_zero_addr(profile->bssid); in brcmf_cfg80211_join_ibss()
1871 if (params->chandef.chan) { in brcmf_cfg80211_join_ibss()
1874 cfg->channel = in brcmf_cfg80211_join_ibss()
1876 params->chandef.chan->center_freq); in brcmf_cfg80211_join_ibss()
1877 if (params->channel_fixed) { in brcmf_cfg80211_join_ibss()
1879 chanspec = chandef_to_chanspec(&cfg->d11inf, in brcmf_cfg80211_join_ibss()
1880 &params->chandef); in brcmf_cfg80211_join_ibss()
1888 target_channel = cfg->channel; in brcmf_cfg80211_join_ibss()
1896 cfg->channel = 0; in brcmf_cfg80211_join_ibss()
1898 cfg->ibss_starter = false; in brcmf_cfg80211_join_ibss()
1910 clear_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state); in brcmf_cfg80211_join_ibss()
1921 if (!check_vif_up(ifp->vif)) { in brcmf_cfg80211_leave_ibss()
1929 brcmf_link_down(ifp->vif, WLAN_REASON_DEAUTH_LEAVING, true); in brcmf_cfg80211_leave_ibss()
1942 struct brcmf_pub *drvr = ifp->drvr; in brcmf_set_wpa_version()
1947 if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_1) in brcmf_set_wpa_version()
1949 else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) in brcmf_set_wpa_version()
1951 else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_3) in brcmf_set_wpa_version()
1961 sec = &profile->sec; in brcmf_set_wpa_version()
1962 sec->wpa_versions = sme->crypto.wpa_versions; in brcmf_set_wpa_version()
1971 struct brcmf_pub *drvr = ifp->drvr; in brcmf_set_auth_type()
1976 switch (sme->auth_type) { in brcmf_set_auth_type()
1991 brcmf_dbg(CONN, "automatic, auth type (%d)\n", sme->auth_type); in brcmf_set_auth_type()
2000 sec = &profile->sec; in brcmf_set_auth_type()
2001 sec->auth_type = sme->auth_type; in brcmf_set_auth_type()
2011 struct brcmf_pub *drvr = ifp->drvr; in brcmf_set_wsec_mode()
2018 if (sme->crypto.n_ciphers_pairwise) { in brcmf_set_wsec_mode()
2019 switch (sme->crypto.ciphers_pairwise[0]) { in brcmf_set_wsec_mode()
2035 sme->crypto.ciphers_pairwise[0]); in brcmf_set_wsec_mode()
2036 return -EINVAL; in brcmf_set_wsec_mode()
2039 if (sme->crypto.cipher_group) { in brcmf_set_wsec_mode()
2040 switch (sme->crypto.cipher_group) { in brcmf_set_wsec_mode()
2056 sme->crypto.cipher_group); in brcmf_set_wsec_mode()
2057 return -EINVAL; in brcmf_set_wsec_mode()
2063 /* setting AES. WPS-2.0 allows no security */ in brcmf_set_wsec_mode()
2064 if (brcmf_find_wpsie(sme->ie, sme->ie_len) && !pval && !gval && in brcmf_set_wsec_mode()
2065 sme->privacy) in brcmf_set_wsec_mode()
2075 sec = &profile->sec; in brcmf_set_wsec_mode()
2076 sec->cipher_pairwise = sme->crypto.ciphers_pairwise[0]; in brcmf_set_wsec_mode()
2077 sec->cipher_group = sme->crypto.cipher_group; in brcmf_set_wsec_mode()
2086 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; in brcmf_set_key_mgmt()
2087 struct brcmf_pub *drvr = ifp->drvr; in brcmf_set_key_mgmt()
2098 profile->use_fwsup = BRCMF_PROFILE_FWSUP_NONE; in brcmf_set_key_mgmt()
2099 profile->is_ft = false; in brcmf_set_key_mgmt()
2101 if (!sme->crypto.n_akm_suites) in brcmf_set_key_mgmt()
2111 switch (sme->crypto.akm_suites[0]) { in brcmf_set_key_mgmt()
2114 if (sme->want_1x) in brcmf_set_key_mgmt()
2115 profile->use_fwsup = BRCMF_PROFILE_FWSUP_1X; in brcmf_set_key_mgmt()
2121 bphy_err(drvr, "invalid akm suite (%d)\n", in brcmf_set_key_mgmt()
2122 sme->crypto.akm_suites[0]); in brcmf_set_key_mgmt()
2123 return -EINVAL; in brcmf_set_key_mgmt()
2126 switch (sme->crypto.akm_suites[0]) { in brcmf_set_key_mgmt()
2129 if (sme->want_1x) in brcmf_set_key_mgmt()
2130 profile->use_fwsup = BRCMF_PROFILE_FWSUP_1X; in brcmf_set_key_mgmt()
2134 if (sme->want_1x) in brcmf_set_key_mgmt()
2135 profile->use_fwsup = BRCMF_PROFILE_FWSUP_1X; in brcmf_set_key_mgmt()
2145 profile->is_ft = true; in brcmf_set_key_mgmt()
2146 if (sme->want_1x) in brcmf_set_key_mgmt()
2147 profile->use_fwsup = BRCMF_PROFILE_FWSUP_1X; in brcmf_set_key_mgmt()
2151 profile->is_ft = true; in brcmf_set_key_mgmt()
2154 bphy_err(drvr, "invalid akm suite (%d)\n", in brcmf_set_key_mgmt()
2155 sme->crypto.akm_suites[0]); in brcmf_set_key_mgmt()
2156 return -EINVAL; in brcmf_set_key_mgmt()
2159 switch (sme->crypto.akm_suites[0]) { in brcmf_set_key_mgmt()
2162 if (sme->crypto.sae_pwd) { in brcmf_set_key_mgmt()
2164 profile->use_fwsup = BRCMF_PROFILE_FWSUP_SAE; in brcmf_set_key_mgmt()
2169 profile->is_ft = true; in brcmf_set_key_mgmt()
2170 if (sme->crypto.sae_pwd) { in brcmf_set_key_mgmt()
2172 profile->use_fwsup = BRCMF_PROFILE_FWSUP_SAE; in brcmf_set_key_mgmt()
2176 bphy_err(drvr, "invalid akm suite (%d)\n", in brcmf_set_key_mgmt()
2177 sme->crypto.akm_suites[0]); in brcmf_set_key_mgmt()
2178 return -EINVAL; in brcmf_set_key_mgmt()
2182 if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_1X) in brcmf_set_key_mgmt()
2190 rsn_ie = brcmf_parse_tlvs((const u8 *)sme->ie, sme->ie_len, in brcmf_set_key_mgmt()
2195 ie_len = rsn_ie->len + TLV_HDR_LEN; in brcmf_set_key_mgmt()
2196 /* Skip unicast suite */ in brcmf_set_key_mgmt()
2200 /* Skip multicast suite */ in brcmf_set_key_mgmt()
2205 /* Skip auth key management suite(s) */ in brcmf_set_key_mgmt()
2235 struct brcmf_pub *drvr = ifp->drvr; in brcmf_set_sharedkey()
2242 brcmf_dbg(CONN, "key len (%d)\n", sme->key_len); in brcmf_set_sharedkey()
2244 if (sme->key_len == 0) in brcmf_set_sharedkey()
2247 sec = &profile->sec; in brcmf_set_sharedkey()
2249 sec->wpa_versions, sec->cipher_pairwise); in brcmf_set_sharedkey()
2251 if (sec->wpa_versions & (NL80211_WPA_VERSION_1 | NL80211_WPA_VERSION_2 | in brcmf_set_sharedkey()
2255 if (!(sec->cipher_pairwise & in brcmf_set_sharedkey()
2260 key.len = (u32) sme->key_len; in brcmf_set_sharedkey()
2261 key.index = (u32) sme->key_idx; in brcmf_set_sharedkey()
2264 return -EINVAL; in brcmf_set_sharedkey()
2266 memcpy(key.data, sme->key, key.len); in brcmf_set_sharedkey()
2268 switch (sec->cipher_pairwise) { in brcmf_set_sharedkey()
2277 sme->crypto.ciphers_pairwise[0]); in brcmf_set_sharedkey()
2278 return -EINVAL; in brcmf_set_sharedkey()
2288 if (sec->auth_type == NL80211_AUTHTYPE_SHARED_KEY) { in brcmf_set_sharedkey()
2313 struct brcmf_pub *drvr = ifp->drvr; in brcmf_set_join_pref()
2321 if (bss_select->behaviour != NL80211_BSS_SELECT_ATTR_BAND_PREF) in brcmf_set_join_pref()
2324 switch (bss_select->behaviour) { in brcmf_set_join_pref()
2330 band = bss_select->param.band_pref; in brcmf_set_join_pref()
2336 band = bss_select->param.adjust.band; in brcmf_set_join_pref()
2338 join_pref_params[i].rssi_gain = bss_select->param.adjust.delta; in brcmf_set_join_pref()
2361 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; in brcmf_cfg80211_connect()
2362 struct ieee80211_channel *chan = sme->channel; in brcmf_cfg80211_connect()
2363 struct brcmf_pub *drvr = ifp->drvr; in brcmf_cfg80211_connect()
2376 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_connect()
2377 return -EIO; in brcmf_cfg80211_connect()
2379 if (!sme->ssid) { in brcmf_cfg80211_connect()
2381 return -EOPNOTSUPP; in brcmf_cfg80211_connect()
2384 if (sme->channel_hint) in brcmf_cfg80211_connect()
2385 chan = sme->channel_hint; in brcmf_cfg80211_connect()
2387 if (sme->bssid_hint) in brcmf_cfg80211_connect()
2388 sme->bssid = sme->bssid_hint; in brcmf_cfg80211_connect()
2390 if (ifp->vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY].vif) { in brcmf_cfg80211_connect()
2395 wpa_ie = brcmf_find_wpaie((u8 *)sme->ie, sme->ie_len); in brcmf_cfg80211_connect()
2398 ie_len = wpa_ie->len + TLV_HDR_LEN; in brcmf_cfg80211_connect()
2401 rsn_ie = brcmf_parse_tlvs((const u8 *)sme->ie, in brcmf_cfg80211_connect()
2402 sme->ie_len, in brcmf_cfg80211_connect()
2406 ie_len = rsn_ie->len + TLV_HDR_LEN; in brcmf_cfg80211_connect()
2412 err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG, in brcmf_cfg80211_connect()
2413 sme->ie, sme->ie_len); in brcmf_cfg80211_connect()
2419 set_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state); in brcmf_cfg80211_connect()
2422 cfg->channel = in brcmf_cfg80211_connect()
2423 ieee80211_frequency_to_channel(chan->center_freq); in brcmf_cfg80211_connect()
2424 chanspec = channel_to_chanspec(&cfg->d11inf, chan); in brcmf_cfg80211_connect()
2426 cfg->channel, chan->center_freq, chanspec); in brcmf_cfg80211_connect()
2428 cfg->channel = 0; in brcmf_cfg80211_connect()
2432 brcmf_dbg(INFO, "ie (%p), ie_len (%zd)\n", sme->ie, sme->ie_len); in brcmf_cfg80211_connect()
2440 sme->auth_type = brcmf_war_auth_type(ifp, sme->auth_type); in brcmf_cfg80211_connect()
2465 if (sme->crypto.psk && in brcmf_cfg80211_connect()
2466 profile->use_fwsup != BRCMF_PROFILE_FWSUP_SAE) { in brcmf_cfg80211_connect()
2467 if (WARN_ON(profile->use_fwsup != BRCMF_PROFILE_FWSUP_NONE)) { in brcmf_cfg80211_connect()
2468 err = -EINVAL; in brcmf_cfg80211_connect()
2472 profile->use_fwsup = BRCMF_PROFILE_FWSUP_PSK; in brcmf_cfg80211_connect()
2475 if (profile->use_fwsup != BRCMF_PROFILE_FWSUP_NONE) { in brcmf_cfg80211_connect()
2476 /* enable firmware supplicant for this interface */ in brcmf_cfg80211_connect()
2484 if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_PSK) in brcmf_cfg80211_connect()
2485 err = brcmf_set_pmk(ifp, sme->crypto.psk, in brcmf_cfg80211_connect()
2487 else if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_SAE) { in brcmf_cfg80211_connect()
2488 /* clean up user-space RSNE */ in brcmf_cfg80211_connect()
2491 bphy_err(drvr, "failed to clean up user-space RSNE\n"); in brcmf_cfg80211_connect()
2494 err = brcmf_fwvid_set_sae_password(ifp, &sme->crypto); in brcmf_cfg80211_connect()
2495 if (!err && sme->crypto.psk) in brcmf_cfg80211_connect()
2496 err = brcmf_set_pmk(ifp, sme->crypto.psk, in brcmf_cfg80211_connect()
2507 if (cfg->channel) in brcmf_cfg80211_connect()
2511 err = -ENOMEM; in brcmf_cfg80211_connect()
2514 ssid_len = min_t(u32, sme->ssid_len, IEEE80211_MAX_SSID_LEN); in brcmf_cfg80211_connect()
2515 ext_join_params->ssid_le.SSID_len = cpu_to_le32(ssid_len); in brcmf_cfg80211_connect()
2516 memcpy(&ext_join_params->ssid_le.SSID, sme->ssid, ssid_len); in brcmf_cfg80211_connect()
2519 ext_join_params->ssid_le.SSID, ssid_len); in brcmf_cfg80211_connect()
2522 ext_join_params->scan_le.scan_type = -1; in brcmf_cfg80211_connect()
2523 ext_join_params->scan_le.home_time = cpu_to_le32(-1); in brcmf_cfg80211_connect()
2525 if (sme->bssid) in brcmf_cfg80211_connect()
2526 memcpy(&ext_join_params->assoc_le.bssid, sme->bssid, ETH_ALEN); in brcmf_cfg80211_connect()
2528 eth_broadcast_addr(ext_join_params->assoc_le.bssid); in brcmf_cfg80211_connect()
2530 if (cfg->channel) { in brcmf_cfg80211_connect()
2531 ext_join_params->assoc_le.chanspec_num = cpu_to_le32(1); in brcmf_cfg80211_connect()
2533 ext_join_params->assoc_le.chanspec_list[0] = in brcmf_cfg80211_connect()
2539 ext_join_params->scan_le.active_time = in brcmf_cfg80211_connect()
2541 ext_join_params->scan_le.passive_time = in brcmf_cfg80211_connect()
2547 ext_join_params->scan_le.nprobes = in brcmf_cfg80211_connect()
2551 ext_join_params->scan_le.active_time = cpu_to_le32(-1); in brcmf_cfg80211_connect()
2552 ext_join_params->scan_le.passive_time = cpu_to_le32(-1); in brcmf_cfg80211_connect()
2553 ext_join_params->scan_le.nprobes = cpu_to_le32(-1); in brcmf_cfg80211_connect()
2556 brcmf_set_join_pref(ifp, &sme->bss_select); in brcmf_cfg80211_connect()
2569 memcpy(&join_params.ssid_le.SSID, sme->ssid, ssid_len); in brcmf_cfg80211_connect()
2572 if (sme->bssid) in brcmf_cfg80211_connect()
2573 memcpy(join_params.params_le.bssid, sme->bssid, ETH_ALEN); in brcmf_cfg80211_connect()
2577 if (cfg->channel) { in brcmf_cfg80211_connect()
2589 clear_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state); in brcmf_cfg80211_connect()
2600 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; in brcmf_cfg80211_disconnect()
2601 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_disconnect()
2606 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_disconnect()
2607 return -EIO; in brcmf_cfg80211_disconnect()
2609 clear_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state); in brcmf_cfg80211_disconnect()
2610 clear_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state); in brcmf_cfg80211_disconnect()
2611 clear_bit(BRCMF_VIF_STATUS_EAP_SUCCESS, &ifp->vif->sme_state); in brcmf_cfg80211_disconnect()
2612 clear_bit(BRCMF_VIF_STATUS_ASSOC_SUCCESS, &ifp->vif->sme_state); in brcmf_cfg80211_disconnect()
2615 memcpy(&scbval.ea, &profile->bssid, ETH_ALEN); in brcmf_cfg80211_disconnect()
2633 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_set_tx_power()
2639 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_set_tx_power()
2640 return -EIO; in brcmf_cfg80211_set_tx_power()
2648 bphy_err(drvr, "TX_POWER_FIXED - dbm is negative\n"); in brcmf_cfg80211_set_tx_power()
2649 err = -EINVAL; in brcmf_cfg80211_set_tx_power()
2659 err = -EINVAL; in brcmf_cfg80211_set_tx_power()
2683 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_get_tx_power()
2689 return -EIO; in brcmf_cfg80211_get_tx_power()
2691 err = brcmf_fil_iovar_int_get(vif->ifp, "qtxpower", &qdbm); in brcmf_cfg80211_get_tx_power()
2709 struct brcmf_pub *drvr = ifp->drvr; in brcmf_cfg80211_config_default_key()
2716 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_config_default_key()
2717 return -EIO; in brcmf_cfg80211_config_default_key()
2750 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_del_key()
2751 return -EIO; in brcmf_cfg80211_del_key()
2755 return -EINVAL; in brcmf_cfg80211_del_key()
2758 key = &ifp->vif->profile.key[key_idx]; in brcmf_cfg80211_del_key()
2760 if (key->algo == CRYPTO_ALGO_OFF) { in brcmf_cfg80211_del_key()
2762 return -EINVAL; in brcmf_cfg80211_del_key()
2766 key->index = (u32)key_idx; in brcmf_cfg80211_del_key()
2767 key->flags = BRCMF_PRIMARY_KEY; in brcmf_cfg80211_del_key()
2783 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_add_key()
2793 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_add_key()
2794 return -EIO; in brcmf_cfg80211_add_key()
2799 return -EINVAL; in brcmf_cfg80211_add_key()
2802 if (params->key_len == 0) in brcmf_cfg80211_add_key()
2803 return brcmf_cfg80211_del_key(wiphy, ndev, -1, key_idx, in brcmf_cfg80211_add_key()
2806 if (params->key_len > sizeof(key->data)) { in brcmf_cfg80211_add_key()
2807 bphy_err(drvr, "Too long key length (%u)\n", params->key_len); in brcmf_cfg80211_add_key()
2808 return -EINVAL; in brcmf_cfg80211_add_key()
2812 if (mac_addr && (params->cipher != WLAN_CIPHER_SUITE_WEP40) && in brcmf_cfg80211_add_key()
2813 (params->cipher != WLAN_CIPHER_SUITE_WEP104)) { in brcmf_cfg80211_add_key()
2818 key = &ifp->vif->profile.key[key_idx]; in brcmf_cfg80211_add_key()
2821 memcpy((char *)&key->ea, (void *)mac_addr, ETH_ALEN); in brcmf_cfg80211_add_key()
2822 key->len = params->key_len; in brcmf_cfg80211_add_key()
2823 key->index = key_idx; in brcmf_cfg80211_add_key()
2824 memcpy(key->data, params->key, key->len); in brcmf_cfg80211_add_key()
2826 key->flags = BRCMF_PRIMARY_KEY; in brcmf_cfg80211_add_key()
2828 if (params->seq && params->seq_len == 6) { in brcmf_cfg80211_add_key()
2832 ivptr = (u8 *)params->seq; in brcmf_cfg80211_add_key()
2833 key->rxiv.hi = (ivptr[5] << 24) | (ivptr[4] << 16) | in brcmf_cfg80211_add_key()
2835 key->rxiv.lo = (ivptr[1] << 8) | ivptr[0]; in brcmf_cfg80211_add_key()
2836 key->iv_initialized = true; in brcmf_cfg80211_add_key()
2839 switch (params->cipher) { in brcmf_cfg80211_add_key()
2841 key->algo = CRYPTO_ALGO_WEP1; in brcmf_cfg80211_add_key()
2846 key->algo = CRYPTO_ALGO_WEP128; in brcmf_cfg80211_add_key()
2851 if (!brcmf_is_apmode(ifp->vif)) { in brcmf_cfg80211_add_key()
2853 memcpy(keybuf, &key->data[24], sizeof(keybuf)); in brcmf_cfg80211_add_key()
2854 memcpy(&key->data[24], &key->data[16], sizeof(keybuf)); in brcmf_cfg80211_add_key()
2855 memcpy(&key->data[16], keybuf, sizeof(keybuf)); in brcmf_cfg80211_add_key()
2857 key->algo = CRYPTO_ALGO_TKIP; in brcmf_cfg80211_add_key()
2862 key->algo = CRYPTO_ALGO_AES_CCM; in brcmf_cfg80211_add_key()
2867 key->algo = CRYPTO_ALGO_AES_CCM; in brcmf_cfg80211_add_key()
2872 bphy_err(drvr, "Invalid cipher (0x%x)\n", params->cipher); in brcmf_cfg80211_add_key()
2873 err = -EINVAL; in brcmf_cfg80211_add_key()
2908 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; in brcmf_cfg80211_get_key()
2909 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_get_key()
2916 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_get_key()
2917 return -EIO; in brcmf_cfg80211_get_key()
2925 err = -EAGAIN; in brcmf_cfg80211_get_key()
2929 sec = &profile->sec; in brcmf_cfg80211_get_key()
2930 if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP40) { in brcmf_cfg80211_get_key()
2933 } else if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP104) { in brcmf_cfg80211_get_key()
2945 err = -EINVAL; in brcmf_cfg80211_get_key()
2969 return -EOPNOTSUPP; in brcmf_cfg80211_config_default_mgmt_key()
2975 struct brcmf_pub *drvr = ifp->drvr; in brcmf_cfg80211_reconfigure_wep()
2982 key = &ifp->vif->profile.key[key_idx]; in brcmf_cfg80211_reconfigure_wep()
2983 if ((key->algo == CRYPTO_ALGO_WEP1) || in brcmf_cfg80211_reconfigure_wep()
2984 (key->algo == CRYPTO_ALGO_WEP128)) in brcmf_cfg80211_reconfigure_wep()
3011 si->filled |= BIT_ULL(NL80211_STA_INFO_STA_FLAGS); in brcmf_convert_sta_flags()
3012 sfu = &si->sta_flags; in brcmf_convert_sta_flags()
3013 sfu->mask = BIT(NL80211_STA_FLAG_WME) | in brcmf_convert_sta_flags()
3018 sfu->set |= BIT(NL80211_STA_FLAG_WME); in brcmf_convert_sta_flags()
3020 sfu->set |= BIT(NL80211_STA_FLAG_AUTHENTICATED); in brcmf_convert_sta_flags()
3022 sfu->set |= BIT(NL80211_STA_FLAG_ASSOCIATED); in brcmf_convert_sta_flags()
3024 sfu->set |= BIT(NL80211_STA_FLAG_AUTHORIZED); in brcmf_convert_sta_flags()
3029 struct brcmf_pub *drvr = ifp->drvr; in brcmf_fill_bss_param()
3041 buf->len = cpu_to_le32(WL_BSS_INFO_MAX); in brcmf_fill_bss_param()
3048 si->filled |= BIT_ULL(NL80211_STA_INFO_BSS_PARAM); in brcmf_fill_bss_param()
3049 si->bss_param.beacon_interval = le16_to_cpu(buf->bss_le.beacon_period); in brcmf_fill_bss_param()
3050 si->bss_param.dtim_period = buf->bss_le.dtim_period; in brcmf_fill_bss_param()
3051 capability = le16_to_cpu(buf->bss_le.capability); in brcmf_fill_bss_param()
3053 si->bss_param.flags |= BSS_PARAM_FLAGS_CTS_PROT; in brcmf_fill_bss_param()
3055 si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE; in brcmf_fill_bss_param()
3057 si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME; in brcmf_fill_bss_param()
3067 struct brcmf_pub *drvr = ifp->drvr; in brcmf_cfg80211_get_station_ibss()
3080 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in brcmf_cfg80211_get_station_ibss()
3081 sinfo->txrate.legacy = rate * 5; in brcmf_cfg80211_get_station_ibss()
3091 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); in brcmf_cfg80211_get_station_ibss()
3092 sinfo->signal = rssi; in brcmf_cfg80211_get_station_ibss()
3100 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS) | in brcmf_cfg80211_get_station_ibss()
3104 sinfo->rx_packets = le32_to_cpu(pktcnt.rx_good_pkt); in brcmf_cfg80211_get_station_ibss()
3105 sinfo->rx_dropped_misc = le32_to_cpu(pktcnt.rx_bad_pkt); in brcmf_cfg80211_get_station_ibss()
3106 sinfo->tx_packets = le32_to_cpu(pktcnt.tx_good_pkt); in brcmf_cfg80211_get_station_ibss()
3107 sinfo->tx_failed = le32_to_cpu(pktcnt.tx_bad_pkt); in brcmf_cfg80211_get_station_ibss()
3118 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_get_station()
3131 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_get_station()
3132 return -EIO; in brcmf_cfg80211_get_station()
3134 if (brcmf_is_ibssmode(ifp->vif)) in brcmf_cfg80211_get_station()
3153 sinfo->filled = BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME); in brcmf_cfg80211_get_station()
3154 sinfo->inactive_time = le32_to_cpu(sta_info_le.idle) * 1000; in brcmf_cfg80211_get_station()
3157 sinfo->sta_flags.mask |= BIT(NL80211_STA_FLAG_TDLS_PEER); in brcmf_cfg80211_get_station()
3159 sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER); in brcmf_cfg80211_get_station()
3161 sinfo->sta_flags.set &= ~BIT(NL80211_STA_FLAG_TDLS_PEER); in brcmf_cfg80211_get_station()
3163 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CONNECTED_TIME); in brcmf_cfg80211_get_station()
3164 sinfo->connected_time = le32_to_cpu(sta_info_le.in); in brcmf_cfg80211_get_station()
3168 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED); in brcmf_cfg80211_get_station()
3169 sinfo->tx_failed = le32_to_cpu(sta_info_le.tx_failures); in brcmf_cfg80211_get_station()
3170 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS); in brcmf_cfg80211_get_station()
3171 sinfo->tx_packets = le32_to_cpu(sta_info_le.tx_pkts); in brcmf_cfg80211_get_station()
3172 sinfo->tx_packets += le32_to_cpu(sta_info_le.tx_mcast_pkts); in brcmf_cfg80211_get_station()
3173 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS); in brcmf_cfg80211_get_station()
3174 sinfo->rx_packets = le32_to_cpu(sta_info_le.rx_ucast_pkts); in brcmf_cfg80211_get_station()
3175 sinfo->rx_packets += le32_to_cpu(sta_info_le.rx_mcast_pkts); in brcmf_cfg80211_get_station()
3176 if (sinfo->tx_packets) { in brcmf_cfg80211_get_station()
3177 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in brcmf_cfg80211_get_station()
3178 sinfo->txrate.legacy = in brcmf_cfg80211_get_station()
3181 if (sinfo->rx_packets) { in brcmf_cfg80211_get_station()
3182 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BITRATE); in brcmf_cfg80211_get_station()
3183 sinfo->rxrate.legacy = in brcmf_cfg80211_get_station()
3187 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES); in brcmf_cfg80211_get_station()
3188 sinfo->tx_bytes = le64_to_cpu(sta_info_le.tx_tot_bytes); in brcmf_cfg80211_get_station()
3189 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES); in brcmf_cfg80211_get_station()
3190 sinfo->rx_bytes = le64_to_cpu(sta_info_le.rx_tot_bytes); in brcmf_cfg80211_get_station()
3196 sinfo->chains |= BIT(count_rssi); in brcmf_cfg80211_get_station()
3197 sinfo->chain_signal[count_rssi] = in brcmf_cfg80211_get_station()
3199 sinfo->chain_signal_avg[count_rssi] = in brcmf_cfg80211_get_station()
3206 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); in brcmf_cfg80211_get_station()
3207 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG); in brcmf_cfg80211_get_station()
3208 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL); in brcmf_cfg80211_get_station()
3209 sinfo->filled |= in brcmf_cfg80211_get_station()
3211 sinfo->signal = total_rssi / count_rssi; in brcmf_cfg80211_get_station()
3212 sinfo->signal_avg = total_rssi_avg / count_rssi; in brcmf_cfg80211_get_station()
3214 &ifp->vif->sme_state)) { in brcmf_cfg80211_get_station()
3224 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); in brcmf_cfg80211_get_station()
3225 sinfo->signal = rssi; in brcmf_cfg80211_get_station()
3241 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_dump_station()
3247 cfg->assoclist.count = cpu_to_le32(BRCMF_MAX_ASSOCLIST); in brcmf_cfg80211_dump_station()
3249 &cfg->assoclist, in brcmf_cfg80211_dump_station()
3250 sizeof(cfg->assoclist)); in brcmf_cfg80211_dump_station()
3252 /* GET_ASSOCLIST unsupported by firmware of older chips */ in brcmf_cfg80211_dump_station()
3253 if (err == -EBADE) in brcmf_cfg80211_dump_station()
3259 cfg->assoclist.count = 0; in brcmf_cfg80211_dump_station()
3260 return -EOPNOTSUPP; in brcmf_cfg80211_dump_station()
3263 if (idx < le32_to_cpu(cfg->assoclist.count)) { in brcmf_cfg80211_dump_station()
3264 memcpy(mac, cfg->assoclist.mac[idx], ETH_ALEN); in brcmf_cfg80211_dump_station()
3267 return -ENOENT; in brcmf_cfg80211_dump_station()
3278 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_set_power_mgmt()
3289 cfg->pwr_save = enabled; in brcmf_cfg80211_set_power_mgmt()
3290 if (!check_vif_up(ifp->vif)) { in brcmf_cfg80211_set_power_mgmt()
3298 if (ifp->vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT) { in brcmf_cfg80211_set_power_mgmt()
3306 if (err == -ENODEV) in brcmf_cfg80211_set_power_mgmt()
3326 struct brcmf_pub *drvr = cfg->pub; in brcmf_inform_single_bss()
3338 if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) { in brcmf_inform_single_bss()
3340 return -EINVAL; in brcmf_inform_single_bss()
3343 if (!bi->ctl_ch) { in brcmf_inform_single_bss()
3344 ch.chspec = le16_to_cpu(bi->chanspec); in brcmf_inform_single_bss()
3345 cfg->d11inf.decchspec(&ch); in brcmf_inform_single_bss()
3346 bi->ctl_ch = ch.control_ch_num; in brcmf_inform_single_bss()
3348 channel = bi->ctl_ch; in brcmf_inform_single_bss()
3359 notify_capability = le16_to_cpu(bi->capability); in brcmf_inform_single_bss()
3360 notify_interval = le16_to_cpu(bi->beacon_period); in brcmf_inform_single_bss()
3361 notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset); in brcmf_inform_single_bss()
3362 notify_ielen = le32_to_cpu(bi->ie_length); in brcmf_inform_single_bss()
3363 bss_data.signal = (s16)le16_to_cpu(bi->RSSI) * 100; in brcmf_inform_single_bss()
3365 brcmf_dbg(CONN, "bssid: %pM\n", bi->BSSID); in brcmf_inform_single_bss()
3373 (const u8 *)bi->BSSID, in brcmf_inform_single_bss()
3379 return -ENOMEM; in brcmf_inform_single_bss()
3390 return list->bss_info_le; in next_bss_le()
3392 le32_to_cpu(bss->length)); in next_bss_le()
3397 struct brcmf_pub *drvr = cfg->pub; in brcmf_inform_bss()
3403 bss_list = (struct brcmf_scan_results *)cfg->escan_info.escan_buf; in brcmf_inform_bss()
3404 if (bss_list->count != 0 && in brcmf_inform_bss()
3405 bss_list->version != BRCMF_BSS_INFO_VERSION) { in brcmf_inform_bss()
3407 bss_list->version); in brcmf_inform_bss()
3408 return -EOPNOTSUPP; in brcmf_inform_bss()
3410 brcmf_dbg(SCAN, "scanned AP count (%d)\n", bss_list->count); in brcmf_inform_bss()
3411 for (i = 0; i < bss_list->count; i++) { in brcmf_inform_bss()
3424 struct brcmf_pub *drvr = cfg->pub; in brcmf_inform_ibss()
3443 err = -ENOMEM; in brcmf_inform_ibss()
3458 ch.chspec = le16_to_cpu(bi->chanspec); in brcmf_inform_ibss()
3459 cfg->d11inf.decchspec(&ch); in brcmf_inform_ibss()
3462 band = wiphy->bands[NL80211_BAND_2GHZ]; in brcmf_inform_ibss()
3464 band = wiphy->bands[NL80211_BAND_5GHZ]; in brcmf_inform_ibss()
3466 freq = ieee80211_channel_to_frequency(ch.control_ch_num, band->band); in brcmf_inform_ibss()
3467 cfg->channel = freq; in brcmf_inform_ibss()
3470 notify_capability = le16_to_cpu(bi->capability); in brcmf_inform_ibss()
3471 notify_interval = le16_to_cpu(bi->beacon_period); in brcmf_inform_ibss()
3472 notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset); in brcmf_inform_ibss()
3473 notify_ielen = le32_to_cpu(bi->ie_length); in brcmf_inform_ibss()
3474 notify_signal = (s16)le16_to_cpu(bi->RSSI) * 100; in brcmf_inform_ibss()
3488 err = -ENOMEM; in brcmf_inform_ibss()
3506 struct brcmf_pub *drvr = cfg->pub; in brcmf_update_bss_info()
3511 if (brcmf_is_ibssmode(ifp->vif)) in brcmf_update_bss_info()
3514 *(__le32 *)cfg->extra_buf = cpu_to_le32(WL_EXTRA_BUF_MAX); in brcmf_update_bss_info()
3516 cfg->extra_buf, WL_EXTRA_BUF_MAX); in brcmf_update_bss_info()
3521 bi = (struct brcmf_bss_info_le *)(cfg->extra_buf + 4); in brcmf_update_bss_info()
3531 struct escan_info *escan = &cfg->escan_info; in brcmf_abort_scanning()
3533 set_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status); in brcmf_abort_scanning()
3534 if (cfg->int_escan_map || cfg->scan_request) { in brcmf_abort_scanning()
3535 escan->escan_state = WL_ESCAN_STATE_IDLE; in brcmf_abort_scanning()
3536 brcmf_notify_escan_complete(cfg, escan->ifp, true, true); in brcmf_abort_scanning()
3538 clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); in brcmf_abort_scanning()
3539 clear_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status); in brcmf_abort_scanning()
3549 brcmf_notify_escan_complete(cfg, cfg->escan_info.ifp, true, true); in brcmf_cfg80211_escan_timeout_worker()
3556 struct brcmf_pub *drvr = cfg->pub; in brcmf_escan_timeout()
3558 if (cfg->int_escan_map || cfg->scan_request) { in brcmf_escan_timeout()
3560 schedule_work(&cfg->escan_timeout_work); in brcmf_escan_timeout()
3571 ch_bss.chspec = le16_to_cpu(bss->chanspec); in brcmf_compare_update_same_bss()
3572 cfg->d11inf.decchspec(&ch_bss); in brcmf_compare_update_same_bss()
3573 ch_bss_info_le.chspec = le16_to_cpu(bss_info_le->chanspec); in brcmf_compare_update_same_bss()
3574 cfg->d11inf.decchspec(&ch_bss_info_le); in brcmf_compare_update_same_bss()
3576 if (!memcmp(&bss_info_le->BSSID, &bss->BSSID, ETH_ALEN) && in brcmf_compare_update_same_bss()
3578 bss_info_le->SSID_len == bss->SSID_len && in brcmf_compare_update_same_bss()
3579 !memcmp(bss_info_le->SSID, bss->SSID, bss_info_le->SSID_len)) { in brcmf_compare_update_same_bss()
3580 if ((bss->flags & BRCMF_BSS_RSSI_ON_CHANNEL) == in brcmf_compare_update_same_bss()
3581 (bss_info_le->flags & BRCMF_BSS_RSSI_ON_CHANNEL)) { in brcmf_compare_update_same_bss()
3582 s16 bss_rssi = le16_to_cpu(bss->RSSI); in brcmf_compare_update_same_bss()
3583 s16 bss_info_rssi = le16_to_cpu(bss_info_le->RSSI); in brcmf_compare_update_same_bss()
3586 * both on-channel or both off-channel in brcmf_compare_update_same_bss()
3589 bss->RSSI = bss_info_le->RSSI; in brcmf_compare_update_same_bss()
3590 } else if ((bss->flags & BRCMF_BSS_RSSI_ON_CHANNEL) && in brcmf_compare_update_same_bss()
3591 (bss_info_le->flags & BRCMF_BSS_RSSI_ON_CHANNEL) == 0) { in brcmf_compare_update_same_bss()
3592 /* preserve the on-channel rssi measurement in brcmf_compare_update_same_bss()
3595 bss->RSSI = bss_info_le->RSSI; in brcmf_compare_update_same_bss()
3596 bss->flags |= BRCMF_BSS_RSSI_ON_CHANNEL; in brcmf_compare_update_same_bss()
3607 struct brcmf_pub *drvr = ifp->drvr; in brcmf_cfg80211_escan_handler()
3608 struct brcmf_cfg80211_info *cfg = drvr->config; in brcmf_cfg80211_escan_handler()
3619 status = e->status; in brcmf_cfg80211_escan_handler()
3624 if (!test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { in brcmf_cfg80211_escan_handler()
3626 ifp->bsscfgidx); in brcmf_cfg80211_escan_handler()
3627 return -EPERM; in brcmf_cfg80211_escan_handler()
3632 if (e->datalen < sizeof(*escan_result_le)) { in brcmf_cfg80211_escan_handler()
3641 escan_buflen = le32_to_cpu(escan_result_le->buflen); in brcmf_cfg80211_escan_handler()
3643 escan_buflen > e->datalen || in brcmf_cfg80211_escan_handler()
3649 if (le16_to_cpu(escan_result_le->bss_count) != 1) { in brcmf_cfg80211_escan_handler()
3651 escan_result_le->bss_count); in brcmf_cfg80211_escan_handler()
3654 bss_info_le = &escan_result_le->bss_info_le; in brcmf_cfg80211_escan_handler()
3659 if (!cfg->int_escan_map && !cfg->scan_request) { in brcmf_cfg80211_escan_handler()
3664 bi_length = le32_to_cpu(bss_info_le->length); in brcmf_cfg80211_escan_handler()
3665 if (bi_length != escan_buflen - WL_ESCAN_RESULTS_FIXED_SIZE) { in brcmf_cfg80211_escan_handler()
3671 if (!(cfg_to_wiphy(cfg)->interface_modes & in brcmf_cfg80211_escan_handler()
3673 if (le16_to_cpu(bss_info_le->capability) & in brcmf_cfg80211_escan_handler()
3681 cfg->escan_info.escan_buf; in brcmf_cfg80211_escan_handler()
3682 if (bi_length > BRCMF_ESCAN_BUF_SIZE - list->buflen) { in brcmf_cfg80211_escan_handler()
3687 for (i = 0; i < list->count; i++) { in brcmf_cfg80211_escan_handler()
3690 le32_to_cpu(bss->length)) : list->bss_info_le; in brcmf_cfg80211_escan_handler()
3695 memcpy(&cfg->escan_info.escan_buf[list->buflen], bss_info_le, in brcmf_cfg80211_escan_handler()
3697 list->version = le32_to_cpu(bss_info_le->version); in brcmf_cfg80211_escan_handler()
3698 list->buflen += bi_length; in brcmf_cfg80211_escan_handler()
3699 list->count++; in brcmf_cfg80211_escan_handler()
3701 cfg->escan_info.escan_state = WL_ESCAN_STATE_IDLE; in brcmf_cfg80211_escan_handler()
3704 if (cfg->int_escan_map || cfg->scan_request) { in brcmf_cfg80211_escan_handler()
3718 brcmf_fweh_register(cfg->pub, BRCMF_E_ESCAN_RESULT, in brcmf_init_escan()
3720 cfg->escan_info.escan_state = WL_ESCAN_STATE_IDLE; in brcmf_init_escan()
3722 timer_setup(&cfg->escan_timeout, brcmf_escan_timeout, 0); in brcmf_init_escan()
3723 INIT_WORK(&cfg->escan_timeout_work, in brcmf_init_escan()
3733 n_netinfo * sizeof(req->channels[0]) + in brcmf_alloc_internal_escan_request()
3734 n_netinfo * sizeof(*req->ssids); in brcmf_alloc_internal_escan_request()
3738 req->wiphy = wiphy; in brcmf_alloc_internal_escan_request()
3739 req->ssids = (void *)(&req->channels[0]) + in brcmf_alloc_internal_escan_request()
3740 n_netinfo * sizeof(req->channels[0]); in brcmf_alloc_internal_escan_request()
3759 return -EINVAL; in brcmf_internal_escan_add_info()
3761 chan = ieee80211_get_channel(req->wiphy, freq); in brcmf_internal_escan_add_info()
3763 return -EINVAL; in brcmf_internal_escan_add_info()
3765 for (i = 0; i < req->n_channels; i++) { in brcmf_internal_escan_add_info()
3766 if (req->channels[i] == chan) in brcmf_internal_escan_add_info()
3769 if (i == req->n_channels) { in brcmf_internal_escan_add_info()
3770 req->n_channels++; in brcmf_internal_escan_add_info()
3771 req->channels[i] = chan; in brcmf_internal_escan_add_info()
3774 for (i = 0; i < req->n_ssids; i++) { in brcmf_internal_escan_add_info()
3775 if (req->ssids[i].ssid_len == ssid_len && in brcmf_internal_escan_add_info()
3776 !memcmp(req->ssids[i].ssid, ssid, ssid_len)) in brcmf_internal_escan_add_info()
3779 if (i == req->n_ssids) { in brcmf_internal_escan_add_info()
3780 memcpy(req->ssids[req->n_ssids].ssid, ssid, ssid_len); in brcmf_internal_escan_add_info()
3781 req->ssids[req->n_ssids++].ssid_len = ssid_len; in brcmf_internal_escan_add_info()
3789 struct brcmf_cfg80211_info *cfg = ifp->drvr->config; in brcmf_start_internal_escan()
3792 if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { in brcmf_start_internal_escan()
3793 if (cfg->int_escan_map) in brcmf_start_internal_escan()
3795 cfg->int_escan_map); in brcmf_start_internal_escan()
3796 /* Abort any on-going scan */ in brcmf_start_internal_escan()
3801 set_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); in brcmf_start_internal_escan()
3802 cfg->escan_info.run = brcmf_run_escan; in brcmf_start_internal_escan()
3805 clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); in brcmf_start_internal_escan()
3808 cfg->int_escan_map = fwmap; in brcmf_start_internal_escan()
3818 switch (pfn_v1->version) { in brcmf_get_netinfo_array()
3844 struct brcmf_pub *drvr = ifp->drvr; in brcmf_notify_sched_scan_results()
3845 struct brcmf_cfg80211_info *cfg = drvr->config; in brcmf_notify_sched_scan_results()
3858 if (e->datalen < (sizeof(*pfn_result) + sizeof(*netinfo))) { in brcmf_notify_sched_scan_results()
3863 if (e->event_code == BRCMF_E_PFN_NET_LOST) { in brcmf_notify_sched_scan_results()
3869 result_count = le32_to_cpu(pfn_result->count); in brcmf_notify_sched_scan_results()
3870 status = le32_to_cpu(pfn_result->status); in brcmf_notify_sched_scan_results()
3883 datalen = e->datalen - ((void *)netinfo_start - (void *)pfn_result); in brcmf_notify_sched_scan_results()
3892 err = -ENOMEM; in brcmf_notify_sched_scan_results()
3900 if (netinfo->SSID_len > IEEE80211_MAX_SSID_LEN) in brcmf_notify_sched_scan_results()
3901 netinfo->SSID_len = IEEE80211_MAX_SSID_LEN; in brcmf_notify_sched_scan_results()
3903 netinfo->SSID, netinfo->channel); in brcmf_notify_sched_scan_results()
3904 bucket_map |= brcmf_pno_get_bucket_map(cfg->pno, netinfo); in brcmf_notify_sched_scan_results()
3906 netinfo->SSID, in brcmf_notify_sched_scan_results()
3907 netinfo->SSID_len, in brcmf_notify_sched_scan_results()
3908 netinfo->channel); in brcmf_notify_sched_scan_results()
3934 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_sched_scan_start()
3937 req->n_match_sets, req->n_ssids); in brcmf_cfg80211_sched_scan_start()
3939 if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) { in brcmf_cfg80211_sched_scan_start()
3941 cfg->scan_status); in brcmf_cfg80211_sched_scan_start()
3942 return -EAGAIN; in brcmf_cfg80211_sched_scan_start()
3945 if (req->n_match_sets <= 0) { in brcmf_cfg80211_sched_scan_start()
3947 req->n_match_sets); in brcmf_cfg80211_sched_scan_start()
3948 return -EINVAL; in brcmf_cfg80211_sched_scan_start()
3962 if (cfg->int_escan_map) in brcmf_cfg80211_sched_scan_stop()
3989 patternoffset = sizeof(*filter) - sizeof(filter->cmd) + masksize; in brcmf_config_wowl_pattern()
3994 return -ENOMEM; in brcmf_config_wowl_pattern()
3997 memcpy(filter->cmd, cmd, 4); in brcmf_config_wowl_pattern()
3998 filter->masksize = cpu_to_le32(masksize); in brcmf_config_wowl_pattern()
3999 filter->offset = cpu_to_le32(packet_offset); in brcmf_config_wowl_pattern()
4000 filter->patternoffset = cpu_to_le32(patternoffset); in brcmf_config_wowl_pattern()
4001 filter->patternsize = cpu_to_le32(patternsize); in brcmf_config_wowl_pattern()
4002 filter->type = cpu_to_le32(BRCMF_WOWL_PATTERN_TYPE_BITMAP); in brcmf_config_wowl_pattern()
4019 struct brcmf_pub *drvr = ifp->drvr; in brcmf_wowl_nd_results()
4020 struct brcmf_cfg80211_info *cfg = drvr->config; in brcmf_wowl_nd_results()
4026 if (e->datalen < (sizeof(*pfn_result) + sizeof(*netinfo))) { in brcmf_wowl_nd_results()
4033 if (e->event_code == BRCMF_E_PFN_NET_LOST) { in brcmf_wowl_nd_results()
4038 if (le32_to_cpu(pfn_result->count) < 1) { in brcmf_wowl_nd_results()
4040 le32_to_cpu(pfn_result->count)); in brcmf_wowl_nd_results()
4041 return -EINVAL; in brcmf_wowl_nd_results()
4045 if (netinfo->SSID_len > IEEE80211_MAX_SSID_LEN) in brcmf_wowl_nd_results()
4046 netinfo->SSID_len = IEEE80211_MAX_SSID_LEN; in brcmf_wowl_nd_results()
4047 memcpy(cfg->wowl.nd->ssid.ssid, netinfo->SSID, netinfo->SSID_len); in brcmf_wowl_nd_results()
4048 cfg->wowl.nd->ssid.ssid_len = netinfo->SSID_len; in brcmf_wowl_nd_results()
4049 cfg->wowl.nd->n_channels = 1; in brcmf_wowl_nd_results()
4050 cfg->wowl.nd->channels[0] = in brcmf_wowl_nd_results()
4051 ieee80211_channel_to_frequency(netinfo->channel, in brcmf_wowl_nd_results()
4052 netinfo->channel <= CH_MAX_2G_CHANNEL ? in brcmf_wowl_nd_results()
4054 cfg->wowl.nd_info->n_matches = 1; in brcmf_wowl_nd_results()
4055 cfg->wowl.nd_info->matches[0] = cfg->wowl.nd; in brcmf_wowl_nd_results()
4058 cfg->wowl.nd_data_completed = true; in brcmf_wowl_nd_results()
4059 wake_up(&cfg->wowl.nd_data_wait); in brcmf_wowl_nd_results()
4069 struct brcmf_pub *drvr = cfg->pub; in brcmf_report_wowl_wakeind()
4090 wakeup_data.pattern_idx = -1; in brcmf_report_wowl_wakeind()
4117 time_left = wait_event_timeout(cfg->wowl.nd_data_wait, in brcmf_report_wowl_wakeind()
4118 cfg->wowl.nd_data_completed, in brcmf_report_wowl_wakeind()
4123 wakeup_data.net_detect = cfg->wowl.nd_info; in brcmf_report_wowl_wakeind()
4132 cfg80211_report_wowlan_wakeup(&ifp->vif->wdev, wakeup, GFP_KERNEL); in brcmf_report_wowl_wakeind()
4151 if (cfg->wowl.active) { in brcmf_cfg80211_resume()
4158 cfg->wowl.pre_pmmode); in brcmf_cfg80211_resume()
4159 cfg->wowl.active = false; in brcmf_cfg80211_resume()
4160 if (cfg->wowl.nd_enabled) { in brcmf_cfg80211_resume()
4161 brcmf_cfg80211_sched_scan_stop(cfg->wiphy, ifp->ndev, 0); in brcmf_cfg80211_resume()
4162 brcmf_fweh_unregister(cfg->pub, BRCMF_E_PFN_NET_FOUND); in brcmf_cfg80211_resume()
4163 brcmf_fweh_register(cfg->pub, BRCMF_E_PFN_NET_FOUND, in brcmf_cfg80211_resume()
4165 cfg->wowl.nd_enabled = false; in brcmf_cfg80211_resume()
4183 brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_PM, &cfg->wowl.pre_pmmode); in brcmf_configure_wowl()
4187 if (wowl->disconnect) in brcmf_configure_wowl()
4189 if (wowl->magic_pkt) in brcmf_configure_wowl()
4191 if ((wowl->patterns) && (wowl->n_patterns)) { in brcmf_configure_wowl()
4193 for (i = 0; i < wowl->n_patterns; i++) { in brcmf_configure_wowl()
4195 (u8 *)wowl->patterns[i].pattern, in brcmf_configure_wowl()
4196 wowl->patterns[i].pattern_len, in brcmf_configure_wowl()
4197 (u8 *)wowl->patterns[i].mask, in brcmf_configure_wowl()
4198 wowl->patterns[i].pkt_offset); in brcmf_configure_wowl()
4201 if (wowl->nd_config) { in brcmf_configure_wowl()
4202 brcmf_cfg80211_sched_scan_start(cfg->wiphy, ifp->ndev, in brcmf_configure_wowl()
4203 wowl->nd_config); in brcmf_configure_wowl()
4206 cfg->wowl.nd_data_completed = false; in brcmf_configure_wowl()
4207 cfg->wowl.nd_enabled = true; in brcmf_configure_wowl()
4209 brcmf_fweh_unregister(cfg->pub, BRCMF_E_PFN_NET_FOUND); in brcmf_configure_wowl()
4210 brcmf_fweh_register(cfg->pub, BRCMF_E_PFN_NET_FOUND, in brcmf_configure_wowl()
4213 if (wowl->gtk_rekey_failure) in brcmf_configure_wowl()
4215 if (!test_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state)) in brcmf_configure_wowl()
4223 brcmf_bus_wowl_config(cfg->pub->bus_if, true); in brcmf_configure_wowl()
4224 cfg->wowl.active = true; in brcmf_configure_wowl()
4240 brcmf_err("keep-alive packet config failed, ret=%d\n", ret); in brcmf_keepalive_start()
4258 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_suspend()
4266 if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) in brcmf_cfg80211_suspend()
4270 brcmf_bus_wowl_config(cfg->pub->bus_if, false); in brcmf_cfg80211_suspend()
4271 list_for_each_entry(vif, &cfg->vif_list, list) { in brcmf_cfg80211_suspend()
4272 if (!test_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state)) in brcmf_cfg80211_suspend()
4292 /* Prevent disassociation due to inactivity with keep-alive */ in brcmf_cfg80211_suspend()
4299 cfg->scan_status = 0; in brcmf_cfg80211_suspend()
4313 return -ENOMEM; in brcmf_pmksa_v3_op()
4315 pmk_op->version = cpu_to_le16(BRCMF_PMKSA_VER_3); in brcmf_pmksa_v3_op()
4319 pmk_op->count = cpu_to_le16(0); in brcmf_pmksa_v3_op()
4322 pmk_op->count = cpu_to_le16(1); in brcmf_pmksa_v3_op()
4324 if (pmksa->bssid) in brcmf_pmksa_v3_op()
4325 memcpy(pmk_op->pmk[0].bssid, pmksa->bssid, ETH_ALEN); in brcmf_pmksa_v3_op()
4326 if (pmksa->pmkid) { in brcmf_pmksa_v3_op()
4327 memcpy(pmk_op->pmk[0].pmkid, pmksa->pmkid, WLAN_PMKID_LEN); in brcmf_pmksa_v3_op()
4328 pmk_op->pmk[0].pmkid_len = WLAN_PMKID_LEN; in brcmf_pmksa_v3_op()
4330 if (pmksa->ssid && pmksa->ssid_len) { in brcmf_pmksa_v3_op()
4331 memcpy(pmk_op->pmk[0].ssid.SSID, pmksa->ssid, pmksa->ssid_len); in brcmf_pmksa_v3_op()
4332 pmk_op->pmk[0].ssid.SSID_len = pmksa->ssid_len; in brcmf_pmksa_v3_op()
4334 pmk_op->pmk[0].time_left = cpu_to_le32(alive ? BRCMF_PMKSA_NO_EXPIRY : 0); in brcmf_pmksa_v3_op()
4337 pmk_op->length = cpu_to_le16(length); in brcmf_pmksa_v3_op()
4351 pmk_list = &cfg->pmk_list; in brcmf_update_pmklist()
4352 npmk = le32_to_cpu(pmk_list->npmk); in brcmf_update_pmklist()
4356 brcmf_dbg(CONN, "PMK[%d]: %pM\n", i, &pmk_list->pmk[i].bssid); in brcmf_update_pmklist()
4368 struct brcmf_pmksa *pmk = &cfg->pmk_list.pmk[0]; in brcmf_cfg80211_set_pmksa()
4369 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_set_pmksa()
4374 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_set_pmksa()
4375 return -EIO; in brcmf_cfg80211_set_pmksa()
4377 brcmf_dbg(CONN, "set_pmksa - PMK bssid: %pM =\n", pmksa->bssid); in brcmf_cfg80211_set_pmksa()
4378 brcmf_dbg(CONN, "%*ph\n", WLAN_PMKID_LEN, pmksa->pmkid); in brcmf_cfg80211_set_pmksa()
4385 npmk = le32_to_cpu(cfg->pmk_list.npmk); in brcmf_cfg80211_set_pmksa()
4387 if (!memcmp(pmksa->bssid, pmk[i].bssid, ETH_ALEN)) in brcmf_cfg80211_set_pmksa()
4390 memcpy(pmk[i].bssid, pmksa->bssid, ETH_ALEN); in brcmf_cfg80211_set_pmksa()
4391 memcpy(pmk[i].pmkid, pmksa->pmkid, WLAN_PMKID_LEN); in brcmf_cfg80211_set_pmksa()
4394 cfg->pmk_list.npmk = cpu_to_le32(npmk); in brcmf_cfg80211_set_pmksa()
4398 return -EINVAL; in brcmf_cfg80211_set_pmksa()
4413 struct brcmf_pmksa *pmk = &cfg->pmk_list.pmk[0]; in brcmf_cfg80211_del_pmksa()
4414 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_del_pmksa()
4419 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_del_pmksa()
4420 return -EIO; in brcmf_cfg80211_del_pmksa()
4422 brcmf_dbg(CONN, "del_pmksa - PMK bssid = %pM\n", pmksa->bssid); in brcmf_cfg80211_del_pmksa()
4429 npmk = le32_to_cpu(cfg->pmk_list.npmk); in brcmf_cfg80211_del_pmksa()
4431 if (!memcmp(pmksa->bssid, pmk[i].bssid, ETH_ALEN)) in brcmf_cfg80211_del_pmksa()
4435 for (; i < (npmk - 1); i++) { in brcmf_cfg80211_del_pmksa()
4441 cfg->pmk_list.npmk = cpu_to_le32(npmk - 1); in brcmf_cfg80211_del_pmksa()
4444 return -EINVAL; in brcmf_cfg80211_del_pmksa()
4462 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_flush_pmksa()
4463 return -EIO; in brcmf_cfg80211_flush_pmksa()
4470 memset(&cfg->pmk_list, 0, sizeof(cfg->pmk_list)); in brcmf_cfg80211_flush_pmksa()
4480 struct brcmf_pub *drvr = ifp->drvr; in brcmf_configure_opensecurity()
4496 /* set upper-layer auth */ in brcmf_configure_opensecurity()
4497 if (brcmf_is_ibssmode(ifp->vif)) in brcmf_configure_opensecurity()
4523 struct brcmf_pub *drvr = ifp->drvr; in brcmf_configure_wpaie()
4543 len = wpa_ie->len + TLV_HDR_LEN; in brcmf_configure_wpaie()
4551 /* check for multicast cipher suite */ in brcmf_configure_wpaie()
4553 err = -EINVAL; in brcmf_configure_wpaie()
4554 bphy_err(drvr, "no multicast cipher suite\n"); in brcmf_configure_wpaie()
4559 err = -EINVAL; in brcmf_configure_wpaie()
4581 err = -EINVAL; in brcmf_configure_wpaie()
4590 /* Check for unicast suite(s) */ in brcmf_configure_wpaie()
4592 err = -EINVAL; in brcmf_configure_wpaie()
4593 bphy_err(drvr, "no unicast cipher suite\n"); in brcmf_configure_wpaie()
4598 err = -EINVAL; in brcmf_configure_wpaie()
4621 /* walk thru auth management suite list and pick up what we recognize */ in brcmf_configure_wpaie()
4624 /* Check for auth key management suite(s) */ in brcmf_configure_wpaie()
4626 err = -EINVAL; in brcmf_configure_wpaie()
4627 bphy_err(drvr, "no auth key mgmt suite\n"); in brcmf_configure_wpaie()
4632 err = -EINVAL; in brcmf_configure_wpaie()
4680 /* Firmware only supports mfp required in in brcmf_configure_wpaie()
4687 err = -EINVAL; in brcmf_configure_wpaie()
4690 /* Firmware has requirement that WPA2_AUTH_PSK/ in brcmf_configure_wpaie()
4715 /* See if there is BIP wpa suite left for MFP */ in brcmf_configure_wpaie()
4752 /* set upper-layer auth */ in brcmf_configure_wpaie()
4777 if (ie->id != WLAN_EID_VENDOR_SPECIFIC) in brcmf_parse_vndr_ies()
4781 if (vndrie->len < (VS_IE_FIXED_HDR_LEN - TLV_HDR_LEN + 1)) { in brcmf_parse_vndr_ies()
4783 vndrie->len); in brcmf_parse_vndr_ies()
4787 if (!memcmp(vndrie->oui, (u8 *)WPA_OUI, TLV_OUI_LEN) && in brcmf_parse_vndr_ies()
4788 ((vndrie->oui_type == WPA_OUI_TYPE) || in brcmf_parse_vndr_ies()
4789 (vndrie->oui_type == WME_OUI_TYPE))) { in brcmf_parse_vndr_ies()
4794 parsed_info = &vndr_ies->ie_info[vndr_ies->count]; in brcmf_parse_vndr_ies()
4797 parsed_info->ie_ptr = (char *)vndrie; in brcmf_parse_vndr_ies()
4798 parsed_info->ie_len = vndrie->len + TLV_HDR_LEN; in brcmf_parse_vndr_ies()
4799 memcpy(&parsed_info->vndrie, vndrie, sizeof(*vndrie)); in brcmf_parse_vndr_ies()
4801 vndr_ies->count++; in brcmf_parse_vndr_ies()
4804 parsed_info->vndrie.oui, in brcmf_parse_vndr_ies()
4805 parsed_info->vndrie.oui_type); in brcmf_parse_vndr_ies()
4807 if (vndr_ies->count >= VNDR_IE_PARSE_LIMIT) in brcmf_parse_vndr_ies()
4810 remaining_len -= (ie->len + TLV_HDR_LEN); in brcmf_parse_vndr_ies()
4814 ie = (struct brcmf_tlv *)(((u8 *)ie) + ie->len + in brcmf_parse_vndr_ies()
4857 return -ENODEV; in brcmf_vif_set_mgmt_ie()
4858 ifp = vif->ifp; in brcmf_vif_set_mgmt_ie()
4859 drvr = ifp->drvr; in brcmf_vif_set_mgmt_ie()
4860 saved_ie = &vif->saved_ie; in brcmf_vif_set_mgmt_ie()
4862 brcmf_dbg(TRACE, "bsscfgidx %d, pktflag : 0x%02X\n", ifp->bsscfgidx, in brcmf_vif_set_mgmt_ie()
4866 return -ENOMEM; in brcmf_vif_set_mgmt_ie()
4870 mgmt_ie_buf = saved_ie->probe_req_ie; in brcmf_vif_set_mgmt_ie()
4871 mgmt_ie_len = &saved_ie->probe_req_ie_len; in brcmf_vif_set_mgmt_ie()
4872 mgmt_ie_buf_len = sizeof(saved_ie->probe_req_ie); in brcmf_vif_set_mgmt_ie()
4875 mgmt_ie_buf = saved_ie->probe_res_ie; in brcmf_vif_set_mgmt_ie()
4876 mgmt_ie_len = &saved_ie->probe_res_ie_len; in brcmf_vif_set_mgmt_ie()
4877 mgmt_ie_buf_len = sizeof(saved_ie->probe_res_ie); in brcmf_vif_set_mgmt_ie()
4880 mgmt_ie_buf = saved_ie->beacon_ie; in brcmf_vif_set_mgmt_ie()
4881 mgmt_ie_len = &saved_ie->beacon_ie_len; in brcmf_vif_set_mgmt_ie()
4882 mgmt_ie_buf_len = sizeof(saved_ie->beacon_ie); in brcmf_vif_set_mgmt_ie()
4885 mgmt_ie_buf = saved_ie->assoc_req_ie; in brcmf_vif_set_mgmt_ie()
4886 mgmt_ie_len = &saved_ie->assoc_req_ie_len; in brcmf_vif_set_mgmt_ie()
4887 mgmt_ie_buf_len = sizeof(saved_ie->assoc_req_ie); in brcmf_vif_set_mgmt_ie()
4890 mgmt_ie_buf = saved_ie->assoc_res_ie; in brcmf_vif_set_mgmt_ie()
4891 mgmt_ie_len = &saved_ie->assoc_res_ie_len; in brcmf_vif_set_mgmt_ie()
4892 mgmt_ie_buf_len = sizeof(saved_ie->assoc_res_ie); in brcmf_vif_set_mgmt_ie()
4895 err = -EPERM; in brcmf_vif_set_mgmt_ie()
4901 err = -ENOMEM; in brcmf_vif_set_mgmt_ie()
4912 memcpy(ptr + parsed_ie_buf_len, vndrie_info->ie_ptr, in brcmf_vif_set_mgmt_ie()
4913 vndrie_info->ie_len); in brcmf_vif_set_mgmt_ie()
4914 parsed_ie_buf_len += vndrie_info->ie_len; in brcmf_vif_set_mgmt_ie()
4934 vndrie_info->vndrie.id, in brcmf_vif_set_mgmt_ie()
4935 vndrie_info->vndrie.len, in brcmf_vif_set_mgmt_ie()
4936 vndrie_info->vndrie.oui); in brcmf_vif_set_mgmt_ie()
4939 vndrie_info->ie_ptr, in brcmf_vif_set_mgmt_ie()
4940 vndrie_info->ie_len, in brcmf_vif_set_mgmt_ie()
4959 if (remained_buf_len < (vndrie_info->vndrie.len + in brcmf_vif_set_mgmt_ie()
4965 remained_buf_len -= (vndrie_info->ie_len + in brcmf_vif_set_mgmt_ie()
4969 vndrie_info->vndrie.id, in brcmf_vif_set_mgmt_ie()
4970 vndrie_info->vndrie.len, in brcmf_vif_set_mgmt_ie()
4971 vndrie_info->vndrie.oui); in brcmf_vif_set_mgmt_ie()
4974 vndrie_info->ie_ptr, in brcmf_vif_set_mgmt_ie()
4975 vndrie_info->ie_len, in brcmf_vif_set_mgmt_ie()
4979 memcpy(ptr + (*mgmt_ie_len), vndrie_info->ie_ptr, in brcmf_vif_set_mgmt_ie()
4980 vndrie_info->ie_len); in brcmf_vif_set_mgmt_ie()
4981 *mgmt_ie_len += vndrie_info->ie_len; in brcmf_vif_set_mgmt_ie()
5011 memset(&vif->saved_ie, 0, sizeof(vif->saved_ie)); in brcmf_vif_clear_mgmt_ies()
5019 struct brcmf_pub *drvr = vif->ifp->drvr; in brcmf_config_ap_mgmt_ie()
5024 beacon->tail, beacon->tail_len); in brcmf_config_ap_mgmt_ie()
5033 beacon->proberesp_ies, in brcmf_config_ap_mgmt_ie()
5034 beacon->proberesp_ies_len); in brcmf_config_ap_mgmt_ie()
5042 beacon->assocresp_ies, in brcmf_config_ap_mgmt_ie()
5043 beacon->assocresp_ies_len); in brcmf_config_ap_mgmt_ie()
5062 rsn_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail, in brcmf_parse_configure_security()
5063 settings->beacon.tail_len, WLAN_EID_RSN); in brcmf_parse_configure_security()
5066 wpa_ie = brcmf_find_wpaie((u8 *)settings->beacon.tail, in brcmf_parse_configure_security()
5067 settings->beacon.tail_len); in brcmf_parse_configure_security()
5101 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_start_ap()
5102 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; in brcmf_cfg80211_start_ap()
5103 struct cfg80211_crypto_settings *crypto = &settings->crypto; in brcmf_cfg80211_start_ap()
5107 s32 err = -EPERM; in brcmf_cfg80211_start_ap()
5111 u16 chanspec = chandef_to_chanspec(&cfg->d11inf, &settings->chandef); in brcmf_cfg80211_start_ap()
5118 settings->chandef.chan->hw_value, in brcmf_cfg80211_start_ap()
5119 settings->chandef.center_freq1, settings->chandef.width, in brcmf_cfg80211_start_ap()
5120 settings->beacon_interval, settings->dtim_period); in brcmf_cfg80211_start_ap()
5122 settings->ssid, settings->ssid_len, settings->auth_type, in brcmf_cfg80211_start_ap()
5123 settings->inactivity_timeout); in brcmf_cfg80211_start_ap()
5124 dev_role = ifp->vif->wdev.iftype; in brcmf_cfg80211_start_ap()
5125 mbss = ifp->vif->mbss; in brcmf_cfg80211_start_ap()
5129 &ifp->vif->is_11d)) { in brcmf_cfg80211_start_ap()
5132 country_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail, in brcmf_cfg80211_start_ap()
5133 settings->beacon.tail_len, in brcmf_cfg80211_start_ap()
5140 if (settings->ssid == NULL || settings->ssid_len == 0) { in brcmf_cfg80211_start_ap()
5143 (u8 *)&settings->beacon.head[ie_offset], in brcmf_cfg80211_start_ap()
5144 settings->beacon.head_len - ie_offset, in brcmf_cfg80211_start_ap()
5146 if (!ssid_ie || ssid_ie->len > IEEE80211_MAX_SSID_LEN) in brcmf_cfg80211_start_ap()
5147 return -EINVAL; in brcmf_cfg80211_start_ap()
5149 memcpy(ssid_le.SSID, ssid_ie->data, ssid_ie->len); in brcmf_cfg80211_start_ap()
5150 ssid_le.SSID_len = cpu_to_le32(ssid_ie->len); in brcmf_cfg80211_start_ap()
5153 memcpy(ssid_le.SSID, settings->ssid, settings->ssid_len); in brcmf_cfg80211_start_ap()
5154 ssid_le.SSID_len = cpu_to_le32((u32)settings->ssid_len); in brcmf_cfg80211_start_ap()
5164 if ((supports_11d) && (is_11d != ifp->vif->is_11d)) { in brcmf_cfg80211_start_ap()
5173 if (settings->beacon_interval) { in brcmf_cfg80211_start_ap()
5175 settings->beacon_interval); in brcmf_cfg80211_start_ap()
5182 if (settings->dtim_period) { in brcmf_cfg80211_start_ap()
5184 settings->dtim_period); in brcmf_cfg80211_start_ap()
5193 ((ifp->ifidx == 0) || in brcmf_cfg80211_start_ap()
5210 } else if (WARN_ON(supports_11d && (is_11d != ifp->vif->is_11d))) { in brcmf_cfg80211_start_ap()
5211 /* Multiple-BSS should use same 11d configuration */ in brcmf_cfg80211_start_ap()
5212 err = -EINVAL; in brcmf_cfg80211_start_ap()
5228 /* Firmware 10.x requires setting channel after enabling in brcmf_cfg80211_start_ap()
5244 if (crypto->psk) { in brcmf_cfg80211_start_ap()
5246 profile->use_fwauth |= BIT(BRCMF_PROFILE_FWAUTH_PSK); in brcmf_cfg80211_start_ap()
5247 err = brcmf_set_pmk(ifp, crypto->psk, in brcmf_cfg80211_start_ap()
5252 if (crypto->sae_pwd) { in brcmf_cfg80211_start_ap()
5254 profile->use_fwauth |= BIT(BRCMF_PROFILE_FWAUTH_SAE); in brcmf_cfg80211_start_ap()
5259 if (profile->use_fwauth == 0) in brcmf_cfg80211_start_ap()
5260 profile->use_fwauth = BIT(BRCMF_PROFILE_FWAUTH_NONE); in brcmf_cfg80211_start_ap()
5269 /* On DOWN the firmware removes the WEP keys, reconfigure in brcmf_cfg80211_start_ap()
5286 (settings->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE); in brcmf_cfg80211_start_ap()
5317 bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx); in brcmf_cfg80211_start_ap()
5331 brcmf_config_ap_mgmt_ie(ifp->vif, &settings->beacon); in brcmf_cfg80211_start_ap()
5332 set_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); in brcmf_cfg80211_start_ap()
5348 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_stop_ap()
5349 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; in brcmf_cfg80211_stop_ap()
5356 if (ifp->vif->wdev.iftype == NL80211_IFTYPE_AP) { in brcmf_cfg80211_stop_ap()
5361 if (profile->use_fwauth != BIT(BRCMF_PROFILE_FWAUTH_NONE)) { in brcmf_cfg80211_stop_ap()
5364 if (profile->use_fwauth & BIT(BRCMF_PROFILE_FWAUTH_PSK)) in brcmf_cfg80211_stop_ap()
5366 if (profile->use_fwauth & BIT(BRCMF_PROFILE_FWAUTH_SAE)) in brcmf_cfg80211_stop_ap()
5368 profile->use_fwauth = BIT(BRCMF_PROFILE_FWAUTH_NONE); in brcmf_cfg80211_stop_ap()
5371 if (ifp->vif->mbss) { in brcmf_cfg80211_stop_ap()
5377 if (ifp->bsscfgidx == 0) in brcmf_cfg80211_stop_ap()
5394 ifp->vif->is_11d); in brcmf_cfg80211_stop_ap()
5400 brcmf_vif_clear_mgmt_ies(ifp->vif); in brcmf_cfg80211_stop_ap()
5402 bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx); in brcmf_cfg80211_stop_ap()
5411 clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); in brcmf_cfg80211_stop_ap()
5425 return brcmf_config_ap_mgmt_ie(ifp->vif, &info->beacon); in brcmf_cfg80211_change_beacon()
5433 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_del_station()
5438 if (!params->mac) in brcmf_cfg80211_del_station()
5439 return -EFAULT; in brcmf_cfg80211_del_station()
5441 brcmf_dbg(TRACE, "Enter %pM\n", params->mac); in brcmf_cfg80211_del_station()
5443 if (ifp->vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif) in brcmf_cfg80211_del_station()
5444 ifp = cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp; in brcmf_cfg80211_del_station()
5445 if (!check_vif_up(ifp->vif)) in brcmf_cfg80211_del_station()
5446 return -EIO; in brcmf_cfg80211_del_station()
5448 memcpy(&scbval.ea, params->mac, ETH_ALEN); in brcmf_cfg80211_del_station()
5449 scbval.val = cpu_to_le32(params->reason_code); in brcmf_cfg80211_del_station()
5465 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_change_station()
5470 params->sta_flags_mask, params->sta_flags_set); in brcmf_cfg80211_change_station()
5476 if (!(params->sta_flags_mask & BIT(NL80211_STA_FLAG_AUTHORIZED))) in brcmf_cfg80211_change_station()
5479 if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) in brcmf_cfg80211_change_station()
5486 bphy_err(drvr, "Setting SCB (de-)authorize failed, %d\n", err); in brcmf_cfg80211_change_station()
5500 vif->mgmt_rx_reg = upd->interface_stypes; in brcmf_cfg80211_update_mgmt_frame_registrations()
5509 struct ieee80211_channel *chan = params->chan; in brcmf_cfg80211_mgmt_tx()
5510 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_mgmt_tx()
5511 const u8 *buf = params->buf; in brcmf_cfg80211_mgmt_tx()
5512 size_t len = params->len; in brcmf_cfg80211_mgmt_tx()
5530 if (!ieee80211_is_mgmt(mgmt->frame_control)) { in brcmf_cfg80211_mgmt_tx()
5532 return -EPERM; in brcmf_cfg80211_mgmt_tx()
5537 if (ieee80211_is_probe_resp(mgmt->frame_control)) { in brcmf_cfg80211_mgmt_tx()
5546 /* "DIRECT-". Note in future supplicant will take */ in brcmf_cfg80211_mgmt_tx()
5551 ie_len = len - ie_offset; in brcmf_cfg80211_mgmt_tx()
5552 if (vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY].vif) in brcmf_cfg80211_mgmt_tx()
5553 vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif; in brcmf_cfg80211_mgmt_tx()
5560 } else if (ieee80211_is_action(mgmt->frame_control)) { in brcmf_cfg80211_mgmt_tx()
5563 err = -EINVAL; in brcmf_cfg80211_mgmt_tx()
5569 err = -ENOMEM; in brcmf_cfg80211_mgmt_tx()
5572 action_frame = &af_params->action_frame; in brcmf_cfg80211_mgmt_tx()
5574 action_frame->packet_id = cpu_to_le32(*cookie); in brcmf_cfg80211_mgmt_tx()
5576 memcpy(&action_frame->da[0], &mgmt->da[0], ETH_ALEN); in brcmf_cfg80211_mgmt_tx()
5577 memcpy(&af_params->bssid[0], &mgmt->bssid[0], ETH_ALEN); in brcmf_cfg80211_mgmt_tx()
5579 action_frame->len = cpu_to_le16(len - DOT11_MGMT_HDR_LEN); in brcmf_cfg80211_mgmt_tx()
5581 * the current one (got from the firmware) otherwise in brcmf_cfg80211_mgmt_tx()
5584 freq = chan->center_freq; in brcmf_cfg80211_mgmt_tx()
5586 brcmf_fil_cmd_int_get(vif->ifp, BRCMF_C_GET_CHANNEL, in brcmf_cfg80211_mgmt_tx()
5589 af_params->channel = cpu_to_le32(chan_nr); in brcmf_cfg80211_mgmt_tx()
5590 af_params->dwell_time = cpu_to_le32(params->wait); in brcmf_cfg80211_mgmt_tx()
5591 memcpy(action_frame->data, &buf[DOT11_MGMT_HDR_LEN], in brcmf_cfg80211_mgmt_tx()
5592 le16_to_cpu(action_frame->len)); in brcmf_cfg80211_mgmt_tx()
5595 *cookie, le16_to_cpu(action_frame->len), freq); in brcmf_cfg80211_mgmt_tx()
5604 brcmf_dbg(TRACE, "Unhandled, fc=%04x!!\n", mgmt->frame_control); in brcmf_cfg80211_mgmt_tx()
5623 vif = ifp->vif; in brcmf_cfg80211_set_cqm_rssi_range_config()
5625 if (rssi_low != vif->cqm_rssi_low || rssi_high != vif->cqm_rssi_high) { in brcmf_cfg80211_set_cqm_rssi_range_config()
5626 /* The firmware will send an event when the RSSI is less than or in brcmf_cfg80211_set_cqm_rssi_range_config()
5636 clamp_val(rssi_low, S8_MIN, S8_MAX - 2), in brcmf_cfg80211_set_cqm_rssi_range_config()
5637 clamp_val(rssi_high, S8_MIN + 1, S8_MAX - 1), in brcmf_cfg80211_set_cqm_rssi_range_config()
5645 err = -EINVAL; in brcmf_cfg80211_set_cqm_rssi_range_config()
5647 vif->cqm_rssi_low = rssi_low; in brcmf_cfg80211_set_cqm_rssi_range_config()
5648 vif->cqm_rssi_high = rssi_high; in brcmf_cfg80211_set_cqm_rssi_range_config()
5661 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_cancel_remain_on_channel()
5667 vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif; in brcmf_cfg80211_cancel_remain_on_channel()
5670 err = -ENODEV; in brcmf_cfg80211_cancel_remain_on_channel()
5673 brcmf_p2p_cancel_remain_on_channel(vif->ifp); in brcmf_cfg80211_cancel_remain_on_channel()
5684 struct net_device *ndev = wdev->netdev; in brcmf_cfg80211_get_channel()
5685 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_get_channel()
5692 if (!ndev || drvr->bus_if->state != BRCMF_BUS_UP) in brcmf_cfg80211_get_channel()
5693 return -ENODEV; in brcmf_cfg80211_get_channel()
5702 cfg->d11inf.decchspec(&ch); in brcmf_cfg80211_get_channel()
5732 chandef->chan = ieee80211_get_channel(wiphy, freq); in brcmf_cfg80211_get_channel()
5733 chandef->width = width; in brcmf_cfg80211_get_channel()
5734 chandef->center_freq1 = ieee80211_channel_to_frequency(ch.chnum, band); in brcmf_cfg80211_get_channel()
5735 chandef->center_freq2 = 0; in brcmf_cfg80211_get_channel()
5752 return -EINVAL; in brcmf_cfg80211_crit_proto_start()
5755 set_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status); in brcmf_cfg80211_crit_proto_start()
5770 clear_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status); in brcmf_cfg80211_crit_proto_stop()
5777 switch (e->reason) { in brcmf_notify_tdls_peer_event()
5783 brcmf_proto_add_tdls_peer(ifp->drvr, ifp->ifidx, (u8 *)e->addr); in brcmf_notify_tdls_peer_event()
5787 brcmf_proto_delete_peer(ifp->drvr, ifp->ifidx, (u8 *)e->addr); in brcmf_notify_tdls_peer_event()
5810 ret = -EOPNOTSUPP; in brcmf_convert_nl80211_tdls_oper()
5820 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_tdls_oper()
5850 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_update_conn_params()
5858 err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG, in brcmf_cfg80211_update_conn_params()
5859 sme->ie, sme->ie_len); in brcmf_cfg80211_update_conn_params()
5874 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_set_rekey_data()
5879 brcmf_dbg(TRACE, "Enter, bssidx=%d\n", ifp->bsscfgidx); in brcmf_cfg80211_set_rekey_data()
5881 memcpy(gtk_le.kck, gtk->kck, sizeof(gtk_le.kck)); in brcmf_cfg80211_set_rekey_data()
5882 memcpy(gtk_le.kek, gtk->kek, sizeof(gtk_le.kek)); in brcmf_cfg80211_set_rekey_data()
5883 memcpy(gtk_le.replay_counter, gtk->replay_ctr, in brcmf_cfg80211_set_rekey_data()
5902 /* expect using firmware supplicant for 1X */ in brcmf_cfg80211_set_pmk()
5904 if (WARN_ON(ifp->vif->profile.use_fwsup != BRCMF_PROFILE_FWSUP_1X)) in brcmf_cfg80211_set_pmk()
5905 return -EINVAL; in brcmf_cfg80211_set_pmk()
5907 if (conf->pmk_len > BRCMF_WSEC_MAX_PSK_LEN) in brcmf_cfg80211_set_pmk()
5908 return -ERANGE; in brcmf_cfg80211_set_pmk()
5910 return brcmf_set_pmk(ifp, conf->pmk, conf->pmk_len); in brcmf_cfg80211_set_pmk()
5920 if (WARN_ON(ifp->vif->profile.use_fwsup != BRCMF_PROFILE_FWSUP_1X)) in brcmf_cfg80211_del_pmk()
5921 return -EINVAL; in brcmf_cfg80211_del_pmk()
5982 if (ops && settings->roamoff) in brcmf_cfg80211_get_ops()
5983 ops->update_connect_params = NULL; in brcmf_cfg80211_get_ops()
5994 struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); in brcmf_alloc_vif()
6000 return ERR_PTR(-ENOMEM); in brcmf_alloc_vif()
6002 vif->wdev.wiphy = cfg->wiphy; in brcmf_alloc_vif()
6003 vif->wdev.iftype = type; in brcmf_alloc_vif()
6005 brcmf_init_prof(&vif->profile); in brcmf_alloc_vif()
6010 list_for_each_entry(vif_walk, &cfg->vif_list, list) { in brcmf_alloc_vif()
6011 if (vif_walk->wdev.iftype == NL80211_IFTYPE_AP) { in brcmf_alloc_vif()
6016 vif->mbss = mbss; in brcmf_alloc_vif()
6019 list_add_tail(&vif->list, &cfg->vif_list); in brcmf_alloc_vif()
6025 list_del(&vif->list); in brcmf_free_vif()
6035 vif = ifp->vif; in brcmf_cfg80211_free_netdev()
6044 u32 event = e->event_code; in brcmf_is_linkup()
6045 u32 status = e->status; in brcmf_is_linkup()
6047 if ((vif->profile.use_fwsup == BRCMF_PROFILE_FWSUP_PSK || in brcmf_is_linkup()
6048 vif->profile.use_fwsup == BRCMF_PROFILE_FWSUP_SAE) && in brcmf_is_linkup()
6051 set_bit(BRCMF_VIF_STATUS_EAP_SUCCESS, &vif->sme_state); in brcmf_is_linkup()
6054 memcpy(vif->profile.bssid, e->addr, ETH_ALEN); in brcmf_is_linkup()
6055 if (vif->profile.use_fwsup != BRCMF_PROFILE_FWSUP_PSK && in brcmf_is_linkup()
6056 vif->profile.use_fwsup != BRCMF_PROFILE_FWSUP_SAE) in brcmf_is_linkup()
6059 set_bit(BRCMF_VIF_STATUS_ASSOC_SUCCESS, &vif->sme_state); in brcmf_is_linkup()
6062 if (test_bit(BRCMF_VIF_STATUS_EAP_SUCCESS, &vif->sme_state) && in brcmf_is_linkup()
6063 test_bit(BRCMF_VIF_STATUS_ASSOC_SUCCESS, &vif->sme_state)) { in brcmf_is_linkup()
6064 clear_bit(BRCMF_VIF_STATUS_EAP_SUCCESS, &vif->sme_state); in brcmf_is_linkup()
6065 clear_bit(BRCMF_VIF_STATUS_ASSOC_SUCCESS, &vif->sme_state); in brcmf_is_linkup()
6074 u32 event = e->event_code; in brcmf_is_linkdown()
6075 u16 flags = e->flags; in brcmf_is_linkdown()
6081 clear_bit(BRCMF_VIF_STATUS_EAP_SUCCESS, &vif->sme_state); in brcmf_is_linkdown()
6082 clear_bit(BRCMF_VIF_STATUS_ASSOC_SUCCESS, &vif->sme_state); in brcmf_is_linkdown()
6091 u32 event = e->event_code; in brcmf_is_nonetwork()
6092 u32 status = e->status; in brcmf_is_nonetwork()
6096 e->flags & BRCMF_EVENT_MSG_LINK ? "up" : "down"); in brcmf_is_nonetwork()
6119 kfree(conn_info->req_ie); in brcmf_clear_assoc_ies()
6120 conn_info->req_ie = NULL; in brcmf_clear_assoc_ies()
6121 conn_info->req_ie_len = 0; in brcmf_clear_assoc_ies()
6122 kfree(conn_info->resp_ie); in brcmf_clear_assoc_ies()
6123 conn_info->resp_ie = NULL; in brcmf_clear_assoc_ies()
6124 conn_info->resp_ie_len = 0; in brcmf_clear_assoc_ies()
6135 /* For those AC(s) with ACM flag set to 1, convert its 4-level priority in brcmf_map_prio_to_prec()
6136 * to an 8-level precedence which is the same as BE's in brcmf_map_prio_to_prec()
6139 cfg->ac_priority[prio] == cfg->ac_priority[PRIO_8021D_BE]) in brcmf_map_prio_to_prec()
6140 return cfg->ac_priority[prio] * 2; in brcmf_map_prio_to_prec()
6142 /* Conversion of 4-level priority to 8-level precedence */ in brcmf_map_prio_to_prec()
6145 return cfg->ac_priority[prio] * 2; in brcmf_map_prio_to_prec()
6147 return cfg->ac_priority[prio] * 2 + 1; in brcmf_map_prio_to_prec()
6159 return cfg->ac_priority[prio]; in brcmf_map_prio_to_aci()
6196 aifsn = acp->ACI & EDCF_AIFSN_MASK; in brcmf_wifi_prioritize_acparams()
6197 acm = (acp->ACI & EDCF_ACM_MASK) ? 1 : 0; in brcmf_wifi_prioritize_acparams()
6198 ecwmin = acp->ECW & EDCF_ECWMIN_MASK; in brcmf_wifi_prioritize_acparams()
6199 ecwmax = (acp->ECW & EDCF_ECWMAX_MASK) >> EDCF_ECWMAX_SHIFT; in brcmf_wifi_prioritize_acparams()
6258 brcmf_dbg(CONN, "Adj prio BE 0->%d, BK 1->%d, BK 2->%d, BE 3->%d\n", in brcmf_wifi_prioritize_acparams()
6261 brcmf_dbg(CONN, "Adj prio VI 4->%d, VI 5->%d, VO 6->%d, VO 7->%d\n", in brcmf_wifi_prioritize_acparams()
6268 struct brcmf_pub *drvr = cfg->pub; in brcmf_get_assoc_ies()
6279 cfg->extra_buf, WL_ASSOC_INFO_MAX); in brcmf_get_assoc_ies()
6285 (struct brcmf_cfg80211_assoc_ielen_le *)cfg->extra_buf; in brcmf_get_assoc_ies()
6286 req_len = le32_to_cpu(assoc_info->req_len); in brcmf_get_assoc_ies()
6287 resp_len = le32_to_cpu(assoc_info->resp_len); in brcmf_get_assoc_ies()
6291 return -EINVAL; in brcmf_get_assoc_ies()
6295 cfg->extra_buf, in brcmf_get_assoc_ies()
6301 conn_info->req_ie_len = req_len; in brcmf_get_assoc_ies()
6302 conn_info->req_ie = in brcmf_get_assoc_ies()
6303 kmemdup(cfg->extra_buf, conn_info->req_ie_len, in brcmf_get_assoc_ies()
6305 if (!conn_info->req_ie) in brcmf_get_assoc_ies()
6306 conn_info->req_ie_len = 0; in brcmf_get_assoc_ies()
6308 conn_info->req_ie_len = 0; in brcmf_get_assoc_ies()
6309 conn_info->req_ie = NULL; in brcmf_get_assoc_ies()
6313 cfg->extra_buf, in brcmf_get_assoc_ies()
6319 conn_info->resp_ie_len = resp_len; in brcmf_get_assoc_ies()
6320 conn_info->resp_ie = in brcmf_get_assoc_ies()
6321 kmemdup(cfg->extra_buf, conn_info->resp_ie_len, in brcmf_get_assoc_ies()
6323 if (!conn_info->resp_ie) in brcmf_get_assoc_ies()
6324 conn_info->resp_ie_len = 0; in brcmf_get_assoc_ies()
6335 cfg->ac_priority); in brcmf_get_assoc_ies()
6337 conn_info->resp_ie_len = 0; in brcmf_get_assoc_ies()
6338 conn_info->resp_ie = NULL; in brcmf_get_assoc_ies()
6341 conn_info->req_ie_len, conn_info->resp_ie_len); in brcmf_get_assoc_ies()
6352 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; in brcmf_bss_roaming_done()
6367 memcpy(profile->bssid, e->addr, ETH_ALEN); in brcmf_bss_roaming_done()
6372 err = -ENOMEM; in brcmf_bss_roaming_done()
6385 ch.chspec = le16_to_cpu(bi->chanspec); in brcmf_bss_roaming_done()
6386 cfg->d11inf.decchspec(&ch); in brcmf_bss_roaming_done()
6389 band = wiphy->bands[NL80211_BAND_2GHZ]; in brcmf_bss_roaming_done()
6391 band = wiphy->bands[NL80211_BAND_5GHZ]; in brcmf_bss_roaming_done()
6393 freq = ieee80211_channel_to_frequency(ch.control_ch_num, band->band); in brcmf_bss_roaming_done()
6400 roam_info.links[0].bssid = profile->bssid; in brcmf_bss_roaming_done()
6401 roam_info.req_ie = conn_info->req_ie; in brcmf_bss_roaming_done()
6402 roam_info.req_ie_len = conn_info->req_ie_len; in brcmf_bss_roaming_done()
6403 roam_info.resp_ie = conn_info->resp_ie; in brcmf_bss_roaming_done()
6404 roam_info.resp_ie_len = conn_info->resp_ie_len; in brcmf_bss_roaming_done()
6409 if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_1X && profile->is_ft) { in brcmf_bss_roaming_done()
6410 cfg80211_port_authorized(ndev, profile->bssid, NULL, 0, GFP_KERNEL); in brcmf_bss_roaming_done()
6414 set_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state); in brcmf_bss_roaming_done()
6425 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; in brcmf_bss_connect_done()
6432 &ifp->vif->sme_state)) { in brcmf_bss_connect_done()
6438 &ifp->vif->sme_state); in brcmf_bss_connect_done()
6442 &ifp->vif->sme_state); in brcmf_bss_connect_done()
6444 &ifp->vif->sme_state); in brcmf_bss_connect_done()
6447 conn_params.links[0].bssid = profile->bssid; in brcmf_bss_connect_done()
6448 conn_params.req_ie = conn_info->req_ie; in brcmf_bss_connect_done()
6449 conn_params.req_ie_len = conn_info->req_ie_len; in brcmf_bss_connect_done()
6450 conn_params.resp_ie = conn_info->resp_ie; in brcmf_bss_connect_done()
6451 conn_params.resp_ie_len = conn_info->resp_ie_len; in brcmf_bss_connect_done()
6453 brcmf_dbg(CONN, "Report connect result - connection %s\n", in brcmf_bss_connect_done()
6465 struct brcmf_pub *drvr = cfg->pub; in brcmf_notify_connect_status_ap()
6467 u32 event = e->event_code; in brcmf_notify_connect_status_ap()
6468 u32 reason = e->reason; in brcmf_notify_connect_status_ap()
6476 complete(&cfg->vif_disabled); in brcmf_notify_connect_status_ap()
6484 return -EINVAL; in brcmf_notify_connect_status_ap()
6489 return -ENOMEM; in brcmf_notify_connect_status_ap()
6491 sinfo->assoc_req_ies = data; in brcmf_notify_connect_status_ap()
6492 sinfo->assoc_req_ies_len = e->datalen; in brcmf_notify_connect_status_ap()
6494 sinfo->generation = generation; in brcmf_notify_connect_status_ap()
6495 cfg80211_new_sta(ndev, e->addr, sinfo, GFP_KERNEL); in brcmf_notify_connect_status_ap()
6501 cfg80211_del_sta(ndev, e->addr, GFP_KERNEL); in brcmf_notify_connect_status_ap()
6510 struct brcmf_cfg80211_info *cfg = ifp->drvr->config; in brcmf_notify_connect_status()
6511 struct net_device *ndev = ifp->ndev; in brcmf_notify_connect_status()
6512 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; in brcmf_notify_connect_status()
6516 if ((e->event_code == BRCMF_E_DEAUTH) || in brcmf_notify_connect_status()
6517 (e->event_code == BRCMF_E_DEAUTH_IND) || in brcmf_notify_connect_status()
6518 (e->event_code == BRCMF_E_DISASSOC_IND) || in brcmf_notify_connect_status()
6519 ((e->event_code == BRCMF_E_LINK) && (!e->flags))) { in brcmf_notify_connect_status()
6520 brcmf_proto_delete_peer(ifp->drvr, ifp->ifidx, (u8 *)e->addr); in brcmf_notify_connect_status()
6523 if (brcmf_is_apmode(ifp->vif)) { in brcmf_notify_connect_status()
6525 } else if (brcmf_is_linkup(ifp->vif, e)) { in brcmf_notify_connect_status()
6527 if (brcmf_is_ibssmode(ifp->vif)) { in brcmf_notify_connect_status()
6528 brcmf_inform_ibss(cfg, ndev, e->addr); in brcmf_notify_connect_status()
6529 chan = ieee80211_get_channel(cfg->wiphy, cfg->channel); in brcmf_notify_connect_status()
6530 memcpy(profile->bssid, e->addr, ETH_ALEN); in brcmf_notify_connect_status()
6531 cfg80211_ibss_joined(ndev, e->addr, chan, GFP_KERNEL); in brcmf_notify_connect_status()
6533 &ifp->vif->sme_state); in brcmf_notify_connect_status()
6535 &ifp->vif->sme_state); in brcmf_notify_connect_status()
6539 } else if (brcmf_is_linkdown(ifp->vif, e)) { in brcmf_notify_connect_status()
6541 if (!brcmf_is_ibssmode(ifp->vif) && in brcmf_notify_connect_status()
6543 &ifp->vif->sme_state) || in brcmf_notify_connect_status()
6545 &ifp->vif->sme_state))) { in brcmf_notify_connect_status()
6547 &ifp->vif->sme_state) && in brcmf_notify_connect_status()
6548 memcmp(profile->bssid, e->addr, ETH_ALEN)) in brcmf_notify_connect_status()
6552 brcmf_link_down(ifp->vif, in brcmf_notify_connect_status()
6554 e->event_code & in brcmf_notify_connect_status()
6560 complete(&cfg->vif_disabled); in brcmf_notify_connect_status()
6564 if (brcmf_is_ibssmode(ifp->vif)) in brcmf_notify_connect_status()
6566 &ifp->vif->sme_state); in brcmf_notify_connect_status()
6578 struct brcmf_cfg80211_info *cfg = ifp->drvr->config; in brcmf_notify_roaming_status()
6579 u32 event = e->event_code; in brcmf_notify_roaming_status()
6580 u32 status = e->status; in brcmf_notify_roaming_status()
6584 &ifp->vif->sme_state)) { in brcmf_notify_roaming_status()
6585 brcmf_bss_roaming_done(cfg, ifp->ndev, e); in brcmf_notify_roaming_status()
6587 brcmf_bss_connect_done(cfg, ifp->ndev, e, true); in brcmf_notify_roaming_status()
6599 u16 flags = e->flags; in brcmf_notify_mic_status()
6607 cfg80211_michael_mic_failure(ifp->ndev, (u8 *)&e->addr, key_type, -1, in brcmf_notify_mic_status()
6616 struct brcmf_cfg80211_vif *vif = ifp->vif; in brcmf_notify_rssi()
6621 if (e->datalen >= sizeof(*info)) { in brcmf_notify_rssi()
6622 rssi = be32_to_cpu(info->rssi); in brcmf_notify_rssi()
6623 snr = be32_to_cpu(info->snr); in brcmf_notify_rssi()
6624 noise = be32_to_cpu(info->noise); in brcmf_notify_rssi()
6625 } else if (e->datalen >= sizeof(rssi)) { in brcmf_notify_rssi()
6632 low = vif->cqm_rssi_low; in brcmf_notify_rssi()
6633 high = vif->cqm_rssi_high; in brcmf_notify_rssi()
6634 last = vif->cqm_rssi_last; in brcmf_notify_rssi()
6639 vif->cqm_rssi_last = rssi; in brcmf_notify_rssi()
6643 cfg80211_cqm_rssi_notify(ifp->ndev, in brcmf_notify_rssi()
6648 cfg80211_cqm_rssi_notify(ifp->ndev, in brcmf_notify_rssi()
6659 struct brcmf_cfg80211_info *cfg = ifp->drvr->config; in brcmf_notify_vif_event()
6661 struct brcmf_cfg80211_vif_event *event = &cfg->vif_event; in brcmf_notify_vif_event()
6665 ifevent->action, ifevent->flags, ifevent->ifidx, in brcmf_notify_vif_event()
6666 ifevent->bsscfgidx); in brcmf_notify_vif_event()
6668 spin_lock(&event->vif_event_lock); in brcmf_notify_vif_event()
6669 event->action = ifevent->action; in brcmf_notify_vif_event()
6670 vif = event->vif; in brcmf_notify_vif_event()
6672 switch (ifevent->action) { in brcmf_notify_vif_event()
6675 if (!cfg->vif_event.vif) { in brcmf_notify_vif_event()
6676 spin_unlock(&event->vif_event_lock); in brcmf_notify_vif_event()
6677 return -EBADF; in brcmf_notify_vif_event()
6680 ifp->vif = vif; in brcmf_notify_vif_event()
6681 vif->ifp = ifp; in brcmf_notify_vif_event()
6682 if (ifp->ndev) { in brcmf_notify_vif_event()
6683 vif->wdev.netdev = ifp->ndev; in brcmf_notify_vif_event()
6684 ifp->ndev->ieee80211_ptr = &vif->wdev; in brcmf_notify_vif_event()
6685 SET_NETDEV_DEV(ifp->ndev, wiphy_dev(cfg->wiphy)); in brcmf_notify_vif_event()
6687 spin_unlock(&event->vif_event_lock); in brcmf_notify_vif_event()
6688 wake_up(&event->vif_wq); in brcmf_notify_vif_event()
6692 spin_unlock(&event->vif_event_lock); in brcmf_notify_vif_event()
6695 wake_up(&event->vif_wq); in brcmf_notify_vif_event()
6699 spin_unlock(&event->vif_event_lock); in brcmf_notify_vif_event()
6700 wake_up(&event->vif_wq); in brcmf_notify_vif_event()
6704 spin_unlock(&event->vif_event_lock); in brcmf_notify_vif_event()
6707 return -EINVAL; in brcmf_notify_vif_event()
6712 conf->frag_threshold = (u32)-1; in brcmf_init_conf()
6713 conf->rts_threshold = (u32)-1; in brcmf_init_conf()
6714 conf->retry_short = (u32)-1; in brcmf_init_conf()
6715 conf->retry_long = (u32)-1; in brcmf_init_conf()
6720 brcmf_fweh_register(cfg->pub, BRCMF_E_LINK, in brcmf_register_event_handlers()
6722 brcmf_fweh_register(cfg->pub, BRCMF_E_DEAUTH_IND, in brcmf_register_event_handlers()
6724 brcmf_fweh_register(cfg->pub, BRCMF_E_DEAUTH, in brcmf_register_event_handlers()
6726 brcmf_fweh_register(cfg->pub, BRCMF_E_DISASSOC_IND, in brcmf_register_event_handlers()
6728 brcmf_fweh_register(cfg->pub, BRCMF_E_ASSOC_IND, in brcmf_register_event_handlers()
6730 brcmf_fweh_register(cfg->pub, BRCMF_E_REASSOC_IND, in brcmf_register_event_handlers()
6732 brcmf_fweh_register(cfg->pub, BRCMF_E_ROAM, in brcmf_register_event_handlers()
6734 brcmf_fweh_register(cfg->pub, BRCMF_E_MIC_ERROR, in brcmf_register_event_handlers()
6736 brcmf_fweh_register(cfg->pub, BRCMF_E_SET_SSID, in brcmf_register_event_handlers()
6738 brcmf_fweh_register(cfg->pub, BRCMF_E_PFN_NET_FOUND, in brcmf_register_event_handlers()
6740 brcmf_fweh_register(cfg->pub, BRCMF_E_IF, in brcmf_register_event_handlers()
6742 brcmf_fweh_register(cfg->pub, BRCMF_E_P2P_PROBEREQ_MSG, in brcmf_register_event_handlers()
6744 brcmf_fweh_register(cfg->pub, BRCMF_E_P2P_DISC_LISTEN_COMPLETE, in brcmf_register_event_handlers()
6746 brcmf_fweh_register(cfg->pub, BRCMF_E_ACTION_FRAME_RX, in brcmf_register_event_handlers()
6748 brcmf_fweh_register(cfg->pub, BRCMF_E_ACTION_FRAME_COMPLETE, in brcmf_register_event_handlers()
6750 brcmf_fweh_register(cfg->pub, BRCMF_E_ACTION_FRAME_OFF_CHAN_COMPLETE, in brcmf_register_event_handlers()
6752 brcmf_fweh_register(cfg->pub, BRCMF_E_PSK_SUP, in brcmf_register_event_handlers()
6754 brcmf_fweh_register(cfg->pub, BRCMF_E_RSSI, brcmf_notify_rssi); in brcmf_register_event_handlers()
6759 kfree(cfg->conf); in brcmf_deinit_priv_mem()
6760 cfg->conf = NULL; in brcmf_deinit_priv_mem()
6761 kfree(cfg->extra_buf); in brcmf_deinit_priv_mem()
6762 cfg->extra_buf = NULL; in brcmf_deinit_priv_mem()
6763 kfree(cfg->wowl.nd); in brcmf_deinit_priv_mem()
6764 cfg->wowl.nd = NULL; in brcmf_deinit_priv_mem()
6765 kfree(cfg->wowl.nd_info); in brcmf_deinit_priv_mem()
6766 cfg->wowl.nd_info = NULL; in brcmf_deinit_priv_mem()
6767 kfree(cfg->escan_info.escan_buf); in brcmf_deinit_priv_mem()
6768 cfg->escan_info.escan_buf = NULL; in brcmf_deinit_priv_mem()
6773 cfg->conf = kzalloc(sizeof(*cfg->conf), GFP_KERNEL); in brcmf_init_priv_mem()
6774 if (!cfg->conf) in brcmf_init_priv_mem()
6776 cfg->extra_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL); in brcmf_init_priv_mem()
6777 if (!cfg->extra_buf) in brcmf_init_priv_mem()
6779 cfg->wowl.nd = kzalloc(sizeof(*cfg->wowl.nd) + sizeof(u32), GFP_KERNEL); in brcmf_init_priv_mem()
6780 if (!cfg->wowl.nd) in brcmf_init_priv_mem()
6782 cfg->wowl.nd_info = kzalloc(sizeof(*cfg->wowl.nd_info) + in brcmf_init_priv_mem()
6785 if (!cfg->wowl.nd_info) in brcmf_init_priv_mem()
6787 cfg->escan_info.escan_buf = kzalloc(BRCMF_ESCAN_BUF_SIZE, GFP_KERNEL); in brcmf_init_priv_mem()
6788 if (!cfg->escan_info.escan_buf) in brcmf_init_priv_mem()
6796 return -ENOMEM; in brcmf_init_priv_mem()
6803 cfg->scan_request = NULL; in wl_init_priv()
6804 cfg->pwr_save = true; in wl_init_priv()
6805 cfg->dongle_up = false; /* dongle is not up yet */ in wl_init_priv()
6810 mutex_init(&cfg->usr_sync); in wl_init_priv()
6812 brcmf_init_conf(cfg->conf); in wl_init_priv()
6813 brcmf_init_wmm_prio(cfg->ac_priority); in wl_init_priv()
6814 init_completion(&cfg->vif_disabled); in wl_init_priv()
6820 cfg->dongle_up = false; /* dongle down */ in wl_deinit_priv()
6828 init_waitqueue_head(&event->vif_wq); in init_vif_event()
6829 spin_lock_init(&event->vif_event_lock); in init_vif_event()
6834 struct brcmf_pub *drvr = ifp->drvr; in brcmf_dongle_roam()
6841 if (ifp->drvr->settings->roamoff) in brcmf_dongle_roam()
6851 /* Enable/Disable built-in roaming to allow supplicant to take care of in brcmf_dongle_roam()
6855 ifp->drvr->settings->roamoff ? "Off" : "On"); in brcmf_dongle_roam()
6857 ifp->drvr->settings->roamoff); in brcmf_dongle_roam()
6886 struct brcmf_pub *drvr = ifp->drvr; in brcmf_dongle_scantime()
6918 ht40_flag = channel->flags & IEEE80211_CHAN_NO_HT40; in brcmf_update_bw40_channel_flag()
6919 if (ch->sb == BRCMU_CHAN_SB_U) { in brcmf_update_bw40_channel_flag()
6921 channel->flags &= ~IEEE80211_CHAN_NO_HT40; in brcmf_update_bw40_channel_flag()
6922 channel->flags |= IEEE80211_CHAN_NO_HT40PLUS; in brcmf_update_bw40_channel_flag()
6928 channel->flags &= ~IEEE80211_CHAN_NO_HT40; in brcmf_update_bw40_channel_flag()
6930 channel->flags |= IEEE80211_CHAN_NO_HT40MINUS; in brcmf_update_bw40_channel_flag()
6938 struct brcmf_pub *drvr = cfg->pub; in brcmf_construct_chaninfo()
6953 return -ENOMEM; in brcmf_construct_chaninfo()
6964 band = wiphy->bands[NL80211_BAND_2GHZ]; in brcmf_construct_chaninfo()
6966 for (i = 0; i < band->n_channels; i++) in brcmf_construct_chaninfo()
6967 band->channels[i].flags = IEEE80211_CHAN_DISABLED; in brcmf_construct_chaninfo()
6968 band = wiphy->bands[NL80211_BAND_5GHZ]; in brcmf_construct_chaninfo()
6970 for (i = 0; i < band->n_channels; i++) in brcmf_construct_chaninfo()
6971 band->channels[i].flags = IEEE80211_CHAN_DISABLED; in brcmf_construct_chaninfo()
6973 total = le32_to_cpu(list->count); in brcmf_construct_chaninfo()
6977 err = -EINVAL; in brcmf_construct_chaninfo()
6982 ch.chspec = (u16)le32_to_cpu(list->element[i]); in brcmf_construct_chaninfo()
6983 cfg->d11inf.decchspec(&ch); in brcmf_construct_chaninfo()
6986 band = wiphy->bands[NL80211_BAND_2GHZ]; in brcmf_construct_chaninfo()
6988 band = wiphy->bands[NL80211_BAND_5GHZ]; in brcmf_construct_chaninfo()
6996 if (!(bw_cap[band->band] & WLC_BW_40MHZ_BIT) && in brcmf_construct_chaninfo()
6999 if (!(bw_cap[band->band] & WLC_BW_80MHZ_BIT) && in brcmf_construct_chaninfo()
7004 for (j = 0; j < band->n_channels; j++) { in brcmf_construct_chaninfo()
7005 if (band->channels[j].hw_value == ch.control_ch_num) { in brcmf_construct_chaninfo()
7006 channel = &band->channels[j]; in brcmf_construct_chaninfo()
7011 /* It seems firmware supports some channel we never in brcmf_construct_chaninfo()
7014 bphy_err(drvr, "Ignoring unexpected firmware channel %d\n", in brcmf_construct_chaninfo()
7019 if (channel->orig_flags & IEEE80211_CHAN_DISABLED) in brcmf_construct_chaninfo()
7027 channel->flags &= ~IEEE80211_CHAN_NO_160MHZ; in brcmf_construct_chaninfo()
7030 channel->flags &= ~IEEE80211_CHAN_NO_80MHZ; in brcmf_construct_chaninfo()
7036 wiphy_warn(wiphy, "Firmware reported unsupported bandwidth %d\n", in brcmf_construct_chaninfo()
7044 channel->flags = IEEE80211_CHAN_NO_HT40 | in brcmf_construct_chaninfo()
7048 cfg->d11inf.encchspec(&ch); in brcmf_construct_chaninfo()
7054 channel->flags |= in brcmf_construct_chaninfo()
7058 channel->flags |= in brcmf_construct_chaninfo()
7071 struct brcmf_pub *drvr = cfg->pub; in brcmf_enable_bw40_2g()
7104 return -ENOMEM; in brcmf_enable_bw40_2g()
7110 cfg->d11inf.encchspec(&ch); in brcmf_enable_bw40_2g()
7123 band = cfg_to_wiphy(cfg)->bands[NL80211_BAND_2GHZ]; in brcmf_enable_bw40_2g()
7125 num_chan = le32_to_cpu(list->count); in brcmf_enable_bw40_2g()
7130 return -EINVAL; in brcmf_enable_bw40_2g()
7134 ch.chspec = (u16)le32_to_cpu(list->element[i]); in brcmf_enable_bw40_2g()
7135 cfg->d11inf.decchspec(&ch); in brcmf_enable_bw40_2g()
7140 for (j = 0; j < band->n_channels; j++) { in brcmf_enable_bw40_2g()
7141 if (band->channels[j].hw_value == ch.control_ch_num) in brcmf_enable_bw40_2g()
7144 if (WARN_ON(j == band->n_channels)) in brcmf_enable_bw40_2g()
7147 brcmf_update_bw40_channel_flag(&band->channels[j], &ch); in brcmf_enable_bw40_2g()
7156 struct brcmf_pub *drvr = ifp->drvr; in brcmf_get_bwcap()
7176 /* assume 20MHz if firmware does not give a clue */ in brcmf_get_bwcap()
7198 band->ht_cap.ht_supported = true; in brcmf_update_ht_cap()
7199 if (bw_cap[band->band] & WLC_BW_40MHZ_BIT) { in brcmf_update_ht_cap()
7200 band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40; in brcmf_update_ht_cap()
7201 band->ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; in brcmf_update_ht_cap()
7203 band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_20; in brcmf_update_ht_cap()
7204 band->ht_cap.cap |= IEEE80211_HT_CAP_DSSSCCK40; in brcmf_update_ht_cap()
7205 band->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K; in brcmf_update_ht_cap()
7206 band->ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16; in brcmf_update_ht_cap()
7207 memset(band->ht_cap.mcs.rx_mask, 0xff, nchain); in brcmf_update_ht_cap()
7208 band->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; in brcmf_update_ht_cap()
7229 if (band->band == NL80211_BAND_2GHZ) in brcmf_update_vht_cap()
7232 band->vht_cap.vht_supported = true; in brcmf_update_vht_cap()
7234 band->vht_cap.cap |= IEEE80211_VHT_CAP_SHORT_GI_80; in brcmf_update_vht_cap()
7235 if (bw_cap[band->band] & WLC_BW_160MHZ_BIT) { in brcmf_update_vht_cap()
7236 band->vht_cap.cap |= IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; in brcmf_update_vht_cap()
7237 band->vht_cap.cap |= IEEE80211_VHT_CAP_SHORT_GI_160; in brcmf_update_vht_cap()
7239 /* all support 256-QAM */ in brcmf_update_vht_cap()
7241 band->vht_cap.vht_mcs.rx_mcs_map = mcs_map; in brcmf_update_vht_cap()
7242 band->vht_cap.vht_mcs.tx_mcs_map = mcs_map; in brcmf_update_vht_cap()
7246 band->vht_cap.cap |= IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE; in brcmf_update_vht_cap()
7248 band->vht_cap.cap |= IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE; in brcmf_update_vht_cap()
7250 band->vht_cap.cap |= IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE; in brcmf_update_vht_cap()
7252 band->vht_cap.cap |= IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE; in brcmf_update_vht_cap()
7255 band->vht_cap.cap |= in brcmf_update_vht_cap()
7257 band->vht_cap.cap |= ((txstreams - 1) << in brcmf_update_vht_cap()
7259 band->vht_cap.cap |= in brcmf_update_vht_cap()
7266 struct brcmf_pub *drvr = cfg->pub; in brcmf_setup_wiphybands()
7294 /* rxchain unsupported by firmware of older chips */ in brcmf_setup_wiphybands()
7295 if (err == -EBADE) in brcmf_setup_wiphybands()
7303 rxchain = rxchain & (rxchain - 1); in brcmf_setup_wiphybands()
7321 for (i = 0; i < ARRAY_SIZE(wiphy->bands); i++) { in brcmf_setup_wiphybands()
7322 band = wiphy->bands[i]; in brcmf_setup_wiphybands()
7376 * brcmf_setup_ifmodes() - determine interface modes and combinations.
7382 * based on firmware functionality.
7398 * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 1, 3 total
7399 * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
7404 * #STA <= 2, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 2, 3 total
7405 * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
7409 * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 2, AP <= 2,
7432 wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | in brcmf_setup_ifmodes()
7436 wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR); in brcmf_setup_ifmodes()
7438 wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) | in brcmf_setup_ifmodes()
7522 wiphy->n_iface_combinations = n_combos; in brcmf_setup_ifmodes()
7523 wiphy->iface_combinations = combo; in brcmf_setup_ifmodes()
7531 return -ENOMEM; in brcmf_setup_ifmodes()
7548 struct brcmf_pub *drvr = cfg->pub; in brcmf_wiphy_wowl_params()
7555 wiphy->wowlan = &brcmf_wowlan_support; in brcmf_wiphy_wowl_params()
7561 wowl->flags |= WIPHY_WOWLAN_NET_DETECT; in brcmf_wiphy_wowl_params()
7562 wowl->max_nd_match_sets = BRCMF_PNO_MAX_PFN_COUNT; in brcmf_wiphy_wowl_params()
7563 init_waitqueue_head(&cfg->wowl.nd_data_wait); in brcmf_wiphy_wowl_params()
7567 wowl->flags |= WIPHY_WOWLAN_SUPPORTS_GTK_REKEY; in brcmf_wiphy_wowl_params()
7568 wowl->flags |= WIPHY_WOWLAN_GTK_REKEY_FAILURE; in brcmf_wiphy_wowl_params()
7571 wiphy->wowlan = wowl; in brcmf_wiphy_wowl_params()
7577 struct brcmf_pub *drvr = ifp->drvr; in brcmf_setup_wiphy()
7586 wiphy->max_scan_ssids = WL_NUM_SCAN_MAX; in brcmf_setup_wiphy()
7587 wiphy->max_scan_ie_len = BRCMF_SCAN_IE_LEN_MAX; in brcmf_setup_wiphy()
7588 wiphy->max_num_pmkids = BRCMF_MAXPMKID; in brcmf_setup_wiphy()
7594 for (i = 0, combo = wiphy->iface_combinations; in brcmf_setup_wiphy()
7595 i < wiphy->n_iface_combinations; i++, combo++) { in brcmf_setup_wiphy()
7596 max_interfaces = max(max_interfaces, combo->max_interfaces); in brcmf_setup_wiphy()
7599 for (i = 0; i < max_interfaces && i < ARRAY_SIZE(drvr->addresses); in brcmf_setup_wiphy()
7601 u8 *addr = drvr->addresses[i].addr; in brcmf_setup_wiphy()
7603 memcpy(addr, drvr->mac, ETH_ALEN); in brcmf_setup_wiphy()
7606 addr[ETH_ALEN - 1] ^= i; in brcmf_setup_wiphy()
7609 wiphy->addresses = drvr->addresses; in brcmf_setup_wiphy()
7610 wiphy->n_addresses = i; in brcmf_setup_wiphy()
7612 wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; in brcmf_setup_wiphy()
7613 wiphy->cipher_suites = brcmf_cipher_suites; in brcmf_setup_wiphy()
7614 wiphy->n_cipher_suites = ARRAY_SIZE(brcmf_cipher_suites); in brcmf_setup_wiphy()
7616 wiphy->n_cipher_suites--; in brcmf_setup_wiphy()
7617 wiphy->bss_select_support = BIT(NL80211_BSS_SELECT_ATTR_RSSI) | in brcmf_setup_wiphy()
7621 wiphy->flags |= WIPHY_FLAG_NETNS_OK | in brcmf_setup_wiphy()
7627 wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS; in brcmf_setup_wiphy()
7628 if (!ifp->drvr->settings->roamoff) in brcmf_setup_wiphy()
7629 wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; in brcmf_setup_wiphy()
7646 wiphy->mgmt_stypes = brcmf_txrx_stypes; in brcmf_setup_wiphy()
7647 wiphy->max_remain_on_channel_duration = 5000; in brcmf_setup_wiphy()
7653 wiphy->vendor_commands = brcmf_vendor_cmds; in brcmf_setup_wiphy()
7654 wiphy->n_vendor_commands = BRCMF_VNDR_CMDS_LAST - 1; in brcmf_setup_wiphy()
7671 return -ENOMEM; in brcmf_setup_wiphy()
7673 band->channels = kmemdup(&__wl_2ghz_channels, in brcmf_setup_wiphy()
7676 if (!band->channels) { in brcmf_setup_wiphy()
7678 return -ENOMEM; in brcmf_setup_wiphy()
7681 band->n_channels = ARRAY_SIZE(__wl_2ghz_channels); in brcmf_setup_wiphy()
7682 wiphy->bands[NL80211_BAND_2GHZ] = band; in brcmf_setup_wiphy()
7688 return -ENOMEM; in brcmf_setup_wiphy()
7690 band->channels = kmemdup(&__wl_5ghz_channels, in brcmf_setup_wiphy()
7693 if (!band->channels) { in brcmf_setup_wiphy()
7695 return -ENOMEM; in brcmf_setup_wiphy()
7698 band->n_channels = ARRAY_SIZE(__wl_5ghz_channels); in brcmf_setup_wiphy()
7699 wiphy->bands[NL80211_BAND_5GHZ] = band; in brcmf_setup_wiphy()
7703 if (wiphy->bands[NL80211_BAND_5GHZ] && in brcmf_setup_wiphy()
7717 struct brcmf_pub *drvr = cfg->pub; in brcmf_config_dongle()
7724 if (cfg->dongle_up) in brcmf_config_dongle()
7728 wdev = ndev->ieee80211_ptr; in brcmf_config_dongle()
7736 power_mode = cfg->pwr_save ? PM_FAST : PM_OFF; in brcmf_config_dongle()
7746 err = brcmf_cfg80211_change_iface(wdev->wiphy, ndev, wdev->iftype, in brcmf_config_dongle()
7759 cfg->dongle_up = true; in brcmf_config_dongle()
7768 set_bit(BRCMF_VIF_STATUS_READY, &ifp->vif->sme_state); in __brcmf_cfg80211_up()
7770 return brcmf_config_dongle(ifp->drvr->config); in __brcmf_cfg80211_up()
7775 struct brcmf_cfg80211_info *cfg = ifp->drvr->config; in __brcmf_cfg80211_down()
7781 if (check_vif_up(ifp->vif)) { in __brcmf_cfg80211_down()
7782 brcmf_link_down(ifp->vif, WLAN_REASON_UNSPECIFIED, true); in __brcmf_cfg80211_down()
7792 clear_bit(BRCMF_VIF_STATUS_READY, &ifp->vif->sme_state); in __brcmf_cfg80211_down()
7800 struct brcmf_cfg80211_info *cfg = ifp->drvr->config; in brcmf_cfg80211_up()
7803 mutex_lock(&cfg->usr_sync); in brcmf_cfg80211_up()
7805 mutex_unlock(&cfg->usr_sync); in brcmf_cfg80211_up()
7813 struct brcmf_cfg80211_info *cfg = ifp->drvr->config; in brcmf_cfg80211_down()
7816 mutex_lock(&cfg->usr_sync); in brcmf_cfg80211_down()
7818 mutex_unlock(&cfg->usr_sync); in brcmf_cfg80211_down()
7825 struct wireless_dev *wdev = &ifp->vif->wdev; in brcmf_cfg80211_get_iftype()
7827 return wdev->iftype; in brcmf_cfg80211_get_iftype()
7835 list_for_each_entry(vif, &cfg->vif_list, list) { in brcmf_get_vif_state_any()
7836 if (test_bit(state, &vif->sme_state)) in brcmf_get_vif_state_any()
7847 spin_lock(&event->vif_event_lock); in vif_event_equals()
7848 evt_action = event->action; in vif_event_equals()
7849 spin_unlock(&event->vif_event_lock); in vif_event_equals()
7856 struct brcmf_cfg80211_vif_event *event = &cfg->vif_event; in brcmf_cfg80211_arm_vif_event()
7858 spin_lock(&event->vif_event_lock); in brcmf_cfg80211_arm_vif_event()
7859 event->vif = vif; in brcmf_cfg80211_arm_vif_event()
7860 event->action = 0; in brcmf_cfg80211_arm_vif_event()
7861 spin_unlock(&event->vif_event_lock); in brcmf_cfg80211_arm_vif_event()
7866 struct brcmf_cfg80211_vif_event *event = &cfg->vif_event; in brcmf_cfg80211_vif_event_armed()
7869 spin_lock(&event->vif_event_lock); in brcmf_cfg80211_vif_event_armed()
7870 armed = event->vif != NULL; in brcmf_cfg80211_vif_event_armed()
7871 spin_unlock(&event->vif_event_lock); in brcmf_cfg80211_vif_event_armed()
7879 struct brcmf_cfg80211_vif_event *event = &cfg->vif_event; in brcmf_cfg80211_wait_vif_event()
7881 return wait_event_timeout(event->vif_wq, in brcmf_cfg80211_wait_vif_event()
7887 if (drvr->settings->trivial_ccode_map) in brmcf_use_iso3166_ccode_fallback()
7890 switch (drvr->bus_if->chip) { in brmcf_use_iso3166_ccode_fallback()
7909 if ((alpha2[0] == ccreq->country_abbrev[0]) && in brcmf_translate_country_code()
7910 (alpha2[1] == ccreq->country_abbrev[1])) { in brcmf_translate_country_code()
7912 return -EAGAIN; in brcmf_translate_country_code()
7915 country_codes = drvr->settings->country_codes; in brcmf_translate_country_code()
7920 ccreq->country_abbrev[0] = alpha2[0]; in brcmf_translate_country_code()
7921 ccreq->country_abbrev[1] = alpha2[1]; in brcmf_translate_country_code()
7922 ccreq->ccode[0] = alpha2[0]; in brcmf_translate_country_code()
7923 ccreq->ccode[1] = alpha2[1]; in brcmf_translate_country_code()
7928 return -EINVAL; in brcmf_translate_country_code()
7931 found_index = -1; in brcmf_translate_country_code()
7932 for (i = 0; i < country_codes->table_size; i++) { in brcmf_translate_country_code()
7933 cc = &country_codes->table[i]; in brcmf_translate_country_code()
7934 if ((cc->iso3166[0] == '\0') && (found_index == -1)) in brcmf_translate_country_code()
7936 if ((cc->iso3166[0] == alpha2[0]) && in brcmf_translate_country_code()
7937 (cc->iso3166[1] == alpha2[1])) { in brcmf_translate_country_code()
7942 if (found_index == -1) { in brcmf_translate_country_code()
7944 return -EINVAL; in brcmf_translate_country_code()
7947 ccreq->rev = cpu_to_le32(country_codes->table[found_index].rev); in brcmf_translate_country_code()
7948 memcpy(ccreq->ccode, country_codes->table[found_index].cc, in brcmf_translate_country_code()
7950 ccreq->country_abbrev[0] = alpha2[0]; in brcmf_translate_country_code()
7951 ccreq->country_abbrev[1] = alpha2[1]; in brcmf_translate_country_code()
7952 ccreq->country_abbrev[2] = 0; in brcmf_translate_country_code()
7974 survey->obss = val; in brcmf_parse_dump_obss()
7983 survey->ibss = val; in brcmf_parse_dump_obss()
7992 survey->tx = val; in brcmf_parse_dump_obss()
8001 survey->no_ctg = val; in brcmf_parse_dump_obss()
8010 survey->no_pckt = val; in brcmf_parse_dump_obss()
8019 survey->idle = val; in brcmf_parse_dump_obss()
8038 return -ENOMEM; in brcmf_dump_obss()
8045 err = -EINVAL; in brcmf_dump_obss()
8051 brcmf_parse_dump_obss(results->buf, survey); in brcmf_dump_obss()
8065 if (chan->flags & IEEE80211_CHAN_DISABLED) in brcmf_set_channel()
8066 return -EINVAL; in brcmf_set_channel()
8069 chspec = channel_to_chanspec(&cfg->d11inf, chan); in brcmf_set_channel()
8074 err = -EINVAL; in brcmf_set_channel()
8078 err = -EINVAL; in brcmf_set_channel()
8100 if ((test_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state)) || in brcmf_cfg80211_dump_survey()
8101 (test_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state))) { in brcmf_cfg80211_dump_survey()
8102 return -EBUSY; in brcmf_cfg80211_dump_survey()
8106 band = wiphy->bands[band_id]; in brcmf_cfg80211_dump_survey()
8109 if (idx >= band->n_channels) { in brcmf_cfg80211_dump_survey()
8110 idx -= band->n_channels; in brcmf_cfg80211_dump_survey()
8114 info->channel = &band->channels[idx]; in brcmf_cfg80211_dump_survey()
8118 return -ENOENT; in brcmf_cfg80211_dump_survey()
8121 info->filled = 0; in brcmf_cfg80211_dump_survey()
8122 if (brcmf_set_channel(cfg, info->channel)) in brcmf_cfg80211_dump_survey()
8158 info->noise = noise; in brcmf_cfg80211_dump_survey()
8159 info->time = ACS_MSRMNT_DELAY; in brcmf_cfg80211_dump_survey()
8160 info->time_busy = ACS_MSRMNT_DELAY - survey.idle; in brcmf_cfg80211_dump_survey()
8161 info->time_rx = survey.obss + survey.ibss + survey.no_ctg + in brcmf_cfg80211_dump_survey()
8163 info->time_tx = survey.tx; in brcmf_cfg80211_dump_survey()
8164 info->filled = SURVEY_INFO_NOISE_DBM | SURVEY_INFO_TIME | in brcmf_cfg80211_dump_survey()
8169 ieee80211_frequency_to_channel(info->channel->center_freq), in brcmf_cfg80211_dump_survey()
8172 info->noise, info->time_busy, info->time_rx, info->time_tx); in brcmf_cfg80211_dump_survey()
8175 if (!brcmf_is_apmode(ifp->vif)) in brcmf_cfg80211_dump_survey()
8184 struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); in brcmf_cfg80211_reg_notifier()
8185 struct brcmf_pub *drvr = cfg->pub; in brcmf_cfg80211_reg_notifier()
8191 if (req->alpha2[0] == '0' && req->alpha2[1] == '0') in brcmf_cfg80211_reg_notifier()
8194 /* ignore non-ISO3166 country codes */ in brcmf_cfg80211_reg_notifier()
8196 if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') { in brcmf_cfg80211_reg_notifier()
8198 req->alpha2[0], req->alpha2[1]); in brcmf_cfg80211_reg_notifier()
8202 brcmf_dbg(TRACE, "Enter: initiator=%d, alpha=%c%c\n", req->initiator, in brcmf_cfg80211_reg_notifier()
8203 req->alpha2[0], req->alpha2[1]); in brcmf_cfg80211_reg_notifier()
8211 err = brcmf_translate_country_code(ifp->drvr, req->alpha2, &ccreq); in brcmf_cfg80211_reg_notifier()
8217 bphy_err(drvr, "Firmware rejected country setting\n"); in brcmf_cfg80211_reg_notifier()
8230 if (wiphy->iface_combinations) { in brcmf_free_wiphy()
8231 for (i = 0; i < wiphy->n_iface_combinations; i++) in brcmf_free_wiphy()
8232 kfree(wiphy->iface_combinations[i].limits); in brcmf_free_wiphy()
8234 kfree(wiphy->iface_combinations); in brcmf_free_wiphy()
8235 if (wiphy->bands[NL80211_BAND_2GHZ]) { in brcmf_free_wiphy()
8236 kfree(wiphy->bands[NL80211_BAND_2GHZ]->channels); in brcmf_free_wiphy()
8237 kfree(wiphy->bands[NL80211_BAND_2GHZ]); in brcmf_free_wiphy()
8239 if (wiphy->bands[NL80211_BAND_5GHZ]) { in brcmf_free_wiphy()
8240 kfree(wiphy->bands[NL80211_BAND_5GHZ]->channels); in brcmf_free_wiphy()
8241 kfree(wiphy->bands[NL80211_BAND_5GHZ]); in brcmf_free_wiphy()
8244 if (wiphy->wowlan != &brcmf_wowlan_support) in brcmf_free_wiphy()
8245 kfree(wiphy->wowlan); in brcmf_free_wiphy()
8253 struct wiphy *wiphy = drvr->wiphy; in brcmf_cfg80211_attach()
8254 struct net_device *ndev = brcmf_get_ifp(drvr, 0)->ndev; in brcmf_cfg80211_attach()
8273 cfg->wiphy = wiphy; in brcmf_cfg80211_attach()
8274 cfg->pub = drvr; in brcmf_cfg80211_attach()
8275 init_vif_event(&cfg->vif_event); in brcmf_cfg80211_attach()
8276 INIT_LIST_HEAD(&cfg->vif_list); in brcmf_cfg80211_attach()
8283 vif->ifp = ifp; in brcmf_cfg80211_attach()
8284 vif->wdev.netdev = ndev; in brcmf_cfg80211_attach()
8285 ndev->ieee80211_ptr = &vif->wdev; in brcmf_cfg80211_attach()
8286 SET_NETDEV_DEV(ndev, wiphy_dev(cfg->wiphy)); in brcmf_cfg80211_attach()
8294 ifp->vif = vif; in brcmf_cfg80211_attach()
8302 cfg->d11inf.io_type = (u8)io_type; in brcmf_cfg80211_attach()
8303 brcmu_d11_attach(&cfg->d11inf); in brcmf_cfg80211_attach()
8308 drvr->config = cfg; in brcmf_cfg80211_attach()
8315 wiphy->reg_notifier = brcmf_cfg80211_reg_notifier; in brcmf_cfg80211_attach()
8316 wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG; in brcmf_cfg80211_attach()
8319 /* firmware defaults to 40MHz disabled in 2G band. We signal in brcmf_cfg80211_attach()
8323 if (wiphy->bands[NL80211_BAND_2GHZ]) { in brcmf_cfg80211_attach()
8324 cap = &wiphy->bands[NL80211_BAND_2GHZ]->ht_cap.cap; in brcmf_cfg80211_attach()
8329 ops->set_rekey_data = brcmf_cfg80211_set_rekey_data; in brcmf_cfg80211_attach()
8332 ops->dump_survey = brcmf_cfg80211_dump_survey; in brcmf_cfg80211_attach()
8371 bphy_err(drvr, "BT-coex initialisation failed (%d)\n", err); in brcmf_cfg80211_attach()
8372 brcmf_p2p_detach(&cfg->p2p); in brcmf_cfg80211_attach()
8379 brcmf_p2p_detach(&cfg->p2p); in brcmf_cfg80211_attach()
8387 wiphy->flags &= ~WIPHY_FLAG_SUPPORTS_TDLS; in brcmf_cfg80211_attach()
8389 brcmf_fweh_register(cfg->pub, BRCMF_E_TDLS_PEER_EVENT, in brcmf_cfg80211_attach()
8394 /* (re-) activate FWEH event handling */ in brcmf_cfg80211_attach()
8403 wiphy->features |= NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR; in brcmf_cfg80211_attach()
8405 if (wiphy->wowlan && in brcmf_cfg80211_attach()
8406 wiphy->wowlan->flags & WIPHY_WOWLAN_NET_DETECT) in brcmf_cfg80211_attach()
8407 wiphy->features |= NL80211_FEATURE_ND_RANDOM_MAC_ADDR; in brcmf_cfg80211_attach()
8416 brcmf_p2p_detach(&cfg->p2p); in brcmf_cfg80211_attach()
8418 wiphy_unregister(cfg->wiphy); in brcmf_cfg80211_attach()
8422 ifp->vif = NULL; in brcmf_cfg80211_attach()
8436 wiphy_unregister(cfg->wiphy); in brcmf_cfg80211_detach()
8438 cancel_work_sync(&cfg->escan_timeout_work); in brcmf_cfg80211_detach()
8439 brcmf_free_wiphy(cfg->wiphy); in brcmf_cfg80211_detach()