Debian Codegraph @

patches/old/rtl8187_2.6.20v4.patch

raw
1 diff -Naur rtl8187_orig/beta-8187/ieee80211.h rtl8187_rawtx/beta-8187/ieee80211.h
2 --- rtl8187_orig/beta-8187/ieee80211.h 2007-03-13 23:45:09.000000000 +0100
3 +++ rtl8187_rawtx/beta-8187/ieee80211.h 2007-05-26 10:37:51.000000000 +0200
4 @@ -156,6 +156,22 @@
5 struct list_head list;
6 };
7
8 +#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
9 +/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
10 + * (from linux-wlan-ng) */
11 +struct linux_wlan_ng_val {
12 + u32 did;
13 + u16 status, len;
14 + u32 data;
15 +} __attribute__ ((packed));
16 +
17 +struct linux_wlan_ng_prism_hdr {
18 + u32 msgcode, msglen;
19 + char devname[16];
20 + struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
21 + noise, rate, istx, frmlen;
22 +} __attribute__ ((packed));
23 +
24 struct ieee80211_hdr {
25 u16 frame_ctl;
26 u16 duration_id;
27 @@ -840,14 +856,14 @@
28
29
30 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
31 -extern inline int is_multicast_ether_addr(const u8 *addr)
32 +extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
33 {
34 return ((addr[0] != 0xff) && (0x01 & addr[0]));
35 }
36 #endif
37
38 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
39 -extern inline int is_broadcast_ether_addr(const u8 *addr)
40 +extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
41 {
42 return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
43 (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
44 @@ -1015,10 +1031,16 @@
45 struct timer_list beacon_timer;
46
47 struct work_struct associate_complete_wq;
48 +
49 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
50 + struct delayed_work associate_retry_wq;
51 + struct delayed_work softmac_scan_wq;
52 +#else
53 struct work_struct associate_retry_wq;
54 + struct work_struct softmac_scan_wq;
55 +#endif
56 struct work_struct start_ibss_wq;
57 struct work_struct associate_procedure_wq;
58 - struct work_struct softmac_scan_wq;
59 struct work_struct wx_sync_scan_wq;
60
61 struct workqueue_struct *wq;
62 @@ -1154,12 +1176,12 @@
63
64
65
66 -extern inline void *ieee80211_priv(struct net_device *dev)
67 +extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
68 {
69 return ((struct ieee80211_device *)netdev_priv(dev))->priv;
70 }
71
72 -extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
73 +extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
74 {
75 /* Single white space is for Linksys APs */
76 if (essid_len == 1 && essid[0] == ' ')
77 @@ -1175,7 +1197,7 @@
78 return 1;
79 }
80
81 -extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
82 +extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
83 {
84 /*
85 * It is possible for both access points and our device to support
86 @@ -1201,7 +1223,7 @@
87 return 0;
88 }
89
90 -extern inline int ieee80211_get_hdrlen(u16 fc)
91 +extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
92 {
93 int hdrlen = 24;
94
95 @@ -1229,140 +1251,144 @@
96
97
98 /* ieee80211.c */
99 -extern void free_ieee80211(struct net_device *dev);
100 -extern struct net_device *alloc_ieee80211(int sizeof_priv);
101 +extern void free_ieee80211_rtl7(struct net_device *dev);
102 +extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
103
104 -extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
105 +extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
106
107 /* ieee80211_tx.c */
108
109 -extern int ieee80211_encrypt_fragment(
110 +extern int ieee80211_encrypt_fragment_rtl7(
111 struct ieee80211_device *ieee,
112 struct sk_buff *frag,
113 int hdr_len);
114
115 -extern int ieee80211_xmit(struct sk_buff *skb,
116 +extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
117 struct net_device *dev);
118 -extern void ieee80211_txb_free(struct ieee80211_txb *);
119 +extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
120
121
122 /* ieee80211_rx.c */
123 -extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
124 +extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
125 struct ieee80211_rx_stats *rx_stats);
126 -extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
127 +extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
128 struct ieee80211_hdr *header,
129 struct ieee80211_rx_stats *stats);
130
131 /* ieee80211_wx.c */
132 -extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
133 +extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
134 struct iw_request_info *info,
135 union iwreq_data *wrqu, char *key);
136 -extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
137 +extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
138 struct iw_request_info *info,
139 union iwreq_data *wrqu, char *key);
140 -extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
141 +extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
142 struct iw_request_info *info,
143 union iwreq_data *wrqu, char *key);
144 /* ieee80211_softmac.c */
145 -extern short ieee80211_is_54g(struct ieee80211_network net);
146 -extern short ieee80211_is_shortslot(struct ieee80211_network net);
147 -extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
148 +extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
149 +extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
150 +extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
151 struct ieee80211_rx_stats *rx_stats, u16 type,
152 u16 stype);
153 -extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
154 +extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
155
156 -extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
157 -extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
158 -extern void ieee80211_start_bss(struct ieee80211_device *ieee);
159 -extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
160 -extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
161 -extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
162 -extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
163 -extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
164 -extern void ieee80211_disassociate(struct ieee80211_device *ieee);
165 -extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
166 -extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
167 -extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
168 -extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
169 -extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
170 -extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
171 -extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
172 -extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
173 -extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
174 -extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
175 -extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
176 -extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
177 -extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
178 -extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
179 -extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
180 -extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
181 +extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
182 +extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
183 +extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
184 +extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
185 +extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
186 +extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
187 +extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
188 +extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
189 +extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
190 +extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
191 +extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
192 +extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
193 +extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
194 +extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
195 +extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
196 +extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
197 +extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
198 +extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
199 +extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
200 +extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
201 +extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
202 +extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
203 +extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
204 +extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
205 +extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
206
207 /* ieee80211_softmac_wx.c */
208
209 -extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
210 +extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
211 struct iw_request_info *info,
212 union iwreq_data *wrqu, char *ext);
213
214 -extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
215 +extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
216 struct iw_request_info *info,
217 union iwreq_data *awrq,
218 char *extra);
219
220 -extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
221 +extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
222
223 -extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
224 +extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
225 struct iw_request_info *info,
226 union iwreq_data *wrqu, char *extra);
227
228 -extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
229 +extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
230 struct iw_request_info *info,
231 union iwreq_data *wrqu, char *extra);
232
233 -extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
234 +extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
235 union iwreq_data *wrqu, char *b);
236
237 -extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
238 +extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
239 union iwreq_data *wrqu, char *b);
240
241 -extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
242 +extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
243 struct iw_request_info *a,
244 union iwreq_data *wrqu, char *extra);
245
246 -extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
247 +extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
248 union iwreq_data *wrqu, char *b);
249
250 -extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
251 +extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
252 union iwreq_data *wrqu, char *b);
253
254 -extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
255 +extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
256 union iwreq_data *wrqu, char *b);
257
258 -extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
259 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
260 +extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
261 +#else
262 +extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
263 +#endif
264
265 -extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
266 +extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
267 struct iw_request_info *info,
268 union iwreq_data *wrqu, char *extra);
269
270 -extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
271 +extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
272 struct iw_request_info *info,
273 union iwreq_data *wrqu, char *extra);
274
275 -extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
276 +extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
277 struct iw_request_info *info,
278 union iwreq_data *wrqu, char *extra);
279
280 -extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
281 +extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
282 struct iw_request_info *info,
283 union iwreq_data *wrqu, char *extra);
284
285 -extern const long ieee80211_wlan_frequencies[];
286 +extern const long ieee80211_wlan_frequencies_rtl7[];
287
288 -extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
289 +extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
290 {
291 ieee->scans++;
292 }
293
294 -extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
295 +extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
296 {
297 return ieee->scans;
298 }
299 @@ -1372,7 +1398,7 @@
300 const char *s = essid;
301 char *d = escaped;
302
303 - if (ieee80211_is_empty_essid(essid, essid_len)) {
304 + if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
305 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
306 return escaped;
307 }
308 diff -Naur rtl8187_orig/beta-8187/Makefile rtl8187_rawtx/beta-8187/Makefile
309 --- rtl8187_orig/beta-8187/Makefile 2007-03-13 23:45:09.000000000 +0100
310 +++ rtl8187_rawtx/beta-8187/Makefile 2007-05-27 10:47:14.000000000 +0200
311 @@ -18,6 +18,8 @@
312 KVER := $(shell uname -r)
313 KSRC := /lib/modules/$(KVER)/build
314 INSTALL_PREFIX :=
315 +PWD = $(shell pwd)
316 +
317 all: modules
318
319 clean:
320 diff -Naur rtl8187_orig/beta-8187/r8180_93cx6.c rtl8187_rawtx/beta-8187/r8180_93cx6.c
321 --- rtl8187_orig/beta-8187/r8180_93cx6.c 2007-03-13 23:45:09.000000000 +0100
322 +++ rtl8187_rawtx/beta-8187/r8180_93cx6.c 2007-05-26 10:37:46.000000000 +0200
323 @@ -87,7 +87,7 @@
324
325 u32 eprom_read(struct net_device *dev, u32 addr)
326 {
327 - struct r8180_priv *priv = ieee80211_priv(dev);
328 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
329 short read_cmd[]={1,1,0};
330 short addr_str[8];
331 int i;
332 diff -Naur rtl8187_orig/beta-8187/r8180_hw.h rtl8187_rawtx/beta-8187/r8180_hw.h
333 --- rtl8187_orig/beta-8187/r8180_hw.h 2007-03-13 23:45:09.000000000 +0100
334 +++ rtl8187_rawtx/beta-8187/r8180_hw.h 2007-05-26 10:37:51.000000000 +0200
335 @@ -646,6 +646,7 @@
336 #define FFER_INTR ((1<<15))
337 #define FFER_GWAKE ((1<< 4))
338
339 -
340 +#define MAX_TX_POWER 27
341 +#define MIN_TX_POWER 20
342
343 #endif
344 diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.c rtl8187_rawtx/beta-8187/r8180_rtl8225.c
345 --- rtl8187_orig/beta-8187/r8180_rtl8225.c 2007-03-13 23:45:09.000000000 +0100
346 +++ rtl8187_rawtx/beta-8187/r8180_rtl8225.c 2007-05-26 10:37:46.000000000 +0200
347 @@ -173,7 +173,7 @@
348
349 void rtl8225_set_gain(struct net_device *dev, short gain)
350 {
351 - struct r8180_priv *priv = ieee80211_priv(dev);
352 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
353
354 rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
355
356 @@ -208,7 +208,7 @@
357 {
358 #ifdef USE_8051_3WIRE
359
360 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
361 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
362 struct usb_device *udev = priv->udev;
363 //u8 bit;
364 u16 wReg80, wReg82, wReg84;
365 @@ -255,7 +255,7 @@
366 u16 out,select;
367 u8 bit;
368 u32 bangdata = (data << 4) | (adr & 0xf);
369 - struct r8180_priv *priv = ieee80211_priv(dev);
370 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
371
372 out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
373
374 @@ -349,7 +349,7 @@
375
376 void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch)
377 {
378 - struct r8180_priv *priv = ieee80211_priv(dev);
379 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
380
381 int GainIdx;
382 int GainSetting;
383 @@ -454,9 +454,9 @@
384
385 void rtl8225_rf_set_chan(struct net_device *dev, short ch)
386 {
387 - struct r8180_priv *priv = ieee80211_priv(dev);
388 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
389 short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
390 - ieee80211_is_54g(priv->ieee80211->current_network)) ||
391 + ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
392 priv->ieee80211->iw_mode == IW_MODE_MONITOR;
393
394 rtl8225_SetTXPowerLevel(dev, ch);
395 @@ -474,7 +474,7 @@
396 write_nic_byte(dev,DIFS,0x24); //DIFS: 36
397
398 if(priv->ieee80211->state == IEEE80211_LINKED &&
399 - ieee80211_is_shortslot(priv->ieee80211->current_network))
400 + ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
401 write_nic_byte(dev,SLOT,0x9); //SLOT: 9
402
403 else
404 @@ -546,7 +546,7 @@
405
406 void rtl8225_rf_init(struct net_device *dev)
407 {
408 - struct r8180_priv *priv = ieee80211_priv(dev);
409 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
410 int i;
411 short channel = 1;
412 u16 brsr;
413 diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.h rtl8187_rawtx/beta-8187/r8180_rtl8225.h
414 --- rtl8187_orig/beta-8187/r8180_rtl8225.h 2007-03-13 23:45:09.000000000 +0100
415 +++ rtl8187_rawtx/beta-8187/r8180_rtl8225.h 2007-05-26 10:37:51.000000000 +0200
416 @@ -44,3 +44,5 @@
417 extern u32 rtl8225_chan[];
418
419 #endif
420 +
421 +void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
422 diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225z2.c rtl8187_rawtx/beta-8187/r8180_rtl8225z2.c
423 --- rtl8187_orig/beta-8187/r8180_rtl8225z2.c 2007-03-13 23:45:09.000000000 +0100
424 +++ rtl8187_rawtx/beta-8187/r8180_rtl8225z2.c 2007-05-26 10:37:46.000000000 +0200
425 @@ -2,12 +2,12 @@
426 This is part of the rtl8180-sa2400 driver
427 released under the GPL (See file COPYING for details).
428 Copyright (c) 2005 Andrea Merello <[email protected]>
429 -
430 - This files contains programming code for the rtl8225
431 +
432 + This files contains programming code for the rtl8225
433 radio frontend.
434 -
435 +
436 *Many* thanks to Realtek Corp. for their great support!
437 -
438 +
439 */
440
441
442 @@ -32,51 +32,68 @@
443 };
444
445 u8 rtl8225z2_gain_a[]={
446 - 0x13,0x27,0x5a,//,0x37,// -82dbm
447 - 0x23,0x23,0x58,//,0x37,// -82dbm
448 - 0x33,0x1f,0x56,//,0x37,// -82dbm
449 - 0x43,0x1b,0x54,//,0x37,// -78dbm
450 - 0x53,0x17,0x51,//,0x37,// -74dbm
451 - 0x63,0x24,0x4f,//,0x37,// -70dbm
452 - 0x73,0x0f,0x4c,//,0x37,// -66dbm
453 + 0x13,0x27,0x5a,//,0x37,// -82dbm
454 + 0x23,0x23,0x58,//,0x37,// -82dbm
455 + 0x33,0x1f,0x56,//,0x37,// -82dbm
456 + 0x43,0x1b,0x54,//,0x37,// -78dbm
457 + 0x53,0x17,0x51,//,0x37,// -74dbm
458 + 0x63,0x24,0x4f,//,0x37,// -70dbm
459 + 0x73,0x0f,0x4c,//,0x37,// -66dbm
460 };
461 #if 0
462 u32 rtl8225_chan[] = {
463 0, //dummy channel 0
464 - 0x085c, //1
465 - 0x08dc, //2
466 - 0x095c, //3
467 - 0x09dc, //4
468 - 0x0a5c, //5
469 - 0x0adc, //6
470 - 0x0b5c, //7
471 - 0x0bdc, //8
472 - 0x0c5c, //9
473 - 0x0cdc, //10
474 - 0x0d5c, //11
475 - 0x0ddc, //12
476 - 0x0e5c, //13
477 + 0x085c, //1
478 + 0x08dc, //2
479 + 0x095c, //3
480 + 0x09dc, //4
481 + 0x0a5c, //5
482 + 0x0adc, //6
483 + 0x0b5c, //7
484 + 0x0bdc, //8
485 + 0x0c5c, //9
486 + 0x0cdc, //10
487 + 0x0d5c, //11
488 + 0x0ddc, //12
489 + 0x0e5c, //13
490 //0x0f5c, //14
491 - 0x0f72, // 14
492 + 0x0f72, // 14
493 };
494 #endif
495
496 +#if 0
497 //-
498 -u16 rtl8225z2_rxgain[]={
499 +u16 rtl8225z2_rxgain[]={
500 0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
501 - 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
502 + 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
503 0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
504 - 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
505 + 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
506 0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
507 0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
508 0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
509 0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
510 - 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
511 - 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
512 - 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
513 + 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
514 + 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
515 + 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
516 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
517
518 };
519 +#else
520 +u16 rtl8225z2_rxgain[]={
521 + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0008, 0x0009,
522 + 0x000a, 0x000b, 0x0102, 0x0103, 0x0104, 0x0105, 0x0140, 0x0141,
523 + 0x0142, 0x0143, 0x0144, 0x0145, 0x0180, 0x0181, 0x0182, 0x0183,
524 + 0x0184, 0x0185, 0x0188, 0x0189, 0x018a, 0x018b, 0x0243, 0x0244,
525 + 0x0245, 0x0280, 0x0281, 0x0282, 0x0283, 0x0284, 0x0285, 0x0288,
526 + 0x0289, 0x028a, 0x028b, 0x028c, 0x0342, 0x0343, 0x0344, 0x0345,
527 + 0x0380, 0x0381, 0x0382, 0x0383, 0x0384, 0x0385, 0x0388, 0x0389,
528 + 0x038a, 0x038b, 0x038c, 0x038d, 0x0390, 0x0391, 0x0392, 0x0393,
529 + 0x0394, 0x0395, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d,
530 + 0x03a0, 0x03a1, 0x03a2, 0x03a3, 0x03a4, 0x03a5, 0x03a8, 0x03a9,
531 + 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
532 + 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
533 +};
534 +#endif
535
536 //2005.11.16,
537 u8 ZEBRA2_CCK_OFDM_GAIN_SETTING[]={
538 @@ -129,23 +146,30 @@
539 void rtl8225z2_set_gain(struct net_device *dev, short gain)
540 {
541 u8* rtl8225_gain;
542 - struct r8180_priv *priv = ieee80211_priv(dev);
543 -
544 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
545 +
546 u8 mode = priv->ieee80211->mode;
547 -
548 - if(mode == IEEE_B || mode == IEEE_G)
549 +
550 + if((mode&IEEE_B) == IEEE_B || (mode&IEEE_G) == IEEE_G) {
551 + //printk(KERN_WARNING "mode ag!\n");
552 rtl8225_gain = rtl8225z2_gain_bg;
553 - else
554 + } else {
555 rtl8225_gain = rtl8225z2_gain_a;
556 -
557 + //printk(KERN_WARNING "mode a!\n");
558 + }
559 +
560 //write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 3]);
561 //write_phy_ofdm(dev, 0x19, rtl8225_gain[gain * 3 + 1]);
562 //write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 2]);
563 //2005.11.17, by ch-hsu
564 write_phy_ofdm(dev, 0x0b, rtl8225_gain[gain * 3]);
565 + mdelay(1);
566 write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 1]);
567 + mdelay(1);
568 write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 3 + 2]);
569 - write_phy_ofdm(dev, 0x21, 0x37);
570 + mdelay(1);
571 + write_phy_ofdm(dev, 0x21, 0x17);
572 + mdelay(1);
573
574 }
575
576 @@ -153,33 +177,33 @@
577
578 void rtl8225_set_gain(struct net_device *dev, short gain)
579 {
580 - struct r8180_priv *priv = ieee80211_priv(dev);
581 -
582 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
583 +
584 rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
585 -
586 +
587 if(priv->card_8185 == 2)
588 write_phy_ofdm(dev, 0x21, 0x27);
589 else
590 write_phy_ofdm(dev, 0x21, 0x37);
591 -
592 +
593 write_phy_ofdm(dev, 0x25, 0x20);
594 write_phy_ofdm(dev, 0x11, 0x6);
595 -
596 +
597 if(priv->card_8185 == 1 && priv->card_8185_Bversion)
598 write_phy_ofdm(dev, 0x27, 0x8);
599 else
600 write_phy_ofdm(dev, 0x27, 0x88);
601 -
602 +
603 write_phy_ofdm(dev, 0x14, 0);
604 write_phy_ofdm(dev, 0x16, 0);
605 write_phy_ofdm(dev, 0x15, 0x40);
606 write_phy_ofdm(dev, 0x17, 0x40);
607 -
608 +
609 write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 4]);
610 write_phy_ofdm(dev, 0x23, rtl8225_gain[gain * 4 + 1]);
611 write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 4 + 2]);
612 write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 4 + 3]);
613 - //rtl8225_set_gain_usb(dev, gain);
614 + //rtl8225_set_gain_usb(dev, gain);
615 }
616 #endif
617
618 @@ -193,7 +217,7 @@
619 // ThreeWireReg tdata;
620 int i;
621 short bit, rw;
622 -
623 +
624 u8 wLength = 6;
625 u8 rLength = 12;
626 u8 low2high = 0;
627 @@ -207,20 +231,20 @@
628
629 dataRead = 0;
630
631 - oval &= ~0xf;
632 + oval &= ~0xf;
633
634 write_nic_word(dev, RFPinsOutput, oval | BB_HOST_BANG_EN ); udelay(4);
635
636 write_nic_word(dev, RFPinsOutput, oval ); udelay(5);
637 -
638 +
639 rw = 0;
640 -
641 +
642 mask = (low2high) ? 0x01 : (((u32)0x01)<<(32-1));
643 for(i = 0; i < wLength/2; i++)
644 {
645 bit = ((data2Write&mask) != 0) ? 1 : 0;
646 write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(1);
647 -
648 +
649 write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
650 write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
651
652 @@ -233,9 +257,9 @@
653 write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(2);
654 break;
655 }
656 -
657 +
658 bit = ((data2Write&mask) != 0) ? 1: 0;
659 -
660 +
661 write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
662 write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
663
664 @@ -252,22 +276,22 @@
665 for(i = 0; i < rLength; i++)
666 {
667 write_nic_word(dev, RFPinsOutput, rw|oval); udelay(1);
668 -
669 +
670 write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
671 write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
672 write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
673 tmp = read_nic_word(dev, RFPinsInput);
674 -
675 +
676 dataRead |= (tmp & BB_HOST_BANG_CLK ? mask : 0);
677
678 write_nic_word(dev, RFPinsOutput, (rw|oval)); udelay(2);
679
680 mask = (low2high) ? (mask<<1) : (mask>>1);
681 }
682 -
683 +
684 write_nic_word(dev, RFPinsOutput, BB_HOST_BANG_EN|BB_HOST_BANG_RW|oval); udelay(2);
685
686 - write_nic_word(dev, RFPinsEnable, oval2);
687 + write_nic_word(dev, RFPinsEnable, oval2);
688 write_nic_word(dev, RFPinsSelect, oval3); // Set To SW Switch
689 write_nic_word(dev, RFPinsOutput, 0x3a0);
690
691 @@ -280,61 +304,61 @@
692 u16 out,select;
693 u8 bit;
694 u32 bangdata = (data << 4) | (adr & 0xf);
695 - struct r8180_priv *priv = ieee80211_priv(dev);
696 -
697 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
698 +
699 out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
700 -
701 +
702 write_nic_word(dev,RFPinsEnable,
703 (read_nic_word(dev,RFPinsEnable) | 0x7));
704 -
705 +
706 select = read_nic_word(dev, RFPinsSelect);
707 -
708 - write_nic_word(dev, RFPinsSelect, select | 0x7 |
709 +
710 + write_nic_word(dev, RFPinsSelect, select | 0x7 |
711 ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
712 -
713 +
714 force_pci_posting(dev);
715 udelay(10);
716 -
717 +
718 write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN );//| 0x1fff);
719 -
720 +
721 force_pci_posting(dev);
722 udelay(2);
723 -
724 +
725 write_nic_word(dev, RFPinsOutput, out);
726 -
727 +
728 force_pci_posting(dev);
729 udelay(10);
730 -
731 -
732 +
733 +
734 for(i=15; i>=0;i--){
735 -
736 +
737 bit = (bangdata & (1<<i)) >> i;
738 -
739 +
740 write_nic_word(dev, RFPinsOutput, bit | out);
741 -
742 +
743 write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
744 write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
745
746 i--;
747 bit = (bangdata & (1<<i)) >> i;
748 -
749 +
750 write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
751 write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
752
753 write_nic_word(dev, RFPinsOutput, bit | out);
754
755 }
756 -
757 +
758 write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
759 -
760 +
761 force_pci_posting(dev);
762 udelay(10);
763
764 - write_nic_word(dev, RFPinsOutput, out |
765 + write_nic_word(dev, RFPinsOutput, out |
766 ((priv->card_type == USB) ? 4 : BB_HOST_BANG_EN));
767
768 - write_nic_word(dev, RFPinsSelect, select |
769 - ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
770 + write_nic_word(dev, RFPinsSelect, select |
771 + ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
772
773 if(priv->card_type == USB)
774 mdelay(2);
775 @@ -348,30 +372,30 @@
776 short vz2 = 1;
777 /* sw to reg pg 1 */
778 write_rtl8225(dev, 0, 0x1b7);
779 -
780 +
781 /* reg 8 pg 1 = 23*/
782 if( read_rtl8225(dev, 8) != 0x588)
783 vz2 = 0;
784 -
785 - else /* reg 9 pg 1 = 24 */
786 +
787 + else /* reg 9 pg 1 = 24 */
788 if( read_rtl8225(dev, 9) != 0x700)
789 vz2 = 0;
790 -
791 - /* sw back to pg 0 */
792 +
793 + /* sw back to pg 0 */
794 write_rtl8225(dev, 0, 0xb7);
795
796 return vz2;
797 -
798 +
799 }
800
801 #if 0
802 void rtl8225_rf_close(struct net_device *dev)
803 {
804 - write_rtl8225(dev, 0x4, 0x1f);
805 -
806 + write_rtl8225(dev, 0x4, 0x1f);
807 +
808 force_pci_posting(dev);
809 mdelay(1);
810 -
811 +
812 rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_OFF);
813 rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_OFF);
814 }
815 @@ -380,24 +404,24 @@
816 short rtl8225_rf_set_sens(struct net_device *dev, short sens)
817 {
818 if (sens <0 || sens > 6) return -1;
819 -
820 +
821 if(sens > 4)
822 write_rtl8225(dev, 0x0c, 0x850);
823 - else
824 + else
825 write_rtl8225(dev, 0x0c, 0x50);
826
827 sens= 6-sens;
828 rtl8225_set_gain(dev, sens);
829 -
830 +
831 write_phy_cck(dev, 0x41, rtl8225_threshold[sens]);
832 return 0;
833 -
834 +
835 }
836 #endif
837 void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch)
838 {
839 - struct r8180_priv *priv = ieee80211_priv(dev);
840 -
841 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
842 +
843 // int GainIdx;
844 // int GainSetting;
845 int i;
846 @@ -406,44 +430,47 @@
847 u8 max_cck_power_level;
848 //u8 min_cck_power_level;
849 u8 max_ofdm_power_level;
850 - u8 min_ofdm_power_level;
851 + u8 min_ofdm_power_level;
852 u8 cck_power_level = 0xff & priv->chtxpwr[ch];
853 u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch];
854 -
855 -
856 +
857 +
858 max_cck_power_level = 15;
859 //min_cck_power_level = 0;
860 max_ofdm_power_level = 25; // 12 -> 25
861 min_ofdm_power_level = 10;
862 -
863 +
864 /* CCK power setting */
865 if(cck_power_level > max_cck_power_level)
866 + {
867 cck_power_level = max_cck_power_level;
868 -
869 + priv->chtxpwr[ch] = max_cck_power_level;
870 + }
871 +
872 cck_power_level += priv->cck_txpwr_base;
873 -
874 +
875 if(cck_power_level > 35)
876 cck_power_level = 35;
877 -
878 - if(ch == 14)
879 +
880 + if(ch == 14)
881 cck_power_table = rtl8225z2_tx_power_cck_ch14;
882 - else
883 + else
884 cck_power_table = rtl8225z2_tx_power_cck;
885 -
886 -
887 +
888 +
889 for(i=0;i<8;i++){
890 -
891 +
892 power = cck_power_table[i];
893 write_phy_cck(dev, 0x44 + i, power);
894 }
895 -
896 +
897 //write_nic_byte(dev, TX_GAIN_CCK, power);
898 //2005.11.17,
899 write_nic_byte(dev, TX_GAIN_CCK, ZEBRA2_CCK_OFDM_GAIN_SETTING[cck_power_level]);
900 -
901 +
902 force_pci_posting(dev);
903 mdelay(1);
904 -
905 +
906 /* OFDM power setting */
907 // Old:
908 // if(ofdm_power_level > max_ofdm_power_level)
909 @@ -454,26 +481,26 @@
910 ofdm_power_level = max_ofdm_power_level;
911 else
912 ofdm_power_level += min_ofdm_power_level;
913 -
914 +
915 ofdm_power_level += priv->ofdm_txpwr_base;
916 -
917 +
918 if(ofdm_power_level > 35)
919 ofdm_power_level = 35;
920 -
921 +
922 rtl8185_set_anaparam2(dev,RTL8225_ANAPARAM2_ON);
923 -
924 +
925 write_phy_ofdm(dev,2,0x42);
926 write_phy_ofdm(dev,5,0);
927 write_phy_ofdm(dev,6,0x40);
928 write_phy_ofdm(dev,7,0);
929 - write_phy_ofdm(dev,8,0x40);
930 -
931 + write_phy_ofdm(dev,8,0x40);
932 +
933
934 //write_nic_byte(dev, TX_GAIN_OFDM, ofdm_power_level);
935 //2005.11.17,
936 write_nic_byte(dev, TX_GAIN_OFDM, ZEBRA2_CCK_OFDM_GAIN_SETTING[ofdm_power_level]);
937
938 -
939 +
940 force_pci_posting(dev);
941 mdelay(1);
942 //write_nic_byte(dev, TX_AGC_CONTROL,4);
943 @@ -483,39 +510,39 @@
944 void rtl8225_set_mode(struct net_device *dev, short modeb)
945 {
946 write_phy_ofdm(dev, 0x15, (modeb ? 0x0 : 0x40));
947 - write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
948 + write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
949 }
950 #endif
951
952 void rtl8225z2_rf_set_chan(struct net_device *dev, short ch)
953 {
954 - struct r8180_priv *priv = ieee80211_priv(dev);
955 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
956 short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
957 - ieee80211_is_54g(priv->ieee80211->current_network)) ||
958 + ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
959 priv->ieee80211->iw_mode == IW_MODE_MONITOR;
960 -
961 +
962 rtl8225z2_SetTXPowerLevel(dev, ch);
963 -
964 +
965 write_rtl8225(dev, 0x7, rtl8225_chan[ch]);
966 -
967 +
968 force_pci_posting(dev);
969 mdelay(10);
970 -
971 +
972 write_nic_byte(dev,SIFS,0x22);// SIFS: 0x22
973 -
974 +
975 if(gset)
976 - write_nic_byte(dev,DIFS,20); //DIFS: 20
977 + write_nic_byte(dev,DIFS,20); //DIFS: 20
978 else
979 - write_nic_byte(dev,DIFS,0x24); //DIFS: 36
980 -
981 + write_nic_byte(dev,DIFS,0x24); //DIFS: 36
982 +
983 if(priv->ieee80211->state == IEEE80211_LINKED &&
984 - ieee80211_is_shortslot(priv->ieee80211->current_network))
985 + ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
986 write_nic_byte(dev,SLOT,0x9); //SLOT: 9
987 -
988 +
989 else
990 write_nic_byte(dev,SLOT,0x14); //SLOT: 20 (0x14)
991 -
992 -
993 +
994 +
995 if(gset){
996 write_nic_byte(dev,EIFS,91 - 20); // EIFS: 91 (0x5B)
997 write_nic_byte(dev,CW_VAL,0x73); //CW VALUE: 0x37
998 @@ -529,68 +556,68 @@
999
1000 }
1001 #if 0
1002 -void rtl8225_host_pci_init(struct net_device *dev)
1003 +void rtl8225_host_pci_init(struct net_device *dev)
1004 {
1005 write_nic_word(dev, RFPinsOutput, 0x480);
1006 -
1007 +
1008 rtl8185_rf_pins_enable(dev);
1009 -
1010 +
1011 //if(priv->card_8185 == 2 && priv->enable_gpio0 ) /* version D */
1012 //write_nic_word(dev, RFPinsSelect, 0x88);
1013 //else
1014 write_nic_word(dev, RFPinsSelect, 0x88 | SW_CONTROL_GPIO); /* 0x488 | SW_CONTROL_GPIO */
1015 -
1016 +
1017 write_nic_byte(dev, GP_ENABLE, 0);
1018 -
1019 +
1020 force_pci_posting(dev);
1021 mdelay(200);
1022 -
1023 +
1024 write_nic_word(dev, GP_ENABLE, 0xff & (~(1<<6))); /* bit 6 is for RF on/off detection */
1025
1026 -
1027 +
1028 }
1029
1030 -void rtl8225_host_usb_init(struct net_device *dev)
1031 +void rtl8225_host_usb_init(struct net_device *dev)
1032 {
1033 write_nic_byte(dev,RFPinsSelect+1,0);
1034
1035 write_nic_byte(dev,GPIO,0);
1036 -
1037 +
1038 write_nic_byte_E(dev,0x53,read_nic_byte_E(dev,0x53) | (1<<7));
1039 -
1040 +
1041 write_nic_byte(dev,RFPinsSelect+1,4);
1042
1043 write_nic_byte(dev,GPIO,0x20);
1044
1045 write_nic_byte(dev,GP_ENABLE,0);
1046
1047 -
1048 - /* Config BB & RF */
1049 +
1050 + /* Config BB & RF */
1051 write_nic_word(dev, RFPinsOutput, 0x80);
1052
1053 write_nic_word(dev, RFPinsSelect, 0x80);
1054
1055 write_nic_word(dev, RFPinsEnable, 0x80);
1056
1057 -
1058 +
1059 mdelay(100);
1060
1061 - mdelay(1000);
1062 + mdelay(1000);
1063
1064 }
1065 #endif
1066 -void rtl8225z2_rf_init(struct net_device *dev)
1067 +void rtl8225z2_rf_init(struct net_device *dev)
1068 {
1069 - struct r8180_priv *priv = ieee80211_priv(dev);
1070 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1071 int i;
1072 short channel = 1;
1073 u16 brsr;
1074 u32 data,addr;
1075 -
1076 +
1077 priv->chan = channel;
1078
1079 rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
1080 -
1081 +
1082
1083 if(priv->card_type == USB)
1084 rtl8225_host_usb_init(dev);
1085 @@ -598,42 +625,42 @@
1086 rtl8225_host_pci_init(dev);
1087
1088 write_nic_dword(dev, RF_TIMING, 0x000a8008);
1089 -
1090 +
1091 brsr = read_nic_word(dev, BRSR);
1092 -
1093 - write_nic_word(dev, BRSR, 0xffff);
1094 +
1095 + write_nic_word(dev, BRSR, 0xffff);
1096
1097
1098 write_nic_dword(dev, RF_PARA, 0x100044);
1099 -
1100 +
1101 #if 1 //0->1
1102 rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
1103 write_nic_byte(dev, CONFIG3, 0x44);
1104 rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
1105 #endif
1106 -
1107 -
1108 +
1109 +
1110 rtl8185_rf_pins_enable(dev);
1111
1112 // mdelay(1000);
1113
1114 write_rtl8225(dev, 0x0, 0x2bf); mdelay(1);
1115 -
1116 -
1117 +
1118 +
1119 write_rtl8225(dev, 0x1, 0xee0); mdelay(1);
1120
1121 write_rtl8225(dev, 0x2, 0x44d); mdelay(1);
1122
1123 write_rtl8225(dev, 0x3, 0x441); mdelay(1);
1124
1125 -
1126 +
1127 write_rtl8225(dev, 0x4, 0x8c3);mdelay(1);
1128 -
1129 -
1130 -
1131 +
1132 +
1133 +
1134 write_rtl8225(dev, 0x5, 0xc72);mdelay(1);
1135 // }
1136 -
1137 +
1138 write_rtl8225(dev, 0x6, 0xe6); mdelay(1);
1139
1140 write_rtl8225(dev, 0x7, ((priv->card_type == USB)? 0x82a : rtl8225_chan[channel])); mdelay(1);
1141 @@ -653,28 +680,28 @@
1142
1143 write_rtl8225(dev, 0xe, 0x2b); mdelay(1);
1144
1145 - write_rtl8225(dev, 0xf, 0x114);
1146 -
1147 -
1148 + write_rtl8225(dev, 0xf, 0x114);
1149 +
1150 +
1151 mdelay(100);
1152 -
1153 -
1154 +
1155 +
1156 //if(priv->card_type != USB) /* maybe not needed even for 8185 */
1157 -// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
1158 -
1159 +// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
1160 +
1161 write_rtl8225(dev, 0x0, 0x1b7);
1162 -
1163 +
1164 for(i=0;i<95;i++){
1165 write_rtl8225(dev, 0x1, (u8)(i+1));
1166 -
1167 +
1168 #if 0
1169 - if(priv->phy_ver == 1)
1170 + if(priv->phy_ver == 1)
1171 /* version A */
1172 write_rtl8225(dev, 0x2, rtl8225a_rxgain[i]);
1173 else
1174 #endif
1175 /* version B & C & D*/
1176 -
1177 +
1178 write_rtl8225(dev, 0x2, rtl8225z2_rxgain[i]);
1179 }
1180 write_rtl8225(dev, 0x3, 0x80);
1181 @@ -683,16 +710,16 @@
1182 write_rtl8225(dev, 0x0, 0xb7);
1183
1184 write_rtl8225(dev, 0x2, 0xc4d);
1185 -
1186 +
1187 if(priv->card_type == USB){
1188 // force_pci_posting(dev);
1189 mdelay(200);
1190 -
1191 +
1192 write_rtl8225(dev, 0x2, 0x44d);
1193 -
1194 +
1195 // force_pci_posting(dev);
1196 mdelay(100);
1197 -
1198 +
1199 }//End of if(priv->card_type == USB)
1200 /* FIXME!! rtl8187 we have to check if calibrarion
1201 * is successful and eventually cal. again (repeat
1202 @@ -713,23 +740,23 @@
1203 }
1204 }
1205 //force_pci_posting(dev);
1206 -
1207 - mdelay(200); //200 for 8187
1208 -
1209 -
1210 +
1211 + mdelay(200); //200 for 8187
1212 +
1213 +
1214 // //if(priv->card_type != USB){
1215 // write_rtl8225(dev, 0x2, 0x44d);
1216 // write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
1217 // write_rtl8225(dev, 0x2, 0x47d);
1218 -//
1219 +//
1220 // force_pci_posting(dev);
1221 // mdelay(100);
1222 -//
1223 +//
1224 // write_rtl8225(dev, 0x2, 0x44d);
1225 // //}
1226 -
1227 - write_rtl8225(dev, 0x0, 0x2bf);
1228 -
1229 +
1230 + write_rtl8225(dev, 0x0, 0x2bf);
1231 +
1232 if(priv->card_type != USB)
1233 rtl8185_rf_pins_enable(dev);
1234 //set up ZEBRA AGC table, 2005.11.17,
1235 @@ -744,20 +771,20 @@
1236
1237 mdelay(1);
1238 }
1239 -#if 0
1240 +#if 0
1241 for(i=0;i<128;i++){
1242 write_phy_ofdm(dev, 0xb, rtl8225_agc[i]);
1243 -
1244 - mdelay(1);
1245 +
1246 + mdelay(1);
1247 write_phy_ofdm(dev, 0xa, (u8)i+ 0x80);
1248 -
1249 - mdelay(1);
1250 +
1251 + mdelay(1);
1252 }
1253 #endif
1254 -
1255 +
1256 force_pci_posting(dev);
1257 mdelay(1);
1258 -
1259 +
1260 write_phy_ofdm(dev, 0x0, 0x1); mdelay(1);
1261 write_phy_ofdm(dev, 0x1, 0x2); mdelay(1);
1262 write_phy_ofdm(dev, 0x2, ((priv->card_type == USB)? 0x42 : 0x62)); mdelay(1);
1263 @@ -771,20 +798,20 @@
1264
1265 write_phy_ofdm(dev, 0xa, 0x8); mdelay(1);
1266
1267 - //write_phy_ofdm(dev, 0x18, 0xef);
1268 + //write_phy_ofdm(dev, 0x18, 0xef);
1269 // }
1270 //}
1271 write_phy_ofdm(dev, 0xb, 0x80); mdelay(1);
1272
1273 write_phy_ofdm(dev, 0xc, 0x1);mdelay(1);
1274
1275 -
1276 +
1277 //if(priv->card_type != USB)
1278 - write_phy_ofdm(dev, 0xd, 0x43);
1279 -
1280 + write_phy_ofdm(dev, 0xd, 0x43);
1281 +
1282 write_phy_ofdm(dev, 0xe, 0xd3);mdelay(1);
1283
1284 -
1285 +
1286 #if 0
1287 if(priv->card_8185 == 1){
1288 if(priv->card_8185_Bversion)
1289 @@ -796,17 +823,17 @@
1290 write_phy_ofdm(dev, 0xf, 0x38);mdelay(1);
1291 /*ver D & 8187*/
1292 // }
1293 -
1294 +
1295 // if(priv->card_8185 == 1 && priv->card_8185_Bversion)
1296 // write_phy_ofdm(dev, 0x10, 0x04);/*ver B*/
1297 // else
1298 write_phy_ofdm(dev, 0x10, 0x84);mdelay(1);
1299 /*ver C & D & 8187*/
1300 -
1301 +
1302 write_phy_ofdm(dev, 0x11, 0x07);mdelay(1);
1303 /*agc resp time 700*/
1304
1305 -
1306 +
1307 // if(priv->card_8185 == 2){
1308 /* Ver D & 8187*/
1309 write_phy_ofdm(dev, 0x12, 0x20);mdelay(1);
1310 @@ -824,47 +851,47 @@
1311 write_phy_ofdm(dev, 0x15, 0x40); mdelay(1);
1312 write_phy_ofdm(dev, 0x16, 0x0); mdelay(1);
1313 write_phy_ofdm(dev, 0x17, 0x40); mdelay(1);
1314 -
1315 +
1316 // if (priv->card_type == USB)
1317 // write_phy_ofdm(dev, 0x18, 0xef);
1318 -
1319 +
1320 write_phy_ofdm(dev, 0x18, 0xef);mdelay(1);
1321 -
1322 +
1323
1324 write_phy_ofdm(dev, 0x19, 0x19); mdelay(1);
1325 write_phy_ofdm(dev, 0x1a, 0x20); mdelay(1);
1326 write_phy_ofdm(dev, 0x1b, 0x15);mdelay(1);
1327 -
1328 +
1329 write_phy_ofdm(dev, 0x1c, 0x4);mdelay(1);
1330
1331 write_phy_ofdm(dev, 0x1d, 0xc5);mdelay(1); //2005.11.17,
1332 -
1333 +
1334 write_phy_ofdm(dev, 0x1e, 0x95);mdelay(1);
1335
1336 write_phy_ofdm(dev, 0x1f, 0x75); mdelay(1);
1337
1338 // }
1339 -
1340 +
1341 write_phy_ofdm(dev, 0x20, 0x1f);mdelay(1);
1342
1343 write_phy_ofdm(dev, 0x21, 0x17);mdelay(1);
1344 -
1345 +
1346 write_phy_ofdm(dev, 0x22, 0x16);mdelay(1);
1347
1348 // if(priv->card_type != USB)
1349 write_phy_ofdm(dev, 0x23, 0x80);mdelay(1); //FIXME maybe not needed // <>
1350 -
1351 +
1352 write_phy_ofdm(dev, 0x24, 0x46); mdelay(1);
1353 write_phy_ofdm(dev, 0x25, 0x00); mdelay(1);
1354 write_phy_ofdm(dev, 0x26, 0x90); mdelay(1);
1355
1356 write_phy_ofdm(dev, 0x27, 0x88); mdelay(1);
1357
1358 -
1359 +
1360 // <> Set init. gain to m74dBm.
1361 -
1362 +
1363 rtl8225z2_set_gain(dev,4);
1364 -
1365 +
1366 write_phy_cck(dev, 0x0, 0x98); mdelay(1);
1367 write_phy_cck(dev, 0x3, 0x20); mdelay(1);
1368 write_phy_cck(dev, 0x4, 0x7e); mdelay(1);
1369 @@ -875,6 +902,9 @@
1370 /* Ver C & D & 8187*/
1371
1372 write_phy_cck(dev, 0x8, 0x2e);mdelay(1);
1373 + write_phy_cck(dev, 0x9, 0x11);mdelay(1);
1374 + write_phy_cck(dev, 0xa, 0x17);mdelay(1);
1375 + write_phy_cck(dev, 0xb, 0x11);mdelay(1);
1376
1377 write_phy_cck(dev, 0x10, ((priv->card_type == USB) ? 0x9b: 0x93)); mdelay(1);
1378 write_phy_cck(dev, 0x11, 0x88); mdelay(1);
1379 @@ -885,52 +915,59 @@
1380 else
1381 #endif
1382 write_phy_cck(dev, 0x13, 0xd0); /* Ver C & D & 8187*/
1383 -
1384 - write_phy_cck(dev, 0x19, 0x0);
1385 - write_phy_cck(dev, 0x1a, 0xa0);
1386 - write_phy_cck(dev, 0x1b, 0x8);
1387 - write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
1388 -
1389 - write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
1390
1391 -
1392 +// write_phy_cck(dev, 0x19, 0x0);
1393 +// write_phy_cck(dev, 0x1a, 0xa0);
1394 +// write_phy_cck(dev, 0x1b, 0x8);
1395 +// write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
1396 + write_phy_cck(dev, 0x19, 0x0); mdelay(1);
1397 + write_phy_cck(dev, 0x1a, 0xa0); mdelay(1);
1398 + write_phy_cck(dev, 0x1b, 0x8); mdelay(1);
1399 + write_phy_cck(dev, 0x1d, 0x0); mdelay(1);
1400 + write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */ mdelay(1);
1401 + write_phy_cck(dev, 0x41, 0x9d); mdelay(1);
1402 +
1403 +
1404 +// write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
1405 +
1406 +
1407 write_phy_cck(dev, 0x42, 0x15); mdelay(1);
1408 write_phy_cck(dev, 0x43, 0x18); mdelay(1);
1409 -
1410 -
1411 +
1412 +
1413 write_phy_cck(dev, 0x44, 0x36); mdelay(1);
1414 write_phy_cck(dev, 0x45, 0x35); mdelay(1);
1415 write_phy_cck(dev, 0x46, 0x2e); mdelay(1);
1416 write_phy_cck(dev, 0x47, 0x25); mdelay(1);
1417 write_phy_cck(dev, 0x48, 0x1c); mdelay(1);
1418 write_phy_cck(dev, 0x49, 0x12); mdelay(1);
1419 - write_phy_cck(dev, 0x4a, 0x9); mdelay(1);
1420 - write_phy_cck(dev, 0x4b, 0x4); mdelay(1);
1421 + write_phy_cck(dev, 0x4a, 0x09); mdelay(1);
1422 + write_phy_cck(dev, 0x4b, 0x04); mdelay(1);
1423 write_phy_cck(dev, 0x4c, 0x5);mdelay(1);
1424
1425
1426 write_nic_byte(dev, 0x5b, 0x0d); mdelay(1);
1427
1428 -
1429 +
1430
1431 // <>
1432 // // TESTR 0xb 8187
1433 // write_phy_cck(dev, 0x10, 0x93);// & 0xfb);
1434 -//
1435 +//
1436 // //if(priv->card_type != USB){
1437 // write_phy_ofdm(dev, 0x2, 0x62);
1438 // write_phy_ofdm(dev, 0x6, 0x0);
1439 // write_phy_ofdm(dev, 0x8, 0x0);
1440 // //}
1441 -
1442 +
1443 rtl8225z2_SetTXPowerLevel(dev, channel);
1444 -
1445 +
1446 write_phy_cck(dev, 0x10, 0x9b); mdelay(1); /* Rx ant A, 0xdb for B */
1447 write_phy_ofdm(dev, 0x26, 0x90); mdelay(1); /* Rx ant A, 0x10 for B */
1448 -
1449 +
1450 rtl8185_tx_antenna(dev, 0x3); /* TX ant A, 0x0 for B */
1451 -
1452 - /* switch to high-speed 3-wire
1453 +
1454 + /* switch to high-speed 3-wire
1455 * last digit. 2 for both cck and ofdm
1456 */
1457 if(priv->card_type == USB)
1458 @@ -943,23 +980,23 @@
1459 // if(priv->card_type != USB)
1460 // rtl8225_set_gain(dev, 4); /* FIXME this '1' is random */ // <>
1461 // rtl8225_set_mode(dev, 1); /* FIXME start in B mode */ // <>
1462 -//
1463 +//
1464 // /* make sure is waken up! */
1465 // write_rtl8225(dev,0x4, 0x9ff);
1466 -// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
1467 +// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
1468 // rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
1469 -
1470 +
1471 rtl8225_rf_set_chan(dev, priv->chan);
1472
1473 //write_nic_word(dev,BRSR,brsr);
1474 -
1475 +
1476 //rtl8225z2_rf_set_mode(dev);
1477 }
1478
1479 -void rtl8225z2_rf_set_mode(struct net_device *dev)
1480 +void rtl8225z2_rf_set_mode(struct net_device *dev)
1481 {
1482 - struct r8180_priv *priv = ieee80211_priv(dev);
1483 -
1484 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1485 +
1486 if(priv->ieee80211->mode == IEEE_A)
1487 {
1488 write_rtl8225(dev, 0x5, 0x1865);
1489 @@ -970,15 +1007,15 @@
1490 write_phy_ofdm(dev, 0xb, 0x99);
1491 write_phy_ofdm(dev, 0xf, 0x20);
1492 write_phy_ofdm(dev, 0x11, 0x7);
1493 -
1494 +
1495 rtl8225z2_set_gain(dev,4);
1496 -
1497 +
1498 write_phy_ofdm(dev,0x15, 0x40);
1499 write_phy_ofdm(dev,0x17, 0x40);
1500 -
1501 +
1502 write_nic_dword(dev, 0x94,0x10000000);
1503 }else{
1504 -
1505 +
1506 write_rtl8225(dev, 0x5, 0x1864);
1507 write_nic_dword(dev, RF_PARA, 0x10044);
1508 write_nic_dword(dev, RF_TIMING, 0xa8008);
1509 @@ -987,12 +1024,12 @@
1510 write_phy_ofdm(dev, 0xb, 0x99);
1511 write_phy_ofdm(dev, 0xf, 0x20);
1512 write_phy_ofdm(dev, 0x11, 0x7);
1513 -
1514 +
1515 rtl8225z2_set_gain(dev,4);
1516 -
1517 +
1518 write_phy_ofdm(dev,0x15, 0x40);
1519 write_phy_ofdm(dev,0x17, 0x40);
1520 -
1521 +
1522 write_nic_dword(dev, 0x94,0x04000002);
1523 }
1524 }
1525 diff -Naur rtl8187_orig/beta-8187/r8180_wx.c rtl8187_rawtx/beta-8187/r8180_wx.c
1526 --- rtl8187_orig/beta-8187/r8180_wx.c 2007-03-13 23:45:09.000000000 +0100
1527 +++ rtl8187_rawtx/beta-8187/r8180_wx.c 2007-05-26 10:37:46.000000000 +0200
1528 @@ -1,19 +1,19 @@
1529 -/*
1530 +/*
1531 This file contains wireless extension handlers.
1532
1533 This is part of rtl8180 OpenSource driver.
1534 - Copyright (C) Andrea Merello 2004-2005 <[email protected]>
1535 + Copyright (C) Andrea Merello 2004-2005 <[email protected]>
1536 Released under the terms of GPL (General Public Licence)
1537 -
1538 - Parts of this driver are based on the GPL part
1539 +
1540 + Parts of this driver are based on the GPL part
1541 of the official realtek driver.
1542 -
1543 - Parts of this driver are based on the rtl8180 driver skeleton
1544 +
1545 + Parts of this driver are based on the rtl8180 driver skeleton
1546 from Patric Schenke & Andres Salomon.
1547
1548 Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver.
1549 -
1550 - We want to tanks the Authors of those projects and the Ndiswrapper
1551 +
1552 + We want to tanks the Authors of those projects and the Ndiswrapper
1553 project Authors.
1554 */
1555
1556 @@ -21,20 +21,21 @@
1557
1558 #include "r8187.h"
1559 #include "r8180_hw.h"
1560 +#include "r8180_rtl8225.h"
1561
1562
1563 #define RATE_COUNT 4
1564 u32 rtl8180_rates[] = {1000000,2000000,5500000,11000000,
1565 6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000};
1566 -
1567 +
1568
1569 static int r8180_wx_get_freq(struct net_device *dev,
1570 struct iw_request_info *a,
1571 union iwreq_data *wrqu, char *b)
1572 {
1573 - struct r8180_priv *priv = ieee80211_priv(dev);
1574 -
1575 - return ieee80211_wx_get_freq(priv->ieee80211,a,wrqu,b);
1576 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1577 +
1578 + return ieee80211_wx_get_freq_rtl7(priv->ieee80211,a,wrqu,b);
1579 }
1580
1581
1582 @@ -45,28 +46,28 @@
1583 {
1584 int *parms = (int *)b;
1585 int bi = parms[0];
1586 -
1587 - struct r8180_priv *priv = ieee80211_priv(dev);
1588 -
1589 +
1590 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1591 +
1592 down(&priv->wx_sem);
1593 DMESG("setting beacon interval to %x",bi);
1594 -
1595 +
1596 priv->ieee80211->beacon_interval=bi;
1597 rtl8180_commit(dev);
1598 up(&priv->wx_sem);
1599 -
1600 - return 0;
1601 +
1602 + return 0;
1603 }
1604
1605
1606 static int r8180_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa,
1607 union iwreq_data *wrqu, char *extra)
1608 {
1609 - struct r8180_priv *priv=ieee80211_priv(dev);
1610 + struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
1611 int *parms = (int *)extra;
1612 -
1613 +
1614 priv->ieee80211->force_associate = (parms[0] > 0);
1615 -
1616 +
1617
1618 return 0;
1619 }
1620 @@ -75,108 +76,157 @@
1621 static int r8180_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
1622 union iwreq_data *wrqu, char *b)
1623 {
1624 - struct r8180_priv *priv=ieee80211_priv(dev);
1625 + struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
1626
1627 - return ieee80211_wx_get_mode(priv->ieee80211,a,wrqu,b);
1628 + return ieee80211_wx_get_mode_rtl7(priv->ieee80211,a,wrqu,b);
1629 }
1630
1631
1632
1633 -static int r8180_wx_get_rate(struct net_device *dev,
1634 - struct iw_request_info *info,
1635 +static int r8180_wx_get_rate(struct net_device *dev,
1636 + struct iw_request_info *info,
1637 union iwreq_data *wrqu, char *extra)
1638 {
1639 - struct r8180_priv *priv = ieee80211_priv(dev);
1640 - return ieee80211_wx_get_rate(priv->ieee80211,info,wrqu,extra);
1641 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1642 + return ieee80211_wx_get_rate_rtl7(priv->ieee80211,info,wrqu,extra);
1643 }
1644
1645
1646
1647 -static int r8180_wx_set_rate(struct net_device *dev,
1648 - struct iw_request_info *info,
1649 +static int r8180_wx_set_rate(struct net_device *dev,
1650 + struct iw_request_info *info,
1651 union iwreq_data *wrqu, char *extra)
1652 {
1653 int ret;
1654 - struct r8180_priv *priv = ieee80211_priv(dev);
1655 -
1656 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1657 +
1658 down(&priv->wx_sem);
1659 + ret = ieee80211_wx_set_rate_rtl7(priv->ieee80211,info,wrqu,extra);
1660
1661 - ret = ieee80211_wx_set_rate(priv->ieee80211,info,wrqu,extra);
1662 -
1663 up(&priv->wx_sem);
1664 -
1665 +
1666 return ret;
1667 }
1668
1669 -static int r8180_wx_set_rawtx(struct net_device *dev,
1670 - struct iw_request_info *info,
1671 - union iwreq_data *wrqu, char *extra)
1672 +static int r8180_wx_get_txpow(struct net_device *dev,
1673 + struct iw_request_info *info,
1674 + union iwreq_data *wrqu, char *extra)
1675 {
1676 - struct r8180_priv *priv = ieee80211_priv(dev);
1677 - int ret;
1678 -
1679 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1680 + int i=0;
1681 down(&priv->wx_sem);
1682 -
1683 - ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
1684 -
1685 + wrqu->power.value = 0;
1686 + for(i=0; i<15; i++)
1687 + {
1688 + if(priv->chtxpwr[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr[i];
1689 + if(priv->chtxpwr_ofdm[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr_ofdm[i];
1690 + }
1691 + wrqu->power.fixed = 1;
1692 + wrqu->power.flags = IW_TXPOW_DBM;
1693 + wrqu->power.disabled = 0;
1694 up(&priv->wx_sem);
1695 -
1696 +
1697 + return 0;
1698 +}
1699 +
1700 +#if 1
1701 +static int r8180_wx_set_txpow(struct net_device *dev,
1702 + struct iw_request_info *info,
1703 + union iwreq_data *wrqu, char *extra)
1704 +{
1705 + int ret = 0, i=0;
1706 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1707 +
1708 + down(&priv->wx_sem);
1709 +
1710 + if (wrqu->power.flags != IW_TXPOW_DBM)
1711 + {
1712 + ret = -EINVAL;
1713 + goto out;
1714 + }
1715 +
1716 + if(wrqu->power.value > priv->txpwr_max)
1717 + {
1718 + ret = -EINVAL;
1719 + goto out;
1720 + }
1721 +
1722 + if(wrqu->power.value < 0)
1723 + {
1724 + ret = -EINVAL;
1725 + goto out;
1726 + }
1727 +
1728 + for(i=1;i<15;i++)
1729 + {
1730 + priv->chtxpwr[i] = priv->chtxpwr_orig[i] - (priv->txpwr_max - wrqu->power.value);
1731 + if(priv->chtxpwr[i] > priv->chtxpwr_orig[i]) priv->chtxpwr[i] = 0;
1732 +
1733 + priv->chtxpwr_ofdm[i] = priv->chtxpwr_ofdm_orig[i] - (priv->txpwr_max - wrqu->power.value);
1734 + if(priv->chtxpwr_ofdm[i] > priv->chtxpwr_ofdm_orig[i]) priv->chtxpwr_ofdm[i] = 0;
1735 + }
1736 + rtl8225z2_SetTXPowerLevel(dev, 1);
1737 +
1738 + out:
1739 + up(&priv->wx_sem);
1740 +
1741 return ret;
1742 -
1743 +
1744 }
1745 +#endif
1746
1747 -static int r8180_wx_set_crcmon(struct net_device *dev,
1748 - struct iw_request_info *info,
1749 +static int r8180_wx_set_crcmon(struct net_device *dev,
1750 + struct iw_request_info *info,
1751 union iwreq_data *wrqu, char *extra)
1752 {
1753 - struct r8180_priv *priv = ieee80211_priv(dev);
1754 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1755 int *parms = (int *)extra;
1756 int enable = (parms[0] > 0);
1757 short prev = priv->crcmon;
1758
1759 down(&priv->wx_sem);
1760 -
1761 - if(enable)
1762 +
1763 + if(enable)
1764 priv->crcmon=1;
1765 - else
1766 + else
1767 priv->crcmon=0;
1768
1769 - DMESG("bad CRC in monitor mode are %s",
1770 + DMESG("bad CRC in monitor mode are %s",
1771 priv->crcmon ? "accepted" : "rejected");
1772
1773 if(prev != priv->crcmon && priv->up){
1774 rtl8180_down(dev);
1775 rtl8180_up(dev);
1776 }
1777 -
1778 +
1779 up(&priv->wx_sem);
1780 -
1781 +
1782 return 0;
1783 }
1784
1785 static int r8180_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
1786 union iwreq_data *wrqu, char *b)
1787 {
1788 - struct r8180_priv *priv = ieee80211_priv(dev);
1789 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1790 int ret;
1791 -
1792 +
1793 down(&priv->wx_sem);
1794 -
1795 - ret = ieee80211_wx_set_mode(priv->ieee80211,a,wrqu,b);
1796 -
1797 +
1798 + ret = ieee80211_wx_set_mode_rtl7(priv->ieee80211,a,wrqu,b);
1799 +
1800 rtl8187_set_rxconf(dev);
1801 -
1802 +
1803 up(&priv->wx_sem);
1804 return ret;
1805 }
1806
1807
1808 -static int rtl8180_wx_get_range(struct net_device *dev,
1809 - struct iw_request_info *info,
1810 +static int rtl8180_wx_get_range(struct net_device *dev,
1811 + struct iw_request_info *info,
1812 union iwreq_data *wrqu, char *extra)
1813 {
1814 struct iw_range *range = (struct iw_range *)extra;
1815 - struct r8180_priv *priv = ieee80211_priv(dev);
1816 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1817 u16 val;
1818 int i;
1819
1820 @@ -186,26 +236,26 @@
1821 /* Let's try to keep this struct in the same order as in
1822 * linux/include/wireless.h
1823 */
1824 -
1825 +
1826 /* TODO: See what values we can set, and remove the ones we can't
1827 * set, or fill them with some default data.
1828 */
1829
1830 /* ~5 Mb/s real (802.11b) */
1831 - range->throughput = 5 * 1000 * 1000;
1832 + range->throughput = 5 * 1000 * 1000;
1833
1834 // TODO: Not used in 802.11b?
1835 // range->min_nwid; /* Minimal NWID we are able to set */
1836 // TODO: Not used in 802.11b?
1837 // range->max_nwid; /* Maximal NWID we are able to set */
1838 -
1839 +
1840 /* Old Frequency (backward compat - moved lower ) */
1841 -// range->old_num_channels;
1842 +// range->old_num_channels;
1843 // range->old_num_frequency;
1844 // range->old_freq[6]; /* Filler to keep "version" at the same offset */
1845 if(priv->rf_set_sens != NULL)
1846 range->sensitivity = priv->max_sens; /* signal level threshold range */
1847 -
1848 +
1849 range->max_qual.qual = 100;
1850 /* TODO: Find real max RSSI and stick here */
1851 range->max_qual.level = 0;
1852 @@ -219,14 +269,14 @@
1853 range->avg_qual.updated = 7; /* Updated all three */
1854
1855 range->num_bitrates = RATE_COUNT;
1856 -
1857 +
1858 for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) {
1859 range->bitrate[i] = rtl8180_rates[i];
1860 }
1861 -
1862 +
1863 range->min_frag = MIN_FRAG_THRESHOLD;
1864 range->max_frag = MAX_FRAG_THRESHOLD;
1865 -
1866 +
1867 range->pm_capa = 0;
1868
1869 range->we_version_compiled = WIRELESS_EXT;
1870 @@ -243,18 +293,18 @@
1871 range->num_channels = 14;
1872
1873 for (i = 0, val = 0; i < 14; i++) {
1874 -
1875 +
1876 // Include only legal frequencies for some countries
1877 if ((priv->challow)[i+1]) {
1878 range->freq[val].i = i + 1;
1879 - range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000;
1880 + range->freq[val].m = ieee80211_wlan_frequencies_rtl7[i] * 100000;
1881 range->freq[val].e = 1;
1882 val++;
1883 } else {
1884 // FIXME: do we need to set anything for channels
1885 // we don't use ?
1886 }
1887 -
1888 +
1889 if (val == IW_MAX_FREQUENCIES)
1890 break;
1891 }
1892 @@ -267,15 +317,15 @@
1893 static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
1894 union iwreq_data *wrqu, char *b)
1895 {
1896 - struct r8180_priv *priv = ieee80211_priv(dev);
1897 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1898 int ret;
1899 -
1900 +
1901 if(!priv->up) return -1;
1902 -
1903 +
1904 down(&priv->wx_sem);
1905 -
1906 - ret = ieee80211_wx_set_scan(priv->ieee80211,a,wrqu,b);
1907 -
1908 +
1909 + ret = ieee80211_wx_set_scan_rtl7(priv->ieee80211,a,wrqu,b);
1910 +
1911 up(&priv->wx_sem);
1912 return ret;
1913 }
1914 @@ -286,50 +336,50 @@
1915 {
1916
1917 int ret;
1918 - struct r8180_priv *priv = ieee80211_priv(dev);
1919 -
1920 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1921 +
1922 if(!priv->up) return -1;
1923 -
1924 +
1925 down(&priv->wx_sem);
1926
1927 - ret = ieee80211_wx_get_scan(priv->ieee80211,a,wrqu,b);
1928 -
1929 + ret = ieee80211_wx_get_scan_rtl7(priv->ieee80211,a,wrqu,b);
1930 +
1931 up(&priv->wx_sem);
1932 -
1933 +
1934 return ret;
1935 }
1936
1937
1938 -static int r8180_wx_set_essid(struct net_device *dev,
1939 +static int r8180_wx_set_essid(struct net_device *dev,
1940 struct iw_request_info *a,
1941 union iwreq_data *wrqu, char *b)
1942 {
1943 - struct r8180_priv *priv = ieee80211_priv(dev);
1944 -
1945 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1946 +
1947 int ret;
1948 -
1949 +
1950 down(&priv->wx_sem);
1951 -
1952 - ret = ieee80211_wx_set_essid(priv->ieee80211,a,wrqu,b);
1953 -
1954 +
1955 + ret = ieee80211_wx_set_essid_rtl7(priv->ieee80211,a,wrqu,b);
1956 +
1957 up(&priv->wx_sem);
1958 return ret;
1959 }
1960
1961
1962 -static int r8180_wx_get_essid(struct net_device *dev,
1963 +static int r8180_wx_get_essid(struct net_device *dev,
1964 struct iw_request_info *a,
1965 union iwreq_data *wrqu, char *b)
1966 {
1967 int ret;
1968 - struct r8180_priv *priv = ieee80211_priv(dev);
1969 -
1970 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1971 +
1972 down(&priv->wx_sem);
1973 -
1974 - ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b);
1975 +
1976 + ret = ieee80211_wx_get_essid_rtl7(priv->ieee80211, a, wrqu, b);
1977
1978 up(&priv->wx_sem);
1979 -
1980 +
1981 return ret;
1982 }
1983
1984 @@ -338,30 +388,30 @@
1985 union iwreq_data *wrqu, char *b)
1986 {
1987 int ret;
1988 - struct r8180_priv *priv = ieee80211_priv(dev);
1989 -
1990 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1991 +
1992 down(&priv->wx_sem);
1993 -
1994 - ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b);
1995 -
1996 +
1997 + ret = ieee80211_wx_set_freq_rtl7(priv->ieee80211, a, wrqu, b);
1998 +
1999 up(&priv->wx_sem);
2000 return ret;
2001 }
2002
2003 -static int r8180_wx_get_name(struct net_device *dev,
2004 - struct iw_request_info *info,
2005 +static int r8180_wx_get_name(struct net_device *dev,
2006 + struct iw_request_info *info,
2007 union iwreq_data *wrqu, char *extra)
2008 {
2009 - struct r8180_priv *priv = ieee80211_priv(dev);
2010 - return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra);
2011 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2012 + return ieee80211_wx_get_name_rtl7(priv->ieee80211, info, wrqu, extra);
2013 }
2014
2015
2016 -static int r8180_wx_set_frag(struct net_device *dev,
2017 - struct iw_request_info *info,
2018 +static int r8180_wx_set_frag(struct net_device *dev,
2019 + struct iw_request_info *info,
2020 union iwreq_data *wrqu, char *extra)
2021 {
2022 - struct r8180_priv *priv = ieee80211_priv(dev);
2023 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2024
2025 if (wrqu->frag.disabled)
2026 priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
2027 @@ -369,7 +419,7 @@
2028 if (wrqu->frag.value < MIN_FRAG_THRESHOLD ||
2029 wrqu->frag.value > MAX_FRAG_THRESHOLD)
2030 return -EINVAL;
2031 -
2032 +
2033 priv->ieee80211->fts = wrqu->frag.value & ~0x1;
2034 }
2035
2036 @@ -377,11 +427,11 @@
2037 }
2038
2039
2040 -static int r8180_wx_get_frag(struct net_device *dev,
2041 - struct iw_request_info *info,
2042 +static int r8180_wx_get_frag(struct net_device *dev,
2043 + struct iw_request_info *info,
2044 union iwreq_data *wrqu, char *extra)
2045 {
2046 - struct r8180_priv *priv = ieee80211_priv(dev);
2047 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2048
2049 wrqu->frag.value = priv->ieee80211->fts;
2050 wrqu->frag.fixed = 0; /* no auto select */
2051 @@ -397,49 +447,49 @@
2052 char *extra)
2053 {
2054 int ret;
2055 - struct r8180_priv *priv = ieee80211_priv(dev);
2056 -
2057 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2058 +
2059 down(&priv->wx_sem);
2060 -
2061 - ret = ieee80211_wx_set_wap(priv->ieee80211,info,awrq,extra);
2062 -
2063 +
2064 + ret = ieee80211_wx_set_wap_rtl7(priv->ieee80211,info,awrq,extra);
2065 +
2066 up(&priv->wx_sem);
2067 return ret;
2068 -
2069 +
2070 }
2071 -
2072
2073 -static int r8180_wx_get_wap(struct net_device *dev,
2074 - struct iw_request_info *info,
2075 +
2076 +static int r8180_wx_get_wap(struct net_device *dev,
2077 + struct iw_request_info *info,
2078 union iwreq_data *wrqu, char *extra)
2079 {
2080 - struct r8180_priv *priv = ieee80211_priv(dev);
2081 -
2082 - return ieee80211_wx_get_wap(priv->ieee80211,info,wrqu,extra);
2083 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2084 +
2085 + return ieee80211_wx_get_wap_rtl7(priv->ieee80211,info,wrqu,extra);
2086 }
2087
2088
2089 -static int r8180_wx_get_enc(struct net_device *dev,
2090 - struct iw_request_info *info,
2091 +static int r8180_wx_get_enc(struct net_device *dev,
2092 + struct iw_request_info *info,
2093 union iwreq_data *wrqu, char *key)
2094 {
2095 - struct r8180_priv *priv = ieee80211_priv(dev);
2096 -
2097 - return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key);
2098 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2099 +
2100 + return ieee80211_wx_get_encode_rtl7(priv->ieee80211, info, wrqu, key);
2101 }
2102
2103 -static int r8180_wx_set_enc(struct net_device *dev,
2104 - struct iw_request_info *info,
2105 +static int r8180_wx_set_enc(struct net_device *dev,
2106 + struct iw_request_info *info,
2107 union iwreq_data *wrqu, char *key)
2108 {
2109 - struct r8180_priv *priv = ieee80211_priv(dev);
2110 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2111 int ret;
2112 -
2113 +
2114 down(&priv->wx_sem);
2115 -
2116 +
2117 DMESG("Setting SW wep key");
2118 - ret = ieee80211_wx_set_encode(priv->ieee80211,info,wrqu,key);
2119 -
2120 + ret = ieee80211_wx_set_encode_rtl7(priv->ieee80211,info,wrqu,key);
2121 +
2122 up(&priv->wx_sem);
2123 return ret;
2124 }
2125 @@ -447,28 +497,28 @@
2126
2127 static int r8180_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union
2128 iwreq_data *wrqu, char *p){
2129 -
2130 - struct r8180_priv *priv = ieee80211_priv(dev);
2131 +
2132 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2133 int *parms=(int*)p;
2134 int mode=parms[0];
2135 -
2136 +
2137 priv->ieee80211->active_scan = mode;
2138 -
2139 +
2140 return 1;
2141 }
2142
2143
2144
2145 -static int r8180_wx_set_retry(struct net_device *dev,
2146 - struct iw_request_info *info,
2147 +static int r8180_wx_set_retry(struct net_device *dev,
2148 + struct iw_request_info *info,
2149 union iwreq_data *wrqu, char *extra)
2150 {
2151 - struct r8180_priv *priv = ieee80211_priv(dev);
2152 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2153 int err = 0;
2154 -
2155 +
2156 down(&priv->wx_sem);
2157 -
2158 - if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
2159 +
2160 + if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
2161 wrqu->retry.disabled){
2162 err = -EINVAL;
2163 goto exit;
2164 @@ -485,13 +535,13 @@
2165 if (wrqu->retry.flags & IW_RETRY_MAX) {
2166 priv->retry_rts = wrqu->retry.value;
2167 DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value);
2168 -
2169 +
2170 }else {
2171 priv->retry_data = wrqu->retry.value;
2172 DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value);
2173 }
2174 -
2175 - /* FIXME !
2176 +
2177 + /* FIXME !
2178 * We might try to write directly the TX config register
2179 * or to restart just the (R)TX process.
2180 * I'm unsure if whole reset is really needed
2181 @@ -503,28 +553,28 @@
2182 rtl8180_rtx_disable(dev);
2183 rtl8180_rx_enable(dev);
2184 rtl8180_tx_enable(dev);
2185 -
2186 +
2187 }
2188 */
2189 exit:
2190 up(&priv->wx_sem);
2191 -
2192 +
2193 return err;
2194 }
2195
2196 -static int r8180_wx_get_retry(struct net_device *dev,
2197 - struct iw_request_info *info,
2198 +static int r8180_wx_get_retry(struct net_device *dev,
2199 + struct iw_request_info *info,
2200 union iwreq_data *wrqu, char *extra)
2201 {
2202 - struct r8180_priv *priv = ieee80211_priv(dev);
2203 -
2204 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2205 +
2206
2207 wrqu->retry.disabled = 0; /* can't be disabled */
2208
2209 - if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
2210 - IW_RETRY_LIFETIME)
2211 + if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
2212 + IW_RETRY_LIFETIME)
2213 return -EINVAL;
2214 -
2215 +
2216 if (wrqu->retry.flags & IW_RETRY_MAX) {
2217 wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MAX;
2218 wrqu->retry.value = priv->retry_rts;
2219 @@ -533,30 +583,30 @@
2220 wrqu->retry.value = priv->retry_data;
2221 }
2222 //DMESG("returning %d",wrqu->retry.value);
2223 -
2224 +
2225
2226 return 0;
2227 }
2228
2229 -static int r8180_wx_get_sens(struct net_device *dev,
2230 - struct iw_request_info *info,
2231 +static int r8180_wx_get_sens(struct net_device *dev,
2232 + struct iw_request_info *info,
2233 union iwreq_data *wrqu, char *extra)
2234 {
2235 - struct r8180_priv *priv = ieee80211_priv(dev);
2236 - if(priv->rf_set_sens == NULL)
2237 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2238 + if(priv->rf_set_sens == NULL)
2239 return -1; /* we have not this support for this radio */
2240 wrqu->sens.value = priv->sens;
2241 return 0;
2242 }
2243
2244
2245 -static int r8180_wx_set_sens(struct net_device *dev,
2246 - struct iw_request_info *info,
2247 +static int r8180_wx_set_sens(struct net_device *dev,
2248 + struct iw_request_info *info,
2249 union iwreq_data *wrqu, char *extra)
2250 {
2251 -
2252 - struct r8180_priv *priv = ieee80211_priv(dev);
2253 -
2254 +
2255 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2256 +
2257 short err = 0;
2258 down(&priv->wx_sem);
2259 //DMESG("attempt to set sensivity to %ddb",wrqu->sens.value);
2260 @@ -571,7 +621,7 @@
2261
2262 exit:
2263 up(&priv->wx_sem);
2264 -
2265 +
2266 return err;
2267 }
2268
2269 @@ -623,32 +673,28 @@
2270 dummy, /* SIOCGIWRTS */
2271 r8180_wx_set_frag, /* SIOCSIWFRAG */
2272 r8180_wx_get_frag, /* SIOCGIWFRAG */
2273 - dummy, /* SIOCSIWTXPOW */
2274 - dummy, /* SIOCGIWTXPOW */
2275 + r8180_wx_set_txpow, /* SIOCSIWTXPOW */
2276 + r8180_wx_get_txpow, /* SIOCGIWTXPOW */
2277 r8180_wx_set_retry, /* SIOCSIWRETRY */
2278 r8180_wx_get_retry, /* SIOCGIWRETRY */
2279 r8180_wx_set_enc, /* SIOCSIWENCODE */
2280 r8180_wx_get_enc, /* SIOCGIWENCODE */
2281 dummy, /* SIOCSIWPOWER */
2282 dummy, /* SIOCGIWPOWER */
2283 -};
2284 +};
2285
2286
2287 -static const struct iw_priv_args r8180_private_args[] = {
2288 -
2289 +static const struct iw_priv_args r8180_private_args[] = {
2290 +
2291 {
2292 - SIOCIWFIRSTPRIV + 0x0,
2293 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
2294 - },
2295 -
2296 + SIOCIWFIRSTPRIV + 0x0,
2297 + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
2298 + },
2299 +
2300 {
2301 SIOCIWFIRSTPRIV + 0x1,
2302 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
2303 -
2304 - },
2305 - {
2306 - SIOCIWFIRSTPRIV + 0x2,
2307 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx"
2308 +
2309 }
2310 };
2311
2312 @@ -660,13 +706,12 @@
2313 // r8180_wx_set_beaconinterval,
2314 // r8180_wx_set_monitor_type,
2315 r8180_wx_set_scan_type,
2316 - r8180_wx_set_rawtx,
2317 };
2318
2319 -#if WIRELESS_EXT >= 17
2320 +#if WIRELESS_EXT >= 17
2321 static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
2322 {
2323 - struct r8180_priv *priv = ieee80211_priv(dev);
2324 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2325
2326 return &priv->wstats;
2327 }
2328 @@ -679,8 +724,8 @@
2329 .private = r8180_private_handler,
2330 .num_private = sizeof(r8180_private_handler) / sizeof(iw_handler),
2331 .num_private_args = sizeof(r8180_private_args) / sizeof(struct iw_priv_args),
2332 -#if WIRELESS_EXT >= 17
2333 +#if WIRELESS_EXT >= 17
2334 .get_wireless_stats = r8180_get_wireless_stats,
2335 #endif
2336 - .private_args = (struct iw_priv_args *)r8180_private_args,
2337 + .private_args = (struct iw_priv_args *)r8180_private_args,
2338 };
2339 diff -Naur rtl8187_orig/beta-8187/r8187_core.c rtl8187_rawtx/beta-8187/r8187_core.c
2340 --- rtl8187_orig/beta-8187/r8187_core.c 2007-03-13 23:45:09.000000000 +0100
2341 +++ rtl8187_rawtx/beta-8187/r8187_core.c 2007-05-27 11:31:45.000000000 +0200
2342 @@ -1,27 +1,27 @@
2343 /*
2344 This is part of rtl8187 OpenSource driver - v 0.1
2345 - Copyright (C) Andrea Merello 2005 <[email protected]>
2346 + Copyright (C) Andrea Merello 2005 <[email protected]>
2347 Released under the terms of GPL (General Public License)
2348 -
2349 -
2350 - Parts of this driver are based on the rtl8180 driver skeleton
2351 +
2352 +
2353 + Parts of this driver are based on the rtl8180 driver skeleton
2354 from Patric Schenke & Andres Salomon.
2355
2356 Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers.
2357 -
2358 +
2359 some ideas might be derived from David Young rtl8180 netbsd driver.
2360 -
2361 +
2362 Parts of the usb code are from the r8150.c driver in linux kernel
2363 -
2364 +
2365 Some ideas borrowed from the 8139too.c driver included in linux kernel.
2366 -
2367 - We (I?) want to thanks the Authors of those projecs and also the
2368 +
2369 + We (I?) want to thanks the Authors of those projecs and also the
2370 Ndiswrapper's project Authors.
2371 -
2372 - A special big thanks goes also to Realtek corp. for their help in my
2373 - attempt to add RTL8187 and RTL8225 support, and to David Young also.
2374
2375 - - Please note that this file is a modified version from rtl8180-sa2400
2376 + A special big thanks goes also to Realtek corp. for their help in my
2377 + attempt to add RTL8187 and RTL8225 support, and to David Young also.
2378 +
2379 + - Please note that this file is a modified version from rtl8180-sa2400
2380 drv. So some other people have contributed to this project, and they are
2381 thanked in the rtl8180-sa2400 CHANGELOG.
2382 */
2383 @@ -57,6 +57,7 @@
2384 #undef DEBUG_IRQ_TASKLET
2385 #undef DEBUG_TX_ALLOC
2386 #undef DEBUG_TX_DESC
2387 +#undef DEBUG_TX_POWER
2388
2389 //#define CONFIG_RTL8180_IO_MAP
2390
2391 @@ -66,6 +67,9 @@
2392 #include "r8180_93cx6.h" /* Card EEPROM */
2393 #include "r8180_wx.h"
2394
2395 +#if !(defined(CONFIG_USB_EHCI_HCD) || defined (CONFIG_USB_EHCI_HCD_MODULE))
2396 + #error Build your kernel with ehci_hcd support!
2397 +#endif
2398
2399 // FIXME: check if 2.6.7 is ok
2400 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
2401 @@ -98,6 +102,10 @@
2402 #endif
2403 static int channels = 0x3fff;
2404
2405 +// #define DEBUG_EPROM
2406 +// #define DEBUG_REGISTERS
2407 +// #define DEBUG_TX_POWER
2408 +
2409 MODULE_LICENSE("GPL");
2410 MODULE_VERSION("V 1.1");
2411 MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
2412 @@ -137,7 +145,7 @@
2413
2414 static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
2415 const struct usb_device_id *id);
2416 -
2417 +
2418 static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf);
2419
2420 static struct usb_driver rtl8187_usb_driver = {
2421 @@ -158,13 +166,12 @@
2422 #endif
2423 };
2424
2425 -
2426 void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
2427 {
2428 -
2429 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2430 +
2431 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2432 struct usb_device *udev = priv->udev;
2433 -
2434 +
2435 usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
2436 RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
2437 indx|0xfe00, 0, &data, 1, HZ / 2);
2438 @@ -173,10 +180,10 @@
2439
2440 void write_nic_byte(struct net_device *dev, int indx, u8 data)
2441 {
2442 -
2443 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2444 +
2445 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2446 struct usb_device *udev = priv->udev;
2447 -
2448 +
2449 usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
2450 RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
2451 indx|0xff00, 0, &data, 1, HZ / 2);
2452 @@ -185,10 +192,10 @@
2453
2454 void write_nic_word(struct net_device *dev, int indx, u16 data)
2455 {
2456 -
2457 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2458 +
2459 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2460 struct usb_device *udev = priv->udev;
2461 -
2462 +
2463 usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
2464 RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
2465 indx|0xff00, 0, &data, 2, HZ / 2);
2466 @@ -197,23 +204,23 @@
2467
2468 void write_nic_dword(struct net_device *dev, int indx, u32 data)
2469 {
2470 -
2471 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2472 +
2473 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2474 struct usb_device *udev = priv->udev;
2475 -
2476 +
2477 usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
2478 RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
2479 indx|0xff00, 0, &data, 4, HZ / 2);
2480 }
2481 -
2482 -
2483 -
2484 +
2485 +
2486 +
2487 u8 read_nic_byte(struct net_device *dev, int indx)
2488 {
2489 u8 data;
2490 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2491 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2492 struct usb_device *udev = priv->udev;
2493 -
2494 +
2495 usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
2496 RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
2497 indx|0xff00, 0, &data, 1, HZ / 2);
2498 @@ -223,22 +230,22 @@
2499 u8 read_nic_byte_E(struct net_device *dev, int indx)
2500 {
2501 u8 data;
2502 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2503 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2504 struct usb_device *udev = priv->udev;
2505 -
2506 +
2507 usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
2508 RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
2509 indx|0xfe00, 0, &data, 1, HZ / 2);
2510 return data;
2511 }
2512
2513 -
2514 +
2515 u16 read_nic_word(struct net_device *dev, int indx)
2516 {
2517 u16 data;
2518 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2519 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2520 struct usb_device *udev = priv->udev;
2521 -
2522 +
2523 usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
2524 RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
2525 indx|0xff00, 0, &data, 2, HZ / 2);
2526 @@ -249,16 +256,16 @@
2527 u32 read_nic_dword(struct net_device *dev, int indx)
2528 {
2529 u32 data;
2530 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2531 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2532 struct usb_device *udev = priv->udev;
2533 -
2534 +
2535 usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
2536 RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
2537 indx|0xff00, 0, &data, 4, HZ / 2);
2538 return data;
2539 }
2540
2541 -/* this might still called in what was the PHY rtl8185/rtl8187 common code
2542 +/* this might still called in what was the PHY rtl8185/rtl8187 common code
2543 * plans are to possibilty turn it again in one common code...
2544 */
2545 inline void force_pci_posting(struct net_device *dev)
2546 @@ -271,7 +278,12 @@
2547 //void set_nic_txring(struct net_device *dev);
2548 static struct net_device_stats *rtl8180_stats(struct net_device *dev);
2549 void rtl8180_commit(struct net_device *dev);
2550 +
2551 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
2552 +void rtl8180_restart(struct work_struct *work);
2553 +#else
2554 void rtl8180_restart(struct net_device *dev);
2555 +#endif
2556
2557 /****************************************************************************
2558 -----------------------------PROCFS STUFF-------------------------
2559 @@ -284,13 +296,13 @@
2560 int *eof, void *data)
2561 {
2562 struct net_device *dev = data;
2563 -// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2564 -
2565 +// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2566 +
2567 int len = 0;
2568 int i,n;
2569 -
2570 +
2571 int max=0xff;
2572 -
2573 +
2574 /* This dump the current register page */
2575 for(n=0;n<=max;)
2576 {
2577 @@ -307,7 +319,7 @@
2578 len += snprintf(page + len, count - len,"\n");
2579
2580
2581 -
2582 +
2583 *eof = 1;
2584 return len;
2585
2586 @@ -319,16 +331,16 @@
2587 int *eof, void *data)
2588 {
2589 struct net_device *dev = data;
2590 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2591 -
2592 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2593 +
2594 int len = 0;
2595 -
2596 +
2597 len += snprintf(page + len, count - len,
2598 "NIC int: %lu\n"
2599 "Total int: %lu\n",
2600 priv->stats.ints,
2601 priv->stats.shints);
2602 -
2603 +
2604 *eof = 1;
2605 return len;
2606 }
2607 @@ -339,10 +351,10 @@
2608 int *eof, void *data)
2609 {
2610 struct net_device *dev = data;
2611 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2612 -
2613 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2614 +
2615 int len = 0;
2616 -
2617 +
2618 len += snprintf(page + len, count - len,
2619 "TX normal priority ok int: %lu\n"
2620 "TX normal priority error int: %lu\n"
2621 @@ -359,7 +371,7 @@
2622 "TX HW queue: %d\n"
2623 "TX lp dropped: %lu\n"
2624 "TX np dropped: %lu\n"
2625 - "TX total data packets %lu\n",
2626 + "TX total data packets %lu\n",
2627 // "TX beacon aborted: %lu\n",
2628 priv->stats.txnpokint,
2629 priv->stats.txnperr,
2630 @@ -379,10 +391,10 @@
2631 priv->stats.txdatapkt
2632 // priv->stats.txbeaconerr
2633 );
2634 -
2635 +
2636 *eof = 1;
2637 return len;
2638 -}
2639 +}
2640
2641
2642
2643 @@ -391,10 +403,10 @@
2644 int *eof, void *data)
2645 {
2646 struct net_device *dev = data;
2647 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2648 -
2649 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2650 +
2651 int len = 0;
2652 -
2653 +
2654 len += snprintf(page + len, count - len,
2655 "RX packets: %lu\n"
2656 "RX urb status error: %lu\n"
2657 @@ -402,21 +414,22 @@
2658 priv->stats.rxok,
2659 priv->stats.rxstaterr,
2660 priv->stats.rxurberr);
2661 -
2662 +
2663 *eof = 1;
2664 return len;
2665 -}
2666 -
2667 +}
2668
2669 +#if WIRELESS_EXT < 17
2670 static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
2671 {
2672 - struct r8180_priv *priv = ieee80211_priv(dev);
2673 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2674
2675 return &priv->wstats;
2676 }
2677 +#endif
2678
2679 void rtl8180_proc_module_init(void)
2680 -{
2681 +{
2682 DMESG("Initializing proc filesystem");
2683 rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net);
2684 }
2685 @@ -430,7 +443,7 @@
2686
2687 void rtl8180_proc_remove_one(struct net_device *dev)
2688 {
2689 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2690 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2691 if (priv->dir_dev) {
2692 // remove_proc_entry("stats-hw", priv->dir_dev);
2693 remove_proc_entry("stats-tx", priv->dir_dev);
2694 @@ -447,9 +460,9 @@
2695 void rtl8180_proc_init_one(struct net_device *dev)
2696 {
2697 struct proc_dir_entry *e;
2698 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2699 - priv->dir_dev = create_proc_entry(dev->name,
2700 - S_IFDIR | S_IRUGO | S_IXUGO,
2701 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2702 + priv->dir_dev = create_proc_entry(dev->name,
2703 + S_IFDIR | S_IRUGO | S_IXUGO,
2704 rtl8180_proc);
2705 if (!priv->dir_dev) {
2706 DMESGE("Unable to initialize /proc/net/rtl8187/%s\n",
2707 @@ -459,7 +472,7 @@
2708 #if 0
2709 e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO,
2710 priv->dir_dev, proc_get_stats_hw, dev);
2711 -
2712 +
2713 if (!e) {
2714 DMESGE("Unable to initialize "
2715 "/proc/net/rtl8187/%s/stats-hw\n",
2716 @@ -468,17 +481,17 @@
2717 #endif
2718 e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
2719 priv->dir_dev, proc_get_stats_rx, dev);
2720 -
2721 +
2722 if (!e) {
2723 DMESGE("Unable to initialize "
2724 "/proc/net/rtl8187/%s/stats-rx\n",
2725 dev->name);
2726 }
2727 -
2728 -
2729 +
2730 +
2731 e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
2732 priv->dir_dev, proc_get_stats_tx, dev);
2733 -
2734 +
2735 if (!e) {
2736 DMESGE("Unable to initialize "
2737 "/proc/net/rtl8187/%s/stats-tx\n",
2738 @@ -487,27 +500,27 @@
2739 #if 0
2740 e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO,
2741 priv->dir_dev, proc_get_stats_ieee, dev);
2742 -
2743 +
2744 if (!e) {
2745 DMESGE("Unable to initialize "
2746 "/proc/net/rtl8187/%s/stats-ieee\n",
2747 dev->name);
2748 }
2749 -
2750 -
2751 +
2752 +
2753 e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
2754 priv->dir_dev, proc_get_stats_ap, dev);
2755 -
2756 +
2757 if (!e) {
2758 DMESGE("Unable to initialize "
2759 "/proc/net/rtl8187/%s/stats-ap\n",
2760 dev->name);
2761 }
2762 #endif
2763 -
2764 +
2765 e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
2766 priv->dir_dev, proc_get_registers, dev);
2767 -
2768 +
2769 if (!e) {
2770 DMESGE("Unable to initialize "
2771 "/proc/net/rtl8187/%s/registers\n",
2772 @@ -523,14 +536,14 @@
2773 {
2774 int i;
2775 u8 *buf =(u8*)buffer;
2776 -
2777 +
2778 printk("ASCII BUFFER DUMP (len: %x):\n",len);
2779 -
2780 +
2781 for(i=0;i<len;i++)
2782 printk("%c",buf[i]);
2783 -
2784 +
2785 printk("\nBINARY BUFFER DUMP (len: %x):\n",len);
2786 -
2787 +
2788 for(i=0;i<len;i++)
2789 printk("%x",buf[i]);
2790
2791 @@ -539,17 +552,17 @@
2792
2793 short check_nic_enought_desc(struct net_device *dev, priority_t priority)
2794 {
2795 - struct r8180_priv *priv = ieee80211_priv(dev);
2796 -
2797 - int used = atomic_read((priority == NORM_PRIORITY) ?
2798 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2799 +
2800 + int used = atomic_read((priority == NORM_PRIORITY) ?
2801 &priv->tx_np_pending : &priv->tx_lp_pending);
2802 -
2803 +
2804 return (used < MAX_TX_URB);
2805 }
2806
2807 void tx_timeout(struct net_device *dev)
2808 {
2809 - struct r8180_priv *priv = ieee80211_priv(dev);
2810 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2811 //rtl8180_commit(dev);
2812 schedule_work(&priv->reset_wq);
2813 //DMESG("TXTIMEOUT");
2814 @@ -561,7 +574,20 @@
2815 {
2816 int i;
2817 for(i=0; i<63; i++)
2818 - DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
2819 + DMESG("EEPROM addr %02X : %04X", i, eprom_read(dev,i));
2820 +}
2821 +
2822 +/* this is only for debug */
2823 +void dump_tx_power(struct net_device *dev)
2824 +{
2825 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2826 + int i;
2827 + DMESG("CCK TX-Power (b-mode):");
2828 + for(i=1; i<=14; i++)
2829 + DMESG("Channel %d: %d", i, priv->chtxpwr[i]);
2830 + DMESG("OFDM TX-Power (g-mode):");
2831 + for(i=1; i<=14; i++)
2832 + DMESG("Channel %d: %d", i, priv->chtxpwr_ofdm[i]);
2833 }
2834
2835 /* this is only for debug */
2836 @@ -570,14 +596,14 @@
2837 int i;
2838 int n;
2839 int max=0xff;
2840 -
2841 - DMESG("Dumping NIC register map");
2842 -
2843 +
2844 + DMESG("Dumping NIC register map");
2845 +
2846 for(n=0;n<=max;)
2847 {
2848 - printk( "\nD: %2x> ", n);
2849 + printk( "\nD: %02X> ", n);
2850 for(i=0;i<16 && n<=max;i++,n++)
2851 - printk("%2x ",read_nic_byte(dev,n));
2852 + printk("%02X ",read_nic_byte(dev,n));
2853 }
2854 printk("\n");
2855 }
2856 @@ -589,11 +615,11 @@
2857
2858 void rtl8180_irq_enable(struct net_device *dev)
2859 {
2860 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2861 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2862 //priv->irq_enabled = 1;
2863 /*
2864 - write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
2865 - INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
2866 + write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
2867 + INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
2868 INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
2869 INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
2870 */
2871 @@ -603,7 +629,7 @@
2872
2873 void rtl8180_irq_disable(struct net_device *dev)
2874 {
2875 -// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2876 +// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2877
2878 write_nic_word(dev,INTA_MASK,0);
2879 force_pci_posting(dev);
2880 @@ -625,115 +651,115 @@
2881
2882 void rtl8180_update_msr(struct net_device *dev)
2883 {
2884 - struct r8180_priv *priv = ieee80211_priv(dev);
2885 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2886 u8 msr;
2887 -
2888 +
2889 msr = read_nic_byte(dev, MSR);
2890 msr &= ~ MSR_LINK_MASK;
2891 -
2892 +
2893 /* do not change in link_state != WLAN_LINK_ASSOCIATED.
2894 - * msr must be updated if the state is ASSOCIATING.
2895 + * msr must be updated if the state is ASSOCIATING.
2896 * this is intentional and make sense for ad-hoc and
2897 * master (see the create BSS/IBSS func)
2898 */
2899 - if (priv->ieee80211->state == IEEE80211_LINKED){
2900 -
2901 + if (priv->ieee80211->state == IEEE80211_LINKED){
2902 +
2903 if (priv->ieee80211->iw_mode == IW_MODE_INFRA)
2904 msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT);
2905 else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
2906 msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT);
2907 else if (priv->ieee80211->iw_mode == IW_MODE_MASTER)
2908 msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT);
2909 -
2910 +
2911 }else
2912 msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT);
2913 -
2914 +
2915 write_nic_byte(dev, MSR, msr);
2916 }
2917
2918 void rtl8180_set_chan(struct net_device *dev,short ch)
2919 {
2920 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2921 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2922 u32 tx;
2923 priv->chan=ch;
2924 #if 0
2925 - if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
2926 + if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
2927 priv->ieee80211->iw_mode == IW_MODE_MASTER){
2928 -
2929 - priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
2930 +
2931 + priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
2932 priv->ieee80211->master_chan = ch;
2933 - rtl8180_update_beacon_ch(dev);
2934 + rtl8180_update_beacon_ch(dev);
2935 }
2936 #endif
2937 -
2938 +
2939 /* this hack should avoid frame TX during channel setting*/
2940 tx = read_nic_dword(dev,TX_CONF);
2941 tx &= ~TX_LOOPBACK_MASK;
2942
2943 -#ifndef LOOP_TEST
2944 +#ifndef LOOP_TEST
2945 write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
2946 -
2947 priv->rf_set_chan(dev,priv->chan);
2948 mdelay(10);
2949 - write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
2950 + write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
2951 #endif
2952 }
2953 +
2954 void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs);
2955
2956
2957 void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb)
2958 {
2959 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2960 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2961 int err;
2962 -
2963 +
2964 // u8 *rx;
2965 -
2966 +
2967 //DMESG("starting RX");
2968 /*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC);
2969 - if(!rx){
2970 + if(!rx){
2971 DMESGE("unable to allocate RX buffer");
2972 return;
2973 }*/
2974 -
2975 +
2976 usb_fill_bulk_urb(rx_urb,priv->udev,
2977 usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer,
2978 RX_URB_SIZE,rtl8187_rx_isr,dev);
2979 - err = usb_submit_urb(rx_urb, GFP_ATOMIC);
2980 + err = usb_submit_urb(rx_urb, GFP_ATOMIC);
2981 if(err && err != -EPERM){
2982 DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status);
2983 -
2984 +
2985 }
2986 -
2987 +
2988 }
2989
2990
2991 void rtl8187_rx_initiate(struct net_device *dev)
2992 {
2993 int i;
2994 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2995 -
2996 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2997 +
2998 if(!priv->rx_urb)
2999 DMESGE("Cannot intiate RX urb mechanism");
3000 - for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
3001 + for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
3002 rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]);
3003 -
3004 +
3005 }
3006
3007 void rtl8187_set_rxconf(struct net_device *dev)
3008 {
3009 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3010 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3011 u32 rxconf;
3012 -
3013 +
3014 rxconf=read_nic_dword(dev,RX_CONF);
3015 rxconf = rxconf &~ MAC_FILTER_MASK;
3016 rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT);
3017 rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
3018 rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
3019 rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
3020 - rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
3021 + rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
3022
3023 if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
3024 -
3025 +
3026 if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
3027 dev->flags & IFF_PROMISC){
3028 rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
3029 @@ -741,40 +767,40 @@
3030 rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT);
3031 rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
3032 }
3033 -
3034 +
3035 /*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){
3036 rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
3037 rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
3038 }*/
3039 -
3040 +
3041 if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
3042 rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
3043 rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT);
3044 }
3045 -
3046 +
3047 if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
3048 rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
3049 -
3050 -
3051 +
3052 +
3053 rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
3054 rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
3055 -
3056 -
3057 +
3058 +
3059 rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
3060 -
3061 +
3062 rxconf = rxconf &~ MAX_RX_DMA_MASK;
3063 rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
3064 -
3065 +
3066 rxconf = rxconf | RCR_ONLYERLPKT;
3067 -
3068 +
3069 // rxconf = rxconf &~ RCR_CS_MASK;
3070 // rxconf = rxconf | (1<<RCR_CS_SHIFT);
3071
3072 - write_nic_dword(dev, RX_CONF, rxconf);
3073 -
3074 + write_nic_dword(dev, RX_CONF, rxconf);
3075 +
3076 // V rtl suggested V //
3077 // write_nic_dword(dev, RX_CONF, 0x901ce70e);
3078 -
3079 +
3080 //fix_rx_fifo(dev);
3081 // //set_nic_rxring(dev);
3082 #ifdef DEBUG_RX
3083 @@ -785,23 +811,23 @@
3084 void rtl8180_rx_enable(struct net_device *dev)
3085 {
3086 u8 cmd;
3087 -
3088 -
3089 +
3090 +
3091 rtl8187_rx_initiate(dev);
3092
3093 - rtl8187_set_rxconf(dev);
3094 + rtl8187_set_rxconf(dev);
3095
3096 cmd=read_nic_byte(dev,CMD);
3097 write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
3098 #if 0
3099 - /* In rtl8139 driver seems that DMA threshold has to be written
3100 - * after enabling RX, so we rewrite RX_CONFIG register
3101 + /* In rtl8139 driver seems that DMA threshold has to be written
3102 + * after enabling RX, so we rewrite RX_CONFIG register
3103 */
3104 //mdelay(100);
3105 - write_nic_dword(dev, RX_CONF, rxconf);
3106 -
3107 + write_nic_dword(dev, RX_CONF, rxconf);
3108 +
3109 #endif
3110 -
3111 +
3112 }
3113
3114
3115 @@ -810,37 +836,37 @@
3116 u8 cmd;
3117 u8 byte;
3118 u32 txconf;
3119 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3120 -
3121 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3122 +
3123 byte = read_nic_byte(dev,CW_CONF);
3124 byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
3125 byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
3126 write_nic_byte(dev, CW_CONF, byte);
3127 -
3128 +
3129 byte = read_nic_byte(dev, TX_AGC_CTL);
3130 byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
3131 byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
3132 byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT);
3133 write_nic_byte(dev, TX_AGC_CTL, byte);
3134 -
3135 +
3136 txconf= read_nic_dword(dev,TX_CONF);
3137 -
3138 +
3139 #if 0
3140 if(priv->card_8185){
3141 -
3142 +
3143 txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
3144 -
3145 +
3146 }else{
3147 -
3148 - if(priv->ieee80211->hw_seq)
3149 +
3150 + if(priv->ieee80211->hw_seq)
3151 txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
3152 - else
3153 + else
3154 txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
3155 }
3156 #endif
3157
3158 txconf = txconf &~ TX_LOOPBACK_MASK;
3159 -
3160 +
3161 #ifndef LOOP_TEST
3162 txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
3163 #else
3164 @@ -848,23 +874,26 @@
3165 #endif
3166 txconf = txconf &~ TCR_DPRETRY_MASK;
3167 txconf = txconf &~ TCR_RTSRETRY_MASK;
3168 -
3169 - txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
3170 - txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
3171 -
3172 +
3173 + if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
3174 + {
3175 + txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
3176 + txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
3177 + }
3178 +
3179 txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
3180 -
3181 +
3182 txconf = txconf &~ TCR_MXDMA_MASK;
3183 txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
3184 -
3185 +
3186 txconf = txconf | TCR_CWMIN;
3187 txconf = txconf | TCR_DISCW;
3188 txconf = txconf &~ TCR_SWPLCPLEN;
3189 -
3190 +
3191 txconf=txconf | (1<<TX_NOICV_SHIFT);
3192 -
3193 +
3194 write_nic_dword(dev,TX_CONF,txconf);
3195 -
3196 +
3197 // V RTL suggested V //
3198 // write_nic_dword(dev,TX_CONF,0x00e00707);
3199
3200 @@ -872,9 +901,9 @@
3201 #ifdef DEBUG_TX
3202 DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF));
3203 #endif
3204 -
3205 +
3206 cmd=read_nic_byte(dev,CMD);
3207 - write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
3208 + write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
3209
3210 // mdelay(100);
3211 //write_nic_dword(dev,TX_CONF,txconf);
3212 @@ -889,18 +918,18 @@
3213 #if 0
3214 void rtl8180_beacon_tx_enable(struct net_device *dev)
3215 {
3216 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3217 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3218 priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
3219 rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
3220 - write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
3221 + write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
3222 rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
3223 }
3224
3225
3226 void rtl8180_
3227 -_disable(struct net_device *dev)
3228 +_disable(struct net_device *dev)
3229 {
3230 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3231 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3232 priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
3233 rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
3234 write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
3235 @@ -914,8 +943,8 @@
3236 {
3237 u8 cmd;
3238 int i;
3239 - struct r8180_priv *priv = ieee80211_priv(dev);
3240 -
3241 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3242 +
3243 cmd=read_nic_byte(dev,CMD);
3244 write_nic_byte(dev, CMD, cmd &~ \
3245 ((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
3246 @@ -926,9 +955,9 @@
3247 usb_kill_urb(priv->rx_urb[i]);
3248 }
3249 /*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT))
3250 - udelay(10);
3251 + udelay(10);
3252 */
3253 -
3254 +
3255 // if(!priv->rx_skb_complete)
3256 // dev_kfree_skb_any(priv->rx_skb);
3257 }
3258 @@ -939,14 +968,14 @@
3259 #if 0
3260 int i;
3261 u32 *tmp;
3262 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3263 -
3264 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3265 +
3266 priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
3267 - sizeof(u32)*8*count,
3268 + sizeof(u32)*8*count,
3269 &priv->txbeaconringdma);
3270 if (!priv->txbeaconring) return -1;
3271 for (tmp=priv->txbeaconring,i=0;i<count;i++){
3272 - *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
3273 + *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
3274 /*
3275 *(tmp+2) = (u32)dma_tmp;
3276 *(tmp+3) = bufsize;
3277 @@ -955,7 +984,7 @@
3278 *(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
3279 else
3280 *(tmp+4) = (u32)priv->txbeaconringdma;
3281 -
3282 +
3283 tmp=tmp+8;
3284 }
3285 #endif
3286 @@ -965,15 +994,15 @@
3287
3288 void rtl8180_reset(struct net_device *dev)
3289 {
3290 -
3291 +
3292 u8 cr;
3293 -
3294 +
3295 /* make sure the analog power is on before
3296 * reset, otherwise reset may fail
3297 */
3298 rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
3299 rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
3300 -
3301 +
3302 rtl8180_irq_disable(dev);
3303
3304 mdelay(200);
3305 @@ -981,19 +1010,19 @@
3306 write_nic_byte_E(dev,0x18,0x11);
3307 write_nic_byte_E(dev,0x18,0x00);
3308 mdelay(200);
3309 -
3310 +
3311 cr=read_nic_byte(dev,CMD);
3312 cr = cr & 2;
3313 cr = cr | (1<<CMD_RST_SHIFT);
3314 write_nic_byte(dev,CMD,cr);
3315 -
3316 +
3317 force_pci_posting(dev);
3318 -
3319 +
3320 mdelay(200);
3321 -
3322 - if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
3323 +
3324 + if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
3325 DMESGW("Card reset timeout!");
3326 - else
3327 + else
3328 DMESG("Card successfully reset");
3329
3330 rtl8180_set_mode(dev,EPROM_CMD_LOAD);
3331 @@ -1005,13 +1034,13 @@
3332 */
3333 rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
3334 rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
3335 -
3336 +
3337 }
3338
3339 inline u16 ieeerate2rtlrate(int rate)
3340 {
3341 switch(rate){
3342 - case 10:
3343 + case 10:
3344 return 0;
3345 case 20:
3346 return 1;
3347 @@ -1037,32 +1066,38 @@
3348 return 11;
3349 default:
3350 return 3;
3351 -
3352 +
3353 }
3354 }
3355 static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540};
3356 inline u16 rtl8180_rate2rate(short rate)
3357 {
3358 if (rate >11) return 0;
3359 - return rtl_rate[rate];
3360 + return rtl_rate[rate];
3361 +}
3362 +
3363 +inline u8 rtl8180_IsWirelessBMode(u16 rate)
3364 +{
3365 + if( ((rate <= 110) && (rate != 60) && (rate != 90)) || (rate == 220) )
3366 + return 1;
3367 + else return 0;
3368 }
3369 -
3370
3371 void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
3372 {
3373 struct net_device *dev = (struct net_device*)rx_urb->context;
3374 - struct r8180_priv *priv = ieee80211_priv(dev);
3375 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3376
3377 priv->rxurb_task = rx_urb;
3378 // DMESGW("David: Rx tasklet start!");
3379 - tasklet_schedule(&priv->irq_rx_tasklet);
3380 + tasklet_schedule(&priv->irq_rx_tasklet);
3381 // DMESGW("=David: Rx tasklet finish!");
3382 }
3383
3384 #if 0
3385 void rtl8180_tx_queues_stop(struct net_device *dev)
3386 {
3387 - //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3388 + //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3389 u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
3390 dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
3391 dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
3392 @@ -1078,7 +1113,7 @@
3393 {
3394 //FIXME !!
3395 #if 0
3396 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3397 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3398 priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
3399 rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
3400 write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
3401 @@ -1091,7 +1126,7 @@
3402 {
3403 // FIXME !!
3404 #if 0
3405 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3406 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3407 priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
3408 rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
3409 write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
3410 @@ -1105,14 +1140,19 @@
3411 */
3412 void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
3413 {
3414 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3415 -
3416 - short morefrag = 0;
3417 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3418 +
3419 + short morefrag = 0;
3420 unsigned long flags;
3421 struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
3422
3423 - if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
3424 - morefrag = 1;
3425 + if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->ieee80211->raw_tx != 1)
3426 + {
3427 + if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
3428 + {
3429 + morefrag = 1;
3430 + }
3431 + }
3432 // DMESG("%x %x", h->frame_ctl, h->seq_ctl);
3433 /*
3434 * This function doesn't require lock because we make
3435 @@ -1121,24 +1161,24 @@
3436 * the ieee stack, or from the try_wake_queue (again trought
3437 * the ieee stack.
3438 */
3439 - spin_lock_irqsave(&priv->tx_lock,flags);
3440 -
3441 + spin_lock_irqsave(&priv->tx_lock,flags);
3442 +
3443 //DMESG("TX");
3444 if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
3445 DMESG("Error: no TX slot ");
3446 - ieee80211_stop_queue(priv->ieee80211);
3447 + ieee80211_stop_queue_rtl7(priv->ieee80211);
3448 }
3449 -
3450 +
3451 rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
3452 ieeerate2rtlrate(rate));
3453
3454 priv->stats.txdatapkt++;
3455 -
3456 +
3457 if (!check_nic_enought_desc(dev, LOW_PRIORITY))
3458 - ieee80211_stop_queue(priv->ieee80211);
3459 -
3460 - spin_unlock_irqrestore(&priv->tx_lock,flags);
3461 -
3462 + ieee80211_stop_queue_rtl7(priv->ieee80211);
3463 +
3464 + spin_unlock_irqrestore(&priv->tx_lock,flags);
3465 +
3466 }
3467 #if 0
3468 /* This is a rough attempt to TX a frame
3469 @@ -1148,12 +1188,12 @@
3470 */
3471 int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
3472 {
3473 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3474 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3475 int ret;
3476 unsigned long flags;
3477 -
3478 +
3479 spin_lock_irqsave(&priv->tx_lock,flags);
3480 -
3481 +
3482 ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE);
3483 /*
3484 int i;
3485 @@ -1163,9 +1203,9 @@
3486 */
3487 priv->ieee80211->stats.tx_bytes+=skb->len;
3488 priv->ieee80211->stats.tx_packets++;
3489 -
3490 - spin_unlock_irqrestore(&priv->tx_lock,flags);
3491 -
3492 +
3493 + spin_unlock_irqrestore(&priv->tx_lock,flags);
3494 +
3495 dev_kfree_skb_any(skb);
3496 return ret;
3497 }
3498 @@ -1178,7 +1218,7 @@
3499 u16 duration;
3500 u16 drift;
3501 *ext=0;
3502 -
3503 +
3504 switch(rate){
3505 case 0://1mbps
3506 *ext=0;
3507 @@ -1187,7 +1227,7 @@
3508 if(drift ==0 ) break;
3509 duration++;
3510 break;
3511 -
3512 +
3513 case 1://2mbps
3514 *ext=0;
3515 duration = ((len+4)<<4) /0x4;
3516 @@ -1195,30 +1235,30 @@
3517 if(drift ==0 ) break;
3518 duration++;
3519 break;
3520 -
3521 +
3522 case 2: //5.5mbps
3523 *ext=0;
3524 duration = ((len+4)<<4) /0xb;
3525 drift = ((len+4)<<4) % 0xb;
3526 - if(drift ==0 )
3527 + if(drift ==0 )
3528 break;
3529 duration++;
3530 break;
3531 -
3532 +
3533 default:
3534 - case 3://11mbps
3535 + case 3://11mbps
3536 *ext=0;
3537 duration = ((len+4)<<4) /0x16;
3538 drift = ((len+4)<<4) % 0x16;
3539 - if(drift ==0 )
3540 + if(drift ==0 )
3541 break;
3542 duration++;
3543 - if(drift > 6)
3544 + if(drift > 6)
3545 break;
3546 *ext=1;
3547 break;
3548 }
3549 -
3550 +
3551 return duration;
3552 }
3553 #endif
3554 @@ -1228,7 +1268,7 @@
3555 void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs)
3556 {
3557 struct net_device *dev = (struct net_device*)tx_urb->context;
3558 - struct r8180_priv *priv = ieee80211_priv(dev);
3559 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3560 if(tx_urb->status == 0)
3561 priv->stats.txlpokint++;
3562 else
3563 @@ -1249,55 +1289,55 @@
3564 if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) ||
3565 (msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){
3566 write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE);
3567 - write_nic_byte(dev, MSR, msr);
3568 + write_nic_byte(dev, MSR, msr);
3569 }
3570 -
3571 -
3572 +
3573 +
3574 }
3575
3576
3577 void rtl8187_net_update(struct net_device *dev)
3578 {
3579
3580 - struct r8180_priv *priv = ieee80211_priv(dev);
3581 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3582 struct ieee80211_network *net;
3583 net = & priv->ieee80211->current_network;
3584 -
3585 -
3586 +
3587 +
3588 write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]);
3589 write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]);
3590 //for(i=0;i<ETH_ALEN;i++)
3591 // write_nic_byte(dev,BSSID+i,net->bssid[i]);
3592
3593 rtl8180_update_msr(dev);
3594 -
3595 +
3596 // rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
3597 write_nic_word(dev, AtimWnd, 2);
3598 - write_nic_word(dev, AtimtrItv, 100);
3599 + write_nic_word(dev, AtimtrItv, 100);
3600 write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval);
3601 write_nic_word(dev, BcnIntTime, 100);
3602 -
3603 +
3604
3605 }
3606
3607 void rtl8187_beacon_tx(struct net_device *dev)
3608 {
3609
3610 - struct r8180_priv *priv = ieee80211_priv(dev);
3611 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3612 struct sk_buff *skb;
3613 int i = 0;
3614 -
3615 +
3616 rtl8187_net_update(dev);
3617 -
3618 - skb = ieee80211_get_beacon(priv->ieee80211);
3619 -
3620 -
3621 - if(!skb){
3622 +
3623 + skb = ieee80211_get_beacon_rtl7(priv->ieee80211);
3624 +
3625 +
3626 + if(!skb){
3627 DMESG("not enought memory for allocating beacon");
3628 return;
3629 }
3630 -
3631 -#if 0
3632 +
3633 +#if 0
3634 while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){
3635 msleep_interruptible_rtl(HZ/2);
3636 if(i++ > 20){
3637 @@ -1307,7 +1347,7 @@
3638 }
3639 #endif
3640 write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7));
3641 -
3642 +
3643 i=0;
3644 //while(!read_nic_byte(dev,BQREQ & (1<<7)))
3645 while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 )
3646 @@ -1318,16 +1358,16 @@
3647 return ;
3648 }
3649 }
3650 -
3651 +
3652 rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY,
3653 0, priv->ieee80211->basic_rate);
3654 -
3655 +
3656 }
3657
3658 void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs)
3659 {
3660 struct net_device *dev = (struct net_device*)tx_urb->context;
3661 - struct r8180_priv *priv = ieee80211_priv(dev);
3662 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3663 if(tx_urb->status == 0)
3664 priv->stats.txnpokint++;
3665 else
3666 @@ -1339,10 +1379,10 @@
3667 }
3668
3669
3670 -/* This function do the real dirty work: it sends a TX command
3671 - * descriptor plus data URB
3672 +/* This function do the real dirty work: it sends a TX command
3673 + * descriptor plus data URB
3674 */
3675 -
3676 +
3677 short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority,
3678 short morefrag, short rate)
3679 {
3680 @@ -1352,8 +1392,8 @@
3681 int pend ;
3682 int status;
3683 struct urb *tx_urb;
3684 - int urb_len;
3685 - struct r8180_priv *priv = ieee80211_priv(dev);
3686 + int urb_len;
3687 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3688 // int rate = ieeerate2rtlrate(priv->ieee80211->rate);
3689
3690 pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
3691 @@ -1365,32 +1405,32 @@
3692 priv->stats.txlpdrop++;
3693 return -1;
3694 }
3695 -
3696 -
3697 +
3698 +
3699 //tx = kmalloc((len + 4*3), GFP_ATOMIC);
3700 urb_len = len + 4*3;
3701 if((0 == urb_len%64)||(0 == urb_len%512)) {
3702 - urb_len += 1;
3703 + urb_len += 1;
3704 }
3705 tx = kmalloc(urb_len, GFP_ATOMIC);
3706 if(!tx) return -ENOMEM;
3707 - //printk(KERN_WARNING "urb_len = %d\n", urb_len);
3708 + //printk(KERN_WARNING "urb_len = %d\n", urb_len);
3709 tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
3710 -
3711 +
3712 if(!tx_urb){
3713 -
3714 +
3715 kfree(tx);
3716 return -ENOMEM;
3717 }
3718 -
3719 +
3720 memcpy(tx+3,txbuf,len);
3721 tx[0] = 0;
3722 tx[0] |= len & 0xfff;
3723 tx[0] |= (1<<15);
3724 -
3725 +
3726 // if(priv->shortpre)
3727 // tx[0] |= (1<<16);
3728 -
3729 +
3730 //if(len > priv->rts_threshold){
3731 // tx[0] |= (1<<23); //ENABLE RTS
3732 // tx[0] |= (1<<18); //ENABLE CTS
3733 @@ -1399,18 +1439,18 @@
3734 tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
3735 tx[0] |= (rate << 24);
3736 tx[1] = 0;
3737 -
3738 +
3739 // duration = rtl8180_len2duration(len,
3740 -// rate,&ext);
3741 +// rate,&ext);
3742 // tx[1] |= (duration & 0x7fff) <<16;
3743 // if(ext) tx[1] |= (1<<31);
3744
3745 -
3746 +
3747 // tx[2] = 0x303020;
3748 tx[2] = 3; // CW min
3749 tx[2] |= (7<<4); //CW max
3750 tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim
3751 -
3752 +
3753 // printk("%x\n%x\n",tx[0],tx[1]);
3754
3755 #ifdef DUMP_TX
3756 @@ -1421,7 +1461,7 @@
3757 printk("---------------\n");
3758 #endif
3759
3760 -
3761 +
3762 /* FIXME check what EP is for low/norm PRI */
3763 usb_fill_bulk_urb(tx_urb,priv->udev,
3764 usb_sndbulkpipe(priv->udev,(priority == LOW_PRIORITY) ? 2:3), tx,
3765 @@ -1438,54 +1478,54 @@
3766 }
3767 }
3768
3769 -
3770 +
3771
3772 void rtl8180_irq_rx_tasklet(struct r8180_priv * priv);
3773
3774
3775 short rtl8187_usb_initendpoints(struct net_device *dev)
3776 {
3777 - struct r8180_priv *priv = ieee80211_priv(dev);
3778 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3779 int i;
3780 -
3781 +
3782 priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
3783 -
3784 +
3785 for(i=0;i<MAX_RX_URB;i++){
3786 priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL);
3787 - if(!priv->rx_urb[i])
3788 + if(!priv->rx_urb[i])
3789 goto destroy;
3790 -
3791 +
3792 priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL);
3793 - if(!priv->rx_urb[i]->transfer_buffer)
3794 + if(!priv->rx_urb[i]->transfer_buffer)
3795 goto destroy1;
3796 -
3797 +
3798 priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE;
3799 }
3800 -
3801 +
3802 return 0;
3803 -
3804 +
3805 destroy1:
3806 usb_free_urb(priv->rx_urb[i]);
3807 -
3808 +
3809 destroy:
3810 while (--i >= 0){
3811 kfree(priv->rx_urb[i]->transfer_buffer);
3812 usb_free_urb(priv->rx_urb[i]);
3813 }
3814 -
3815 +
3816 kfree(priv->rx_urb);
3817 -
3818 +
3819 priv->rx_urb = NULL;
3820 DMESGE("Endpoint Alloc Failure");
3821 return -ENOMEM;
3822 -
3823 +
3824 }
3825
3826 void rtl8187_usb_deleteendpoints(struct net_device *dev)
3827 {
3828 - struct r8180_priv *priv = ieee80211_priv(dev);
3829 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3830 int i;
3831 -
3832 +
3833 if(priv->rx_urb){
3834 for(i=0;i<MAX_RX_URB;i++){
3835 usb_kill_urb(priv->rx_urb[i]);
3836 @@ -1494,9 +1534,9 @@
3837 }
3838 kfree(priv->rx_urb);
3839 priv->rx_urb = NULL;
3840 -
3841 +
3842 }
3843 -
3844 +
3845 }
3846
3847
3848 @@ -1505,16 +1545,16 @@
3849 int i;
3850 u16 word;
3851 int basic_rate,min_rr_rate,max_rr_rate;
3852 -
3853 -// struct r8180_priv *priv = ieee80211_priv(dev);
3854 -
3855 - //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
3856 +
3857 +// struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3858 +
3859 + //if (ieee80211_is_54g_rtl7(priv->ieee80211->current_network) &&
3860 // priv->ieee80211->state == IEEE80211_LINKED){
3861 basic_rate = ieeerate2rtlrate(240);
3862 min_rr_rate = ieeerate2rtlrate(60);
3863 max_rr_rate = ieeerate2rtlrate(240);
3864 -
3865 -//
3866 +
3867 +//
3868 // }else{
3869 // basic_rate = ieeerate2rtlrate(20);
3870 // min_rr_rate = ieeerate2rtlrate(10);
3871 @@ -1526,21 +1566,21 @@
3872
3873 word = read_nic_word(dev, BRSR);
3874 word &= ~BRSR_MBR_8185;
3875 -
3876 +
3877
3878 for(i=0;i<=basic_rate;i++)
3879 word |= (1<<i);
3880
3881 write_nic_word(dev, BRSR, word);
3882 - //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
3883 + DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
3884 }
3885
3886
3887 void rtl8187_link_change(struct net_device *dev)
3888 {
3889 // int i;
3890 -
3891 - struct r8180_priv *priv = ieee80211_priv(dev);
3892 +
3893 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3894 //write_nic_word(dev, BintrItv, net->beacon_interval);
3895 rtl8187_net_update(dev);
3896 /*update timing params*/
3897 @@ -1553,24 +1593,24 @@
3898
3899 short rtl8180_init(struct net_device *dev)
3900 {
3901 -
3902 - struct r8180_priv *priv = ieee80211_priv(dev);
3903 +
3904 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3905 int i, j;
3906 u16 word;
3907 - int ch;
3908 + int ch, chans;
3909 //u16 version;
3910 - //u8 hw_version;
3911 - //u8 config3;
3912 -
3913 + u8 hw_version;
3914 + u8 config3;
3915 +
3916 //FIXME: these constants are placed in a bad pleace.
3917
3918 // priv->txbuffsize = 1024;
3919 // priv->txringcount = 32;
3920 // priv->rxbuffersize = 1024;
3921 -// priv->rxringcount = 32;
3922 +// priv->rxringcount = 32;
3923 // priv->txbeaconcount = 3;
3924 // priv->rx_skb_complete = 1;
3925 - //priv->txnp_pending.ispending=0;
3926 + //priv->txnp_pending.ispending=0;
3927 /* ^^ the SKB does not containt a partial RXed
3928 * packet (is empty)
3929 */
3930 @@ -1580,15 +1620,24 @@
3931 return -1;
3932 }
3933 ch=channels;
3934 + chans=0;
3935 + for (i=1; i<=14; i++) {
3936 + if( (u8)(ch & 0x01) ) chans++;
3937 + ch >>= 1;
3938 + }
3939 + DMESG("Enabling %d channels.", chans);
3940 + ch=channels;
3941 // set channels 1..14 allowed in given locale
3942 for (i=1; i<=14; i++) {
3943 (priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
3944 ch >>= 1;
3945 }
3946 //memcpy(priv->stats,0,sizeof(struct Stats));
3947 -
3948 +
3949 //priv->irq_enabled=0;
3950 -
3951 +
3952 + priv->dev = dev;
3953 +
3954 // priv->stats.rxdmafail=0;
3955 priv->stats.txrdu=0;
3956 // priv->stats.rxrdu=0;
3957 @@ -1612,33 +1661,37 @@
3958 // priv->stats.txbeaconerr=0;
3959 priv->stats.txlperr=0;
3960 priv->stats.txlpokint=0;
3961 -
3962 +
3963 priv->ieee80211->iw_mode = IW_MODE_INFRA;
3964 -
3965 +
3966 priv->retry_rts = DEFAULT_RETRY_RTS;
3967 priv->retry_data = DEFAULT_RETRY_DATA;
3968 priv->ieee80211->rate = 110; //11 mbps
3969 priv->ieee80211->short_slot = 1;
3970 - priv->ieee80211->mode = IEEE_G;
3971 + priv->ieee80211->mode = IEEE_G|IEEE_B;
3972 priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
3973 spin_lock_init(&priv->tx_lock);
3974 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
3975 INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
3976 +#else
3977 + INIT_WORK(&priv->reset_wq, rtl8180_restart);
3978 +#endif
3979 sema_init(&priv->wx_sem,1);
3980 tasklet_init(&priv->irq_rx_tasklet,
3981 (void(*)(unsigned long))rtl8180_irq_rx_tasklet,
3982 (unsigned long)priv);
3983
3984 - //priv->ieee80211->func =
3985 + //priv->ieee80211->func =
3986 // kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL);
3987 //memset(priv->ieee80211->func, 0,
3988 // sizeof(struct ieee80211_helper_functions));
3989 - priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
3990 + priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
3991 priv->ieee80211->iw_mode = IW_MODE_INFRA;
3992 - priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
3993 - IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
3994 + priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
3995 + IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
3996 IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE |
3997 /*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE;
3998 -
3999 +
4000 priv->ieee80211->active_scan = 1;
4001 priv->ieee80211->rate = 110; //11 mbps
4002 priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION;
4003 @@ -1655,51 +1708,51 @@
4004 priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume;
4005 //priv->ieee80211->start_send_beacons = NULL;
4006 //priv->ieee80211->stop_send_beacons = NULL;
4007 -
4008 +
4009 priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
4010 -
4011 +
4012 priv->card_8185 = 2;
4013 priv->phy_ver = 2;
4014 priv->card_type = USB;
4015 -
4016 +
4017 #if 0
4018 hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
4019 -
4020 +
4021 switch (hw_version){
4022 case HW_VERID_R8185_ABC:
4023 - DMESG("MAC controller is a RTL8185 b/g");
4024 + DMESG("MAC controller is a RTL8185 b/g");
4025 priv->card_8185 = 1;
4026 /* you should not find a card with 8225 PHY ver < C*/
4027 priv->phy_ver = 2;
4028 break;
4029 -
4030 +
4031 case HW_VERID_R8185_D:
4032 - DMESG("MAC controller is a RTL8185 b/g (V. D)");
4033 + DMESG("MAC controller is a RTL8185 b/g (V. D)");
4034 priv->card_8185 = 2;
4035 /* you should not find a card with 8225 PHY ver < C*/
4036 priv->phy_ver = 2;
4037 break;
4038 -
4039 +
4040 case HW_VERID_R8180_ABCD:
4041 DMESG("MAC controller is a RTL8180");
4042 priv->card_8185 = 0;
4043 break;
4044 -
4045 +
4046 case HW_VERID_R8180_F:
4047 DMESG("MAC controller is a RTL8180 (v. F)");
4048 priv->card_8185 = 0;
4049 break;
4050 -
4051 +
4052 default:
4053 DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version);
4054 priv->card_8185 = 0;
4055 break;
4056 }
4057 -
4058 -
4059 +
4060 +
4061 /* you should not found any 8185 Ver B Card */
4062 priv->card_8185_Bversion = 0;
4063 -
4064 +
4065 config3 = read_nic_byte(dev, CONFIG3);
4066 if(config3 & 0x8){
4067 priv->card_type = CARDBUS;
4068 @@ -1715,13 +1768,19 @@
4069 #endif
4070 priv->enable_gpio0 = 0;
4071
4072 -
4073 +
4074 + hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
4075 + config3 = read_nic_byte(dev, CONFIG3);
4076 +
4077 + DMESG("MAC chip version: %02X", hw_version);
4078 + DMESG("Card type: %02X", config3);
4079 +
4080 /* commented out just because we already do
4081 this when resetting the card
4082 andrea 20050924
4083 */
4084 #if 0
4085 -
4086 +
4087 u8 txcr, txreg50;
4088 u32 txreg54, txreg60;
4089
4090 @@ -1757,8 +1816,8 @@
4091 // DMESG("<<txcr:%x>>", txcr);
4092
4093 #endif
4094 -
4095 - /*the eeprom type is stored in RCR register bit #6 */
4096 +
4097 + /*the eeprom type is stored in RCR register bit #6 */
4098 if (RCR_9356SEL & read_nic_dword(dev, RCR)){
4099 priv->epromtype=EPROM_93c56;
4100 DMESG("Reported EEPROM chip is a 93c56 (2Kbit)");
4101 @@ -1766,58 +1825,73 @@
4102 priv->epromtype=EPROM_93c46;
4103 DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
4104 }
4105 -
4106 +
4107 dev->get_stats = rtl8180_stats;
4108 -
4109 +
4110 dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
4111 dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
4112 dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff;
4113 dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8;
4114 dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff;
4115 dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8;
4116 -
4117 +
4118 DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr));
4119 -
4120 +
4121 for(i=1,j=0; i<6; i+=2,j++){
4122 -
4123 +
4124 word = eprom_read(dev,EPROM_TXPW0 + j);
4125 priv->chtxpwr[i]=word & 0xf;
4126 priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4;
4127 priv->chtxpwr[i+1]=(word & 0xf00)>>8;
4128 priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12;
4129 }
4130 -
4131 +
4132 for(i=1,j=0; i<4; i+=2,j++){
4133 -
4134 +
4135 word = eprom_read(dev,EPROM_TXPW1 + j);
4136 priv->chtxpwr[i+6]=word & 0xf;
4137 priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4;
4138 priv->chtxpwr[i+6+1]=(word & 0xf00)>>8;
4139 priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12;
4140 }
4141 -
4142 +
4143 for(i=1,j=0; i<4; i+=2,j++){
4144 -
4145 +
4146 word = eprom_read(dev,EPROM_TXPW2 + j);
4147 priv->chtxpwr[i+6+4]=word & 0xf;
4148 priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4;
4149 priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8;
4150 priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12;
4151 }
4152 -
4153 -
4154 +
4155 +
4156 priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
4157 -
4158 +
4159 +#ifdef DEBUG_TX_POWER
4160 + dump_tx_power(dev);
4161 +#endif
4162 +
4163 + DMESG("RF Chip ID: %02X", priv->rf_chip);
4164 +
4165 word = eprom_read(dev,EPROM_TXPW_BASE);
4166 priv->cck_txpwr_base = word & 0xf;
4167 priv->ofdm_txpwr_base = (word>>4) & 0xf;
4168 -
4169 +
4170 + priv->txpwr_max = 0;
4171 + for(i=1; i<15; i++)
4172 + {
4173 + if(priv->chtxpwr[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr[i];
4174 + if(priv->chtxpwr_ofdm[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr_ofdm[i];
4175 + priv->chtxpwr_orig[i] = priv->chtxpwr[i];
4176 + priv->chtxpwr_ofdm_orig[i] = priv->chtxpwr_ofdm[i];
4177 + }
4178 +
4179 /* check RF frontend chipset */
4180 -
4181 +
4182 switch (priv->rf_chip) {
4183 -
4184 +
4185 case EPROM_RFCHIPID_RTL8225U:
4186 -
4187 +
4188 DMESG("Card reports RF frontend Realtek 8225");
4189 DMESGW("This driver has EXPERIMENTAL support for this chipset.");
4190 DMESGW("use it with care and at your own risk and");
4191 @@ -1834,28 +1908,28 @@
4192 DMESG("This seems a legacy 1st version radio");
4193 }
4194 priv->rf_close = rtl8225_rf_close;
4195 -
4196 +
4197 priv->max_sens = RTL8225_RF_MAX_SENS;
4198 priv->sens = RTL8225_RF_DEF_SENS;
4199 break;
4200 -
4201 +
4202 default:
4203 DMESGW("Unknown RF module %x",priv->rf_chip);
4204 DMESGW("Exiting...");
4205 return -1;
4206 -
4207 +
4208 }
4209 -
4210 +
4211 // DMESG("Energy threshold: %x",priv->cs_treshold);
4212 DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7);
4213 //DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2));
4214 -
4215 - if(rtl8187_usb_initendpoints(dev)!=0){
4216 +
4217 + if(rtl8187_usb_initendpoints(dev)!=0){
4218 DMESG("Endopoints initialization failed");
4219 return -ENOMEM;
4220 }
4221 -#if 0
4222 - if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
4223 +#if 0
4224 + if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
4225 return -ENOMEM;
4226
4227 if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
4228 @@ -1869,16 +1943,16 @@
4229 if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
4230 TX_LOWPRIORITY_RING_ADDR))
4231 return -ENOMEM;
4232 -
4233 -
4234 +
4235 +
4236 if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount))
4237 return -ENOMEM;
4238 #endif
4239 -
4240 +
4241
4242 #ifdef DEBUG_EPROM
4243 dump_eprom(dev);
4244 -#endif
4245 +#endif
4246 return 0;
4247
4248 }
4249 @@ -1898,7 +1972,7 @@
4250 rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
4251
4252 conf3 = read_nic_byte(dev, CONFIG3);
4253 - write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
4254 + write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
4255
4256 write_nic_dword(dev, ANAPARAM2, a);
4257
4258 @@ -1918,23 +1992,23 @@
4259
4260 conf3 = read_nic_byte(dev, CONFIG3);
4261 write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
4262 -
4263 +
4264 write_nic_dword(dev, ANAPARAM, a);
4265
4266 conf3 = read_nic_byte(dev, CONFIG3);
4267 write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
4268
4269 rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
4270 -
4271 +
4272 }
4273
4274
4275 void rtl8185_tx_antenna(struct net_device *dev, u8 ant)
4276 {
4277 - write_nic_byte(dev, TX_ANTENNA, ant);
4278 + write_nic_byte(dev, TX_ANTENNA, ant);
4279 force_pci_posting(dev);
4280 mdelay(1);
4281 -}
4282 +}
4283
4284
4285 void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data)
4286 @@ -1942,26 +2016,26 @@
4287 //u8 phyr;
4288 u32 phyw;
4289 // int i;
4290 -
4291 +
4292 adr |= 0x80;
4293 -
4294 +
4295 phyw= ((data<<8) | adr);
4296 -
4297 -
4298 -
4299 - // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
4300 +
4301 +
4302 +
4303 + // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
4304 write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24));
4305 write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16));
4306 write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8));
4307 write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) ));
4308
4309 //read_nic_dword(dev, PHY_ADR);
4310 -#if 0
4311 +#if 0
4312 for(i=0;i<10;i++){
4313 write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw);
4314 phyr = read_nic_byte(dev, PHY_READ);
4315 if(phyr == (data&0xff)) break;
4316 -
4317 +
4318 }
4319 #endif
4320 /* this is ok to fail when we write AGC table. check for AGC table might be
4321 @@ -1988,60 +2062,60 @@
4322
4323 void rtl8180_adapter_start(struct net_device *dev)
4324 {
4325 - struct r8180_priv *priv = ieee80211_priv(dev);
4326 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
4327 //u32 anaparam;
4328 //u8 config3;
4329 -
4330 +
4331 //rtl8180_rtx_disable(dev);
4332 rtl8180_reset(dev);
4333
4334 write_nic_byte(dev,0x85,0);
4335 write_nic_byte(dev,0x91,0);
4336 -
4337 +
4338 /* light blink! */
4339 write_nic_byte(dev,0x85,4);
4340 write_nic_byte(dev,0x91,1);
4341 write_nic_byte(dev,0x90,0);
4342 -
4343 +
4344 priv->irq_mask = 0xffff;
4345 /*
4346 priv->dma_poll_mask = 0;
4347 priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT);
4348 -*/
4349 +*/
4350 // rtl8180_beacon_tx_disable(dev);
4351 -
4352 +
4353 rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
4354 write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]);
4355 write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff );
4356
4357 rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
4358 rtl8180_update_msr(dev);
4359 -
4360 +
4361 rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
4362 -
4363 +
4364 write_nic_word(dev,0xf4,0xffff);
4365 write_nic_byte(dev,
4366 - CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
4367 + CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
4368
4369 rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
4370 -
4371 - write_nic_dword(dev,INT_TIMEOUT,0);
4372 +
4373 + write_nic_dword(dev,INT_TIMEOUT,0);
4374
4375 #ifdef DEBUG_REGISTERS
4376 - rtl8180_dump_reg(dev);
4377 + rtl8180_dump_reg(dev);
4378 #endif
4379 -
4380 -
4381 - write_nic_byte(dev, WPA_CONFIG, 0);
4382 +
4383 +
4384 + write_nic_byte(dev, WPA_CONFIG, 0);
4385
4386 write_nic_byte(dev, RATE_FALLBACK, 0x81);
4387 rtl8187_set_rate(dev);
4388 -
4389 - priv->rf_init(dev);
4390 +
4391 + priv->rf_init(dev);
4392
4393 if(priv->rf_set_sens != NULL)
4394 - priv->rf_set_sens(dev,priv->sens);
4395 -
4396 + priv->rf_set_sens(dev,priv->sens);
4397 +
4398 write_nic_word(dev,0x5e,1);
4399
4400 #if 1
4401 @@ -2054,13 +2128,13 @@
4402 write_nic_byte(dev, 0xff, 0x60);
4403
4404 write_nic_word(dev,0x5e,0);
4405 -
4406 -
4407 +
4408 +
4409 rtl8180_irq_enable(dev);
4410 /*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY));
4411 -
4412 +
4413 DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY));
4414 -
4415 +
4416 DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY));
4417 if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK");
4418 if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK");
4419 @@ -2077,8 +2151,8 @@
4420 void rtl8180_start_tx_beacon(struct net_device *dev)
4421 {
4422 int i;
4423 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
4424 - u16 word;
4425 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
4426 + u16 word;
4427 DMESG("Enabling beacon TX");
4428 //write_nic_byte(dev, 0x42,0xe6);// TCR
4429 //rtl8180_init_beacon(dev);
4430 @@ -2091,41 +2165,41 @@
4431 //write_nic_word(dev,0x7a,0);
4432 //write_nic_word(dev,0x7a,0x8000);
4433
4434 -
4435 +
4436 word = read_nic_word(dev, BcnItv);
4437 word &= ~BcnItv_BcnItv; // clear Bcn_Itv
4438 write_nic_word(dev, BcnItv, word);
4439
4440 - write_nic_word(dev, AtimWnd,
4441 + write_nic_word(dev, AtimWnd,
4442 read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd);
4443 -
4444 +
4445 word = read_nic_word(dev, BintrItv);
4446 word &= ~BintrItv_BintrItv;
4447 -
4448 - //word |= priv->ieee80211->beacon_interval *
4449 +
4450 + //word |= priv->ieee80211->beacon_interval *
4451 // ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1);
4452 // FIXME:FIXME check if correct ^^ worked with 0x3e8;
4453 -
4454 +
4455 write_nic_word(dev, BintrItv, word);
4456 -
4457 +
4458 //write_nic_word(dev,0x2e,0xe002);
4459 //write_nic_dword(dev,0x30,0xb8c7832e);
4460 for(i=0; i<ETH_ALEN; i++)
4461 write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]);
4462 -
4463 +
4464 // rtl8180_update_msr(dev);
4465
4466 -
4467 +
4468 //write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */
4469 -
4470 +
4471 rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
4472 -
4473 +
4474 rtl8180_irq_enable(dev);
4475 -
4476 +
4477 /* VV !!!!!!!!!! VV*/
4478 /*
4479 rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
4480 - write_nic_byte(dev,0x9d,0x00);
4481 + write_nic_byte(dev,0x9d,0x00);
4482 rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
4483 */
4484 }
4485 @@ -2135,137 +2209,138 @@
4486 ***************************************************************************/
4487 static struct net_device_stats *rtl8180_stats(struct net_device *dev)
4488 {
4489 - struct r8180_priv *priv = ieee80211_priv(dev);
4490 -
4491 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
4492 +
4493 return &priv->ieee80211->stats;
4494 }
4495
4496
4497 int _rtl8180_up(struct net_device *dev)
4498 {
4499 - struct r8180_priv *priv = ieee80211_priv(dev);
4500 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
4501
4502 priv->up=1;
4503 -
4504 - //DMESG("Bringing up iface");
4505 +
4506 +// DMESG("Bringing up iface");
4507
4508 rtl8180_adapter_start(dev);
4509 -
4510 rtl8180_rx_enable(dev);
4511 -
4512 rtl8180_tx_enable(dev);
4513 -
4514 - ieee80211_softmac_start_protocol(priv->ieee80211);
4515 -
4516 - ieee80211_reset_queue(priv->ieee80211);
4517 + ieee80211_softmac_start_protocol_rtl7(priv->ieee80211);
4518 + ieee80211_reset_queue_rtl7(priv->ieee80211);
4519 if(!netif_queue_stopped(dev))
4520 netif_start_queue(dev);
4521 else
4522 netif_wake_queue(dev);
4523 -
4524 return 0;
4525 }
4526
4527
4528 int rtl8180_open(struct net_device *dev)
4529 {
4530 - struct r8180_priv *priv = ieee80211_priv(dev);
4531 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
4532 int ret;
4533 -
4534 +
4535 down(&priv->wx_sem);
4536 +
4537 ret = rtl8180_up(dev);
4538 up(&priv->wx_sem);
4539 return ret;
4540 -
4541 +
4542 }
4543
4544
4545 int rtl8180_up(struct net_device *dev)
4546 {
4547 - struct r8180_priv *priv = ieee80211_priv(dev);
4548 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
4549
4550 if (priv->up == 1) return -1;
4551 -
4552 +
4553 return _rtl8180_up(dev);
4554 }
4555
4556
4557 int rtl8180_close(struct net_device *dev)
4558 {
4559 - struct r8180_priv *priv = ieee80211_priv(dev);
4560 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
4561 int ret;
4562 -
4563 +
4564 down(&priv->wx_sem);
4565 -
4566 +
4567 ret = rtl8180_down(dev);
4568 -
4569 +
4570 up(&priv->wx_sem);
4571 -
4572 +
4573 return ret;
4574
4575 }
4576
4577 int rtl8180_down(struct net_device *dev)
4578 {
4579 - struct r8180_priv *priv = ieee80211_priv(dev);
4580 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
4581
4582 if (priv->up == 0) return -1;
4583 -
4584 +
4585 priv->up=0;
4586
4587 /* FIXME */
4588 if (!netif_queue_stopped(dev))
4589 netif_stop_queue(dev);
4590 -
4591 +
4592 rtl8180_rtx_disable(dev);
4593 rtl8180_irq_disable(dev);
4594
4595 - ieee80211_softmac_stop_protocol(priv->ieee80211);
4596 -
4597 + ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
4598 +
4599 return 0;
4600 }
4601
4602
4603 void rtl8180_commit(struct net_device *dev)
4604 {
4605 - struct r8180_priv *priv = ieee80211_priv(dev);
4606 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
4607
4608 if (priv->up == 0) return ;
4609 -
4610 - ieee80211_softmac_stop_protocol(priv->ieee80211);
4611 -
4612 +
4613 + ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
4614 +
4615 rtl8180_irq_disable(dev);
4616 rtl8180_rtx_disable(dev);
4617 _rtl8180_up(dev);
4618 }
4619
4620 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
4621 +void rtl8180_restart(struct work_struct *work)
4622 +{
4623 + struct r8180_priv *priv = container_of(work, struct r8180_priv, reset_wq);
4624 + struct net_device *dev = priv->dev;
4625 +#else
4626 void rtl8180_restart(struct net_device *dev)
4627 {
4628 - struct r8180_priv *priv = ieee80211_priv(dev);
4629 -
4630 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
4631 +#endif
4632 down(&priv->wx_sem);
4633 -
4634 rtl8180_commit(dev);
4635 -
4636 +
4637 up(&priv->wx_sem);
4638 }
4639
4640 static void r8180_set_multicast(struct net_device *dev)
4641 {
4642 - struct r8180_priv *priv = ieee80211_priv(dev);
4643 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
4644 short promisc;
4645
4646 //down(&priv->wx_sem);
4647 -
4648 +
4649 /* FIXME FIXME */
4650 -
4651 +
4652 promisc = (dev->flags & IFF_PROMISC) ? 1:0;
4653 -
4654 +
4655 if (promisc != priv->promisc)
4656 // rtl8180_commit(dev);
4657 -
4658 +
4659 priv->promisc = promisc;
4660 -
4661 +
4662 //schedule_work(&priv->reset_wq);
4663 //up(&priv->wx_sem);
4664 }
4665 @@ -2273,17 +2348,17 @@
4666
4667 int r8180_set_mac_adr(struct net_device *dev, void *mac)
4668 {
4669 - struct r8180_priv *priv = ieee80211_priv(dev);
4670 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
4671 struct sockaddr *addr = mac;
4672 -
4673 +
4674 down(&priv->wx_sem);
4675 -
4676 +
4677 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
4678 -
4679 +
4680 schedule_work(&priv->reset_wq);
4681 -
4682 +
4683 up(&priv->wx_sem);
4684 -
4685 +
4686 return 0;
4687 }
4688
4689 @@ -2291,16 +2366,18 @@
4690 /* based on ipw2200 driver */
4691 int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
4692 {
4693 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
4694 -
4695 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
4696 + struct iwreq *wrq;
4697 + int ret;
4698 +
4699 down(&priv->wx_sem);
4700 -
4701 - struct iwreq *wrq = (struct iwreq *)rq;
4702 -
4703 - int ret=-1;
4704 +
4705 + wrq = (struct iwreq *)rq;
4706 +
4707 + ret=-1;
4708 switch (cmd) {
4709 case RTL_IOCTL_WPA_SUPPLICANT:
4710 - ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
4711 + ret = ieee80211_wpa_supplicant_ioctl_rtl7(priv->ieee80211, &wrq->u.data);
4712 break;
4713
4714 default:
4715 @@ -2309,7 +2386,7 @@
4716 }
4717
4718 up(&priv->wx_sem);
4719 -
4720 +
4721 return ret;
4722 }
4723
4724 @@ -2320,10 +2397,11 @@
4725 struct net_device *dev = (struct net_device*)rx_urb->context;
4726 int status,len,flen;
4727 struct sk_buff *skb;
4728 - u32 *desc;
4729 -
4730 + u8 *desc;
4731 + u8 signal,quality,rate;
4732 +
4733 //DMESG("rtl8187_rx_isr");
4734 -
4735 +
4736 struct ieee80211_rx_stats stats = {
4737 .signal = 0,
4738 .noise = -98,
4739 @@ -2332,43 +2410,111 @@
4740 .freq = IEEE80211_24GHZ_BAND,
4741 };
4742
4743 +
4744 //DMESG("RX %d ",rx_urb->status);
4745 status = rx_urb->status;
4746 if(status == 0){
4747 -
4748 +
4749 len = rx_urb->actual_length;
4750 - // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
4751 + // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
4752 len -= 4*4;/* 4 dword and 4 byte CRC */
4753 -
4754 +#if 0
4755 desc = (u32*)(rx_urb->transfer_buffer + len);
4756 -
4757 +
4758 flen = desc[0] & 0xfff;
4759 -
4760 +
4761 if( flen <= rx_urb->actual_length){
4762 -
4763 - stats.signal = (desc[1] & 0x7f00)>>8;
4764 - stats.noise = desc[1] &0xff;
4765 - stats.rate = desc[0] >> 20 & 0xf;
4766 +
4767 + //stats.signal = (desc[1] & 0x7f00)>>8;
4768 + //stats.noise = desc[1] &0xff;
4769 + signal=(desc[1]& (0xff0000))>>16;
4770 + signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
4771 +
4772 + quality=(desc[1] & (0xff));
4773 +
4774 + rate=(desc[0] &((1<<23)|(1<<22)|(1<<21)|(1<<20)))>>20;
4775 + // printk(KERN_INFO "rate is %d!\n",rate);
4776 + stats.rate = rtl8180_rate2rate(rate);
4777 + // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
4778 + //stats.rate = desc[0] >> 20 & 0xf;
4779 stats.mac_time[0] = desc[2];
4780 stats.mac_time[1] = desc[3];
4781 +#endif
4782 +
4783 + desc = rx_urb->transfer_buffer + len;
4784 +
4785 + flen = ((desc[1] & 0x0f) << 8) + (desc[0] & 0xff);
4786 +
4787 + if( flen <= rx_urb->actual_length){
4788 +
4789 + //stats.signal = (desc[1] & 0x7f00)>>8;
4790 + //stats.noise = desc[1] &0xff;
4791 + signal=(desc[6]& 0xfe)>>1;
4792 + //signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
4793 +
4794 + quality=desc[4] & 0xff;
4795 +
4796 + //rate=(desc[2] &((1<<7)|(1<<6)|(1<<5)|(1<<4)))>>4;
4797 + rate=(desc[2] & 0xf0)>>4;
4798 + // printk(KERN_INFO "rate is %d!\n",rate);
4799 + stats.rate = rtl8180_rate2rate(rate);
4800 + // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
4801 + //stats.rate = desc[0] >> 20 & 0xf;
4802 + stats.mac_time[0] = desc[8] + (desc[9]<<8) + (desc[10]<<16) + (desc[11]<<24);
4803 + stats.mac_time[1] = desc[12] + (desc[13]<<8) + (desc[14]<<16) + (desc[15]<<24);
4804 +
4805 +
4806 + //calculate link quality begin
4807 + if(!rtl8180_IsWirelessBMode(stats.rate) )
4808 + { // OFDM rate.
4809 + if(signal>90)
4810 + signal=90;
4811 + else if(signal<25)
4812 + signal=25;
4813 + signal = (90-signal)*100/65;
4814 + }
4815 + else
4816 + { // CCK rate.
4817 + if(signal>95)
4818 + signal = 95;
4819 + else if(signal<30)
4820 + signal = 30;
4821 + signal =(95-signal )*100/65;
4822 + }
4823 + priv->wstats.qual.level = signal;
4824 + // printk(KERN_INFO "signal is %d!\n",signal);
4825 + if(quality > 64)
4826 + priv ->wstats.qual.qual = 0;
4827 + else
4828 + priv ->wstats.qual.qual = ((64-quality) * 100) / 64; // SQ value is the SIGNAL_QUALITY returned to IORequest,
4829 + //and this value only appear when STA is associated to AP or
4830 + // STA is in IBSS mode
4831 + // printk(KERN_INFO "quality is %d!\n",priv->wstats.qual.qual);
4832 + priv->wstats.qual.noise = 100 - priv ->wstats.qual.qual;
4833 + priv->wstats.qual.updated = 7;
4834 + if(priv->ieee80211->iw_mode == IW_MODE_MONITOR)
4835 + {
4836 + stats.signal = priv->wstats.qual.level;
4837 + stats.noise = priv->wstats.qual.noise;
4838 + }
4839 + //calculate link quality end
4840 skb = dev_alloc_skb(flen-4);
4841 - //skb_reserve(skb,2);
4842 - if(skb){
4843 + if(skb){
4844 memcpy(skb_put(skb,flen-4),
4845 rx_urb->transfer_buffer,flen -4);
4846 -
4847 +
4848 #ifdef DUMP_RX
4849 int i;
4850 for(i=0;i<flen-4;i++)
4851 printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]);
4852 printk("------RATE %x:w---------------\n",stats.rate);
4853 -
4854 +
4855 #endif
4856 priv->stats.rxok++;
4857 // priv->rxskb = skb;
4858 // priv->tempstats = &stats;
4859
4860 - if(!ieee80211_rx(priv->ieee80211,
4861 + if(!ieee80211_rx_rtl7(priv->ieee80211,
4862 skb, &stats))
4863 dev_kfree_skb_any(skb);
4864 }
4865 @@ -2376,9 +2522,8 @@
4866 }else{
4867 priv->stats.rxstaterr++;
4868 priv->ieee80211->stats.rx_errors++;
4869 -
4870 }
4871 -
4872 +
4873 if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb);
4874 else DMESG("RX process aborted due to explicit shutdown");
4875 }
4876 @@ -2396,20 +2541,20 @@
4877 struct r8180_priv *priv= NULL;
4878 struct usb_device *udev = interface_to_usbdev(intf);
4879
4880 -//printk("===> rtl8187_usb_probe()\n");
4881 -
4882 - dev = alloc_ieee80211(sizeof(struct r8180_priv));
4883 -
4884 +//printk("===> rtl8187_usb_probe()\n");
4885 +
4886 + dev = alloc_ieee80211_rtl7(sizeof(struct r8180_priv));
4887 +
4888 SET_MODULE_OWNER(dev);
4889 - usb_set_intfdata(intf, dev);
4890 -
4891 + usb_set_intfdata(intf, dev);
4892 +
4893 SET_NETDEV_DEV(dev, &intf->dev);
4894
4895 - priv = ieee80211_priv(dev);
4896 + priv = ieee80211_priv_rtl7(dev);
4897 priv->ieee80211 = netdev_priv(dev);
4898 -
4899 +
4900 priv->udev=udev;
4901 -
4902 +
4903 dev->open = rtl8180_open;
4904 dev->stop = rtl8180_close;
4905 //dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
4906 @@ -2418,41 +2563,46 @@
4907 dev->do_ioctl = rtl8180_ioctl;
4908 dev->set_multicast_list = r8180_set_multicast;
4909 dev->set_mac_address = r8180_set_mac_adr;
4910 +#if WIRELESS_EXT >= 12
4911 +#if WIRELESS_EXT < 17
4912 dev->get_wireless_stats = r8180_get_wireless_stats;
4913 +#endif
4914 + dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
4915 +#endif
4916 dev->type=ARPHRD_ETHER;
4917 -
4918 +
4919 if (dev_alloc_name(dev, ifname) < 0){
4920 DMESG("Oops: devname already taken! Trying wlan%%d...\n");
4921 ifname = "wlan%d";
4922 dev_alloc_name(dev, ifname);
4923 }
4924 -
4925 +
4926 // dev->open=rtl8180_init;
4927 -
4928 - if(rtl8180_init(dev)!=0){
4929 +
4930 + if(rtl8180_init(dev)!=0){
4931 DMESG("Initialization failed");
4932 goto fail;
4933 }
4934 -
4935 +
4936 netif_carrier_off(dev);
4937 netif_stop_queue(dev);
4938 -
4939 +
4940 register_netdev(dev);
4941 -
4942 +
4943 rtl8180_proc_init_one(dev);
4944 -
4945 -
4946 +
4947 +
4948 DMESG("Driver probe completed\n");
4949 - return 0;
4950 + return 0;
4951 +
4952
4953 -
4954 fail:
4955 - free_ieee80211(dev);
4956 -
4957 + free_ieee80211_rtl7(dev);
4958 +
4959 DMESG("wlan driver load failed\n");
4960 -
4961 +
4962 return -ENODEV;
4963 -
4964 +
4965 }
4966
4967
4968 @@ -2461,13 +2611,13 @@
4969 struct r8180_priv *priv;
4970 struct net_device *dev = usb_get_intfdata(intf);
4971 if(dev){
4972 -
4973 +
4974 unregister_netdev(dev);
4975 -
4976 - priv=ieee80211_priv(dev);
4977 -
4978 +
4979 + priv=ieee80211_priv_rtl7(dev);
4980 +
4981 rtl8180_proc_remove_one(dev);
4982 -
4983 +
4984 rtl8180_down(dev);
4985 priv->rf_close(dev);
4986 //rtl8180_rtx_disable(dev);
4987 @@ -2478,12 +2628,12 @@
4988
4989 }
4990 // pci_disable_device(pdev);
4991 - free_ieee80211(dev);
4992 + free_ieee80211_rtl7(dev);
4993 DMESG("wlan driver removed\n");
4994 }
4995
4996
4997 -static int __init rtl8187_usb_module_init(void)
4998 +static int __init rtl8187_usb_module_init_rtl7(void)
4999 {
5000 printk(KERN_INFO "\nLinux kernel driver for RTL8187 \
5001 based WLAN cards\n");
5002 @@ -2495,7 +2645,7 @@
5003 }
5004
5005
5006 -static void __exit rtl8187_usb_module_exit(void)
5007 +static void __exit rtl8187_usb_module_exit_rtl7(void)
5008 {
5009 usb_deregister(&rtl8187_usb_driver);
5010
5011 @@ -2508,14 +2658,14 @@
5012 {
5013 unsigned long flags;
5014 short enough_desc;
5015 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
5016 -
5017 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
5018 +
5019 spin_lock_irqsave(&priv->tx_lock,flags);
5020 enough_desc = check_nic_enought_desc(dev,pri);
5021 - spin_unlock_irqrestore(&priv->tx_lock,flags);
5022 -
5023 + spin_unlock_irqrestore(&priv->tx_lock,flags);
5024 +
5025 if(enough_desc)
5026 - ieee80211_wake_queue(priv->ieee80211);
5027 + ieee80211_wake_queue_rtl7(priv->ieee80211);
5028 }
5029
5030
5031 @@ -2523,5 +2673,5 @@
5032 /***************************************************************************
5033 ------------------- module init / exit stubs ----------------
5034 ****************************************************************************/
5035 -module_init(rtl8187_usb_module_init);
5036 -module_exit(rtl8187_usb_module_exit);
5037 +module_init(rtl8187_usb_module_init_rtl7);
5038 +module_exit(rtl8187_usb_module_exit_rtl7);
5039 diff -Naur rtl8187_orig/beta-8187/r8187.h rtl8187_rawtx/beta-8187/r8187.h
5040 --- rtl8187_orig/beta-8187/r8187.h 2007-03-13 23:45:09.000000000 +0100
5041 +++ rtl8187_rawtx/beta-8187/r8187.h 2007-05-26 10:37:51.000000000 +0200
5042 @@ -1,17 +1,17 @@
5043 -/*
5044 +/*
5045 This is part of rtl8187 OpenSource driver.
5046 - Copyright (C) Andrea Merello 2004-2005 <[email protected]>
5047 + Copyright (C) Andrea Merello 2004-2005 <[email protected]>
5048 Released under the terms of GPL (General Public Licence)
5049 -
5050 - Parts of this driver are based on the GPL part of the
5051 +
5052 + Parts of this driver are based on the GPL part of the
5053 official realtek driver
5054 -
5055 - Parts of this driver are based on the rtl8180 driver skeleton
5056 +
5057 + Parts of this driver are based on the rtl8180 driver skeleton
5058 from Patric Schenke & Andres Salomon
5059 -
5060 +
5061 Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
5062 -
5063 - We want to tanks the Authors of those projects and the Ndiswrapper
5064 +
5065 + We want to tanks the Authors of those projects and the Ndiswrapper
5066 project Authors.
5067 */
5068
5069 @@ -26,7 +26,6 @@
5070
5071 #include <linux/module.h>
5072 #include <linux/kernel.h>
5073 -#include <linux/config.h>
5074 #include <linux/init.h>
5075 #include <linux/ioport.h>
5076 #include <linux/sched.h>
5077 @@ -47,6 +46,12 @@
5078 #include <asm/io.h>
5079 #include <asm/semaphore.h>
5080
5081 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
5082 +#include <linux/config.h>
5083 +#else
5084 +#include <linux/autoconf.h>
5085 +#endif
5086 +
5087 #include "ieee80211.h"
5088
5089 #define EPROM_93c46 0
5090 @@ -68,7 +73,7 @@
5091 {
5092 struct buffer *next;
5093 u32 *buf;
5094 -
5095 +
5096 } buffer;
5097
5098 #if 0
5099 @@ -123,18 +128,18 @@
5100 short epromtype;
5101 int irq;
5102 struct ieee80211_device *ieee80211;
5103 -
5104 +
5105 short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D */
5106 short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */
5107 short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
5108 short enable_gpio0;
5109 enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type;
5110 short hw_plcp_len;
5111 -
5112 +
5113 // spinlock_t irq_lock;
5114 // spinlock_t irq_th_lock;
5115 spinlock_t tx_lock;
5116 -
5117 +
5118 u16 irq_mask;
5119 // short irq_enabled;
5120 struct net_device *dev;
5121 @@ -143,13 +148,16 @@
5122 short max_sens;
5123 u8 chtxpwr[15]; //channels from 1 to 14, 0 not used
5124 u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used
5125 + u8 chtxpwr_orig[15]; //channels from 1 to 14, 0 not used
5126 + u8 chtxpwr_ofdm_orig[15]; //channels from 1 to 14, 0 not used
5127 u8 cck_txpwr_base;
5128 u8 ofdm_txpwr_base;
5129 + u8 txpwr_max;
5130 u8 challow[15]; //channels from 1 to 14, 0 not used
5131 short up;
5132 short crcmon; //if 1 allow bad crc frame reception in monitor mode
5133 -// short prism_hdr;
5134 -
5135 + short prism_hdr;
5136 +
5137 // struct timer_list scan_timer;
5138 /*short scanpending;
5139 short stopscan;*/
5140 @@ -158,7 +166,7 @@
5141 //u8 active_scan_num;
5142 struct semaphore wx_sem;
5143 // short hw_wep;
5144 -
5145 +
5146 // short digphy;
5147 // short antb;
5148 // short diversity;
5149 @@ -171,31 +179,31 @@
5150 void (*rf_close)(struct net_device *dev);
5151 void (*rf_init)(struct net_device *dev);
5152 //short rate;
5153 - short promisc;
5154 + short promisc;
5155 /*stats*/
5156 struct Stats stats;
5157 struct iw_statistics wstats;
5158 struct proc_dir_entry *dir_dev;
5159 -
5160 +
5161 /*RX stuff*/
5162 // u32 *rxring;
5163 // u32 *rxringtail;
5164 // dma_addr_t rxringdma;
5165 struct urb **rx_urb;
5166 -
5167 +
5168 //struct buffer *rxbuffer;
5169 //struct buffer *rxbufferhead;
5170 //int rxringcount;
5171 //u16 rxbuffersize;
5172 -
5173 - //struct sk_buff *rx_skb;
5174 +
5175 + //struct sk_buff *rx_skb;
5176
5177 //short rx_skb_complete;
5178
5179 //u32 rx_prevlen;
5180 atomic_t tx_lp_pending;
5181 atomic_t tx_np_pending;
5182 -#if 0
5183 +#if 0
5184 /*TX stuff*/
5185 u32 *txlpring;
5186 u32 *txhpring;
5187 @@ -225,7 +233,7 @@
5188 struct urb *rxurb_task;
5189 // u8 dma_poll_mask;
5190 //short tx_suspend;
5191 -
5192 +
5193 /* adhoc/master mode stuff */
5194 #if 0
5195 u32 *txbeacontail;
5196 @@ -239,18 +247,18 @@
5197 //u16 master_beaconinterval;
5198 // u32 master_beaconsize;
5199 //u16 beacon_interval;
5200 -
5201 +
5202 u8 retry_data;
5203 u8 retry_rts;
5204 -
5205 +
5206 struct work_struct reset_wq;
5207 -
5208 +
5209 }r8180_priv;
5210
5211
5212 -typedef enum{
5213 +typedef enum{
5214 LOW_PRIORITY ,
5215 - NORM_PRIORITY
5216 + NORM_PRIORITY
5217 } priority_t;
5218
5219
5220 diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.c rtl8187_rawtx/ieee80211/ieee80211_crypt.c
5221 --- rtl8187_orig/ieee80211/ieee80211_crypt.c 2007-03-13 23:45:09.000000000 +0100
5222 +++ rtl8187_rawtx/ieee80211/ieee80211_crypt.c 2007-05-26 10:38:07.000000000 +0200
5223 @@ -11,7 +11,6 @@
5224 *
5225 */
5226
5227 -#include <linux/config.h>
5228 #include <linux/version.h>
5229 #include <linux/module.h>
5230 #include <linux/init.h>
5231 @@ -19,6 +18,12 @@
5232 #include <asm/string.h>
5233 #include <asm/errno.h>
5234
5235 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
5236 +#include <linux/config.h>
5237 +#else
5238 +#include <linux/autoconf.h>
5239 +#endif
5240 +
5241 #include "ieee80211.h"
5242
5243 MODULE_AUTHOR("Jouni Malinen");
5244 @@ -38,7 +43,7 @@
5245
5246 static struct ieee80211_crypto *hcrypt;
5247
5248 -void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
5249 +void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *ieee,
5250 int force)
5251 {
5252 struct list_head *ptr, *n;
5253 @@ -61,13 +66,13 @@
5254 }
5255 }
5256
5257 -void ieee80211_crypt_deinit_handler(unsigned long data)
5258 +void ieee80211_crypt_deinit_handler_rtl7(unsigned long data)
5259 {
5260 struct ieee80211_device *ieee = (struct ieee80211_device *)data;
5261 unsigned long flags;
5262
5263 spin_lock_irqsave(&ieee->lock, flags);
5264 - ieee80211_crypt_deinit_entries(ieee, 0);
5265 + ieee80211_crypt_deinit_entries_rtl7(ieee, 0);
5266 if (!list_empty(&ieee->crypt_deinit_list)) {
5267 printk(KERN_DEBUG "%s: entries remaining in delayed crypt "
5268 "deletion list\n", ieee->dev->name);
5269 @@ -78,7 +83,7 @@
5270
5271 }
5272
5273 -void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
5274 +void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
5275 struct ieee80211_crypt_data **crypt)
5276 {
5277 struct ieee80211_crypt_data *tmp;
5278 @@ -103,7 +108,7 @@
5279 spin_unlock_irqrestore(&ieee->lock, flags);
5280 }
5281
5282 -int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
5283 +int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
5284 {
5285 unsigned long flags;
5286 struct ieee80211_crypto_alg *alg;
5287 @@ -128,7 +133,7 @@
5288 return 0;
5289 }
5290
5291 -int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops)
5292 +int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
5293 {
5294 unsigned long flags;
5295 struct list_head *ptr;
5296 @@ -159,7 +164,7 @@
5297 }
5298
5299
5300 -struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name)
5301 +struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name)
5302 {
5303 unsigned long flags;
5304 struct list_head *ptr;
5305 @@ -186,13 +191,13 @@
5306 }
5307
5308
5309 -static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; }
5310 -static void ieee80211_crypt_null_deinit(void *priv) {}
5311 +static void * ieee80211_crypt_null_init_rtl7(int keyidx) { return (void *) 1; }
5312 +static void ieee80211_crypt_null_deinit_rtl7(void *priv) {}
5313
5314 static struct ieee80211_crypto_ops ieee80211_crypt_null = {
5315 .name = "NULL",
5316 - .init = ieee80211_crypt_null_init,
5317 - .deinit = ieee80211_crypt_null_deinit,
5318 + .init = ieee80211_crypt_null_init_rtl7,
5319 + .deinit = ieee80211_crypt_null_deinit_rtl7,
5320 .encrypt_mpdu = NULL,
5321 .decrypt_mpdu = NULL,
5322 .encrypt_msdu = NULL,
5323 @@ -205,7 +210,7 @@
5324 };
5325
5326
5327 -static int __init ieee80211_crypto_init(void)
5328 +static int __init ieee80211_crypto_init_rtl7(void)
5329 {
5330 int ret = -ENOMEM;
5331
5332 @@ -217,7 +222,7 @@
5333 INIT_LIST_HEAD(&hcrypt->algs);
5334 spin_lock_init(&hcrypt->lock);
5335
5336 - ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null);
5337 + ret = ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_null);
5338 if (ret < 0) {
5339 kfree(hcrypt);
5340 hcrypt = NULL;
5341 @@ -227,7 +232,7 @@
5342 }
5343
5344
5345 -static void __exit ieee80211_crypto_deinit(void)
5346 +static void __exit ieee80211_crypto_deinit_rtl7(void)
5347 {
5348 struct list_head *ptr, *n;
5349
5350 @@ -247,13 +252,13 @@
5351 kfree(hcrypt);
5352 }
5353
5354 -EXPORT_SYMBOL(ieee80211_crypt_deinit_entries);
5355 -EXPORT_SYMBOL(ieee80211_crypt_deinit_handler);
5356 -EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit);
5357 -
5358 -EXPORT_SYMBOL(ieee80211_register_crypto_ops);
5359 -EXPORT_SYMBOL(ieee80211_unregister_crypto_ops);
5360 -EXPORT_SYMBOL(ieee80211_get_crypto_ops);
5361 +EXPORT_SYMBOL(ieee80211_crypt_deinit_entries_rtl7);
5362 +EXPORT_SYMBOL(ieee80211_crypt_deinit_handler_rtl7);
5363 +EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit_rtl7);
5364 +
5365 +EXPORT_SYMBOL(ieee80211_register_crypto_ops_rtl7);
5366 +EXPORT_SYMBOL(ieee80211_unregister_crypto_ops_rtl7);
5367 +EXPORT_SYMBOL(ieee80211_get_crypto_ops_rtl7);
5368
5369 -module_init(ieee80211_crypto_init);
5370 -module_exit(ieee80211_crypto_deinit);
5371 +module_init(ieee80211_crypto_init_rtl7);
5372 +module_exit(ieee80211_crypto_deinit_rtl7);
5373 diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c rtl8187_rawtx/ieee80211/ieee80211_crypt_ccmp.c
5374 --- rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c 2007-03-13 23:45:09.000000000 +0100
5375 +++ rtl8187_rawtx/ieee80211/ieee80211_crypt_ccmp.c 2007-05-26 10:38:07.000000000 +0200
5376 @@ -9,7 +9,6 @@
5377 * more details.
5378 */
5379
5380 -#include <linux/config.h>
5381 #include <linux/version.h>
5382 #include <linux/module.h>
5383 #include <linux/init.h>
5384 @@ -22,11 +21,22 @@
5385 #include <asm/string.h>
5386 #include <linux/wireless.h>
5387
5388 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
5389 +#include <linux/config.h>
5390 +#else
5391 +#include <linux/autoconf.h>
5392 +#endif
5393 +
5394 #include "ieee80211.h"
5395
5396
5397 #include <linux/crypto.h>
5398 -#include <asm/scatterlist.h>
5399 +
5400 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
5401 + #include <asm/scatterlist.h>
5402 +#else
5403 + #include <linux/scatterlist.h>
5404 +#endif
5405
5406 MODULE_AUTHOR("Jouni Malinen");
5407 MODULE_DESCRIPTION("Host AP crypt: CCMP");
5408 @@ -59,7 +69,7 @@
5409 u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN];
5410 };
5411
5412 -void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
5413 +void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_tfm *tfm,
5414 const u8 pt[16], u8 ct[16])
5415 {
5416 struct scatterlist src, dst;
5417 @@ -75,7 +85,7 @@
5418 crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
5419 }
5420
5421 -static void * ieee80211_ccmp_init(int key_idx)
5422 +static void * ieee80211_ccmp_init_rtl7(int key_idx)
5423 {
5424 struct ieee80211_ccmp_data *priv;
5425
5426 @@ -105,7 +115,7 @@
5427 }
5428
5429
5430 -static void ieee80211_ccmp_deinit(void *priv)
5431 +static void ieee80211_ccmp_deinit_rtl7(void *priv)
5432 {
5433 struct ieee80211_ccmp_data *_priv = priv;
5434 if (_priv && _priv->tfm)
5435 @@ -114,7 +124,7 @@
5436 }
5437
5438
5439 -static inline void xor_block(u8 *b, u8 *a, size_t len)
5440 +static inline void xor_block_rtl7(u8 *b, u8 *a, size_t len)
5441 {
5442 int i;
5443 for (i = 0; i < len; i++)
5444 @@ -122,7 +132,7 @@
5445 }
5446
5447
5448 -static void ccmp_init_blocks(struct crypto_tfm *tfm,
5449 +static void ccmp_init_blocks_rtl7(struct crypto_tfm *tfm,
5450 struct ieee80211_hdr *hdr,
5451 u8 *pn, size_t dlen, u8 *b0, u8 *auth,
5452 u8 *s0)
5453 @@ -186,18 +196,18 @@
5454 }
5455
5456 /* Start with the first block and AAD */
5457 - ieee80211_ccmp_aes_encrypt(tfm, b0, auth);
5458 - xor_block(auth, aad, AES_BLOCK_LEN);
5459 - ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
5460 - xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
5461 - ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
5462 + ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, auth);
5463 + xor_block_rtl7(auth, aad, AES_BLOCK_LEN);
5464 + ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
5465 + xor_block_rtl7(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
5466 + ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
5467 b0[0] &= 0x07;
5468 b0[14] = b0[15] = 0;
5469 - ieee80211_ccmp_aes_encrypt(tfm, b0, s0);
5470 + ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, s0);
5471 }
5472
5473
5474 -static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
5475 +static int ieee80211_ccmp_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
5476 {
5477 struct ieee80211_ccmp_data *key = priv;
5478 int data_len, i, blocks, last, len;
5479 @@ -237,7 +247,7 @@
5480 *pos++ = key->tx_pn[0];
5481
5482 hdr = (struct ieee80211_hdr *) skb->data;
5483 - ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
5484 + ccmp_init_blocks_rtl7(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
5485
5486 blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
5487 last = data_len % AES_BLOCK_LEN;
5488 @@ -245,13 +255,13 @@
5489 for (i = 1; i <= blocks; i++) {
5490 len = (i == blocks && last) ? last : AES_BLOCK_LEN;
5491 /* Authentication */
5492 - xor_block(b, pos, len);
5493 - ieee80211_ccmp_aes_encrypt(key->tfm, b, b);
5494 + xor_block_rtl7(b, pos, len);
5495 + ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b, b);
5496 /* Encryption, with counter */
5497 b0[14] = (i >> 8) & 0xff;
5498 b0[15] = i & 0xff;
5499 - ieee80211_ccmp_aes_encrypt(key->tfm, b0, e);
5500 - xor_block(pos, e, len);
5501 + ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, e);
5502 + xor_block_rtl7(pos, e, len);
5503 pos += len;
5504 }
5505
5506 @@ -262,7 +272,7 @@
5507 }
5508
5509
5510 -static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
5511 +static int ieee80211_ccmp_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
5512 {
5513 struct ieee80211_ccmp_data *key = priv;
5514 u8 keyidx, *pos;
5515 @@ -326,8 +336,8 @@
5516 return -4;
5517 }
5518
5519 - ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b);
5520 - xor_block(mic, b, CCMP_MIC_LEN);
5521 + ccmp_init_blocks_rtl7(key->tfm, hdr, pn, data_len, b0, a, b);
5522 + xor_block_rtl7(mic, b, CCMP_MIC_LEN);
5523
5524 blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
5525 last = data_len % AES_BLOCK_LEN;
5526 @@ -337,11 +347,11 @@
5527 /* Decrypt, with counter */
5528 b0[14] = (i >> 8) & 0xff;
5529 b0[15] = i & 0xff;
5530 - ieee80211_ccmp_aes_encrypt(key->tfm, b0, b);
5531 - xor_block(pos, b, len);
5532 + ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, b);
5533 + xor_block_rtl7(pos, b, len);
5534 /* Authentication */
5535 - xor_block(a, pos, len);
5536 - ieee80211_ccmp_aes_encrypt(key->tfm, a, a);
5537 + xor_block_rtl7(a, pos, len);
5538 + ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, a, a);
5539 pos += len;
5540 }
5541
5542 @@ -365,7 +375,7 @@
5543 }
5544
5545
5546 -static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
5547 +static int ieee80211_ccmp_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
5548 {
5549 struct ieee80211_ccmp_data *data = priv;
5550 int keyidx;
5551 @@ -396,7 +406,7 @@
5552 }
5553
5554
5555 -static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
5556 +static int ieee80211_ccmp_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
5557 {
5558 struct ieee80211_ccmp_data *data = priv;
5559
5560 @@ -420,7 +430,7 @@
5561 }
5562
5563
5564 -static char * ieee80211_ccmp_print_stats(char *p, void *priv)
5565 +static char * ieee80211_ccmp_print_stats_rtl7(char *p, void *priv)
5566 {
5567 struct ieee80211_ccmp_data *ccmp = priv;
5568 p += sprintf(p, "key[%d] alg=CCMP key_set=%d "
5569 @@ -437,34 +447,34 @@
5570 }
5571
5572
5573 -static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
5574 +static struct ieee80211_crypto_ops ieee80211_crypt_ccmp_rtl7 = {
5575 .name = "CCMP",
5576 - .init = ieee80211_ccmp_init,
5577 - .deinit = ieee80211_ccmp_deinit,
5578 - .encrypt_mpdu = ieee80211_ccmp_encrypt,
5579 - .decrypt_mpdu = ieee80211_ccmp_decrypt,
5580 + .init = ieee80211_ccmp_init_rtl7,
5581 + .deinit = ieee80211_ccmp_deinit_rtl7,
5582 + .encrypt_mpdu = ieee80211_ccmp_encrypt_rtl7,
5583 + .decrypt_mpdu = ieee80211_ccmp_decrypt_rtl7,
5584 .encrypt_msdu = NULL,
5585 .decrypt_msdu = NULL,
5586 - .set_key = ieee80211_ccmp_set_key,
5587 - .get_key = ieee80211_ccmp_get_key,
5588 - .print_stats = ieee80211_ccmp_print_stats,
5589 + .set_key = ieee80211_ccmp_set_key_rtl7,
5590 + .get_key = ieee80211_ccmp_get_key_rtl7,
5591 + .print_stats = ieee80211_ccmp_print_stats_rtl7,
5592 .extra_prefix_len = CCMP_HDR_LEN,
5593 .extra_postfix_len = CCMP_MIC_LEN,
5594 .owner = THIS_MODULE,
5595 };
5596
5597
5598 -static int __init ieee80211_crypto_ccmp_init(void)
5599 +static int __init ieee80211_crypto_ccmp_init_rtl7(void)
5600 {
5601 - return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp);
5602 + return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
5603 }
5604
5605
5606 -static void __exit ieee80211_crypto_ccmp_exit(void)
5607 +static void __exit ieee80211_crypto_ccmp_exit_rtl7(void)
5608 {
5609 - ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
5610 + ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
5611 }
5612
5613
5614 -module_init(ieee80211_crypto_ccmp_init);
5615 -module_exit(ieee80211_crypto_ccmp_exit);
5616 +module_init(ieee80211_crypto_ccmp_init_rtl7);
5617 +module_exit(ieee80211_crypto_ccmp_exit_rtl7);
5618 diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.h rtl8187_rawtx/ieee80211/ieee80211_crypt.h
5619 --- rtl8187_orig/ieee80211/ieee80211_crypt.h 2007-03-13 23:45:09.000000000 +0100
5620 +++ rtl8187_rawtx/ieee80211/ieee80211_crypt.h 2007-05-26 10:38:11.000000000 +0200
5621 @@ -75,12 +75,12 @@
5622 atomic_t refcnt;
5623 };
5624
5625 -int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
5626 -int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
5627 -struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
5628 -void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
5629 -void ieee80211_crypt_deinit_handler(unsigned long);
5630 -void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
5631 +int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
5632 +int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
5633 +struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
5634 +void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
5635 +void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
5636 +void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
5637 struct ieee80211_crypt_data **crypt);
5638
5639 #endif
5640 diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c rtl8187_rawtx/ieee80211/ieee80211_crypt_tkip.c
5641 --- rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c 2007-03-13 23:45:09.000000000 +0100
5642 +++ rtl8187_rawtx/ieee80211/ieee80211_crypt_tkip.c 2007-05-26 10:38:07.000000000 +0200
5643 @@ -9,7 +9,6 @@
5644 * more details.
5645 */
5646
5647 -#include <linux/config.h>
5648 #include <linux/version.h>
5649 #include <linux/module.h>
5650 #include <linux/init.h>
5651 @@ -21,13 +20,24 @@
5652 #include <linux/if_arp.h>
5653 #include <asm/string.h>
5654
5655 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
5656 +#include <linux/config.h>
5657 +#else
5658 +#include <linux/autoconf.h>
5659 +#endif
5660 +
5661 #include "ieee80211.h"
5662
5663 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
5664 + #include <asm/scatterlist.h>
5665 +#else
5666 + #include <linux/scatterlist.h>
5667 +#endif
5668
5669 #include <linux/crypto.h>
5670 -#include <asm/scatterlist.h>
5671 #include <linux/crc32.h>
5672
5673 +
5674 MODULE_AUTHOR("Jouni Malinen");
5675 MODULE_DESCRIPTION("Host AP crypt: TKIP");
5676 MODULE_LICENSE("GPL");
5677 @@ -62,7 +72,7 @@
5678 u8 rx_hdr[16], tx_hdr[16];
5679 };
5680
5681 -static void * ieee80211_tkip_init(int key_idx)
5682 +static void * ieee80211_tkip_init_rtl7(int key_idx)
5683 {
5684 struct ieee80211_tkip_data *priv;
5685
5686 @@ -101,7 +111,7 @@
5687 }
5688
5689
5690 -static void ieee80211_tkip_deinit(void *priv)
5691 +static void ieee80211_tkip_deinit_rtl7(void *priv)
5692 {
5693 struct ieee80211_tkip_data *_priv = priv;
5694 if (_priv && _priv->tfm_michael)
5695 @@ -200,7 +210,7 @@
5696
5697 #define PHASE1_LOOP_COUNT 8
5698
5699 -static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
5700 +static void tkip_mixing_phase1_rtl7(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
5701 {
5702 int i, j;
5703
5704 @@ -222,7 +232,7 @@
5705 }
5706
5707
5708 -static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
5709 +static void tkip_mixing_phase2_rtl7(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
5710 u16 IV16)
5711 {
5712 /* Make temporary area overlap WEP seed so that the final copy can be
5713 @@ -268,7 +278,7 @@
5714 #endif
5715 }
5716
5717 -static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
5718 +static int ieee80211_tkip_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
5719 {
5720 struct ieee80211_tkip_data *tkey = priv;
5721 int len;
5722 @@ -283,11 +293,11 @@
5723
5724 hdr = (struct ieee80211_hdr *) skb->data;
5725 if (!tkey->tx_phase1_done) {
5726 - tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2,
5727 + tkip_mixing_phase1_rtl7(tkey->tx_ttak, tkey->key, hdr->addr2,
5728 tkey->tx_iv32);
5729 tkey->tx_phase1_done = 1;
5730 }
5731 - tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
5732 + tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
5733
5734 len = skb->len - hdr_len;
5735 pos = skb_push(skb, 8);
5736 @@ -325,7 +335,7 @@
5737 return 0;
5738 }
5739
5740 -static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
5741 +static int ieee80211_tkip_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
5742 {
5743 struct ieee80211_tkip_data *tkey = priv;
5744 u8 rc4key[16];
5745 @@ -382,10 +392,10 @@
5746 }
5747
5748 if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) {
5749 - tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
5750 + tkip_mixing_phase1_rtl7(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
5751 tkey->rx_phase1_done = 1;
5752 }
5753 - tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16);
5754 + tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->rx_ttak, iv16);
5755
5756 plen = skb->len - hdr_len - 12;
5757
5758 @@ -428,10 +438,14 @@
5759 }
5760
5761
5762 -static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
5763 +static int michael_mic_rtl7(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
5764 u8 *data, size_t data_len, u8 *mic)
5765 {
5766 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
5767 + struct hash_desc desc;
5768 +#endif
5769 struct scatterlist sg[2];
5770 + int ret=0;
5771
5772 if (tkey->tfm_michael == NULL) {
5773 printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
5774 @@ -445,15 +459,24 @@
5775 sg[1].offset = offset_in_page(data);
5776 sg[1].length = data_len;
5777
5778 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
5779 crypto_digest_init(tkey->tfm_michael);
5780 crypto_digest_setkey(tkey->tfm_michael, key, 8);
5781 crypto_digest_update(tkey->tfm_michael, sg, 2);
5782 crypto_digest_final(tkey->tfm_michael, mic);
5783 +#else
5784 + if (crypto_hash_setkey(tkey->tfm_michael, key, 8))
5785 + return -1;
5786
5787 - return 0;
5788 + desc.tfm = tkey->tfm_michael;
5789 + desc.flags = 0;
5790 + ret = crypto_hash_digest(&desc, sg, data_len + 16, mic);
5791 +#endif
5792 +
5793 + return ret;
5794 }
5795
5796 -static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
5797 +static void michael_mic_hdr_rtl7(struct sk_buff *skb, u8 *hdr)
5798 {
5799 struct ieee80211_hdr *hdr11;
5800
5801 @@ -483,7 +506,7 @@
5802 }
5803
5804
5805 -static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv)
5806 +static int ieee80211_michael_mic_add_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
5807 {
5808 struct ieee80211_tkip_data *tkey = priv;
5809 u8 *pos;
5810 @@ -495,9 +518,9 @@
5811 return -1;
5812 }
5813
5814 - michael_mic_hdr(skb, tkey->tx_hdr);
5815 + michael_mic_hdr_rtl7(skb, tkey->tx_hdr);
5816 pos = skb_put(skb, 8);
5817 - if (michael_mic(tkey, &tkey->key[16], tkey->tx_hdr,
5818 + if (michael_mic_rtl7(tkey, &tkey->key[16], tkey->tx_hdr,
5819 skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
5820 return -1;
5821
5822 @@ -506,7 +529,7 @@
5823
5824
5825 #if WIRELESS_EXT >= 18
5826 -static void ieee80211_michael_mic_failure(struct net_device *dev,
5827 +static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
5828 struct ieee80211_hdr *hdr,
5829 int keyidx)
5830 {
5831 @@ -527,7 +550,7 @@
5832 wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev);
5833 }
5834 #elif WIRELESS_EXT >= 15
5835 -static void ieee80211_michael_mic_failure(struct net_device *dev,
5836 +static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
5837 struct ieee80211_hdr *hdr,
5838 int keyidx)
5839 {
5840 @@ -543,7 +566,7 @@
5841 wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
5842 }
5843 #else /* WIRELESS_EXT >= 15 */
5844 -static inline void ieee80211_michael_mic_failure(struct net_device *dev,
5845 +static inline void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
5846 struct ieee80211_hdr *hdr,
5847 int keyidx)
5848 {
5849 @@ -551,7 +574,7 @@
5850 #endif /* WIRELESS_EXT >= 15 */
5851
5852
5853 -static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
5854 +static int ieee80211_michael_mic_verify_rtl7(struct sk_buff *skb, int keyidx,
5855 int hdr_len, void *priv)
5856 {
5857 struct ieee80211_tkip_data *tkey = priv;
5858 @@ -560,8 +583,8 @@
5859 if (!tkey->key_set)
5860 return -1;
5861
5862 - michael_mic_hdr(skb, tkey->rx_hdr);
5863 - if (michael_mic(tkey, &tkey->key[24], tkey->rx_hdr,
5864 + michael_mic_hdr_rtl7(skb, tkey->rx_hdr);
5865 + if (michael_mic_rtl7(tkey, &tkey->key[24], tkey->rx_hdr,
5866 skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
5867 return -1;
5868 if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
5869 @@ -572,7 +595,7 @@
5870 skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2),
5871 keyidx);
5872 if (skb->dev)
5873 - ieee80211_michael_mic_failure(skb->dev, hdr, keyidx);
5874 + ieee80211_michael_mic_failure_rtl7(skb->dev, hdr, keyidx);
5875 tkey->dot11RSNAStatsTKIPLocalMICFailures++;
5876 return -1;
5877 }
5878 @@ -588,7 +611,7 @@
5879 }
5880
5881
5882 -static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
5883 +static int ieee80211_tkip_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
5884 {
5885 struct ieee80211_tkip_data *tkey = priv;
5886 int keyidx;
5887 @@ -618,7 +641,7 @@
5888 }
5889
5890
5891 -static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv)
5892 +static int ieee80211_tkip_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
5893 {
5894 struct ieee80211_tkip_data *tkey = priv;
5895
5896 @@ -648,7 +671,7 @@
5897 }
5898
5899
5900 -static char * ieee80211_tkip_print_stats(char *p, void *priv)
5901 +static char * ieee80211_tkip_print_stats_rtl7(char *p, void *priv)
5902 {
5903 struct ieee80211_tkip_data *tkip = priv;
5904 p += sprintf(p, "key[%d] alg=TKIP key_set=%d "
5905 @@ -675,34 +698,34 @@
5906 }
5907
5908
5909 -static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
5910 +static struct ieee80211_crypto_ops ieee80211_crypt_tkip_rtl7 = {
5911 .name = "TKIP",
5912 - .init = ieee80211_tkip_init,
5913 - .deinit = ieee80211_tkip_deinit,
5914 - .encrypt_mpdu = ieee80211_tkip_encrypt,
5915 - .decrypt_mpdu = ieee80211_tkip_decrypt,
5916 - .encrypt_msdu = ieee80211_michael_mic_add,
5917 - .decrypt_msdu = ieee80211_michael_mic_verify,
5918 - .set_key = ieee80211_tkip_set_key,
5919 - .get_key = ieee80211_tkip_get_key,
5920 - .print_stats = ieee80211_tkip_print_stats,
5921 + .init = ieee80211_tkip_init_rtl7,
5922 + .deinit = ieee80211_tkip_deinit_rtl7,
5923 + .encrypt_mpdu = ieee80211_tkip_encrypt_rtl7,
5924 + .decrypt_mpdu = ieee80211_tkip_decrypt_rtl7,
5925 + .encrypt_msdu = ieee80211_michael_mic_add_rtl7,
5926 + .decrypt_msdu = ieee80211_michael_mic_verify_rtl7,
5927 + .set_key = ieee80211_tkip_set_key_rtl7,
5928 + .get_key = ieee80211_tkip_get_key_rtl7,
5929 + .print_stats = ieee80211_tkip_print_stats_rtl7,
5930 .extra_prefix_len = 4 + 4, /* IV + ExtIV */
5931 .extra_postfix_len = 8 + 4, /* MIC + ICV */
5932 .owner = THIS_MODULE,
5933 };
5934
5935
5936 -static int __init ieee80211_crypto_tkip_init(void)
5937 +static int __init ieee80211_crypto_tkip_init_rtl7(void)
5938 {
5939 - return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip);
5940 + return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
5941 }
5942
5943
5944 -static void __exit ieee80211_crypto_tkip_exit(void)
5945 +static void __exit ieee80211_crypto_tkip_exit_rtl7(void)
5946 {
5947 - ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip);
5948 + ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
5949 }
5950
5951
5952 -module_init(ieee80211_crypto_tkip_init);
5953 -module_exit(ieee80211_crypto_tkip_exit);
5954 +module_init(ieee80211_crypto_tkip_init_rtl7);
5955 +module_exit(ieee80211_crypto_tkip_exit_rtl7);
5956 diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_wep.c rtl8187_rawtx/ieee80211/ieee80211_crypt_wep.c
5957 --- rtl8187_orig/ieee80211/ieee80211_crypt_wep.c 2007-03-13 23:45:09.000000000 +0100
5958 +++ rtl8187_rawtx/ieee80211/ieee80211_crypt_wep.c 2007-05-26 10:38:07.000000000 +0200
5959 @@ -9,7 +9,6 @@
5960 * more details.
5961 */
5962
5963 -#include <linux/config.h>
5964 #include <linux/version.h>
5965 #include <linux/module.h>
5966 #include <linux/init.h>
5967 @@ -18,13 +17,24 @@
5968 #include <linux/skbuff.h>
5969 #include <asm/string.h>
5970
5971 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
5972 +#include <linux/config.h>
5973 +#else
5974 +#include <linux/autoconf.h>
5975 +#endif
5976 +
5977 #include "ieee80211.h"
5978
5979
5980 #include <linux/crypto.h>
5981 -#include <asm/scatterlist.h>
5982 #include <linux/crc32.h>
5983
5984 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
5985 + #include <asm/scatterlist.h>
5986 +#else
5987 + #include <linux/scatterlist.h>
5988 +#endif
5989 +
5990 MODULE_AUTHOR("Jouni Malinen");
5991 MODULE_DESCRIPTION("Host AP crypt: WEP");
5992 MODULE_LICENSE("GPL");
5993 @@ -40,7 +50,7 @@
5994 };
5995
5996
5997 -static void * prism2_wep_init(int keyidx)
5998 +static void * prism2_wep_init_rtl7(int keyidx)
5999 {
6000 struct prism2_wep_data *priv;
6001
6002 @@ -72,7 +82,7 @@
6003 }
6004
6005
6006 -static void prism2_wep_deinit(void *priv)
6007 +static void prism2_wep_deinit_rtl7(void *priv)
6008 {
6009 struct prism2_wep_data *_priv = priv;
6010 if (_priv && _priv->tfm)
6011 @@ -87,7 +97,7 @@
6012 *
6013 * WEP frame payload: IV + TX key idx, RC4(data), ICV = RC4(CRC32(data))
6014 */
6015 -static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
6016 +static int prism2_wep_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
6017 {
6018 struct prism2_wep_data *wep = priv;
6019 u32 crc, klen, len;
6020 @@ -151,7 +161,7 @@
6021 * Returns 0 if frame was decrypted successfully and ICV was correct and -1 on
6022 * failure. If frame is OK, IV and ICV will be removed.
6023 */
6024 -static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
6025 +static int prism2_wep_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
6026 {
6027 struct prism2_wep_data *wep = priv;
6028 u32 crc, klen, plen;
6029 @@ -203,7 +213,7 @@
6030 }
6031
6032
6033 -static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
6034 +static int prism2_wep_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
6035 {
6036 struct prism2_wep_data *wep = priv;
6037
6038 @@ -217,7 +227,7 @@
6039 }
6040
6041
6042 -static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv)
6043 +static int prism2_wep_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
6044 {
6045 struct prism2_wep_data *wep = priv;
6046
6047 @@ -230,7 +240,7 @@
6048 }
6049
6050
6051 -static char * prism2_wep_print_stats(char *p, void *priv)
6052 +static char * prism2_wep_print_stats_rtl7(char *p, void *priv)
6053 {
6054 struct prism2_wep_data *wep = priv;
6055 p += sprintf(p, "key[%d] alg=WEP len=%d\n",
6056 @@ -239,34 +249,34 @@
6057 }
6058
6059
6060 -static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
6061 +static struct ieee80211_crypto_ops ieee80211_crypt_wep_rtl7 = {
6062 .name = "WEP",
6063 - .init = prism2_wep_init,
6064 - .deinit = prism2_wep_deinit,
6065 - .encrypt_mpdu = prism2_wep_encrypt,
6066 - .decrypt_mpdu = prism2_wep_decrypt,
6067 + .init = prism2_wep_init_rtl7,
6068 + .deinit = prism2_wep_deinit_rtl7,
6069 + .encrypt_mpdu = prism2_wep_encrypt_rtl7,
6070 + .decrypt_mpdu = prism2_wep_decrypt_rtl7,
6071 .encrypt_msdu = NULL,
6072 .decrypt_msdu = NULL,
6073 - .set_key = prism2_wep_set_key,
6074 - .get_key = prism2_wep_get_key,
6075 - .print_stats = prism2_wep_print_stats,
6076 + .set_key = prism2_wep_set_key_rtl7,
6077 + .get_key = prism2_wep_get_key_rtl7,
6078 + .print_stats = prism2_wep_print_stats_rtl7,
6079 .extra_prefix_len = 4, /* IV */
6080 .extra_postfix_len = 4, /* ICV */
6081 .owner = THIS_MODULE,
6082 };
6083
6084
6085 -static int __init ieee80211_crypto_wep_init(void)
6086 +static int __init ieee80211_crypto_wep_init_rtl7(void)
6087 {
6088 - return ieee80211_register_crypto_ops(&ieee80211_crypt_wep);
6089 + return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
6090 }
6091
6092
6093 -static void __exit ieee80211_crypto_wep_exit(void)
6094 +static void __exit ieee80211_crypto_wep_exit_rtl7(void)
6095 {
6096 - ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep);
6097 + ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
6098 }
6099
6100
6101 -module_init(ieee80211_crypto_wep_init);
6102 -module_exit(ieee80211_crypto_wep_exit);
6103 +module_init(ieee80211_crypto_wep_init_rtl7);
6104 +module_exit(ieee80211_crypto_wep_exit_rtl7);
6105 diff -Naur rtl8187_orig/ieee80211/ieee80211.h rtl8187_rawtx/ieee80211/ieee80211.h
6106 --- rtl8187_orig/ieee80211/ieee80211.h 2007-03-13 23:45:09.000000000 +0100
6107 +++ rtl8187_rawtx/ieee80211/ieee80211.h 2007-05-26 10:38:11.000000000 +0200
6108 @@ -156,6 +156,22 @@
6109 struct list_head list;
6110 };
6111
6112 +#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
6113 +/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
6114 + * (from linux-wlan-ng) */
6115 +struct linux_wlan_ng_val {
6116 + u32 did;
6117 + u16 status, len;
6118 + u32 data;
6119 +} __attribute__ ((packed));
6120 +
6121 +struct linux_wlan_ng_prism_hdr {
6122 + u32 msgcode, msglen;
6123 + char devname[16];
6124 + struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
6125 + noise, rate, istx, frmlen;
6126 +} __attribute__ ((packed));
6127 +
6128 struct ieee80211_hdr {
6129 u16 frame_ctl;
6130 u16 duration_id;
6131 @@ -840,14 +856,14 @@
6132
6133
6134 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
6135 -extern inline int is_multicast_ether_addr(const u8 *addr)
6136 +extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
6137 {
6138 return ((addr[0] != 0xff) && (0x01 & addr[0]));
6139 }
6140 #endif
6141
6142 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
6143 -extern inline int is_broadcast_ether_addr(const u8 *addr)
6144 +extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
6145 {
6146 return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
6147 (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
6148 @@ -1015,10 +1031,16 @@
6149 struct timer_list beacon_timer;
6150
6151 struct work_struct associate_complete_wq;
6152 +
6153 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
6154 + struct delayed_work associate_retry_wq;
6155 + struct delayed_work softmac_scan_wq;
6156 +#else
6157 struct work_struct associate_retry_wq;
6158 + struct work_struct softmac_scan_wq;
6159 +#endif
6160 struct work_struct start_ibss_wq;
6161 struct work_struct associate_procedure_wq;
6162 - struct work_struct softmac_scan_wq;
6163 struct work_struct wx_sync_scan_wq;
6164
6165 struct workqueue_struct *wq;
6166 @@ -1154,12 +1176,12 @@
6167
6168
6169
6170 -extern inline void *ieee80211_priv(struct net_device *dev)
6171 +extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
6172 {
6173 return ((struct ieee80211_device *)netdev_priv(dev))->priv;
6174 }
6175
6176 -extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
6177 +extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
6178 {
6179 /* Single white space is for Linksys APs */
6180 if (essid_len == 1 && essid[0] == ' ')
6181 @@ -1175,7 +1197,7 @@
6182 return 1;
6183 }
6184
6185 -extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
6186 +extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
6187 {
6188 /*
6189 * It is possible for both access points and our device to support
6190 @@ -1201,7 +1223,7 @@
6191 return 0;
6192 }
6193
6194 -extern inline int ieee80211_get_hdrlen(u16 fc)
6195 +extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
6196 {
6197 int hdrlen = 24;
6198
6199 @@ -1229,140 +1251,144 @@
6200
6201
6202 /* ieee80211.c */
6203 -extern void free_ieee80211(struct net_device *dev);
6204 -extern struct net_device *alloc_ieee80211(int sizeof_priv);
6205 +extern void free_ieee80211_rtl7(struct net_device *dev);
6206 +extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
6207
6208 -extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
6209 +extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
6210
6211 /* ieee80211_tx.c */
6212
6213 -extern int ieee80211_encrypt_fragment(
6214 +extern int ieee80211_encrypt_fragment_rtl7(
6215 struct ieee80211_device *ieee,
6216 struct sk_buff *frag,
6217 int hdr_len);
6218
6219 -extern int ieee80211_xmit(struct sk_buff *skb,
6220 +extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
6221 struct net_device *dev);
6222 -extern void ieee80211_txb_free(struct ieee80211_txb *);
6223 +extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
6224
6225
6226 /* ieee80211_rx.c */
6227 -extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
6228 +extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
6229 struct ieee80211_rx_stats *rx_stats);
6230 -extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
6231 +extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
6232 struct ieee80211_hdr *header,
6233 struct ieee80211_rx_stats *stats);
6234
6235 /* ieee80211_wx.c */
6236 -extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
6237 +extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
6238 struct iw_request_info *info,
6239 union iwreq_data *wrqu, char *key);
6240 -extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
6241 +extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
6242 struct iw_request_info *info,
6243 union iwreq_data *wrqu, char *key);
6244 -extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
6245 +extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
6246 struct iw_request_info *info,
6247 union iwreq_data *wrqu, char *key);
6248 /* ieee80211_softmac.c */
6249 -extern short ieee80211_is_54g(struct ieee80211_network net);
6250 -extern short ieee80211_is_shortslot(struct ieee80211_network net);
6251 -extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
6252 +extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
6253 +extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
6254 +extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
6255 struct ieee80211_rx_stats *rx_stats, u16 type,
6256 u16 stype);
6257 -extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
6258 +extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
6259
6260 -extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
6261 -extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
6262 -extern void ieee80211_start_bss(struct ieee80211_device *ieee);
6263 -extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
6264 -extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
6265 -extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
6266 -extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
6267 -extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
6268 -extern void ieee80211_disassociate(struct ieee80211_device *ieee);
6269 -extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
6270 -extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
6271 -extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
6272 -extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
6273 -extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
6274 -extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
6275 -extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
6276 -extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
6277 -extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
6278 -extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
6279 -extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
6280 -extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
6281 -extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
6282 -extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
6283 -extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
6284 -extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
6285 +extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
6286 +extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
6287 +extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
6288 +extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
6289 +extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
6290 +extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
6291 +extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
6292 +extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
6293 +extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
6294 +extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
6295 +extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
6296 +extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
6297 +extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
6298 +extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
6299 +extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
6300 +extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
6301 +extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
6302 +extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
6303 +extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
6304 +extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
6305 +extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
6306 +extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
6307 +extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
6308 +extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
6309 +extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
6310
6311 /* ieee80211_softmac_wx.c */
6312
6313 -extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
6314 +extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
6315 struct iw_request_info *info,
6316 union iwreq_data *wrqu, char *ext);
6317
6318 -extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
6319 +extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
6320 struct iw_request_info *info,
6321 union iwreq_data *awrq,
6322 char *extra);
6323
6324 -extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
6325 +extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
6326
6327 -extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
6328 +extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
6329 struct iw_request_info *info,
6330 union iwreq_data *wrqu, char *extra);
6331
6332 -extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
6333 +extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
6334 struct iw_request_info *info,
6335 union iwreq_data *wrqu, char *extra);
6336
6337 -extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
6338 +extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
6339 union iwreq_data *wrqu, char *b);
6340
6341 -extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
6342 +extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
6343 union iwreq_data *wrqu, char *b);
6344
6345 -extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
6346 +extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
6347 struct iw_request_info *a,
6348 union iwreq_data *wrqu, char *extra);
6349
6350 -extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
6351 +extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
6352 union iwreq_data *wrqu, char *b);
6353
6354 -extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
6355 +extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
6356 union iwreq_data *wrqu, char *b);
6357
6358 -extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
6359 +extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
6360 union iwreq_data *wrqu, char *b);
6361
6362 -extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
6363 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
6364 +extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
6365 +#else
6366 +extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
6367 +#endif
6368
6369 -extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
6370 +extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
6371 struct iw_request_info *info,
6372 union iwreq_data *wrqu, char *extra);
6373
6374 -extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
6375 +extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
6376 struct iw_request_info *info,
6377 union iwreq_data *wrqu, char *extra);
6378
6379 -extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
6380 +extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
6381 struct iw_request_info *info,
6382 union iwreq_data *wrqu, char *extra);
6383
6384 -extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
6385 +extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
6386 struct iw_request_info *info,
6387 union iwreq_data *wrqu, char *extra);
6388
6389 -extern const long ieee80211_wlan_frequencies[];
6390 +extern const long ieee80211_wlan_frequencies_rtl7[];
6391
6392 -extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
6393 +extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
6394 {
6395 ieee->scans++;
6396 }
6397
6398 -extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
6399 +extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
6400 {
6401 return ieee->scans;
6402 }
6403 @@ -1372,7 +1398,7 @@
6404 const char *s = essid;
6405 char *d = escaped;
6406
6407 - if (ieee80211_is_empty_essid(essid, essid_len)) {
6408 + if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
6409 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
6410 return escaped;
6411 }
6412 diff -Naur rtl8187_orig/ieee80211/ieee80211_module.c rtl8187_rawtx/ieee80211/ieee80211_module.c
6413 --- rtl8187_orig/ieee80211/ieee80211_module.c 2007-03-13 23:45:09.000000000 +0100
6414 +++ rtl8187_rawtx/ieee80211/ieee80211_module.c 2007-05-26 10:38:07.000000000 +0200
6415 @@ -31,7 +31,6 @@
6416 *******************************************************************************/
6417
6418 #include <linux/compiler.h>
6419 -#include <linux/config.h>
6420 #include <linux/errno.h>
6421 #include <linux/if_arp.h>
6422 #include <linux/in6.h>
6423 @@ -52,6 +51,12 @@
6424 #include <asm/uaccess.h>
6425 #include <net/arp.h>
6426
6427 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
6428 +#include <linux/config.h>
6429 +#else
6430 +#include <linux/autoconf.h>
6431 +#endif
6432 +
6433 #include "ieee80211.h"
6434
6435 MODULE_DESCRIPTION("802.11 data/management/control stack");
6436 @@ -60,7 +65,7 @@
6437
6438 #define DRV_NAME "ieee80211"
6439
6440 -static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
6441 +static inline int ieee80211_networks_allocate_rtl7(struct ieee80211_device *ieee)
6442 {
6443 if (ieee->networks)
6444 return 0;
6445 @@ -80,7 +85,7 @@
6446 return 0;
6447 }
6448
6449 -static inline void ieee80211_networks_free(struct ieee80211_device *ieee)
6450 +static inline void ieee80211_networks_free_rtl7(struct ieee80211_device *ieee)
6451 {
6452 if (!ieee->networks)
6453 return;
6454 @@ -88,7 +93,7 @@
6455 ieee->networks = NULL;
6456 }
6457
6458 -static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee)
6459 +static inline void ieee80211_networks_initialize_rtl7(struct ieee80211_device *ieee)
6460 {
6461 int i;
6462
6463 @@ -99,7 +104,7 @@
6464 }
6465
6466
6467 -struct net_device *alloc_ieee80211(int sizeof_priv)
6468 +struct net_device *alloc_ieee80211_rtl7(int sizeof_priv)
6469 {
6470 struct ieee80211_device *ieee;
6471 struct net_device *dev;
6472 @@ -113,17 +118,17 @@
6473 goto failed;
6474 }
6475 ieee = netdev_priv(dev);
6476 - dev->hard_start_xmit = ieee80211_xmit;
6477 + dev->hard_start_xmit = ieee80211_xmit_rtl7;
6478
6479 ieee->dev = dev;
6480
6481 - err = ieee80211_networks_allocate(ieee);
6482 + err = ieee80211_networks_allocate_rtl7(ieee);
6483 if (err) {
6484 IEEE80211_ERROR("Unable to allocate beacon storage: %d\n",
6485 err);
6486 goto failed;
6487 }
6488 - ieee80211_networks_initialize(ieee);
6489 + ieee80211_networks_initialize_rtl7(ieee);
6490
6491 /* Default fragmentation threshold is maximum payload size */
6492 ieee->fts = DEFAULT_FTS;
6493 @@ -138,7 +143,7 @@
6494 INIT_LIST_HEAD(&ieee->crypt_deinit_list);
6495 init_timer(&ieee->crypt_deinit_timer);
6496 ieee->crypt_deinit_timer.data = (unsigned long)ieee;
6497 - ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler;
6498 + ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler_rtl7;
6499
6500 spin_lock_init(&ieee->lock);
6501
6502 @@ -149,7 +154,7 @@
6503 ieee->ieee802_1x = 1;
6504 ieee->raw_tx = 0;
6505
6506 - ieee80211_softmac_init(ieee);
6507 + ieee80211_softmac_init_rtl7(ieee);
6508
6509 for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++)
6510 INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]);
6511 @@ -167,7 +172,7 @@
6512 }
6513
6514
6515 -void free_ieee80211(struct net_device *dev)
6516 +void free_ieee80211_rtl7(struct net_device *dev)
6517 {
6518 struct ieee80211_device *ieee = netdev_priv(dev);
6519
6520 @@ -175,9 +180,9 @@
6521 struct list_head *p, *q;
6522
6523
6524 - ieee80211_softmac_free(ieee);
6525 + ieee80211_softmac_free_rtl7(ieee);
6526 del_timer_sync(&ieee->crypt_deinit_timer);
6527 - ieee80211_crypt_deinit_entries(ieee, 1);
6528 + ieee80211_crypt_deinit_entries_rtl7(ieee, 1);
6529
6530 for (i = 0; i < WEP_KEYS; i++) {
6531 struct ieee80211_crypt_data *crypt = ieee->crypt[i];
6532 @@ -191,7 +196,7 @@
6533 }
6534 }
6535
6536 - ieee80211_networks_free(ieee);
6537 + ieee80211_networks_free_rtl7(ieee);
6538
6539 for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) {
6540 list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) {
6541 @@ -210,13 +215,13 @@
6542 u32 ieee80211_debug_level = 0;
6543 struct proc_dir_entry *ieee80211_proc = NULL;
6544
6545 -static int show_debug_level(char *page, char **start, off_t offset,
6546 +static int show_debug_level_rtl7(char *page, char **start, off_t offset,
6547 int count, int *eof, void *data)
6548 {
6549 return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
6550 }
6551
6552 -static int store_debug_level(struct file *file, const char *buffer,
6553 +static int store_debug_level_rtl7(struct file *file, const char *buffer,
6554 unsigned long count, void *data)
6555 {
6556 char buf[] = "0x00000000";
6557 @@ -243,7 +248,7 @@
6558 return strnlen(buf, count);
6559 }
6560
6561 -static int __init ieee80211_init(void)
6562 +static int __init ieee80211_init_rtl7(void)
6563 {
6564 struct proc_dir_entry *e;
6565
6566 @@ -268,7 +273,7 @@
6567 return 0;
6568 }
6569
6570 -static void __exit ieee80211_exit(void)
6571 +static void __exit ieee80211_exit_rtl7(void)
6572 {
6573 if (ieee80211_proc) {
6574 remove_proc_entry("debug_level", ieee80211_proc);
6575 @@ -282,9 +287,9 @@
6576 MODULE_PARM_DESC(debug, "debug output mask");
6577
6578
6579 -module_exit(ieee80211_exit);
6580 -module_init(ieee80211_init);
6581 +module_exit(ieee80211_exit_rtl7);
6582 +module_init(ieee80211_init_rtl7);
6583 #endif
6584
6585 -EXPORT_SYMBOL(alloc_ieee80211);
6586 -EXPORT_SYMBOL(free_ieee80211);
6587 +EXPORT_SYMBOL(alloc_ieee80211_rtl7);
6588 +EXPORT_SYMBOL(free_ieee80211_rtl7);
6589 diff -Naur rtl8187_orig/ieee80211/ieee80211_rx.c rtl8187_rawtx/ieee80211/ieee80211_rx.c
6590 --- rtl8187_orig/ieee80211/ieee80211_rx.c 2007-03-13 23:45:09.000000000 +0100
6591 +++ rtl8187_rawtx/ieee80211/ieee80211_rx.c 2007-05-26 10:38:07.000000000 +0200
6592 @@ -22,7 +22,6 @@
6593
6594
6595 #include <linux/compiler.h>
6596 -#include <linux/config.h>
6597 #include <linux/errno.h>
6598 #include <linux/if_arp.h>
6599 #include <linux/in6.h>
6600 @@ -43,18 +42,85 @@
6601 #include <asm/uaccess.h>
6602 #include <linux/ctype.h>
6603
6604 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
6605 +#include <linux/config.h>
6606 +#else
6607 +#include <linux/autoconf.h>
6608 +#endif
6609 +
6610 +
6611 #include "ieee80211.h"
6612
6613 -static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
6614 +static inline void ieee80211_monitor_rx_rtl7(struct ieee80211_device *ieee,
6615 struct sk_buff *skb,
6616 struct ieee80211_rx_stats *rx_stats)
6617 {
6618 - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
6619 - u16 fc = le16_to_cpu(hdr->frame_ctl);
6620 + struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data;
6621 + u16 fc = le16_to_cpu(hdr1->frame_ctl);
6622 + int prism_header;
6623 + int hdrlen, phdrlen, head_need, tail_need;
6624 +
6625 + if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) {
6626 + prism_header = 1;
6627 + phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
6628 + } else {
6629 + prism_header = 0;
6630 + phdrlen = 0;
6631 + }
6632 +
6633 + hdrlen = ieee80211_get_hdrlen_rtl7(fc);
6634 +
6635 + /* check if there is enough room for extra data; if not, expand skb
6636 + * buffer to be large enough for the changes */
6637 + head_need = phdrlen;
6638 + tail_need = 0;
6639 +#ifdef PRISM2_ADD_BOGUS_CRC
6640 + tail_need += 4;
6641 +#endif /* PRISM2_ADD_BOGUS_CRC */
6642 +
6643 + head_need -= skb_headroom(skb);
6644 + tail_need -= skb_tailroom(skb);
6645 +
6646 + if (head_need > 0 || tail_need > 0) {
6647 + if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
6648 + tail_need > 0 ? tail_need : 0,
6649 + GFP_ATOMIC)) {
6650 + printk(KERN_DEBUG "%s: ieee80211_rx failed to "
6651 + "reallocate skb buffer\n", ieee->dev->name);
6652 + dev_kfree_skb_any(skb);
6653 + return;
6654 + }
6655 + }
6656 +
6657 + if (prism_header == 1) {
6658 + struct linux_wlan_ng_prism_hdr *hdr;
6659 + hdr = (struct linux_wlan_ng_prism_hdr *)
6660 + skb_push(skb, phdrlen);
6661 + memset(hdr, 0, phdrlen);
6662 + hdr->msgcode = LWNG_CAP_DID_BASE;
6663 + hdr->msglen = sizeof(*hdr);
6664 + memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname));
6665 +#define LWNG_SETVAL(f,i,s,l,d) \
6666 +hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
6667 +hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
6668 + LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
6669 + LWNG_SETVAL(mactime, 2, 0, 4, ((u32)rx_stats->mac_time));
6670 + LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
6671 + LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
6672 + LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
6673 + LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
6674 + LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
6675 + LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
6676 + LWNG_SETVAL(istx, 9, 0, 4, 0);
6677 + LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
6678 +#undef LWNG_SETVAL
6679 + }
6680
6681 skb->dev = ieee->dev;
6682 skb->mac.raw = skb->data;
6683 - skb_pull(skb, ieee80211_get_hdrlen(fc));
6684 + skb_pull(skb, hdrlen);
6685 + if (prism_header)
6686 + skb_pull(skb, phdrlen);
6687 skb->pkt_type = PACKET_OTHERHOST;
6688 skb->protocol = __constant_htons(ETH_P_80211_RAW);
6689 memset(skb->cb, 0, sizeof(skb->cb));
6690 @@ -64,7 +130,7 @@
6691
6692 /* Called only as a tasklet (software IRQ) */
6693 static struct ieee80211_frag_entry *
6694 -ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq,
6695 +ieee80211_frag_cache_find_rtl7(struct ieee80211_device *ieee, unsigned int seq,
6696 unsigned int frag, u8 *src, u8 *dst)
6697 {
6698 struct ieee80211_frag_entry *entry;
6699 @@ -94,7 +160,7 @@
6700
6701 /* Called only as a tasklet (software IRQ) */
6702 static struct sk_buff *
6703 -ieee80211_frag_cache_get(struct ieee80211_device *ieee,
6704 +ieee80211_frag_cache_get_rtl7(struct ieee80211_device *ieee,
6705 struct ieee80211_hdr *hdr)
6706 {
6707 struct sk_buff *skb = NULL;
6708 @@ -133,7 +199,7 @@
6709 } else {
6710 /* received a fragment of a frame for which the head fragment
6711 * should have already been received */
6712 - entry = ieee80211_frag_cache_find(ieee, seq, frag, hdr->addr2,
6713 + entry = ieee80211_frag_cache_find_rtl7(ieee, seq, frag, hdr->addr2,
6714 hdr->addr1);
6715 if (entry != NULL) {
6716 entry->last_frag = frag;
6717 @@ -146,7 +212,7 @@
6718
6719
6720 /* Called only as a tasklet (software IRQ) */
6721 -static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee,
6722 +static int ieee80211_frag_cache_invalidate_rtl7(struct ieee80211_device *ieee,
6723 struct ieee80211_hdr *hdr)
6724 {
6725 u16 sc;
6726 @@ -156,7 +222,7 @@
6727 sc = le16_to_cpu(hdr->seq_ctl);
6728 seq = WLAN_GET_SEQ_SEQ(sc);
6729
6730 - entry = ieee80211_frag_cache_find(ieee, seq, -1, hdr->addr2,
6731 + entry = ieee80211_frag_cache_find_rtl7(ieee, seq, -1, hdr->addr2,
6732 hdr->addr1);
6733
6734 if (entry == NULL) {
6735 @@ -178,7 +244,7 @@
6736 *
6737 * Called by ieee80211_rx */
6738 static inline int
6739 -ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
6740 +ieee80211_rx_frame_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
6741 struct ieee80211_rx_stats *rx_stats, u16 type,
6742 u16 stype)
6743 {
6744 @@ -187,8 +253,8 @@
6745 * response parser uses it
6746 */
6747 rx_stats->len = skb->len;
6748 - ieee80211_rx_mgt(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
6749 - ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype);
6750 + ieee80211_rx_mgt_rtl7(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
6751 + ieee80211_rx_frame_softmac_rtl7(ieee, skb, rx_stats, type, stype);
6752
6753 dev_kfree_skb_any(skb);
6754
6755 @@ -253,7 +319,7 @@
6756 /* No encapsulation header if EtherType < 0x600 (=length) */
6757
6758 /* Called by ieee80211_rx_frame_decrypt */
6759 -static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee,
6760 +static int ieee80211_is_eapol_frame_rtl7(struct ieee80211_device *ieee,
6761 struct sk_buff *skb)
6762 {
6763 struct net_device *dev = ieee->dev;
6764 @@ -294,7 +360,7 @@
6765
6766 /* Called only as a tasklet (software IRQ), by ieee80211_rx */
6767 static inline int
6768 -ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb,
6769 +ieee80211_rx_frame_decrypt_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
6770 struct ieee80211_crypt_data *crypt)
6771 {
6772 struct ieee80211_hdr *hdr;
6773 @@ -304,7 +370,7 @@
6774 return 0;
6775
6776 hdr = (struct ieee80211_hdr *) skb->data;
6777 - hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
6778 + hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
6779
6780 #ifdef CONFIG_IEEE80211_CRYPT_TKIP
6781 if (ieee->tkip_countermeasures &&
6782 @@ -339,7 +405,7 @@
6783
6784 /* Called only as a tasklet (software IRQ), by ieee80211_rx */
6785 static inline int
6786 -ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb,
6787 +ieee80211_rx_frame_decrypt_msdu_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
6788 int keyidx, struct ieee80211_crypt_data *crypt)
6789 {
6790 struct ieee80211_hdr *hdr;
6791 @@ -349,7 +415,7 @@
6792 return 0;
6793
6794 hdr = (struct ieee80211_hdr *) skb->data;
6795 - hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
6796 + hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
6797
6798 atomic_inc(&crypt->refcnt);
6799 res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
6800 @@ -367,7 +433,7 @@
6801
6802 /* this function is stolen from ipw2200 driver*/
6803 #define IEEE_PACKET_RETRY_TIME (5*HZ)
6804 -static int is_duplicate_packet(struct ieee80211_device *ieee,
6805 +static int is_duplicate_packet_rtl7(struct ieee80211_device *ieee,
6806 struct ieee80211_hdr *header)
6807 {
6808 // u16 fc = le16_to_cpu(header->frame_ctl);
6809 @@ -444,7 +510,7 @@
6810 /* All received frames are sent to this function. @skb contains the frame in
6811 * IEEE 802.11 format, i.e., in the format it was sent over air.
6812 * This function is called only as a tasklet (software IRQ). */
6813 -int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
6814 +int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
6815 struct ieee80211_rx_stats *rx_stats)
6816 {
6817 struct net_device *dev = ieee->dev;
6818 @@ -483,7 +549,7 @@
6819 sc = le16_to_cpu(hdr->seq_ctl);
6820
6821 frag = WLAN_GET_SEQ_FRAG(sc);
6822 - hdrlen = ieee80211_get_hdrlen(fc);
6823 + hdrlen = ieee80211_get_hdrlen_rtl7(fc);
6824
6825 #ifdef NOT_YET
6826 #if WIRELESS_EXT > 15
6827 @@ -501,12 +567,12 @@
6828 }
6829 #endif /* IW_WIRELESS_SPY */
6830 #endif /* WIRELESS_EXT > 15 */
6831 - hostap_update_rx_stats(local->ap, hdr, rx_stats);
6832 + hostap_update_rx_stats_rtl7(local->ap, hdr, rx_stats);
6833 #endif
6834
6835 #if WIRELESS_EXT > 15
6836 if (ieee->iw_mode == IW_MODE_MONITOR) {
6837 - ieee80211_monitor_rx(ieee, skb, rx_stats);
6838 + ieee80211_monitor_rx_rtl7(ieee, skb, rx_stats);
6839 stats->rx_packets++;
6840 stats->rx_bytes += skb->len;
6841 return 1;
6842 @@ -529,7 +595,7 @@
6843 * stations that do not support WEP key mapping). */
6844
6845 if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key)
6846 - (void) hostap_handle_sta_crypto(local, hdr, &crypt,
6847 + (void) hostap_handle_sta_crypto_rtl7(local, hdr, &crypt,
6848 &sta);
6849 #endif
6850
6851 @@ -555,7 +621,7 @@
6852 if (skb->len < IEEE80211_DATA_HDR3_LEN)
6853 goto rx_dropped;
6854
6855 - if (is_duplicate_packet(ieee, hdr))
6856 + if (is_duplicate_packet_rtl7(ieee, hdr))
6857 goto rx_dropped;
6858
6859
6860 @@ -575,7 +641,7 @@
6861 #endif
6862
6863
6864 - if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype))
6865 + if (ieee80211_rx_frame_mgmt_rtl7(ieee, skb, rx_stats, type, stype))
6866 goto rx_dropped;
6867 else
6868 goto rx_exit;
6869 @@ -606,7 +672,7 @@
6870 }
6871
6872 #ifdef NOT_YET
6873 - if (hostap_rx_frame_wds(ieee, hdr, fc, &wds))
6874 + if (hostap_rx_frame_wds_rtl7(ieee, hdr, fc, &wds))
6875 goto rx_dropped;
6876 if (wds) {
6877 skb->dev = dev = wds;
6878 @@ -619,7 +685,7 @@
6879 memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) {
6880 /* Frame from BSSID of the AP for which we are a client */
6881 skb->dev = dev = ieee->stadev;
6882 - stats = hostap_get_stats(dev);
6883 + stats = hostap_get_stats_rtl7(dev);
6884 from_assoc_ap = 1;
6885 }
6886 #endif
6887 @@ -630,7 +696,7 @@
6888 if ((ieee->iw_mode == IW_MODE_MASTER ||
6889 ieee->iw_mode == IW_MODE_REPEAT) &&
6890 !from_assoc_ap) {
6891 - switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats,
6892 + switch (hostap_handle_sta_rx_rtl7(ieee, dev, skb, rx_stats,
6893 wds != NULL)) {
6894 case AP_RX_CONTINUE_NOT_AUTHORIZED:
6895 frame_authorized = 0;
6896 @@ -664,7 +730,7 @@
6897 /* skb: hdr + (possibly fragmented, possibly encrypted) payload */
6898
6899 if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
6900 - (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0)
6901 + (keyidx = ieee80211_rx_frame_decrypt_rtl7(ieee, skb, crypt)) < 0)
6902 goto rx_dropped;
6903
6904 hdr = (struct ieee80211_hdr *) skb->data;
6905 @@ -674,7 +740,7 @@
6906 // ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
6907 if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) {
6908 int flen;
6909 - struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr);
6910 + struct sk_buff *frag_skb = ieee80211_frag_cache_get_rtl7(ieee, hdr);
6911 IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag);
6912
6913 if (!frag_skb) {
6914 @@ -694,7 +760,7 @@
6915 printk(KERN_WARNING "%s: host decrypted and "
6916 "reassembled frame did not fit skb\n",
6917 dev->name);
6918 - ieee80211_frag_cache_invalidate(ieee, hdr);
6919 + ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
6920 goto rx_dropped;
6921 }
6922
6923 @@ -722,19 +788,19 @@
6924 * delivered, so remove skb from fragment cache */
6925 skb = frag_skb;
6926 hdr = (struct ieee80211_hdr *) skb->data;
6927 - ieee80211_frag_cache_invalidate(ieee, hdr);
6928 + ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
6929 }
6930
6931 /* skb: hdr + (possible reassembled) full MSDU payload; possibly still
6932 * encrypted/authenticated */
6933 if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
6934 - ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt))
6935 + ieee80211_rx_frame_decrypt_msdu_rtl7(ieee, skb, keyidx, crypt))
6936 goto rx_dropped;
6937
6938 hdr = (struct ieee80211_hdr *) skb->data;
6939 if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) {
6940 if (/*ieee->ieee802_1x &&*/
6941 - ieee80211_is_eapol_frame(ieee, skb)) {
6942 + ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
6943 #ifdef CONFIG_IEEE80211_DEBUG
6944 /* pass unencrypted EAPOL frames even if encryption is
6945 * configured */
6946 @@ -763,7 +829,7 @@
6947 #endif
6948
6949 if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep &&
6950 - !ieee80211_is_eapol_frame(ieee, skb)) {
6951 + !ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
6952 IEEE80211_DEBUG_DROP(
6953 "dropped unencrypted RX data "
6954 "frame from " MAC_FMT
6955 @@ -896,7 +962,7 @@
6956
6957 #define MGMT_FRAME_FIXED_PART_LENGTH 0x24
6958
6959 -static inline int ieee80211_is_ofdm_rate(u8 rate)
6960 +static inline int ieee80211_is_ofdm_rate_rtl7(u8 rate)
6961 {
6962 switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
6963 case IEEE80211_OFDM_RATE_6MB:
6964 @@ -913,7 +979,7 @@
6965 }
6966
6967
6968 -static inline int ieee80211_network_init(
6969 +static inline int ieee80211_network_init_rtl7(
6970 struct ieee80211_device *ieee,
6971 struct ieee80211_probe_response *beacon,
6972 struct ieee80211_network *network,
6973 @@ -964,7 +1030,7 @@
6974
6975 switch (info_element->id) {
6976 case MFIE_TYPE_SSID:
6977 - if (ieee80211_is_empty_essid(info_element->data,
6978 + if (ieee80211_is_empty_essid_rtl7(info_element->data,
6979 info_element->len)) {
6980 network->flags |= NETWORK_EMPTY_ESSID;
6981 break;
6982 @@ -991,7 +1057,7 @@
6983 #ifdef CONFIG_IEEE80211_DEBUG
6984 p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
6985 #endif
6986 - if (ieee80211_is_ofdm_rate(info_element->data[i])) {
6987 + if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
6988 network->flags |= NETWORK_HAS_OFDM;
6989 if (info_element->data[i] &
6990 IEEE80211_BASIC_RATE_MASK)
6991 @@ -1014,7 +1080,7 @@
6992 #ifdef CONFIG_IEEE80211_DEBUG
6993 p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
6994 #endif
6995 - if (ieee80211_is_ofdm_rate(info_element->data[i])) {
6996 + if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
6997 network->flags |= NETWORK_HAS_OFDM;
6998 if (info_element->data[i] &
6999 IEEE80211_BASIC_RATE_MASK)
7000 @@ -1147,7 +1213,7 @@
7001 return 1;
7002 }
7003
7004 - if (ieee80211_is_empty_essid(network->ssid, network->ssid_len))
7005 + if (ieee80211_is_empty_essid_rtl7(network->ssid, network->ssid_len))
7006 network->flags |= NETWORK_EMPTY_ESSID;
7007
7008 memcpy(&network->stats, stats, sizeof(network->stats));
7009 @@ -1155,7 +1221,7 @@
7010 return 0;
7011 }
7012
7013 -static inline int is_same_network(struct ieee80211_network *src,
7014 +static inline int is_same_network_rtl7(struct ieee80211_network *src,
7015 struct ieee80211_network *dst)
7016 {
7017 /* A network is only a duplicate if the channel, BSSID, ESSID
7018 @@ -1172,7 +1238,7 @@
7019 (dst->capability & WLAN_CAPABILITY_BSS)));
7020 }
7021
7022 -static inline void update_network(struct ieee80211_network *dst,
7023 +static inline void update_network_rtl7(struct ieee80211_network *dst,
7024 struct ieee80211_network *src)
7025 {
7026 memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats));
7027 @@ -1204,7 +1270,7 @@
7028 /* dst->last_associate is not overwritten */
7029 }
7030
7031 -static inline void ieee80211_process_probe_response(
7032 +static inline void ieee80211_process_probe_response_rtl7(
7033 struct ieee80211_device *ieee,
7034 struct ieee80211_probe_response *beacon,
7035 struct ieee80211_rx_stats *stats)
7036 @@ -1239,7 +1305,7 @@
7037 (beacon->capability & (1<<0x1)) ? '1' : '0',
7038 (beacon->capability & (1<<0x0)) ? '1' : '0');
7039
7040 - if (ieee80211_network_init(ieee, beacon, &network, stats)) {
7041 + if (ieee80211_network_init_rtl7(ieee, beacon, &network, stats)) {
7042 IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n",
7043 escape_essid(info_element->data,
7044 info_element->len),
7045 @@ -1262,11 +1328,11 @@
7046
7047 spin_lock_irqsave(&ieee->lock, flags);
7048
7049 - if(is_same_network(&ieee->current_network, &network))
7050 - update_network(&ieee->current_network, &network);
7051 + if(is_same_network_rtl7(&ieee->current_network, &network))
7052 + update_network_rtl7(&ieee->current_network, &network);
7053
7054 list_for_each_entry(target, &ieee->network_list, list) {
7055 - if (is_same_network(target, &network))
7056 + if (is_same_network_rtl7(target, &network))
7057 break;
7058
7059 if ((oldest == NULL) ||
7060 @@ -1306,7 +1372,7 @@
7061 memcpy(target, &network, sizeof(*target));
7062 list_add_tail(&target->list, &ieee->network_list);
7063 if(ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)
7064 - ieee80211_softmac_new_net(ieee,&network);
7065 + ieee80211_softmac_new_net_rtl7(ieee,&network);
7066 } else {
7067 IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n",
7068 escape_essid(target->ssid,
7069 @@ -1321,15 +1387,15 @@
7070 * net and call the new_net handler
7071 */
7072 renew = !time_after(target->last_scanned + ieee->scan_age, jiffies);
7073 - update_network(target, &network);
7074 + update_network_rtl7(target, &network);
7075 if(renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE))
7076 - ieee80211_softmac_new_net(ieee,&network);
7077 + ieee80211_softmac_new_net_rtl7(ieee,&network);
7078 }
7079
7080 spin_unlock_irqrestore(&ieee->lock, flags);
7081 }
7082
7083 -void ieee80211_rx_mgt(struct ieee80211_device *ieee,
7084 +void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
7085 struct ieee80211_hdr *header,
7086 struct ieee80211_rx_stats *stats)
7087 {
7088 @@ -1339,7 +1405,7 @@
7089 IEEE80211_DEBUG_MGMT("received BEACON (%d)\n",
7090 WLAN_FC_GET_STYPE(header->frame_ctl));
7091 IEEE80211_DEBUG_SCAN("Beacon\n");
7092 - ieee80211_process_probe_response(
7093 + ieee80211_process_probe_response_rtl7(
7094 ieee, (struct ieee80211_probe_response *)header, stats);
7095 break;
7096
7097 @@ -1347,7 +1413,7 @@
7098 IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n",
7099 WLAN_FC_GET_STYPE(header->frame_ctl));
7100 IEEE80211_DEBUG_SCAN("Probe response\n");
7101 - ieee80211_process_probe_response(
7102 + ieee80211_process_probe_response_rtl7(
7103 ieee, (struct ieee80211_probe_response *)header, stats);
7104 break;
7105
7106 @@ -1355,5 +1421,5 @@
7107 }
7108
7109
7110 -EXPORT_SYMBOL(ieee80211_rx_mgt);
7111 -EXPORT_SYMBOL(ieee80211_rx);
7112 +EXPORT_SYMBOL(ieee80211_rx_mgt_rtl7);
7113 +EXPORT_SYMBOL(ieee80211_rx_rtl7);
7114 diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac.c rtl8187_rawtx/ieee80211/ieee80211_softmac.c
7115 --- rtl8187_orig/ieee80211/ieee80211_softmac.c 2007-03-13 23:45:09.000000000 +0100
7116 +++ rtl8187_rawtx/ieee80211/ieee80211_softmac.c 2007-05-26 10:38:07.000000000 +0200
7117 @@ -1,14 +1,14 @@
7118 /* IEEE 802.11 SoftMAC layer
7119 * Copyright (c) 2005 Andrea Merello <[email protected]>
7120 *
7121 - * Mostly extracted from the rtl8180-sa2400 driver for the
7122 + * Mostly extracted from the rtl8180-sa2400 driver for the
7123 * in-kernel generic ieee802.11 stack.
7124 *
7125 * Few lines might be stolen from other part of the ieee80211
7126 * stack. Copyright who own it's copyright
7127 *
7128 * WPA code stolen from the ipw2200 driver.
7129 - * Copyright who own it's copyright.
7130 + * Copyright who own it's copyright.
7131 *
7132 * released under the GPL
7133 */
7134 @@ -20,12 +20,12 @@
7135 #include <linux/delay.h>
7136 #include <linux/version.h>
7137
7138 -short ieee80211_is_54g(struct ieee80211_network net)
7139 +short ieee80211_is_54g_rtl7(struct ieee80211_network net)
7140 {
7141 return ((net.rates_ex_len > 0) || (net.rates_len > 4));
7142 }
7143
7144 -short ieee80211_is_shortslot(struct ieee80211_network net)
7145 +short ieee80211_is_shortslot_rtl7(struct ieee80211_network net)
7146 {
7147 return (net.capability & WLAN_CAPABILITY_SHORT_SLOT);
7148 }
7149 @@ -34,28 +34,28 @@
7150 * tag and the EXTENDED RATE MFIE tag if needed.
7151 * It encludes two bytes per tag for the tag itself and its len
7152 */
7153 -unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee)
7154 +unsigned int ieee80211_MFIE_rate_len_rtl7(struct ieee80211_device *ieee)
7155 {
7156 unsigned int rate_len = 0;
7157 -
7158 +
7159 if (ieee->modulation & IEEE80211_CCK_MODULATION)
7160 rate_len = IEEE80211_CCK_RATE_LEN + 2;
7161 -
7162 +
7163 if (ieee->modulation & IEEE80211_OFDM_MODULATION)
7164 -
7165 +
7166 rate_len += IEEE80211_OFDM_RATE_LEN + 2;
7167 -
7168 +
7169 return rate_len;
7170 }
7171
7172 -/* pleace the MFIE rate, tag to the memory (double) poined.
7173 +/* pleace the MFIE rate, tag to the memory (double) poined.
7174 * Then it updates the pointer so that
7175 * it points after the new MFIE tag added.
7176 - */
7177 -void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p)
7178 + */
7179 +void ieee80211_MFIE_Brate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
7180 {
7181 - u8 *tag = *tag_p;
7182 -
7183 + u8 *tag = *tag_p;
7184 +
7185 if (ieee->modulation & IEEE80211_CCK_MODULATION){
7186 *tag++ = MFIE_TYPE_RATES;
7187 *tag++ = 4;
7188 @@ -64,17 +64,17 @@
7189 *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
7190 *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
7191 }
7192 -
7193 +
7194 /* We may add an option for custom rates that specific HW might support */
7195 *tag_p = tag;
7196 }
7197
7198 -void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
7199 -{
7200 - u8 *tag = *tag_p;
7201 -
7202 +void ieee80211_MFIE_Grate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
7203 +{
7204 + u8 *tag = *tag_p;
7205 +
7206 if (ieee->modulation & IEEE80211_OFDM_MODULATION){
7207 -
7208 +
7209 *tag++ = MFIE_TYPE_RATES_EX;
7210 *tag++ = 8;
7211 *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
7212 @@ -85,73 +85,73 @@
7213 *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
7214 *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
7215 *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
7216 -
7217 +
7218 }
7219 -
7220 +
7221 /* We may add an option for custom rates that specific HW might support */
7222 *tag_p = tag;
7223 }
7224
7225 -void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb)
7226 +void enqueue_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
7227 {
7228 int nh;
7229 nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM;
7230 -
7231 +
7232 /*
7233 * if the queue is full but we have newer frames then
7234 * just overwrites the oldest.
7235 - *
7236 + *
7237 * if (nh == ieee->mgmt_queue_tail)
7238 * return -1;
7239 - */
7240 + */
7241 ieee->mgmt_queue_head = nh;
7242 ieee->mgmt_queue_ring[nh] = skb;
7243 -
7244 +
7245 //return 0;
7246 }
7247
7248 -struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee)
7249 +struct sk_buff *dequeue_mgmt_rtl7(struct ieee80211_device *ieee)
7250 {
7251 struct sk_buff *ret;
7252 -
7253 +
7254 if(ieee->mgmt_queue_tail == ieee->mgmt_queue_head)
7255 return NULL;
7256 -
7257 +
7258 ret = ieee->mgmt_queue_ring[ieee->mgmt_queue_tail];
7259 -
7260 - ieee->mgmt_queue_tail =
7261 +
7262 + ieee->mgmt_queue_tail =
7263 (ieee->mgmt_queue_tail+1) % MGMT_QUEUE_NUM;
7264 -
7265 +
7266 return ret;
7267 }
7268
7269 -void init_mgmt_queue(struct ieee80211_device *ieee)
7270 +void init_mgmt_queue_rtl7(struct ieee80211_device *ieee)
7271 {
7272 ieee->mgmt_queue_tail = ieee->mgmt_queue_head = 0;
7273 }
7274
7275
7276 -void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl);
7277 +void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl);
7278
7279 -inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
7280 +inline void softmac_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
7281 {
7282 unsigned long flags;
7283 short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
7284 struct ieee80211_hdr_3addr *header=
7285 (struct ieee80211_hdr_3addr *) skb->data;
7286 -
7287 -
7288 +
7289 +
7290 spin_lock_irqsave(&ieee->lock, flags);
7291 -
7292 +
7293 /* called with 2nd param 0, no mgmt lock required */
7294 - ieee80211_sta_wakeup(ieee,0);
7295 -
7296 + ieee80211_sta_wakeup_rtl7(ieee,0);
7297 +
7298 if(single){
7299 -
7300 +
7301 if(ieee->queue_stop){
7302 -
7303 - enqueue_mgmt(ieee,skb);
7304 -
7305 +
7306 + enqueue_mgmt_rtl7(ieee,skb);
7307 +
7308 }else{
7309 header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
7310
7311 @@ -159,119 +159,119 @@
7312 ieee->seq_ctrl = 0;
7313 else
7314 ieee->seq_ctrl++;
7315 -
7316 +
7317 /* avoid watchdog triggers */
7318 ieee->dev->trans_start = jiffies;
7319 ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
7320 }
7321 -
7322 +
7323 spin_unlock_irqrestore(&ieee->lock, flags);
7324 }else{
7325 spin_unlock_irqrestore(&ieee->lock, flags);
7326 spin_lock_irqsave(&ieee->mgmt_tx_lock, flags);
7327 -
7328 +
7329 header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
7330 -
7331 +
7332 if (ieee->seq_ctrl == 0xFFF)
7333 ieee->seq_ctrl = 0;
7334 else
7335 ieee->seq_ctrl++;
7336 -
7337 +
7338 ieee->softmac_hard_start_xmit(skb,ieee->dev);
7339 -
7340 +
7341 spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags);
7342 }
7343 }
7344
7345
7346 -inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
7347 +inline void softmac_ps_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
7348 {
7349 -
7350 +
7351 short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
7352 struct ieee80211_hdr_3addr *header =
7353 (struct ieee80211_hdr_3addr *) skb->data;
7354 -
7355 -
7356 +
7357 +
7358 if(single){
7359 -
7360 +
7361 header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
7362
7363 if (ieee->seq_ctrl == 0xFFF)
7364 ieee->seq_ctrl = 0;
7365 else
7366 ieee->seq_ctrl++;
7367 -
7368 +
7369 /* avoid watchdog triggers */
7370 ieee->dev->trans_start = jiffies;
7371 ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
7372 -
7373 +
7374 }else{
7375 -
7376 +
7377 header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
7378 -
7379 +
7380 if (ieee->seq_ctrl == 0xFFF)
7381 ieee->seq_ctrl = 0;
7382 else
7383 ieee->seq_ctrl++;
7384
7385 ieee->softmac_hard_start_xmit(skb,ieee->dev);
7386 -
7387 +
7388 }
7389 }
7390
7391 -inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee)
7392 +inline struct sk_buff *ieee80211_probe_req_rtl7(struct ieee80211_device *ieee)
7393 {
7394 unsigned int len,rate_len;
7395 u8 *tag;
7396 struct sk_buff *skb;
7397 struct ieee80211_probe_request *req;
7398 -
7399 +
7400 len = ieee->current_network.ssid_len;
7401 -
7402 - rate_len = ieee80211_MFIE_rate_len(ieee);
7403 -
7404 +
7405 + rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
7406 +
7407 skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) +
7408 2 + len + rate_len);
7409 -
7410 - if (!skb)
7411 +
7412 + if (!skb)
7413 return NULL;
7414 -
7415 +
7416 req = (struct ieee80211_probe_request *) skb_put(skb,sizeof(struct ieee80211_probe_request));
7417 req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ);
7418 - req->header.duration_id = 0; //FIXME: is this OK ?
7419 -
7420 + req->header.duration_id = 0; //FIXME: is this OK ?
7421 +
7422 memset(req->header.addr1, 0xff, ETH_ALEN);
7423 memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
7424 memset(req->header.addr3, 0xff, ETH_ALEN);
7425 -
7426 +
7427 tag = (u8 *) skb_put(skb,len+2+rate_len);
7428 -
7429 +
7430 *tag++ = MFIE_TYPE_SSID;
7431 *tag++ = len;
7432 memcpy(tag, ieee->current_network.ssid, len);
7433 tag += len;
7434 -
7435 - ieee80211_MFIE_Brate(ieee,&tag);
7436 - ieee80211_MFIE_Grate(ieee,&tag);
7437 +
7438 + ieee80211_MFIE_Brate_rtl7(ieee,&tag);
7439 + ieee80211_MFIE_Grate_rtl7(ieee,&tag);
7440 return skb;
7441 }
7442
7443 -struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee);
7444 -void ieee80211_send_beacon(struct ieee80211_device *ieee)
7445 +struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee);
7446 +void ieee80211_send_beacon_rtl7(struct ieee80211_device *ieee)
7447 {
7448 struct sk_buff *skb;
7449 -
7450 - unsigned long flags;
7451 -
7452 - skb = ieee80211_get_beacon_(ieee);
7453 +
7454 + unsigned long flags;
7455 +
7456 + skb = ieee80211_get_beacon__rtl7(ieee);
7457 if (skb){
7458 - softmac_mgmt_xmit(skb, ieee);
7459 + softmac_mgmt_xmit_rtl7(skb, ieee);
7460 ieee->softmac_stats.tx_beacons++;
7461 }
7462
7463 - ieee->beacon_timer.expires = jiffies +
7464 + ieee->beacon_timer.expires = jiffies +
7465 (MSECS( ieee->current_network.beacon_interval -5));
7466 -
7467 +
7468 spin_lock_irqsave(&ieee->beacon_lock,flags);
7469 if(ieee->beacon_txing)
7470 add_timer(&ieee->beacon_timer);
7471 @@ -279,57 +279,57 @@
7472 }
7473
7474
7475 -void ieee80211_send_beacon_cb(unsigned long _ieee)
7476 +void ieee80211_send_beacon_cb_rtl7(unsigned long _ieee)
7477 {
7478 struct ieee80211_device *ieee =
7479 (struct ieee80211_device *) _ieee;
7480 - ieee80211_send_beacon(ieee);
7481 + ieee80211_send_beacon_rtl7(ieee);
7482 }
7483
7484
7485 -void ieee80211_send_probe(struct ieee80211_device *ieee)
7486 +void ieee80211_send_probe_rtl7(struct ieee80211_device *ieee)
7487 {
7488 struct sk_buff *skb;
7489 -
7490 - skb = ieee80211_probe_req(ieee);
7491 +
7492 + skb = ieee80211_probe_req_rtl7(ieee);
7493 if (skb){
7494 - softmac_mgmt_xmit(skb, ieee);
7495 + softmac_mgmt_xmit_rtl7(skb, ieee);
7496 ieee->softmac_stats.tx_probe_rq++;
7497 }
7498 }
7499
7500 -void ieee80211_send_probe_requests(struct ieee80211_device *ieee)
7501 +void ieee80211_send_probe_requests_rtl7(struct ieee80211_device *ieee)
7502 {
7503 if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)){
7504 - ieee80211_send_probe(ieee);
7505 - ieee80211_send_probe(ieee);
7506 + ieee80211_send_probe_rtl7(ieee);
7507 + ieee80211_send_probe_rtl7(ieee);
7508 }
7509 }
7510
7511 /* this performs syncro scan blocking the caller until all channels
7512 - * in the allowed channel map has been checked.
7513 + * in the allowed channel map has been checked.
7514 */
7515 -void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
7516 +void ieee80211_softmac_scan_syncro_rtl7(struct ieee80211_device *ieee)
7517 {
7518 short ch = 0;
7519 -
7520 +
7521 down(&ieee->scan_sem);
7522 -
7523 +
7524 while(1)
7525 {
7526 -
7527 +
7528 do{
7529 ch++;
7530 - if (ch > MAX_CHANNEL_NUMBER)
7531 + if (ch > MAX_CHANNEL_NUMBER)
7532 goto out; /* scan completed */
7533 -
7534 +
7535 }while(!ieee->channel_map[ch]);
7536 -
7537 +
7538 /* this fuction can be called in two situations
7539 * 1- We have switched to ad-hoc mode and we are
7540 * performing a complete syncro scan before conclude
7541 - * there are no interesting cell and to create a
7542 - * new one. In this case the link state is
7543 + * there are no interesting cell and to create a
7544 + * new one. In this case the link state is
7545 * IEEE80211_NOLINK until we found an interesting cell.
7546 * If so the ieee8021_new_net, called by the RX path
7547 * will set the state to IEEE80211_LINKED, so we stop
7548 @@ -342,24 +342,24 @@
7549 * not filter RX frames and the channel is changing.
7550 * So the only situation in witch are interested is to check
7551 * if the state become LINKED because of the #1 situation
7552 - */
7553 -
7554 + */
7555 +
7556 if (ieee->state == IEEE80211_LINKED)
7557 goto out;
7558 -
7559 +
7560 ieee->set_chan(ieee->dev, ch);
7561 -
7562 - ieee80211_send_probe_requests(ieee);
7563 -
7564 +
7565 + ieee80211_send_probe_requests_rtl7(ieee);
7566 +
7567 /* this prevent excessive time wait when we
7568 * need to wait for a syncro scan to end..
7569 - */
7570 + */
7571 if (ieee->sync_scan_hurryup)
7572 goto out;
7573
7574
7575 msleep_interruptible_rtl(IEEE80211_SOFTMAC_SCAN_TIME);
7576 -
7577 +
7578 }
7579 out:
7580 ieee->sync_scan_hurryup = 0;
7581 @@ -370,43 +370,49 @@
7582 void ieee80211_softmac_scan(struct ieee80211_device *ieee)
7583 {
7584 short watchdog = 0;
7585 -
7586 +
7587 do{
7588 - ieee->current_network.channel =
7589 + ieee->current_network.channel =
7590 (ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
7591 - if (watchdog++ > MAX_CHANNEL_NUMBER)
7592 + if (watchdog++ > MAX_CHANNEL_NUMBER)
7593 return; /* no good chans */
7594 -
7595 +
7596 }while(!ieee->channel_map[ieee->current_network.channel]);
7597 -
7598 +
7599
7600 schedule_work(&ieee->softmac_scan_wq);
7601 }
7602 #endif
7603
7604 -void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
7605 -{
7606 - down(&ieee->scan_sem);
7607 -
7608 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
7609 +void ieee80211_softmac_scan_wq_rtl7(struct work_struct *work)
7610 +{
7611 + struct delayed_work *dwork = container_of(work, struct delayed_work, work);
7612 + struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
7613 +#else
7614 +void ieee80211_softmac_scan_wq_rtl7(struct ieee80211_device *ieee)
7615 +{
7616 +#endif
7617 short watchdog = 0;
7618 -
7619 + down(&ieee->scan_sem);
7620 +
7621 do{
7622 - ieee->current_network.channel =
7623 + ieee->current_network.channel =
7624 (ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
7625 - if (watchdog++ > MAX_CHANNEL_NUMBER)
7626 + if (watchdog++ > MAX_CHANNEL_NUMBER)
7627 goto out; /* no good chans */
7628 -
7629 +
7630 }while(!ieee->channel_map[ieee->current_network.channel]);
7631 -
7632 +
7633 if (ieee->scanning == 0 )
7634 goto out;
7635 -
7636 +
7637 ieee->set_chan(ieee->dev, ieee->current_network.channel);
7638 - ieee80211_send_probe_requests(ieee);
7639 + ieee80211_send_probe_requests_rtl7(ieee);
7640
7641 -#if 0
7642 +#if 0
7643 ieee->.expires = jiffies + (IEEE80211_SOFTMAC_SCAN_TIME);
7644 - if (ieee->scanning == 1)
7645 + if (ieee->scanning == 1)
7646 add_timer(&ieee->scan_timer);
7647 #endif
7648 queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME);
7649 @@ -419,7 +425,7 @@
7650 {
7651 unsigned long flags;
7652 struct ieee80211_device *ieee = (struct ieee80211_device *)_dev;
7653 -
7654 +
7655 spin_lock_irqsave(&ieee->lock, flags);
7656 ieee80211_softmac_scan(ieee);
7657 spin_unlock_irqrestore(&ieee->lock, flags);
7658 @@ -427,19 +433,19 @@
7659 #endif
7660
7661
7662 -void ieee80211_beacons_start(struct ieee80211_device *ieee)
7663 +void ieee80211_beacons_start_rtl7(struct ieee80211_device *ieee)
7664 {
7665 - unsigned long flags;
7666 + unsigned long flags;
7667
7668 spin_lock_irqsave(&ieee->beacon_lock,flags);
7669
7670 ieee->beacon_txing = 1;
7671 - ieee80211_send_beacon(ieee);
7672 -
7673 + ieee80211_send_beacon_rtl7(ieee);
7674 +
7675 spin_unlock_irqrestore(&ieee->beacon_lock,flags);
7676 }
7677
7678 -void ieee80211_beacons_stop(struct ieee80211_device *ieee)
7679 +void ieee80211_beacons_stop_rtl7(struct ieee80211_device *ieee)
7680 {
7681 unsigned long flags;
7682
7683 @@ -453,111 +459,111 @@
7684 }
7685
7686
7687 -void ieee80211_stop_send_beacons(struct ieee80211_device *ieee)
7688 +void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee)
7689 {
7690 if(ieee->stop_send_beacons)
7691 ieee->stop_send_beacons(ieee->dev);
7692 if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
7693 - ieee80211_beacons_stop(ieee);
7694 + ieee80211_beacons_stop_rtl7(ieee);
7695 }
7696
7697
7698 -void ieee80211_start_send_beacons(struct ieee80211_device *ieee)
7699 +void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee)
7700 {
7701 if(ieee->start_send_beacons)
7702 ieee->start_send_beacons(ieee->dev);
7703 if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
7704 - ieee80211_beacons_start(ieee);
7705 + ieee80211_beacons_start_rtl7(ieee);
7706 }
7707
7708
7709 -void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee)
7710 +void ieee80211_softmac_stop_scan_rtl7(struct ieee80211_device *ieee)
7711 {
7712 -// unsigned long flags;
7713 -
7714 +// unsigned long flags;
7715 +
7716 //ieee->sync_scan_hurryup = 1;
7717 -
7718 +
7719 down(&ieee->scan_sem);
7720 // spin_lock_irqsave(&ieee->lock, flags);
7721 -
7722 +
7723 if (ieee->scanning == 1){
7724 ieee->scanning = 0;
7725 //del_timer_sync(&ieee->scan_timer);
7726 cancel_delayed_work(&ieee->softmac_scan_wq);
7727 }
7728 -
7729 +
7730 // spin_unlock_irqrestore(&ieee->lock, flags);
7731 up(&ieee->scan_sem);
7732 }
7733
7734 -void ieee80211_stop_scan(struct ieee80211_device *ieee)
7735 +void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee)
7736 {
7737 if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
7738 - ieee80211_softmac_stop_scan(ieee);
7739 + ieee80211_softmac_stop_scan_rtl7(ieee);
7740 else
7741 ieee->stop_scan(ieee->dev);
7742 }
7743
7744 /* called with ieee->lock held */
7745 -void ieee80211_start_scan(struct ieee80211_device *ieee)
7746 +void ieee80211_start_scan_rtl7(struct ieee80211_device *ieee)
7747 {
7748 - if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
7749 + if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
7750 if (ieee->scanning == 0){
7751 ieee->scanning = 1;
7752 //ieee80211_softmac_scan(ieee);
7753 - queue_work(ieee->wq, &ieee->softmac_scan_wq);
7754 + queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
7755 }
7756 }else
7757 ieee->start_scan(ieee->dev);
7758 -
7759 +
7760 }
7761
7762 /* called with wx_sem held */
7763 -void ieee80211_start_scan_syncro(struct ieee80211_device *ieee)
7764 +void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee)
7765 {
7766 ieee->sync_scan_hurryup = 0;
7767 -
7768 +
7769 if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
7770 - ieee80211_softmac_scan_syncro(ieee);
7771 + ieee80211_softmac_scan_syncro_rtl7(ieee);
7772 else
7773 ieee->scan_syncro(ieee->dev);
7774 -
7775 +
7776 }
7777
7778 -inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon,
7779 +inline struct sk_buff *ieee80211_authentication_req_rtl7(struct ieee80211_network *beacon,
7780 struct ieee80211_device *ieee, int challengelen)
7781 {
7782 - struct sk_buff *skb;
7783 + struct sk_buff *skb;
7784 struct ieee80211_authentication *auth;
7785 -
7786 - skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
7787 -
7788 +
7789 + skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
7790 +
7791 if (!skb) return NULL;
7792 -
7793 +
7794 auth = (struct ieee80211_authentication *)
7795 skb_put(skb, sizeof(struct ieee80211_authentication));
7796 -
7797 +
7798 auth->header.frame_ctl = IEEE80211_STYPE_AUTH;
7799 if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP;
7800 -
7801 +
7802 auth->header.duration_id = 0x013a; //FIXME
7803 -
7804 +
7805 memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN);
7806 memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
7807 memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN);
7808 -
7809 +
7810 auth->algorithm = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY;
7811 -
7812 +
7813 auth->transaction = cpu_to_le16(ieee->associate_seq);
7814 ieee->associate_seq++;
7815 -
7816 +
7817 auth->status = cpu_to_le16(WLAN_STATUS_SUCCESS);
7818 -
7819 +
7820 return skb;
7821 -
7822 +
7823 }
7824
7825 -static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest)
7826 +static struct sk_buff* ieee80211_probe_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
7827 {
7828 u8 *tag;
7829 int beacon_size;
7830 @@ -566,23 +572,23 @@
7831 int encrypt;
7832 int atim_len,erp_len;
7833 struct ieee80211_crypt_data* crypt;
7834 -
7835 +
7836 char *ssid = ieee->current_network.ssid;
7837 int ssid_len = ieee->current_network.ssid_len;
7838 int rate_len = ieee->current_network.rates_len+2;
7839 int rate_ex_len = ieee->current_network.rates_ex_len;
7840 if(rate_ex_len > 0) rate_ex_len+=2;
7841 -
7842 +
7843 if(ieee->current_network.capability & WLAN_CAPABILITY_IBSS)
7844 atim_len = 4;
7845 else
7846 atim_len = 0;
7847 -
7848 - if(ieee80211_is_54g(ieee->current_network))
7849 +
7850 + if(ieee80211_is_54g_rtl7(ieee->current_network))
7851 erp_len = 3;
7852 else
7853 erp_len = 0;
7854 -
7855 +
7856 beacon_size = sizeof(struct ieee80211_probe_response)+
7857 ssid_len
7858 +3 //channel
7859 @@ -590,72 +596,72 @@
7860 +rate_ex_len
7861 +atim_len
7862 +erp_len;
7863 -
7864 +
7865 skb = dev_alloc_skb(beacon_size);
7866 -
7867 - if (!skb)
7868 +
7869 + if (!skb)
7870 return NULL;
7871 -
7872 +
7873 beacon_buf = (struct ieee80211_probe_response*) skb_put(skb, beacon_size);
7874 -
7875 +
7876 memcpy (beacon_buf->header.addr1, dest,ETH_ALEN);
7877 memcpy (beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
7878 memcpy (beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN);
7879
7880 beacon_buf->header.duration_id = 0; //FIXME
7881 - beacon_buf->beacon_interval =
7882 + beacon_buf->beacon_interval =
7883 cpu_to_le16(ieee->current_network.beacon_interval);
7884 - beacon_buf->capability =
7885 + beacon_buf->capability =
7886 cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_IBSS);
7887 -
7888 +
7889 if(ieee->short_slot && (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_SLOT))
7890 - cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
7891 -
7892 + cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
7893 +
7894 crypt = ieee->crypt[ieee->tx_keyidx];
7895
7896 - encrypt = ieee->host_encrypt && crypt && crypt->ops &&
7897 + encrypt = ieee->host_encrypt && crypt && crypt->ops &&
7898 (0 == strcmp(crypt->ops->name, "WEP"));
7899
7900 - if (encrypt)
7901 + if (encrypt)
7902 beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
7903 -
7904 -
7905 +
7906 +
7907 beacon_buf->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_RESP);
7908 -
7909 - beacon_buf->info_element.id = MFIE_TYPE_SSID;
7910 +
7911 + beacon_buf->info_element.id = MFIE_TYPE_SSID;
7912 beacon_buf->info_element.len = ssid_len;
7913 -
7914 +
7915 tag = (u8*) beacon_buf->info_element.data;
7916 -
7917 +
7918 memcpy(tag, ssid, ssid_len);
7919 -
7920 +
7921 tag += ssid_len;
7922 -
7923 +
7924 *(tag++) = MFIE_TYPE_RATES;
7925 - *(tag++) = rate_len-2;
7926 + *(tag++) = rate_len-2;
7927 memcpy(tag,ieee->current_network.rates,rate_len-2);
7928 tag+=rate_len-2;
7929 -
7930 +
7931 *(tag++) = MFIE_TYPE_DS_SET;
7932 *(tag++) = 1;
7933 *(tag++) = ieee->current_network.channel;
7934 -
7935 +
7936 if(atim_len){
7937 *(tag++) = MFIE_TYPE_IBSS_SET;
7938 *(tag++) = 2;
7939 *((u16*)(tag)) = cpu_to_le16(ieee->current_network.atim_window);
7940 tag+=2;
7941 }
7942 -
7943 +
7944 if(erp_len){
7945 *(tag++) = MFIE_TYPE_ERP;
7946 *(tag++) = 1;
7947 - *(tag++) = 0;
7948 + *(tag++) = 0;
7949 }
7950 -
7951 +
7952 if(rate_ex_len){
7953 *(tag++) = MFIE_TYPE_RATES_EX;
7954 - *(tag++) = rate_ex_len-2;
7955 + *(tag++) = rate_ex_len-2;
7956 memcpy(tag,ieee->current_network.rates_ex,rate_ex_len-2);
7957 tag+=rate_ex_len-2;
7958 }
7959 @@ -664,208 +670,208 @@
7960 }
7961
7962
7963 -struct sk_buff* ieee80211_assoc_resp(struct ieee80211_device *ieee, u8 *dest)
7964 +struct sk_buff* ieee80211_assoc_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
7965 {
7966 struct sk_buff *skb;
7967 u8* tag;
7968 -
7969 +
7970 struct ieee80211_crypt_data* crypt;
7971 struct ieee80211_assoc_response_frame *assoc;
7972 short encrypt;
7973 -
7974 - unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
7975 +
7976 + unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
7977 int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len;
7978 -
7979 - skb = dev_alloc_skb(len);
7980 -
7981 - if (!skb)
7982 +
7983 + skb = dev_alloc_skb(len);
7984 +
7985 + if (!skb)
7986 return NULL;
7987 -
7988 +
7989 assoc = (struct ieee80211_assoc_response_frame *)
7990 skb_put(skb,sizeof(struct ieee80211_assoc_response_frame));
7991 -
7992 +
7993 assoc->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP);
7994 memcpy(assoc->header.addr1, dest,ETH_ALEN);
7995 memcpy(assoc->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
7996 memcpy(assoc->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
7997 - assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
7998 + assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
7999 WLAN_CAPABILITY_BSS : WLAN_CAPABILITY_IBSS);
8000 -
8001 -
8002 +
8003 +
8004 if(ieee->short_slot)
8005 assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
8006 -
8007 +
8008 if (ieee->host_encrypt)
8009 crypt = ieee->crypt[ieee->tx_keyidx];
8010 else crypt = NULL;
8011 -
8012 +
8013 encrypt = ( crypt && crypt->ops);
8014 -
8015 +
8016 if (encrypt)
8017 assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
8018 -
8019 +
8020 assoc->status = 0;
8021 assoc->aid = cpu_to_le16(ieee->assoc_id);
8022 if (ieee->assoc_id == 0x2007) ieee->assoc_id=0;
8023 else ieee->assoc_id++;
8024 -
8025 +
8026 tag = (u8*) skb_put(skb, rate_len);
8027 -
8028 - ieee80211_MFIE_Brate(ieee, &tag);
8029 - ieee80211_MFIE_Grate(ieee, &tag);
8030 -
8031 +
8032 + ieee80211_MFIE_Brate_rtl7(ieee, &tag);
8033 + ieee80211_MFIE_Grate_rtl7(ieee, &tag);
8034 +
8035 return skb;
8036 }
8037
8038 -struct sk_buff* ieee80211_auth_resp(struct ieee80211_device *ieee,int status, u8 *dest)
8039 +struct sk_buff* ieee80211_auth_resp_rtl7(struct ieee80211_device *ieee,int status, u8 *dest)
8040 {
8041 struct sk_buff *skb;
8042 struct ieee80211_authentication *auth;
8043 -
8044 - skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
8045 -
8046 - if (!skb)
8047 +
8048 + skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
8049 +
8050 + if (!skb)
8051 return NULL;
8052 -
8053 +
8054 skb->len = sizeof(struct ieee80211_authentication);
8055 -
8056 +
8057 auth = (struct ieee80211_authentication *)skb->data;
8058 -
8059 +
8060 auth->status = cpu_to_le16(status);
8061 auth->transaction = cpu_to_le16(2);
8062 auth->algorithm = cpu_to_le16(WLAN_AUTH_OPEN);
8063 -
8064 +
8065 memcpy(auth->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
8066 memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
8067 memcpy(auth->header.addr1, dest, ETH_ALEN);
8068 - auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
8069 + auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
8070 return skb;
8071 -
8072 -
8073 +
8074 +
8075 }
8076
8077 -struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr)
8078 +struct sk_buff* ieee80211_null_func_rtl7(struct ieee80211_device *ieee,short pwr)
8079 {
8080 struct sk_buff *skb;
8081 struct ieee80211_hdr_3addr* hdr;
8082 -
8083 - skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
8084 -
8085 - if (!skb)
8086 +
8087 + skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
8088 +
8089 + if (!skb)
8090 return NULL;
8091 -
8092 +
8093 hdr = (struct ieee80211_hdr_3addr*)skb_put(skb,sizeof(struct ieee80211_hdr_3addr));
8094 -
8095 +
8096 memcpy(hdr->addr1, ieee->current_network.bssid, ETH_ALEN);
8097 memcpy(hdr->addr2, ieee->dev->dev_addr, ETH_ALEN);
8098 memcpy(hdr->addr3, ieee->current_network.bssid, ETH_ALEN);
8099 -
8100 - hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
8101 - IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
8102 - (pwr ? IEEE80211_FCTL_PM:0));
8103 -
8104 +
8105 + hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
8106 + IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
8107 + (pwr ? IEEE80211_FCTL_PM:0));
8108 +
8109 return skb;
8110 -
8111 -
8112 +
8113 +
8114 }
8115
8116
8117 -void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest)
8118 +void ieee80211_resp_to_assoc_rq_rtl7(struct ieee80211_device *ieee, u8* dest)
8119 {
8120 - struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest);
8121 -
8122 + struct sk_buff *buf = ieee80211_assoc_resp_rtl7(ieee, dest);
8123 +
8124 if (buf)
8125 - softmac_mgmt_xmit(buf, ieee);
8126 + softmac_mgmt_xmit_rtl7(buf, ieee);
8127 }
8128
8129
8130 -void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest)
8131 +void ieee80211_resp_to_auth_rtl7(struct ieee80211_device *ieee, int s, u8* dest)
8132 {
8133 - struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest);
8134 -
8135 + struct sk_buff *buf = ieee80211_auth_resp_rtl7(ieee, s, dest);
8136 +
8137 if (buf)
8138 - softmac_mgmt_xmit(buf, ieee);
8139 + softmac_mgmt_xmit_rtl7(buf, ieee);
8140 }
8141
8142
8143 -void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest)
8144 +void ieee80211_resp_to_probe_rtl7(struct ieee80211_device *ieee, u8 *dest)
8145 {
8146 -
8147 - struct sk_buff *buf = ieee80211_probe_resp(ieee, dest);
8148 -
8149 - if (buf)
8150 - softmac_mgmt_xmit(buf, ieee);
8151 +
8152 + struct sk_buff *buf = ieee80211_probe_resp_rtl7(ieee, dest);
8153 +
8154 + if (buf)
8155 + softmac_mgmt_xmit_rtl7(buf, ieee);
8156 }
8157
8158
8159 -inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
8160 +inline struct sk_buff *ieee80211_association_req_rtl7(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
8161 {
8162 struct sk_buff *skb;
8163 -
8164 +
8165 struct ieee80211_assoc_request_frame *hdr;
8166 u8 *tag;
8167 -
8168 +
8169 unsigned int wpa_len = beacon->wpa_ie_len;
8170 -
8171 - unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
8172 -
8173 -
8174 -
8175 +
8176 + unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
8177 +
8178 +
8179 +
8180 int len=sizeof(struct ieee80211_assoc_request_frame)+
8181 + beacon->ssid_len//essid tagged val
8182 + rate_len//rates tagged val
8183 + wpa_len;
8184 -
8185 +
8186 skb = dev_alloc_skb(len);
8187 -
8188 - if (!skb)
8189 +
8190 + if (!skb)
8191 return NULL;
8192 -
8193 +
8194 hdr = (struct ieee80211_assoc_request_frame *)
8195 skb_put(skb, sizeof(struct ieee80211_assoc_request_frame));
8196 -
8197 -
8198 +
8199 +
8200 hdr->header.frame_ctl = IEEE80211_STYPE_ASSOC_REQ;
8201 hdr->header.duration_id= 37; //FIXME
8202 memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN);
8203 memcpy(hdr->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
8204 memcpy(hdr->header.addr3, beacon->bssid, ETH_ALEN);
8205 -
8206 +
8207 hdr->capability = cpu_to_le16(WLAN_CAPABILITY_BSS);
8208 - if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
8209 + if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
8210 hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
8211 -
8212 +
8213 if(ieee->short_slot)
8214 hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
8215 -
8216 +
8217 hdr->listen_interval = 0xa; //FIXME
8218 -
8219 +
8220 hdr->info_element.id = MFIE_TYPE_SSID;
8221
8222 hdr->info_element.len = beacon->ssid_len;
8223 tag = skb_put(skb, beacon->ssid_len);
8224 memcpy(tag, beacon->ssid, beacon->ssid_len);
8225 -
8226 - tag = skb_put(skb, rate_len);
8227 -
8228 - ieee80211_MFIE_Brate(ieee, &tag);
8229 - ieee80211_MFIE_Grate(ieee, &tag);
8230 -
8231 +
8232 + tag = skb_put(skb, rate_len);
8233 +
8234 + ieee80211_MFIE_Brate_rtl7(ieee, &tag);
8235 + ieee80211_MFIE_Grate_rtl7(ieee, &tag);
8236 +
8237 tag = skb_put(skb,wpa_len);
8238 -
8239 +
8240 memcpy(tag,beacon->wpa_ie,wpa_len);
8241 -
8242 +
8243 return skb;
8244 }
8245
8246 -void ieee80211_associate_abort(struct ieee80211_device *ieee)
8247 +void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee)
8248 {
8249 -
8250 +
8251 unsigned long flags;
8252 spin_lock_irqsave(&ieee->lock, flags);
8253 -
8254 +
8255 ieee->associate_seq++;
8256 -
8257 +
8258 /* don't scan, and avoid to have the RX path possibily
8259 * try again to associate. Even do not react to AUTH or
8260 * ASSOC response. Just wait for the retry wq to be scheduled.
8261 @@ -873,103 +879,109 @@
8262 * with, so we retry or just get back to NO_LINK and scanning
8263 */
8264 if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING){
8265 - IEEE80211_DEBUG_MGMT("Authentication failed\n");
8266 + IEEE80211_DEBUG_MGMT("Authentication failed\n");
8267 ieee->softmac_stats.no_auth_rs++;
8268 }else{
8269 - IEEE80211_DEBUG_MGMT("Association failed\n");
8270 + IEEE80211_DEBUG_MGMT("Association failed\n");
8271 ieee->softmac_stats.no_ass_rs++;
8272 }
8273 -
8274 +
8275 ieee->state = IEEE80211_ASSOCIATING_RETRY;
8276 -
8277 +
8278 queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, IEEE80211_SOFTMAC_ASSOC_RETRY_TIME);
8279 -
8280 +
8281 spin_unlock_irqrestore(&ieee->lock, flags);
8282 }
8283
8284 -void ieee80211_associate_abort_cb(unsigned long dev)
8285 +void ieee80211_associate_abort_cb_rtl7(unsigned long dev)
8286 {
8287 - ieee80211_associate_abort((struct ieee80211_device *) dev);
8288 + ieee80211_associate_abort_rtl7((struct ieee80211_device *) dev);
8289 }
8290
8291
8292 -void ieee80211_associate_step1(struct ieee80211_device *ieee)
8293 +void ieee80211_associate_step1_rtl7(struct ieee80211_device *ieee)
8294 {
8295 struct ieee80211_network *beacon = &ieee->current_network;
8296 struct sk_buff *skb;
8297 -
8298 +
8299 IEEE80211_DEBUG_MGMT("Stopping scan\n");
8300 -
8301 +
8302 ieee->softmac_stats.tx_auth_rq++;
8303 - skb=ieee80211_authentication_req(beacon, ieee, 0);
8304 -
8305 - if (!skb)
8306 - ieee80211_associate_abort(ieee);
8307 - else{
8308 + skb=ieee80211_authentication_req_rtl7(beacon, ieee, 0);
8309 +
8310 + if (!skb)
8311 + ieee80211_associate_abort_rtl7(ieee);
8312 + else{
8313 ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ;
8314 IEEE80211_DEBUG_MGMT("Sending authentication request\n");
8315 - softmac_mgmt_xmit(skb, ieee);
8316 + softmac_mgmt_xmit_rtl7(skb, ieee);
8317 ieee->associate_timer.expires = jiffies + (HZ / 2);
8318 add_timer(&ieee->associate_timer);
8319 - }
8320 + }
8321 }
8322
8323 -void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
8324 +void ieee80211_auth_challenge_rtl7(struct ieee80211_device *ieee, u8 *challenge, int chlen)
8325 {
8326 - u8 *c;
8327 + u8 *c;
8328 struct sk_buff *skb;
8329 struct ieee80211_network *beacon = &ieee->current_network;
8330 // int hlen = sizeof(struct ieee80211_authentication);
8331 -
8332 +
8333 ieee->associate_seq++;
8334 ieee->softmac_stats.tx_auth_rq++;
8335 -
8336 - skb = ieee80211_authentication_req(beacon, ieee, chlen+2);
8337 - if (!skb)
8338 - ieee80211_associate_abort(ieee);
8339 +
8340 + skb = ieee80211_authentication_req_rtl7(beacon, ieee, chlen+2);
8341 + if (!skb)
8342 + ieee80211_associate_abort_rtl7(ieee);
8343 else{
8344 c = skb_put(skb, chlen+2);
8345 *(c++) = MFIE_TYPE_CHALLENGE;
8346 *(c++) = chlen;
8347 memcpy(c, challenge, chlen);
8348 -
8349 +
8350 IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n");
8351 -
8352 - ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
8353 -
8354 - softmac_mgmt_xmit(skb, ieee);
8355 +
8356 + ieee80211_encrypt_fragment_rtl7(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
8357 +
8358 + softmac_mgmt_xmit_rtl7(skb, ieee);
8359 ieee->associate_timer.expires = jiffies + (HZ / 2);
8360 add_timer(&ieee->associate_timer);
8361 - }
8362 + }
8363 kfree(challenge);
8364 }
8365
8366 -void ieee80211_associate_step2(struct ieee80211_device *ieee)
8367 +void ieee80211_associate_step2_rtl7(struct ieee80211_device *ieee)
8368 {
8369 struct sk_buff* skb;
8370 struct ieee80211_network *beacon = &ieee->current_network;
8371 -
8372 +
8373 del_timer_sync(&ieee->associate_timer);
8374 -
8375 +
8376 IEEE80211_DEBUG_MGMT("Sending association request\n");
8377 -
8378 +
8379 ieee->softmac_stats.tx_ass_rq++;
8380 - skb=ieee80211_association_req(beacon, ieee);
8381 - if (!skb)
8382 - ieee80211_associate_abort(ieee);
8383 + skb=ieee80211_association_req_rtl7(beacon, ieee);
8384 + if (!skb)
8385 + ieee80211_associate_abort_rtl7(ieee);
8386 else{
8387 - softmac_mgmt_xmit(skb, ieee);
8388 + softmac_mgmt_xmit_rtl7(skb, ieee);
8389 ieee->associate_timer.expires = jiffies + (HZ / 2);
8390 add_timer(&ieee->associate_timer);
8391 - }
8392 + }
8393 }
8394
8395 -void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
8396 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
8397 +void ieee80211_associate_complete_wq_rtl7(struct work_struct *work)
8398 {
8399 + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
8400 +#else
8401 +void ieee80211_associate_complete_wq_rtl7(struct ieee80211_device *ieee)
8402 +{
8403 +#endif
8404 printk(KERN_INFO "Associated successfully\n");
8405 - if(ieee80211_is_54g(ieee->current_network) &&
8406 + if(ieee80211_is_54g_rtl7(ieee->current_network) &&
8407 (ieee->modulation & IEEE80211_OFDM_MODULATION)){
8408 -
8409 +
8410 ieee->rate = 540;
8411 printk(KERN_INFO"Using G rates\n");
8412 }else{
8413 @@ -977,62 +989,67 @@
8414 printk(KERN_INFO"Using B rates\n");
8415 }
8416 ieee->link_change(ieee->dev);
8417 - notify_wx_assoc_event(ieee);
8418 + notify_wx_assoc_event_rtl7(ieee);
8419 if (ieee->data_hard_resume)
8420 ieee->data_hard_resume(ieee->dev);
8421 netif_carrier_on(ieee->dev);
8422 }
8423
8424 -void ieee80211_associate_complete(struct ieee80211_device *ieee)
8425 +void ieee80211_associate_complete_rtl7(struct ieee80211_device *ieee)
8426 {
8427
8428 del_timer_sync(&ieee->associate_timer);
8429 -
8430 +
8431 ieee->seq_ctrl = 0;
8432 ieee->state = IEEE80211_LINKED;
8433 IEEE80211_DEBUG_MGMT("Successfully associated\n");
8434 -
8435 +
8436 queue_work(ieee->wq, &ieee->associate_complete_wq);
8437 }
8438
8439 -void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee)
8440 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
8441 +void ieee80211_associate_procedure_wq_rtl7(struct work_struct *work)
8442 +{
8443 + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
8444 +#else
8445 +void ieee80211_associate_procedure_wq_rtl7(struct ieee80211_device *ieee)
8446 {
8447 +#endif
8448 ieee->sync_scan_hurryup = 1;
8449 down(&ieee->wx_sem);
8450 -
8451 if (ieee->data_hard_stop)
8452 ieee->data_hard_stop(ieee->dev);
8453 -
8454 - ieee80211_stop_scan(ieee);
8455 +
8456 + ieee80211_stop_scan_rtl7(ieee);
8457 ieee->set_chan(ieee->dev, ieee->current_network.channel);
8458 -
8459 +
8460 ieee->associate_seq = 1;
8461 - ieee80211_associate_step1(ieee);
8462 -
8463 + ieee80211_associate_step1_rtl7(ieee);
8464 +
8465 up(&ieee->wx_sem);
8466 }
8467
8468 -inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net)
8469 +inline void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net)
8470 {
8471 -
8472 +
8473 u8 tmp_ssid[IW_ESSID_MAX_SIZE+1];
8474 int tmp_ssid_len = 0;
8475 -
8476 +
8477 short apset,ssidset,ssidbroad,apmatch,ssidmatch;
8478 -
8479 - /* we are interested in new new only if we are not associated
8480 +
8481 + /* we are interested in new new only if we are not associated
8482 * and we are not associating / authenticating
8483 */
8484 if (ieee->state != IEEE80211_NOLINK)
8485 - return;
8486 -
8487 + return;
8488 +
8489 if ((ieee->iw_mode == IW_MODE_INFRA) && !(net->capability & WLAN_CAPABILITY_BSS))
8490 return;
8491 -
8492 +
8493 if ((ieee->iw_mode == IW_MODE_ADHOC) && !(net->capability & WLAN_CAPABILITY_IBSS))
8494 return;
8495
8496 -
8497 +
8498 if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC){
8499 /* if the user specified the AP MAC, we need also the essid
8500 * This could be obtained by beacons or, if the network does not
8501 @@ -1043,23 +1060,23 @@
8502 ssidbroad = !(net->ssid_len == 0 || net->ssid[0]== '\0');
8503 apmatch = (memcmp(ieee->current_network.bssid, net->bssid, ETH_ALEN)==0);
8504 ssidmatch = (0==strncmp(ieee->current_network.ssid, net->ssid, net->ssid_len));
8505 -
8506 -
8507 -
8508 +
8509 +
8510 +
8511 if ( /* if the user set the AP check if match.
8512 * if the network does not broadcast essid we check the user supplyed ANY essid
8513 * if the network does broadcast and the user does not set essid it is OK
8514 * if the network does broadcast and the user did set essid chech if essid match
8515 */
8516 - ( apset && apmatch &&
8517 - ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
8518 + ( apset && apmatch &&
8519 + ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
8520 /* if the ap is not set, check that the user set the bssid
8521 * and the network does bradcast and that those two bssid matches
8522 - */
8523 - (!apset && ssidset && ssidbroad && ssidmatch)
8524 + */
8525 + (!apset && ssidset && ssidbroad && ssidmatch)
8526 ){
8527 -
8528 -
8529 +
8530 +
8531 /* if the essid is hidden replace it with the
8532 * essid provided by the user.
8533 */
8534 @@ -1068,18 +1085,18 @@
8535 tmp_ssid_len = ieee->current_network.ssid_len;
8536 }
8537 memcpy(&ieee->current_network, net, sizeof(struct ieee80211_network));
8538 -
8539 +
8540 if (!ssidbroad){
8541 strncpy(ieee->current_network.ssid, tmp_ssid, IW_ESSID_MAX_SIZE);
8542 ieee->current_network.ssid_len = tmp_ssid_len;
8543 }
8544 printk(KERN_INFO"Linking with %s\n",ieee->current_network.ssid);
8545 -
8546 +
8547 if (ieee->iw_mode == IW_MODE_INFRA){
8548 ieee->state = IEEE80211_ASSOCIATING;
8549 queue_work(ieee->wq, &ieee->associate_procedure_wq);
8550 }else{
8551 - if(ieee80211_is_54g(ieee->current_network) &&
8552 + if(ieee80211_is_54g_rtl7(ieee->current_network) &&
8553 (ieee->modulation & IEEE80211_OFDM_MODULATION)){
8554 ieee->rate = 540;
8555 printk(KERN_INFO"Using G rates\n");
8556 @@ -1089,42 +1106,40 @@
8557 }
8558 ieee->state = IEEE80211_LINKED;
8559 }
8560 -
8561 +
8562 }
8563 }
8564 -
8565 }
8566
8567 -void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee)
8568 +void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee)
8569 {
8570 -
8571 +
8572 unsigned long flags;
8573 struct ieee80211_network *target;
8574 -
8575 +
8576 spin_lock_irqsave(&ieee->lock, flags);
8577 -
8578 list_for_each_entry(target, &ieee->network_list, list) {
8579 -
8580 +
8581 /* if the state become different that NOLINK means
8582 * we had found what we are searching for
8583 */
8584 - if (ieee->state != IEEE80211_NOLINK)
8585 + if (ieee->state != IEEE80211_NOLINK)
8586 break;
8587 -
8588 +
8589 //if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies))
8590 - ieee80211_softmac_new_net(ieee, target);
8591 + ieee80211_softmac_new_net_rtl7(ieee, target);
8592 }
8593 -
8594 +
8595 spin_unlock_irqrestore(&ieee->lock, flags);
8596 -
8597 +
8598 }
8599
8600
8601 -static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
8602 +static inline u16 auth_parse_rtl7(struct sk_buff *skb, u8** challenge, int *chlen)
8603 {
8604 struct ieee80211_authentication *a;
8605 u8 *t;
8606 - if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
8607 + if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
8608 IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n",skb->len);
8609 return 0xcafe;
8610 }
8611 @@ -1132,58 +1147,58 @@
8612 a = (struct ieee80211_authentication*) skb->data;
8613 if(skb->len > (sizeof(struct ieee80211_authentication) +3)){
8614 t = skb->data + sizeof(struct ieee80211_authentication);
8615 -
8616 +
8617 if(*(t++) == MFIE_TYPE_CHALLENGE){
8618 *chlen = *(t++);
8619 *challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC);
8620 memcpy(*challenge, t, *chlen);
8621 }
8622 }
8623 -
8624 +
8625 return cpu_to_le16(a->status);
8626 -
8627 +
8628 }
8629
8630
8631 -int auth_rq_parse(struct sk_buff *skb,u8* dest)
8632 +int auth_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
8633 {
8634 struct ieee80211_authentication *a;
8635 -
8636 - if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
8637 - IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
8638 +
8639 + if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
8640 + IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
8641 return -1;
8642 }
8643 a = (struct ieee80211_authentication*) skb->data;
8644 -
8645 +
8646 memcpy(dest,a->header.addr2, ETH_ALEN);
8647 -
8648 - if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
8649 +
8650 + if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
8651 return WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG;
8652 -
8653 +
8654 return WLAN_STATUS_SUCCESS;
8655 }
8656
8657 -static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
8658 +static short probe_rq_parse_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
8659 {
8660 u8 *tag;
8661 u8 *skbend;
8662 u8 *ssid=NULL;
8663 u8 ssidlen = 0;
8664 -
8665 +
8666 struct ieee80211_hdr_3addr *header =
8667 (struct ieee80211_hdr_3addr *) skb->data;
8668 -
8669 - if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
8670 +
8671 + if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
8672 return -1; /* corrupted */
8673 -
8674 +
8675 memcpy(src,header->addr2, ETH_ALEN);
8676 -
8677 +
8678 skbend = (u8*)skb->data + skb->len;
8679 -
8680 +
8681 tag = skb->data + sizeof (struct ieee80211_hdr_3addr );
8682 -
8683 +
8684 while (tag+1 < skbend){
8685 - if (*tag == 0){
8686 + if (*tag == 0){
8687 ssid = tag+2;
8688 ssidlen = *(tag+1);
8689 break;
8690 @@ -1192,88 +1207,88 @@
8691 tag = tag + *(tag); /* point to the last data byte of the tag */
8692 tag++; /* point to the next tag */
8693 }
8694 -
8695 +
8696 //IEEE80211DMESG("Card MAC address is "MACSTR, MAC2STR(src));
8697 if (ssidlen == 0) return 1;
8698 -
8699 +
8700 if (!ssid) return 1; /* ssid not found in tagged param */
8701 return (!strncmp(ssid, ieee->current_network.ssid, ssidlen));
8702 -
8703 +
8704 }
8705
8706 -int assoc_rq_parse(struct sk_buff *skb,u8* dest)
8707 +int assoc_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
8708 {
8709 struct ieee80211_assoc_request_frame *a;
8710 -
8711 - if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
8712 - sizeof(struct ieee80211_info_element))) {
8713 -
8714 +
8715 + if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
8716 + sizeof(struct ieee80211_info_element))) {
8717 +
8718 IEEE80211_DEBUG_MGMT("invalid len in auth request:%d \n", skb->len);
8719 return -1;
8720 }
8721 -
8722 +
8723 a = (struct ieee80211_assoc_request_frame*) skb->data;
8724 -
8725 +
8726 memcpy(dest,a->header.addr2,ETH_ALEN);
8727 -
8728 +
8729 return 0;
8730 }
8731
8732 -static inline u16 assoc_parse(struct sk_buff *skb, int *aid)
8733 +static inline u16 assoc_parse_rtl7(struct sk_buff *skb, int *aid)
8734 {
8735 struct ieee80211_assoc_response_frame *a;
8736 - if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
8737 + if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
8738 IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len);
8739 return 0xcafe;
8740 }
8741 -
8742 +
8743 a = (struct ieee80211_assoc_response_frame*) skb->data;
8744 *aid = le16_to_cpu(a->aid) & 0x3fff;
8745 return le16_to_cpu(a->status);
8746 }
8747
8748 static inline void
8749 -ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
8750 +ieee80211_rx_probe_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
8751 {
8752 u8 dest[ETH_ALEN];
8753 -
8754 +
8755 //IEEE80211DMESG("Rx probe");
8756 ieee->softmac_stats.rx_probe_rq++;
8757 //DMESG("Dest is "MACSTR, MAC2STR(dest));
8758 - if (probe_rq_parse(ieee, skb, dest)){
8759 + if (probe_rq_parse_rtl7(ieee, skb, dest)){
8760 //IEEE80211DMESG("Was for me!");
8761 ieee->softmac_stats.tx_probe_rs++;
8762 - ieee80211_resp_to_probe(ieee, dest);
8763 + ieee80211_resp_to_probe_rtl7(ieee, dest);
8764 }
8765 }
8766
8767 static inline void
8768 -ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
8769 +ieee80211_rx_auth_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
8770 {
8771 u8 dest[ETH_ALEN];
8772 int status;
8773 //IEEE80211DMESG("Rx probe");
8774 ieee->softmac_stats.rx_auth_rq++;
8775 -
8776 - if ((status = auth_rq_parse(skb, dest))!= -1){
8777 - ieee80211_resp_to_auth(ieee, status, dest);
8778 +
8779 + if ((status = auth_rq_parse_rtl7(skb, dest))!= -1){
8780 + ieee80211_resp_to_auth_rtl7(ieee, status, dest);
8781 }
8782 //DMESG("Dest is "MACSTR, MAC2STR(dest));
8783 -
8784 +
8785 }
8786
8787 static inline void
8788 -ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
8789 +ieee80211_rx_assoc_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
8790 {
8791 -
8792 +
8793 u8 dest[ETH_ALEN];
8794 //unsigned long flags;
8795 -
8796 +
8797 ieee->softmac_stats.rx_ass_rq++;
8798 - if (assoc_rq_parse(skb,dest) != -1){
8799 - ieee80211_resp_to_assoc_rq(ieee, dest);
8800 + if (assoc_rq_parse_rtl7(skb,dest) != -1){
8801 + ieee80211_resp_to_assoc_rq_rtl7(ieee, dest);
8802 }
8803 -
8804 +
8805 printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest));
8806 //FIXME
8807 #if 0
8808 @@ -1285,25 +1300,25 @@
8809
8810
8811
8812 -void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr)
8813 +void ieee80211_sta_ps_send_null_frame_rtl7(struct ieee80211_device *ieee, short pwr)
8814 {
8815 -
8816 - struct sk_buff *buf = ieee80211_null_func(ieee, pwr);
8817 -
8818 +
8819 + struct sk_buff *buf = ieee80211_null_func_rtl7(ieee, pwr);
8820 +
8821 if (buf)
8822 - softmac_ps_mgmt_xmit(buf, ieee);
8823 + softmac_ps_mgmt_xmit_rtl7(buf, ieee);
8824
8825 -}
8826 +}
8827
8828
8829 -short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
8830 -{
8831 +short ieee80211_sta_ps_sleep_rtl7(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
8832 +{
8833 int timeout = ieee->ps_timeout;
8834 u8 dtim;
8835 /*if(ieee->ps == IEEE80211_PS_DISABLED ||
8836 - ieee->iw_mode != IW_MODE_INFRA ||
8837 + ieee->iw_mode != IW_MODE_INFRA ||
8838 ieee->state != IEEE80211_LINKED)
8839 -
8840 +
8841 return 0;
8842 */
8843 dtim = ieee->current_network.dtim_data;
8844 @@ -1312,133 +1327,133 @@
8845 return 0;
8846 //printk("VALID\n");
8847 ieee->current_network.dtim_data = IEEE80211_DTIM_INVALID;
8848 -
8849 +
8850 if(dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST)& ieee->ps))
8851 return 2;
8852 -
8853 +
8854 if(!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout)))
8855 return 0;
8856 -
8857 +
8858 if(!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout)))
8859 return 0;
8860 -
8861 +
8862 if((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE ) &&
8863 (ieee->mgmt_queue_tail != ieee->mgmt_queue_head))
8864 return 0;
8865 -
8866 +
8867 if(time_l){
8868 - *time_l = ieee->current_network.last_dtim_sta_time[0]
8869 - + (ieee->current_network.beacon_interval
8870 + *time_l = ieee->current_network.last_dtim_sta_time[0]
8871 + + (ieee->current_network.beacon_interval
8872 * ieee->current_network.dtim_period) * 1000;
8873 }
8874 -
8875 +
8876 if(time_h){
8877 *time_h = ieee->current_network.last_dtim_sta_time[1];
8878 if(time_l && *time_l < ieee->current_network.last_dtim_sta_time[0])
8879 *time_h += 1;
8880 }
8881 -
8882 +
8883 return 1;
8884 -
8885 -
8886 +
8887 +
8888 }
8889
8890 -inline void ieee80211_sta_ps(struct ieee80211_device *ieee)
8891 +inline void ieee80211_sta_ps_rtl7(struct ieee80211_device *ieee)
8892 {
8893
8894 u32 th,tl;
8895 short sleep;
8896 -
8897 +
8898 unsigned long flags,flags2;
8899 -
8900 +
8901 spin_lock_irqsave(&ieee->lock, flags);
8902 -
8903 +
8904 if((ieee->ps == IEEE80211_PS_DISABLED ||
8905 - ieee->iw_mode != IW_MODE_INFRA ||
8906 + ieee->iw_mode != IW_MODE_INFRA ||
8907 ieee->state != IEEE80211_LINKED)){
8908 -
8909 - #warning CHECK_LOCK_HERE
8910 +
8911 +// #warning CHECK_LOCK_HERE
8912 spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
8913 -
8914 - ieee80211_sta_wakeup(ieee, 1);
8915 -
8916 +
8917 + ieee80211_sta_wakeup_rtl7(ieee, 1);
8918 + printk(KERN_WARNING "wakeup 1!\n" );
8919 spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
8920 }
8921 -
8922 - sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl);
8923 +
8924 + sleep = ieee80211_sta_ps_sleep_rtl7(ieee,&th, &tl);
8925 /* 2 wake, 1 sleep, 0 do nothing */
8926 if(sleep == 0)
8927 goto out;
8928 -
8929 +
8930 if(sleep == 1){
8931 -
8932 +
8933 if(ieee->sta_sleep == 1)
8934 ieee->enter_sleep_state(ieee->dev,th,tl);
8935 -
8936 +
8937 else if(ieee->sta_sleep == 0){
8938 // printk("send null 1\n");
8939 spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
8940 -
8941 +
8942 if(ieee->ps_is_queue_empty(ieee->dev)){
8943 -
8944 -
8945 +
8946 +
8947 ieee->sta_sleep = 2;
8948 -
8949 +
8950 ieee->ps_request_tx_ack(ieee->dev);
8951 -
8952 - ieee80211_sta_ps_send_null_frame(ieee,1);
8953 -
8954 +
8955 + ieee80211_sta_ps_send_null_frame_rtl7(ieee,1);
8956 +
8957 ieee->ps_th = th;
8958 ieee->ps_tl = tl;
8959 - }
8960 + }
8961 spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
8962 -
8963 +
8964 }
8965 -
8966 -
8967 +
8968 +
8969 }else if(sleep == 2){
8970 -#warning CHECK_LOCK_HERE
8971 +// #warning CHECK_LOCK_HERE
8972 spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
8973 -
8974 - ieee80211_sta_wakeup(ieee,1);
8975 -
8976 +
8977 + ieee80211_sta_wakeup_rtl7(ieee,1);
8978 + printk(KERN_WARNING "wakeup 2!\n" );
8979 spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
8980 }
8981
8982 -out:
8983 +out:
8984 spin_unlock_irqrestore(&ieee->lock, flags);
8985 -
8986 +
8987 }
8988
8989 -void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl)
8990 +void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl)
8991 {
8992 if(ieee->sta_sleep == 0){
8993 if(nl){
8994 printk("Warning: driver is probably failing to report TX ps error\n");
8995 ieee->ps_request_tx_ack(ieee->dev);
8996 - ieee80211_sta_ps_send_null_frame(ieee, 0);
8997 + ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
8998 }
8999 return;
9000 -
9001 +
9002 }
9003 -
9004 - if(ieee->sta_sleep == 1)
9005 +
9006 + if(ieee->sta_sleep == 1)
9007 ieee->sta_wake_up(ieee->dev);
9008 -
9009 +
9010 ieee->sta_sleep = 0;
9011 -
9012 +
9013 if(nl){
9014 ieee->ps_request_tx_ack(ieee->dev);
9015 - ieee80211_sta_ps_send_null_frame(ieee, 0);
9016 + ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
9017 }
9018 }
9019
9020 -void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success)
9021 +void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success)
9022 {
9023 unsigned long flags,flags2;
9024 -
9025 +
9026 spin_lock_irqsave(&ieee->lock, flags);
9027 -
9028 +
9029 if(ieee->sta_sleep == 2){
9030 /* Null frame with PS bit set */
9031 if(success){
9032 @@ -1451,10 +1466,10 @@
9033 }
9034 /* 21112005 - tx again null without PS bit if lost */
9035 else {
9036 -
9037 +
9038 if((ieee->sta_sleep == 0) && !success){
9039 spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
9040 - ieee80211_sta_ps_send_null_frame(ieee, 0);
9041 + ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
9042 spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
9043 }
9044 }
9045 @@ -1462,129 +1477,132 @@
9046 }
9047
9048 inline int
9049 -ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
9050 +ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
9051 struct ieee80211_rx_stats *rx_stats, u16 type,
9052 u16 stype)
9053 {
9054 struct ieee80211_hdr_3addr *header;
9055 - header = (struct ieee80211_hdr_3addr *) skb->data;
9056 u16 errcode;
9057 u8* challenge;
9058 int chlen;
9059 int aid;
9060 -
9061 +
9062 + chlen = 0;
9063 +
9064 + header = (struct ieee80211_hdr_3addr *) skb->data;
9065 +
9066 if(!ieee->proto_started)
9067 return 0;
9068 -
9069 +
9070 if(ieee->sta_sleep || (ieee->ps != IEEE80211_PS_DISABLED &&
9071 - ieee->iw_mode == IW_MODE_INFRA &&
9072 + ieee->iw_mode == IW_MODE_INFRA &&
9073 ieee->state == IEEE80211_LINKED))
9074 -
9075 +
9076 tasklet_schedule(&ieee->ps_task);
9077 -
9078 +
9079 if(WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_PROBE_RESP &&
9080 WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_BEACON)
9081 ieee->last_rx_ps_time = jiffies;
9082 -
9083 +
9084 switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
9085 -
9086 +
9087 case IEEE80211_STYPE_ASSOC_RESP:
9088 case IEEE80211_STYPE_REASSOC_RESP:
9089 -
9090 +
9091 IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n",
9092 WLAN_FC_GET_STYPE(header->frame_ctl));
9093 if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
9094 - ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
9095 + ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
9096 ieee->iw_mode == IW_MODE_INFRA){
9097 - if (0 == (errcode=assoc_parse(skb, &aid))){
9098 -
9099 + if (0 == (errcode=assoc_parse_rtl7(skb, &aid))){
9100 +
9101 ieee->state=IEEE80211_LINKED;
9102 ieee->assoc_id = aid;
9103 ieee->softmac_stats.rx_ass_ok++;
9104 -
9105 - ieee80211_associate_complete(ieee);
9106 +
9107 + ieee80211_associate_complete_rtl7(ieee);
9108 }else{
9109 ieee->softmac_stats.rx_ass_err++;
9110 IEEE80211_DEBUG_MGMT(
9111 "Association response status code 0x%x\n",
9112 errcode);
9113 - ieee80211_associate_abort(ieee);
9114 + ieee80211_associate_abort_rtl7(ieee);
9115 }
9116 }
9117 break;
9118 -
9119 +
9120 case IEEE80211_STYPE_ASSOC_REQ:
9121 case IEEE80211_STYPE_REASSOC_REQ:
9122 -
9123 +
9124 if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
9125 ieee->iw_mode == IW_MODE_MASTER)
9126 -
9127 - ieee80211_rx_assoc_rq(ieee, skb);
9128 +
9129 + ieee80211_rx_assoc_rq_rtl7(ieee, skb);
9130 break;
9131 -
9132 +
9133 case IEEE80211_STYPE_AUTH:
9134 -
9135 +
9136 if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE){
9137 - if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
9138 + if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
9139 ieee->iw_mode == IW_MODE_INFRA){
9140 -
9141 +
9142 IEEE80211_DEBUG_MGMT("Received authentication response");
9143 -
9144 - if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){
9145 +
9146 + if (0 == (errcode=auth_parse_rtl7(skb, &challenge, &chlen))){
9147 if(ieee->open_wep || !challenge){
9148 ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
9149 ieee->softmac_stats.rx_auth_rs_ok++;
9150 -
9151 - ieee80211_associate_step2(ieee);
9152 +
9153 + ieee80211_associate_step2_rtl7(ieee);
9154 }else{
9155 - ieee80211_auth_challenge(ieee, challenge, chlen);
9156 + ieee80211_auth_challenge_rtl7(ieee, challenge, chlen);
9157 }
9158 }else{
9159 ieee->softmac_stats.rx_auth_rs_err++;
9160 IEEE80211_DEBUG_MGMT("Authentication respose status code 0x%x",errcode);
9161 - ieee80211_associate_abort(ieee);
9162 + ieee80211_associate_abort_rtl7(ieee);
9163 }
9164 -
9165 +
9166 }else if (ieee->iw_mode == IW_MODE_MASTER){
9167 - ieee80211_rx_auth_rq(ieee, skb);
9168 + ieee80211_rx_auth_rq_rtl7(ieee, skb);
9169 }
9170 }
9171 break;
9172 -
9173 +
9174 case IEEE80211_STYPE_PROBE_REQ:
9175 -
9176 - if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
9177 - ((ieee->iw_mode == IW_MODE_ADHOC ||
9178 +
9179 + if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
9180 + ((ieee->iw_mode == IW_MODE_ADHOC ||
9181 ieee->iw_mode == IW_MODE_MASTER) &&
9182 ieee->state == IEEE80211_LINKED))
9183 -
9184 - ieee80211_rx_probe_rq(ieee, skb);
9185 +
9186 + ieee80211_rx_probe_rq_rtl7(ieee, skb);
9187 break;
9188 -
9189 +
9190 case IEEE80211_STYPE_DISASSOC:
9191 case IEEE80211_STYPE_DEAUTH:
9192 - /* FIXME for now repeat all the association procedure
9193 + /* FIXME for now repeat all the association procedure
9194 * both for disassociation and deauthentication
9195 */
9196 if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
9197 - ieee->state == IEEE80211_LINKED &&
9198 + ieee->state == IEEE80211_LINKED &&
9199 ieee->iw_mode == IW_MODE_INFRA){
9200 -
9201 +
9202 ieee->state = IEEE80211_ASSOCIATING;
9203 ieee->softmac_stats.reassoc++;
9204 -
9205 - notify_wx_assoc_event(ieee);
9206 -
9207 +
9208 + notify_wx_assoc_event_rtl7(ieee);
9209 +
9210 queue_work(ieee->wq, &ieee->associate_procedure_wq);
9211 }
9212 -
9213 +
9214 break;
9215 -
9216 - default:
9217 +
9218 + default:
9219 return -1;
9220 break;
9221 }
9222 -
9223 +
9224 //dev_kfree_skb_any(skb);
9225 return 0;
9226 }
9227 @@ -1602,21 +1620,21 @@
9228 * This might be useful if each fragment need it's own
9229 * descriptor, thus just keep a total free memory > than
9230 * the max fragmentation treshold is not enought.. If the
9231 - * ieee802.11 stack passed a TXB struct then you needed
9232 - * to keep N free descriptors where
9233 + * ieee802.11 stack passed a TXB struct then you needed
9234 + * to keep N free descriptors where
9235 * N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD
9236 * In this way you need just one and the 802.11 stack
9237 - * will take care of buffering fragments and pass them to
9238 + * will take care of buffering fragments and pass them to
9239 * to the driver later, when it wakes the queue.
9240 - */
9241 -
9242 -void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
9243 + */
9244 +
9245 +void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
9246 {
9247 -
9248 -
9249 +
9250 +
9251 unsigned long flags;
9252 int i;
9253 -
9254 +
9255 spin_lock_irqsave(&ieee->lock,flags);
9256 #if 0
9257 if(ieee->queue_stop){
9258 @@ -1627,13 +1645,13 @@
9259 err = 1;
9260 goto exit;
9261 }
9262 -
9263 +
9264 ieee->stats.tx_bytes+=skb->len;
9265 -
9266 -
9267 +
9268 +
9269 txb=ieee80211_skb_to_txb(ieee,skb);
9270 -
9271 -
9272 +
9273 +
9274 if(txb==NULL){
9275 IEEE80211DMESG("WW: IEEE stack failed to provide txb");
9276 //dev_kfree_skb_any(skb);
9277 @@ -1641,12 +1659,12 @@
9278 goto exit;
9279 }
9280 #endif
9281 -
9282 +
9283 /* called with 2nd parm 0, no tx mgmt lock required */
9284 - ieee80211_sta_wakeup(ieee,0);
9285 + ieee80211_sta_wakeup_rtl7(ieee,0);
9286
9287 for(i = 0; i < txb->nr_frags; i++) {
9288 -
9289 +
9290 if (ieee->queue_stop){
9291 ieee->tx_pending.txb = txb;
9292 ieee->tx_pending.frag = i;
9293 @@ -1658,29 +1676,29 @@
9294 //(i+1)<txb->nr_frags);
9295 ieee->stats.tx_packets++;
9296 ieee->stats.tx_bytes += txb->fragments[i]->len;
9297 - ieee->dev->trans_start = jiffies;
9298 + ieee->dev->trans_start = jiffies;
9299 }
9300 - }
9301 -
9302 - ieee80211_txb_free(txb);
9303 -
9304 + }
9305 +
9306 + ieee80211_txb_free_rtl7(txb);
9307 +
9308 exit:
9309 spin_unlock_irqrestore(&ieee->lock,flags);
9310 -
9311 +
9312 }
9313
9314 /* called with ieee->lock acquired */
9315 -void ieee80211_resume_tx(struct ieee80211_device *ieee)
9316 +void ieee80211_resume_tx_rtl7(struct ieee80211_device *ieee)
9317 {
9318 int i;
9319 for(i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) {
9320 -
9321 +
9322 if (ieee->queue_stop){
9323 ieee->tx_pending.frag = i;
9324 return;
9325 }else{
9326 -
9327 - ieee->softmac_data_hard_start_xmit(
9328 +
9329 + ieee->softmac_data_hard_start_xmit(
9330 ieee->tx_pending.txb->fragments[i],
9331 ieee->dev,ieee->rate);
9332 //(i+1)<ieee->tx_pending.txb->nr_frags);
9333 @@ -1688,21 +1706,21 @@
9334 ieee->dev->trans_start = jiffies;
9335 }
9336 }
9337 -
9338 -
9339 - ieee80211_txb_free(ieee->tx_pending.txb);
9340 +
9341 +
9342 + ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
9343 ieee->tx_pending.txb = NULL;
9344 }
9345
9346
9347 -void ieee80211_reset_queue(struct ieee80211_device *ieee)
9348 +void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee)
9349 {
9350 unsigned long flags;
9351 -
9352 +
9353 spin_lock_irqsave(&ieee->lock,flags);
9354 - init_mgmt_queue(ieee);
9355 + init_mgmt_queue_rtl7(ieee);
9356 if (ieee->tx_pending.txb){
9357 - ieee80211_txb_free(ieee->tx_pending.txb);
9358 + ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
9359 ieee->tx_pending.txb = NULL;
9360 }
9361 ieee->queue_stop = 0;
9362 @@ -1710,23 +1728,23 @@
9363
9364 }
9365
9366 -void ieee80211_wake_queue(struct ieee80211_device *ieee)
9367 +void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee)
9368 {
9369
9370 unsigned long flags;
9371 struct sk_buff *skb;
9372 struct ieee80211_hdr_3addr *header;
9373 -
9374 +
9375 spin_lock_irqsave(&ieee->lock,flags);
9376 if (! ieee->queue_stop) goto exit;
9377 -
9378 +
9379 ieee->queue_stop = 0;
9380 -
9381 +
9382 if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){
9383 - while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){
9384 -
9385 + while (!ieee->queue_stop && (skb = dequeue_mgmt_rtl7(ieee))){
9386 +
9387 header = (struct ieee80211_hdr_3addr *) skb->data;
9388 -
9389 +
9390 header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
9391
9392 if (ieee->seq_ctrl == 0xFFF)
9393 @@ -1738,19 +1756,19 @@
9394 }
9395 }
9396 if (!ieee->queue_stop && ieee->tx_pending.txb)
9397 - ieee80211_resume_tx(ieee);
9398 -
9399 + ieee80211_resume_tx_rtl7(ieee);
9400 +
9401 if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){
9402 ieee->softmac_stats.swtxawake++;
9403 netif_wake_queue(ieee->dev);
9404 }
9405 -
9406 +
9407 exit :
9408 spin_unlock_irqrestore(&ieee->lock,flags);
9409 }
9410
9411
9412 -void ieee80211_stop_queue(struct ieee80211_device *ieee)
9413 +void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee)
9414 {
9415 //unsigned long flags;
9416 //spin_lock_irqsave(&ieee->lock,flags);
9417 @@ -1761,81 +1779,88 @@
9418 }
9419 ieee->queue_stop = 1;
9420 //spin_unlock_irqrestore(&ieee->lock,flags);
9421 -
9422 +
9423 }
9424
9425
9426 -inline void ieee80211_randomize_cell(struct ieee80211_device *ieee)
9427 +inline void ieee80211_randomize_cell_rtl7(struct ieee80211_device *ieee)
9428 {
9429 -
9430 +
9431 get_random_bytes(ieee->current_network.bssid, ETH_ALEN);
9432 -
9433 +
9434 /* an IBSS cell address must have the two less significant
9435 - * bits of the first byte = 2
9436 + * bits of the first byte = 2
9437 */
9438 ieee->current_network.bssid[0] &= ~0x01;
9439 ieee->current_network.bssid[0] |= 0x02;
9440 }
9441
9442 /* called in user context only */
9443 -void ieee80211_start_master_bss(struct ieee80211_device *ieee)
9444 +void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee)
9445 {
9446 ieee->assoc_id = 1;
9447 -
9448 +
9449 if (ieee->current_network.ssid_len == 0){
9450 - strncpy(ieee->current_network.ssid,
9451 + strncpy(ieee->current_network.ssid,
9452 IEEE80211_DEFAULT_TX_ESSID,
9453 IW_ESSID_MAX_SIZE);
9454 -
9455 +
9456 ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
9457 ieee->ssid_set = 1;
9458 }
9459 -
9460 +
9461 memcpy(ieee->current_network.bssid, ieee->dev->dev_addr, ETH_ALEN);
9462 -
9463 +
9464 ieee->set_chan(ieee->dev, ieee->current_network.channel);
9465 ieee->state = IEEE80211_LINKED;
9466 ieee->link_change(ieee->dev);
9467 - notify_wx_assoc_event(ieee);
9468 -
9469 + notify_wx_assoc_event_rtl7(ieee);
9470 +
9471 if (ieee->data_hard_resume)
9472 ieee->data_hard_resume(ieee->dev);
9473 -
9474 +
9475 netif_carrier_on(ieee->dev);
9476 }
9477
9478 -void ieee80211_start_monitor_mode(struct ieee80211_device *ieee)
9479 +void ieee80211_start_monitor_mode_rtl7(struct ieee80211_device *ieee)
9480 {
9481 if(ieee->raw_tx){
9482 -
9483 +
9484 if (ieee->data_hard_resume)
9485 ieee->data_hard_resume(ieee->dev);
9486 -
9487 +
9488 netif_carrier_on(ieee->dev);
9489 }
9490 }
9491 -void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
9492 +
9493 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
9494 +void ieee80211_start_ibss_wq_rtl7(struct work_struct *work)
9495 {
9496 -
9497 + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, start_ibss_wq);
9498 +#else
9499 +void ieee80211_start_ibss_wq_rtl7(struct ieee80211_device *ieee)
9500 +{
9501 +#endif
9502 +
9503 /* iwconfig mode ad-hoc will schedule this and return
9504 * on the other hand this will block further iwconfig SET
9505 * operations because of the wx_sem hold.
9506 * Anyway some most set operations set a flag to speed-up
9507 - * (abort) this wq (when syncro scanning) before sleeping
9508 + * (abort) this wq (when syncro scanning) before sleeping
9509 * on the semaphore
9510 */
9511 -
9512 +
9513 down(&ieee->wx_sem);
9514 -
9515 +
9516 if (ieee->current_network.ssid_len == 0){
9517 strcpy(ieee->current_network.ssid,IEEE80211_DEFAULT_TX_ESSID);
9518 ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
9519 ieee->ssid_set = 1;
9520 - }
9521 -
9522 + }
9523 +
9524 /* check if we have this cell in our network list */
9525 - ieee80211_softmac_check_all_nets(ieee);
9526 -
9527 + ieee80211_softmac_check_all_nets_rtl7(ieee);
9528 +
9529 /* if not then the state is not linked. Maybe the user swithced to
9530 * ad-hoc mode just after being in monitor mode, or just after
9531 * being very few time in managed mode (so the card have had no
9532 @@ -1851,29 +1876,29 @@
9533 * associated.
9534 */
9535 if (ieee->state == IEEE80211_NOLINK)
9536 - ieee80211_start_scan_syncro(ieee);
9537 + ieee80211_start_scan_syncro_rtl7(ieee);
9538
9539 /* the network definitively is not here.. create a new cell */
9540 if (ieee->state == IEEE80211_NOLINK){
9541 - printk("creating new IBSS cell\n");
9542 + printk("creating new IBSS cell\n");
9543 if(!ieee->wap_set)
9544 - ieee80211_randomize_cell(ieee);
9545 -
9546 + ieee80211_randomize_cell_rtl7(ieee);
9547 +
9548 if(ieee->modulation & IEEE80211_CCK_MODULATION){
9549 -
9550 +
9551 ieee->current_network.rates_len = 4;
9552 -
9553 +
9554 ieee->current_network.rates[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB;
9555 ieee->current_network.rates[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB;
9556 ieee->current_network.rates[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
9557 ieee->current_network.rates[3] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
9558 -
9559 +
9560 }else
9561 ieee->current_network.rates_len = 0;
9562 -
9563 +
9564 if(ieee->modulation & IEEE80211_OFDM_MODULATION){
9565 ieee->current_network.rates_ex_len = 8;
9566 -
9567 +
9568 ieee->current_network.rates_ex[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
9569 ieee->current_network.rates_ex[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_9MB;
9570 ieee->current_network.rates_ex[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_12MB;
9571 @@ -1882,44 +1907,44 @@
9572 ieee->current_network.rates_ex[5] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
9573 ieee->current_network.rates_ex[6] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
9574 ieee->current_network.rates_ex[7] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
9575 -
9576 +
9577 ieee->rate = 540;
9578 }else{
9579 ieee->current_network.rates_ex_len = 0;
9580 ieee->rate = 110;
9581 }
9582 -
9583 +
9584 ieee->current_network.atim_window = 0;
9585 ieee->current_network.capability = WLAN_CAPABILITY_IBSS;
9586 if(ieee->short_slot)
9587 ieee->current_network.capability |= WLAN_CAPABILITY_SHORT_SLOT;
9588 -
9589 +
9590 }
9591 -
9592 +
9593 ieee->state = IEEE80211_LINKED;
9594 -
9595 +
9596 ieee->set_chan(ieee->dev, ieee->current_network.channel);
9597 ieee->link_change(ieee->dev);
9598 -
9599 - notify_wx_assoc_event(ieee);
9600 -
9601 - ieee80211_start_send_beacons(ieee);
9602 -
9603 +
9604 + notify_wx_assoc_event_rtl7(ieee);
9605 +
9606 + ieee80211_start_send_beacons_rtl7(ieee);
9607 +
9608 if (ieee->data_hard_resume)
9609 ieee->data_hard_resume(ieee->dev);
9610 -
9611 +
9612 netif_carrier_on(ieee->dev);
9613 -
9614 +
9615 up(&ieee->wx_sem);
9616 }
9617
9618 -inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
9619 +inline void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee)
9620 {
9621 queue_work(ieee->wq, &ieee->start_ibss_wq);
9622 }
9623
9624 /* this is called only in user context, with wx_sem held */
9625 -void ieee80211_start_bss(struct ieee80211_device *ieee)
9626 +void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee)
9627 {
9628 unsigned long flags;
9629 /* check if we have already found the net we
9630 @@ -1927,8 +1952,8 @@
9631 * if not (we are disassociated and we are not
9632 * in associating / authenticating phase) start the background scanning.
9633 */
9634 - ieee80211_softmac_check_all_nets(ieee);
9635 -
9636 + ieee80211_softmac_check_all_nets_rtl7(ieee);
9637 +
9638 /* ensure no-one start an associating process (thus setting
9639 * the ieee->state to ieee80211_ASSOCIATING) while we
9640 * have just cheked it and we are going to enable scan.
9641 @@ -1937,41 +1962,49 @@
9642 * the rx path), so we cannot be in the middle of such function
9643 */
9644 spin_lock_irqsave(&ieee->lock, flags);
9645 -
9646 if (ieee->state == IEEE80211_NOLINK)
9647 - ieee80211_start_scan(ieee);
9648 -
9649 + ieee80211_start_scan_rtl7(ieee);
9650 +
9651 spin_unlock_irqrestore(&ieee->lock, flags);
9652 }
9653
9654 /* called only in userspace context */
9655 -void ieee80211_disassociate(struct ieee80211_device *ieee)
9656 +void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee)
9657 {
9658 netif_carrier_off(ieee->dev);
9659 -
9660 +
9661 if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)
9662 - ieee80211_reset_queue(ieee);
9663 -
9664 + ieee80211_reset_queue_rtl7(ieee);
9665 +
9666 if (ieee->data_hard_stop)
9667 ieee->data_hard_stop(ieee->dev);
9668 -
9669 +
9670 ieee->state = IEEE80211_NOLINK;
9671 ieee->link_change(ieee->dev);
9672 - notify_wx_assoc_event(ieee);
9673 -
9674 + notify_wx_assoc_event_rtl7(ieee);
9675 +
9676 }
9677 -void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
9678 +
9679 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
9680 +void ieee80211_associate_retry_wq_rtl7(struct work_struct *work)
9681 {
9682 + struct delayed_work *dwork = container_of(work, struct delayed_work, work);
9683 + struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
9684 +#else
9685 +void ieee80211_associate_retry_wq_rtl7(struct ieee80211_device *ieee)
9686 +{
9687 +#endif
9688 unsigned long flags;
9689 -
9690 +
9691 down(&ieee->wx_sem);
9692 +
9693 if(!ieee->proto_started)
9694 goto exit;
9695 -
9696 +
9697 if(ieee->state != IEEE80211_ASSOCIATING_RETRY)
9698 goto exit;
9699 -
9700 - /* until we do not set the state to IEEE80211_NOLINK
9701 +
9702 + /* until we do not set the state to IEEE80211_NOLINK
9703 * there are no possibility to have someone else trying
9704 * to start an association procdure (we get here with
9705 * ieee->state = IEEE80211_ASSOCIATING).
9706 @@ -1981,122 +2014,120 @@
9707 * RX path works with ieee->lock held so there are no
9708 * problems. If we are still disassociated then start a scan.
9709 * the lock here is necessary to ensure no one try to start
9710 - * an association procedure when we have just checked the
9711 + * an association procedure when we have just checked the
9712 * state and we are going to start the scan.
9713 */
9714 ieee->state = IEEE80211_NOLINK;
9715
9716 - ieee80211_softmac_check_all_nets(ieee);
9717 -
9718 + ieee80211_softmac_check_all_nets_rtl7(ieee);
9719 +
9720 spin_lock_irqsave(&ieee->lock, flags);
9721 -
9722 +
9723 if(ieee->state == IEEE80211_NOLINK)
9724 - ieee80211_start_scan(ieee);
9725 -
9726 + ieee80211_start_scan_rtl7(ieee);
9727 +
9728 spin_unlock_irqrestore(&ieee->lock, flags);
9729
9730 exit:
9731 up(&ieee->wx_sem);
9732 }
9733
9734 -struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee)
9735 +struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee)
9736 {
9737 u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff};
9738 -
9739 +
9740 struct sk_buff *skb;
9741 struct ieee80211_probe_response *b;
9742 -
9743 - skb = ieee80211_probe_resp(ieee, broadcast_addr);
9744 -
9745 - if (!skb)
9746 +
9747 + skb = ieee80211_probe_resp_rtl7(ieee, broadcast_addr);
9748 +
9749 + if (!skb)
9750 return NULL;
9751 -
9752 +
9753 b = (struct ieee80211_probe_response *) skb->data;
9754 b->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_BEACON);
9755 -
9756 +
9757 return skb;
9758 -
9759 +
9760 }
9761
9762 -struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee)
9763 +struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee)
9764 {
9765 struct sk_buff *skb;
9766 struct ieee80211_probe_response *b;
9767 -
9768 - skb = ieee80211_get_beacon_(ieee);
9769 - if(!skb)
9770 +
9771 + skb = ieee80211_get_beacon__rtl7(ieee);
9772 + if(!skb)
9773 return NULL;
9774 -
9775 - b = (struct ieee80211_probe_response *) skb->data;
9776 +
9777 + b = (struct ieee80211_probe_response *) skb->data;
9778 b->header.seq_ctrl = cpu_to_le16(ieee->seq_ctrl << 4);
9779 -
9780 +
9781 if (ieee->seq_ctrl == 0xFFF)
9782 ieee->seq_ctrl = 0;
9783 else
9784 ieee->seq_ctrl++;
9785 -
9786 +
9787 return skb;
9788 }
9789
9790 -void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee)
9791 +void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee)
9792 {
9793 ieee->sync_scan_hurryup = 1;
9794 down(&ieee->wx_sem);
9795 - ieee80211_stop_protocol(ieee);
9796 +
9797 + ieee80211_stop_protocol_rtl7(ieee);
9798 up(&ieee->wx_sem);
9799 }
9800
9801
9802 -void ieee80211_stop_protocol(struct ieee80211_device *ieee)
9803 +void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee)
9804 {
9805 if (!ieee->proto_started)
9806 return;
9807 -
9808 +
9809 ieee->proto_started = 0;
9810 -
9811 - ieee80211_stop_send_beacons(ieee);
9812 -
9813 +
9814 + ieee80211_stop_send_beacons_rtl7(ieee);
9815 +
9816 del_timer_sync(&ieee->associate_timer);
9817 - cancel_delayed_work(&ieee->associate_retry_wq);
9818 -
9819 - ieee80211_stop_scan(ieee);
9820 + cancel_delayed_work(&ieee->associate_retry_wq);
9821
9822 - ieee80211_disassociate(ieee);
9823 + ieee80211_stop_scan_rtl7(ieee);
9824 +
9825 + ieee80211_disassociate_rtl7(ieee);
9826 }
9827
9828 -void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee)
9829 +void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee)
9830 {
9831 ieee->sync_scan_hurryup = 0;
9832 down(&ieee->wx_sem);
9833 - ieee80211_start_protocol(ieee);
9834 + ieee80211_start_protocol_rtl7(ieee);
9835 up(&ieee->wx_sem);
9836 }
9837
9838 -void ieee80211_start_protocol(struct ieee80211_device *ieee)
9839 +void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee)
9840 {
9841 short ch = 0;
9842 -
9843 if (ieee->proto_started)
9844 return;
9845 -
9846 +
9847 ieee->proto_started = 1;
9848 -
9849 +
9850 if (ieee->current_network.channel == 0){
9851 do{
9852 ch++;
9853 - if (ch > MAX_CHANNEL_NUMBER)
9854 + if (ch > MAX_CHANNEL_NUMBER)
9855 return; /* no channel found */
9856 -
9857 +
9858 }while(!ieee->channel_map[ch]);
9859 -
9860 +
9861 ieee->current_network.channel = ch;
9862 }
9863 -
9864 +
9865 if (ieee->current_network.beacon_interval == 0)
9866 ieee->current_network.beacon_interval = 100;
9867 -
9868 ieee->set_chan(ieee->dev,ieee->current_network.channel);
9869 -
9870 ieee->last_seq_num = -1;
9871 ieee->last_frag_num = -1;
9872 ieee->last_packet_time = 0;
9873 @@ -2107,30 +2138,27 @@
9874 * attempts does not fail just because the user provide the essid
9875 * and the nic is still checking for the AP MAC ??
9876 */
9877 -
9878 +
9879 if (ieee->iw_mode == IW_MODE_INFRA)
9880 - ieee80211_start_bss(ieee);
9881 -
9882 + ieee80211_start_bss_rtl7(ieee);
9883 else if (ieee->iw_mode == IW_MODE_ADHOC)
9884 - ieee80211_start_ibss(ieee);
9885 -
9886 + ieee80211_start_ibss_rtl7(ieee);
9887 else if (ieee->iw_mode == IW_MODE_MASTER)
9888 - ieee80211_start_master_bss(ieee);
9889 -
9890 + ieee80211_start_master_bss_rtl7(ieee);
9891 else if(ieee->iw_mode == IW_MODE_MONITOR)
9892 - ieee80211_start_monitor_mode(ieee);
9893 + ieee80211_start_monitor_mode_rtl7(ieee);
9894 }
9895
9896
9897 #define DRV_NAME "Ieee80211"
9898 -void ieee80211_softmac_init(struct ieee80211_device *ieee)
9899 +void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee)
9900 {
9901 memset(&ieee->current_network, 0, sizeof(struct ieee80211_network));
9902 -
9903 +
9904 ieee->state = IEEE80211_NOLINK;
9905 ieee->sync_scan_hurryup = 0;
9906 ieee->seq_ctrl = 0;
9907 -
9908 +
9909 ieee->assoc_id = 0;
9910 ieee->queue_stop = 0;
9911 ieee->scanning = 0;
9912 @@ -2142,66 +2170,75 @@
9913 ieee->rate = 3;
9914 ieee->ps = IEEE80211_PS_DISABLED;
9915 ieee->sta_sleep = 0;
9916 -
9917 - init_mgmt_queue(ieee);
9918 +
9919 + init_mgmt_queue_rtl7(ieee);
9920 #if 0
9921 init_timer(&ieee->scan_timer);
9922 ieee->scan_timer.data = (unsigned long)ieee;
9923 ieee->scan_timer.function = ieee80211_softmac_scan_cb;
9924 #endif
9925 ieee->tx_pending.txb = NULL;
9926 -
9927 +
9928 init_timer(&ieee->associate_timer);
9929 ieee->associate_timer.data = (unsigned long)ieee;
9930 - ieee->associate_timer.function = ieee80211_associate_abort_cb;
9931 + ieee->associate_timer.function = ieee80211_associate_abort_cb_rtl7;
9932
9933 init_timer(&ieee->beacon_timer);
9934 ieee->beacon_timer.data = (unsigned long) ieee;
9935 - ieee->beacon_timer.function = ieee80211_send_beacon_cb;
9936 -
9937 + ieee->beacon_timer.function = ieee80211_send_beacon_cb_rtl7;
9938 +
9939 #ifdef PF_SYNCTHREAD
9940 ieee->wq = create_workqueue(DRV_NAME,0);
9941 -#else
9942 +#else
9943 ieee->wq = create_workqueue(DRV_NAME);
9944 #endif
9945 -
9946 - INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
9947 - INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
9948 - INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
9949 - INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
9950 - INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
9951 - INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
9952 -
9953 +
9954 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
9955 + INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq_rtl7,ieee);
9956 + INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq_rtl7,ieee);
9957 + INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq_rtl7,ieee);
9958 + INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq_rtl7,ieee);
9959 + INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq_rtl7,ieee);
9960 + INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq_rtl7,ieee);
9961 +#else
9962 + INIT_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq_rtl7);
9963 + INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq_rtl7);
9964 + INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq_rtl7);
9965 + INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq_rtl7);
9966 + INIT_DELAYED_WORK(&ieee->softmac_scan_wq, ieee80211_softmac_scan_wq_rtl7);
9967 + INIT_WORK(&ieee->wx_sync_scan_wq, ieee80211_wx_sync_scan_wq_rtl7);
9968 +#endif
9969 +
9970 sema_init(&ieee->wx_sem, 1);
9971 sema_init(&ieee->scan_sem, 1);
9972 -
9973 +
9974 spin_lock_init(&ieee->mgmt_tx_lock);
9975 spin_lock_init(&ieee->beacon_lock);
9976 -
9977 +
9978 tasklet_init(&ieee->ps_task,
9979 - (void(*)(unsigned long)) ieee80211_sta_ps,
9980 + (void(*)(unsigned long)) ieee80211_sta_ps_rtl7,
9981 (unsigned long)ieee);
9982
9983 }
9984
9985 -void ieee80211_softmac_free(struct ieee80211_device *ieee)
9986 +void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee)
9987 {
9988 down(&ieee->wx_sem);
9989 -
9990 +
9991 del_timer_sync(&ieee->associate_timer);
9992 cancel_delayed_work(&ieee->associate_retry_wq);
9993 destroy_workqueue(ieee->wq);
9994 -
9995 +
9996 up(&ieee->wx_sem);
9997 }
9998
9999 -/********************************************************
10000 +/********************************************************
10001 * Start of WPA code. *
10002 * this is stolen from the ipw2200 driver *
10003 ********************************************************/
10004
10005 -
10006 -static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value)
10007 +
10008 +static int ieee80211_wpa_enable_rtl7(struct ieee80211_device *ieee, int value)
10009 {
10010 /* This is called when wpa_supplicant loads and closes the driver
10011 * interface. */
10012 @@ -2210,19 +2247,19 @@
10013 return 0;
10014 }
10015
10016 -
10017 -void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
10018 +
10019 +void ieee80211_wpa_assoc_frame_rtl7(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
10020 {
10021 /* make sure WPA is enabled */
10022 - ieee80211_wpa_enable(ieee, 1);
10023 + ieee80211_wpa_enable_rtl7(ieee, 1);
10024
10025 - ieee80211_disassociate(ieee);
10026 + ieee80211_disassociate_rtl7(ieee);
10027 }
10028
10029
10030 -static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason)
10031 +static int ieee80211_wpa_mlme_rtl7(struct ieee80211_device *ieee, int command, int reason)
10032 {
10033 -
10034 +
10035 int ret = 0;
10036
10037 switch (command) {
10038 @@ -2231,7 +2268,7 @@
10039 break;
10040
10041 case IEEE_MLME_STA_DISASSOC:
10042 - ieee80211_disassociate(ieee);
10043 + ieee80211_disassociate_rtl7(ieee);
10044 break;
10045
10046 default:
10047 @@ -2243,7 +2280,7 @@
10048 }
10049
10050
10051 -static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee,
10052 +static int ieee80211_wpa_set_wpa_ie_rtl7(struct ieee80211_device *ieee,
10053 struct ieee_param *param, int plen)
10054 {
10055 u8 *buf;
10056 @@ -2267,16 +2304,16 @@
10057 ieee->wpa_ie_len = 0;
10058 }
10059
10060 - ieee80211_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
10061 + ieee80211_wpa_assoc_frame_rtl7(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
10062 return 0;
10063 }
10064
10065 #define AUTH_ALG_OPEN_SYSTEM 0x1
10066 #define AUTH_ALG_SHARED_KEY 0x2
10067
10068 -static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value)
10069 +static int ieee80211_wpa_set_auth_algs_rtl7(struct ieee80211_device *ieee, int value)
10070 {
10071 -
10072 +
10073 struct ieee80211_security sec = {
10074 .flags = SEC_AUTH_MODE,
10075 };
10076 @@ -2300,13 +2337,13 @@
10077
10078
10079
10080 -static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value)
10081 +static int ieee80211_wpa_set_param_rtl7(struct ieee80211_device *ieee, u8 name, u32 value)
10082 {
10083 int ret=0;
10084
10085 switch (name) {
10086 case IEEE_PARAM_WPA_ENABLED:
10087 - ret = ieee80211_wpa_enable(ieee, value);
10088 + ret = ieee80211_wpa_enable_rtl7(ieee, value);
10089 break;
10090
10091 case IEEE_PARAM_TKIP_COUNTERMEASURES:
10092 @@ -2351,7 +2388,7 @@
10093 break;
10094
10095 case IEEE_PARAM_AUTH_ALGS:
10096 - ret = ieee80211_wpa_set_auth_algs(ieee, value);
10097 + ret = ieee80211_wpa_set_auth_algs_rtl7(ieee, value);
10098 break;
10099
10100 case IEEE_PARAM_IEEE_802_1X:
10101 @@ -2368,11 +2405,11 @@
10102
10103 /* implementation borrowed from hostap driver */
10104
10105 -static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
10106 +static int ieee80211_wpa_set_encryption_rtl7(struct ieee80211_device *ieee,
10107 struct ieee_param *param, int param_len)
10108 {
10109 int ret = 0;
10110 -
10111 +
10112 struct ieee80211_crypto_ops *ops;
10113 struct ieee80211_crypt_data **crypt;
10114
10115 @@ -2407,7 +2444,7 @@
10116 //sec.encrypt = 0;
10117 sec.level = SEC_LEVEL_0;
10118 sec.flags |= SEC_ENABLED | SEC_LEVEL;
10119 - ieee80211_crypt_delayed_deinit(ieee, crypt);
10120 + ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
10121 }
10122 goto done;
10123 }
10124 @@ -2421,16 +2458,16 @@
10125 strcmp(param->u.crypt.alg, "TKIP"))
10126 goto skip_host_crypt;
10127
10128 - ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
10129 + ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
10130 if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
10131 - request_module("ieee80211_crypt_wep");
10132 - ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
10133 + request_module("ieee80211_crypt_wep_rtl7");
10134 + ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
10135 } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {
10136 - request_module("ieee80211_crypt_tkip");
10137 - ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
10138 + request_module("ieee80211_crypt_tkip_rtl7");
10139 + ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
10140 } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {
10141 - request_module("ieee80211_crypt_ccmp");
10142 - ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
10143 + request_module("ieee80211_crypt_ccmp_rtl7");
10144 + ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
10145 }
10146 if (ops == NULL) {
10147 printk("unknown crypto alg '%s'\n", param->u.crypt.alg);
10148 @@ -2442,7 +2479,7 @@
10149 if (*crypt == NULL || (*crypt)->ops != ops) {
10150 struct ieee80211_crypt_data *new_crypt;
10151
10152 - ieee80211_crypt_delayed_deinit(ieee, crypt);
10153 + ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
10154
10155 new_crypt = (struct ieee80211_crypt_data *)
10156 kmalloc(sizeof(*new_crypt), GFP_KERNEL);
10157 @@ -2525,7 +2562,7 @@
10158
10159
10160
10161 -int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p)
10162 +int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p)
10163 {
10164 struct ieee_param *param;
10165 int ret=0;
10166 @@ -2537,7 +2574,7 @@
10167 ret = -EINVAL;
10168 goto out;
10169 }
10170 -
10171 +
10172 param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
10173 if (param == NULL){
10174 ret = -ENOMEM;
10175 @@ -2552,20 +2589,20 @@
10176 switch (param->cmd) {
10177
10178 case IEEE_CMD_SET_WPA_PARAM:
10179 - ret = ieee80211_wpa_set_param(ieee, param->u.wpa_param.name,
10180 + ret = ieee80211_wpa_set_param_rtl7(ieee, param->u.wpa_param.name,
10181 param->u.wpa_param.value);
10182 break;
10183
10184 case IEEE_CMD_SET_WPA_IE:
10185 - ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->length);
10186 + ret = ieee80211_wpa_set_wpa_ie_rtl7(ieee, param, p->length);
10187 break;
10188
10189 case IEEE_CMD_SET_ENCRYPTION:
10190 - ret = ieee80211_wpa_set_encryption(ieee, param, p->length);
10191 + ret = ieee80211_wpa_set_encryption_rtl7(ieee, param, p->length);
10192 break;
10193
10194 case IEEE_CMD_MLME:
10195 - ret = ieee80211_wpa_mlme(ieee, param->u.mlme.command,
10196 + ret = ieee80211_wpa_mlme_rtl7(ieee, param->u.mlme.command,
10197 param->u.mlme.reason_code);
10198 break;
10199
10200 @@ -2581,11 +2618,11 @@
10201 kfree(param);
10202 out:
10203 up(&ieee->wx_sem);
10204 -
10205 +
10206 return ret;
10207 }
10208
10209 -void notify_wx_assoc_event(struct ieee80211_device *ieee)
10210 +void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee)
10211 {
10212 union iwreq_data wrqu;
10213 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
10214 @@ -2597,14 +2634,14 @@
10215 }
10216
10217
10218 -EXPORT_SYMBOL(ieee80211_get_beacon);
10219 -EXPORT_SYMBOL(ieee80211_wake_queue);
10220 -EXPORT_SYMBOL(ieee80211_stop_queue);
10221 -EXPORT_SYMBOL(ieee80211_reset_queue);
10222 -EXPORT_SYMBOL(ieee80211_softmac_stop_protocol);
10223 -EXPORT_SYMBOL(ieee80211_softmac_start_protocol);
10224 -EXPORT_SYMBOL(ieee80211_is_shortslot);
10225 -EXPORT_SYMBOL(ieee80211_is_54g);
10226 -EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl);
10227 -EXPORT_SYMBOL(ieee80211_ps_tx_ack);
10228 -//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame);
10229 +EXPORT_SYMBOL(ieee80211_get_beacon_rtl7);
10230 +EXPORT_SYMBOL(ieee80211_wake_queue_rtl7);
10231 +EXPORT_SYMBOL(ieee80211_stop_queue_rtl7);
10232 +EXPORT_SYMBOL(ieee80211_reset_queue_rtl7);
10233 +EXPORT_SYMBOL(ieee80211_softmac_stop_protocol_rtl7);
10234 +EXPORT_SYMBOL(ieee80211_softmac_start_protocol_rtl7);
10235 +EXPORT_SYMBOL(ieee80211_is_shortslot_rtl7);
10236 +EXPORT_SYMBOL(ieee80211_is_54g_rtl7);
10237 +EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl_rtl7);
10238 +EXPORT_SYMBOL(ieee80211_ps_tx_ack_rtl7);
10239 +//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame_rtl7);
10240 diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac_wx.c rtl8187_rawtx/ieee80211/ieee80211_softmac_wx.c
10241 --- rtl8187_orig/ieee80211/ieee80211_softmac_wx.c 2007-03-13 23:45:09.000000000 +0100
10242 +++ rtl8187_rawtx/ieee80211/ieee80211_softmac_wx.c 2007-05-26 10:38:07.000000000 +0200
10243 @@ -1,7 +1,7 @@
10244 /* IEEE 802.11 SoftMAC layer
10245 * Copyright (c) 2005 Andrea Merello <[email protected]>
10246 *
10247 - * Mostly extracted from the rtl8180-sa2400 driver for the
10248 + * Mostly extracted from the rtl8180-sa2400 driver for the
10249 * in-kernel generic ieee802.11 stack.
10250 *
10251 * Some pieces of code might be stolen from ipw2100 driver
10252 @@ -18,23 +18,23 @@
10253
10254 /* FIXME: add A freqs */
10255
10256 -const long ieee80211_wlan_frequencies[] = {
10257 - 2412, 2417, 2422, 2427,
10258 - 2432, 2437, 2442, 2447,
10259 - 2452, 2457, 2462, 2467,
10260 - 2472, 2484
10261 +const long ieee80211_wlan_frequencies_rtl7[] = {
10262 + 2412, 2417, 2422, 2427,
10263 + 2432, 2437, 2442, 2447,
10264 + 2452, 2457, 2462, 2467,
10265 + 2472, 2484
10266 };
10267
10268
10269 -int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
10270 +int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
10271 union iwreq_data *wrqu, char *b)
10272 {
10273 int ret;
10274 struct iw_freq *fwrq = & wrqu->freq;
10275
10276 down(&ieee->wx_sem);
10277 -
10278 - if(ieee->iw_mode == IW_MODE_INFRA){
10279 +
10280 + if(ieee->iw_mode == IW_MODE_INFRA){
10281 ret = -EOPNOTSUPP;
10282 goto out;
10283 }
10284 @@ -45,31 +45,31 @@
10285 fwrq->m <= (int) 2.487e8)) {
10286 int f = fwrq->m / 100000;
10287 int c = 0;
10288 -
10289 - while ((c < 14) && (f != ieee80211_wlan_frequencies[c]))
10290 +
10291 + while ((c < 14) && (f != ieee80211_wlan_frequencies_rtl7[c]))
10292 c++;
10293 -
10294 +
10295 /* hack to fall through */
10296 fwrq->e = 0;
10297 fwrq->m = c + 1;
10298 }
10299 }
10300 -
10301 - if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
10302 +
10303 + if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
10304 ret = -EOPNOTSUPP;
10305 goto out;
10306 -
10307 +
10308 }else { /* Set the channel */
10309 -
10310 -
10311 +
10312 +
10313 ieee->current_network.channel = fwrq->m;
10314 ieee->set_chan(ieee->dev, ieee->current_network.channel);
10315 -
10316 +
10317 if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
10318 if(ieee->state == IEEE80211_LINKED){
10319 -
10320 - ieee80211_stop_send_beacons(ieee);
10321 - ieee80211_start_send_beacons(ieee);
10322 +
10323 + ieee80211_stop_send_beacons_rtl7(ieee);
10324 + ieee80211_start_send_beacons_rtl7(ieee);
10325 }
10326 }
10327
10328 @@ -80,7 +80,7 @@
10329 }
10330
10331
10332 -int ieee80211_wx_get_freq(struct ieee80211_device *ieee,
10333 +int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee,
10334 struct iw_request_info *a,
10335 union iwreq_data *wrqu, char *b)
10336 {
10337 @@ -88,110 +88,110 @@
10338
10339 if (ieee->current_network.channel == 0)
10340 return -1;
10341 -
10342 +
10343 fwrq->m = ieee->current_network.channel;
10344 fwrq->e = 0;
10345 -
10346 +
10347 return 0;
10348 }
10349
10350 -int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
10351 - struct iw_request_info *info,
10352 +int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
10353 + struct iw_request_info *info,
10354 union iwreq_data *wrqu, char *extra)
10355 {
10356 - unsigned long flags;
10357 -
10358 + unsigned long flags;
10359 +
10360 wrqu->ap_addr.sa_family = ARPHRD_ETHER;
10361 -
10362 +
10363 if (ieee->iw_mode == IW_MODE_MONITOR)
10364 return -1;
10365 -
10366 +
10367 /* We want avoid to give to the user inconsistent infos*/
10368 spin_lock_irqsave(&ieee->lock, flags);
10369 -
10370 - if (ieee->state != IEEE80211_LINKED &&
10371 +
10372 + if (ieee->state != IEEE80211_LINKED &&
10373 ieee->state != IEEE80211_LINKED_SCANNING &&
10374 ieee->wap_set == 0)
10375 -
10376 +
10377 memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
10378 else
10379 - memcpy(wrqu->ap_addr.sa_data,
10380 + memcpy(wrqu->ap_addr.sa_data,
10381 ieee->current_network.bssid, ETH_ALEN);
10382 -
10383 +
10384 spin_unlock_irqrestore(&ieee->lock, flags);
10385 -
10386 +
10387 return 0;
10388 }
10389
10390
10391 -int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
10392 +int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
10393 struct iw_request_info *info,
10394 union iwreq_data *awrq,
10395 char *extra)
10396 {
10397 -
10398 +
10399 int ret = 0;
10400 u8 zero[] = {0,0,0,0,0,0};
10401 unsigned long flags;
10402 -
10403 +
10404 + struct sockaddr *temp = NULL;
10405 short ifup = ieee->proto_started;//dev->flags & IFF_UP;
10406 -
10407 +
10408 ieee->sync_scan_hurryup = 1;
10409 -
10410 +
10411 down(&ieee->wx_sem);
10412 -
10413 - struct sockaddr *temp = (struct sockaddr *)awrq;
10414 -
10415 +
10416 + temp = (struct sockaddr *)awrq;
10417 /* use ifconfig hw ether */
10418 if (ieee->iw_mode == IW_MODE_MASTER){
10419 ret = -1;
10420 goto out;
10421 }
10422 -
10423 +
10424 if (temp->sa_family != ARPHRD_ETHER){
10425 ret = -EINVAL;
10426 goto out;
10427 }
10428 -
10429 +
10430 if (ifup)
10431 - ieee80211_stop_protocol(ieee);
10432 -
10433 + ieee80211_stop_protocol_rtl7(ieee);
10434 +
10435 /* just to avoid to give inconsistent infos in the
10436 - * get wx method. not really needed otherwise
10437 + * get wx method. not really needed otherwise
10438 */
10439 spin_lock_irqsave(&ieee->lock, flags);
10440 -
10441 - memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
10442 +
10443 + memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
10444 ieee->wap_set = memcmp(temp->sa_data, zero,ETH_ALEN)!=0;
10445 -
10446 +
10447 spin_unlock_irqrestore(&ieee->lock, flags);
10448 -
10449 +
10450 if (ifup)
10451 - ieee80211_start_protocol(ieee);
10452 -
10453 + ieee80211_start_protocol_rtl7(ieee);
10454 +
10455 out:
10456 up(&ieee->wx_sem);
10457 return ret;
10458 }
10459 -
10460 - int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
10461 +
10462 + int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
10463 {
10464 int len,ret = 0;
10465 unsigned long flags;
10466 -
10467 +
10468 if (ieee->iw_mode == IW_MODE_MONITOR)
10469 return -1;
10470 -
10471 - /* We want avoid to give to the user inconsistent infos*/
10472 +
10473 + /* We want avoid to give to the user inconsistent infos*/
10474 spin_lock_irqsave(&ieee->lock, flags);
10475 -
10476 +
10477 if (ieee->current_network.ssid[0] == '\0' ||
10478 - ieee->current_network.ssid_len == 0){
10479 + ieee->current_network.ssid_len == 0){
10480 ret = -1;
10481 goto out;
10482 }
10483 -
10484 - if (ieee->state != IEEE80211_LINKED &&
10485 +
10486 + if (ieee->state != IEEE80211_LINKED &&
10487 ieee->state != IEEE80211_LINKED_SCANNING &&
10488 ieee->ssid_set == 0){
10489 ret = -1;
10490 @@ -204,59 +204,76 @@
10491
10492 out:
10493 spin_unlock_irqrestore(&ieee->lock, flags);
10494 -
10495 +
10496 return ret;
10497 -
10498 +
10499 }
10500
10501 -int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
10502 +int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
10503 struct iw_request_info *info,
10504 union iwreq_data *wrqu, char *extra)
10505 {
10506
10507 u32 target_rate = wrqu->bitrate.value;
10508 -
10509 +
10510 ieee->rate = target_rate/100000;
10511 //FIXME: we might want to limit rate also in management protocols.
10512 - return 0;
10513 + return 0;
10514 }
10515
10516
10517
10518 -int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
10519 - struct iw_request_info *info,
10520 +int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
10521 + struct iw_request_info *info,
10522 union iwreq_data *wrqu, char *extra)
10523 {
10524 -
10525 +
10526 wrqu->bitrate.value = ieee->rate * 100000;
10527 -
10528 +
10529 return 0;
10530 }
10531
10532 -int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
10533 +int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
10534 union iwreq_data *wrqu, char *b)
10535 {
10536 -
10537 + short prev = ieee->raw_tx;
10538 +
10539 ieee->sync_scan_hurryup = 1;
10540 -
10541 +
10542 down(&ieee->wx_sem);
10543 -
10544 +
10545 if (wrqu->mode == ieee->iw_mode)
10546 goto out;
10547 -
10548 +
10549 if (wrqu->mode == IW_MODE_MONITOR){
10550 -
10551 - ieee->dev->type = ARPHRD_IEEE80211;
10552 + ieee->dev->type = ARPHRD_IEEE80211_PRISM;
10553 }else{
10554 ieee->dev->type = ARPHRD_ETHER;
10555 }
10556 -
10557 +
10558 if (!ieee->proto_started){
10559 ieee->iw_mode = wrqu->mode;
10560 }else{
10561 - ieee80211_stop_protocol(ieee);
10562 + ieee80211_stop_protocol_rtl7(ieee);
10563 ieee->iw_mode = wrqu->mode;
10564 - ieee80211_start_protocol(ieee);
10565 + ieee80211_start_protocol_rtl7(ieee);
10566 + }
10567 +
10568 + if(ieee->iw_mode == IW_MODE_MONITOR)
10569 + {
10570 + ieee->raw_tx = 1;
10571 + if(prev == 0 && ieee->raw_tx){
10572 + if (ieee->data_hard_resume)
10573 + ieee->data_hard_resume(ieee->dev);
10574 +
10575 + netif_carrier_on(ieee->dev);
10576 + }
10577 +
10578 + netif_carrier_on(ieee->dev);
10579 + }
10580 + else
10581 + {
10582 + ieee->raw_tx = 0;
10583 }
10584
10585 out:
10586 @@ -264,120 +281,132 @@
10587 return 0;
10588 }
10589
10590 -void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
10591 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
10592 +void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work)
10593 {
10594 + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
10595 +#else
10596 +void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee)
10597 +{
10598 +#endif
10599 short chan;
10600
10601 chan = ieee->current_network.channel;
10602 -
10603 +
10604 netif_carrier_off(ieee->dev);
10605 -
10606 +
10607 if (ieee->data_hard_stop)
10608 ieee->data_hard_stop(ieee->dev);
10609 -
10610 - ieee80211_stop_send_beacons(ieee);
10611 -
10612 +
10613 + ieee80211_stop_send_beacons_rtl7(ieee);
10614 +
10615 ieee->state = IEEE80211_LINKED_SCANNING;
10616 ieee->link_change(ieee->dev);
10617 -
10618 - ieee80211_start_scan_syncro(ieee);
10619 -
10620 +
10621 + ieee80211_start_scan_syncro_rtl7(ieee);
10622 +
10623 ieee->set_chan(ieee->dev, chan);
10624 -
10625 +
10626 ieee->state = IEEE80211_LINKED;
10627 ieee->link_change(ieee->dev);
10628 -
10629 +
10630 if (ieee->data_hard_resume)
10631 ieee->data_hard_resume(ieee->dev);
10632 -
10633 +
10634 if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
10635 - ieee80211_start_send_beacons(ieee);
10636 -
10637 + ieee80211_start_send_beacons_rtl7(ieee);
10638 +
10639 netif_carrier_on(ieee->dev);
10640 -
10641 +
10642 up(&ieee->wx_sem);
10643 -
10644 +
10645 }
10646
10647 -int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
10648 +int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
10649 union iwreq_data *wrqu, char *b)
10650 {
10651 int ret = 0;
10652 -
10653 +
10654 down(&ieee->wx_sem);
10655 -
10656 - if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
10657 +
10658 + if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
10659 ret = -1;
10660 goto out;
10661 }
10662 -
10663 +
10664 if ( ieee->state == IEEE80211_LINKED){
10665 queue_work(ieee->wq, &ieee->wx_sync_scan_wq);
10666 /* intentionally forget to up sem */
10667 return 0;
10668 }
10669 -
10670 +
10671 out:
10672 up(&ieee->wx_sem);
10673 return ret;
10674 }
10675
10676 -int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
10677 +int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
10678 struct iw_request_info *a,
10679 union iwreq_data *wrqu, char *extra)
10680 {
10681 -
10682 +
10683 int ret=0,len;
10684 short proto_started;
10685 unsigned long flags;
10686 -
10687 +
10688 ieee->sync_scan_hurryup = 1;
10689 -
10690 +
10691 down(&ieee->wx_sem);
10692 -
10693 +
10694 proto_started = ieee->proto_started;
10695 -
10696 +
10697 if (wrqu->essid.length > IW_ESSID_MAX_SIZE){
10698 ret= -E2BIG;
10699 goto out;
10700 }
10701 -
10702 +
10703 if (ieee->iw_mode == IW_MODE_MONITOR){
10704 ret= -1;
10705 goto out;
10706 }
10707 -
10708 +
10709 if(proto_started)
10710 - ieee80211_stop_protocol(ieee);
10711 -
10712 + ieee80211_stop_protocol_rtl7(ieee);
10713 +
10714 /* this is just to be sure that the GET wx callback
10715 * has consisten infos. not needed otherwise
10716 */
10717 spin_lock_irqsave(&ieee->lock, flags);
10718 -
10719 +
10720 if (wrqu->essid.flags && wrqu->essid.length) {
10721 +#if WIRELESS_EXT > 20
10722 + len = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE);
10723 +#else
10724 len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
10725 -
10726 +#endif
10727 +
10728 strncpy(ieee->current_network.ssid, extra, len);
10729 ieee->current_network.ssid_len = len;
10730 ieee->ssid_set = 1;
10731 }
10732 - else{
10733 + else{
10734 ieee->ssid_set = 0;
10735 ieee->current_network.ssid[0] = '\0';
10736 ieee->current_network.ssid_len = 0;
10737 }
10738 -
10739 +
10740 spin_unlock_irqrestore(&ieee->lock, flags);
10741 -
10742 +
10743 if (proto_started)
10744 - ieee80211_start_protocol(ieee);
10745 + ieee80211_start_protocol_rtl7(ieee);
10746 out:
10747 up(&ieee->wx_sem);
10748 +
10749 +
10750 return ret;
10751 }
10752
10753 - int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
10754 + int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
10755 union iwreq_data *wrqu, char *b)
10756 {
10757
10758 @@ -385,23 +414,23 @@
10759 return 0;
10760 }
10761
10762 - int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
10763 - struct iw_request_info *info,
10764 + int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
10765 + struct iw_request_info *info,
10766 union iwreq_data *wrqu, char *extra)
10767 {
10768 -
10769 +
10770 int *parms = (int *)extra;
10771 int enable = (parms[0] > 0);
10772 short prev = ieee->raw_tx;
10773
10774 down(&ieee->wx_sem);
10775 -
10776 - if(enable)
10777 +
10778 + if(enable)
10779 ieee->raw_tx = 1;
10780 - else
10781 + else
10782 ieee->raw_tx = 0;
10783
10784 - printk(KERN_INFO"raw TX is %s\n",
10785 + printk(KERN_INFO"raw TX is %s\n",
10786 ieee->raw_tx ? "enabled" : "disabled");
10787
10788 if(ieee->iw_mode == IW_MODE_MONITOR)
10789 @@ -409,21 +438,21 @@
10790 if(prev == 0 && ieee->raw_tx){
10791 if (ieee->data_hard_resume)
10792 ieee->data_hard_resume(ieee->dev);
10793 -
10794 - netif_carrier_on(ieee->dev);
10795 +
10796 + netif_carrier_on(ieee->dev);
10797 }
10798 -
10799 +
10800 if(prev && ieee->raw_tx == 1)
10801 - netif_carrier_off(ieee->dev);
10802 + netif_carrier_off(ieee->dev);
10803 }
10804 -
10805 +
10806 up(&ieee->wx_sem);
10807 -
10808 +
10809 return 0;
10810 }
10811 -
10812 -int ieee80211_wx_get_name(struct ieee80211_device *ieee,
10813 - struct iw_request_info *info,
10814 +
10815 +int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
10816 + struct iw_request_info *info,
10817 union iwreq_data *wrqu, char *extra)
10818 {
10819 strcpy(wrqu->name, "802.11");
10820 @@ -433,20 +462,20 @@
10821 strcat(wrqu->name, "/g");
10822 }else if(ieee->modulation & IEEE80211_OFDM_MODULATION)
10823 strcat(wrqu->name, "g");
10824 -
10825 - if((ieee->state == IEEE80211_LINKED) ||
10826 +
10827 + if((ieee->state == IEEE80211_LINKED) ||
10828 (ieee->state == IEEE80211_LINKED_SCANNING))
10829 strcat(wrqu->name," linked");
10830 else if(ieee->state != IEEE80211_NOLINK)
10831 strcat(wrqu->name," link..");
10832 -
10833 -
10834 +
10835 +
10836 return 0;
10837 }
10838
10839
10840 /* this is mostly stolen from hostap */
10841 -int ieee80211_wx_set_power(struct ieee80211_device *ieee,
10842 +int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
10843 struct iw_request_info *info,
10844 union iwreq_data *wrqu, char *extra)
10845 {
10846 @@ -457,50 +486,50 @@
10847 (!ieee->ps_request_tx_ack) ||
10848 (!ieee->enter_sleep_state) ||
10849 (!ieee->ps_is_queue_empty)){
10850 -
10851 +
10852 printk("ERROR. PS mode is tryied to be use but\
10853 -driver missed a callback\n\n");
10854 -
10855 +driver missed a callback\n\n");
10856 +
10857 return -1;
10858 }
10859 -
10860 +
10861 down(&ieee->wx_sem);
10862 -
10863 +
10864 if (wrqu->power.disabled){
10865 ieee->ps = IEEE80211_PS_DISABLED;
10866 -
10867 +
10868 goto exit;
10869 }
10870 switch (wrqu->power.flags & IW_POWER_MODE) {
10871 case IW_POWER_UNICAST_R:
10872 ieee->ps = IEEE80211_PS_UNICAST;
10873 -
10874 +
10875 break;
10876 case IW_POWER_ALL_R:
10877 - ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
10878 + ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
10879 break;
10880 -
10881 +
10882 case IW_POWER_ON:
10883 ieee->ps = IEEE80211_PS_DISABLED;
10884 break;
10885 -
10886 +
10887 default:
10888 ret = -EINVAL;
10889 goto exit;
10890 }
10891
10892 if (wrqu->power.flags & IW_POWER_TIMEOUT) {
10893 -
10894 +
10895 ieee->ps_timeout = wrqu->power.value / 1000;
10896 printk("Timeout %d\n",ieee->ps_timeout);
10897 }
10898 -
10899 +
10900 if (wrqu->power.flags & IW_POWER_PERIOD) {
10901 -
10902 +
10903 ret = -EOPNOTSUPP;
10904 goto exit;
10905 //wrq->value / 1024;
10906 -
10907 +
10908 }
10909 exit:
10910 up(&ieee->wx_sem);
10911 @@ -509,15 +538,15 @@
10912 }
10913
10914 /* this is stolen from hostap */
10915 -int ieee80211_wx_get_power(struct ieee80211_device *ieee,
10916 +int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
10917 struct iw_request_info *info,
10918 union iwreq_data *wrqu, char *extra)
10919 {
10920 int ret =0;
10921 -
10922 +
10923 down(&ieee->wx_sem);
10924 -
10925 - if(ieee->ps == IEEE80211_PS_DISABLED){
10926 +
10927 + if(ieee->ps == IEEE80211_PS_DISABLED){
10928 wrqu->power.disabled = 1;
10929 goto exit;
10930 }
10931 @@ -547,19 +576,19 @@
10932
10933 }
10934
10935 -EXPORT_SYMBOL(ieee80211_wx_get_essid);
10936 -EXPORT_SYMBOL(ieee80211_wx_set_essid);
10937 -EXPORT_SYMBOL(ieee80211_wx_set_rate);
10938 -EXPORT_SYMBOL(ieee80211_wx_get_rate);
10939 -EXPORT_SYMBOL(ieee80211_wx_set_wap);
10940 -EXPORT_SYMBOL(ieee80211_wx_get_wap);
10941 -EXPORT_SYMBOL(ieee80211_wx_set_mode);
10942 -EXPORT_SYMBOL(ieee80211_wx_get_mode);
10943 -EXPORT_SYMBOL(ieee80211_wx_set_scan);
10944 -EXPORT_SYMBOL(ieee80211_wx_get_freq);
10945 -EXPORT_SYMBOL(ieee80211_wx_set_freq);
10946 -EXPORT_SYMBOL(ieee80211_wx_set_rawtx);
10947 -EXPORT_SYMBOL(ieee80211_wx_get_name);
10948 -EXPORT_SYMBOL(ieee80211_wx_set_power);
10949 -EXPORT_SYMBOL(ieee80211_wx_get_power);
10950 -EXPORT_SYMBOL(ieee80211_wlan_frequencies);
10951 +EXPORT_SYMBOL(ieee80211_wx_get_essid_rtl7);
10952 +EXPORT_SYMBOL(ieee80211_wx_set_essid_rtl7);
10953 +EXPORT_SYMBOL(ieee80211_wx_set_rate_rtl7);
10954 +EXPORT_SYMBOL(ieee80211_wx_get_rate_rtl7);
10955 +EXPORT_SYMBOL(ieee80211_wx_set_wap_rtl7);
10956 +EXPORT_SYMBOL(ieee80211_wx_get_wap_rtl7);
10957 +EXPORT_SYMBOL(ieee80211_wx_set_mode_rtl7);
10958 +EXPORT_SYMBOL(ieee80211_wx_get_mode_rtl7);
10959 +EXPORT_SYMBOL(ieee80211_wx_set_scan_rtl7);
10960 +EXPORT_SYMBOL(ieee80211_wx_get_freq_rtl7);
10961 +EXPORT_SYMBOL(ieee80211_wx_set_freq_rtl7);
10962 +EXPORT_SYMBOL(ieee80211_wx_set_rawtx_rtl7);
10963 +EXPORT_SYMBOL(ieee80211_wx_get_name_rtl7);
10964 +EXPORT_SYMBOL(ieee80211_wx_set_power_rtl7);
10965 +EXPORT_SYMBOL(ieee80211_wx_get_power_rtl7);
10966 +EXPORT_SYMBOL(ieee80211_wlan_frequencies_rtl7);
10967 diff -Naur rtl8187_orig/ieee80211/ieee80211_tx.c rtl8187_rawtx/ieee80211/ieee80211_tx.c
10968 --- rtl8187_orig/ieee80211/ieee80211_tx.c 2007-03-13 23:45:09.000000000 +0100
10969 +++ rtl8187_rawtx/ieee80211/ieee80211_tx.c 2007-05-26 10:38:07.000000000 +0200
10970 @@ -32,7 +32,6 @@
10971 ******************************************************************************/
10972
10973 #include <linux/compiler.h>
10974 -#include <linux/config.h>
10975 #include <linux/errno.h>
10976 #include <linux/if_arp.h>
10977 #include <linux/in6.h>
10978 @@ -52,6 +51,12 @@
10979 #include <linux/etherdevice.h>
10980 #include <asm/uaccess.h>
10981
10982 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
10983 +#include <linux/config.h>
10984 +#else
10985 +#include <linux/autoconf.h>
10986 +#endif
10987 +
10988 #include "ieee80211.h"
10989
10990
10991 @@ -155,7 +160,7 @@
10992 static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
10993 static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
10994
10995 -static inline int ieee80211_put_snap(u8 *data, u16 h_proto)
10996 +static inline int ieee80211_put_snap_rtl7(u8 *data, u16 h_proto)
10997 {
10998 struct ieee80211_snap_hdr *snap;
10999 u8 *oui;
11000 @@ -178,7 +183,7 @@
11001 return SNAP_SIZE + sizeof(u16);
11002 }
11003
11004 -int ieee80211_encrypt_fragment(
11005 +int ieee80211_encrypt_fragment_rtl7(
11006 struct ieee80211_device *ieee,
11007 struct sk_buff *frag,
11008 int hdr_len)
11009 @@ -225,7 +230,7 @@
11010 }
11011
11012
11013 -void ieee80211_txb_free(struct ieee80211_txb *txb) {
11014 +void ieee80211_txb_free_rtl7(struct ieee80211_txb *txb) {
11015 int i;
11016 if (unlikely(!txb))
11017 return;
11018 @@ -235,7 +240,7 @@
11019 kfree(txb);
11020 }
11021
11022 -struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
11023 +struct ieee80211_txb *ieee80211_alloc_txb_rtl7(int nr_frags, int txb_size,
11024 int gfp_mask)
11025 {
11026 struct ieee80211_txb *txb;
11027 @@ -267,7 +272,7 @@
11028 }
11029
11030 /* SKBs are added to the ieee->tx_queue. */
11031 -int ieee80211_xmit(struct sk_buff *skb,
11032 +int ieee80211_xmit_rtl7(struct sk_buff *skb,
11033 struct net_device *dev)
11034 {
11035 struct ieee80211_device *ieee = netdev_priv(dev);
11036 @@ -397,7 +402,7 @@
11037 /* When we allocate the TXB we allocate enough space for the reserve
11038 * and full fragment bytes (bytes_per_frag doesn't include prefix,
11039 * postfix, header, FCS, etc.) */
11040 - txb = ieee80211_alloc_txb(nr_frags, frag_size, GFP_ATOMIC);
11041 + txb = ieee80211_alloc_txb_rtl7(nr_frags, frag_size, GFP_ATOMIC);
11042 if (unlikely(!txb)) {
11043 printk(KERN_WARNING "%s: Could not allocate TXB\n",
11044 ieee->dev->name);
11045 @@ -432,7 +437,7 @@
11046
11047 /* Put a SNAP header on the first fragment */
11048 if (i == 0) {
11049 - ieee80211_put_snap(
11050 + ieee80211_put_snap_rtl7(
11051 skb_put(skb_frag, SNAP_SIZE + sizeof(u16)),
11052 ether_type);
11053 bytes -= SNAP_SIZE + sizeof(u16);
11054 @@ -446,7 +451,7 @@
11055 /* Encryption routine will move the header forward in order
11056 * to insert the IV between the header and the payload */
11057 if (encrypt)
11058 - ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
11059 + ieee80211_encrypt_fragment_rtl7(ieee, skb_frag, hdr_len);
11060 if (ieee->config &
11061 (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
11062 skb_put(skb_frag, 4);
11063 @@ -458,13 +463,14 @@
11064 ieee->seq_ctrl++;
11065 //---
11066 }else{
11067 - if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
11068 +// if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
11069 + if (unlikely(skb->len < 14)) {
11070 printk(KERN_WARNING "%s: skb too small (%d).\n",
11071 ieee->dev->name, skb->len);
11072 goto success;
11073 }
11074
11075 - txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC);
11076 + txb = ieee80211_alloc_txb_rtl7(1, skb->len, GFP_ATOMIC);
11077 if(!txb){
11078 printk(KERN_WARNING "%s: Could not allocate TXB\n",
11079 ieee->dev->name);
11080 @@ -481,14 +487,14 @@
11081 dev_kfree_skb_any(skb);
11082 if (txb) {
11083 if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE){
11084 - ieee80211_softmac_xmit(txb, ieee);
11085 + ieee80211_softmac_xmit_rtl7(txb, ieee);
11086 }else{
11087 if ((*ieee->hard_start_xmit)(txb, dev) == 0) {
11088 stats->tx_packets++;
11089 stats->tx_bytes += txb->payload_size;
11090 return 0;
11091 }
11092 - ieee80211_txb_free(txb);
11093 + ieee80211_txb_free_rtl7(txb);
11094 }
11095
11096
11097 @@ -504,4 +510,4 @@
11098
11099 }
11100
11101 -EXPORT_SYMBOL(ieee80211_txb_free);
11102 +EXPORT_SYMBOL(ieee80211_txb_free_rtl7);
11103 diff -Naur rtl8187_orig/ieee80211/ieee80211_wx.c rtl8187_rawtx/ieee80211/ieee80211_wx.c
11104 --- rtl8187_orig/ieee80211/ieee80211_wx.c 2007-03-13 23:45:09.000000000 +0100
11105 +++ rtl8187_rawtx/ieee80211/ieee80211_wx.c 2007-05-26 10:38:07.000000000 +0200
11106 @@ -40,7 +40,7 @@
11107 };
11108
11109 #define MAX_CUSTOM_LEN 64
11110 -static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
11111 +static inline char *ipw2100_translate_scan_rtl7(struct ieee80211_device *ieee,
11112 char *start, char *stop,
11113 struct ieee80211_network *network)
11114 {
11115 @@ -207,7 +207,7 @@
11116 return start;
11117 }
11118
11119 -int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
11120 +int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
11121 struct iw_request_info *info,
11122 union iwreq_data *wrqu, char *extra)
11123 {
11124 @@ -220,13 +220,14 @@
11125
11126 IEEE80211_DEBUG_WX("Getting scan\n");
11127 down(&ieee->wx_sem);
11128 + printk("GOT WX GET SCAN WX_SEM LOCK");
11129 spin_lock_irqsave(&ieee->lock, flags);
11130
11131 list_for_each_entry(network, &ieee->network_list, list) {
11132 i++;
11133 if (ieee->scan_age == 0 ||
11134 time_after(network->last_scanned + ieee->scan_age, jiffies))
11135 - ev = ipw2100_translate_scan(ieee, ev, stop, network);
11136 + ev = ipw2100_translate_scan_rtl7(ieee, ev, stop, network);
11137 else
11138 IEEE80211_DEBUG_SCAN(
11139 "Not showing network '%s ("
11140 @@ -247,7 +248,7 @@
11141 return 0;
11142 }
11143
11144 -int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
11145 +int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
11146 struct iw_request_info *info,
11147 union iwreq_data *wrqu, char *keybuf)
11148 {
11149 @@ -281,7 +282,7 @@
11150 if (key_provided && *crypt) {
11151 IEEE80211_DEBUG_WX("Disabling encryption on key %d.\n",
11152 key);
11153 - ieee80211_crypt_delayed_deinit(ieee, crypt);
11154 + ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
11155 } else
11156 IEEE80211_DEBUG_WX("Disabling encryption.\n");
11157
11158 @@ -291,7 +292,7 @@
11159 if (ieee->crypt[i] != NULL) {
11160 if (key_provided)
11161 break;
11162 - ieee80211_crypt_delayed_deinit(
11163 + ieee80211_crypt_delayed_deinit_rtl7(
11164 ieee, &ieee->crypt[i]);
11165 }
11166 }
11167 @@ -314,7 +315,7 @@
11168 strcmp((*crypt)->ops->name, "WEP") != 0) {
11169 /* changing to use WEP; deinit previously used algorithm
11170 * on this key */
11171 - ieee80211_crypt_delayed_deinit(ieee, crypt);
11172 + ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
11173 }
11174
11175 if (*crypt == NULL) {
11176 @@ -326,10 +327,10 @@
11177 if (new_crypt == NULL)
11178 return -ENOMEM;
11179 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
11180 - new_crypt->ops = ieee80211_get_crypto_ops("WEP");
11181 + new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
11182 if (!new_crypt->ops) {
11183 request_module("ieee80211_crypt_wep");
11184 - new_crypt->ops = ieee80211_get_crypto_ops("WEP");
11185 + new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
11186 }
11187
11188 if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
11189 @@ -418,7 +419,7 @@
11190 return 0;
11191 }
11192
11193 -int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
11194 +int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
11195 struct iw_request_info *info,
11196 union iwreq_data *wrqu, char *keybuf)
11197 {
11198 @@ -470,6 +471,6 @@
11199 }
11200
11201
11202 -EXPORT_SYMBOL(ieee80211_wx_get_scan);
11203 -EXPORT_SYMBOL(ieee80211_wx_set_encode);
11204 -EXPORT_SYMBOL(ieee80211_wx_get_encode);
11205 +EXPORT_SYMBOL(ieee80211_wx_get_scan_rtl7);
11206 +EXPORT_SYMBOL(ieee80211_wx_set_encode_rtl7);
11207 +EXPORT_SYMBOL(ieee80211_wx_get_encode_rtl7);
11208 diff -Naur rtl8187_orig/ieee80211/Makefile rtl8187_rawtx/ieee80211/Makefile
11209 --- rtl8187_orig/ieee80211/Makefile 2007-03-13 23:45:09.000000000 +0100
11210 +++ rtl8187_rawtx/ieee80211/Makefile 2007-05-27 10:47:26.000000000 +0200
11211 @@ -17,6 +17,7 @@
11212 KVER := $(shell uname -r)
11213 KSRC := /lib/modules/$(KVER)/build
11214 INSTALL_PREFIX :=
11215 +PWD = $(shell pwd)
11216
11217 all: modules
11218
11219 diff -Naur rtl8187_orig/Makefile rtl8187_rawtx/Makefile
11220 --- rtl8187_orig/Makefile 1970-01-01 01:00:00.000000000 +0100
11221 +++ rtl8187_rawtx/Makefile 2007-05-26 10:39:10.000000000 +0200
11222 @@ -0,0 +1,36 @@
11223 +prefix = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless
11224 +r8187dir = $(prefix)/rtl8187
11225 +ieeedir = $(prefix)/rtl_ieee80211
11226 +
11227 +default: all
11228 +
11229 +all:
11230 + $(MAKE) -C ieee80211 $(@)
11231 + -chmod +x symvers
11232 + -./symvers
11233 + $(MAKE) -C beta-8187 $(@)
11234 +
11235 +install:
11236 + install -d $(ieeedir)
11237 + install -d $(r8187dir)
11238 + install -m 644 ./ieee80211/*.ko $(ieeedir)
11239 + install -m 644 ./beta-8187/*.ko $(r8187dir)
11240 + -depmod -ae
11241 +
11242 +uninstall:
11243 + -rm -f $(ieeedir)/ieee80211-rtl.ko
11244 + -rm -f $(ieeedir)/ieee80211_crypt-rtl.ko
11245 + -rm -f $(ieeedir)/ieee80211_crypt_ccmp-rtl.ko
11246 + -rm -f $(ieeedir)/ieee80211_crypt_tkip-rtl.ko
11247 + -rm -f $(ieeedir)/ieee80211_crypt_wep-rtl.ko
11248 + -rm -f $(r8187dir)/r8187.ko
11249 + -rm -fr $(ieeedir)
11250 + -rm -fr $(r8187dir)
11251 + -depmod -ae
11252 +
11253 +clean:
11254 + $(MAKE) -C ieee80211 $(@)
11255 + $(MAKE) -C beta-8187 $(@)
11256 +
11257 +distclean: clean
11258 +
11259 diff -Naur rtl8187_orig/symvers rtl8187_rawtx/symvers
11260 --- rtl8187_orig/symvers 1970-01-01 01:00:00.000000000 +0100
11261 +++ rtl8187_rawtx/symvers 2007-05-26 10:39:22.000000000 +0200
11262 @@ -0,0 +1,25 @@
11263 +#!/bin/sh
11264 +
11265 +cd beta-8187
11266 +
11267 +if [ -e Module.symvers ]
11268 +then
11269 + rm Module.symvers
11270 +fi
11271 +
11272 +if [ -e Modules.symvers ]
11273 +then
11274 + rm Modules.symvers
11275 +fi
11276 +
11277 +if [ -e ../ieee80211/Module.symvers ]
11278 +then
11279 + ln -sf ../ieee80211/Module.symvers ./
11280 +fi
11281 +
11282 +if [ -e ../ieee80211/Modules.symvers ]
11283 +then
11284 + ln -sf ../ieee80211/Modules.symvers ./
11285 +fi
11286 +
11287 +cd ..