Lines Matching +full:cs +full:- +full:dev +full:- +full:assoc
1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright 2011-2020 NXP
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
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()
236 "assoc: send assoc resp to %pM\n", 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()
240 "assoc: send reassoc resp to %pM\n", 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()
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()
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()
425 *dbm = priv->tx_power_level; in mwifiex_cfg80211_get_tx_power()
437 struct net_device *dev, in mwifiex_cfg80211_set_power_mgmt() argument
440 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_set_power_mgmt()
444 mwifiex_dbg(priv->adapter, INFO, in mwifiex_cfg80211_set_power_mgmt()
463 if (!priv->sec_info.wep_enabled) in mwifiex_cfg80211_set_default_key()
466 if (priv->bss_type == MWIFIEX_BSS_TYPE_UAP) { in mwifiex_cfg80211_set_default_key()
467 priv->wep_key_curr_index = key_index; in mwifiex_cfg80211_set_default_key()
470 mwifiex_dbg(priv->adapter, ERROR, "set default Tx key index\n"); in mwifiex_cfg80211_set_default_key()
471 return -EFAULT; in mwifiex_cfg80211_set_default_key()
491 (params->cipher == WLAN_CIPHER_SUITE_WEP40 || in mwifiex_cfg80211_add_key()
492 params->cipher == WLAN_CIPHER_SUITE_WEP104)) { in mwifiex_cfg80211_add_key()
493 if (params->key && params->key_len) { in mwifiex_cfg80211_add_key()
494 wep_key = &priv->wep_key[key_index]; in mwifiex_cfg80211_add_key()
496 memcpy(wep_key->key_material, params->key, in mwifiex_cfg80211_add_key()
497 params->key_len); in mwifiex_cfg80211_add_key()
498 wep_key->key_index = key_index; in mwifiex_cfg80211_add_key()
499 wep_key->key_length = params->key_len; in mwifiex_cfg80211_add_key()
500 priv->sec_info.wep_enabled = 1; in mwifiex_cfg80211_add_key()
505 if (mwifiex_set_encode(priv, params, params->key, params->key_len, in mwifiex_cfg80211_add_key()
507 mwifiex_dbg(priv->adapter, ERROR, "crypto keys added\n"); in mwifiex_cfg80211_add_key()
508 return -EFAULT; in mwifiex_cfg80211_add_key()
528 if (priv->adapter->host_mlme_enabled) in mwifiex_cfg80211_set_default_mgmt_key()
539 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_set_default_mgmt_key()
541 return -1; in mwifiex_cfg80211_set_default_mgmt_key()
550 * The following information are passed to the firmware -
551 * - Country codes
552 * - Sub bands (first channel, number of channels, maximum Tx power)
566 struct mwifiex_802_11d_domain_reg *domain_info = &adapter->domain_reg; in mwifiex_send_domain_info_cmd_fw()
569 domain_info->country_code[0] = adapter->country_code[0]; in mwifiex_send_domain_info_cmd_fw()
570 domain_info->country_code[1] = adapter->country_code[1]; in mwifiex_send_domain_info_cmd_fw()
571 domain_info->country_code[2] = ' '; in mwifiex_send_domain_info_cmd_fw()
573 band = mwifiex_band_to_radio_type(adapter->config_bands); in mwifiex_send_domain_info_cmd_fw()
574 if (!wiphy->bands[band]) { in mwifiex_send_domain_info_cmd_fw()
577 return -1; in mwifiex_send_domain_info_cmd_fw()
580 sband = wiphy->bands[band]; in mwifiex_send_domain_info_cmd_fw()
582 for (i = 0; i < sband->n_channels ; i++) { in mwifiex_send_domain_info_cmd_fw()
583 ch = &sband->channels[i]; in mwifiex_send_domain_info_cmd_fw()
584 if (ch->flags & IEEE80211_CHAN_DISABLED) in mwifiex_send_domain_info_cmd_fw()
589 first_chan = (u32) ch->hw_value; in mwifiex_send_domain_info_cmd_fw()
591 max_pwr = ch->max_power; in mwifiex_send_domain_info_cmd_fw()
596 if (ch->hw_value == next_chan + 1 && in mwifiex_send_domain_info_cmd_fw()
597 ch->max_power == max_pwr) { in mwifiex_send_domain_info_cmd_fw()
601 t = &domain_info->triplet[no_of_triplet]; in mwifiex_send_domain_info_cmd_fw()
602 t->chans.first_channel = first_chan; in mwifiex_send_domain_info_cmd_fw()
603 t->chans.num_channels = no_of_parsed_chan; in mwifiex_send_domain_info_cmd_fw()
604 t->chans.max_power = max_pwr; in mwifiex_send_domain_info_cmd_fw()
606 first_chan = (u32) ch->hw_value; in mwifiex_send_domain_info_cmd_fw()
608 max_pwr = ch->max_power; in mwifiex_send_domain_info_cmd_fw()
614 t = &domain_info->triplet[no_of_triplet]; in mwifiex_send_domain_info_cmd_fw()
615 t->chans.first_channel = first_chan; in mwifiex_send_domain_info_cmd_fw()
616 t->chans.num_channels = no_of_parsed_chan; in mwifiex_send_domain_info_cmd_fw()
617 t->chans.max_power = max_pwr; in mwifiex_send_domain_info_cmd_fw()
621 domain_info->no_of_triplet = no_of_triplet; in mwifiex_send_domain_info_cmd_fw()
629 return -1; in mwifiex_send_domain_info_cmd_fw()
641 if (!wiphy->bands[NL80211_BAND_5GHZ]) in mwifiex_reg_apply_radar_flags()
643 sband = wiphy->bands[NL80211_BAND_5GHZ]; in mwifiex_reg_apply_radar_flags()
645 for (i = 0; i < sband->n_channels; i++) { in mwifiex_reg_apply_radar_flags()
646 chan = &sband->channels[i]; in mwifiex_reg_apply_radar_flags()
647 if ((!(chan->flags & IEEE80211_CHAN_DISABLED)) && in mwifiex_reg_apply_radar_flags()
648 (chan->flags & IEEE80211_CHAN_RADAR)) in mwifiex_reg_apply_radar_flags()
649 chan->flags |= IEEE80211_CHAN_NO_IR; in mwifiex_reg_apply_radar_flags()
657 * following reasons -
658 * - Set by driver
659 * - Set by system core
660 * - Set by user
661 * - Set bt Country IE
671 request->alpha2[0], request->alpha2[1]); in mwifiex_reg_notifier()
674 switch (request->initiator) { in mwifiex_reg_notifier()
683 request->initiator); in mwifiex_reg_notifier()
688 if (strncmp(request->alpha2, "00", 2) && in mwifiex_reg_notifier()
689 strncmp(request->alpha2, adapter->country_code, in mwifiex_reg_notifier()
690 sizeof(request->alpha2))) { in mwifiex_reg_notifier()
691 memcpy(adapter->country_code, request->alpha2, in mwifiex_reg_notifier()
692 sizeof(request->alpha2)); in mwifiex_reg_notifier()
749 switch (priv->bss_role) { in mwifiex_cfg80211_set_wiphy_params()
751 if (priv->bss_started) { in mwifiex_cfg80211_set_wiphy_params()
754 return -EINVAL; in mwifiex_cfg80211_set_wiphy_params()
759 return -ENOMEM; in mwifiex_cfg80211_set_wiphy_params()
764 bss_cfg->rts_threshold = wiphy->rts_threshold; in mwifiex_cfg80211_set_wiphy_params()
766 bss_cfg->frag_threshold = wiphy->frag_threshold; in mwifiex_cfg80211_set_wiphy_params()
768 bss_cfg->retry_limit = wiphy->retry_long; in mwifiex_cfg80211_set_wiphy_params()
784 if (priv->media_connected) { in mwifiex_cfg80211_set_wiphy_params()
787 return -EINVAL; in mwifiex_cfg80211_set_wiphy_params()
791 wiphy->rts_threshold); in mwifiex_cfg80211_set_wiphy_params()
797 wiphy->frag_threshold); in mwifiex_cfg80211_set_wiphy_params()
814 return -1; in mwifiex_cfg80211_deinit_p2p()
822 * disable -> device -> client
830 return -1; in mwifiex_cfg80211_init_p2p_client()
835 return -1; in mwifiex_cfg80211_init_p2p_client()
840 return -1; in mwifiex_cfg80211_init_p2p_client()
848 * disable -> device -> GO
856 return -1; in mwifiex_cfg80211_init_p2p_go()
861 return -1; in mwifiex_cfg80211_init_p2p_go()
866 return -1; in mwifiex_cfg80211_init_p2p_go()
873 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_deinit_priv_params()
876 priv->host_mlme_reg = false; in mwifiex_deinit_priv_params()
877 priv->mgmt_frame_mask = 0; in mwifiex_deinit_priv_params()
880 &priv->mgmt_frame_mask, false)) { in mwifiex_deinit_priv_params()
883 return -1; in mwifiex_deinit_priv_params()
888 spin_lock_irqsave(&adapter->main_proc_lock, flags); in mwifiex_deinit_priv_params()
889 adapter->main_locked = true; in mwifiex_deinit_priv_params()
890 if (adapter->mwifiex_processing) { in mwifiex_deinit_priv_params()
891 spin_unlock_irqrestore(&adapter->main_proc_lock, flags); in mwifiex_deinit_priv_params()
892 flush_workqueue(adapter->workqueue); in mwifiex_deinit_priv_params()
894 spin_unlock_irqrestore(&adapter->main_proc_lock, flags); in mwifiex_deinit_priv_params()
897 spin_lock_bh(&adapter->rx_proc_lock); in mwifiex_deinit_priv_params()
898 adapter->rx_locked = true; in mwifiex_deinit_priv_params()
899 if (adapter->rx_processing) { in mwifiex_deinit_priv_params()
900 spin_unlock_bh(&adapter->rx_proc_lock); in mwifiex_deinit_priv_params()
901 flush_workqueue(adapter->rx_workqueue); in mwifiex_deinit_priv_params()
903 spin_unlock_bh(&adapter->rx_proc_lock); in mwifiex_deinit_priv_params()
907 priv->wdev.iftype = NL80211_IFTYPE_UNSPECIFIED; in mwifiex_deinit_priv_params()
908 priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED; in mwifiex_deinit_priv_params()
909 priv->sec_info.authentication_mode = NL80211_AUTHTYPE_OPEN_SYSTEM; in mwifiex_deinit_priv_params()
916 struct net_device *dev, in mwifiex_init_new_priv_params() argument
919 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_init_new_priv_params()
924 priv->bss_mode = type; in mwifiex_init_new_priv_params()
925 priv->wdev.iftype = type; in mwifiex_init_new_priv_params()
927 mwifiex_init_priv_params(priv, priv->netdev); in mwifiex_init_new_priv_params()
928 priv->bss_started = 0; in mwifiex_init_new_priv_params()
933 priv->bss_role = MWIFIEX_BSS_ROLE_STA; in mwifiex_init_new_priv_params()
934 priv->bss_type = MWIFIEX_BSS_TYPE_STA; in mwifiex_init_new_priv_params()
937 priv->bss_role = MWIFIEX_BSS_ROLE_STA; in mwifiex_init_new_priv_params()
938 priv->bss_type = MWIFIEX_BSS_TYPE_P2P; in mwifiex_init_new_priv_params()
941 priv->bss_role = MWIFIEX_BSS_ROLE_UAP; in mwifiex_init_new_priv_params()
942 priv->bss_type = MWIFIEX_BSS_TYPE_P2P; in mwifiex_init_new_priv_params()
945 priv->bss_role = MWIFIEX_BSS_ROLE_UAP; in mwifiex_init_new_priv_params()
946 priv->bss_type = MWIFIEX_BSS_TYPE_UAP; in mwifiex_init_new_priv_params()
951 dev->name, type); in mwifiex_init_new_priv_params()
952 return -EOPNOTSUPP; in mwifiex_init_new_priv_params()
955 priv->bss_num = mwifiex_get_unused_bss_num(adapter, priv->bss_type); in mwifiex_init_new_priv_params()
957 spin_lock_irqsave(&adapter->main_proc_lock, flags); in mwifiex_init_new_priv_params()
958 adapter->main_locked = false; in mwifiex_init_new_priv_params()
959 spin_unlock_irqrestore(&adapter->main_proc_lock, flags); in mwifiex_init_new_priv_params()
961 spin_lock_bh(&adapter->rx_proc_lock); in mwifiex_init_new_priv_params()
962 adapter->rx_locked = false; in mwifiex_init_new_priv_params()
963 spin_unlock_bh(&adapter->rx_proc_lock); in mwifiex_init_new_priv_params()
965 mwifiex_set_mac_address(priv, dev, false, NULL); in mwifiex_init_new_priv_params()
982 return adapter->curr_iface_comb.p2p_intf != in is_vif_type_change_allowed()
983 adapter->iface_limit.p2p_intf; in is_vif_type_change_allowed()
985 return adapter->curr_iface_comb.uap_intf != in is_vif_type_change_allowed()
986 adapter->iface_limit.uap_intf; in is_vif_type_change_allowed()
997 return adapter->curr_iface_comb.p2p_intf != in is_vif_type_change_allowed()
998 adapter->iface_limit.p2p_intf; in is_vif_type_change_allowed()
1000 return adapter->curr_iface_comb.uap_intf != in is_vif_type_change_allowed()
1001 adapter->iface_limit.uap_intf; in is_vif_type_change_allowed()
1010 return adapter->curr_iface_comb.sta_intf != in is_vif_type_change_allowed()
1011 adapter->iface_limit.sta_intf; in is_vif_type_change_allowed()
1014 return adapter->curr_iface_comb.p2p_intf != in is_vif_type_change_allowed()
1015 adapter->iface_limit.p2p_intf; in is_vif_type_change_allowed()
1028 return adapter->curr_iface_comb.uap_intf != in is_vif_type_change_allowed()
1029 adapter->iface_limit.uap_intf; in is_vif_type_change_allowed()
1042 return adapter->curr_iface_comb.uap_intf != in is_vif_type_change_allowed()
1043 adapter->iface_limit.uap_intf; in is_vif_type_change_allowed()
1064 adapter->curr_iface_comb.sta_intf += change; in update_vif_type_counter()
1067 adapter->curr_iface_comb.uap_intf += change; in update_vif_type_counter()
1071 adapter->curr_iface_comb.p2p_intf += change; in update_vif_type_counter()
1082 mwifiex_change_vif_to_p2p(struct net_device *dev, in mwifiex_change_vif_to_p2p() argument
1090 priv = mwifiex_netdev_get_priv(dev); in mwifiex_change_vif_to_p2p()
1093 return -1; in mwifiex_change_vif_to_p2p()
1095 adapter = priv->adapter; in mwifiex_change_vif_to_p2p()
1098 "%s: changing role to p2p\n", dev->name); in mwifiex_change_vif_to_p2p()
1101 return -1; in mwifiex_change_vif_to_p2p()
1102 if (mwifiex_init_new_priv_params(priv, dev, type)) in mwifiex_change_vif_to_p2p()
1103 return -1; in mwifiex_change_vif_to_p2p()
1105 update_vif_type_counter(adapter, curr_iftype, -1); in mwifiex_change_vif_to_p2p()
1107 dev->ieee80211_ptr->iftype = type; in mwifiex_change_vif_to_p2p()
1112 return -EFAULT; in mwifiex_change_vif_to_p2p()
1116 return -EFAULT; in mwifiex_change_vif_to_p2p()
1121 dev->name, type); in mwifiex_change_vif_to_p2p()
1122 return -EOPNOTSUPP; in mwifiex_change_vif_to_p2p()
1127 return -1; in mwifiex_change_vif_to_p2p()
1130 return -1; in mwifiex_change_vif_to_p2p()
1136 mwifiex_change_vif_to_sta_adhoc(struct net_device *dev, in mwifiex_change_vif_to_sta_adhoc() argument
1144 priv = mwifiex_netdev_get_priv(dev); in mwifiex_change_vif_to_sta_adhoc()
1147 return -1; in mwifiex_change_vif_to_sta_adhoc()
1149 adapter = priv->adapter; in mwifiex_change_vif_to_sta_adhoc()
1153 "%s: changing role to station\n", dev->name); in mwifiex_change_vif_to_sta_adhoc()
1156 "%s: changing role to adhoc\n", dev->name); in mwifiex_change_vif_to_sta_adhoc()
1159 return -1; in mwifiex_change_vif_to_sta_adhoc()
1160 if (mwifiex_init_new_priv_params(priv, dev, type)) in mwifiex_change_vif_to_sta_adhoc()
1161 return -1; in mwifiex_change_vif_to_sta_adhoc()
1163 update_vif_type_counter(adapter, curr_iftype, -1); in mwifiex_change_vif_to_sta_adhoc()
1165 dev->ieee80211_ptr->iftype = type; in mwifiex_change_vif_to_sta_adhoc()
1169 return -1; in mwifiex_change_vif_to_sta_adhoc()
1171 return -1; in mwifiex_change_vif_to_sta_adhoc()
1177 mwifiex_change_vif_to_ap(struct net_device *dev, in mwifiex_change_vif_to_ap() argument
1185 priv = mwifiex_netdev_get_priv(dev); in mwifiex_change_vif_to_ap()
1188 return -1; in mwifiex_change_vif_to_ap()
1190 adapter = priv->adapter; in mwifiex_change_vif_to_ap()
1193 "%s: changing role to AP\n", dev->name); in mwifiex_change_vif_to_ap()
1196 return -1; in mwifiex_change_vif_to_ap()
1197 if (mwifiex_init_new_priv_params(priv, dev, type)) in mwifiex_change_vif_to_ap()
1198 return -1; in mwifiex_change_vif_to_ap()
1200 update_vif_type_counter(adapter, curr_iftype, -1); in mwifiex_change_vif_to_ap()
1202 dev->ieee80211_ptr->iftype = type; in mwifiex_change_vif_to_ap()
1206 return -1; in mwifiex_change_vif_to_ap()
1208 return -1; in mwifiex_change_vif_to_ap()
1217 struct net_device *dev, in mwifiex_cfg80211_change_virtual_intf() argument
1221 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_change_virtual_intf()
1222 enum nl80211_iftype curr_iftype = dev->ieee80211_ptr->iftype; in mwifiex_cfg80211_change_virtual_intf()
1224 if (priv->scan_request) { in mwifiex_cfg80211_change_virtual_intf()
1225 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_change_virtual_intf()
1227 return -EBUSY; in mwifiex_cfg80211_change_virtual_intf()
1231 mwifiex_dbg(priv->adapter, INFO, in mwifiex_cfg80211_change_virtual_intf()
1233 dev->name, curr_iftype); in mwifiex_cfg80211_change_virtual_intf()
1238 mwifiex_dbg(priv->adapter, INFO, in mwifiex_cfg80211_change_virtual_intf()
1240 dev->name, curr_iftype); in mwifiex_cfg80211_change_virtual_intf()
1244 if (!is_vif_type_change_allowed(priv->adapter, curr_iftype, type)) { in mwifiex_cfg80211_change_virtual_intf()
1245 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_change_virtual_intf()
1247 dev->name, curr_iftype, type); in mwifiex_cfg80211_change_virtual_intf()
1248 return -EOPNOTSUPP; in mwifiex_cfg80211_change_virtual_intf()
1255 priv->bss_mode = type; in mwifiex_cfg80211_change_virtual_intf()
1256 priv->sec_info.authentication_mode = in mwifiex_cfg80211_change_virtual_intf()
1258 dev->ieee80211_ptr->iftype = type; in mwifiex_cfg80211_change_virtual_intf()
1265 return mwifiex_change_vif_to_p2p(dev, curr_iftype, in mwifiex_cfg80211_change_virtual_intf()
1268 return mwifiex_change_vif_to_ap(dev, curr_iftype, type, in mwifiex_cfg80211_change_virtual_intf()
1277 priv->bss_mode = type; in mwifiex_cfg80211_change_virtual_intf()
1278 priv->sec_info.authentication_mode = in mwifiex_cfg80211_change_virtual_intf()
1280 dev->ieee80211_ptr->iftype = type; in mwifiex_cfg80211_change_virtual_intf()
1287 return mwifiex_change_vif_to_p2p(dev, curr_iftype, in mwifiex_cfg80211_change_virtual_intf()
1290 return mwifiex_change_vif_to_ap(dev, curr_iftype, type, in mwifiex_cfg80211_change_virtual_intf()
1300 return mwifiex_change_vif_to_sta_adhoc(dev, curr_iftype, in mwifiex_cfg80211_change_virtual_intf()
1305 return mwifiex_change_vif_to_p2p(dev, curr_iftype, in mwifiex_cfg80211_change_virtual_intf()
1313 return -EFAULT; in mwifiex_cfg80211_change_virtual_intf()
1318 return mwifiex_change_vif_to_sta_adhoc(dev, curr_iftype, in mwifiex_cfg80211_change_virtual_intf()
1321 return mwifiex_change_vif_to_p2p(dev, curr_iftype, in mwifiex_cfg80211_change_virtual_intf()
1324 return mwifiex_change_vif_to_ap(dev, curr_iftype, type, in mwifiex_cfg80211_change_virtual_intf()
1332 return -EFAULT; in mwifiex_cfg80211_change_virtual_intf()
1337 return mwifiex_change_vif_to_sta_adhoc(dev, curr_iftype, in mwifiex_cfg80211_change_virtual_intf()
1340 return mwifiex_change_vif_to_p2p(dev, curr_iftype, in mwifiex_cfg80211_change_virtual_intf()
1343 return mwifiex_change_vif_to_ap(dev, curr_iftype, type, in mwifiex_cfg80211_change_virtual_intf()
1357 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_change_virtual_intf()
1360 return -EOPNOTSUPP; in mwifiex_cfg80211_change_virtual_intf()
1367 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_parse_htinfo()
1369 if (adapter->is_hw_11ac_capable) { in mwifiex_parse_htinfo()
1370 /* bit[1-0]: 00=LG 01=HT 10=VHT */ in mwifiex_parse_htinfo()
1373 rate->mcs = rateinfo; in mwifiex_parse_htinfo()
1374 rate->flags |= RATE_INFO_FLAGS_MCS; in mwifiex_parse_htinfo()
1378 rate->mcs = rateinfo & 0x0F; in mwifiex_parse_htinfo()
1379 rate->flags |= RATE_INFO_FLAGS_VHT_MCS; in mwifiex_parse_htinfo()
1386 rate->bw = RATE_INFO_BW_20; in mwifiex_parse_htinfo()
1389 rate->bw = RATE_INFO_BW_40; in mwifiex_parse_htinfo()
1392 rate->bw = RATE_INFO_BW_80; in mwifiex_parse_htinfo()
1395 rate->bw = RATE_INFO_BW_160; in mwifiex_parse_htinfo()
1400 rate->flags |= RATE_INFO_FLAGS_SHORT_GI; in mwifiex_parse_htinfo()
1403 rate->nss = 2; in mwifiex_parse_htinfo()
1405 rate->nss = 1; in mwifiex_parse_htinfo()
1413 rate->mcs = rateinfo; in mwifiex_parse_htinfo()
1414 rate->flags |= RATE_INFO_FLAGS_MCS; in mwifiex_parse_htinfo()
1415 rate->bw = RATE_INFO_BW_20; in mwifiex_parse_htinfo()
1417 rate->bw = RATE_INFO_BW_40; in mwifiex_parse_htinfo()
1419 rate->flags |= RATE_INFO_FLAGS_SHORT_GI; in mwifiex_parse_htinfo()
1423 /* Decode legacy rates for non-HT. */ in mwifiex_parse_htinfo()
1442 rate->legacy = legacy_rates[rateinfo]; in mwifiex_parse_htinfo()
1449 * The following information are shown -
1450 * - Total bytes transmitted
1451 * - Total bytes received
1452 * - Total packets transmitted
1453 * - Total packets received
1454 * - Signal quality level
1455 * - Transmission rate
1464 sinfo->filled = BIT_ULL(NL80211_STA_INFO_RX_BYTES) | BIT_ULL(NL80211_STA_INFO_TX_BYTES) | in mwifiex_dump_station_info()
1471 return -ENOENT; in mwifiex_dump_station_info()
1473 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME) | in mwifiex_dump_station_info()
1475 sinfo->inactive_time = in mwifiex_dump_station_info()
1476 jiffies_to_msecs(jiffies - node->stats.last_rx); in mwifiex_dump_station_info()
1478 sinfo->signal = node->stats.rssi; in mwifiex_dump_station_info()
1479 sinfo->signal_avg = node->stats.rssi; in mwifiex_dump_station_info()
1480 sinfo->rx_bytes = node->stats.rx_bytes; in mwifiex_dump_station_info()
1481 sinfo->tx_bytes = node->stats.tx_bytes; in mwifiex_dump_station_info()
1482 sinfo->rx_packets = node->stats.rx_packets; in mwifiex_dump_station_info()
1483 sinfo->tx_packets = node->stats.tx_packets; in mwifiex_dump_station_info()
1484 sinfo->tx_failed = node->stats.tx_failed; in mwifiex_dump_station_info()
1486 mwifiex_parse_htinfo(priv, priv->tx_rate, in mwifiex_dump_station_info()
1487 node->stats.last_tx_htinfo, in mwifiex_dump_station_info()
1488 &sinfo->txrate); in mwifiex_dump_station_info()
1489 sinfo->txrate.legacy = node->stats.last_tx_rate * 5; in mwifiex_dump_station_info()
1497 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_dump_station_info()
1499 return -EFAULT; in mwifiex_dump_station_info()
1503 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_dump_station_info()
1505 return -EFAULT; in mwifiex_dump_station_info()
1511 &priv->dtim_period, true); in mwifiex_dump_station_info()
1513 mwifiex_parse_htinfo(priv, priv->tx_rate, priv->tx_htinfo, in mwifiex_dump_station_info()
1514 &sinfo->txrate); in mwifiex_dump_station_info()
1516 sinfo->signal_avg = priv->bcn_rssi_avg; in mwifiex_dump_station_info()
1517 sinfo->rx_bytes = priv->stats.rx_bytes; in mwifiex_dump_station_info()
1518 sinfo->tx_bytes = priv->stats.tx_bytes; in mwifiex_dump_station_info()
1519 sinfo->rx_packets = priv->stats.rx_packets; in mwifiex_dump_station_info()
1520 sinfo->tx_packets = priv->stats.tx_packets; in mwifiex_dump_station_info()
1521 sinfo->signal = priv->bcn_rssi_avg; in mwifiex_dump_station_info()
1523 sinfo->txrate.legacy = rate * 5; in mwifiex_dump_station_info()
1525 sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE); in mwifiex_dump_station_info()
1526 mwifiex_parse_htinfo(priv, priv->rxpd_rate, priv->rxpd_htinfo, in mwifiex_dump_station_info()
1527 &sinfo->rxrate); in mwifiex_dump_station_info()
1529 if (priv->bss_mode == NL80211_IFTYPE_STATION) { in mwifiex_dump_station_info()
1530 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_BSS_PARAM); in mwifiex_dump_station_info()
1531 sinfo->bss_param.flags = 0; in mwifiex_dump_station_info()
1532 if (priv->curr_bss_params.bss_descriptor.cap_info_bitmap & in mwifiex_dump_station_info()
1534 sinfo->bss_param.flags |= in mwifiex_dump_station_info()
1536 if (priv->curr_bss_params.bss_descriptor.cap_info_bitmap & in mwifiex_dump_station_info()
1538 sinfo->bss_param.flags |= in mwifiex_dump_station_info()
1540 sinfo->bss_param.dtim_period = priv->dtim_period; in mwifiex_dump_station_info()
1541 sinfo->bss_param.beacon_interval = in mwifiex_dump_station_info()
1542 priv->curr_bss_params.bss_descriptor.beacon_period; in mwifiex_dump_station_info()
1555 mwifiex_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, in mwifiex_cfg80211_get_station() argument
1558 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_get_station()
1560 if (!priv->media_connected) in mwifiex_cfg80211_get_station()
1561 return -ENOENT; in mwifiex_cfg80211_get_station()
1562 if (memcmp(mac, priv->cfg_bssid, ETH_ALEN)) in mwifiex_cfg80211_get_station()
1563 return -ENOENT; in mwifiex_cfg80211_get_station()
1572 mwifiex_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *dev, in mwifiex_cfg80211_dump_station() argument
1575 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_dump_station()
1580 priv->media_connected && idx == 0) { in mwifiex_cfg80211_dump_station()
1581 ether_addr_copy(mac, priv->cfg_bssid); in mwifiex_cfg80211_dump_station()
1588 list_for_each_entry(node, &priv->sta_list, list) { in mwifiex_cfg80211_dump_station()
1591 ether_addr_copy(mac, node->mac_addr); in mwifiex_cfg80211_dump_station()
1596 return -ENOENT; in mwifiex_cfg80211_dump_station()
1600 mwifiex_cfg80211_dump_survey(struct wiphy *wiphy, struct net_device *dev, in mwifiex_cfg80211_dump_survey() argument
1603 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_dump_survey()
1604 struct mwifiex_chan_stats *pchan_stats = priv->adapter->chan_stats; in mwifiex_cfg80211_dump_survey()
1607 mwifiex_dbg(priv->adapter, DUMP, "dump_survey idx=%d\n", idx); in mwifiex_cfg80211_dump_survey()
1612 priv->media_connected && idx == 0) { in mwifiex_cfg80211_dump_survey()
1613 u8 curr_bss_band = priv->curr_bss_params.band; in mwifiex_cfg80211_dump_survey()
1614 u32 chan = priv->curr_bss_params.bss_descriptor.channel; in mwifiex_cfg80211_dump_survey()
1617 survey->channel = ieee80211_get_channel(wiphy, in mwifiex_cfg80211_dump_survey()
1620 if (priv->bcn_nf_last) { in mwifiex_cfg80211_dump_survey()
1621 survey->filled = SURVEY_INFO_NOISE_DBM; in mwifiex_cfg80211_dump_survey()
1622 survey->noise = priv->bcn_nf_last; in mwifiex_cfg80211_dump_survey()
1627 if (idx >= priv->adapter->num_in_chan_stats) in mwifiex_cfg80211_dump_survey()
1628 return -ENOENT; in mwifiex_cfg80211_dump_survey()
1634 survey->channel = ieee80211_get_channel(wiphy, in mwifiex_cfg80211_dump_survey()
1636 survey->filled = SURVEY_INFO_NOISE_DBM | in mwifiex_cfg80211_dump_survey()
1639 survey->noise = pchan_stats[idx].noise; in mwifiex_cfg80211_dump_survey()
1640 survey->time = pchan_stats[idx].cca_scan_dur; in mwifiex_cfg80211_dump_survey()
1641 survey->time_busy = pchan_stats[idx].cca_busy_dur; in mwifiex_cfg80211_dump_survey()
1725 .n_bitrates = ARRAY_SIZE(mwifiex_rates) - 4,
1776 struct net_device *dev, in mwifiex_cfg80211_set_bitrate_mask() argument
1781 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_set_bitrate_mask()
1784 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_cfg80211_set_bitrate_mask()
1786 if (!priv->media_connected) { in mwifiex_cfg80211_set_bitrate_mask()
1789 return -EINVAL; in mwifiex_cfg80211_set_bitrate_mask()
1792 band = mwifiex_band_to_radio_type(priv->curr_bss_params.band); in mwifiex_cfg80211_set_bitrate_mask()
1798 bitmap_rates[0] = mask->control[band].legacy & 0x000f; in mwifiex_cfg80211_set_bitrate_mask()
1802 bitmap_rates[1] = (mask->control[band].legacy & 0x0ff0) >> 4; in mwifiex_cfg80211_set_bitrate_mask()
1804 bitmap_rates[1] = mask->control[band].legacy; in mwifiex_cfg80211_set_bitrate_mask()
1807 bitmap_rates[2] = mask->control[band].ht_mcs[0]; in mwifiex_cfg80211_set_bitrate_mask()
1808 if (adapter->hw_dev_mcs_support == HT_STREAM_2X2) in mwifiex_cfg80211_set_bitrate_mask()
1809 bitmap_rates[2] |= mask->control[band].ht_mcs[1] << 8; in mwifiex_cfg80211_set_bitrate_mask()
1812 if (adapter->fw_api_ver == MWIFIEX_FW_V15) { in mwifiex_cfg80211_set_bitrate_mask()
1813 bitmap_rates[10] = mask->control[band].vht_mcs[0]; in mwifiex_cfg80211_set_bitrate_mask()
1814 if (adapter->hw_dev_mcs_support == HT_STREAM_2X2) in mwifiex_cfg80211_set_bitrate_mask()
1815 bitmap_rates[11] = mask->control[band].vht_mcs[1]; in mwifiex_cfg80211_set_bitrate_mask()
1829 struct net_device *dev, in mwifiex_cfg80211_set_cqm_rssi_config() argument
1832 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_set_cqm_rssi_config()
1835 priv->cqm_rssi_thold = rssi_thold; in mwifiex_cfg80211_set_cqm_rssi_config()
1836 priv->cqm_rssi_hyst = rssi_hyst; in mwifiex_cfg80211_set_cqm_rssi_config()
1865 struct net_device *dev, in mwifiex_cfg80211_change_beacon() argument
1868 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_change_beacon()
1869 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_cfg80211_change_beacon()
1870 struct cfg80211_beacon_data *data = ¶ms->beacon; in mwifiex_cfg80211_change_beacon()
1875 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_change_beacon()
1877 return -EINVAL; in mwifiex_cfg80211_change_beacon()
1880 if (!priv->bss_started) { in mwifiex_cfg80211_change_beacon()
1881 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_change_beacon()
1883 return -EINVAL; in mwifiex_cfg80211_change_beacon()
1887 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_change_beacon()
1889 return -EFAULT; in mwifiex_cfg80211_change_beacon()
1902 mwifiex_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev, in mwifiex_cfg80211_del_station() argument
1905 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_del_station()
1909 if (!priv->bss_started && priv->wdev.links[0].cac_started) { in mwifiex_cfg80211_del_station()
1910 mwifiex_dbg(priv->adapter, INFO, "%s: abort CAC!\n", __func__); in mwifiex_cfg80211_del_station()
1914 if (list_empty(&priv->sta_list) || !priv->bss_started) in mwifiex_cfg80211_del_station()
1917 if (!params->mac || is_broadcast_ether_addr(params->mac)) in mwifiex_cfg80211_del_station()
1920 mwifiex_dbg(priv->adapter, INFO, "%s: mac address %pM\n", in mwifiex_cfg80211_del_station()
1921 __func__, params->mac); in mwifiex_cfg80211_del_station()
1925 spin_lock_bh(&priv->sta_list_spinlock); in mwifiex_cfg80211_del_station()
1926 sta_node = mwifiex_get_sta_entry(priv, params->mac); in mwifiex_cfg80211_del_station()
1928 ether_addr_copy(deauth_mac, params->mac); in mwifiex_cfg80211_del_station()
1929 spin_unlock_bh(&priv->sta_list_spinlock); in mwifiex_cfg80211_del_station()
1935 return -1; in mwifiex_cfg80211_del_station()
1950 return -EOPNOTSUPP; in mwifiex_cfg80211_set_antenna()
1952 if (adapter->hw_dev_mcs_support != HT_STREAM_2X2) { in mwifiex_cfg80211_set_antenna()
1957 return -EOPNOTSUPP; in mwifiex_cfg80211_set_antenna()
1959 if ((tx_ant & (tx_ant - 1)) && in mwifiex_cfg80211_set_antenna()
1960 (tx_ant != BIT(adapter->number_of_antenna) - 1)) in mwifiex_cfg80211_set_antenna()
1961 return -EOPNOTSUPP; in mwifiex_cfg80211_set_antenna()
1963 if ((tx_ant == BIT(adapter->number_of_antenna) - 1) && in mwifiex_cfg80211_set_antenna()
1964 (priv->adapter->number_of_antenna > 1)) { in mwifiex_cfg80211_set_antenna()
1974 adapter->user_dev_mcs_support = HT_STREAM_1X1; in mwifiex_cfg80211_set_antenna()
1975 if (adapter->is_hw_11ac_capable) in mwifiex_cfg80211_set_antenna()
1976 adapter->usr_dot_11ac_mcs_support = in mwifiex_cfg80211_set_antenna()
1979 adapter->user_dev_mcs_support = HT_STREAM_2X2; in mwifiex_cfg80211_set_antenna()
1980 if (adapter->is_hw_11ac_capable) in mwifiex_cfg80211_set_antenna()
1981 adapter->usr_dot_11ac_mcs_support = in mwifiex_cfg80211_set_antenna()
1986 if (!adapter->wiphy->bands[band]) in mwifiex_cfg80211_set_antenna()
1989 ht_info = &adapter->wiphy->bands[band]->ht_cap; in mwifiex_cfg80211_set_antenna()
1991 GET_RXMCSSUPP(adapter->user_dev_mcs_support); in mwifiex_cfg80211_set_antenna()
1992 memset(&ht_info->mcs, 0, adapter->number_of_antenna); in mwifiex_cfg80211_set_antenna()
1993 memset(&ht_info->mcs, 0xff, rx_mcs_supp); in mwifiex_cfg80211_set_antenna()
2013 *tx_ant = priv->tx_ant; in mwifiex_cfg80211_get_antenna()
2014 *rx_ant = priv->rx_ant; in mwifiex_cfg80211_get_antenna()
2022 static int mwifiex_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *dev, in mwifiex_cfg80211_stop_ap() argument
2025 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_stop_ap()
2030 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_stop_ap()
2033 priv->ap_11n_enabled = 0; in mwifiex_cfg80211_stop_ap()
2034 memset(&priv->bss_cfg, 0, sizeof(priv->bss_cfg)); in mwifiex_cfg80211_stop_ap()
2038 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_stop_ap()
2040 return -1; in mwifiex_cfg80211_stop_ap()
2045 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_stop_ap()
2047 return -1; in mwifiex_cfg80211_stop_ap()
2050 if (netif_carrier_ok(priv->netdev)) in mwifiex_cfg80211_stop_ap()
2051 netif_carrier_off(priv->netdev); in mwifiex_cfg80211_stop_ap()
2052 mwifiex_stop_net_dev_queue(priv->netdev, priv->adapter); in mwifiex_cfg80211_stop_ap()
2063 struct net_device *dev, in mwifiex_cfg80211_start_ap() argument
2067 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_start_ap()
2070 return -1; in mwifiex_cfg80211_start_ap()
2074 return -ENOMEM; in mwifiex_cfg80211_start_ap()
2078 memcpy(bss_cfg->mac_addr, priv->curr_addr, ETH_ALEN); in mwifiex_cfg80211_start_ap()
2080 if (params->beacon_interval) in mwifiex_cfg80211_start_ap()
2081 bss_cfg->beacon_period = params->beacon_interval; in mwifiex_cfg80211_start_ap()
2082 if (params->dtim_period) in mwifiex_cfg80211_start_ap()
2083 bss_cfg->dtim_period = params->dtim_period; in mwifiex_cfg80211_start_ap()
2085 if (params->ssid && params->ssid_len) { in mwifiex_cfg80211_start_ap()
2086 memcpy(bss_cfg->ssid.ssid, params->ssid, params->ssid_len); in mwifiex_cfg80211_start_ap()
2087 bss_cfg->ssid.ssid_len = params->ssid_len; in mwifiex_cfg80211_start_ap()
2089 if (params->inactivity_timeout > 0) { in mwifiex_cfg80211_start_ap()
2091 bss_cfg->sta_ao_timer = 10 * params->inactivity_timeout; in mwifiex_cfg80211_start_ap()
2092 bss_cfg->ps_sta_ao_timer = 10 * params->inactivity_timeout; in mwifiex_cfg80211_start_ap()
2095 switch (params->hidden_ssid) { in mwifiex_cfg80211_start_ap()
2097 bss_cfg->bcast_ssid_ctl = 1; in mwifiex_cfg80211_start_ap()
2100 bss_cfg->bcast_ssid_ctl = 0; in mwifiex_cfg80211_start_ap()
2103 bss_cfg->bcast_ssid_ctl = 2; in mwifiex_cfg80211_start_ap()
2107 return -EINVAL; in mwifiex_cfg80211_start_ap()
2110 mwifiex_uap_set_channel(priv, bss_cfg, params->chandef); in mwifiex_cfg80211_start_ap()
2114 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_start_ap()
2121 if (priv->adapter->is_hw_11ac_capable) { in mwifiex_cfg80211_start_ap()
2123 mwifiex_set_vht_width(priv, params->chandef.width, in mwifiex_cfg80211_start_ap()
2124 priv->ap_11ac_enabled); in mwifiex_cfg80211_start_ap()
2127 if (priv->ap_11ac_enabled) in mwifiex_cfg80211_start_ap()
2138 !cfg80211_chandef_dfs_required(wiphy, ¶ms->chandef, in mwifiex_cfg80211_start_ap()
2139 priv->bss_mode)) { in mwifiex_cfg80211_start_ap()
2140 mwifiex_dbg(priv->adapter, INFO, in mwifiex_cfg80211_start_ap()
2143 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_start_ap()
2147 priv->state_11h.is_11h_active = false; in mwifiex_cfg80211_start_ap()
2150 mwifiex_config_uap_11d(priv, ¶ms->beacon); in mwifiex_cfg80211_start_ap()
2153 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_start_ap()
2158 if (mwifiex_set_mgmt_ies(priv, ¶ms->beacon)) in mwifiex_cfg80211_start_ap()
2161 if (!netif_carrier_ok(priv->netdev)) in mwifiex_cfg80211_start_ap()
2162 netif_carrier_on(priv->netdev); in mwifiex_cfg80211_start_ap()
2163 mwifiex_wake_up_net_dev_queue(priv->netdev, priv->adapter); in mwifiex_cfg80211_start_ap()
2165 memcpy(&priv->bss_cfg, bss_cfg, sizeof(priv->bss_cfg)); in mwifiex_cfg80211_start_ap()
2171 return -1; in mwifiex_cfg80211_start_ap()
2181 mwifiex_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, in mwifiex_cfg80211_disconnect() argument
2184 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_disconnect()
2187 cfg80211_sched_scan_stopped_locked(priv->wdev.wiphy, 0); in mwifiex_cfg80211_disconnect()
2190 return -EFAULT; in mwifiex_cfg80211_disconnect()
2192 eth_zero_addr(priv->cfg_bssid); in mwifiex_cfg80211_disconnect()
2193 priv->hs2_enabled = false; in mwifiex_cfg80211_disconnect()
2204 * - SSID
2205 * - SSID length
2206 * - BSSID
2207 * - Channel
2219 return -1; in mwifiex_cfg80211_inform_ibss_bss()
2228 band = mwifiex_band_to_radio_type(priv->curr_bss_params.band); in mwifiex_cfg80211_inform_ibss_bss()
2229 chan = ieee80211_get_channel(priv->wdev.wiphy, in mwifiex_cfg80211_inform_ibss_bss()
2233 bss = cfg80211_inform_bss(priv->wdev.wiphy, chan, in mwifiex_cfg80211_inform_ibss_bss()
2238 cfg80211_put_bss(priv->wdev.wiphy, bss); in mwifiex_cfg80211_inform_ibss_bss()
2239 ether_addr_copy(priv->cfg_bssid, bss_info.bssid); in mwifiex_cfg80211_inform_ibss_bss()
2248 * This function handles both Infra and Ad-Hoc modes. It also performs
2255 * is not found in scan table. However, for Ad-Hoc mode, it can create
2275 mwifiex_dbg(priv->adapter, ERROR, "invalid SSID - aborting\n"); in mwifiex_cfg80211_assoc()
2276 return -EINVAL; in mwifiex_cfg80211_assoc()
2281 mwifiex_dbg(priv->adapter, ERROR, "invalid SSID - aborting\n"); in mwifiex_cfg80211_assoc()
2282 return -EINVAL; in mwifiex_cfg80211_assoc()
2287 priv->sec_info.wpa_enabled = false; in mwifiex_cfg80211_assoc()
2288 priv->sec_info.wpa2_enabled = false; in mwifiex_cfg80211_assoc()
2289 priv->wep_key_curr_index = 0; in mwifiex_cfg80211_assoc()
2290 priv->sec_info.encryption_mode = 0; in mwifiex_cfg80211_assoc()
2291 priv->sec_info.is_authtype_auto = 0; in mwifiex_cfg80211_assoc()
2305 /* "privacy" is set only for ad-hoc mode */ in mwifiex_cfg80211_assoc()
2313 priv->sec_info.encryption_mode = in mwifiex_cfg80211_assoc()
2315 priv->sec_info.authentication_mode = in mwifiex_cfg80211_assoc()
2323 if (sme->auth_type == NL80211_AUTHTYPE_AUTOMATIC) { in mwifiex_cfg80211_assoc()
2325 priv->sec_info.is_authtype_auto = 1; in mwifiex_cfg80211_assoc()
2327 auth_type = sme->auth_type; in mwifiex_cfg80211_assoc()
2330 if (sme->crypto.n_ciphers_pairwise) { in mwifiex_cfg80211_assoc()
2331 priv->sec_info.encryption_mode = in mwifiex_cfg80211_assoc()
2332 sme->crypto.ciphers_pairwise[0]; in mwifiex_cfg80211_assoc()
2333 priv->sec_info.authentication_mode = auth_type; in mwifiex_cfg80211_assoc()
2336 if (sme->crypto.cipher_group) { in mwifiex_cfg80211_assoc()
2337 priv->sec_info.encryption_mode = sme->crypto.cipher_group; in mwifiex_cfg80211_assoc()
2338 priv->sec_info.authentication_mode = auth_type; in mwifiex_cfg80211_assoc()
2340 if (sme->ie) in mwifiex_cfg80211_assoc()
2341 ret = mwifiex_set_gen_ie(priv, sme->ie, sme->ie_len); in mwifiex_cfg80211_assoc()
2343 if (sme->key) { in mwifiex_cfg80211_assoc()
2344 if (mwifiex_is_alg_wep(priv->sec_info.encryption_mode)) { in mwifiex_cfg80211_assoc()
2345 mwifiex_dbg(priv->adapter, INFO, in mwifiex_cfg80211_assoc()
2347 "with key len %d\n", sme->key_len); in mwifiex_cfg80211_assoc()
2348 priv->wep_key_curr_index = sme->key_idx; in mwifiex_cfg80211_assoc()
2349 ret = mwifiex_set_encode(priv, NULL, sme->key, in mwifiex_cfg80211_assoc()
2350 sme->key_len, sme->key_idx, in mwifiex_cfg80211_assoc()
2364 mwifiex_dbg(priv->adapter, ERROR, "scan error\n"); in mwifiex_cfg80211_assoc()
2365 return -EFAULT; in mwifiex_cfg80211_assoc()
2371 bss = cfg80211_get_bss(priv->wdev.wiphy, channel, in mwifiex_cfg80211_assoc()
2376 bss = cfg80211_get_bss(priv->wdev.wiphy, channel, in mwifiex_cfg80211_assoc()
2383 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_assoc()
2384 "assoc: requested bss not found in scan results\n"); in mwifiex_cfg80211_assoc()
2389 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_assoc()
2391 bss->bssid); in mwifiex_cfg80211_assoc()
2392 memcpy(&priv->cfg_bssid, bss->bssid, ETH_ALEN); in mwifiex_cfg80211_assoc()
2398 cfg80211_ref_bss(priv->adapter->wiphy, bss); in mwifiex_cfg80211_assoc()
2406 * kernel will give a panic after successful assoc */ in mwifiex_cfg80211_assoc()
2408 ret = -EFAULT; in mwifiex_cfg80211_assoc()
2421 cfg80211_put_bss(priv->adapter->wiphy, bss); in mwifiex_cfg80211_assoc()
2428 * This function does not work when the current mode is set to Ad-Hoc, or
2433 mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, in mwifiex_cfg80211_connect() argument
2436 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_connect()
2437 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_cfg80211_connect()
2443 "%s: reject infra assoc request in non-STA role\n", in mwifiex_cfg80211_connect()
2444 dev->name); in mwifiex_cfg80211_connect()
2445 return -EINVAL; in mwifiex_cfg80211_connect()
2448 if (priv->wdev.connected) { in mwifiex_cfg80211_connect()
2450 "%s: already connected\n", dev->name); in mwifiex_cfg80211_connect()
2451 return -EALREADY; in mwifiex_cfg80211_connect()
2454 if (priv->scan_block) in mwifiex_cfg80211_connect()
2455 priv->scan_block = false; in mwifiex_cfg80211_connect()
2457 if (test_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags) || in mwifiex_cfg80211_connect()
2458 test_bit(MWIFIEX_IS_CMD_TIMEDOUT, &adapter->work_flags)) { in mwifiex_cfg80211_connect()
2462 dev->name); in mwifiex_cfg80211_connect()
2463 return -EFAULT; in mwifiex_cfg80211_connect()
2467 "info: Trying to associate to bssid %pM\n", sme->bssid); in mwifiex_cfg80211_connect()
2470 cfg80211_sched_scan_stopped_locked(priv->wdev.wiphy, 0); in mwifiex_cfg80211_connect()
2472 ret = mwifiex_cfg80211_assoc(priv, sme->ssid_len, sme->ssid, sme->bssid, in mwifiex_cfg80211_connect()
2473 priv->bss_mode, sme->channel, sme, 0, in mwifiex_cfg80211_connect()
2476 cfg80211_connect_bss(priv->netdev, priv->cfg_bssid, bss, NULL, in mwifiex_cfg80211_connect()
2479 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_connect()
2481 priv->cfg_bssid); in mwifiex_cfg80211_connect()
2482 if (ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info) && in mwifiex_cfg80211_connect()
2483 priv->adapter->auto_tdls && in mwifiex_cfg80211_connect()
2484 priv->bss_type == MWIFIEX_BSS_TYPE_STA) in mwifiex_cfg80211_connect()
2487 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_connect()
2489 priv->cfg_bssid); in mwifiex_cfg80211_connect()
2490 eth_zero_addr(priv->cfg_bssid); in mwifiex_cfg80211_connect()
2493 cfg80211_connect_result(priv->netdev, priv->cfg_bssid, in mwifiex_cfg80211_connect()
2497 cfg80211_connect_result(priv->netdev, priv->cfg_bssid, in mwifiex_cfg80211_connect()
2508 * - channel
2509 * - start band
2510 * - 11n flag
2511 * - secondary channel offset
2516 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_set_ibss_params()
2520 if (params->chandef.chan->band == NL80211_BAND_2GHZ) { in mwifiex_set_ibss_params()
2521 if (!params->basic_rates) { in mwifiex_set_ibss_params()
2536 if (params->basic_rates < index) { in mwifiex_set_ibss_params()
2540 if (params->basic_rates % index) in mwifiex_set_ibss_params()
2545 if (cfg80211_get_chandef_type(¶ms->chandef) != in mwifiex_set_ibss_params()
2549 if (cfg80211_get_chandef_type(¶ms->chandef) == in mwifiex_set_ibss_params()
2556 if (!((config_bands | adapter->fw_bands) & ~adapter->fw_bands)) { in mwifiex_set_ibss_params()
2557 adapter->config_bands = config_bands; in mwifiex_set_ibss_params()
2558 adapter->adhoc_start_band = config_bands; in mwifiex_set_ibss_params()
2561 adapter->adhoc_11n_enabled = true; in mwifiex_set_ibss_params()
2563 adapter->adhoc_11n_enabled = false; in mwifiex_set_ibss_params()
2566 adapter->sec_chan_offset = in mwifiex_set_ibss_params()
2568 cfg80211_get_chandef_type(¶ms->chandef)); in mwifiex_set_ibss_params()
2569 priv->adhoc_channel = ieee80211_frequency_to_channel( in mwifiex_set_ibss_params()
2570 params->chandef.chan->center_freq); in mwifiex_set_ibss_params()
2574 config_bands, priv->adhoc_channel, in mwifiex_set_ibss_params()
2575 adapter->sec_chan_offset); in mwifiex_set_ibss_params()
2583 * This function does not work in any mode other than Ad-Hoc, or if
2587 mwifiex_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, in mwifiex_cfg80211_join_ibss() argument
2590 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_join_ibss()
2593 if (priv->bss_mode != NL80211_IFTYPE_ADHOC) { in mwifiex_cfg80211_join_ibss()
2594 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_join_ibss()
2600 mwifiex_dbg(priv->adapter, MSG, "info: trying to join to bssid %pM\n", in mwifiex_cfg80211_join_ibss()
2601 params->bssid); in mwifiex_cfg80211_join_ibss()
2605 ret = mwifiex_cfg80211_assoc(priv, params->ssid_len, params->ssid, in mwifiex_cfg80211_join_ibss()
2606 params->bssid, priv->bss_mode, in mwifiex_cfg80211_join_ibss()
2607 params->chandef.chan, NULL, in mwifiex_cfg80211_join_ibss()
2608 params->privacy, NULL); in mwifiex_cfg80211_join_ibss()
2611 cfg80211_ibss_joined(priv->netdev, priv->cfg_bssid, in mwifiex_cfg80211_join_ibss()
2612 params->chandef.chan, GFP_KERNEL); in mwifiex_cfg80211_join_ibss()
2613 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_join_ibss()
2615 "%pM successfully\n", priv->cfg_bssid); in mwifiex_cfg80211_join_ibss()
2617 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_join_ibss()
2631 mwifiex_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev) in mwifiex_cfg80211_leave_ibss() argument
2633 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_leave_ibss()
2635 mwifiex_dbg(priv->adapter, MSG, "info: disconnecting from essid %pM\n", in mwifiex_cfg80211_leave_ibss()
2636 priv->cfg_bssid); in mwifiex_cfg80211_leave_ibss()
2638 return -EFAULT; in mwifiex_cfg80211_leave_ibss()
2640 eth_zero_addr(priv->cfg_bssid); in mwifiex_cfg80211_leave_ibss()
2656 struct net_device *dev = request->wdev->netdev; in mwifiex_cfg80211_scan() local
2657 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_scan()
2664 mwifiex_dbg(priv->adapter, CMD, in mwifiex_cfg80211_scan()
2665 "info: received scan request on %s\n", dev->name); in mwifiex_cfg80211_scan()
2670 if (priv->scan_request || priv->scan_aborting) { in mwifiex_cfg80211_scan()
2671 mwifiex_dbg(priv->adapter, WARN, in mwifiex_cfg80211_scan()
2673 return -EBUSY; in mwifiex_cfg80211_scan()
2676 if (!priv->wdev.connected && priv->scan_block) in mwifiex_cfg80211_scan()
2677 priv->scan_block = false; in mwifiex_cfg80211_scan()
2680 cfg80211_sched_scan_stopped_locked(priv->wdev.wiphy, 0); in mwifiex_cfg80211_scan()
2684 return -ENOMEM; in mwifiex_cfg80211_scan()
2686 priv->scan_request = request; in mwifiex_cfg80211_scan()
2688 if (request->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { in mwifiex_cfg80211_scan()
2689 get_random_mask_addr(mac_addr, request->mac_addr, in mwifiex_cfg80211_scan()
2690 request->mac_addr_mask); in mwifiex_cfg80211_scan()
2691 ether_addr_copy(request->mac_addr, mac_addr); in mwifiex_cfg80211_scan()
2692 ether_addr_copy(user_scan_cfg->random_mac, mac_addr); in mwifiex_cfg80211_scan()
2695 user_scan_cfg->num_ssids = request->n_ssids; in mwifiex_cfg80211_scan()
2696 user_scan_cfg->ssid_list = request->ssids; in mwifiex_cfg80211_scan()
2698 if (request->ie && request->ie_len) { in mwifiex_cfg80211_scan()
2701 if (priv->vs_ie[i].mask != MWIFIEX_VSIE_MASK_CLEAR) in mwifiex_cfg80211_scan()
2703 priv->vs_ie[i].mask = MWIFIEX_VSIE_MASK_SCAN; in mwifiex_cfg80211_scan()
2704 ie = (struct ieee_types_header *)(request->ie + offset); in mwifiex_cfg80211_scan()
2705 memcpy(&priv->vs_ie[i].ie, ie, sizeof(*ie) + ie->len); in mwifiex_cfg80211_scan()
2706 offset += sizeof(*ie) + ie->len; in mwifiex_cfg80211_scan()
2708 if (offset >= request->ie_len) in mwifiex_cfg80211_scan()
2713 for (i = 0; i < min_t(u32, request->n_channels, in mwifiex_cfg80211_scan()
2715 chan = request->channels[i]; in mwifiex_cfg80211_scan()
2716 user_scan_cfg->chan_list[i].chan_number = chan->hw_value; in mwifiex_cfg80211_scan()
2717 user_scan_cfg->chan_list[i].radio_type = chan->band; in mwifiex_cfg80211_scan()
2719 if ((chan->flags & IEEE80211_CHAN_NO_IR) || !request->n_ssids) in mwifiex_cfg80211_scan()
2720 user_scan_cfg->chan_list[i].scan_type = in mwifiex_cfg80211_scan()
2723 user_scan_cfg->chan_list[i].scan_type = in mwifiex_cfg80211_scan()
2726 user_scan_cfg->chan_list[i].scan_time = 0; in mwifiex_cfg80211_scan()
2729 if (priv->adapter->scan_chan_gap_enabled && in mwifiex_cfg80211_scan()
2731 user_scan_cfg->scan_chan_gap = in mwifiex_cfg80211_scan()
2732 priv->adapter->scan_chan_gap_time; in mwifiex_cfg80211_scan()
2737 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_scan()
2739 priv->scan_aborting = false; in mwifiex_cfg80211_scan()
2740 priv->scan_request = NULL; in mwifiex_cfg80211_scan()
2744 if (request->ie && request->ie_len) { in mwifiex_cfg80211_scan()
2746 if (priv->vs_ie[i].mask == MWIFIEX_VSIE_MASK_SCAN) { in mwifiex_cfg80211_scan()
2747 priv->vs_ie[i].mask = MWIFIEX_VSIE_MASK_CLEAR; in mwifiex_cfg80211_scan()
2748 memset(&priv->vs_ie[i].ie, 0, in mwifiex_cfg80211_scan()
2765 struct net_device *dev, in mwifiex_cfg80211_sched_scan_start() argument
2768 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_sched_scan_start()
2774 if (!request || (!request->n_ssids && !request->n_match_sets)) { in mwifiex_cfg80211_sched_scan_start()
2777 return -EINVAL; in mwifiex_cfg80211_sched_scan_start()
2781 request->n_ssids, request->n_match_sets); in mwifiex_cfg80211_sched_scan_start()
2783 request->n_channels, request->scan_plans->interval, in mwifiex_cfg80211_sched_scan_start()
2784 (int)request->ie_len); in mwifiex_cfg80211_sched_scan_start()
2788 return -ENOMEM; in mwifiex_cfg80211_sched_scan_start()
2790 if (priv->scan_request || priv->scan_aborting) in mwifiex_cfg80211_sched_scan_start()
2791 bgscan_cfg->start_later = true; in mwifiex_cfg80211_sched_scan_start()
2793 bgscan_cfg->num_ssids = request->n_match_sets; in mwifiex_cfg80211_sched_scan_start()
2794 bgscan_cfg->ssid_list = request->match_sets; in mwifiex_cfg80211_sched_scan_start()
2796 if (request->ie && request->ie_len) { in mwifiex_cfg80211_sched_scan_start()
2799 if (priv->vs_ie[i].mask != MWIFIEX_VSIE_MASK_CLEAR) in mwifiex_cfg80211_sched_scan_start()
2801 priv->vs_ie[i].mask = MWIFIEX_VSIE_MASK_BGSCAN; in mwifiex_cfg80211_sched_scan_start()
2802 ie = (struct ieee_types_header *)(request->ie + offset); in mwifiex_cfg80211_sched_scan_start()
2803 memcpy(&priv->vs_ie[i].ie, ie, sizeof(*ie) + ie->len); in mwifiex_cfg80211_sched_scan_start()
2804 offset += sizeof(*ie) + ie->len; in mwifiex_cfg80211_sched_scan_start()
2806 if (offset >= request->ie_len) in mwifiex_cfg80211_sched_scan_start()
2811 for (i = 0; i < min_t(u32, request->n_channels, in mwifiex_cfg80211_sched_scan_start()
2813 chan = request->channels[i]; in mwifiex_cfg80211_sched_scan_start()
2814 bgscan_cfg->chan_list[i].chan_number = chan->hw_value; in mwifiex_cfg80211_sched_scan_start()
2815 bgscan_cfg->chan_list[i].radio_type = chan->band; in mwifiex_cfg80211_sched_scan_start()
2817 if ((chan->flags & IEEE80211_CHAN_NO_IR) || !request->n_ssids) in mwifiex_cfg80211_sched_scan_start()
2818 bgscan_cfg->chan_list[i].scan_type = in mwifiex_cfg80211_sched_scan_start()
2821 bgscan_cfg->chan_list[i].scan_type = in mwifiex_cfg80211_sched_scan_start()
2824 bgscan_cfg->chan_list[i].scan_time = 0; in mwifiex_cfg80211_sched_scan_start()
2827 bgscan_cfg->chan_per_scan = min_t(u32, request->n_channels, in mwifiex_cfg80211_sched_scan_start()
2831 bgscan_cfg->scan_interval = (request->scan_plans->interval > in mwifiex_cfg80211_sched_scan_start()
2833 request->scan_plans->interval : in mwifiex_cfg80211_sched_scan_start()
2836 bgscan_cfg->repeat_count = MWIFIEX_BGSCAN_REPEAT_COUNT; in mwifiex_cfg80211_sched_scan_start()
2837 bgscan_cfg->report_condition = MWIFIEX_BGSCAN_SSID_MATCH | in mwifiex_cfg80211_sched_scan_start()
2839 bgscan_cfg->bss_type = MWIFIEX_BSS_MODE_INFRA; in mwifiex_cfg80211_sched_scan_start()
2840 bgscan_cfg->action = MWIFIEX_BGSCAN_ACT_SET; in mwifiex_cfg80211_sched_scan_start()
2841 bgscan_cfg->enable = true; in mwifiex_cfg80211_sched_scan_start()
2842 if (request->min_rssi_thold != NL80211_SCAN_RSSI_THOLD_OFF) { in mwifiex_cfg80211_sched_scan_start()
2843 bgscan_cfg->report_condition |= MWIFIEX_BGSCAN_SSID_RSSI_MATCH; in mwifiex_cfg80211_sched_scan_start()
2844 bgscan_cfg->rssi_threshold = request->min_rssi_thold; in mwifiex_cfg80211_sched_scan_start()
2850 return -EFAULT; in mwifiex_cfg80211_sched_scan_start()
2853 priv->sched_scanning = true; in mwifiex_cfg80211_sched_scan_start()
2865 struct net_device *dev, u64 reqid) in mwifiex_cfg80211_sched_scan_stop() argument
2867 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_sched_scan_stop()
2878 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_setup_vht_caps()
2880 vht_info->vht_supported = true; in mwifiex_setup_vht_caps()
2882 vht_info->cap = adapter->hw_dot_11ac_dev_cap; in mwifiex_setup_vht_caps()
2884 vht_info->vht_mcs.rx_mcs_map = cpu_to_le16( in mwifiex_setup_vht_caps()
2885 adapter->hw_dot_11ac_mcs_support & 0xFFFF); in mwifiex_setup_vht_caps()
2886 vht_info->vht_mcs.rx_highest = 0; in mwifiex_setup_vht_caps()
2887 vht_info->vht_mcs.tx_mcs_map = cpu_to_le16( in mwifiex_setup_vht_caps()
2888 adapter->hw_dot_11ac_mcs_support >> 16); in mwifiex_setup_vht_caps()
2889 vht_info->vht_mcs.tx_highest = 0; in mwifiex_setup_vht_caps()
2896 * The following default values are set -
2897 * - HT Supported = True
2898 * - Maximum AMPDU length factor = IEEE80211_HT_MAX_AMPDU_64K
2899 * - Minimum AMPDU spacing = IEEE80211_HT_MPDU_DENSITY_NONE
2900 * - HT Capabilities supported by firmware
2901 * - MCS information, Rx mask = 0xff
2902 * - MCD information, Tx parameters = IEEE80211_HT_MCS_TX_DEFINED (0x01)
2911 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_setup_ht_caps()
2913 ht_info->ht_supported = true; in mwifiex_setup_ht_caps()
2914 ht_info->ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K; in mwifiex_setup_ht_caps()
2915 ht_info->ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE; in mwifiex_setup_ht_caps()
2917 memset(&ht_info->mcs, 0, sizeof(ht_info->mcs)); 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()
2968 sizeof(struct ieee80211_mcs_info) - 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()
2974 memcpy((u8 *) &ht_info->mcs, mcs, sizeof(struct ieee80211_mcs_info)); in mwifiex_setup_ht_caps()
2976 ht_info->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; in mwifiex_setup_ht_caps()
2990 struct net_device *dev; in mwifiex_add_virtual_intf() local
2995 return ERR_PTR(-EFAULT); in mwifiex_add_virtual_intf()
3001 if (adapter->curr_iface_comb.sta_intf == in mwifiex_add_virtual_intf()
3002 adapter->iface_limit.sta_intf) { in mwifiex_add_virtual_intf()
3005 return ERR_PTR(-EINVAL); in mwifiex_add_virtual_intf()
3013 return ERR_PTR(-EFAULT); in mwifiex_add_virtual_intf()
3016 priv->wdev.wiphy = wiphy; in mwifiex_add_virtual_intf()
3017 priv->wdev.iftype = NL80211_IFTYPE_STATION; in mwifiex_add_virtual_intf()
3020 priv->bss_mode = NL80211_IFTYPE_STATION; in mwifiex_add_virtual_intf()
3022 priv->bss_mode = type; in mwifiex_add_virtual_intf()
3024 priv->bss_type = MWIFIEX_BSS_TYPE_STA; in mwifiex_add_virtual_intf()
3025 priv->frame_type = MWIFIEX_DATA_FRAME_TYPE_ETH_II; in mwifiex_add_virtual_intf()
3026 priv->bss_priority = 0; in mwifiex_add_virtual_intf()
3027 priv->bss_role = MWIFIEX_BSS_ROLE_STA; in mwifiex_add_virtual_intf()
3031 if (adapter->curr_iface_comb.uap_intf == in mwifiex_add_virtual_intf()
3032 adapter->iface_limit.uap_intf) { in mwifiex_add_virtual_intf()
3035 return ERR_PTR(-EINVAL); in mwifiex_add_virtual_intf()
3043 return ERR_PTR(-EFAULT); in mwifiex_add_virtual_intf()
3046 priv->wdev.wiphy = wiphy; in mwifiex_add_virtual_intf()
3047 priv->wdev.iftype = NL80211_IFTYPE_AP; in mwifiex_add_virtual_intf()
3049 priv->bss_type = MWIFIEX_BSS_TYPE_UAP; in mwifiex_add_virtual_intf()
3050 priv->frame_type = MWIFIEX_DATA_FRAME_TYPE_ETH_II; in mwifiex_add_virtual_intf()
3051 priv->bss_priority = 0; in mwifiex_add_virtual_intf()
3052 priv->bss_role = MWIFIEX_BSS_ROLE_UAP; in mwifiex_add_virtual_intf()
3053 priv->bss_started = 0; in mwifiex_add_virtual_intf()
3054 priv->bss_mode = type; in mwifiex_add_virtual_intf()
3058 if (adapter->curr_iface_comb.p2p_intf == in mwifiex_add_virtual_intf()
3059 adapter->iface_limit.p2p_intf) { in mwifiex_add_virtual_intf()
3062 return ERR_PTR(-EINVAL); in mwifiex_add_virtual_intf()
3070 return ERR_PTR(-EFAULT); in mwifiex_add_virtual_intf()
3073 priv->wdev.wiphy = wiphy; in mwifiex_add_virtual_intf()
3074 /* At start-up, wpa_supplicant tries to change the interface in mwifiex_add_virtual_intf()
3077 priv->wdev.iftype = NL80211_IFTYPE_P2P_CLIENT; in mwifiex_add_virtual_intf()
3078 priv->bss_mode = NL80211_IFTYPE_P2P_CLIENT; in mwifiex_add_virtual_intf()
3084 priv->bss_type = MWIFIEX_BSS_TYPE_P2P; in mwifiex_add_virtual_intf()
3086 priv->frame_type = MWIFIEX_DATA_FRAME_TYPE_ETH_II; in mwifiex_add_virtual_intf()
3087 priv->bss_priority = 0; in mwifiex_add_virtual_intf()
3088 priv->bss_role = MWIFIEX_BSS_ROLE_STA; in mwifiex_add_virtual_intf()
3089 priv->bss_started = 0; in mwifiex_add_virtual_intf()
3092 memset(&priv->wdev, 0, sizeof(priv->wdev)); in mwifiex_add_virtual_intf()
3093 priv->wdev.iftype = NL80211_IFTYPE_UNSPECIFIED; in mwifiex_add_virtual_intf()
3094 return ERR_PTR(-EFAULT); in mwifiex_add_virtual_intf()
3100 return ERR_PTR(-EINVAL); in mwifiex_add_virtual_intf()
3103 dev = alloc_netdev_mqs(sizeof(struct mwifiex_private *), name, in mwifiex_add_virtual_intf()
3106 if (!dev) { in mwifiex_add_virtual_intf()
3109 ret = -ENOMEM; in mwifiex_add_virtual_intf()
3113 mwifiex_init_priv_params(priv, dev); in mwifiex_add_virtual_intf()
3115 priv->netdev = dev; in mwifiex_add_virtual_intf()
3117 if (!adapter->mfg_mode) { in mwifiex_add_virtual_intf()
3118 mwifiex_set_mac_address(priv, dev, false, NULL); in mwifiex_add_virtual_intf()
3130 mwifiex_setup_ht_caps(&wiphy->bands[NL80211_BAND_2GHZ]->ht_cap, priv); in mwifiex_add_virtual_intf()
3131 if (adapter->is_hw_11ac_capable) in mwifiex_add_virtual_intf()
3133 &wiphy->bands[NL80211_BAND_2GHZ]->vht_cap, priv); in mwifiex_add_virtual_intf()
3135 if (adapter->config_bands & BAND_A) in mwifiex_add_virtual_intf()
3137 &wiphy->bands[NL80211_BAND_5GHZ]->ht_cap, priv); in mwifiex_add_virtual_intf()
3139 if ((adapter->config_bands & BAND_A) && adapter->is_hw_11ac_capable) in mwifiex_add_virtual_intf()
3141 &wiphy->bands[NL80211_BAND_5GHZ]->vht_cap, priv); in mwifiex_add_virtual_intf()
3143 dev_net_set(dev, wiphy_net(wiphy)); in mwifiex_add_virtual_intf()
3144 dev->ieee80211_ptr = &priv->wdev; in mwifiex_add_virtual_intf()
3145 dev->ieee80211_ptr->iftype = priv->bss_mode; in mwifiex_add_virtual_intf()
3146 SET_NETDEV_DEV(dev, wiphy_dev(wiphy)); in mwifiex_add_virtual_intf()
3148 dev->flags |= IFF_BROADCAST | IFF_MULTICAST; in mwifiex_add_virtual_intf()
3149 dev->watchdog_timeo = MWIFIEX_DEFAULT_WATCHDOG_TIMEOUT; in mwifiex_add_virtual_intf()
3150 dev->needed_headroom = MWIFIEX_MIN_DATA_HEADER_LEN; in mwifiex_add_virtual_intf()
3151 dev->ethtool_ops = &mwifiex_ethtool_ops; in mwifiex_add_virtual_intf()
3153 mdev_priv = netdev_priv(dev); in mwifiex_add_virtual_intf()
3156 SET_NETDEV_DEV(dev, adapter->dev); in mwifiex_add_virtual_intf()
3158 priv->dfs_cac_workqueue = alloc_workqueue("MWIFIEX_DFS_CAC%s", in mwifiex_add_virtual_intf()
3162 if (!priv->dfs_cac_workqueue) { in mwifiex_add_virtual_intf()
3164 ret = -ENOMEM; in mwifiex_add_virtual_intf()
3168 INIT_DELAYED_WORK(&priv->dfs_cac_work, mwifiex_dfs_cac_work_queue); in mwifiex_add_virtual_intf()
3170 priv->dfs_chan_sw_workqueue = alloc_workqueue("MWIFIEX_DFS_CHSW%s", in mwifiex_add_virtual_intf()
3173 if (!priv->dfs_chan_sw_workqueue) { in mwifiex_add_virtual_intf()
3175 ret = -ENOMEM; in mwifiex_add_virtual_intf()
3179 INIT_DELAYED_WORK(&priv->dfs_chan_sw_work, in mwifiex_add_virtual_intf()
3182 mutex_init(&priv->async_mutex); in mwifiex_add_virtual_intf()
3185 if (cfg80211_register_netdevice(dev)) { in mwifiex_add_virtual_intf()
3187 ret = -EFAULT; in mwifiex_add_virtual_intf()
3192 "info: %s: Marvell 802.11 Adapter\n", dev->name); in mwifiex_add_virtual_intf()
3200 return &priv->wdev; in mwifiex_add_virtual_intf()
3203 destroy_workqueue(priv->dfs_chan_sw_workqueue); in mwifiex_add_virtual_intf()
3204 priv->dfs_chan_sw_workqueue = NULL; in mwifiex_add_virtual_intf()
3206 destroy_workqueue(priv->dfs_cac_workqueue); in mwifiex_add_virtual_intf()
3207 priv->dfs_cac_workqueue = NULL; in mwifiex_add_virtual_intf()
3209 free_netdev(dev); in mwifiex_add_virtual_intf()
3210 priv->netdev = NULL; in mwifiex_add_virtual_intf()
3214 memset(&priv->wdev, 0, sizeof(priv->wdev)); in mwifiex_add_virtual_intf()
3215 priv->wdev.iftype = NL80211_IFTYPE_UNSPECIFIED; in mwifiex_add_virtual_intf()
3216 priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED; in mwifiex_add_virtual_intf()
3222 * del_virtual_intf: remove the virtual interface determined by dev
3226 struct mwifiex_private *priv = mwifiex_netdev_get_priv(wdev->netdev); in mwifiex_del_virtual_intf()
3227 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_del_virtual_intf()
3234 if (priv->sched_scanning) in mwifiex_del_virtual_intf()
3235 priv->sched_scanning = false; in mwifiex_del_virtual_intf()
3237 mwifiex_stop_net_dev_queue(priv->netdev, adapter); in mwifiex_del_virtual_intf()
3239 skb_queue_walk_safe(&priv->bypass_txq, skb, tmp) { in mwifiex_del_virtual_intf()
3240 skb_unlink(skb, &priv->bypass_txq); in mwifiex_del_virtual_intf()
3241 mwifiex_write_data_complete(priv->adapter, skb, 0, -1); in mwifiex_del_virtual_intf()
3244 if (netif_carrier_ok(priv->netdev)) in mwifiex_del_virtual_intf()
3245 netif_carrier_off(priv->netdev); in mwifiex_del_virtual_intf()
3247 if (wdev->netdev->reg_state == NETREG_REGISTERED) in mwifiex_del_virtual_intf()
3248 cfg80211_unregister_netdevice(wdev->netdev); in mwifiex_del_virtual_intf()
3250 if (priv->dfs_cac_workqueue) { in mwifiex_del_virtual_intf()
3251 destroy_workqueue(priv->dfs_cac_workqueue); in mwifiex_del_virtual_intf()
3252 priv->dfs_cac_workqueue = NULL; in mwifiex_del_virtual_intf()
3255 if (priv->dfs_chan_sw_workqueue) { in mwifiex_del_virtual_intf()
3256 destroy_workqueue(priv->dfs_chan_sw_workqueue); in mwifiex_del_virtual_intf()
3257 priv->dfs_chan_sw_workqueue = NULL; in mwifiex_del_virtual_intf()
3260 priv->netdev = NULL; in mwifiex_del_virtual_intf()
3262 update_vif_type_counter(adapter, priv->bss_mode, -1); in mwifiex_del_virtual_intf()
3264 priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED; in mwifiex_del_virtual_intf()
3268 kfree(priv->hist_data); in mwifiex_del_virtual_intf()
3281 for (j = 0; j < DIV_ROUND_UP(pat->pattern_len, 8); j++) { in mwifiex_is_pattern_supported()
3283 if (pat->mask[j] & 1 << k) { in mwifiex_is_pattern_supported()
3285 &pat->pattern[j * 8 + k], 1); in mwifiex_is_pattern_supported()
3298 pat->pkt_offset++; in mwifiex_is_pattern_supported()
3318 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_set_auto_arp_mef_entry()
3320 mef_entry->mode = MEF_MODE_HOST_SLEEP; in mwifiex_set_auto_arp_mef_entry()
3321 mef_entry->action = MEF_ACTION_AUTO_ARP; in mwifiex_set_auto_arp_mef_entry()
3326 if (adapter->priv[i]->netdev) { in mwifiex_set_auto_arp_mef_entry()
3327 in_dev = __in_dev_get_rtnl(adapter->priv[i]->netdev); in mwifiex_set_auto_arp_mef_entry()
3330 ifa = rtnl_dereference(in_dev->ifa_list); in mwifiex_set_auto_arp_mef_entry()
3331 if (!ifa || !ifa->ifa_local) in mwifiex_set_auto_arp_mef_entry()
3333 ips[i] = ifa->ifa_local; in mwifiex_set_auto_arp_mef_entry()
3341 mef_entry->filter[filt_num].repeat = 1; in mwifiex_set_auto_arp_mef_entry()
3342 memcpy(mef_entry->filter[filt_num].byte_seq, in mwifiex_set_auto_arp_mef_entry()
3344 mef_entry->filter[filt_num]. in mwifiex_set_auto_arp_mef_entry()
3347 mef_entry->filter[filt_num].offset = 46; in mwifiex_set_auto_arp_mef_entry()
3348 mef_entry->filter[filt_num].filt_type = TYPE_EQ; in mwifiex_set_auto_arp_mef_entry()
3350 mef_entry->filter[filt_num].filt_action = in mwifiex_set_auto_arp_mef_entry()
3356 mef_entry->filter[filt_num].repeat = 1; in mwifiex_set_auto_arp_mef_entry()
3357 mef_entry->filter[filt_num].byte_seq[0] = 0x08; in mwifiex_set_auto_arp_mef_entry()
3358 mef_entry->filter[filt_num].byte_seq[1] = 0x06; in mwifiex_set_auto_arp_mef_entry()
3359 mef_entry->filter[filt_num].byte_seq[MWIFIEX_MEF_MAX_BYTESEQ] = 2; in mwifiex_set_auto_arp_mef_entry()
3360 mef_entry->filter[filt_num].offset = 20; in mwifiex_set_auto_arp_mef_entry()
3361 mef_entry->filter[filt_num].filt_type = TYPE_EQ; in mwifiex_set_auto_arp_mef_entry()
3362 mef_entry->filter[filt_num].filt_action = TYPE_AND; in mwifiex_set_auto_arp_mef_entry()
3376 mef_entry->mode = MEF_MODE_HOST_SLEEP; in mwifiex_set_wowlan_mef_entry()
3377 mef_entry->action = MEF_ACTION_ALLOW_AND_WAKEUP_HOST; in mwifiex_set_wowlan_mef_entry()
3379 for (i = 0; i < wowlan->n_patterns; i++) { in mwifiex_set_wowlan_mef_entry()
3381 if (!mwifiex_is_pattern_supported(&wowlan->patterns[i], in mwifiex_set_wowlan_mef_entry()
3384 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_set_wowlan_mef_entry()
3386 return -EOPNOTSUPP; in mwifiex_set_wowlan_mef_entry()
3389 if (!wowlan->patterns[i].pkt_offset) { in mwifiex_set_wowlan_mef_entry()
3392 mef_cfg->criteria |= MWIFIEX_CRITERIA_UNICAST; in mwifiex_set_wowlan_mef_entry()
3395 mef_cfg->criteria |= MWIFIEX_CRITERIA_BROADCAST; in mwifiex_set_wowlan_mef_entry()
3401 mef_cfg->criteria |= MWIFIEX_CRITERIA_MULTICAST; in mwifiex_set_wowlan_mef_entry()
3405 mef_entry->filter[filt_num].repeat = 1; in mwifiex_set_wowlan_mef_entry()
3406 mef_entry->filter[filt_num].offset = in mwifiex_set_wowlan_mef_entry()
3407 wowlan->patterns[i].pkt_offset; in mwifiex_set_wowlan_mef_entry()
3408 memcpy(mef_entry->filter[filt_num].byte_seq, byte_seq, in mwifiex_set_wowlan_mef_entry()
3410 mef_entry->filter[filt_num].filt_type = TYPE_EQ; in mwifiex_set_wowlan_mef_entry()
3414 mwifiex_dbg(priv->adapter, INFO, "Wake on patterns\n"); in mwifiex_set_wowlan_mef_entry()
3416 mef_entry->filter[filt_num].filt_action = TYPE_AND; in mwifiex_set_wowlan_mef_entry()
3422 if (wowlan->magic_pkt) { in mwifiex_set_wowlan_mef_entry()
3423 mef_cfg->criteria |= MWIFIEX_CRITERIA_UNICAST; in mwifiex_set_wowlan_mef_entry()
3424 mef_entry->filter[filt_num].repeat = 16; in mwifiex_set_wowlan_mef_entry()
3425 memcpy(mef_entry->filter[filt_num].byte_seq, priv->curr_addr, in mwifiex_set_wowlan_mef_entry()
3427 mef_entry->filter[filt_num].byte_seq[MWIFIEX_MEF_MAX_BYTESEQ] = in mwifiex_set_wowlan_mef_entry()
3429 mef_entry->filter[filt_num].offset = 28; in mwifiex_set_wowlan_mef_entry()
3430 mef_entry->filter[filt_num].filt_type = TYPE_EQ; in mwifiex_set_wowlan_mef_entry()
3432 mef_entry->filter[filt_num].filt_action = TYPE_OR; in mwifiex_set_wowlan_mef_entry()
3435 mef_entry->filter[filt_num].repeat = 16; in mwifiex_set_wowlan_mef_entry()
3436 memcpy(mef_entry->filter[filt_num].byte_seq, priv->curr_addr, in mwifiex_set_wowlan_mef_entry()
3438 mef_entry->filter[filt_num].byte_seq[MWIFIEX_MEF_MAX_BYTESEQ] = in mwifiex_set_wowlan_mef_entry()
3440 mef_entry->filter[filt_num].offset = 56; in mwifiex_set_wowlan_mef_entry()
3441 mef_entry->filter[filt_num].filt_type = TYPE_EQ; in mwifiex_set_wowlan_mef_entry()
3442 mef_entry->filter[filt_num].filt_action = TYPE_OR; in mwifiex_set_wowlan_mef_entry()
3443 mwifiex_dbg(priv->adapter, INFO, "Wake on magic packet\n"); in mwifiex_set_wowlan_mef_entry()
3455 if (wowlan->n_patterns || wowlan->magic_pkt) in mwifiex_set_mef_filter()
3460 return -ENOMEM; in mwifiex_set_mef_filter()
3470 if (wowlan->n_patterns || wowlan->magic_pkt) { in mwifiex_set_mef_filter()
3501 sta_priv->scan_aborting = true; in mwifiex_cfg80211_suspend()
3502 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_cfg80211_suspend()
3503 priv = adapter->priv[i]; in mwifiex_cfg80211_suspend()
3509 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_cfg80211_suspend()
3510 priv = adapter->priv[i]; in mwifiex_cfg80211_suspend()
3511 if (priv->netdev) in mwifiex_cfg80211_suspend()
3512 netif_device_detach(priv->netdev); in mwifiex_cfg80211_suspend()
3518 !skb_queue_empty(&adapter->tx_data_q)) in mwifiex_cfg80211_suspend()
3531 if (!sta_priv->media_connected && !wowlan->nd_config) { in mwifiex_cfg80211_suspend()
3545 hs_cfg.conditions = le32_to_cpu(adapter->hs_cfg.conditions); in mwifiex_cfg80211_suspend()
3547 if (wowlan->nd_config) { in mwifiex_cfg80211_suspend()
3550 mwifiex_cfg80211_sched_scan_start(wiphy, sta_priv->netdev, in mwifiex_cfg80211_suspend()
3551 wowlan->nd_config); in mwifiex_cfg80211_suspend()
3554 if (wowlan->disconnect) { in mwifiex_cfg80211_suspend()
3556 mwifiex_dbg(sta_priv->adapter, INFO, "Wake on device disconnect\n"); in mwifiex_cfg80211_suspend()
3560 hs_cfg.gpio = adapter->hs_cfg.gpio; in mwifiex_cfg80211_suspend()
3561 hs_cfg.gap = adapter->hs_cfg.gap; in mwifiex_cfg80211_suspend()
3568 sta_priv->scan_aborting = false; in mwifiex_cfg80211_suspend()
3581 for (i = 0; i < adapter->priv_num; i++) { in mwifiex_cfg80211_resume()
3582 priv = adapter->priv[i]; in mwifiex_cfg80211_resume()
3583 if (priv->netdev) in mwifiex_cfg80211_resume()
3584 netif_device_attach(priv->netdev); in mwifiex_cfg80211_resume()
3587 if (!wiphy->wowlan_config) in mwifiex_cfg80211_resume()
3595 wakeup_report.pattern_idx = -1; in mwifiex_cfg80211_resume()
3609 if (wiphy->wowlan_config->disconnect) in mwifiex_cfg80211_resume()
3611 if (wiphy->wowlan_config->nd_config) in mwifiex_cfg80211_resume()
3612 wakeup_report.net_detect = adapter->nd_info; in mwifiex_cfg80211_resume()
3617 if (wiphy->wowlan_config->magic_pkt) in mwifiex_cfg80211_resume()
3619 if (wiphy->wowlan_config->n_patterns) in mwifiex_cfg80211_resume()
3623 if (wiphy->wowlan_config->gtk_rekey_failure) in mwifiex_cfg80211_resume()
3632 cfg80211_report_wowlan_wakeup(&priv->wdev, &wakeup_report, in mwifiex_cfg80211_resume()
3636 if (adapter->nd_info) { in mwifiex_cfg80211_resume()
3637 for (i = 0 ; i < adapter->nd_info->n_matches ; i++) in mwifiex_cfg80211_resume()
3638 kfree(adapter->nd_info->matches[i]); in mwifiex_cfg80211_resume()
3639 kfree(adapter->nd_info); in mwifiex_cfg80211_resume()
3640 adapter->nd_info = NULL; in mwifiex_cfg80211_resume()
3651 device_set_wakeup_enable(adapter->dev, enabled); in mwifiex_cfg80211_set_wakeup()
3654 static int mwifiex_set_rekey_data(struct wiphy *wiphy, struct net_device *dev, in mwifiex_set_rekey_data() argument
3657 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_set_rekey_data()
3659 if (!ISSUPP_FIRMWARE_SUPPLICANT(priv->adapter->fw_cap_info)) in mwifiex_set_rekey_data()
3660 return -EOPNOTSUPP; in mwifiex_set_rekey_data()
3662 if (priv->adapter->host_mlme_enabled) in mwifiex_set_rekey_data()
3700 mrule->max_coalescing_delay = crule->delay; in mwifiex_fill_coalesce_rule_info()
3702 param = mrule->params; in mwifiex_fill_coalesce_rule_info()
3704 for (i = 0; i < crule->n_patterns; i++) { in mwifiex_fill_coalesce_rule_info()
3706 if (!mwifiex_is_pattern_supported(&crule->patterns[i], in mwifiex_fill_coalesce_rule_info()
3709 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_fill_coalesce_rule_info()
3711 return -EOPNOTSUPP; in mwifiex_fill_coalesce_rule_info()
3714 if (!crule->patterns[i].pkt_offset) { in mwifiex_fill_coalesce_rule_info()
3718 if (pkt_type && mrule->pkt_type) { in mwifiex_fill_coalesce_rule_info()
3719 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_fill_coalesce_rule_info()
3721 return -EOPNOTSUPP; in mwifiex_fill_coalesce_rule_info()
3723 mrule->pkt_type = pkt_type; in mwifiex_fill_coalesce_rule_info()
3728 if (crule->condition == NL80211_COALESCE_CONDITION_MATCH) in mwifiex_fill_coalesce_rule_info()
3729 param->operation = RECV_FILTER_MATCH_TYPE_EQ; in mwifiex_fill_coalesce_rule_info()
3731 param->operation = RECV_FILTER_MATCH_TYPE_NE; in mwifiex_fill_coalesce_rule_info()
3733 param->operand_len = byte_seq[MWIFIEX_COALESCE_MAX_BYTESEQ]; in mwifiex_fill_coalesce_rule_info()
3734 memcpy(param->operand_byte_stream, byte_seq, in mwifiex_fill_coalesce_rule_info()
3735 param->operand_len); in mwifiex_fill_coalesce_rule_info()
3736 param->offset = crule->patterns[i].pkt_offset; in mwifiex_fill_coalesce_rule_info()
3739 mrule->num_of_fields++; in mwifiex_fill_coalesce_rule_info()
3742 if (!mrule->pkt_type) { in mwifiex_fill_coalesce_rule_info()
3743 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_fill_coalesce_rule_info()
3745 return -EOPNOTSUPP; in mwifiex_fill_coalesce_rule_info()
3769 coalesce_cfg.num_of_rules = coalesce->n_rules; in mwifiex_cfg80211_set_coalesce()
3770 for (i = 0; i < coalesce->n_rules; i++) { in mwifiex_cfg80211_set_coalesce()
3771 ret = mwifiex_fill_coalesce_rule_info(priv, &coalesce->rules[i], in mwifiex_cfg80211_set_coalesce()
3789 mwifiex_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, in mwifiex_cfg80211_tdls_mgmt() argument
3795 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_tdls_mgmt()
3798 if (!(wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS)) in mwifiex_cfg80211_tdls_mgmt()
3799 return -EOPNOTSUPP; in mwifiex_cfg80211_tdls_mgmt()
3802 if (!(priv->bss_type == MWIFIEX_BSS_TYPE_STA && priv->media_connected)) in mwifiex_cfg80211_tdls_mgmt()
3803 return -EOPNOTSUPP; in mwifiex_cfg80211_tdls_mgmt()
3807 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()
3833 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_tdls_mgmt()
3840 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_tdls_mgmt()
3847 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_tdls_mgmt()
3854 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_tdls_mgmt()
3856 ret = -EINVAL; in mwifiex_cfg80211_tdls_mgmt()
3864 mwifiex_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, in mwifiex_cfg80211_tdls_oper() argument
3867 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_tdls_oper()
3869 if (!(wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) || in mwifiex_cfg80211_tdls_oper()
3870 !(wiphy->flags & WIPHY_FLAG_TDLS_EXTERNAL_SETUP)) in mwifiex_cfg80211_tdls_oper()
3871 return -EOPNOTSUPP; in mwifiex_cfg80211_tdls_oper()
3874 if (!(priv->bss_type == MWIFIEX_BSS_TYPE_STA && priv->media_connected)) in mwifiex_cfg80211_tdls_oper()
3875 return -EOPNOTSUPP; in mwifiex_cfg80211_tdls_oper()
3877 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_tdls_oper()
3889 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_tdls_oper()
3891 return -EINVAL; in mwifiex_cfg80211_tdls_oper()
3894 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_tdls_oper()
3896 return -EINVAL; in mwifiex_cfg80211_tdls_oper()
3899 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_tdls_oper()
3901 return -EINVAL; in mwifiex_cfg80211_tdls_oper()
3903 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_tdls_oper()
3905 return -EOPNOTSUPP; in mwifiex_cfg80211_tdls_oper()
3912 mwifiex_cfg80211_tdls_chan_switch(struct wiphy *wiphy, struct net_device *dev, in mwifiex_cfg80211_tdls_chan_switch() argument
3919 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_tdls_chan_switch()
3921 spin_lock_bh(&priv->sta_list_spinlock); in mwifiex_cfg80211_tdls_chan_switch()
3924 spin_unlock_bh(&priv->sta_list_spinlock); in mwifiex_cfg80211_tdls_chan_switch()
3927 return -ENOENT; in mwifiex_cfg80211_tdls_chan_switch()
3930 if (!(sta_ptr->tdls_cap.extcap.ext_capab[3] & in mwifiex_cfg80211_tdls_chan_switch()
3932 spin_unlock_bh(&priv->sta_list_spinlock); in mwifiex_cfg80211_tdls_chan_switch()
3933 wiphy_err(wiphy, "%pM do not support tdls cs\n", addr); in mwifiex_cfg80211_tdls_chan_switch()
3934 return -ENOENT; in mwifiex_cfg80211_tdls_chan_switch()
3937 if (sta_ptr->tdls_status == TDLS_CHAN_SWITCHING || in mwifiex_cfg80211_tdls_chan_switch()
3938 sta_ptr->tdls_status == TDLS_IN_OFF_CHAN) { in mwifiex_cfg80211_tdls_chan_switch()
3939 spin_unlock_bh(&priv->sta_list_spinlock); in mwifiex_cfg80211_tdls_chan_switch()
3941 return -EALREADY; in mwifiex_cfg80211_tdls_chan_switch()
3943 spin_unlock_bh(&priv->sta_list_spinlock); in mwifiex_cfg80211_tdls_chan_switch()
3945 chan = chandef->chan->hw_value; in mwifiex_cfg80211_tdls_chan_switch()
3947 band = chandef->chan->band; in mwifiex_cfg80211_tdls_chan_switch()
3955 struct net_device *dev, in mwifiex_cfg80211_tdls_cancel_chan_switch() argument
3959 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_tdls_cancel_chan_switch()
3961 spin_lock_bh(&priv->sta_list_spinlock); in mwifiex_cfg80211_tdls_cancel_chan_switch()
3964 spin_unlock_bh(&priv->sta_list_spinlock); in mwifiex_cfg80211_tdls_cancel_chan_switch()
3967 } else if (!(sta_ptr->tdls_status == TDLS_CHAN_SWITCHING || in mwifiex_cfg80211_tdls_cancel_chan_switch()
3968 sta_ptr->tdls_status == TDLS_IN_BASE_CHAN || in mwifiex_cfg80211_tdls_cancel_chan_switch()
3969 sta_ptr->tdls_status == TDLS_IN_OFF_CHAN)) { in mwifiex_cfg80211_tdls_cancel_chan_switch()
3970 spin_unlock_bh(&priv->sta_list_spinlock); in mwifiex_cfg80211_tdls_cancel_chan_switch()
3974 spin_unlock_bh(&priv->sta_list_spinlock); in mwifiex_cfg80211_tdls_cancel_chan_switch()
3997 return -ENOMEM; in mwifiex_cfg80211_uap_add_station()
3999 cfg80211_new_sta(priv->netdev, mac, sinfo, GFP_KERNEL); in mwifiex_cfg80211_uap_add_station()
4007 mwifiex_cfg80211_add_station(struct wiphy *wiphy, struct net_device *dev, in mwifiex_cfg80211_add_station() argument
4010 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_add_station()
4012 if (priv->adapter->host_mlme_enabled && in mwifiex_cfg80211_add_station()
4016 if (!(params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER))) in mwifiex_cfg80211_add_station()
4017 return -EOPNOTSUPP; in mwifiex_cfg80211_add_station()
4020 if ((priv->bss_type != MWIFIEX_BSS_TYPE_STA) || !priv->media_connected) in mwifiex_cfg80211_add_station()
4021 return -EOPNOTSUPP; in mwifiex_cfg80211_add_station()
4027 mwifiex_cfg80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, in mwifiex_cfg80211_channel_switch() argument
4033 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_channel_switch()
4035 if (priv->adapter->scan_processing) { in mwifiex_cfg80211_channel_switch()
4036 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_channel_switch()
4038 return -EBUSY; in mwifiex_cfg80211_channel_switch()
4041 if (priv->wdev.links[0].cac_started) in mwifiex_cfg80211_channel_switch()
4042 return -EBUSY; in mwifiex_cfg80211_channel_switch()
4044 if (cfg80211_chandef_identical(¶ms->chandef, in mwifiex_cfg80211_channel_switch()
4045 &priv->dfs_chandef)) in mwifiex_cfg80211_channel_switch()
4046 return -EINVAL; in mwifiex_cfg80211_channel_switch()
4049 params->beacon_csa.tail, in mwifiex_cfg80211_channel_switch()
4050 params->beacon_csa.tail_len); in mwifiex_cfg80211_channel_switch()
4052 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_channel_switch()
4054 return -EINVAL; in mwifiex_cfg80211_channel_switch()
4058 if (channel_sw->mode) { in mwifiex_cfg80211_channel_switch()
4059 if (netif_carrier_ok(priv->netdev)) in mwifiex_cfg80211_channel_switch()
4060 netif_carrier_off(priv->netdev); in mwifiex_cfg80211_channel_switch()
4061 mwifiex_stop_net_dev_queue(priv->netdev, priv->adapter); in mwifiex_cfg80211_channel_switch()
4065 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_channel_switch()
4068 if (mwifiex_set_mgmt_ies(priv, ¶ms->beacon_csa)) { in mwifiex_cfg80211_channel_switch()
4069 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_channel_switch()
4071 return -EFAULT; in mwifiex_cfg80211_channel_switch()
4074 memcpy(&priv->dfs_chandef, ¶ms->chandef, sizeof(priv->dfs_chandef)); in mwifiex_cfg80211_channel_switch()
4075 memcpy(&priv->beacon_after, ¶ms->beacon_after, in mwifiex_cfg80211_channel_switch()
4076 sizeof(priv->beacon_after)); in mwifiex_cfg80211_channel_switch()
4078 chsw_msec = max(channel_sw->count * priv->bss_cfg.beacon_period, 100); in mwifiex_cfg80211_channel_switch()
4079 queue_delayed_work(priv->dfs_chan_sw_workqueue, &priv->dfs_chan_sw_work, in mwifiex_cfg80211_channel_switch()
4089 struct mwifiex_private *priv = mwifiex_netdev_get_priv(wdev->netdev); in mwifiex_cfg80211_get_channel()
4095 int ret = -ENODATA; in mwifiex_cfg80211_get_channel()
4098 cfg80211_chandef_valid(&priv->bss_chandef)) { in mwifiex_cfg80211_get_channel()
4099 *chandef = priv->bss_chandef; in mwifiex_cfg80211_get_channel()
4101 } else if (priv->media_connected) { in mwifiex_cfg80211_get_channel()
4102 curr_bss = &priv->curr_bss_params.bss_descriptor; in mwifiex_cfg80211_get_channel()
4103 band = mwifiex_band_to_radio_type(priv->curr_bss_params.band); in mwifiex_cfg80211_get_channel()
4104 freq = ieee80211_channel_to_frequency(curr_bss->channel, band); in mwifiex_cfg80211_get_channel()
4107 if (priv->ht_param_present) { in mwifiex_cfg80211_get_channel()
4129 MWIFIEX_TM_ATTR_MAX = __MWIFIEX_TM_ATTR_AFTER_LAST - 1,
4145 struct mwifiex_private *priv = mwifiex_netdev_get_priv(wdev->netdev); in mwifiex_tm_cmd()
4152 return -EINVAL; in mwifiex_tm_cmd()
4160 return -EINVAL; in mwifiex_tm_cmd()
4165 return -EINVAL; in mwifiex_tm_cmd()
4169 return -ENOMEM; in mwifiex_tm_cmd()
4171 hostcmd->len = nla_len(tb[MWIFIEX_TM_ATTR_DATA]); in mwifiex_tm_cmd()
4172 memcpy(hostcmd->cmd, nla_data(tb[MWIFIEX_TM_ATTR_DATA]), in mwifiex_tm_cmd()
4173 hostcmd->len); in mwifiex_tm_cmd()
4176 dev_err(priv->adapter->dev, "Failed to process hostcmd\n"); in mwifiex_tm_cmd()
4178 return -EFAULT; in mwifiex_tm_cmd()
4182 skb = cfg80211_testmode_alloc_reply_skb(wiphy, hostcmd->len); in mwifiex_tm_cmd()
4185 return -ENOMEM; in mwifiex_tm_cmd()
4188 hostcmd->len, hostcmd->cmd); in mwifiex_tm_cmd()
4192 return -EMSGSIZE; in mwifiex_tm_cmd()
4199 return -EOPNOTSUPP; in mwifiex_tm_cmd()
4206 struct net_device *dev, in mwifiex_cfg80211_start_radar_detection() argument
4210 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_start_radar_detection()
4213 if (priv->adapter->scan_processing) { in mwifiex_cfg80211_start_radar_detection()
4214 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_start_radar_detection()
4216 return -EBUSY; in mwifiex_cfg80211_start_radar_detection()
4220 mwifiex_dbg(priv->adapter, INFO, in mwifiex_cfg80211_start_radar_detection()
4223 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_start_radar_detection()
4225 return -1; in mwifiex_cfg80211_start_radar_detection()
4227 priv->state_11h.is_11h_active = true; in mwifiex_cfg80211_start_radar_detection()
4234 memcpy(&priv->dfs_chandef, chandef, sizeof(priv->dfs_chandef)); in mwifiex_cfg80211_start_radar_detection()
4238 return -1; in mwifiex_cfg80211_start_radar_detection()
4240 queue_delayed_work(priv->dfs_cac_workqueue, &priv->dfs_cac_work, in mwifiex_cfg80211_start_radar_detection()
4246 mwifiex_cfg80211_change_station(struct wiphy *wiphy, struct net_device *dev, in mwifiex_cfg80211_change_station() argument
4251 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_change_station()
4253 if (priv->adapter->host_mlme_enabled && in mwifiex_cfg80211_change_station()
4258 if (!(params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER))) in mwifiex_cfg80211_change_station()
4259 return -EOPNOTSUPP; in mwifiex_cfg80211_change_station()
4262 if ((priv->bss_type != MWIFIEX_BSS_TYPE_STA) || !priv->media_connected) in mwifiex_cfg80211_change_station()
4263 return -EOPNOTSUPP; in mwifiex_cfg80211_change_station()
4265 priv->sta_params = params; in mwifiex_cfg80211_change_station()
4268 priv->sta_params = NULL; in mwifiex_cfg80211_change_station()
4275 struct net_device *dev, in mwifiex_cfg80211_authenticate() argument
4278 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_authenticate()
4279 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_cfg80211_authenticate()
4290 mwifiex_dbg(priv->adapter, ERROR, "Interface role is AP\n"); in mwifiex_cfg80211_authenticate()
4291 return -EFAULT; in mwifiex_cfg80211_authenticate()
4294 if (priv->wdev.iftype != NL80211_IFTYPE_STATION) { in mwifiex_cfg80211_authenticate()
4295 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_authenticate()
4297 priv->wdev.iftype); in mwifiex_cfg80211_authenticate()
4298 return -EINVAL; in mwifiex_cfg80211_authenticate()
4301 if (priv->auth_alg != WLAN_AUTH_SAE && in mwifiex_cfg80211_authenticate()
4302 (priv->auth_flag & HOST_MLME_AUTH_PENDING)) { in mwifiex_cfg80211_authenticate()
4303 mwifiex_dbg(priv->adapter, ERROR, "Pending auth on going\n"); in mwifiex_cfg80211_authenticate()
4304 return -EBUSY; in mwifiex_cfg80211_authenticate()
4307 if (!priv->host_mlme_reg) { in mwifiex_cfg80211_authenticate()
4308 priv->host_mlme_reg = true; in mwifiex_cfg80211_authenticate()
4309 priv->mgmt_frame_mask |= HOST_MLME_MGMT_MASK; in mwifiex_cfg80211_authenticate()
4312 &priv->mgmt_frame_mask, false); in mwifiex_cfg80211_authenticate()
4315 switch (req->auth_type) { in mwifiex_cfg80211_authenticate()
4332 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_authenticate()
4333 "unsupported auth type=%d\n", req->auth_type); in mwifiex_cfg80211_authenticate()
4334 return -EOPNOTSUPP; in mwifiex_cfg80211_authenticate()
4337 if (!priv->auth_flag) { in mwifiex_cfg80211_authenticate()
4339 req->bss->channel, in mwifiex_cfg80211_authenticate()
4343 priv->roc_cfg.cookie = get_random_u32() | 1; in mwifiex_cfg80211_authenticate()
4344 priv->roc_cfg.chan = *req->bss->channel; in mwifiex_cfg80211_authenticate()
4346 return -EFAULT; in mwifiex_cfg80211_authenticate()
4350 priv->sec_info.authentication_mode = auth_alg; in mwifiex_cfg80211_authenticate()
4354 pkt_len = (u16)req->ie_len + req->auth_data_len + in mwifiex_cfg80211_authenticate()
4356 if (req->auth_data_len >= 4) in mwifiex_cfg80211_authenticate()
4357 pkt_len -= 4; in mwifiex_cfg80211_authenticate()
4363 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_cfg80211_authenticate()
4365 return -ENOMEM; in mwifiex_cfg80211_authenticate()
4370 tx_info->bss_num = priv->bss_num; in mwifiex_cfg80211_authenticate()
4371 tx_info->bss_type = priv->bss_type; in mwifiex_cfg80211_authenticate()
4372 tx_info->pkt_len = pkt_len; in mwifiex_cfg80211_authenticate()
4383 mgmt->frame_control = in mwifiex_cfg80211_authenticate()
4385 memcpy(mgmt->da, req->bss->bssid, ETH_ALEN); in mwifiex_cfg80211_authenticate()
4386 memcpy(mgmt->sa, priv->curr_addr, ETH_ALEN); in mwifiex_cfg80211_authenticate()
4387 memcpy(mgmt->bssid, req->bss->bssid, ETH_ALEN); in mwifiex_cfg80211_authenticate()
4388 eth_broadcast_addr(mgmt->addr4); in mwifiex_cfg80211_authenticate()
4390 if (req->auth_data_len >= 4) { in mwifiex_cfg80211_authenticate()
4391 if (req->auth_type == NL80211_AUTHTYPE_SAE) { in mwifiex_cfg80211_authenticate()
4392 __le16 *pos = (__le16 *)req->auth_data; in mwifiex_cfg80211_authenticate()
4397 memcpy((u8 *)(&mgmt->auth.variable), req->auth_data + 4, in mwifiex_cfg80211_authenticate()
4398 req->auth_data_len - 4); in mwifiex_cfg80211_authenticate()
4399 varptr = (u8 *)&mgmt->auth.variable + in mwifiex_cfg80211_authenticate()
4400 (req->auth_data_len - 4); in mwifiex_cfg80211_authenticate()
4403 mgmt->auth.auth_alg = cpu_to_le16(auth_alg); in mwifiex_cfg80211_authenticate()
4404 mgmt->auth.auth_transaction = cpu_to_le16(trans); in mwifiex_cfg80211_authenticate()
4405 mgmt->auth.status_code = cpu_to_le16(status_code); in mwifiex_cfg80211_authenticate()
4407 if (req->ie && req->ie_len) { in mwifiex_cfg80211_authenticate()
4409 varptr = (u8 *)&mgmt->auth.variable; in mwifiex_cfg80211_authenticate()
4410 memcpy((u8 *)varptr, req->ie, req->ie_len); in mwifiex_cfg80211_authenticate()
4413 priv->auth_flag = HOST_MLME_AUTH_PENDING; in mwifiex_cfg80211_authenticate()
4414 priv->auth_alg = auth_alg; in mwifiex_cfg80211_authenticate()
4416 skb->priority = WMM_HIGHEST_PRIORITY; in mwifiex_cfg80211_authenticate()
4419 mwifiex_dbg(priv->adapter, MSG, in mwifiex_cfg80211_authenticate()
4420 "auth: send authentication to %pM\n", req->bss->bssid); in mwifiex_cfg80211_authenticate()
4428 mwifiex_cfg80211_associate(struct wiphy *wiphy, struct net_device *dev, in mwifiex_cfg80211_associate() argument
4431 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); in mwifiex_cfg80211_associate()
4432 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_cfg80211_associate()
4439 "%s: reject infra assoc request in non-STA role\n", in mwifiex_cfg80211_associate()
4440 dev->name); in mwifiex_cfg80211_associate()
4441 return -EINVAL; in mwifiex_cfg80211_associate()
4444 if (test_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags) || in mwifiex_cfg80211_associate()
4445 test_bit(MWIFIEX_IS_CMD_TIMEDOUT, &adapter->work_flags)) { in mwifiex_cfg80211_associate()
4449 dev->name); in mwifiex_cfg80211_associate()
4450 return -EFAULT; in mwifiex_cfg80211_associate()
4453 if (priv->auth_alg == WLAN_AUTH_SAE) in mwifiex_cfg80211_associate()
4454 priv->auth_flag = HOST_MLME_AUTH_DONE; in mwifiex_cfg80211_associate()
4456 if (priv->auth_flag && !(priv->auth_flag & HOST_MLME_AUTH_DONE)) in mwifiex_cfg80211_associate()
4457 return -EBUSY; in mwifiex_cfg80211_associate()
4459 if (priv->roc_cfg.cookie) { in mwifiex_cfg80211_associate()
4461 &priv->roc_cfg.chan, 0); in mwifiex_cfg80211_associate()
4463 memset(&priv->roc_cfg, 0, in mwifiex_cfg80211_associate()
4466 return -EFAULT; in mwifiex_cfg80211_associate()
4470 cfg80211_sched_scan_stopped_locked(priv->wdev.wiphy, 0); in mwifiex_cfg80211_associate()
4474 ssid_ie = ieee80211_bss_get_ie(req->bss, WLAN_EID_SSID); in mwifiex_cfg80211_associate()
4481 mwifiex_dbg(adapter, ERROR, "invalid SSID - aborting\n"); in mwifiex_cfg80211_associate()
4487 mwifiex_dbg(adapter, ERROR, "invalid SSID - aborting\n"); in mwifiex_cfg80211_associate()
4495 priv->sec_info.wpa_enabled = false; in mwifiex_cfg80211_associate()
4496 priv->sec_info.wpa2_enabled = false; in mwifiex_cfg80211_associate()
4497 priv->wep_key_curr_index = 0; in mwifiex_cfg80211_associate()
4498 priv->sec_info.encryption_mode = 0; in mwifiex_cfg80211_associate()
4499 priv->sec_info.is_authtype_auto = 0; in mwifiex_cfg80211_associate()
4501 mwifiex_dbg(priv->adapter, ERROR, "deleting the crypto keys\n"); in mwifiex_cfg80211_associate()
4502 return -EFAULT; in mwifiex_cfg80211_associate()
4505 if (req->crypto.n_ciphers_pairwise) in mwifiex_cfg80211_associate()
4506 priv->sec_info.encryption_mode = in mwifiex_cfg80211_associate()
4507 req->crypto.ciphers_pairwise[0]; in mwifiex_cfg80211_associate()
4509 if (req->crypto.cipher_group) in mwifiex_cfg80211_associate()
4510 priv->sec_info.encryption_mode = req->crypto.cipher_group; in mwifiex_cfg80211_associate()
4512 if (req->ie) in mwifiex_cfg80211_associate()
4513 mwifiex_set_gen_ie(priv, req->ie, req->ie_len); in mwifiex_cfg80211_associate()
4515 memcpy(priv->cfg_bssid, req->bss->bssid, ETH_ALEN); in mwifiex_cfg80211_associate()
4518 "assoc: send association to %pM\n", req->bss->bssid); in mwifiex_cfg80211_associate()
4520 cfg80211_ref_bss(adapter->wiphy, req->bss); in mwifiex_cfg80211_associate()
4521 ret = mwifiex_bss_start(priv, req->bss, &req_ssid); in mwifiex_cfg80211_associate()
4523 priv->auth_flag = 0; in mwifiex_cfg80211_associate()
4524 priv->auth_alg = WLAN_AUTH_NONE; in mwifiex_cfg80211_associate()
4525 eth_zero_addr(priv->cfg_bssid); in mwifiex_cfg80211_associate()
4528 if (priv->assoc_rsp_size) { in mwifiex_cfg80211_associate()
4529 priv->req_bss = req->bss; in mwifiex_cfg80211_associate()
4530 adapter->assoc_resp_received = true; in mwifiex_cfg80211_associate()
4531 queue_work(adapter->host_mlme_workqueue, in mwifiex_cfg80211_associate()
4532 &adapter->host_mlme_work); in mwifiex_cfg80211_associate()
4535 cfg80211_put_bss(priv->adapter->wiphy, req->bss); in mwifiex_cfg80211_associate()
4541 return -EFAULT; in mwifiex_cfg80211_associate()
4546 struct net_device *dev, in mwifiex_cfg80211_deauthenticate() argument
4549 return mwifiex_cfg80211_disconnect(wiphy, dev, req->reason_code); in mwifiex_cfg80211_deauthenticate()
4554 struct net_device *dev, in mwifiex_cfg80211_disassociate() argument
4557 return mwifiex_cfg80211_disconnect(wiphy, dev, req->reason_code); in mwifiex_cfg80211_disassociate()
4562 struct net_device *dev, const u8 *peer, in mwifiex_cfg80211_probe_client() argument
4566 * it requires monitor-mode support (which mwifiex doesn't support). in mwifiex_cfg80211_probe_client()
4569 return -EOPNOTSUPP; in mwifiex_cfg80211_probe_client()
4676 if (adapter->config_bands & BAND_A) in mwifiex_init_channel_scan_gap()
4682 adapter->num_in_chan_stats = 2 * (n_channels_bg + n_channels_a); in mwifiex_init_channel_scan_gap()
4683 adapter->chan_stats = vmalloc(array_size(sizeof(*adapter->chan_stats), in mwifiex_init_channel_scan_gap()
4684 adapter->num_in_chan_stats)); in mwifiex_init_channel_scan_gap()
4686 if (!adapter->chan_stats) in mwifiex_init_channel_scan_gap()
4687 return -ENOMEM; in mwifiex_init_channel_scan_gap()
4705 struct mwifiex_private *priv = adapter->priv[MWIFIEX_BSS_TYPE_STA]; in mwifiex_register_cfg80211()
4710 ops = devm_kmemdup(adapter->dev, &mwifiex_cfg80211_ops, in mwifiex_register_cfg80211()
4713 return -ENOMEM; in mwifiex_register_cfg80211()
4720 return -ENOMEM; in mwifiex_register_cfg80211()
4722 if (adapter->host_mlme_enabled) { in mwifiex_register_cfg80211()
4723 ops->auth = mwifiex_cfg80211_authenticate; in mwifiex_register_cfg80211()
4724 ops->assoc = mwifiex_cfg80211_associate; in mwifiex_register_cfg80211()
4725 ops->deauth = mwifiex_cfg80211_deauthenticate; in mwifiex_register_cfg80211()
4726 ops->disassoc = mwifiex_cfg80211_disassociate; in mwifiex_register_cfg80211()
4727 ops->disconnect = NULL; in mwifiex_register_cfg80211()
4728 ops->connect = NULL; in mwifiex_register_cfg80211()
4729 ops->probe_client = mwifiex_cfg80211_probe_client; in mwifiex_register_cfg80211()
4731 wiphy->max_scan_ssids = MWIFIEX_MAX_SSID_LIST_LENGTH; in mwifiex_register_cfg80211()
4732 wiphy->max_scan_ie_len = MWIFIEX_MAX_VSIE_LEN; in mwifiex_register_cfg80211()
4733 if (adapter->host_mlme_enabled) { in mwifiex_register_cfg80211()
4734 memcpy(adapter->mwifiex_mgmt_stypes, in mwifiex_register_cfg80211()
4739 adapter->mwifiex_mgmt_stypes[NL80211_IFTYPE_AP].tx = 0xffff; in mwifiex_register_cfg80211()
4740 adapter->mwifiex_mgmt_stypes[NL80211_IFTYPE_AP].rx = in mwifiex_register_cfg80211()
4748 wiphy->mgmt_stypes = adapter->mwifiex_mgmt_stypes; in mwifiex_register_cfg80211()
4750 wiphy->mgmt_stypes = mwifiex_mgmt_stypes; in mwifiex_register_cfg80211()
4752 wiphy->max_remain_on_channel_duration = 5000; in mwifiex_register_cfg80211()
4753 wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | in mwifiex_register_cfg80211()
4758 wiphy->max_num_akm_suites = CFG80211_MAX_NUM_AKM_SUITES; in mwifiex_register_cfg80211()
4760 if (ISSUPP_ADHOC_ENABLED(adapter->fw_cap_info)) in mwifiex_register_cfg80211()
4761 wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC); in mwifiex_register_cfg80211()
4763 wiphy->bands[NL80211_BAND_2GHZ] = devm_kmemdup(adapter->dev, in mwifiex_register_cfg80211()
4767 if (!wiphy->bands[NL80211_BAND_2GHZ]) { in mwifiex_register_cfg80211()
4768 ret = -ENOMEM; in mwifiex_register_cfg80211()
4772 if (adapter->config_bands & BAND_A) { in mwifiex_register_cfg80211()
4773 wiphy->bands[NL80211_BAND_5GHZ] = devm_kmemdup(adapter->dev, in mwifiex_register_cfg80211()
4777 if (!wiphy->bands[NL80211_BAND_5GHZ]) { in mwifiex_register_cfg80211()
4778 ret = -ENOMEM; in mwifiex_register_cfg80211()
4782 wiphy->bands[NL80211_BAND_5GHZ] = NULL; in mwifiex_register_cfg80211()
4785 if (adapter->drcs_enabled && ISSUPP_DRCS_ENABLED(adapter->fw_cap_info)) in mwifiex_register_cfg80211()
4786 wiphy->iface_combinations = &mwifiex_iface_comb_ap_sta_drcs; in mwifiex_register_cfg80211()
4787 else if (adapter->is_hw_11ac_capable) in mwifiex_register_cfg80211()
4788 wiphy->iface_combinations = &mwifiex_iface_comb_ap_sta_vht; in mwifiex_register_cfg80211()
4790 wiphy->iface_combinations = &mwifiex_iface_comb_ap_sta; in mwifiex_register_cfg80211()
4791 wiphy->n_iface_combinations = 1; in mwifiex_register_cfg80211()
4793 if (adapter->max_sta_conn > adapter->max_p2p_conn) in mwifiex_register_cfg80211()
4794 wiphy->max_ap_assoc_sta = adapter->max_sta_conn; in mwifiex_register_cfg80211()
4796 wiphy->max_ap_assoc_sta = adapter->max_p2p_conn; in mwifiex_register_cfg80211()
4799 wiphy->cipher_suites = mwifiex_cipher_suites; in mwifiex_register_cfg80211()
4800 wiphy->n_cipher_suites = ARRAY_SIZE(mwifiex_cipher_suites); in mwifiex_register_cfg80211()
4802 if (adapter->regd) { in mwifiex_register_cfg80211()
4803 wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG | in mwifiex_register_cfg80211()
4806 wiphy_apply_custom_regulatory(wiphy, adapter->regd); in mwifiex_register_cfg80211()
4809 ether_addr_copy(wiphy->perm_addr, adapter->perm_addr); in mwifiex_register_cfg80211()
4810 wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; in mwifiex_register_cfg80211()
4811 wiphy->flags |= WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD | in mwifiex_register_cfg80211()
4818 if (adapter->host_mlme_enabled) in mwifiex_register_cfg80211()
4819 wiphy->flags |= WIPHY_FLAG_REPORTS_OBSS; in mwifiex_register_cfg80211()
4821 wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME; in mwifiex_register_cfg80211()
4823 if (ISSUPP_TDLS_ENABLED(adapter->fw_cap_info)) in mwifiex_register_cfg80211()
4824 wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS | in mwifiex_register_cfg80211()
4828 if (ISSUPP_FIRMWARE_SUPPLICANT(priv->adapter->fw_cap_info)) in mwifiex_register_cfg80211()
4829 wiphy->wowlan = &mwifiex_wowlan_support; in mwifiex_register_cfg80211()
4831 wiphy->wowlan = &mwifiex_wowlan_support_no_gtk; in mwifiex_register_cfg80211()
4834 wiphy->coalesce = &mwifiex_coalesce_support; in mwifiex_register_cfg80211()
4836 wiphy->probe_resp_offload = NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS | in mwifiex_register_cfg80211()
4840 wiphy->max_sched_scan_reqs = 1; in mwifiex_register_cfg80211()
4841 wiphy->max_sched_scan_ssids = MWIFIEX_MAX_SSID_LIST_LENGTH; in mwifiex_register_cfg80211()
4842 wiphy->max_sched_scan_ie_len = MWIFIEX_MAX_VSIE_LEN; in mwifiex_register_cfg80211()
4843 wiphy->max_match_sets = MWIFIEX_MAX_SSID_LIST_LENGTH; in mwifiex_register_cfg80211()
4845 wiphy->available_antennas_tx = BIT(adapter->number_of_antenna) - 1; in mwifiex_register_cfg80211()
4846 wiphy->available_antennas_rx = BIT(adapter->number_of_antenna) - 1; in mwifiex_register_cfg80211()
4848 wiphy->features |= NL80211_FEATURE_INACTIVITY_TIMER | in mwifiex_register_cfg80211()
4852 if (adapter->host_mlme_enabled) in mwifiex_register_cfg80211()
4853 wiphy->features |= NL80211_FEATURE_SAE; in mwifiex_register_cfg80211()
4855 if (ISSUPP_ADHOC_ENABLED(adapter->fw_cap_info)) in mwifiex_register_cfg80211()
4856 wiphy->features |= NL80211_FEATURE_HT_IBSS; in mwifiex_register_cfg80211()
4858 if (ISSUPP_RANDOM_MAC(adapter->fw_cap_info)) in mwifiex_register_cfg80211()
4859 wiphy->features |= NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR | in mwifiex_register_cfg80211()
4863 if (ISSUPP_TDLS_ENABLED(adapter->fw_cap_info)) in mwifiex_register_cfg80211()
4864 wiphy->features |= NL80211_FEATURE_TDLS_CHANNEL_SWITCH; in mwifiex_register_cfg80211()
4866 if (adapter->fw_api_ver == MWIFIEX_FW_V15) in mwifiex_register_cfg80211()
4867 wiphy->features |= NL80211_FEATURE_SK_TX_STATUS; in mwifiex_register_cfg80211()
4870 wiphy->bss_priv_size = sizeof(struct mwifiex_bss_priv); in mwifiex_register_cfg80211()
4872 wiphy->reg_notifier = mwifiex_reg_notifier; in mwifiex_register_cfg80211()
4878 set_wiphy_dev(wiphy, priv->adapter->dev); in mwifiex_register_cfg80211()
4887 if (!adapter->regd) { in mwifiex_register_cfg80211()
4893 if (adapter->region_code == 0x00) { in mwifiex_register_cfg80211()
4897 wiphy->regulatory_flags |= in mwifiex_register_cfg80211()
4902 adapter->region_code); in mwifiex_register_cfg80211()
4905 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_register_cfg80211()
4913 wiphy->frag_threshold = thr; in mwifiex_register_cfg80211()
4916 wiphy->rts_threshold = thr; in mwifiex_register_cfg80211()
4919 wiphy->retry_short = (u8) retry; in mwifiex_register_cfg80211()
4922 wiphy->retry_long = (u8) retry; in mwifiex_register_cfg80211()
4924 adapter->wiphy = wiphy; in mwifiex_register_cfg80211()