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;
|
|
|
|
|
2015-08-15 18:06:32 +00:00
|
|
|
for (i=0; i < NR_RECVFRAME; i++)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
2015-08-15 18:02:34 +00:00
|
|
|
if (precvframe->u.hdr.pkt)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
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);
|
2015-08-15 18:24:16 +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
|
|
|
|
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;
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (precvbuf->purb)
|
2013-05-08 21:45:39 +00:00
|
|
|
usb_free_urb(precvbuf->purb);
|
2015-08-15 18:02:34 +00:00
|
|
|
if (precvbuf->pskb)
|
2014-12-17 01:03:30 +00:00
|
|
|
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-08-15 18:02:34 +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-08-15 18:02:34 +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
|
2015-03-16 13:54:18 +00:00
|
|
|
struct sk_buff *skb;
|
2014-12-17 01:03:30 +00:00
|
|
|
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); */
|
2015-08-15 18:02:34 +00:00
|
|
|
/* 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;
|
2015-03-16 13:54:18 +00:00
|
|
|
struct __queue *pfree_recv_queue;
|
|
|
|
struct sk_buff *skb;
|
2014-12-17 01:03:30 +00:00
|
|
|
struct mlme_priv*pmlmepriv = &padapter->mlmepriv;
|
|
|
|
#ifdef CONFIG_BR_EXT
|
|
|
|
void *br_port = NULL;
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
|
|
2015-03-10 16:18:03 +00:00
|
|
|
if (!precv_frame)
|
|
|
|
goto _recv_indicatepkt_drop;
|
2013-05-08 21:45:39 +00:00
|
|
|
skb = precv_frame->u.hdr.pkt;
|
2015-08-15 18:02:34 +00:00
|
|
|
if (skb == NULL)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
2015-08-15 18:22:58 +00:00
|
|
|
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));
|
2015-08-15 18:00:19 +00:00
|
|
|
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
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
2015-08-15 18:31:56 +00:00
|
|
|
struct sk_buff *pskb2= NULL;
|
2014-12-19 06:59:46 +00:00
|
|
|
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
|
|
|
|
2015-08-15 18:02:34 +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
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (bmcast)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
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);
|
|
|
|
}
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (psta)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
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
|
|
|
|
2015-08-15 18:02:34 +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
|
|
|
|
2015-08-15 18:02:34 +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) {
|
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 */
|
2013-05-08 21:45:39 +00:00
|
|
|
skb->ip_summed = CHECKSUM_NONE;
|
2014-12-17 01:03:30 +00:00
|
|
|
|
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);
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (bmcast)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
2015-08-15 18:02:34 +00:00
|
|
|
if (psta)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
2015-08-15 18:05:44 +00:00
|
|
|
switch (pattrib->priority)
|
2014-12-17 01:03:30 +00:00
|
|
|
{
|
|
|
|
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 */
|
2015-08-15 18:02:34 +00:00
|
|
|
if (precv_frame)
|
2014-12-17 01:03:30 +00:00
|
|
|
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
|
|
|
|
2015-08-15 18:02:34 +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
|
|
|
}
|