Lines Matching +full:tlv +full:- +full:layout
4 * Copyright 2011-2020 NXP
11 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
13 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
40 mwifiex_dbg(priv->adapter, DATA, "%s: %pM\n", __func__, mac); in mwifiex_restore_tdls_packets()
41 spin_lock_bh(&priv->wmm.ra_list_spinlock); in mwifiex_restore_tdls_packets()
43 skb_queue_walk_safe(&priv->tdls_txq, skb, tmp) { in mwifiex_restore_tdls_packets()
44 if (!ether_addr_equal(mac, skb->data)) in mwifiex_restore_tdls_packets()
47 __skb_unlink(skb, &priv->tdls_txq); in mwifiex_restore_tdls_packets()
49 tid = skb->priority; in mwifiex_restore_tdls_packets()
54 ra_list->tdls_link = true; in mwifiex_restore_tdls_packets()
55 tx_info->flags |= MWIFIEX_BUF_FLAG_TDLS_PKT; in mwifiex_restore_tdls_packets()
57 tid_list = &priv->wmm.tid_tbl_ptr[tid_down].ra_list; in mwifiex_restore_tdls_packets()
60 tx_info->flags &= ~MWIFIEX_BUF_FLAG_TDLS_PKT; in mwifiex_restore_tdls_packets()
64 mwifiex_write_data_complete(priv->adapter, skb, 0, -1); in mwifiex_restore_tdls_packets()
68 skb_queue_tail(&ra_list->skb_head, skb); in mwifiex_restore_tdls_packets()
70 ra_list->ba_pkt_count++; in mwifiex_restore_tdls_packets()
71 ra_list->total_pkt_count++; in mwifiex_restore_tdls_packets()
73 if (atomic_read(&priv->wmm.highest_queued_prio) < in mwifiex_restore_tdls_packets()
75 atomic_set(&priv->wmm.highest_queued_prio, in mwifiex_restore_tdls_packets()
78 atomic_inc(&priv->wmm.tx_pkts_queued); in mwifiex_restore_tdls_packets()
81 spin_unlock_bh(&priv->wmm.ra_list_spinlock); in mwifiex_restore_tdls_packets()
93 mwifiex_dbg(priv->adapter, DATA, "%s: %pM\n", __func__, mac); in mwifiex_hold_tdls_packets()
94 spin_lock_bh(&priv->wmm.ra_list_spinlock); in mwifiex_hold_tdls_packets()
97 if (!list_empty(&priv->wmm.tid_tbl_ptr[i].ra_list)) { in mwifiex_hold_tdls_packets()
98 ra_list_head = &priv->wmm.tid_tbl_ptr[i].ra_list; in mwifiex_hold_tdls_packets()
100 skb_queue_walk_safe(&ra_list->skb_head, skb, in mwifiex_hold_tdls_packets()
102 if (!ether_addr_equal(mac, skb->data)) in mwifiex_hold_tdls_packets()
104 __skb_unlink(skb, &ra_list->skb_head); in mwifiex_hold_tdls_packets()
105 atomic_dec(&priv->wmm.tx_pkts_queued); in mwifiex_hold_tdls_packets()
106 ra_list->total_pkt_count--; in mwifiex_hold_tdls_packets()
107 skb_queue_tail(&priv->tdls_txq, skb); in mwifiex_hold_tdls_packets()
113 spin_unlock_bh(&priv->wmm.ra_list_spinlock); in mwifiex_hold_tdls_packets()
117 /* This function appends rate TLV to scan config command. */
131 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_tdls_append_rates_ie()
133 return -ENOMEM; in mwifiex_tdls_append_rates_ie()
142 ext_rates_size = rates_size - MWIFIEX_TDLS_SUPPORTED_RATES; in mwifiex_tdls_append_rates_ie()
159 assoc_rsp = (struct ieee_types_assoc_rsp *)&priv->assoc_rsp_buf; in mwifiex_tdls_add_aid()
163 memcpy(pos, &assoc_rsp->a_id, sizeof(assoc_rsp->a_id)); in mwifiex_tdls_add_aid()
180 mwifiex_fill_vht_cap_tlv(priv, &vht_cap, priv->curr_bss_params.band); in mwifiex_tdls_add_vht_capab()
193 &priv->curr_bss_params.bss_descriptor; in mwifiex_tdls_add_ht_oper()
198 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_tdls_add_ht_oper()
200 return -1; in mwifiex_tdls_add_ht_oper()
203 if (!(le16_to_cpu(sta_ptr->tdls_cap.ht_capb.cap_info))) { in mwifiex_tdls_add_ht_oper()
204 mwifiex_dbg(priv->adapter, WARN, in mwifiex_tdls_add_ht_oper()
214 ht_oper->primary_chan = bss_desc->channel; in mwifiex_tdls_add_ht_oper()
217 if (ISSUPP_CHANWIDTH40(priv->adapter->hw_dot_11n_dev_cap) && in mwifiex_tdls_add_ht_oper()
218 bss_desc->bcn_ht_cap && in mwifiex_tdls_add_ht_oper()
219 ISALLOWED_CHANWIDTH40(bss_desc->bcn_ht_oper->ht_param)) in mwifiex_tdls_add_ht_oper()
220 ht_oper->ht_param = bss_desc->bcn_ht_oper->ht_param; in mwifiex_tdls_add_ht_oper()
223 ht_oper->ht_param = in mwifiex_tdls_add_ht_oper()
224 mwifiex_get_sec_chan_offset(bss_desc->channel); in mwifiex_tdls_add_ht_oper()
225 ht_oper->ht_param |= BIT(2); in mwifiex_tdls_add_ht_oper()
228 memcpy(&sta_ptr->tdls_cap.ht_oper, ht_oper, in mwifiex_tdls_add_ht_oper()
241 struct mwifiex_adapter *adapter = priv->adapter; in mwifiex_tdls_add_vht_oper()
248 bss_desc = &priv->curr_bss_params.bss_descriptor; in mwifiex_tdls_add_vht_oper()
254 return -1; in mwifiex_tdls_add_vht_oper()
257 if (!(le32_to_cpu(sta_ptr->tdls_cap.vhtcap.vht_cap_info))) { in mwifiex_tdls_add_vht_oper()
264 if (sta_ptr->tdls_cap.extcap.ext_capab[7] & in mwifiex_tdls_add_vht_oper()
271 ap_vht_cap = bss_desc->bcn_vht_cap; in mwifiex_tdls_add_vht_oper()
279 if (bss_desc->bss_band & BAND_A) in mwifiex_tdls_add_vht_oper()
280 usr_vht_cap_info = adapter->usr_dot_11ac_dev_cap_a; in mwifiex_tdls_add_vht_oper()
282 usr_vht_cap_info = adapter->usr_dot_11ac_dev_cap_bg; in mwifiex_tdls_add_vht_oper()
285 vht_cap = &sta_ptr->tdls_cap.vhtcap; in mwifiex_tdls_add_vht_oper()
288 GET_VHTCAP_CHWDSET(le32_to_cpu(vht_cap->vht_cap_info)); in mwifiex_tdls_add_vht_oper()
293 if (ap_vht_cap && sta_ptr->tdls_cap.extcap.ext_capab[7] & in mwifiex_tdls_add_vht_oper()
296 GET_VHTCAP_CHWDSET(le32_to_cpu(ap_vht_cap->vht_cap_info)); in mwifiex_tdls_add_vht_oper()
302 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80MHZ; in mwifiex_tdls_add_vht_oper()
305 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_160MHZ; in mwifiex_tdls_add_vht_oper()
308 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80P80MHZ; in mwifiex_tdls_add_vht_oper()
311 vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_USE_HT; in mwifiex_tdls_add_vht_oper()
315 mcs_map_user = GET_DEVRXMCSMAP(adapter->usr_dot_11ac_mcs_support); in mwifiex_tdls_add_vht_oper()
316 mcs_map_resp = le16_to_cpu(vht_cap->supp_mcs.rx_mcs_map); in mwifiex_tdls_add_vht_oper()
332 vht_oper->basic_mcs_set = cpu_to_le16(mcs_map_result); in mwifiex_tdls_add_vht_oper()
334 switch (vht_oper->chan_width) { in mwifiex_tdls_add_vht_oper()
348 vht_oper->center_freq_seg0_idx = in mwifiex_tdls_add_vht_oper()
350 bss_desc->channel, in mwifiex_tdls_add_vht_oper()
362 extcap->ieee_hdr.element_id = WLAN_EID_EXT_CAPABILITY; in mwifiex_tdls_add_ext_capab()
363 extcap->ieee_hdr.len = 8; in mwifiex_tdls_add_ext_capab()
364 memset(extcap->ext_capab, 0, 8); in mwifiex_tdls_add_ext_capab()
365 extcap->ext_capab[4] |= WLAN_EXT_CAPA5_TDLS_ENABLED; in mwifiex_tdls_add_ext_capab()
366 extcap->ext_capab[3] |= WLAN_EXT_CAPA4_TDLS_CHAN_SWITCH; in mwifiex_tdls_add_ext_capab()
368 if (priv->adapter->is_hw_11ac_capable) in mwifiex_tdls_add_ext_capab()
369 extcap->ext_capab[7] |= WLAN_EXT_CAPA8_TDLS_WIDE_BW_ENABLED; in mwifiex_tdls_add_ext_capab()
392 wmm->element_id = WLAN_EID_VENDOR_SPECIFIC; in mwifiex_tdls_add_wmm_param_ie()
393 wmm->len = sizeof(*wmm) - 2; in mwifiex_tdls_add_wmm_param_ie()
394 wmm->oui[0] = 0x00; /* Microsoft OUI 00:50:F2 */ in mwifiex_tdls_add_wmm_param_ie()
395 wmm->oui[1] = 0x50; in mwifiex_tdls_add_wmm_param_ie()
396 wmm->oui[2] = 0xf2; in mwifiex_tdls_add_wmm_param_ie()
397 wmm->oui_type = 2; /* WME */ in mwifiex_tdls_add_wmm_param_ie()
398 wmm->oui_subtype = 1; /* WME param */ in mwifiex_tdls_add_wmm_param_ie()
399 wmm->version = 1; /* WME ver */ in mwifiex_tdls_add_wmm_param_ie()
400 wmm->qos_info = 0; /* U-APSD not in use */ in mwifiex_tdls_add_wmm_param_ie()
403 memcpy(&wmm->ac[0], ac_be, sizeof(ac_be)); in mwifiex_tdls_add_wmm_param_ie()
404 memcpy(&wmm->ac[1], ac_bk, sizeof(ac_bk)); in mwifiex_tdls_add_wmm_param_ie()
405 memcpy(&wmm->ac[2], ac_vi, sizeof(ac_vi)); in mwifiex_tdls_add_wmm_param_ie()
406 memcpy(&wmm->ac[3], ac_vo, sizeof(ac_vo)); in mwifiex_tdls_add_wmm_param_ie()
426 *buf++ = qosinfo; /* U-APSD no in use */ in mwifiex_add_wmm_info_ie()
434 bssco->ieee_hdr.element_id = WLAN_EID_BSS_COEX_2040; in mwifiex_tdls_add_bss_co_2040()
435 bssco->ieee_hdr.len = sizeof(struct ieee_types_bss_co_2040) - in mwifiex_tdls_add_bss_co_2040()
437 bssco->bss_2040co = 0x01; in mwifiex_tdls_add_bss_co_2040()
447 supp_chan->ieee_hdr.element_id = WLAN_EID_SUPPORTED_CHANNELS; in mwifiex_tdls_add_supported_chan()
448 supp_chan->ieee_hdr.len = sizeof(chan_supp); in mwifiex_tdls_add_supported_chan()
449 memcpy(supp_chan->data, chan_supp, sizeof(chan_supp)); in mwifiex_tdls_add_supported_chan()
459 reg_class->ieee_hdr.element_id = WLAN_EID_SUPPORTED_REGULATORY_CLASSES; in mwifiex_tdls_add_oper_class()
460 reg_class->ieee_hdr.len = sizeof(rc_list); in mwifiex_tdls_add_oper_class()
461 memcpy(reg_class->data, rc_list, sizeof(rc_list)); in mwifiex_tdls_add_oper_class()
475 capab = priv->curr_bss_params.bss_descriptor.cap_info_bitmap; in mwifiex_prep_tdls_encap_data()
478 memcpy(tf->da, peer, ETH_ALEN); in mwifiex_prep_tdls_encap_data()
479 memcpy(tf->sa, priv->curr_addr, ETH_ALEN); in mwifiex_prep_tdls_encap_data()
480 tf->ether_type = cpu_to_be16(ETH_P_TDLS); in mwifiex_prep_tdls_encap_data()
481 tf->payload_type = WLAN_TDLS_SNAP_RFTYPE; in mwifiex_prep_tdls_encap_data()
485 tf->category = WLAN_CATEGORY_TDLS; in mwifiex_prep_tdls_encap_data()
486 tf->action_code = WLAN_TDLS_SETUP_REQUEST; in mwifiex_prep_tdls_encap_data()
487 skb_put(skb, sizeof(tf->u.setup_req)); in mwifiex_prep_tdls_encap_data()
488 tf->u.setup_req.dialog_token = dialog_token; in mwifiex_prep_tdls_encap_data()
489 tf->u.setup_req.capability = cpu_to_le16(capab); in mwifiex_prep_tdls_encap_data()
500 radio = mwifiex_band_to_radio_type(priv->curr_bss_params.band); in mwifiex_prep_tdls_encap_data()
507 if (priv->adapter->is_hw_11ac_capable) { in mwifiex_prep_tdls_encap_data()
524 tf->category = WLAN_CATEGORY_TDLS; in mwifiex_prep_tdls_encap_data()
525 tf->action_code = WLAN_TDLS_SETUP_RESPONSE; in mwifiex_prep_tdls_encap_data()
526 skb_put(skb, sizeof(tf->u.setup_resp)); in mwifiex_prep_tdls_encap_data()
527 tf->u.setup_resp.status_code = cpu_to_le16(status_code); in mwifiex_prep_tdls_encap_data()
528 tf->u.setup_resp.dialog_token = dialog_token; in mwifiex_prep_tdls_encap_data()
529 tf->u.setup_resp.capability = cpu_to_le16(capab); in mwifiex_prep_tdls_encap_data()
540 radio = mwifiex_band_to_radio_type(priv->curr_bss_params.band); in mwifiex_prep_tdls_encap_data()
547 if (priv->adapter->is_hw_11ac_capable) { in mwifiex_prep_tdls_encap_data()
564 tf->category = WLAN_CATEGORY_TDLS; in mwifiex_prep_tdls_encap_data()
565 tf->action_code = WLAN_TDLS_SETUP_CONFIRM; in mwifiex_prep_tdls_encap_data()
566 skb_put(skb, sizeof(tf->u.setup_cfm)); in mwifiex_prep_tdls_encap_data()
567 tf->u.setup_cfm.status_code = cpu_to_le16(status_code); in mwifiex_prep_tdls_encap_data()
568 tf->u.setup_cfm.dialog_token = dialog_token; in mwifiex_prep_tdls_encap_data()
571 if (priv->adapter->is_hw_11ac_capable) { in mwifiex_prep_tdls_encap_data()
592 tf->category = WLAN_CATEGORY_TDLS; in mwifiex_prep_tdls_encap_data()
593 tf->action_code = WLAN_TDLS_TEARDOWN; in mwifiex_prep_tdls_encap_data()
594 skb_put(skb, sizeof(tf->u.teardown)); in mwifiex_prep_tdls_encap_data()
595 tf->u.teardown.reason_code = cpu_to_le16(status_code); in mwifiex_prep_tdls_encap_data()
599 tf->category = WLAN_CATEGORY_TDLS; in mwifiex_prep_tdls_encap_data()
600 tf->action_code = WLAN_TDLS_DISCOVERY_REQUEST; in mwifiex_prep_tdls_encap_data()
601 skb_put(skb, sizeof(tf->u.discover_req)); in mwifiex_prep_tdls_encap_data()
602 tf->u.discover_req.dialog_token = dialog_token; in mwifiex_prep_tdls_encap_data()
605 mwifiex_dbg(priv->adapter, ERROR, "Unknown TDLS frame type.\n"); in mwifiex_prep_tdls_encap_data()
606 return -EINVAL; in mwifiex_prep_tdls_encap_data()
619 lnkid->ie_type = WLAN_EID_LINK_ID; in mwifiex_tdls_add_link_ie()
620 lnkid->ie_len = sizeof(struct ieee80211_tdls_lnkie) - in mwifiex_tdls_add_link_ie()
623 memcpy(lnkid->bssid, bssid, ETH_ALEN); in mwifiex_tdls_add_link_ie()
624 memcpy(lnkid->init_sta, src_addr, ETH_ALEN); in mwifiex_tdls_add_link_ie()
625 memcpy(lnkid->resp_sta, peer, ETH_ALEN); in mwifiex_tdls_add_link_ie()
655 if (priv->adapter->is_hw_11ac_capable) in mwifiex_send_tdls_data_frame()
662 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_send_tdls_data_frame()
664 return -ENOMEM; in mwifiex_send_tdls_data_frame()
682 mwifiex_tdls_add_link_ie(skb, priv->curr_addr, peer, in mwifiex_send_tdls_data_frame()
683 priv->cfg_bssid); in mwifiex_send_tdls_data_frame()
695 mwifiex_tdls_add_link_ie(skb, peer, priv->curr_addr, in mwifiex_send_tdls_data_frame()
696 priv->cfg_bssid); in mwifiex_send_tdls_data_frame()
703 skb->priority = MWIFIEX_PRIO_BK; in mwifiex_send_tdls_data_frame()
706 skb->priority = MWIFIEX_PRIO_VI; in mwifiex_send_tdls_data_frame()
712 tx_info->bss_num = priv->bss_num; in mwifiex_send_tdls_data_frame()
713 tx_info->bss_type = priv->bss_type; in mwifiex_send_tdls_data_frame()
741 capab = priv->curr_bss_params.bss_descriptor.cap_info_bitmap; in mwifiex_construct_tdls_action_frame()
746 memcpy(mgmt->da, peer, ETH_ALEN); in mwifiex_construct_tdls_action_frame()
747 memcpy(mgmt->sa, priv->curr_addr, ETH_ALEN); in mwifiex_construct_tdls_action_frame()
748 memcpy(mgmt->bssid, priv->cfg_bssid, ETH_ALEN); in mwifiex_construct_tdls_action_frame()
749 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in mwifiex_construct_tdls_action_frame()
757 /* See the layout of 'struct ieee80211_mgmt'. */ in mwifiex_construct_tdls_action_frame()
758 extra = sizeof(mgmt->u.action.u.tdls_discover_resp) + in mwifiex_construct_tdls_action_frame()
759 sizeof(mgmt->u.action.category); in mwifiex_construct_tdls_action_frame()
761 mgmt->u.action.category = WLAN_CATEGORY_PUBLIC; in mwifiex_construct_tdls_action_frame()
762 mgmt->u.action.u.tdls_discover_resp.action_code = in mwifiex_construct_tdls_action_frame()
764 mgmt->u.action.u.tdls_discover_resp.dialog_token = in mwifiex_construct_tdls_action_frame()
766 mgmt->u.action.u.tdls_discover_resp.capability = in mwifiex_construct_tdls_action_frame()
769 memmove(pos + ETH_ALEN, &mgmt->u.action, extra); in mwifiex_construct_tdls_action_frame()
783 radio = mwifiex_band_to_radio_type(priv->curr_bss_params.band); in mwifiex_construct_tdls_action_frame()
790 if (priv->adapter->is_hw_11ac_capable) { in mwifiex_construct_tdls_action_frame()
806 mwifiex_dbg(priv->adapter, ERROR, "Unknown TDLS action frame type\n"); in mwifiex_construct_tdls_action_frame()
807 return -EINVAL; in mwifiex_construct_tdls_action_frame()
838 if (priv->adapter->is_hw_11ac_capable) in mwifiex_send_tdls_action_frame()
845 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_send_tdls_action_frame()
847 return -ENOMEM; in mwifiex_send_tdls_action_frame()
863 return -EINVAL; in mwifiex_send_tdls_action_frame()
871 mwifiex_tdls_add_link_ie(skb, peer, priv->curr_addr, in mwifiex_send_tdls_action_frame()
872 priv->cfg_bssid); in mwifiex_send_tdls_action_frame()
874 skb->priority = MWIFIEX_PRIO_VI; in mwifiex_send_tdls_action_frame()
878 tx_info->bss_num = priv->bss_num; in mwifiex_send_tdls_action_frame()
879 tx_info->bss_type = priv->bss_type; in mwifiex_send_tdls_action_frame()
880 tx_info->flags |= MWIFIEX_BUF_FLAG_TDLS_PKT; in mwifiex_send_tdls_action_frame()
882 pkt_len = skb->len - MWIFIEX_MGMT_FRAME_HEADER_SIZE - sizeof(pkt_len); in mwifiex_send_tdls_action_frame()
883 memcpy(skb->data + MWIFIEX_MGMT_FRAME_HEADER_SIZE, &pkt_len, in mwifiex_send_tdls_action_frame()
912 mwifiex_dbg(priv->adapter, DATA, in mwifiex_process_tdls_action_frame()
923 ies_len = len - sizeof(struct ethhdr) - TDLS_REQ_FIX_LEN; in mwifiex_process_tdls_action_frame()
933 ies_len = len - sizeof(struct ethhdr) - TDLS_RESP_FIX_LEN; in mwifiex_process_tdls_action_frame()
941 ies_len = len - sizeof(struct ethhdr) - TDLS_CONFIRM_FIX_LEN; in mwifiex_process_tdls_action_frame()
944 mwifiex_dbg(priv->adapter, ERROR, "Unknown TDLS frame type.\n"); in mwifiex_process_tdls_action_frame()
952 sta_ptr->tdls_cap.capab = cpu_to_le16(cap); in mwifiex_process_tdls_action_frame()
962 if (ie_len > sizeof(sta_ptr->tdls_cap.rates)) in mwifiex_process_tdls_action_frame()
964 sta_ptr->tdls_cap.rates_len = ie_len; in mwifiex_process_tdls_action_frame()
966 sta_ptr->tdls_cap.rates[i] = pos[i + 2]; in mwifiex_process_tdls_action_frame()
970 if (ie_len > sizeof(sta_ptr->tdls_cap.rates)) in mwifiex_process_tdls_action_frame()
972 basic = sta_ptr->tdls_cap.rates_len; in mwifiex_process_tdls_action_frame()
973 if (ie_len > sizeof(sta_ptr->tdls_cap.rates) - basic) in mwifiex_process_tdls_action_frame()
976 sta_ptr->tdls_cap.rates[basic + i] = pos[i + 2]; in mwifiex_process_tdls_action_frame()
977 sta_ptr->tdls_cap.rates_len += ie_len; in mwifiex_process_tdls_action_frame()
983 memcpy((u8 *)&sta_ptr->tdls_cap.ht_capb, pos + 2, in mwifiex_process_tdls_action_frame()
985 sta_ptr->is_11n_enabled = 1; in mwifiex_process_tdls_action_frame()
991 memcpy(&sta_ptr->tdls_cap.ht_oper, pos + 2, in mwifiex_process_tdls_action_frame()
997 sta_ptr->tdls_cap.coex_2040 = pos[2]; in mwifiex_process_tdls_action_frame()
1004 memcpy((u8 *)&sta_ptr->tdls_cap.extcap, pos, in mwifiex_process_tdls_action_frame()
1011 if (ie_len > IEEE_MAX_IE_SIZE - in mwifiex_process_tdls_action_frame()
1014 memcpy((u8 *)&sta_ptr->tdls_cap.rsn_ie, pos, in mwifiex_process_tdls_action_frame()
1016 min_t(u8, ie_len, IEEE_MAX_IE_SIZE - in mwifiex_process_tdls_action_frame()
1022 sta_ptr->tdls_cap.qos_info = pos[2]; in mwifiex_process_tdls_action_frame()
1025 if (priv->adapter->is_hw_11ac_capable) { in mwifiex_process_tdls_action_frame()
1030 memcpy(&sta_ptr->tdls_cap.vhtoper, pos + 2, in mwifiex_process_tdls_action_frame()
1035 if (priv->adapter->is_hw_11ac_capable) { in mwifiex_process_tdls_action_frame()
1039 memcpy((u8 *)&sta_ptr->tdls_cap.vhtcap, pos + 2, in mwifiex_process_tdls_action_frame()
1041 sta_ptr->is_11ac_enabled = 1; in mwifiex_process_tdls_action_frame()
1045 if (priv->adapter->is_hw_11ac_capable) { in mwifiex_process_tdls_action_frame()
1048 sta_ptr->tdls_cap.aid = in mwifiex_process_tdls_action_frame()
1069 if (!sta_ptr || sta_ptr->tdls_status == TDLS_SETUP_FAILURE) { in mwifiex_tdls_process_config_link()
1070 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_tdls_process_config_link()
1072 return -EINVAL; in mwifiex_tdls_process_config_link()
1090 if (sta_ptr && sta_ptr->tdls_status == TDLS_SETUP_INPROGRESS) { in mwifiex_tdls_process_create_link()
1091 mwifiex_dbg(priv->adapter, WARN, in mwifiex_tdls_process_create_link()
1098 return -ENOMEM; in mwifiex_tdls_process_create_link()
1100 sta_ptr->tdls_status = TDLS_SETUP_INPROGRESS; in mwifiex_tdls_process_create_link()
1118 if (sta_ptr->is_11n_enabled) { in mwifiex_tdls_process_disable_link()
1120 spin_lock_bh(&priv->wmm.ra_list_spinlock); in mwifiex_tdls_process_disable_link()
1122 spin_unlock_bh(&priv->wmm.ra_list_spinlock); in mwifiex_tdls_process_disable_link()
1144 if (sta_ptr && (sta_ptr->tdls_status != TDLS_SETUP_FAILURE)) { in mwifiex_tdls_process_enable_link()
1145 mwifiex_dbg(priv->adapter, MSG, in mwifiex_tdls_process_enable_link()
1148 sta_ptr->tdls_status = TDLS_SETUP_COMPLETE; in mwifiex_tdls_process_enable_link()
1150 mcs = sta_ptr->tdls_cap.ht_capb.mcs; in mwifiex_tdls_process_enable_link()
1152 sta_ptr->is_11n_enabled = true; in mwifiex_tdls_process_enable_link()
1153 if (sta_ptr->is_11n_enabled) { in mwifiex_tdls_process_enable_link()
1154 if (le16_to_cpu(sta_ptr->tdls_cap.ht_capb.cap_info) & in mwifiex_tdls_process_enable_link()
1156 sta_ptr->max_amsdu = in mwifiex_tdls_process_enable_link()
1159 sta_ptr->max_amsdu = in mwifiex_tdls_process_enable_link()
1163 sta_ptr->ampdu_sta[i] = in mwifiex_tdls_process_enable_link()
1164 priv->aggr_prio_tbl[i].ampdu_user; in mwifiex_tdls_process_enable_link()
1167 sta_ptr->ampdu_sta[i] = BA_STREAM_NOT_ALLOWED; in mwifiex_tdls_process_enable_link()
1169 if (sta_ptr->tdls_cap.extcap.ext_capab[3] & in mwifiex_tdls_process_enable_link()
1175 memset(sta_ptr->rx_seq, 0xff, sizeof(sta_ptr->rx_seq)); in mwifiex_tdls_process_enable_link()
1180 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_tdls_process_enable_link()
1184 spin_lock_bh(&priv->wmm.ra_list_spinlock); in mwifiex_tdls_process_enable_link()
1186 spin_unlock_bh(&priv->wmm.ra_list_spinlock); in mwifiex_tdls_process_enable_link()
1193 return -1; in mwifiex_tdls_process_enable_link()
1220 return sta_ptr->tdls_status; in mwifiex_get_tdls_link_status()
1232 if (!ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info)) in mwifiex_get_tdls_list()
1236 if (!(priv->bss_type == MWIFIEX_BSS_TYPE_STA && priv->media_connected)) in mwifiex_get_tdls_list()
1239 spin_lock_bh(&priv->sta_list_spinlock); in mwifiex_get_tdls_list()
1240 list_for_each_entry(sta_ptr, &priv->sta_list, list) { in mwifiex_get_tdls_list()
1241 if (mwifiex_is_tdls_link_setup(sta_ptr->tdls_status)) { in mwifiex_get_tdls_list()
1242 ether_addr_copy(peer->peer_addr, sta_ptr->mac_addr); in mwifiex_get_tdls_list()
1249 spin_unlock_bh(&priv->sta_list_spinlock); in mwifiex_get_tdls_list()
1259 if (list_empty(&priv->sta_list)) in mwifiex_disable_all_tdls_links()
1262 list_for_each_entry(sta_ptr, &priv->sta_list, list) { in mwifiex_disable_all_tdls_links()
1265 if (sta_ptr->is_11n_enabled) { in mwifiex_disable_all_tdls_links()
1267 spin_lock_bh(&priv->wmm.ra_list_spinlock); in mwifiex_disable_all_tdls_links()
1269 spin_unlock_bh(&priv->wmm.ra_list_spinlock); in mwifiex_disable_all_tdls_links()
1272 mwifiex_restore_tdls_packets(priv, sta_ptr->mac_addr, in mwifiex_disable_all_tdls_links()
1274 memcpy(&tdls_oper.peer_mac, sta_ptr->mac_addr, ETH_ALEN); in mwifiex_disable_all_tdls_links()
1278 mwifiex_dbg(priv->adapter, ERROR, in mwifiex_disable_all_tdls_links()
1280 sta_ptr->mac_addr); in mwifiex_disable_all_tdls_links()
1291 ether_addr_copy(mac, skb->data); in mwifiex_tdls_check_tx()
1293 spin_lock_bh(&priv->auto_tdls_lock); in mwifiex_tdls_check_tx()
1294 list_for_each_entry(peer, &priv->auto_tdls_list, list) { in mwifiex_tdls_check_tx()
1295 if (!memcmp(mac, peer->mac_addr, ETH_ALEN)) { in mwifiex_tdls_check_tx()
1296 if (peer->rssi <= MWIFIEX_TDLS_RSSI_HIGH && in mwifiex_tdls_check_tx()
1297 peer->tdls_status == TDLS_NOT_SETUP && in mwifiex_tdls_check_tx()
1298 (peer->failure_count < in mwifiex_tdls_check_tx()
1300 peer->tdls_status = TDLS_SETUP_INPROGRESS; in mwifiex_tdls_check_tx()
1301 mwifiex_dbg(priv->adapter, INFO, in mwifiex_tdls_check_tx()
1303 peer->mac_addr, peer->rssi); in mwifiex_tdls_check_tx()
1305 cfg80211_tdls_oper_request(priv->netdev, in mwifiex_tdls_check_tx()
1306 peer->mac_addr, in mwifiex_tdls_check_tx()
1309 priv->check_tdls_tx = false; in mwifiex_tdls_check_tx()
1310 } else if (peer->failure_count < in mwifiex_tdls_check_tx()
1312 peer->do_discover) { in mwifiex_tdls_check_tx()
1314 peer->mac_addr, in mwifiex_tdls_check_tx()
1317 peer->do_discover = false; in mwifiex_tdls_check_tx()
1321 spin_unlock_bh(&priv->auto_tdls_lock); in mwifiex_tdls_check_tx()
1330 spin_lock_bh(&priv->auto_tdls_lock); in mwifiex_flush_auto_tdls_list()
1331 list_for_each_entry_safe(peer, tmp_node, &priv->auto_tdls_list, list) { in mwifiex_flush_auto_tdls_list()
1332 list_del(&peer->list); in mwifiex_flush_auto_tdls_list()
1336 INIT_LIST_HEAD(&priv->auto_tdls_list); in mwifiex_flush_auto_tdls_list()
1337 spin_unlock_bh(&priv->auto_tdls_lock); in mwifiex_flush_auto_tdls_list()
1338 priv->check_tdls_tx = false; in mwifiex_flush_auto_tdls_list()
1345 if (!priv->adapter->auto_tdls) in mwifiex_add_auto_tdls_peer()
1348 spin_lock_bh(&priv->auto_tdls_lock); in mwifiex_add_auto_tdls_peer()
1349 list_for_each_entry(tdls_peer, &priv->auto_tdls_list, list) { in mwifiex_add_auto_tdls_peer()
1350 if (!memcmp(tdls_peer->mac_addr, mac, ETH_ALEN)) { in mwifiex_add_auto_tdls_peer()
1351 tdls_peer->tdls_status = TDLS_SETUP_INPROGRESS; in mwifiex_add_auto_tdls_peer()
1352 tdls_peer->rssi_jiffies = jiffies; in mwifiex_add_auto_tdls_peer()
1353 spin_unlock_bh(&priv->auto_tdls_lock); in mwifiex_add_auto_tdls_peer()
1361 ether_addr_copy(tdls_peer->mac_addr, mac); in mwifiex_add_auto_tdls_peer()
1362 tdls_peer->tdls_status = TDLS_SETUP_INPROGRESS; in mwifiex_add_auto_tdls_peer()
1363 tdls_peer->rssi_jiffies = jiffies; in mwifiex_add_auto_tdls_peer()
1364 INIT_LIST_HEAD(&tdls_peer->list); in mwifiex_add_auto_tdls_peer()
1365 list_add_tail(&tdls_peer->list, &priv->auto_tdls_list); in mwifiex_add_auto_tdls_peer()
1366 mwifiex_dbg(priv->adapter, INFO, in mwifiex_add_auto_tdls_peer()
1370 spin_unlock_bh(&priv->auto_tdls_lock); in mwifiex_add_auto_tdls_peer()
1378 if (!priv->adapter->auto_tdls) in mwifiex_auto_tdls_update_peer_status()
1381 spin_lock_bh(&priv->auto_tdls_lock); in mwifiex_auto_tdls_update_peer_status()
1382 list_for_each_entry(peer, &priv->auto_tdls_list, list) { in mwifiex_auto_tdls_update_peer_status()
1383 if (!memcmp(peer->mac_addr, mac, ETH_ALEN)) { in mwifiex_auto_tdls_update_peer_status()
1385 (peer->tdls_status == TDLS_SETUP_INPROGRESS)) in mwifiex_auto_tdls_update_peer_status()
1386 peer->failure_count++; in mwifiex_auto_tdls_update_peer_status()
1388 peer->failure_count = 0; in mwifiex_auto_tdls_update_peer_status()
1390 peer->tdls_status = link_status; in mwifiex_auto_tdls_update_peer_status()
1394 spin_unlock_bh(&priv->auto_tdls_lock); in mwifiex_auto_tdls_update_peer_status()
1402 if (!priv->adapter->auto_tdls) in mwifiex_auto_tdls_update_peer_signal()
1405 spin_lock_bh(&priv->auto_tdls_lock); in mwifiex_auto_tdls_update_peer_signal()
1406 list_for_each_entry(peer, &priv->auto_tdls_list, list) { in mwifiex_auto_tdls_update_peer_signal()
1407 if (!memcmp(peer->mac_addr, mac, ETH_ALEN)) { in mwifiex_auto_tdls_update_peer_signal()
1408 peer->rssi = nflr - snr; in mwifiex_auto_tdls_update_peer_signal()
1409 peer->rssi_jiffies = jiffies; in mwifiex_auto_tdls_update_peer_signal()
1413 spin_unlock_bh(&priv->auto_tdls_lock); in mwifiex_auto_tdls_update_peer_signal()
1422 if (WARN_ON_ONCE(!priv || !priv->adapter)) { in mwifiex_check_auto_tdls()
1428 if (unlikely(!priv->adapter->auto_tdls)) in mwifiex_check_auto_tdls()
1431 if (!priv->auto_tdls_timer_active) { in mwifiex_check_auto_tdls()
1432 mwifiex_dbg(priv->adapter, INFO, in mwifiex_check_auto_tdls()
1437 priv->check_tdls_tx = false; in mwifiex_check_auto_tdls()
1439 spin_lock_bh(&priv->auto_tdls_lock); in mwifiex_check_auto_tdls()
1440 list_for_each_entry(tdls_peer, &priv->auto_tdls_list, list) { in mwifiex_check_auto_tdls()
1441 if (time_after(jiffies, tdls_peer->rssi_jiffies + in mwifiex_check_auto_tdls()
1443 tdls_peer->rssi = 0; in mwifiex_check_auto_tdls()
1444 tdls_peer->do_discover = true; in mwifiex_check_auto_tdls()
1445 priv->check_tdls_tx = true; in mwifiex_check_auto_tdls()
1448 if (((tdls_peer->rssi >= MWIFIEX_TDLS_RSSI_LOW) || in mwifiex_check_auto_tdls()
1449 !tdls_peer->rssi) && in mwifiex_check_auto_tdls()
1450 mwifiex_is_tdls_link_setup(tdls_peer->tdls_status)) { in mwifiex_check_auto_tdls()
1451 tdls_peer->tdls_status = TDLS_LINK_TEARDOWN; in mwifiex_check_auto_tdls()
1452 mwifiex_dbg(priv->adapter, MSG, in mwifiex_check_auto_tdls()
1454 tdls_peer->mac_addr, -tdls_peer->rssi); in mwifiex_check_auto_tdls()
1455 tdls_peer->do_discover = true; in mwifiex_check_auto_tdls()
1456 priv->check_tdls_tx = true; in mwifiex_check_auto_tdls()
1457 cfg80211_tdls_oper_request(priv->netdev, in mwifiex_check_auto_tdls()
1458 tdls_peer->mac_addr, in mwifiex_check_auto_tdls()
1461 } else if (tdls_peer->rssi && in mwifiex_check_auto_tdls()
1462 tdls_peer->rssi <= MWIFIEX_TDLS_RSSI_HIGH && in mwifiex_check_auto_tdls()
1463 tdls_peer->tdls_status == TDLS_NOT_SETUP && in mwifiex_check_auto_tdls()
1464 tdls_peer->failure_count < in mwifiex_check_auto_tdls()
1466 priv->check_tdls_tx = true; in mwifiex_check_auto_tdls()
1467 mwifiex_dbg(priv->adapter, INFO, in mwifiex_check_auto_tdls()
1469 "rssi=%d\n", tdls_peer->mac_addr, in mwifiex_check_auto_tdls()
1470 tdls_peer->rssi); in mwifiex_check_auto_tdls()
1473 spin_unlock_bh(&priv->auto_tdls_lock); in mwifiex_check_auto_tdls()
1475 mod_timer(&priv->auto_tdls_timer, in mwifiex_check_auto_tdls()
1481 timer_setup(&priv->auto_tdls_timer, mwifiex_check_auto_tdls, 0); in mwifiex_setup_auto_tdls_timer()
1482 priv->auto_tdls_timer_active = true; in mwifiex_setup_auto_tdls_timer()
1483 mod_timer(&priv->auto_tdls_timer, in mwifiex_setup_auto_tdls_timer()
1489 if (ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info) && in mwifiex_clean_auto_tdls()
1490 priv->adapter->auto_tdls && in mwifiex_clean_auto_tdls()
1491 priv->bss_type == MWIFIEX_BSS_TYPE_STA) { in mwifiex_clean_auto_tdls()
1492 priv->auto_tdls_timer_active = false; in mwifiex_clean_auto_tdls()
1493 del_timer(&priv->auto_tdls_timer); in mwifiex_clean_auto_tdls()