Debian Codegraph @

patches/old/rtl8187_2.6.21v2.patch

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