]>
Commit | Line | Data |
---|---|---|
b1925ad8 LF |
1 | /****************************************************************************** |
2 | * | |
3 | * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. | |
4 | * | |
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. | |
8 | * | |
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 | |
12 | * more details. | |
13 | * | |
14 | ******************************************************************************/ | |
15 | #define _RECV_OSDEP_C_ | |
16 | ||
17 | #include <osdep_service.h> | |
18 | #include <drv_types.h> | |
19 | ||
20 | #include <wifi.h> | |
21 | #include <recv_osdep.h> | |
22 | ||
23 | #include <osdep_intf.h> | |
b1925ad8 LF |
24 | |
25 | #include <usb_ops.h> | |
26 | ||
b1925ad8 LF |
27 | void rtw_handle_tkip_mic_err23a(struct rtw_adapter *padapter, u8 bgroup) |
28 | { | |
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; | |
35 | ||
36 | if (psecuritypriv->last_mic_err_time == 0) { | |
37 | psecuritypriv->last_mic_err_time = jiffies; | |
38 | } else { | |
39 | cur_time = jiffies; | |
40 | ||
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; | |
45 | } else { | |
46 | psecuritypriv->last_mic_err_time = jiffies; | |
47 | } | |
48 | } | |
49 | ||
50 | if (bgroup) | |
51 | key_type |= NL80211_KEYTYPE_GROUP; | |
52 | else | |
53 | key_type |= NL80211_KEYTYPE_PAIRWISE; | |
54 | ||
55 | cfg80211_michael_mic_failure(padapter->pnetdev, | |
56 | (u8 *)&pmlmepriv->assoc_bssid[0], | |
57 | key_type, -1, NULL, GFP_ATOMIC); | |
58 | ||
59 | memset(&ev, 0x00, sizeof(ev)); | |
60 | if (bgroup) | |
61 | ev.flags |= IW_MICFAILURE_GROUP; | |
62 | else | |
63 | ev.flags |= IW_MICFAILURE_PAIRWISE; | |
64 | ||
65 | ev.src_addr.sa_family = ARPHRD_ETHER; | |
66 | ether_addr_copy(ev.src_addr.sa_data, &pmlmepriv->assoc_bssid[0]); | |
67 | ||
68 | memset(&wrqu, 0x00, sizeof(wrqu)); | |
69 | wrqu.data.length = sizeof(ev); | |
70 | } | |
71 | ||
b1925ad8 LF |
72 | int rtw_recv_indicatepkt23a(struct rtw_adapter *padapter, |
73 | struct recv_frame *precv_frame) | |
74 | { | |
75 | struct recv_priv *precvpriv; | |
b1925ad8 LF |
76 | struct sk_buff *skb; |
77 | struct mlme_priv *pmlmepriv = &padapter->mlmepriv; | |
78 | ||
c5779a0d | 79 | precvpriv = &padapter->recvpriv; |
b1925ad8 LF |
80 | |
81 | skb = precv_frame->pkt; | |
82 | if (!skb) { | |
83 | RT_TRACE(_module_recv_osdep_c_, _drv_err_, | |
90403aa1 | 84 | "rtw_recv_indicatepkt23a():skb == NULL!!!!\n"); |
b1925ad8 LF |
85 | goto _recv_indicatepkt_drop; |
86 | } | |
87 | ||
88 | RT_TRACE(_module_recv_osdep_c_, _drv_info_, | |
90403aa1 | 89 | "rtw_recv_indicatepkt23a():skb != NULL !!!\n"); |
b1925ad8 | 90 | RT_TRACE(_module_recv_osdep_c_, _drv_info_, |
90403aa1 JP |
91 | "rtw_recv_indicatepkt23a():precv_frame->hdr.rx_data =%p\n", |
92 | precv_frame->pkt->data); | |
b1925ad8 | 93 | RT_TRACE(_module_recv_osdep_c_, _drv_info_, |
90403aa1 JP |
94 | "skb->head =%p skb->data =%p skb->tail =%p skb->end =%p skb->len =%d\n", |
95 | skb->head, skb->data, | |
96 | skb_tail_pointer(skb), skb_end_pointer(skb), skb->len); | |
b1925ad8 LF |
97 | |
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); | |
104 | ||
105 | /* DBG_8723A("bmcast =%d\n", bmcast); */ | |
106 | ||
107 | if (!ether_addr_equal(pattrib->dst, | |
108 | myid(&padapter->eeprompriv))) { | |
109 | /* DBG_8723A("not ap psta =%p, addr =%pM\n", psta, pattrib->dst); */ | |
110 | if (bmcast) { | |
111 | psta = rtw_get_bcmc_stainfo23a(padapter); | |
112 | pskb2 = skb_clone(skb, GFP_ATOMIC); | |
113 | } else { | |
114 | psta = rtw_get_stainfo23a(pstapriv, pattrib->dst); | |
115 | } | |
116 | ||
117 | if (psta) { | |
118 | struct net_device *pnetdev = padapter->pnetdev; | |
119 | ||
120 | /* DBG_8723A("directly forwarding to the rtw_xmit23a_entry23a\n"); */ | |
121 | ||
122 | /* skb->ip_summed = CHECKSUM_NONE; */ | |
123 | skb->dev = pnetdev; | |
124 | skb_set_queue_mapping(skb, rtw_recv_select_queue23a(skb)); | |
125 | ||
126 | rtw_xmit23a_entry23a(skb, pnetdev); | |
127 | ||
128 | if (bmcast) | |
129 | skb = pskb2; | |
130 | else | |
131 | goto _recv_indicatepkt_end; | |
132 | } | |
133 | } else { /* to APself */ | |
134 | /* DBG_8723A("to APSelf\n"); */ | |
135 | } | |
136 | } | |
137 | ||
138 | skb->ip_summed = CHECKSUM_NONE; | |
139 | skb->dev = padapter->pnetdev; | |
140 | skb->protocol = eth_type_trans(skb, padapter->pnetdev); | |
141 | ||
142 | netif_rx(skb); | |
143 | ||
144 | _recv_indicatepkt_end: | |
145 | ||
146 | precv_frame->pkt = NULL; /* pointers to NULL before rtw_free_recvframe23a() */ | |
147 | ||
c5779a0d | 148 | rtw_free_recvframe23a(precv_frame); |
b1925ad8 LF |
149 | |
150 | RT_TRACE(_module_recv_osdep_c_, _drv_info_, | |
90403aa1 | 151 | "rtw_recv_indicatepkt23a :after netif_rx!!!!\n"); |
b1925ad8 LF |
152 | return _SUCCESS; |
153 | ||
154 | _recv_indicatepkt_drop: | |
155 | ||
c5779a0d | 156 | rtw_free_recvframe23a(precv_frame); |
b1925ad8 LF |
157 | return _FAIL; |
158 | } | |
159 | ||
b1925ad8 LF |
160 | void rtw_init_recv_timer23a(struct recv_reorder_ctrl *preorder_ctrl) |
161 | { | |
162 | setup_timer(&preorder_ctrl->reordering_ctrl_timer, | |
163 | rtw_reordering_ctrl_timeout_handler23a, | |
164 | (unsigned long)preorder_ctrl); | |
165 | } |