From 993b4435cbe3632599b1ac31fe1a24405c946ae9 Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Tue, 10 Mar 2015 11:18:03 -0500 Subject: [PATCH] rtl8188eu: Fix most errors from smatch Signed-off-by: Larry Finger --- core/rtw_br_ext.c | 7 +- core/rtw_cmd.c | 10 +- core/rtw_debug.c | 1 - core/rtw_ieee80211.c | 30 +- core/rtw_io.c | 5 +- core/rtw_ioctl_set.c | 56 +- core/rtw_led.c | 31 +- core/rtw_mlme.c | 17 +- core/rtw_mlme_ext.c | 45 +- core/rtw_odm.c | 4 +- core/rtw_p2p.c | 9 - core/rtw_recv.c | 23 +- core/rtw_security.c | 1558 +++++++++++++++++------------------- core/rtw_sta_mgt.c | 9 +- core/rtw_wlan_util.c | 27 +- core/rtw_xmit.c | 17 +- hal/Hal8188ERateAdaptive.c | 16 +- hal/HalHWImg8188E_BB.c | 251 +++--- hal/HalHWImg8188E_MAC.c | 63 +- hal/HalHWImg8188E_RF.c | 2 +- hal/HalPhyRf_8188e.c | 169 ++-- hal/odm.c | 189 ++--- hal/odm_HWConfig.c | 112 ++- hal/odm_RTL8188E.c | 14 +- hal/odm_RegConfig8188E.c | 8 +- hal/rtl8188e_hal_init.c | 17 +- hal/rtl8188e_phycfg.c | 46 +- hal/rtl8188eu_xmit.c | 22 +- hal/usb_halinit.c | 130 +-- hal/usb_ops_linux.c | 90 +-- include/rtw_br_ext.h | 4 +- os_dep/ioctl_cfg80211.c | 145 ++-- os_dep/ioctl_linux.c | 405 +++------- os_dep/mlme_linux.c | 16 +- os_dep/os_intfs.c | 2 +- os_dep/osdep_service.c | 23 +- os_dep/recv_linux.c | 2 + os_dep/usb_intf.c | 114 ++- os_dep/usb_ops_linux.c | 2 +- os_dep/xmit_linux.c | 21 +- 40 files changed, 1508 insertions(+), 2204 deletions(-) diff --git a/core/rtw_br_ext.c b/core/rtw_br_ext.c index a7f92ff..ec1bcbe 100755 --- a/core/rtw_br_ext.c +++ b/core/rtw_br_ext.c @@ -1295,9 +1295,9 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) __nat25_db_print(priv); if (iph->nexthdr == IPPROTO_ICMPV6 && - skb->len > (ETH_HLEN + sizeof(*iph) + 4)) { + skb->len > (ETH_HLEN + sizeof(*iph) + 4)) { if (update_nd_link_layer_addr(skb->data + ETH_HLEN + sizeof(*iph), - skb->len - ETH_HLEN - sizeof(*iph), GET_MY_HWADDR(priv))) { + skb->len - ETH_HLEN - sizeof(*iph), GET_MY_HWADDR(priv))) { struct icmp6hdr *hdr = (struct icmp6hdr *)(skb->data + ETH_HLEN + sizeof(*iph)); hdr->icmp6_cksum = 0; hdr->icmp6_cksum = csum_ipv6_magic(&iph->saddr, &iph->daddr, @@ -1430,8 +1430,7 @@ void dhcp_flag_bcast(struct adapter *priv, struct sk_buff *skb) if(skb == NULL) return; - if(!priv->ethBrExtInfo.dhcp_bcst_disable) - { + if(!priv->ethBrExtInfo.dhcp_bcst_disable) { __be16 protocol = *((__be16 *)(skb->data + 2 * ETH_ALEN)); if(protocol == __constant_htons(ETH_P_IP)) /* IP */ diff --git a/core/rtw_cmd.c b/core/rtw_cmd.c index 6b41abb..7ee2a5d 100755 --- a/core/rtw_cmd.c +++ b/core/rtw_cmd.c @@ -462,7 +462,7 @@ _next: memcpy(pcmdbuf, pcmd->parmbuf, pcmd->cmdsz); - if(pcmd->cmdcode <= (sizeof(wlancmds) /sizeof(struct cmd_hdl))) + if(pcmd->cmdcode < (sizeof(wlancmds) /sizeof(struct cmd_hdl))) { cmd_hdl = wlancmds[pcmd->cmdcode].h2cfuns; @@ -484,7 +484,7 @@ _next: post_process: /* call callback function for post-processed */ - if(pcmd->cmdcode <= (sizeof(rtw_cmd_callback) /sizeof(struct _cmd_callback))) + if(pcmd->cmdcode < (sizeof(rtw_cmd_callback) /sizeof(struct _cmd_callback))) { pcmd_callback = rtw_cmd_callback[pcmd->cmdcode].callback; if(pcmd_callback == NULL) @@ -702,9 +702,6 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, NDIS_802_11_SSID *ssid, int ssi if (ssid[i].SsidLength) { memcpy(&psurveyPara->ssid[i], &ssid[i], sizeof(NDIS_802_11_SSID)); psurveyPara->ssid_num++; - if (0) - DBG_871X(FUNC_ADPT_FMT" ssid:(%s, %d)\n", FUNC_ADPT_ARG(padapter), - psurveyPara->ssid[i].Ssid, psurveyPara->ssid[i].SsidLength); } } } @@ -716,9 +713,6 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, NDIS_802_11_SSID *ssid, int ssi if (ch[i].hw_value && !(ch[i].flags & RTW_IEEE80211_CHAN_DISABLED)) { memcpy(&psurveyPara->ch[i], &ch[i], sizeof(struct rtw_ieee80211_channel)); psurveyPara->ch_num++; - if (0) - DBG_871X(FUNC_ADPT_FMT" ch:%u\n", FUNC_ADPT_ARG(padapter), - psurveyPara->ch[i].hw_value); } } } diff --git a/core/rtw_debug.c b/core/rtw_debug.c index f21a823..a8071c3 100755 --- a/core/rtw_debug.c +++ b/core/rtw_debug.c @@ -692,7 +692,6 @@ int proc_set_rx_signal(struct file *file, const char __user *buffer, return count; signal_strength = signal_strength>100?100:signal_strength; - signal_strength = signal_strength<0?0:signal_strength; padapter->recvpriv.is_signal_dbg = is_signal_dbg; padapter->recvpriv.signal_strength_dbg=signal_strength; diff --git a/core/rtw_ieee80211.c b/core/rtw_ieee80211.c index f013134..89ee1f7 100755 --- a/core/rtw_ieee80211.c +++ b/core/rtw_ieee80211.c @@ -82,36 +82,28 @@ int rtw_get_bit_value_from_ieee_value(u8 val) uint rtw_is_cckrates_included(u8 *rate) { - u32 i = 0; + u32 i = 0; - while(rate[i]!=0) - { - if ( (((rate[i]) & 0x7f) == 2) || (((rate[i]) & 0x7f) == 4) || - (((rate[i]) & 0x7f) == 11) || (((rate[i]) & 0x7f) == 22) ) + while(rate[i]!=0) { + if ((((rate[i]) & 0x7f) == 2) || (((rate[i]) & 0x7f) == 4) || + (((rate[i]) & 0x7f) == 11) || (((rate[i]) & 0x7f) == 22) ) return true; - i++; - } - - return false; + i++; + } + return false; } uint rtw_is_cckratesonly_included(u8 *rate) { u32 i = 0; - - while(rate[i]!=0) - { - if ( (((rate[i]) & 0x7f) != 2) && (((rate[i]) & 0x7f) != 4) && - (((rate[i]) & 0x7f) != 11) && (((rate[i]) & 0x7f) != 22) ) - + while (rate[i]!=0) { + if ((((rate[i]) & 0x7f) != 2) && (((rate[i]) & 0x7f) != 4) && + (((rate[i]) & 0x7f) != 11) && (((rate[i]) & 0x7f) != 22) ) return false; - - i++; + i++; } - return true; - } int rtw_check_network_type(unsigned char *rate, int ratelen, int channel) diff --git a/core/rtw_io.c b/core/rtw_io.c index 79db313..afaf8c7 100755 --- a/core/rtw_io.c +++ b/core/rtw_io.c @@ -188,7 +188,7 @@ void _rtw_read_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem) RT_TRACE(_module_rtl871x_io_c_, _drv_info_, ("rtw_read_mem:bDriverStopped(%d) OR bSurpriseRemoved(%d)", adapter->bDriverStopped, adapter->bSurpriseRemoved)); - return; + return; } _read_mem = pintfhdl->io_ops._read_mem; @@ -262,8 +262,7 @@ u32 _rtw_write_port_and_wait(struct adapter *adapter, u32 addr, u32 cnt, u8 *pme if (ret == _SUCCESS) ret = rtw_sctx_wait(&sctx); - - return ret; + return ret; } void _rtw_write_port_cancel(struct adapter *adapter) diff --git a/core/rtw_ioctl_set.c b/core/rtw_ioctl_set.c index 69ecf38..5d2f6f4 100755 --- a/core/rtw_ioctl_set.c +++ b/core/rtw_ioctl_set.c @@ -684,23 +684,24 @@ u8 rtw_set_802_11_add_wep(struct adapter* padapter, NDIS_802_11_WEP *wep){ goto exit; } - switch(wep->KeyLength) - { - case 5: - psecuritypriv->dot11PrivacyAlgrthm=_WEP40_; - RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("MgntActrtw_set_802_11_add_wep:wep->KeyLength=5\n")); - break; - case 13: - psecuritypriv->dot11PrivacyAlgrthm=_WEP104_; - RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("MgntActrtw_set_802_11_add_wep:wep->KeyLength=13\n")); - break; - default: - psecuritypriv->dot11PrivacyAlgrthm=_NO_PRIVACY_; - RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("MgntActrtw_set_802_11_add_wep:wep->KeyLength!=5 or 13\n")); - break; + switch(wep->KeyLength) { + case 5: + psecuritypriv->dot11PrivacyAlgrthm=_WEP40_; + RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("MgntActrtw_set_802_11_add_wep:wep->KeyLength=5\n")); + break; + case 13: + psecuritypriv->dot11PrivacyAlgrthm=_WEP104_; + RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("MgntActrtw_set_802_11_add_wep:wep->KeyLength=13\n")); + break; + default: + psecuritypriv->dot11PrivacyAlgrthm=_NO_PRIVACY_; + RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("MgntActrtw_set_802_11_add_wep:wep->KeyLength!=5 or 13\n")); + break; } - RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_set_802_11_add_wep:befor memcpy, wep->KeyLength=0x%x wep->KeyIndex=0x%x keyid =%x\n",wep->KeyLength,wep->KeyIndex,keyid)); + RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_, + ("rtw_set_802_11_add_wep:befor memcpy, wep->KeyLength=0x%x wep->KeyIndex=0x%x keyid =%x\n", + wep->KeyLength,wep->KeyIndex,keyid)); memcpy(&(psecuritypriv->dot11DefKey[keyid].skey[0]),&(wep->KeyMaterial),wep->KeyLength); @@ -856,7 +857,8 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, NDIS_802_11_KEY *key){ } /* Check key length for WEP. For NDTEST, 2005.01.27, by rcnjko. */ - if( (encryptionalgo== _WEP40_|| encryptionalgo== _WEP104_) && (key->KeyLength != 5 || key->KeyLength != 13)) { + if ((encryptionalgo == _WEP40_ && key->KeyLength != 5) || + (encryptionalgo== _WEP104_ && key->KeyLength != 13)) { RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("WEP KeyLength:0x%x != 5 or 13\n", key->KeyLength)); ret=_FAIL; goto exit; @@ -871,14 +873,10 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, NDIS_802_11_KEY *key){ RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("key index: 0x%8x(0x%8x)\n", key->KeyIndex,(key->KeyIndex&0x3))); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("key Length: %d\n", key->KeyLength)); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("------------------------------------------\n")); - - } - else - { + } else { /* Group key - KeyIndex(BIT30==0) */ RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("OID_802_11_ADD_KEY: +++++ Group key +++++\n")); - /* when add wep key through add key and didn't assigned encryption type before */ if((padapter->securitypriv.ndisauthtype<=3)&&(padapter->securitypriv.dot118021XGrpPrivacy==0)) { @@ -1160,32 +1158,24 @@ u8 rtw_set_802_11_remove_key(struct adapter* padapter, NDIS_802_11_REMOVE_KEY *k memset(&padapter->securitypriv.dot118021XGrpKey[keyIndex], 0, 16); /* \todo Send a H2C Command to Firmware for removing this Key in CAM Entry. */ - } else { - pbssid=get_bssid(&padapter->mlmepriv); stainfo=rtw_get_stainfo(&padapter->stapriv , pbssid ); if(stainfo !=NULL){ encryptionalgo=stainfo->dot118021XPrivacy; - /* clear key by BSSID */ - memset(&stainfo->dot118021x_UncstKey, 0, 16); + /* clear key by BSSID */ + memset(&stainfo->dot118021x_UncstKey, 0, 16); - /* \todo Send a H2C Command to Firmware for disable this Key in CAM Entry. */ - - } - else{ + /* \todo Send a H2C Command to Firmware for disable this Key in CAM Entry. */ + } else{ ret= _FAIL; goto exit; } } exit: - -; - return true; - } /* diff --git a/core/rtw_led.c b/core/rtw_led.c index c631838..b56440c 100755 --- a/core/rtw_led.c +++ b/core/rtw_led.c @@ -460,7 +460,7 @@ static void SwLedBlink2(PLED_871x pLed) } else { - if( pLed->bLedOn ) + if( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -506,7 +506,7 @@ static void SwLedBlink2(PLED_871x pLed) } else { - if( pLed->bLedOn ) + if( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -770,7 +770,7 @@ static void SwLedBlink4(PLED_871x pLed) } else { - if( pLed->bLedOn ) + if( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -811,7 +811,7 @@ static void SwLedBlink4(PLED_871x pLed) } else { - if( pLed->bLedOn ) + if( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -978,7 +978,7 @@ static void SwLedBlink5(PLED_871x pLed) } else { - if( pLed->bLedOn ) + if( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -1215,7 +1215,7 @@ SwLedControlMode1( if( pLed->bLedLinkBlinkInProgress == true ) { _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedLinkBlinkInProgress = false; + pLed->bLedLinkBlinkInProgress = false; } if(pLed->bLedBlinkInProgress ==true) { @@ -1274,7 +1274,7 @@ SwLedControlMode1( if( pLed->bLedLinkBlinkInProgress == true ) { _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedLinkBlinkInProgress = false; + pLed->bLedLinkBlinkInProgress = false; } if(pLed->bLedBlinkInProgress ==true) { @@ -1306,7 +1306,7 @@ SwLedControlMode1( if( pLed->bLedLinkBlinkInProgress == true ) { _cancel_timer_ex(&(pLed->BlinkTimer)); - pLed->bLedLinkBlinkInProgress = false; + pLed->bLedLinkBlinkInProgress = false; } if(pLed->bLedBlinkInProgress ==true) { @@ -2251,22 +2251,13 @@ LedControl871x( { struct led_priv *ledpriv = &(padapter->ledpriv); - if( (padapter->bSurpriseRemoved == true) || ( padapter->bDriverStopped == true) - ||(padapter->hw_init_completed == false) ) - { - return; - } - + if ((padapter->bSurpriseRemoved) || ( padapter->bDriverStopped) || + (padapter->hw_init_completed == false) ) + return; if( ledpriv->bRegUseLed == false) return; - /* if (!priv->up) */ - /* return; */ - - /* if(priv->bInHctTest) */ - /* return; */ - if( (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) && (LedAction == LED_CTL_TX || LedAction == LED_CTL_RX || diff --git a/core/rtw_mlme.c b/core/rtw_mlme.c index c67b97d..1dea2e0 100755 --- a/core/rtw_mlme.c +++ b/core/rtw_mlme.c @@ -580,8 +580,8 @@ inline int is_same_ess(struct wlan_bssid_ex *a, struct wlan_bssid_ex *b) int is_same_network(struct wlan_bssid_ex *src, struct wlan_bssid_ex *dst, u8 feature) { - __le16 ls_cap, ld_cap; - u16 s_cap, d_cap; + __le16 ls_cap, ld_cap; + u16 s_cap, d_cap; memcpy((u8 *)&ls_cap, rtw_get_capability_from_ie(src->IEs), 2); memcpy((u8 *)&ld_cap, rtw_get_capability_from_ie(dst->IEs), 2); @@ -1383,7 +1383,7 @@ void rtw_indicate_disconnect( struct adapter *padapter ) /* set ips_deny_time to avoid enter IPS before LPS leave */ adapter_to_pwrctl(padapter)->ips_deny_time = rtw_get_current_time() + rtw_ms_to_systime(3000); - _clr_fwstate_(pmlmepriv, _FW_LINKED); + _clr_fwstate_(pmlmepriv, _FW_LINKED); rtw_led_control(padapter, LED_CTL_NO_LINK); @@ -1452,7 +1452,7 @@ static struct sta_info *rtw_joinbss_update_stainfo(struct adapter *padapter, str DBG_871X("%s\n", __FUNCTION__); psta->aid = pnetwork->join_res; - psta->mac_id=0; + psta->mac_id=0; /* sta mode */ rtw_hal_set_odm_var(padapter,HAL_ODM_STA_INFO,psta,true); @@ -2244,8 +2244,6 @@ inline void rtw_clear_scan_deny(struct adapter *adapter) { struct mlme_priv *mlmepriv = &adapter->mlmepriv; ATOMIC_SET(&mlmepriv->set_scan_deny, 0); - if (0) - DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(adapter)); } void rtw_set_scan_deny_timer_hdl(struct adapter *adapter) @@ -2294,10 +2292,9 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv } /* check ssid, if needed */ - if(pmlmepriv->assoc_ssid.Ssid && pmlmepriv->assoc_ssid.SsidLength) { - if( competitor->network.Ssid.SsidLength != pmlmepriv->assoc_ssid.SsidLength - || _rtw_memcmp(competitor->network.Ssid.Ssid, pmlmepriv->assoc_ssid.Ssid, pmlmepriv->assoc_ssid.SsidLength) == false - ) + if (pmlmepriv->assoc_ssid.SsidLength) { + if (competitor->network.Ssid.SsidLength != pmlmepriv->assoc_ssid.SsidLength || + _rtw_memcmp(competitor->network.Ssid.Ssid, pmlmepriv->assoc_ssid.Ssid, pmlmepriv->assoc_ssid.SsidLength) == false) goto exit; } diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c index 2f62e59..8a26615 100755 --- a/core/rtw_mlme_ext.c +++ b/core/rtw_mlme_ext.c @@ -556,18 +556,14 @@ static void _mgt_dispatcher(struct adapter *padapter, struct mlme_handler *ptabl u8 bc_addr[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff}; u8 *pframe = precv_frame->u.hdr.rx_data; - if(ptable->func) - { + if(ptable->func) { /* receive the frames that ra(a1) is my address or ra(a1) is bc address. */ if (!_rtw_memcmp(GetAddr1Ptr(pframe), myid(&padapter->eeprompriv), ETH_ALEN) && !_rtw_memcmp(GetAddr1Ptr(pframe), bc_addr, ETH_ALEN)) - { return; - } ptable->func(padapter, precv_frame); } - } void mgt_dispatcher(struct adapter *padapter, union recv_frame *precv_frame) @@ -1813,25 +1809,17 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) if (pstapriv->sta_aid[pstat->aid - 1] == NULL) break; - /* if (pstat->aid > NUM_STA) { */ if (pstat->aid > pstapriv->max_num_sta) { - pstat->aid = 0; - DBG_871X(" no room for more AIDs\n"); - status = WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA; - goto OnAssocReqFail; - - } else { pstapriv->sta_aid[pstat->aid - 1] = pstat; DBG_871X("allocate new AID = (%d)\n", pstat->aid); } } - pstat->state &= (~WIFI_FW_ASSOC_STATE); pstat->state |= WIFI_FW_ASSOC_SUCCESS; @@ -2999,7 +2987,7 @@ static void issue_p2p_GO_response(struct adapter *padapter, u8* raddr, u8* frame p2pie[ p2pielen++ ] = P2P_ATTR_STATUS; /* Length: */ - *(__le16*) ( p2pie + p2pielen ) = cpu_to_le16( 0x0001 ); + *(__le16*) ( p2pie + p2pielen ) = cpu_to_le16( 0x0001 ); p2pielen += 2; /* Value: */ @@ -4121,16 +4109,14 @@ static u8 is_matched_in_profilelist( u8* peermacaddr, struct profile_info* profi for( i = 0; i < P2P_MAX_PERSISTENT_GROUP_NUM; i++, profileinfo++ ) { - DBG_871X( "[%s] profileinfo_mac = %.2X %.2X %.2X %.2X %.2X %.2X\n", __FUNCTION__, + DBG_871X( "[%s] profileinfo_mac = %.2X %.2X %.2X %.2X %.2X %.2X\n", __FUNCTION__, profileinfo->peermac[0], profileinfo->peermac[1],profileinfo->peermac[2],profileinfo->peermac[3],profileinfo->peermac[4],profileinfo->peermac[5]); - if ( _rtw_memcmp( peermacaddr, profileinfo->peermac, ETH_ALEN ) ) - { + if ( _rtw_memcmp( peermacaddr, profileinfo->peermac, ETH_ALEN ) ) { match_result = 1; DBG_871X( "[%s] Match!\n", __FUNCTION__ ); break; } } - return (match_result ); } @@ -4923,7 +4909,7 @@ static unsigned int on_action_public_p2p(union recv_frame *precv_frame) /* Commented by Kurt 20120113 */ /* Get peer_dev_addr here if peer doesn't issue prov_disc frame. */ - if( _rtw_memcmp(pwdinfo->rx_prov_disc_info.peerDevAddr, empty_addr, ETH_ALEN) ); + if( _rtw_memcmp(pwdinfo->rx_prov_disc_info.peerDevAddr, empty_addr, ETH_ALEN) ) memcpy(pwdinfo->rx_prov_disc_info.peerDevAddr, GetAddr2Ptr(pframe), ETH_ALEN); result = process_p2p_group_negotation_req( pwdinfo, frame_body, len ); @@ -5613,7 +5599,7 @@ s32 dump_mgntframe_and_wait(struct adapter *padapter, struct xmit_frame *pmgntfr pxmitbuf->sctx = NULL; _exit_critical(&pxmitpriv->lock_sctx, &irqL); - return ret; + return ret; } s32 dump_mgntframe_and_wait_ack(struct adapter *padapter, struct xmit_frame *pmgntframe) @@ -5641,7 +5627,7 @@ s32 dump_mgntframe_and_wait_ack(struct adapter *padapter, struct xmit_frame *pmg pxmitpriv->ack_tx = false; _exit_critical_mutex(&pxmitpriv->ack_tx_mutex, NULL); - return ret; + return ret; } static int update_hidden_ssid(u8 *ies, u32 ies_len, u8 hidden_ssid_mode) @@ -8627,9 +8613,10 @@ void start_clnt_join(struct adapter* padapter) for (pos = get_next(head);!rtw_end_of_queue_search(head, pos); pos = get_next(pos)) { scanned = LIST_CONTAINOR(pos, struct wlan_network, list); - if(scanned==NULL) + if(scanned==NULL) { rtw_warn_on(1); - + return; + } if (_rtw_memcmp(&(scanned->network.Ssid), &(pnetwork->Ssid), sizeof(NDIS_802_11_SSID)) == true && _rtw_memcmp(scanned->network.MacAddress, pnetwork->MacAddress, sizeof(NDIS_802_11_MAC_ADDRESS)) == true ) { @@ -9541,11 +9528,10 @@ void mlmeext_sta_del_event_callback(struct adapter *padapter) Following are the functions for the timer handlers *****************************************************************************/ -void _linked_rx_signal_strehgth_display(struct adapter *padapter); void _linked_rx_signal_strehgth_display(struct adapter *padapter) { struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); u8 mac_id; int UndecoratedSmoothedPWDB; if((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE) @@ -10200,8 +10186,6 @@ static int rtw_scan_ch_decision(struct adapter *padapter, struct rtw_ieee80211_c /* acquire channels from in */ j = 0; for (i=0;ichannel_set, in[i].hw_value)) >=0 ) @@ -10588,20 +10572,15 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf) peventbuf += 2; - if(peventbuf) - { + if(peventbuf) { event_callback = wlanevents[evt_code].event_callback; event_callback(padapter, (u8*)peventbuf); pevt_priv->evt_done_cnt++; } - _abort_event_: - - return H2C_SUCCESS; - } u8 h2c_msg_hdl(struct adapter *padapter, unsigned char *pbuf) diff --git a/core/rtw_odm.c b/core/rtw_odm.c index 085a263..c912d5b 100755 --- a/core/rtw_odm.c +++ b/core/rtw_odm.c @@ -113,8 +113,8 @@ int _rtw_odm_dbg_comp_msg(struct adapter *adapter, char *buf, int len) cnt += snprintf(buf+cnt, len-cnt, "odm.DebugComponents = 0x%016llx \n", dbg_comp); for (i=0;irtw_wdev)->p2p_enabled && pwdinfo->listen_channel) { ch = pwdinfo->listen_channel; bw = HT_CHANNEL_WIDTH_20; offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; - if (0) - DBG_871X(FUNC_ADPT_FMT" back to listen ch - ch:%u, bw:%u, offset:%u\n", - FUNC_ADPT_ARG(padapter), ch, bw, offset); } else { ch = pcfg80211_wdinfo->restore_channel; bw = HT_CHANNEL_WIDTH_20; offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; - if (0) - DBG_871X(FUNC_ADPT_FMT" back to restore ch - ch:%u, bw:%u, offset:%u\n", - FUNC_ADPT_ARG(padapter), ch, bw, offset); } set_channel_bwmode(padapter, ch, offset, bw); diff --git a/core/rtw_recv.c b/core/rtw_recv.c index 9ed8f77..a98d43b 100755 --- a/core/rtw_recv.c +++ b/core/rtw_recv.c @@ -243,17 +243,10 @@ int rtw_free_recvframe(union recv_frame *precvframe, _queue *pfree_recv_queue) precvpriv->free_recvframe_cnt++; } - spin_unlock_bh(&pfree_recv_queue->lock); - -; - + spin_unlock_bh(&pfree_recv_queue->lock); return _SUCCESS; - } - - - sint _rtw_enqueue_recvframe(union recv_frame *precvframe, _queue *queue) { @@ -962,9 +955,8 @@ sint sta2sta_data_frame( RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("bssid != TA under STATION_MODE; drop pkt\n")); ret= _FAIL; goto exit; - } - - sta_addr = pattrib->bssid; + } + sta_addr = pattrib->bssid; } } @@ -1784,7 +1776,7 @@ sint validate_recv_frame(struct adapter *adapter, union recv_frame *precv_frame) u8 subtype; sint retval = _SUCCESS; struct rx_pkt_attrib *pattrib = & precv_frame->u.hdr.attrib; - + u8 bDumpRxPkt; u8 *ptr = precv_frame->u.hdr.rx_data; u8 ver =(unsigned char) (*ptr)&0x3 ; #ifdef CONFIG_AP_MODE @@ -1820,8 +1812,6 @@ sint validate_recv_frame(struct adapter *adapter, union recv_frame *precv_frame) pattrib->privacy = GetPrivacy(ptr); pattrib->order = GetOrder(ptr); -{ - u8 bDumpRxPkt; rtw_hal_get_def_var(adapter, HAL_DEF_DBG_DUMP_RXPKT, &(bDumpRxPkt)); if(bDumpRxPkt ==1){/* dump all rx packets */ int i; @@ -1854,7 +1844,6 @@ sint validate_recv_frame(struct adapter *adapter, union recv_frame *precv_frame) DBG_871X("############################# \n"); } } -} switch (type) { case WIFI_MGT_TYPE: /* mgnt */ @@ -2327,7 +2316,7 @@ int amsdu_to_msdu(struct adapter *padapter, union recv_frame *prframe) } /* Indicat the packets to upper layer */ - if (sub_skb) { + { /* memset(sub_skb->cb, 0, sizeof(sub_skb->cb)); */ #ifdef CONFIG_BR_EXT @@ -2511,7 +2500,7 @@ int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reorder_ctr return true; } - prframe = LIST_CONTAINOR(plist, union recv_frame, u); + prframe = LIST_CONTAINOR(plist, union recv_frame, u); pattrib = &prframe->u.hdr.attrib; preorder_ctrl->indicate_seq = pattrib->seq_num; #ifdef DBG_RX_SEQ diff --git a/core/rtw_security.c b/core/rtw_security.c index 88ae69a..8972a74 100755 --- a/core/rtw_security.c +++ b/core/rtw_security.c @@ -209,27 +209,18 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe) arcfour_init(&mycontext, wepkey,3+keylength); arcfour_encrypt(&mycontext, payload, payload, length); arcfour_encrypt(&mycontext, payload+length, crc, 4); - - } - else - { - length=pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len ; + } else { + length=pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len ; *((__le32 *)crc)=getcrc32(payload,length); arcfour_init(&mycontext, wepkey,3+keylength); arcfour_encrypt(&mycontext, payload, payload, length); arcfour_encrypt(&mycontext, payload+length, crc, 4); - pframe+=pxmitpriv->frag_len; - pframe=(u8 *)RND4((SIZE_PTR)(pframe)); - + pframe+=pxmitpriv->frag_len; + pframe=(u8 *)RND4((SIZE_PTR)(pframe)); } - } - } - -; - } void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe) @@ -373,7 +364,6 @@ void rtw_secmicappend(struct mic_data *pmicdata, u8 * src, u32 nbytes ) void rtw_secgetmic(struct mic_data *pmicdata, u8 * dst ) { -; /* Append the minimum padding */ rtw_secmicappendbyte(pmicdata, 0x5a ); rtw_secmicappendbyte(pmicdata, 0 ); @@ -382,36 +372,31 @@ void rtw_secgetmic(struct mic_data *pmicdata, u8 * dst ) rtw_secmicappendbyte(pmicdata, 0 ); /* and then zeroes until the length is a multiple of 4 */ while( pmicdata->nBytesInM != 0 ) - { rtw_secmicappendbyte(pmicdata, 0 ); - } /* The appendByte function has already computed the result. */ secmicputuint32( dst, pmicdata->L ); secmicputuint32( dst+4, pmicdata->R ); /* Reset to the empty message. */ secmicclear(pmicdata); -; } - void rtw_seccalctkipmic(u8 * key,u8 *header,u8 *data,u32 data_len,u8 *mic_code, u8 pri) { struct mic_data micdata; u8 priority[4]={0x0,0x0,0x0,0x0}; -; + rtw_secmicsetkey(&micdata, key); priority[0]=pri; /* Michael MIC pseudo header: DA, SA, 3 x 0, Priority */ if(header[1]&1){ /* ToDS==1 */ - rtw_secmicappend(&micdata, &header[16], 6); /* DA */ + rtw_secmicappend(&micdata, &header[16], 6); /* DA */ if(header[1]&2) /* From Ds==1 */ rtw_secmicappend(&micdata, &header[24], 6); else rtw_secmicappend(&micdata, &header[10], 6); - } - else{ /* ToDS==0 */ + } else{ /* ToDS==0 */ rtw_secmicappend(&micdata, &header[4], 6); /* DA */ if(header[1]&2) /* From Ds==1 */ rtw_secmicappend(&micdata, &header[16], 6); @@ -425,7 +410,6 @@ void rtw_seccalctkipmic(u8 * key,u8 *header,u8 *data,u32 data_len,u8 *mic_code, rtw_secmicappend(&micdata, data, data_len); rtw_secgetmic(&micdata,mic_code); -; } @@ -565,7 +549,7 @@ static void phase1(u16 *p1k,const u8 *tk,const u8 *ta,u32 iv32) p1k[3] += _S_(p1k[2] ^ TK16((i&1)+6)); p1k[4] += _S_(p1k[3] ^ TK16((i&1)+0)); p1k[4] += (unsigned short)i; /* avoid "slide attacks" */ - } + } ; } @@ -599,8 +583,9 @@ static void phase2(u8 *rc4key,const u8 *tk,const u16 *p1k,u16 iv16) u16 PPK[6]; /* temporary key for mixing */ ; /* Note: all adds in the PPK[] equations below are mod 2**16 */ - for (i=0;i<5;i++) PPK[i]=p1k[i]; /* first, copy P1K to PPK */ - PPK[5] = p1k[4] +iv16; /* next, add in IV16 */ + for (i=0;i<5;i++) + PPK[i]=p1k[i]; /* first, copy P1K to PPK */ + PPK[5] = p1k[4] +iv16; /* next, add in IV16 */ /* Bijective non-linear mixing of the 96 bits of PPK[0..5] */ PPK[0] += _S_(PPK[5] ^ TK16(0)); /* Mix key in each "round" */ @@ -724,16 +709,15 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe) arcfour_encrypt(&mycontext, payload, payload, length); arcfour_encrypt(&mycontext, payload+length, crc, 4); - } - else{ + } else{ length=pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len ; *((__le32 *)crc)=getcrc32(payload,length);/* modified by Amy*/ arcfour_init(&mycontext,rc4key,16); arcfour_encrypt(&mycontext, payload, payload, length); arcfour_encrypt(&mycontext, payload+length, crc, 4); - pframe+=pxmitpriv->frag_len; - pframe=(u8 *)RND4((SIZE_PTR)(pframe)); + pframe+=pxmitpriv->frag_len; + pframe=(u8 *)RND4((SIZE_PTR)(pframe)); } } @@ -742,7 +726,7 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe) } else{ RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("rtw_tkip_encrypt: stainfo==NULL!!!\n")); - DBG_871X("%s, psta==NUL\n", __func__); + DBG_871X("%s, psta==NUL\n", __func__); res=_FAIL; } @@ -854,7 +838,7 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe) if(crc[3]!=payload[length-1] || crc[2]!=payload[length-2] || crc[1]!=payload[length-3] || crc[0]!=payload[length-4]) { - RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("rtw_wep_decrypt:icv error crc[3](%x)!=payload[length-1](%x) || crc[2](%x)!=payload[length-2](%x) || crc[1](%x)!=payload[length-3](%x) || crc[0](%x)!=payload[length-4](%x)\n", + RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("rtw_wep_decrypt:icv error crc[3](%x)!=payload[length-1](%x) || crc[2](%x)!=payload[length-2](%x) || crc[1](%x)!=payload[length-3](%x) || crc[0](%x)!=payload[length-4](%x)\n", crc[3],payload[length-1],crc[2],payload[length-2],crc[1],payload[length-3],crc[0],payload[length-4])); res=_FAIL; } @@ -883,41 +867,41 @@ exit: /******** SBOX Table *********/ /*****************************/ - static u8 sbox_table[256] = - { - 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, - 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, - 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, - 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, - 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, - 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, - 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, - 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, - 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, - 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, - 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, - 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, - 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, - 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, - 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, - 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, - 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, - 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, - 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, - 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, - 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, - 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, - 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, - 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, - 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, - 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, - 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, - 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, - 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, - 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, - 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, - 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 - }; +static u8 sbox_table[256] = + { + 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, + 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, + 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, + 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, + 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, + 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, + 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, + 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, + 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, + 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, + 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, + 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, + 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, + 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, + 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, + 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, + 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, + 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, + 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, + 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, + 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, + 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, + 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, + 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, + 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, + 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, + 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, + 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, + 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, + 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, + 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, + 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 + }; /*****************************/ /**** Function Prototypes ****/ @@ -925,31 +909,31 @@ exit: static void bitwise_xor(u8 *ina, u8 *inb, u8 *out); static void construct_mic_iv( - u8 *mic_header1, - sint qc_exists, - sint a4_exists, - u8 *mpdu, - uint payload_length, - u8 * pn_vector, - uint frtype);/* add for CONFIG_IEEE80211W, none 11w also can use */ + u8 *mic_header1, + sint qc_exists, + sint a4_exists, + u8 *mpdu, + uint payload_length, + u8 * pn_vector, + uint frtype);/* add for CONFIG_IEEE80211W, none 11w also can use */ static void construct_mic_header1( - u8 *mic_header1, - sint header_length, - u8 *mpdu, - uint frtype);/* add for CONFIG_IEEE80211W, none 11w also can use */ + u8 *mic_header1, + sint header_length, + u8 *mpdu, + uint frtype);/* add for CONFIG_IEEE80211W, none 11w also can use */ static void construct_mic_header2( - u8 *mic_header2, - u8 *mpdu, - sint a4_exists, - sint qc_exists); + u8 *mic_header2, + u8 *mpdu, + sint a4_exists, + sint qc_exists); static void construct_ctr_preload( - u8 *ctr_preload, - sint a4_exists, - sint qc_exists, - u8 *mpdu, - u8 *pn_vector, - sint c, - uint frtype);/* add for CONFIG_IEEE80211W, none 11w also can use */ + u8 *ctr_preload, + sint a4_exists, + sint qc_exists, + u8 *mpdu, + u8 *pn_vector, + sint c, + uint frtype);/* add for CONFIG_IEEE80211W, none 11w also can use */ static void xor_128(u8 *a, u8 *b, u8 *out); static void xor_32(u8 *a, u8 *b, u8 *out); static u8 sbox(u8 a); @@ -958,10 +942,10 @@ static void byte_sub(u8 *in, u8 *out); static void shift_row(u8 *in, u8 *out); static void mix_column(u8 *in, u8 *out); static void add_round_key( u8 *shiftrow_in, - u8 *mcol_in, - u8 *block_in, - sint round, - u8 *out); + u8 *mcol_in, + u8 *block_in, + sint round, + u8 *out); static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext); @@ -972,69 +956,69 @@ static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext); /****************************************/ static void xor_128(u8 *a, u8 *b, u8 *out) { - sint i; + sint i; ; - for (i=0;i<16; i++) - { - out[i] = a[i] ^ b[i]; - } + for (i=0;i<16; i++) + { + out[i] = a[i] ^ b[i]; + } ; } static void xor_32(u8 *a, u8 *b, u8 *out) { - sint i; + sint i; ; - for (i=0;i<4; i++) - { - out[i] = a[i] ^ b[i]; - } + for (i=0;i<4; i++) + { + out[i] = a[i] ^ b[i]; + } ; } static u8 sbox(u8 a) { - return sbox_table[(sint)a]; + return sbox_table[(sint)a]; } static void next_key(u8 *key, sint round) { - u8 rcon; - u8 sbox_key[4]; - u8 rcon_table[12] = - { - 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, - 0x1b, 0x36, 0x36, 0x36 - }; + u8 rcon; + u8 sbox_key[4]; + u8 rcon_table[12] = + { + 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, + 0x1b, 0x36, 0x36, 0x36 + }; ; - sbox_key[0] = sbox(key[13]); - sbox_key[1] = sbox(key[14]); - sbox_key[2] = sbox(key[15]); - sbox_key[3] = sbox(key[12]); + sbox_key[0] = sbox(key[13]); + sbox_key[1] = sbox(key[14]); + sbox_key[2] = sbox(key[15]); + sbox_key[3] = sbox(key[12]); - rcon = rcon_table[round]; + rcon = rcon_table[round]; - xor_32(&key[0], sbox_key, &key[0]); - key[0] = key[0] ^ rcon; + xor_32(&key[0], sbox_key, &key[0]); + key[0] = key[0] ^ rcon; - xor_32(&key[4], &key[0], &key[4]); - xor_32(&key[8], &key[4], &key[8]); - xor_32(&key[12], &key[8], &key[12]); + xor_32(&key[4], &key[0], &key[4]); + xor_32(&key[8], &key[4], &key[8]); + xor_32(&key[12], &key[8], &key[12]); ; } static void byte_sub(u8 *in, u8 *out) { - sint i; + sint i; ; - for (i=0; i< 16; i++) - { - out[i] = sbox(in[i]); - } + for (i=0; i< 16; i++) + { + out[i] = sbox(in[i]); + } ; } @@ -1042,124 +1026,124 @@ static void byte_sub(u8 *in, u8 *out) static void shift_row(u8 *in, u8 *out) { ; - out[0] = in[0]; - out[1] = in[5]; - out[2] = in[10]; - out[3] = in[15]; - out[4] = in[4]; - out[5] = in[9]; - out[6] = in[14]; - out[7] = in[3]; - out[8] = in[8]; - out[9] = in[13]; - out[10] = in[2]; - out[11] = in[7]; - out[12] = in[12]; - out[13] = in[1]; - out[14] = in[6]; - out[15] = in[11]; + out[0] = in[0]; + out[1] = in[5]; + out[2] = in[10]; + out[3] = in[15]; + out[4] = in[4]; + out[5] = in[9]; + out[6] = in[14]; + out[7] = in[3]; + out[8] = in[8]; + out[9] = in[13]; + out[10] = in[2]; + out[11] = in[7]; + out[12] = in[12]; + out[13] = in[1]; + out[14] = in[6]; + out[15] = in[11]; ; } static void mix_column(u8 *in, u8 *out) { - sint i; - u8 add1b[4]; - u8 add1bf7[4]; - u8 rotl[4]; - u8 swap_halfs[4]; - u8 andf7[4]; - u8 rotr[4]; - u8 temp[4]; - u8 tempb[4]; + sint i; + u8 add1b[4]; + u8 add1bf7[4]; + u8 rotl[4]; + u8 swap_halfs[4]; + u8 andf7[4]; + u8 rotr[4]; + u8 temp[4]; + u8 tempb[4]; ; - for (i=0 ; i<4; i++) - { - if ((in[i] & 0x80)== 0x80) - add1b[i] = 0x1b; - else - add1b[i] = 0x00; - } + for (i=0 ; i<4; i++) + { + if ((in[i] & 0x80)== 0x80) + add1b[i] = 0x1b; + else + add1b[i] = 0x00; + } - swap_halfs[0] = in[2]; /* Swap halfs */ - swap_halfs[1] = in[3]; - swap_halfs[2] = in[0]; - swap_halfs[3] = in[1]; + swap_halfs[0] = in[2]; /* Swap halfs */ + swap_halfs[1] = in[3]; + swap_halfs[2] = in[0]; + swap_halfs[3] = in[1]; - rotl[0] = in[3]; /* Rotate left 8 bits */ - rotl[1] = in[0]; - rotl[2] = in[1]; - rotl[3] = in[2]; + rotl[0] = in[3]; /* Rotate left 8 bits */ + rotl[1] = in[0]; + rotl[2] = in[1]; + rotl[3] = in[2]; - andf7[0] = in[0] & 0x7f; - andf7[1] = in[1] & 0x7f; - andf7[2] = in[2] & 0x7f; - andf7[3] = in[3] & 0x7f; + andf7[0] = in[0] & 0x7f; + andf7[1] = in[1] & 0x7f; + andf7[2] = in[2] & 0x7f; + andf7[3] = in[3] & 0x7f; - for (i = 3; i>0; i--) /* logical shift left 1 bit */ - { - andf7[i] = andf7[i] << 1; - if ((andf7[i-1] & 0x80) == 0x80) - { - andf7[i] = (andf7[i] | 0x01); - } - } - andf7[0] = andf7[0] << 1; - andf7[0] = andf7[0] & 0xfe; + for (i = 3; i>0; i--) /* logical shift left 1 bit */ + { + andf7[i] = andf7[i] << 1; + if ((andf7[i-1] & 0x80) == 0x80) + { + andf7[i] = (andf7[i] | 0x01); + } + } + andf7[0] = andf7[0] << 1; + andf7[0] = andf7[0] & 0xfe; - xor_32(add1b, andf7, add1bf7); + xor_32(add1b, andf7, add1bf7); - xor_32(in, add1bf7, rotr); + xor_32(in, add1bf7, rotr); - temp[0] = rotr[0]; /* Rotate right 8 bits */ - rotr[0] = rotr[1]; - rotr[1] = rotr[2]; - rotr[2] = rotr[3]; - rotr[3] = temp[0]; + temp[0] = rotr[0]; /* Rotate right 8 bits */ + rotr[0] = rotr[1]; + rotr[1] = rotr[2]; + rotr[2] = rotr[3]; + rotr[3] = temp[0]; - xor_32(add1bf7, rotr, temp); - xor_32(swap_halfs, rotl,tempb); - xor_32(temp, tempb, out); + xor_32(add1bf7, rotr, temp); + xor_32(swap_halfs, rotl,tempb); + xor_32(temp, tempb, out); ; } static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext) { - sint round; - sint i; - u8 intermediatea[16]; - u8 intermediateb[16]; - u8 round_key[16]; + sint round; + sint i; + u8 intermediatea[16]; + u8 intermediateb[16]; + u8 round_key[16]; ; - for(i=0; i<16; i++) round_key[i] = key[i]; + for(i=0; i<16; i++) round_key[i] = key[i]; - for (round = 0; round < 11; round++) - { - if (round == 0) - { - xor_128(round_key, data, ciphertext); - next_key(round_key, round); - } - else if (round == 10) - { - byte_sub(ciphertext, intermediatea); - shift_row(intermediatea, intermediateb); - xor_128(intermediateb, round_key, ciphertext); - } - else /* 1 - 9 */ - { - byte_sub(ciphertext, intermediatea); - shift_row(intermediatea, intermediateb); - mix_column(&intermediateb[0], &intermediatea[0]); - mix_column(&intermediateb[4], &intermediatea[4]); - mix_column(&intermediateb[8], &intermediatea[8]); - mix_column(&intermediateb[12], &intermediatea[12]); - xor_128(intermediatea, round_key, ciphertext); - next_key(round_key, round); - } - } + for (round = 0; round < 11; round++) + { + if (round == 0) + { + xor_128(round_key, data, ciphertext); + next_key(round_key, round); + } + else if (round == 10) + { + byte_sub(ciphertext, intermediatea); + shift_row(intermediatea, intermediateb); + xor_128(intermediateb, round_key, ciphertext); + } + else /* 1 - 9 */ + { + byte_sub(ciphertext, intermediatea); + shift_row(intermediatea, intermediateb); + mix_column(&intermediateb[0], &intermediatea[0]); + mix_column(&intermediateb[4], &intermediatea[4]); + mix_column(&intermediateb[8], &intermediatea[8]); + mix_column(&intermediateb[12], &intermediatea[12]); + xor_128(intermediatea, round_key, ciphertext); + next_key(round_key, round); + } + } ; } @@ -1171,41 +1155,39 @@ static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext) /* nonce */ /************************************************/ static void construct_mic_iv( - u8 *mic_iv, - sint qc_exists, - sint a4_exists, - u8 *mpdu, - uint payload_length, - u8 *pn_vector, - uint frtype/* add for CONFIG_IEEE80211W, none 11w also can use */ - ) + u8 *mic_iv, + sint qc_exists, + sint a4_exists, + u8 *mpdu, + uint payload_length, + u8 *pn_vector, + uint frtype/* add for CONFIG_IEEE80211W, none 11w also can use */ + ) { - sint i; -; - mic_iv[0] = 0x59; - if (qc_exists && a4_exists) mic_iv[1] = mpdu[30] & 0x0f; /* QoS_TC */ - if (qc_exists && !a4_exists) mic_iv[1] = mpdu[24] & 0x0f; /* mute bits 7-4 */ - if (!qc_exists) mic_iv[1] = 0x00; + sint i; + + mic_iv[0] = 0x59; + if (qc_exists && a4_exists) mic_iv[1] = mpdu[30] & 0x0f; /* QoS_TC */ + if (qc_exists && !a4_exists) mic_iv[1] = mpdu[24] & 0x0f; /* mute bits 7-4 */ + if (!qc_exists) mic_iv[1] = 0x00; #ifdef CONFIG_IEEE80211W /* 802.11w management frame should set management bit(4) */ - if(frtype == WIFI_MGT_TYPE) + if(frtype == WIFI_MGT_TYPE) mic_iv[1] |= BIT(4); #endif /* CONFIG_IEEE80211W */ - for (i = 2; i < 8; i++) - mic_iv[i] = mpdu[i + 8]; /* mic_iv[2:7] = A2[0:5] = mpdu[10:15] */ - #ifdef CONSISTENT_PN_ORDER - for (i = 8; i < 14; i++) - mic_iv[i] = pn_vector[i - 8]; /* mic_iv[8:13] = PN[0:5] */ - #else - for (i = 8; i < 14; i++) - mic_iv[i] = pn_vector[13 - i]; /* mic_iv[8:13] = PN[5:0] */ - #endif - mic_iv[14] = (unsigned char) (payload_length / 256); - mic_iv[15] = (unsigned char) (payload_length % 256); -; + for (i = 2; i < 8; i++) + mic_iv[i] = mpdu[i + 8]; /* mic_iv[2:7] = A2[0:5] = mpdu[10:15] */ + #ifdef CONSISTENT_PN_ORDER + for (i = 8; i < 14; i++) + mic_iv[i] = pn_vector[i - 8]; /* mic_iv[8:13] = PN[0:5] */ + #else + for (i = 8; i < 14; i++) + mic_iv[i] = pn_vector[13 - i]; /* mic_iv[8:13] = PN[5:0] */ + #endif + mic_iv[14] = (unsigned char) (payload_length / 256); + mic_iv[15] = (unsigned char) (payload_length % 256); } - /************************************************/ /* construct_mic_header1() */ /* Builds the first MIC header block from */ @@ -1213,36 +1195,36 @@ static void construct_mic_iv( /* Build AAD SC,A1,A2 */ /************************************************/ static void construct_mic_header1( - u8 *mic_header1, - sint header_length, - u8 *mpdu, - uint frtype/* add for CONFIG_IEEE80211W, none 11w also can use */ - ) + u8 *mic_header1, + sint header_length, + u8 *mpdu, + uint frtype/* add for CONFIG_IEEE80211W, none 11w also can use */ + ) { ; - mic_header1[0] = (u8)((header_length - 2) / 256); - mic_header1[1] = (u8)((header_length - 2) % 256); + mic_header1[0] = (u8)((header_length - 2) / 256); + mic_header1[1] = (u8)((header_length - 2) % 256); #ifdef CONFIG_IEEE80211W - /* 802.11w management frame don't AND subtype bits 4,5,6 of frame control field */ - if(frtype == WIFI_MGT_TYPE) + /* 802.11w management frame don't AND subtype bits 4,5,6 of frame control field */ + if(frtype == WIFI_MGT_TYPE) mic_header1[2] = mpdu[0]; /* Mute CF poll & CF ack bits */ else #endif /* CONFIG_IEEE80211W */ mic_header1[2] = mpdu[0] & 0xcf; /* Mute CF poll & CF ack bits */ - mic_header1[3] = mpdu[1] & 0xc7; /* Mute retry, more data and pwr mgt bits */ - mic_header1[4] = mpdu[4]; /* A1 */ - mic_header1[5] = mpdu[5]; - mic_header1[6] = mpdu[6]; - mic_header1[7] = mpdu[7]; - mic_header1[8] = mpdu[8]; - mic_header1[9] = mpdu[9]; - mic_header1[10] = mpdu[10]; /* A2 */ - mic_header1[11] = mpdu[11]; - mic_header1[12] = mpdu[12]; - mic_header1[13] = mpdu[13]; - mic_header1[14] = mpdu[14]; - mic_header1[15] = mpdu[15]; + mic_header1[3] = mpdu[1] & 0xc7; /* Mute retry, more data and pwr mgt bits */ + mic_header1[4] = mpdu[4]; /* A1 */ + mic_header1[5] = mpdu[5]; + mic_header1[6] = mpdu[6]; + mic_header1[7] = mpdu[7]; + mic_header1[8] = mpdu[8]; + mic_header1[9] = mpdu[9]; + mic_header1[10] = mpdu[10]; /* A2 */ + mic_header1[11] = mpdu[11]; + mic_header1[12] = mpdu[12]; + mic_header1[13] = mpdu[13]; + mic_header1[14] = mpdu[14]; + mic_header1[15] = mpdu[15]; ; } @@ -1253,46 +1235,46 @@ static void construct_mic_header1( /* header fields. */ /************************************************/ static void construct_mic_header2( - u8 *mic_header2, - u8 *mpdu, - sint a4_exists, - sint qc_exists - ) + u8 *mic_header2, + u8 *mpdu, + sint a4_exists, + sint qc_exists + ) { - sint i; + sint i; ; - for (i = 0; i<16; i++) mic_header2[i]=0x00; + for (i = 0; i<16; i++) mic_header2[i]=0x00; - mic_header2[0] = mpdu[16]; /* A3 */ - mic_header2[1] = mpdu[17]; - mic_header2[2] = mpdu[18]; - mic_header2[3] = mpdu[19]; - mic_header2[4] = mpdu[20]; - mic_header2[5] = mpdu[21]; + mic_header2[0] = mpdu[16]; /* A3 */ + mic_header2[1] = mpdu[17]; + mic_header2[2] = mpdu[18]; + mic_header2[3] = mpdu[19]; + mic_header2[4] = mpdu[20]; + mic_header2[5] = mpdu[21]; - mic_header2[6] = 0x00; - mic_header2[7] = 0x00; /* mpdu[23]; */ + mic_header2[6] = 0x00; + mic_header2[7] = 0x00; /* mpdu[23]; */ - if (!qc_exists && a4_exists) - { - for (i=0;i<6;i++) mic_header2[8+i] = mpdu[24+i]; /* A4 */ + if (!qc_exists && a4_exists) + { + for (i=0;i<6;i++) mic_header2[8+i] = mpdu[24+i]; /* A4 */ - } + } - if (qc_exists && !a4_exists) - { - mic_header2[8] = mpdu[24] & 0x0f; /* mute bits 15 - 4 */ - mic_header2[9] = mpdu[25] & 0x00; - } + if (qc_exists && !a4_exists) + { + mic_header2[8] = mpdu[24] & 0x0f; /* mute bits 15 - 4 */ + mic_header2[9] = mpdu[25] & 0x00; + } - if (qc_exists && a4_exists) - { - for (i=0;i<6;i++) mic_header2[8+i] = mpdu[24+i]; /* A4 */ + if (qc_exists && a4_exists) + { + for (i=0;i<6;i++) mic_header2[8+i] = mpdu[24+i]; /* A4 */ - mic_header2[14] = mpdu[30] & 0x0f; - mic_header2[15] = mpdu[31] & 0x00; - } + mic_header2[14] = mpdu[30] & 0x0f; + mic_header2[15] = mpdu[31] & 0x00; + } ; } @@ -1306,42 +1288,42 @@ static void construct_mic_header2( /* nonce */ /************************************************/ static void construct_ctr_preload( - u8 *ctr_preload, - sint a4_exists, - sint qc_exists, - u8 *mpdu, - u8 *pn_vector, - sint c, - uint frtype /* add for CONFIG_IEEE80211W, none 11w also can use */ - ) + u8 *ctr_preload, + sint a4_exists, + sint qc_exists, + u8 *mpdu, + u8 *pn_vector, + sint c, + uint frtype /* add for CONFIG_IEEE80211W, none 11w also can use */ + ) { - sint i = 0; + sint i = 0; ; - for (i=0; i<16; i++) ctr_preload[i] = 0x00; - i = 0; + for (i=0; i<16; i++) + ctr_preload[i] = 0x00; + i = 0; - ctr_preload[0] = 0x01; /* flag */ - if (qc_exists && a4_exists) + ctr_preload[0] = 0x01; /* flag */ + if (qc_exists && a4_exists) ctr_preload[1] = mpdu[30] & 0x0f; /* QoC_Control */ - if (qc_exists && !a4_exists) + if (qc_exists && !a4_exists) ctr_preload[1] = mpdu[24] & 0x0f; #ifdef CONFIG_IEEE80211W /* 802.11w management frame should set management bit(4) */ if(frtype == WIFI_MGT_TYPE) ctr_preload[1] |= BIT(4); #endif /* CONFIG_IEEE80211W */ - for (i = 2; i < 8; i++) - ctr_preload[i] = mpdu[i + 8]; /* ctr_preload[2:7] = A2[0:5] = mpdu[10:15] */ - #ifdef CONSISTENT_PN_ORDER - for (i = 8; i < 14; i++) - ctr_preload[i] = pn_vector[i - 8]; /* ctr_preload[8:13] = PN[0:5] */ - #else - for (i = 8; i < 14; i++) - ctr_preload[i] = pn_vector[13 - i]; /* ctr_preload[8:13] = PN[5:0] */ - #endif - ctr_preload[14] = (unsigned char) (c / 256); /* Ctr */ - ctr_preload[15] = (unsigned char) (c % 256); -; + for (i = 2; i < 8; i++) + ctr_preload[i] = mpdu[i + 8]; /* ctr_preload[2:7] = A2[0:5] = mpdu[10:15] */ + #ifdef CONSISTENT_PN_ORDER + for (i = 8; i < 14; i++) + ctr_preload[i] = pn_vector[i - 8]; /* ctr_preload[8:13] = PN[0:5] */ + #else + for (i = 8; i < 14; i++) + ctr_preload[i] = pn_vector[13 - i]; /* ctr_preload[8:13] = PN[5:0] */ + #endif + ctr_preload[14] = (unsigned char) (c / 256); /* Ctr */ + ctr_preload[15] = (unsigned char) (c % 256); } @@ -1351,12 +1333,12 @@ static void construct_ctr_preload( /************************************/ static void bitwise_xor(u8 *ina, u8 *inb, u8 *out) { - sint i; + sint i; ; - for (i=0; i<16; i++) - { - out[i] = ina[i] ^ inb[i]; - } + for (i=0; i<16; i++) + { + out[i] = ina[i] ^ inb[i]; + } ; } @@ -1381,10 +1363,7 @@ static sint aes_cipher(u8 *key, uint hdrlen, uint frtype = GetFrameType(pframe); uint frsubtype = GetFrameSubType(pframe); -; frsubtype=frsubtype>>4; - - memset((void *)mic_iv, 0, 16); memset((void *)mic_header1, 0, 16); memset((void *)mic_header2, 0, 16); @@ -1398,31 +1377,23 @@ static sint aes_cipher(u8 *key, uint hdrlen, else a4_exists = 1; - if ( - ((frtype|frsubtype) == WIFI_DATA_CFACK) || - ((frtype|frsubtype) == WIFI_DATA_CFPOLL)|| - ((frtype|frsubtype) == WIFI_DATA_CFACKPOLL)) - { - qc_exists = 1; - if(hdrlen != WLAN_HDR_A3_QOS_LEN){ - - hdrlen += 2; - } - } + if (((frtype|frsubtype) == WIFI_DATA_CFACK) || + ((frtype|frsubtype) == WIFI_DATA_CFPOLL)|| + ((frtype|frsubtype) == WIFI_DATA_CFACKPOLL)) { + qc_exists = 1; + if(hdrlen != WLAN_HDR_A3_QOS_LEN) + hdrlen += 2; + } /* add for CONFIG_IEEE80211W, none 11w also can use */ else if ((frtype == WIFI_DATA) && ((frsubtype == 0x08) || (frsubtype == 0x09)|| (frsubtype == 0x0a)|| - (frsubtype == 0x0b))) - { - if(hdrlen != WLAN_HDR_A3_QOS_LEN){ - - hdrlen += 2; - } - qc_exists = 1; - } - else + (frsubtype == 0x0b))) { + if(hdrlen != WLAN_HDR_A3_QOS_LEN) + hdrlen += 2; + qc_exists = 1; + } else qc_exists = 0; pn_vector[0]=pframe[hdrlen]; @@ -1433,133 +1404,127 @@ static sint aes_cipher(u8 *key, uint hdrlen, pn_vector[5]=pframe[hdrlen+7]; construct_mic_iv( - mic_iv, - qc_exists, - a4_exists, - pframe, /* message, */ - plen, - pn_vector, - frtype /* add for CONFIG_IEEE80211W, none 11w also can use */ - ); + mic_iv, + qc_exists, + a4_exists, + pframe, /* message, */ + plen, + pn_vector, + frtype /* add for CONFIG_IEEE80211W, none 11w also can use */ + ); - construct_mic_header1( - mic_header1, - hdrlen, - pframe, /* message */ - frtype /* add for CONFIG_IEEE80211W, none 11w also can use */ - ); - construct_mic_header2( - mic_header2, - pframe, /* message, */ - a4_exists, - qc_exists - ); + construct_mic_header1( + mic_header1, + hdrlen, + pframe, /* message */ + frtype /* add for CONFIG_IEEE80211W, none 11w also can use */ + ); + construct_mic_header2( + mic_header2, + pframe, /* message, */ + a4_exists, + qc_exists + ); payload_remainder = plen % 16; - num_blocks = plen / 16; + num_blocks = plen / 16; - /* Find start of payload */ - payload_index = (hdrlen + 8); + /* Find start of payload */ + payload_index = (hdrlen + 8); - /* Calculate MIC */ - aes128k128d(key, mic_iv, aes_out); - bitwise_xor(aes_out, mic_header1, chain_buffer); - aes128k128d(key, chain_buffer, aes_out); - bitwise_xor(aes_out, mic_header2, chain_buffer); - aes128k128d(key, chain_buffer, aes_out); + /* Calculate MIC */ + aes128k128d(key, mic_iv, aes_out); + bitwise_xor(aes_out, mic_header1, chain_buffer); + aes128k128d(key, chain_buffer, aes_out); + bitwise_xor(aes_out, mic_header2, chain_buffer); + aes128k128d(key, chain_buffer, aes_out); - for (i = 0; i < num_blocks; i++) - { - bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);/* bitwise_xor(aes_out, &message[payload_index], chain_buffer); */ + for (i = 0; i < num_blocks; i++) { + bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);/* bitwise_xor(aes_out, &message[payload_index], chain_buffer); */ - payload_index += 16; - aes128k128d(key, chain_buffer, aes_out); - } + payload_index += 16; + aes128k128d(key, chain_buffer, aes_out); + } - /* Add on the final payload block if it needs padding */ - if (payload_remainder > 0) - { - for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; - for (j = 0; j < payload_remainder; j++) - { - padded_buffer[j] = pframe[payload_index++];/* padded_buffer[j] = message[payload_index++]; */ - } - bitwise_xor(aes_out, padded_buffer, chain_buffer); - aes128k128d(key, chain_buffer, aes_out); + /* Add on the final payload block if it needs padding */ + if (payload_remainder > 0) { + for (j = 0; j < 16; j++) + padded_buffer[j] = 0x00; + for (j = 0; j < payload_remainder; j++) + padded_buffer[j] = pframe[payload_index++];/* padded_buffer[j] = message[payload_index++]; */ + bitwise_xor(aes_out, padded_buffer, chain_buffer); + aes128k128d(key, chain_buffer, aes_out); - } + } - for (j = 0 ; j < 8; j++) mic[j] = aes_out[j]; + for (j = 0 ; j < 8; j++) + mic[j] = aes_out[j]; - /* Insert MIC into payload */ - for (j = 0; j < 8; j++) - pframe[payload_index+j] = mic[j]; /* message[payload_index+j] = mic[j]; */ + /* Insert MIC into payload */ + for (j = 0; j < 8; j++) + pframe[payload_index+j] = mic[j]; /* message[payload_index+j] = mic[j]; */ payload_index = hdrlen + 8; - for (i=0; i< num_blocks; i++) - { - construct_ctr_preload( - ctr_preload, - a4_exists, - qc_exists, - pframe, /* message, */ - pn_vector, - i+1, - frtype); /* add for CONFIG_IEEE80211W, none 11w also can use */ - aes128k128d(key, ctr_preload, aes_out); - bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);/* bitwise_xor(aes_out, &message[payload_index], chain_buffer); */ - for (j=0; j<16;j++) pframe[payload_index++] = chain_buffer[j];/* for (j=0; j<16;j++) message[payload_index++] = chain_buffer[j]; */ - } + for (i=0; i< num_blocks; i++) { + construct_ctr_preload( + ctr_preload, + a4_exists, + qc_exists, + pframe, /* message, */ + pn_vector, + i+1, + frtype); /* add for CONFIG_IEEE80211W, none 11w also can use */ + aes128k128d(key, ctr_preload, aes_out); + bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);/* bitwise_xor(aes_out, &message[payload_index], chain_buffer); */ + for (j=0; j<16;j++) + pframe[payload_index++] = chain_buffer[j];/* for (j=0; j<16;j++) message[payload_index++] = chain_buffer[j]; */ + } - if (payload_remainder > 0) /* If there is a short final block, then pad it,*/ - { /* encrypt it and copy the unpadded part back */ - construct_ctr_preload( - ctr_preload, - a4_exists, - qc_exists, - pframe, /* message, */ - pn_vector, - num_blocks+1, - frtype); /* add for CONFIG_IEEE80211W, none 11w also can use */ + if (payload_remainder > 0) /* If there is a short final block, then pad it,*/ + { /* encrypt it and copy the unpadded part back */ + construct_ctr_preload( + ctr_preload, + a4_exists, + qc_exists, + pframe, /* message, */ + pn_vector, + num_blocks+1, + frtype); /* add for CONFIG_IEEE80211W, none 11w also can use */ - for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; - for (j = 0; j < payload_remainder; j++) - { - padded_buffer[j] = pframe[payload_index+j];/* padded_buffer[j] = message[payload_index+j]; */ - } - aes128k128d(key, ctr_preload, aes_out); - bitwise_xor(aes_out, padded_buffer, chain_buffer); - for (j=0; jattrib; struct security_priv *psecuritypriv=&padapter->securitypriv; struct xmit_priv *pxmitpriv=&padapter->xmitpriv; - -/* uint offset = 0; */ u32 res=_SUCCESS; -; if(((struct xmit_frame*)pxmitframe)->buf_addr==NULL) return _FAIL; @@ -1591,21 +1553,15 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe) /* 4 start to encrypt each fragment */ if((pattrib->encrypt==_AES_)){ - - if(pattrib->psta) - { + if(pattrib->psta) { stainfo = pattrib->psta; - } - else - { + } else { DBG_871X("%s, call rtw_get_stainfo()\n", __func__); stainfo=rtw_get_stainfo(&padapter->stapriv ,&pattrib->ra[0] ); } if (stainfo!=NULL){ - - if(!(stainfo->state &_FW_LINKED)) - { + if(!(stainfo->state &_FW_LINKED)) { DBG_871X("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, stainfo->state); return _FAIL; } @@ -1613,13 +1569,9 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe) RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("rtw_aes_encrypt: stainfo!=NULL!!!\n")); if(IS_MCAST(pattrib->ra)) - { prwskey=psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey; - } else - { prwskey=&stainfo->dot118021x_UncstKey.skey[0]; - } prwskeylen=16; for(curfragnum=0;curfragnumnr_frags;curfragnum++){ @@ -1628,22 +1580,17 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe) length=pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len- pattrib->icv_len; aes_cipher(prwskey,pattrib->hdrlen,pframe, length); - } - else{ + } else { length=pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len ; aes_cipher(prwskey,pattrib->hdrlen,pframe, length); - pframe+=pxmitpriv->frag_len; - pframe=(u8*)RND4((SIZE_PTR)(pframe)); - + pframe+=pxmitpriv->frag_len; + pframe=(u8*)RND4((SIZE_PTR)(pframe)); } } - - - } - else{ + } else{ RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("rtw_aes_encrypt: stainfo==NULL!!!\n")); - DBG_871X("%s, psta==NUL\n", __func__); + DBG_871X("%s, psta==NUL\n", __func__); res=_FAIL; } @@ -1668,20 +1615,17 @@ static sint aes_decipher(u8 *key, uint hdrlen, u8 mic_header2[16]; u8 ctr_preload[16]; - /* Intermediate Buffers */ + /* Intermediate Buffers */ u8 chain_buffer[16]; u8 aes_out[16]; u8 padded_buffer[16]; u8 mic[8]; -/* uint offset = 0; */ uint frtype = GetFrameType(pframe); uint frsubtype = GetFrameSubType(pframe); -; + frsubtype=frsubtype>>4; - - memset((void *)mic_iv, 0, 16); memset((void *)mic_header1, 0, 16); memset((void *)mic_header2, 0, 16); @@ -1708,30 +1652,24 @@ static sint aes_decipher(u8 *key, uint hdrlen, else a4_exists = 1; - if ( - ((frtype|frsubtype) == WIFI_DATA_CFACK) || - ((frtype|frsubtype) == WIFI_DATA_CFPOLL)|| - ((frtype|frsubtype) == WIFI_DATA_CFACKPOLL)) - { + if (((frtype|frsubtype) == WIFI_DATA_CFACK) || + ((frtype|frsubtype) == WIFI_DATA_CFPOLL)|| + ((frtype|frsubtype) == WIFI_DATA_CFACKPOLL)) { qc_exists = 1; - if(hdrlen != WLAN_HDR_A3_QOS_LEN){ - - hdrlen += 2; + if(hdrlen != WLAN_HDR_A3_QOS_LEN){ + hdrlen += 2; } }/* only for data packet . add for CONFIG_IEEE80211W, none 11w also can use */ else if ((frtype == WIFI_DATA) && ((frsubtype == 0x08) || (frsubtype == 0x09)|| (frsubtype == 0x0a)|| - (frsubtype == 0x0b))) - { - if(hdrlen != WLAN_HDR_A3_QOS_LEN){ - - hdrlen += 2; - } - qc_exists = 1; + (frsubtype == 0x0b))) { + if(hdrlen != WLAN_HDR_A3_QOS_LEN){ + hdrlen += 2; } - else + qc_exists = 1; + } else qc_exists = 0; @@ -1739,45 +1677,47 @@ static sint aes_decipher(u8 *key, uint hdrlen, payload_index = hdrlen + 8; /* 8 is for extiv */ - for (i=0; i< num_blocks; i++) - { - construct_ctr_preload( - ctr_preload, - a4_exists, - qc_exists, - pframe, - pn_vector, - i+1, - frtype - ); + for (i=0; i< num_blocks; i++) { + construct_ctr_preload( + ctr_preload, + a4_exists, + qc_exists, + pframe, + pn_vector, + i+1, + frtype + ); - aes128k128d(key, ctr_preload, aes_out); - bitwise_xor(aes_out, &pframe[payload_index], chain_buffer); + aes128k128d(key, ctr_preload, aes_out); + bitwise_xor(aes_out, &pframe[payload_index], chain_buffer); - for (j=0; j<16;j++) pframe[payload_index++] = chain_buffer[j]; - } + for (j=0; j<16;j++) + pframe[payload_index++] = chain_buffer[j]; + } - if (payload_remainder > 0) /* If there is a short final block, then pad it,*/ - { /* encrypt it and copy the unpadded part back */ - construct_ctr_preload( - ctr_preload, - a4_exists, - qc_exists, - pframe, - pn_vector, - num_blocks+1, - frtype /* add for CONFIG_IEEE80211W, none 11w also can use */ - ); + if (payload_remainder > 0) /* If there is a short final block, then pad it,*/ + { /* encrypt it and copy the unpadded part back */ + construct_ctr_preload( + ctr_preload, + a4_exists, + qc_exists, + pframe, + pn_vector, + num_blocks+1, + frtype /* add for CONFIG_IEEE80211W, none 11w also can use */ + ); - for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; - for (j = 0; j < payload_remainder; j++) - { - padded_buffer[j] = pframe[payload_index+j]; - } - aes128k128d(key, ctr_preload, aes_out); - bitwise_xor(aes_out, padded_buffer, chain_buffer); - for (j=0; j 0) - { - for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; - for (j = 0; j < payload_remainder; j++) - { - padded_buffer[j] = message[payload_index++]; - } - bitwise_xor(aes_out, padded_buffer, chain_buffer); - aes128k128d(key, chain_buffer, aes_out); + /* Add on the final payload block if it needs padding */ + if (payload_remainder > 0) { + for (j = 0; j < 16; j++) + padded_buffer[j] = 0x00; + for (j = 0; j < payload_remainder; j++) + padded_buffer[j] = message[payload_index++]; + bitwise_xor(aes_out, padded_buffer, chain_buffer); + aes128k128d(key, chain_buffer, aes_out); + } - } + for (j = 0 ; j < 8; j++) + mic[j] = aes_out[j]; - for (j = 0 ; j < 8; j++) mic[j] = aes_out[j]; - - /* Insert MIC into payload */ - for (j = 0; j < 8; j++) - message[payload_index+j] = mic[j]; + /* Insert MIC into payload */ + for (j = 0; j < 8; j++) + message[payload_index+j] = mic[j]; payload_index = hdrlen + 8; - for (i=0; i< num_blocks; i++) - { - construct_ctr_preload( - ctr_preload, - a4_exists, - qc_exists, - message, - pn_vector, - i+1, - frtype); /* add for CONFIG_IEEE80211W, none 11w also can use */ - aes128k128d(key, ctr_preload, aes_out); - bitwise_xor(aes_out, &message[payload_index], chain_buffer); - for (j=0; j<16;j++) message[payload_index++] = chain_buffer[j]; - } + for (i=0; i< num_blocks; i++) { + construct_ctr_preload( + ctr_preload, + a4_exists, + qc_exists, + message, + pn_vector, + i+1, + frtype); /* add for CONFIG_IEEE80211W, none 11w also can use */ + aes128k128d(key, ctr_preload, aes_out); + bitwise_xor(aes_out, &message[payload_index], chain_buffer); + for (j=0; j<16;j++) + message[payload_index++] = chain_buffer[j]; + } - if (payload_remainder > 0) /* If there is a short final block, then pad it,*/ - { /* encrypt it and copy the unpadded part back */ - construct_ctr_preload( - ctr_preload, - a4_exists, - qc_exists, - message, - pn_vector, - num_blocks+1, - frtype); /* add for CONFIG_IEEE80211W, none 11w also can use */ + if (payload_remainder > 0) { /* If there is a short final block, then pad it,*/ + /* encrypt it and copy the unpadded part back */ + construct_ctr_preload( + ctr_preload, + a4_exists, + qc_exists, + message, + pn_vector, + num_blocks+1, + frtype); /* add for CONFIG_IEEE80211W, none 11w also can use */ - for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; - for (j = 0; j < payload_remainder; j++) - { - padded_buffer[j] = message[payload_index+j]; - } - aes128k128d(key, ctr_preload, aes_out); - bitwise_xor(aes_out, padded_buffer, chain_buffer); - for (j=0; j 64) { + /* if key is longer than 64 bytes reset it to key = SHA256(key) */ + if (key_len > 64) { sha256_vector(1, &key, &key_len, tk); key = tk; key_len = 32; - } + } /* the HMAC_SHA256 transform looks like: * @@ -2426,171 +2359,172 @@ static void sha256_prf(u8 *key, size_t key_len, char *label, /* AES tables*/ const u32 Te0[256] = { - 0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU, - 0xfff2f20dU, 0xd66b6bbdU, 0xde6f6fb1U, 0x91c5c554U, - 0x60303050U, 0x02010103U, 0xce6767a9U, 0x562b2b7dU, - 0xe7fefe19U, 0xb5d7d762U, 0x4dababe6U, 0xec76769aU, - 0x8fcaca45U, 0x1f82829dU, 0x89c9c940U, 0xfa7d7d87U, - 0xeffafa15U, 0xb25959ebU, 0x8e4747c9U, 0xfbf0f00bU, - 0x41adadecU, 0xb3d4d467U, 0x5fa2a2fdU, 0x45afafeaU, - 0x239c9cbfU, 0x53a4a4f7U, 0xe4727296U, 0x9bc0c05bU, - 0x75b7b7c2U, 0xe1fdfd1cU, 0x3d9393aeU, 0x4c26266aU, - 0x6c36365aU, 0x7e3f3f41U, 0xf5f7f702U, 0x83cccc4fU, - 0x6834345cU, 0x51a5a5f4U, 0xd1e5e534U, 0xf9f1f108U, - 0xe2717193U, 0xabd8d873U, 0x62313153U, 0x2a15153fU, - 0x0804040cU, 0x95c7c752U, 0x46232365U, 0x9dc3c35eU, - 0x30181828U, 0x379696a1U, 0x0a05050fU, 0x2f9a9ab5U, - 0x0e070709U, 0x24121236U, 0x1b80809bU, 0xdfe2e23dU, - 0xcdebeb26U, 0x4e272769U, 0x7fb2b2cdU, 0xea75759fU, - 0x1209091bU, 0x1d83839eU, 0x582c2c74U, 0x341a1a2eU, - 0x361b1b2dU, 0xdc6e6eb2U, 0xb45a5aeeU, 0x5ba0a0fbU, - 0xa45252f6U, 0x763b3b4dU, 0xb7d6d661U, 0x7db3b3ceU, - 0x5229297bU, 0xdde3e33eU, 0x5e2f2f71U, 0x13848497U, - 0xa65353f5U, 0xb9d1d168U, 0x00000000U, 0xc1eded2cU, - 0x40202060U, 0xe3fcfc1fU, 0x79b1b1c8U, 0xb65b5bedU, - 0xd46a6abeU, 0x8dcbcb46U, 0x67bebed9U, 0x7239394bU, - 0x944a4adeU, 0x984c4cd4U, 0xb05858e8U, 0x85cfcf4aU, - 0xbbd0d06bU, 0xc5efef2aU, 0x4faaaae5U, 0xedfbfb16U, - 0x864343c5U, 0x9a4d4dd7U, 0x66333355U, 0x11858594U, - 0x8a4545cfU, 0xe9f9f910U, 0x04020206U, 0xfe7f7f81U, - 0xa05050f0U, 0x783c3c44U, 0x259f9fbaU, 0x4ba8a8e3U, - 0xa25151f3U, 0x5da3a3feU, 0x804040c0U, 0x058f8f8aU, - 0x3f9292adU, 0x219d9dbcU, 0x70383848U, 0xf1f5f504U, - 0x63bcbcdfU, 0x77b6b6c1U, 0xafdada75U, 0x42212163U, - 0x20101030U, 0xe5ffff1aU, 0xfdf3f30eU, 0xbfd2d26dU, - 0x81cdcd4cU, 0x180c0c14U, 0x26131335U, 0xc3ecec2fU, - 0xbe5f5fe1U, 0x359797a2U, 0x884444ccU, 0x2e171739U, - 0x93c4c457U, 0x55a7a7f2U, 0xfc7e7e82U, 0x7a3d3d47U, - 0xc86464acU, 0xba5d5de7U, 0x3219192bU, 0xe6737395U, - 0xc06060a0U, 0x19818198U, 0x9e4f4fd1U, 0xa3dcdc7fU, - 0x44222266U, 0x542a2a7eU, 0x3b9090abU, 0x0b888883U, - 0x8c4646caU, 0xc7eeee29U, 0x6bb8b8d3U, 0x2814143cU, - 0xa7dede79U, 0xbc5e5ee2U, 0x160b0b1dU, 0xaddbdb76U, - 0xdbe0e03bU, 0x64323256U, 0x743a3a4eU, 0x140a0a1eU, - 0x924949dbU, 0x0c06060aU, 0x4824246cU, 0xb85c5ce4U, - 0x9fc2c25dU, 0xbdd3d36eU, 0x43acacefU, 0xc46262a6U, - 0x399191a8U, 0x319595a4U, 0xd3e4e437U, 0xf279798bU, - 0xd5e7e732U, 0x8bc8c843U, 0x6e373759U, 0xda6d6db7U, - 0x018d8d8cU, 0xb1d5d564U, 0x9c4e4ed2U, 0x49a9a9e0U, - 0xd86c6cb4U, 0xac5656faU, 0xf3f4f407U, 0xcfeaea25U, - 0xca6565afU, 0xf47a7a8eU, 0x47aeaee9U, 0x10080818U, - 0x6fbabad5U, 0xf0787888U, 0x4a25256fU, 0x5c2e2e72U, - 0x381c1c24U, 0x57a6a6f1U, 0x73b4b4c7U, 0x97c6c651U, - 0xcbe8e823U, 0xa1dddd7cU, 0xe874749cU, 0x3e1f1f21U, - 0x964b4bddU, 0x61bdbddcU, 0x0d8b8b86U, 0x0f8a8a85U, - 0xe0707090U, 0x7c3e3e42U, 0x71b5b5c4U, 0xcc6666aaU, - 0x904848d8U, 0x06030305U, 0xf7f6f601U, 0x1c0e0e12U, - 0xc26161a3U, 0x6a35355fU, 0xae5757f9U, 0x69b9b9d0U, - 0x17868691U, 0x99c1c158U, 0x3a1d1d27U, 0x279e9eb9U, - 0xd9e1e138U, 0xebf8f813U, 0x2b9898b3U, 0x22111133U, - 0xd26969bbU, 0xa9d9d970U, 0x078e8e89U, 0x339494a7U, - 0x2d9b9bb6U, 0x3c1e1e22U, 0x15878792U, 0xc9e9e920U, - 0x87cece49U, 0xaa5555ffU, 0x50282878U, 0xa5dfdf7aU, - 0x038c8c8fU, 0x59a1a1f8U, 0x09898980U, 0x1a0d0d17U, - 0x65bfbfdaU, 0xd7e6e631U, 0x844242c6U, 0xd06868b8U, - 0x824141c3U, 0x299999b0U, 0x5a2d2d77U, 0x1e0f0f11U, - 0x7bb0b0cbU, 0xa85454fcU, 0x6dbbbbd6U, 0x2c16163aU, + 0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU, + 0xfff2f20dU, 0xd66b6bbdU, 0xde6f6fb1U, 0x91c5c554U, + 0x60303050U, 0x02010103U, 0xce6767a9U, 0x562b2b7dU, + 0xe7fefe19U, 0xb5d7d762U, 0x4dababe6U, 0xec76769aU, + 0x8fcaca45U, 0x1f82829dU, 0x89c9c940U, 0xfa7d7d87U, + 0xeffafa15U, 0xb25959ebU, 0x8e4747c9U, 0xfbf0f00bU, + 0x41adadecU, 0xb3d4d467U, 0x5fa2a2fdU, 0x45afafeaU, + 0x239c9cbfU, 0x53a4a4f7U, 0xe4727296U, 0x9bc0c05bU, + 0x75b7b7c2U, 0xe1fdfd1cU, 0x3d9393aeU, 0x4c26266aU, + 0x6c36365aU, 0x7e3f3f41U, 0xf5f7f702U, 0x83cccc4fU, + 0x6834345cU, 0x51a5a5f4U, 0xd1e5e534U, 0xf9f1f108U, + 0xe2717193U, 0xabd8d873U, 0x62313153U, 0x2a15153fU, + 0x0804040cU, 0x95c7c752U, 0x46232365U, 0x9dc3c35eU, + 0x30181828U, 0x379696a1U, 0x0a05050fU, 0x2f9a9ab5U, + 0x0e070709U, 0x24121236U, 0x1b80809bU, 0xdfe2e23dU, + 0xcdebeb26U, 0x4e272769U, 0x7fb2b2cdU, 0xea75759fU, + 0x1209091bU, 0x1d83839eU, 0x582c2c74U, 0x341a1a2eU, + 0x361b1b2dU, 0xdc6e6eb2U, 0xb45a5aeeU, 0x5ba0a0fbU, + 0xa45252f6U, 0x763b3b4dU, 0xb7d6d661U, 0x7db3b3ceU, + 0x5229297bU, 0xdde3e33eU, 0x5e2f2f71U, 0x13848497U, + 0xa65353f5U, 0xb9d1d168U, 0x00000000U, 0xc1eded2cU, + 0x40202060U, 0xe3fcfc1fU, 0x79b1b1c8U, 0xb65b5bedU, + 0xd46a6abeU, 0x8dcbcb46U, 0x67bebed9U, 0x7239394bU, + 0x944a4adeU, 0x984c4cd4U, 0xb05858e8U, 0x85cfcf4aU, + 0xbbd0d06bU, 0xc5efef2aU, 0x4faaaae5U, 0xedfbfb16U, + 0x864343c5U, 0x9a4d4dd7U, 0x66333355U, 0x11858594U, + 0x8a4545cfU, 0xe9f9f910U, 0x04020206U, 0xfe7f7f81U, + 0xa05050f0U, 0x783c3c44U, 0x259f9fbaU, 0x4ba8a8e3U, + 0xa25151f3U, 0x5da3a3feU, 0x804040c0U, 0x058f8f8aU, + 0x3f9292adU, 0x219d9dbcU, 0x70383848U, 0xf1f5f504U, + 0x63bcbcdfU, 0x77b6b6c1U, 0xafdada75U, 0x42212163U, + 0x20101030U, 0xe5ffff1aU, 0xfdf3f30eU, 0xbfd2d26dU, + 0x81cdcd4cU, 0x180c0c14U, 0x26131335U, 0xc3ecec2fU, + 0xbe5f5fe1U, 0x359797a2U, 0x884444ccU, 0x2e171739U, + 0x93c4c457U, 0x55a7a7f2U, 0xfc7e7e82U, 0x7a3d3d47U, + 0xc86464acU, 0xba5d5de7U, 0x3219192bU, 0xe6737395U, + 0xc06060a0U, 0x19818198U, 0x9e4f4fd1U, 0xa3dcdc7fU, + 0x44222266U, 0x542a2a7eU, 0x3b9090abU, 0x0b888883U, + 0x8c4646caU, 0xc7eeee29U, 0x6bb8b8d3U, 0x2814143cU, + 0xa7dede79U, 0xbc5e5ee2U, 0x160b0b1dU, 0xaddbdb76U, + 0xdbe0e03bU, 0x64323256U, 0x743a3a4eU, 0x140a0a1eU, + 0x924949dbU, 0x0c06060aU, 0x4824246cU, 0xb85c5ce4U, + 0x9fc2c25dU, 0xbdd3d36eU, 0x43acacefU, 0xc46262a6U, + 0x399191a8U, 0x319595a4U, 0xd3e4e437U, 0xf279798bU, + 0xd5e7e732U, 0x8bc8c843U, 0x6e373759U, 0xda6d6db7U, + 0x018d8d8cU, 0xb1d5d564U, 0x9c4e4ed2U, 0x49a9a9e0U, + 0xd86c6cb4U, 0xac5656faU, 0xf3f4f407U, 0xcfeaea25U, + 0xca6565afU, 0xf47a7a8eU, 0x47aeaee9U, 0x10080818U, + 0x6fbabad5U, 0xf0787888U, 0x4a25256fU, 0x5c2e2e72U, + 0x381c1c24U, 0x57a6a6f1U, 0x73b4b4c7U, 0x97c6c651U, + 0xcbe8e823U, 0xa1dddd7cU, 0xe874749cU, 0x3e1f1f21U, + 0x964b4bddU, 0x61bdbddcU, 0x0d8b8b86U, 0x0f8a8a85U, + 0xe0707090U, 0x7c3e3e42U, 0x71b5b5c4U, 0xcc6666aaU, + 0x904848d8U, 0x06030305U, 0xf7f6f601U, 0x1c0e0e12U, + 0xc26161a3U, 0x6a35355fU, 0xae5757f9U, 0x69b9b9d0U, + 0x17868691U, 0x99c1c158U, 0x3a1d1d27U, 0x279e9eb9U, + 0xd9e1e138U, 0xebf8f813U, 0x2b9898b3U, 0x22111133U, + 0xd26969bbU, 0xa9d9d970U, 0x078e8e89U, 0x339494a7U, + 0x2d9b9bb6U, 0x3c1e1e22U, 0x15878792U, 0xc9e9e920U, + 0x87cece49U, 0xaa5555ffU, 0x50282878U, 0xa5dfdf7aU, + 0x038c8c8fU, 0x59a1a1f8U, 0x09898980U, 0x1a0d0d17U, + 0x65bfbfdaU, 0xd7e6e631U, 0x844242c6U, 0xd06868b8U, + 0x824141c3U, 0x299999b0U, 0x5a2d2d77U, 0x1e0f0f11U, + 0x7bb0b0cbU, 0xa85454fcU, 0x6dbbbbd6U, 0x2c16163aU, }; const u32 Td0[256] = { - 0x51f4a750U, 0x7e416553U, 0x1a17a4c3U, 0x3a275e96U, - 0x3bab6bcbU, 0x1f9d45f1U, 0xacfa58abU, 0x4be30393U, - 0x2030fa55U, 0xad766df6U, 0x88cc7691U, 0xf5024c25U, - 0x4fe5d7fcU, 0xc52acbd7U, 0x26354480U, 0xb562a38fU, - 0xdeb15a49U, 0x25ba1b67U, 0x45ea0e98U, 0x5dfec0e1U, - 0xc32f7502U, 0x814cf012U, 0x8d4697a3U, 0x6bd3f9c6U, - 0x038f5fe7U, 0x15929c95U, 0xbf6d7aebU, 0x955259daU, - 0xd4be832dU, 0x587421d3U, 0x49e06929U, 0x8ec9c844U, - 0x75c2896aU, 0xf48e7978U, 0x99583e6bU, 0x27b971ddU, - 0xbee14fb6U, 0xf088ad17U, 0xc920ac66U, 0x7dce3ab4U, - 0x63df4a18U, 0xe51a3182U, 0x97513360U, 0x62537f45U, - 0xb16477e0U, 0xbb6bae84U, 0xfe81a01cU, 0xf9082b94U, - 0x70486858U, 0x8f45fd19U, 0x94de6c87U, 0x527bf8b7U, - 0xab73d323U, 0x724b02e2U, 0xe31f8f57U, 0x6655ab2aU, - 0xb2eb2807U, 0x2fb5c203U, 0x86c57b9aU, 0xd33708a5U, - 0x302887f2U, 0x23bfa5b2U, 0x02036abaU, 0xed16825cU, - 0x8acf1c2bU, 0xa779b492U, 0xf307f2f0U, 0x4e69e2a1U, - 0x65daf4cdU, 0x0605bed5U, 0xd134621fU, 0xc4a6fe8aU, - 0x342e539dU, 0xa2f355a0U, 0x058ae132U, 0xa4f6eb75U, - 0x0b83ec39U, 0x4060efaaU, 0x5e719f06U, 0xbd6e1051U, - 0x3e218af9U, 0x96dd063dU, 0xdd3e05aeU, 0x4de6bd46U, - 0x91548db5U, 0x71c45d05U, 0x0406d46fU, 0x605015ffU, - 0x1998fb24U, 0xd6bde997U, 0x894043ccU, 0x67d99e77U, - 0xb0e842bdU, 0x07898b88U, 0xe7195b38U, 0x79c8eedbU, - 0xa17c0a47U, 0x7c420fe9U, 0xf8841ec9U, 0x00000000U, - 0x09808683U, 0x322bed48U, 0x1e1170acU, 0x6c5a724eU, - 0xfd0efffbU, 0x0f853856U, 0x3daed51eU, 0x362d3927U, - 0x0a0fd964U, 0x685ca621U, 0x9b5b54d1U, 0x24362e3aU, - 0x0c0a67b1U, 0x9357e70fU, 0xb4ee96d2U, 0x1b9b919eU, - 0x80c0c54fU, 0x61dc20a2U, 0x5a774b69U, 0x1c121a16U, - 0xe293ba0aU, 0xc0a02ae5U, 0x3c22e043U, 0x121b171dU, - 0x0e090d0bU, 0xf28bc7adU, 0x2db6a8b9U, 0x141ea9c8U, - 0x57f11985U, 0xaf75074cU, 0xee99ddbbU, 0xa37f60fdU, - 0xf701269fU, 0x5c72f5bcU, 0x44663bc5U, 0x5bfb7e34U, - 0x8b432976U, 0xcb23c6dcU, 0xb6edfc68U, 0xb8e4f163U, - 0xd731dccaU, 0x42638510U, 0x13972240U, 0x84c61120U, - 0x854a247dU, 0xd2bb3df8U, 0xaef93211U, 0xc729a16dU, - 0x1d9e2f4bU, 0xdcb230f3U, 0x0d8652ecU, 0x77c1e3d0U, - 0x2bb3166cU, 0xa970b999U, 0x119448faU, 0x47e96422U, - 0xa8fc8cc4U, 0xa0f03f1aU, 0x567d2cd8U, 0x223390efU, - 0x87494ec7U, 0xd938d1c1U, 0x8ccaa2feU, 0x98d40b36U, - 0xa6f581cfU, 0xa57ade28U, 0xdab78e26U, 0x3fadbfa4U, - 0x2c3a9de4U, 0x5078920dU, 0x6a5fcc9bU, 0x547e4662U, - 0xf68d13c2U, 0x90d8b8e8U, 0x2e39f75eU, 0x82c3aff5U, - 0x9f5d80beU, 0x69d0937cU, 0x6fd52da9U, 0xcf2512b3U, - 0xc8ac993bU, 0x10187da7U, 0xe89c636eU, 0xdb3bbb7bU, - 0xcd267809U, 0x6e5918f4U, 0xec9ab701U, 0x834f9aa8U, - 0xe6956e65U, 0xaaffe67eU, 0x21bccf08U, 0xef15e8e6U, - 0xbae79bd9U, 0x4a6f36ceU, 0xea9f09d4U, 0x29b07cd6U, - 0x31a4b2afU, 0x2a3f2331U, 0xc6a59430U, 0x35a266c0U, - 0x744ebc37U, 0xfc82caa6U, 0xe090d0b0U, 0x33a7d815U, - 0xf104984aU, 0x41ecdaf7U, 0x7fcd500eU, 0x1791f62fU, - 0x764dd68dU, 0x43efb04dU, 0xccaa4d54U, 0xe49604dfU, - 0x9ed1b5e3U, 0x4c6a881bU, 0xc12c1fb8U, 0x4665517fU, - 0x9d5eea04U, 0x018c355dU, 0xfa877473U, 0xfb0b412eU, - 0xb3671d5aU, 0x92dbd252U, 0xe9105633U, 0x6dd64713U, - 0x9ad7618cU, 0x37a10c7aU, 0x59f8148eU, 0xeb133c89U, - 0xcea927eeU, 0xb761c935U, 0xe11ce5edU, 0x7a47b13cU, - 0x9cd2df59U, 0x55f2733fU, 0x1814ce79U, 0x73c737bfU, - 0x53f7cdeaU, 0x5ffdaa5bU, 0xdf3d6f14U, 0x7844db86U, - 0xcaaff381U, 0xb968c43eU, 0x3824342cU, 0xc2a3405fU, - 0x161dc372U, 0xbce2250cU, 0x283c498bU, 0xff0d9541U, - 0x39a80171U, 0x080cb3deU, 0xd8b4e49cU, 0x6456c190U, - 0x7bcb8461U, 0xd532b670U, 0x486c5c74U, 0xd0b85742U, + 0x51f4a750U, 0x7e416553U, 0x1a17a4c3U, 0x3a275e96U, + 0x3bab6bcbU, 0x1f9d45f1U, 0xacfa58abU, 0x4be30393U, + 0x2030fa55U, 0xad766df6U, 0x88cc7691U, 0xf5024c25U, + 0x4fe5d7fcU, 0xc52acbd7U, 0x26354480U, 0xb562a38fU, + 0xdeb15a49U, 0x25ba1b67U, 0x45ea0e98U, 0x5dfec0e1U, + 0xc32f7502U, 0x814cf012U, 0x8d4697a3U, 0x6bd3f9c6U, + 0x038f5fe7U, 0x15929c95U, 0xbf6d7aebU, 0x955259daU, + 0xd4be832dU, 0x587421d3U, 0x49e06929U, 0x8ec9c844U, + 0x75c2896aU, 0xf48e7978U, 0x99583e6bU, 0x27b971ddU, + 0xbee14fb6U, 0xf088ad17U, 0xc920ac66U, 0x7dce3ab4U, + 0x63df4a18U, 0xe51a3182U, 0x97513360U, 0x62537f45U, + 0xb16477e0U, 0xbb6bae84U, 0xfe81a01cU, 0xf9082b94U, + 0x70486858U, 0x8f45fd19U, 0x94de6c87U, 0x527bf8b7U, + 0xab73d323U, 0x724b02e2U, 0xe31f8f57U, 0x6655ab2aU, + 0xb2eb2807U, 0x2fb5c203U, 0x86c57b9aU, 0xd33708a5U, + 0x302887f2U, 0x23bfa5b2U, 0x02036abaU, 0xed16825cU, + 0x8acf1c2bU, 0xa779b492U, 0xf307f2f0U, 0x4e69e2a1U, + 0x65daf4cdU, 0x0605bed5U, 0xd134621fU, 0xc4a6fe8aU, + 0x342e539dU, 0xa2f355a0U, 0x058ae132U, 0xa4f6eb75U, + 0x0b83ec39U, 0x4060efaaU, 0x5e719f06U, 0xbd6e1051U, + 0x3e218af9U, 0x96dd063dU, 0xdd3e05aeU, 0x4de6bd46U, + 0x91548db5U, 0x71c45d05U, 0x0406d46fU, 0x605015ffU, + 0x1998fb24U, 0xd6bde997U, 0x894043ccU, 0x67d99e77U, + 0xb0e842bdU, 0x07898b88U, 0xe7195b38U, 0x79c8eedbU, + 0xa17c0a47U, 0x7c420fe9U, 0xf8841ec9U, 0x00000000U, + 0x09808683U, 0x322bed48U, 0x1e1170acU, 0x6c5a724eU, + 0xfd0efffbU, 0x0f853856U, 0x3daed51eU, 0x362d3927U, + 0x0a0fd964U, 0x685ca621U, 0x9b5b54d1U, 0x24362e3aU, + 0x0c0a67b1U, 0x9357e70fU, 0xb4ee96d2U, 0x1b9b919eU, + 0x80c0c54fU, 0x61dc20a2U, 0x5a774b69U, 0x1c121a16U, + 0xe293ba0aU, 0xc0a02ae5U, 0x3c22e043U, 0x121b171dU, + 0x0e090d0bU, 0xf28bc7adU, 0x2db6a8b9U, 0x141ea9c8U, + 0x57f11985U, 0xaf75074cU, 0xee99ddbbU, 0xa37f60fdU, + 0xf701269fU, 0x5c72f5bcU, 0x44663bc5U, 0x5bfb7e34U, + 0x8b432976U, 0xcb23c6dcU, 0xb6edfc68U, 0xb8e4f163U, + 0xd731dccaU, 0x42638510U, 0x13972240U, 0x84c61120U, + 0x854a247dU, 0xd2bb3df8U, 0xaef93211U, 0xc729a16dU, + 0x1d9e2f4bU, 0xdcb230f3U, 0x0d8652ecU, 0x77c1e3d0U, + 0x2bb3166cU, 0xa970b999U, 0x119448faU, 0x47e96422U, + 0xa8fc8cc4U, 0xa0f03f1aU, 0x567d2cd8U, 0x223390efU, + 0x87494ec7U, 0xd938d1c1U, 0x8ccaa2feU, 0x98d40b36U, + 0xa6f581cfU, 0xa57ade28U, 0xdab78e26U, 0x3fadbfa4U, + 0x2c3a9de4U, 0x5078920dU, 0x6a5fcc9bU, 0x547e4662U, + 0xf68d13c2U, 0x90d8b8e8U, 0x2e39f75eU, 0x82c3aff5U, + 0x9f5d80beU, 0x69d0937cU, 0x6fd52da9U, 0xcf2512b3U, + 0xc8ac993bU, 0x10187da7U, 0xe89c636eU, 0xdb3bbb7bU, + 0xcd267809U, 0x6e5918f4U, 0xec9ab701U, 0x834f9aa8U, + 0xe6956e65U, 0xaaffe67eU, 0x21bccf08U, 0xef15e8e6U, + 0xbae79bd9U, 0x4a6f36ceU, 0xea9f09d4U, 0x29b07cd6U, + 0x31a4b2afU, 0x2a3f2331U, 0xc6a59430U, 0x35a266c0U, + 0x744ebc37U, 0xfc82caa6U, 0xe090d0b0U, 0x33a7d815U, + 0xf104984aU, 0x41ecdaf7U, 0x7fcd500eU, 0x1791f62fU, + 0x764dd68dU, 0x43efb04dU, 0xccaa4d54U, 0xe49604dfU, + 0x9ed1b5e3U, 0x4c6a881bU, 0xc12c1fb8U, 0x4665517fU, + 0x9d5eea04U, 0x018c355dU, 0xfa877473U, 0xfb0b412eU, + 0xb3671d5aU, 0x92dbd252U, 0xe9105633U, 0x6dd64713U, + 0x9ad7618cU, 0x37a10c7aU, 0x59f8148eU, 0xeb133c89U, + 0xcea927eeU, 0xb761c935U, 0xe11ce5edU, 0x7a47b13cU, + 0x9cd2df59U, 0x55f2733fU, 0x1814ce79U, 0x73c737bfU, + 0x53f7cdeaU, 0x5ffdaa5bU, 0xdf3d6f14U, 0x7844db86U, + 0xcaaff381U, 0xb968c43eU, 0x3824342cU, 0xc2a3405fU, + 0x161dc372U, 0xbce2250cU, 0x283c498bU, 0xff0d9541U, + 0x39a80171U, 0x080cb3deU, 0xd8b4e49cU, 0x6456c190U, + 0x7bcb8461U, 0xd532b670U, 0x486c5c74U, 0xd0b85742U, }; const u8 Td4s[256] = { - 0x52U, 0x09U, 0x6aU, 0xd5U, 0x30U, 0x36U, 0xa5U, 0x38U, - 0xbfU, 0x40U, 0xa3U, 0x9eU, 0x81U, 0xf3U, 0xd7U, 0xfbU, - 0x7cU, 0xe3U, 0x39U, 0x82U, 0x9bU, 0x2fU, 0xffU, 0x87U, - 0x34U, 0x8eU, 0x43U, 0x44U, 0xc4U, 0xdeU, 0xe9U, 0xcbU, - 0x54U, 0x7bU, 0x94U, 0x32U, 0xa6U, 0xc2U, 0x23U, 0x3dU, - 0xeeU, 0x4cU, 0x95U, 0x0bU, 0x42U, 0xfaU, 0xc3U, 0x4eU, - 0x08U, 0x2eU, 0xa1U, 0x66U, 0x28U, 0xd9U, 0x24U, 0xb2U, - 0x76U, 0x5bU, 0xa2U, 0x49U, 0x6dU, 0x8bU, 0xd1U, 0x25U, - 0x72U, 0xf8U, 0xf6U, 0x64U, 0x86U, 0x68U, 0x98U, 0x16U, - 0xd4U, 0xa4U, 0x5cU, 0xccU, 0x5dU, 0x65U, 0xb6U, 0x92U, - 0x6cU, 0x70U, 0x48U, 0x50U, 0xfdU, 0xedU, 0xb9U, 0xdaU, - 0x5eU, 0x15U, 0x46U, 0x57U, 0xa7U, 0x8dU, 0x9dU, 0x84U, - 0x90U, 0xd8U, 0xabU, 0x00U, 0x8cU, 0xbcU, 0xd3U, 0x0aU, - 0xf7U, 0xe4U, 0x58U, 0x05U, 0xb8U, 0xb3U, 0x45U, 0x06U, - 0xd0U, 0x2cU, 0x1eU, 0x8fU, 0xcaU, 0x3fU, 0x0fU, 0x02U, - 0xc1U, 0xafU, 0xbdU, 0x03U, 0x01U, 0x13U, 0x8aU, 0x6bU, - 0x3aU, 0x91U, 0x11U, 0x41U, 0x4fU, 0x67U, 0xdcU, 0xeaU, - 0x97U, 0xf2U, 0xcfU, 0xceU, 0xf0U, 0xb4U, 0xe6U, 0x73U, - 0x96U, 0xacU, 0x74U, 0x22U, 0xe7U, 0xadU, 0x35U, 0x85U, - 0xe2U, 0xf9U, 0x37U, 0xe8U, 0x1cU, 0x75U, 0xdfU, 0x6eU, - 0x47U, 0xf1U, 0x1aU, 0x71U, 0x1dU, 0x29U, 0xc5U, 0x89U, - 0x6fU, 0xb7U, 0x62U, 0x0eU, 0xaaU, 0x18U, 0xbeU, 0x1bU, - 0xfcU, 0x56U, 0x3eU, 0x4bU, 0xc6U, 0xd2U, 0x79U, 0x20U, - 0x9aU, 0xdbU, 0xc0U, 0xfeU, 0x78U, 0xcdU, 0x5aU, 0xf4U, - 0x1fU, 0xddU, 0xa8U, 0x33U, 0x88U, 0x07U, 0xc7U, 0x31U, - 0xb1U, 0x12U, 0x10U, 0x59U, 0x27U, 0x80U, 0xecU, 0x5fU, - 0x60U, 0x51U, 0x7fU, 0xa9U, 0x19U, 0xb5U, 0x4aU, 0x0dU, - 0x2dU, 0xe5U, 0x7aU, 0x9fU, 0x93U, 0xc9U, 0x9cU, 0xefU, - 0xa0U, 0xe0U, 0x3bU, 0x4dU, 0xaeU, 0x2aU, 0xf5U, 0xb0U, - 0xc8U, 0xebU, 0xbbU, 0x3cU, 0x83U, 0x53U, 0x99U, 0x61U, - 0x17U, 0x2bU, 0x04U, 0x7eU, 0xbaU, 0x77U, 0xd6U, 0x26U, - 0xe1U, 0x69U, 0x14U, 0x63U, 0x55U, 0x21U, 0x0cU, 0x7dU, + 0x52U, 0x09U, 0x6aU, 0xd5U, 0x30U, 0x36U, 0xa5U, 0x38U, + 0xbfU, 0x40U, 0xa3U, 0x9eU, 0x81U, 0xf3U, 0xd7U, 0xfbU, + 0x7cU, 0xe3U, 0x39U, 0x82U, 0x9bU, 0x2fU, 0xffU, 0x87U, + 0x34U, 0x8eU, 0x43U, 0x44U, 0xc4U, 0xdeU, 0xe9U, 0xcbU, + 0x54U, 0x7bU, 0x94U, 0x32U, 0xa6U, 0xc2U, 0x23U, 0x3dU, + 0xeeU, 0x4cU, 0x95U, 0x0bU, 0x42U, 0xfaU, 0xc3U, 0x4eU, + 0x08U, 0x2eU, 0xa1U, 0x66U, 0x28U, 0xd9U, 0x24U, 0xb2U, + 0x76U, 0x5bU, 0xa2U, 0x49U, 0x6dU, 0x8bU, 0xd1U, 0x25U, + 0x72U, 0xf8U, 0xf6U, 0x64U, 0x86U, 0x68U, 0x98U, 0x16U, + 0xd4U, 0xa4U, 0x5cU, 0xccU, 0x5dU, 0x65U, 0xb6U, 0x92U, + 0x6cU, 0x70U, 0x48U, 0x50U, 0xfdU, 0xedU, 0xb9U, 0xdaU, + 0x5eU, 0x15U, 0x46U, 0x57U, 0xa7U, 0x8dU, 0x9dU, 0x84U, + 0x90U, 0xd8U, 0xabU, 0x00U, 0x8cU, 0xbcU, 0xd3U, 0x0aU, + 0xf7U, 0xe4U, 0x58U, 0x05U, 0xb8U, 0xb3U, 0x45U, 0x06U, + 0xd0U, 0x2cU, 0x1eU, 0x8fU, 0xcaU, 0x3fU, 0x0fU, 0x02U, + 0xc1U, 0xafU, 0xbdU, 0x03U, 0x01U, 0x13U, 0x8aU, 0x6bU, + 0x3aU, 0x91U, 0x11U, 0x41U, 0x4fU, 0x67U, 0xdcU, 0xeaU, + 0x97U, 0xf2U, 0xcfU, 0xceU, 0xf0U, 0xb4U, 0xe6U, 0x73U, + 0x96U, 0xacU, 0x74U, 0x22U, 0xe7U, 0xadU, 0x35U, 0x85U, + 0xe2U, 0xf9U, 0x37U, 0xe8U, 0x1cU, 0x75U, 0xdfU, 0x6eU, + 0x47U, 0xf1U, 0x1aU, 0x71U, 0x1dU, 0x29U, 0xc5U, 0x89U, + 0x6fU, 0xb7U, 0x62U, 0x0eU, 0xaaU, 0x18U, 0xbeU, 0x1bU, + 0xfcU, 0x56U, 0x3eU, 0x4bU, 0xc6U, 0xd2U, 0x79U, 0x20U, + 0x9aU, 0xdbU, 0xc0U, 0xfeU, 0x78U, 0xcdU, 0x5aU, 0xf4U, + 0x1fU, 0xddU, 0xa8U, 0x33U, 0x88U, 0x07U, 0xc7U, 0x31U, + 0xb1U, 0x12U, 0x10U, 0x59U, 0x27U, 0x80U, 0xecU, 0x5fU, + 0x60U, 0x51U, 0x7fU, 0xa9U, 0x19U, 0xb5U, 0x4aU, 0x0dU, + 0x2dU, 0xe5U, 0x7aU, 0x9fU, 0x93U, 0xc9U, 0x9cU, 0xefU, + 0xa0U, 0xe0U, 0x3bU, 0x4dU, 0xaeU, 0x2aU, 0xf5U, 0xb0U, + 0xc8U, 0xebU, 0xbbU, 0x3cU, 0x83U, 0x53U, 0x99U, 0x61U, + 0x17U, 0x2bU, 0x04U, 0x7eU, 0xbaU, 0x77U, 0xd6U, 0x26U, + 0xe1U, 0x69U, 0x14U, 0x63U, 0x55U, 0x21U, 0x0cU, 0x7dU, }; + const u8 rcons[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1B, 0x36 /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */ @@ -2819,19 +2753,13 @@ static int omac1_aes_128(u8 *key, u8 *data, size_t data_len, u8 *mac) void rtw_use_tkipkey_handler(void *FunctionContext) { - struct adapter *padapter = (struct adapter *)FunctionContext; - - -; + struct adapter *padapter = (struct adapter *)FunctionContext; RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("^^^rtw_use_tkipkey_handler ^^^\n")); padapter->securitypriv.busetkipkey=true; RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("^^^rtw_use_tkipkey_handler padapter->securitypriv.busetkipkey=%d^^^\n",padapter->securitypriv.busetkipkey)); - -; - } /* Restore HW wep key setting according to key_mask */ diff --git a/core/rtw_sta_mgt.c b/core/rtw_sta_mgt.c index 1dcf207..0a4ff96 100755 --- a/core/rtw_sta_mgt.c +++ b/core/rtw_sta_mgt.c @@ -29,20 +29,13 @@ #include -void _rtw_init_stainfo(struct sta_info *psta); void _rtw_init_stainfo(struct sta_info *psta) { - -; - memset((u8 *)psta, 0, sizeof (struct sta_info)); - spin_lock_init(&psta->lock); + spin_lock_init(&psta->lock); _rtw_init_listhead(&psta->list); _rtw_init_listhead(&psta->hash_list); - /* _rtw_init_listhead(&psta->asoc_list); */ - /* _rtw_init_listhead(&psta->sleep_list); */ - /* _rtw_init_listhead(&psta->wakeup_list); */ _rtw_init_queue(&psta->sleep_q); psta->sleepq_len = 0; diff --git a/core/rtw_wlan_util.c b/core/rtw_wlan_util.c index 8bba3ac..0e3e2c4 100755 --- a/core/rtw_wlan_util.c +++ b/core/rtw_wlan_util.c @@ -77,11 +77,9 @@ int cckrates_included(unsigned char *rate, int ratelen) { if ( (((rate[i]) & 0x7f) == 2) || (((rate[i]) & 0x7f) == 4) || (((rate[i]) & 0x7f) == 11) || (((rate[i]) & 0x7f) == 22) ) - return true; + return true; } - return false; - } int cckratesonly_included(unsigned char *rate, int ratelen) @@ -92,9 +90,8 @@ int cckratesonly_included(unsigned char *rate, int ratelen) { if ( (((rate[i]) & 0x7f) != 2) && (((rate[i]) & 0x7f) != 4) && (((rate[i]) & 0x7f) != 11) && (((rate[i]) & 0x7f) != 22) ) - return false; + return false; } - return true; } @@ -1505,27 +1502,19 @@ unsigned int should_forbid_n_rate(struct adapter * padapter) break; case _RSN_IE_2_: - if ((_rtw_memcmp((pIE->data + 8), RSN_CIPHER_SUITE_CCMP, 4)) || - (_rtw_memcmp((pIE->data + 12), RSN_CIPHER_SUITE_CCMP, 4))) - return false; - + if ((_rtw_memcmp((pIE->data + 8), RSN_CIPHER_SUITE_CCMP, 4)) || + (_rtw_memcmp((pIE->data + 12), RSN_CIPHER_SUITE_CCMP, 4))) + return false; default: break; } - i += (pIE->Length + 2); } - return true; } - else - { - return false; - } - + return false; } - unsigned int is_ap_in_wep(struct adapter *padapter) { u32 i; @@ -1828,10 +1817,10 @@ unsigned char check_assoc_AP(u8 *pframe, uint len) } else if (_rtw_memcmp(pIE->data, EPIGRAM_OUI, 3)) { - epigram_vendor_flag = 1; + epigram_vendor_flag = 1; if(ralink_vendor_flag) { DBG_871X("link to Tenda W311R AP\n"); - return HT_IOT_PEER_TENDA; + return HT_IOT_PEER_TENDA; } else { DBG_871X("Capture EPIGRAM_OUI\n"); } diff --git a/core/rtw_xmit.c b/core/rtw_xmit.c index 423a0ef..28ec08c 100755 --- a/core/rtw_xmit.c +++ b/core/rtw_xmit.c @@ -316,8 +316,8 @@ void rtw_mfree_xmit_priv_lock (struct xmit_priv *pxmitpriv) void _rtw_free_xmit_priv (struct xmit_priv *pxmitpriv) { - int i; - struct adapter *padapter = pxmitpriv->adapter; + int i; + struct adapter *padapter = pxmitpriv->adapter; struct xmit_frame *pxmitframe = (struct xmit_frame*) pxmitpriv->pxmit_frame_buf; struct xmit_buf *pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmitbuf; u32 max_xmit_extbuf_size = MAX_XMIT_EXTBUF_SZ; @@ -905,8 +905,7 @@ static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitfr rtw_secmicappend(&micdata, &pframe[24], 6); else rtw_secmicappend(&micdata, &pframe[10], 6); - } - else{ /* ToDS==0 */ + } else{ /* ToDS==0 */ rtw_secmicappend(&micdata, &pframe[4], 6); /* DA */ if(pframe[1]&2) /* From Ds==1 */ rtw_secmicappend(&micdata, &pframe[16], 6); @@ -915,8 +914,8 @@ static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitfr } - /* if(pqospriv->qos_option==1) */ - if(pattrib->qos_en) + /* if(pqospriv->qos_option==1) */ + if(pattrib->qos_en) priority[0]=(u8)pxmitframe->attrib.priority; @@ -1126,7 +1125,7 @@ s32 rtw_make_wlanhdr (struct adapter *padapter , u8 *hdr, struct pkt_attrib *pat if(pattrib->ht_en && psta->htpriv.ampdu_enable) { if(psta->htpriv.agg_enable_bitmap & BIT(pattrib->priority)) - pattrib->ampdu_en = true; + pattrib->ampdu_en = true; } /* re-check if enable ampdu by BA_starting_seqctrl */ @@ -2205,11 +2204,7 @@ static struct xmit_frame *dequeue_one_xmitframe(struct xmit_priv *pxmitpriv, str ptxservq->qcnt--; break; - - pxmitframe = NULL; - } - return pxmitframe; } diff --git a/hal/Hal8188ERateAdaptive.c b/hal/Hal8188ERateAdaptive.c index aeb8944..1c3a9bd 100755 --- a/hal/Hal8188ERateAdaptive.c +++ b/hal/Hal8188ERateAdaptive.c @@ -453,14 +453,14 @@ odm_ARFBRefresh_8188E( } #if POWER_TRAINING_ACTIVE == 1 - if (pRaInfo->HighestRate >0x13) - pRaInfo->PTModeSS=3; - else if(pRaInfo->HighestRate >0x0b) - pRaInfo->PTModeSS=2; - else if(pRaInfo->HighestRate >0x0b) - pRaInfo->PTModeSS=1; - else - pRaInfo->PTModeSS=0; + if (pRaInfo->HighestRate >0x13) + pRaInfo->PTModeSS=3; + else if(pRaInfo->HighestRate >0x0b) + pRaInfo->PTModeSS=2; + else if(pRaInfo->HighestRate >0x0b) + pRaInfo->PTModeSS=1; + else + pRaInfo->PTModeSS=0; ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("ODM_ARFBRefresh_8188E(): PTModeSS=%d\n", pRaInfo->PTModeSS)); diff --git a/hal/HalHWImg8188E_BB.c b/hal/HalHWImg8188E_BB.c index 33c4f79..ee0a644 100755 --- a/hal/HalHWImg8188E_BB.c +++ b/hal/HalHWImg8188E_BB.c @@ -540,12 +540,12 @@ ODM_ReadAndConfig_AGC_TAB_1T_ICUT_8188E( u32 hex = 0; u32 i = 0; u16 count = 0; - u32 * ptr_array = NULL; + u32 *ptr_array = NULL; u8 platform = pDM_Odm->SupportPlatform; u8 _interface = pDM_Odm->SupportInterface; u8 board = pDM_Odm->BoardType; u32 ArrayLen = sizeof(Array_MP_8188E_AGC_TAB_1T_ICUT)/sizeof(u32); - u32 * Array = Array_MP_8188E_AGC_TAB_1T_ICUT; + u32 *Array = Array_MP_8188E_AGC_TAB_1T_ICUT; hex += board; @@ -554,50 +554,38 @@ ODM_ReadAndConfig_AGC_TAB_1T_ICUT_8188E( hex += 0xFF000000; ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_AGC_TAB_1T_ICUT, hex = 0x%X\n", hex)); - for (i = 0; i < ArrayLen; i += 2 ) - { - u32 v1 = Array[i]; - u32 v2 = Array[i+1]; + for (i = 0; i < ArrayLen; i += 2 ) { + u32 v1 = Array[i]; + u32 v2 = Array[i+1]; - /* This (offset, data) pair meets the condition. */ - if ( v1 < 0xCDCDCDCD ) - { - odm_ConfigBB_AGC_8188E(pDM_Odm, v1, bMaskDWord, v2); - continue; - } - else - { /* This line is the start line of branch. */ - if ( !CheckCondition(Array[i], hex) ) - { /* Discard the following (offset, data) pairs. */ - READ_NEXT_PAIR(v1, v2, i); - while (v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - i -= 2; /* prevent from for-loop += 2 */ - } - else /* Configure matched pairs and skip to end of if-else. */ - { - READ_NEXT_PAIR(v1, v2, i); - while (v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < ArrayLen -2) - { - odm_ConfigBB_AGC_8188E(pDM_Odm, v1, bMaskDWord, v2); - READ_NEXT_PAIR(v1, v2, i); - } + /* This (offset, data) pair meets the condition. */ + if ( v1 < 0xCDCDCDCD ) { + odm_ConfigBB_AGC_8188E(pDM_Odm, v1, bMaskDWord, v2); + continue; + } else { /* This line is the start line of branch. */ + if ( !CheckCondition(Array[i], hex) ) + { /* Discard the following (offset, data) pairs. */ + READ_NEXT_PAIR(v1, v2, i); + while (v2 != 0xDEAD && + v2 != 0xCDEF && + v2 != 0xCDCD && i < ArrayLen -2) + READ_NEXT_PAIR(v1, v2, i); + i -= 2; /* prevent from for-loop += 2 */ + } else /* Configure matched pairs and skip to end of if-else. */ + { + READ_NEXT_PAIR(v1, v2, i); + while (v2 != 0xDEAD && + v2 != 0xCDEF && + v2 != 0xCDCD && i < ArrayLen -2) { + odm_ConfigBB_AGC_8188E(pDM_Odm, v1, bMaskDWord, v2); + READ_NEXT_PAIR(v1, v2, i); + } - while (v2 != 0xDEAD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - - } + while (v2 != 0xDEAD && i < ArrayLen -2) + READ_NEXT_PAIR(v1, v2, i); + } } } - } /****************************************************************************** @@ -845,53 +833,43 @@ ODM_ReadAndConfig_PHY_REG_1T_8188E( hex += platform << 16; hex += 0xFF000000; for (i = 0; i < ArrayLen; i += 2 ) { - u32 v1 = Array[i]; - u32 v2 = Array[i+1]; + u32 v1 = Array[i]; + u32 v2 = Array[i+1]; - /* This (offset, data) pair meets the condition. */ - if ( v1 < 0xCDCDCDCD ) { - { - odm_ConfigBB_PHY_8188E(pDM_Odm, v1, bMaskDWord, v2); - } + /* This (offset, data) pair meets the condition. */ + if ( v1 < 0xCDCDCDCD ) { + odm_ConfigBB_PHY_8188E(pDM_Odm, v1, bMaskDWord, v2); continue; } else { /* This line is the start line of branch. */ - if ( !CheckCondition(Array[i], hex) ) - { /* Discard the following (offset, data) pairs. */ - READ_NEXT_PAIR(v1, v2, i); - while (v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - i -= 2; /* prevent from for-loop += 2 */ - } - else /* Configure matched pairs and skip to end of if-else. */ - { - READ_NEXT_PAIR(v1, v2, i); - while (v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < ArrayLen -2) - { - { + if ( !CheckCondition(Array[i], hex) ) + { /* Discard the following (offset, data) pairs. */ + READ_NEXT_PAIR(v1, v2, i); + while (v2 != 0xDEAD && + v2 != 0xCDEF && + v2 != 0xCDCD && i < ArrayLen -2) + READ_NEXT_PAIR(v1, v2, i); + i -= 2; /* prevent from for-loop += 2 */ + } else /* Configure matched pairs and skip to end of if-else. */ + { + READ_NEXT_PAIR(v1, v2, i); + while (v2 != 0xDEAD && + v2 != 0xCDEF && + v2 != 0xCDCD && i < ArrayLen -2) { odm_ConfigBB_PHY_8188E(pDM_Odm, v1, bMaskDWord, v2); + READ_NEXT_PAIR(v1, v2, i); } - READ_NEXT_PAIR(v1, v2, i); - } - while (v2 != 0xDEAD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - - } + while (v2 != 0xDEAD && i < ArrayLen -2) + READ_NEXT_PAIR(v1, v2, i); + } } } return rst; } + /****************************************************************************** * PHY_REG_1T_ICUT.TXT ******************************************************************************/ @@ -1115,50 +1093,37 @@ ODM_ReadAndConfig_PHY_REG_1T_ICUT_8188E( hex += 0xFF000000; ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_PHY_REG_1T_ICUT, hex = 0x%X\n", hex)); - for (i = 0; i < ArrayLen; i += 2 ) - { - u32 v1 = Array[i]; - u32 v2 = Array[i+1]; + for (i = 0; i < ArrayLen; i += 2 ) { + u32 v1 = Array[i]; + u32 v2 = Array[i+1]; - /* This (offset, data) pair meets the condition. */ - if ( v1 < 0xCDCDCDCD ) - { + /* This (offset, data) pair meets the condition. */ + if ( v1 < 0xCDCDCDCD ) { odm_ConfigBB_PHY_8188E(pDM_Odm, v1, bMaskDWord, v2); - continue; - } - else - { /* This line is the start line of branch. */ - if ( !CheckCondition(Array[i], hex) ) - { /* Discard the following (offset, data) pairs. */ - READ_NEXT_PAIR(v1, v2, i); - while (v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - i -= 2; /* prevent from for-loop += 2 */ - } - else /* Configure matched pairs and skip to end of if-else. */ - { - READ_NEXT_PAIR(v1, v2, i); - while (v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < ArrayLen -2) - { + continue; + } else { /* This line is the start line of branch. */ + if ( !CheckCondition(Array[i], hex) ) + { /* Discard the following (offset, data) pairs. */ + READ_NEXT_PAIR(v1, v2, i); + while (v2 != 0xDEAD && + v2 != 0xCDEF && + v2 != 0xCDCD && i < ArrayLen -2) + READ_NEXT_PAIR(v1, v2, i); + i -= 2; /* prevent from for-loop += 2 */ + } else /* Configure matched pairs and skip to end of if-else. */ { + READ_NEXT_PAIR(v1, v2, i); + while (v2 != 0xDEAD && + v2 != 0xCDEF && + v2 != 0xCDCD && i < ArrayLen -2) { odm_ConfigBB_PHY_8188E(pDM_Odm, v1, bMaskDWord, v2); - READ_NEXT_PAIR(v1, v2, i); - } + READ_NEXT_PAIR(v1, v2, i); + } - while (v2 != 0xDEAD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - - } + while (v2 != 0xDEAD && i < ArrayLen -2) + READ_NEXT_PAIR(v1, v2, i); + } } } - } @@ -1196,40 +1161,32 @@ ODM_ReadAndConfig_PHY_REG_PG_8188E( hex += interfaceValue << 8; hex += platform << 16; hex += 0xFF000000; - for (i = 0; i < ArrayLen; i += 6 ) - { - u32 v1 = Array[i]; - u32 v2 = Array[i+1]; - u32 v3 = Array[i+2]; - u32 v4 = Array[i+3]; - u32 v5 = Array[i+4]; - u32 v6 = Array[i+5]; - - /* this line is a line of pure_body */ - if ( v1 < 0xCDCDCDCD ) - { + for (i = 0; i < ArrayLen; i += 6 ) { + u32 v1 = Array[i]; + u32 v2 = Array[i+1]; + u32 v3 = Array[i+2]; + u32 v4 = Array[i+3]; + u32 v5 = Array[i+4]; + u32 v6 = Array[i+5]; + /* this line is a line of pure_body */ + if ( v1 < 0xCDCDCDCD ) { odm_ConfigBB_PHY_REG_PG_8188E(pDM_Odm, v1, v2, v3); - - continue; - } - else - { /* this line is the start of branch */ - if ( !CheckCondition(Array[i], hex) ) - { /* don't need the hw_body */ - i += 2; /* skip the pair of expression */ - v1 = Array[i]; - v2 = Array[i+1]; - v3 = Array[i+2]; - while (v2 != 0xDEAD) - { - i += 3; - v1 = Array[i]; - v2 = Array[i+1]; - v3 = Array[i+1]; - } - } - } + continue; + } else { /* this line is the start of branch */ + if ( !CheckCondition(Array[i], hex) ) + { /* don't need the hw_body */ + i += 2; /* skip the pair of expression */ + v1 = Array[i]; + v2 = Array[i+1]; + v3 = Array[i+2]; + while (v2 != 0xDEAD) { + i += 3; + v1 = Array[i]; + v2 = Array[i+1]; + v3 = Array[i+1]; + } + } + } } - } diff --git a/hal/HalHWImg8188E_MAC.c b/hal/HalHWImg8188E_MAC.c index d70b620..8ce870b 100755 --- a/hal/HalHWImg8188E_MAC.c +++ b/hal/HalHWImg8188E_MAC.c @@ -337,48 +337,37 @@ ODM_ReadAndConfig_MAC_REG_ICUT_8188E( hex += 0xFF000000; ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ReadAndConfig_MP_8188E_MAC_REG_ICUT, hex = 0x%X\n", hex)); - for (i = 0; i < ArrayLen; i += 2 ) - { - u32 v1 = Array[i]; - u32 v2 = Array[i+1]; + for (i = 0; i < ArrayLen; i += 2 ) { + u32 v1 = Array[i]; + u32 v2 = Array[i+1]; - /* This (offset, data) pair meets the condition. */ - if ( v1 < 0xCDCDCDCD ) - { + /* This (offset, data) pair meets the condition. */ + if ( v1 < 0xCDCDCDCD ) { odm_ConfigMAC_8188E(pDM_Odm, v1, (u8)v2); - continue; - } - else + continue; + } else { /* This line is the start line of branch. */ - if ( !CheckCondition(Array[i], hex) ) - { /* Discard the following (offset, data) pairs. */ - READ_NEXT_PAIR(v1, v2, i); - while (v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - i -= 2; /* prevent from for-loop += 2 */ - } - else /* Configure matched pairs and skip to end of if-else. */ - { - READ_NEXT_PAIR(v1, v2, i); - while (v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < ArrayLen -2) - { + if ( !CheckCondition(Array[i], hex) ) + { /* Discard the following (offset, data) pairs. */ + READ_NEXT_PAIR(v1, v2, i); + while (v2 != 0xDEAD && + v2 != 0xCDEF && + v2 != 0xCDCD && i < ArrayLen -2) + READ_NEXT_PAIR(v1, v2, i); + i -= 2; /* prevent from for-loop += 2 */ + } else /* Configure matched pairs and skip to end of if-else. */ + { + READ_NEXT_PAIR(v1, v2, i); + while (v2 != 0xDEAD && + v2 != 0xCDEF && + v2 != 0xCDCD && i < ArrayLen -2) { odm_ConfigMAC_8188E(pDM_Odm, v1, (u8)v2); - READ_NEXT_PAIR(v1, v2, i); - } + READ_NEXT_PAIR(v1, v2, i); + } - while (v2 != 0xDEAD && i < ArrayLen -2) - { - READ_NEXT_PAIR(v1, v2, i); - } - - } + while (v2 != 0xDEAD && i < ArrayLen -2) + READ_NEXT_PAIR(v1, v2, i); + } } } - } diff --git a/hal/HalHWImg8188E_RF.c b/hal/HalHWImg8188E_RF.c index 52508ce..ed5b6cb 100755 --- a/hal/HalHWImg8188E_RF.c +++ b/hal/HalHWImg8188E_RF.c @@ -399,7 +399,7 @@ ODM_ReadAndConfig_RadioA_1T_ICUT_8188E( v2 != 0xCDCD && i < ArrayLen -2) { odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2); - READ_NEXT_PAIR(v1, v2, i); + READ_NEXT_PAIR(v1, v2, i); } while (v2 != 0xDEAD && i < ArrayLen -2) diff --git a/hal/HalPhyRf_8188e.c b/hal/HalPhyRf_8188e.c index b300eb6..77733c7 100755 --- a/hal/HalPhyRf_8188e.c +++ b/hal/HalPhyRf_8188e.c @@ -76,39 +76,35 @@ static void setIqkMatrix( ele_C = ((IqkResult_Y * ele_D)>>8)&0x000003FF; if (RFPath == RF_PATH_A) - switch (RFPath) - { - case RF_PATH_A: - /* wirte new elements A, C, D to regC80 and regC94, element B is always 0 */ - value32 = (ele_D<<22)|((ele_C&0x3F)<<16)|ele_A; - ODM_SetBBReg(pDM_Odm, rOFDM0_XATxIQImbalance, bMaskDWord, value32); + switch (RFPath) { + case RF_PATH_A: + /* wirte new elements A, C, D to regC80 and regC94, element B is always 0 */ + value32 = (ele_D<<22)|((ele_C&0x3F)<<16)|ele_A; + ODM_SetBBReg(pDM_Odm, rOFDM0_XATxIQImbalance, bMaskDWord, value32); - value32 = (ele_C&0x000003C0)>>6; - ODM_SetBBReg(pDM_Odm, rOFDM0_XCTxAFE, bMaskH4Bits, value32); + value32 = (ele_C&0x000003C0)>>6; + ODM_SetBBReg(pDM_Odm, rOFDM0_XCTxAFE, bMaskH4Bits, value32); - value32 = ((IqkResult_X * ele_D)>>7)&0x01; - ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT24, value32); - break; - case RF_PATH_B: - /* wirte new elements A, C, D to regC88 and regC9C, element B is always 0 */ - value32=(ele_D<<22)|((ele_C&0x3F)<<16) |ele_A; - ODM_SetBBReg(pDM_Odm, rOFDM0_XBTxIQImbalance, bMaskDWord, value32); + value32 = ((IqkResult_X * ele_D)>>7)&0x01; + ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT24, value32); + break; + case RF_PATH_B: + /* wirte new elements A, C, D to regC88 and regC9C, element B is always 0 */ + value32=(ele_D<<22)|((ele_C&0x3F)<<16) |ele_A; + ODM_SetBBReg(pDM_Odm, rOFDM0_XBTxIQImbalance, bMaskDWord, value32); - value32 = (ele_C&0x000003C0)>>6; - ODM_SetBBReg(pDM_Odm, rOFDM0_XDTxAFE, bMaskH4Bits, value32); + value32 = (ele_C&0x000003C0)>>6; + ODM_SetBBReg(pDM_Odm, rOFDM0_XDTxAFE, bMaskH4Bits, value32); - value32 = ((IqkResult_X * ele_D)>>7)&0x01; - ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT28, value32); + value32 = ((IqkResult_X * ele_D)>>7)&0x01; + ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT28, value32); - break; - default: - break; - } - } - else - { - switch (RFPath) - { + break; + default: + break; + } + } else { + switch (RFPath) { case RF_PATH_A: ODM_SetBBReg(pDM_Odm, rOFDM0_XATxIQImbalance, bMaskDWord, OFDMSwingTable[OFDM_index]); ODM_SetBBReg(pDM_Odm, rOFDM0_XCTxAFE, bMaskH4Bits, 0x00); @@ -126,8 +122,9 @@ static void setIqkMatrix( } } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("TxPwrTracking path B: X = 0x%x, Y = 0x%x ele_A = 0x%x ele_C = 0x%x ele_D = 0x%x 0xeb4 = 0x%x 0xebc = 0x%x\n", - (u32)IqkResult_X, (u32)IqkResult_Y, (u32)ele_A, (u32)ele_C, (u32)ele_D, (u32)IqkResult_X, (u32)IqkResult_Y)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, + ("TxPwrTracking path B: X = 0x%x, Y = 0x%x ele_A = 0x%x ele_C = 0x%x ele_D = 0x%x 0xeb4 = 0x%x 0xebc = 0x%x\n", + (u32)IqkResult_X, (u32)IqkResult_Y, (u32)ele_A, (u32)ele_C, (u32)ele_D, (u32)IqkResult_X, (u32)IqkResult_Y)); } @@ -358,7 +355,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( u8 OFDM_min_index = 6, rf = (is2T) ? 2 : 1; /* OFDM BB Swing should be less than +3.0dB, which is required by Arthur */ u8 Indexforchannel = 0;/*GetRightChnlPlaceforIQK(pHalData->CurrentChannel)*/ - enum _POWER_DEC_INC { POWER_DEC, POWER_INC }; + enum _POWER_DEC_INC { POWER_DEC, POWER_INC }; PDM_ODM_T pDM_Odm = &pHalData->odmpriv; struct dm_priv *pdmpriv = &pHalData->dmpriv; @@ -384,8 +381,8 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("===>odm_TXPowerTrackingCallback_ThermalMeter_8188E, pDM_Odm->BbSwingIdxCckBase: %d, pDM_Odm->BbSwingIdxOfdmBase: %d \n", pDM_Odm->BbSwingIdxCckBase, pDM_Odm->BbSwingIdxOfdmBase)); ThermalValue = (u8)ODM_GetRFReg(pDM_Odm, RF_PATH_A, RF_T_METER_88E, 0xfc00); /* 0x42: RF Reg[15:10] 88E */ - if( ! ThermalValue || ! pDM_Odm->RFCalibrateInfo.TxPowerTrackControl) - return; + if (!ThermalValue || ! pDM_Odm->RFCalibrateInfo.TxPowerTrackControl) + return; /* 4 3. Initialize ThermalValues of RFCalibrateInfo */ @@ -462,8 +459,8 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( else pDM_Odm->RFCalibrateInfo.PowerIndexOffset = pDM_Odm->RFCalibrateInfo.DeltaPowerIndex - pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast; - for(i = 0; i < rf; i++) - pDM_Odm->RFCalibrateInfo.OFDM_index[i] = pDM_Odm->BbSwingIdxOfdmBase + pDM_Odm->RFCalibrateInfo.PowerIndexOffset; + for(i = 0; i < rf; i++) + pDM_Odm->RFCalibrateInfo.OFDM_index[i] = pDM_Odm->BbSwingIdxOfdmBase + pDM_Odm->RFCalibrateInfo.PowerIndexOffset; pDM_Odm->RFCalibrateInfo.CCK_index = pDM_Odm->BbSwingIdxCckBase + pDM_Odm->RFCalibrateInfo.PowerIndexOffset; pDM_Odm->BbSwingIdxCck = pDM_Odm->RFCalibrateInfo.CCK_index; @@ -475,8 +472,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( /* 4 7.1 Handle boundary conditions of index. */ - for(i = 0; i < rf; i++) - { + for(i = 0; i < rf; i++) { if(pDM_Odm->RFCalibrateInfo.OFDM_index[i] > OFDM_TABLE_SIZE_92D-1) { pDM_Odm->RFCalibrateInfo.OFDM_index[i] = OFDM_TABLE_SIZE_92D-1; @@ -489,11 +485,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( if(pDM_Odm->RFCalibrateInfo.CCK_index > CCK_TABLE_SIZE-1) pDM_Odm->RFCalibrateInfo.CCK_index = CCK_TABLE_SIZE-1; - else if (pDM_Odm->RFCalibrateInfo.CCK_index < 0) - pDM_Odm->RFCalibrateInfo.CCK_index = 0; - } - else - { + } else { ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("The thermal meter is unchanged or TxPowerTracking OFF: ThermalValue: %d , pDM_Odm->RFCalibrateInfo.ThermalValue: %d)\n", ThermalValue, pDM_Odm->RFCalibrateInfo.ThermalValue)); pDM_Odm->RFCalibrateInfo.PowerIndexOffset = 0; @@ -1190,32 +1182,31 @@ phy_SimularityCompare_8188E( else { - if (!(SimularityBitMap & 0x03)) /* path A TX OK */ - { - for(i = 0; i < 2; i++) - result[3][i] = result[c1][i]; - } + if (!(SimularityBitMap & 0x03)) /* path A TX OK */ + { + for(i = 0; i < 2; i++) + result[3][i] = result[c1][i]; + } - if (!(SimularityBitMap & 0x0c)) /* path A RX OK */ - { - for(i = 2; i < 4; i++) - result[3][i] = result[c1][i]; - } + if (!(SimularityBitMap & 0x0c)) /* path A RX OK */ + { + for(i = 2; i < 4; i++) + result[3][i] = result[c1][i]; + } - if (!(SimularityBitMap & 0x30)) /* path B TX OK */ - { - for(i = 4; i < 6; i++) - result[3][i] = result[c1][i]; + if (!(SimularityBitMap & 0x30)) /* path B TX OK */ + { + for(i = 4; i < 6; i++) + result[3][i] = result[c1][i]; + } - } + if (!(SimularityBitMap & 0xc0)) /* path B RX OK */ + { + for(i = 6; i < 8; i++) + result[3][i] = result[c1][i]; + } - if (!(SimularityBitMap & 0xc0)) /* path B RX OK */ - { - for(i = 6; i < 8; i++) - result[3][i] = result[c1][i]; - } - - return false; + return false; } } @@ -1258,15 +1249,14 @@ phy_IQCalibrate_8188E( #else u32 retryCount = 2; #endif -if ( *(pDM_Odm->mp_mode) == 1) - retryCount = 9; + if ( *(pDM_Odm->mp_mode) == 1) + retryCount = 9; else retryCount = 2; /* Note: IQ calibration must be performed after loading */ /* PHY_REG.txt , and radio_a, radio_b.txt */ - if(t==0) - { + if(t==0) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQ Calibration for %s for %d times\n", (is2T ? "2T2R" : "1T1R"), t)); /* Save ADDA parameters, turn Path A ADDA on */ @@ -1605,22 +1595,17 @@ if ( *(pDM_Odm->mp_mode) == 1) /* and value will cause RF internal PA to be unpredictably disabled by HW, such that RF Tx signal */ /* will disappear after disable/enable card many times on 88CU. RF SD and DD have not find the */ /* root cause, so we remove these actions temporarily. Added by tynli and SD3 Allen. 2010.05.31. */ -/* if MP_DRIVER != 1 */ -if (*(pDM_Odm->mp_mode) != 1) - return; -/* endif */ + if (*(pDM_Odm->mp_mode) != 1) + return; /* settings adjust for normal chip */ - for(index = 0; index < PATH_NUM; index ++) - { + for(index = 0; index < PATH_NUM; index ++) { APK_offset[index] = APK_normal_offset[index]; APK_value[index] = APK_normal_value[index]; AFE_on_off[index] = 0x6fdb25a4; } - for(index = 0; index < APK_BB_REG_NUM; index ++) - { - for(path = 0; path < pathbound; path++) - { + for(index = 0; index < APK_BB_REG_NUM; index ++) { + for(path = 0; path < pathbound; path++) { APK_RF_init_value[path][index] = APK_normal_RF_init_value[path][index]; APK_RF_value_0[path][index] = APK_normal_RF_value_0[path][index]; } @@ -1630,8 +1615,7 @@ if (*(pDM_Odm->mp_mode) != 1) apkbound = 6; /* save BB default value */ - for(index = 0; index < APK_BB_REG_NUM ; index++) - { + for(index = 0; index < APK_BB_REG_NUM ; index++) { if(index == 0) /* skip */ continue; BB_backup[index] = ODM_GetBBReg(pDM_Odm, BB_REG[index], bMaskDWord); @@ -2089,7 +2073,7 @@ if (*(pDM_Odm->mp_mode) == 1) _PHY_PathBFillIQKMatrix(pAdapter, bPathBOK, result, final_candidate, (RegEC4 == 0)); } - Indexforchannel = ODM_GetRightChnlPlaceforIQK(pHalData->CurrentChannel); + Indexforchannel = ODM_GetRightChnlPlaceforIQK(pHalData->CurrentChannel); /* To Fix BSOD when final_candidate is 0xff */ /* by sherry 20120321 */ @@ -2178,29 +2162,6 @@ PHY_APCalibrate_8188E( IN s8 delta ) { - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - PDM_ODM_T pDM_Odm = &pHalData->odmpriv; -#if DISABLE_BB_RF - return; -#endif - - return; - if(!(pDM_Odm->SupportAbility & ODM_RF_CALIBRATION)) - return; - -#if FOR_BRAZIL_PRETEST != 1 - if(pDM_Odm->RFCalibrateInfo.bAPKdone) -#endif - return; - - if(pDM_Odm->RFType == ODM_2T2R){ - phy_APCalibrate_8188E(pAdapter, delta, true); - } - else - { - /* For 88C 1T1R */ - phy_APCalibrate_8188E(pAdapter, delta, false); - } } static void phy_SetRFPathSwitch_8188E( diff --git a/hal/odm.c b/hal/odm.c index c6c89ce..6313006 100755 --- a/hal/odm.c +++ b/hal/odm.c @@ -640,7 +640,7 @@ ODM_DMWatchdog( else if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) { ODM_TXPowerTrackingCheck(pDM_Odm); - odm_EdcaTurboCheck(pDM_Odm); + odm_EdcaTurboCheck(pDM_Odm); odm_DynamicTxPower(pDM_Odm); } @@ -1167,32 +1167,28 @@ ODM_Write_DIG( if(pDM_DigTable->CurIGValue != CurrentIGI)/* if(pDM_DigTable->PreIGValue != CurrentIGI) */ { - if(pDM_Odm->SupportPlatform & (ODM_CE|ODM_MP)) - { + if(pDM_Odm->SupportPlatform & (ODM_CE|ODM_MP)) { ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_A,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); - if(pDM_Odm->SupportICType != ODM_RTL8188E) + if(pDM_Odm->SupportICType != ODM_RTL8188E) ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_B,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); - } - else if(pDM_Odm->SupportPlatform & (ODM_AP|ODM_ADSL)) - { - switch(*(pDM_Odm->pOnePathCCA)) - { + } else if(pDM_Odm->SupportPlatform & (ODM_AP|ODM_ADSL)) { + switch(*(pDM_Odm->pOnePathCCA)) { case ODM_CCA_2R: ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_A,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); - if(pDM_Odm->SupportICType != ODM_RTL8188E) + if(pDM_Odm->SupportICType != ODM_RTL8188E) ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_B,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); break; case ODM_CCA_1R_A: ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_A,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); - if(pDM_Odm->SupportICType != ODM_RTL8188E) + if(pDM_Odm->SupportICType != ODM_RTL8188E) ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_B,pDM_Odm), ODM_BIT(IGI,pDM_Odm), getIGIForDiff(CurrentIGI)); break; case ODM_CCA_1R_B: ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_A,pDM_Odm), ODM_BIT(IGI,pDM_Odm), getIGIForDiff(CurrentIGI)); - if(pDM_Odm->SupportICType != ODM_RTL8188E) + if(pDM_Odm->SupportICType != ODM_RTL8188E) ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_B,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); - break; - } + break; + } } ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("CurrentIGI(0x%02x). \n",CurrentIGI)); /* pDM_DigTable->PreIGValue = pDM_DigTable->CurIGValue; */ @@ -1250,9 +1246,9 @@ odm_DIGbyRSSI_LPS( RSSI_Lower =DM_DIG_MIN_NIC; /* Upper and Lower Bound checking */ - if(CurrentIGI > DM_DIG_MAX_NIC) + if(CurrentIGI > DM_DIG_MAX_NIC) CurrentIGI=DM_DIG_MAX_NIC; - else if(CurrentIGI < RSSI_Lower) + else if(CurrentIGI < RSSI_Lower) CurrentIGI =RSSI_Lower; ODM_Write_DIG(pDM_Odm, CurrentIGI);/* ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); */ @@ -1904,51 +1900,47 @@ odm_FalseAlarmCounterStatistics( if(!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT)) return; - if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) - { - - /* hold ofdm counter */ + if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) { + /* hold ofdm counter */ ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_HOLDC_11N, BIT31, 1); /* hold page C counter */ ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTD_11N, BIT31, 1); /* hold page D counter */ ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_TYPE1_11N, bMaskDWord); - FalseAlmCnt->Cnt_Fast_Fsync = (ret_value&0xffff); - FalseAlmCnt->Cnt_SB_Search_fail = ((ret_value&0xffff0000)>>16); + FalseAlmCnt->Cnt_Fast_Fsync = (ret_value&0xffff); + FalseAlmCnt->Cnt_SB_Search_fail = ((ret_value&0xffff0000)>>16); ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_TYPE2_11N, bMaskDWord); - FalseAlmCnt->Cnt_OFDM_CCA = (ret_value&0xffff); - FalseAlmCnt->Cnt_Parity_Fail = ((ret_value&0xffff0000)>>16); + FalseAlmCnt->Cnt_OFDM_CCA = (ret_value&0xffff); + FalseAlmCnt->Cnt_Parity_Fail = ((ret_value&0xffff0000)>>16); ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_TYPE3_11N, bMaskDWord); - FalseAlmCnt->Cnt_Rate_Illegal = (ret_value&0xffff); - FalseAlmCnt->Cnt_Crc8_fail = ((ret_value&0xffff0000)>>16); + FalseAlmCnt->Cnt_Rate_Illegal = (ret_value&0xffff); + FalseAlmCnt->Cnt_Crc8_fail = ((ret_value&0xffff0000)>>16); ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_OFDM_FA_TYPE4_11N, bMaskDWord); - FalseAlmCnt->Cnt_Mcs_fail = (ret_value&0xffff); + FalseAlmCnt->Cnt_Mcs_fail = (ret_value&0xffff); - FalseAlmCnt->Cnt_Ofdm_fail = FalseAlmCnt->Cnt_Parity_Fail + FalseAlmCnt->Cnt_Rate_Illegal + + FalseAlmCnt->Cnt_Ofdm_fail = FalseAlmCnt->Cnt_Parity_Fail + FalseAlmCnt->Cnt_Rate_Illegal + FalseAlmCnt->Cnt_Crc8_fail + FalseAlmCnt->Cnt_Mcs_fail + FalseAlmCnt->Cnt_Fast_Fsync + FalseAlmCnt->Cnt_SB_Search_fail; - if(pDM_Odm->SupportICType == ODM_RTL8188E) - { + if(pDM_Odm->SupportICType == ODM_RTL8188E) + { ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_SC_CNT_11N, bMaskDWord); - FalseAlmCnt->Cnt_BW_LSC = (ret_value&0xffff); - FalseAlmCnt->Cnt_BW_USC = ((ret_value&0xffff0000)>>16); - } + FalseAlmCnt->Cnt_BW_LSC = (ret_value&0xffff); + FalseAlmCnt->Cnt_BW_USC = ((ret_value&0xffff0000)>>16); + } - { /* hold cck counter */ - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT12, 1); - ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT14, 1); + ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT12, 1); + ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT14, 1); - ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_CCK_FA_LSB_11N, bMaskByte0); + ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_CCK_FA_LSB_11N, bMaskByte0); FalseAlmCnt->Cnt_Cck_fail = ret_value; - ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_CCK_FA_MSB_11N, bMaskByte3); + ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_CCK_FA_MSB_11N, bMaskByte3); FalseAlmCnt->Cnt_Cck_fail += (ret_value& 0xff)<<8; - ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_CCK_CCA_CNT_11N, bMaskDWord); + ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_CCK_CCA_CNT_11N, bMaskDWord); FalseAlmCnt->Cnt_CCK_CCA = ((ret_value&0xFF)<<8) |((ret_value&0xFF00)>>8); - } - FalseAlmCnt->Cnt_all = ( FalseAlmCnt->Cnt_Fast_Fsync + + FalseAlmCnt->Cnt_all = ( FalseAlmCnt->Cnt_Fast_Fsync + FalseAlmCnt->Cnt_SB_Search_fail + FalseAlmCnt->Cnt_Parity_Fail + FalseAlmCnt->Cnt_Rate_Illegal + @@ -1956,33 +1948,33 @@ odm_FalseAlarmCounterStatistics( FalseAlmCnt->Cnt_Mcs_fail + FalseAlmCnt->Cnt_Cck_fail); - FalseAlmCnt->Cnt_CCA_all = FalseAlmCnt->Cnt_OFDM_CCA + FalseAlmCnt->Cnt_CCK_CCA; + FalseAlmCnt->Cnt_CCA_all = FalseAlmCnt->Cnt_OFDM_CCA + FalseAlmCnt->Cnt_CCK_CCA; - if(pDM_Odm->SupportICType >=ODM_RTL8723A) - { - /* reset false alarm counter registers */ + if(pDM_Odm->SupportICType >=ODM_RTL8723A) + { + /* reset false alarm counter registers */ ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTC_11N, BIT31, 1); ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTC_11N, BIT31, 0); ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTD_11N, BIT27, 1); ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTD_11N, BIT27, 0); - /* update ofdm counter */ + /* update ofdm counter */ ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_HOLDC_11N, BIT31, 0); /* update page C counter */ ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTD_11N, BIT31, 0); /* update page D counter */ - /* reset CCK CCA counter */ + /* reset CCK CCA counter */ ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT13|BIT12, 0); ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT13|BIT12, 2); - /* reset CCK FA counter */ + /* reset CCK FA counter */ ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT15|BIT14, 0); ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_FA_RST_11N, BIT15|BIT14, 2); - } + } - ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Enter odm_FalseAlarmCounterStatistics\n")); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Fast_Fsync=%d, Cnt_SB_Search_fail=%d\n", + ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Enter odm_FalseAlarmCounterStatistics\n")); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Fast_Fsync=%d, Cnt_SB_Search_fail=%d\n", FalseAlmCnt->Cnt_Fast_Fsync, FalseAlmCnt->Cnt_SB_Search_fail)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Parity_Fail=%d, Cnt_Rate_Illegal=%d\n", + ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Parity_Fail=%d, Cnt_Rate_Illegal=%d\n", FalseAlmCnt->Cnt_Parity_Fail, FalseAlmCnt->Cnt_Rate_Illegal)); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Crc8_fail=%d, Cnt_Mcs_fail=%d\n", + ODM_RT_TRACE(pDM_Odm,ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Crc8_fail=%d, Cnt_Mcs_fail=%d\n", FalseAlmCnt->Cnt_Crc8_fail, FalseAlmCnt->Cnt_Mcs_fail)); } else /* FOR ODM_IC_11AC_SERIES */ @@ -3180,28 +3172,24 @@ odm_SetRxIdleAnt( { SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; - if(Ant != pDM_SWAT_Table->RxIdleAnt) - { - /* for path-A */ - if(Ant==1) + if(Ant != pDM_SWAT_Table->RxIdleAnt) { + /* for path-A */ + if(Ant==1) ODM_SetBBReg(pDM_Odm,ODM_REG_RX_DEFUALT_A_11N, 0xFFFF, 0x65a9); /* right-side antenna */ - else + else ODM_SetBBReg(pDM_Odm,ODM_REG_RX_DEFUALT_A_11N, 0xFFFF, 0x569a); /* left-side antenna */ - /* for path-B */ - if(bDualPath){ + /* for path-B */ + if(bDualPath){ if(Ant==0) ODM_SetBBReg(pDM_Odm,ODM_REG_RX_DEFUALT_A_11N, 0xFFFF0000, 0x65a9); /* right-side antenna */ - else + else ODM_SetBBReg(pDM_Odm,ODM_REG_RX_DEFUALT_A_11N, 0xFFFF0000, 0x569a); /* left-side antenna */ } } - pDM_SWAT_Table->RxIdleAnt = Ant; + pDM_SWAT_Table->RxIdleAnt = Ant; ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("RxIdleAnt: %s Reg858=0x%x\n",(Ant==1)?"Ant1":"Ant2",(Ant==1)?0x65a9:0x569a)); - - /* ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("<==============odm_SetRxIdleAnt\n")); */ - - } +} void ODM_AntselStatistics_88C( @@ -3800,61 +3788,42 @@ ODM_SingleDualAntennaDetection( if(pDM_Odm->SupportICType == ODM_RTL8723A) { /* 2 Test Ant B based on Ant A is ON */ - if(mode==ANTTESTB) - { - if(AntA_report >= 100) - { - if(AntB_report > (AntA_report+1)) - { - pDM_SWAT_Table->ANTB_ON=false; + if(mode==ANTTESTB) { + if(AntA_report >= 100) { + if(AntB_report > (AntA_report+1)) { + pDM_SWAT_Table->ANTB_ON=false; ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SingleDualAntennaDetection(): Single Antenna A\n")); - } - else - { - pDM_SWAT_Table->ANTB_ON=true; + } else { + pDM_SWAT_Table->ANTB_ON=true; ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SingleDualAntennaDetection(): Dual Antenna is A and B\n")); + } + } else { + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SingleDualAntennaDetection(): Need to check again\n")); + pDM_SWAT_Table->ANTB_ON=false; /* Set Antenna B off as default */ + bResult = false; + } } - } - else - { - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SingleDualAntennaDetection(): Need to check again\n")); - pDM_SWAT_Table->ANTB_ON=false; /* Set Antenna B off as default */ - bResult = false; - } - } - /* 2 Test Ant A and B based on DPDT Open */ - else if(mode==ANTTESTALL) - { - if((AntO_report >=100)&(AntO_report <118)) - { - if(AntA_report > (AntO_report+1)) - { - pDM_SWAT_Table->ANTA_ON=false; - /* RT_TRACE(COMP_ANTENNA, DBG_LOUD, ("ODM_AntennaDetection(): Antenna A is OFF\n")); */ + /* 2 Test Ant A and B based on DPDT Open */ + else if(mode==ANTTESTALL) { + if((AntO_report >=100)&(AntO_report <118)) { + if(AntA_report > (AntO_report+1)) { + pDM_SWAT_Table->ANTA_ON=false; ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("Ant A is OFF")); - } - else - { - pDM_SWAT_Table->ANTA_ON=true; - /* RT_TRACE(COMP_ANTENNA, DBG_LOUD, ("ODM_AntennaDetection(): Antenna A is ON\n")); */ + } else { + pDM_SWAT_Table->ANTA_ON=true; ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("Ant A is ON")); - } + } - if(AntB_report > (AntO_report+2)) - { - pDM_SWAT_Table->ANTB_ON=false; - /* RT_TRACE(COMP_ANTENNA, DBG_LOUD, ("ODM_AntennaDetection(): Antenna B is OFF\n")); */ + if(AntB_report > (AntO_report+2)) { + pDM_SWAT_Table->ANTB_ON=false; ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("Ant B is OFF")); - } - else - { - pDM_SWAT_Table->ANTB_ON=true; - /* RT_TRACE(COMP_ANTENNA, DBG_LOUD, ("ODM_AntennaDetection(): Antenna B is ON\n")); */ + } else { + pDM_SWAT_Table->ANTB_ON=true; ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("Ant B is ON")); + } } } } - } else if(pDM_Odm->SupportICType == ODM_RTL8192C) { if(AntA_report >= 100) diff --git a/hal/odm_HWConfig.c b/hal/odm_HWConfig.c index 0a550fe..0595990 100755 --- a/hal/odm_HWConfig.c +++ b/hal/odm_HWConfig.c @@ -255,71 +255,63 @@ odm_RxPhyStatus92CSeries_Parsing( PPHY_STATUS_RPT_8192CD_T pPhyStaRpt = (PPHY_STATUS_RPT_8192CD_T)pPhyStatus; - isCCKrate = ((pPktinfo->Rate >= DESC92C_RATE1M ) && (pPktinfo->Rate <= DESC92C_RATE11M ))?true :false; + isCCKrate = (pPktinfo->Rate <= DESC92C_RATE11M) ? true : false; pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_A] = -1; pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_B] = -1; - if(isCCKrate) - { + if(isCCKrate) { u8 report; u8 cck_agc_rpt; pDM_Odm->PhyDbgInfo.NumQryPhyStatusCCK++; - /* */ /* (1)Hardware does not provide RSSI for CCK */ /* (2)PWDB, Average PWDB cacluated by hardware (for rate adaptive) */ - /* */ - /* if(pHalData->eRFPowerState == eRfOn) */ - cck_highpwr = pDM_Odm->bCckHighPower; - /* else */ - /* cck_highpwr = false; */ + cck_highpwr = pDM_Odm->bCckHighPower; cck_agc_rpt = pPhyStaRpt->cck_agc_rpt_ofdm_cfosho_a ; /* 2011.11.28 LukeLee: 88E use different LNA & VGA gain table */ /* The RSSI formula should be modified according to the gain table */ /* In 88E, cck_highpwr is always set to 1 */ - if(pDM_Odm->SupportICType & (ODM_RTL8188E|ODM_RTL8812)) - { + if(pDM_Odm->SupportICType & (ODM_RTL8188E|ODM_RTL8812)) { LNA_idx = ((cck_agc_rpt & 0xE0) >>5); VGA_idx = (cck_agc_rpt & 0x1F); - switch(LNA_idx) - { - case 7: - if(VGA_idx <= 27) - rx_pwr_all = -100 + 2*(27-VGA_idx); /* VGA_idx = 27~2 */ - else - rx_pwr_all = -100; - break; - case 6: - rx_pwr_all = -48 + 2*(2-VGA_idx); /* VGA_idx = 2~0 */ - break; - case 5: - rx_pwr_all = -42 + 2*(7-VGA_idx); /* VGA_idx = 7~5 */ - break; - case 4: - rx_pwr_all = -36 + 2*(7-VGA_idx); /* VGA_idx = 7~4 */ - break; - case 3: - rx_pwr_all = -24 + 2*(7-VGA_idx); /* VGA_idx = 7~0 */ - break; - case 2: - if(cck_highpwr) - rx_pwr_all = -12 + 2*(5-VGA_idx); /* VGA_idx = 5~0 */ - else - rx_pwr_all = -6+ 2*(5-VGA_idx); - break; - case 1: - rx_pwr_all = 8-2*VGA_idx; - break; - case 0: - rx_pwr_all = 14-2*VGA_idx; - break; - default: - break; + switch(LNA_idx) { + case 7: + if(VGA_idx <= 27) + rx_pwr_all = -100 + 2*(27-VGA_idx); /* VGA_idx = 27~2 */ + else + rx_pwr_all = -100; + break; + case 6: + rx_pwr_all = -48 + 2*(2-VGA_idx); /* VGA_idx = 2~0 */ + break; + case 5: + rx_pwr_all = -42 + 2*(7-VGA_idx); /* VGA_idx = 7~5 */ + break; + case 4: + rx_pwr_all = -36 + 2*(7-VGA_idx); /* VGA_idx = 7~4 */ + break; + case 3: + rx_pwr_all = -24 + 2*(7-VGA_idx); /* VGA_idx = 7~0 */ + break; + case 2: + if(cck_highpwr) + rx_pwr_all = -12 + 2*(5-VGA_idx); /* VGA_idx = 5~0 */ + else + rx_pwr_all = -6+ 2*(5-VGA_idx); + break; + case 1: + rx_pwr_all = 8-2*VGA_idx; + break; + case 0: + rx_pwr_all = 14-2*VGA_idx; + break; + default: + break; } rx_pwr_all += 6; PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all); @@ -449,11 +441,8 @@ odm_RxPhyStatus92CSeries_Parsing( { pDM_Odm->PhyDbgInfo.NumQryPhyStatusOFDM++; - /* */ /* (1)Get RSSI for HT rate */ - /* */ - - for(i = ODM_RF_PATH_A; i < ODM_RF_PATH_MAX; i++) + for(i = ODM_RF_PATH_A; i < ODM_RF_PATH_MAX; i++) { /* 2008/01/30 MH we will judge RF RX path now. */ if (pDM_Odm->RFPathRxEnable & BIT(i)) @@ -601,15 +590,12 @@ odm_Process_RSSIForDM( } pEntry = pDM_Odm->pODM_StaInfo[pPktinfo->StationID]; - if(!IS_STA_VALID(pEntry) ){ + if(!IS_STA_VALID(pEntry)) return; - } if((!pPktinfo->bPacketMatchBSSID) ) - { return; - } - isCCKrate = ((pPktinfo->Rate >= DESC92C_RATE1M ) && (pPktinfo->Rate <= DESC92C_RATE11M ))?true :false; + isCCKrate = (pPktinfo->Rate <= DESC92C_RATE11M) ? true : false; if(pPktinfo->bPacketBeacon) pDM_Odm->PhyDbgInfo.NumQryBeaconPkt++; @@ -877,25 +863,18 @@ ODM_ConfigBBWithHeaderFile( IN ODM_BB_Config_Type ConfigType ) { - if(pDM_Odm->SupportICType == ODM_RTL8188E) - { - - if(ConfigType == CONFIG_BB_PHY_REG) - { + if(pDM_Odm->SupportICType == ODM_RTL8188E) { + if(ConfigType == CONFIG_BB_PHY_REG) { if(IS_VENDOR_8188E_I_CUT_SERIES(pDM_Odm->Adapter)) READ_AND_CONFIG(8188E,_PHY_REG_1T_ICUT_); else READ_AND_CONFIG(8188E,_PHY_REG_1T_); - } - else if(ConfigType == CONFIG_BB_AGC_TAB) - { + } else if(ConfigType == CONFIG_BB_AGC_TAB) { if(IS_VENDOR_8188E_I_CUT_SERIES(pDM_Odm->Adapter)) READ_AND_CONFIG(8188E,_AGC_TAB_1T_ICUT_); else READ_AND_CONFIG(8188E,_AGC_TAB_1T_); - } - else if(ConfigType == CONFIG_BB_PHY_REG_PG) - { + } else if(ConfigType == CONFIG_BB_PHY_REG_PG) { READ_AND_CONFIG(8188E,_PHY_REG_PG_); ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> phy_ConfigBBWithHeaderFile() agc:Rtl8188EPHY_REG_PGArray\n")); } @@ -909,8 +888,7 @@ ODM_ConfigMACWithHeaderFile( ) { u8 result = HAL_STATUS_SUCCESS; - if (pDM_Odm->SupportICType == ODM_RTL8188E) - { + if (pDM_Odm->SupportICType == ODM_RTL8188E) { if(IS_VENDOR_8188E_I_CUT_SERIES(pDM_Odm->Adapter)) READ_AND_CONFIG(8188E,_MAC_REG_ICUT_); else diff --git a/hal/odm_RTL8188E.c b/hal/odm_RTL8188E.c index 907ab1d..0dfa318 100755 --- a/hal/odm_RTL8188E.c +++ b/hal/odm_RTL8188E.c @@ -140,18 +140,18 @@ odm_FastAntTrainingInit( pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; u32 AntCombination = 2; struct adapter * Adapter = pDM_Odm->Adapter; - ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_FastAntTrainingInit() \n")); + + + ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_FastAntTrainingInit() \n")); #if (MP_DRIVER == 1) - if (*(pDM_Odm->mp_mode) == 1) - { + if (*(pDM_Odm->mp_mode) == 1) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("pDM_Odm->AntDivType: %d\n", pDM_Odm->AntDivType)); - return; + return; } #endif - for(i=0; i<6; i++) - { + for(i=0; i<6; i++) { pDM_FatTable->Bssid[i] = 0; pDM_FatTable->antSumRSSI[i] = 0; pDM_FatTable->antRSSIcnt[i] = 0; @@ -576,5 +576,5 @@ odm_DynamicPrimaryCCA( u8 SecCHOffset; u8 i; - return; + return; } diff --git a/hal/odm_RegConfig8188E.c b/hal/odm_RegConfig8188E.c index 6f69d38..0fceba0 100755 --- a/hal/odm_RegConfig8188E.c +++ b/hal/odm_RegConfig8188E.c @@ -72,9 +72,9 @@ odm_ConfigRF_RadioA_8188E( u32 content = 0x1000; /* RF_Content: radioa_txt */ u32 maskforPhySet= (u32)(content&0xE000); - odm_ConfigRFReg_8188E(pDM_Odm, Addr, Data, ODM_RF_PATH_A, Addr|maskforPhySet); + odm_ConfigRFReg_8188E(pDM_Odm, Addr, Data, ODM_RF_PATH_A, Addr|maskforPhySet); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigRFWithHeaderFile: [RadioA] %08X %08X\n", Addr, Data)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigRFWithHeaderFile: [RadioA] %08X %08X\n", Addr, Data)); } void @@ -87,7 +87,7 @@ odm_ConfigRF_RadioB_8188E( u32 content = 0x1001; /* RF_Content: radiob_txt */ u32 maskforPhySet= (u32)(content&0xE000); - odm_ConfigRFReg_8188E(pDM_Odm, Addr, Data, ODM_RF_PATH_B, Addr|maskforPhySet); + odm_ConfigRFReg_8188E(pDM_Odm, Addr, Data, ODM_RF_PATH_B, Addr|maskforPhySet); ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigRFWithHeaderFile: [RadioB] %08X %08X\n", Addr, Data)); @@ -116,7 +116,7 @@ odm_ConfigBB_AGC_8188E( /* Add 1us delay between BB/RF register setting. */ ODM_delay_us(1); - ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigBBWithHeaderFile: [AGC_TAB] %08X %08X\n", Addr, Data)); + ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigBBWithHeaderFile: [AGC_TAB] %08X %08X\n", Addr, Data)); } void diff --git a/hal/rtl8188e_hal_init.c b/hal/rtl8188e_hal_init.c index bc08f78..9be98a7 100755 --- a/hal/rtl8188e_hal_init.c +++ b/hal/rtl8188e_hal_init.c @@ -2762,16 +2762,15 @@ static u8 _LLTRead(struct adapter *padapter, u32 address) void Read_LLT_Tab(struct adapter *padapter) { u32 addr,next_addr; - printk("############### %s ###################\n",__FUNCTION__); - for(addr=0;addr<176;addr++) - { - next_addr = _LLTRead(padapter,addr); - printk("%d->",next_addr); - if(((addr+1) %8) ==0) - printk("\n"); - } - printk("\n##################################\n"); + printk("############### %s ###################\n",__FUNCTION__); + for(addr=0;addr<176;addr++) { + next_addr = _LLTRead(padapter,addr); + printk("%d->",next_addr); + if(((addr+1) %8) ==0) + printk("\n"); + } + printk("\n##################################\n"); } s32 InitLLTTable(struct adapter *padapter, u8 txpktbuf_bndy) diff --git a/hal/rtl8188e_phycfg.c b/hal/rtl8188e_phycfg.c index 0ab5d4b..68ec95c 100755 --- a/hal/rtl8188e_phycfg.c +++ b/hal/rtl8188e_phycfg.c @@ -1454,15 +1454,12 @@ phy_TxPwrIdxToDbm( /* The mapping may be different by different NICs. Do not use this formula for what needs accurate result. */ /* By Bruce, 2008-01-29. */ /* */ - switch(WirelessMode) - { + switch(WirelessMode) { case WIRELESS_MODE_B: Offset = -7; break; - case WIRELESS_MODE_G: case WIRELESS_MODE_N_24G: - Offset = -8; default: Offset = -8; break; @@ -1577,47 +1574,6 @@ static void getTxPowerIndex88E( /* 2. BW40 */ BW40PowerLevel[TxCount] = pHalData->Index24G_BW40_Base[TxCount][index]; } - else if(TxCount==RF_PATH_C) - { - /* 1. CCK */ - cckPowerLevel[TxCount] = pHalData->Index24G_CCK_Base[TxCount][index]; - /* 2. OFDM */ - ofdmPowerLevel[TxCount] = pHalData->Index24G_BW40_Base[RF_PATH_A][index]+ - pHalData->BW20_24G_Diff[RF_PATH_A][index]+ - pHalData->BW20_24G_Diff[RF_PATH_B][index]+ - pHalData->BW20_24G_Diff[TxCount][index]; - /* 1. BW20 */ - BW20PowerLevel[TxCount] = pHalData->Index24G_BW40_Base[RF_PATH_A][index]+ - pHalData->BW20_24G_Diff[RF_PATH_A][index]+ - pHalData->BW20_24G_Diff[RF_PATH_B][index]+ - pHalData->BW20_24G_Diff[TxCount][index]; - /* 2. BW40 */ - BW40PowerLevel[TxCount] = pHalData->Index24G_BW40_Base[TxCount][index]; - } - else if(TxCount==RF_PATH_D) - { - /* 1. CCK */ - cckPowerLevel[TxCount] = pHalData->Index24G_CCK_Base[TxCount][index]; - /* 2. OFDM */ - ofdmPowerLevel[TxCount] = pHalData->Index24G_BW40_Base[RF_PATH_A][index]+ - pHalData->BW20_24G_Diff[RF_PATH_A][index]+ - pHalData->BW20_24G_Diff[RF_PATH_B][index]+ - pHalData->BW20_24G_Diff[RF_PATH_C][index]+ - pHalData->BW20_24G_Diff[TxCount][index]; - - /* 1. BW20 */ - BW20PowerLevel[TxCount] = pHalData->Index24G_BW40_Base[RF_PATH_A][index]+ - pHalData->BW20_24G_Diff[RF_PATH_A][index]+ - pHalData->BW20_24G_Diff[RF_PATH_B][index]+ - pHalData->BW20_24G_Diff[RF_PATH_C][index]+ - pHalData->BW20_24G_Diff[TxCount][index]; - - /* 2. BW40 */ - BW40PowerLevel[TxCount] = pHalData->Index24G_BW40_Base[TxCount][index]; - } - else - { - } } } diff --git a/hal/rtl8188eu_xmit.c b/hal/rtl8188eu_xmit.c index 5f98538..84eb1ba 100755 --- a/hal/rtl8188eu_xmit.c +++ b/hal/rtl8188eu_xmit.c @@ -205,14 +205,13 @@ static void fill_txdesc_phy(struct pkt_attrib *pattrib, __le32 *pdw) static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bagg_pkt) { - int pull=0; + int pull=0; uint qsel; u8 data_rate,pwr_status,offset; struct adapter *padapter = pxmitframe->padapter; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct pkt_attrib *pattrib = &pxmitframe->attrib; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - /* struct dm_priv *pdmpriv = &pHalData->dmpriv; */ struct tx_desc *ptxdesc = (struct tx_desc *)pmem; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -249,17 +248,15 @@ if (padapter->registrypriv.mp_mode == 0) if (bmcst) ptxdesc->txdw0 |= cpu_to_le32(BMC); #ifndef CONFIG_USE_USB_BUFFER_ALLOC_TX -if (padapter->registrypriv.mp_mode == 0) -{ - if(!bagg_pkt){ - if((pull) && (pxmitframe->pkt_offset>0)) { - pxmitframe->pkt_offset = pxmitframe->pkt_offset -1; + if (padapter->registrypriv.mp_mode == 0) + { + if(!bagg_pkt){ + if((pull) && (pxmitframe->pkt_offset>0)) { + pxmitframe->pkt_offset = pxmitframe->pkt_offset -1; + } } } -} #endif - /* DBG_8192C("%s, pkt_offset=0x%02x\n",__FUNCTION__,pxmitframe->pkt_offset); */ - /* pkt_offset, unit:8 bytes padding */ if (pxmitframe->pkt_offset > 0) ptxdesc->txdw1 |= cpu_to_le32((pxmitframe->pkt_offset << 26) & 0x7c000000); @@ -538,10 +535,9 @@ static s32 rtw_dump_xframe(struct adapter *padapter, struct xmit_frame *pxmitfra rtw_issue_addbareq_cmd(padapter, pxmitframe); mem_addr = pxmitframe->buf_addr; - RT_TRACE(_module_rtl871x_xmit_c_,_drv_info_,("rtw_dump_xframe()\n")); + RT_TRACE(_module_rtl871x_xmit_c_,_drv_info_,("rtw_dump_xframe()\n")); - for (t = 0; t < pattrib->nr_frags; t++) - { + for (t = 0; t < pattrib->nr_frags; t++) { if (inner_ret != _SUCCESS && ret == _SUCCESS) ret = _FAIL; diff --git a/hal/usb_halinit.c b/hal/usb_halinit.c index 281292e..c6fd48d 100755 --- a/hal/usb_halinit.c +++ b/hal/usb_halinit.c @@ -1120,42 +1120,9 @@ HwSuspendModeEnable_88eu( IN u8 Type ) { - /* PRT_USB_DEVICE pDevice = GET_RT_USB_DEVICE(pAdapter); */ - u16 reg = rtw_read16(pAdapter, REG_GPIO_MUXCFG); - - /* if (!pDevice->RegUsbSS) */ - { - return; - } - - /* */ - /* 2010/08/23 MH According to Alfred's suggestion, we need to to prevent HW */ - /* to enter suspend mode automatically. Otherwise, it will shut down major power */ - /* domain and 8051 will stop. When we try to enter selective suspend mode, we */ - /* need to prevent HW to enter D2 mode aumotmatically. Another way, Host will */ - /* issue a S10 signal to power domain. Then it will cleat SIC setting(from Yngli). */ - /* We need to enable HW suspend mode when enter S3/S4 or disable. We need */ - /* to disable HW suspend mode for IPS/radio_off. */ - /* */ - /* RT_TRACE(COMP_RF, DBG_LOUD, ("HwSuspendModeEnable92Cu = %d\n", Type)); */ - if (Type == false) - { - reg |= BIT14; - /* RT_TRACE(COMP_RF, DBG_LOUD, ("REG_GPIO_MUXCFG = %x\n", reg)); */ - rtw_write16(pAdapter, REG_GPIO_MUXCFG, reg); - reg |= BIT12; - /* RT_TRACE(COMP_RF, DBG_LOUD, ("REG_GPIO_MUXCFG = %x\n", reg)); */ - rtw_write16(pAdapter, REG_GPIO_MUXCFG, reg); - } - else - { - reg &= (~BIT12); - rtw_write16(pAdapter, REG_GPIO_MUXCFG, reg); - reg &= (~BIT14); - rtw_write16(pAdapter, REG_GPIO_MUXCFG, reg); - } - + return; } /* HwSuspendModeEnable92Cu */ + rt_rf_power_state RfOnOffDetect(IN struct adapter *pAdapter ) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); @@ -1270,11 +1237,7 @@ static u32 rtl8188eu_hal_init(struct adapter *Adapter) #define HAL_INIT_PROFILE_TAG(stage) do {} while(0) #endif /* DBG_HAL_INIT_PROFILING */ - - -; - -HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_BEGIN); + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_BEGIN); if(pwrctrlpriv->bkeepfwalive) { @@ -1296,7 +1259,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_BEGIN); } -HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_PW_ON); + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_PW_ON); status = InitPowerOn_rtl8188eu(Adapter); if(status == _FAIL){ RT_TRACE(_module_hci_hal_init_c_, _drv_err_, ("Failed to init power on!\n")); @@ -1324,38 +1287,33 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_PW_ON); txpktbuf_bndy = WMM_NORMAL_TX_PAGE_BOUNDARY_88E; } -HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC01); + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC01); _InitQueueReservedPage(Adapter); _InitQueuePriority(Adapter); _InitPageBoundary(Adapter); _InitTransferPageSize(Adapter); -HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_DOWNLOAD_FW); + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_DOWNLOAD_FW); #if (MP_DRIVER == 1) if (Adapter->registrypriv.mp_mode == 1) { _InitRxSetting(Adapter); } #endif /* MP_DRIVER == 1 */ - { - status = rtl8188e_FirmwareDownload(Adapter); - if (status != _SUCCESS) { - DBG_871X("%s: Download Firmware failed!!\n", __FUNCTION__); - Adapter->bFWReady = false; - pHalData->fw_ractrl = false; - return status; - } else { - RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("Initializepadapter8192CSdio(): Download Firmware Success!!\n")); - Adapter->bFWReady = true; - pHalData->fw_ractrl = false; - } + status = rtl8188e_FirmwareDownload(Adapter); + if (status != _SUCCESS) { + DBG_871X("%s: Download Firmware failed!!\n", __FUNCTION__); + Adapter->bFWReady = false; + pHalData->fw_ractrl = false; + return status; + } else { + RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("Initializepadapter8192CSdio(): Download Firmware Success!!\n")); + Adapter->bFWReady = true; + pHalData->fw_ractrl = false; } - - rtl8188e_InitializeFirmwareVars(Adapter); - -HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MAC); + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MAC); #if (HAL_MAC_ENABLE == 1) status = PHY_MACConfig8188E(Adapter); if(status == _FAIL) @@ -1368,7 +1326,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MAC); /* */ /* d. Initialize BB related configurations. */ /* */ -HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_BB); + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_BB); #if (HAL_BB_ENABLE == 1) status = PHY_BBConfig8188E(Adapter); if(status == _FAIL) @@ -1379,7 +1337,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_BB); #endif -HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_RF); + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_RF); #if (HAL_RF_ENABLE == 1) status = PHY_RFConfig8188E(Adapter); if(status == _FAIL) @@ -1389,7 +1347,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_RF); } #endif -HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_EFUSE_PATCH); + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_EFUSE_PATCH); status = rtl8188e_iol_efuse_patch(Adapter); if(status == _FAIL){ DBG_871X("%s rtl8188e_iol_efuse_patch failed \n",__FUNCTION__); @@ -1398,14 +1356,14 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_EFUSE_PATCH); _InitTxBufferBoundary(Adapter, txpktbuf_bndy); -HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_LLTT); + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_LLTT); status = InitLLTTable(Adapter, txpktbuf_bndy); if(status == _FAIL){ RT_TRACE(_module_hci_hal_init_c_, _drv_err_, ("Failed to init LLT table\n")); goto exit; } -HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC02); + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC02); /* Get Rx PHY status in order to report RSSI and others. */ _InitDriverInfoSize(Adapter, DRVINFO_SZ); @@ -1439,15 +1397,14 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC02); } #if (RATE_ADAPTIVE_SUPPORT==1) - {/* Enable TX Report */ - /* Enable Tx Report Timer */ - value8 = rtw_read8(Adapter, REG_TX_RPT_CTRL); - rtw_write8(Adapter, REG_TX_RPT_CTRL, (value8|BIT1|BIT0)); - /* Set MAX RPT MACID */ - rtw_write8(Adapter, REG_TX_RPT_CTRL+1, 2);/* FOR sta mode ,0: bc/mc ,1:AP */ - /* Tx RPT Timer. Unit: 32us */ - rtw_write16(Adapter, REG_TX_RPT_TIME, 0xCdf0); - } + /* Enable TX Report */ + /* Enable Tx Report Timer */ + value8 = rtw_read8(Adapter, REG_TX_RPT_CTRL); + rtw_write8(Adapter, REG_TX_RPT_CTRL, (value8|BIT1|BIT0)); + /* Set MAX RPT MACID */ + rtw_write8(Adapter, REG_TX_RPT_CTRL+1, 2);/* FOR sta mode ,0: bc/mc ,1:AP */ + /* Tx RPT Timer. Unit: 32us */ + rtw_write16(Adapter, REG_TX_RPT_TIME, 0xCdf0); #endif rtw_write8(Adapter, REG_EARLY_MODE_CONTROL, 0); @@ -1467,14 +1424,14 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC02); pHalData->RfRegChnlVal[0] = PHY_QueryRFReg(Adapter, (RF_RADIO_PATH_E)0, RF_CHNLBW, bRFRegOffsetMask); pHalData->RfRegChnlVal[1] = PHY_QueryRFReg(Adapter, (RF_RADIO_PATH_E)1, RF_CHNLBW, bRFRegOffsetMask); -HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_TURN_ON_BLOCK); + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_TURN_ON_BLOCK); _BBTurnOnBlock(Adapter); /* NicIFSetMacAddress(padapter, padapter->PermanentAddress); */ -HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_SECURITY); + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_SECURITY); invalidate_cam_all(Adapter); -HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC11); + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC11); /* 2010/12/17 MH We need to set TX power according to EFUSE content at first. */ PHY_SetTxPowerLevel8188E(Adapter, pHalData->CurrentChannel); @@ -1499,7 +1456,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC11); /* Nav limit , suggest by scott */ rtw_write8(Adapter, 0x652, 0x0); -HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_HAL_DM); + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_HAL_DM); rtl8188e_InitHalDm(Adapter); #if (MP_DRIVER == 1) @@ -1535,25 +1492,23 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_HAL_DM); /* enable tx DMA to drop the redundate data of packet */ rtw_write16(Adapter,REG_TXDMA_OFFSET_CHK, (rtw_read16(Adapter,REG_TXDMA_OFFSET_CHK) | DROP_DATA_EN)); -HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_IQK); + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_IQK); /* 2010/08/26 MH Merge from 8192CE. */ if(pwrctrlpriv->rf_pwrstate == rf_on) { if(pHalData->odmpriv.RFCalibrateInfo.bIQKInitialized){ PHY_IQCalibrate_8188E(Adapter,true); - } - else - { + } else { PHY_IQCalibrate_8188E(Adapter,false); pHalData->odmpriv.RFCalibrateInfo.bIQKInitialized = true; } -HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_PW_TRACK); + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_PW_TRACK); ODM_TXPowerTrackingCheck(&pHalData->odmpriv ); -HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_LCK); + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_LCK); PHY_LCCalibrate_8188E(Adapter); } } @@ -1566,7 +1521,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_LCK); rtw_write32(Adapter, REG_FWHW_TXQ_CTRL, rtw_read32(Adapter, REG_FWHW_TXQ_CTRL)|BIT(12)); exit: -HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_END); + HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_END); DBG_871X("%s in %dms\n", __FUNCTION__, rtw_get_passing_time_ms(init_start_time)); @@ -1582,10 +1537,6 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_END); ); } #endif - - -; - return status; } @@ -1598,11 +1549,10 @@ static void hal_poweroff_rtl8188eu( IN struct adapter * Adapter ) { -/* PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); */ u8 val8; u16 val16; u32 val32; - u8 bMacPwrCtrlOn=false; + u8 bMacPwrCtrlOn=false; rtw_hal_get_hwreg(Adapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); if(bMacPwrCtrlOn == false) diff --git a/hal/usb_ops_linux.c b/hal/usb_ops_linux.c index 64b5056..2d10089 100755 --- a/hal/usb_ops_linux.c +++ b/hal/usb_ops_linux.c @@ -228,7 +228,7 @@ static int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val) data = val; - ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype); + ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype); return ret; } @@ -295,7 +295,7 @@ static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata wvalue = (u16)(addr&0x0000ffff); len = length; - memcpy(buf, pdata, len ); + memcpy(buf, pdata, len ); return usbctrl_vendorreq(pintfhdl, request, wvalue, index, buf, len, requesttype); } @@ -779,9 +779,6 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem) struct recv_priv *precvpriv = &adapter->recvpriv; struct usb_device *pusbd = pdvobj->pusbdev; - -; - if (adapter->bDriverStopped || adapter->bSurpriseRemoved ||dvobj_to_pwrctl(pdvobj)->pnp_bstop_trx) { RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port:( padapter->bDriverStopped ||padapter->bSurpriseRemoved ||pwrctl->pnp_bstop_trx)!!!\n")); @@ -793,61 +790,56 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem) precvbuf->reuse = true; } - if (precvbuf != NULL) { - rtl8188eu_init_recvbuf(adapter, precvbuf); + rtl8188eu_init_recvbuf(adapter, precvbuf); - /* re-assign for linux based on skb */ - if ((precvbuf->reuse == false) || (precvbuf->pskb == NULL)) { - precvbuf->pskb = rtw_skb_alloc(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ); + /* re-assign for linux based on skb */ + if ((precvbuf->reuse == false) || (precvbuf->pskb == NULL)) { + precvbuf->pskb = rtw_skb_alloc(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ); - if (precvbuf->pskb == NULL) { - RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("init_recvbuf(): alloc_skb fail!\n")); - DBG_8192C("#### usb_read_port() alloc_skb fail!#####\n"); - return _FAIL; - } + if (precvbuf->pskb == NULL) { + RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("init_recvbuf(): alloc_skb fail!\n")); + DBG_8192C("#### usb_read_port() alloc_skb fail!#####\n"); + return _FAIL; + } - tmpaddr = (SIZE_PTR)precvbuf->pskb->data; - alignment = tmpaddr & (RECVBUFF_ALIGN_SZ-1); - skb_reserve(precvbuf->pskb, (RECVBUFF_ALIGN_SZ - alignment)); + tmpaddr = (SIZE_PTR)precvbuf->pskb->data; + alignment = tmpaddr & (RECVBUFF_ALIGN_SZ-1); + skb_reserve(precvbuf->pskb, (RECVBUFF_ALIGN_SZ - alignment)); - precvbuf->phead = precvbuf->pskb->head; - precvbuf->pdata = precvbuf->pskb->data; - precvbuf->ptail = skb_tail_pointer(precvbuf->pskb); - precvbuf->pend = skb_end_pointer(precvbuf->pskb); - precvbuf->pbuf = precvbuf->pskb->data; - } else/* reuse skb */ - { - precvbuf->phead = precvbuf->pskb->head; - precvbuf->pdata = precvbuf->pskb->data; - precvbuf->ptail = skb_tail_pointer(precvbuf->pskb); - precvbuf->pend = skb_end_pointer(precvbuf->pskb); + precvbuf->phead = precvbuf->pskb->head; + precvbuf->pdata = precvbuf->pskb->data; + precvbuf->ptail = skb_tail_pointer(precvbuf->pskb); + precvbuf->pend = skb_end_pointer(precvbuf->pskb); + precvbuf->pbuf = precvbuf->pskb->data; + } else/* reuse skb */ + { + precvbuf->phead = precvbuf->pskb->head; + precvbuf->pdata = precvbuf->pskb->data; + precvbuf->ptail = skb_tail_pointer(precvbuf->pskb); + precvbuf->pend = skb_end_pointer(precvbuf->pskb); precvbuf->pbuf = precvbuf->pskb->data; - precvbuf->reuse = false; - } + precvbuf->reuse = false; + } - precvpriv->rx_pending_cnt++; + precvpriv->rx_pending_cnt++; - purb = precvbuf->purb; + purb = precvbuf->purb; - /* translate DMA FIFO addr to pipehandle */ - pipe = ffaddr2pipehdl(pdvobj, addr); + /* translate DMA FIFO addr to pipehandle */ + pipe = ffaddr2pipehdl(pdvobj, addr); - usb_fill_bulk_urb(purb, pusbd, pipe, precvbuf->pbuf, - MAX_RECVBUF_SZ, usb_read_port_complete, - precvbuf);/* context is precvbuf */ + usb_fill_bulk_urb(purb, pusbd, pipe, precvbuf->pbuf, + MAX_RECVBUF_SZ, usb_read_port_complete, + precvbuf);/* context is precvbuf */ - err = usb_submit_urb(purb, GFP_ATOMIC); - if ((err) && (err != (-EPERM))) { - RT_TRACE(_module_hci_ops_os_c_,_drv_err_, - ("cannot submit rx in-token(err=0x%.8x), URB_STATUS =0x%.8x", - err, purb->status)); - DBG_8192C("cannot submit rx in-token(err = 0x%08x),urb_status = %d\n", - err, purb->status); - ret = _FAIL; - } - } else { - RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port:precvbuf ==NULL\n")); + err = usb_submit_urb(purb, GFP_ATOMIC); + if ((err) && (err != (-EPERM))) { + RT_TRACE(_module_hci_ops_os_c_,_drv_err_, + ("cannot submit rx in-token(err=0x%.8x), URB_STATUS =0x%.8x", + err, purb->status)); + DBG_8192C("cannot submit rx in-token(err = 0x%08x),urb_status = %d\n", + err, purb->status); ret = _FAIL; } return ret; diff --git a/include/rtw_br_ext.h b/include/rtw_br_ext.h index 641dd64..4af0281 100755 --- a/include/rtw_br_ext.h +++ b/include/rtw_br_ext.h @@ -23,9 +23,9 @@ #define CL_IPV6_PASS 1 #define MACADDRLEN 6 #define _DEBUG_ERR DBG_8192C -#define _DEBUG_INFO //DBG_8192C +#define _DEBUG_INFO DBG_8192C #define DEBUG_WARN DBG_8192C -#define DEBUG_INFO //DBG_8192C +#define DEBUG_INFO DBG_8192C #define DEBUG_ERR DBG_8192C #define GET_MY_HWADDR(padapter) ((padapter)->eeprompriv.mac_addr) diff --git a/os_dep/ioctl_cfg80211.c b/os_dep/ioctl_cfg80211.c index 17d32d7..0ba09f8 100755 --- a/os_dep/ioctl_cfg80211.c +++ b/os_dep/ioctl_cfg80211.c @@ -549,23 +549,20 @@ void rtw_cfg80211_ibss_indicate_connect(struct adapter *padapter) { memcpy(&cur_network->network, pnetwork, sizeof(struct wlan_bssid_ex)); - if(cur_network) - { + if(cur_network) { if (!rtw_cfg80211_inform_bss(padapter,cur_network)) DBG_871X(FUNC_ADPT_FMT" inform fail !!\n", FUNC_ADPT_ARG(padapter)); else DBG_871X(FUNC_ADPT_FMT" inform success !!\n", FUNC_ADPT_ARG(padapter)); - } - else - { + } else { DBG_871X("cur_network is not exist!!!\n"); return ; } - } - else - { - if(scanned == NULL) + } else { + if (scanned == NULL) { rtw_warn_on(1); + return; + } if (_rtw_memcmp(&(scanned->network.Ssid), &(pnetwork->Ssid), sizeof(NDIS_802_11_SSID)) == true && _rtw_memcmp(scanned->network.MacAddress, pnetwork->MacAddress, sizeof(NDIS_802_11_MAC_ADDRESS)) == true @@ -819,20 +816,18 @@ static int set_group_key(struct adapter *padapter, u8 *key, u8 alg, int keyid) psetkeyparm->set_tx = 1; - switch(alg) - { - case _WEP40_: - keylen = 5; - break; - case _WEP104_: - keylen = 13; - break; - case _TKIP_: - case _TKIP_WTMIC_: - case _AES_: - keylen = 16; - default: - keylen = 16; + switch(alg) { + case _WEP40_: + keylen = 5; + break; + case _WEP104_: + keylen = 13; + break; + case _TKIP_: + case _TKIP_WTMIC_: + case _AES_: + default: + keylen = 16; } memcpy(&(psetkeyparm->key[0]), key, keylen); @@ -1226,12 +1221,11 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param wep_key_len = wep_key_len <= 5 ? 5 : 13; - psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled; + psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled; psecuritypriv->dot11PrivacyAlgrthm = _WEP40_; psecuritypriv->dot118021XGrpPrivacy = _WEP40_; - if(wep_key_len==13) - { + if(wep_key_len==13) { psecuritypriv->dot11PrivacyAlgrthm = _WEP104_; psecuritypriv->dot118021XGrpPrivacy = _WEP104_; } @@ -1531,13 +1525,13 @@ static int cfg80211_rtw_set_default_key(struct wiphy *wiphy, struct adapter *padapter = (struct adapter *)rtw_netdev_priv(ndev); struct security_priv *psecuritypriv = &padapter->securitypriv; - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) - DBG_871X(FUNC_NDEV_FMT" key_index=%d, unicast=%d, multicast=%d\n", - FUNC_NDEV_ARG(ndev), key_index , unicast, multicast); - #else - DBG_871X(FUNC_NDEV_FMT" key_index=%d\n", FUNC_NDEV_ARG(ndev), - key_index); - #endif + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) + DBG_871X(FUNC_NDEV_FMT" key_index=%d, unicast=%d, multicast=%d\n", + FUNC_NDEV_ARG(ndev), key_index , unicast, multicast); + #else + DBG_871X(FUNC_NDEV_FMT" key_index=%d\n", FUNC_NDEV_ARG(ndev), + key_index); + #endif if ((key_index < WEP_KEYS) && ((psecuritypriv->dot11PrivacyAlgrthm == _WEP40_) || (psecuritypriv->dot11PrivacyAlgrthm == _WEP104_))) /* set wep default key */ { @@ -2011,18 +2005,12 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy #ifdef CONFIG_P2P if( pwdinfo->driver_interface == DRIVER_CFG80211 ) { - if(ssids->ssid != NULL - && _rtw_memcmp(ssids->ssid, "DIRECT-", 7) - && rtw_get_p2p_ie((u8 *)request->ie, request->ie_len, NULL, NULL) - ) - { - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) - { + if (_rtw_memcmp(ssids->ssid, "DIRECT-", 7) && + rtw_get_p2p_ie((u8 *)request->ie, request->ie_len, NULL, NULL)) { + if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { rtw_p2p_enable(padapter, P2P_ROLE_DEVICE); wdev_to_priv(padapter->rtw_wdev)->p2p_enabled = true; - } - else - { + } else { rtw_p2p_set_pre_state(pwdinfo, rtw_p2p_state(pwdinfo)); #ifdef CONFIG_DEBUG_CFG80211 DBG_8192C("%s, role=%d, p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo)); @@ -2030,22 +2018,17 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy } rtw_p2p_set_state(pwdinfo, P2P_STATE_LISTEN); - if(request->n_channels == 3 && - request->channels[0]->hw_value == 1 && - request->channels[1]->hw_value == 6 && - request->channels[2]->hw_value == 11 - ) - { + if (request->n_channels == 3 && + request->channels[0]->hw_value == 1 && + request->channels[1]->hw_value == 6 && + request->channels[2]->hw_value == 11) social_channel = 1; - } } } #endif /* CONFIG_P2P */ if(request->ie && request->ie_len>0) - { rtw_cfg80211_set_probe_req_wpsp2pie(padapter, (u8 *)request->ie, request->ie_len ); - } if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true) { DBG_8192C("%s, fwstate=0x%x\n", __func__, pmlmepriv->fw_state); @@ -2057,8 +2040,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy goto check_need_indicate_scan_done; } - if (pmlmepriv->LinkDetectInfo.bBusyTraffic == true) - { + if (pmlmepriv->LinkDetectInfo.bBusyTraffic) { DBG_8192C("%s, bBusyTraffic == true\n", __func__); need_indicate_scan_done = true; goto check_need_indicate_scan_done; @@ -2071,10 +2053,9 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy } #ifdef CONFIG_P2P - if( pwdinfo->driver_interface == DRIVER_CFG80211 ) - { - if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE) && !rtw_p2p_chk_state(pwdinfo, P2P_STATE_IDLE)) - { + if( pwdinfo->driver_interface == DRIVER_CFG80211 ) { + if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE) && + !rtw_p2p_chk_state(pwdinfo, P2P_STATE_IDLE)) { rtw_p2p_set_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH); rtw_free_network_queue(padapter, true); @@ -2086,7 +2067,6 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy } #endif /* CONFIG_P2P */ - memset(ssid, 0, sizeof(NDIS_802_11_SSID)*RTW_SSID_SCAN_AMOUNT); /* parsing request ssids, n_ssids */ for (i = 0; i < request->n_ssids && i < RTW_SSID_SCAN_AMOUNT; i++) { @@ -2115,9 +2095,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy } else if (request->n_channels <= 4) { for(j=request->n_channels-1;j>=0;j--) for(i=0;in_channels); } else { _status = rtw_sitesurvey_cmd(padapter, ssid, RTW_SSID_SCAN_AMOUNT, NULL, 0); @@ -2126,9 +2104,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy if(_status == false) - { ret = -1; - } check_need_indicate_scan_done: if(need_indicate_scan_done) @@ -2137,7 +2113,6 @@ check_need_indicate_scan_done: exit: return ret; - } static int cfg80211_rtw_set_wiphy_params(struct wiphy *wiphy, u32 changed) @@ -2146,8 +2121,6 @@ static int cfg80211_rtw_set_wiphy_params(struct wiphy *wiphy, u32 changed) return 0; } - - static int rtw_cfg80211_set_wpa_version(struct security_priv *psecuritypriv, u32 wpa_version) { DBG_8192C("%s, wpa_version=%d\n", __func__, wpa_version); @@ -2157,21 +2130,10 @@ static int rtw_cfg80211_set_wpa_version(struct security_priv *psecuritypriv, u32 return 0; } - if (wpa_version & (NL80211_WPA_VERSION_1 | NL80211_WPA_VERSION_2)) - { psecuritypriv->ndisauthtype = Ndis802_11AuthModeWPAPSK; - } - -/* - if (wpa_version & NL80211_WPA_VERSION_2) - { - psecuritypriv->ndisauthtype = Ndis802_11AuthModeWPA2PSK; - } -*/ return 0; - } static int rtw_cfg80211_set_auth_type(struct security_priv *psecuritypriv, @@ -2182,30 +2144,23 @@ static int rtw_cfg80211_set_auth_type(struct security_priv *psecuritypriv, switch (sme_auth_type) { case NL80211_AUTHTYPE_AUTOMATIC: - psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Auto; - break; case NL80211_AUTHTYPE_OPEN_SYSTEM: - psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; - if(psecuritypriv->ndisauthtype>Ndis802_11AuthModeWPA) psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; break; case NL80211_AUTHTYPE_SHARED_KEY: - psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Shared; psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled; break; default: psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; - /* return -ENOTSUPP; */ } return 0; - } static int rtw_cfg80211_set_cipher(struct security_priv *psecuritypriv, u32 cipher, bool ucast) @@ -2217,7 +2172,6 @@ static int rtw_cfg80211_set_cipher(struct security_priv *psecuritypriv, u32 ciph DBG_8192C("%s, ucast=%d, cipher=0x%x\n", __func__, ucast, cipher); - if (!cipher) { *profile_cipher = _NO_PRIVACY_; psecuritypriv->ndisencryptstatus = ndisencryptstatus; @@ -3030,8 +2984,9 @@ static int rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struct net_de DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - if (skb) - rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize); + if (!skb) + return -1; + rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize); if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header))) goto fail; @@ -5014,18 +4969,11 @@ static void rtw_cfg80211_preinit_wiphy(struct adapter *padapter, struct wiphy *w wiphy->software_iftypes |= BIT(NL80211_IFTYPE_MONITOR); #endif - /* - wiphy->iface_combinations = &rtw_combinations; - wiphy->n_iface_combinations = 1; - */ - wiphy->cipher_suites = rtw_cipher_suites; wiphy->n_cipher_suites = ARRAY_SIZE(rtw_cipher_suites); - /* if (padapter->registrypriv.wireless_mode & WIRELESS_11G) */ - wiphy->bands[IEEE80211_BAND_2GHZ] = rtw_spt_band_alloc(IEEE80211_BAND_2GHZ); - /* if (padapter->registrypriv.wireless_mode & WIRELESS_11A) */ - wiphy->bands[IEEE80211_BAND_5GHZ] = rtw_spt_band_alloc(IEEE80211_BAND_5GHZ); + wiphy->bands[IEEE80211_BAND_2GHZ] = rtw_spt_band_alloc(IEEE80211_BAND_2GHZ); + wiphy->bands[IEEE80211_BAND_5GHZ] = rtw_spt_band_alloc(IEEE80211_BAND_5GHZ); #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38) && LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)) wiphy->flags |= WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS; @@ -5105,14 +5053,13 @@ int rtw_wdev_alloc(struct adapter *padapter, struct device *dev) return ret; - rtw_mfree((u8*)wdev, sizeof(struct wireless_dev)); +// rtw_mfree((u8*)wdev, sizeof(struct wireless_dev)); unregister_wiphy: wiphy_unregister(wiphy); free_wiphy: wiphy_free(wiphy); exit: return ret; - } void rtw_wdev_free(struct wireless_dev *wdev) diff --git a/os_dep/ioctl_linux.c b/os_dep/ioctl_linux.c index 6ac03d4..2a1da5a 100755 --- a/os_dep/ioctl_linux.c +++ b/os_dep/ioctl_linux.c @@ -226,6 +226,8 @@ static char *translate_scan(struct adapter *padapter, struct iw_request_info* info, struct wlan_network *pnetwork, char *start, char *stop) { + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + u8 ss, sq; struct iw_event iwe; u16 cap; __le16 le_cap; @@ -529,10 +531,6 @@ static char *translate_scan(struct adapter *padapter, } } -{ - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - u8 ss, sq; - /* Add quality statistics */ iwe.cmd = IWEVQUAL; iwe.u.qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED | IW_QUAL_NOISE_INVALID; @@ -557,7 +555,6 @@ static char *translate_scan(struct adapter *padapter, iwe.u.qual.noise = 0; /* noise level */ start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_QUAL_LEN); -} { u8 buf[MAX_WPA_IE_LEN]; @@ -728,8 +725,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, ret = -EOPNOTSUPP ; goto exit; } - - memcpy(&(psecuritypriv->dot11DefKey[wep_key_idx].skey[0]), pwep->KeyMaterial, pwep->KeyLength); + memcpy(&(psecuritypriv->dot11DefKey[wep_key_idx].skey[0]), pwep->KeyMaterial, pwep->KeyLength); psecuritypriv->dot11DefKeylen[wep_key_idx]=pwep->KeyLength; rtw_set_key(padapter, psecuritypriv, wep_key_idx, 0,true); } @@ -1190,34 +1186,18 @@ static int rtw_wx_get_mode(struct net_device *dev, struct iw_request_info *a, RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,(" rtw_wx_get_mode \n")); - ; - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) - { wrqu->mode = IW_MODE_INFRA; - } else if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) || (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true)) - - { wrqu->mode = IW_MODE_ADHOC; - } else if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) - { wrqu->mode = IW_MODE_MASTER; - } else - { wrqu->mode = IW_MODE_AUTO; - } - - ; - return 0; - } - static int rtw_wx_set_pmkid(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *extra) @@ -1232,22 +1212,16 @@ static int rtw_wx_set_pmkid(struct net_device *dev, u8 strIssueBssid[ ETH_ALEN ] = { 0x00 }; memcpy( strIssueBssid, pPMK->bssid.sa_data, ETH_ALEN); - if ( pPMK->cmd == IW_PMKSA_ADD ) - { - DBG_871X( "[rtw_wx_set_pmkid] IW_PMKSA_ADD!\n" ); - if ( _rtw_memcmp( strIssueBssid, strZeroMacAddress, ETH_ALEN ) == true ) - { - return( intReturn ); - } - else - { - intReturn = true; - } + if ( pPMK->cmd == IW_PMKSA_ADD ) { + DBG_871X( "[rtw_wx_set_pmkid] IW_PMKSA_ADD!\n" ); + if ( _rtw_memcmp( strIssueBssid, strZeroMacAddress, ETH_ALEN ) == true ) + return( intReturn ); + else + intReturn = true; blInserted = false; /* overwrite PMKID */ - for(j=0 ; jPMKIDList[j].Bssid, strIssueBssid, ETH_ALEN) ==true ) { /* BSSID is matched, the same AP => rewrite with new PMKID. */ @@ -1261,8 +1235,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev, } } - if(!blInserted) - { + if(!blInserted) { /* Find a new entry */ DBG_871X( "[rtw_wx_set_pmkid] Use the new entry index = %d for this PMKID.\n", psecuritypriv->PMKIDIndex ); @@ -1273,17 +1246,12 @@ static int rtw_wx_set_pmkid(struct net_device *dev, psecuritypriv->PMKIDList[ psecuritypriv->PMKIDIndex ].bUsed = true; psecuritypriv->PMKIDIndex++ ; if(psecuritypriv->PMKIDIndex==16) - { psecuritypriv->PMKIDIndex =0; - } } - } - else if ( pPMK->cmd == IW_PMKSA_REMOVE ) - { + } else if ( pPMK->cmd == IW_PMKSA_REMOVE ) { DBG_871X( "[rtw_wx_set_pmkid] IW_PMKSA_REMOVE!\n" ); intReturn = true; - for(j=0 ; jPMKIDList[j].Bssid, strIssueBssid, ETH_ALEN) ==true ) { /* BSSID is matched, the same AP => Remove this PMKID information and reset it. */ memset( psecuritypriv->PMKIDList[ j ].Bssid, 0x00, ETH_ALEN ); @@ -1291,15 +1259,13 @@ static int rtw_wx_set_pmkid(struct net_device *dev, break; } } - } - else if ( pPMK->cmd == IW_PMKSA_FLUSH ) - { + } else if ( pPMK->cmd == IW_PMKSA_FLUSH ) { DBG_871X( "[rtw_wx_set_pmkid] IW_PMKSA_FLUSH!\n" ); memset( &psecuritypriv->PMKIDList[ 0 ], 0x00, sizeof( RT_PMKID_LIST ) * NUM_PMKID_CACHE ); psecuritypriv->PMKIDIndex = 0; intReturn = true; } - return( intReturn ); + return( intReturn ); } static int rtw_wx_get_sens(struct net_device *dev, @@ -1353,7 +1319,7 @@ static int rtw_wx_get_range(struct net_device *dev, range->avg_qual.qual = 92; /* > 8% missed beacons is 'bad' */ /* TODO: Find real 'good' to 'bad' threshol value for RSSI */ - range->avg_qual.level = 20 + -98; + range->avg_qual.level = 178; /* equals -78 */ range->avg_qual.noise = 0; range->avg_qual.updated = 7; /* Updated all three */ @@ -1462,8 +1428,8 @@ static int rtw_wx_set_wap(struct net_device *dev, authmode = padapter->securitypriv.ndisauthtype; spin_lock_bh(&queue->lock); - phead = get_list_head(queue); - pmlmepriv->pscanned = get_next(phead); + phead = get_list_head(queue); + pmlmepriv->pscanned = get_next(phead); while (1) { @@ -1602,8 +1568,8 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, goto exit; } - if(padapter->bDriverStopped){ - DBG_871X("bDriverStopped=%d\n", padapter->bDriverStopped); + if (padapter->bDriverStopped) { + DBG_871X("bDriverStopped=%d\n", padapter->bDriverStopped); ret= -1; goto exit; } @@ -1830,10 +1796,8 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a, #endif ; - while (check_fwstate(pmlmepriv, wait_status) == true) - { + if (check_fwstate(pmlmepriv, wait_status)) return -EAGAIN; - } spin_lock_bh(&(pmlmepriv->scanned_queue.lock)); @@ -1866,7 +1830,7 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a, spin_unlock_bh(&(pmlmepriv->scanned_queue.lock)); - wrqu->data.length = ev-extra; + wrqu->data.length = ev-extra; wrqu->data.flags = 0; exit: @@ -1964,8 +1928,8 @@ static int rtw_wx_set_essid(struct net_device *dev, RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_info_, ("rtw_wx_set_essid: ssid=[%s]\n", src_ssid)); spin_lock_bh(&queue->lock); - phead = get_list_head(queue); - pmlmepriv->pscanned = get_next(phead); + phead = get_list_head(queue); + pmlmepriv->pscanned = get_next(phead); while (1) { if (rtw_end_of_queue_search(phead, pmlmepriv->pscanned) == true) { @@ -2078,9 +2042,7 @@ static int rtw_wx_set_rate(struct net_device *dev, u32 target_rate = wrqu->bitrate.value; u32 fixed = wrqu->bitrate.fixed; u32 ratevalue = 0; - u8 mpdatarate[NumRates]={11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0xff}; - -; + u8 mpdatarate[NumRates]={11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0xff}; RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,(" rtw_wx_set_rate \n")); RT_TRACE(_module_rtl871x_ioctl_os_c,_drv_info_,("target_rate = %d, fixed = %d\n",target_rate,fixed)); @@ -2466,12 +2428,9 @@ static int rtw_wx_set_gen_ie(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - int ret; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - ret = rtw_set_wpa_ie(padapter, extra, wrqu->data.length); - - return ret; + return rtw_set_wpa_ie(padapter, extra, wrqu->data.length); } static int rtw_wx_set_auth(struct net_device *dev, @@ -4203,7 +4162,7 @@ static int rtw_p2p_get_invitation_procedure(struct net_device *dev, if (!blnMatch) { sprintf(inv_proc_str, "\nIP=-1"); } else { - if (attr_content[0] && 0x20) + if (attr_content[0] & 0x20) sprintf(inv_proc_str, "\nIP=1"); else sprintf(inv_proc_str, "\nIP=0"); @@ -5380,7 +5339,7 @@ static int rtw_p2p_get2(struct net_device *dev, if (copy_from_user(buffer, wrqu->data.pointer, wrqu->data.length)) { - ret - EFAULT; + ret = -EFAULT; goto bad; } @@ -5642,19 +5601,16 @@ static int rtw_dbg_port(struct net_device *dev, rtw_hal_write_rfreg(padapter, minor_cmd, arg, 0xffffffff, extra_arg); DBG_871X("write RF_reg path(0x%02x),offset(0x%x),value(0x%08x)\n",minor_cmd,arg, rtw_hal_read_rfreg(padapter, minor_cmd, arg, 0xffffffff)); break; - case 0x76: - switch(minor_cmd) - { - case 0x00: /* normal mode, */ - padapter->recvpriv.is_signal_dbg = 0; - break; - case 0x01: /* dbg mode */ - padapter->recvpriv.is_signal_dbg = 1; - extra_arg = extra_arg>100?100:extra_arg; - extra_arg = extra_arg<0?0:extra_arg; - padapter->recvpriv.signal_strength_dbg=extra_arg; - break; + switch(minor_cmd) { + case 0x00: /* normal mode, */ + padapter->recvpriv.is_signal_dbg = 0; + break; + case 0x01: /* dbg mode */ + padapter->recvpriv.is_signal_dbg = 1; + extra_arg = extra_arg > 100 ? 100 : extra_arg; + padapter->recvpriv.signal_strength_dbg=extra_arg; + break; } break; case 0x78: /* IOL test */ @@ -6252,31 +6208,23 @@ static int wpa_set_param(struct net_device *dev, u8 name, u32 value) switch (name){ case IEEE_PARAM_WPA_ENABLED: - padapter->securitypriv.dot11AuthAlgrthm= dot11AuthAlgrthm_8021X; /* 802.1x */ - /* ret = ieee80211_wpa_enable(ieee, value); */ - - switch((value)&0xff) - { - case 1 : /* WPA */ + switch((value)&0xff) { + case 1 : /* WPA */ padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeWPAPSK; /* WPA_PSK */ padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption2Enabled; - break; - case 2: /* WPA2 */ + break; + case 2: /* WPA2 */ padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeWPA2PSK; /* WPA2_PSK */ padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled; - break; + break; } - RT_TRACE(_module_rtl871x_ioctl_os_c,_drv_info_,("wpa_set_param:padapter->securitypriv.ndisauthtype=%d\n", padapter->securitypriv.ndisauthtype)); - break; - case IEEE_PARAM_TKIP_COUNTERMEASURES: /* ieee->tkip_countermeasures=value; */ break; - case IEEE_PARAM_DROP_UNENCRYPTED: /* HACK: * @@ -6483,7 +6431,6 @@ static int set_group_key(struct adapter *padapter, u8 *key, u8 alg, int keyid) case _TKIP_: case _TKIP_WTMIC_: case _AES_: - keylen = 16; default: keylen = 16; } @@ -6629,13 +6576,10 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, psecuritypriv->dot11PrivacyAlgrthm=_WEP40_; psecuritypriv->dot118021XGrpPrivacy=_WEP40_; - if(pwep->KeyLength==13) - { + if (pwep->KeyLength==13) { psecuritypriv->dot11PrivacyAlgrthm=_WEP104_; psecuritypriv->dot118021XGrpPrivacy=_WEP104_; } - - psecuritypriv->dot11PrivacyKeyIndex = wep_key_idx; memcpy(&(psecuritypriv->dot11DefKey[wep_key_idx].skey[0]), pwep->KeyMaterial, pwep->KeyLength); @@ -6643,17 +6587,13 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, psecuritypriv->dot11DefKeylen[wep_key_idx]=pwep->KeyLength; set_wep_key(padapter, pwep->KeyMaterial, pwep->KeyLength, wep_key_idx); - - - } - else - { + } else { DBG_871X("wep, set_tx=0\n"); /* don't update "psecuritypriv->dot11PrivacyAlgrthm" and */ /* psecuritypriv->dot11PrivacyKeyIndex=keyid", but can rtw_set_key to cam */ - memcpy(&(psecuritypriv->dot11DefKey[wep_key_idx].skey[0]), pwep->KeyMaterial, pwep->KeyLength); + memcpy(&(psecuritypriv->dot11DefKey[wep_key_idx].skey[0]), pwep->KeyMaterial, pwep->KeyLength); psecuritypriv->dot11DefKeylen[wep_key_idx] = pwep->KeyLength; @@ -7289,21 +7229,10 @@ static int rtw_set_hidden_ssid(struct net_device *dev, struct ieee_param *param, memcpy(ssid, ssid_ie+2, ssid_len); ssid[ssid_len>NDIS_802_11_LENGTH_SSID?NDIS_802_11_LENGTH_SSID:ssid_len] = 0x0; - if(0) - DBG_871X(FUNC_ADPT_FMT" ssid:(%s,%d), from ie:(%s,%d), (%s,%d)\n", FUNC_ADPT_ARG(adapter), - ssid, ssid_len, - pbss_network->Ssid.Ssid, pbss_network->Ssid.SsidLength, - pbss_network_ext->Ssid.Ssid, pbss_network_ext->Ssid.SsidLength); - memcpy(pbss_network->Ssid.Ssid, (void *)ssid, ssid_len); pbss_network->Ssid.SsidLength = ssid_len; memcpy(pbss_network_ext->Ssid.Ssid, (void *)ssid, ssid_len); pbss_network_ext->Ssid.SsidLength = ssid_len; - - if(0) - DBG_871X(FUNC_ADPT_FMT" after ssid:(%s,%d), (%s,%d)\n", FUNC_ADPT_ARG(adapter), - pbss_network->Ssid.Ssid, pbss_network->Ssid.SsidLength, - pbss_network_ext->Ssid.Ssid, pbss_network_ext->Ssid.SsidLength); } DBG_871X(FUNC_ADPT_FMT" ignore_broadcast_ssid:%d, %s,%d\n", FUNC_ADPT_ARG(adapter), @@ -7794,8 +7723,7 @@ static int rtw_mp_efuse_get(struct net_device *dev, if(strcmp(tmp[0], "status") == 0){ sprintf(extra, "Load File efuse=%s,Load File MAC=%s",(pEEPROM->bloadfile_fail_flag? "FAIL" : "OK"),(pEEPROM->bloadmac_fail_flag? "FAIL" : "OK")); - - goto exit; + goto exit; } else if (strcmp(tmp[0], "drvmap") == 0) { @@ -7804,22 +7732,16 @@ static int rtw_mp_efuse_get(struct net_device *dev, sprintf(extra, "\n"); for (i = 0; i < EFUSE_MAP_SIZE; i += 16) { -/* DBG_871X("0x%02x\t", i); */ sprintf(extra, "%s0x%02x\t", extra, i); for (j=0; j<8; j++) { -/* DBG_871X("%02X ", data[i+j]); */ sprintf(extra, "%s%02X ", extra, PROMContent[i+j]); } -/* DBG_871X("\t"); */ sprintf(extra, "%s\t", extra); for (; j<16; j++) { -/* DBG_871X("%02X ", data[i+j]); */ sprintf(extra, "%s%02X ", extra, PROMContent[i+j]); } -/* DBG_871X("\n"); */ sprintf(extra,"%s\n",extra); } -/* DBG_871X("\n"); */ } else if (strcmp(tmp[0], "realmap") == 0) { @@ -7831,30 +7753,23 @@ static int rtw_mp_efuse_get(struct net_device *dev, goto exit; } -/* DBG_871X("OFFSET\tVALUE(hex)\n"); */ sprintf(extra, "\n"); for (i = 0; i < EFUSE_MAP_SIZE; i += 16) { -/* DBG_871X("0x%02x\t", i); */ sprintf(extra, "%s0x%02x\t", extra, i); for (j=0; j<8; j++) { if (i + j >= EFUSE_MAX_MAP_LEN) continue; -/* DBG_871X("%02X ", data[i+j]); */ sprintf(extra, "%s%02X ", extra, pEfuseHal->fakeEfuseInitMap[i+j]); } -/* DBG_871X("\t"); */ sprintf(extra, "%s\t", extra); for (; j<16; j++) { if (i + j >= EFUSE_MAX_MAP_LEN) continue; -/* DBG_871X("%02X ", data[i+j]); */ sprintf(extra, "%s%02X ", extra, pEfuseHal->fakeEfuseInitMap[i+j]); } -/* DBG_871X("\n"); */ sprintf(extra,"%s\n",extra); } -/* DBG_871X("\n"); */ } else if (strcmp(tmp[0], "rmap") == 0) { @@ -7893,13 +7808,10 @@ static int rtw_mp_efuse_get(struct net_device *dev, goto exit; } -/* DBG_871X("%s: data={", __FUNCTION__); */ *extra = 0; for (i=0; iBTEfuseInitMap[i+j]); */ + for (j=0; j<8; j++) sprintf(extra, "%s%02X ", extra, pEfuseHal->BTEfuseInitMap[i+j]); - } -/* DBG_871X("\t"); */ sprintf(extra,"%s\t",extra); - for (; j<16; j++) { -/* DBG_871X("%02X ", pEfuseHal->BTEfuseInitMap[i+j]); */ + for (; j<16; j++) sprintf(extra, "%s%02X ", extra, pEfuseHal->BTEfuseInitMap[i+j]); - } -/* DBG_871X("\n"); */ sprintf(extra, "%s\n", extra); } -/* DBG_871X("\n"); */ } else if (strcmp(tmp[0],"btbmap") == 0) { @@ -8045,27 +7931,17 @@ static int rtw_mp_efuse_get(struct net_device *dev, goto exit; } -/* DBG_871X("OFFSET\tVALUE(hex)\n"); */ sprintf(extra, "\n"); for (i=512; i<1024 ; i+=16) { -/* DBG_871X("0x%03x\t", i); */ sprintf(extra, "%s0x%03x\t", extra, i); for (j=0; j<8; j++) - { -/* DBG_871X("%02X ", data[i+j]); */ sprintf(extra, "%s%02X ", extra, pEfuseHal->BTEfuseInitMap[i+j]); - } -/* DBG_871X("\t"); */ sprintf(extra,"%s\t",extra); - for (; j<16; j++) { -/* DBG_871X("%02X ", data[i+j]); */ + for (; j<16; j++) sprintf(extra, "%s%02X ", extra, pEfuseHal->BTEfuseInitMap[i+j]); - } -/* DBG_871X("\n"); */ sprintf(extra, "%s\n", extra); } -/* DBG_871X("\n"); */ } else if (strcmp(tmp[0],"btrmap") == 0) { @@ -8188,65 +8064,53 @@ static int rtw_mp_efuse_get(struct net_device *dev, } /* DBG_871X("\n"); */ - } - else if (strcmp(tmp[0],"wlrfkrmap")== 0) - { - if ((tmp[1]==NULL) || (tmp[2]==NULL)) - { - DBG_871X("%s: rmap Fail!! Parameters error!\n", __FUNCTION__); - err = -EINVAL; - goto exit; - } - /* rmap addr cnts */ - addr = simple_strtoul(tmp[1], &ptmp, 16); - DBG_871X("%s: addr=%x\n", __FUNCTION__, addr); + } else if (strcmp(tmp[0],"wlrfkrmap")== 0) { + if ((tmp[1]==NULL) || (tmp[2]==NULL)) { + DBG_871X("%s: rmap Fail!! Parameters error!\n", __FUNCTION__); + err = -EINVAL; + goto exit; + } + /* rmap addr cnts */ + addr = simple_strtoul(tmp[1], &ptmp, 16); + DBG_871X("%s: addr=%x\n", __FUNCTION__, addr); - cnts = simple_strtoul(tmp[2], &ptmp, 10); - if (cnts == 0) - { - DBG_871X("%s: rmap Fail!! cnts error!\n", __FUNCTION__); - err = -EINVAL; - goto exit; - } - DBG_871X("%s: cnts=%d\n", __FUNCTION__, cnts); + cnts = simple_strtoul(tmp[2], &ptmp, 10); + if (cnts == 0) { + DBG_871X("%s: rmap Fail!! cnts error!\n", __FUNCTION__); + err = -EINVAL; + goto exit; + } + DBG_871X("%s: cnts=%d\n", __FUNCTION__, cnts); - /* DBG_871X("%s: data={", __FUNCTION__); */ - *extra = 0; - for (i=0; ifakeEfuseModifiedMap[addr+i]); - sprintf(extra, "%s0x%02X ", extra, pEfuseHal->fakeEfuseModifiedMap[addr+i]); - } - } - else if (strcmp(tmp[0],"btrfkrmap")== 0) - { - if ((tmp[1]==NULL) || (tmp[2]==NULL)) - { - DBG_871X("%s: rmap Fail!! Parameters error!\n", __FUNCTION__); - err = -EINVAL; - goto exit; - } - /* rmap addr cnts */ - addr = simple_strtoul(tmp[1], &ptmp, 16); - DBG_871X("%s: addr=%x\n", __FUNCTION__, addr); + *extra = 0; + for (i=0; ifakeEfuseModifiedMap[addr+i]); + sprintf(extra, "%s0x%02X ", extra, pEfuseHal->fakeEfuseModifiedMap[addr+i]); + } + } else if (strcmp(tmp[0],"btrfkrmap")== 0) { + if ((tmp[1]==NULL) || (tmp[2]==NULL)) { + DBG_871X("%s: rmap Fail!! Parameters error!\n", __FUNCTION__); + err = -EINVAL; + goto exit; + } + /* rmap addr cnts */ + addr = simple_strtoul(tmp[1], &ptmp, 16); + DBG_871X("%s: addr=%x\n", __FUNCTION__, addr); - cnts = simple_strtoul(tmp[2], &ptmp, 10); - if (cnts == 0) - { - DBG_871X("%s: rmap Fail!! cnts error!\n", __FUNCTION__); - err = -EINVAL; - goto exit; - } - DBG_871X("%s: cnts=%d\n", __FUNCTION__, cnts); + cnts = simple_strtoul(tmp[2], &ptmp, 10); + if (cnts == 0) { + DBG_871X("%s: rmap Fail!! cnts error!\n", __FUNCTION__); + err = -EINVAL; + goto exit; + } + DBG_871X("%s: cnts=%d\n", __FUNCTION__, cnts); - /* DBG_871X("%s: data={", __FUNCTION__); */ - *extra = 0; - for (i=0; ifakeBTEfuseModifiedMap[addr+i]); - sprintf(extra, "%s0x%02X ", extra, pEfuseHal->fakeBTEfuseModifiedMap[addr+i]); - } - } - else - { + *extra = 0; + for (i=0; ifakeBTEfuseModifiedMap[addr+i]); + sprintf(extra, "%s0x%02X ", extra, pEfuseHal->fakeBTEfuseModifiedMap[addr+i]); + } + } else { sprintf(extra, "Command not found!"); } @@ -8706,18 +8570,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; - - 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; - - return ret; + return 0; } @@ -8725,92 +8585,70 @@ static int rtw_tdls_enable(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - int ret = 0; - - 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; - - 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; - - 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; - - 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; - - 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; - - 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; - - 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; - - 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; - - 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; - - return ret; - + return 0; } /* WFDTDLS, for sigma test */ @@ -8818,11 +8656,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; - - return ret; - + return 0; } /* WFDTDLS, for sigma test */ @@ -8830,28 +8664,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; - - 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; - - 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; - - return ret; + return 0; } @@ -8886,10 +8713,6 @@ static int rtw_tdls_get(struct net_device *dev, return ret; } - - - - #ifdef CONFIG_MAC_LOOPBACK_DRIVER #include @@ -9671,20 +9494,17 @@ static iw_handler rtw_private_handler[] = #if WIRELESS_EXT >= 17 static struct iw_statistics *rtw_get_wireless_stats(struct net_device *dev) { - struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - struct iw_statistics *piwstats=&padapter->iwstats; + struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); + struct iw_statistics *piwstats=&padapter->iwstats; int tmp_level = 0; int tmp_qual = 0; int tmp_noise = 0; - if (check_fwstate(&padapter->mlmepriv, _FW_LINKED) != true) - { + if (check_fwstate(&padapter->mlmepriv, _FW_LINKED) != true) { piwstats->qual.qual = 0; piwstats->qual.level = 0; piwstats->qual.noise = 0; - /* DBG_871X("No link level:%d, qual:%d, noise:%d\n", tmp_level, tmp_qual, tmp_noise); */ - } - else{ + } else { tmp_level = padapter->recvpriv.signal_strength; #ifdef CONFIG_BT_COEXIST { @@ -9696,7 +9516,6 @@ static struct iw_statistics *rtw_get_wireless_stats(struct net_device *dev) tmp_qual = padapter->recvpriv.signal_qual; tmp_noise =padapter->recvpriv.noise; - /* DBG_871X("level:%d, qual:%d, noise:%d, rssi (%d)\n", tmp_level, tmp_qual, tmp_noise,padapter->recvpriv.rssi); */ piwstats->qual.level = tmp_level; piwstats->qual.qual = tmp_qual; diff --git a/os_dep/mlme_linux.c b/os_dep/mlme_linux.c index 8ff44af..dfedb52 100755 --- a/os_dep/mlme_linux.c +++ b/os_dep/mlme_linux.c @@ -178,21 +178,14 @@ void rtw_reset_securitypriv( struct adapter *adapter ) void rtw_os_indicate_disconnect( struct adapter *adapter ) { - /* RT_PMKID_LIST backupPMKIDList[ NUM_PMKID_CACHE ]; */ - -; - netif_carrier_off(adapter->pnetdev); /* Do it first for tx broadcast pkt after disconnection issue! */ rtw_cfg80211_indicate_disconnect(adapter); rtw_indicate_wx_disassoc_event(adapter); - /* modify for CONFIG_IEEE80211W, none 11w also can use the same command */ - rtw_reset_securitypriv_cmd(adapter); - -; - + /* modify for CONFIG_IEEE80211W, none 11w also can use the same command */ + rtw_reset_securitypriv_cmd(adapter); } void rtw_report_sec_ie(struct adapter *adapter,u8 authmode,u8 *sec_ie) @@ -201,13 +194,10 @@ void rtw_report_sec_ie(struct adapter *adapter,u8 authmode,u8 *sec_ie) u8 *buff,*p,i; union iwreq_data wrqu; -; - RT_TRACE(_module_mlme_osdep_c_,_drv_info_,("+rtw_report_sec_ie, authmode=%d\n", authmode)); buff = NULL; - if(authmode==_WPA_IE_ID_) - { + if(authmode==_WPA_IE_ID_) { RT_TRACE(_module_mlme_osdep_c_,_drv_info_,("rtw_report_sec_ie, authmode=%d\n", authmode)); buff = rtw_malloc(IW_CUSTOM_MAX); diff --git a/os_dep/os_intfs.c b/os_dep/os_intfs.c index 1d9aca2..366ff34 100755 --- a/os_dep/os_intfs.c +++ b/os_dep/os_intfs.c @@ -1294,7 +1294,7 @@ static int ips_netdrv_open(struct adapter *padapter) rtw_set_pwr_state_check_timer(adapter_to_pwrctl(padapter)); _set_timer(&padapter->mlmepriv.dynamic_chk_timer,5000); - return _SUCCESS; + return _SUCCESS; netdev_open_error: /* padapter->bup = false; */ diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c index 9409d36..78551d2 100755 --- a/os_dep/osdep_service.c +++ b/os_dep/osdep_service.c @@ -51,21 +51,19 @@ u32 rtw_atoi(u8* s) int num=0,flag=0; int i; - for(i=0;i<=strlen(s);i++) - { - if(s[i] >= '0' && s[i] <= '9') - num = num * 10 + s[i] -'0'; - else if(s[0] == '-' && i==0) - flag =1; - else - break; + for(i=0;i<=strlen(s);i++) { + if(s[i] >= '0' && s[i] <= '9') + num = num * 10 + s[i] -'0'; + else if(s[0] == '-' && i==0) + flag =1; + else + break; } if(flag == 1) - num = num * -1; - - return(num); + num = num * -1; + return num; } inline u8* _rtw_vmalloc(u32 sz) @@ -1166,13 +1164,14 @@ RETURN: int rtw_change_ifname(struct adapter *padapter, const char *ifname) { struct net_device *pnetdev; - struct net_device *cur_pnetdev = padapter->pnetdev; + struct net_device *cur_pnetdev; struct rereg_nd_name_data *rereg_priv; int ret; if(!padapter) goto error; + cur_pnetdev = padapter->pnetdev; rereg_priv = &padapter->rereg_nd_name_priv; /* free the old_pnetdev */ diff --git a/os_dep/recv_linux.c b/os_dep/recv_linux.c index 068caef..6492946 100755 --- a/os_dep/recv_linux.c +++ b/os_dep/recv_linux.c @@ -211,6 +211,8 @@ int rtw_recv_indicatepkt(struct adapter *padapter, union recv_frame *precv_frame } #endif + if (!precv_frame) + goto _recv_indicatepkt_drop; skb = precv_frame->u.hdr.pkt; if(skb == NULL) { diff --git a/os_dep/usb_intf.c b/os_dep/usb_intf.c index 8ce4642..4bc067a 100755 --- a/os_dep/usb_intf.c +++ b/os_dep/usb_intf.c @@ -459,7 +459,7 @@ void rtw_dev_unload(struct adapter *padapter) /* s4. */ if(!adapter_to_pwrctl(padapter)->bInternalAutoSuspend ) - rtw_stop_drv_threads(padapter); + rtw_stop_drv_threads(padapter); /* s5. */ @@ -508,8 +508,6 @@ int rtw_hw_suspend(struct adapter *padapter ) struct usb_interface *pusb_intf = adapter_to_dvobj(padapter)->pusbintf; struct net_device *pnetdev = padapter->pnetdev; - ; - if((!padapter->bup) || (padapter->bDriverStopped)||(padapter->bSurpriseRemoved)) { DBG_871X("padapter->bup=%d bDriverStopped=%d bSurpriseRemoved = %d\n", @@ -517,57 +515,49 @@ int rtw_hw_suspend(struct adapter *padapter ) goto error_exit; } - if(padapter)/* system suspend */ + LeaveAllPowerSaveMode(padapter); + + DBG_871X("==> rtw_hw_suspend\n"); + _enter_pwrlock(&pwrpriv->lock); + pwrpriv->bips_processing = true; + /* s1. */ + if(pnetdev) { - LeaveAllPowerSaveMode(padapter); - - DBG_871X("==> rtw_hw_suspend\n"); - _enter_pwrlock(&pwrpriv->lock); - pwrpriv->bips_processing = true; - /* padapter->net_closed = true; */ - /* s1. */ - if(pnetdev) - { - netif_carrier_off(pnetdev); - rtw_netif_stop_queue(pnetdev); - } - - /* s2. */ - rtw_disassoc_cmd(padapter, 500, false); - - /* s2-2. indicate disconnect to os */ - /* rtw_indicate_disconnect(padapter); */ - { - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - - if(check_fwstate(pmlmepriv, _FW_LINKED)) - { - _clr_fwstate_(pmlmepriv, _FW_LINKED); - - rtw_led_control(padapter, LED_CTL_NO_LINK); - - rtw_os_indicate_disconnect(padapter); - - /* donnot enqueue cmd */ - rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_DISCONNECT, 0); - } - - } - /* s2-3. */ - rtw_free_assoc_resources(padapter, 1); - - /* s2-4. */ - rtw_free_network_queue(padapter,true); - rtw_ips_dev_unload(padapter); - pwrpriv->rf_pwrstate = rf_off; - pwrpriv->bips_processing = false; - - _exit_pwrlock(&pwrpriv->lock); + netif_carrier_off(pnetdev); + rtw_netif_stop_queue(pnetdev); } - else - goto error_exit; - ; + /* s2. */ + rtw_disassoc_cmd(padapter, 500, false); + + /* s2-2. indicate disconnect to os */ + { + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + + if(check_fwstate(pmlmepriv, _FW_LINKED)) + { + _clr_fwstate_(pmlmepriv, _FW_LINKED); + + rtw_led_control(padapter, LED_CTL_NO_LINK); + + rtw_os_indicate_disconnect(padapter); + + /* donnot enqueue cmd */ + rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_DISCONNECT, 0); + } + + } + /* s2-3. */ + rtw_free_assoc_resources(padapter, 1); + + /* s2-4. */ + rtw_free_network_queue(padapter,true); + rtw_ips_dev_unload(padapter); + pwrpriv->rf_pwrstate = rf_off; + pwrpriv->bips_processing = false; + + _exit_pwrlock(&pwrpriv->lock); + return 0; error_exit: @@ -578,21 +568,21 @@ error_exit: int rtw_hw_resume(struct adapter *padapter) { - struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - struct usb_interface *pusb_intf = adapter_to_dvobj(padapter)->pusbintf; - struct net_device *pnetdev = padapter->pnetdev; - - ; + struct pwrctrl_priv *pwrpriv; + struct usb_interface *pusb_intf; + struct net_device *pnetdev; if(padapter)/* system resume */ { + pwrpriv = adapter_to_pwrctl(padapter); + pusb_intf = adapter_to_dvobj(padapter)->pusbintf; + pnetdev = padapter->pnetdev; DBG_871X("==> rtw_hw_resume\n"); _enter_pwrlock(&pwrpriv->lock); pwrpriv->bips_processing = true; rtw_reset_drv_sw(padapter); - if(pm_netdev_open(pnetdev,false) != 0) - { + if(pm_netdev_open(pnetdev,false) != 0) { _exit_pwrlock(&pwrpriv->lock); goto error_exit; } @@ -612,14 +602,10 @@ int rtw_hw_resume(struct adapter *padapter) pwrpriv->bips_processing = false; _exit_pwrlock(&pwrpriv->lock); - } - else - { + } else { goto error_exit; } - ; - return 0; error_exit: DBG_871X("%s, Open net dev failed \n",__FUNCTION__); @@ -694,7 +680,7 @@ static int rtw_resume(struct usb_interface *pusb_intf) struct adapter *padapter = dvobj->if1; struct net_device *pnetdev = padapter->pnetdev; struct pwrctrl_priv *pwrpriv = dvobj_to_pwrctl(dvobj); - int ret = 0; + int ret = 0; if(pwrpriv->bInternalAutoSuspend ){ ret = rtw_resume_process(padapter); diff --git a/os_dep/usb_ops_linux.c b/os_dep/usb_ops_linux.c index 8b97b4d..921c398 100755 --- a/os_dep/usb_ops_linux.c +++ b/os_dep/usb_ops_linux.c @@ -311,7 +311,7 @@ static void usb_write_port_complete(struct urb *purb, struct pt_regs *regs) /* struct xmit_frame *pxmitframe = (struct xmit_frame *)pxmitbuf->priv_data; */ /* struct adapter *padapter = pxmitframe->padapter; */ struct adapter *padapter = pxmitbuf->padapter; - struct xmit_priv *pxmitpriv = &padapter->xmitpriv; + struct xmit_priv *pxmitpriv = &padapter->xmitpriv; /* struct pkt_attrib *pattrib = &pxmitframe->attrib; */ ; diff --git a/os_dep/xmit_linux.c b/os_dep/xmit_linux.c index 163b268..ddfe656 100755 --- a/os_dep/xmit_linux.c +++ b/os_dep/xmit_linux.c @@ -53,33 +53,22 @@ uint _rtw_pktfile_read (struct pkt_file *pfile, u8 *rmem, uint rlen) { uint len = 0; -; - - len = rtw_remainder_len(pfile); + len = rtw_remainder_len(pfile); len = (rlen > len)? len: rlen; - if(rmem) - skb_copy_bits(pfile->pkt, pfile->buf_len-pfile->pkt_len, rmem, len); - - pfile->cur_addr += len; - pfile->pkt_len -= len; - -; + if (rmem) + skb_copy_bits(pfile->pkt, pfile->buf_len-pfile->pkt_len, rmem, len); + pfile->cur_addr += len; + pfile->pkt_len -= len; return len; } sint rtw_endofpktfile(struct pkt_file *pfile) { -; - if (pfile->pkt_len == 0) { -; return true; } - -; - return false; }