2013-05-08 21:45:39 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of version 2 of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
|
|
|
*
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
#define _RECV_OSDEP_C_
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
#include <drv_conf.h>
|
2013-05-08 21:45:39 +00:00
|
|
|
#include <osdep_service.h>
|
|
|
|
#include <drv_types.h>
|
|
|
|
|
|
|
|
#include <wifi.h>
|
|
|
|
#include <recv_osdep.h>
|
|
|
|
|
|
|
|
#include <osdep_intf.h>
|
|
|
|
#include <ethernet.h>
|
|
|
|
#include <usb_ops.h>
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* init os related resource in struct recv_priv */
|
2014-12-17 23:13:53 +00:00
|
|
|
int rtw_os_recv_resource_init(struct recv_priv *precvpriv, struct adapter *padapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
int res=_SUCCESS;
|
|
|
|
|
|
|
|
return res;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* alloc os related resource in union recv_frame */
|
2014-12-17 23:13:53 +00:00
|
|
|
int rtw_os_recv_resource_alloc(struct adapter *padapter, union recv_frame *precvframe)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
int res=_SUCCESS;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
precvframe->u.hdr.pkt_newalloc = precvframe->u.hdr.pkt = NULL;
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* free os related resource in union recv_frame */
|
2013-05-08 21:45:39 +00:00
|
|
|
void rtw_os_recv_resource_free(struct recv_priv *precvpriv)
|
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
sint i;
|
|
|
|
union recv_frame *precvframe;
|
|
|
|
precvframe = (union recv_frame*) precvpriv->precv_frame_buf;
|
|
|
|
|
|
|
|
for(i=0; i < NR_RECVFRAME; i++)
|
|
|
|
{
|
|
|
|
if(precvframe->u.hdr.pkt)
|
|
|
|
{
|
2015-02-20 04:11:26 +00:00
|
|
|
rtw_skb_free(precvframe->u.hdr.pkt);/* free skb by driver */
|
2014-12-17 01:03:30 +00:00
|
|
|
precvframe->u.hdr.pkt = NULL;
|
|
|
|
}
|
|
|
|
precvframe++;
|
|
|
|
}
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* alloc os related resource in struct recv_buf */
|
2014-12-17 23:13:53 +00:00
|
|
|
int rtw_os_recvbuf_resource_alloc(struct adapter *padapter, struct recv_buf *precvbuf)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
int res=_SUCCESS;
|
|
|
|
|
|
|
|
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
|
|
|
|
struct usb_device *pusbd = pdvobjpriv->pusbdev;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
precvbuf->irp_pending = false;
|
2013-05-08 21:45:39 +00:00
|
|
|
precvbuf->purb = usb_alloc_urb(0, GFP_KERNEL);
|
2014-12-17 01:03:30 +00:00
|
|
|
if(precvbuf->purb == NULL){
|
2013-05-08 21:45:39 +00:00
|
|
|
res = _FAIL;
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
precvbuf->pskb = NULL;
|
2014-12-17 01:03:30 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
precvbuf->reuse = false;
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
precvbuf->pallocated_buf = precvbuf->pbuf = NULL;
|
|
|
|
|
|
|
|
precvbuf->pdata = precvbuf->phead = precvbuf->ptail = precvbuf->pend = NULL;
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
precvbuf->transfer_len = 0;
|
2014-12-17 01:03:30 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
precvbuf->len = 0;
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX
|
|
|
|
precvbuf->pallocated_buf = rtw_usb_buffer_alloc(pusbd, (size_t)precvbuf->alloc_sz, &precvbuf->dma_transfer_addr);
|
|
|
|
precvbuf->pbuf = precvbuf->pallocated_buf;
|
|
|
|
if(precvbuf->pallocated_buf == NULL)
|
|
|
|
return _FAIL;
|
2015-02-20 04:11:26 +00:00
|
|
|
#endif /* CONFIG_USE_USB_BUFFER_ALLOC_RX */
|
2013-05-08 21:45:39 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* free os related resource in struct recv_buf */
|
2014-12-17 23:13:53 +00:00
|
|
|
int rtw_os_recvbuf_resource_free(struct adapter *padapter, struct recv_buf *precvbuf)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
int ret = _SUCCESS;
|
|
|
|
|
|
|
|
#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX
|
|
|
|
|
|
|
|
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
|
|
|
|
struct usb_device *pusbd = pdvobjpriv->pusbdev;
|
|
|
|
|
|
|
|
rtw_usb_buffer_free(pusbd, (size_t)precvbuf->alloc_sz, precvbuf->pallocated_buf, precvbuf->dma_transfer_addr);
|
|
|
|
precvbuf->pallocated_buf = NULL;
|
|
|
|
precvbuf->dma_transfer_addr = 0;
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
#endif /* CONFIG_USE_USB_BUFFER_ALLOC_RX */
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
if(precvbuf->purb)
|
|
|
|
{
|
2015-02-20 04:11:26 +00:00
|
|
|
/* usb_kill_urb(precvbuf->purb); */
|
2013-05-08 21:45:39 +00:00
|
|
|
usb_free_urb(precvbuf->purb);
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
|
|
|
if(precvbuf->pskb)
|
|
|
|
rtw_skb_free(precvbuf->pskb);
|
|
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_handle_tkip_mic_err(struct adapter *padapter,u8 bgroup)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
enum nl80211_key_type key_type;
|
2013-05-08 21:45:39 +00:00
|
|
|
union iwreq_data wrqu;
|
|
|
|
struct iw_michaelmicfailure ev;
|
2014-12-17 01:03:30 +00:00
|
|
|
struct mlme_priv* pmlmepriv = &padapter->mlmepriv;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct security_priv *psecuritypriv = &padapter->securitypriv;
|
2013-05-08 21:45:39 +00:00
|
|
|
u32 cur_time = 0;
|
|
|
|
|
2015-02-20 04:52:01 +00:00
|
|
|
if( psecuritypriv->last_mic_err_time == 0 ) {
|
2013-05-08 21:45:39 +00:00
|
|
|
psecuritypriv->last_mic_err_time = rtw_get_current_time();
|
2015-02-20 04:52:01 +00:00
|
|
|
} else {
|
2013-05-08 21:45:39 +00:00
|
|
|
cur_time = rtw_get_current_time();
|
|
|
|
|
2015-02-20 04:52:01 +00:00
|
|
|
if( cur_time - psecuritypriv->last_mic_err_time < 60*HZ ) {
|
2014-12-29 02:13:24 +00:00
|
|
|
psecuritypriv->btkip_countermeasure = true;
|
2013-05-08 21:45:39 +00:00
|
|
|
psecuritypriv->last_mic_err_time = 0;
|
|
|
|
psecuritypriv->btkip_countermeasure_time = cur_time;
|
2015-02-20 04:52:01 +00:00
|
|
|
} else {
|
2013-05-08 21:45:39 +00:00
|
|
|
psecuritypriv->last_mic_err_time = rtw_get_current_time();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
if ( bgroup )
|
|
|
|
key_type |= NL80211_KEYTYPE_GROUP;
|
|
|
|
else
|
|
|
|
key_type |= NL80211_KEYTYPE_PAIRWISE;
|
|
|
|
|
|
|
|
cfg80211_michael_mic_failure(padapter->pnetdev, (u8 *)&pmlmepriv->assoc_bssid[ 0 ], key_type, -1,
|
|
|
|
NULL, GFP_ATOMIC);
|
|
|
|
|
2015-02-19 20:58:09 +00:00
|
|
|
memset( &ev, 0x00, sizeof( ev ) );
|
2014-12-17 01:03:30 +00:00
|
|
|
if ( bgroup )
|
|
|
|
ev.flags |= IW_MICFAILURE_GROUP;
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-17 01:03:30 +00:00
|
|
|
ev.flags |= IW_MICFAILURE_PAIRWISE;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
ev.src_addr.sa_family = ARPHRD_ETHER;
|
2015-02-19 20:50:04 +00:00
|
|
|
memcpy( ev.src_addr.sa_data, &pmlmepriv->assoc_bssid[ 0 ], ETH_ALEN );
|
2014-12-17 01:03:30 +00:00
|
|
|
|
2015-02-19 20:58:09 +00:00
|
|
|
memset( &wrqu, 0x00, sizeof( wrqu ) );
|
2014-12-17 01:03:30 +00:00
|
|
|
wrqu.data.length = sizeof( ev );
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_hostapd_mlme_rx(struct adapter *padapter, union recv_frame *precv_frame)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifdef CONFIG_HOSTAPD_MLME
|
|
|
|
_pkt *skb;
|
|
|
|
struct hostapd_priv *phostapdpriv = padapter->phostapdpriv;
|
|
|
|
struct net_device *pmgnt_netdev = phostapdpriv->pmgnt_netdev;
|
|
|
|
|
|
|
|
RT_TRACE(_module_recv_osdep_c_, _drv_info_, ("+rtw_hostapd_mlme_rx\n"));
|
|
|
|
|
|
|
|
skb = precv_frame->u.hdr.pkt;
|
|
|
|
|
|
|
|
if (skb == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
skb->data = precv_frame->u.hdr.rx_data;
|
|
|
|
skb->tail = precv_frame->u.hdr.rx_tail;
|
|
|
|
skb->len = precv_frame->u.hdr.len;
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* pskb_copy = rtw_skb_copy(skb); */
|
|
|
|
/* if(skb == NULL) goto _exit; */
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
skb->dev = pmgnt_netdev;
|
|
|
|
skb->ip_summed = CHECKSUM_NONE;
|
|
|
|
skb->pkt_type = PACKET_OTHERHOST;
|
|
|
|
skb->protocol = __constant_htons(0x0003); /*ETH_P_80211_RAW*/
|
|
|
|
|
|
|
|
skb_reset_mac_header(skb);
|
|
|
|
|
2015-02-19 20:58:09 +00:00
|
|
|
memset(skb->cb, 0, sizeof(skb->cb));
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
rtw_netif_rx(pmgnt_netdev, skb);
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
precv_frame->u.hdr.pkt = NULL; /* set pointer to NULL before rtw_free_recvframe() if call rtw_netif_rx() */
|
2014-12-17 01:03:30 +00:00
|
|
|
#endif
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
int rtw_recv_indicatepkt(struct adapter *padapter, union recv_frame *precv_frame)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
struct recv_priv *precvpriv;
|
2014-12-17 01:03:30 +00:00
|
|
|
_queue *pfree_recv_queue;
|
|
|
|
_pkt *skb;
|
|
|
|
struct mlme_priv*pmlmepriv = &padapter->mlmepriv;
|
|
|
|
#ifdef CONFIG_TCP_CSUM_OFFLOAD_RX
|
|
|
|
struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_BR_EXT
|
|
|
|
void *br_port = NULL;
|
|
|
|
#endif
|
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
precvpriv = &(padapter->recvpriv);
|
|
|
|
pfree_recv_queue = &(precvpriv->free_recv_queue);
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifdef CONFIG_DRVEXT_MODULE
|
|
|
|
if (drvext_rx_handler(padapter, precv_frame->u.hdr.rx_data, precv_frame->u.hdr.len) == _SUCCESS)
|
|
|
|
{
|
|
|
|
goto _recv_indicatepkt_drop;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_WAPI_SUPPORT
|
|
|
|
if (rtw_wapi_check_for_drop(padapter,precv_frame))
|
|
|
|
{
|
|
|
|
WAPI_TRACE(WAPI_ERR, "%s(): Rx Reorder Drop case!!\n", __FUNCTION__);
|
|
|
|
goto _recv_indicatepkt_drop;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
skb = precv_frame->u.hdr.pkt;
|
2014-12-17 01:03:30 +00:00
|
|
|
if(skb == NULL)
|
|
|
|
{
|
|
|
|
RT_TRACE(_module_recv_osdep_c_,_drv_err_,("rtw_recv_indicatepkt():skb==NULL something wrong!!!!\n"));
|
2013-05-08 21:45:39 +00:00
|
|
|
goto _recv_indicatepkt_drop;
|
|
|
|
}
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
RT_TRACE(_module_recv_osdep_c_,_drv_info_,("rtw_recv_indicatepkt():skb != NULL !!!\n"));
|
2014-12-17 01:03:30 +00:00
|
|
|
RT_TRACE(_module_recv_osdep_c_,_drv_info_,("rtw_recv_indicatepkt():precv_frame->u.hdr.rx_head=%p precv_frame->hdr.rx_data=%p\n", precv_frame->u.hdr.rx_head, precv_frame->u.hdr.rx_data));
|
|
|
|
RT_TRACE(_module_recv_osdep_c_,_drv_info_,("precv_frame->hdr.rx_tail=%p precv_frame->u.hdr.rx_end=%p precv_frame->hdr.len=%d \n", precv_frame->u.hdr.rx_tail, precv_frame->u.hdr.rx_end, precv_frame->u.hdr.len));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
skb->data = precv_frame->u.hdr.rx_data;
|
|
|
|
|
|
|
|
skb_set_tail_pointer(skb, precv_frame->u.hdr.len);
|
|
|
|
|
|
|
|
skb->len = precv_frame->u.hdr.len;
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
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, skb->end, skb->len));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == true)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
_pkt *pskb2=NULL;
|
|
|
|
struct sta_info *psta = NULL;
|
|
|
|
struct sta_priv *pstapriv = &padapter->stapriv;
|
2013-05-08 21:45:39 +00:00
|
|
|
struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
|
|
|
|
int bmcast = IS_MCAST(pattrib->dst);
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* DBG_871X("bmcast=%d\n", bmcast); */
|
2014-12-17 01:03:30 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
if(_rtw_memcmp(pattrib->dst, myid(&padapter->eeprompriv), ETH_ALEN)==false)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
2015-02-20 04:11:26 +00:00
|
|
|
/* DBG_871X("not ap psta=%p, addr=%pM\n", psta, pattrib->dst); */
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
if(bmcast)
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
psta = rtw_get_bcmc_stainfo(padapter);
|
2014-12-17 01:03:30 +00:00
|
|
|
pskb2 = rtw_skb_clone(skb);
|
2013-05-08 21:45:39 +00:00
|
|
|
} else {
|
|
|
|
psta = rtw_get_stainfo(pstapriv, pattrib->dst);
|
|
|
|
}
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
if(psta)
|
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
struct net_device *pnetdev= (struct net_device*)padapter->pnetdev;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* DBG_871X("directly forwarding to the rtw_xmit_entry\n"); */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* skb->ip_summed = CHECKSUM_NONE; */
|
2014-12-19 06:59:46 +00:00
|
|
|
skb->dev = pnetdev;
|
2014-12-17 01:03:30 +00:00
|
|
|
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35))
|
2014-12-28 00:06:03 +00:00
|
|
|
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0))
|
2014-12-17 01:03:30 +00:00
|
|
|
skb_set_queue_mapping(skb, rtw_recv_select_queue(skb));
|
2014-12-28 00:06:03 +00:00
|
|
|
#else
|
|
|
|
skb_set_queue_mapping(skb, rtw_recv_select_queue(skb,
|
|
|
|
NULL, NULL));
|
|
|
|
#endif
|
2015-02-20 04:11:26 +00:00
|
|
|
#endif /* LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35) */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
_rtw_xmit_entry(skb, pnetdev);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
if(bmcast)
|
2013-05-08 21:45:39 +00:00
|
|
|
skb = pskb2;
|
|
|
|
else
|
|
|
|
goto _recv_indicatepkt_end;
|
|
|
|
}
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
}
|
2015-02-20 04:11:26 +00:00
|
|
|
else/* to APself */
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
2015-02-20 04:11:26 +00:00
|
|
|
/* DBG_871X("to APSelf\n"); */
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifdef CONFIG_BR_EXT
|
|
|
|
|
|
|
|
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35))
|
|
|
|
br_port = padapter->pnetdev->br_port;
|
2015-02-20 04:11:26 +00:00
|
|
|
#else /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) */
|
2013-05-08 21:45:39 +00:00
|
|
|
rcu_read_lock();
|
2014-12-17 01:03:30 +00:00
|
|
|
br_port = rcu_dereference(padapter->pnetdev->rx_handler_data);
|
|
|
|
rcu_read_unlock();
|
2015-02-20 04:11:26 +00:00
|
|
|
#endif /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) */
|
2014-12-17 01:03:30 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
if( br_port && (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) == true) )
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
2014-12-17 23:13:53 +00:00
|
|
|
int nat25_handle_frame(struct adapter *priv, struct sk_buff *skb);
|
2014-12-17 01:03:30 +00:00
|
|
|
if (nat25_handle_frame(padapter, skb) == -1) {
|
2015-02-20 04:11:26 +00:00
|
|
|
/* priv->ext_stats.rx_data_drops++; */
|
|
|
|
/* DEBUG_ERR("RX DROP: nat25_handle_frame fail!\n"); */
|
|
|
|
/* return FAIL; */
|
2014-12-19 06:59:46 +00:00
|
|
|
#if 1
|
2015-02-20 04:11:26 +00:00
|
|
|
/* bypass this frame to upper layer!! */
|
2014-02-12 17:05:30 +00:00
|
|
|
#else
|
2014-12-17 01:03:30 +00:00
|
|
|
goto _recv_indicatepkt_drop;
|
2014-02-12 17:05:30 +00:00
|
|
|
#endif
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
#endif /* CONFIG_BR_EXT */
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
#ifdef CONFIG_TCP_CSUM_OFFLOAD_RX
|
|
|
|
if ( (pattrib->tcpchk_valid == 1) && (pattrib->tcp_chkrpt == 1) ) {
|
|
|
|
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
2015-02-20 04:11:26 +00:00
|
|
|
/* DBG_871X("CHECKSUM_UNNECESSARY \n"); */
|
2014-12-17 01:03:30 +00:00
|
|
|
} else {
|
|
|
|
skb->ip_summed = CHECKSUM_NONE;
|
2015-02-20 04:11:26 +00:00
|
|
|
/* DBG_871X("CHECKSUM_NONE(%d, %d) \n", pattrib->tcpchk_valid, pattrib->tcp_chkrpt); */
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
|
|
|
#else /* !CONFIG_TCP_CSUM_OFFLOAD_RX */
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
skb->ip_summed = CHECKSUM_NONE;
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
skb->dev = padapter->pnetdev;
|
|
|
|
skb->protocol = eth_type_trans(skb, padapter->pnetdev);
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
#ifdef DBG_TRX_STA_PKTS
|
|
|
|
{
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
struct sta_info *psta = NULL;
|
2014-12-19 06:59:46 +00:00
|
|
|
struct sta_priv *pstapriv = &padapter->stapriv;
|
2014-12-17 01:03:30 +00:00
|
|
|
struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
|
|
|
|
int bmcast = IS_MCAST(pattrib->dst);
|
|
|
|
|
|
|
|
if(bmcast)
|
|
|
|
{
|
|
|
|
psta = rtw_get_bcmc_stainfo(padapter);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
} else {
|
|
|
|
psta = rtw_get_stainfo(pstapriv, pattrib->src);
|
|
|
|
}
|
|
|
|
if(psta)
|
|
|
|
{
|
|
|
|
switch(pattrib->priority)
|
|
|
|
{
|
|
|
|
case 1:
|
2014-12-19 06:59:46 +00:00
|
|
|
case 2:
|
2014-12-17 01:03:30 +00:00
|
|
|
psta->rx_bk_cnt++;
|
|
|
|
break;
|
|
|
|
case 4:
|
2014-12-19 06:59:46 +00:00
|
|
|
case 5:
|
2014-12-17 01:03:30 +00:00
|
|
|
psta->rx_vi_cnt++;
|
|
|
|
break;
|
|
|
|
case 6:
|
2014-12-19 06:59:46 +00:00
|
|
|
case 7:
|
2014-12-17 01:03:30 +00:00
|
|
|
psta->rx_vo_cnt++;
|
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
case 3:
|
2014-12-19 06:59:46 +00:00
|
|
|
default:
|
2014-12-17 01:03:30 +00:00
|
|
|
psta->rx_be_cnt++;
|
2014-12-19 06:59:46 +00:00
|
|
|
break;
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
2014-12-17 01:03:30 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
rtw_netif_rx(padapter->pnetdev, skb);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
_recv_indicatepkt_end:
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
precv_frame->u.hdr.pkt = NULL; /* pointers to NULL before rtw_free_recvframe() */
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
rtw_free_recvframe(precv_frame, pfree_recv_queue);
|
|
|
|
|
2014-12-17 01:03:30 +00:00
|
|
|
RT_TRACE(_module_recv_osdep_c_,_drv_info_,("\n rtw_recv_indicatepkt :after rtw_netif_rx!!!!\n"));
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2014-12-17 01:03:30 +00:00
|
|
|
|
|
|
|
return _SUCCESS;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
_recv_indicatepkt_drop:
|
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* enqueue back to free_recv_queue */
|
2014-12-17 01:03:30 +00:00
|
|
|
if(precv_frame)
|
|
|
|
rtw_free_recvframe(precv_frame, pfree_recv_queue);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-08-11 03:17:11 +00:00
|
|
|
return _FAIL;
|
2014-12-17 01:03:30 +00:00
|
|
|
|
2015-01-26 22:20:25 +00:00
|
|
|
;
|
2014-12-17 01:03:30 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void rtw_os_read_port(struct adapter *padapter, struct recv_buf *precvbuf)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
struct recv_priv *precvpriv = &padapter->recvpriv;
|
|
|
|
|
|
|
|
precvbuf->ref_cnt--;
|
2014-12-17 01:03:30 +00:00
|
|
|
|
2015-02-20 04:11:26 +00:00
|
|
|
/* free skb in recv_buf */
|
2014-12-17 01:03:30 +00:00
|
|
|
rtw_skb_free(precvbuf->pskb);
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
precvbuf->pskb = NULL;
|
2014-12-29 02:13:24 +00:00
|
|
|
precvbuf->reuse = false;
|
2014-12-17 01:03:30 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
if(precvbuf->irp_pending == false)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
|
|
|
rtw_read_port(padapter, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf);
|
|
|
|
}
|
|
|
|
}
|
2014-12-28 17:13:03 +00:00
|
|
|
|
2015-01-29 21:27:28 +00:00
|
|
|
static void _rtw_reordering_ctrl_timeout_handler (void *FunctionContext)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
|
|
|
struct recv_reorder_ctrl *preorder_ctrl = (struct recv_reorder_ctrl *)FunctionContext;
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_reordering_ctrl_timeout_handler(preorder_ctrl);
|
|
|
|
}
|
|
|
|
|
|
|
|
void rtw_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl)
|
|
|
|
{
|
2014-12-17 23:13:53 +00:00
|
|
|
struct adapter *padapter = preorder_ctrl->padapter;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
_init_timer(&(preorder_ctrl->reordering_ctrl_timer), padapter->pnetdev, _rtw_reordering_ctrl_timeout_handler, preorder_ctrl);
|
2014-12-17 01:03:30 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|