diff options
Diffstat (limited to 'kernel/drivers/staging/rtl8712/rtl871x_recv.c')
-rw-r--r-- | kernel/drivers/staging/rtl8712/rtl871x_recv.c | 70 |
1 files changed, 37 insertions, 33 deletions
diff --git a/kernel/drivers/staging/rtl8712/rtl871x_recv.c b/kernel/drivers/staging/rtl8712/rtl871x_recv.c index 046a46c4c..4ff530155 100644 --- a/kernel/drivers/staging/rtl8712/rtl871x_recv.c +++ b/kernel/drivers/staging/rtl8712/rtl871x_recv.c @@ -83,7 +83,7 @@ sint _r8712_init_recv_priv(struct recv_priv *precvpriv, precvpriv->precv_frame_buf = precvpriv->pallocated_frame_buf + RXFRAME_ALIGN_SZ - ((addr_t)(precvpriv->pallocated_frame_buf) & - (RXFRAME_ALIGN_SZ-1)); + (RXFRAME_ALIGN_SZ - 1)); precvframe = (union recv_frame *)precvpriv->precv_frame_buf; for (i = 0; i < NR_RECVFRAME; i++) { INIT_LIST_HEAD(&(precvframe->u.list)); @@ -112,9 +112,9 @@ union recv_frame *r8712_alloc_recvframe(struct __queue *pfree_recv_queue) struct recv_priv *precvpriv; spin_lock_irqsave(&pfree_recv_queue->lock, irqL); - if (list_empty(&pfree_recv_queue->queue)) + if (list_empty(&pfree_recv_queue->queue)) { precvframe = NULL; - else { + } else { phead = &pfree_recv_queue->queue; plist = phead->next; precvframe = LIST_CONTAINOR(plist, union recv_frame, u); @@ -147,7 +147,7 @@ void r8712_free_recvframe_queue(struct __queue *pframequeue, spin_lock(&pframequeue->lock); phead = &pframequeue->queue; plist = phead->next; - while (end_of_queue_search(phead, plist) == false) { + while (!end_of_queue_search(phead, plist)) { precvframe = LIST_CONTAINOR(plist, union recv_frame, u); plist = plist->next; r8712_free_recvframe(precvframe, pfree_recv_queue); @@ -178,10 +178,11 @@ sint r8712_recvframe_chkmic(struct _adapter *adapter, idx = iv[3]; mickey = &psecuritypriv->XGrprxmickey[(((idx >> 6) & 0x3)) - 1].skey[0]; - if (psecuritypriv->binstallGrpkey == false) + if (!psecuritypriv->binstallGrpkey) return _FAIL; - } else + } else { mickey = &stainfo->tkiprxmickey.skey[0]; + } /*icv_len included the mic code*/ datalen = precvframe->u.hdr.len - prxattrib->hdrlen - prxattrib->iv_len - prxattrib->icv_len - 8; @@ -197,16 +198,15 @@ sint r8712_recvframe_chkmic(struct _adapter *adapter, if (miccode[i] != *(pframemic + i)) bmic_err = true; } - if (bmic_err == true) { - if (prxattrib->bdecrypted == true) + if (bmic_err) { + if (prxattrib->bdecrypted) r8712_handle_tkip_mic_err(adapter, (u8)IS_MCAST(prxattrib->ra)); res = _FAIL; } else { /* mic checked ok */ - if ((psecuritypriv->bcheck_grpkey == - false) && (IS_MCAST(prxattrib->ra) == - true)) + if (!psecuritypriv->bcheck_grpkey && + IS_MCAST(prxattrib->ra)) psecuritypriv->bcheck_grpkey = true; } recvframe_pull_tail(precvframe, 8); @@ -224,7 +224,7 @@ union recv_frame *r8712_decryptor(struct _adapter *padapter, union recv_frame *return_packet = precv_frame; if ((prxattrib->encrypt > 0) && ((prxattrib->bdecrypted == 0) || - (psecuritypriv->sw_decrypt == true))) { + psecuritypriv->sw_decrypt)) { psecuritypriv->hw_decrypted = false; switch (prxattrib->encrypt) { case _WEP40_: @@ -240,8 +240,9 @@ union recv_frame *r8712_decryptor(struct _adapter *padapter, default: break; } - } else if (prxattrib->bdecrypted == 1) + } else if (prxattrib->bdecrypted == 1) { psecuritypriv->hw_decrypted = true; + } return return_packet; } /*###set the security information in the recv_frame */ @@ -271,9 +272,9 @@ union recv_frame *r8712_portctrl(struct _adapter *adapter, if ((psta != NULL) && (psta->ieee8021x_blocked)) { /* blocked * only accept EAPOL frame */ - if (ether_type == 0x888e) + if (ether_type == 0x888e) { prtnframe = precv_frame; - else { + } else { /*free this frame*/ r8712_free_recvframe(precv_frame, &adapter->recvpriv.free_recv_queue); @@ -290,8 +291,9 @@ union recv_frame *r8712_portctrl(struct _adapter *adapter, prtnframe = precv_frame; } } - } else + } else { prtnframe = precv_frame; + } return prtnframe; } @@ -299,7 +301,7 @@ static sint recv_decache(union recv_frame *precv_frame, u8 bretry, struct stainfo_rxcache *prxcache) { sint tid = precv_frame->u.hdr.attrib.priority; - u16 seq_ctrl = ((precv_frame->u.hdr.attrib.seq_num&0xffff) << 4) | + u16 seq_ctrl = ((precv_frame->u.hdr.attrib.seq_num & 0xffff) << 4) | (precv_frame->u.hdr.attrib.frag_num & 0xf); if (tid > 15) @@ -324,8 +326,8 @@ static sint sta2sta_data_frame(struct _adapter *adapter, u8 *sta_addr = NULL; sint bmcast = IS_MCAST(pattrib->dst); - if ((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) || - (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true)) { + if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) || + check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) { /* filter packets that SA is myself or multicast or broadcast */ if (!memcmp(myhwaddr, pattrib->src, ETH_ALEN)) return _FAIL; @@ -336,13 +338,13 @@ static sint sta2sta_data_frame(struct _adapter *adapter, (memcmp(pattrib->bssid, mybssid, ETH_ALEN))) return _FAIL; sta_addr = pattrib->src; - } else if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) { + } else if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { /* For Station mode, sa and bssid should always be BSSID, * and DA is my mac-address */ if (memcmp(pattrib->bssid, pattrib->src, ETH_ALEN)) return _FAIL; sta_addr = pattrib->bssid; - } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) { + } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { if (bmcast) { /* For AP mode, if DA == MCAST, then BSSID should * be also MCAST */ @@ -355,21 +357,22 @@ static sint sta2sta_data_frame(struct _adapter *adapter, return _FAIL; sta_addr = pattrib->src; } - } else if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) { + } else if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) { memcpy(pattrib->dst, GetAddr1Ptr(ptr), ETH_ALEN); memcpy(pattrib->src, GetAddr2Ptr(ptr), ETH_ALEN); memcpy(pattrib->bssid, GetAddr3Ptr(ptr), ETH_ALEN); memcpy(pattrib->ra, pattrib->dst, ETH_ALEN); memcpy(pattrib->ta, pattrib->src, ETH_ALEN); sta_addr = mybssid; - } else + } else { ret = _FAIL; + } if (bmcast) *psta = r8712_get_bcmc_stainfo(adapter); else *psta = r8712_get_stainfo(pstapriv, sta_addr); /* get ap_info */ if (*psta == NULL) { - if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) + if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) adapter->mppriv.rx_pktloss++; return _FAIL; } @@ -388,8 +391,8 @@ static sint ap2sta_data_frame(struct _adapter *adapter, u8 *myhwaddr = myid(&adapter->eeprompriv); sint bmcast = IS_MCAST(pattrib->dst); - if ((check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) - && (check_fwstate(pmlmepriv, _FW_LINKED) == true)) { + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) && + check_fwstate(pmlmepriv, _FW_LINKED)) { /* if NULL-frame, drop packet */ if ((GetFrameSubType(ptr)) == WIFI_DATA_NULL) return _FAIL; @@ -419,8 +422,8 @@ static sint ap2sta_data_frame(struct _adapter *adapter, *psta = r8712_get_stainfo(pstapriv, pattrib->bssid); if (*psta == NULL) return _FAIL; - } else if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) && - (check_fwstate(pmlmepriv, _FW_LINKED) == true)) { + } else if (check_fwstate(pmlmepriv, WIFI_MP_STATE) && + check_fwstate(pmlmepriv, _FW_LINKED)) { memcpy(pattrib->dst, GetAddr1Ptr(ptr), ETH_ALEN); memcpy(pattrib->src, GetAddr2Ptr(ptr), ETH_ALEN); memcpy(pattrib->bssid, GetAddr3Ptr(ptr), ETH_ALEN); @@ -430,8 +433,9 @@ static sint ap2sta_data_frame(struct _adapter *adapter, *psta = r8712_get_stainfo(pstapriv, pattrib->bssid); if (*psta == NULL) return _FAIL; - } else + } else { return _FAIL; + } return _SUCCESS; } @@ -444,7 +448,7 @@ static sint sta2ap_data_frame(struct _adapter *adapter, struct mlme_priv *pmlmepriv = &adapter->mlmepriv; unsigned char *mybssid = get_bssid(pmlmepriv); - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) { + if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { /* For AP mode, if DA is non-MCAST, then it must be BSSID, * and bssid == BSSID * For AP mode, RA=BSSID, TX=STA(SRC_ADDR), A3=DST_ADDR */ @@ -630,10 +634,10 @@ sint r8712_wlanhdr_to_ethhdr(union recv_frame *precvframe) rmv_len = pattrib->hdrlen + pattrib->iv_len + (bsnaphdr ? SNAP_SIZE : 0); len = precvframe->u.hdr.len - rmv_len; - if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) { + if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) { ptr += rmv_len; *ptr = 0x87; - *(ptr+1) = 0x12; + *(ptr + 1) = 0x12; /* append rx status for mp test packets */ ptr = recvframe_pull(precvframe, (rmv_len - sizeof(struct ethhdr) + 2) - 24); @@ -644,7 +648,7 @@ sint r8712_wlanhdr_to_ethhdr(union recv_frame *precvframe) sizeof(struct ethhdr) + (bsnaphdr ? 2 : 0))); memcpy(ptr, pattrib->dst, ETH_ALEN); - memcpy(ptr+ETH_ALEN, pattrib->src, ETH_ALEN); + memcpy(ptr + ETH_ALEN, pattrib->src, ETH_ALEN); if (!bsnaphdr) { len = htons(len); memcpy(ptr + 12, &len, 2); |