nexmon – Blame information for rev 1

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