1 /******************************************************************************
3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 ******************************************************************************/
15 #define _RECV_OSDEP_C_
17 #include <osdep_service.h>
18 #include <drv_types.h>
21 #include <recv_osdep.h>
23 #include <osdep_intf.h>
27 void rtw_handle_tkip_mic_err23a(struct rtw_adapter *padapter, u8 bgroup)
29 enum nl80211_key_type key_type = 0;
30 union iwreq_data wrqu;
31 struct iw_michaelmicfailure ev;
32 struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
33 struct security_priv *psecuritypriv = &padapter->securitypriv;
34 unsigned long cur_time;
36 if (psecuritypriv->last_mic_err_time == 0) {
37 psecuritypriv->last_mic_err_time = jiffies;
41 if (cur_time - psecuritypriv->last_mic_err_time < 60*HZ) {
42 psecuritypriv->btkip_countermeasure = true;
43 psecuritypriv->last_mic_err_time = 0;
44 psecuritypriv->btkip_countermeasure_time = cur_time;
46 psecuritypriv->last_mic_err_time = jiffies;
51 key_type |= NL80211_KEYTYPE_GROUP;
53 key_type |= NL80211_KEYTYPE_PAIRWISE;
55 cfg80211_michael_mic_failure(padapter->pnetdev,
56 (u8 *)&pmlmepriv->assoc_bssid[0],
57 key_type, -1, NULL, GFP_ATOMIC);
59 memset(&ev, 0x00, sizeof(ev));
61 ev.flags |= IW_MICFAILURE_GROUP;
63 ev.flags |= IW_MICFAILURE_PAIRWISE;
65 ev.src_addr.sa_family = ARPHRD_ETHER;
66 ether_addr_copy(ev.src_addr.sa_data, &pmlmepriv->assoc_bssid[0]);
68 memset(&wrqu, 0x00, sizeof(wrqu));
69 wrqu.data.length = sizeof(ev);
72 int rtw_recv_indicatepkt23a(struct rtw_adapter *padapter,
73 struct recv_frame *precv_frame)
75 struct recv_priv *precvpriv;
76 struct rtw_queue *pfree_recv_queue;
78 struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
80 precvpriv = &(padapter->recvpriv);
81 pfree_recv_queue = &(precvpriv->free_recv_queue);
83 skb = precv_frame->pkt;
85 RT_TRACE(_module_recv_osdep_c_, _drv_err_,
86 ("rtw_recv_indicatepkt23a():skb == NULL!!!!\n"));
87 goto _recv_indicatepkt_drop;
90 RT_TRACE(_module_recv_osdep_c_, _drv_info_,
91 ("rtw_recv_indicatepkt23a():skb != NULL !!!\n"));
92 RT_TRACE(_module_recv_osdep_c_, _drv_info_,
93 ("rtw_recv_indicatepkt23a():precv_frame->hdr.rx_data =%p\n",
94 precv_frame->pkt->data));
95 RT_TRACE(_module_recv_osdep_c_, _drv_info_,
96 ("\n skb->head =%p skb->data =%p skb->tail =%p skb->end =%p skb->len =%d\n",
98 skb_tail_pointer(skb), skb_end_pointer(skb), skb->len));
100 if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) {
101 struct sk_buff *pskb2 = NULL;
102 struct sta_info *psta = NULL;
103 struct sta_priv *pstapriv = &padapter->stapriv;
104 struct rx_pkt_attrib *pattrib = &precv_frame->attrib;
105 int bmcast = is_multicast_ether_addr(pattrib->dst);
107 /* DBG_8723A("bmcast =%d\n", bmcast); */
109 if (!ether_addr_equal(pattrib->dst,
110 myid(&padapter->eeprompriv))) {
111 /* DBG_8723A("not ap psta =%p, addr =%pM\n", psta, pattrib->dst); */
113 psta = rtw_get_bcmc_stainfo23a(padapter);
114 pskb2 = skb_clone(skb, GFP_ATOMIC);
116 psta = rtw_get_stainfo23a(pstapriv, pattrib->dst);
120 struct net_device *pnetdev = padapter->pnetdev;
122 /* DBG_8723A("directly forwarding to the rtw_xmit23a_entry23a\n"); */
124 /* skb->ip_summed = CHECKSUM_NONE; */
126 skb_set_queue_mapping(skb, rtw_recv_select_queue23a(skb));
128 rtw_xmit23a_entry23a(skb, pnetdev);
133 goto _recv_indicatepkt_end;
135 } else { /* to APself */
136 /* DBG_8723A("to APSelf\n"); */
140 skb->ip_summed = CHECKSUM_NONE;
141 skb->dev = padapter->pnetdev;
142 skb->protocol = eth_type_trans(skb, padapter->pnetdev);
146 _recv_indicatepkt_end:
148 precv_frame->pkt = NULL; /* pointers to NULL before rtw_free_recvframe23a() */
150 rtw_free_recvframe23a(precv_frame, pfree_recv_queue);
152 RT_TRACE(_module_recv_osdep_c_, _drv_info_,
153 ("\n rtw_recv_indicatepkt23a :after netif_rx!!!!\n"));
156 _recv_indicatepkt_drop:
158 rtw_free_recvframe23a(precv_frame, pfree_recv_queue);
162 void rtw_init_recv_timer23a(struct recv_reorder_ctrl *preorder_ctrl)
164 setup_timer(&preorder_ctrl->reordering_ctrl_timer,
165 rtw_reordering_ctrl_timeout_handler23a,
166 (unsigned long)preorder_ctrl);