Lines Matching +full:channel +full:- +full:spacing
1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright 2011-2020 NXP
61 * This function maps the nl802.11 channel type into driver channel type.
63 * The mapping is as follows -
64 * NL80211_CHAN_NO_HT -> IEEE80211_HT_PARAM_CHA_SEC_NONE
65 * NL80211_CHAN_HT20 -> IEEE80211_HT_PARAM_CHA_SEC_NONE
66 * NL80211_CHAN_HT40PLUS -> IEEE80211_HT_PARAM_CHA_SEC_ABOVE
67 * NL80211_CHAN_HT40MINUS -> IEEE80211_HT_PARAM_CHA_SEC_BELOW
68 * Others -> IEEE80211_HT_PARAM_CHA_SEC_NONE
85 /* This function maps IEEE HT secondary channel type to NL80211 channel type
153 mwifiex_dbg(priv->adapter, ERROR, "deleting the crypto keys\n"); in mwifiex_cfg80211_del_key()
154 return -EFAULT; in mwifiex_cfg80211_del_key()
157 mwifiex_dbg(priv->adapter, INFO, "info: crypto keys deleted\n"); in mwifiex_cfg80211_del_key()
186 len - sizeof(struct ieee80211_hdr_3addr)); in mwifiex_form_mgmt_frame()
188 skb->priority = LOW_PRIO_TID; in mwifiex_form_mgmt_frame()
201 const u8 *buf = params->buf; in mwifiex_cfg80211_mgmt_tx()
202 size_t len = params->len; in mwifiex_cfg80211_mgmt_tx()
207 struct mwifiex_private *priv = mwifiex_netdev_get_priv(wdev->netdev); in mwifiex_cfg80211_mgmt_tx()
210 mwifiex_dbg(priv->adapter, ERROR, "invalid buffer and length\n"); in mwifiex_cfg80211_mgmt_tx()
211 return -EFAULT; in mwifiex_cfg80211_mgmt_tx()
216 ieee80211_is_probe_resp(mgmt->frame_control)) { in mwifiex_cfg80211_mgmt_tx()
219 mwifiex_dbg(priv->adapter, INFO, in mwifiex_cfg80211_mgmt_tx()
225 if (ieee80211_is_auth(mgmt->frame_control)) in mwifiex_cfg80211_mgmt_tx()
226 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_mgmt_tx()
227 "auth: send auth to %pM\n", mgmt->da); in mwifiex_cfg80211_mgmt_tx()
228 if (ieee80211_is_deauth(mgmt->frame_control)) in mwifiex_cfg80211_mgmt_tx()
229 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_mgmt_tx()
230 "auth: send deauth to %pM\n", mgmt->da); in mwifiex_cfg80211_mgmt_tx()
231 if (ieee80211_is_disassoc(mgmt->frame_control)) in mwifiex_cfg80211_mgmt_tx()
232 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_mgmt_tx()
233 "assoc: send disassoc to %pM\n", mgmt->da); in mwifiex_cfg80211_mgmt_tx()
234 if (ieee80211_is_assoc_resp(mgmt->frame_control)) in mwifiex_cfg80211_mgmt_tx()
235 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_mgmt_tx()
237 mgmt->da); in mwifiex_cfg80211_mgmt_tx()
238 if (ieee80211_is_reassoc_resp(mgmt->frame_control)) in mwifiex_cfg80211_mgmt_tx()
239 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_mgmt_tx()
241 mgmt->da); in mwifiex_cfg80211_mgmt_tx()
250 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_mgmt_tx()
252 return -ENOMEM; in mwifiex_cfg80211_mgmt_tx()
257 tx_info->bss_num = priv->bss_num; in mwifiex_cfg80211_mgmt_tx()
258 tx_info->bss_type = priv->bss_type; in mwifiex_cfg80211_mgmt_tx()
259 tx_info->pkt_len = pkt_len; in mwifiex_cfg80211_mgmt_tx()
264 if (ieee80211_is_action(mgmt->frame_control)) in mwifiex_cfg80211_mgmt_tx()
274 mwifiex_dbg(priv->adapter, INFO, "info: management frame transmitted\n"); in mwifiex_cfg80211_mgmt_tx()
286 struct mwifiex_private *priv = mwifiex_netdev_get_priv(wdev->netdev); in mwifiex_cfg80211_update_mgmt_frame_registrations()
287 u32 mask = upd->interface_stypes; in mwifiex_cfg80211_update_mgmt_frame_registrations()
289 if (mask != priv->mgmt_frame_mask) { in mwifiex_cfg80211_update_mgmt_frame_registrations()
290 priv->mgmt_frame_mask = mask; in mwifiex_cfg80211_update_mgmt_frame_registrations()
291 if (priv->host_mlme_reg) in mwifiex_cfg80211_update_mgmt_frame_registrations()
292 priv->mgmt_frame_mask |= HOST_MLME_MGMT_MASK; in mwifiex_cfg80211_update_mgmt_frame_registrations()
295 &priv->mgmt_frame_mask, false); in mwifiex_cfg80211_update_mgmt_frame_registrations()
296 mwifiex_dbg(priv->adapter, INFO, "info: mgmt frame registered\n"); in mwifiex_cfg80211_update_mgmt_frame_registrations()
301 * CFG802.11 operation handler to remain on channel.
309 struct mwifiex_private *priv = mwifiex_netdev_get_priv(wdev->netdev); in mwifiex_cfg80211_remain_on_channel()
313 mwifiex_dbg(priv->adapter, ERROR, "Invalid parameter for ROC\n"); in mwifiex_cfg80211_remain_on_channel()
314 return -EINVAL; in mwifiex_cfg80211_remain_on_channel()
317 if (priv->roc_cfg.cookie) { in mwifiex_cfg80211_remain_on_channel()
318 mwifiex_dbg(priv->adapter, INFO, in mwifiex_cfg80211_remain_on_channel()
320 priv->roc_cfg.cookie); in mwifiex_cfg80211_remain_on_channel()
321 return -EBUSY; in mwifiex_cfg80211_remain_on_channel()
329 priv->roc_cfg.cookie = *cookie; in mwifiex_cfg80211_remain_on_channel()
330 priv->roc_cfg.chan = *chan; in mwifiex_cfg80211_remain_on_channel()
335 mwifiex_dbg(priv->adapter, INFO, in mwifiex_cfg80211_remain_on_channel()
343 * CFG802.11 operation handler to cancel remain on channel.
349 struct mwifiex_private *priv = mwifiex_netdev_get_priv(wdev->netdev); in mwifiex_cfg80211_cancel_remain_on_channel()
352 if (cookie != priv->roc_cfg.cookie) in mwifiex_cfg80211_cancel_remain_on_channel()
353 return -ENOENT; in mwifiex_cfg80211_cancel_remain_on_channel()
356 &priv->roc_cfg.chan, 0); in mwifiex_cfg80211_cancel_remain_on_channel()
360 &priv->roc_cfg.chan, in mwifiex_cfg80211_cancel_remain_on_channel()
363 memset(&priv->roc_cfg, 0, sizeof(struct mwifiex_roc_cfg)); in mwifiex_cfg80211_cancel_remain_on_channel()
365 mwifiex_dbg(priv->adapter, INFO, in mwifiex_cfg80211_cancel_remain_on_channel()
427 *dbm = priv->tx_power_level; in mwifiex_cfg80211_get_tx_power()
446 mwifiex_dbg(priv->adapter, INFO, in mwifiex_cfg80211_set_power_mgmt()
465 if (!priv->sec_info.wep_enabled) in mwifiex_cfg80211_set_default_key()
468 if (priv->bss_type == MWIFIEX_BSS_TYPE_UAP) { in mwifiex_cfg80211_set_default_key()
469 priv->wep_key_curr_index = key_index; in mwifiex_cfg80211_set_default_key()
472 mwifiex_dbg(priv->adapter, ERROR, "set default Tx key index\n"); in mwifiex_cfg80211_set_default_key()
473 return -EFAULT; in mwifiex_cfg80211_set_default_key()
493 (params->cipher == WLAN_CIPHER_SUITE_WEP40 || in mwifiex_cfg80211_add_key()
494 params->cipher == WLAN_CIPHER_SUITE_WEP104)) { in mwifiex_cfg80211_add_key()
495 if (params->key && params->key_len) { in mwifiex_cfg80211_add_key()
496 wep_key = &priv->wep_key[key_index]; in mwifiex_cfg80211_add_key()
498 memcpy(wep_key->key_material, params->key, in mwifiex_cfg80211_add_key()
499 params->key_len); in mwifiex_cfg80211_add_key()
500 wep_key->key_index = key_index; in mwifiex_cfg80211_add_key()
501 wep_key->key_length = params->key_len; in mwifiex_cfg80211_add_key()
502 priv->sec_info.wep_enabled = 1; in mwifiex_cfg80211_add_key()
507 if (mwifiex_set_encode(priv, params, params->key, params->key_len, in mwifiex_cfg80211_add_key()
509 mwifiex_dbg(priv->adapter, ERROR, "crypto keys added\n"); in mwifiex_cfg80211_add_key()
510 return -EFAULT; in mwifiex_cfg80211_add_key()
530 if (priv->adapter->host_mlme_enabled) in mwifiex_cfg80211_set_default_mgmt_key()
541 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_set_default_mgmt_key()
543 return -1; in mwifiex_cfg80211_set_default_mgmt_key()
552 * The following information are passed to the firmware -
553 * - Country codes
554 * - Sub bands (first channel, number of channels, maximum Tx power)
568 struct mwifiex_802_11d_domain_reg *domain_info = &adapter->domain_reg; in mwifiex_send_domain_info_cmd_fw()
571 domain_info->country_code[0] = adapter->country_code[0]; in mwifiex_send_domain_info_cmd_fw()
572 domain_info->country_code[1] = adapter->country_code[1]; in mwifiex_send_domain_info_cmd_fw()
573 domain_info->country_code[2] = ' '; in mwifiex_send_domain_info_cmd_fw()
575 band = mwifiex_band_to_radio_type(adapter->config_bands); in mwifiex_send_domain_info_cmd_fw()
576 if (!wiphy->bands[band]) { in mwifiex_send_domain_info_cmd_fw()
579 return -1; in mwifiex_send_domain_info_cmd_fw()
582 sband = wiphy->bands[band]; in mwifiex_send_domain_info_cmd_fw()
584 for (i = 0; i < sband->n_channels ; i++) { in mwifiex_send_domain_info_cmd_fw()
585 ch = &sband->channels[i]; in mwifiex_send_domain_info_cmd_fw()
586 if (ch->flags & IEEE80211_CHAN_DISABLED) in mwifiex_send_domain_info_cmd_fw()
591 first_chan = (u32) ch->hw_value; in mwifiex_send_domain_info_cmd_fw()
593 max_pwr = ch->max_power; in mwifiex_send_domain_info_cmd_fw()
598 if (ch->hw_value == next_chan + 1 && in mwifiex_send_domain_info_cmd_fw()
599 ch->max_power == max_pwr) { in mwifiex_send_domain_info_cmd_fw()
603 t = &domain_info->triplet[no_of_triplet]; in mwifiex_send_domain_info_cmd_fw()
604 t->chans.first_channel = first_chan; in mwifiex_send_domain_info_cmd_fw()
605 t->chans.num_channels = no_of_parsed_chan; in mwifiex_send_domain_info_cmd_fw()
606 t->chans.max_power = max_pwr; in mwifiex_send_domain_info_cmd_fw()
608 first_chan = (u32) ch->hw_value; in mwifiex_send_domain_info_cmd_fw()
610 max_pwr = ch->max_power; in mwifiex_send_domain_info_cmd_fw()
616 t = &domain_info->triplet[no_of_triplet]; in mwifiex_send_domain_info_cmd_fw()
617 t->chans.first_channel = first_chan; in mwifiex_send_domain_info_cmd_fw()
618 t->chans.num_channels = no_of_parsed_chan; in mwifiex_send_domain_info_cmd_fw()
619 t->chans.max_power = max_pwr; in mwifiex_send_domain_info_cmd_fw()
623 domain_info->no_of_triplet = no_of_triplet; in mwifiex_send_domain_info_cmd_fw()
631 return -1; in mwifiex_send_domain_info_cmd_fw()
643 if (!wiphy->bands[NL80211_BAND_5GHZ]) in mwifiex_reg_apply_radar_flags()
645 sband = wiphy->bands[NL80211_BAND_5GHZ]; in mwifiex_reg_apply_radar_flags()
647 for (i = 0; i < sband->n_channels; i++) { in mwifiex_reg_apply_radar_flags()
648 chan = &sband->channels[i]; in mwifiex_reg_apply_radar_flags()
649 if ((!(chan->flags & IEEE80211_CHAN_DISABLED)) && in mwifiex_reg_apply_radar_flags()
650 (chan->flags & IEEE80211_CHAN_RADAR)) in mwifiex_reg_apply_radar_flags()
651 chan->flags |= IEEE80211_CHAN_NO_IR; in mwifiex_reg_apply_radar_flags()
659 * following reasons -
660 * - Set by driver
661 * - Set by system core
662 * - Set by user
663 * - Set bt Country IE
673 request->alpha2[0], request->alpha2[1]); in mwifiex_reg_notifier()
676 switch (request->initiator) { in mwifiex_reg_notifier()
685 request->initiator); in mwifiex_reg_notifier()
690 if (strncmp(request->alpha2, adapter->country_code, in mwifiex_reg_notifier()
691 sizeof(request->alpha2)) != 0) { in mwifiex_reg_notifier()
692 memcpy(adapter->country_code, request->alpha2, in mwifiex_reg_notifier()
693 sizeof(request->alpha2)); in mwifiex_reg_notifier()
751 switch (priv->bss_role) { in mwifiex_cfg80211_set_wiphy_params()
753 if (priv->bss_started) { in mwifiex_cfg80211_set_wiphy_params()
756 return -EINVAL; in mwifiex_cfg80211_set_wiphy_params()
761 return -ENOMEM; in mwifiex_cfg80211_set_wiphy_params()
766 bss_cfg->rts_threshold = wiphy->rts_threshold; in mwifiex_cfg80211_set_wiphy_params()
768 bss_cfg->frag_threshold = wiphy->frag_threshold; in mwifiex_cfg80211_set_wiphy_params()
770 bss_cfg->retry_limit = wiphy->retry_long; in mwifiex_cfg80211_set_wiphy_params()
786 if (priv->media_connected) { in mwifiex_cfg80211_set_wiphy_params()
789 return -EINVAL; in mwifiex_cfg80211_set_wiphy_params()
793 wiphy->rts_threshold); in mwifiex_cfg80211_set_wiphy_params()
799 wiphy->frag_threshold); in mwifiex_cfg80211_set_wiphy_params()
816 return -1; in mwifiex_cfg80211_deinit_p2p()
824 * disable -> device -> client
832 return -1; in mwifiex_cfg80211_init_p2p_client()
837 return -1; in mwifiex_cfg80211_init_p2p_client()
842 return -1; in mwifiex_cfg80211_init_p2p_client()
850 * disable -> device -> GO
858 return -1; in mwifiex_cfg80211_init_p2p_go()
863 return -1; in mwifiex_cfg80211_init_p2p_go()
868 return -1; in mwifiex_cfg80211_init_p2p_go()
875 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_deinit_priv_params()
878 priv->host_mlme_reg = false; in mwifiex_deinit_priv_params()
879 priv->mgmt_frame_mask = 0; in mwifiex_deinit_priv_params()
882 &priv->mgmt_frame_mask, false)) { in mwifiex_deinit_priv_params()
885 return -1; in mwifiex_deinit_priv_params()
890 spin_lock_irqsave(&adapter->main_proc_lock, flags); in mwifiex_deinit_priv_params()
891 adapter->main_locked = true; in mwifiex_deinit_priv_params()
892 if (adapter->mwifiex_processing) { in mwifiex_deinit_priv_params()
893 spin_unlock_irqrestore(&adapter->main_proc_lock, flags); in mwifiex_deinit_priv_params()
894 flush_workqueue(adapter->workqueue); in mwifiex_deinit_priv_params()
896 spin_unlock_irqrestore(&adapter->main_proc_lock, flags); in mwifiex_deinit_priv_params()
899 spin_lock_bh(&adapter->rx_proc_lock); in mwifiex_deinit_priv_params()
900 adapter->rx_locked = true; in mwifiex_deinit_priv_params()
901 if (adapter->rx_processing) { in mwifiex_deinit_priv_params()
902 spin_unlock_bh(&adapter->rx_proc_lock); in mwifiex_deinit_priv_params()
903 flush_workqueue(adapter->rx_workqueue); in mwifiex_deinit_priv_params()
905 spin_unlock_bh(&adapter->rx_proc_lock); in mwifiex_deinit_priv_params()
909 priv->wdev.iftype = NL80211_IFTYPE_UNSPECIFIED; in mwifiex_deinit_priv_params()
910 priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED; in mwifiex_deinit_priv_params()
911 priv->sec_info.authentication_mode = NL80211_AUTHTYPE_OPEN_SYSTEM; in mwifiex_deinit_priv_params()
921 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_init_new_priv_params()
926 priv->bss_mode = type; in mwifiex_init_new_priv_params()
927 priv->wdev.iftype = type; in mwifiex_init_new_priv_params()
929 mwifiex_init_priv_params(priv, priv->netdev); in mwifiex_init_new_priv_params()
930 priv->bss_started = 0; in mwifiex_init_new_priv_params()
935 priv->bss_role = MWIFIEX_BSS_ROLE_STA; in mwifiex_init_new_priv_params()
936 priv->bss_type = MWIFIEX_BSS_TYPE_STA; in mwifiex_init_new_priv_params()
939 priv->bss_role = MWIFIEX_BSS_ROLE_STA; in mwifiex_init_new_priv_params()
940 priv->bss_type = MWIFIEX_BSS_TYPE_P2P; in mwifiex_init_new_priv_params()
943 priv->bss_role = MWIFIEX_BSS_ROLE_UAP; in mwifiex_init_new_priv_params()
944 priv->bss_type = MWIFIEX_BSS_TYPE_P2P; in mwifiex_init_new_priv_params()
947 priv->bss_role = MWIFIEX_BSS_ROLE_UAP; in mwifiex_init_new_priv_params()
948 priv->bss_type = MWIFIEX_BSS_TYPE_UAP; in mwifiex_init_new_priv_params()
953 dev->name, type); in mwifiex_init_new_priv_params()
954 return -EOPNOTSUPP; in mwifiex_init_new_priv_params()
957 priv->bss_num = mwifiex_get_unused_bss_num(adapter, priv->bss_type); in mwifiex_init_new_priv_params()
959 spin_lock_irqsave(&adapter->main_proc_lock, flags); in mwifiex_init_new_priv_params()
960 adapter->main_locked = false; in mwifiex_init_new_priv_params()
961 spin_unlock_irqrestore(&adapter->main_proc_lock, flags); in mwifiex_init_new_priv_params()
963 spin_lock_bh(&adapter->rx_proc_lock); in mwifiex_init_new_priv_params()
964 adapter->rx_locked = false; in mwifiex_init_new_priv_params()
965 spin_unlock_bh(&adapter->rx_proc_lock); in mwifiex_init_new_priv_params()
984 return adapter->curr_iface_comb.p2p_intf != in is_vif_type_change_allowed()
985 adapter->iface_limit.p2p_intf; in is_vif_type_change_allowed()
987 return adapter->curr_iface_comb.uap_intf != in is_vif_type_change_allowed()
988 adapter->iface_limit.uap_intf; in is_vif_type_change_allowed()
999 return adapter->curr_iface_comb.p2p_intf != in is_vif_type_change_allowed()
1000 adapter->iface_limit.p2p_intf; in is_vif_type_change_allowed()
1002 return adapter->curr_iface_comb.uap_intf != in is_vif_type_change_allowed()
1003 adapter->iface_limit.uap_intf; in is_vif_type_change_allowed()
1012 return adapter->curr_iface_comb.sta_intf != in is_vif_type_change_allowed()
1013 adapter->iface_limit.sta_intf; in is_vif_type_change_allowed()
1016 return adapter->curr_iface_comb.p2p_intf != in is_vif_type_change_allowed()
1017 adapter->iface_limit.p2p_intf; in is_vif_type_change_allowed()
1030 return adapter->curr_iface_comb.uap_intf != in is_vif_type_change_allowed()
1031 adapter->iface_limit.uap_intf; in is_vif_type_change_allowed()
1044 return adapter->curr_iface_comb.uap_intf != in is_vif_type_change_allowed()
1045 adapter->iface_limit.uap_intf; in is_vif_type_change_allowed()
1066 adapter->curr_iface_comb.sta_intf += change; in update_vif_type_counter()
1069 adapter->curr_iface_comb.uap_intf += change; in update_vif_type_counter()
1073 adapter->curr_iface_comb.p2p_intf += change; in update_vif_type_counter()
1095 return -1; in mwifiex_change_vif_to_p2p()
1097 adapter = priv->adapter; in mwifiex_change_vif_to_p2p()
1100 "%s: changing role to p2p\n", dev->name); in mwifiex_change_vif_to_p2p()
1103 return -1; in mwifiex_change_vif_to_p2p()
1105 return -1; in mwifiex_change_vif_to_p2p()
1107 update_vif_type_counter(adapter, curr_iftype, -1); in mwifiex_change_vif_to_p2p()
1109 dev->ieee80211_ptr->iftype = type; in mwifiex_change_vif_to_p2p()
1114 return -EFAULT; in mwifiex_change_vif_to_p2p()
1118 return -EFAULT; in mwifiex_change_vif_to_p2p()
1123 dev->name, type); in mwifiex_change_vif_to_p2p()
1124 return -EOPNOTSUPP; in mwifiex_change_vif_to_p2p()
1129 return -1; in mwifiex_change_vif_to_p2p()
1132 return -1; in mwifiex_change_vif_to_p2p()
1149 return -1; in mwifiex_change_vif_to_sta_adhoc()
1151 adapter = priv->adapter; in mwifiex_change_vif_to_sta_adhoc()
1155 "%s: changing role to station\n", dev->name); in mwifiex_change_vif_to_sta_adhoc()
1158 "%s: changing role to adhoc\n", dev->name); in mwifiex_change_vif_to_sta_adhoc()
1161 return -1; in mwifiex_change_vif_to_sta_adhoc()
1163 return -1; in mwifiex_change_vif_to_sta_adhoc()
1165 update_vif_type_counter(adapter, curr_iftype, -1); in mwifiex_change_vif_to_sta_adhoc()
1167 dev->ieee80211_ptr->iftype = type; in mwifiex_change_vif_to_sta_adhoc()
1171 return -1; in mwifiex_change_vif_to_sta_adhoc()
1173 return -1; in mwifiex_change_vif_to_sta_adhoc()
1190 return -1; in mwifiex_change_vif_to_ap()
1192 adapter = priv->adapter; in mwifiex_change_vif_to_ap()
1195 "%s: changing role to AP\n", dev->name); in mwifiex_change_vif_to_ap()
1198 return -1; in mwifiex_change_vif_to_ap()
1200 return -1; in mwifiex_change_vif_to_ap()
1202 update_vif_type_counter(adapter, curr_iftype, -1); in mwifiex_change_vif_to_ap()
1204 dev->ieee80211_ptr->iftype = type; in mwifiex_change_vif_to_ap()
1208 return -1; in mwifiex_change_vif_to_ap()
1210 return -1; in mwifiex_change_vif_to_ap()
1224 enum nl80211_iftype curr_iftype = dev->ieee80211_ptr->iftype; in mwifiex_cfg80211_change_virtual_intf()
1226 if (priv->scan_request) { in mwifiex_cfg80211_change_virtual_intf()
1227 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_change_virtual_intf()
1229 return -EBUSY; in mwifiex_cfg80211_change_virtual_intf()
1233 mwifiex_dbg(priv->adapter, INFO, in mwifiex_cfg80211_change_virtual_intf()
1235 dev->name, curr_iftype); in mwifiex_cfg80211_change_virtual_intf()
1240 mwifiex_dbg(priv->adapter, INFO, in mwifiex_cfg80211_change_virtual_intf()
1242 dev->name, curr_iftype); in mwifiex_cfg80211_change_virtual_intf()
1246 if (!is_vif_type_change_allowed(priv->adapter, curr_iftype, type)) { in mwifiex_cfg80211_change_virtual_intf()
1247 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_change_virtual_intf()
1249 dev->name, curr_iftype, type); in mwifiex_cfg80211_change_virtual_intf()
1250 return -EOPNOTSUPP; in mwifiex_cfg80211_change_virtual_intf()
1257 priv->bss_mode = type; in mwifiex_cfg80211_change_virtual_intf()
1258 priv->sec_info.authentication_mode = in mwifiex_cfg80211_change_virtual_intf()
1260 dev->ieee80211_ptr->iftype = type; in mwifiex_cfg80211_change_virtual_intf()
1279 priv->bss_mode = type; in mwifiex_cfg80211_change_virtual_intf()
1280 priv->sec_info.authentication_mode = in mwifiex_cfg80211_change_virtual_intf()
1282 dev->ieee80211_ptr->iftype = type; in mwifiex_cfg80211_change_virtual_intf()
1315 return -EFAULT; in mwifiex_cfg80211_change_virtual_intf()
1334 return -EFAULT; in mwifiex_cfg80211_change_virtual_intf()
1359 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_change_virtual_intf()
1362 return -EOPNOTSUPP; in mwifiex_cfg80211_change_virtual_intf()
1369 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_parse_htinfo()
1371 if (adapter->is_hw_11ac_capable) { in mwifiex_parse_htinfo()
1372 /* bit[1-0]: 00=LG 01=HT 10=VHT */ in mwifiex_parse_htinfo()
1375 rate->mcs = rateinfo; in mwifiex_parse_htinfo()
1376 rate->flags |= RATE_INFO_FLAGS_MCS; in mwifiex_parse_htinfo()
1380 rate->mcs = rateinfo & 0x0F; in mwifiex_parse_htinfo()
1381 rate->flags |= RATE_INFO_FLAGS_VHT_MCS; in mwifiex_parse_htinfo()
1388 rate->bw = RATE_INFO_BW_20; in mwifiex_parse_htinfo()
1391 rate->bw = RATE_INFO_BW_40; in mwifiex_parse_htinfo()
1394 rate->bw = RATE_INFO_BW_80; in mwifiex_parse_htinfo()
1397 rate->bw = RATE_INFO_BW_160; in mwifiex_parse_htinfo()
1402 rate->flags |= RATE_INFO_FLAGS_SHORT_GI; in mwifiex_parse_htinfo()
1405 rate->nss = 2; in mwifiex_parse_htinfo()
1407 rate->nss = 1; in mwifiex_parse_htinfo()
1415 rate->mcs = rateinfo; in mwifiex_parse_htinfo()
1416 rate->flags |= RATE_INFO_FLAGS_MCS; in mwifiex_parse_htinfo()
1417 rate->bw = RATE_INFO_BW_20; in mwifiex_parse_htinfo()
1419 rate->bw = RATE_INFO_BW_40; in mwifiex_parse_htinfo()
1421 rate->flags |= RATE_INFO_FLAGS_SHORT_GI; in mwifiex_parse_htinfo()
1425 /* Decode legacy rates for non-HT. */ in mwifiex_parse_htinfo()
1444 rate->legacy = legacy_rates[rateinfo]; in mwifiex_parse_htinfo()
1451 * The following information are shown -
1452 * - Total bytes transmitted
1453 * - Total bytes received
1454 * - Total packets transmitted
1455 * - Total packets received
1456 * - Signal quality level
1457 * - Transmission rate
1466 sinfo->filled = BIT_ULL(NL80211_STA_INFO_RX_BYTES) | BIT_ULL(NL80211_STA_INFO_TX_BYTES) | in mwifiex_dump_station_info()
1473 return -ENOENT; in mwifiex_dump_station_info()
1475 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME) | in mwifiex_dump_station_info()
1477 sinfo->inactive_time = in mwifiex_dump_station_info()
1478 jiffies_to_msecs(jiffies - node->stats.last_rx); in mwifiex_dump_station_info()
1480 sinfo->signal = node->stats.rssi; in mwifiex_dump_station_info()
1481 sinfo->signal_avg = node->stats.rssi; in mwifiex_dump_station_info()
1482 sinfo->rx_bytes = node->stats.rx_bytes; in mwifiex_dump_station_info()
1483 sinfo->tx_bytes = node->stats.tx_bytes; in mwifiex_dump_station_info()
1484 sinfo->rx_packets = node->stats.rx_packets; in mwifiex_dump_station_info()
1485 sinfo->tx_packets = node->stats.tx_packets; in mwifiex_dump_station_info()
1486 sinfo->tx_failed = node->stats.tx_failed; in mwifiex_dump_station_info()
1488 mwifiex_parse_htinfo(priv, priv->tx_rate, in mwifiex_dump_station_info()
1489 node->stats.last_tx_htinfo, in mwifiex_dump_station_info()
1490 &sinfo->txrate); in mwifiex_dump_station_info()
1491 sinfo->txrate.legacy = node->stats.last_tx_rate * 5; in mwifiex_dump_station_info()
1499 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_dump_station_info()
1501 return -EFAULT; in mwifiex_dump_station_info()
1505 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_dump_station_info()
1507 return -EFAULT; in mwifiex_dump_station_info()
1513 &priv->dtim_period, true); in mwifiex_dump_station_info()
1515 mwifiex_parse_htinfo(priv, priv->tx_rate, priv->tx_htinfo, in mwifiex_dump_station_info()
1516 &sinfo->txrate); in mwifiex_dump_station_info()
1518 sinfo->signal_avg = priv->bcn_rssi_avg; in mwifiex_dump_station_info()
1519 sinfo->rx_bytes = priv->stats.rx_bytes; in mwifiex_dump_station_info()
1520 sinfo->tx_bytes = priv->stats.tx_bytes; in mwifiex_dump_station_info()
1521 sinfo->rx_packets = priv->stats.rx_packets; in mwifiex_dump_station_info()
1522 sinfo->tx_packets = priv->stats.tx_packets; in mwifiex_dump_station_info()
1523 sinfo->signal = priv->bcn_rssi_avg; in mwifiex_dump_station_info()
1525 sinfo->txrate.legacy = rate * 5; in mwifiex_dump_station_info()
1527 sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE); in mwifiex_dump_station_info()
1528 mwifiex_parse_htinfo(priv, priv->rxpd_rate, priv->rxpd_htinfo, in mwifiex_dump_station_info()
1529 &sinfo->rxrate); in mwifiex_dump_station_info()
1531 if (priv->bss_mode == NL80211_IFTYPE_STATION) { in mwifiex_dump_station_info()
1532 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_BSS_PARAM); in mwifiex_dump_station_info()
1533 sinfo->bss_param.flags = 0; in mwifiex_dump_station_info()
1534 if (priv->curr_bss_params.bss_descriptor.cap_info_bitmap & in mwifiex_dump_station_info()
1536 sinfo->bss_param.flags |= in mwifiex_dump_station_info()
1538 if (priv->curr_bss_params.bss_descriptor.cap_info_bitmap & in mwifiex_dump_station_info()
1540 sinfo->bss_param.flags |= in mwifiex_dump_station_info()
1542 sinfo->bss_param.dtim_period = priv->dtim_period; in mwifiex_dump_station_info()
1543 sinfo->bss_param.beacon_interval = in mwifiex_dump_station_info()
1544 priv->curr_bss_params.bss_descriptor.beacon_period; in mwifiex_dump_station_info()
1562 if (!priv->media_connected) in mwifiex_cfg80211_get_station()
1563 return -ENOENT; in mwifiex_cfg80211_get_station()
1564 if (memcmp(mac, priv->cfg_bssid, ETH_ALEN)) in mwifiex_cfg80211_get_station()
1565 return -ENOENT; in mwifiex_cfg80211_get_station()
1582 priv->media_connected && idx == 0) { in mwifiex_cfg80211_dump_station()
1583 ether_addr_copy(mac, priv->cfg_bssid); in mwifiex_cfg80211_dump_station()
1590 list_for_each_entry(node, &priv->sta_list, list) { in mwifiex_cfg80211_dump_station()
1593 ether_addr_copy(mac, node->mac_addr); in mwifiex_cfg80211_dump_station()
1598 return -ENOENT; in mwifiex_cfg80211_dump_station()
1606 struct mwifiex_chan_stats *pchan_stats = priv->adapter->chan_stats; in mwifiex_cfg80211_dump_survey()
1609 mwifiex_dbg(priv->adapter, DUMP, "dump_survey idx=%d\n", idx); in mwifiex_cfg80211_dump_survey()
1614 priv->media_connected && idx == 0) { in mwifiex_cfg80211_dump_survey()
1615 u8 curr_bss_band = priv->curr_bss_params.band; in mwifiex_cfg80211_dump_survey()
1616 u32 chan = priv->curr_bss_params.bss_descriptor.channel; in mwifiex_cfg80211_dump_survey()
1619 survey->channel = ieee80211_get_channel(wiphy, in mwifiex_cfg80211_dump_survey()
1622 if (priv->bcn_nf_last) { in mwifiex_cfg80211_dump_survey()
1623 survey->filled = SURVEY_INFO_NOISE_DBM; in mwifiex_cfg80211_dump_survey()
1624 survey->noise = priv->bcn_nf_last; in mwifiex_cfg80211_dump_survey()
1629 if (idx >= priv->adapter->num_in_chan_stats) in mwifiex_cfg80211_dump_survey()
1630 return -ENOENT; in mwifiex_cfg80211_dump_survey()
1636 survey->channel = ieee80211_get_channel(wiphy, in mwifiex_cfg80211_dump_survey()
1638 survey->filled = SURVEY_INFO_NOISE_DBM | in mwifiex_cfg80211_dump_survey()
1641 survey->noise = pchan_stats[idx].noise; in mwifiex_cfg80211_dump_survey()
1642 survey->time = pchan_stats[idx].cca_scan_dur; in mwifiex_cfg80211_dump_survey()
1643 survey->time_busy = pchan_stats[idx].cca_busy_dur; in mwifiex_cfg80211_dump_survey()
1664 /* Channel definitions to be advertised to cfg80211 */
1727 .n_bitrates = ARRAY_SIZE(mwifiex_rates) - 4,
1786 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_cfg80211_set_bitrate_mask()
1788 if (!priv->media_connected) { in mwifiex_cfg80211_set_bitrate_mask()
1791 return -EINVAL; in mwifiex_cfg80211_set_bitrate_mask()
1794 band = mwifiex_band_to_radio_type(priv->curr_bss_params.band); in mwifiex_cfg80211_set_bitrate_mask()
1800 bitmap_rates[0] = mask->control[band].legacy & 0x000f; in mwifiex_cfg80211_set_bitrate_mask()
1804 bitmap_rates[1] = (mask->control[band].legacy & 0x0ff0) >> 4; in mwifiex_cfg80211_set_bitrate_mask()
1806 bitmap_rates[1] = mask->control[band].legacy; in mwifiex_cfg80211_set_bitrate_mask()
1809 bitmap_rates[2] = mask->control[band].ht_mcs[0]; in mwifiex_cfg80211_set_bitrate_mask()
1810 if (adapter->hw_dev_mcs_support == HT_STREAM_2X2) in mwifiex_cfg80211_set_bitrate_mask()
1811 bitmap_rates[2] |= mask->control[band].ht_mcs[1] << 8; in mwifiex_cfg80211_set_bitrate_mask()
1814 if (adapter->fw_api_ver == MWIFIEX_FW_V15) { in mwifiex_cfg80211_set_bitrate_mask()
1815 bitmap_rates[10] = mask->control[band].vht_mcs[0]; in mwifiex_cfg80211_set_bitrate_mask()
1816 if (adapter->hw_dev_mcs_support == HT_STREAM_2X2) in mwifiex_cfg80211_set_bitrate_mask()
1817 bitmap_rates[11] = mask->control[band].vht_mcs[1]; in mwifiex_cfg80211_set_bitrate_mask()
1837 priv->cqm_rssi_thold = rssi_thold; in mwifiex_cfg80211_set_cqm_rssi_config()
1838 priv->cqm_rssi_hyst = rssi_hyst; in mwifiex_cfg80211_set_cqm_rssi_config()
1871 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_cfg80211_change_beacon()
1872 struct cfg80211_beacon_data *data = ¶ms->beacon; in mwifiex_cfg80211_change_beacon()
1877 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_change_beacon()
1879 return -EINVAL; in mwifiex_cfg80211_change_beacon()
1882 if (!priv->bss_started) { in mwifiex_cfg80211_change_beacon()
1883 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_change_beacon()
1885 return -EINVAL; in mwifiex_cfg80211_change_beacon()
1889 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_change_beacon()
1891 return -EFAULT; in mwifiex_cfg80211_change_beacon()
1911 if (!priv->bss_started && priv->wdev.links[0].cac_started) { in mwifiex_cfg80211_del_station()
1912 mwifiex_dbg(priv->adapter, INFO, "%s: abort CAC!\n", __func__); in mwifiex_cfg80211_del_station()
1916 if (list_empty(&priv->sta_list) || !priv->bss_started) in mwifiex_cfg80211_del_station()
1919 if (!params->mac || is_broadcast_ether_addr(params->mac)) in mwifiex_cfg80211_del_station()
1922 mwifiex_dbg(priv->adapter, INFO, "%s: mac address %pM\n", in mwifiex_cfg80211_del_station()
1923 __func__, params->mac); in mwifiex_cfg80211_del_station()
1927 spin_lock_bh(&priv->sta_list_spinlock); in mwifiex_cfg80211_del_station()
1928 sta_node = mwifiex_get_sta_entry(priv, params->mac); in mwifiex_cfg80211_del_station()
1930 ether_addr_copy(deauth_mac, params->mac); in mwifiex_cfg80211_del_station()
1931 spin_unlock_bh(&priv->sta_list_spinlock); in mwifiex_cfg80211_del_station()
1937 return -1; in mwifiex_cfg80211_del_station()
1953 return -EOPNOTSUPP; in mwifiex_cfg80211_set_antenna()
1955 if (adapter->hw_dev_mcs_support != HT_STREAM_2X2) { in mwifiex_cfg80211_set_antenna()
1960 return -EOPNOTSUPP; in mwifiex_cfg80211_set_antenna()
1962 if ((tx_ant & (tx_ant - 1)) && in mwifiex_cfg80211_set_antenna()
1963 (tx_ant != BIT(adapter->number_of_antenna) - 1)) in mwifiex_cfg80211_set_antenna()
1964 return -EOPNOTSUPP; in mwifiex_cfg80211_set_antenna()
1966 if ((tx_ant == BIT(adapter->number_of_antenna) - 1) && in mwifiex_cfg80211_set_antenna()
1967 (priv->adapter->number_of_antenna > 1)) { in mwifiex_cfg80211_set_antenna()
1977 adapter->user_dev_mcs_support = HT_STREAM_1X1; in mwifiex_cfg80211_set_antenna()
1978 if (adapter->is_hw_11ac_capable) in mwifiex_cfg80211_set_antenna()
1979 adapter->usr_dot_11ac_mcs_support = in mwifiex_cfg80211_set_antenna()
1982 adapter->user_dev_mcs_support = HT_STREAM_2X2; in mwifiex_cfg80211_set_antenna()
1983 if (adapter->is_hw_11ac_capable) in mwifiex_cfg80211_set_antenna()
1984 adapter->usr_dot_11ac_mcs_support = in mwifiex_cfg80211_set_antenna()
1989 if (!adapter->wiphy->bands[band]) in mwifiex_cfg80211_set_antenna()
1992 ht_info = &adapter->wiphy->bands[band]->ht_cap; in mwifiex_cfg80211_set_antenna()
1994 GET_RXMCSSUPP(adapter->user_dev_mcs_support); in mwifiex_cfg80211_set_antenna()
1995 memset(&ht_info->mcs, 0, adapter->number_of_antenna); in mwifiex_cfg80211_set_antenna()
1996 memset(&ht_info->mcs, 0xff, rx_mcs_supp); in mwifiex_cfg80211_set_antenna()
2017 *tx_ant = priv->tx_ant; in mwifiex_cfg80211_get_antenna()
2018 *rx_ant = priv->rx_ant; in mwifiex_cfg80211_get_antenna()
2034 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_stop_ap()
2037 priv->ap_11n_enabled = 0; in mwifiex_cfg80211_stop_ap()
2038 memset(&priv->bss_cfg, 0, sizeof(priv->bss_cfg)); in mwifiex_cfg80211_stop_ap()
2042 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_stop_ap()
2044 return -1; in mwifiex_cfg80211_stop_ap()
2049 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_stop_ap()
2051 return -1; in mwifiex_cfg80211_stop_ap()
2054 if (netif_carrier_ok(priv->netdev)) in mwifiex_cfg80211_stop_ap()
2055 netif_carrier_off(priv->netdev); in mwifiex_cfg80211_stop_ap()
2056 mwifiex_stop_net_dev_queue(priv->netdev, priv->adapter); in mwifiex_cfg80211_stop_ap()
2074 return -1; in mwifiex_cfg80211_start_ap()
2078 return -ENOMEM; in mwifiex_cfg80211_start_ap()
2082 memcpy(bss_cfg->mac_addr, priv->curr_addr, ETH_ALEN); in mwifiex_cfg80211_start_ap()
2084 if (params->beacon_interval) in mwifiex_cfg80211_start_ap()
2085 bss_cfg->beacon_period = params->beacon_interval; in mwifiex_cfg80211_start_ap()
2086 if (params->dtim_period) in mwifiex_cfg80211_start_ap()
2087 bss_cfg->dtim_period = params->dtim_period; in mwifiex_cfg80211_start_ap()
2089 if (params->ssid && params->ssid_len) { in mwifiex_cfg80211_start_ap()
2090 memcpy(bss_cfg->ssid.ssid, params->ssid, params->ssid_len); in mwifiex_cfg80211_start_ap()
2091 bss_cfg->ssid.ssid_len = params->ssid_len; in mwifiex_cfg80211_start_ap()
2093 if (params->inactivity_timeout > 0) { in mwifiex_cfg80211_start_ap()
2095 bss_cfg->sta_ao_timer = 10 * params->inactivity_timeout; in mwifiex_cfg80211_start_ap()
2096 bss_cfg->ps_sta_ao_timer = 10 * params->inactivity_timeout; in mwifiex_cfg80211_start_ap()
2099 switch (params->hidden_ssid) { in mwifiex_cfg80211_start_ap()
2101 bss_cfg->bcast_ssid_ctl = 1; in mwifiex_cfg80211_start_ap()
2104 bss_cfg->bcast_ssid_ctl = 0; in mwifiex_cfg80211_start_ap()
2107 bss_cfg->bcast_ssid_ctl = 2; in mwifiex_cfg80211_start_ap()
2111 return -EINVAL; in mwifiex_cfg80211_start_ap()
2114 mwifiex_uap_set_channel(priv, bss_cfg, params->chandef); in mwifiex_cfg80211_start_ap()
2118 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_start_ap()
2125 if (priv->adapter->is_hw_11ac_capable) { in mwifiex_cfg80211_start_ap()
2127 mwifiex_set_vht_width(priv, params->chandef.width, in mwifiex_cfg80211_start_ap()
2128 priv->ap_11ac_enabled); in mwifiex_cfg80211_start_ap()
2131 if (priv->ap_11ac_enabled) in mwifiex_cfg80211_start_ap()
2142 !cfg80211_chandef_dfs_required(wiphy, ¶ms->chandef, in mwifiex_cfg80211_start_ap()
2143 priv->bss_mode)) { in mwifiex_cfg80211_start_ap()
2144 mwifiex_dbg(priv->adapter, INFO, in mwifiex_cfg80211_start_ap()
2147 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_start_ap()
2151 priv->state_11h.is_11h_active = false; in mwifiex_cfg80211_start_ap()
2154 mwifiex_config_uap_11d(priv, ¶ms->beacon); in mwifiex_cfg80211_start_ap()
2157 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_start_ap()
2162 if (mwifiex_set_mgmt_ies(priv, ¶ms->beacon)) in mwifiex_cfg80211_start_ap()
2165 if (!netif_carrier_ok(priv->netdev)) in mwifiex_cfg80211_start_ap()
2166 netif_carrier_on(priv->netdev); in mwifiex_cfg80211_start_ap()
2167 mwifiex_wake_up_net_dev_queue(priv->netdev, priv->adapter); in mwifiex_cfg80211_start_ap()
2169 memcpy(&priv->bss_cfg, bss_cfg, sizeof(priv->bss_cfg)); in mwifiex_cfg80211_start_ap()
2175 return -1; in mwifiex_cfg80211_start_ap()
2191 cfg80211_sched_scan_stopped_locked(priv->wdev.wiphy, 0); in mwifiex_cfg80211_disconnect()
2194 return -EFAULT; in mwifiex_cfg80211_disconnect()
2196 eth_zero_addr(priv->cfg_bssid); in mwifiex_cfg80211_disconnect()
2197 priv->hs2_enabled = false; in mwifiex_cfg80211_disconnect()
2208 * - SSID
2209 * - SSID length
2210 * - BSSID
2211 * - Channel
2223 return -1; in mwifiex_cfg80211_inform_ibss_bss()
2232 band = mwifiex_band_to_radio_type(priv->curr_bss_params.band); in mwifiex_cfg80211_inform_ibss_bss()
2233 chan = ieee80211_get_channel(priv->wdev.wiphy, in mwifiex_cfg80211_inform_ibss_bss()
2237 bss = cfg80211_inform_bss(priv->wdev.wiphy, chan, in mwifiex_cfg80211_inform_ibss_bss()
2242 cfg80211_put_bss(priv->wdev.wiphy, bss); in mwifiex_cfg80211_inform_ibss_bss()
2243 ether_addr_copy(priv->cfg_bssid, bss_info.bssid); in mwifiex_cfg80211_inform_ibss_bss()
2252 * This function handles both Infra and Ad-Hoc modes. It also performs
2259 * is not found in scan table. However, for Ad-Hoc mode, it can create
2266 struct ieee80211_channel *channel, in mwifiex_cfg80211_assoc() argument
2279 mwifiex_dbg(priv->adapter, ERROR, "invalid SSID - aborting\n"); in mwifiex_cfg80211_assoc()
2280 return -EINVAL; in mwifiex_cfg80211_assoc()
2285 mwifiex_dbg(priv->adapter, ERROR, "invalid SSID - aborting\n"); in mwifiex_cfg80211_assoc()
2286 return -EINVAL; in mwifiex_cfg80211_assoc()
2291 priv->sec_info.wpa_enabled = false; in mwifiex_cfg80211_assoc()
2292 priv->sec_info.wpa2_enabled = false; in mwifiex_cfg80211_assoc()
2293 priv->wep_key_curr_index = 0; in mwifiex_cfg80211_assoc()
2294 priv->sec_info.encryption_mode = 0; in mwifiex_cfg80211_assoc()
2295 priv->sec_info.is_authtype_auto = 0; in mwifiex_cfg80211_assoc()
2309 /* "privacy" is set only for ad-hoc mode */ in mwifiex_cfg80211_assoc()
2317 priv->sec_info.encryption_mode = in mwifiex_cfg80211_assoc()
2319 priv->sec_info.authentication_mode = in mwifiex_cfg80211_assoc()
2327 if (sme->auth_type == NL80211_AUTHTYPE_AUTOMATIC) { in mwifiex_cfg80211_assoc()
2329 priv->sec_info.is_authtype_auto = 1; in mwifiex_cfg80211_assoc()
2331 auth_type = sme->auth_type; in mwifiex_cfg80211_assoc()
2334 if (sme->crypto.n_ciphers_pairwise) { in mwifiex_cfg80211_assoc()
2335 priv->sec_info.encryption_mode = in mwifiex_cfg80211_assoc()
2336 sme->crypto.ciphers_pairwise[0]; in mwifiex_cfg80211_assoc()
2337 priv->sec_info.authentication_mode = auth_type; in mwifiex_cfg80211_assoc()
2340 if (sme->crypto.cipher_group) { in mwifiex_cfg80211_assoc()
2341 priv->sec_info.encryption_mode = sme->crypto.cipher_group; in mwifiex_cfg80211_assoc()
2342 priv->sec_info.authentication_mode = auth_type; in mwifiex_cfg80211_assoc()
2344 if (sme->ie) in mwifiex_cfg80211_assoc()
2345 ret = mwifiex_set_gen_ie(priv, sme->ie, sme->ie_len); in mwifiex_cfg80211_assoc()
2347 if (sme->key) { in mwifiex_cfg80211_assoc()
2348 if (mwifiex_is_alg_wep(priv->sec_info.encryption_mode)) { in mwifiex_cfg80211_assoc()
2349 mwifiex_dbg(priv->adapter, INFO, in mwifiex_cfg80211_assoc()
2351 "with key len %d\n", sme->key_len); in mwifiex_cfg80211_assoc()
2352 priv->wep_key_curr_index = sme->key_idx; in mwifiex_cfg80211_assoc()
2353 ret = mwifiex_set_encode(priv, NULL, sme->key, in mwifiex_cfg80211_assoc()
2354 sme->key_len, sme->key_idx, in mwifiex_cfg80211_assoc()
2368 mwifiex_dbg(priv->adapter, ERROR, "scan error\n"); in mwifiex_cfg80211_assoc()
2369 return -EFAULT; in mwifiex_cfg80211_assoc()
2375 bss = cfg80211_get_bss(priv->wdev.wiphy, channel, in mwifiex_cfg80211_assoc()
2380 bss = cfg80211_get_bss(priv->wdev.wiphy, channel, in mwifiex_cfg80211_assoc()
2387 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_assoc()
2393 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_assoc()
2395 bss->bssid); in mwifiex_cfg80211_assoc()
2396 memcpy(&priv->cfg_bssid, bss->bssid, ETH_ALEN); in mwifiex_cfg80211_assoc()
2402 cfg80211_ref_bss(priv->adapter->wiphy, bss); in mwifiex_cfg80211_assoc()
2412 ret = -EFAULT; in mwifiex_cfg80211_assoc()
2425 cfg80211_put_bss(priv->adapter->wiphy, bss); in mwifiex_cfg80211_assoc()
2432 * This function does not work when the current mode is set to Ad-Hoc, or
2441 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_cfg80211_connect()
2447 "%s: reject infra assoc request in non-STA role\n", in mwifiex_cfg80211_connect()
2448 dev->name); in mwifiex_cfg80211_connect()
2449 return -EINVAL; in mwifiex_cfg80211_connect()
2452 if (priv->wdev.connected) { in mwifiex_cfg80211_connect()
2454 "%s: already connected\n", dev->name); in mwifiex_cfg80211_connect()
2455 return -EALREADY; in mwifiex_cfg80211_connect()
2458 if (priv->scan_block) in mwifiex_cfg80211_connect()
2459 priv->scan_block = false; in mwifiex_cfg80211_connect()
2461 if (test_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags) || in mwifiex_cfg80211_connect()
2462 test_bit(MWIFIEX_IS_CMD_TIMEDOUT, &adapter->work_flags)) { in mwifiex_cfg80211_connect()
2466 dev->name); in mwifiex_cfg80211_connect()
2467 return -EFAULT; in mwifiex_cfg80211_connect()
2471 "info: Trying to associate to bssid %pM\n", sme->bssid); in mwifiex_cfg80211_connect()
2474 cfg80211_sched_scan_stopped_locked(priv->wdev.wiphy, 0); in mwifiex_cfg80211_connect()
2476 ret = mwifiex_cfg80211_assoc(priv, sme->ssid_len, sme->ssid, sme->bssid, in mwifiex_cfg80211_connect()
2477 priv->bss_mode, sme->channel, sme, 0, in mwifiex_cfg80211_connect()
2480 cfg80211_connect_bss(priv->netdev, priv->cfg_bssid, bss, NULL, in mwifiex_cfg80211_connect()
2483 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_connect()
2485 priv->cfg_bssid); in mwifiex_cfg80211_connect()
2486 if (ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info) && in mwifiex_cfg80211_connect()
2487 priv->adapter->auto_tdls && in mwifiex_cfg80211_connect()
2488 priv->bss_type == MWIFIEX_BSS_TYPE_STA) in mwifiex_cfg80211_connect()
2491 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_connect()
2493 priv->cfg_bssid); in mwifiex_cfg80211_connect()
2494 eth_zero_addr(priv->cfg_bssid); in mwifiex_cfg80211_connect()
2497 cfg80211_connect_result(priv->netdev, priv->cfg_bssid, in mwifiex_cfg80211_connect()
2501 cfg80211_connect_result(priv->netdev, priv->cfg_bssid, in mwifiex_cfg80211_connect()
2512 * - channel
2513 * - start band
2514 * - 11n flag
2515 * - secondary channel offset
2520 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_set_ibss_params()
2524 if (params->chandef.chan->band == NL80211_BAND_2GHZ) { in mwifiex_set_ibss_params()
2525 if (!params->basic_rates) { in mwifiex_set_ibss_params()
2540 if (params->basic_rates < index) { in mwifiex_set_ibss_params()
2544 if (params->basic_rates % index) in mwifiex_set_ibss_params()
2549 if (cfg80211_get_chandef_type(¶ms->chandef) != in mwifiex_set_ibss_params()
2553 if (cfg80211_get_chandef_type(¶ms->chandef) == in mwifiex_set_ibss_params()
2560 if (!((config_bands | adapter->fw_bands) & ~adapter->fw_bands)) { in mwifiex_set_ibss_params()
2561 adapter->config_bands = config_bands; in mwifiex_set_ibss_params()
2562 adapter->adhoc_start_band = config_bands; in mwifiex_set_ibss_params()
2565 adapter->adhoc_11n_enabled = true; in mwifiex_set_ibss_params()
2567 adapter->adhoc_11n_enabled = false; in mwifiex_set_ibss_params()
2570 adapter->sec_chan_offset = in mwifiex_set_ibss_params()
2572 cfg80211_get_chandef_type(¶ms->chandef)); in mwifiex_set_ibss_params()
2573 priv->adhoc_channel = ieee80211_frequency_to_channel( in mwifiex_set_ibss_params()
2574 params->chandef.chan->center_freq); in mwifiex_set_ibss_params()
2578 config_bands, priv->adhoc_channel, in mwifiex_set_ibss_params()
2579 adapter->sec_chan_offset); in mwifiex_set_ibss_params()
2587 * This function does not work in any mode other than Ad-Hoc, or if
2597 if (priv->bss_mode != NL80211_IFTYPE_ADHOC) { in mwifiex_cfg80211_join_ibss()
2598 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_join_ibss()
2604 mwifiex_dbg(priv->adapter, MSG, "info: trying to join to bssid %pM\n", in mwifiex_cfg80211_join_ibss()
2605 params->bssid); in mwifiex_cfg80211_join_ibss()
2609 ret = mwifiex_cfg80211_assoc(priv, params->ssid_len, params->ssid, in mwifiex_cfg80211_join_ibss()
2610 params->bssid, priv->bss_mode, in mwifiex_cfg80211_join_ibss()
2611 params->chandef.chan, NULL, in mwifiex_cfg80211_join_ibss()
2612 params->privacy, NULL); in mwifiex_cfg80211_join_ibss()
2615 cfg80211_ibss_joined(priv->netdev, priv->cfg_bssid, in mwifiex_cfg80211_join_ibss()
2616 params->chandef.chan, GFP_KERNEL); in mwifiex_cfg80211_join_ibss()
2617 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_join_ibss()
2619 "%pM successfully\n", priv->cfg_bssid); in mwifiex_cfg80211_join_ibss()
2621 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_join_ibss()
2639 mwifiex_dbg(priv->adapter, MSG, "info: disconnecting from essid %pM\n", in mwifiex_cfg80211_leave_ibss()
2640 priv->cfg_bssid); in mwifiex_cfg80211_leave_ibss()
2642 return -EFAULT; in mwifiex_cfg80211_leave_ibss()
2644 eth_zero_addr(priv->cfg_bssid); in mwifiex_cfg80211_leave_ibss()
2660 struct net_device *dev = request->wdev->netdev; in mwifiex_cfg80211_scan()
2668 mwifiex_dbg(priv->adapter, CMD, in mwifiex_cfg80211_scan()
2669 "info: received scan request on %s\n", dev->name); in mwifiex_cfg80211_scan()
2674 if (priv->scan_request || priv->scan_aborting) { in mwifiex_cfg80211_scan()
2675 mwifiex_dbg(priv->adapter, WARN, in mwifiex_cfg80211_scan()
2677 return -EBUSY; in mwifiex_cfg80211_scan()
2680 if (!priv->wdev.connected && priv->scan_block) in mwifiex_cfg80211_scan()
2681 priv->scan_block = false; in mwifiex_cfg80211_scan()
2684 cfg80211_sched_scan_stopped_locked(priv->wdev.wiphy, 0); in mwifiex_cfg80211_scan()
2688 return -ENOMEM; in mwifiex_cfg80211_scan()
2690 priv->scan_request = request; in mwifiex_cfg80211_scan()
2692 if (request->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { in mwifiex_cfg80211_scan()
2693 get_random_mask_addr(mac_addr, request->mac_addr, in mwifiex_cfg80211_scan()
2694 request->mac_addr_mask); in mwifiex_cfg80211_scan()
2695 ether_addr_copy(request->mac_addr, mac_addr); in mwifiex_cfg80211_scan()
2696 ether_addr_copy(user_scan_cfg->random_mac, mac_addr); in mwifiex_cfg80211_scan()
2699 user_scan_cfg->num_ssids = request->n_ssids; in mwifiex_cfg80211_scan()
2700 user_scan_cfg->ssid_list = request->ssids; in mwifiex_cfg80211_scan()
2702 if (request->ie && request->ie_len) { in mwifiex_cfg80211_scan()
2705 if (priv->vs_ie[i].mask != MWIFIEX_VSIE_MASK_CLEAR) in mwifiex_cfg80211_scan()
2707 priv->vs_ie[i].mask = MWIFIEX_VSIE_MASK_SCAN; in mwifiex_cfg80211_scan()
2708 ie = (struct ieee_types_header *)(request->ie + offset); in mwifiex_cfg80211_scan()
2709 memcpy(&priv->vs_ie[i].ie, ie, sizeof(*ie) + ie->len); in mwifiex_cfg80211_scan()
2710 offset += sizeof(*ie) + ie->len; in mwifiex_cfg80211_scan()
2712 if (offset >= request->ie_len) in mwifiex_cfg80211_scan()
2717 for (i = 0; i < min_t(u32, request->n_channels, in mwifiex_cfg80211_scan()
2719 chan = request->channels[i]; in mwifiex_cfg80211_scan()
2720 user_scan_cfg->chan_list[i].chan_number = chan->hw_value; in mwifiex_cfg80211_scan()
2721 user_scan_cfg->chan_list[i].radio_type = chan->band; in mwifiex_cfg80211_scan()
2723 if ((chan->flags & IEEE80211_CHAN_NO_IR) || !request->n_ssids) in mwifiex_cfg80211_scan()
2724 user_scan_cfg->chan_list[i].scan_type = in mwifiex_cfg80211_scan()
2727 user_scan_cfg->chan_list[i].scan_type = in mwifiex_cfg80211_scan()
2730 user_scan_cfg->chan_list[i].scan_time = 0; in mwifiex_cfg80211_scan()
2733 if (priv->adapter->scan_chan_gap_enabled && in mwifiex_cfg80211_scan()
2735 user_scan_cfg->scan_chan_gap = in mwifiex_cfg80211_scan()
2736 priv->adapter->scan_chan_gap_time; in mwifiex_cfg80211_scan()
2741 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_scan()
2743 priv->scan_aborting = false; in mwifiex_cfg80211_scan()
2744 priv->scan_request = NULL; in mwifiex_cfg80211_scan()
2748 if (request->ie && request->ie_len) { in mwifiex_cfg80211_scan()
2750 if (priv->vs_ie[i].mask == MWIFIEX_VSIE_MASK_SCAN) { in mwifiex_cfg80211_scan()
2751 priv->vs_ie[i].mask = MWIFIEX_VSIE_MASK_CLEAR; in mwifiex_cfg80211_scan()
2752 memset(&priv->vs_ie[i].ie, 0, in mwifiex_cfg80211_scan()
2778 if (!request || (!request->n_ssids && !request->n_match_sets)) { in mwifiex_cfg80211_sched_scan_start()
2781 return -EINVAL; in mwifiex_cfg80211_sched_scan_start()
2785 request->n_ssids, request->n_match_sets); in mwifiex_cfg80211_sched_scan_start()
2787 request->n_channels, request->scan_plans->interval, in mwifiex_cfg80211_sched_scan_start()
2788 (int)request->ie_len); in mwifiex_cfg80211_sched_scan_start()
2792 return -ENOMEM; in mwifiex_cfg80211_sched_scan_start()
2794 if (priv->scan_request || priv->scan_aborting) in mwifiex_cfg80211_sched_scan_start()
2795 bgscan_cfg->start_later = true; in mwifiex_cfg80211_sched_scan_start()
2797 bgscan_cfg->num_ssids = request->n_match_sets; in mwifiex_cfg80211_sched_scan_start()
2798 bgscan_cfg->ssid_list = request->match_sets; in mwifiex_cfg80211_sched_scan_start()
2800 if (request->ie && request->ie_len) { in mwifiex_cfg80211_sched_scan_start()
2803 if (priv->vs_ie[i].mask != MWIFIEX_VSIE_MASK_CLEAR) in mwifiex_cfg80211_sched_scan_start()
2805 priv->vs_ie[i].mask = MWIFIEX_VSIE_MASK_BGSCAN; in mwifiex_cfg80211_sched_scan_start()
2806 ie = (struct ieee_types_header *)(request->ie + offset); in mwifiex_cfg80211_sched_scan_start()
2807 memcpy(&priv->vs_ie[i].ie, ie, sizeof(*ie) + ie->len); in mwifiex_cfg80211_sched_scan_start()
2808 offset += sizeof(*ie) + ie->len; in mwifiex_cfg80211_sched_scan_start()
2810 if (offset >= request->ie_len) in mwifiex_cfg80211_sched_scan_start()
2815 for (i = 0; i < min_t(u32, request->n_channels, in mwifiex_cfg80211_sched_scan_start()
2817 chan = request->channels[i]; in mwifiex_cfg80211_sched_scan_start()
2818 bgscan_cfg->chan_list[i].chan_number = chan->hw_value; in mwifiex_cfg80211_sched_scan_start()
2819 bgscan_cfg->chan_list[i].radio_type = chan->band; in mwifiex_cfg80211_sched_scan_start()
2821 if ((chan->flags & IEEE80211_CHAN_NO_IR) || !request->n_ssids) in mwifiex_cfg80211_sched_scan_start()
2822 bgscan_cfg->chan_list[i].scan_type = in mwifiex_cfg80211_sched_scan_start()
2825 bgscan_cfg->chan_list[i].scan_type = in mwifiex_cfg80211_sched_scan_start()
2828 bgscan_cfg->chan_list[i].scan_time = 0; in mwifiex_cfg80211_sched_scan_start()
2831 bgscan_cfg->chan_per_scan = min_t(u32, request->n_channels, in mwifiex_cfg80211_sched_scan_start()
2835 bgscan_cfg->scan_interval = (request->scan_plans->interval > in mwifiex_cfg80211_sched_scan_start()
2837 request->scan_plans->interval : in mwifiex_cfg80211_sched_scan_start()
2840 bgscan_cfg->repeat_count = MWIFIEX_BGSCAN_REPEAT_COUNT; in mwifiex_cfg80211_sched_scan_start()
2841 bgscan_cfg->report_condition = MWIFIEX_BGSCAN_SSID_MATCH | in mwifiex_cfg80211_sched_scan_start()
2843 bgscan_cfg->bss_type = MWIFIEX_BSS_MODE_INFRA; in mwifiex_cfg80211_sched_scan_start()
2844 bgscan_cfg->action = MWIFIEX_BGSCAN_ACT_SET; in mwifiex_cfg80211_sched_scan_start()
2845 bgscan_cfg->enable = true; in mwifiex_cfg80211_sched_scan_start()
2846 if (request->min_rssi_thold != NL80211_SCAN_RSSI_THOLD_OFF) { in mwifiex_cfg80211_sched_scan_start()
2847 bgscan_cfg->report_condition |= MWIFIEX_BGSCAN_SSID_RSSI_MATCH; in mwifiex_cfg80211_sched_scan_start()
2848 bgscan_cfg->rssi_threshold = request->min_rssi_thold; in mwifiex_cfg80211_sched_scan_start()
2854 return -EFAULT; in mwifiex_cfg80211_sched_scan_start()
2857 priv->sched_scanning = true; in mwifiex_cfg80211_sched_scan_start()
2882 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_setup_vht_caps()
2884 vht_info->vht_supported = true; in mwifiex_setup_vht_caps()
2886 vht_info->cap = adapter->hw_dot_11ac_dev_cap; in mwifiex_setup_vht_caps()
2888 vht_info->vht_mcs.rx_mcs_map = cpu_to_le16( in mwifiex_setup_vht_caps()
2889 adapter->hw_dot_11ac_mcs_support & 0xFFFF); in mwifiex_setup_vht_caps()
2890 vht_info->vht_mcs.rx_highest = 0; in mwifiex_setup_vht_caps()
2891 vht_info->vht_mcs.tx_mcs_map = cpu_to_le16( in mwifiex_setup_vht_caps()
2892 adapter->hw_dot_11ac_mcs_support >> 16); in mwifiex_setup_vht_caps()
2893 vht_info->vht_mcs.tx_highest = 0; in mwifiex_setup_vht_caps()
2900 * The following default values are set -
2901 * - HT Supported = True
2902 * - Maximum AMPDU length factor = IEEE80211_HT_MAX_AMPDU_64K
2903 * - Minimum AMPDU spacing = IEEE80211_HT_MPDU_DENSITY_NONE
2904 * - HT Capabilities supported by firmware
2905 * - MCS information, Rx mask = 0xff
2906 * - MCD information, Tx parameters = IEEE80211_HT_MCS_TX_DEFINED (0x01)
2913 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_setup_ht_caps()
2915 ht_info->ht_supported = true; in mwifiex_setup_ht_caps()
2916 ht_info->ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K; in mwifiex_setup_ht_caps()
2917 ht_info->ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE; in mwifiex_setup_ht_caps()
2920 if (ISSUPP_CHANWIDTH40(adapter->hw_dot_11n_dev_cap)) in mwifiex_setup_ht_caps()
2921 ht_info->cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; in mwifiex_setup_ht_caps()
2923 ht_info->cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; in mwifiex_setup_ht_caps()
2925 if (ISSUPP_SHORTGI20(adapter->hw_dot_11n_dev_cap)) in mwifiex_setup_ht_caps()
2926 ht_info->cap |= IEEE80211_HT_CAP_SGI_20; in mwifiex_setup_ht_caps()
2928 ht_info->cap &= ~IEEE80211_HT_CAP_SGI_20; in mwifiex_setup_ht_caps()
2930 if (ISSUPP_SHORTGI40(adapter->hw_dot_11n_dev_cap)) in mwifiex_setup_ht_caps()
2931 ht_info->cap |= IEEE80211_HT_CAP_SGI_40; in mwifiex_setup_ht_caps()
2933 ht_info->cap &= ~IEEE80211_HT_CAP_SGI_40; in mwifiex_setup_ht_caps()
2935 if (adapter->user_dev_mcs_support == HT_STREAM_2X2) in mwifiex_setup_ht_caps()
2936 ht_info->cap |= 2 << IEEE80211_HT_CAP_RX_STBC_SHIFT; in mwifiex_setup_ht_caps()
2938 ht_info->cap |= 1 << IEEE80211_HT_CAP_RX_STBC_SHIFT; in mwifiex_setup_ht_caps()
2940 if (ISSUPP_TXSTBC(adapter->hw_dot_11n_dev_cap)) in mwifiex_setup_ht_caps()
2941 ht_info->cap |= IEEE80211_HT_CAP_TX_STBC; in mwifiex_setup_ht_caps()
2943 ht_info->cap &= ~IEEE80211_HT_CAP_TX_STBC; in mwifiex_setup_ht_caps()
2945 if (ISSUPP_GREENFIELD(adapter->hw_dot_11n_dev_cap)) in mwifiex_setup_ht_caps()
2946 ht_info->cap |= IEEE80211_HT_CAP_GRN_FLD; in mwifiex_setup_ht_caps()
2948 ht_info->cap &= ~IEEE80211_HT_CAP_GRN_FLD; in mwifiex_setup_ht_caps()
2950 if (ISENABLED_40MHZ_INTOLERANT(adapter->hw_dot_11n_dev_cap)) in mwifiex_setup_ht_caps()
2951 ht_info->cap |= IEEE80211_HT_CAP_40MHZ_INTOLERANT; in mwifiex_setup_ht_caps()
2953 ht_info->cap &= ~IEEE80211_HT_CAP_40MHZ_INTOLERANT; in mwifiex_setup_ht_caps()
2955 if (ISSUPP_RXLDPC(adapter->hw_dot_11n_dev_cap)) in mwifiex_setup_ht_caps()
2956 ht_info->cap |= IEEE80211_HT_CAP_LDPC_CODING; in mwifiex_setup_ht_caps()
2958 ht_info->cap &= ~IEEE80211_HT_CAP_LDPC_CODING; in mwifiex_setup_ht_caps()
2960 ht_info->cap &= ~IEEE80211_HT_CAP_MAX_AMSDU; in mwifiex_setup_ht_caps()
2961 ht_info->cap |= IEEE80211_HT_CAP_SM_PS; in mwifiex_setup_ht_caps()
2963 rx_mcs_supp = GET_RXMCSSUPP(adapter->user_dev_mcs_support); in mwifiex_setup_ht_caps()
2965 memset(&ht_info->mcs, 0, sizeof(ht_info->mcs)); in mwifiex_setup_ht_caps()
2967 memset(ht_info->mcs.rx_mask, 0xff, rx_mcs_supp); in mwifiex_setup_ht_caps()
2969 if (priv->bss_mode == NL80211_IFTYPE_STATION || in mwifiex_setup_ht_caps()
2970 ISSUPP_CHANWIDTH40(adapter->hw_dot_11n_dev_cap)) in mwifiex_setup_ht_caps()
2971 /* Set MCS32 for infra mode or ad-hoc mode with 40MHz support */ in mwifiex_setup_ht_caps()
2972 SETHT_MCS32(ht_info->mcs.rx_mask); in mwifiex_setup_ht_caps()
2974 ht_info->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; in mwifiex_setup_ht_caps()
2993 return ERR_PTR(-EFAULT); in mwifiex_add_virtual_intf()
2999 if (adapter->curr_iface_comb.sta_intf == in mwifiex_add_virtual_intf()
3000 adapter->iface_limit.sta_intf) { in mwifiex_add_virtual_intf()
3003 return ERR_PTR(-EINVAL); in mwifiex_add_virtual_intf()
3011 return ERR_PTR(-EFAULT); in mwifiex_add_virtual_intf()
3014 priv->wdev.iftype = NL80211_IFTYPE_STATION; in mwifiex_add_virtual_intf()
3017 priv->bss_mode = NL80211_IFTYPE_STATION; in mwifiex_add_virtual_intf()
3019 priv->bss_mode = type; in mwifiex_add_virtual_intf()
3021 priv->bss_type = MWIFIEX_BSS_TYPE_STA; in mwifiex_add_virtual_intf()
3022 priv->bss_role = MWIFIEX_BSS_ROLE_STA; in mwifiex_add_virtual_intf()
3026 if (adapter->curr_iface_comb.uap_intf == in mwifiex_add_virtual_intf()
3027 adapter->iface_limit.uap_intf) { in mwifiex_add_virtual_intf()
3030 return ERR_PTR(-EINVAL); in mwifiex_add_virtual_intf()
3038 return ERR_PTR(-EFAULT); in mwifiex_add_virtual_intf()
3041 priv->wdev.iftype = NL80211_IFTYPE_AP; in mwifiex_add_virtual_intf()
3043 priv->bss_type = MWIFIEX_BSS_TYPE_UAP; in mwifiex_add_virtual_intf()
3044 priv->bss_role = MWIFIEX_BSS_ROLE_UAP; in mwifiex_add_virtual_intf()
3045 priv->bss_mode = type; in mwifiex_add_virtual_intf()
3049 if (adapter->curr_iface_comb.p2p_intf == in mwifiex_add_virtual_intf()
3050 adapter->iface_limit.p2p_intf) { in mwifiex_add_virtual_intf()
3053 return ERR_PTR(-EINVAL); in mwifiex_add_virtual_intf()
3061 return ERR_PTR(-EFAULT); in mwifiex_add_virtual_intf()
3064 /* At start-up, wpa_supplicant tries to change the interface in mwifiex_add_virtual_intf()
3067 priv->wdev.iftype = NL80211_IFTYPE_P2P_CLIENT; in mwifiex_add_virtual_intf()
3068 priv->bss_mode = NL80211_IFTYPE_P2P_CLIENT; in mwifiex_add_virtual_intf()
3074 priv->bss_type = MWIFIEX_BSS_TYPE_P2P; in mwifiex_add_virtual_intf()
3076 priv->bss_role = MWIFIEX_BSS_ROLE_STA; in mwifiex_add_virtual_intf()
3079 memset(&priv->wdev, 0, sizeof(priv->wdev)); in mwifiex_add_virtual_intf()
3080 priv->wdev.iftype = NL80211_IFTYPE_UNSPECIFIED; in mwifiex_add_virtual_intf()
3081 return ERR_PTR(-EFAULT); in mwifiex_add_virtual_intf()
3087 return ERR_PTR(-EINVAL); in mwifiex_add_virtual_intf()
3090 priv->wdev.wiphy = wiphy; in mwifiex_add_virtual_intf()
3091 priv->bss_priority = 0; in mwifiex_add_virtual_intf()
3092 priv->bss_started = 0; in mwifiex_add_virtual_intf()
3093 priv->frame_type = MWIFIEX_DATA_FRAME_TYPE_ETH_II; in mwifiex_add_virtual_intf()
3101 ret = -ENOMEM; in mwifiex_add_virtual_intf()
3107 priv->netdev = dev; in mwifiex_add_virtual_intf()
3109 if (!adapter->mfg_mode) { in mwifiex_add_virtual_intf()
3122 mwifiex_setup_ht_caps(&wiphy->bands[NL80211_BAND_2GHZ]->ht_cap, priv); in mwifiex_add_virtual_intf()
3123 if (adapter->is_hw_11ac_capable) in mwifiex_add_virtual_intf()
3125 &wiphy->bands[NL80211_BAND_2GHZ]->vht_cap, priv); in mwifiex_add_virtual_intf()
3127 if (adapter->config_bands & BAND_A) in mwifiex_add_virtual_intf()
3129 &wiphy->bands[NL80211_BAND_5GHZ]->ht_cap, priv); in mwifiex_add_virtual_intf()
3131 if ((adapter->config_bands & BAND_A) && adapter->is_hw_11ac_capable) in mwifiex_add_virtual_intf()
3133 &wiphy->bands[NL80211_BAND_5GHZ]->vht_cap, priv); in mwifiex_add_virtual_intf()
3136 dev->ieee80211_ptr = &priv->wdev; in mwifiex_add_virtual_intf()
3137 dev->ieee80211_ptr->iftype = priv->bss_mode; in mwifiex_add_virtual_intf()
3140 dev->flags |= IFF_BROADCAST | IFF_MULTICAST; in mwifiex_add_virtual_intf()
3141 dev->watchdog_timeo = MWIFIEX_DEFAULT_WATCHDOG_TIMEOUT; in mwifiex_add_virtual_intf()
3142 dev->needed_headroom = MWIFIEX_MIN_DATA_HEADER_LEN; in mwifiex_add_virtual_intf()
3143 dev->ethtool_ops = &mwifiex_ethtool_ops; in mwifiex_add_virtual_intf()
3148 SET_NETDEV_DEV(dev, adapter->dev); in mwifiex_add_virtual_intf()
3150 priv->dfs_cac_workqueue = alloc_workqueue("MWIFIEX_DFS_CAC%s", in mwifiex_add_virtual_intf()
3154 if (!priv->dfs_cac_workqueue) { in mwifiex_add_virtual_intf()
3156 ret = -ENOMEM; in mwifiex_add_virtual_intf()
3160 INIT_DELAYED_WORK(&priv->dfs_cac_work, mwifiex_dfs_cac_work_queue); in mwifiex_add_virtual_intf()
3162 priv->dfs_chan_sw_workqueue = alloc_workqueue("MWIFIEX_DFS_CHSW%s", in mwifiex_add_virtual_intf()
3165 if (!priv->dfs_chan_sw_workqueue) { in mwifiex_add_virtual_intf()
3166 mwifiex_dbg(adapter, ERROR, "cannot alloc DFS channel sw queue\n"); in mwifiex_add_virtual_intf()
3167 ret = -ENOMEM; in mwifiex_add_virtual_intf()
3171 INIT_DELAYED_WORK(&priv->dfs_chan_sw_work, in mwifiex_add_virtual_intf()
3174 mutex_init(&priv->async_mutex); in mwifiex_add_virtual_intf()
3179 ret = -EFAULT; in mwifiex_add_virtual_intf()
3184 "info: %s: Marvell 802.11 Adapter\n", dev->name); in mwifiex_add_virtual_intf()
3192 return &priv->wdev; in mwifiex_add_virtual_intf()
3195 destroy_workqueue(priv->dfs_chan_sw_workqueue); in mwifiex_add_virtual_intf()
3196 priv->dfs_chan_sw_workqueue = NULL; in mwifiex_add_virtual_intf()
3198 destroy_workqueue(priv->dfs_cac_workqueue); in mwifiex_add_virtual_intf()
3199 priv->dfs_cac_workqueue = NULL; in mwifiex_add_virtual_intf()
3202 priv->netdev = NULL; in mwifiex_add_virtual_intf()
3206 memset(&priv->wdev, 0, sizeof(priv->wdev)); in mwifiex_add_virtual_intf()
3207 priv->wdev.iftype = NL80211_IFTYPE_UNSPECIFIED; in mwifiex_add_virtual_intf()
3208 priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED; in mwifiex_add_virtual_intf()
3218 struct mwifiex_private *priv = mwifiex_netdev_get_priv(wdev->netdev); in mwifiex_del_virtual_intf()
3219 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_del_virtual_intf()
3226 if (priv->sched_scanning) in mwifiex_del_virtual_intf()
3227 priv->sched_scanning = false; in mwifiex_del_virtual_intf()
3229 mwifiex_stop_net_dev_queue(priv->netdev, adapter); in mwifiex_del_virtual_intf()
3231 skb_queue_walk_safe(&priv->bypass_txq, skb, tmp) { in mwifiex_del_virtual_intf()
3232 skb_unlink(skb, &priv->bypass_txq); in mwifiex_del_virtual_intf()
3233 mwifiex_write_data_complete(priv->adapter, skb, 0, -1); in mwifiex_del_virtual_intf()
3236 if (netif_carrier_ok(priv->netdev)) in mwifiex_del_virtual_intf()
3237 netif_carrier_off(priv->netdev); in mwifiex_del_virtual_intf()
3239 if (wdev->netdev->reg_state == NETREG_REGISTERED) in mwifiex_del_virtual_intf()
3240 cfg80211_unregister_netdevice(wdev->netdev); in mwifiex_del_virtual_intf()
3242 if (priv->dfs_cac_workqueue) { in mwifiex_del_virtual_intf()
3243 destroy_workqueue(priv->dfs_cac_workqueue); in mwifiex_del_virtual_intf()
3244 priv->dfs_cac_workqueue = NULL; in mwifiex_del_virtual_intf()
3247 if (priv->dfs_chan_sw_workqueue) { in mwifiex_del_virtual_intf()
3248 destroy_workqueue(priv->dfs_chan_sw_workqueue); in mwifiex_del_virtual_intf()
3249 priv->dfs_chan_sw_workqueue = NULL; in mwifiex_del_virtual_intf()
3252 priv->netdev = NULL; in mwifiex_del_virtual_intf()
3254 update_vif_type_counter(adapter, priv->bss_mode, -1); in mwifiex_del_virtual_intf()
3256 priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED; in mwifiex_del_virtual_intf()
3260 kfree(priv->hist_data); in mwifiex_del_virtual_intf()
3273 for (j = 0; j < DIV_ROUND_UP(pat->pattern_len, 8); j++) { in mwifiex_is_pattern_supported()
3275 if (pat->mask[j] & 1 << k) { in mwifiex_is_pattern_supported()
3277 &pat->pattern[j * 8 + k], 1); in mwifiex_is_pattern_supported()
3290 pat->pkt_offset++; in mwifiex_is_pattern_supported()
3310 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_set_auto_arp_mef_entry()
3312 mef_entry->mode = MEF_MODE_HOST_SLEEP; in mwifiex_set_auto_arp_mef_entry()
3313 mef_entry->action = MEF_ACTION_AUTO_ARP; in mwifiex_set_auto_arp_mef_entry()
3318 if (adapter->priv[i]->netdev) { in mwifiex_set_auto_arp_mef_entry()
3319 in_dev = __in_dev_get_rtnl(adapter->priv[i]->netdev); in mwifiex_set_auto_arp_mef_entry()
3322 ifa = rtnl_dereference(in_dev->ifa_list); in mwifiex_set_auto_arp_mef_entry()
3323 if (!ifa || !ifa->ifa_local) in mwifiex_set_auto_arp_mef_entry()
3325 ips[i] = ifa->ifa_local; in mwifiex_set_auto_arp_mef_entry()
3333 mef_entry->filter[filt_num].repeat = 1; in mwifiex_set_auto_arp_mef_entry()
3334 memcpy(mef_entry->filter[filt_num].byte_seq, in mwifiex_set_auto_arp_mef_entry()
3336 mef_entry->filter[filt_num]. in mwifiex_set_auto_arp_mef_entry()
3339 mef_entry->filter[filt_num].offset = 46; in mwifiex_set_auto_arp_mef_entry()
3340 mef_entry->filter[filt_num].filt_type = TYPE_EQ; in mwifiex_set_auto_arp_mef_entry()
3342 mef_entry->filter[filt_num].filt_action = in mwifiex_set_auto_arp_mef_entry()
3348 mef_entry->filter[filt_num].repeat = 1; in mwifiex_set_auto_arp_mef_entry()
3349 mef_entry->filter[filt_num].byte_seq[0] = 0x08; in mwifiex_set_auto_arp_mef_entry()
3350 mef_entry->filter[filt_num].byte_seq[1] = 0x06; in mwifiex_set_auto_arp_mef_entry()
3351 mef_entry->filter[filt_num].byte_seq[MWIFIEX_MEF_MAX_BYTESEQ] = 2; in mwifiex_set_auto_arp_mef_entry()
3352 mef_entry->filter[filt_num].offset = 20; in mwifiex_set_auto_arp_mef_entry()
3353 mef_entry->filter[filt_num].filt_type = TYPE_EQ; in mwifiex_set_auto_arp_mef_entry()
3354 mef_entry->filter[filt_num].filt_action = TYPE_AND; in mwifiex_set_auto_arp_mef_entry()
3368 mef_entry->mode = MEF_MODE_HOST_SLEEP; in mwifiex_set_wowlan_mef_entry()
3369 mef_entry->action = MEF_ACTION_ALLOW_AND_WAKEUP_HOST; in mwifiex_set_wowlan_mef_entry()
3371 for (i = 0; i < wowlan->n_patterns; i++) { in mwifiex_set_wowlan_mef_entry()
3373 if (!mwifiex_is_pattern_supported(&wowlan->patterns[i], in mwifiex_set_wowlan_mef_entry()
3376 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_set_wowlan_mef_entry()
3378 return -EOPNOTSUPP; in mwifiex_set_wowlan_mef_entry()
3381 if (!wowlan->patterns[i].pkt_offset) { in mwifiex_set_wowlan_mef_entry()
3384 mef_cfg->criteria |= MWIFIEX_CRITERIA_UNICAST; in mwifiex_set_wowlan_mef_entry()
3387 mef_cfg->criteria |= MWIFIEX_CRITERIA_BROADCAST; in mwifiex_set_wowlan_mef_entry()
3393 mef_cfg->criteria |= MWIFIEX_CRITERIA_MULTICAST; in mwifiex_set_wowlan_mef_entry()
3397 mef_entry->filter[filt_num].repeat = 1; in mwifiex_set_wowlan_mef_entry()
3398 mef_entry->filter[filt_num].offset = in mwifiex_set_wowlan_mef_entry()
3399 wowlan->patterns[i].pkt_offset; in mwifiex_set_wowlan_mef_entry()
3400 memcpy(mef_entry->filter[filt_num].byte_seq, byte_seq, in mwifiex_set_wowlan_mef_entry()
3402 mef_entry->filter[filt_num].filt_type = TYPE_EQ; in mwifiex_set_wowlan_mef_entry()
3406 mwifiex_dbg(priv->adapter, INFO, "Wake on patterns\n"); in mwifiex_set_wowlan_mef_entry()
3408 mef_entry->filter[filt_num].filt_action = TYPE_AND; in mwifiex_set_wowlan_mef_entry()
3414 if (wowlan->magic_pkt) { in mwifiex_set_wowlan_mef_entry()
3415 mef_cfg->criteria |= MWIFIEX_CRITERIA_UNICAST; in mwifiex_set_wowlan_mef_entry()
3416 mef_entry->filter[filt_num].repeat = 16; in mwifiex_set_wowlan_mef_entry()
3417 memcpy(mef_entry->filter[filt_num].byte_seq, priv->curr_addr, in mwifiex_set_wowlan_mef_entry()
3419 mef_entry->filter[filt_num].byte_seq[MWIFIEX_MEF_MAX_BYTESEQ] = in mwifiex_set_wowlan_mef_entry()
3421 mef_entry->filter[filt_num].offset = 28; in mwifiex_set_wowlan_mef_entry()
3422 mef_entry->filter[filt_num].filt_type = TYPE_EQ; in mwifiex_set_wowlan_mef_entry()
3424 mef_entry->filter[filt_num].filt_action = TYPE_OR; in mwifiex_set_wowlan_mef_entry()
3427 mef_entry->filter[filt_num].repeat = 16; in mwifiex_set_wowlan_mef_entry()
3428 memcpy(mef_entry->filter[filt_num].byte_seq, priv->curr_addr, in mwifiex_set_wowlan_mef_entry()
3430 mef_entry->filter[filt_num].byte_seq[MWIFIEX_MEF_MAX_BYTESEQ] = in mwifiex_set_wowlan_mef_entry()
3432 mef_entry->filter[filt_num].offset = 56; in mwifiex_set_wowlan_mef_entry()
3433 mef_entry->filter[filt_num].filt_type = TYPE_EQ; in mwifiex_set_wowlan_mef_entry()
3434 mef_entry->filter[filt_num].filt_action = TYPE_OR; in mwifiex_set_wowlan_mef_entry()
3435 mwifiex_dbg(priv->adapter, INFO, "Wake on magic packet\n"); in mwifiex_set_wowlan_mef_entry()
3447 if (wowlan->n_patterns || wowlan->magic_pkt) in mwifiex_set_mef_filter()
3452 return -ENOMEM; in mwifiex_set_mef_filter()
3462 if (wowlan->n_patterns || wowlan->magic_pkt) { in mwifiex_set_mef_filter()
3493 sta_priv->scan_aborting = true; in mwifiex_cfg80211_suspend()
3494 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_cfg80211_suspend()
3495 priv = adapter->priv[i]; in mwifiex_cfg80211_suspend()
3501 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_cfg80211_suspend()
3502 priv = adapter->priv[i]; in mwifiex_cfg80211_suspend()
3503 if (priv->netdev) in mwifiex_cfg80211_suspend()
3504 netif_device_detach(priv->netdev); in mwifiex_cfg80211_suspend()
3510 !skb_queue_empty(&adapter->tx_data_q)) in mwifiex_cfg80211_suspend()
3523 if (!sta_priv->media_connected && !wowlan->nd_config) { in mwifiex_cfg80211_suspend()
3537 hs_cfg.conditions = le32_to_cpu(adapter->hs_cfg.conditions); in mwifiex_cfg80211_suspend()
3539 if (wowlan->nd_config) { in mwifiex_cfg80211_suspend()
3542 mwifiex_cfg80211_sched_scan_start(wiphy, sta_priv->netdev, in mwifiex_cfg80211_suspend()
3543 wowlan->nd_config); in mwifiex_cfg80211_suspend()
3546 if (wowlan->disconnect) { in mwifiex_cfg80211_suspend()
3548 mwifiex_dbg(sta_priv->adapter, INFO, "Wake on device disconnect\n"); in mwifiex_cfg80211_suspend()
3552 hs_cfg.gpio = adapter->hs_cfg.gpio; in mwifiex_cfg80211_suspend()
3553 hs_cfg.gap = adapter->hs_cfg.gap; in mwifiex_cfg80211_suspend()
3560 sta_priv->scan_aborting = false; in mwifiex_cfg80211_suspend()
3573 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_cfg80211_resume()
3574 priv = adapter->priv[i]; in mwifiex_cfg80211_resume()
3575 if (priv->netdev) in mwifiex_cfg80211_resume()
3576 netif_device_attach(priv->netdev); in mwifiex_cfg80211_resume()
3579 if (!wiphy->wowlan_config) in mwifiex_cfg80211_resume()
3587 wakeup_report.pattern_idx = -1; in mwifiex_cfg80211_resume()
3601 if (wiphy->wowlan_config->disconnect) in mwifiex_cfg80211_resume()
3603 if (wiphy->wowlan_config->nd_config) in mwifiex_cfg80211_resume()
3604 wakeup_report.net_detect = adapter->nd_info; in mwifiex_cfg80211_resume()
3609 if (wiphy->wowlan_config->magic_pkt) in mwifiex_cfg80211_resume()
3611 if (wiphy->wowlan_config->n_patterns) in mwifiex_cfg80211_resume()
3615 if (wiphy->wowlan_config->gtk_rekey_failure) in mwifiex_cfg80211_resume()
3624 cfg80211_report_wowlan_wakeup(&priv->wdev, &wakeup_report, in mwifiex_cfg80211_resume()
3628 if (adapter->nd_info) { in mwifiex_cfg80211_resume()
3629 for (i = 0 ; i < adapter->nd_info->n_matches ; i++) in mwifiex_cfg80211_resume()
3630 kfree(adapter->nd_info->matches[i]); in mwifiex_cfg80211_resume()
3631 kfree(adapter->nd_info); in mwifiex_cfg80211_resume()
3632 adapter->nd_info = NULL; in mwifiex_cfg80211_resume()
3643 device_set_wakeup_enable(adapter->dev, enabled); in mwifiex_cfg80211_set_wakeup()
3651 if (!ISSUPP_FIRMWARE_SUPPLICANT(priv->adapter->fw_cap_info)) in mwifiex_set_rekey_data()
3652 return -EOPNOTSUPP; in mwifiex_set_rekey_data()
3654 if (priv->adapter->host_mlme_enabled) in mwifiex_set_rekey_data()
3692 mrule->max_coalescing_delay = crule->delay; in mwifiex_fill_coalesce_rule_info()
3694 param = mrule->params; in mwifiex_fill_coalesce_rule_info()
3696 for (i = 0; i < crule->n_patterns; i++) { in mwifiex_fill_coalesce_rule_info()
3698 if (!mwifiex_is_pattern_supported(&crule->patterns[i], in mwifiex_fill_coalesce_rule_info()
3701 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_fill_coalesce_rule_info()
3703 return -EOPNOTSUPP; in mwifiex_fill_coalesce_rule_info()
3706 if (!crule->patterns[i].pkt_offset) { in mwifiex_fill_coalesce_rule_info()
3710 if (pkt_type && mrule->pkt_type) { in mwifiex_fill_coalesce_rule_info()
3711 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_fill_coalesce_rule_info()
3713 return -EOPNOTSUPP; in mwifiex_fill_coalesce_rule_info()
3715 mrule->pkt_type = pkt_type; in mwifiex_fill_coalesce_rule_info()
3720 if (crule->condition == NL80211_COALESCE_CONDITION_MATCH) in mwifiex_fill_coalesce_rule_info()
3721 param->operation = RECV_FILTER_MATCH_TYPE_EQ; in mwifiex_fill_coalesce_rule_info()
3723 param->operation = RECV_FILTER_MATCH_TYPE_NE; in mwifiex_fill_coalesce_rule_info()
3725 param->operand_len = byte_seq[MWIFIEX_COALESCE_MAX_BYTESEQ]; in mwifiex_fill_coalesce_rule_info()
3726 memcpy(param->operand_byte_stream, byte_seq, in mwifiex_fill_coalesce_rule_info()
3727 param->operand_len); in mwifiex_fill_coalesce_rule_info()
3728 param->offset = crule->patterns[i].pkt_offset; in mwifiex_fill_coalesce_rule_info()
3731 mrule->num_of_fields++; in mwifiex_fill_coalesce_rule_info()
3734 if (!mrule->pkt_type) { in mwifiex_fill_coalesce_rule_info()
3735 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_fill_coalesce_rule_info()
3737 return -EOPNOTSUPP; in mwifiex_fill_coalesce_rule_info()
3761 coalesce_cfg.num_of_rules = coalesce->n_rules; in mwifiex_cfg80211_set_coalesce()
3762 for (i = 0; i < coalesce->n_rules; i++) { in mwifiex_cfg80211_set_coalesce()
3763 ret = mwifiex_fill_coalesce_rule_info(priv, &coalesce->rules[i], in mwifiex_cfg80211_set_coalesce()
3790 if (!(wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS)) in mwifiex_cfg80211_tdls_mgmt()
3791 return -EOPNOTSUPP; in mwifiex_cfg80211_tdls_mgmt()
3794 if (!(priv->bss_type == MWIFIEX_BSS_TYPE_STA && priv->media_connected)) in mwifiex_cfg80211_tdls_mgmt()
3795 return -EOPNOTSUPP; in mwifiex_cfg80211_tdls_mgmt()
3799 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_tdls_mgmt()
3809 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_tdls_mgmt()
3817 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_tdls_mgmt()
3825 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_tdls_mgmt()
3832 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_tdls_mgmt()
3839 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_tdls_mgmt()
3846 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_tdls_mgmt()
3848 ret = -EINVAL; in mwifiex_cfg80211_tdls_mgmt()
3861 if (!(wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) || in mwifiex_cfg80211_tdls_oper()
3862 !(wiphy->flags & WIPHY_FLAG_TDLS_EXTERNAL_SETUP)) in mwifiex_cfg80211_tdls_oper()
3863 return -EOPNOTSUPP; in mwifiex_cfg80211_tdls_oper()
3866 if (!(priv->bss_type == MWIFIEX_BSS_TYPE_STA && priv->media_connected)) in mwifiex_cfg80211_tdls_oper()
3867 return -EOPNOTSUPP; in mwifiex_cfg80211_tdls_oper()
3869 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_tdls_oper()
3881 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_tdls_oper()
3883 return -EINVAL; in mwifiex_cfg80211_tdls_oper()
3886 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_tdls_oper()
3888 return -EINVAL; in mwifiex_cfg80211_tdls_oper()
3891 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_tdls_oper()
3893 return -EINVAL; in mwifiex_cfg80211_tdls_oper()
3895 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_tdls_oper()
3897 return -EOPNOTSUPP; in mwifiex_cfg80211_tdls_oper()
3913 spin_lock_bh(&priv->sta_list_spinlock); in mwifiex_cfg80211_tdls_chan_switch()
3916 spin_unlock_bh(&priv->sta_list_spinlock); in mwifiex_cfg80211_tdls_chan_switch()
3919 return -ENOENT; in mwifiex_cfg80211_tdls_chan_switch()
3922 if (!(sta_ptr->tdls_cap.extcap.ext_capab[3] & in mwifiex_cfg80211_tdls_chan_switch()
3924 spin_unlock_bh(&priv->sta_list_spinlock); in mwifiex_cfg80211_tdls_chan_switch()
3926 return -ENOENT; in mwifiex_cfg80211_tdls_chan_switch()
3929 if (sta_ptr->tdls_status == TDLS_CHAN_SWITCHING || in mwifiex_cfg80211_tdls_chan_switch()
3930 sta_ptr->tdls_status == TDLS_IN_OFF_CHAN) { in mwifiex_cfg80211_tdls_chan_switch()
3931 spin_unlock_bh(&priv->sta_list_spinlock); in mwifiex_cfg80211_tdls_chan_switch()
3932 wiphy_err(wiphy, "channel switch is running, abort request\n"); in mwifiex_cfg80211_tdls_chan_switch()
3933 return -EALREADY; in mwifiex_cfg80211_tdls_chan_switch()
3935 spin_unlock_bh(&priv->sta_list_spinlock); in mwifiex_cfg80211_tdls_chan_switch()
3937 chan = chandef->chan->hw_value; in mwifiex_cfg80211_tdls_chan_switch()
3939 band = chandef->chan->band; in mwifiex_cfg80211_tdls_chan_switch()
3953 spin_lock_bh(&priv->sta_list_spinlock); in mwifiex_cfg80211_tdls_cancel_chan_switch()
3956 spin_unlock_bh(&priv->sta_list_spinlock); in mwifiex_cfg80211_tdls_cancel_chan_switch()
3959 } else if (!(sta_ptr->tdls_status == TDLS_CHAN_SWITCHING || in mwifiex_cfg80211_tdls_cancel_chan_switch()
3960 sta_ptr->tdls_status == TDLS_IN_BASE_CHAN || in mwifiex_cfg80211_tdls_cancel_chan_switch()
3961 sta_ptr->tdls_status == TDLS_IN_OFF_CHAN)) { in mwifiex_cfg80211_tdls_cancel_chan_switch()
3962 spin_unlock_bh(&priv->sta_list_spinlock); in mwifiex_cfg80211_tdls_cancel_chan_switch()
3966 spin_unlock_bh(&priv->sta_list_spinlock); in mwifiex_cfg80211_tdls_cancel_chan_switch()
3989 return -ENOMEM; in mwifiex_cfg80211_uap_add_station()
3991 cfg80211_new_sta(priv->netdev, mac, sinfo, GFP_KERNEL); in mwifiex_cfg80211_uap_add_station()
4004 if (priv->adapter->host_mlme_enabled && in mwifiex_cfg80211_add_station()
4008 if (!(params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER))) in mwifiex_cfg80211_add_station()
4009 return -EOPNOTSUPP; in mwifiex_cfg80211_add_station()
4012 if ((priv->bss_type != MWIFIEX_BSS_TYPE_STA) || !priv->media_connected) in mwifiex_cfg80211_add_station()
4013 return -EOPNOTSUPP; in mwifiex_cfg80211_add_station()
4027 if (priv->adapter->scan_processing) { in mwifiex_cfg80211_channel_switch()
4028 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_channel_switch()
4030 return -EBUSY; in mwifiex_cfg80211_channel_switch()
4033 if (priv->wdev.links[0].cac_started) in mwifiex_cfg80211_channel_switch()
4034 return -EBUSY; in mwifiex_cfg80211_channel_switch()
4036 if (cfg80211_chandef_identical(¶ms->chandef, in mwifiex_cfg80211_channel_switch()
4037 &priv->dfs_chandef)) in mwifiex_cfg80211_channel_switch()
4038 return -EINVAL; in mwifiex_cfg80211_channel_switch()
4041 params->beacon_csa.tail, in mwifiex_cfg80211_channel_switch()
4042 params->beacon_csa.tail_len); in mwifiex_cfg80211_channel_switch()
4044 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_channel_switch()
4045 "Could not parse channel switch announcement IE\n"); in mwifiex_cfg80211_channel_switch()
4046 return -EINVAL; in mwifiex_cfg80211_channel_switch()
4050 if (channel_sw->mode) { in mwifiex_cfg80211_channel_switch()
4051 if (netif_carrier_ok(priv->netdev)) in mwifiex_cfg80211_channel_switch()
4052 netif_carrier_off(priv->netdev); in mwifiex_cfg80211_channel_switch()
4053 mwifiex_stop_net_dev_queue(priv->netdev, priv->adapter); in mwifiex_cfg80211_channel_switch()
4057 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_channel_switch()
4060 if (mwifiex_set_mgmt_ies(priv, ¶ms->beacon_csa)) { in mwifiex_cfg80211_channel_switch()
4061 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_channel_switch()
4063 return -EFAULT; in mwifiex_cfg80211_channel_switch()
4066 memcpy(&priv->dfs_chandef, ¶ms->chandef, sizeof(priv->dfs_chandef)); in mwifiex_cfg80211_channel_switch()
4067 memcpy(&priv->beacon_after, ¶ms->beacon_after, in mwifiex_cfg80211_channel_switch()
4068 sizeof(priv->beacon_after)); in mwifiex_cfg80211_channel_switch()
4070 chsw_msec = max(channel_sw->count * priv->bss_cfg.beacon_period, 100); in mwifiex_cfg80211_channel_switch()
4071 queue_delayed_work(priv->dfs_chan_sw_workqueue, &priv->dfs_chan_sw_work, in mwifiex_cfg80211_channel_switch()
4081 struct mwifiex_private *priv = mwifiex_netdev_get_priv(wdev->netdev); in mwifiex_cfg80211_get_channel()
4087 int ret = -ENODATA; in mwifiex_cfg80211_get_channel()
4090 cfg80211_chandef_valid(&priv->bss_chandef)) { in mwifiex_cfg80211_get_channel()
4091 *chandef = priv->bss_chandef; in mwifiex_cfg80211_get_channel()
4093 } else if (priv->media_connected) { in mwifiex_cfg80211_get_channel()
4094 curr_bss = &priv->curr_bss_params.bss_descriptor; in mwifiex_cfg80211_get_channel()
4095 band = mwifiex_band_to_radio_type(priv->curr_bss_params.band); in mwifiex_cfg80211_get_channel()
4096 freq = ieee80211_channel_to_frequency(curr_bss->channel, band); in mwifiex_cfg80211_get_channel()
4099 if (priv->ht_param_present) { in mwifiex_cfg80211_get_channel()
4121 MWIFIEX_TM_ATTR_MAX = __MWIFIEX_TM_ATTR_AFTER_LAST - 1,
4137 struct mwifiex_private *priv = mwifiex_netdev_get_priv(wdev->netdev); in mwifiex_tm_cmd()
4144 return -EINVAL; in mwifiex_tm_cmd()
4152 return -EINVAL; in mwifiex_tm_cmd()
4157 return -EINVAL; in mwifiex_tm_cmd()
4161 return -ENOMEM; in mwifiex_tm_cmd()
4163 hostcmd->len = nla_len(tb[MWIFIEX_TM_ATTR_DATA]); in mwifiex_tm_cmd()
4164 memcpy(hostcmd->cmd, nla_data(tb[MWIFIEX_TM_ATTR_DATA]), in mwifiex_tm_cmd()
4165 hostcmd->len); in mwifiex_tm_cmd()
4168 dev_err(priv->adapter->dev, "Failed to process hostcmd\n"); in mwifiex_tm_cmd()
4170 return -EFAULT; in mwifiex_tm_cmd()
4174 skb = cfg80211_testmode_alloc_reply_skb(wiphy, hostcmd->len); in mwifiex_tm_cmd()
4177 return -ENOMEM; in mwifiex_tm_cmd()
4180 hostcmd->len, hostcmd->cmd); in mwifiex_tm_cmd()
4184 return -EMSGSIZE; in mwifiex_tm_cmd()
4191 return -EOPNOTSUPP; in mwifiex_tm_cmd()
4205 if (priv->adapter->scan_processing) { in mwifiex_cfg80211_start_radar_detection()
4206 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_start_radar_detection()
4208 return -EBUSY; in mwifiex_cfg80211_start_radar_detection()
4212 mwifiex_dbg(priv->adapter, INFO, in mwifiex_cfg80211_start_radar_detection()
4215 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_start_radar_detection()
4217 return -1; in mwifiex_cfg80211_start_radar_detection()
4219 priv->state_11h.is_11h_active = true; in mwifiex_cfg80211_start_radar_detection()
4226 memcpy(&priv->dfs_chandef, chandef, sizeof(priv->dfs_chandef)); in mwifiex_cfg80211_start_radar_detection()
4230 return -1; in mwifiex_cfg80211_start_radar_detection()
4232 queue_delayed_work(priv->dfs_cac_workqueue, &priv->dfs_cac_work, in mwifiex_cfg80211_start_radar_detection()
4245 if (priv->adapter->host_mlme_enabled && in mwifiex_cfg80211_change_station()
4250 if (!(params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER))) in mwifiex_cfg80211_change_station()
4251 return -EOPNOTSUPP; in mwifiex_cfg80211_change_station()
4254 if ((priv->bss_type != MWIFIEX_BSS_TYPE_STA) || !priv->media_connected) in mwifiex_cfg80211_change_station()
4255 return -EOPNOTSUPP; in mwifiex_cfg80211_change_station()
4257 priv->sta_params = params; in mwifiex_cfg80211_change_station()
4260 priv->sta_params = NULL; in mwifiex_cfg80211_change_station()
4271 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_cfg80211_authenticate()
4282 mwifiex_dbg(priv->adapter, ERROR, "Interface role is AP\n"); in mwifiex_cfg80211_authenticate()
4283 return -EFAULT; in mwifiex_cfg80211_authenticate()
4286 if (priv->wdev.iftype != NL80211_IFTYPE_STATION) { in mwifiex_cfg80211_authenticate()
4287 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_authenticate()
4289 priv->wdev.iftype); in mwifiex_cfg80211_authenticate()
4290 return -EINVAL; in mwifiex_cfg80211_authenticate()
4293 if (priv->auth_alg != WLAN_AUTH_SAE && in mwifiex_cfg80211_authenticate()
4294 (priv->auth_flag & HOST_MLME_AUTH_PENDING)) { in mwifiex_cfg80211_authenticate()
4295 mwifiex_dbg(priv->adapter, ERROR, "Pending auth on going\n"); in mwifiex_cfg80211_authenticate()
4296 return -EBUSY; in mwifiex_cfg80211_authenticate()
4299 if (!priv->host_mlme_reg) { in mwifiex_cfg80211_authenticate()
4300 priv->host_mlme_reg = true; in mwifiex_cfg80211_authenticate()
4301 priv->mgmt_frame_mask |= HOST_MLME_MGMT_MASK; in mwifiex_cfg80211_authenticate()
4304 &priv->mgmt_frame_mask, false); in mwifiex_cfg80211_authenticate()
4307 switch (req->auth_type) { in mwifiex_cfg80211_authenticate()
4324 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_authenticate()
4325 "unsupported auth type=%d\n", req->auth_type); in mwifiex_cfg80211_authenticate()
4326 return -EOPNOTSUPP; in mwifiex_cfg80211_authenticate()
4329 if (!priv->auth_flag) { in mwifiex_cfg80211_authenticate()
4331 req->bss->channel, in mwifiex_cfg80211_authenticate()
4335 priv->roc_cfg.cookie = get_random_u32() | 1; in mwifiex_cfg80211_authenticate()
4336 priv->roc_cfg.chan = *req->bss->channel; in mwifiex_cfg80211_authenticate()
4338 return -EFAULT; in mwifiex_cfg80211_authenticate()
4342 priv->sec_info.authentication_mode = auth_alg; in mwifiex_cfg80211_authenticate()
4346 pkt_len = (u16)req->ie_len + req->auth_data_len + in mwifiex_cfg80211_authenticate()
4348 if (req->auth_data_len >= 4) in mwifiex_cfg80211_authenticate()
4349 pkt_len -= 4; in mwifiex_cfg80211_authenticate()
4355 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_authenticate()
4357 return -ENOMEM; in mwifiex_cfg80211_authenticate()
4362 tx_info->bss_num = priv->bss_num; in mwifiex_cfg80211_authenticate()
4363 tx_info->bss_type = priv->bss_type; in mwifiex_cfg80211_authenticate()
4364 tx_info->pkt_len = pkt_len; in mwifiex_cfg80211_authenticate()
4375 mgmt->frame_control = in mwifiex_cfg80211_authenticate()
4377 memcpy(mgmt->da, req->bss->bssid, ETH_ALEN); in mwifiex_cfg80211_authenticate()
4378 memcpy(mgmt->sa, priv->curr_addr, ETH_ALEN); in mwifiex_cfg80211_authenticate()
4379 memcpy(mgmt->bssid, req->bss->bssid, ETH_ALEN); in mwifiex_cfg80211_authenticate()
4380 eth_broadcast_addr(mgmt->addr4); in mwifiex_cfg80211_authenticate()
4382 if (req->auth_data_len >= 4) { in mwifiex_cfg80211_authenticate()
4383 if (req->auth_type == NL80211_AUTHTYPE_SAE) { in mwifiex_cfg80211_authenticate()
4384 __le16 *pos = (__le16 *)req->auth_data; in mwifiex_cfg80211_authenticate()
4389 memcpy((u8 *)(&mgmt->auth.variable), req->auth_data + 4, in mwifiex_cfg80211_authenticate()
4390 req->auth_data_len - 4); in mwifiex_cfg80211_authenticate()
4391 varptr = (u8 *)&mgmt->auth.variable + in mwifiex_cfg80211_authenticate()
4392 (req->auth_data_len - 4); in mwifiex_cfg80211_authenticate()
4395 mgmt->auth.auth_alg = cpu_to_le16(auth_alg); in mwifiex_cfg80211_authenticate()
4396 mgmt->auth.auth_transaction = cpu_to_le16(trans); in mwifiex_cfg80211_authenticate()
4397 mgmt->auth.status_code = cpu_to_le16(status_code); in mwifiex_cfg80211_authenticate()
4399 if (req->ie && req->ie_len) { in mwifiex_cfg80211_authenticate()
4401 varptr = (u8 *)&mgmt->auth.variable; in mwifiex_cfg80211_authenticate()
4402 memcpy((u8 *)varptr, req->ie, req->ie_len); in mwifiex_cfg80211_authenticate()
4405 priv->auth_flag = HOST_MLME_AUTH_PENDING; in mwifiex_cfg80211_authenticate()
4406 priv->auth_alg = auth_alg; in mwifiex_cfg80211_authenticate()
4408 skb->priority = WMM_HIGHEST_PRIORITY; in mwifiex_cfg80211_authenticate()
4411 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_authenticate()
4412 "auth: send authentication to %pM\n", req->bss->bssid); in mwifiex_cfg80211_authenticate()
4424 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_cfg80211_associate()
4431 "%s: reject infra assoc request in non-STA role\n", in mwifiex_cfg80211_associate()
4432 dev->name); in mwifiex_cfg80211_associate()
4433 return -EINVAL; in mwifiex_cfg80211_associate()
4436 if (test_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags) || in mwifiex_cfg80211_associate()
4437 test_bit(MWIFIEX_IS_CMD_TIMEDOUT, &adapter->work_flags)) { in mwifiex_cfg80211_associate()
4441 dev->name); in mwifiex_cfg80211_associate()
4442 return -EFAULT; in mwifiex_cfg80211_associate()
4445 if (priv->auth_alg == WLAN_AUTH_SAE) in mwifiex_cfg80211_associate()
4446 priv->auth_flag = HOST_MLME_AUTH_DONE; in mwifiex_cfg80211_associate()
4448 if (priv->auth_flag && !(priv->auth_flag & HOST_MLME_AUTH_DONE)) in mwifiex_cfg80211_associate()
4449 return -EBUSY; in mwifiex_cfg80211_associate()
4451 if (priv->roc_cfg.cookie) { in mwifiex_cfg80211_associate()
4453 &priv->roc_cfg.chan, 0); in mwifiex_cfg80211_associate()
4455 memset(&priv->roc_cfg, 0, in mwifiex_cfg80211_associate()
4458 return -EFAULT; in mwifiex_cfg80211_associate()
4462 cfg80211_sched_scan_stopped_locked(priv->wdev.wiphy, 0); in mwifiex_cfg80211_associate()
4466 ssid_ie = ieee80211_bss_get_ie(req->bss, WLAN_EID_SSID); in mwifiex_cfg80211_associate()
4473 mwifiex_dbg(adapter, ERROR, "invalid SSID - aborting\n"); in mwifiex_cfg80211_associate()
4479 mwifiex_dbg(adapter, ERROR, "invalid SSID - aborting\n"); in mwifiex_cfg80211_associate()
4487 priv->sec_info.wpa_enabled = false; in mwifiex_cfg80211_associate()
4488 priv->sec_info.wpa2_enabled = false; in mwifiex_cfg80211_associate()
4489 priv->wep_key_curr_index = 0; in mwifiex_cfg80211_associate()
4490 priv->sec_info.encryption_mode = 0; in mwifiex_cfg80211_associate()
4491 priv->sec_info.is_authtype_auto = 0; in mwifiex_cfg80211_associate()
4493 mwifiex_dbg(priv->adapter, ERROR, "deleting the crypto keys\n"); in mwifiex_cfg80211_associate()
4494 return -EFAULT; in mwifiex_cfg80211_associate()
4497 if (req->crypto.n_ciphers_pairwise) in mwifiex_cfg80211_associate()
4498 priv->sec_info.encryption_mode = in mwifiex_cfg80211_associate()
4499 req->crypto.ciphers_pairwise[0]; in mwifiex_cfg80211_associate()
4501 if (req->crypto.cipher_group) in mwifiex_cfg80211_associate()
4502 priv->sec_info.encryption_mode = req->crypto.cipher_group; in mwifiex_cfg80211_associate()
4504 if (req->ie) in mwifiex_cfg80211_associate()
4505 mwifiex_set_gen_ie(priv, req->ie, req->ie_len); in mwifiex_cfg80211_associate()
4507 memcpy(priv->cfg_bssid, req->bss->bssid, ETH_ALEN); in mwifiex_cfg80211_associate()
4510 "assoc: send association to %pM\n", req->bss->bssid); in mwifiex_cfg80211_associate()
4512 cfg80211_ref_bss(adapter->wiphy, req->bss); in mwifiex_cfg80211_associate()
4513 ret = mwifiex_bss_start(priv, req->bss, &req_ssid); in mwifiex_cfg80211_associate()
4515 priv->auth_flag = 0; in mwifiex_cfg80211_associate()
4516 priv->auth_alg = WLAN_AUTH_NONE; in mwifiex_cfg80211_associate()
4517 eth_zero_addr(priv->cfg_bssid); in mwifiex_cfg80211_associate()
4520 if (priv->assoc_rsp_size) { in mwifiex_cfg80211_associate()
4521 priv->req_bss = req->bss; in mwifiex_cfg80211_associate()
4522 adapter->assoc_resp_received = true; in mwifiex_cfg80211_associate()
4523 queue_work(adapter->host_mlme_workqueue, in mwifiex_cfg80211_associate()
4524 &adapter->host_mlme_work); in mwifiex_cfg80211_associate()
4527 cfg80211_put_bss(priv->adapter->wiphy, req->bss); in mwifiex_cfg80211_associate()
4533 return -EFAULT; in mwifiex_cfg80211_associate()
4541 return mwifiex_cfg80211_disconnect(wiphy, dev, req->reason_code); in mwifiex_cfg80211_deauthenticate()
4549 return mwifiex_cfg80211_disconnect(wiphy, dev, req->reason_code); in mwifiex_cfg80211_disassociate()
4558 * it requires monitor-mode support (which mwifiex doesn't support). in mwifiex_cfg80211_probe_client()
4561 return -EOPNOTSUPP; in mwifiex_cfg80211_probe_client()
4668 if (adapter->config_bands & BAND_A) in mwifiex_init_channel_scan_gap()
4674 adapter->num_in_chan_stats = 2 * (n_channels_bg + n_channels_a); in mwifiex_init_channel_scan_gap()
4675 adapter->chan_stats = kcalloc(adapter->num_in_chan_stats, in mwifiex_init_channel_scan_gap()
4676 sizeof(*adapter->chan_stats), in mwifiex_init_channel_scan_gap()
4679 if (!adapter->chan_stats) in mwifiex_init_channel_scan_gap()
4680 return -ENOMEM; in mwifiex_init_channel_scan_gap()
4698 struct mwifiex_private *priv = adapter->priv[MWIFIEX_BSS_TYPE_STA]; in mwifiex_register_cfg80211()
4703 ops = devm_kmemdup(adapter->dev, &mwifiex_cfg80211_ops, in mwifiex_register_cfg80211()
4706 return -ENOMEM; in mwifiex_register_cfg80211()
4713 return -ENOMEM; in mwifiex_register_cfg80211()
4715 if (adapter->host_mlme_enabled) { in mwifiex_register_cfg80211()
4716 ops->auth = mwifiex_cfg80211_authenticate; in mwifiex_register_cfg80211()
4717 ops->assoc = mwifiex_cfg80211_associate; in mwifiex_register_cfg80211()
4718 ops->deauth = mwifiex_cfg80211_deauthenticate; in mwifiex_register_cfg80211()
4719 ops->disassoc = mwifiex_cfg80211_disassociate; in mwifiex_register_cfg80211()
4720 ops->disconnect = NULL; in mwifiex_register_cfg80211()
4721 ops->connect = NULL; in mwifiex_register_cfg80211()
4722 ops->probe_client = mwifiex_cfg80211_probe_client; in mwifiex_register_cfg80211()
4724 wiphy->max_scan_ssids = MWIFIEX_MAX_SSID_LIST_LENGTH; in mwifiex_register_cfg80211()
4725 wiphy->max_scan_ie_len = MWIFIEX_MAX_VSIE_LEN; in mwifiex_register_cfg80211()
4726 if (adapter->host_mlme_enabled) { in mwifiex_register_cfg80211()
4727 memcpy(adapter->mwifiex_mgmt_stypes, in mwifiex_register_cfg80211()
4732 adapter->mwifiex_mgmt_stypes[NL80211_IFTYPE_AP].tx = 0xffff; in mwifiex_register_cfg80211()
4733 adapter->mwifiex_mgmt_stypes[NL80211_IFTYPE_AP].rx = in mwifiex_register_cfg80211()
4741 wiphy->mgmt_stypes = adapter->mwifiex_mgmt_stypes; in mwifiex_register_cfg80211()
4743 wiphy->mgmt_stypes = mwifiex_mgmt_stypes; in mwifiex_register_cfg80211()
4745 wiphy->max_remain_on_channel_duration = 5000; in mwifiex_register_cfg80211()
4746 wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | in mwifiex_register_cfg80211()
4751 wiphy->max_num_akm_suites = CFG80211_MAX_NUM_AKM_SUITES; in mwifiex_register_cfg80211()
4753 if (ISSUPP_ADHOC_ENABLED(adapter->fw_cap_info)) in mwifiex_register_cfg80211()
4754 wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC); in mwifiex_register_cfg80211()
4756 wiphy->bands[NL80211_BAND_2GHZ] = devm_kmemdup(adapter->dev, in mwifiex_register_cfg80211()
4760 if (!wiphy->bands[NL80211_BAND_2GHZ]) { in mwifiex_register_cfg80211()
4761 ret = -ENOMEM; in mwifiex_register_cfg80211()
4765 if (adapter->config_bands & BAND_A) { in mwifiex_register_cfg80211()
4766 wiphy->bands[NL80211_BAND_5GHZ] = devm_kmemdup(adapter->dev, in mwifiex_register_cfg80211()
4770 if (!wiphy->bands[NL80211_BAND_5GHZ]) { in mwifiex_register_cfg80211()
4771 ret = -ENOMEM; in mwifiex_register_cfg80211()
4775 wiphy->bands[NL80211_BAND_5GHZ] = NULL; in mwifiex_register_cfg80211()
4778 if (adapter->drcs_enabled && ISSUPP_DRCS_ENABLED(adapter->fw_cap_info)) in mwifiex_register_cfg80211()
4779 wiphy->iface_combinations = &mwifiex_iface_comb_ap_sta_drcs; in mwifiex_register_cfg80211()
4780 else if (adapter->is_hw_11ac_capable) in mwifiex_register_cfg80211()
4781 wiphy->iface_combinations = &mwifiex_iface_comb_ap_sta_vht; in mwifiex_register_cfg80211()
4783 wiphy->iface_combinations = &mwifiex_iface_comb_ap_sta; in mwifiex_register_cfg80211()
4784 wiphy->n_iface_combinations = 1; in mwifiex_register_cfg80211()
4786 wiphy->max_ap_assoc_sta = max_t(typeof(wiphy->max_ap_assoc_sta), in mwifiex_register_cfg80211()
4787 adapter->max_sta_conn, in mwifiex_register_cfg80211()
4788 adapter->max_p2p_conn); in mwifiex_register_cfg80211()
4791 wiphy->cipher_suites = mwifiex_cipher_suites; in mwifiex_register_cfg80211()
4792 wiphy->n_cipher_suites = ARRAY_SIZE(mwifiex_cipher_suites); in mwifiex_register_cfg80211()
4794 if (adapter->regd) { in mwifiex_register_cfg80211()
4795 wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG | in mwifiex_register_cfg80211()
4798 wiphy_apply_custom_regulatory(wiphy, adapter->regd); in mwifiex_register_cfg80211()
4801 ether_addr_copy(wiphy->perm_addr, adapter->perm_addr); in mwifiex_register_cfg80211()
4802 wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; in mwifiex_register_cfg80211()
4803 wiphy->flags |= WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD | in mwifiex_register_cfg80211()
4810 if (adapter->host_mlme_enabled) in mwifiex_register_cfg80211()
4811 wiphy->flags |= WIPHY_FLAG_REPORTS_OBSS; in mwifiex_register_cfg80211()
4813 wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME; in mwifiex_register_cfg80211()
4815 if (ISSUPP_TDLS_ENABLED(adapter->fw_cap_info)) in mwifiex_register_cfg80211()
4816 wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS | in mwifiex_register_cfg80211()
4820 if (ISSUPP_FIRMWARE_SUPPLICANT(priv->adapter->fw_cap_info)) in mwifiex_register_cfg80211()
4821 wiphy->wowlan = &mwifiex_wowlan_support; in mwifiex_register_cfg80211()
4823 wiphy->wowlan = &mwifiex_wowlan_support_no_gtk; in mwifiex_register_cfg80211()
4826 wiphy->coalesce = &mwifiex_coalesce_support; in mwifiex_register_cfg80211()
4828 wiphy->probe_resp_offload = NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS | in mwifiex_register_cfg80211()
4832 wiphy->max_sched_scan_reqs = 1; in mwifiex_register_cfg80211()
4833 wiphy->max_sched_scan_ssids = MWIFIEX_MAX_SSID_LIST_LENGTH; in mwifiex_register_cfg80211()
4834 wiphy->max_sched_scan_ie_len = MWIFIEX_MAX_VSIE_LEN; in mwifiex_register_cfg80211()
4835 wiphy->max_match_sets = MWIFIEX_MAX_SSID_LIST_LENGTH; in mwifiex_register_cfg80211()
4837 wiphy->available_antennas_tx = BIT(adapter->number_of_antenna) - 1; in mwifiex_register_cfg80211()
4838 wiphy->available_antennas_rx = BIT(adapter->number_of_antenna) - 1; in mwifiex_register_cfg80211()
4840 wiphy->features |= NL80211_FEATURE_INACTIVITY_TIMER | in mwifiex_register_cfg80211()
4844 if (adapter->host_mlme_enabled) in mwifiex_register_cfg80211()
4845 wiphy->features |= NL80211_FEATURE_SAE; in mwifiex_register_cfg80211()
4847 if (ISSUPP_ADHOC_ENABLED(adapter->fw_cap_info)) in mwifiex_register_cfg80211()
4848 wiphy->features |= NL80211_FEATURE_HT_IBSS; in mwifiex_register_cfg80211()
4850 if (ISSUPP_RANDOM_MAC(adapter->fw_cap_info)) in mwifiex_register_cfg80211()
4851 wiphy->features |= NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR | in mwifiex_register_cfg80211()
4855 if (ISSUPP_TDLS_ENABLED(adapter->fw_cap_info)) in mwifiex_register_cfg80211()
4856 wiphy->features |= NL80211_FEATURE_TDLS_CHANNEL_SWITCH; in mwifiex_register_cfg80211()
4858 if (adapter->fw_api_ver == MWIFIEX_FW_V15) in mwifiex_register_cfg80211()
4859 wiphy->features |= NL80211_FEATURE_SK_TX_STATUS; in mwifiex_register_cfg80211()
4862 wiphy->bss_priv_size = sizeof(struct mwifiex_bss_priv); in mwifiex_register_cfg80211()
4864 wiphy->reg_notifier = mwifiex_reg_notifier; in mwifiex_register_cfg80211()
4870 set_wiphy_dev(wiphy, priv->adapter->dev); in mwifiex_register_cfg80211()
4879 if (!adapter->regd) { in mwifiex_register_cfg80211()
4885 if (adapter->region_code == 0x00) { in mwifiex_register_cfg80211()
4889 wiphy->regulatory_flags |= in mwifiex_register_cfg80211()
4894 adapter->region_code); in mwifiex_register_cfg80211()
4897 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_register_cfg80211()
4905 wiphy->frag_threshold = thr; in mwifiex_register_cfg80211()
4908 wiphy->rts_threshold = thr; in mwifiex_register_cfg80211()
4911 wiphy->retry_short = (u8) retry; in mwifiex_register_cfg80211()
4914 wiphy->retry_long = (u8) retry; in mwifiex_register_cfg80211()
4916 adapter->wiphy = wiphy; in mwifiex_register_cfg80211()