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;
77 struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
79 precvpriv = &padapter->recvpriv;
81 skb = precv_frame->pkt;
83 RT_TRACE(_module_recv_osdep_c_, _drv_err_,
84 "rtw_recv_indicatepkt23a():skb == NULL!!!!\n");
85 goto _recv_indicatepkt_drop;
88 RT_TRACE(_module_recv_osdep_c_, _drv_info_,
89 "rtw_recv_indicatepkt23a():skb != NULL !!!\n");
90 RT_TRACE(_module_recv_osdep_c_, _drv_info_,
91 "rtw_recv_indicatepkt23a():precv_frame->hdr.rx_data =%p\n",
92 precv_frame->pkt->data);
93 RT_TRACE(_module_recv_osdep_c_, _drv_info_,
94 "skb->head =%p skb->data =%p skb->tail =%p skb->end =%p skb->len =%d\n",
96 skb_tail_pointer(skb), skb_end_pointer(skb), skb->len);
98 if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) {
99 struct sk_buff *pskb2 = NULL;
100 struct sta_info *psta = NULL;
101 struct sta_priv *pstapriv = &padapter->stapriv;
102 struct rx_pkt_attrib *pattrib = &precv_frame->attrib;
103 int bmcast = is_multicast_ether_addr(pattrib->dst);
105 /* DBG_8723A("bmcast =%d\n", bmcast); */
107 if (!ether_addr_equal(pattrib->dst,
108 myid(&padapter->eeprompriv))) {
109 /* DBG_8723A("not ap psta =%p, addr =%pM\n", psta, pattrib->dst); */
111 psta = rtw_get_bcmc_stainfo23a(padapter);
112 pskb2 = skb_clone(skb, GFP_ATOMIC);
114 psta = rtw_get_stainfo23a(pstapriv, pattrib->dst);
118 struct net_device *pnetdev = padapter->pnetdev;
120 /* DBG_8723A("directly forwarding to the rtw_xmit23a_entry23a\n"); */
122 /* skb->ip_summed = CHECKSUM_NONE; */
124 skb_set_queue_mapping(skb, rtw_recv_select_queue23a(skb));
126 rtw_xmit23a_entry23a(skb, pnetdev);
131 goto _recv_indicatepkt_end;
133 } else { /* to APself */
134 /* DBG_8723A("to APSelf\n"); */
138 skb->ip_summed = CHECKSUM_NONE;
139 skb->dev = padapter->pnetdev;
140 skb->protocol = eth_type_trans(skb, padapter->pnetdev);
144 _recv_indicatepkt_end:
146 precv_frame->pkt = NULL; /* pointers to NULL before rtw_free_recvframe23a() */
148 rtw_free_recvframe23a(precv_frame);
150 RT_TRACE(_module_recv_osdep_c_, _drv_info_,
151 "rtw_recv_indicatepkt23a :after netif_rx!!!!\n");
154 _recv_indicatepkt_drop:
156 rtw_free_recvframe23a(precv_frame);
160 void rtw_init_recv_timer23a(struct recv_reorder_ctrl *preorder_ctrl)
162 setup_timer(&preorder_ctrl->reordering_ctrl_timer,
163 rtw_reordering_ctrl_timeout_handler23a,
164 (unsigned long)preorder_ctrl);