rtl8188eu: Remove dead code for CONFIG_TDLS

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2013-07-11 20:13:07 -05:00
parent 0e4009c999
commit e79535e153
23 changed files with 50 additions and 5135 deletions

View file

@ -191,7 +191,6 @@ rtk_core := \
core/rtw_security.o \
core/rtw_sreset.o \
core/rtw_sta_mgt.o \
core/rtw_tdls.o \
core/rtw_wlan_util.o \
core/rtw_xmit.o

View file

@ -1397,22 +1397,12 @@ _func_enter_;
_rtw_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)
_rtw_memcpy(&psetstakey_para->key, sta->tpk.tk, 16);
else
#endif /* CONFIG_TDLS */
_rtw_memcpy(&psetstakey_para->key, &sta->dot118021x_UncstKey, 16);
} else {
_rtw_memcpy(&psetstakey_para->key, &psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey, 16);
@ -1884,47 +1874,7 @@ _func_exit_;
u8 rtw_tdls_cmd(_adapter *padapter, u8 *addr, u8 option)
{
struct cmd_obj* pcmdobj;
struct TDLSoption_param *TDLSoption;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
u8 res=_SUCCESS;
_func_enter_;
#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;
}
spin_lock(&(padapter->tdlsinfo.cmd_lock));
_rtw_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:
_func_exit_;
return res;
return _SUCCESS;
}
static void traffic_status_watchdog(_adapter *padapter)
@ -1938,9 +1888,6 @@ static void traffic_status_watchdog(_adapter *padapter)
u16 bPktCount = 0;
#endif
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
#ifdef CONFIG_TDLS
struct tdls_info *ptdlsinfo = &(padapter->tdlsinfo);
#endif /* CONFIG_TDLS */
/* */
/* Determine if our traffic is busy now */
@ -1993,14 +1940,6 @@ static void traffic_status_watchdog(_adapter *padapter)
}
#endif /* CONFIG_KEEP_FTP_TRANSMIT */
#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_LPS
#ifdef CONFIG_BT_COEXIST
if (BT_1Ant(padapter) == false)

View file

@ -1213,9 +1213,6 @@ void rtw_free_assoc_resources(_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 */
_func_enter_;
RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, ("+rtw_free_assoc_resources\n"));
@ -1227,18 +1224,9 @@ _func_enter_;
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);
} else
#endif /* CONFIG_TDLS */
{
_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
rtw_free_stainfo(adapter, psta);
_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
}
_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
rtw_free_stainfo(adapter, psta);
_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
}
if (check_fwstate( pmlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE|WIFI_AP_STATE)) {

View file

@ -264,14 +264,15 @@ static void init_mlme_ext_priv_value(_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,};
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,
};
ATOMIC_SET(&pmlmeext->event_seq, 0);
pmlmeext->mgnt_seq = 0;/* reset to zero when disconnect at client mode */
@ -620,16 +621,6 @@ void mgt_dispatcher(_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_88E("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));
@ -637,13 +628,9 @@ void mgt_dispatcher(_adapter *padapter, union recv_frame *precv_frame)
}
ptable += index;
#if 1
if (psta != NULL)
{
if (GetRetry(pframe))
{
if (precv_frame->u.hdr.attrib.seq_num == psta->RxMgmtFrameSeqNum)
{
if (psta != NULL) {
if (GetRetry(pframe)) {
if (precv_frame->u.hdr.attrib.seq_num == psta->RxMgmtFrameSeqNum) {
/* drop the duplicate management frame */
DBG_88E("Drop duplicate management frame with seq_num = %d.\n", precv_frame->u.hdr.attrib.seq_num);
return;
@ -651,14 +638,6 @@ void mgt_dispatcher(_adapter *padapter, union recv_frame *precv_frame)
}
psta->RxMgmtFrameSeqNum = precv_frame->u.hdr.attrib.seq_num;
}
#else
if (GetRetry(pframe))
{
/* RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("drop due to decache!\n")); */
/* return; */
}
#endif
#ifdef CONFIG_AP_MODE
switch (GetFrameSubType(pframe))
@ -2386,19 +2365,8 @@ unsigned int OnAction_back(_adapter *padapter, union recv_frame *precv_frame)
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;
}
action = frame_body[1];
DBG_88E("%s, action=%d\n", __func__, action);
@ -10635,13 +10603,6 @@ u8 sitesurvey_cmd_hdl(_adapter *padapter, u8 *pbuf)
#ifdef CONFIG_CONCURRENT_MODE
else if (is_client_associated_to_ap(padapter->pbuddy_adapter) == true)
{
#ifdef CONFIG_TDLS
if (padapter->pbuddy_adapter->wdinfo.wfd_tdls_enable == 1)
{
issue_tunneled_probe_req(padapter->pbuddy_adapter);
}
#endif /* CONFIG_TDLS */
pmlmeext->sitesurvey_res.state = SCAN_TXNULL;
issue_nulldata(padapter->pbuddy_adapter, NULL, 1, 3, 500);
@ -10745,11 +10706,6 @@ u8 set_stakey_hdl(_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 */
@ -10851,20 +10807,6 @@ u8 set_stakey_hdl(_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;
@ -10893,19 +10835,7 @@ u8 add_ba_hdl(_adapter *padapter, unsigned char *pbuf)
issue_action_BA(padapter, pparm->addr, RTW_WLAN_ACTION_ADDBA_REQ, (u16)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, (u16)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);
}
#endif /* CONFIG_80211N_HT */
@ -12126,163 +12056,5 @@ u8 set_csa_hdl(_adapter *padapter, unsigned char *pbuf)
/* TDLS_FREE_STA : free tdls sta */
u8 tdls_hdl(_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_88E("[%s] option:%d\n", __func__, 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_88E("TDLS with %pM\n", 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_88E("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<MAX_CHANNEL_NUM-1; i++){
if (min > 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_88E("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_88E("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_88E("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_88E("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_88E("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_88E("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_88E("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 */
}

View file

@ -929,26 +929,6 @@ u32 build_probe_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf, u8 tunnel
}
#ifdef CONFIG_CONCURRENT_MODE
#ifdef CONFIG_TDLS
if ( ( tunneled == 0 ) && ( padapter->pbuddy_adapter->wdinfo.wfd_tdls_enable == 1 ) )
{
/* Alternative MAC Address ATTR */
/* Type: */
wfdie[ wfdielen++ ] = WFD_ATTR_ALTER_MAC;
/* Length: */
/* Note: In the WFD specification, the size of length field is 2. */
RTW_PUT_BE16(wfdie + wfdielen, ETH_ALEN );
wfdielen += 2;
/* Value: */
/* Alternative MAC Address */
_rtw_memcpy( wfdie + wfdielen, &padapter->pbuddy_adapter->eeprompriv.mac_addr[ 0 ], ETH_ALEN );
/* This mac address is used to make the WFD session when TDLS is enable. */
wfdielen += ETH_ALEN;
}
#endif /* CONFIG_TDLS */
#endif /* CONFIG_CONCURRENT_MODE */
pbuf = rtw_set_ie(pbuf, _VENDOR_SPECIFIC_IE_, wfdielen, (unsigned char *) wfdie, &len);
@ -2632,9 +2612,6 @@ u8 process_p2p_group_negotation_req( struct wifidirect_info *pwdinfo, u8 *pframe
#ifdef CONFIG_WFD
u8 wfd_ie[ 128 ] = { 0x00 };
u32 wfd_ielen = 0;
#ifdef CONFIG_TDLS
struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
#endif /* CONFIG_TDLS */
#endif /* CONFIG_WFD */
#ifdef CONFIG_CONCURRENT_MODE
_adapter *pbuddy_adapter = pwdinfo->padapter->pbuddy_adapter;
@ -2695,23 +2672,10 @@ u8 process_p2p_group_negotation_req( struct wifidirect_info *pwdinfo, u8 *pframe
u8 peer_ch_num = 0;
u8 ch_list_inclusioned[50] = { 0x00 };
u8 ch_num_inclusioned = 0;
#if defined(CONFIG_WFD) && defined(CONFIG_TDLS)
u16 cap_attr;
#endif /* defined(CONFIG_WFD) && defined(CONFIG_TDLS) */
__le16 le_tmp;
rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_ING);
/* Check P2P Capability ATTR */
if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8*)&le_tmp, (uint*)&attr_contentlen) )
{
#if defined(CONFIG_WFD) && defined(CONFIG_TDLS)
cap_attr = le16_to_cpu(le_tmp);
if (!(cap_attr & P2P_GRPCAP_INTRABSS) )
ptdlsinfo->ap_prohibited = true;
#endif /* defined(CONFIG_WFD) && defined(CONFIG_TDLS) */
}
if ( rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_GO_INTENT , &attr_content, &attr_contentlen) )
{
DBG_88E( "[%s] GO Intent = %d, tie = %d\n", __func__, attr_content >> 1, attr_content & 0x01 );
@ -2858,9 +2822,6 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram
#ifdef CONFIG_WFD
u8 wfd_ie[ 128 ] = { 0x00 };
u32 wfd_ielen = 0;
#ifdef CONFIG_TDLS
struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
#endif /* CONFIG_TDLS */
#endif /* CONFIG_WFD */
ies = pframe + _PUBLIC_ACTION_IE_OFFSET_;
@ -2895,9 +2856,6 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram
uint ch_cnt = 0;
u8 ch_content[50] = { 0x00 };
u8 groupid[ 38 ];
#ifdef CONFIG_TDLS
u16 cap_attr;
#endif /* CONFIG_TDLS */
u8 peer_ch_list[50] = { 0x00 };
u8 peer_ch_num = 0;
u8 ch_list_inclusioned[50] = { 0x00 };
@ -2905,15 +2863,6 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram
__le16 le_tmp;
while (p2p_ie) { /* Found the P2P IE. */
/* Check P2P Capability ATTR */
if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8*)&le_tmp, (uint*)&attr_contentlen) ) {
#ifdef CONFIG_TDLS
cap_attr = le16_to_cpu(le_tmp);
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 ) {
DBG_88E( "[%s] Status = %d\n", __func__, attr_content );

View file

@ -484,13 +484,6 @@ void rtw_set_ps_mode(PADAPTER padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode
#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 */
_func_enter_;
@ -526,28 +519,6 @@ _func_enter_;
#endif /* CONFIG_P2P_PS */
{
DBG_88E("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));
@ -563,28 +534,6 @@ _func_enter_;
)
{
DBG_88E("%s: Enter 802.11 power save\n", __func__);
#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;

View file

@ -843,23 +843,13 @@ void process_wmmps_data(_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)
{
if (psta->state&WIFI_SLEEP_STATE) {
u8 wmmps_ac=0;
switch (pattrib->priority)
@ -904,100 +894,6 @@ void process_wmmps_data(_adapter *padapter, union recv_frame *precv_frame)
}
#ifdef CONFIG_TDLS
sint OnTDLS(_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_WFD
u8 WFA_OUI[3] = { 0x50, 0x6f, 0x9a };
#endif /* CONFIG_WFD */
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_88E("recv tdls frame, "
"but tdls haven't enabled\n");
ret = _FAIL;
return ret;
}
switch (*paction){
case TDLS_SETUP_REQUEST:
DBG_88E("recv tdls setup request frame\n");
ret=On_TDLS_Setup_Req(adapter, precv_frame);
break;
case TDLS_SETUP_RESPONSE:
DBG_88E("recv tdls setup response frame\n");
ret=On_TDLS_Setup_Rsp(adapter, precv_frame);
break;
case TDLS_SETUP_CONFIRM:
DBG_88E("recv tdls setup confirm frame\n");
ret=On_TDLS_Setup_Cfm(adapter, precv_frame);
break;
case TDLS_TEARDOWN:
DBG_88E("recv tdls teardown, free sta_info\n");
ret=On_TDLS_Teardown(adapter, precv_frame);
break;
case TDLS_DISCOVERY_REQUEST:
DBG_88E("recv tdls discovery request frame\n");
ret=On_TDLS_Dis_Req(adapter, precv_frame);
break;
case TDLS_PEER_TRAFFIC_RESPONSE:
DBG_88E("recv tdls peer traffic response frame\n");
ret=On_TDLS_Peer_Traffic_Rsp(adapter, precv_frame);
break;
case TDLS_CHANNEL_SWITCH_REQUEST:
DBG_88E("recv tdls channel switch request frame\n");
ret=On_TDLS_Ch_Switch_Req(adapter, precv_frame);
break;
case TDLS_CHANNEL_SWITCH_RESPONSE:
DBG_88E("recv tdls channel switch response frame\n");
ret=On_TDLS_Ch_Switch_Rsp(adapter, precv_frame);
break;
#ifdef CONFIG_WFD
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_88E("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_88E("recv tunneled probe response frame\n");
}
}
break;
#endif /* CONFIG_WFD */
default:
DBG_88E("receive TDLS frame but not supported\n");
ret=_FAIL;
break;
}
exit:
return ret;
}
#endif
void count_rx_stats(_adapter *padapter, union recv_frame *prframe, struct sta_info*sta);
void count_rx_stats(_adapter *padapter, union recv_frame *prframe, struct sta_info*sta)
{
int sz;
@ -1051,14 +947,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
_func_enter_;
if ((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) ||
@ -1089,100 +977,14 @@ _func_enter_;
}
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_88E("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_88E("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) )
{
/* 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) )
{
RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("bssid != TA under STATION_MODE; drop pkt\n"));
ret= _FAIL;
goto exit;
RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("bssid != TA under STATION_MODE; drop pkt\n"));
ret= _FAIL;
goto exit;
}
sta_addr = pattrib->bssid;
}
}
else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true)
@ -1229,11 +1031,6 @@ _func_enter_;
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"));
#ifdef CONFIG_MP_INCLUDED
@ -1743,9 +1540,6 @@ sint validate_recv_data_frame(_adapter *adapter, union recv_frame *precv_frame)
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 */
_func_enter_;
@ -1869,13 +1663,6 @@ _func_enter_;
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));
@ -1914,9 +1701,6 @@ sint validate_recv_frame(_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_WAPI_SUPPORT
PRT_WAPI_T pWapiInfo = &adapter->wapiInfo;
struct recv_frame_hdr *phdr = &precv_frame->u.hdr;
@ -1936,12 +1720,6 @@ _func_enter_;
}
#endif
#ifdef CONFIG_TDLS
if (ptdlsinfo->ch_sensing==1 && ptdlsinfo->cur_channel !=0){
ptdlsinfo->collect_pkt_num[ptdlsinfo->cur_channel-1]++;
}
#endif /* CONFIG_TDLS */
/* add version chk */
if (ver!=0){
RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("validate_recv_data_frame fail! (ver!=0)\n"));
@ -3021,22 +2799,12 @@ int process_recv_indicatepkts(_adapter *padapter, union recv_frame *prframe)
/* 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 */
#ifdef CONFIG_80211N_HT
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]; */
@ -3142,13 +2910,6 @@ static int recv_func_posthandle(_adapter *padapter, union recv_frame *prframe)
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);
@ -3162,19 +2923,6 @@ static int recv_func_posthandle(_adapter *padapter, union recv_frame *prframe)
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"));
@ -3194,13 +2942,7 @@ static int recv_func_posthandle(_adapter *padapter, union recv_frame *prframe)
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 */
#ifdef CONFIG_WAPI_SUPPORT
rtw_wapi_update_info(padapter, prframe);

View file

@ -1552,18 +1552,6 @@ _func_enter_;
{
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_88E("[%s] for tdls link\n", __func__);
prwskey=&ptdls_sta->tpk.tk[0];
}
}
#endif /* CONFIG_TDLS */
for (curfragnum=0;curfragnum<pattrib->nr_frags;curfragnum++){
if ((curfragnum+1)==pattrib->nr_frags){ /* 4 the last fragment */
@ -2640,176 +2628,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(_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) {
_rtw_memcpy(data, myid(&(padapter->eeprompriv)), ETH_ALEN);
_rtw_memcpy(data + ETH_ALEN, psta->hwaddr, ETH_ALEN);
} else {
_rtw_memcpy(data, psta->hwaddr, ETH_ALEN);
_rtw_memcpy(data + ETH_ALEN, myid(&(padapter->eeprompriv)), ETH_ALEN);
}
_rtw_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_88E("TDLS: No memory for MIC calculation\n");
return -1;
}
pos = buf;
_lnkid = (struct wpa_tdls_lnkid *) lnkid;
/* 1) TDLS initiator STA MAC address */
_rtw_memcpy(pos, _lnkid->init_sta, ETH_ALEN);
pos += ETH_ALEN;
/* 2) TDLS responder STA MAC address */
_rtw_memcpy(pos, _lnkid->resp_sta, ETH_ALEN);
pos += ETH_ALEN;
/* 3) Transaction Sequence number */
*pos++ = trans_seq;
/* 4) Link Identifier IE */
_rtw_memcpy(pos, lnkid, 2 + lnkid[1]);
pos += 2 + lnkid[1];
/* 5) RSN IE */
_rtw_memcpy(pos, rsnie, 2 + rsnie[1]);
pos += 2 + rsnie[1];
/* 6) Timeout Interval IE */
_rtw_memcpy(pos, timeoutie, 2 + timeoutie[1]);
pos += 2 + timeoutie[1];
/* 7) FTIE, with the MIC field of the FTIE set to 0 */
_rtw_memcpy(pos, ftie, 2 + ftie[1]);
_ftie = (struct wpa_tdls_ftie *) pos;
_rtw_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 */
_rtw_memcpy(pos, lnkid + ETH_ALEN + 2, ETH_ALEN);
pos += ETH_ALEN;
/* 2) TDLS responder STA MAC address */
_rtw_memcpy(pos, lnkid + 2 * ETH_ALEN + 2, ETH_ALEN);
pos += ETH_ALEN;
/* 3) Transaction Sequence number */
*pos++ = trans_seq;
/* 4) Link Identifier IE */
_rtw_memcpy(pos, lnkid, 2 + 18);
pos += 2 + 18;
/* 5) RSN IE */
_rtw_memcpy(pos, rsnie, 2 + *(rsnie+1));
pos += 2 + *(rsnie+1);
/* 6) Timeout Interval IE */
_rtw_memcpy(pos, timeoutie, 2 + *(timeoutie+1));
pos += 2 + *(timeoutie+1);
/* 7) FTIE, with the MIC field of the FTIE set to 0 */
_rtw_memcpy(pos, ftie, 2 + *(ftie+1));
pos += 2;
tmp_ftie = (u8 *) (pos+2);
_rtw_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_88E( "[%s] Invalid MIC\n", __func__);
return 0;
}
#endif /* CONFIG_TDLS */
void rtw_use_tkipkey_handler(void *FunctionContext)
{
_adapter *padapter = (_adapter *)FunctionContext;

View file

@ -362,16 +362,6 @@ _func_enter_;
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++)
{
@ -492,15 +482,6 @@ _func_enter_;
_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++)
{

File diff suppressed because it is too large Load diff

View file

@ -1295,24 +1295,6 @@ void VCS_update(_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(ADAPTER *Adapter, u8 *pframe, u32 packet_len)
{
unsigned int len;
@ -1528,11 +1510,6 @@ void update_beacon_info(_adapter *padapter, u8 *pframe, uint pkt_len, struct sta
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;)
@ -1550,13 +1527,6 @@ void update_beacon_info(_adapter *padapter, u8 *pframe, uint pkt_len, struct sta
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;
}

View file

@ -1020,12 +1020,6 @@ s32 rtw_make_wlanhdr (_adapter *padapter , u8 *hdr, struct pkt_attrib *pattrib)
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;
u16 *fctrl = &pwlanhdr->frame_ctl;
@ -1053,32 +1047,11 @@ _func_enter_;
if (pattrib->subtype & WIFI_DATA_TYPE) {
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 */
_rtw_memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
_rtw_memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
_rtw_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);
_rtw_memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv), ETH_ALEN);
_rtw_memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
_rtw_memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN);
}
}else
#endif /* CONFIG_TDLS */
{
/* Data transfer to AP */
SetToDs(fctrl);
_rtw_memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv), ETH_ALEN);
_rtw_memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
_rtw_memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN);
}
/* Data transfer to AP */
SetToDs(fctrl);
_rtw_memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv), ETH_ALEN);
_rtw_memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
_rtw_memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN);
if (pqospriv->qos_option)
qos_option = true;
@ -1132,14 +1105,6 @@ _func_enter_;
/* 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;
@ -1183,40 +1148,9 @@ _func_enter_;
}
#endif /* CONFIG_80211N_HT */
#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;
#ifdef CONFIG_80211N_HT
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;
#endif /* CONFIG_80211N_HT */
pattrib->mac_id = ptdls_sta->mac_id;
psta = psta_backup;
}
#endif /* CONFIG_TDLS */
}
}
}
else
{
}
exit:
_func_exit_;
@ -1267,269 +1201,6 @@ s32 rtw_txframes_sta_ac_pending(_adapter *padapter, struct pkt_attrib *pattrib)
return ptxservq->qcnt;
}
#ifdef CONFIG_TDLS
int rtw_build_tdls_ies(_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_WFD
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_WFD */
default:
res=_FAIL;
break;
}
return res;
}
s32 rtw_make_tdls_wlanhdr (_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;
_func_enter_;
_rtw_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);
_rtw_memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv), ETH_ALEN);
_rtw_memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
_rtw_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:
_rtw_memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
_rtw_memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
_rtw_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);
_rtw_memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv), ETH_ALEN);
_rtw_memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
_rtw_memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN);
}
else
{
_rtw_memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
_rtw_memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
_rtw_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:
_func_exit_;
return res;
}
s32 rtw_xmit_tdls_coalesce(_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;
_func_enter_;
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;
}
}
_rtw_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;
_rtw_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:
_func_exit_;
return res;
}
#endif /* CONFIG_TDLS */
/*
* Calculate wlan 802.11 packet MAX size from pkt_attrib
* This function doesn't consider fragment case
@ -2832,82 +2503,7 @@ s32 rtw_xmit(_adapter *padapter, _pkt **ppkt)
return 0;
}
#ifdef CONFIG_TDLS
sint xmitframe_enqueue_for_tdls_sleeping_sta(_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(_adapter *padapter, struct xmit_frame *pxmitframe)
{
@ -2918,27 +2514,14 @@ sint xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *p
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;
if (pattrib->psta)
{
psta = pattrib->psta;
}
else
{
psta=rtw_get_stainfo(pstapriv, pattrib->ra);
}
if (psta==NULL)
return ret;
@ -3103,13 +2686,8 @@ void stop_sta_xmit(_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));
@ -3125,27 +2703,12 @@ void stop_sta_xmit(_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(_adapter *padapter, struct sta_info *psta)
@ -3225,21 +2788,8 @@ void wakeup_sta_to_xmit(_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;
_exit_critical_bh(&psta->sleep_q.lock, &irqL);
return;
}
#endif /* CONFIG_TDLS */
pstapriv->tim_bitmap &= ~BIT(psta->aid);
/* DBG_88E("wakeup to xmit, qlen==0, update_BCNTIM, tim=%x\n", pstapriv->tim_bitmap); */
/* upate BCN for TIM IE */
/* update_BCNTIM(padapter); */
update_mask = BIT(0);
if (psta->state&WIFI_SLEEP_STATE)
@ -3382,32 +2932,18 @@ void xmit_delivery_enabled_frames(_adapter *padapter, struct sta_info *psta)
pxmitframe->attrib.triggered = 1;
if (rtw_hal_xmit(padapter, pxmitframe) == true)
{
rtw_os_xmit_complete(padapter, pxmitframe);
}
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);
return;
}
#endif /* CONFIG_TDLS */
if ((psta->sleepq_ac_len==0) && (!psta->has_legacy_ac) && (wmmps_ac)) {
pstapriv->tim_bitmap &= ~BIT(psta->aid);
/* DBG_88E("wakeup to xmit, qlen==0, update_BCNTIM, tim=%x\n", pstapriv->tim_bitmap); */
/* upate BCN for TIM IE */
/* update_BCNTIM(padapter); */
update_beacon(padapter, _TIM_IE_, NULL, false);
/* update_mask = BIT(0); */
}
}
_exit_critical_bh(&psta->sleep_q.lock, &irqL);
}
#endif

View file

@ -3383,30 +3383,6 @@ _func_enter_;
}
break;
#endif /* CONFIG_P2P_PS */
#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;

View file

@ -139,17 +139,6 @@
//#define CONFIG_P2P_IPS
#endif
// Added by Kurt 20110511
//#define CONFIG_TDLS
#ifdef CONFIG_TDLS
// #ifndef CONFIG_WFD
// #define CONFIG_WFD
// #endif
// #define CONFIG_TDLS_AUTOSETUP
// #define CONFIG_TDLS_AUTOCHECKALIVE
#endif
#define CONFIG_SKB_COPY //for amsdu
#define CONFIG_LED

View file

@ -67,7 +67,6 @@ typedef struct _ADAPTER _adapter, ADAPTER,*PADAPTER;
#include <rtw_led.h>
#include <rtw_mlme_ext.h>
#include <rtw_p2p.h>
#include <rtw_tdls.h>
#include <rtw_ap.h>
#ifdef CONFIG_WAPI_SUPPORT
@ -394,10 +393,6 @@ struct _ADAPTER{
struct wifidirect_info wdinfo;
#endif //CONFIG_P2P
#ifdef CONFIG_TDLS
struct tdls_info tdlsinfo;
#endif //CONFIG_TDLS
#ifdef CONFIG_WAPI_SUPPORT
u8 WapiSupport;
RT_WAPI_T wapiInfo;

View file

@ -1026,26 +1026,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,

View file

@ -320,42 +320,7 @@ 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 FW_Sta_Info {
struct sta_info *psta;
u32 status;
u32 rx_pkt;

View file

@ -414,16 +414,6 @@ void rtw_wep_encrypt(_adapter *padapter, u8 *pxmitframe);
u32 rtw_aes_decrypt(_adapter *padapter, u8 *precvframe);
u32 rtw_tkip_decrypt(_adapter *padapter, u8 *precvframe);
void rtw_wep_decrypt(_adapter *padapter, u8 *precvframe);
#ifdef CONFIG_TDLS
void wpa_tdls_generate_tpk(_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);
#endif //__RTL871X_SECURITY_H_

View file

@ -1,142 +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
*
*
******************************************************************************/
#ifndef __RTW_TDLS_H_
#define __RTW_TDLS_H_
#include <drv_types.h>
#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_TIME 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(_adapter* padapter);
int rtw_init_tdls_info(_adapter* padapter);
void rtw_free_tdls_info(struct tdls_info *ptdlsinfo);
void issue_nulldata_to_TDLS_peer_STA(_adapter *padapter, struct sta_info *ptdls_sta, unsigned int power_mode);
void init_TPK_timer(_adapter *padapter, struct sta_info *psta);
void init_ch_switch_timer(_adapter *padapter, struct sta_info *psta);
void init_base_ch_timer(_adapter *padapter, struct sta_info *psta);
void init_off_ch_timer(_adapter *padapter, struct sta_info *psta);
void init_tdls_alive_timer(_adapter *padapter, struct sta_info *psta);
void init_handshake_timer(_adapter *padapter, struct sta_info *psta);
void free_tdls_sta(_adapter *padapter, struct sta_info *ptdls_sta);
#ifdef CONFIG_WFD
void issue_tunneled_probe_req(_adapter *padapter);
void issue_tunneled_probe_rsp(_adapter *padapter, union recv_frame *precv_frame);
#endif //CONFIG_WFD
void issue_tdls_dis_req(_adapter *padapter, u8 *mac_addr);
void issue_tdls_setup_req(_adapter *padapter, u8 *mac_addr);
void issue_tdls_setup_rsp(_adapter *padapter, union recv_frame *precv_frame);
void issue_tdls_setup_cfm(_adapter *padapter, union recv_frame *precv_frame);
void issue_tdls_dis_rsp(_adapter * padapter, union recv_frame * precv_frame, u8 dialog);
void issue_tdls_teardown(_adapter *padapter, u8 *mac_addr);
void issue_tdls_peer_traffic_indication(_adapter *padapter, struct sta_info *psta);
void issue_tdls_ch_switch_req(_adapter *padapter, u8 *mac_addr);
void issue_tdls_ch_switch_rsp(_adapter *padapter, u8 *mac_addr);
sint On_TDLS_Dis_Rsp(_adapter *adapter, union recv_frame *precv_frame);
sint On_TDLS_Setup_Req(_adapter *adapter, union recv_frame *precv_frame);
sint On_TDLS_Setup_Rsp(_adapter *adapter, union recv_frame *precv_frame);
sint On_TDLS_Setup_Cfm(_adapter *adapter, union recv_frame *precv_frame);
sint On_TDLS_Dis_Req(_adapter *adapter, union recv_frame *precv_frame);
sint On_TDLS_Teardown(_adapter *adapter, union recv_frame *precv_frame);
sint On_TDLS_Peer_Traffic_Rsp(_adapter *adapter, union recv_frame *precv_frame);
sint On_TDLS_Ch_Switch_Req(_adapter *adapter, union recv_frame *precv_frame);
sint On_TDLS_Ch_Switch_Rsp(_adapter *adapter, union recv_frame *precv_frame);
void rtw_build_tdls_setup_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe);
void rtw_build_tdls_setup_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe);
void rtw_build_tdls_setup_cfm_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe);
void rtw_build_tdls_teardown_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe);
void rtw_build_tdls_dis_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe);
void rtw_build_tdls_dis_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe, u8 dialog);
void rtw_build_tdls_peer_traffic_indication_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe);
void rtw_build_tdls_ch_switch_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe);
void rtw_build_tdls_ch_switch_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe);
void rtw_build_tunneled_probe_req_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe);
void rtw_build_tunneled_probe_rsp_ies(_adapter * padapter, struct xmit_frame * pxmitframe, u8 *pframe);
int update_sgi_tdls(_adapter *padapter, struct sta_info *psta);
u32 update_mask_tdls(_adapter *padapter, struct sta_info *psta);
#endif //CONFIG_TDLS
#endif

View file

@ -432,9 +432,6 @@ extern s32 rtw_xmit_classifier(_adapter *padapter, struct xmit_frame *pxmitframe
extern u32 rtw_calculate_wlan_pkt_size_by_attribue(struct pkt_attrib *pattrib);
#define rtw_wlan_pkt_size(f) rtw_calculate_wlan_pkt_size_by_attribue(&f->attrib)
extern s32 rtw_xmitframe_coalesce(_adapter *padapter, _pkt *pkt, struct xmit_frame *pxmitframe);
#ifdef CONFIG_TDLS
s32 rtw_xmit_tdls_coalesce(_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);
@ -454,7 +451,7 @@ void rtw_free_hwxmits(_adapter *padapter);
s32 rtw_xmit(_adapter *padapter, _pkt **pkt);
#if defined(CONFIG_AP_MODE) || defined(CONFIG_TDLS)
#if defined(CONFIG_AP_MODE)
sint xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *pxmitframe);
void stop_sta_xmit(_adapter *padapter, struct sta_info *psta);
void wakeup_sta_to_xmit(_adapter *padapter, struct sta_info *psta);

View file

@ -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;
@ -136,32 +129,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;
_adapter *padapter;
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;

View file

@ -10563,54 +10563,14 @@ static int rtw_wfd_tdls_enable(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret = 0;
#ifdef CONFIG_TDLS
#ifdef CONFIG_WFD
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
printk("[%s] %s %d\n", __func__, extra, wrqu->data.length -1 );
if (extra[ 0 ] == '0')
{
padapter->wdinfo.wfd_tdls_enable = 0;
}
else
{
padapter->wdinfo.wfd_tdls_enable = 1;
}
#endif //CONFIG_WFD
#endif //CONFIG_TDLS
return ret;
return 0;
}
static int rtw_tdls_weaksec(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret = 0;
#ifdef CONFIG_TDLS
u8 i, j;
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
DBG_88E("[%s] %s %d\n", __func__, 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;
return 0;
}
@ -10618,361 +10578,70 @@ static int rtw_tdls_enable(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret = 0;
#ifdef CONFIG_TDLS
_adapter *padapter = (_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", __func__, extra, wrqu->data.length -1 );
_rtw_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)
{
_rtw_memcpy(tdls_sta[index], psta->hwaddr, ETH_ALEN);
}
}
}
_exit_critical_bh(&pstapriv->sta_hash_lock, &irqL);
for (index=0; index< NUM_STA; index++) {
if (!!memcmp(tdls_sta[index], empty_hwaddr, ETH_ALEN)) {
pr_info("issue tear down to %pM\n", 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;
return 0;
}
static int rtw_tdls_setup(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret = 0;
#ifdef CONFIG_TDLS
u8 i, j;
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
u8 mac_addr[ETH_ALEN];
#ifdef CONFIG_WFD
struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
#endif // CONFIG_WFD
printk("[%s] %s %d\n", __func__, 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_WFD
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_88E("[%s] Current link is not AES, SKIP sending the tdls setup request!!\n", __func__);
}
else
{
issue_tdls_setup_req(padapter, mac_addr);
}
}
else
#endif // CONFIG_WFD
{
issue_tdls_setup_req(padapter, mac_addr);
}
#endif
return ret;
return 0;
}
static int rtw_tdls_teardown(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret = 0;
#ifdef CONFIG_TDLS
u8 i,j;
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
struct sta_info *ptdls_sta = NULL;
u8 mac_addr[ETH_ALEN];
DBG_88E("[%s] %s %d\n", __func__, 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;
return 0;
}
static int rtw_tdls_discovery(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret = 0;
#ifdef CONFIG_TDLS
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
DBG_88E("[%s] %s %d\n", __func__, extra, wrqu->data.length -1 );
issue_tdls_dis_req(padapter, NULL);
#endif //CONFIG_TDLS
return ret;
return 0;
}
static int rtw_tdls_ch_switch (struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret = 0;
#ifdef CONFIG_TDLS
_adapter *padapter = (_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_88E("[%s] %s %d\n", __func__, 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;
return 0;
}
static int rtw_tdls_pson(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret = 0;
#ifdef CONFIG_TDLS
_adapter *padapter = (_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_88E("[%s] %s %d\n", __func__, 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;
return 0;
}
static int rtw_tdls_psoff(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret = 0;
#ifdef CONFIG_TDLS
_adapter *padapter = (_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_88E("[%s] %s %d\n", __func__, 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;
return 0;
}
static int rtw_tdls_setip(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret = 0;
#ifdef CONFIG_TDLS
#ifdef CONFIG_WFD
_adapter *padapter = (_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", __func__, 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", __func__,
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_WFD
#endif //CONFIG_TDLS
return ret;
return 0;
}
static int rtw_tdls_getip(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret = 0;
#ifdef CONFIG_TDLS
#ifdef CONFIG_WFD
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
struct wifi_display_info *pwfd_info = ptdlsinfo->wfd_info;
printk("[%s]\n", __func__);
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", __func__,
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_WFD
#endif //CONFIG_TDLS
return ret;
return 0;
}
static int rtw_tdls_getport(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret = 0;
#ifdef CONFIG_TDLS
#ifdef CONFIG_WFD
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
struct wifi_display_info *pwfd_info = ptdlsinfo->wfd_info;
printk("[%s]\n", __func__);
sprintf(extra, "\n\n%d\n", pwfd_info->peer_rtsp_ctrlport);
printk("[%s] remote port = %d\n", __func__, pwfd_info->peer_rtsp_ctrlport);
wrqu->data.length = strlen(extra);
#endif //CONFIG_WFD
#endif //CONFIG_TDLS
return ret;
return 0;
}
@ -10981,31 +10650,7 @@ static int rtw_tdls_dis_result(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret = 0;
#ifdef CONFIG_TDLS
#ifdef CONFIG_WFD
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
struct wifi_display_info *pwfd_info = ptdlsinfo->wfd_info;
printk("[%s]\n", __func__);
if (ptdlsinfo->dev_discovered == 1)
{
sprintf(extra, "\n\nDis=1\n");
ptdlsinfo->dev_discovered = 0;
}
wrqu->data.length = strlen(extra);
#endif //CONFIG_WFD
#endif //CONFIG_TDLS
return ret;
return 0;
}
//WFDTDLS, for sigma test
@ -11013,156 +10658,21 @@ static int rtw_wfd_tdls_status(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret = 0;
#ifdef CONFIG_TDLS
#ifdef CONFIG_WFD
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
struct wifi_display_info *pwfd_info = ptdlsinfo->wfd_info;
printk("[%s]\n", __func__);
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_WFD
#endif //CONFIG_TDLS
return ret;
return 0;
}
static int rtw_tdls_ch_switch_off(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret = 0;
#ifdef CONFIG_TDLS
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
u8 i, j, mac_addr[ETH_ALEN];
struct sta_info *ptdls_sta = NULL;
DBG_88E("[%s] %s %d\n", __func__, 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_88E("issue tdls ch switch req back to base channel\n");
}
*/
#endif //CONFIG_TDLS
return ret;
return 0;
}
static int rtw_tdls(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret = 0;
#ifdef CONFIG_TDLS
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
DBG_88E("[%s] extra = %s\n", __func__, extra);
// WFD Sigma will use the tdls enable command to let the driver know we want to test the tdls now!
if (!memcmp(extra, "wfdenable=", 10))
{
wrqu->data.length -=10;
rtw_wfd_tdls_enable(dev, info, wrqu, &extra[10]);
return ret;
}
else if (!memcmp(extra, "weaksec=", 8))
{
wrqu->data.length -=8;
rtw_tdls_weaksec(dev, info, wrqu, &extra[8]);
return ret;
}
else if (!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 (!memcmp(extra, "setup=", 6))
{
wrqu->data.length -=6;
rtw_tdls_setup(dev, info, wrqu, &extra[6]);
}
else if (!memcmp(extra, "tear=", 5))
{
wrqu->data.length -= 5;
rtw_tdls_teardown(dev, info, wrqu, &extra[5]);
}
else if (!memcmp(extra, "dis=", 4))
{
wrqu->data.length -= 4;
rtw_tdls_discovery(dev, info, wrqu, &extra[4]);
}
else if (!memcmp(extra, "sw=", 3))
{
wrqu->data.length -= 3;
rtw_tdls_ch_switch (dev, info, wrqu, &extra[3]);
}
else if (!memcmp(extra, "swoff=", 6))
{
wrqu->data.length -= 6;
rtw_tdls_ch_switch_off(dev, info, wrqu, &extra[6]);
}
else if (!memcmp(extra, "pson=", 5))
{
wrqu->data.length -= 5;
rtw_tdls_pson(dev, info, wrqu, &extra[5]);
}
else if (!memcmp(extra, "psoff=", 6))
{
wrqu->data.length -= 6;
rtw_tdls_psoff(dev, info, wrqu, &extra[6]);
}
#ifdef CONFIG_WFD
else if (!memcmp(extra, "setip=", 6))
{
wrqu->data.length -= 6;
rtw_tdls_setip(dev, info, wrqu, &extra[6]);
}
else if (!memcmp(extra, "tprobe=", 6))
{
issue_tunneled_probe_req((_adapter *)rtw_netdev_priv(dev));
}
#endif //CONFIG_WFD
#endif //CONFIG_TDLS
return ret;
return 0;
}
@ -11170,8 +10680,6 @@ static int rtw_tdls_get(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret = 0;
#ifdef CONFIG_WFD
DBG_88E("[%s] extra = %s\n", __func__, (char*) wrqu->data.pointer);
@ -11195,25 +10703,19 @@ static int rtw_tdls_get(struct net_device *dev,
}
#endif //CONFIG_WFD
return ret;
return 0;
}
#ifdef CONFIG_INTEL_WIDI
static int rtw_widi_set(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret = 0;
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
process_intel_widi_cmd(padapter, extra);
return ret;
return 0;
}
static int rtw_widi_set_probe_request(struct net_device *dev,

View file

@ -1203,14 +1203,6 @@ _func_enter_;
goto exit;
}
#ifdef CONFIG_TDLS
if (rtw_init_tdls_info(padapter) == _FAIL) {
DBG_88E("Can't rtw_init_tdls_info\n");
ret8=_FAIL;
goto exit;
}
#endif //CONFIG_TDLS
if (_rtw_init_xmit_priv(&padapter->xmitpriv, padapter) == _FAIL) {
DBG_88E("Can't _rtw_init_xmit_priv\n");
ret8=_FAIL;