rtl8188eu: Fix most errors from smatch

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2015-03-10 11:18:03 -05:00
parent ee006634cb
commit 993b4435cb
40 changed files with 1508 additions and 2204 deletions

View file

@ -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 */

View file

@ -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);
}
}
}

View file

@ -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;

View file

@ -84,14 +84,12 @@ uint rtw_is_cckrates_included(u8 *rate)
{
u32 i = 0;
while(rate[i]!=0)
{
if ( (((rate[i]) & 0x7f) == 2) || (((rate[i]) & 0x7f) == 4) ||
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;
}
@ -99,19 +97,13 @@ uint rtw_is_cckratesonly_included(u8 *rate)
{
u32 i = 0;
while(rate[i]!=0)
{
if ( (((rate[i]) & 0x7f) != 2) && (((rate[i]) & 0x7f) != 4) &&
while (rate[i]!=0) {
if ((((rate[i]) & 0x7f) != 2) && (((rate[i]) & 0x7f) != 4) &&
(((rate[i]) & 0x7f) != 11) && (((rate[i]) & 0x7f) != 22) )
return false;
i++;
}
return true;
}
int rtw_check_network_type(unsigned char *rate, int ratelen, int channel)

View file

@ -262,7 +262,6 @@ 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;
}

View file

@ -684,8 +684,7 @@ u8 rtw_set_802_11_add_wep(struct adapter* padapter, NDIS_802_11_WEP *wep){
goto exit;
}
switch(wep->KeyLength)
{
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"));
@ -700,7 +699,9 @@ u8 rtw_set_802_11_add_wep(struct adapter* padapter, NDIS_802_11_WEP *wep){
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,9 +1158,7 @@ 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){
@ -1172,20 +1168,14 @@ u8 rtw_set_802_11_remove_key(struct adapter* padapter, NDIS_802_11_REMOVE_KEY *k
memset(&stainfo->dot118021x_UncstKey, 0, 16);
/* \todo Send a H2C Command to Firmware for disable this Key in CAM Entry. */
}
else{
} else{
ret= _FAIL;
goto exit;
}
}
exit:
;
return true;
}
/*

View file

@ -2251,22 +2251,13 @@ LedControl871x(
{
struct led_priv *ledpriv = &(padapter->ledpriv);
if( (padapter->bSurpriseRemoved == true) || ( padapter->bDriverStopped == true)
||(padapter->hw_init_completed == false) )
{
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 ||

View file

@ -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;
}

View file

@ -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;
@ -4123,14 +4111,12 @@ static u8 is_matched_in_profilelist( u8* peermacaddr, struct profile_info* profi
{
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 );
@ -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,7 +9528,6 @@ 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;
@ -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;i<in_num;i++) {
if (0)
DBG_871X(FUNC_ADPT_FMT" "CHAN_FMT"\n", FUNC_ADPT_ARG(padapter), CHAN_ARG(&in[i]));
if(in[i].hw_value && !(in[i].flags & RTW_IEEE80211_CHAN_DISABLED)
&& (set_idx=rtw_ch_set_search_ch(pmlmeext->channel_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)

View file

@ -3217,25 +3217,16 @@ static void ro_ch_handler(struct adapter *padapter)
u8 ch, bw, offset;
if (rtw_get_ch_setting_union(padapter, &ch, &bw, &offset) != 0) {
if (0)
DBG_871X(FUNC_ADPT_FMT" back to linked union - ch:%u, bw:%u, offset:%u\n",
FUNC_ADPT_ARG(padapter), ch, bw, offset);
}
else if (wdev_to_priv(padapter->rtw_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);

View file

@ -244,16 +244,9 @@ int rtw_free_recvframe(union recv_frame *precvframe, _queue *pfree_recv_queue)
}
spin_unlock_bh(&pfree_recv_queue->lock);
;
return _SUCCESS;
}
sint _rtw_enqueue_recvframe(union recv_frame *precvframe, _queue *queue)
{
@ -963,7 +956,6 @@ sint sta2sta_data_frame(
ret= _FAIL;
goto exit;
}
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

View file

@ -209,10 +209,7 @@ 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
{
} else {
length=pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len ;
*((__le32 *)crc)=getcrc32(payload,length);
arcfour_init(&mycontext, wepkey,3+keylength);
@ -221,15 +218,9 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)
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,24 +372,20 @@ 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;
@ -410,8 +396,7 @@ void rtw_seccalctkipmic(u8 * key,u8 *header,u8 *data,u32 data_len,u8 *mic_code,
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);
;
}
@ -599,7 +583,8 @@ 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 */
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] */
@ -724,8 +709,7 @@ 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);
@ -883,7 +867,7 @@ exit:
/******** SBOX Table *********/
/*****************************/
static u8 sbox_table[256] =
static u8 sbox_table[256] =
{
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5,
0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
@ -1181,7 +1165,7 @@ static void construct_mic_iv(
)
{
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 */
@ -1202,10 +1186,8 @@ static void construct_mic_iv(
#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 */
@ -1317,7 +1299,8 @@ static void construct_ctr_preload(
{
sint i = 0;
;
for (i=0; i<16; i++) ctr_preload[i] = 0x00;
for (i=0; i<16; i++)
ctr_preload[i] = 0x00;
i = 0;
ctr_preload[0] = 0x01; /* flag */
@ -1341,7 +1324,6 @@ static void construct_ctr_preload(
#endif
ctr_preload[14] = (unsigned char) (c / 256); /* Ctr */
ctr_preload[15] = (unsigned char) (c % 256);
;
}
@ -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) ||
if (((frtype|frsubtype) == WIFI_DATA_CFACK) ||
((frtype|frsubtype) == WIFI_DATA_CFPOLL)||
((frtype|frsubtype) == WIFI_DATA_CFACKPOLL))
{
((frtype|frsubtype) == WIFI_DATA_CFACKPOLL)) {
qc_exists = 1;
if(hdrlen != WLAN_HDR_A3_QOS_LEN){
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){
(frsubtype == 0x0b))) {
if(hdrlen != WLAN_HDR_A3_QOS_LEN)
hdrlen += 2;
}
qc_exists = 1;
}
else
} else
qc_exists = 0;
pn_vector[0]=pframe[hdrlen];
@ -1469,8 +1440,7 @@ static sint aes_cipher(u8 *key, uint hdrlen,
bitwise_xor(aes_out, mic_header2, chain_buffer);
aes128k128d(key, chain_buffer, aes_out);
for (i = 0; i < num_blocks; i++)
{
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;
@ -1478,27 +1448,25 @@ static sint aes_cipher(u8 *key, uint hdrlen,
}
/* Add on the final payload block if it needs padding */
if (payload_remainder > 0)
{
for (j = 0; j < 16; j++) padded_buffer[j] = 0x00;
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]; */
payload_index = hdrlen + 8;
for (i=0; i< num_blocks; i++)
{
for (i=0; i< num_blocks; i++) {
construct_ctr_preload(
ctr_preload,
a4_exists,
@ -1509,7 +1477,8 @@ static sint aes_cipher(u8 *key, uint hdrlen,
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 (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,*/
@ -1523,14 +1492,14 @@ static sint aes_cipher(u8 *key, uint hdrlen,
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 < 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; j<payload_remainder;j++) pframe[payload_index++] = chain_buffer[j];/* for (j=0; j<payload_remainder;j++) message[payload_index++] = chain_buffer[j]; */
for (j=0; j<payload_remainder;j++)
pframe[payload_index++] = chain_buffer[j];/* for (j=0; j<payload_remainder;j++) message[payload_index++] = chain_buffer[j]; */
}
/* Encrypt the MIC */
@ -1543,23 +1512,19 @@ static sint aes_cipher(u8 *key, uint hdrlen,
0,
frtype); /* add for CONFIG_IEEE80211W, none 11w also can use */
for (j = 0; j < 16; j++) padded_buffer[j] = 0x00;
for (j = 0; j < 16; j++)
padded_buffer[j] = 0x00;
for (j = 0; j < 8; j++)
{
padded_buffer[j] = pframe[j+hdrlen+8+plen];/* padded_buffer[j] = message[j+hdrlen+8+plen]; */
}
aes128k128d(key, ctr_preload, aes_out);
bitwise_xor(aes_out, padded_buffer, chain_buffer);
for (j=0; j<8;j++) pframe[payload_index++] = chain_buffer[j];/* for (j=0; j<8;j++) message[payload_index++] = chain_buffer[j]; */
for (j=0; j<8;j++)
pframe[payload_index++] = chain_buffer[j];/* for (j=0; j<8;j++) message[payload_index++] = chain_buffer[j]; */
;
return _SUCCESS;
}
u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe)
{ /* exclude ICV */
@ -1576,10 +1541,7 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe)
struct pkt_attrib *pattrib = &((struct xmit_frame *)pxmitframe)->attrib;
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;curfragnum<pattrib->nr_frags;curfragnum++){
@ -1628,20 +1580,15 @@ 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));
}
}
}
else{
} else{
RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("rtw_aes_encrypt: stainfo==NULL!!!\n"));
DBG_871X("%s, psta==NUL\n", __func__);
res=_FAIL;
@ -1675,13 +1622,10 @@ static sint aes_decipher(u8 *key, uint hdrlen,
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,14 +1652,11 @@ static sint aes_decipher(u8 *key, uint hdrlen,
else
a4_exists = 1;
if (
((frtype|frsubtype) == WIFI_DATA_CFACK) ||
if (((frtype|frsubtype) == WIFI_DATA_CFACK) ||
((frtype|frsubtype) == WIFI_DATA_CFPOLL)||
((frtype|frsubtype) == WIFI_DATA_CFACKPOLL))
{
((frtype|frsubtype) == WIFI_DATA_CFACKPOLL)) {
qc_exists = 1;
if(hdrlen != WLAN_HDR_A3_QOS_LEN){
hdrlen += 2;
}
}/* only for data packet . add for CONFIG_IEEE80211W, none 11w also can use */
@ -1723,15 +1664,12 @@ static sint aes_decipher(u8 *key, uint hdrlen,
((frsubtype == 0x08) ||
(frsubtype == 0x09)||
(frsubtype == 0x0a)||
(frsubtype == 0x0b)))
{
(frsubtype == 0x0b))) {
if(hdrlen != WLAN_HDR_A3_QOS_LEN){
hdrlen += 2;
}
qc_exists = 1;
}
else
} else
qc_exists = 0;
@ -1739,8 +1677,7 @@ static sint aes_decipher(u8 *key, uint hdrlen,
payload_index = hdrlen + 8; /* 8 is for extiv */
for (i=0; i< num_blocks; i++)
{
for (i=0; i< num_blocks; i++) {
construct_ctr_preload(
ctr_preload,
a4_exists,
@ -1754,7 +1691,8 @@ static sint aes_decipher(u8 *key, uint hdrlen,
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,*/
@ -1769,14 +1707,16 @@ static sint aes_decipher(u8 *key, uint hdrlen,
frtype /* add for CONFIG_IEEE80211W, none 11w also can use */
);
for (j = 0; j < 16; j++) padded_buffer[j] = 0x00;
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<payload_remainder;j++) pframe[payload_index++] = chain_buffer[j];
for (j=0; j<payload_remainder;j++)
pframe[payload_index++] = chain_buffer[j];
}
/* start to calculate the mic */
@ -1790,9 +1730,6 @@ static sint aes_decipher(u8 *key, uint hdrlen,
pn_vector[3]=pframe[hdrlen+5];
pn_vector[4]=pframe[hdrlen+6];
pn_vector[5]=pframe[hdrlen+7];
construct_mic_iv(
mic_iv,
qc_exists,
@ -1830,8 +1767,7 @@ static sint aes_decipher(u8 *key, uint hdrlen,
bitwise_xor(aes_out, mic_header2, chain_buffer);
aes128k128d(key, chain_buffer, aes_out);
for (i = 0; i < num_blocks; i++)
{
for (i = 0; i < num_blocks; i++) {
bitwise_xor(aes_out, &message[payload_index], chain_buffer);
payload_index += 16;
@ -1839,27 +1775,24 @@ static sint aes_decipher(u8 *key, uint hdrlen,
}
/* Add on the final payload block if it needs padding */
if (payload_remainder > 0)
{
for (j = 0; j < 16; j++) padded_buffer[j] = 0x00;
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];
payload_index = hdrlen + 8;
for (i=0; i< num_blocks; i++)
{
for (i=0; i< num_blocks; i++) {
construct_ctr_preload(
ctr_preload,
a4_exists,
@ -1870,11 +1803,12 @@ static sint aes_decipher(u8 *key, uint hdrlen,
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 (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 */
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,
@ -1884,14 +1818,14 @@ static sint aes_decipher(u8 *key, uint hdrlen,
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 < 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<payload_remainder;j++) message[payload_index++] = chain_buffer[j];
for (j=0; j<payload_remainder;j++)
message[payload_index++] = chain_buffer[j];
}
/* Encrypt the MIC */
@ -1904,11 +1838,10 @@ static sint aes_decipher(u8 *key, uint hdrlen,
0,
frtype); /* add for CONFIG_IEEE80211W, none 11w also can use */
for (j = 0; j < 16; j++) padded_buffer[j] = 0x00;
for (j = 0; j < 16; j++)
padded_buffer[j] = 0x00;
for (j = 0; j < 8; j++)
{
padded_buffer[j] = message[j+hdrlen+8+plen-8];
}
aes128k128d(key, ctr_preload, aes_out);
bitwise_xor(aes_out, padded_buffer, chain_buffer);
@ -2591,6 +2524,7 @@ const u8 Td4s[256] = {
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 */
@ -2821,17 +2755,11 @@ void rtw_use_tkipkey_handler(void *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 */

View file

@ -29,20 +29,13 @@
#include <sta_info.h>
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);
_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;

View file

@ -79,9 +79,7 @@ int cckrates_included(unsigned char *rate, int ratelen)
(((rate[i]) & 0x7f) == 11) || (((rate[i]) & 0x7f) == 22) )
return true;
}
return false;
}
int cckratesonly_included(unsigned char *rate, int ratelen)
@ -94,7 +92,6 @@ int cckratesonly_included(unsigned char *rate, int ratelen)
(((rate[i]) & 0x7f) != 11) && (((rate[i]) & 0x7f) != 22) )
return false;
}
return true;
}
@ -1508,24 +1505,16 @@ unsigned int should_forbid_n_rate(struct adapter * padapter)
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;
}
}
unsigned int is_ap_in_wep(struct adapter *padapter)
{
u32 i;

View file

@ -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);
@ -2205,11 +2204,7 @@ static struct xmit_frame *dequeue_one_xmitframe(struct xmit_priv *pxmitpriv, str
ptxservq->qcnt--;
break;
pxmitframe = NULL;
}
return pxmitframe;
}

View file

@ -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 )
{
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 )
{
if ( v1 < 0xCDCDCDCD ) {
odm_ConfigBB_AGC_8188E(pDM_Odm, v1, bMaskDWord, v2);
continue;
}
else
{ /* This line is the start line of branch. */
} 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. */
} 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)
{
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);
}
}
}
}
}
/******************************************************************************
@ -851,9 +839,7 @@ ODM_ReadAndConfig_PHY_REG_1T_8188E(
/* This (offset, data) pair meets the condition. */
if ( v1 < 0xCDCDCDCD ) {
{
odm_ConfigBB_PHY_8188E(pDM_Odm, v1, bMaskDWord, v2);
}
continue;
}
else
@ -864,34 +850,26 @@ ODM_ReadAndConfig_PHY_REG_1T_8188E(
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. */
} 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)
{
{
v2 != 0xCDCD && i < ArrayLen -2) {
odm_ConfigBB_PHY_8188E(pDM_Odm, v1, bMaskDWord, v2);
}
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 )
{
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 )
{
if ( v1 < 0xCDCDCDCD ) {
odm_ConfigBB_PHY_8188E(pDM_Odm, v1, bMaskDWord, v2);
continue;
}
else
{ /* This line is the start line of branch. */
} 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. */
{
} 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)
{
v2 != 0xCDCD && i < ArrayLen -2) {
odm_ConfigBB_PHY_8188E(pDM_Odm, v1, bMaskDWord, v2);
READ_NEXT_PAIR(v1, v2, i);
}
while (v2 != 0xDEAD && i < ArrayLen -2)
{
READ_NEXT_PAIR(v1, v2, i);
}
}
}
}
}
@ -1196,8 +1161,7 @@ ODM_ReadAndConfig_PHY_REG_PG_8188E(
hex += interfaceValue << 8;
hex += platform << 16;
hex += 0xFF000000;
for (i = 0; i < ArrayLen; i += 6 )
{
for (i = 0; i < ArrayLen; i += 6 ) {
u32 v1 = Array[i];
u32 v2 = Array[i+1];
u32 v3 = Array[i+2];
@ -1206,23 +1170,17 @@ ODM_ReadAndConfig_PHY_REG_PG_8188E(
u32 v6 = Array[i+5];
/* this line is a line of pure_body */
if ( v1 < 0xCDCDCDCD )
{
if ( v1 < 0xCDCDCDCD ) {
odm_ConfigBB_PHY_REG_PG_8188E(pDM_Odm, v1, v2, v3);
continue;
}
else
{ /* this line is the start of branch */
} 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)
{
while (v2 != 0xDEAD) {
i += 3;
v1 = Array[i];
v2 = Array[i+1];
@ -1231,5 +1189,4 @@ ODM_ReadAndConfig_PHY_REG_PG_8188E(
}
}
}
}

View file

@ -337,18 +337,15 @@ 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 )
{
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 )
{
if ( v1 < 0xCDCDCDCD ) {
odm_ConfigMAC_8188E(pDM_Odm, v1, (u8)v2);
continue;
}
else
} else
{ /* This line is the start line of branch. */
if ( !CheckCondition(Array[i], hex) )
{ /* Discard the following (offset, data) pairs. */
@ -356,29 +353,21 @@ ODM_ReadAndConfig_MAC_REG_ICUT_8188E(
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. */
} 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)
{
v2 != 0xCDCD && i < ArrayLen -2) {
odm_ConfigMAC_8188E(pDM_Odm, v1, (u8)v2);
READ_NEXT_PAIR(v1, v2, i);
}
while (v2 != 0xDEAD && i < ArrayLen -2)
{
READ_NEXT_PAIR(v1, v2, i);
}
}
}
}
}

View file

@ -76,8 +76,7 @@ static void setIqkMatrix(
ele_C = ((IqkResult_Y * ele_D)>>8)&0x000003FF;
if (RFPath == RF_PATH_A)
switch (RFPath)
{
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;
@ -104,11 +103,8 @@ static void setIqkMatrix(
default:
break;
}
}
else
{
switch (RFPath)
{
} 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,7 +122,8 @@ 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",
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));
}
@ -384,7 +381,7 @@ 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)
if (!ThermalValue || ! pDM_Odm->RFCalibrateInfo.TxPowerTrackControl)
return;
/* 4 3. Initialize ThermalValues of RFCalibrateInfo */
@ -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;
@ -1206,7 +1198,6 @@ phy_SimularityCompare_8188E(
{
for(i = 4; i < 6; i++)
result[3][i] = result[c1][i];
}
if (!(SimularityBitMap & 0xc0)) /* path B RX OK */
@ -1258,15 +1249,14 @@ phy_IQCalibrate_8188E(
#else
u32 retryCount = 2;
#endif
if ( *(pDM_Odm->mp_mode) == 1)
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)
if (*(pDM_Odm->mp_mode) != 1)
return;
/* endif */
/* 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);
@ -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(

View file

@ -1167,16 +1167,12 @@ 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)
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)
@ -1904,9 +1900,7 @@ odm_FalseAlarmCounterStatistics(
if(!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT))
return;
if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES)
{
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 */
@ -1934,7 +1928,6 @@ odm_FalseAlarmCounterStatistics(
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);
@ -1946,7 +1939,6 @@ odm_FalseAlarmCounterStatistics(
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_SB_Search_fail +
@ -3180,8 +3172,7 @@ odm_SetRxIdleAnt(
{
SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table;
if(Ant != pDM_SWAT_Table->RxIdleAnt)
{
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 */
@ -3198,10 +3189,7 @@ odm_SetRxIdleAnt(
}
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,56 +3788,37 @@ 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))
{
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
{
} 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
{
} 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))
{
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")); */
ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("Ant A is OFF"));
}
else
{
} else {
pDM_SWAT_Table->ANTA_ON=true;
/* RT_TRACE(COMP_ANTENNA, DBG_LOUD, ("ODM_AntennaDetection(): Antenna A is ON\n")); */
ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("Ant A is ON"));
}
if(AntB_report > (AntO_report+2))
{
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")); */
ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("Ant B is OFF"));
}
else
{
} else {
pDM_SWAT_Table->ANTB_ON=true;
/* RT_TRACE(COMP_ANTENNA, DBG_LOUD, ("ODM_AntennaDetection(): Antenna B is ON\n")); */
ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("Ant B is ON"));
}
}

View file

@ -255,39 +255,31 @@ 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_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)
{
switch(LNA_idx) {
case 7:
if(VGA_idx <= 27)
rx_pwr_all = -100 + 2*(27-VGA_idx); /* VGA_idx = 27~2 */
@ -449,10 +441,7 @@ 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++)
{
/* 2008/01/30 MH we will judge RF RX path now. */
@ -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

View file

@ -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"));
#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;
}
#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;

View file

@ -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++)
{
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)

View file

@ -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
{
}
}
}

View file

@ -212,7 +212,6 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag
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 (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);
@ -540,8 +537,7 @@ static s32 rtw_dump_xframe(struct adapter *padapter, struct xmit_frame *pxmitfra
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;

View file

@ -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);
}
} /* 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,20 +1287,19 @@ 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__);
@ -1349,13 +1311,9 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_DOWNLOAD_FW);
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,7 +1397,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC02);
}
#if (RATE_ADAPTIVE_SUPPORT==1)
{/* Enable TX Report */
/* 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));
@ -1447,7 +1405,6 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MISC02);
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,7 +1549,6 @@ static void hal_poweroff_rtl8188eu(
IN struct adapter * Adapter
)
{
/* PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); */
u8 val8;
u16 val16;
u32 val32;

View file

@ -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,7 +790,6 @@ 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);
/* re-assign for linux based on skb */
@ -846,10 +842,6 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
err, purb->status);
ret = _FAIL;
}
} else {
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port:precvbuf ==NULL\n"));
ret = _FAIL;
}
return ret;
}

View file

@ -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)

View file

@ -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,8 +816,7 @@ static int set_group_key(struct adapter *padapter, u8 *key, u8 alg, int keyid)
psetkeyparm->set_tx = 1;
switch(alg)
{
switch(alg) {
case _WEP40_:
keylen = 5;
break;
@ -830,7 +826,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;
}
@ -1230,8 +1225,7 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param
psecuritypriv->dot11PrivacyAlgrthm = _WEP40_;
psecuritypriv->dot118021XGrpPrivacy = _WEP40_;
if(wep_key_len==13)
{
if(wep_key_len==13) {
psecuritypriv->dot11PrivacyAlgrthm = _WEP104_;
psecuritypriv->dot118021XGrpPrivacy = _WEP104_;
}
@ -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 &&
if (request->n_channels == 3 &&
request->channels[0]->hw_value == 1 &&
request->channels[1]->hw_value == 6 &&
request->channels[2]->hw_value == 11
)
{
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;i<survey_times;i++)
{
memcpy(&ch[j*survey_times+i], &ch[j], sizeof(struct rtw_ieee80211_channel));
}
_status = rtw_sitesurvey_cmd(padapter, ssid, RTW_SSID_SCAN_AMOUNT, ch, survey_times * request->n_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,7 +2984,8 @@ 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)
if (!skb)
return -1;
rtw_mstat_update(MSTAT_TYPE_SKB, MSTAT_ALLOC_SUCCESS, skb->truesize);
if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header)))
@ -5014,17 +4969,10 @@ 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);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38) && LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0))
@ -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)

View file

@ -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,7 +725,6 @@ 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);
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 )
{
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 ; j<NUM_PMKID_CACHE; j++)
{
for(j=0 ; j<NUM_PMKID_CACHE; j++) {
if( _rtw_memcmp( psecuritypriv->PMKIDList[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 ; j<NUM_PMKID_CACHE; j++)
{
for(j=0 ; j<NUM_PMKID_CACHE; j++) {
if( _rtw_memcmp( psecuritypriv->PMKIDList[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,9 +1259,7 @@ 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;
@ -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 */
@ -1602,7 +1568,7 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
goto exit;
}
if(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));
@ -2080,8 +2044,6 @@ static int rtw_wx_set_rate(struct net_device *dev,
u32 ratevalue = 0;
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,17 +5601,14 @@ 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)
{
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;
extra_arg = extra_arg > 100 ? 100 : extra_arg;
padapter->recvpriv.signal_strength_dbg=extra_arg;
break;
}
@ -6252,13 +6208,9 @@ 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)
{
switch((value)&0xff) {
case 1 : /* WPA */
padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeWPAPSK; /* WPA_PSK */
padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption2Enabled;
@ -6268,15 +6220,11 @@ static int wpa_set_param(struct net_device *dev, u8 name, u32 value)
padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled;
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,11 +6587,7 @@ 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 */
@ -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,7 +7723,6 @@ 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;
}
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; i<cnts; i++) {
/* DBG_871X("0x%02x ", data[i]); */
sprintf(extra, "%s0x%02X ", extra, data[i]);
}
/* DBG_871X("}\n"); */
}
else if (strcmp(tmp[0], "realraw") == 0)
{
@ -7912,26 +7824,20 @@ static int rtw_mp_efuse_get(struct net_device *dev,
goto exit;
}
/* DBG_871X("%s: realraw={\n", __FUNCTION__); */
sprintf(extra, "\n");
for (i=0; i<mapLen; i++)
{
/* DBG_871X("%02X", rawdata[i]); */
sprintf(extra, "%s%02X", extra, rawdata[i]);
if ((i & 0xF) == 0xF) {
/* DBG_871X("\n"); */
sprintf(extra, "%s\n", extra);
}
else if ((i & 0x7) == 0x7){
/* DBG_871X("\t"); */
sprintf(extra, "%s\t", extra);
} else {
/* DBG_871X(" "); */
sprintf(extra, "%s ", extra);
}
}
/* DBG_871X("}\n"); */
}
else if (strcmp(tmp[0], "mac") == 0)
{
@ -7956,16 +7862,11 @@ static int rtw_mp_efuse_get(struct net_device *dev,
*extra = 0;
for (i=0; i<cnts; i++)
{
/* DBG_871X("%02X", data[i]); */
sprintf(extra, "%s%02X", extra, data[i]);
if (i != (cnts-1))
{
/* DBG_871X(":"); */
sprintf(extra,"%s:",extra);
}
}
/* DBG_871X("}\n"); */
}
else if (strcmp(tmp[0], "vidpid") == 0)
{
cnts = 4;
@ -7984,20 +7885,14 @@ static int rtw_mp_efuse_get(struct net_device *dev,
goto exit;
}
/* DBG_871X("%s: {VID,PID}={", __FUNCTION__); */
*extra = 0;
for (i=0; i<cnts; i++)
{
/* DBG_871X("0x%02x", data[i]); */
sprintf(extra, "%s0x%02X", extra, data[i]);
if (i != (cnts-1))
{
/* DBG_871X(","); */
sprintf(extra,"%s,",extra);
}
}
/* DBG_871X("}\n"); */
}
else if (strcmp(tmp[0], "ableraw") == 0)
{
efuse_GetCurrentSize(padapter,&raw_cursize);
@ -8014,26 +7909,17 @@ 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<512; i+=16) /* set 512 because the iwpriv's extra size have limit 0x7FF */
{
/* DBG_871X("0x%03x\t", i); */
sprintf(extra, "%s0x%03x\t", extra, i);
for (j=0; j<8; j++) {
/* DBG_871X("%02X ", pEfuseHal->BTEfuseInitMap[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,11 +8064,8 @@ 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))
{
} 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;
@ -8202,25 +8075,20 @@ static int rtw_mp_efuse_get(struct net_device *dev,
DBG_871X("%s: addr=%x\n", __FUNCTION__, addr);
cnts = simple_strtoul(tmp[2], &ptmp, 10);
if (cnts == 0)
{
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; i<cnts; i++) {
DBG_871X("wlrfkrmap = 0x%02x \n", pEfuseHal->fakeEfuseModifiedMap[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))
{
} 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;
@ -8230,23 +8098,19 @@ static int rtw_mp_efuse_get(struct net_device *dev,
DBG_871X("%s: addr=%x\n", __FUNCTION__, addr);
cnts = simple_strtoul(tmp[2], &ptmp, 10);
if (cnts == 0)
{
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; i<cnts; i++) {
DBG_871X("wlrfkrmap = 0x%02x \n", pEfuseHal->fakeBTEfuseModifiedMap[addr+i]);
sprintf(extra, "%s0x%02X ", extra, pEfuseHal->fakeBTEfuseModifiedMap[addr+i]);
}
}
else
{
} 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 <rtl8188e_hal.h>
@ -9677,14 +9500,11 @@ static struct iw_statistics *rtw_get_wireless_stats(struct net_device *dev)
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;

View file

@ -178,10 +178,6 @@ 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);
@ -190,9 +186,6 @@ void rtw_os_indicate_disconnect( struct adapter *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);

View file

@ -51,8 +51,7 @@ u32 rtw_atoi(u8* s)
int num=0,flag=0;
int i;
for(i=0;i<=strlen(s);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)
@ -64,8 +63,7 @@ u32 rtw_atoi(u8* s)
if(flag == 1)
num = num * -1;
return(num);
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 */

View file

@ -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)
{

View file

@ -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,14 +515,11 @@ 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;
/* padapter->net_closed = true; */
/* s1. */
if(pnetdev)
{
@ -536,7 +531,6 @@ int rtw_hw_suspend(struct adapter *padapter )
rtw_disassoc_cmd(padapter, 500, false);
/* s2-2. indicate disconnect to os */
/* rtw_indicate_disconnect(padapter); */
{
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@ -563,11 +557,7 @@ int rtw_hw_suspend(struct adapter *padapter )
pwrpriv->bips_processing = false;
_exit_pwrlock(&pwrpriv->lock);
}
else
goto error_exit;
;
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__);

View file

@ -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 = (rlen > len)? len: rlen;
if(rmem)
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;
}