diff options
Diffstat (limited to 'drivers/staging/rtl8723bs/os_dep/recv_linux.c')
-rw-r--r-- | drivers/staging/rtl8723bs/os_dep/recv_linux.c | 101 |
1 files changed, 31 insertions, 70 deletions
diff --git a/drivers/staging/rtl8723bs/os_dep/recv_linux.c b/drivers/staging/rtl8723bs/os_dep/recv_linux.c index 67ec336264e5..643caccc3069 100644 --- a/drivers/staging/rtl8723bs/os_dep/recv_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/recv_linux.c @@ -12,8 +12,7 @@ void rtw_os_free_recvframe(union recv_frame *precvframe) { - if (precvframe->u.hdr.pkt) - { + if (precvframe->u.hdr.pkt) { dev_kfree_skb_any(precvframe->u.hdr.pkt);/* free skb by driver */ precvframe->u.hdr.pkt = NULL; @@ -21,13 +20,9 @@ void rtw_os_free_recvframe(union recv_frame *precvframe) } /* alloc os related resource in union recv_frame */ -int rtw_os_recv_resource_alloc(struct adapter *padapter, union recv_frame *precvframe) +void rtw_os_recv_resource_alloc(struct adapter *padapter, union recv_frame *precvframe) { - int res = _SUCCESS; - precvframe->u.hdr.pkt_newalloc = precvframe->u.hdr.pkt = NULL; - - return res; } /* free os related resource in union recv_frame */ @@ -38,10 +33,8 @@ void rtw_os_recv_resource_free(struct recv_priv *precvpriv) precvframe = (union recv_frame*) precvpriv->precv_frame_buf; - for (i = 0; i < NR_RECVFRAME; i++) - { - if (precvframe->u.hdr.pkt) - { + for (i = 0; i < NR_RECVFRAME; i++) { + if (precvframe->u.hdr.pkt) { dev_kfree_skb_any(precvframe->u.hdr.pkt);/* free skb by driver */ precvframe->u.hdr.pkt = NULL; } @@ -50,16 +43,11 @@ void rtw_os_recv_resource_free(struct recv_priv *precvpriv) } /* free os related resource in struct recv_buf */ -int rtw_os_recvbuf_resource_free(struct adapter *padapter, struct recv_buf *precvbuf) +void rtw_os_recvbuf_resource_free(struct adapter *padapter, struct recv_buf *precvbuf) { - int ret = _SUCCESS; - - if (precvbuf->pskb) - { + if (precvbuf->pskb) { dev_kfree_skb_any(precvbuf->pskb); } - return ret; - } _pkt *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, u16 nSubframe_Length, u8 *pdata) @@ -71,22 +59,16 @@ _pkt *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, u16 nSubframe_Length, u8 pattrib = &prframe->u.hdr.attrib; sub_skb = rtw_skb_alloc(nSubframe_Length + 12); - if (sub_skb) - { + if (sub_skb) { skb_reserve(sub_skb, 12); skb_put_data(sub_skb, (pdata + ETH_HLEN), nSubframe_Length); - } - else - { + } else { sub_skb = rtw_skb_clone(prframe->u.hdr.pkt); - if (sub_skb) - { + if (sub_skb) { sub_skb->data = pdata + ETH_HLEN; sub_skb->len = nSubframe_Length; skb_set_tail_pointer(sub_skb, nSubframe_Length); - } - else - { + } else { DBG_871X("%s(): rtw_skb_clone() Fail!!!\n", __func__); return NULL; } @@ -121,8 +103,7 @@ void rtw_os_recv_indicate_pkt(struct adapter *padapter, _pkt *pkt, struct rx_pkt /* Indicat the packets to upper layer */ if (pkt) { - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) - { + if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) { _pkt *pskb2 = NULL; struct sta_info *psta = NULL; struct sta_priv *pstapriv = &padapter->stapriv; @@ -130,20 +111,17 @@ void rtw_os_recv_indicate_pkt(struct adapter *padapter, _pkt *pkt, struct rx_pkt /* DBG_871X("bmcast =%d\n", bmcast); */ - if (memcmp(pattrib->dst, myid(&padapter->eeprompriv), ETH_ALEN)) - { + if (memcmp(pattrib->dst, myid(&padapter->eeprompriv), ETH_ALEN)) { /* DBG_871X("not ap psta =%p, addr =%pM\n", psta, pattrib->dst); */ - if (bmcast) - { + if (bmcast) { psta = rtw_get_bcmc_stainfo(padapter); pskb2 = rtw_skb_clone(pkt); } else { psta = rtw_get_stainfo(pstapriv, pattrib->dst); } - if (psta) - { + if (psta) { struct net_device *pnetdev = (struct net_device*)padapter->pnetdev; /* DBG_871X("directly forwarding to the rtw_xmit_entry\n"); */ @@ -162,9 +140,8 @@ void rtw_os_recv_indicate_pkt(struct adapter *padapter, _pkt *pkt, struct rx_pkt return; } } - } - else/* to APself */ - { + } else { + /* to APself */ /* DBG_871X("to APSelf\n"); */ DBG_COUNTER(padapter->rx_logs.os_indicate_ap_self); } @@ -200,32 +177,23 @@ void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup) struct security_priv *psecuritypriv = &padapter->securitypriv; unsigned long cur_time = 0; - if (psecuritypriv->last_mic_err_time == 0) - { + if (psecuritypriv->last_mic_err_time == 0) { psecuritypriv->last_mic_err_time = jiffies; - } - else - { + } else { cur_time = jiffies; - if (cur_time - psecuritypriv->last_mic_err_time < 60*HZ) - { + if (cur_time - psecuritypriv->last_mic_err_time < 60*HZ) { psecuritypriv->btkip_countermeasure = true; psecuritypriv->last_mic_err_time = 0; psecuritypriv->btkip_countermeasure_time = cur_time; - } - else - { + } else { psecuritypriv->last_mic_err_time = jiffies; } } - if (bgroup) - { + if (bgroup) { key_type |= NL80211_KEYTYPE_GROUP; - } - else - { + } else { key_type |= NL80211_KEYTYPE_PAIRWISE; } @@ -233,13 +201,10 @@ void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup) NULL, GFP_ATOMIC); memset(&ev, 0x00, sizeof(ev)); - if (bgroup) - { - ev.flags |= IW_MICFAILURE_GROUP; - } - else - { - ev.flags |= IW_MICFAILURE_PAIRWISE; + if (bgroup) { + ev.flags |= IW_MICFAILURE_GROUP; + } else { + ev.flags |= IW_MICFAILURE_PAIRWISE; } ev.src_addr.sa_family = ARPHRD_ETHER; @@ -258,8 +223,7 @@ static void rtw_os_ksocket_send(struct adapter *padapter, union recv_frame *prec DBG_871X("eth rx: got eth_type = 0x%x\n", pattrib->eth_type); - if (psta && psta->isrc && psta->pid>0) - { + if (psta && psta->isrc && psta->pid>0) { u16 rx_pid; rx_pid = *(u16*)(skb->data+ETH_HLEN); @@ -267,8 +231,7 @@ static void rtw_os_ksocket_send(struct adapter *padapter, union recv_frame *prec DBG_871X("eth rx(pid = 0x%x): sta("MAC_FMT") pid = 0x%x\n", rx_pid, MAC_ARG(psta->hwaddr), psta->pid); - if (rx_pid == psta->pid) - { + if (rx_pid == psta->pid) { int i; u16 len = *(u16*)(skb->data+ETH_HLEN+2); /* u16 ctrl_type = *(u16*)(skb->data+ETH_HLEN+4); */ @@ -301,8 +264,7 @@ int rtw_recv_indicatepkt(struct adapter *padapter, union recv_frame *precv_frame pfree_recv_queue = &(precvpriv->free_recv_queue); skb = precv_frame->u.hdr.pkt; - if (skb == NULL) - { + if (skb == NULL) { RT_TRACE(_module_recv_osdep_c_, _drv_err_, ("rtw_recv_indicatepkt():skb == NULL something wrong!!!!\n")); goto _recv_indicatepkt_drop; } @@ -320,8 +282,7 @@ int rtw_recv_indicatepkt(struct adapter *padapter, union recv_frame *precv_frame RT_TRACE(_module_recv_osdep_c_, _drv_info_, ("\n skb->head =%p skb->data =%p skb->tail =%p skb->end =%p skb->len =%d\n", skb->head, skb->data, skb_tail_pointer(skb), skb_end_pointer(skb), skb->len)); #ifdef CONFIG_AUTO_AP_MODE - if (0x8899 == pattrib->eth_type) - { + if (0x8899 == pattrib->eth_type) { rtw_os_ksocket_send(padapter, precv_frame); /* goto _recv_indicatepkt_drop; */ @@ -336,7 +297,7 @@ int rtw_recv_indicatepkt(struct adapter *padapter, union recv_frame *precv_frame RT_TRACE(_module_recv_osdep_c_, _drv_info_, ("\n rtw_recv_indicatepkt :after rtw_os_recv_indicate_pkt!!!!\n")); - return _SUCCESS; + return _SUCCESS; _recv_indicatepkt_drop: |