diff --git a/Makefile b/Makefile index ccc8af0..eca3eac 100755 --- a/Makefile +++ b/Makefile @@ -128,7 +128,6 @@ rtk_core := core/rtw_cmd.o \ core/rtw_ap.o \ core/rtw_xmit.o \ core/rtw_p2p.o \ - core/rtw_tdls.o \ core/rtw_br_ext.o \ core/rtw_iol.o \ core/rtw_led.o \ diff --git a/core/rtw_cmd.c b/core/rtw_cmd.c index 07c8a82..d932bb5 100755 --- a/core/rtw_cmd.c +++ b/core/rtw_cmd.c @@ -1371,22 +1371,12 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, u8 *psta, u8 unicast_key, bool en memcpy(psetstakey_para->addr, sta->hwaddr,ETH_ALEN); if(check_fwstate(pmlmepriv, WIFI_STATION_STATE)){ -#ifdef CONFIG_TDLS - if(sta->tdls_sta_state&TDLS_LINKED_STATE) - psetstakey_para->algorithm=(u8)sta->dot118021XPrivacy; - else -#endif /* CONFIG_TDLS */ psetstakey_para->algorithm =(unsigned char) psecuritypriv->dot11PrivacyAlgrthm; }else{ GET_ENCRY_ALGO(psecuritypriv, sta, psetstakey_para->algorithm, false); } if (unicast_key == true) { -#ifdef CONFIG_TDLS - if((sta->tdls_sta_state&TDLS_LINKED_STATE)==TDLS_LINKED_STATE) - memcpy(&psetstakey_para->key, sta->tpk.tk, 16); - else -#endif /* CONFIG_TDLS */ memcpy(&psetstakey_para->key, &sta->dot118021x_UncstKey, 16); } else { @@ -1963,39 +1953,7 @@ u8 rtw_tdls_cmd(struct adapter *padapter, u8 *addr, u8 option) u8 res=_SUCCESS; -; - -#ifdef CONFIG_TDLS - - RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_set_tdls_cmd\n")); - - pcmdobj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(pcmdobj == NULL){ - res=_FAIL; - goto exit; - } - - TDLSoption= (struct TDLSoption_param *)rtw_zmalloc(sizeof(struct TDLSoption_param)); - if(TDLSoption == NULL) { - rtw_mfree((u8 *)pcmdobj, sizeof(struct cmd_obj)); - res= _FAIL; - goto exit; - } - - _rtw_spinlock(&(padapter->tdlsinfo.cmd_lock)); - memcpy(TDLSoption->addr, addr, 6); - TDLSoption->option = option; - _rtw_spinunlock(&(padapter->tdlsinfo.cmd_lock)); - init_h2fwcmd_w_parm_no_rsp(pcmdobj, TDLSoption, GEN_CMD_CODE(_TDLS)); - res = rtw_enqueue_cmd(pcmdpriv, pcmdobj); - -#endif /* CONFIG_TDLS */ - exit: - - -; - return res; } @@ -2045,18 +2003,11 @@ static void traffic_status_watchdog(struct adapter *padapter) u8 bBusyTraffic = false, bTxBusyTraffic = false, bRxBusyTraffic = false; u8 bHigherBusyTraffic = false, bHigherBusyRxTraffic = false, bHigherBusyTxTraffic = false; struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); -#ifdef CONFIG_TDLS - struct tdls_info *ptdlsinfo = &(padapter->tdlsinfo); -#endif /* CONFIG_TDLS */ RT_LINK_DETECT_T * link_detect = &pmlmepriv->LinkDetectInfo; - /* */ /* Determine if our traffic is busy now */ - /* */ - if((check_fwstate(pmlmepriv, _FW_LINKED)== true) - /*&& !MgntInitAdapterInProgress(pMgntInfo)*/) - { + if(check_fwstate(pmlmepriv, _FW_LINKED)) { /* if we raise bBusyTraffic in last watchdog, using lower threshold. */ if (pmlmepriv->LinkDetectInfo.bBusyTraffic) BusyThreshold =180; /* 75; */ @@ -2101,14 +2052,6 @@ static void traffic_status_watchdog(struct adapter *padapter) } #endif -#ifdef CONFIG_TDLS -#ifdef CONFIG_TDLS_AUTOSETUP - if( ( ptdlsinfo->watchdog_count % TDLS_WATCHDOG_PERIOD ) == 0 ) /* 10 * 2sec, periodically sending */ - issue_tdls_dis_req( padapter, NULL ); - ptdlsinfo->watchdog_count++; -#endif /* CONFIG_TDLS_AUTOSETUP */ -#endif /* CONFIG_TDLS */ - #ifdef CONFIG_BT_COEXIST if (BT_1Ant(padapter) == false) #endif diff --git a/core/rtw_mlme.c b/core/rtw_mlme.c index ab9b36a..c684244 100755 --- a/core/rtw_mlme.c +++ b/core/rtw_mlme.c @@ -1242,11 +1242,6 @@ void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue) struct sta_priv *pstapriv = &adapter->stapriv; struct wlan_network *tgt_network = &pmlmepriv->cur_network; -#ifdef CONFIG_TDLS - struct tdls_info *ptdlsinfo = &adapter->tdlsinfo; -#endif /* CONFIG_TDLS */ -; - RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, ("+rtw_free_assoc_resources\n")); RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("tgt_network->network.MacAddress="MAC_FMT" ssid=%s\n", MAC_ARG(tgt_network->network.MacAddress), tgt_network->network.Ssid.Ssid)); @@ -1256,18 +1251,8 @@ void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue) psta = rtw_get_stainfo(&adapter->stapriv, tgt_network->network.MacAddress); -#ifdef CONFIG_TDLS - if(ptdlsinfo->setup_state != TDLS_STATE_NONE) { - rtw_tdls_cmd(adapter, myid(&(adapter->eeprompriv)), TDLS_RS_RCR); - rtw_reset_tdls_info(adapter); - rtw_free_all_stainfo(adapter); - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - } else -#endif /* CONFIG_TDLS */ - { - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - rtw_free_stainfo(adapter, psta); - } + _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); + rtw_free_stainfo(adapter, psta); _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c index 709e16d..43cf6f1 100755 --- a/core/rtw_mlme_ext.c +++ b/core/rtw_mlme_ext.c @@ -250,12 +250,6 @@ static void init_mlme_ext_priv_value(struct adapter* padapter) { struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - -#ifdef CONFIG_TDLS - u8 i; -#endif - - /* unsigned char default_channel_set[MAX_CHANNEL_NUM] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 0}; */ unsigned char mixed_datarate[NumRates] = {_1M_RATE_, _2M_RATE_, _5M_RATE_, _11M_RATE_, _6M_RATE_,_9M_RATE_, _12M_RATE_, _18M_RATE_, _24M_RATE_, _36M_RATE_, _48M_RATE_, _54M_RATE_, 0xff}; unsigned char mixed_basicrate[NumRates] ={_1M_RATE_, _2M_RATE_, _5M_RATE_, _11M_RATE_, _6M_RATE_, _12M_RATE_, _24M_RATE_, 0xff,}; @@ -608,16 +602,6 @@ void mgt_dispatcher(struct adapter *padapter, union recv_frame *precv_frame) index = GetFrameSubType(pframe) >> 4; -#ifdef CONFIG_TDLS - if((index << 4)==WIFI_ACTION){ - /* category==public (4), action==TDLS_DISCOVERY_RESPONSE */ - if(*(pframe+24)==0x04 && *(pframe+25)==TDLS_DISCOVERY_RESPONSE){ - DBG_871X("recv tdls discovery response frame\n"); - On_TDLS_Dis_Rsp(padapter, precv_frame); - } - } -#endif /* CONFIG_TDLS */ - if (index > 13) { RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("Currently we do not support reserved sub-fr-type=%d\n", index)); @@ -2356,15 +2340,6 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra category = frame_body[0]; if (category == RTW_WLAN_CATEGORY_BACK)/* representing Block Ack */ { -#ifdef CONFIG_TDLS - if((psta->tdls_sta_state & TDLS_LINKED_STATE) && - (psta->htpriv.ht_option==true) && - (psta->htpriv.ampdu_enable==true) ) - { - /* do nothing; just don't want to return _SUCCESS; */ - } - else -#endif /* CONFIG_TDLS */ if (!pmlmeinfo->HT_enable) { return _SUCCESS; @@ -10448,11 +10423,6 @@ u8 set_stakey_hdl(struct adapter *padapter, u8 *pbuf) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct set_stakey_parm *pparm = (struct set_stakey_parm *)pbuf; -#ifdef CONFIG_TDLS - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - struct sta_priv *pstapriv = &padapter->stapriv; - struct sta_info *psta; -#endif /* CONFIG_TDLS */ /* cam_entry: */ /* 0~3 for default key */ @@ -10525,20 +10495,6 @@ u8 set_stakey_hdl(struct adapter *padapter, u8 *pbuf) ctrl = BIT(15) | ((pparm->algorithm) << 2); -#ifdef CONFIG_TDLS - if(ptdlsinfo->clear_cam!=0){ - clear_cam_entry(padapter, ptdlsinfo->clear_cam); - ptdlsinfo->clear_cam=0; - - return H2C_SUCCESS; - } - - psta = rtw_get_stainfo(pstapriv, pparm->addr);/* Get TDLS Peer STA */ - if( psta->tdls_sta_state&TDLS_LINKED_STATE ){ - write_cam(padapter, psta->mac_id, ctrl, pparm->addr, pparm->key); - } - else -#endif /* CONFIG_TDLS */ write_cam(padapter, cam_id, ctrl, pparm->addr, pparm->key); pmlmeinfo->enc_algo = pparm->algorithm; @@ -10567,20 +10523,7 @@ u8 add_ba_hdl(struct adapter *padapter, unsigned char *pbuf) pparm->tid); /* _set_timer(&pmlmeext->ADDBA_timer, ADDBA_TO); */ _set_timer(&psta->addba_retry_timer, ADDBA_TO); - } -#ifdef CONFIG_TDLS - else if((psta->tdls_sta_state & TDLS_LINKED_STATE)&& - (psta->htpriv.ht_option==true) && - (psta->htpriv.ampdu_enable==true) ) - { - issue_action_BA(padapter, pparm->addr, RTW_WLAN_ACTION_ADDBA_REQ, - pparm->tid); - /* _set_timer(&pmlmeext->ADDBA_timer, ADDBA_TO); */ - _set_timer(&psta->addba_retry_timer, ADDBA_TO); - } -#endif /* CONFIG */ - else - { + } else { psta->htpriv.candidate_tid_bitmap &= ~BIT(pparm->tid); } return H2C_SUCCESS; @@ -10953,163 +10896,5 @@ u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf) /* TDLS_FREE_STA : free tdls sta */ u8 tdls_hdl(struct adapter *padapter, unsigned char *pbuf) { -#ifdef CONFIG_TDLS - _irqL irqL; - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - struct TDLSoption_param *TDLSoption; - struct sta_info *ptdls_sta; - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; - u8 survey_channel, i, min, option; - - if(!pbuf) - return H2C_PARAMETERS_ERROR; - - TDLSoption = (struct TDLSoption_param *)pbuf; - - ptdls_sta = rtw_get_stainfo( &(padapter->stapriv), TDLSoption->addr ); - option = TDLSoption->option; - - if( ptdls_sta == NULL ) - { - if( option != TDLS_RS_RCR ) - return H2C_REJECTED; - } - - /* _enter_critical_bh(&(ptdlsinfo->hdl_lock), &irqL); */ - DBG_871X("[%s] option:%d\n", __FUNCTION__, option); - - switch(option){ - case TDLS_WRCR: - /* As long as TDLS handshake success, we should set RCR_CBSSID_DATA bit to 0 */ - /* such we can receive all kinds of data frames. */ - rtw_hal_set_hwreg(padapter, HW_VAR_TDLS_WRCR, 0); - DBG_871X("TDLS with "MAC_FMT"\n", MAC_ARG(ptdls_sta->hwaddr)); - - pmlmeinfo->FW_sta_info[ptdls_sta->mac_id].psta = ptdls_sta; - /* set TDLS sta rate. */ - set_sta_rate(padapter, ptdls_sta); - break; - case TDLS_SD_PTI: - issue_tdls_peer_traffic_indication(padapter, ptdls_sta); - break; - case TDLS_CS_OFF: - _cancel_timer_ex(&ptdls_sta->base_ch_timer); - _cancel_timer_ex(&ptdls_sta->off_ch_timer); - SelectChannel(padapter, pmlmeext->cur_channel); - ptdls_sta->tdls_sta_state &= ~(TDLS_CH_SWITCH_ON_STATE | - TDLS_PEER_AT_OFF_STATE | - TDLS_AT_OFF_CH_STATE); - DBG_871X("go back to base channel\n "); - issue_nulldata(padapter, NULL, 0, 0, 0); - break; - case TDLS_INIT_CH_SEN: - rtw_hal_set_hwreg(padapter, HW_VAR_TDLS_INIT_CH_SEN, 0); - pmlmeext->sitesurvey_res.channel_idx = 0; - ptdls_sta->option = TDLS_DONE_CH_SEN; - rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_DONE_CH_SEN); - break; - case TDLS_DONE_CH_SEN: - survey_channel = pmlmeext->channel_set[pmlmeext->sitesurvey_res.channel_idx].ChannelNum; - if(survey_channel){ - SelectChannel(padapter, survey_channel); - ptdlsinfo->cur_channel = survey_channel; - pmlmeext->sitesurvey_res.channel_idx++; - _set_timer(&ptdls_sta->option_timer, SURVEY_TO); - }else{ - SelectChannel(padapter, pmlmeext->cur_channel); - - rtw_hal_set_hwreg(padapter, HW_VAR_TDLS_DONE_CH_SEN, 0); - - if(ptdlsinfo->ch_sensing==1){ - ptdlsinfo->ch_sensing=0; - ptdlsinfo->cur_channel=1; - min=ptdlsinfo->collect_pkt_num[0]; - for(i=1; i ptdlsinfo->collect_pkt_num[i]){ - ptdlsinfo->cur_channel=i+1; - min=ptdlsinfo->collect_pkt_num[i]; - } - ptdlsinfo->collect_pkt_num[i]=0; - } - ptdlsinfo->collect_pkt_num[0]=0; - ptdlsinfo->candidate_ch=ptdlsinfo->cur_channel; - DBG_871X("TDLS channel sensing done, candidate channel: %02x\n", ptdlsinfo->candidate_ch); - ptdlsinfo->cur_channel=0; - - } - - if(ptdls_sta->tdls_sta_state & TDLS_PEER_SLEEP_STATE){ - ptdls_sta->tdls_sta_state |= TDLS_APSD_CHSW_STATE; - }else{ - /* send null data with pwrbit==1 before send ch_switching_req to peer STA. */ - issue_nulldata(padapter, NULL, 1, 0, 0); - - ptdls_sta->tdls_sta_state |= TDLS_CH_SW_INITIATOR_STATE; - - issue_tdls_ch_switch_req(padapter, ptdls_sta->hwaddr); - DBG_871X("issue tdls ch switch req\n"); - } - } - break; - case TDLS_OFF_CH: - issue_nulldata(padapter, NULL, 1, 0, 0); - SelectChannel(padapter, ptdls_sta->off_ch); - - DBG_871X("change channel to tar ch:%02x\n", ptdls_sta->off_ch); - ptdls_sta->tdls_sta_state |= TDLS_AT_OFF_CH_STATE; - ptdls_sta->tdls_sta_state &= ~(TDLS_PEER_AT_OFF_STATE); - _set_timer(&ptdls_sta->option_timer, (u32)ptdls_sta->ch_switch_time); - break; - case TDLS_BASE_CH: - _cancel_timer_ex(&ptdls_sta->base_ch_timer); - _cancel_timer_ex(&ptdls_sta->off_ch_timer); - SelectChannel(padapter, pmlmeext->cur_channel); - ptdls_sta->tdls_sta_state &= ~(TDLS_CH_SWITCH_ON_STATE | - TDLS_PEER_AT_OFF_STATE | - TDLS_AT_OFF_CH_STATE); - DBG_871X("go back to base channel\n "); - issue_nulldata(padapter, NULL, 0, 0, 0); - _set_timer(&ptdls_sta->option_timer, (u32)ptdls_sta->ch_switch_time); - break; - case TDLS_P_OFF_CH: - SelectChannel(padapter, pmlmeext->cur_channel); - issue_nulldata(padapter, NULL, 0, 0, 0); - DBG_871X("change channel to base ch:%02x\n", pmlmeext->cur_channel); - ptdls_sta->tdls_sta_state &= ~(TDLS_PEER_AT_OFF_STATE| TDLS_AT_OFF_CH_STATE); - _set_timer(&ptdls_sta->off_ch_timer, TDLS_STAY_TIME); - break; - case TDLS_P_BASE_CH: - issue_nulldata(ptdls_sta->padapter, NULL, 1, 0, 0); - SelectChannel(padapter, ptdls_sta->off_ch); - DBG_871X("change channel to off ch:%02x\n", ptdls_sta->off_ch); - ptdls_sta->tdls_sta_state |= TDLS_AT_OFF_CH_STATE; - if((ptdls_sta->tdls_sta_state & TDLS_PEER_AT_OFF_STATE) != TDLS_PEER_AT_OFF_STATE){ - issue_nulldata_to_TDLS_peer_STA(padapter, ptdls_sta, 0); - } - _set_timer(&ptdls_sta->base_ch_timer, TDLS_STAY_TIME); - break; - case TDLS_RS_RCR: - rtw_hal_set_hwreg(padapter, HW_VAR_TDLS_RS_RCR, 0); - DBG_871X("wirte REG_RCR, set bit6 on\n"); - break; - case TDLS_CKALV_PH1: - _set_timer(&ptdls_sta->alive_timer2, TDLS_ALIVE_TIMER_PH2); - break; - case TDLS_CKALV_PH2: - _set_timer(&ptdls_sta->alive_timer1, TDLS_ALIVE_TIMER_PH1); - break; - case TDLS_FREE_STA: - free_tdls_sta(padapter, ptdls_sta); - break; - - } - - /* _exit_critical_bh(&(ptdlsinfo->hdl_lock), &irqL); */ - - return H2C_SUCCESS; -#else return H2C_REJECTED; -#endif /* CONFIG_TDLS */ - } diff --git a/core/rtw_p2p.c b/core/rtw_p2p.c index ab47caa..a0d1bed 100755 --- a/core/rtw_p2p.c +++ b/core/rtw_p2p.c @@ -2587,9 +2587,6 @@ u8 process_p2p_group_negotation_req( struct wifidirect_info *pwdinfo, u8 *pframe #ifdef CONFIG_P2P u8 wfd_ie[ 128 ] = { 0x00 }; u32 wfd_ielen = 0; -#ifdef CONFIG_TDLS - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; -#endif /* CONFIG_TDLS */ #endif /* CONFIG_P2P */ __be16 be_tmp; @@ -2661,15 +2658,8 @@ u8 process_p2p_group_negotation_req( struct wifidirect_info *pwdinfo, u8 *pframe /* Check P2P Capability ATTR */ if(rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8*)&le_tmp, (uint*)&attr_contentlen) ) - { cap_attr = le16_to_cpu(le_tmp); -#if defined(CONFIG_P2P) && defined(CONFIG_TDLS) - if(!(cap_attr & P2P_GRPCAP_INTRABSS) ) - ptdlsinfo->ap_prohibited = true; -#endif /* defined(CONFIG_P2P) && defined(CONFIG_TDLS) */ - } - if ( rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_GO_INTENT , &attr_content, &attr_contentlen) ) { DBG_871X( "[%s] GO Intent = %d, tie = %d\n", __FUNCTION__, attr_content >> 1, attr_content & 0x01 ); @@ -2806,9 +2796,6 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram #ifdef CONFIG_P2P u8 wfd_ie[ 128 ] = { 0x00 }; u32 wfd_ielen = 0; -#ifdef CONFIG_TDLS - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; -#endif /* CONFIG_TDLS */ #endif /* CONFIG_P2P */ ies = pframe + _PUBLIC_ACTION_IE_OFFSET_; @@ -2854,17 +2841,10 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram /* Check P2P Capability ATTR */ if(rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8*)&le_tmp, (uint*)&attr_contentlen) ) - { cap_attr = le16_to_cpu(le_tmp); -#ifdef CONFIG_TDLS - if(!(cap_attr & P2P_GRPCAP_INTRABSS) ) - ptdlsinfo->ap_prohibited = true; -#endif /* CONFIG_TDLS */ - } rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_STATUS, &attr_content, &attr_contentlen); - if ( attr_contentlen == 1 ) - { + if ( attr_contentlen == 1 ) { DBG_871X( "[%s] Status = %d\n", __FUNCTION__, attr_content ); if ( attr_content == P2P_STATUS_SUCCESS ) { diff --git a/core/rtw_pwrctrl.c b/core/rtw_pwrctrl.c index d95e30a..1771a8c 100755 --- a/core/rtw_pwrctrl.c +++ b/core/rtw_pwrctrl.c @@ -469,15 +469,6 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a #ifdef CONFIG_P2P struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); #endif /* CONFIG_P2P */ -#ifdef CONFIG_TDLS - struct sta_priv *pstapriv = &padapter->stapriv; - _irqL irqL; - int i, j; - _list *plist, *phead; - struct sta_info *ptdls_sta; -#endif /* CONFIG_TDLS */ - -; RT_TRACE(_module_rtl871x_pwrctrl_c_, _drv_notice_, ("%s: PowerMode=%d Smart_PS=%d\n", @@ -507,28 +498,6 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a #endif /* CONFIG_P2P */ { DBG_871X("rtw_set_ps_mode: Leave 802.11 power save\n"); - -#ifdef CONFIG_TDLS - _enter_critical_bh(&pstapriv->sta_hash_lock, &irqL); - - for(i=0; i< NUM_STA; i++) - { - phead = &(pstapriv->sta_hash[i]); - plist = get_next(phead); - - while ((rtw_end_of_queue_search(phead, plist)) == false) - { - ptdls_sta = LIST_CONTAINOR(plist, struct sta_info, hash_list); - - if( ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE ) - issue_nulldata_to_TDLS_peer_STA(padapter, ptdls_sta, 0); - plist = get_next(plist); - } - } - - _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); -#endif /* CONFIG_TDLS */ - pwrpriv->pwr_mode = ps_mode; rtw_set_rpwm(padapter, PS_STATE_S4); rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 *)(&ps_mode)); @@ -544,28 +513,6 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a ) { DBG_871X("%s: Enter 802.11 power save\n", __FUNCTION__); - -#ifdef CONFIG_TDLS - _enter_critical_bh(&pstapriv->sta_hash_lock, &irqL); - - for(i=0; i< NUM_STA; i++) - { - phead = &(pstapriv->sta_hash[i]); - plist = get_next(phead); - - while ((rtw_end_of_queue_search(phead, plist)) == false) - { - ptdls_sta = LIST_CONTAINOR(plist, struct sta_info, hash_list); - - if( ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE ) - issue_nulldata_to_TDLS_peer_STA(padapter, ptdls_sta, 1); - plist = get_next(plist); - } - } - - _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); -#endif /* CONFIG_TDLS */ - pwrpriv->bFwCurrentInPSMode = true; pwrpriv->pwr_mode = ps_mode; pwrpriv->smart_ps = smart_ps; diff --git a/core/rtw_recv.c b/core/rtw_recv.c index 98a90ab..3853a73 100755 --- a/core/rtw_recv.c +++ b/core/rtw_recv.c @@ -830,21 +830,12 @@ void process_wmmps_data(struct adapter *padapter, union recv_frame *precv_frame) if(!psta) return; -#ifdef CONFIG_TDLS - if( !(psta->tdls_sta_state & TDLS_LINKED_STATE ) ) - { -#endif /* CONFIG_TDLS */ - if(!psta->qos_option) return; if(!(psta->qos_info&0xf)) return; -#ifdef CONFIG_TDLS - } -#endif /* CONFIG_TDLS */ - if(psta->state&WIFI_SLEEP_STATE) { u8 wmmps_ac=0; @@ -891,100 +882,6 @@ void process_wmmps_data(struct adapter *padapter, union recv_frame *precv_frame) } -#ifdef CONFIG_TDLS -sint OnTDLS(struct adapter *adapter, union recv_frame *precv_frame) -{ - struct rx_pkt_attrib *pattrib = & precv_frame->u.hdr.attrib; - sint ret = _SUCCESS; - u8 *paction = get_recvframe_data(precv_frame); - u8 category_field = 1; -#ifdef CONFIG_P2P - u8 WFA_OUI[3] = { 0x50, 0x6f, 0x9a }; -#endif /* CONFIG_P2P */ - struct tdls_info *ptdlsinfo = &(adapter->tdlsinfo); - - /* point to action field */ - paction+=pattrib->hdrlen - + pattrib->iv_len - + SNAP_SIZE - + ETH_TYPE_LEN - + PAYLOAD_TYPE_LEN - + category_field; - - if(ptdlsinfo->enable == 0) - { - DBG_871X("recv tdls frame, " - "but tdls haven't enabled\n"); - ret = _FAIL; - return ret; - } - - switch(*paction){ - case TDLS_SETUP_REQUEST: - DBG_871X("recv tdls setup request frame\n"); - ret=On_TDLS_Setup_Req(adapter, precv_frame); - break; - case TDLS_SETUP_RESPONSE: - DBG_871X("recv tdls setup response frame\n"); - ret=On_TDLS_Setup_Rsp(adapter, precv_frame); - break; - case TDLS_SETUP_CONFIRM: - DBG_871X("recv tdls setup confirm frame\n"); - ret=On_TDLS_Setup_Cfm(adapter, precv_frame); - break; - case TDLS_TEARDOWN: - DBG_871X("recv tdls teardown, free sta_info\n"); - ret=On_TDLS_Teardown(adapter, precv_frame); - break; - case TDLS_DISCOVERY_REQUEST: - DBG_871X("recv tdls discovery request frame\n"); - ret=On_TDLS_Dis_Req(adapter, precv_frame); - break; - case TDLS_PEER_TRAFFIC_RESPONSE: - DBG_871X("recv tdls peer traffic response frame\n"); - ret=On_TDLS_Peer_Traffic_Rsp(adapter, precv_frame); - break; - case TDLS_CHANNEL_SWITCH_REQUEST: - DBG_871X("recv tdls channel switch request frame\n"); - ret=On_TDLS_Ch_Switch_Req(adapter, precv_frame); - break; - case TDLS_CHANNEL_SWITCH_RESPONSE: - DBG_871X("recv tdls channel switch response frame\n"); - ret=On_TDLS_Ch_Switch_Rsp(adapter, precv_frame); - break; -#ifdef CONFIG_P2P - case 0x50: /* First byte of WFA OUI */ - if( _rtw_memcmp(WFA_OUI, (paction), 3) ) - { - if( *(paction + 3) == 0x04) /* Probe request frame */ - { - /* WFDTDLS: for sigma test, do not setup direct link automatically */ - ptdlsinfo->dev_discovered = 1; - DBG_871X("recv tunneled probe request frame\n"); - issue_tunneled_probe_rsp(adapter, precv_frame); - } - if( *(paction + 3) == 0x05) /* Probe response frame */ - { - /* WFDTDLS: for sigma test, do not setup direct link automatically */ - ptdlsinfo->dev_discovered = 1; - DBG_871X("recv tunneled probe response frame\n"); - } - } - break; -#endif /* CONFIG_P2P */ - default: - DBG_871X("receive TDLS frame but not supported\n"); - ret=_FAIL; - break; - } - -exit: - return ret; - -} -#endif - -void count_rx_stats(struct adapter *padapter, union recv_frame *prframe, struct sta_info*sta); void count_rx_stats(struct adapter *padapter, union recv_frame *prframe, struct sta_info*sta) { int sz; @@ -1038,16 +935,6 @@ sint sta2sta_data_frame( u8 * sta_addr = NULL; sint bmcast = IS_MCAST(pattrib->dst); -#ifdef CONFIG_TDLS - struct tdls_info *ptdlsinfo = &adapter->tdlsinfo; - struct sta_info *ptdls_sta=NULL; - u8 *psnap_type=ptr+pattrib->hdrlen + pattrib->iv_len+SNAP_SIZE; - /* frame body located after [+2]: ether-type, [+1]: payload type */ - u8 *pframe_body = psnap_type+2+1; -#endif - -; - if ((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) || (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true)) { @@ -1076,89 +963,6 @@ sint sta2sta_data_frame( } else if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) { -#ifdef CONFIG_TDLS - - /* direct link data transfer */ - if(ptdlsinfo->setup_state == TDLS_LINKED_STATE){ - ptdls_sta = rtw_get_stainfo(pstapriv, pattrib->src); - if(ptdls_sta==NULL) - { - ret=_FAIL; - goto exit; - } - else if(ptdls_sta->tdls_sta_state&TDLS_LINKED_STATE) - { - - /* drop QoS-SubType Data, including QoS NULL, excluding QoS-Data */ - if( (GetFrameSubType(ptr) & WIFI_QOS_DATA_TYPE )== WIFI_QOS_DATA_TYPE) - { - if(GetFrameSubType(ptr)&(BIT(4)|BIT(5)|BIT(6))) - { - DBG_871X("drop QoS-Sybtype Data\n"); - ret= _FAIL; - goto exit; - } - } - /* filter packets that SA is myself or multicast or broadcast */ - if (_rtw_memcmp(myhwaddr, pattrib->src, ETH_ALEN)){ - ret= _FAIL; - goto exit; - } - /* da should be for me */ - if((!_rtw_memcmp(myhwaddr, pattrib->dst, ETH_ALEN))&& (!bmcast)) - { - ret= _FAIL; - goto exit; - } - /* check BSSID */ - if( _rtw_memcmp(pattrib->bssid, "\x0\x0\x0\x0\x0\x0", ETH_ALEN) || - _rtw_memcmp(mybssid, "\x0\x0\x0\x0\x0\x0", ETH_ALEN) || - (!_rtw_memcmp(pattrib->bssid, mybssid, ETH_ALEN)) ) - { - ret= _FAIL; - goto exit; - } - - /* process UAPSD tdls sta */ - process_pwrbit_data(adapter, precv_frame); - - /* if NULL-frame, check pwrbit */ - if ((GetFrameSubType(ptr)) == WIFI_DATA_NULL) - { - /* NULL-frame with pwrbit=1, buffer_STA should buffer frames for sleep_STA */ - if(GetPwrMgt(ptr)) - { - DBG_871X("TDLS: recv peer null frame with pwr bit 1\n"); - ptdls_sta->tdls_sta_state|=TDLS_PEER_SLEEP_STATE; - /* it would be triggered when we are off channel and receiving NULL DATA */ - /* we can confirm that peer STA is at off channel */ - } - else if(ptdls_sta->tdls_sta_state&TDLS_CH_SWITCH_ON_STATE) - { - if((ptdls_sta->tdls_sta_state & TDLS_PEER_AT_OFF_STATE) != TDLS_PEER_AT_OFF_STATE) - { - issue_nulldata_to_TDLS_peer_STA(adapter, ptdls_sta, 0); - ptdls_sta->tdls_sta_state |= TDLS_PEER_AT_OFF_STATE; - On_TDLS_Peer_Traffic_Rsp(adapter, precv_frame); - } - } - - ret= _FAIL; - goto exit; - } - /* receive some of all TDLS management frames, process it at ON_TDLS */ - if((_rtw_memcmp(psnap_type, SNAP_ETH_TYPE_TDLS, 2))){ - ret= OnTDLS(adapter, precv_frame); - goto exit; - } - - } - - sta_addr = pattrib->src; - - } - else -#endif /* CONFIG_TDLS */ { /* For Station mode, sa and bssid should always be BSSID, and DA is my mac-address */ if(!_rtw_memcmp(pattrib->bssid, pattrib->src, ETH_ALEN) ) @@ -1216,11 +1020,6 @@ sint sta2sta_data_frame( else *psta = rtw_get_stainfo(pstapriv, sta_addr); /* get ap_info */ -#ifdef CONFIG_TDLS - if(ptdls_sta != NULL) - *psta = ptdls_sta; -#endif /* CONFIG_TDLS */ - if (*psta == NULL) { RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("can't get psta under sta2sta_data_frame ; drop pkt\n")); ret= _FAIL; @@ -1722,11 +1521,6 @@ sint validate_recv_data_frame(struct adapter *adapter, union recv_frame *precv_f struct sta_priv *pstapriv = &adapter->stapriv; struct security_priv *psecuritypriv = &adapter->securitypriv; sint ret = _SUCCESS; -#ifdef CONFIG_TDLS - struct tdls_info *ptdlsinfo = &adapter->tdlsinfo; -#endif /* CONFIG_TDLS */ - -; bretry = GetRetry(ptr); pda = get_da(ptr); @@ -1847,14 +1641,6 @@ sint validate_recv_data_frame(struct adapter *adapter, union recv_frame *precv_f RT_TRACE(_module_rtl871x_recv_c_,_drv_info_,("validate_recv_data_frame:pattrib->privacy=%x\n", pattrib->privacy)); RT_TRACE(_module_rtl871x_recv_c_,_drv_info_,("\n ^^^^^^^^^^^IS_MCAST(pattrib->ra(0x%02x))=%d^^^^^^^^^^^^^^^6\n", pattrib->ra[0],IS_MCAST(pattrib->ra))); - -#ifdef CONFIG_TDLS - if((psta->tdls_sta_state & TDLS_LINKED_STATE) && (psta->dot118021XPrivacy==_AES_)) - { - pattrib->encrypt=psta->dot118021XPrivacy; - } - else -#endif /* CONFIG_TDLS */ GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, IS_MCAST(pattrib->ra)); RT_TRACE(_module_rtl871x_recv_c_,_drv_info_,("\n pattrib->encrypt=%d\n",pattrib->encrypt)); @@ -2013,10 +1799,6 @@ sint validate_recv_frame(struct adapter *adapter, union recv_frame *precv_frame) struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; #endif -#ifdef CONFIG_TDLS - struct tdls_info *ptdlsinfo = &adapter->tdlsinfo; -#endif /* CONFIG_TDLS */ - #ifdef CONFIG_AP_MODE if (pmlmeext->sitesurvey_res.state == SCAN_PROCESS) { int ch_set_idx = rtw_ch_set_search_ch(pmlmeext->channel_set, rtw_get_oper_ch(adapter)); @@ -2025,27 +1807,6 @@ sint validate_recv_frame(struct adapter *adapter, union recv_frame *precv_frame) } #endif -#ifdef CONFIG_TDLS - if(ptdlsinfo->ch_sensing==1 && ptdlsinfo->cur_channel !=0){ - ptdlsinfo->collect_pkt_num[ptdlsinfo->cur_channel-1]++; - } -#endif /* CONFIG_TDLS */ - -#ifdef RTK_DMP_PLATFORM - if ( 0 ) - { - DBG_871X("++\n"); - { - int i; - for(i=0; i<64;i=i+8) - DBG_871X("%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:", *(ptr+i), - *(ptr+i+1), *(ptr+i+2) ,*(ptr+i+3) ,*(ptr+i+4),*(ptr+i+5), *(ptr+i+6), *(ptr+i+7)); - - } - DBG_871X("--\n"); - } -#endif /* RTK_DMP_PLATFORM */ - /* add version chk */ if(ver!=0){ RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("validate_recv_data_frame fail! (ver!=0)\n")); @@ -3158,25 +2919,11 @@ int process_recv_indicatepkts(struct adapter *padapter, union recv_frame *prfram int process_recv_indicatepkts(struct adapter *padapter, union recv_frame *prframe) { int retval = _SUCCESS; - /* struct recv_priv *precvpriv = &padapter->recvpriv; */ - /* struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib; */ struct mlme_priv *pmlmepriv = &padapter->mlmepriv; -#ifdef CONFIG_TDLS - struct sta_info *psta = prframe->u.hdr.psta; -#endif /* CONFIG_TDLS */ struct ht_priv *phtpriv = &pmlmepriv->htpriv; -#ifdef CONFIG_TDLS - if( (phtpriv->ht_option==true) || - ((psta->tdls_sta_state & TDLS_LINKED_STATE) && - (psta->htpriv.ht_option==true) && - (psta->htpriv.ampdu_enable==true))) /* B/G/N Mode */ -#else if(phtpriv->ht_option==true) /* B/G/N Mode */ -#endif /* CONFIG_TDLS */ { - /* prframe->u.hdr.preorder_ctrl = &precvpriv->recvreorder_ctrl[pattrib->priority]; */ - if(recv_indicatepkt_reorder(padapter, prframe)!=_SUCCESS)/* including perform A-MPDU Rx Ordering Buffer Control */ { #ifdef DBG_RX_DROP_FRAME @@ -3255,13 +3002,6 @@ static int recv_func_posthandle(struct adapter *padapter, union recv_frame *prfr struct recv_priv *precvpriv = &padapter->recvpriv; _queue *pfree_recv_queue = &padapter->recvpriv.free_recv_queue; - -#ifdef CONFIG_TDLS - u8 *psnap_type, *pcategory; - struct sta_info *ptdls_sta = NULL; -#endif /* CONFIG_TDLS */ - - /* DATA FRAME */ rtw_led_control(padapter, LED_CTL_RX); @@ -3275,19 +3015,6 @@ static int recv_func_posthandle(struct adapter *padapter, union recv_frame *prfr goto _recv_data_drop; } -#ifdef CONFIG_TDLS - /* check TDLS frame */ - psnap_type = get_recvframe_data(orig_prframe); - psnap_type+=pattrib->hdrlen + pattrib->iv_len+SNAP_SIZE; - pcategory = psnap_type + ETH_TYPE_LEN + PAYLOAD_TYPE_LEN; - - if((_rtw_memcmp(psnap_type, SNAP_ETH_TYPE_TDLS, ETH_TYPE_LEN)) && - ((*pcategory==RTW_WLAN_CATEGORY_TDLS) || (*pcategory==RTW_WLAN_CATEGORY_P2P))){ - ret = OnTDLS(padapter, prframe); /* all of functions will return _FAIL */ - goto _exit_recv_func; - } -#endif /* CONFIG_TDLS */ - prframe = recvframe_chk_defrag(padapter, prframe); if(prframe==NULL) { RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("recvframe_chk_defrag: drop pkt\n")); @@ -3306,14 +3033,7 @@ static int recv_func_posthandle(struct adapter *padapter, union recv_frame *prfr ret = _FAIL; goto _recv_data_drop; } - -#ifdef CONFIG_TDLS - if(padapter->tdlsinfo.setup_state == TDLS_LINKED_STATE) - ptdls_sta = rtw_get_stainfo(&padapter->stapriv, pattrib->src); - count_rx_stats(padapter, prframe, ptdls_sta); -#else count_rx_stats(padapter, prframe, NULL); -#endif /* CONFIG_TDLS */ ret = process_recv_indicatepkts(padapter, prframe); if (ret != _SUCCESS) diff --git a/core/rtw_security.c b/core/rtw_security.c index 91a28c0..88ae69a 100755 --- a/core/rtw_security.c +++ b/core/rtw_security.c @@ -1620,19 +1620,6 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe) { prwskey=&stainfo->dot118021x_UncstKey.skey[0]; } - -#ifdef CONFIG_TDLS /* swencryption */ - { - struct sta_info *ptdls_sta; - ptdls_sta=rtw_get_stainfo(&padapter->stapriv ,&pattrib->dst[0] ); - if((ptdls_sta != NULL) && (ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE) ) - { - DBG_871X("[%s] for tdls link\n", __FUNCTION__); - prwskey=&ptdls_sta->tpk.tk[0]; - } - } -#endif /* CONFIG_TDLS */ - prwskeylen=16; for(curfragnum=0;curfragnumnr_frags;curfragnum++){ @@ -2830,176 +2817,6 @@ static int omac1_aes_128(u8 *key, u8 *data, size_t data_len, u8 *mac) return omac1_aes_128_vector(key, 1, &data, &data_len, mac); } -#ifdef CONFIG_TDLS -void wpa_tdls_generate_tpk(struct adapter *padapter, struct sta_info *psta) -{ - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - u8 *SNonce = psta->SNonce; - u8 *ANonce = psta->ANonce; - - u8 key_input[SHA256_MAC_LEN]; - u8 *nonce[2]; - size_t len[2]; - u8 data[3 * ETH_ALEN]; - - /* IEEE Std 802.11z-2010 8.5.9.1: - * TPK-Key-Input = SHA-256(min(SNonce, ANonce) || max(SNonce, ANonce)) - */ - len[0] = 32; - len[1] = 32; - if (os_memcmp(SNonce, ANonce, 32) < 0) { - nonce[0] = SNonce; - nonce[1] = ANonce; - } else { - nonce[0] = ANonce; - nonce[1] = SNonce; - } - - sha256_vector(2, nonce, len, key_input); - - /* - * TPK-Key-Data = KDF-N_KEY(TPK-Key-Input, "TDLS PMK", - * min(MAC_I, MAC_R) || max(MAC_I, MAC_R) || BSSID || N_KEY) - * TODO: is N_KEY really included in KDF Context and if so, in which - * presentation format (little endian 16-bit?) is it used? It gets - * added by the KDF anyway.. - */ - - if (os_memcmp(myid(&(padapter->eeprompriv)), psta->hwaddr, ETH_ALEN) < 0) { - memcpy(data, myid(&(padapter->eeprompriv)), ETH_ALEN); - memcpy(data + ETH_ALEN, psta->hwaddr, ETH_ALEN); - } else { - memcpy(data, psta->hwaddr, ETH_ALEN); - memcpy(data + ETH_ALEN, myid(&(padapter->eeprompriv)), ETH_ALEN); - } - memcpy(data + 2 * ETH_ALEN, get_bssid(pmlmepriv), ETH_ALEN); - - sha256_prf(key_input, SHA256_MAC_LEN, "TDLS PMK", data, sizeof(data), (u8 *) &psta->tpk, sizeof(psta->tpk)); - - -} - -/** - * wpa_tdls_ftie_mic - Calculate TDLS FTIE MIC - * @kck: TPK-KCK - * @lnkid: Pointer to the beginning of Link Identifier IE - * @rsnie: Pointer to the beginning of RSN IE used for handshake - * @timeoutie: Pointer to the beginning of Timeout IE used for handshake - * @ftie: Pointer to the beginning of FT IE - * @mic: Pointer for writing MIC - * - * Calculate MIC for TDLS frame. - */ -int wpa_tdls_ftie_mic(u8 *kck, u8 trans_seq, - u8 *lnkid, u8 *rsnie, u8 *timeoutie, u8 *ftie, - u8 *mic) -{ - u8 *buf, *pos; - struct wpa_tdls_ftie *_ftie; - struct wpa_tdls_lnkid *_lnkid; - int ret; - int len = 2 * ETH_ALEN + 1 + 2 + lnkid[1] + 2 + rsnie[1] + - 2 + timeoutie[1] + 2 + ftie[1]; - buf = rtw_zmalloc(len); - if (!buf) { - DBG_871X("TDLS: No memory for MIC calculation\n"); - return -1; - } - - pos = buf; - _lnkid = (struct wpa_tdls_lnkid *) lnkid; - /* 1) TDLS initiator STA MAC address */ - memcpy(pos, _lnkid->init_sta, ETH_ALEN); - pos += ETH_ALEN; - /* 2) TDLS responder STA MAC address */ - memcpy(pos, _lnkid->resp_sta, ETH_ALEN); - pos += ETH_ALEN; - /* 3) Transaction Sequence number */ - *pos++ = trans_seq; - /* 4) Link Identifier IE */ - memcpy(pos, lnkid, 2 + lnkid[1]); - pos += 2 + lnkid[1]; - /* 5) RSN IE */ - memcpy(pos, rsnie, 2 + rsnie[1]); - pos += 2 + rsnie[1]; - /* 6) Timeout Interval IE */ - memcpy(pos, timeoutie, 2 + timeoutie[1]); - pos += 2 + timeoutie[1]; - /* 7) FTIE, with the MIC field of the FTIE set to 0 */ - memcpy(pos, ftie, 2 + ftie[1]); - _ftie = (struct wpa_tdls_ftie *) pos; - memset(_ftie->mic, 0, TDLS_MIC_LEN); - pos += 2 + ftie[1]; - - ret = omac1_aes_128(kck, buf, pos - buf, mic); - rtw_mfree(buf, len); - return ret; - -} - -int tdls_verify_mic(u8 *kck, u8 trans_seq, - u8 *lnkid, u8 *rsnie, u8 *timeoutie, u8 *ftie) -{ - u8 *buf, *pos; - int len; - u8 mic[16]; - int ret; - u8 *rx_ftie, *tmp_ftie; - - if (lnkid == NULL || rsnie == NULL || - timeoutie == NULL || ftie == NULL){ - return 0; - } - - len = 2 * ETH_ALEN + 1 + 2 + 18 + 2 + *(rsnie+1) + 2 + *(timeoutie+1) + 2 + *(ftie+1); - - buf = rtw_zmalloc(len); - if (buf == NULL) - return 0; - - pos = buf; - /* 1) TDLS initiator STA MAC address */ - memcpy(pos, lnkid + ETH_ALEN + 2, ETH_ALEN); - pos += ETH_ALEN; - /* 2) TDLS responder STA MAC address */ - memcpy(pos, lnkid + 2 * ETH_ALEN + 2, ETH_ALEN); - pos += ETH_ALEN; - /* 3) Transaction Sequence number */ - *pos++ = trans_seq; - /* 4) Link Identifier IE */ - memcpy(pos, lnkid, 2 + 18); - pos += 2 + 18; - /* 5) RSN IE */ - memcpy(pos, rsnie, 2 + *(rsnie+1)); - pos += 2 + *(rsnie+1); - /* 6) Timeout Interval IE */ - memcpy(pos, timeoutie, 2 + *(timeoutie+1)); - pos += 2 + *(timeoutie+1); - /* 7) FTIE, with the MIC field of the FTIE set to 0 */ - memcpy(pos, ftie, 2 + *(ftie+1)); - pos += 2; - tmp_ftie = (u8 *) (pos+2); - memset(tmp_ftie, 0, 16); - pos += *(ftie+1); - - ret = omac1_aes_128(kck, buf, pos - buf, mic); - rtw_mfree(buf, len); - if (ret) - return 0; - rx_ftie = ftie+4; - - if (os_memcmp(mic, rx_ftie, 16) == 0) { - /* Valid MIC */ - return 1; - } - - /* Invalid MIC */ - DBG_871X( "[%s] Invalid MIC\n", __FUNCTION__); - return 0; - -} -#endif /* CONFIG_TDLS */ - void rtw_use_tkipkey_handler(void *FunctionContext) { struct adapter *padapter = (struct adapter *)FunctionContext; diff --git a/core/rtw_sta_mgt.c b/core/rtw_sta_mgt.c index a7f49f6..7bcfd5a 100755 --- a/core/rtw_sta_mgt.c +++ b/core/rtw_sta_mgt.c @@ -372,16 +372,6 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) init_addba_retry_timer(pstapriv->padapter, psta); -#ifdef CONFIG_TDLS - psta->padapter = pstapriv->padapter; - init_TPK_timer(pstapriv->padapter, psta); - init_ch_switch_timer(pstapriv->padapter, psta); - init_base_ch_timer(pstapriv->padapter, psta); - init_off_ch_timer(pstapriv->padapter, psta); - init_handshake_timer(pstapriv->padapter, psta); - init_tdls_alive_timer(pstapriv->padapter, psta); -#endif /* CONFIG_TDLS */ - /* for A-MPDU Rx reordering buffer control */ for(i=0; i < 16 ; i++) { preorder_ctrl = &psta->recvreorder_ctrl[i]; @@ -497,15 +487,6 @@ u32 rtw_free_stainfo(struct adapter *padapter , struct sta_info *psta) pstapriv->asoc_sta_count --; _cancel_timer_ex(&psta->addba_retry_timer); -#ifdef CONFIG_TDLS - _cancel_timer_ex(&psta->TPK_timer); - _cancel_timer_ex(&psta->option_timer); - _cancel_timer_ex(&psta->base_ch_timer); - _cancel_timer_ex(&psta->off_ch_timer); - _cancel_timer_ex(&psta->alive_timer1); - _cancel_timer_ex(&psta->alive_timer2); -#endif /* CONFIG_TDLS */ - /* for A-MPDU Rx reordering buffer control, cancel reordering_ctrl_timer */ for(i=0; i < 16 ; i++) { diff --git a/core/rtw_tdls.c b/core/rtw_tdls.c deleted file mode 100755 index 27572b4..0000000 --- a/core/rtw_tdls.c +++ /dev/null @@ -1,2936 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * - ******************************************************************************/ -#define _RTW_TDLS_C_ - -#include -#include -#include -#include - -#ifdef CONFIG_TDLS -extern unsigned char MCS_rate_2R[16]; -extern unsigned char MCS_rate_1R[16]; -extern void process_wmmps_data(_adapter *padapter, union recv_frame *precv_frame); -extern s32 rtw_dump_xframe(_adapter *padapter, struct xmit_frame *pxmitframe); - -void rtw_reset_tdls_info(_adapter* padapter) -{ - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - - ptdlsinfo->ap_prohibited = false; - ptdlsinfo->setup_state = TDLS_STATE_NONE; - ptdlsinfo->sta_cnt = 0; - ptdlsinfo->sta_maximum = false; - ptdlsinfo->macid_index= 6; - ptdlsinfo->clear_cam= 0; - ptdlsinfo->ch_sensing = 0; - ptdlsinfo->cur_channel = 0; - ptdlsinfo->candidate_ch = 1; /* when inplement channel switching, default candidate channel is 1 */ - ptdlsinfo->watchdog_count = 0; - ptdlsinfo->dev_discovered = 0; - -#ifdef CONFIG_P2P - ptdlsinfo->wfd_info = &padapter->wfd_info; -#endif /* CONFIG_P2P */ -} - -int rtw_init_tdls_info(_adapter* padapter) -{ - int res = _SUCCESS; - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - - ptdlsinfo->enable = 1; - rtw_reset_tdls_info(padapter); - - _rtw_spinlock_init(&ptdlsinfo->cmd_lock); - _rtw_spinlock_init(&ptdlsinfo->hdl_lock); - - return res; - -} - -void rtw_free_tdls_info(struct tdls_info *ptdlsinfo) -{ - _rtw_spinlock_free(&ptdlsinfo->cmd_lock); - _rtw_spinlock_free(&ptdlsinfo->hdl_lock); - - memset(ptdlsinfo, 0, sizeof(struct tdls_info) ); - -} - -void issue_nulldata_to_TDLS_peer_STA(_adapter *padapter, struct sta_info *ptdls_sta, unsigned int power_mode) -{ - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - unsigned char *pframe; - struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - return; - } - - /* update attribute */ - pattrib = &pmgntframe->attrib; - update_mgntframe_attrib(padapter, pattrib); - - memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET); - - pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET; - pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; - - fctrl = &(pwlanhdr->frame_ctl); - *(fctrl) = 0; -/* SetToDs(fctrl); */ - if (power_mode) - { - SetPwrMgt(fctrl); - } - - memcpy(pwlanhdr->addr1, ptdls_sta->hwaddr, ETH_ALEN); - memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); - memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); - - ptdls_sta->sta_xmitpriv.txseq_tid[pattrib->priority]++; - ptdls_sta->sta_xmitpriv.txseq_tid[pattrib->priority] &= 0xFFF; - pattrib->seqnum = ptdls_sta->sta_xmitpriv.txseq_tid[pattrib->priority]; - SetSeqNum(pwlanhdr, pattrib->seqnum); - - SetFrameSubType(pframe, WIFI_DATA_NULL); - - pframe += sizeof(struct rtw_ieee80211_hdr_3addr); - pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); - - pattrib->last_txcmdsz = pattrib->pktlen; - dump_mgntframe(padapter, pmgntframe); - - return; -} - -s32 update_tdls_attrib(_adapter *padapter, struct pkt_attrib *pattrib) -{ - - struct sta_info *psta = NULL; - struct sta_priv *pstapriv = &padapter->stapriv; - struct security_priv *psecuritypriv = &padapter->securitypriv; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct qos_priv *pqospriv= &pmlmepriv->qospriv; - - s32 res=_SUCCESS; - sint bmcast; - - bmcast = IS_MCAST(pattrib->ra); - - psta = rtw_get_stainfo(pstapriv, pattrib->ra); - if (psta == NULL) { - res =_FAIL; - goto exit; - } - - pattrib->mac_id = psta->mac_id; - - pattrib->psta = psta; - - pattrib->ack_policy = 0; - /* get ether_hdr_len */ - pattrib->pkt_hdrlen = ETH_HLEN;/* pattrib->ether_type == 0x8100) ? (14 + 4 ): 14; vlan tag */ - - if (pqospriv->qos_option && psta->qos_option) { - pattrib->priority = 1; /* tdls management frame should be AC_BK */ - pattrib->hdrlen = WLAN_HDR_A3_QOS_LEN; - pattrib->subtype = WIFI_QOS_DATA_TYPE; - } else { - pattrib->hdrlen = WLAN_HDR_A3_LEN; - pattrib->subtype = WIFI_DATA_TYPE; - pattrib->priority = 0; - } - - if (psta->ieee8021x_blocked == true) - { - pattrib->encrypt = 0; - } - else - { - GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, bmcast); - - switch(psecuritypriv->dot11AuthAlgrthm) - { - case dot11AuthAlgrthm_Open: - case dot11AuthAlgrthm_Shared: - case dot11AuthAlgrthm_Auto: - pattrib->key_idx = (u8)psecuritypriv->dot11PrivacyKeyIndex; - break; - case dot11AuthAlgrthm_8021X: - pattrib->key_idx = 0; - break; - default: - pattrib->key_idx = 0; - break; - } - } - - switch (pattrib->encrypt) - { - case _WEP40_: - case _WEP104_: - pattrib->iv_len = 4; - pattrib->icv_len = 4; - break; - case _TKIP_: - pattrib->iv_len = 8; - pattrib->icv_len = 4; - if(padapter->securitypriv.busetkipkey==_FAIL) - { - res =_FAIL; - goto exit; - } - break; - case _AES_: - pattrib->iv_len = 8; - pattrib->icv_len = 8; - break; - default: - pattrib->iv_len = 0; - pattrib->icv_len = 0; - break; - } - - if (pattrib->encrypt && - ((padapter->securitypriv.sw_encrypt == true) || (psecuritypriv->hw_decrypted == false))) - { - pattrib->bswenc = true; - } else { - pattrib->bswenc = false; - } - - /* qos_en, ht_en, init rate, ,bw, ch_offset, sgi */ - pattrib->qos_en = psta->qos_option; - pattrib->ht_en = psta->htpriv.ht_option; - pattrib->raid = psta->raid; - pattrib->bwmode = psta->htpriv.bwmode; - pattrib->ch_offset = psta->htpriv.ch_offset; - pattrib->sgi= psta->htpriv.sgi; - pattrib->ampdu_en = false; - - /* if(pattrib->ht_en && psta->htpriv.ampdu_enable) */ - /* */ - /* if(psta->htpriv.agg_enable_bitmap & BIT(pattrib->priority)) */ - /* pattrib->ampdu_en = true; */ - /* */ - -exit: - - return res; -} - -void free_tdls_sta(_adapter *padapter, struct sta_info *ptdls_sta) -{ - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - struct sta_priv *pstapriv = &padapter->stapriv; - _irqL irqL; - - /* free peer sta_info */ - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - if(ptdlsinfo->sta_cnt != 0) - ptdlsinfo->sta_cnt--; - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - if( ptdlsinfo->sta_cnt < (NUM_STA - 2) ) /* -2: AP + BC/MC sta */ - { - ptdlsinfo->sta_maximum = false; - memset( &ptdlsinfo->ss_record, 0x00, sizeof(struct tdls_ss_record) ); - } - /* ready to clear cam */ - if(ptdls_sta->mac_id!=0){ - ptdlsinfo->clear_cam=ptdls_sta->mac_id; - rtw_setstakey_cmd(padapter, (u8 *)ptdls_sta, true, true); - } - - if(ptdlsinfo->sta_cnt==0){ - rtw_tdls_cmd(padapter, myid(&(padapter->eeprompriv)), TDLS_RS_RCR); - ptdlsinfo->setup_state=TDLS_STATE_NONE; - } - else - DBG_871X("Remain tdls sta:%02x\n", ptdlsinfo->sta_cnt); - - rtw_free_stainfo(padapter, ptdls_sta); - -} - -/* cam entry will be the same as mac_id */ -void rtw_tdls_set_mac_id(struct tdls_info *ptdlsinfo, struct sta_info *ptdls_sta) -{ - if(ptdls_sta->mac_id==0) - { - ptdls_sta->mac_id = ptdlsinfo->macid_index; - if( (++ptdlsinfo->macid_index) > (NUM_STA -2) ) - ptdlsinfo->macid_index= TDLS_INI_MACID_ENTRY; - } -} - -/* TDLS encryption(if needed) will always be CCMP */ -void rtw_tdls_set_key(_adapter *adapter, struct rx_pkt_attrib *prx_pkt_attrib, struct sta_info *ptdls_sta) -{ - if(prx_pkt_attrib->encrypt) - { - ptdls_sta->dot118021XPrivacy=_AES_; - rtw_setstakey_cmd(adapter, (u8*)ptdls_sta, true, true); - } -} - -void rtw_tdls_process_ht_cap(_adapter *adapter, struct sta_info *ptdls_sta, u8 *data, u8 Length) -{ - /* save HT capabilities in the sta object */ - memset(&ptdls_sta->htpriv.ht_cap, 0, sizeof(struct rtw_ieee80211_ht_cap)); - if (data && Length >= sizeof(struct rtw_ieee80211_ht_cap) ) - { - ptdls_sta->flags |= WLAN_STA_HT; - - ptdls_sta->flags |= WLAN_STA_WME; - - memcpy(&ptdls_sta->htpriv.ht_cap, data, sizeof(struct rtw_ieee80211_ht_cap)); - - } else - ptdls_sta->flags &= ~WLAN_STA_HT; - - if(ptdls_sta->flags & WLAN_STA_HT) - { - if(adapter->registrypriv.ht_enable == true) - { - ptdls_sta->htpriv.ht_option = true; - } - else - { - ptdls_sta->htpriv.ht_option = false; - ptdls_sta->stat_code = _STATS_FAILURE_; - } - } - - /* HT related cap */ - if(ptdls_sta->htpriv.ht_option) - { - /* check if sta supports rx ampdu */ - if(adapter->registrypriv.ampdu_enable==1) - ptdls_sta->htpriv.ampdu_enable = true; - - /* check if sta support s Short GI */ - if(ptdls_sta->htpriv.ht_cap.cap_info & cpu_to_le16(IEEE80211_HT_CAP_SGI_20|IEEE80211_HT_CAP_SGI_40)) - { - ptdls_sta->htpriv.sgi = true; - } - - /* bwmode would still followed AP's setting */ - if(ptdls_sta->htpriv.ht_cap.cap_info & cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH)) - { - ptdls_sta->htpriv.bwmode = adapter->mlmeextpriv.cur_bwmode; - ptdls_sta->htpriv.ch_offset = adapter->mlmeextpriv.cur_ch_offset; - } - } -} - -u8 *rtw_tdls_set_ht_cap(_adapter *padapter, u8 *pframe, struct pkt_attrib *pattrib) -{ - struct rtw_ieee80211_ht_cap ht_capie; - u8 rf_type; - - /* HT capabilities */ - memset(&ht_capie, 0, sizeof(struct rtw_ieee80211_ht_cap)); - - ht_capie.cap_info = IEEE80211_HT_CAP_SUP_WIDTH |IEEE80211_HT_CAP_SGI_20 |IEEE80211_HT_CAP_SM_PS | - IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_TX_STBC |IEEE80211_HT_CAP_DSSSCCK40; - - { - u32 rx_packet_offset, max_recvbuf_sz; - padapter->HalFunc.GetHalDefVarHandler(padapter, HAL_DEF_RX_PACKET_OFFSET, &rx_packet_offset); - padapter->HalFunc.GetHalDefVarHandler(padapter, HAL_DEF_MAX_RECVBUF_SZ, &max_recvbuf_sz); - if(max_recvbuf_sz-rx_packet_offset>(8191-256)) - ht_capie.cap_info = ht_capie.cap_info |IEEE80211_HT_CAP_MAX_AMSDU; - } - - ht_capie.ampdu_params_info = (IEEE80211_HT_CAP_AMPDU_FACTOR&0x03); - - padapter->HalFunc.GetHwRegHandler(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); - switch(rf_type) - { - case RF_1T1R: - ht_capie.cap_info |= 0x0100;/* RX STBC One spatial stream */ - memcpy(ht_capie.supp_mcs_set, MCS_rate_1R, 16); - break; - - case RF_2T2R: - case RF_1T2R: - default: - ht_capie.cap_info|= 0x0200;/* RX STBC two spatial stream */ - memcpy(ht_capie.supp_mcs_set, MCS_rate_2R, 16); - break; - } - - return(rtw_set_ie(pframe, _HT_CAPABILITY_IE_, - sizeof(struct rtw_ieee80211_ht_cap), (unsigned char*)&ht_capie, &(pattrib->pktlen))); -} - -u8 *rtw_tdls_set_sup_ch(struct mlme_ext_priv *pmlmeext, u8 *pframe, struct pkt_attrib *pattrib) -{ - u8 sup_ch[ 30 * 2 ] = { 0x00 }, sup_ch_idx = 0, idx_5g = 2; /* For supported channel */ - do{ - if( pmlmeext->channel_set[sup_ch_idx].ChannelNum <= 14 ) - { - sup_ch[0] = 1; /* First channel number */ - sup_ch[1] = pmlmeext->channel_set[sup_ch_idx].ChannelNum; /* Number of channel */ - } - else - { - sup_ch[idx_5g++] = pmlmeext->channel_set[sup_ch_idx].ChannelNum; - sup_ch[idx_5g++] = 1; - } - - sup_ch_idx++; - } - while( pmlmeext->channel_set[sup_ch_idx].ChannelNum != 0 ); - return(rtw_set_ie(pframe, _SUPPORTED_CH_IE_, idx_5g, sup_ch, &(pattrib->pktlen))); -} - -#ifdef CONFIG_P2P -void rtw_tdls_process_wfd_ie(struct tdls_info *ptdlsinfo, u8 *ptr, u8 length) -{ - u8 wfd_ie[ 128 ] = { 0x00 }; - u32 wfd_ielen = 0; - u32 wfd_offset = 0; - /* Try to get the TCP port information when receiving the negotiation response. */ - /* */ - - wfd_offset = 0; - wfd_offset = rtw_get_wfd_ie( ptr + wfd_offset, length - wfd_offset, wfd_ie, &wfd_ielen ); - while( wfd_offset ) - { - u8 attr_content[ 10 ] = { 0x00 }; - u32 attr_contentlen = 0; - int i; - - DBG_871X( "[%s] WFD IE Found!!\n", __FUNCTION__ ); - rtw_get_wfd_attr_content( wfd_ie, wfd_ielen, WFD_ATTR_DEVICE_INFO, attr_content, &attr_contentlen); - if ( attr_contentlen ) - { - ptdlsinfo->wfd_info->peer_rtsp_ctrlport = RTW_GET_BE16( attr_content + 2 ); - DBG_871X( "[%s] Peer PORT NUM = %d\n", __FUNCTION__, ptdlsinfo->wfd_info->peer_rtsp_ctrlport ); - } - - memset( attr_content, 0x00, 10); - attr_contentlen = 0; - rtw_get_wfd_attr_content( wfd_ie, wfd_ielen, WFD_ATTR_LOCAL_IP_ADDR, attr_content, &attr_contentlen); - if ( attr_contentlen ) - { - memcpy(ptdlsinfo->wfd_info->peer_ip_address, ( attr_content + 1 ), 4); - DBG_871X( "[%s] Peer IP = %02u.%02u.%02u.%02u \n", __FUNCTION__, - ptdlsinfo->wfd_info->peer_ip_address[0], ptdlsinfo->wfd_info->peer_ip_address[1], - ptdlsinfo->wfd_info->peer_ip_address[2], ptdlsinfo->wfd_info->peer_ip_address[3] - ); - } - wfd_offset = rtw_get_wfd_ie( ptr + wfd_offset, length - wfd_offset, wfd_ie, &wfd_ielen ); - } -} - -void issue_tunneled_probe_req(_adapter *padapter) -{ - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - u8 baddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - - DBG_871X("[%s]\n", __FUNCTION__); - - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - return; - } - - /* update attribute */ - pattrib = &pmgntframe->attrib; - - pmgntframe->frame_tag = DATA_FRAMETAG; - pattrib->ether_type = 0x890d; - pattrib->pctrl =0; - - memcpy(pattrib->dst, baddr, ETH_ALEN); - - memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); - - memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN); - memcpy(pattrib->ta, pattrib->src, ETH_ALEN); - - update_tdls_attrib(padapter, pattrib); - pattrib->qsel=pattrib->priority; - if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, TUNNELED_PROBE_REQ) != _SUCCESS) { - rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf); - rtw_free_xmitframe(pxmitpriv, pmgntframe); - goto exit; - } - rtw_dump_xframe(padapter, pmgntframe); - -exit: - - return; -} - -void issue_tunneled_probe_rsp(_adapter *padapter, union recv_frame *precv_frame) -{ - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - struct rx_pkt_attrib *rx_pkt_pattrib = &precv_frame->u.hdr.attrib; - - DBG_871X("[%s]\n", __FUNCTION__); - - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - return; - } - - /* update attribute */ - pattrib = &pmgntframe->attrib; - - pmgntframe->frame_tag = DATA_FRAMETAG; - pattrib->ether_type = 0x890d; - pattrib->pctrl =0; - - memcpy(pattrib->dst, rx_pkt_pattrib->src, ETH_ALEN); - - memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); - - memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN); - memcpy(pattrib->ta, pattrib->src, ETH_ALEN); - - update_tdls_attrib(padapter, pattrib); - pattrib->qsel=pattrib->priority; - if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, TUNNELED_PROBE_RSP) != _SUCCESS) { - rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf); - rtw_free_xmitframe(pxmitpriv, pmgntframe); - goto exit; - } - rtw_dump_xframe(padapter, pmgntframe); - -exit: - - return; -} -#endif /* CONFIG_P2P */ - -void issue_tdls_setup_req(_adapter *padapter, u8 *mac_addr) -{ - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - struct sta_priv *pstapriv = &padapter->stapriv; - struct sta_info *ptdls_sta= NULL; - _irqL irqL; - static u8 dialogtoken = 0; - u32 timeout_interval= TPK_RESEND_COUNT * 1000; /* retry timer should set at least 301 sec, using TPK_count counting 301 times. */ - - if(ptdlsinfo->ap_prohibited == true) - goto exit; - - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - return; - } - - /* update attribute */ - pattrib = &pmgntframe->attrib; - - pmgntframe->frame_tag = DATA_FRAMETAG; - pattrib->ether_type = 0x890d; - pattrib->pctrl =0; - - memcpy(pattrib->dst, mac_addr, ETH_ALEN); - memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); - - memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN); - memcpy(pattrib->ta, pattrib->src, ETH_ALEN); - - update_tdls_attrib(padapter, pattrib); - - /* init peer sta_info */ - ptdls_sta = rtw_get_stainfo(pstapriv, mac_addr); - if(ptdls_sta==NULL) - { - ptdls_sta = rtw_alloc_stainfo(pstapriv, mac_addr); - if(ptdls_sta) - { - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - if(!(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE)) - ptdlsinfo->sta_cnt++; - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - if( ptdlsinfo->sta_cnt == (NUM_STA - 2) ) /* -2: AP + BC/MC sta */ - { - ptdlsinfo->sta_maximum = true; - } - } - else - { - rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf); - rtw_free_xmitframe(pxmitpriv, pmgntframe); - goto exit; - } - } - - if(ptdls_sta){ - ptdls_sta->tdls_sta_state |= TDLS_RESPONDER_STATE; - /* for tdls; ptdls_sta->aid is used to fill dialogtoken */ - ptdls_sta->dialog = dialogtoken; - dialogtoken = (dialogtoken+1)%256; - ptdls_sta->TDLS_PeerKey_Lifetime = timeout_interval; - _set_timer( &ptdls_sta->handshake_timer, TDLS_HANDSHAKE_TIME ); - } - - pattrib->qsel=pattrib->priority; - if(rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_SETUP_REQUEST) !=_SUCCESS ){ - rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf); - rtw_free_xmitframe(pxmitpriv, pmgntframe); - goto exit; - } - rtw_dump_xframe(padapter, pmgntframe); - -exit: - - return; -} - -void issue_tdls_teardown(_adapter *padapter, u8 *mac_addr) -{ - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - struct sta_priv *pstapriv = &padapter->stapriv; - struct sta_info *ptdls_sta=NULL; - _irqL irqL; - - ptdls_sta = rtw_get_stainfo(pstapriv, mac_addr); - if(ptdls_sta==NULL){ - DBG_871X("issue tdls teardown unsuccessful\n"); - return; - }else{ - ptdls_sta->tdls_sta_state=TDLS_STATE_NONE; - } - - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - return; - } - - /* update attribute */ - pattrib = &pmgntframe->attrib; - - pmgntframe->frame_tag = DATA_FRAMETAG; - pattrib->ether_type = 0x890d; - pattrib->pctrl =0; - - memcpy(pattrib->dst, mac_addr, ETH_ALEN); - memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); - - memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN); - memcpy(pattrib->ta, pattrib->src, ETH_ALEN); - - update_tdls_attrib(padapter, pattrib); - pattrib->qsel=pattrib->priority; - if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_TEARDOWN) != _SUCCESS) { - rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf); - rtw_free_xmitframe(pxmitpriv, pmgntframe); - goto exit; - } - rtw_dump_xframe(padapter, pmgntframe); - - if(ptdls_sta->tdls_sta_state & TDLS_CH_SWITCH_ON_STATE){ - rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_CS_OFF); - } - - if( ptdls_sta->timer_flag == 1 ) - { - _enter_critical_bh(&(padapter->tdlsinfo.hdl_lock), &irqL); - ptdls_sta->timer_flag = 2; - _exit_critical_bh(&(padapter->tdlsinfo.hdl_lock), &irqL); - } - else - rtw_tdls_cmd(padapter, mac_addr, TDLS_FREE_STA ); - - -exit: - - return; -} - -void issue_tdls_dis_req(_adapter *padapter, u8 *mac_addr) -{ - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - u8 baddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - return; - } - - /* update attribute */ - pattrib = &pmgntframe->attrib; - - pmgntframe->frame_tag = DATA_FRAMETAG; - pattrib->ether_type = 0x890d; - pattrib->pctrl =0; - - if(mac_addr == NULL) - memcpy(pattrib->dst, baddr, ETH_ALEN); - else - memcpy(pattrib->dst, mac_addr, ETH_ALEN); - - memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); - - memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN); - memcpy(pattrib->ta, pattrib->src, ETH_ALEN); - - update_tdls_attrib(padapter, pattrib); - pattrib->qsel=pattrib->priority; - if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_DISCOVERY_REQUEST) != _SUCCESS) { - rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf); - rtw_free_xmitframe(pxmitpriv, pmgntframe); - goto exit; - } - rtw_dump_xframe(padapter, pmgntframe); - DBG_871X("issue tdls dis req\n"); - -exit: - - return; -} - -void issue_tdls_setup_rsp(_adapter *padapter, union recv_frame *precv_frame) -{ - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct rx_pkt_attrib *rx_pkt_pattrib = &precv_frame->u.hdr.attrib; - _irqL irqL; - - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - return; - } - - /* update attribute */ - pattrib = &pmgntframe->attrib; - - pmgntframe->frame_tag = DATA_FRAMETAG; - pattrib->ether_type = 0x890d; - pattrib->pctrl =0; - - memcpy(pattrib->dst, rx_pkt_pattrib->src, ETH_ALEN); - memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); - - memcpy(pattrib->ra, rx_pkt_pattrib->bssid, ETH_ALEN); - memcpy(pattrib->ta, pattrib->src, ETH_ALEN); - - update_tdls_attrib(padapter, pattrib); - pattrib->qsel=pattrib->priority; - if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_SETUP_RESPONSE) != _SUCCESS) { - rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf); - rtw_free_xmitframe(pxmitpriv, pmgntframe); - goto exit; - } - rtw_dump_xframe(padapter, pmgntframe); - -exit: - - return; - -} - -void issue_tdls_setup_cfm(_adapter *padapter, union recv_frame *precv_frame) -{ - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - struct sta_info *ptdls_sta=NULL; - _irqL irqL; - - struct rx_pkt_attrib *rx_pkt_pattrib = & precv_frame->u.hdr.attrib; - - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - return; - } - - /* update attribute */ - pattrib = &pmgntframe->attrib; - - pmgntframe->frame_tag = DATA_FRAMETAG; - pattrib->ether_type = 0x890d; - pattrib->pctrl =0; - - memcpy(pattrib->dst, rx_pkt_pattrib->src, ETH_ALEN); - memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); - - memcpy(pattrib->ra, rx_pkt_pattrib->bssid, ETH_ALEN); - memcpy(pattrib->ta, pattrib->src, ETH_ALEN); - - update_tdls_attrib(padapter, pattrib); - pattrib->qsel=pattrib->priority; - if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_SETUP_CONFIRM) != _SUCCESS) { - rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf); - rtw_free_xmitframe(pxmitpriv, pmgntframe); - goto exit; - } - - rtw_dump_xframe(padapter, pmgntframe); - -exit: - - return; - -} - -/* TDLS Discovery Response frame is a management action frame */ -void issue_tdls_dis_rsp(_adapter *padapter, union recv_frame *precv_frame, u8 dialog) -{ - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - unsigned char *pframe; - struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - - struct rx_pkt_attrib *rx_pkt_pattrib = &precv_frame->u.hdr.attrib; - - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - return; - } - - /* update attribute */ - pattrib = &pmgntframe->attrib; - update_mgntframe_attrib(padapter, pattrib); - - memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET); - - pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET; - pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; - - fctrl = &(pwlanhdr->frame_ctl); - *(fctrl) = 0; - - /* unicast probe request frame */ - memcpy(pwlanhdr->addr1, rx_pkt_pattrib->src, ETH_ALEN); - memcpy(pattrib->dst, pwlanhdr->addr1, ETH_ALEN); - - memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); - memcpy(pattrib->src, pwlanhdr->addr2, ETH_ALEN); - - memcpy(pwlanhdr->addr3, rx_pkt_pattrib->bssid, ETH_ALEN); - memcpy(pattrib->ra, pwlanhdr->addr3, ETH_ALEN); - - SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); - pmlmeext->mgnt_seq++; - SetFrameSubType(pframe, WIFI_ACTION); - - pframe += sizeof (struct rtw_ieee80211_hdr_3addr); - pattrib->pktlen = sizeof (struct rtw_ieee80211_hdr_3addr); - - rtw_build_tdls_dis_rsp_ies(padapter, pmgntframe, pframe, dialog); - - pattrib->nr_frags = 1; - pattrib->last_txcmdsz = pattrib->pktlen; - - dump_mgntframe(padapter, pmgntframe); - - return; -} - -void issue_tdls_peer_traffic_indication(_adapter *padapter, struct sta_info *ptdls_sta) -{ - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - - static u8 dialogtoken=0; - - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - return; - } - - /* update attribute */ - pattrib = &pmgntframe->attrib; - - pmgntframe->frame_tag = DATA_FRAMETAG; - pattrib->ether_type = 0x890d; - pattrib->pctrl =0; - - memcpy(pattrib->dst, ptdls_sta->hwaddr, ETH_ALEN); - memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); - - memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN); - memcpy(pattrib->ta, pattrib->src, ETH_ALEN); - - /* for tdls; pattrib->nr_frags is used to fill dialogtoken */ - ptdls_sta->dialog = dialogtoken; - dialogtoken = (dialogtoken+1)%256; - /* PTI frame's priority should be AC_VO */ - pattrib->priority = 7; - - update_tdls_attrib(padapter, pattrib); - pattrib->qsel=pattrib->priority; - if (rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_PEER_TRAFFIC_INDICATION) != _SUCCESS) { - rtw_free_xmitbuf(pxmitpriv, pmgntframe->pxmitbuf); - rtw_free_xmitframe(pxmitpriv, pmgntframe); - goto exit; - } - rtw_dump_xframe(padapter, pmgntframe); - -exit: - - return; -} - -void issue_tdls_ch_switch_req(_adapter *padapter, u8 *mac_addr) -{ - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - return; - } - - /* update attribute */ - pattrib = &pmgntframe->attrib; - - pmgntframe->frame_tag = DATA_FRAMETAG; - pattrib->ether_type = 0x890d; - pattrib->pctrl =0; - - memcpy(pattrib->dst, mac_addr, ETH_ALEN); - memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); - - memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN); - memcpy(pattrib->ta, pattrib->src, ETH_ALEN); - - update_tdls_attrib(padapter, pattrib); - - pattrib->qsel=pattrib->priority; - if(rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_CHANNEL_SWITCH_REQUEST) !=_SUCCESS ){ - rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf); - rtw_free_xmitframe(pxmitpriv, pmgntframe); - goto exit; - } - rtw_dump_xframe(padapter, pmgntframe); - -exit: - - return; -} - -void issue_tdls_ch_switch_rsp(_adapter *padapter, u8 *mac_addr) -{ - struct xmit_frame *pmgntframe; - struct pkt_attrib *pattrib; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - - _irqL irqL; - - if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) - { - return; - } - - /* update attribute */ - pattrib = &pmgntframe->attrib; - - pmgntframe->frame_tag = DATA_FRAMETAG; - pattrib->ether_type = 0x890d; - pattrib->pctrl =0; - - memcpy(pattrib->dst, mac_addr, ETH_ALEN); - memcpy(pattrib->src, myid(&(padapter->eeprompriv)), ETH_ALEN); - - memcpy(pattrib->ra, get_bssid(pmlmepriv), ETH_ALEN); - memcpy(pattrib->ta, pattrib->src, ETH_ALEN); - - update_tdls_attrib(padapter, pattrib); - - pattrib->qsel=pattrib->priority; -/* - _enter_critical_bh(&pxmitpriv->lock, &irqL); - if(xmitframe_enqueue_for_tdls_sleeping_sta(padapter, pmgntframe)==true){ - _exit_critical_bh(&pxmitpriv->lock, &irqL); - return false; - } -*/ - if(rtw_xmit_tdls_coalesce(padapter, pmgntframe, TDLS_CHANNEL_SWITCH_RESPONSE) !=_SUCCESS ){ - rtw_free_xmitbuf(pxmitpriv,pmgntframe->pxmitbuf); - rtw_free_xmitframe(pxmitpriv, pmgntframe); - goto exit; - } - rtw_dump_xframe(padapter, pmgntframe); - -exit: - - return; -} - -sint On_TDLS_Dis_Rsp(_adapter *adapter, union recv_frame *precv_frame) -{ - struct sta_info *ptdls_sta = NULL, *psta = rtw_get_stainfo(&(adapter->stapriv), get_bssid(&(adapter->mlmepriv))); - struct recv_priv *precvpriv = &(adapter->recvpriv); - u8 *ptr = precv_frame->u.hdr.rx_data, *psa; - struct rx_pkt_attrib *pattrib = &(precv_frame->u.hdr.attrib); - struct tdls_info *ptdlsinfo = &(adapter->tdlsinfo); - u8 empty_addr[ETH_ALEN] = { 0x00 }; - int UndecoratedSmoothedPWDB; - - - /* WFDTDLS: for sigma test, not to setup direct link automatically */ - ptdlsinfo->dev_discovered = 1; - -#ifdef CONFIG_TDLS_AUTOSETUP - psa = get_sa(ptr); - ptdls_sta = rtw_get_stainfo(&(adapter->stapriv), psa); - - if(ptdls_sta != NULL) - { - ptdls_sta->tdls_sta_state |= TDLS_ALIVE_STATE; - - /* Record the tdls sta with lowest signal strength */ - if( (ptdlsinfo->sta_maximum == true) && (ptdls_sta->alive_count >= 1) ) - { - if( _rtw_memcmp(ptdlsinfo->ss_record.macaddr, empty_addr, ETH_ALEN) ) - { - memcpy(ptdlsinfo->ss_record.macaddr, psa, ETH_ALEN); - ptdlsinfo->ss_record.RxPWDBAll = pattrib->RxPWDBAll; - } - else - { - if( ptdlsinfo->ss_record.RxPWDBAll < pattrib->RxPWDBAll ) - { - memcpy(ptdlsinfo->ss_record.macaddr, psa, ETH_ALEN); - ptdlsinfo->ss_record.RxPWDBAll = pattrib->RxPWDBAll; - } - } - } - - } - else - { - if( ptdlsinfo->sta_maximum == true) - { - if( _rtw_memcmp( ptdlsinfo->ss_record.macaddr, empty_addr, ETH_ALEN ) ) - { - /* All traffics are busy, do not set up another direct link. */ - return _FAIL; - } - else - { - if( pattrib->RxPWDBAll > ptdlsinfo->ss_record.RxPWDBAll ) - { - issue_tdls_teardown(adapter, ptdlsinfo->ss_record.macaddr); - } - else - { - return _FAIL; - } - } - } - - adapter->HalFunc.GetHalDefVarHandler(adapter, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, &UndecoratedSmoothedPWDB); - - if( pattrib->RxPWDBAll + TDLS_SIGNAL_THRESH >= UndecoratedSmoothedPWDB); - { - DBG_871X("pattrib->RxPWDBAll=%d, pdmpriv->UndecoratedSmoothedPWDB=%d\n", pattrib->RxPWDBAll, UndecoratedSmoothedPWDB); - issue_tdls_setup_req(adapter, psa); - } - } -#endif /* CONFIG_TDLS_AUTOSETUP */ - - return _SUCCESS; -} - -sint On_TDLS_Setup_Req(_adapter *adapter, union recv_frame *precv_frame) -{ - struct tdls_info *ptdlsinfo = &adapter->tdlsinfo; - u8 *psa, *pmyid; - struct sta_info *ptdls_sta= NULL; - struct sta_priv *pstapriv = &adapter->stapriv; - u8 *ptr = precv_frame->u.hdr.rx_data; - struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); - struct security_priv *psecuritypriv = &adapter->securitypriv; - _irqL irqL; - struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib; - u8 *prsnie, *ppairwise_cipher; - u8 i, k, pairwise_count; - u8 ccmp_have=0, rsnie_have=0; - u16 j; - u8 SNonce[32]; - u32 *timeout_interval; - sint parsing_length; /* frame body length, without icv_len */ - PNDIS_802_11_VARIABLE_IEs pIE; - u8 FIXED_IE = 5; - unsigned char supportRate[16]; - int supportRateNum = 0; - - psa = get_sa(ptr); - ptdls_sta = rtw_get_stainfo(pstapriv, psa); - - pmyid=myid(&(adapter->eeprompriv)); - ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1; - parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len - -prx_pkt_attrib->hdrlen - -prx_pkt_attrib->iv_len - -prx_pkt_attrib->icv_len - -LLC_HEADER_SIZE - -ETH_TYPE_LEN - -PAYLOAD_TYPE_LEN - -FIXED_IE; - - if(ptdlsinfo->ap_prohibited == true) - { - goto exit; - } - - if(ptdls_sta==NULL){ - ptdls_sta = rtw_alloc_stainfo(pstapriv, psa); - }else{ - if(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE){ - /* If the direct link is already set up */ - /* Process as re-setup after tear down */ - DBG_871X("re-setup a direct link\n"); - } - /* already receiving TDLS setup request */ - else if(ptdls_sta->tdls_sta_state & TDLS_INITIATOR_STATE){ - DBG_871X("receive duplicated TDLS setup request frame in handshaking\n"); - goto exit; - } - /* When receiving and sending setup_req to the same link at the same time, STA with higher MAC_addr would be initiator */ - /* following is to check out MAC_addr */ - else if(ptdls_sta->tdls_sta_state & TDLS_RESPONDER_STATE){ - DBG_871X("receive setup_req after sending setup_req\n"); - for (i=0;i<6;i++){ - if(*(pmyid+i)==*(psa+i)){ - } - else if(*(pmyid+i)>*(psa+i)){ - goto exit; - }else if(*(pmyid+i)<*(psa+i)){ - ptdls_sta->tdls_sta_state=TDLS_INITIATOR_STATE; - break; - } - } - } - } - - if(ptdls_sta) - { - ptdls_sta->dialog = *(ptr+2); /* copy dialog token */ - ptdls_sta->stat_code = 0; - - /* parsing information element */ - for(j=FIXED_IE; jElementID) - { - case _SUPPORTEDRATES_IE_: - memcpy(supportRate, pIE->data, pIE->Length); - supportRateNum = pIE->Length; - break; - case _COUNTRY_IE_: - break; - case _EXT_SUPPORTEDRATES_IE_: - if(supportRateNum<=sizeof(supportRate)) - { - memcpy(supportRate+supportRateNum, pIE->data, pIE->Length); - supportRateNum += pIE->Length; - } - break; - case _SUPPORTED_CH_IE_: - break; - case _RSN_IE_2_: - rsnie_have=1; - if(prx_pkt_attrib->encrypt){ - prsnie=(u8*)pIE; - /* check whether initiator STA has CCMP pairwise_cipher. */ - ppairwise_cipher=prsnie+10; - memcpy(&pairwise_count, (u16*)(ppairwise_cipher-2), 1); - for(k=0;kstat_code=72; - } - } - break; - case _EXT_CAP_IE_: - break; - case _VENDOR_SPECIFIC_IE_: - break; - case _FTIE_: - if(prx_pkt_attrib->encrypt) - memcpy(SNonce, (ptr+j+52), 32); - break; - case _TIMEOUT_ITVL_IE_: - if(prx_pkt_attrib->encrypt) - timeout_interval = (u32 *)(ptr+j+3); - break; - case _RIC_Descriptor_IE_: - break; - case _HT_CAPABILITY_IE_: - rtw_tdls_process_ht_cap(adapter, ptdls_sta, pIE->data, pIE->Length); - break; - case EID_BSSCoexistence: - break; - case _LINK_ID_IE_: - if(_rtw_memcmp(get_bssid(pmlmepriv), pIE->data, 6) == false) - { - /* not in the same BSS */ - ptdls_sta->stat_code=7; - } - break; - default: - break; - } - - j += (pIE->Length + 2); - - } - - /* update station supportRate */ - ptdls_sta->bssratelen = supportRateNum; - memcpy(ptdls_sta->bssrateset, supportRate, supportRateNum); - - /* check status code */ - /* if responder STA has/hasn't security on AP, but request hasn't/has RSNIE, it should reject */ - if(ptdls_sta->stat_code == 0 ) - { - if(rsnie_have && (prx_pkt_attrib->encrypt==0)){ - /* security disabled */ - ptdls_sta->stat_code = 5; - }else if(rsnie_have==0 && (prx_pkt_attrib->encrypt)){ - /* request haven't RSNIE */ - ptdls_sta->stat_code = 38; - } - -#ifdef CONFIG_P2P - /* WFD test plan version 0.18.2 test item 5.1.5 */ - /* SoUT does not use TDLS if AP uses weak security */ - if ( adapter->wdinfo.wfd_tdls_enable ) - { - if(rsnie_have && (prx_pkt_attrib->encrypt != _AES_)) - { - ptdls_sta->stat_code = 5; - } - } -#endif /* CONFIG_P2P */ - } - - ptdls_sta->tdls_sta_state|= TDLS_INITIATOR_STATE; - if(prx_pkt_attrib->encrypt){ - memcpy(ptdls_sta->SNonce, SNonce, 32); - memcpy(&(ptdls_sta->TDLS_PeerKey_Lifetime), timeout_interval, 4); - } - _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - if(!(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE)) - ptdlsinfo->sta_cnt++; - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL); - if( ptdlsinfo->sta_cnt == (NUM_STA - 2) ) /* -2: AP + BC/MC sta */ - { - ptdlsinfo->sta_maximum = true; - } - -#ifdef CONFIG_P2P - rtw_tdls_process_wfd_ie(ptdlsinfo, ptr + FIXED_IE, parsing_length - FIXED_IE); -#endif /* CONFIG_P2P */ - - } - else - { - goto exit; - } - - issue_tdls_setup_rsp(adapter, precv_frame); - - if(ptdls_sta->stat_code==0) - { - _set_timer( &ptdls_sta->handshake_timer, TDLS_HANDSHAKE_TIME); - } - else /* status code!=0 ; setup unsuccess */ - { - free_tdls_sta(adapter, ptdls_sta); - } - -exit: - - return _FAIL; -} - -sint On_TDLS_Setup_Rsp(_adapter *adapter, union recv_frame *precv_frame) -{ - struct tdls_info *ptdlsinfo = &adapter->tdlsinfo; - struct sta_info *ptdls_sta= NULL; - struct sta_priv *pstapriv = &adapter->stapriv; - u8 *ptr = precv_frame->u.hdr.rx_data; - _irqL irqL; - struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib; - u8 *psa; - u16 stat_code; - sint parsing_length; /* frame body length, without icv_len */ - PNDIS_802_11_VARIABLE_IEs pIE; - u8 FIXED_IE =7; - u8 *pftie, *ptimeout_ie, *plinkid_ie, *prsnie, *pftie_mic, *ppairwise_cipher; - u16 pairwise_count, j, k; - u8 verify_ccmp=0; - unsigned char supportRate[16]; - int supportRateNum = 0; - - psa = get_sa(ptr); - ptdls_sta = rtw_get_stainfo(pstapriv, psa); - - if ( NULL == ptdls_sta ) - { - return _FAIL; - } - - ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1; - parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len - -prx_pkt_attrib->hdrlen - -prx_pkt_attrib->iv_len - -prx_pkt_attrib->icv_len - -LLC_HEADER_SIZE - -TYPE_LENGTH_FIELD_SIZE - -1 - -FIXED_IE; - - memcpy(&stat_code, ptr+2, 2); - - if(stat_code!=0) - { - DBG_871X( "[%s] status_code = %d, free_tdls_sta\n", __FUNCTION__, stat_code ); - free_tdls_sta(adapter, ptdls_sta); - return _FAIL; - } - - stat_code = 0; - - /* parsing information element */ - for(j=FIXED_IE; jElementID) - { - case _SUPPORTEDRATES_IE_: - memcpy(supportRate, pIE->data, pIE->Length); - supportRateNum = pIE->Length; - break; - case _COUNTRY_IE_: - break; - case _EXT_SUPPORTEDRATES_IE_: - if(supportRateNum<=sizeof(supportRate)) - { - memcpy(supportRate+supportRateNum, pIE->data, pIE->Length); - supportRateNum += pIE->Length; - } - break; - case _SUPPORTED_CH_IE_: - break; - case _RSN_IE_2_: - prsnie=(u8*)pIE; - /* check whether responder STA has CCMP pairwise_cipher. */ - ppairwise_cipher=prsnie+10; - memcpy(&pairwise_count, (u16*)(ppairwise_cipher-2), 2); - for(k=0;kANonce, (ptr+j+20), 32); - break; - case _TIMEOUT_ITVL_IE_: - ptimeout_ie=(u8*)pIE; - break; - case _RIC_Descriptor_IE_: - break; - case _HT_CAPABILITY_IE_: - rtw_tdls_process_ht_cap(adapter, ptdls_sta, pIE->data, pIE->Length); - break; - case EID_BSSCoexistence: - break; - case _LINK_ID_IE_: - plinkid_ie=(u8*)pIE; - break; - default: - break; - } - - j += (pIE->Length + 2); - - } - - /* update station supportRate */ - ptdls_sta->bssratelen = supportRateNum; - memcpy(ptdls_sta->bssrateset, supportRate, supportRateNum); - -#ifdef CONFIG_P2P - rtw_tdls_process_wfd_ie(ptdlsinfo, ptr + FIXED_IE, parsing_length - FIXED_IE); -#endif /* CONFIG_P2P */ - - if(stat_code != 0) - { - ptdls_sta->stat_code = stat_code; - } - else - { - if(prx_pkt_attrib->encrypt) - { - if(verify_ccmp==1) - { - wpa_tdls_generate_tpk(adapter, ptdls_sta); - ptdls_sta->stat_code=0; - if(tdls_verify_mic(ptdls_sta->tpk.kck, 2, plinkid_ie, prsnie, ptimeout_ie, pftie)==0) /* 0: Invalid, 1: valid */ - { - free_tdls_sta(adapter, ptdls_sta); - return _FAIL; - } - } - else - { - ptdls_sta->stat_code=72; /* invalide contents of RSNIE */ - } - - }else{ - ptdls_sta->stat_code=0; - } - } - - DBG_871X("issue_tdls_setup_cfm\n"); - issue_tdls_setup_cfm(adapter, precv_frame); - - if(ptdls_sta->stat_code==0) - { - ptdlsinfo->setup_state = TDLS_LINKED_STATE; - - if( ptdls_sta->tdls_sta_state & TDLS_RESPONDER_STATE ) - { - ptdls_sta->tdls_sta_state |= TDLS_LINKED_STATE; - _cancel_timer_ex( &ptdls_sta->handshake_timer); -#ifdef CONFIG_TDLS_AUTOCHECKALIVE - _set_timer( &ptdls_sta->alive_timer1, TDLS_ALIVE_TIMER_PH1); -#endif /* CONFIG_TDLS_AUTOSETUP */ - } - - rtw_tdls_set_mac_id(ptdlsinfo, ptdls_sta); - rtw_tdls_set_key(adapter, prx_pkt_attrib, ptdls_sta); - - rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_WRCR); - - } - else /* status code!=0 ; setup unsuccessful */ - { - free_tdls_sta(adapter, ptdls_sta); - } - - return _FAIL; - -} - -sint On_TDLS_Setup_Cfm(_adapter *adapter, union recv_frame *precv_frame) -{ - struct tdls_info *ptdlsinfo = &adapter->tdlsinfo; - struct sta_info *ptdls_sta= NULL; - struct sta_priv *pstapriv = &adapter->stapriv; - u8 *ptr = precv_frame->u.hdr.rx_data; - _irqL irqL; - struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib; - u8 *psa; - u16 stat_code; - sint parsing_length; - PNDIS_802_11_VARIABLE_IEs pIE; - u8 FIXED_IE =5; - u8 *pftie, *ptimeout_ie, *plinkid_ie, *prsnie, *pftie_mic, *ppairwise_cipher; - u16 j, pairwise_count; - - psa = get_sa(ptr); - ptdls_sta = rtw_get_stainfo(pstapriv, psa); - - ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1; - parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len - -prx_pkt_attrib->hdrlen - -prx_pkt_attrib->iv_len - -prx_pkt_attrib->icv_len - -LLC_HEADER_SIZE - -ETH_TYPE_LEN - -PAYLOAD_TYPE_LEN - -FIXED_IE; - memcpy(&stat_code, ptr+2, 2); - - if(stat_code!=0){ - DBG_871X( "[%s] stat_code = %d\n, free_tdls_sta", __FUNCTION__, stat_code ); - free_tdls_sta(adapter, ptdls_sta); - return _FAIL; - } - - if(prx_pkt_attrib->encrypt){ - /* parsing information element */ - for(j=FIXED_IE; jElementID) - { - case _RSN_IE_2_: - prsnie=(u8*)pIE; - break; - case _VENDOR_SPECIFIC_IE_: - break; - case _FTIE_: - pftie=(u8*)pIE; - break; - case _TIMEOUT_ITVL_IE_: - ptimeout_ie=(u8*)pIE; - break; - case _HT_EXTRA_INFO_IE_: - break; - case _LINK_ID_IE_: - plinkid_ie=(u8*)pIE; - break; - default: - break; - } - - j += (pIE->Length + 2); - - } - - /* verify mic in FTIE MIC field */ - if(tdls_verify_mic(ptdls_sta->tpk.kck, 3, plinkid_ie, prsnie, ptimeout_ie, pftie)==0){ /* 0: Invalid, 1: Valid */ - free_tdls_sta(adapter, ptdls_sta); - return _FAIL; - } - - } - - ptdlsinfo->setup_state = TDLS_LINKED_STATE; - if( ptdls_sta->tdls_sta_state & TDLS_INITIATOR_STATE ) - { - ptdls_sta->tdls_sta_state|=TDLS_LINKED_STATE; - _cancel_timer_ex( &ptdls_sta->handshake_timer); -#ifdef CONFIG_TDLS_AUTOCHECKALIVE - _set_timer( &ptdls_sta->alive_timer1, TDLS_ALIVE_TIMER_PH1); -#endif /* CONFIG_TDLS_AUTOCHECKALIVE */ - } - - rtw_tdls_set_mac_id(ptdlsinfo, ptdls_sta); - rtw_tdls_set_key(adapter, prx_pkt_attrib, ptdls_sta); - - rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_WRCR); - - return _FAIL; - -} - -sint On_TDLS_Dis_Req(_adapter *adapter, union recv_frame *precv_frame) -{ - struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib; - struct sta_priv *pstapriv = &adapter->stapriv; - struct sta_info *psta_ap; - u8 *ptr = precv_frame->u.hdr.rx_data; - sint parsing_length; /* frame body length, without icv_len */ - PNDIS_802_11_VARIABLE_IEs pIE; - u8 FIXED_IE = 3, *dst, *pdialog = NULL; - u16 j; - - ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len + LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE + 1; - pdialog=ptr+2; - - parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len - -prx_pkt_attrib->hdrlen - -prx_pkt_attrib->iv_len - -prx_pkt_attrib->icv_len - -LLC_HEADER_SIZE - -TYPE_LENGTH_FIELD_SIZE - -1 - -FIXED_IE; - - /* parsing information element */ - for(j=FIXED_IE; jElementID) - { - case _LINK_ID_IE_: - psta_ap = rtw_get_stainfo(pstapriv, pIE->data); - if(psta_ap == NULL) - { - goto exit; - } - dst = pIE->data + 12; - if( (MacAddr_isBcst(dst) == false) && (_rtw_memcmp(myid(&(adapter->eeprompriv)), dst, 6) == false) ) - { - goto exit; - } - break; - default: - break; - } - - j += (pIE->Length + 2); - - } - - /* check frame contents */ - - issue_tdls_dis_rsp(adapter, precv_frame, *(pdialog) ); - -exit: - - return _FAIL; - -} - -sint On_TDLS_Teardown(_adapter *adapter, union recv_frame *precv_frame) -{ - u8 *psa; - u8 *ptr = precv_frame->u.hdr.rx_data; - struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib; - struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct sta_priv *pstapriv = &adapter->stapriv; - struct sta_info *ptdls_sta= NULL; - _irqL irqL; - - psa = get_sa(ptr); - - ptdls_sta = rtw_get_stainfo(pstapriv, psa); - if(ptdls_sta!=NULL){ - if(ptdls_sta->tdls_sta_state & TDLS_CH_SWITCH_ON_STATE){ - rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_CS_OFF); - } - free_tdls_sta(adapter, ptdls_sta); - } - - return _FAIL; - -} - -u8 TDLS_check_ch_state(uint state){ - if( (state & TDLS_CH_SWITCH_ON_STATE) && - (state & TDLS_AT_OFF_CH_STATE) && - (state & TDLS_PEER_AT_OFF_STATE) ){ - - if(state & TDLS_PEER_SLEEP_STATE) - return 2; /* U-APSD + ch. switch */ - else - return 1; /* ch. switch */ - }else - return 0; -} - -/* we process buffered data for 1. U-APSD, 2. ch. switch, 3. U-APSD + ch. switch here */ -sint On_TDLS_Peer_Traffic_Rsp(_adapter *adapter, union recv_frame *precv_frame) -{ - struct tdls_info *ptdlsinfo = &adapter->tdlsinfo; - struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; - struct rx_pkt_attrib *pattrib = & precv_frame->u.hdr.attrib; - struct sta_priv *pstapriv = &adapter->stapriv; - /* get peer sta infomation */ - struct sta_info *ptdls_sta = rtw_get_stainfo(pstapriv, pattrib->src); - u8 wmmps_ac=0, state=TDLS_check_ch_state(ptdls_sta->tdls_sta_state); - int i; - - ptdls_sta->sta_stats.rx_data_pkts++; - - /* receive peer traffic response frame, sleeping STA wakes up */ - /* ptdls_sta->tdls_sta_state &= ~(TDLS_PEER_SLEEP_STATE); */ - process_wmmps_data( adapter, precv_frame); - - /* if noticed peer STA wakes up by receiving peer traffic response */ - /* and we want to do channel swtiching, then we will transmit channel switch request first */ - if(ptdls_sta->tdls_sta_state & TDLS_APSD_CHSW_STATE){ - issue_tdls_ch_switch_req(adapter, pattrib->src); - ptdls_sta->tdls_sta_state &= ~(TDLS_APSD_CHSW_STATE); - return _FAIL; - } - - /* check 4-AC queue bit */ - if(ptdls_sta->uapsd_vo || ptdls_sta->uapsd_vi || ptdls_sta->uapsd_be || ptdls_sta->uapsd_bk) - wmmps_ac=1; - - /* if it's a direct link and have buffered frame */ - if(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE){ - if(wmmps_ac && state) - { - _irqL irqL; - _list *xmitframe_plist, *xmitframe_phead; - struct xmit_frame *pxmitframe=NULL; - - _enter_critical_bh(&ptdls_sta->sleep_q.lock, &irqL); - - xmitframe_phead = get_list_head(&ptdls_sta->sleep_q); - xmitframe_plist = get_next(xmitframe_phead); - - /* transmit buffered frames */ - while ((rtw_end_of_queue_search(xmitframe_phead, xmitframe_plist)) == false) - { - pxmitframe = LIST_CONTAINOR(xmitframe_plist, struct xmit_frame, list); - xmitframe_plist = get_next(xmitframe_plist); - rtw_list_delete(&pxmitframe->list); - - ptdls_sta->sleepq_len--; - if(ptdls_sta->sleepq_len>0){ - pxmitframe->attrib.mdata = 1; - pxmitframe->attrib.eosp = 0; - }else{ - pxmitframe->attrib.mdata = 0; - pxmitframe->attrib.eosp = 1; - } - if(adapter->HalFunc.hal_xmit(adapter, pxmitframe) == true) - rtw_os_xmit_complete(adapter, pxmitframe); - } - - if(ptdls_sta->sleepq_len==0) - { - DBG_871X("no buffered packets for tdls to xmit\n"); - /* on U-APSD + CH. switch state, when there is no buffered date to xmit, */ - /* we should go back to base channel */ - if(state==2){ - rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_CS_OFF); - }else if(ptdls_sta->tdls_sta_state&TDLS_SW_OFF_STATE){ - ptdls_sta->tdls_sta_state &= ~(TDLS_SW_OFF_STATE); - ptdlsinfo->candidate_ch= pmlmeext->cur_channel; - issue_tdls_ch_switch_req(adapter, pattrib->src); - DBG_871X("issue tdls ch switch req back to base channel\n"); - } - - } - else - { - DBG_871X("error!psta->sleepq_len=%d\n", ptdls_sta->sleepq_len); - ptdls_sta->sleepq_len=0; - } - - _exit_critical_bh(&ptdls_sta->sleep_q.lock, &irqL); - - } - - } - - return _FAIL; -} - -sint On_TDLS_Ch_Switch_Req(_adapter *adapter, union recv_frame *precv_frame) -{ - struct sta_info *ptdls_sta= NULL; - struct sta_priv *pstapriv = &adapter->stapriv; - u8 *ptr = precv_frame->u.hdr.rx_data; - struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib; - u8 *psa; - sint parsing_length; - PNDIS_802_11_VARIABLE_IEs pIE; - u8 FIXED_IE =3; - u16 j; - struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; - - psa = get_sa(ptr); - ptdls_sta = rtw_get_stainfo(pstapriv, psa); - - ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1; - parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len - -prx_pkt_attrib->hdrlen - -prx_pkt_attrib->iv_len - -prx_pkt_attrib->icv_len - -LLC_HEADER_SIZE - -ETH_TYPE_LEN - -PAYLOAD_TYPE_LEN - -FIXED_IE; - - ptdls_sta->off_ch = *(ptr+2); - - /* parsing information element */ - for(j=FIXED_IE; jElementID) - { - case _COUNTRY_IE_: - break; - case _CH_SWTICH_ANNOUNCE_: - break; - case _LINK_ID_IE_: - break; - case _CH_SWITCH_TIMING_: - memcpy(&ptdls_sta->ch_switch_time, pIE->data, 2); - memcpy(&ptdls_sta->ch_switch_timeout, pIE->data+2, 2); - default: - break; - } - - j += (pIE->Length + 2); - - } - - /* todo: check status */ - ptdls_sta->stat_code=0; - ptdls_sta->tdls_sta_state |= TDLS_CH_SWITCH_ON_STATE; - - issue_nulldata(adapter, NULL, 1, 0, 0); - - issue_tdls_ch_switch_rsp(adapter, psa); - - DBG_871X("issue tdls channel switch response\n"); - - if((ptdls_sta->tdls_sta_state & TDLS_CH_SWITCH_ON_STATE) && ptdls_sta->off_ch==pmlmeext->cur_channel){ - DBG_871X("back to base channel %x\n", pmlmeext->cur_channel); - ptdls_sta->option=7; - rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_BASE_CH); - }else{ - ptdls_sta->option=6; - rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_OFF_CH); - } - return _FAIL; -} - -sint On_TDLS_Ch_Switch_Rsp(_adapter *adapter, union recv_frame *precv_frame) -{ - struct sta_info *ptdls_sta= NULL; - struct sta_priv *pstapriv = &adapter->stapriv; - u8 *ptr = precv_frame->u.hdr.rx_data; - struct rx_pkt_attrib *prx_pkt_attrib = &precv_frame->u.hdr.attrib; - u8 *psa; - sint parsing_length; - PNDIS_802_11_VARIABLE_IEs pIE; - u8 FIXED_IE =4; - u16 stat_code, j, switch_time, switch_timeout; - struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; - - psa = get_sa(ptr); - ptdls_sta = rtw_get_stainfo(pstapriv, psa); - - /* if channel switch is running and receiving Unsolicited TDLS Channel Switch Response, */ - /* it will go back to base channel and terminate this channel switch procedure */ - if(ptdls_sta->tdls_sta_state & TDLS_CH_SWITCH_ON_STATE ){ - if(pmlmeext->cur_channel==ptdls_sta->off_ch){ - DBG_871X("back to base channel %x\n", pmlmeext->cur_channel); - ptdls_sta->option=7; - rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_OFF_CH); - }else{ - DBG_871X("receive unsolicited channel switch response \n"); - rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_CS_OFF); - } - return _FAIL; - } - - /* avoiding duplicated or unconditional ch. switch. rsp */ - if((ptdls_sta->tdls_sta_state & TDLS_CH_SW_INITIATOR_STATE) != TDLS_CH_SW_INITIATOR_STATE) - return _FAIL; - - ptr +=prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len+LLC_HEADER_SIZE+TYPE_LENGTH_FIELD_SIZE+1; - parsing_length= ((union recv_frame *)precv_frame)->u.hdr.len - -prx_pkt_attrib->hdrlen - -prx_pkt_attrib->iv_len - -prx_pkt_attrib->icv_len - -LLC_HEADER_SIZE - -ETH_TYPE_LEN - -PAYLOAD_TYPE_LEN - -FIXED_IE; - - memcpy(&stat_code, ptr+2, 2); - - if(stat_code!=0){ - return _FAIL; - } - - /* parsing information element */ - for(j=FIXED_IE; jElementID) - { - case _LINK_ID_IE_: - break; - case _CH_SWITCH_TIMING_: - memcpy(&switch_time, pIE->data, 2); - if(switch_time > ptdls_sta->ch_switch_time) - memcpy(&ptdls_sta->ch_switch_time, &switch_time, 2); - - memcpy(&switch_timeout, pIE->data+2, 2); - if(switch_timeout > ptdls_sta->ch_switch_timeout) - memcpy(&ptdls_sta->ch_switch_timeout, &switch_timeout, 2); - - default: - break; - } - - j += (pIE->Length + 2); - - } - - ptdls_sta->tdls_sta_state &= ~(TDLS_CH_SW_INITIATOR_STATE); - ptdls_sta->tdls_sta_state |=TDLS_CH_SWITCH_ON_STATE; - - /* goto set_channel_workitem_callback() */ - ptdls_sta->option=6; - rtw_tdls_cmd(adapter, ptdls_sta->hwaddr, TDLS_OFF_CH); - - return _FAIL; -} - -#ifdef CONFIG_P2P -void wfd_ie_tdls(_adapter * padapter, u8 *pframe, u32 *pktlen ) -{ - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct wifi_display_info *pwfd_info = padapter->tdlsinfo.wfd_info; - u8 wfdie[ MAX_WFD_IE_LEN] = { 0x00 }; - u32 wfdielen = 0; - - /* WFD OUI */ - wfdielen = 0; - wfdie[ wfdielen++ ] = 0x50; - wfdie[ wfdielen++ ] = 0x6F; - wfdie[ wfdielen++ ] = 0x9A; - wfdie[ wfdielen++ ] = 0x0A; /* WFA WFD v1.0 */ - - /* Commented by Albert 20110825 */ - /* According to the WFD Specification, the negotiation request frame should contain 3 WFD attributes */ - /* 1. WFD Device Information */ - /* 2. Associated BSSID ( Optional ) */ - /* 3. Local IP Adress ( Optional ) */ - - /* WFD Device Information ATTR */ - /* Type: */ - wfdie[ wfdielen++ ] = WFD_ATTR_DEVICE_INFO; - - /* Length: */ - /* Note: In the WFD specification, the size of length field is 2. */ - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); - wfdielen += 2; - - /* Value1: */ - /* WFD device information */ - /* available for WFD session + Preferred TDLS + WSD ( WFD Service Discovery ) */ - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_SESSION_AVAIL - | WFD_DEVINFO_PC_TDLS | WFD_DEVINFO_WSD); - wfdielen += 2; - - /* Value2: */ - /* Session Management Control Port */ - /* Default TCP port for RTSP messages is 554 */ - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->rtsp_ctrlport ); - wfdielen += 2; - - /* Value3: */ - /* WFD Device Maximum Throughput */ - /* 300Mbps is the maximum throughput */ - RTW_PUT_BE16(wfdie + wfdielen, 300); - wfdielen += 2; - - /* Associated BSSID ATTR */ - /* Type: */ - wfdie[ wfdielen++ ] = WFD_ATTR_ASSOC_BSSID; - - /* Length: */ - /* Note: In the WFD specification, the size of length field is 2. */ - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); - wfdielen += 2; - - /* Value: */ - /* Associated BSSID */ - if ( check_fwstate( pmlmepriv, _FW_LINKED) == true ) - { - memcpy( wfdie + wfdielen, &pmlmepriv->assoc_bssid[ 0 ], ETH_ALEN ); - } - else - { - memset( wfdie + wfdielen, 0x00, ETH_ALEN ); - } - - /* Local IP Address ATTR */ - wfdie[ wfdielen++ ] = WFD_ATTR_LOCAL_IP_ADDR; - - /* Length: */ - /* Note: In the WFD specification, the size of length field is 2. */ - RTW_PUT_BE16(wfdie + wfdielen, 0x0005); - wfdielen += 2; - - /* Version: */ - /* 0x01: Version1;IPv4 */ - wfdie[ wfdielen++ ] = 0x01; - - /* IPv4 Address */ - memcpy( wfdie + wfdielen, pwfd_info->ip_address, 4 ); - wfdielen += 4; - - pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, pktlen); - -} -#endif /* CONFIG_P2P */ - -void rtw_build_tdls_setup_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) -{ - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; - struct pkt_attrib *pattrib = &pxmitframe->attrib; - struct registry_priv *pregistrypriv = &padapter->registrypriv; - struct sta_info *ptdls_sta=rtw_get_stainfo( (&padapter->stapriv) , pattrib->dst); - - u8 payload_type = 0x02; - u8 category = RTW_WLAN_CATEGORY_TDLS; - u8 action = TDLS_SETUP_REQUEST; - u8 bssrate[NDIS_802_11_LENGTH_RATES_EX]; /* Use NDIS_802_11_LENGTH_RATES_EX in order to call func.rtw_set_supported_rate */ - int bssrate_len = 0, i = 0 ; - u8 more_supportedrates = 0; - unsigned int ie_len; - u8 *p; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - u8 link_id_addr[18] = {0}; - u8 iedata=0; - u8 sup_ch[ 30 * 2 ] = {0x00 }, sup_ch_idx = 0, idx_5g = 2; /* For supported channel */ - u8 timeout_itvl[5]; /* set timeout interval to maximum value */ - u32 time; - - /* SNonce */ - if(pattrib->encrypt){ - for(i=0;i<8;i++){ - time=rtw_get_current_time(); - memcpy(&ptdls_sta->SNonce[4*i], (u8 *)&time, 4); - } - } - - /* payload type */ - pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); - /* category, action, dialog token */ - pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(ptdls_sta->dialog), &(pattrib->pktlen)); - - /* capability */ - memcpy(pframe, rtw_get_capability_from_ie(pmlmeinfo->network.IEs), 2); - - if(pattrib->encrypt) - *pframe =*pframe | BIT(4); - pframe += 2; - pattrib->pktlen += 2; - - /* supported rates */ - rtw_set_supported_rate(bssrate, WIRELESS_11BG_24N); - bssrate_len = IEEE80211_CCK_RATE_LEN + IEEE80211_NUM_OFDM_RATESLEN; - - if (bssrate_len > 8) - { - pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , 8, bssrate, &(pattrib->pktlen)); - more_supportedrates = 1; - } - else - { - pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , bssrate_len , bssrate, &(pattrib->pktlen)); - } - - /* country(optional) */ - /* extended supported rates */ - if(more_supportedrates==1){ - pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_ , (bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen)); - } - - /* supported channels */ - pframe = rtw_tdls_set_sup_ch(pmlmeext, pframe, pattrib); - - /* SRC IE */ - pframe = rtw_set_ie( pframe, _SRC_IE_, 16, TDLS_SRC, &(pattrib->pktlen)); - - /* RSNIE */ - if(pattrib->encrypt) - pframe = rtw_set_ie(pframe, _RSN_IE_2_, 20, TDLS_RSNIE, &(pattrib->pktlen)); - - /* extended capabilities */ - pframe = rtw_set_ie(pframe, _EXT_CAP_IE_ , 5, TDLS_EXT_CAPIE, &(pattrib->pktlen)); - - /* QoS capability(WMM_IE) */ - pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, 7, TDLS_WMMIE, &(pattrib->pktlen)); - - - if(pattrib->encrypt){ - /* FTIE */ - memset(pframe, 0, 84); /* All fields except SNonce shall be set to 0 */ - memset(pframe, _FTIE_, 1); /* version */ - memset((pframe+1), 82, 1); /* length */ - memcpy((pframe+52), ptdls_sta->SNonce, 32); - pframe += 84; - pattrib->pktlen += 84; - - /* Timeout interval */ - timeout_itvl[0]=0x02; - memcpy(timeout_itvl+1, (u8 *)(&ptdls_sta->TDLS_PeerKey_Lifetime), 4); - pframe = rtw_set_ie(pframe, _TIMEOUT_ITVL_IE_, 5, timeout_itvl, &(pattrib->pktlen)); - } - - /* Sup_reg_classes(optional) */ - /* HT capabilities */ - pframe = rtw_tdls_set_ht_cap(padapter, pframe, pattrib); - - /* 20/40 BSS coexistence */ - if(pmlmepriv->num_FortyMHzIntolerant>0) - iedata |= BIT(2);/* 20 MHz BSS Width Request */ - pframe = rtw_set_ie(pframe, EID_BSSCoexistence, 1, &iedata, &(pattrib->pktlen)); - - /* Link identifier */ - memcpy(link_id_addr, pattrib->ra, 6); - memcpy((link_id_addr+6), pattrib->src, 6); - memcpy((link_id_addr+12), pattrib->dst, 6); - pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); - -#ifdef CONFIG_P2P - wfd_ie_tdls( padapter, pframe, &(pattrib->pktlen) ); -#endif /* CONFIG_P2P */ - -} - -void rtw_build_tdls_setup_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) -{ - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct pkt_attrib *pattrib = &pxmitframe->attrib; - struct sta_info *ptdls_sta; - struct registry_priv *pregistrypriv = &padapter->registrypriv; - - u8 payload_type = 0x02; - unsigned char category = RTW_WLAN_CATEGORY_TDLS; - unsigned char action = TDLS_SETUP_RESPONSE; - unsigned char bssrate[NDIS_802_11_LENGTH_RATES_EX]; - int bssrate_len = 0; - u8 more_supportedrates = 0; - unsigned int ie_len; - unsigned char *p; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - u8 link_id_addr[18] = {0}; - u8 iedata=0; - u8 timeout_itvl[5]; /* setup response timeout interval will copy from request */ - u8 ANonce[32]; /* maybe it can put in ontdls_req */ - u8 k; /* for random ANonce */ - u8 *pftie, *ptimeout_ie, *plinkid_ie, *prsnie, *pftie_mic; - u32 time; - - ptdls_sta = rtw_get_stainfo( &(padapter->stapriv) , pattrib->dst); - - if(ptdls_sta == NULL ) - { - DBG_871X("[%s] %d\n", __FUNCTION__, __LINE__); - return; - } - - if(pattrib->encrypt){ - for(k=0;k<8;k++){ - time=rtw_get_current_time(); - memcpy(&ptdls_sta->ANonce[4*k], (u8*)&time, 4); - } - } - - /* payload type */ - pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); - /* category, action, status code */ - pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 2, (u8 *)&ptdls_sta->stat_code, &(pattrib->pktlen)); - - if(ptdls_sta->stat_code!=0) /* invalid setup request */ - { - DBG_871X("ptdls_sta->stat_code:%04x \n", ptdls_sta->stat_code); - return; - } - - /* dialog token */ - pframe = rtw_set_fixed_ie(pframe, 1, &(ptdls_sta->dialog), &(pattrib->pktlen)); - - /* capability */ - memcpy(pframe, rtw_get_capability_from_ie(pmlmeinfo->network.IEs), 2); - - if(pattrib->encrypt ) - *pframe =*pframe | BIT(4); - pframe += 2; - pattrib->pktlen += 2; - - /* supported rates */ - rtw_set_supported_rate(bssrate, WIRELESS_11BG_24N); - bssrate_len = IEEE80211_CCK_RATE_LEN + IEEE80211_NUM_OFDM_RATESLEN; - - if (bssrate_len > 8) - { - pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , 8, bssrate, &(pattrib->pktlen)); - more_supportedrates = 1; - } - else - { - pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , bssrate_len , bssrate, &(pattrib->pktlen)); - } - - /* country(optional) */ - /* extended supported rates */ - if(more_supportedrates==1){ - pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_ , (bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen)); - } - - /* supported channels */ - pframe = rtw_tdls_set_sup_ch(pmlmeext, pframe, pattrib); - - /* SRC IE */ - pframe = rtw_set_ie(pframe, _SRC_IE_ , 16, TDLS_SRC, &(pattrib->pktlen)); - - /* RSNIE */ - if(pattrib->encrypt){ - prsnie = pframe; - pframe = rtw_set_ie(pframe, _RSN_IE_2_, 20, TDLS_RSNIE, &(pattrib->pktlen)); - } - - /* extended capabilities */ - pframe = rtw_set_ie(pframe, _EXT_CAP_IE_ , 5, TDLS_EXT_CAPIE, &(pattrib->pktlen)); - - /* QoS capability(WMM_IE) */ - pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, 7, TDLS_WMMIE, &(pattrib->pktlen)); - - if(pattrib->encrypt){ - wpa_tdls_generate_tpk(padapter, ptdls_sta); - - /* FTIE */ - pftie = pframe; - pftie_mic = pframe+4; - memset(pframe, 0, 84); /* All fields except SNonce shall be set to 0 */ - memset(pframe, _FTIE_, 1); /* version */ - memset((pframe+1), 82, 1); /* length */ - memcpy((pframe+20), ptdls_sta->ANonce, 32); - memcpy((pframe+52), ptdls_sta->SNonce, 32); - pframe += 84; - pattrib->pktlen += 84; - - /* Timeout interval */ - ptimeout_ie = pframe; - timeout_itvl[0]=0x02; - memcpy(timeout_itvl+1, (u8 *)(&ptdls_sta->TDLS_PeerKey_Lifetime), 4); - pframe = rtw_set_ie(pframe, _TIMEOUT_ITVL_IE_, 5, timeout_itvl, &(pattrib->pktlen)); - } - - /* Sup_reg_classes(optional) */ - /* HT capabilities */ - pframe = rtw_tdls_set_ht_cap(padapter, pframe, pattrib); - - /* 20/40 BSS coexistence */ - if(pmlmepriv->num_FortyMHzIntolerant>0) - iedata |= BIT(2);/* 20 MHz BSS Width Request */ - pframe = rtw_set_ie(pframe, EID_BSSCoexistence, 1, &iedata, &(pattrib->pktlen)); - - /* Link identifier */ - plinkid_ie = pframe; - memcpy(link_id_addr, pattrib->ra, 6); - memcpy((link_id_addr+6), pattrib->dst, 6); - memcpy((link_id_addr+12), pattrib->src, 6); - pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); - - /* fill FTIE mic */ - if(pattrib->encrypt) - wpa_tdls_ftie_mic(ptdls_sta->tpk.kck, 2, plinkid_ie, prsnie, ptimeout_ie, pftie, pftie_mic); - -#ifdef CONFIG_P2P - wfd_ie_tdls( padapter, pframe, &(pattrib->pktlen) ); -#endif /* CONFIG_P2P */ - -} - -void rtw_build_tdls_setup_cfm_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) -{ - - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct pkt_attrib *pattrib = &pxmitframe->attrib; - struct sta_info *ptdls_sta=rtw_get_stainfo( (&padapter->stapriv) , pattrib->dst); - - u8 payload_type = 0x02; - unsigned char category = RTW_WLAN_CATEGORY_TDLS; - unsigned char action = TDLS_SETUP_CONFIRM; - u8 more_supportedrates = 0; - unsigned int ie_len; - unsigned char *p; - u8 timeout_itvl[5]; /* set timeout interval to maximum value */ - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - u8 link_id_addr[18] = {0}; - u8 *pftie, *ptimeout_ie, *plinkid_ie, *prsnie, *pftie_mic; - - /* payload type */ - pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); - /* category, action, status code, dialog token */ - pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 2, (u8 *)&ptdls_sta->stat_code, &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(ptdls_sta->dialog), &(pattrib->pktlen)); - - if(ptdls_sta->stat_code!=0) /* invalid setup request */ - return; - - /* RSNIE */ - if(pattrib->encrypt){ - prsnie = pframe; - pframe = rtw_set_ie(pframe, _RSN_IE_2_, 20, TDLS_RSNIE, &(pattrib->pktlen)); - } - - /* EDCA param set; WMM param ele. */ - if(pattrib->encrypt){ - /* FTIE */ - pftie = pframe; - pftie_mic = pframe+4; - memset(pframe, 0, 84); /* All fields except SNonce shall be set to 0 */ - memset(pframe, _FTIE_, 1); /* version */ - memset((pframe+1), 82, 1); /* length */ - memcpy((pframe+20), ptdls_sta->ANonce, 32); - memcpy((pframe+52), ptdls_sta->SNonce, 32); - pframe += 84; - pattrib->pktlen += 84; - - /* Timeout interval */ - ptimeout_ie = pframe; - timeout_itvl[0]=0x02; - memcpy(timeout_itvl+1, (u8 *)(&ptdls_sta->TDLS_PeerKey_Lifetime), 4); - ptdls_sta->TPK_count=0; - _set_timer(&ptdls_sta->TPK_timer, ptdls_sta->TDLS_PeerKey_Lifetime/TPK_RESEND_COUNT); - pframe = rtw_set_ie(pframe, _TIMEOUT_ITVL_IE_, 5, timeout_itvl, &(pattrib->pktlen)); - } - - /* HT operation; todo */ - /* Link identifier */ - plinkid_ie = pframe; - memcpy(link_id_addr, pattrib->ra, 6); - memcpy((link_id_addr+6), pattrib->src, 6); - memcpy((link_id_addr+12), pattrib->dst, 6); - pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); - - /* fill FTIE mic */ - if(pattrib->encrypt) - wpa_tdls_ftie_mic(ptdls_sta->tpk.kck, 3, plinkid_ie, prsnie, ptimeout_ie, pftie, pftie_mic); - -} - -void rtw_build_tdls_teardown_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) -{ - - struct pkt_attrib *pattrib = &pxmitframe->attrib; - u8 payload_type = 0x02; - unsigned char category = RTW_WLAN_CATEGORY_TDLS; - unsigned char action = TDLS_TEARDOWN; - u8 link_id_addr[18] = {0}; - - struct sta_info *ptdls_sta = rtw_get_stainfo( &(padapter->stapriv) , pattrib->dst); - struct sta_priv *pstapriv = &padapter->stapriv; - - /* payload type */ - pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); - /* category, action, reason code */ - pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, (u8 *)&ptdls_sta->stat_code, &(pattrib->pktlen)); - - /* Link identifier */ - if(ptdls_sta->tdls_sta_state & TDLS_INITIATOR_STATE){ - memcpy(link_id_addr, pattrib->ra, 6); - memcpy((link_id_addr+6), pattrib->src, 6); - memcpy((link_id_addr+12), pattrib->dst, 6); - }else if(ptdls_sta->tdls_sta_state & TDLS_RESPONDER_STATE){ - memcpy(link_id_addr, pattrib->ra, 6); - memcpy((link_id_addr+6), pattrib->dst, 6); - memcpy((link_id_addr+12), pattrib->src, 6); - } - pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); - -} - -void rtw_build_tdls_dis_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) -{ - - struct pkt_attrib *pattrib = &pxmitframe->attrib; - u8 payload_type = 0x02; - u8 category = RTW_WLAN_CATEGORY_TDLS; - u8 action = TDLS_DISCOVERY_REQUEST; - u8 link_id_addr[18] = {0}; - static u8 dialogtoken=0; - - /* payload type */ - pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); - /* category, action, reason code */ - pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(dialogtoken), &(pattrib->pktlen)); - dialogtoken = (dialogtoken+1)%256; - - /* Link identifier */ - memcpy(link_id_addr, pattrib->ra, 6); - memcpy((link_id_addr+6), pattrib->src, 6); - memcpy((link_id_addr+12), pattrib->dst, 6); - pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); - -} - -void rtw_build_tdls_dis_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, u8 dialog) -{ - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; - struct pkt_attrib *pattrib = &pxmitframe->attrib; - struct registry_priv *pregistrypriv = &padapter->registrypriv; - - u8 category = RTW_WLAN_CATEGORY_PUBLIC; - u8 action = TDLS_DISCOVERY_RESPONSE; - u8 bssrate[NDIS_802_11_LENGTH_RATES_EX]; - int bssrate_len = 0; - u8 more_supportedrates = 0; - u8 *p; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - u8 link_id_addr[18] = {0}; - u8 iedata=0; - u8 timeout_itvl[5]; /* set timeout interval to maximum value */ - u32 timeout_interval= TPK_RESEND_COUNT * 1000; - - /* category, action, dialog token */ - pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(dialog), &(pattrib->pktlen)); - - /* capability */ - memcpy(pframe, rtw_get_capability_from_ie(pmlmeinfo->network.IEs), 2); - - if(pattrib->encrypt) - *pframe =*pframe | BIT(4); - pframe += 2; - pattrib->pktlen += 2; - - /* supported rates */ - rtw_set_supported_rate(bssrate, WIRELESS_11BG_24N); - bssrate_len = IEEE80211_CCK_RATE_LEN + IEEE80211_NUM_OFDM_RATESLEN; - - if (bssrate_len > 8) - { - pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , 8, bssrate, &(pattrib->pktlen)); - more_supportedrates = 1; - } - else - { - pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , bssrate_len , bssrate, &(pattrib->pktlen)); - } - - /* extended supported rates */ - if(more_supportedrates==1){ - pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_ , (bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen)); - } - - /* supported channels */ - pframe = rtw_tdls_set_sup_ch(pmlmeext, pframe, pattrib); - - /* RSNIE */ - if(pattrib->encrypt) - pframe = rtw_set_ie(pframe, _RSN_IE_2_, 20, TDLS_RSNIE, &(pattrib->pktlen)); - - /* extended capability */ - pframe = rtw_set_ie(pframe, _EXT_CAP_IE_ , 5, TDLS_EXT_CAPIE, &(pattrib->pktlen)); - - if(pattrib->encrypt){ - /* FTIE */ - memset(pframe, 0, 84); /* All fields shall be set to 0 */ - memset(pframe, _FTIE_, 1); /* version */ - memset((pframe+1), 82, 1); /* length */ - pframe += 84; - pattrib->pktlen += 84; - - /* Timeout interval */ - timeout_itvl[0]=0x02; - memcpy(timeout_itvl+1, &timeout_interval, 4); - pframe = rtw_set_ie(pframe, _TIMEOUT_ITVL_IE_, 5, timeout_itvl, &(pattrib->pktlen)); - } - - /* Sup_reg_classes(optional) */ - /* HT capabilities */ - pframe = rtw_tdls_set_ht_cap(padapter, pframe, pattrib); - - /* 20/40 BSS coexistence */ - if(pmlmepriv->num_FortyMHzIntolerant>0) - iedata |= BIT(2);/* 20 MHz BSS Width Request */ - pframe = rtw_set_ie(pframe, EID_BSSCoexistence, 1, &iedata, &(pattrib->pktlen)); - - /* Link identifier */ - memcpy(link_id_addr, pattrib->ra, 6); - memcpy((link_id_addr+6), pattrib->dst, 6); - memcpy((link_id_addr+12), pattrib->src, 6); - pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); - -} - -void rtw_build_tdls_peer_traffic_indication_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) -{ - - struct pkt_attrib *pattrib = &pxmitframe->attrib; - u8 payload_type = 0x02; - unsigned char category = RTW_WLAN_CATEGORY_TDLS; - unsigned char action = TDLS_PEER_TRAFFIC_INDICATION; - - u8 link_id_addr[18] = {0}; - u8 AC_queue=0; - struct sta_priv *pstapriv = &padapter->stapriv; - struct sta_info *ptdls_sta = rtw_get_stainfo(pstapriv, pattrib->dst); - - /* payload type */ - pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); - /* category, action, reason code */ - pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(ptdls_sta->dialog), &(pattrib->pktlen)); - - /* Link identifier */ - memcpy(link_id_addr, pattrib->ra, 6); - memcpy((link_id_addr+6), pattrib->src, 6); - memcpy((link_id_addr+12), pattrib->dst, 6); - pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); - - /* PTI control */ - /* PU buffer status */ - if(ptdls_sta->uapsd_bk&BIT(1)) - AC_queue=BIT(0); - if(ptdls_sta->uapsd_be&BIT(1)) - AC_queue=BIT(1); - if(ptdls_sta->uapsd_vi&BIT(1)) - AC_queue=BIT(2); - if(ptdls_sta->uapsd_vo&BIT(1)) - AC_queue=BIT(3); - pframe = rtw_set_ie(pframe, _PTI_BUFFER_STATUS_, 1, &AC_queue, &(pattrib->pktlen)); - -} - -void rtw_build_tdls_ch_switch_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) -{ - - struct pkt_attrib *pattrib = &pxmitframe->attrib; - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - u8 payload_type = 0x02; - unsigned char category = RTW_WLAN_CATEGORY_TDLS; - unsigned char action = TDLS_CHANNEL_SWITCH_REQUEST; - u8 link_id_addr[18] = {0}; - struct sta_priv *pstapriv = &padapter->stapriv; - struct sta_info *ptdls_sta = rtw_get_stainfo(pstapriv, pattrib->dst); - u8 ch_switch_timing[4] = {0}; - u16 switch_time= CH_SWITCH_TIME, switch_timeout=CH_SWITCH_TIMEOUT; - - /* payload type */ - pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); - /* category, action, target_ch */ - pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(ptdlsinfo->candidate_ch), &(pattrib->pktlen)); - - /* Link identifier */ - memcpy(link_id_addr, pattrib->ra, 6); - memcpy((link_id_addr+6), pattrib->src, 6); - memcpy((link_id_addr+12), pattrib->dst, 6); - pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); - - /* ch switch timing */ - memcpy(ch_switch_timing, &switch_time, 2); - memcpy(ch_switch_timing+2, &switch_timeout, 2); - pframe = rtw_set_ie(pframe, _CH_SWITCH_TIMING_, 4, ch_switch_timing, &(pattrib->pktlen)); - - /* update ch switch attrib to sta_info */ - ptdls_sta->off_ch=ptdlsinfo->candidate_ch; - ptdls_sta->ch_switch_time=switch_time; - ptdls_sta->ch_switch_timeout=switch_timeout; - -} - -void rtw_build_tdls_ch_switch_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) -{ - - struct pkt_attrib *pattrib = &pxmitframe->attrib; - u8 payload_type = 0x02; - unsigned char category = RTW_WLAN_CATEGORY_TDLS; - unsigned char action = TDLS_CHANNEL_SWITCH_RESPONSE; - u8 link_id_addr[18] = {0}; - struct sta_priv *pstapriv = &padapter->stapriv; - struct sta_info *ptdls_sta = rtw_get_stainfo(pstapriv, pattrib->dst); - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; - u8 ch_switch_timing[4] = {0}; - - /* payload type */ - pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); - /* category, action, status_code */ - pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 2, (u8 *)&ptdls_sta->stat_code, &(pattrib->pktlen)); - - /* Link identifier */ - memcpy(link_id_addr, pattrib->ra, 6); - memcpy((link_id_addr+6), pattrib->src, 6); - memcpy((link_id_addr+12), pattrib->dst, 6); - pframe = rtw_set_ie(pframe, _LINK_ID_IE_, 18, link_id_addr, &(pattrib->pktlen)); - - /* ch switch timing */ - memcpy(ch_switch_timing, &ptdls_sta->ch_switch_time, 2); - memcpy(ch_switch_timing+2, &ptdls_sta->ch_switch_timeout, 2); - pframe = rtw_set_ie(pframe, _CH_SWITCH_TIMING_, 4, ch_switch_timing, &(pattrib->pktlen)); - -} - -#ifdef CONFIG_P2P -void rtw_build_tunneled_probe_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) -{ - - struct pkt_attrib *pattrib = &pxmitframe->attrib; - struct wifidirect_info *pwdinfo = &padapter->wdinfo; - struct wifidirect_info *pbuddy_wdinfo = &padapter->pbuddy_adapter->wdinfo; - u8 payload_type = 0x02; - u8 category = RTW_WLAN_CATEGORY_P2P; - u8 WFA_OUI[3] = { 0x50, 0x6f, 0x9a}; - u8 probe_req = 4; - u8 wfdielen = 0; - - /* payload type */ - pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); - /* category, OUI, frame_body_type */ - pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 3, WFA_OUI, &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(probe_req), &(pattrib->pktlen)); - - if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) - { - wfdielen = build_probe_req_wfd_ie(pwdinfo, pframe); - pframe += wfdielen; - pattrib->pktlen += wfdielen; - } - else if(!rtw_p2p_chk_state(pbuddy_wdinfo, P2P_STATE_NONE)) - { - wfdielen = build_probe_req_wfd_ie(pbuddy_wdinfo, pframe); - pframe += wfdielen; - pattrib->pktlen += wfdielen; - } - -} - -void rtw_build_tunneled_probe_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe) -{ - - struct pkt_attrib *pattrib = &pxmitframe->attrib; - struct wifidirect_info *pwdinfo = &padapter->wdinfo; - struct wifidirect_info *pbuddy_wdinfo = &padapter->pbuddy_adapter->wdinfo; - u8 payload_type = 0x02; - u8 category = RTW_WLAN_CATEGORY_P2P; - u8 WFA_OUI[3] = { 0x50, 0x6f, 0x9a}; - u8 probe_rsp = 5; - u8 wfdielen = 0; - - /* payload type */ - pframe = rtw_set_fixed_ie(pframe, 1, &(payload_type), &(pattrib->pktlen)); - /* category, OUI, frame_body_type */ - pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 3, WFA_OUI, &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 1, &(probe_rsp), &(pattrib->pktlen)); - - if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) - { - wfdielen = build_probe_resp_wfd_ie(pwdinfo, pframe, 1); - pframe += wfdielen; - pattrib->pktlen += wfdielen; - } - else if(!rtw_p2p_chk_state(pbuddy_wdinfo, P2P_STATE_NONE)) - { - wfdielen = build_probe_resp_wfd_ie(pbuddy_wdinfo, pframe, 1); - pframe += wfdielen; - pattrib->pktlen += wfdielen; - } - -} -#endif /* CONFIG_P2P */ - -void _TPK_timer_hdl(void *FunctionContext) -{ - struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext; - - ptdls_sta->TPK_count++; - /* TPK_timer set 1000 as default */ - /* retry timer should set at least 301 sec. */ - if(ptdls_sta->TPK_count==TPK_RESEND_COUNT){ - ptdls_sta->TPK_count=0; - issue_tdls_setup_req(ptdls_sta->padapter, ptdls_sta->hwaddr); - } - - _set_timer(&ptdls_sta->TPK_timer, ptdls_sta->TDLS_PeerKey_Lifetime/TPK_RESEND_COUNT); -} - -void init_TPK_timer(_adapter *padapter, struct sta_info *psta) -{ - psta->padapter=padapter; - - _init_timer(&psta->TPK_timer, padapter->pnetdev, _TPK_timer_hdl, psta); -} - -/* TDLS_DONE_CH_SEN: channel sensing and report candidate channel */ -/* TDLS_OFF_CH: first time set channel to off channel */ -/* TDLS_BASE_CH: when go back to the channel linked with AP, send null data to peer STA as an indication */ -void _ch_switch_timer_hdl(void *FunctionContext) -{ - - struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext; - _adapter *padapter = ptdls_sta->padapter; - - if( ptdls_sta->option == TDLS_DONE_CH_SEN ){ - rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_DONE_CH_SEN); - }else if( ptdls_sta->option == TDLS_OFF_CH ){ - issue_nulldata_to_TDLS_peer_STA(ptdls_sta->padapter, ptdls_sta, 0); - _set_timer(&ptdls_sta->base_ch_timer, 500); - }else if( ptdls_sta->option == TDLS_BASE_CH){ - issue_nulldata_to_TDLS_peer_STA(ptdls_sta->padapter, ptdls_sta, 0); - } -} - -void init_ch_switch_timer(_adapter *padapter, struct sta_info *psta) -{ - psta->padapter=padapter; - _init_timer(&psta->option_timer, padapter->pnetdev, _ch_switch_timer_hdl, psta); -} - -void _base_ch_timer_hdl(void *FunctionContext) -{ - struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext; - rtw_tdls_cmd(ptdls_sta->padapter, ptdls_sta->hwaddr, TDLS_P_OFF_CH); -} - -void init_base_ch_timer(_adapter *padapter, struct sta_info *psta) -{ - psta->padapter=padapter; - _init_timer(&psta->base_ch_timer, padapter->pnetdev, _base_ch_timer_hdl, psta); -} - -void _off_ch_timer_hdl(void *FunctionContext) -{ - struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext; - rtw_tdls_cmd(ptdls_sta->padapter, ptdls_sta->hwaddr, TDLS_P_BASE_CH ); -} - -void init_off_ch_timer(_adapter *padapter, struct sta_info *psta) -{ - psta->padapter=padapter; - _init_timer(&psta->off_ch_timer, padapter->pnetdev, _off_ch_timer_hdl, psta); -} - -void _tdls_handshake_timer_hdl(void *FunctionContext) -{ - struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext; - - if(ptdls_sta != NULL) - { - if( !(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE) ) - { - DBG_871X("tdls handshake time out\n"); - free_tdls_sta(ptdls_sta->padapter, ptdls_sta); - } - } -} - -void init_handshake_timer(_adapter *padapter, struct sta_info *psta) -{ - psta->padapter=padapter; - _init_timer(&psta->handshake_timer, padapter->pnetdev, _tdls_handshake_timer_hdl, psta); -} - -/* Check tdls peer sta alive. */ -void _tdls_alive_timer_phase1_hdl(void *FunctionContext) -{ - _irqL irqL; - struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext; - _adapter *padapter = ptdls_sta->padapter; - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - - _enter_critical_bh(&ptdlsinfo->hdl_lock, &irqL); - ptdls_sta->timer_flag = 1; - _exit_critical_bh(&ptdlsinfo->hdl_lock, &irqL); - - ptdls_sta->tdls_sta_state &= (~TDLS_ALIVE_STATE); - - DBG_871X("issue_tdls_dis_req to check alive\n"); - issue_tdls_dis_req( padapter, ptdls_sta->hwaddr); - rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_CKALV_PH1); - sta_update_last_rx_pkts(ptdls_sta); - - if ( ptdls_sta->timer_flag == 2 ) - rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_FREE_STA); - else - { - _enter_critical_bh(&ptdlsinfo->hdl_lock, &irqL); - ptdls_sta->timer_flag = 0; - _exit_critical_bh(&ptdlsinfo->hdl_lock, &irqL); - } - -} - -void _tdls_alive_timer_phase2_hdl(void *FunctionContext) -{ - _irqL irqL; - struct sta_info *ptdls_sta = (struct sta_info *)FunctionContext; - _adapter *padapter = ptdls_sta->padapter; - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - - _enter_critical_bh(&(ptdlsinfo->hdl_lock), &irqL); - ptdls_sta->timer_flag = 1; - _exit_critical_bh(&ptdlsinfo->hdl_lock, &irqL); - - if( (ptdls_sta->tdls_sta_state & TDLS_ALIVE_STATE) && - (sta_last_rx_pkts(ptdls_sta) + 3 <= sta_rx_pkts(ptdls_sta)) ) - { - DBG_871X("TDLS STA ALIVE, ptdls_sta->sta_stats.last_rx_pkts:%llu, ptdls_sta->sta_stats.rx_pkts:%llu\n", - sta_last_rx_pkts(ptdls_sta), sta_rx_pkts(ptdls_sta)); - - ptdls_sta->alive_count = 0; - rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_CKALV_PH2); - } - else - { - if( !(ptdls_sta->tdls_sta_state & TDLS_ALIVE_STATE) ) - DBG_871X("TDLS STA TOO FAR\n"); - if( !(sta_last_rx_pkts(ptdls_sta) + 3 <= sta_rx_pkts(ptdls_sta))) - DBG_871X("TDLS LINK WITH LOW TRAFFIC, ptdls_sta->sta_stats.last_rx_pkts:%llu, ptdls_sta->sta_stats.rx_pkts:%llu\n", - sta_last_rx_pkts(ptdls_sta), sta_rx_pkts(ptdls_sta)); - - ptdls_sta->alive_count++; - if( ptdls_sta->alive_count == TDLS_ALIVE_COUNT ) - { - ptdls_sta->stat_code = _RSON_TDLS_TEAR_TOOFAR_; - issue_tdls_teardown(padapter, ptdls_sta->hwaddr); - } - else - { - rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_CKALV_PH2); - } - } - - if ( ptdls_sta->timer_flag == 2 ) - rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_FREE_STA); - else - { - _enter_critical_bh(&(ptdlsinfo->hdl_lock), &irqL); - ptdls_sta->timer_flag = 0; - _exit_critical_bh(&ptdlsinfo->hdl_lock, &irqL); -} - -} - -void init_tdls_alive_timer(_adapter *padapter, struct sta_info *psta) -{ - psta->padapter=padapter; - _init_timer(&psta->alive_timer1, padapter->pnetdev, _tdls_alive_timer_phase1_hdl, psta); - _init_timer(&psta->alive_timer2, padapter->pnetdev, _tdls_alive_timer_phase2_hdl, psta); -} - -int update_sgi_tdls(_adapter *padapter, struct sta_info *psta) -{ - struct ht_priv *psta_ht = NULL; - psta_ht = &psta->htpriv; - - if(psta_ht->ht_option) - { - return psta_ht->sgi; - } - else - return false; -} - -u32 update_mask_tdls(_adapter *padapter, struct sta_info *psta) -{ - int i; - u8 rf_type, id; - unsigned char sta_band = 0; - unsigned char limit; - unsigned int tx_ra_bitmap=0; - struct ht_priv *psta_ht = NULL; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - WLAN_BSSID_EX *pcur_network = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network; - - psta_ht = &psta->htpriv; - /* b/g mode ra_bitmap */ - for (i=0; ibssrateset); i++) - { - if (psta->bssrateset[i]) - tx_ra_bitmap |= rtw_get_bit_value_from_ieee_value(psta->bssrateset[i]&0x7f); - } - - /* n mode ra_bitmap */ - if(psta_ht->ht_option) - { - padapter->HalFunc.GetHwRegHandler(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); - if(rf_type == RF_2T2R) - limit=16;/* 2R */ - else - limit=8;/* 1R */ - - for (i=0; iht_cap.supp_mcs_set[i/8] & BIT(i%8)) - tx_ra_bitmap |= BIT(i+12); - } - } - - if ( pcur_network->Configuration.DSConfig > 14 ) { - /* 5G band */ - if (tx_ra_bitmap & 0xffff000) - sta_band |= WIRELESS_11_5N | WIRELESS_11A; - else - sta_band |= WIRELESS_11A; - } else { - if (tx_ra_bitmap & 0xffff000) - sta_band |= WIRELESS_11_24N | WIRELESS_11G | WIRELESS_11B; - else if (tx_ra_bitmap & 0xff0) - sta_band |= WIRELESS_11G |WIRELESS_11B; - else - sta_band |= WIRELESS_11B; - } - - id = networktype_to_raid(sta_band); - tx_ra_bitmap |= ((id<<28)&0xf0000000); - return tx_ra_bitmap; -} - -#endif /* CONFIG_TDLS */ diff --git a/core/rtw_wlan_util.c b/core/rtw_wlan_util.c index 0a53369..9ea7d1d 100755 --- a/core/rtw_wlan_util.c +++ b/core/rtw_wlan_util.c @@ -1166,24 +1166,6 @@ void VCS_update(struct adapter *padapter, struct sta_info *psta) } } -#ifdef CONFIG_TDLS -int check_ap_tdls_prohibited(u8 *pframe, u8 pkt_len) -{ - u8 tdls_prohibited_bit = 0x40; /* bit(38); TDLS_prohibited */ - - if(pkt_len < 5) - { - return false; - } - - pframe += 4; - if( (*pframe) & tdls_prohibited_bit ) - return true; - - return false; -} -#endif /* CONFIG_TDLS */ - int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) { unsigned int len; @@ -1401,11 +1383,6 @@ void update_beacon_info(struct adapter *padapter, u8 *pframe, uint pkt_len, stru unsigned int len; PNDIS_802_11_VARIABLE_IEs pIE; -#ifdef CONFIG_TDLS - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - u8 tdls_prohibited[] = { 0x00, 0x00, 0x00, 0x00, 0x10 }; /* bit(38): TDLS_prohibited */ -#endif /* CONFIG_TDLS */ - len = pkt_len - (_BEACON_IE_OFFSET_ + WLAN_HDR_A3_LEN); for (i = 0; i < len;) @@ -1422,12 +1399,6 @@ void update_beacon_info(struct adapter *padapter, u8 *pframe, uint pkt_len, stru ERP_IE_handler(padapter, pIE); VCS_update(padapter, psta); break; -#ifdef CONFIG_TDLS - case _EXT_CAP_IE_: - if( check_ap_tdls_prohibited(pIE->data, pIE->Length) == true ) - ptdlsinfo->ap_prohibited = true; - break; -#endif /* CONFIG_TDLS */ default: break; } diff --git a/core/rtw_xmit.c b/core/rtw_xmit.c index dda5b13..46388ec 100755 --- a/core/rtw_xmit.c +++ b/core/rtw_xmit.c @@ -1033,12 +1033,6 @@ s32 rtw_make_wlanhdr (struct adapter *padapter , u8 *hdr, struct pkt_attrib *pat struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct qos_priv *pqospriv = &pmlmepriv->qospriv; u8 qos_option = false; -#ifdef CONFIG_TDLS - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - struct sta_priv *pstapriv = &padapter->stapriv; - struct sta_info *ptdls_sta=NULL, *psta_backup=NULL; - u8 direct_link=0; -#endif /* CONFIG_TDLS */ sint res = _SUCCESS; __le16 *fctrl = &pwlanhdr->frame_ctl; @@ -1080,32 +1074,11 @@ s32 rtw_make_wlanhdr (struct adapter *padapter , u8 *hdr, struct pkt_attrib *pat { if ((check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true)) { /* to_ds = 1, fr_ds = 0; */ -#ifdef CONFIG_TDLS - if((ptdlsinfo->setup_state == TDLS_LINKED_STATE)){ - ptdls_sta = rtw_get_stainfo(pstapriv, pattrib->dst); - if((ptdls_sta!=NULL)&&(ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE)&&(pattrib->ether_type!=0x0806)){ - /* TDLS data transfer, ToDS=0, FrDs=0 */ - memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN); - memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN); - memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv), ETH_ALEN); - direct_link=1; - }else{ - /* 1.Data transfer to AP */ - /* 2.Arp pkt will relayed by AP */ - SetToDs(fctrl); - memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv), ETH_ALEN); - memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN); - memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN); - } - }else -#endif /* CONFIG_TDLS */ - { - /* Data transfer to AP */ - SetToDs(fctrl); - memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv), ETH_ALEN); - memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN); - memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN); - } + /* Data transfer to AP */ + SetToDs(fctrl); + memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv), ETH_ALEN); + memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN); + memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN); if (pqospriv->qos_option) qos_option = true; @@ -1159,13 +1132,6 @@ s32 rtw_make_wlanhdr (struct adapter *padapter , u8 *hdr, struct pkt_attrib *pat /* Update Seq Num will be handled by f/w */ { if(psta){ -#ifdef CONFIG_TDLS - if(direct_link==1) - { - psta_backup = psta; - psta = ptdls_sta; - } -#endif /* CONFIG_TDLS */ psta->sta_xmitpriv.txseq_tid[pattrib->priority]++; psta->sta_xmitpriv.txseq_tid[pattrib->priority] &= 0xFFF; @@ -1208,29 +1174,6 @@ s32 rtw_make_wlanhdr (struct adapter *padapter , u8 *hdr, struct pkt_attrib *pat } } -#ifdef CONFIG_TDLS - if(direct_link==1) - { - if (pattrib->encrypt){ - pattrib->encrypt= _AES_; - pattrib->iv_len=8; - pattrib->icv_len=8; - } - - /* qos_en, ht_en, init rate, ,bw, ch_offset, sgi */ - /* pattrib->qos_en = ptdls_sta->qos_option; */ - - pattrib->raid = ptdls_sta->raid; - pattrib->bwmode = ptdls_sta->htpriv.bwmode; - pattrib->ht_en = ptdls_sta->htpriv.ht_option; - pattrib->ch_offset = ptdls_sta->htpriv.ch_offset; - pattrib->sgi= ptdls_sta->htpriv.sgi; - pattrib->mac_id = ptdls_sta->mac_id; - - psta = psta_backup; - } -#endif /* CONFIG_TDLS */ - } } @@ -1310,269 +1253,6 @@ s32 rtw_txframes_sta_ac_pending(struct adapter *padapter, struct pkt_attrib *pat return ptxservq->qcnt; } -#ifdef CONFIG_TDLS - -int rtw_build_tdls_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, u8 action) -{ - int res=_SUCCESS; - - switch(action){ - case TDLS_SETUP_REQUEST: - rtw_build_tdls_setup_req_ies(padapter, pxmitframe, pframe); - break; - case TDLS_SETUP_RESPONSE: - rtw_build_tdls_setup_rsp_ies(padapter, pxmitframe, pframe); - break; - case TDLS_SETUP_CONFIRM: - rtw_build_tdls_setup_cfm_ies(padapter, pxmitframe, pframe); - break; - case TDLS_TEARDOWN: - rtw_build_tdls_teardown_ies(padapter, pxmitframe, pframe); - break; - case TDLS_DISCOVERY_REQUEST: - rtw_build_tdls_dis_req_ies(padapter, pxmitframe, pframe); - break; - case TDLS_PEER_TRAFFIC_INDICATION: - rtw_build_tdls_peer_traffic_indication_ies(padapter, pxmitframe, pframe); - break; - case TDLS_CHANNEL_SWITCH_REQUEST: - rtw_build_tdls_ch_switch_req_ies(padapter, pxmitframe, pframe); - break; - case TDLS_CHANNEL_SWITCH_RESPONSE: - rtw_build_tdls_ch_switch_rsp_ies(padapter, pxmitframe, pframe); - break; -#ifdef CONFIG_P2P - case TUNNELED_PROBE_REQ: - rtw_build_tunneled_probe_req_ies(padapter, pxmitframe, pframe); - break; - case TUNNELED_PROBE_RSP: - rtw_build_tunneled_probe_rsp_ies(padapter, pxmitframe, pframe); - break; -#endif /* CONFIG_P2P */ - default: - res=_FAIL; - break; - } - - return res; -} - -s32 rtw_make_tdls_wlanhdr (struct adapter *padapter , u8 *hdr, struct pkt_attrib *pattrib, u8 action) -{ - u16 *qc; - struct rtw_ieee80211_hdr *pwlanhdr = (struct rtw_ieee80211_hdr *)hdr; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct qos_priv *pqospriv = &pmlmepriv->qospriv; - struct sta_priv *pstapriv = &padapter->stapriv; - struct sta_info *psta=NULL, *ptdls_sta=NULL; - u8 tdls_seq=0, baddr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - - sint res = _SUCCESS; - u16 *fctrl = &pwlanhdr->frame_ctl; - -; - - memset(hdr, 0, WLANHDR_OFFSET); - - SetFrameSubType(fctrl, pattrib->subtype); - - switch(action){ - case TDLS_SETUP_REQUEST: - case TDLS_SETUP_RESPONSE: - case TDLS_SETUP_CONFIRM: - case TDLS_TEARDOWN: /* directly to peer STA or via AP */ - case TDLS_PEER_TRAFFIC_INDICATION: - case TDLS_PEER_PSM_REQUEST: /* directly to peer STA or via AP */ - case TUNNELED_PROBE_REQ: - case TUNNELED_PROBE_RSP: - SetToDs(fctrl); - memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv), ETH_ALEN); - memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN); - memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN); - break; - case TDLS_CHANNEL_SWITCH_REQUEST: - case TDLS_CHANNEL_SWITCH_RESPONSE: - case TDLS_PEER_PSM_RESPONSE: - case TDLS_PEER_TRAFFIC_RESPONSE: - memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN); - memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN); - memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv), ETH_ALEN); - tdls_seq=1; - break; - case TDLS_DISCOVERY_REQUEST: /* unicast: directly to peer sta, Bcast: via AP */ - if(_rtw_memcmp(pattrib->dst, baddr, ETH_ALEN) ) - { - SetToDs(fctrl); - memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv), ETH_ALEN); - memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN); - memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN); - } - else - { - memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN); - memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN); - memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv), ETH_ALEN); - tdls_seq=1; - } - break; - } - - if (pattrib->encrypt) - SetPrivacy(fctrl); - - if (pqospriv->qos_option) - { - qc = (unsigned short *)(hdr + pattrib->hdrlen - 2); - if (pattrib->priority) - SetPriority(qc, pattrib->priority); - SetAckpolicy(qc, pattrib->ack_policy); - } - - psta = pattrib->psta; - - /* 1. update seq_num per link by sta_info */ - /* 2. rewrite encrypt to _AES_, also rewrite iv_len, icv_len */ - if(tdls_seq==1){ - ptdls_sta=rtw_get_stainfo(pstapriv, pattrib->dst); - if(ptdls_sta){ - ptdls_sta->sta_xmitpriv.txseq_tid[pattrib->priority]++; - ptdls_sta->sta_xmitpriv.txseq_tid[pattrib->priority] &= 0xFFF; - pattrib->seqnum = ptdls_sta->sta_xmitpriv.txseq_tid[pattrib->priority]; - SetSeqNum(hdr, pattrib->seqnum); - - if (pattrib->encrypt){ - pattrib->encrypt= _AES_; - pattrib->iv_len=8; - pattrib->icv_len=8; - } - }else{ - res=_FAIL; - goto exit; - } - }else if(psta){ - psta->sta_xmitpriv.txseq_tid[pattrib->priority]++; - psta->sta_xmitpriv.txseq_tid[pattrib->priority] &= 0xFFF; - pattrib->seqnum = psta->sta_xmitpriv.txseq_tid[pattrib->priority]; - SetSeqNum(hdr, pattrib->seqnum); - } - - -exit: - -; - - return res; -} - -s32 rtw_xmit_tdls_coalesce(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 action) -{ - s32 llc_sz; - - u8 *pframe, *mem_start; - - struct sta_info *psta; - struct sta_priv *pstapriv = &padapter->stapriv; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct pkt_attrib *pattrib = &pxmitframe->attrib; - u8 *pbuf_start; - s32 bmcst = IS_MCAST(pattrib->ra); - s32 res = _SUCCESS; - -; - - if (pattrib->psta) { - psta = pattrib->psta; - } else { - if(bmcst) { - psta = rtw_get_bcmc_stainfo(padapter); - } else { - psta = rtw_get_stainfo(&padapter->stapriv, pattrib->ra); - } - } - - if(psta==NULL) - return _FAIL; - - if (pxmitframe->buf_addr == NULL) - return _FAIL; - - pbuf_start = pxmitframe->buf_addr; - mem_start = pbuf_start + TXDESC_OFFSET; - - if (rtw_make_tdls_wlanhdr(padapter, mem_start, pattrib, action) == _FAIL) { - res = _FAIL; - goto exit; - } - - pframe = mem_start; - pframe += pattrib->hdrlen; - - /* adding icv, if necessary... */ - if (pattrib->iv_len) - { - if (psta != NULL) - { - switch(pattrib->encrypt) - { - case _WEP40_: - case _WEP104_: - WEP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); - break; - case _TKIP_: - if(bmcst) - TKIP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); - else - TKIP_IV(pattrib->iv, psta->dot11txpn, 0); - break; - case _AES_: - if(bmcst) - AES_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); - else - AES_IV(pattrib->iv, psta->dot11txpn, 0); - break; - } - } - - memcpy(pframe, pattrib->iv, pattrib->iv_len); - pframe += pattrib->iv_len; - - } - - llc_sz = rtw_put_snap(pframe, pattrib->ether_type); - pframe += llc_sz; - - /* pattrib->pktlen will be counted in rtw_build_tdls_ies */ - pattrib->pktlen = 0; - - rtw_build_tdls_ies(padapter, pxmitframe, pframe, action); - - if ((pattrib->icv_len >0 )&& (pattrib->bswenc)) { - pframe += pattrib->pktlen; - memcpy(pframe, pattrib->icv, pattrib->icv_len); - pframe += pattrib->icv_len; - } - - pattrib->nr_frags = 1; - pattrib->last_txcmdsz = pattrib->hdrlen + pattrib->iv_len + llc_sz + - ((pattrib->bswenc) ? pattrib->icv_len : 0) + pattrib->pktlen; - - if (xmitframe_addmic(padapter, pxmitframe) == _FAIL) - { - goto exit; - } - - xmitframe_swencrypt(padapter, pxmitframe); - - update_attrib_vcs_info(padapter, pxmitframe); - -exit: - -; - - return res; -} -#endif /* CONFIG_TDLS */ - /* * Calculate wlan 802.11 packet MAX size from pkt_attrib * This function doesn't consider fragment case @@ -3148,82 +2828,7 @@ s32 rtw_xmit(struct adapter *padapter, _pkt **ppkt) return 0; } -#ifdef CONFIG_TDLS -sint xmitframe_enqueue_for_tdls_sleeping_sta(struct adapter *padapter, struct xmit_frame *pxmitframe) -{ - sint ret=false; - - _irqL irqL; - struct sta_info *ptdls_sta=NULL; - struct sta_priv *pstapriv = &padapter->stapriv; - struct pkt_attrib *pattrib = &pxmitframe->attrib; - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - int i; - - ptdls_sta=rtw_get_stainfo(pstapriv, pattrib->dst); - if(ptdls_sta==NULL){ - return ret; - }else if(ptdls_sta->tdls_sta_state&TDLS_LINKED_STATE){ - - if(pattrib->triggered==1) - { - ret = true; - return ret; - } - - _enter_critical_bh(&ptdls_sta->sleep_q.lock, &irqL); - - if(ptdls_sta->state&WIFI_SLEEP_STATE) - { - rtw_list_delete(&pxmitframe->list); - - /* _enter_critical_bh(&psta->sleep_q.lock, &irqL); */ - - rtw_list_insert_tail(&pxmitframe->list, get_list_head(&ptdls_sta->sleep_q)); - - ptdls_sta->sleepq_len++; - ptdls_sta->sleepq_ac_len++; - - /* indicate 4-AC queue bit in TDLS peer traffic indication */ - switch(pattrib->priority) - { - case 1: - case 2: - ptdls_sta->uapsd_bk = ptdls_sta->uapsd_bk | BIT(1); - break; - case 4: - case 5: - ptdls_sta->uapsd_vi = ptdls_sta->uapsd_vi | BIT(1); - break; - case 6: - case 7: - ptdls_sta->uapsd_vo = ptdls_sta->uapsd_vo | BIT(1); - break; - case 0: - case 3: - default: - ptdls_sta->uapsd_be = ptdls_sta->uapsd_be | BIT(1); - break; - } - - if(ptdls_sta->sleepq_len==1) - { - /* transmit TDLS PTI via AP */ - rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_SD_PTI); - } - ret = true; - - } - - _exit_critical_bh(&ptdls_sta->sleep_q.lock, &irqL); - } - - return ret; - -} -#endif /* CONFIG_TDLS */ - -#if defined(CONFIG_AP_MODE) || defined(CONFIG_TDLS) +#if defined(CONFIG_AP_MODE) sint xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_frame *pxmitframe) { @@ -3234,15 +2839,6 @@ sint xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_fr struct pkt_attrib *pattrib = &pxmitframe->attrib; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; sint bmcst = IS_MCAST(pattrib->ra); -#ifdef CONFIG_TDLS - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - - if( ptdlsinfo->setup_state == TDLS_LINKED_STATE ) - { - ret = xmitframe_enqueue_for_tdls_sleeping_sta(padapter, pxmitframe); - return ret; - } -#endif /* CONFIG_TDLS */ if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == false) return ret; @@ -3439,13 +3035,8 @@ void stop_sta_xmit(struct adapter *padapter, struct sta_info *psta) psta->state |= WIFI_SLEEP_STATE; -#ifdef CONFIG_TDLS - if( !(psta->tdls_sta_state & TDLS_LINKED_STATE) ) -#endif /* CONFIG_TDLS */ pstapriv->sta_dz_bitmap |= BIT(psta->aid); - - dequeue_xmitframes_to_sleeping_queue(padapter, psta, &pstaxmitpriv->vo_q.sta_pending); rtw_list_delete(&(pstaxmitpriv->vo_q.tx_pending)); @@ -3461,27 +3052,13 @@ void stop_sta_xmit(struct adapter *padapter, struct sta_info *psta) dequeue_xmitframes_to_sleeping_queue(padapter, psta, &pstaxmitpriv->bk_q.sta_pending); rtw_list_delete(&(pstaxmitpriv->bk_q.tx_pending)); -#ifdef CONFIG_TDLS - if( !(psta->tdls_sta_state & TDLS_LINKED_STATE) ) - { - if( psta_bmc != NULL ) - { -#endif /* CONFIG_TDLS */ - - /* for BC/MC Frames */ pstaxmitpriv = &psta_bmc->sta_xmitpriv; dequeue_xmitframes_to_sleeping_queue(padapter, psta_bmc, &pstaxmitpriv->be_q.sta_pending); rtw_list_delete(&(pstaxmitpriv->be_q.tx_pending)); -#ifdef CONFIG_TDLS - } - } -#endif /* CONFIG_TDLS */ _exit_critical_bh(&pxmitpriv->lock, &irqL0); - - } void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) @@ -3496,8 +3073,6 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) psta_bmc = rtw_get_bcmc_stainfo(padapter); - - /* _enter_critical_bh(&psta->sleep_q.lock, &irqL); */ _enter_critical_bh(&pxmitpriv->lock, &irqL); xmitframe_phead = get_list_head(&psta->sleep_q); @@ -3621,15 +3196,6 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) if(psta->sleepq_len==0) { -#ifdef CONFIG_TDLS - if( psta->tdls_sta_state & TDLS_LINKED_STATE ) - { - if(psta->state&WIFI_SLEEP_STATE) - psta->state ^= WIFI_SLEEP_STATE; - - goto _exit; - } -#endif /* CONFIG_TDLS */ pstapriv->tim_bitmap &= ~BIT(psta->aid); /* DBG_871X("wakeup to xmit, qlen==0, update_BCNTIM, tim=%x\n", pstapriv->tim_bitmap); */ @@ -3737,14 +3303,6 @@ void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *pst if((psta->sleepq_ac_len==0) && (!psta->has_legacy_ac) && (wmmps_ac)) { -#ifdef CONFIG_TDLS - if(psta->tdls_sta_state & TDLS_LINKED_STATE ) - { - /* _exit_critical_bh(&psta->sleep_q.lock, &irqL); */ - _exit_critical_bh(&pxmitpriv->lock, &irqL); - return; - } -#endif /* CONFIG_TDLS */ pstapriv->tim_bitmap &= ~BIT(psta->aid); /* DBG_871X("wakeup to xmit, qlen==0, update_BCNTIM, tim=%x\n", pstapriv->tim_bitmap); */ diff --git a/hal/usb_halinit.c b/hal/usb_halinit.c index e26a516..55ab8b9 100755 --- a/hal/usb_halinit.c +++ b/hal/usb_halinit.c @@ -2788,30 +2788,6 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) } break; #endif /* CONFIG_P2P */ -#ifdef CONFIG_TDLS - case HW_VAR_TDLS_WRCR: - rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)&(~RCR_CBSSID_DATA )); - break; - case HW_VAR_TDLS_INIT_CH_SEN: - { - rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)&(~ RCR_CBSSID_DATA )&(~RCR_CBSSID_BCN )); - rtw_write16(Adapter, REG_RXFLTMAP2,0xffff); - - /* disable update TSF */ - rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(4)); - } - break; - case HW_VAR_TDLS_DONE_CH_SEN: - { - /* enable update TSF */ - rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~ BIT(4))); - rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|(RCR_CBSSID_BCN )); - } - break; - case HW_VAR_TDLS_RS_RCR: - rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|(RCR_CBSSID_DATA)); - break; -#endif /* CONFIG_TDLS */ case HW_VAR_INITIAL_GAIN: { DIG_T *pDigTable = &podmpriv->DM_DigTable; diff --git a/include/drv_types.h b/include/drv_types.h index a33911a..3ed00af 100755 --- a/include/drv_types.h +++ b/include/drv_types.h @@ -374,9 +374,6 @@ struct adapter { struct wifidirect_info wdinfo; #endif //CONFIG_P2P -#ifdef CONFIG_TDLS - struct tdls_info tdlsinfo; -#endif //CONFIG_TDLS #ifdef CONFIG_P2P struct wifi_display_info wfd_info; #endif //CONFIG_P2P diff --git a/include/ieee80211.h b/include/ieee80211.h index f184682..c3bf044 100755 --- a/include/ieee80211.h +++ b/include/ieee80211.h @@ -1045,26 +1045,6 @@ enum _PUBLIC_ACTION{ ACT_PUBLIC_MAX }; -#ifdef CONFIG_TDLS -enum TDLS_ACTION_FIELD{ - TDLS_SETUP_REQUEST = 0, - TDLS_SETUP_RESPONSE = 1, - TDLS_SETUP_CONFIRM = 2, - TDLS_TEARDOWN = 3, - TDLS_PEER_TRAFFIC_INDICATION = 4, - TDLS_CHANNEL_SWITCH_REQUEST = 5, - TDLS_CHANNEL_SWITCH_RESPONSE = 6, - TDLS_PEER_PSM_REQUEST = 7, - TDLS_PEER_PSM_RESPONSE = 8, - TDLS_PEER_TRAFFIC_RESPONSE = 9, - TDLS_DISCOVERY_REQUEST = 10, - TDLS_DISCOVERY_RESPONSE = 14, //it's used in public action frame -}; - -#define TUNNELED_PROBE_REQ 15 -#define TUNNELED_PROBE_RSP 16 -#endif //CONFIG_TDLS - /* BACK action code */ enum rtw_ieee80211_back_actioncode { RTW_WLAN_ACTION_ADDBA_REQ = 0, diff --git a/include/rtw_mlme_ext.h b/include/rtw_mlme_ext.h index a69f15b..2825ae9 100755 --- a/include/rtw_mlme_ext.h +++ b/include/rtw_mlme_ext.h @@ -320,40 +320,6 @@ struct ss_res #define WIFI_FW_LINKING_STATE (WIFI_FW_AUTH_NULL | WIFI_FW_AUTH_STATE | WIFI_FW_AUTH_SUCCESS |WIFI_FW_ASSOC_STATE) -#ifdef CONFIG_TDLS -// 1: Write RCR DATA BIT -// 2: Issue peer traffic indication -// 3: Go back to the channel linked with AP, terminating channel switch procedure -// 4: Init channel sensing, receive all data and mgnt frame -// 5: Channel sensing and report candidate channel -// 6: First time set channel to off channel -// 7: Go back tp the channel linked with AP when set base channel as target channel -// 8: Set channel back to base channel -// 9: Set channel back to off channel -// 10: Restore RCR DATA BIT -// 11: Check alive -// 12: Check alive -// 13: Free TDLS sta -enum TDLS_option -{ - TDLS_WRCR = 1, - TDLS_SD_PTI = 2, - TDLS_CS_OFF = 3, - TDLS_INIT_CH_SEN = 4, - TDLS_DONE_CH_SEN = 5, - TDLS_OFF_CH = 6, - TDLS_BASE_CH = 7, - TDLS_P_OFF_CH = 8, - TDLS_P_BASE_CH = 9, - TDLS_RS_RCR = 10, - TDLS_CKALV_PH1 = 11, - TDLS_CKALV_PH2 = 12, - TDLS_FREE_STA = 13, - maxTDLS, -}; - -#endif //CONFIG_TDLS - struct FW_Sta_Info { struct sta_info *psta; diff --git a/include/rtw_security.h b/include/rtw_security.h index 6d8dc86..1f9fc5c 100755 --- a/include/rtw_security.h +++ b/include/rtw_security.h @@ -431,15 +431,6 @@ void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe); #ifdef CONFIG_IEEE80211W u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe); #endif //CONFIG_IEEE80211W -#ifdef CONFIG_TDLS -void wpa_tdls_generate_tpk(struct adapter *padapter, struct sta_info *psta); -int wpa_tdls_ftie_mic(u8 *kck, u8 trans_seq, - u8 *lnkid, u8 *rsnie, u8 *timeoutie, u8 *ftie, - u8 *mic); -int tdls_verify_mic(u8 *kck, u8 trans_seq, - u8 *lnkid, u8 *rsnie, u8 *timeoutie, u8 *ftie); -#endif //CONFIG_TDLS - void rtw_use_tkipkey_handler(void* FunctionContext); void rtw_sec_restore_wep_key(struct adapter *adapter); diff --git a/include/rtw_tdls.h b/include/rtw_tdls.h index 0baf49b..8687be2 100755 --- a/include/rtw_tdls.h +++ b/include/rtw_tdls.h @@ -22,121 +22,5 @@ #include -#ifdef CONFIG_TDLS -/* TDLS STA state */ -#define TDLS_STATE_NONE 0x00000000 //default state -#define TDLS_INITIATOR_STATE 0x10000000 -#define TDLS_RESPONDER_STATE 0x20000000 -#define TDLS_LINKED_STATE 0x40000000 -#define TDLS_CH_SWITCH_ON_STATE 0x01000000 -#define TDLS_PEER_AT_OFF_STATE 0x02000000 //could send pkt on target ch -#define TDLS_AT_OFF_CH_STATE 0x04000000 -#define TDLS_CH_SW_INITIATOR_STATE 0x08000000 //avoiding duplicated or unconditional ch. switch rsp. -#define TDLS_APSD_CHSW_STATE 0x00100000 //in APSD and want to setup channel switch -#define TDLS_PEER_SLEEP_STATE 0x00200000 //peer sta is sleeping -#define TDLS_SW_OFF_STATE 0x00400000 //terminate channel swithcing -#define TDLS_ALIVE_STATE 0x00010000 //Check if peer sta is alived. - -#define TPK_RESEND_COUNT 301 -#define CH_SWITCH_TIME 10 -#define CH_SWITCH_TIMEOUT 30 -#define TDLS_STAY_TIME 500 -#define TDLS_SIGNAL_THRESH 0x20 -#define TDLS_WATCHDOG_PERIOD 10 //Periodically sending tdls discovery request in TDLS_WATCHDOG_PERIOD * 2 sec -#define TDLS_ALIVE_TIMER_PH1 5000 -#define TDLS_ALIVE_TIMER_PH2 2000 -#define TDLS_STAY_TIME 500 -#define TDLS_HANDSHAKE_TIME 8000 -#define TDLS_ALIVE_COUNT 3 -#define TDLS_INI_MACID_ENTRY 6 - -/* TDLS */ -#define TDLS_MIC_LEN 16 -#define WPA_NONCE_LEN 32 -#define TDLS_TIMEOUT_LEN 4 - -struct wpa_tdls_ftie { - u8 ie_type; /* FTIE */ - u8 ie_len; - u8 mic_ctrl[2]; - u8 mic[TDLS_MIC_LEN]; - u8 Anonce[WPA_NONCE_LEN]; /* Responder Nonce in TDLS */ - u8 Snonce[WPA_NONCE_LEN]; /* Initiator Nonce in TDLS */ - /* followed by optional elements */ -} ; - -struct wpa_tdls_lnkid { - u8 ie_type; /* Link Identifier IE */ - u8 ie_len; - u8 bssid[ETH_ALEN]; - u8 init_sta[ETH_ALEN]; - u8 resp_sta[ETH_ALEN]; -} ; - -static u8 TDLS_RSNIE[]={ 0x01, 0x00, //version shall be set to 1 - 0x00, 0x0f, 0xac, 0x07, //group sipher suite - 0x01, 0x00, //pairwise cipher suite count - 0x00, 0x0f, 0xac, 0x04, //pairwise cipher suite list; CCMP only - 0x01, 0x00, //AKM suite count - 0x00, 0x0f, 0xac, 0x07, //TPK Handshake - 0x00, 0x02, - //PMKID shall not be present - }; - -static u8 TDLS_WMMIE[]={0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, 0x00}; //Qos info all set zero - -static u8 TDLS_EXT_CAPIE[] = {0x00, 0x00, 0x00, 0x50, 0x20}; //bit(28), bit(30), bit(37) - -// SRC: Supported Regulatory Classes -static u8 TDLS_SRC[] = { 0x01, 0x01, 0x02, 0x03, 0x04, 0x0c, 0x16, 0x17, 0x18, 0x19, 0x1b, 0x1c, 0x1d, 0x1e, 0x20, 0x21 }; - -void rtw_reset_tdls_info(struct adapter* padapter); -int rtw_init_tdls_info(struct adapter* padapter); -void rtw_free_tdls_info(struct tdls_info *ptdlsinfo); -void issue_nulldata_to_TDLS_peer_STA(struct adapter *padapter, struct sta_info *ptdls_sta, unsigned int power_mode); -void init_TPK_timer(struct adapter *padapter, struct sta_info *psta); -void init_ch_switch_timer(struct adapter *padapter, struct sta_info *psta); -void init_base_ch_timer(struct adapter *padapter, struct sta_info *psta); -void init_off_ch_timer(struct adapter *padapter, struct sta_info *psta); -void init_tdls_alive_timer(struct adapter *padapter, struct sta_info *psta); -void init_handshake_timer(struct adapter *padapter, struct sta_info *psta); -void free_tdls_sta(struct adapter *padapter, struct sta_info *ptdls_sta); -#ifdef CONFIG_P2P -void issue_tunneled_probe_req(struct adapter *padapter); -void issue_tunneled_probe_rsp(struct adapter *padapter, union recv_frame *precv_frame); -#endif //CONFIG_P2P -void issue_tdls_dis_req(struct adapter *padapter, u8 *mac_addr); -void issue_tdls_setup_req(struct adapter *padapter, u8 *mac_addr); -void issue_tdls_setup_rsp(struct adapter *padapter, union recv_frame *precv_frame); -void issue_tdls_setup_cfm(struct adapter *padapter, union recv_frame *precv_frame); -void issue_tdls_dis_rsp(struct adapter * padapter, union recv_frame * precv_frame, u8 dialog); -void issue_tdls_teardown(struct adapter *padapter, u8 *mac_addr); -void issue_tdls_peer_traffic_indication(struct adapter *padapter, struct sta_info *psta); -void issue_tdls_ch_switch_req(struct adapter *padapter, u8 *mac_addr); -void issue_tdls_ch_switch_rsp(struct adapter *padapter, u8 *mac_addr); -sint On_TDLS_Dis_Rsp(struct adapter *adapter, union recv_frame *precv_frame); -sint On_TDLS_Setup_Req(struct adapter *adapter, union recv_frame *precv_frame); -sint On_TDLS_Setup_Rsp(struct adapter *adapter, union recv_frame *precv_frame); -sint On_TDLS_Setup_Cfm(struct adapter *adapter, union recv_frame *precv_frame); -sint On_TDLS_Dis_Req(struct adapter *adapter, union recv_frame *precv_frame); -sint On_TDLS_Teardown(struct adapter *adapter, union recv_frame *precv_frame); -sint On_TDLS_Peer_Traffic_Rsp(struct adapter *adapter, union recv_frame *precv_frame); -sint On_TDLS_Ch_Switch_Req(struct adapter *adapter, union recv_frame *precv_frame); -sint On_TDLS_Ch_Switch_Rsp(struct adapter *adapter, union recv_frame *precv_frame); -void rtw_build_tdls_setup_req_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); -void rtw_build_tdls_setup_rsp_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); -void rtw_build_tdls_setup_cfm_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); -void rtw_build_tdls_teardown_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); -void rtw_build_tdls_dis_req_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); -void rtw_build_tdls_dis_rsp_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, u8 dialog); -void rtw_build_tdls_peer_traffic_indication_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); -void rtw_build_tdls_ch_switch_req_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); -void rtw_build_tdls_ch_switch_rsp_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); -void rtw_build_tunneled_probe_req_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); -void rtw_build_tunneled_probe_rsp_ies(struct adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe); - -int update_sgi_tdls(struct adapter *padapter, struct sta_info *psta); -u32 update_mask_tdls(struct adapter *padapter, struct sta_info *psta); -#endif //CONFIG_TDLS #endif diff --git a/include/rtw_xmit.h b/include/rtw_xmit.h index 85bb7f4..b92f3b2 100755 --- a/include/rtw_xmit.h +++ b/include/rtw_xmit.h @@ -439,9 +439,6 @@ extern s32 rtw_xmitframe_coalesce(struct adapter *padapter, _pkt *pkt, struct xm #ifdef CONFIG_IEEE80211W extern s32 rtw_mgmt_xmitframe_coalesce(struct adapter *padapter, _pkt *pkt, struct xmit_frame *pxmitframe); #endif //CONFIG_IEEE80211W -#ifdef CONFIG_TDLS -s32 rtw_xmit_tdls_coalesce(struct adapter *padapter, struct xmit_frame *pxmitframe, u8 action); -#endif s32 _rtw_init_hw_txqueue(struct hw_txqueue* phw_txqueue, u8 ac_tag); void _rtw_init_sta_xmit_priv(struct sta_xmit_priv *psta_xmitpriv); @@ -461,7 +458,7 @@ void rtw_free_hwxmits(struct adapter *padapter); s32 rtw_xmit(struct adapter *padapter, _pkt **pkt); -#if defined(CONFIG_AP_MODE) || defined(CONFIG_TDLS) +#if defined(CONFIG_AP_MODE) sint xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_frame *pxmitframe); void stop_sta_xmit(struct adapter *padapter, struct sta_info *psta); void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta); diff --git a/include/sta_info.h b/include/sta_info.h index b362a75..436e6b2 100755 --- a/include/sta_info.h +++ b/include/sta_info.h @@ -85,13 +85,6 @@ struct stainfo_stats { }; -#ifdef CONFIG_TDLS -struct TDLS_PeerKey { - u8 kck[16]; /* TPK-KCK */ - u8 tk[16]; /* TPK-TK; only CCMP will be used */ -} ; -#endif //CONFIG_TDLS - struct sta_info { _lock lock; @@ -140,31 +133,6 @@ struct sta_info { u8 wireless_mode; // NETWORK_TYPE struct stainfo_stats sta_stats; -#ifdef CONFIG_TDLS - u32 tdls_sta_state; - u8 dialog; - u8 SNonce[32]; - u8 ANonce[32]; - u32 TDLS_PeerKey_Lifetime; - u16 TPK_count; - _timer TPK_timer; - struct TDLS_PeerKey tpk; - u16 stat_code; - u8 off_ch; - u16 ch_switch_time; - u16 ch_switch_timeout; - u8 option; - _timer option_timer; - _timer base_ch_timer; - _timer off_ch_timer; - - _timer handshake_timer; - _timer alive_timer1; - _timer alive_timer2; - u8 timer_flag; - u8 alive_count; -#endif //CONFIG_TDLS - //for A-MPDU TX, ADDBA timeout check _timer addba_retry_timer; diff --git a/os_dep/ioctl_linux.c b/os_dep/ioctl_linux.c index 5b928f3..8c8e505 100755 --- a/os_dep/ioctl_linux.c +++ b/os_dep/ioctl_linux.c @@ -8817,25 +8817,6 @@ static int rtw_wfd_tdls_enable(struct net_device *dev, { int ret = 0; -#ifdef CONFIG_TDLS -#ifdef CONFIG_P2P - - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - - printk( "[%s] %s %d\n", __FUNCTION__, extra, wrqu->data.length -1 ); - - if ( extra[ 0 ] == '0' ) - { - padapter->wdinfo.wfd_tdls_enable = 0; - } - else - { - padapter->wdinfo.wfd_tdls_enable = 1; - } - -#endif /* CONFIG_P2P */ -#endif /* CONFIG_TDLS */ - return ret; } @@ -8845,23 +8826,6 @@ static int rtw_tdls_weaksec(struct net_device *dev, { int ret = 0; -#ifdef CONFIG_TDLS - - u8 i, j; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - - DBG_871X( "[%s] %s %d\n", __FUNCTION__, extra, wrqu->data.length -1 ); - - if ( extra[ 0 ] == '0' ) - { - padapter->wdinfo.wfd_tdls_weaksec = 0; - } - else - { - padapter->wdinfo.wfd_tdls_weaksec = 1; - } -#endif - return ret; } @@ -8872,66 +8836,6 @@ static int rtw_tdls_enable(struct net_device *dev, { int ret = 0; -#ifdef CONFIG_TDLS - - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - _irqL irqL; - _list *plist, *phead; - s32 index; - struct sta_info *psta = NULL; - struct sta_priv *pstapriv = &padapter->stapriv; - u8 tdls_sta[NUM_STA][ETH_ALEN]; - u8 empty_hwaddr[ETH_ALEN] = { 0x00 }; - - printk( "[%s] %s %d\n", __FUNCTION__, extra, wrqu->data.length -1 ); - - memset(tdls_sta, 0x00, sizeof(tdls_sta)); - - if ( extra[ 0 ] == '0' ) - { - ptdlsinfo->enable = 0; - - if(pstapriv->asoc_sta_count==1) - return ret; - - _enter_critical_bh(&pstapriv->sta_hash_lock, &irqL); - for(index=0; index< NUM_STA; index++) - { - phead = &(pstapriv->sta_hash[index]); - plist = get_next(phead); - - while ((rtw_end_of_queue_search(phead, plist)) == false) - { - psta = LIST_CONTAINOR(plist, struct sta_info ,hash_list); - - plist = get_next(plist); - - if(psta->tdls_sta_state != TDLS_STATE_NONE) - { - memcpy(tdls_sta[index], psta->hwaddr, ETH_ALEN); - } - } - } - _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); - - for(index=0; index< NUM_STA; index++) - { - if( !_rtw_memcmp(tdls_sta[index], empty_hwaddr, ETH_ALEN) ) - { - printk("issue tear down to "MAC_FMT"\n", MAC_ARG(tdls_sta[index])); - issue_tdls_teardown(padapter, tdls_sta[index]); - } - } - rtw_tdls_cmd(padapter, myid(&(padapter->eeprompriv)), TDLS_RS_RCR); - rtw_reset_tdls_info(padapter); - } - else if ( extra[ 0 ] == '1' ) - { - ptdlsinfo->enable = 1; - } -#endif /* CONFIG_TDLS */ - return ret; } @@ -8941,43 +8845,6 @@ static int rtw_tdls_setup(struct net_device *dev, { int ret = 0; -#ifdef CONFIG_TDLS - - u8 i, j; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - u8 mac_addr[ETH_ALEN]; - -#ifdef CONFIG_P2P - struct wifidirect_info *pwdinfo= &(padapter->wdinfo); -#endif /* CONFIG_P2P */ - - printk( "[%s] %s %d\n", __FUNCTION__, extra, wrqu->data.length -1 ); - - for( i=0, j=0 ; i < ETH_ALEN; i++, j+=3 ){ - mac_addr[i]=key_2char2num(*(extra+j), *(extra+j+1)); - } - -#ifdef CONFIG_P2P - if ( _AES_ != padapter->securitypriv.dot11PrivacyAlgrthm ) - { - /* Weak Security situation with AP. */ - if ( 0 == pwdinfo->wfd_tdls_weaksec ) - { - /* Can't send the tdls setup request out!! */ - DBG_871X( "[%s] Current link is not AES, SKIP sending the tdls setup request!!\n", __FUNCTION__ ); - } - else - { - issue_tdls_setup_req(padapter, mac_addr); - } - } - else -#endif /* CONFIG_P2P */ - { - issue_tdls_setup_req(padapter, mac_addr); - } -#endif - return ret; } @@ -8987,29 +8854,6 @@ static int rtw_tdls_teardown(struct net_device *dev, { int ret = 0; -#ifdef CONFIG_TDLS - - u8 i,j; - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct sta_info *ptdls_sta = NULL; - u8 mac_addr[ETH_ALEN]; - - DBG_871X( "[%s] %s %d\n", __FUNCTION__, extra, wrqu->data.length -1 ); - - for( i=0, j=0 ; i < ETH_ALEN; i++, j+=3 ){ - mac_addr[i]=key_2char2num(*(extra+j), *(extra+j+1)); - } - - ptdls_sta = rtw_get_stainfo( &(padapter->stapriv), mac_addr); - - if(ptdls_sta != NULL) - { - ptdls_sta->stat_code = _RSON_TDLS_TEAR_UN_RSN_; - issue_tdls_teardown(padapter, mac_addr); - } - -#endif /* CONFIG_TDLS */ - return ret; } @@ -9019,18 +8863,6 @@ static int rtw_tdls_discovery(struct net_device *dev, { int ret = 0; -#ifdef CONFIG_TDLS - - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - - DBG_871X( "[%s] %s %d\n", __FUNCTION__, extra, wrqu->data.length -1 ); - - issue_tdls_dis_req(padapter, NULL); - -#endif /* CONFIG_TDLS */ - return ret; } @@ -9040,28 +8872,6 @@ static int rtw_tdls_ch_switch(struct net_device *dev, { int ret = 0; -#ifdef CONFIG_TDLS - - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - u8 i, j, mac_addr[ETH_ALEN]; - struct sta_info *ptdls_sta = NULL; - - DBG_8192C( "[%s] %s %d\n", __FUNCTION__, extra, wrqu->data.length -1 ); - - for( i=0, j=0 ; i < ETH_ALEN; i++, j+=3 ){ - mac_addr[i]=key_2char2num(*(extra+j), *(extra+j+1)); - } - - ptdls_sta = rtw_get_stainfo(&padapter->stapriv, mac_addr); - if( ptdls_sta == NULL ) - return ret; - ptdlsinfo->ch_sensing=1; - - rtw_tdls_cmd(padapter, ptdls_sta->hwaddr, TDLS_INIT_CH_SEN); - -#endif /* CONFIG_TDLS */ - return ret; } @@ -9071,26 +8881,6 @@ static int rtw_tdls_pson(struct net_device *dev, { int ret = 0; -#ifdef CONFIG_TDLS - - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - u8 i, j, mac_addr[ETH_ALEN]; - struct sta_info *ptdls_sta = NULL; - - DBG_871X( "[%s] %s %d\n", __FUNCTION__, extra, wrqu->data.length -1 ); - - for( i=0, j=0 ; i < ETH_ALEN; i++, j+=3 ){ - mac_addr[i]=key_2char2num(*(extra+j), *(extra+j+1)); - } - - ptdls_sta = rtw_get_stainfo(&padapter->stapriv, mac_addr); - - issue_nulldata_to_TDLS_peer_STA(padapter, ptdls_sta, 1); - -#endif /* CONFIG_TDLS */ - return ret; } @@ -9100,26 +8890,6 @@ static int rtw_tdls_psoff(struct net_device *dev, { int ret = 0; -#ifdef CONFIG_TDLS - - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - u8 i, j, mac_addr[ETH_ALEN]; - struct sta_info *ptdls_sta = NULL; - - DBG_8192C( "[%s] %s %d\n", __FUNCTION__, extra, wrqu->data.length -1 ); - - for( i=0, j=0 ; i < ETH_ALEN; i++, j+=3 ){ - mac_addr[i]=key_2char2num(*(extra+j), *(extra+j+1)); - } - - ptdls_sta = rtw_get_stainfo(&padapter->stapriv, mac_addr); - - issue_nulldata_to_TDLS_peer_STA(padapter, ptdls_sta, 0); - -#endif /* CONFIG_TDLS */ - return ret; } @@ -9129,45 +8899,6 @@ static int rtw_tdls_setip(struct net_device *dev, { int ret = 0; -#ifdef CONFIG_TDLS -#ifdef CONFIG_P2P - - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - struct wifi_display_info *pwfd_info = ptdlsinfo->wfd_info; - u8 i=0, j=0, k=0, tag=0, ip[3] = { 0xff }, *ptr = extra; - - printk( "[%s] %s %d\n", __FUNCTION__, extra, wrqu->data.length - 1 ); - - - while( i < 4 ) - { - for( j=0; j < 4; j++) - { - if( *( extra + j + tag ) == '.' || *( extra + j + tag ) == '\0' ) - { - if( j == 1 ) - pwfd_info->ip_address[i]=convert_ip_addr( '0', '0', *(extra+(j-1)+tag)); - if( j == 2 ) - pwfd_info->ip_address[i]=convert_ip_addr( '0', *(extra+(j-2)+tag), *(extra+(j-1)+tag)); - if( j == 3 ) - pwfd_info->ip_address[i]=convert_ip_addr( *(extra+(j-3)+tag), *(extra+(j-2)+tag), *(extra+(j-1)+tag)); - - tag += j + 1; - break; - } - } - i++; - } - - printk( "[%s] Set IP = %u.%u.%u.%u \n", __FUNCTION__, - ptdlsinfo->wfd_info->ip_address[0], ptdlsinfo->wfd_info->ip_address[1], - ptdlsinfo->wfd_info->ip_address[2], ptdlsinfo->wfd_info->ip_address[3] - ); - -#endif /* CONFIG_P2P */ -#endif /* CONFIG_TDLS */ - return ret; } @@ -9177,30 +8908,6 @@ static int rtw_tdls_getip(struct net_device *dev, { int ret = 0; -#ifdef CONFIG_TDLS -#ifdef CONFIG_P2P - - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - struct wifi_display_info *pwfd_info = ptdlsinfo->wfd_info; - - printk( "[%s]\n", __FUNCTION__); - - sprintf( extra, "\n\n%u.%u.%u.%u\n", - pwfd_info->peer_ip_address[0], pwfd_info->peer_ip_address[1], - pwfd_info->peer_ip_address[2], pwfd_info->peer_ip_address[3] - ); - - printk( "[%s] IP=%u.%u.%u.%u\n", __FUNCTION__, - pwfd_info->peer_ip_address[0], pwfd_info->peer_ip_address[1], - pwfd_info->peer_ip_address[2], pwfd_info->peer_ip_address[3] - ); - - wrqu->data.length = strlen( extra ); - -#endif /* CONFIG_P2P */ -#endif /* CONFIG_TDLS */ - return ret; } @@ -9211,23 +8918,6 @@ static int rtw_tdls_getport(struct net_device *dev, int ret = 0; -#ifdef CONFIG_TDLS -#ifdef CONFIG_P2P - - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - struct wifi_display_info *pwfd_info = ptdlsinfo->wfd_info; - - printk( "[%s]\n", __FUNCTION__); - - sprintf( extra, "\n\n%d\n", pwfd_info->peer_rtsp_ctrlport ); - printk( "[%s] remote port = %d\n", __FUNCTION__, pwfd_info->peer_rtsp_ctrlport ); - - wrqu->data.length = strlen( extra ); - -#endif /* CONFIG_P2P */ -#endif /* CONFIG_TDLS */ - return ret; } @@ -9240,26 +8930,6 @@ static int rtw_tdls_dis_result(struct net_device *dev, int ret = 0; -#ifdef CONFIG_TDLS -#ifdef CONFIG_P2P - - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - struct wifi_display_info *pwfd_info = ptdlsinfo->wfd_info; - - printk( "[%s]\n", __FUNCTION__); - - if(ptdlsinfo->dev_discovered == 1 ) - { - sprintf( extra, "\n\nDis=1\n" ); - ptdlsinfo->dev_discovered = 0; - } - - wrqu->data.length = strlen( extra ); - -#endif /* CONFIG_P2P */ -#endif /* CONFIG_TDLS */ - return ret; } @@ -9272,31 +8942,7 @@ static int rtw_wfd_tdls_status(struct net_device *dev, int ret = 0; -#ifdef CONFIG_TDLS -#ifdef CONFIG_P2P - - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; - struct wifi_display_info *pwfd_info = ptdlsinfo->wfd_info; - - printk( "[%s]\n", __FUNCTION__); - - if(ptdlsinfo->setup_state == TDLS_LINKED_STATE ) - { - sprintf( extra, "\n\nStatus=1\n" ); - } - else - { - sprintf( extra, "\n\nStatus=0\n" ); - } - - wrqu->data.length = strlen( extra ); - -#endif /* CONFIG_P2P */ -#endif /* CONFIG_TDLS */ - return ret; - } static int rtw_tdls_ch_switch_off(struct net_device *dev, @@ -9305,31 +8951,6 @@ static int rtw_tdls_ch_switch_off(struct net_device *dev, { int ret = 0; -#ifdef CONFIG_TDLS - - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - u8 i, j, mac_addr[ETH_ALEN]; - struct sta_info *ptdls_sta = NULL; - - DBG_871X( "[%s] %s %d\n", __FUNCTION__, extra, wrqu->data.length -1 ); - - for( i=0, j=0 ; i < ETH_ALEN; i++, j+=3 ){ - mac_addr[i]=key_2char2num(*(extra+j), *(extra+j+1)); - } - - ptdls_sta = rtw_get_stainfo(&padapter->stapriv, mac_addr); - - ptdls_sta->tdls_sta_state |= TDLS_SW_OFF_STATE; -/* - if((ptdls_sta->tdls_sta_state & TDLS_AT_OFF_CH_STATE) && (ptdls_sta->tdls_sta_state & TDLS_PEER_AT_OFF_STATE)){ - pmlmeinfo->tdls_candidate_ch= pmlmeext->cur_channel; - issue_tdls_ch_switch_req(padapter, mac_addr); - DBG_871X("issue tdls ch switch req back to base channel\n"); - } -*/ - -#endif /* CONFIG_TDLS */ - return ret; } @@ -9339,85 +8960,6 @@ static int rtw_tdls(struct net_device *dev, { int ret = 0; -#ifdef CONFIG_TDLS - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - - DBG_871X( "[%s] extra = %s\n", __FUNCTION__, extra ); - /* WFD Sigma will use the tdls enable command to let the driver know we want to test the tdls now! */ - if ( _rtw_memcmp( extra, "wfdenable=", 10 ) ) - { - wrqu->data.length -=10; - rtw_wfd_tdls_enable( dev, info, wrqu, &extra[10] ); - return ret; - } - else if ( _rtw_memcmp( extra, "weaksec=", 8 ) ) - { - wrqu->data.length -=8; - rtw_tdls_weaksec( dev, info, wrqu, &extra[8] ); - return ret; - } - else if ( _rtw_memcmp( extra, "tdlsenable=", 11 ) ) - { - wrqu->data.length -=11; - rtw_tdls_enable( dev, info, wrqu, &extra[11] ); - return ret; - } - - if( padapter->tdlsinfo.enable == 0 ) - { - printk("tdls haven't enabled\n"); - return 0; - } - - if ( _rtw_memcmp( extra, "setup=", 6 ) ) - { - wrqu->data.length -=6; - rtw_tdls_setup( dev, info, wrqu, &extra[6] ); - } - else if (_rtw_memcmp( extra, "tear=", 5 ) ) - { - wrqu->data.length -= 5; - rtw_tdls_teardown( dev, info, wrqu, &extra[5] ); - } - else if (_rtw_memcmp( extra, "dis=", 4 ) ) - { - wrqu->data.length -= 4; - rtw_tdls_discovery( dev, info, wrqu, &extra[4] ); - } - else if (_rtw_memcmp( extra, "sw=", 3 ) ) - { - wrqu->data.length -= 3; - rtw_tdls_ch_switch( dev, info, wrqu, &extra[3] ); - } - else if (_rtw_memcmp( extra, "swoff=", 6 ) ) - { - wrqu->data.length -= 6; - rtw_tdls_ch_switch_off( dev, info, wrqu, &extra[6] ); - } - else if (_rtw_memcmp( extra, "pson=", 5 ) ) - { - wrqu->data.length -= 5; - rtw_tdls_pson( dev, info, wrqu, &extra[5] ); - } - else if (_rtw_memcmp( extra, "psoff=", 6 ) ) - { - wrqu->data.length -= 6; - rtw_tdls_psoff( dev, info, wrqu, &extra[6] ); - } -#ifdef CONFIG_P2P - else if (_rtw_memcmp( extra, "setip=", 6 ) ) - { - wrqu->data.length -= 6; - rtw_tdls_setip( dev, info, wrqu, &extra[6] ); - } - else if (_rtw_memcmp( extra, "tprobe=", 6 ) ) - { - issue_tunneled_probe_req((struct adapter *)rtw_netdev_priv(dev)); - } -#endif /* CONFIG_P2P */ - -#endif /* CONFIG_TDLS */ - return ret; } diff --git a/os_dep/os_intfs.c b/os_dep/os_intfs.c index 8dfc14e..a0258d0 100755 --- a/os_dep/os_intfs.c +++ b/os_dep/os_intfs.c @@ -884,15 +884,6 @@ u8 rtw_init_drv_sw(struct adapter *padapter) goto exit; } -#ifdef CONFIG_TDLS - if(rtw_init_tdls_info(padapter) == _FAIL) - { - DBG_871X("Can't rtw_init_tdls_info\n"); - ret8=_FAIL; - goto exit; - } -#endif /* CONFIG_TDLS */ - if(_rtw_init_xmit_priv(&padapter->xmitpriv, padapter) == _FAIL) { DBG_871X("Can't _rtw_init_xmit_priv\n"); @@ -1018,10 +1009,6 @@ u8 rtw_free_drv_sw(struct adapter *padapter) free_mlme_ext_priv(&padapter->mlmeextpriv); -#ifdef CONFIG_TDLS - /* rtw_free_tdls_info(&padapter->tdlsinfo); */ -#endif /* CONFIG_TDLS */ - rtw_free_cmd_priv(&padapter->cmdpriv); rtw_free_evt_priv(&padapter->evtpriv);