Debian Codegraph @

patches/old/rtl8187_2.6.20v3.patch

raw
1 diff -Naur rtl8187_orig/beta-8187/ieee80211.h rtl8187_txpower/beta-8187/ieee80211.h
2 --- rtl8187_orig/beta-8187/ieee80211.h 2007-03-13 23:45:09.000000000 +0100
3 +++ rtl8187_txpower/beta-8187/ieee80211.h 2007-04-23 00:08:15.000000000 +0200
4 @@ -156,6 +156,22 @@
5 struct list_head list;
6 };
7
8 +#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
9 +/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
10 + * (from linux-wlan-ng) */
11 +struct linux_wlan_ng_val {
12 + u32 did;
13 + u16 status, len;
14 + u32 data;
15 +} __attribute__ ((packed));
16 +
17 +struct linux_wlan_ng_prism_hdr {
18 + u32 msgcode, msglen;
19 + char devname[16];
20 + struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
21 + noise, rate, istx, frmlen;
22 +} __attribute__ ((packed));
23 +
24 struct ieee80211_hdr {
25 u16 frame_ctl;
26 u16 duration_id;
27 @@ -840,14 +856,14 @@
28
29
30 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
31 -extern inline int is_multicast_ether_addr(const u8 *addr)
32 +extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
33 {
34 return ((addr[0] != 0xff) && (0x01 & addr[0]));
35 }
36 #endif
37
38 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
39 -extern inline int is_broadcast_ether_addr(const u8 *addr)
40 +extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
41 {
42 return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
43 (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
44 @@ -1015,10 +1031,16 @@
45 struct timer_list beacon_timer;
46
47 struct work_struct associate_complete_wq;
48 +
49 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
50 + struct delayed_work associate_retry_wq;
51 + struct delayed_work softmac_scan_wq;
52 +#else
53 struct work_struct associate_retry_wq;
54 + struct work_struct softmac_scan_wq;
55 +#endif
56 struct work_struct start_ibss_wq;
57 struct work_struct associate_procedure_wq;
58 - struct work_struct softmac_scan_wq;
59 struct work_struct wx_sync_scan_wq;
60
61 struct workqueue_struct *wq;
62 @@ -1154,12 +1176,12 @@
63
64
65
66 -extern inline void *ieee80211_priv(struct net_device *dev)
67 +extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
68 {
69 return ((struct ieee80211_device *)netdev_priv(dev))->priv;
70 }
71
72 -extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
73 +extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
74 {
75 /* Single white space is for Linksys APs */
76 if (essid_len == 1 && essid[0] == ' ')
77 @@ -1175,7 +1197,7 @@
78 return 1;
79 }
80
81 -extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
82 +extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
83 {
84 /*
85 * It is possible for both access points and our device to support
86 @@ -1201,7 +1223,7 @@
87 return 0;
88 }
89
90 -extern inline int ieee80211_get_hdrlen(u16 fc)
91 +extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
92 {
93 int hdrlen = 24;
94
95 @@ -1229,140 +1251,144 @@
96
97
98 /* ieee80211.c */
99 -extern void free_ieee80211(struct net_device *dev);
100 -extern struct net_device *alloc_ieee80211(int sizeof_priv);
101 +extern void free_ieee80211_rtl7(struct net_device *dev);
102 +extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
103
104 -extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
105 +extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
106
107 /* ieee80211_tx.c */
108
109 -extern int ieee80211_encrypt_fragment(
110 +extern int ieee80211_encrypt_fragment_rtl7(
111 struct ieee80211_device *ieee,
112 struct sk_buff *frag,
113 int hdr_len);
114
115 -extern int ieee80211_xmit(struct sk_buff *skb,
116 +extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
117 struct net_device *dev);
118 -extern void ieee80211_txb_free(struct ieee80211_txb *);
119 +extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
120
121
122 /* ieee80211_rx.c */
123 -extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
124 +extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
125 struct ieee80211_rx_stats *rx_stats);
126 -extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
127 +extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
128 struct ieee80211_hdr *header,
129 struct ieee80211_rx_stats *stats);
130
131 /* ieee80211_wx.c */
132 -extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
133 +extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
134 struct iw_request_info *info,
135 union iwreq_data *wrqu, char *key);
136 -extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
137 +extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
138 struct iw_request_info *info,
139 union iwreq_data *wrqu, char *key);
140 -extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
141 +extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
142 struct iw_request_info *info,
143 union iwreq_data *wrqu, char *key);
144 /* ieee80211_softmac.c */
145 -extern short ieee80211_is_54g(struct ieee80211_network net);
146 -extern short ieee80211_is_shortslot(struct ieee80211_network net);
147 -extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
148 +extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
149 +extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
150 +extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
151 struct ieee80211_rx_stats *rx_stats, u16 type,
152 u16 stype);
153 -extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
154 +extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
155
156 -extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
157 -extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
158 -extern void ieee80211_start_bss(struct ieee80211_device *ieee);
159 -extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
160 -extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
161 -extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
162 -extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
163 -extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
164 -extern void ieee80211_disassociate(struct ieee80211_device *ieee);
165 -extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
166 -extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
167 -extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
168 -extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
169 -extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
170 -extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
171 -extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
172 -extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
173 -extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
174 -extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
175 -extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
176 -extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
177 -extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
178 -extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
179 -extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
180 -extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
181 +extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
182 +extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
183 +extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
184 +extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
185 +extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
186 +extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
187 +extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
188 +extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
189 +extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
190 +extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
191 +extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
192 +extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
193 +extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
194 +extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
195 +extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
196 +extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
197 +extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
198 +extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
199 +extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
200 +extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
201 +extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
202 +extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
203 +extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
204 +extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
205 +extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
206
207 /* ieee80211_softmac_wx.c */
208
209 -extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
210 +extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
211 struct iw_request_info *info,
212 union iwreq_data *wrqu, char *ext);
213
214 -extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
215 +extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
216 struct iw_request_info *info,
217 union iwreq_data *awrq,
218 char *extra);
219
220 -extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
221 +extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
222
223 -extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
224 +extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
225 struct iw_request_info *info,
226 union iwreq_data *wrqu, char *extra);
227
228 -extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
229 +extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
230 struct iw_request_info *info,
231 union iwreq_data *wrqu, char *extra);
232
233 -extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
234 +extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
235 union iwreq_data *wrqu, char *b);
236
237 -extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
238 +extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
239 union iwreq_data *wrqu, char *b);
240
241 -extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
242 +extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
243 struct iw_request_info *a,
244 union iwreq_data *wrqu, char *extra);
245
246 -extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
247 +extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
248 union iwreq_data *wrqu, char *b);
249
250 -extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
251 +extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
252 union iwreq_data *wrqu, char *b);
253
254 -extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
255 +extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
256 union iwreq_data *wrqu, char *b);
257
258 -extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
259 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
260 +extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
261 +#else
262 +extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
263 +#endif
264
265 -extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
266 +extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
267 struct iw_request_info *info,
268 union iwreq_data *wrqu, char *extra);
269
270 -extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
271 +extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
272 struct iw_request_info *info,
273 union iwreq_data *wrqu, char *extra);
274
275 -extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
276 +extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
277 struct iw_request_info *info,
278 union iwreq_data *wrqu, char *extra);
279
280 -extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
281 +extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
282 struct iw_request_info *info,
283 union iwreq_data *wrqu, char *extra);
284
285 -extern const long ieee80211_wlan_frequencies[];
286 +extern const long ieee80211_wlan_frequencies_rtl7[];
287
288 -extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
289 +extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
290 {
291 ieee->scans++;
292 }
293
294 -extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
295 +extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
296 {
297 return ieee->scans;
298 }
299 @@ -1372,7 +1398,7 @@
300 const char *s = essid;
301 char *d = escaped;
302
303 - if (ieee80211_is_empty_essid(essid, essid_len)) {
304 + if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
305 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
306 return escaped;
307 }
308 diff -Naur rtl8187_orig/beta-8187/r8180_93cx6.c rtl8187_txpower/beta-8187/r8180_93cx6.c
309 --- rtl8187_orig/beta-8187/r8180_93cx6.c 2007-03-13 23:45:09.000000000 +0100
310 +++ rtl8187_txpower/beta-8187/r8180_93cx6.c 2007-04-23 00:08:11.000000000 +0200
311 @@ -87,7 +87,7 @@
312
313 u32 eprom_read(struct net_device *dev, u32 addr)
314 {
315 - struct r8180_priv *priv = ieee80211_priv(dev);
316 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
317 short read_cmd[]={1,1,0};
318 short addr_str[8];
319 int i;
320 diff -Naur rtl8187_orig/beta-8187/r8180_hw.h rtl8187_txpower/beta-8187/r8180_hw.h
321 --- rtl8187_orig/beta-8187/r8180_hw.h 2007-03-13 23:45:09.000000000 +0100
322 +++ rtl8187_txpower/beta-8187/r8180_hw.h 2007-04-23 00:08:15.000000000 +0200
323 @@ -646,6 +646,7 @@
324 #define FFER_INTR ((1<<15))
325 #define FFER_GWAKE ((1<< 4))
326
327 -
328 +#define MAX_TX_POWER 27
329 +#define MIN_TX_POWER 20
330
331 #endif
332 diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.c rtl8187_txpower/beta-8187/r8180_rtl8225.c
333 --- rtl8187_orig/beta-8187/r8180_rtl8225.c 2007-03-13 23:45:09.000000000 +0100
334 +++ rtl8187_txpower/beta-8187/r8180_rtl8225.c 2007-04-23 00:08:11.000000000 +0200
335 @@ -173,7 +173,7 @@
336
337 void rtl8225_set_gain(struct net_device *dev, short gain)
338 {
339 - struct r8180_priv *priv = ieee80211_priv(dev);
340 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
341
342 rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
343
344 @@ -208,7 +208,7 @@
345 {
346 #ifdef USE_8051_3WIRE
347
348 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
349 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
350 struct usb_device *udev = priv->udev;
351 //u8 bit;
352 u16 wReg80, wReg82, wReg84;
353 @@ -255,7 +255,7 @@
354 u16 out,select;
355 u8 bit;
356 u32 bangdata = (data << 4) | (adr & 0xf);
357 - struct r8180_priv *priv = ieee80211_priv(dev);
358 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
359
360 out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
361
362 @@ -349,7 +349,7 @@
363
364 void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch)
365 {
366 - struct r8180_priv *priv = ieee80211_priv(dev);
367 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
368
369 int GainIdx;
370 int GainSetting;
371 @@ -454,9 +454,9 @@
372
373 void rtl8225_rf_set_chan(struct net_device *dev, short ch)
374 {
375 - struct r8180_priv *priv = ieee80211_priv(dev);
376 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
377 short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
378 - ieee80211_is_54g(priv->ieee80211->current_network)) ||
379 + ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
380 priv->ieee80211->iw_mode == IW_MODE_MONITOR;
381
382 rtl8225_SetTXPowerLevel(dev, ch);
383 @@ -474,7 +474,7 @@
384 write_nic_byte(dev,DIFS,0x24); //DIFS: 36
385
386 if(priv->ieee80211->state == IEEE80211_LINKED &&
387 - ieee80211_is_shortslot(priv->ieee80211->current_network))
388 + ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
389 write_nic_byte(dev,SLOT,0x9); //SLOT: 9
390
391 else
392 @@ -546,7 +546,7 @@
393
394 void rtl8225_rf_init(struct net_device *dev)
395 {
396 - struct r8180_priv *priv = ieee80211_priv(dev);
397 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
398 int i;
399 short channel = 1;
400 u16 brsr;
401 diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.h rtl8187_txpower/beta-8187/r8180_rtl8225.h
402 --- rtl8187_orig/beta-8187/r8180_rtl8225.h 2007-03-13 23:45:09.000000000 +0100
403 +++ rtl8187_txpower/beta-8187/r8180_rtl8225.h 2007-04-23 00:08:15.000000000 +0200
404 @@ -44,3 +44,5 @@
405 extern u32 rtl8225_chan[];
406
407 #endif
408 +
409 +void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
410 diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225z2.c rtl8187_txpower/beta-8187/r8180_rtl8225z2.c
411 --- rtl8187_orig/beta-8187/r8180_rtl8225z2.c 2007-03-13 23:45:09.000000000 +0100
412 +++ rtl8187_txpower/beta-8187/r8180_rtl8225z2.c 2007-04-23 00:08:11.000000000 +0200
413 @@ -129,7 +129,7 @@
414 void rtl8225z2_set_gain(struct net_device *dev, short gain)
415 {
416 u8* rtl8225_gain;
417 - struct r8180_priv *priv = ieee80211_priv(dev);
418 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
419
420 u8 mode = priv->ieee80211->mode;
421
422 @@ -153,7 +153,7 @@
423
424 void rtl8225_set_gain(struct net_device *dev, short gain)
425 {
426 - struct r8180_priv *priv = ieee80211_priv(dev);
427 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
428
429 rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
430
431 @@ -280,7 +280,7 @@
432 u16 out,select;
433 u8 bit;
434 u32 bangdata = (data << 4) | (adr & 0xf);
435 - struct r8180_priv *priv = ieee80211_priv(dev);
436 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
437
438 out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
439
440 @@ -396,7 +396,7 @@
441 #endif
442 void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch)
443 {
444 - struct r8180_priv *priv = ieee80211_priv(dev);
445 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
446
447 // int GainIdx;
448 // int GainSetting;
449 @@ -418,7 +418,10 @@
450
451 /* CCK power setting */
452 if(cck_power_level > max_cck_power_level)
453 + {
454 cck_power_level = max_cck_power_level;
455 + priv->chtxpwr[ch] = max_cck_power_level;
456 + }
457
458 cck_power_level += priv->cck_txpwr_base;
459
460 @@ -489,9 +492,9 @@
461
462 void rtl8225z2_rf_set_chan(struct net_device *dev, short ch)
463 {
464 - struct r8180_priv *priv = ieee80211_priv(dev);
465 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
466 short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
467 - ieee80211_is_54g(priv->ieee80211->current_network)) ||
468 + ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
469 priv->ieee80211->iw_mode == IW_MODE_MONITOR;
470
471 rtl8225z2_SetTXPowerLevel(dev, ch);
472 @@ -509,7 +512,7 @@
473 write_nic_byte(dev,DIFS,0x24); //DIFS: 36
474
475 if(priv->ieee80211->state == IEEE80211_LINKED &&
476 - ieee80211_is_shortslot(priv->ieee80211->current_network))
477 + ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
478 write_nic_byte(dev,SLOT,0x9); //SLOT: 9
479
480 else
481 @@ -581,7 +584,7 @@
482 #endif
483 void rtl8225z2_rf_init(struct net_device *dev)
484 {
485 - struct r8180_priv *priv = ieee80211_priv(dev);
486 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
487 int i;
488 short channel = 1;
489 u16 brsr;
490 @@ -958,7 +961,7 @@
491
492 void rtl8225z2_rf_set_mode(struct net_device *dev)
493 {
494 - struct r8180_priv *priv = ieee80211_priv(dev);
495 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
496
497 if(priv->ieee80211->mode == IEEE_A)
498 {
499 diff -Naur rtl8187_orig/beta-8187/r8180_wx.c rtl8187_txpower/beta-8187/r8180_wx.c
500 --- rtl8187_orig/beta-8187/r8180_wx.c 2007-03-13 23:45:09.000000000 +0100
501 +++ rtl8187_txpower/beta-8187/r8180_wx.c 2007-04-23 00:08:11.000000000 +0200
502 @@ -1,19 +1,19 @@
503 -/*
504 +/*
505 This file contains wireless extension handlers.
506
507 This is part of rtl8180 OpenSource driver.
508 - Copyright (C) Andrea Merello 2004-2005 <[email protected]>
509 + Copyright (C) Andrea Merello 2004-2005 <[email protected]>
510 Released under the terms of GPL (General Public Licence)
511 -
512 - Parts of this driver are based on the GPL part
513 +
514 + Parts of this driver are based on the GPL part
515 of the official realtek driver.
516 -
517 - Parts of this driver are based on the rtl8180 driver skeleton
518 +
519 + Parts of this driver are based on the rtl8180 driver skeleton
520 from Patric Schenke & Andres Salomon.
521
522 Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver.
523 -
524 - We want to tanks the Authors of those projects and the Ndiswrapper
525 +
526 + We want to tanks the Authors of those projects and the Ndiswrapper
527 project Authors.
528 */
529
530 @@ -21,20 +21,21 @@
531
532 #include "r8187.h"
533 #include "r8180_hw.h"
534 +#include "r8180_rtl8225.h"
535
536
537 #define RATE_COUNT 4
538 u32 rtl8180_rates[] = {1000000,2000000,5500000,11000000,
539 6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000};
540 -
541 +
542
543 static int r8180_wx_get_freq(struct net_device *dev,
544 struct iw_request_info *a,
545 union iwreq_data *wrqu, char *b)
546 {
547 - struct r8180_priv *priv = ieee80211_priv(dev);
548 -
549 - return ieee80211_wx_get_freq(priv->ieee80211,a,wrqu,b);
550 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
551 +
552 + return ieee80211_wx_get_freq_rtl7(priv->ieee80211,a,wrqu,b);
553 }
554
555
556 @@ -45,28 +46,28 @@
557 {
558 int *parms = (int *)b;
559 int bi = parms[0];
560 -
561 - struct r8180_priv *priv = ieee80211_priv(dev);
562 -
563 +
564 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
565 +
566 down(&priv->wx_sem);
567 DMESG("setting beacon interval to %x",bi);
568 -
569 +
570 priv->ieee80211->beacon_interval=bi;
571 rtl8180_commit(dev);
572 up(&priv->wx_sem);
573 -
574 - return 0;
575 +
576 + return 0;
577 }
578
579
580 static int r8180_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa,
581 union iwreq_data *wrqu, char *extra)
582 {
583 - struct r8180_priv *priv=ieee80211_priv(dev);
584 + struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
585 int *parms = (int *)extra;
586 -
587 +
588 priv->ieee80211->force_associate = (parms[0] > 0);
589 -
590 +
591
592 return 0;
593 }
594 @@ -75,108 +76,147 @@
595 static int r8180_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
596 union iwreq_data *wrqu, char *b)
597 {
598 - struct r8180_priv *priv=ieee80211_priv(dev);
599 + struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
600
601 - return ieee80211_wx_get_mode(priv->ieee80211,a,wrqu,b);
602 + return ieee80211_wx_get_mode_rtl7(priv->ieee80211,a,wrqu,b);
603 }
604
605
606
607 -static int r8180_wx_get_rate(struct net_device *dev,
608 - struct iw_request_info *info,
609 +static int r8180_wx_get_rate(struct net_device *dev,
610 + struct iw_request_info *info,
611 union iwreq_data *wrqu, char *extra)
612 {
613 - struct r8180_priv *priv = ieee80211_priv(dev);
614 - return ieee80211_wx_get_rate(priv->ieee80211,info,wrqu,extra);
615 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
616 + return ieee80211_wx_get_rate_rtl7(priv->ieee80211,info,wrqu,extra);
617 }
618
619
620
621 -static int r8180_wx_set_rate(struct net_device *dev,
622 - struct iw_request_info *info,
623 +static int r8180_wx_set_rate(struct net_device *dev,
624 + struct iw_request_info *info,
625 union iwreq_data *wrqu, char *extra)
626 {
627 int ret;
628 - struct r8180_priv *priv = ieee80211_priv(dev);
629 -
630 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
631 +
632 down(&priv->wx_sem);
633 + ret = ieee80211_wx_set_rate_rtl7(priv->ieee80211,info,wrqu,extra);
634
635 - ret = ieee80211_wx_set_rate(priv->ieee80211,info,wrqu,extra);
636 -
637 up(&priv->wx_sem);
638 -
639 +
640 return ret;
641 }
642
643 -static int r8180_wx_set_rawtx(struct net_device *dev,
644 - struct iw_request_info *info,
645 - union iwreq_data *wrqu, char *extra)
646 +static int r8180_wx_get_txpow(struct net_device *dev,
647 + struct iw_request_info *info,
648 + union iwreq_data *wrqu, char *extra)
649 +{
650 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
651 + down(&priv->wx_sem);
652 + wrqu->power.value = priv->chtxpwr_ofdm[1] + MIN_TX_POWER;
653 + wrqu->power.fixed = 1;
654 + wrqu->power.flags = IW_TXPOW_DBM;
655 + wrqu->power.disabled = 0;
656 + up(&priv->wx_sem);
657 +
658 + return 0;
659 +}
660 +
661 +#if 0
662 +static int r8180_wx_set_txpow(struct net_device *dev,
663 + struct iw_request_info *info,
664 + union iwreq_data *wrqu, char *extra)
665 {
666 - struct r8180_priv *priv = ieee80211_priv(dev);
667 - int ret;
668 -
669 + int ret = 0, i = 0;
670 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
671 +
672 down(&priv->wx_sem);
673 -
674 - ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
675 -
676 +
677 + if (wrqu->power.flags != IW_TXPOW_DBM)
678 + {
679 + ret = -EINVAL;
680 + goto out;
681 + }
682 +
683 + if(wrqu->power.value > MAX_TX_POWER)
684 + {
685 + ret = -EINVAL;
686 + goto out;
687 + }
688 +
689 + if(wrqu->power.value < MIN_TX_POWER)
690 + {
691 + ret = -EINVAL;
692 + goto out;
693 + }
694 +
695 + for(i=1;i<=14;i++)
696 + {
697 + priv->chtxpwr[i] = wrqu->power.value + 1 - MIN_TX_POWER;
698 + priv->chtxpwr_ofdm[i] = wrqu->power.value - MIN_TX_POWER;
699 + }
700 + rtl8225z2_SetTXPowerLevel(dev, 1);
701 +
702 + out:
703 up(&priv->wx_sem);
704 -
705 +
706 return ret;
707 -
708 }
709 +#endif
710
711 -static int r8180_wx_set_crcmon(struct net_device *dev,
712 - struct iw_request_info *info,
713 +static int r8180_wx_set_crcmon(struct net_device *dev,
714 + struct iw_request_info *info,
715 union iwreq_data *wrqu, char *extra)
716 {
717 - struct r8180_priv *priv = ieee80211_priv(dev);
718 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
719 int *parms = (int *)extra;
720 int enable = (parms[0] > 0);
721 short prev = priv->crcmon;
722
723 down(&priv->wx_sem);
724 -
725 - if(enable)
726 +
727 + if(enable)
728 priv->crcmon=1;
729 - else
730 + else
731 priv->crcmon=0;
732
733 - DMESG("bad CRC in monitor mode are %s",
734 + DMESG("bad CRC in monitor mode are %s",
735 priv->crcmon ? "accepted" : "rejected");
736
737 if(prev != priv->crcmon && priv->up){
738 rtl8180_down(dev);
739 rtl8180_up(dev);
740 }
741 -
742 +
743 up(&priv->wx_sem);
744 -
745 +
746 return 0;
747 }
748
749 static int r8180_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
750 union iwreq_data *wrqu, char *b)
751 {
752 - struct r8180_priv *priv = ieee80211_priv(dev);
753 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
754 int ret;
755 -
756 +
757 down(&priv->wx_sem);
758 -
759 - ret = ieee80211_wx_set_mode(priv->ieee80211,a,wrqu,b);
760 -
761 +
762 + ret = ieee80211_wx_set_mode_rtl7(priv->ieee80211,a,wrqu,b);
763 +
764 rtl8187_set_rxconf(dev);
765 -
766 +
767 up(&priv->wx_sem);
768 return ret;
769 }
770
771
772 -static int rtl8180_wx_get_range(struct net_device *dev,
773 - struct iw_request_info *info,
774 +static int rtl8180_wx_get_range(struct net_device *dev,
775 + struct iw_request_info *info,
776 union iwreq_data *wrqu, char *extra)
777 {
778 struct iw_range *range = (struct iw_range *)extra;
779 - struct r8180_priv *priv = ieee80211_priv(dev);
780 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
781 u16 val;
782 int i;
783
784 @@ -186,26 +226,26 @@
785 /* Let's try to keep this struct in the same order as in
786 * linux/include/wireless.h
787 */
788 -
789 +
790 /* TODO: See what values we can set, and remove the ones we can't
791 * set, or fill them with some default data.
792 */
793
794 /* ~5 Mb/s real (802.11b) */
795 - range->throughput = 5 * 1000 * 1000;
796 + range->throughput = 5 * 1000 * 1000;
797
798 // TODO: Not used in 802.11b?
799 // range->min_nwid; /* Minimal NWID we are able to set */
800 // TODO: Not used in 802.11b?
801 // range->max_nwid; /* Maximal NWID we are able to set */
802 -
803 +
804 /* Old Frequency (backward compat - moved lower ) */
805 -// range->old_num_channels;
806 +// range->old_num_channels;
807 // range->old_num_frequency;
808 // range->old_freq[6]; /* Filler to keep "version" at the same offset */
809 if(priv->rf_set_sens != NULL)
810 range->sensitivity = priv->max_sens; /* signal level threshold range */
811 -
812 +
813 range->max_qual.qual = 100;
814 /* TODO: Find real max RSSI and stick here */
815 range->max_qual.level = 0;
816 @@ -219,14 +259,14 @@
817 range->avg_qual.updated = 7; /* Updated all three */
818
819 range->num_bitrates = RATE_COUNT;
820 -
821 +
822 for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) {
823 range->bitrate[i] = rtl8180_rates[i];
824 }
825 -
826 +
827 range->min_frag = MIN_FRAG_THRESHOLD;
828 range->max_frag = MAX_FRAG_THRESHOLD;
829 -
830 +
831 range->pm_capa = 0;
832
833 range->we_version_compiled = WIRELESS_EXT;
834 @@ -243,18 +283,18 @@
835 range->num_channels = 14;
836
837 for (i = 0, val = 0; i < 14; i++) {
838 -
839 +
840 // Include only legal frequencies for some countries
841 if ((priv->challow)[i+1]) {
842 range->freq[val].i = i + 1;
843 - range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000;
844 + range->freq[val].m = ieee80211_wlan_frequencies_rtl7[i] * 100000;
845 range->freq[val].e = 1;
846 val++;
847 } else {
848 // FIXME: do we need to set anything for channels
849 // we don't use ?
850 }
851 -
852 +
853 if (val == IW_MAX_FREQUENCIES)
854 break;
855 }
856 @@ -267,15 +307,15 @@
857 static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
858 union iwreq_data *wrqu, char *b)
859 {
860 - struct r8180_priv *priv = ieee80211_priv(dev);
861 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
862 int ret;
863 -
864 +
865 if(!priv->up) return -1;
866 -
867 +
868 down(&priv->wx_sem);
869 -
870 - ret = ieee80211_wx_set_scan(priv->ieee80211,a,wrqu,b);
871 -
872 +
873 + ret = ieee80211_wx_set_scan_rtl7(priv->ieee80211,a,wrqu,b);
874 +
875 up(&priv->wx_sem);
876 return ret;
877 }
878 @@ -286,50 +326,50 @@
879 {
880
881 int ret;
882 - struct r8180_priv *priv = ieee80211_priv(dev);
883 -
884 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
885 +
886 if(!priv->up) return -1;
887 -
888 +
889 down(&priv->wx_sem);
890
891 - ret = ieee80211_wx_get_scan(priv->ieee80211,a,wrqu,b);
892 -
893 + ret = ieee80211_wx_get_scan_rtl7(priv->ieee80211,a,wrqu,b);
894 +
895 up(&priv->wx_sem);
896 -
897 +
898 return ret;
899 }
900
901
902 -static int r8180_wx_set_essid(struct net_device *dev,
903 +static int r8180_wx_set_essid(struct net_device *dev,
904 struct iw_request_info *a,
905 union iwreq_data *wrqu, char *b)
906 {
907 - struct r8180_priv *priv = ieee80211_priv(dev);
908 -
909 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
910 +
911 int ret;
912 -
913 +
914 down(&priv->wx_sem);
915 -
916 - ret = ieee80211_wx_set_essid(priv->ieee80211,a,wrqu,b);
917 -
918 +
919 + ret = ieee80211_wx_set_essid_rtl7(priv->ieee80211,a,wrqu,b);
920 +
921 up(&priv->wx_sem);
922 return ret;
923 }
924
925
926 -static int r8180_wx_get_essid(struct net_device *dev,
927 +static int r8180_wx_get_essid(struct net_device *dev,
928 struct iw_request_info *a,
929 union iwreq_data *wrqu, char *b)
930 {
931 int ret;
932 - struct r8180_priv *priv = ieee80211_priv(dev);
933 -
934 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
935 +
936 down(&priv->wx_sem);
937 -
938 - ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b);
939 +
940 + ret = ieee80211_wx_get_essid_rtl7(priv->ieee80211, a, wrqu, b);
941
942 up(&priv->wx_sem);
943 -
944 +
945 return ret;
946 }
947
948 @@ -338,30 +378,30 @@
949 union iwreq_data *wrqu, char *b)
950 {
951 int ret;
952 - struct r8180_priv *priv = ieee80211_priv(dev);
953 -
954 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
955 +
956 down(&priv->wx_sem);
957 -
958 - ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b);
959 -
960 +
961 + ret = ieee80211_wx_set_freq_rtl7(priv->ieee80211, a, wrqu, b);
962 +
963 up(&priv->wx_sem);
964 return ret;
965 }
966
967 -static int r8180_wx_get_name(struct net_device *dev,
968 - struct iw_request_info *info,
969 +static int r8180_wx_get_name(struct net_device *dev,
970 + struct iw_request_info *info,
971 union iwreq_data *wrqu, char *extra)
972 {
973 - struct r8180_priv *priv = ieee80211_priv(dev);
974 - return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra);
975 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
976 + return ieee80211_wx_get_name_rtl7(priv->ieee80211, info, wrqu, extra);
977 }
978
979
980 -static int r8180_wx_set_frag(struct net_device *dev,
981 - struct iw_request_info *info,
982 +static int r8180_wx_set_frag(struct net_device *dev,
983 + struct iw_request_info *info,
984 union iwreq_data *wrqu, char *extra)
985 {
986 - struct r8180_priv *priv = ieee80211_priv(dev);
987 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
988
989 if (wrqu->frag.disabled)
990 priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
991 @@ -369,7 +409,7 @@
992 if (wrqu->frag.value < MIN_FRAG_THRESHOLD ||
993 wrqu->frag.value > MAX_FRAG_THRESHOLD)
994 return -EINVAL;
995 -
996 +
997 priv->ieee80211->fts = wrqu->frag.value & ~0x1;
998 }
999
1000 @@ -377,11 +417,11 @@
1001 }
1002
1003
1004 -static int r8180_wx_get_frag(struct net_device *dev,
1005 - struct iw_request_info *info,
1006 +static int r8180_wx_get_frag(struct net_device *dev,
1007 + struct iw_request_info *info,
1008 union iwreq_data *wrqu, char *extra)
1009 {
1010 - struct r8180_priv *priv = ieee80211_priv(dev);
1011 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1012
1013 wrqu->frag.value = priv->ieee80211->fts;
1014 wrqu->frag.fixed = 0; /* no auto select */
1015 @@ -397,49 +437,49 @@
1016 char *extra)
1017 {
1018 int ret;
1019 - struct r8180_priv *priv = ieee80211_priv(dev);
1020 -
1021 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1022 +
1023 down(&priv->wx_sem);
1024 -
1025 - ret = ieee80211_wx_set_wap(priv->ieee80211,info,awrq,extra);
1026 -
1027 +
1028 + ret = ieee80211_wx_set_wap_rtl7(priv->ieee80211,info,awrq,extra);
1029 +
1030 up(&priv->wx_sem);
1031 return ret;
1032 -
1033 +
1034 }
1035 -
1036
1037 -static int r8180_wx_get_wap(struct net_device *dev,
1038 - struct iw_request_info *info,
1039 +
1040 +static int r8180_wx_get_wap(struct net_device *dev,
1041 + struct iw_request_info *info,
1042 union iwreq_data *wrqu, char *extra)
1043 {
1044 - struct r8180_priv *priv = ieee80211_priv(dev);
1045 -
1046 - return ieee80211_wx_get_wap(priv->ieee80211,info,wrqu,extra);
1047 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1048 +
1049 + return ieee80211_wx_get_wap_rtl7(priv->ieee80211,info,wrqu,extra);
1050 }
1051
1052
1053 -static int r8180_wx_get_enc(struct net_device *dev,
1054 - struct iw_request_info *info,
1055 +static int r8180_wx_get_enc(struct net_device *dev,
1056 + struct iw_request_info *info,
1057 union iwreq_data *wrqu, char *key)
1058 {
1059 - struct r8180_priv *priv = ieee80211_priv(dev);
1060 -
1061 - return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key);
1062 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1063 +
1064 + return ieee80211_wx_get_encode_rtl7(priv->ieee80211, info, wrqu, key);
1065 }
1066
1067 -static int r8180_wx_set_enc(struct net_device *dev,
1068 - struct iw_request_info *info,
1069 +static int r8180_wx_set_enc(struct net_device *dev,
1070 + struct iw_request_info *info,
1071 union iwreq_data *wrqu, char *key)
1072 {
1073 - struct r8180_priv *priv = ieee80211_priv(dev);
1074 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1075 int ret;
1076 -
1077 +
1078 down(&priv->wx_sem);
1079 -
1080 +
1081 DMESG("Setting SW wep key");
1082 - ret = ieee80211_wx_set_encode(priv->ieee80211,info,wrqu,key);
1083 -
1084 + ret = ieee80211_wx_set_encode_rtl7(priv->ieee80211,info,wrqu,key);
1085 +
1086 up(&priv->wx_sem);
1087 return ret;
1088 }
1089 @@ -447,28 +487,28 @@
1090
1091 static int r8180_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union
1092 iwreq_data *wrqu, char *p){
1093 -
1094 - struct r8180_priv *priv = ieee80211_priv(dev);
1095 +
1096 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1097 int *parms=(int*)p;
1098 int mode=parms[0];
1099 -
1100 +
1101 priv->ieee80211->active_scan = mode;
1102 -
1103 +
1104 return 1;
1105 }
1106
1107
1108
1109 -static int r8180_wx_set_retry(struct net_device *dev,
1110 - struct iw_request_info *info,
1111 +static int r8180_wx_set_retry(struct net_device *dev,
1112 + struct iw_request_info *info,
1113 union iwreq_data *wrqu, char *extra)
1114 {
1115 - struct r8180_priv *priv = ieee80211_priv(dev);
1116 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1117 int err = 0;
1118 -
1119 +
1120 down(&priv->wx_sem);
1121 -
1122 - if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
1123 +
1124 + if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
1125 wrqu->retry.disabled){
1126 err = -EINVAL;
1127 goto exit;
1128 @@ -485,13 +525,13 @@
1129 if (wrqu->retry.flags & IW_RETRY_MAX) {
1130 priv->retry_rts = wrqu->retry.value;
1131 DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value);
1132 -
1133 +
1134 }else {
1135 priv->retry_data = wrqu->retry.value;
1136 DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value);
1137 }
1138 -
1139 - /* FIXME !
1140 +
1141 + /* FIXME !
1142 * We might try to write directly the TX config register
1143 * or to restart just the (R)TX process.
1144 * I'm unsure if whole reset is really needed
1145 @@ -503,28 +543,28 @@
1146 rtl8180_rtx_disable(dev);
1147 rtl8180_rx_enable(dev);
1148 rtl8180_tx_enable(dev);
1149 -
1150 +
1151 }
1152 */
1153 exit:
1154 up(&priv->wx_sem);
1155 -
1156 +
1157 return err;
1158 }
1159
1160 -static int r8180_wx_get_retry(struct net_device *dev,
1161 - struct iw_request_info *info,
1162 +static int r8180_wx_get_retry(struct net_device *dev,
1163 + struct iw_request_info *info,
1164 union iwreq_data *wrqu, char *extra)
1165 {
1166 - struct r8180_priv *priv = ieee80211_priv(dev);
1167 -
1168 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1169 +
1170
1171 wrqu->retry.disabled = 0; /* can't be disabled */
1172
1173 - if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
1174 - IW_RETRY_LIFETIME)
1175 + if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
1176 + IW_RETRY_LIFETIME)
1177 return -EINVAL;
1178 -
1179 +
1180 if (wrqu->retry.flags & IW_RETRY_MAX) {
1181 wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MAX;
1182 wrqu->retry.value = priv->retry_rts;
1183 @@ -533,30 +573,30 @@
1184 wrqu->retry.value = priv->retry_data;
1185 }
1186 //DMESG("returning %d",wrqu->retry.value);
1187 -
1188 +
1189
1190 return 0;
1191 }
1192
1193 -static int r8180_wx_get_sens(struct net_device *dev,
1194 - struct iw_request_info *info,
1195 +static int r8180_wx_get_sens(struct net_device *dev,
1196 + struct iw_request_info *info,
1197 union iwreq_data *wrqu, char *extra)
1198 {
1199 - struct r8180_priv *priv = ieee80211_priv(dev);
1200 - if(priv->rf_set_sens == NULL)
1201 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1202 + if(priv->rf_set_sens == NULL)
1203 return -1; /* we have not this support for this radio */
1204 wrqu->sens.value = priv->sens;
1205 return 0;
1206 }
1207
1208
1209 -static int r8180_wx_set_sens(struct net_device *dev,
1210 - struct iw_request_info *info,
1211 +static int r8180_wx_set_sens(struct net_device *dev,
1212 + struct iw_request_info *info,
1213 union iwreq_data *wrqu, char *extra)
1214 {
1215 -
1216 - struct r8180_priv *priv = ieee80211_priv(dev);
1217 -
1218 +
1219 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1220 +
1221 short err = 0;
1222 down(&priv->wx_sem);
1223 //DMESG("attempt to set sensivity to %ddb",wrqu->sens.value);
1224 @@ -571,7 +611,7 @@
1225
1226 exit:
1227 up(&priv->wx_sem);
1228 -
1229 +
1230 return err;
1231 }
1232
1233 @@ -624,31 +664,27 @@
1234 r8180_wx_set_frag, /* SIOCSIWFRAG */
1235 r8180_wx_get_frag, /* SIOCGIWFRAG */
1236 dummy, /* SIOCSIWTXPOW */
1237 - dummy, /* SIOCGIWTXPOW */
1238 + r8180_wx_get_txpow, /* SIOCGIWTXPOW */
1239 r8180_wx_set_retry, /* SIOCSIWRETRY */
1240 r8180_wx_get_retry, /* SIOCGIWRETRY */
1241 r8180_wx_set_enc, /* SIOCSIWENCODE */
1242 r8180_wx_get_enc, /* SIOCGIWENCODE */
1243 dummy, /* SIOCSIWPOWER */
1244 dummy, /* SIOCGIWPOWER */
1245 -};
1246 +};
1247
1248
1249 -static const struct iw_priv_args r8180_private_args[] = {
1250 -
1251 +static const struct iw_priv_args r8180_private_args[] = {
1252 +
1253 {
1254 - SIOCIWFIRSTPRIV + 0x0,
1255 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
1256 - },
1257 -
1258 + SIOCIWFIRSTPRIV + 0x0,
1259 + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
1260 + },
1261 +
1262 {
1263 SIOCIWFIRSTPRIV + 0x1,
1264 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
1265 -
1266 - },
1267 - {
1268 - SIOCIWFIRSTPRIV + 0x2,
1269 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx"
1270 +
1271 }
1272 };
1273
1274 @@ -660,13 +696,12 @@
1275 // r8180_wx_set_beaconinterval,
1276 // r8180_wx_set_monitor_type,
1277 r8180_wx_set_scan_type,
1278 - r8180_wx_set_rawtx,
1279 };
1280
1281 -#if WIRELESS_EXT >= 17
1282 +#if WIRELESS_EXT >= 17
1283 static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
1284 {
1285 - struct r8180_priv *priv = ieee80211_priv(dev);
1286 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1287
1288 return &priv->wstats;
1289 }
1290 @@ -679,8 +714,8 @@
1291 .private = r8180_private_handler,
1292 .num_private = sizeof(r8180_private_handler) / sizeof(iw_handler),
1293 .num_private_args = sizeof(r8180_private_args) / sizeof(struct iw_priv_args),
1294 -#if WIRELESS_EXT >= 17
1295 +#if WIRELESS_EXT >= 17
1296 .get_wireless_stats = r8180_get_wireless_stats,
1297 #endif
1298 - .private_args = (struct iw_priv_args *)r8180_private_args,
1299 + .private_args = (struct iw_priv_args *)r8180_private_args,
1300 };
1301 diff -Naur rtl8187_orig/beta-8187/r8187_core.c rtl8187_txpower/beta-8187/r8187_core.c
1302 --- rtl8187_orig/beta-8187/r8187_core.c 2007-03-13 23:45:09.000000000 +0100
1303 +++ rtl8187_txpower/beta-8187/r8187_core.c 2007-04-23 00:08:11.000000000 +0200
1304 @@ -1,27 +1,27 @@
1305 /*
1306 This is part of rtl8187 OpenSource driver - v 0.1
1307 - Copyright (C) Andrea Merello 2005 <[email protected]>
1308 + Copyright (C) Andrea Merello 2005 <[email protected]>
1309 Released under the terms of GPL (General Public License)
1310 -
1311 -
1312 - Parts of this driver are based on the rtl8180 driver skeleton
1313 +
1314 +
1315 + Parts of this driver are based on the rtl8180 driver skeleton
1316 from Patric Schenke & Andres Salomon.
1317
1318 Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers.
1319 -
1320 +
1321 some ideas might be derived from David Young rtl8180 netbsd driver.
1322 -
1323 +
1324 Parts of the usb code are from the r8150.c driver in linux kernel
1325 -
1326 +
1327 Some ideas borrowed from the 8139too.c driver included in linux kernel.
1328 -
1329 - We (I?) want to thanks the Authors of those projecs and also the
1330 +
1331 + We (I?) want to thanks the Authors of those projecs and also the
1332 Ndiswrapper's project Authors.
1333 -
1334 - A special big thanks goes also to Realtek corp. for their help in my
1335 - attempt to add RTL8187 and RTL8225 support, and to David Young also.
1336
1337 - - Please note that this file is a modified version from rtl8180-sa2400
1338 + A special big thanks goes also to Realtek corp. for their help in my
1339 + attempt to add RTL8187 and RTL8225 support, and to David Young also.
1340 +
1341 + - Please note that this file is a modified version from rtl8180-sa2400
1342 drv. So some other people have contributed to this project, and they are
1343 thanked in the rtl8180-sa2400 CHANGELOG.
1344 */
1345 @@ -57,6 +57,7 @@
1346 #undef DEBUG_IRQ_TASKLET
1347 #undef DEBUG_TX_ALLOC
1348 #undef DEBUG_TX_DESC
1349 +#undef DEBUG_TX_POWER
1350
1351 //#define CONFIG_RTL8180_IO_MAP
1352
1353 @@ -66,6 +67,9 @@
1354 #include "r8180_93cx6.h" /* Card EEPROM */
1355 #include "r8180_wx.h"
1356
1357 +#if !(defined(CONFIG_USB_EHCI_HCD) || defined (CONFIG_USB_EHCI_HCD_MODULE))
1358 + #error Build your kernel with ehci_hcd support!
1359 +#endif
1360
1361 // FIXME: check if 2.6.7 is ok
1362 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
1363 @@ -98,6 +102,10 @@
1364 #endif
1365 static int channels = 0x3fff;
1366
1367 +#define DEBUG_EPROM
1368 +#define DEBUG_REGISTERS
1369 +#define DEBUG_TX_POWER
1370 +
1371 MODULE_LICENSE("GPL");
1372 MODULE_VERSION("V 1.1");
1373 MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
1374 @@ -137,7 +145,7 @@
1375
1376 static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
1377 const struct usb_device_id *id);
1378 -
1379 +
1380 static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf);
1381
1382 static struct usb_driver rtl8187_usb_driver = {
1383 @@ -158,13 +166,12 @@
1384 #endif
1385 };
1386
1387 -
1388 void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
1389 {
1390 -
1391 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1392 +
1393 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1394 struct usb_device *udev = priv->udev;
1395 -
1396 +
1397 usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
1398 RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
1399 indx|0xfe00, 0, &data, 1, HZ / 2);
1400 @@ -173,10 +180,10 @@
1401
1402 void write_nic_byte(struct net_device *dev, int indx, u8 data)
1403 {
1404 -
1405 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1406 +
1407 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1408 struct usb_device *udev = priv->udev;
1409 -
1410 +
1411 usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
1412 RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
1413 indx|0xff00, 0, &data, 1, HZ / 2);
1414 @@ -185,10 +192,10 @@
1415
1416 void write_nic_word(struct net_device *dev, int indx, u16 data)
1417 {
1418 -
1419 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1420 +
1421 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1422 struct usb_device *udev = priv->udev;
1423 -
1424 +
1425 usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
1426 RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
1427 indx|0xff00, 0, &data, 2, HZ / 2);
1428 @@ -197,23 +204,23 @@
1429
1430 void write_nic_dword(struct net_device *dev, int indx, u32 data)
1431 {
1432 -
1433 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1434 +
1435 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1436 struct usb_device *udev = priv->udev;
1437 -
1438 +
1439 usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
1440 RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
1441 indx|0xff00, 0, &data, 4, HZ / 2);
1442 }
1443 -
1444 -
1445 -
1446 +
1447 +
1448 +
1449 u8 read_nic_byte(struct net_device *dev, int indx)
1450 {
1451 u8 data;
1452 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1453 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1454 struct usb_device *udev = priv->udev;
1455 -
1456 +
1457 usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
1458 RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
1459 indx|0xff00, 0, &data, 1, HZ / 2);
1460 @@ -223,22 +230,22 @@
1461 u8 read_nic_byte_E(struct net_device *dev, int indx)
1462 {
1463 u8 data;
1464 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1465 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1466 struct usb_device *udev = priv->udev;
1467 -
1468 +
1469 usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
1470 RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
1471 indx|0xfe00, 0, &data, 1, HZ / 2);
1472 return data;
1473 }
1474
1475 -
1476 +
1477 u16 read_nic_word(struct net_device *dev, int indx)
1478 {
1479 u16 data;
1480 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1481 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1482 struct usb_device *udev = priv->udev;
1483 -
1484 +
1485 usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
1486 RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
1487 indx|0xff00, 0, &data, 2, HZ / 2);
1488 @@ -249,16 +256,16 @@
1489 u32 read_nic_dword(struct net_device *dev, int indx)
1490 {
1491 u32 data;
1492 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1493 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1494 struct usb_device *udev = priv->udev;
1495 -
1496 +
1497 usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
1498 RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
1499 indx|0xff00, 0, &data, 4, HZ / 2);
1500 return data;
1501 }
1502
1503 -/* this might still called in what was the PHY rtl8185/rtl8187 common code
1504 +/* this might still called in what was the PHY rtl8185/rtl8187 common code
1505 * plans are to possibilty turn it again in one common code...
1506 */
1507 inline void force_pci_posting(struct net_device *dev)
1508 @@ -271,7 +278,12 @@
1509 //void set_nic_txring(struct net_device *dev);
1510 static struct net_device_stats *rtl8180_stats(struct net_device *dev);
1511 void rtl8180_commit(struct net_device *dev);
1512 +
1513 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
1514 +void rtl8180_restart(struct work_struct *work);
1515 +#else
1516 void rtl8180_restart(struct net_device *dev);
1517 +#endif
1518
1519 /****************************************************************************
1520 -----------------------------PROCFS STUFF-------------------------
1521 @@ -284,13 +296,13 @@
1522 int *eof, void *data)
1523 {
1524 struct net_device *dev = data;
1525 -// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1526 -
1527 +// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1528 +
1529 int len = 0;
1530 int i,n;
1531 -
1532 +
1533 int max=0xff;
1534 -
1535 +
1536 /* This dump the current register page */
1537 for(n=0;n<=max;)
1538 {
1539 @@ -307,7 +319,7 @@
1540 len += snprintf(page + len, count - len,"\n");
1541
1542
1543 -
1544 +
1545 *eof = 1;
1546 return len;
1547
1548 @@ -319,16 +331,16 @@
1549 int *eof, void *data)
1550 {
1551 struct net_device *dev = data;
1552 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1553 -
1554 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1555 +
1556 int len = 0;
1557 -
1558 +
1559 len += snprintf(page + len, count - len,
1560 "NIC int: %lu\n"
1561 "Total int: %lu\n",
1562 priv->stats.ints,
1563 priv->stats.shints);
1564 -
1565 +
1566 *eof = 1;
1567 return len;
1568 }
1569 @@ -339,10 +351,10 @@
1570 int *eof, void *data)
1571 {
1572 struct net_device *dev = data;
1573 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1574 -
1575 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1576 +
1577 int len = 0;
1578 -
1579 +
1580 len += snprintf(page + len, count - len,
1581 "TX normal priority ok int: %lu\n"
1582 "TX normal priority error int: %lu\n"
1583 @@ -359,7 +371,7 @@
1584 "TX HW queue: %d\n"
1585 "TX lp dropped: %lu\n"
1586 "TX np dropped: %lu\n"
1587 - "TX total data packets %lu\n",
1588 + "TX total data packets %lu\n",
1589 // "TX beacon aborted: %lu\n",
1590 priv->stats.txnpokint,
1591 priv->stats.txnperr,
1592 @@ -379,10 +391,10 @@
1593 priv->stats.txdatapkt
1594 // priv->stats.txbeaconerr
1595 );
1596 -
1597 +
1598 *eof = 1;
1599 return len;
1600 -}
1601 +}
1602
1603
1604
1605 @@ -391,10 +403,10 @@
1606 int *eof, void *data)
1607 {
1608 struct net_device *dev = data;
1609 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1610 -
1611 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1612 +
1613 int len = 0;
1614 -
1615 +
1616 len += snprintf(page + len, count - len,
1617 "RX packets: %lu\n"
1618 "RX urb status error: %lu\n"
1619 @@ -402,21 +414,22 @@
1620 priv->stats.rxok,
1621 priv->stats.rxstaterr,
1622 priv->stats.rxurberr);
1623 -
1624 +
1625 *eof = 1;
1626 return len;
1627 -}
1628 -
1629 +}
1630
1631 +#if WIRELESS_EXT < 17
1632 static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
1633 {
1634 - struct r8180_priv *priv = ieee80211_priv(dev);
1635 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1636
1637 return &priv->wstats;
1638 }
1639 +#endif
1640
1641 void rtl8180_proc_module_init(void)
1642 -{
1643 +{
1644 DMESG("Initializing proc filesystem");
1645 rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net);
1646 }
1647 @@ -430,7 +443,7 @@
1648
1649 void rtl8180_proc_remove_one(struct net_device *dev)
1650 {
1651 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1652 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1653 if (priv->dir_dev) {
1654 // remove_proc_entry("stats-hw", priv->dir_dev);
1655 remove_proc_entry("stats-tx", priv->dir_dev);
1656 @@ -447,9 +460,9 @@
1657 void rtl8180_proc_init_one(struct net_device *dev)
1658 {
1659 struct proc_dir_entry *e;
1660 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1661 - priv->dir_dev = create_proc_entry(dev->name,
1662 - S_IFDIR | S_IRUGO | S_IXUGO,
1663 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1664 + priv->dir_dev = create_proc_entry(dev->name,
1665 + S_IFDIR | S_IRUGO | S_IXUGO,
1666 rtl8180_proc);
1667 if (!priv->dir_dev) {
1668 DMESGE("Unable to initialize /proc/net/rtl8187/%s\n",
1669 @@ -459,7 +472,7 @@
1670 #if 0
1671 e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO,
1672 priv->dir_dev, proc_get_stats_hw, dev);
1673 -
1674 +
1675 if (!e) {
1676 DMESGE("Unable to initialize "
1677 "/proc/net/rtl8187/%s/stats-hw\n",
1678 @@ -468,17 +481,17 @@
1679 #endif
1680 e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
1681 priv->dir_dev, proc_get_stats_rx, dev);
1682 -
1683 +
1684 if (!e) {
1685 DMESGE("Unable to initialize "
1686 "/proc/net/rtl8187/%s/stats-rx\n",
1687 dev->name);
1688 }
1689 -
1690 -
1691 +
1692 +
1693 e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
1694 priv->dir_dev, proc_get_stats_tx, dev);
1695 -
1696 +
1697 if (!e) {
1698 DMESGE("Unable to initialize "
1699 "/proc/net/rtl8187/%s/stats-tx\n",
1700 @@ -487,27 +500,27 @@
1701 #if 0
1702 e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO,
1703 priv->dir_dev, proc_get_stats_ieee, dev);
1704 -
1705 +
1706 if (!e) {
1707 DMESGE("Unable to initialize "
1708 "/proc/net/rtl8187/%s/stats-ieee\n",
1709 dev->name);
1710 }
1711 -
1712 -
1713 +
1714 +
1715 e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
1716 priv->dir_dev, proc_get_stats_ap, dev);
1717 -
1718 +
1719 if (!e) {
1720 DMESGE("Unable to initialize "
1721 "/proc/net/rtl8187/%s/stats-ap\n",
1722 dev->name);
1723 }
1724 #endif
1725 -
1726 +
1727 e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
1728 priv->dir_dev, proc_get_registers, dev);
1729 -
1730 +
1731 if (!e) {
1732 DMESGE("Unable to initialize "
1733 "/proc/net/rtl8187/%s/registers\n",
1734 @@ -523,14 +536,14 @@
1735 {
1736 int i;
1737 u8 *buf =(u8*)buffer;
1738 -
1739 +
1740 printk("ASCII BUFFER DUMP (len: %x):\n",len);
1741 -
1742 +
1743 for(i=0;i<len;i++)
1744 printk("%c",buf[i]);
1745 -
1746 +
1747 printk("\nBINARY BUFFER DUMP (len: %x):\n",len);
1748 -
1749 +
1750 for(i=0;i<len;i++)
1751 printk("%x",buf[i]);
1752
1753 @@ -539,17 +552,17 @@
1754
1755 short check_nic_enought_desc(struct net_device *dev, priority_t priority)
1756 {
1757 - struct r8180_priv *priv = ieee80211_priv(dev);
1758 -
1759 - int used = atomic_read((priority == NORM_PRIORITY) ?
1760 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1761 +
1762 + int used = atomic_read((priority == NORM_PRIORITY) ?
1763 &priv->tx_np_pending : &priv->tx_lp_pending);
1764 -
1765 +
1766 return (used < MAX_TX_URB);
1767 }
1768
1769 void tx_timeout(struct net_device *dev)
1770 {
1771 - struct r8180_priv *priv = ieee80211_priv(dev);
1772 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1773 //rtl8180_commit(dev);
1774 schedule_work(&priv->reset_wq);
1775 //DMESG("TXTIMEOUT");
1776 @@ -561,7 +574,20 @@
1777 {
1778 int i;
1779 for(i=0; i<63; i++)
1780 - DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
1781 + DMESG("EEPROM addr %02X : %04X", i, eprom_read(dev,i));
1782 +}
1783 +
1784 +/* this is only for debug */
1785 +void dump_tx_power(struct net_device *dev)
1786 +{
1787 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1788 + int i;
1789 + DMESG("CCK TX-Power (b-mode):");
1790 + for(i=1; i<=14; i++)
1791 + DMESG("Channel %d: %d", i, priv->chtxpwr[i]);
1792 + DMESG("OFDM TX-Power (g-mode):");
1793 + for(i=1; i<=14; i++)
1794 + DMESG("Channel %d: %d", i, priv->chtxpwr_ofdm[i]);
1795 }
1796
1797 /* this is only for debug */
1798 @@ -570,14 +596,14 @@
1799 int i;
1800 int n;
1801 int max=0xff;
1802 -
1803 - DMESG("Dumping NIC register map");
1804 -
1805 +
1806 + DMESG("Dumping NIC register map");
1807 +
1808 for(n=0;n<=max;)
1809 {
1810 - printk( "\nD: %2x> ", n);
1811 + printk( "\nD: %02X> ", n);
1812 for(i=0;i<16 && n<=max;i++,n++)
1813 - printk("%2x ",read_nic_byte(dev,n));
1814 + printk("%02X ",read_nic_byte(dev,n));
1815 }
1816 printk("\n");
1817 }
1818 @@ -589,11 +615,11 @@
1819
1820 void rtl8180_irq_enable(struct net_device *dev)
1821 {
1822 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1823 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1824 //priv->irq_enabled = 1;
1825 /*
1826 - write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
1827 - INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
1828 + write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
1829 + INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
1830 INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
1831 INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
1832 */
1833 @@ -603,7 +629,7 @@
1834
1835 void rtl8180_irq_disable(struct net_device *dev)
1836 {
1837 -// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1838 +// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1839
1840 write_nic_word(dev,INTA_MASK,0);
1841 force_pci_posting(dev);
1842 @@ -625,115 +651,115 @@
1843
1844 void rtl8180_update_msr(struct net_device *dev)
1845 {
1846 - struct r8180_priv *priv = ieee80211_priv(dev);
1847 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1848 u8 msr;
1849 -
1850 +
1851 msr = read_nic_byte(dev, MSR);
1852 msr &= ~ MSR_LINK_MASK;
1853 -
1854 +
1855 /* do not change in link_state != WLAN_LINK_ASSOCIATED.
1856 - * msr must be updated if the state is ASSOCIATING.
1857 + * msr must be updated if the state is ASSOCIATING.
1858 * this is intentional and make sense for ad-hoc and
1859 * master (see the create BSS/IBSS func)
1860 */
1861 - if (priv->ieee80211->state == IEEE80211_LINKED){
1862 -
1863 + if (priv->ieee80211->state == IEEE80211_LINKED){
1864 +
1865 if (priv->ieee80211->iw_mode == IW_MODE_INFRA)
1866 msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT);
1867 else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
1868 msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT);
1869 else if (priv->ieee80211->iw_mode == IW_MODE_MASTER)
1870 msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT);
1871 -
1872 +
1873 }else
1874 msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT);
1875 -
1876 +
1877 write_nic_byte(dev, MSR, msr);
1878 }
1879
1880 void rtl8180_set_chan(struct net_device *dev,short ch)
1881 {
1882 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1883 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1884 u32 tx;
1885 priv->chan=ch;
1886 #if 0
1887 - if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
1888 + if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
1889 priv->ieee80211->iw_mode == IW_MODE_MASTER){
1890 -
1891 - priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
1892 +
1893 + priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
1894 priv->ieee80211->master_chan = ch;
1895 - rtl8180_update_beacon_ch(dev);
1896 + rtl8180_update_beacon_ch(dev);
1897 }
1898 #endif
1899 -
1900 +
1901 /* this hack should avoid frame TX during channel setting*/
1902 tx = read_nic_dword(dev,TX_CONF);
1903 tx &= ~TX_LOOPBACK_MASK;
1904
1905 -#ifndef LOOP_TEST
1906 +#ifndef LOOP_TEST
1907 write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
1908 -
1909 priv->rf_set_chan(dev,priv->chan);
1910 mdelay(10);
1911 - write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
1912 + write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
1913 #endif
1914 }
1915 +
1916 void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs);
1917
1918
1919 void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb)
1920 {
1921 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1922 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1923 int err;
1924 -
1925 +
1926 // u8 *rx;
1927 -
1928 +
1929 //DMESG("starting RX");
1930 /*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC);
1931 - if(!rx){
1932 + if(!rx){
1933 DMESGE("unable to allocate RX buffer");
1934 return;
1935 }*/
1936 -
1937 +
1938 usb_fill_bulk_urb(rx_urb,priv->udev,
1939 usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer,
1940 RX_URB_SIZE,rtl8187_rx_isr,dev);
1941 - err = usb_submit_urb(rx_urb, GFP_ATOMIC);
1942 + err = usb_submit_urb(rx_urb, GFP_ATOMIC);
1943 if(err && err != -EPERM){
1944 DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status);
1945 -
1946 +
1947 }
1948 -
1949 +
1950 }
1951
1952
1953 void rtl8187_rx_initiate(struct net_device *dev)
1954 {
1955 int i;
1956 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1957 -
1958 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1959 +
1960 if(!priv->rx_urb)
1961 DMESGE("Cannot intiate RX urb mechanism");
1962 - for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
1963 + for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
1964 rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]);
1965 -
1966 +
1967 }
1968
1969 void rtl8187_set_rxconf(struct net_device *dev)
1970 {
1971 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1972 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1973 u32 rxconf;
1974 -
1975 +
1976 rxconf=read_nic_dword(dev,RX_CONF);
1977 rxconf = rxconf &~ MAC_FILTER_MASK;
1978 rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT);
1979 rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
1980 rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
1981 rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
1982 - rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
1983 + rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
1984
1985 if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
1986 -
1987 +
1988 if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
1989 dev->flags & IFF_PROMISC){
1990 rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
1991 @@ -741,40 +767,40 @@
1992 rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT);
1993 rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
1994 }
1995 -
1996 +
1997 /*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){
1998 rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
1999 rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
2000 }*/
2001 -
2002 +
2003 if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
2004 rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
2005 rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT);
2006 }
2007 -
2008 +
2009 if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
2010 rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
2011 -
2012 -
2013 +
2014 +
2015 rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
2016 rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
2017 -
2018 -
2019 +
2020 +
2021 rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
2022 -
2023 +
2024 rxconf = rxconf &~ MAX_RX_DMA_MASK;
2025 rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
2026 -
2027 +
2028 rxconf = rxconf | RCR_ONLYERLPKT;
2029 -
2030 +
2031 // rxconf = rxconf &~ RCR_CS_MASK;
2032 // rxconf = rxconf | (1<<RCR_CS_SHIFT);
2033
2034 - write_nic_dword(dev, RX_CONF, rxconf);
2035 -
2036 + write_nic_dword(dev, RX_CONF, rxconf);
2037 +
2038 // V rtl suggested V //
2039 // write_nic_dword(dev, RX_CONF, 0x901ce70e);
2040 -
2041 +
2042 //fix_rx_fifo(dev);
2043 // //set_nic_rxring(dev);
2044 #ifdef DEBUG_RX
2045 @@ -785,23 +811,23 @@
2046 void rtl8180_rx_enable(struct net_device *dev)
2047 {
2048 u8 cmd;
2049 -
2050 -
2051 +
2052 +
2053 rtl8187_rx_initiate(dev);
2054
2055 - rtl8187_set_rxconf(dev);
2056 + rtl8187_set_rxconf(dev);
2057
2058 cmd=read_nic_byte(dev,CMD);
2059 write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
2060 #if 0
2061 - /* In rtl8139 driver seems that DMA threshold has to be written
2062 - * after enabling RX, so we rewrite RX_CONFIG register
2063 + /* In rtl8139 driver seems that DMA threshold has to be written
2064 + * after enabling RX, so we rewrite RX_CONFIG register
2065 */
2066 //mdelay(100);
2067 - write_nic_dword(dev, RX_CONF, rxconf);
2068 -
2069 + write_nic_dword(dev, RX_CONF, rxconf);
2070 +
2071 #endif
2072 -
2073 +
2074 }
2075
2076
2077 @@ -810,37 +836,37 @@
2078 u8 cmd;
2079 u8 byte;
2080 u32 txconf;
2081 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2082 -
2083 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2084 +
2085 byte = read_nic_byte(dev,CW_CONF);
2086 byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
2087 byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
2088 write_nic_byte(dev, CW_CONF, byte);
2089 -
2090 +
2091 byte = read_nic_byte(dev, TX_AGC_CTL);
2092 byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
2093 byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
2094 byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT);
2095 write_nic_byte(dev, TX_AGC_CTL, byte);
2096 -
2097 +
2098 txconf= read_nic_dword(dev,TX_CONF);
2099 -
2100 +
2101 #if 0
2102 if(priv->card_8185){
2103 -
2104 +
2105 txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
2106 -
2107 +
2108 }else{
2109 -
2110 - if(priv->ieee80211->hw_seq)
2111 +
2112 + if(priv->ieee80211->hw_seq)
2113 txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
2114 - else
2115 + else
2116 txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
2117 }
2118 #endif
2119
2120 txconf = txconf &~ TX_LOOPBACK_MASK;
2121 -
2122 +
2123 #ifndef LOOP_TEST
2124 txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
2125 #else
2126 @@ -848,23 +874,26 @@
2127 #endif
2128 txconf = txconf &~ TCR_DPRETRY_MASK;
2129 txconf = txconf &~ TCR_RTSRETRY_MASK;
2130 -
2131 - txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
2132 - txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
2133 -
2134 +
2135 + if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
2136 + {
2137 + txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
2138 + txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
2139 + }
2140 +
2141 txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
2142 -
2143 +
2144 txconf = txconf &~ TCR_MXDMA_MASK;
2145 txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
2146 -
2147 +
2148 txconf = txconf | TCR_CWMIN;
2149 txconf = txconf | TCR_DISCW;
2150 txconf = txconf &~ TCR_SWPLCPLEN;
2151 -
2152 +
2153 txconf=txconf | (1<<TX_NOICV_SHIFT);
2154 -
2155 +
2156 write_nic_dword(dev,TX_CONF,txconf);
2157 -
2158 +
2159 // V RTL suggested V //
2160 // write_nic_dword(dev,TX_CONF,0x00e00707);
2161
2162 @@ -872,9 +901,9 @@
2163 #ifdef DEBUG_TX
2164 DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF));
2165 #endif
2166 -
2167 +
2168 cmd=read_nic_byte(dev,CMD);
2169 - write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
2170 + write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
2171
2172 // mdelay(100);
2173 //write_nic_dword(dev,TX_CONF,txconf);
2174 @@ -889,18 +918,18 @@
2175 #if 0
2176 void rtl8180_beacon_tx_enable(struct net_device *dev)
2177 {
2178 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2179 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2180 priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
2181 rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
2182 - write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
2183 + write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
2184 rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
2185 }
2186
2187
2188 void rtl8180_
2189 -_disable(struct net_device *dev)
2190 +_disable(struct net_device *dev)
2191 {
2192 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2193 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2194 priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
2195 rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
2196 write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
2197 @@ -914,8 +943,8 @@
2198 {
2199 u8 cmd;
2200 int i;
2201 - struct r8180_priv *priv = ieee80211_priv(dev);
2202 -
2203 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2204 +
2205 cmd=read_nic_byte(dev,CMD);
2206 write_nic_byte(dev, CMD, cmd &~ \
2207 ((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
2208 @@ -926,9 +955,9 @@
2209 usb_kill_urb(priv->rx_urb[i]);
2210 }
2211 /*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT))
2212 - udelay(10);
2213 + udelay(10);
2214 */
2215 -
2216 +
2217 // if(!priv->rx_skb_complete)
2218 // dev_kfree_skb_any(priv->rx_skb);
2219 }
2220 @@ -939,14 +968,14 @@
2221 #if 0
2222 int i;
2223 u32 *tmp;
2224 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2225 -
2226 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2227 +
2228 priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
2229 - sizeof(u32)*8*count,
2230 + sizeof(u32)*8*count,
2231 &priv->txbeaconringdma);
2232 if (!priv->txbeaconring) return -1;
2233 for (tmp=priv->txbeaconring,i=0;i<count;i++){
2234 - *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
2235 + *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
2236 /*
2237 *(tmp+2) = (u32)dma_tmp;
2238 *(tmp+3) = bufsize;
2239 @@ -955,7 +984,7 @@
2240 *(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
2241 else
2242 *(tmp+4) = (u32)priv->txbeaconringdma;
2243 -
2244 +
2245 tmp=tmp+8;
2246 }
2247 #endif
2248 @@ -965,15 +994,15 @@
2249
2250 void rtl8180_reset(struct net_device *dev)
2251 {
2252 -
2253 +
2254 u8 cr;
2255 -
2256 +
2257 /* make sure the analog power is on before
2258 * reset, otherwise reset may fail
2259 */
2260 rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
2261 rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
2262 -
2263 +
2264 rtl8180_irq_disable(dev);
2265
2266 mdelay(200);
2267 @@ -981,19 +1010,19 @@
2268 write_nic_byte_E(dev,0x18,0x11);
2269 write_nic_byte_E(dev,0x18,0x00);
2270 mdelay(200);
2271 -
2272 +
2273 cr=read_nic_byte(dev,CMD);
2274 cr = cr & 2;
2275 cr = cr | (1<<CMD_RST_SHIFT);
2276 write_nic_byte(dev,CMD,cr);
2277 -
2278 +
2279 force_pci_posting(dev);
2280 -
2281 +
2282 mdelay(200);
2283 -
2284 - if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
2285 +
2286 + if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
2287 DMESGW("Card reset timeout!");
2288 - else
2289 + else
2290 DMESG("Card successfully reset");
2291
2292 rtl8180_set_mode(dev,EPROM_CMD_LOAD);
2293 @@ -1005,13 +1034,13 @@
2294 */
2295 rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
2296 rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
2297 -
2298 +
2299 }
2300
2301 inline u16 ieeerate2rtlrate(int rate)
2302 {
2303 switch(rate){
2304 - case 10:
2305 + case 10:
2306 return 0;
2307 case 20:
2308 return 1;
2309 @@ -1037,32 +1066,32 @@
2310 return 11;
2311 default:
2312 return 3;
2313 -
2314 +
2315 }
2316 }
2317 static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540};
2318 inline u16 rtl8180_rate2rate(short rate)
2319 {
2320 if (rate >11) return 0;
2321 - return rtl_rate[rate];
2322 + return rtl_rate[rate];
2323 }
2324 -
2325 +
2326
2327 void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
2328 {
2329 struct net_device *dev = (struct net_device*)rx_urb->context;
2330 - struct r8180_priv *priv = ieee80211_priv(dev);
2331 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2332
2333 priv->rxurb_task = rx_urb;
2334 // DMESGW("David: Rx tasklet start!");
2335 - tasklet_schedule(&priv->irq_rx_tasklet);
2336 + tasklet_schedule(&priv->irq_rx_tasklet);
2337 // DMESGW("=David: Rx tasklet finish!");
2338 }
2339
2340 #if 0
2341 void rtl8180_tx_queues_stop(struct net_device *dev)
2342 {
2343 - //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2344 + //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2345 u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
2346 dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
2347 dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
2348 @@ -1078,7 +1107,7 @@
2349 {
2350 //FIXME !!
2351 #if 0
2352 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2353 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2354 priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
2355 rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
2356 write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
2357 @@ -1091,7 +1120,7 @@
2358 {
2359 // FIXME !!
2360 #if 0
2361 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2362 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2363 priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
2364 rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
2365 write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
2366 @@ -1105,14 +1134,19 @@
2367 */
2368 void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
2369 {
2370 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2371 -
2372 - short morefrag = 0;
2373 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2374 +
2375 + short morefrag = 0;
2376 unsigned long flags;
2377 struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
2378
2379 - if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
2380 - morefrag = 1;
2381 + if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->ieee80211->raw_tx != 1)
2382 + {
2383 + if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
2384 + {
2385 + morefrag = 1;
2386 + }
2387 + }
2388 // DMESG("%x %x", h->frame_ctl, h->seq_ctl);
2389 /*
2390 * This function doesn't require lock because we make
2391 @@ -1121,24 +1155,32 @@
2392 * the ieee stack, or from the try_wake_queue (again trought
2393 * the ieee stack.
2394 */
2395 - spin_lock_irqsave(&priv->tx_lock,flags);
2396 -
2397 - //DMESG("TX");
2398 - if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
2399 - DMESG("Error: no TX slot ");
2400 - ieee80211_stop_queue(priv->ieee80211);
2401 - }
2402 -
2403 - rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
2404 - ieeerate2rtlrate(rate));
2405 -
2406 - priv->stats.txdatapkt++;
2407 -
2408 - if (!check_nic_enought_desc(dev, LOW_PRIORITY))
2409 - ieee80211_stop_queue(priv->ieee80211);
2410 -
2411 - spin_unlock_irqrestore(&priv->tx_lock,flags);
2412 -
2413 + spin_lock_irqsave(&priv->tx_lock,flags);
2414 +
2415 + if(priv->ieee80211->iw_mode == IW_MODE_MONITOR)
2416 + {
2417 + rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, morefrag,
2418 + ieeerate2rtlrate(rate));
2419 + }
2420 + else
2421 + {
2422 + //DMESG("TX");
2423 + if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
2424 + DMESG("Error: no TX slot ");
2425 + ieee80211_stop_queue_rtl7(priv->ieee80211);
2426 + }
2427 +
2428 + rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
2429 + ieeerate2rtlrate(rate));
2430 +
2431 + priv->stats.txdatapkt++;
2432 +
2433 + if (!check_nic_enought_desc(dev, LOW_PRIORITY))
2434 + ieee80211_stop_queue_rtl7(priv->ieee80211);
2435 + }
2436 +
2437 + spin_unlock_irqrestore(&priv->tx_lock,flags);
2438 +
2439 }
2440 #if 0
2441 /* This is a rough attempt to TX a frame
2442 @@ -1148,12 +1190,12 @@
2443 */
2444 int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
2445 {
2446 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2447 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2448 int ret;
2449 unsigned long flags;
2450 -
2451 +
2452 spin_lock_irqsave(&priv->tx_lock,flags);
2453 -
2454 +
2455 ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE);
2456 /*
2457 int i;
2458 @@ -1163,9 +1205,9 @@
2459 */
2460 priv->ieee80211->stats.tx_bytes+=skb->len;
2461 priv->ieee80211->stats.tx_packets++;
2462 -
2463 - spin_unlock_irqrestore(&priv->tx_lock,flags);
2464 -
2465 +
2466 + spin_unlock_irqrestore(&priv->tx_lock,flags);
2467 +
2468 dev_kfree_skb_any(skb);
2469 return ret;
2470 }
2471 @@ -1178,7 +1220,7 @@
2472 u16 duration;
2473 u16 drift;
2474 *ext=0;
2475 -
2476 +
2477 switch(rate){
2478 case 0://1mbps
2479 *ext=0;
2480 @@ -1187,7 +1229,7 @@
2481 if(drift ==0 ) break;
2482 duration++;
2483 break;
2484 -
2485 +
2486 case 1://2mbps
2487 *ext=0;
2488 duration = ((len+4)<<4) /0x4;
2489 @@ -1195,30 +1237,30 @@
2490 if(drift ==0 ) break;
2491 duration++;
2492 break;
2493 -
2494 +
2495 case 2: //5.5mbps
2496 *ext=0;
2497 duration = ((len+4)<<4) /0xb;
2498 drift = ((len+4)<<4) % 0xb;
2499 - if(drift ==0 )
2500 + if(drift ==0 )
2501 break;
2502 duration++;
2503 break;
2504 -
2505 +
2506 default:
2507 - case 3://11mbps
2508 + case 3://11mbps
2509 *ext=0;
2510 duration = ((len+4)<<4) /0x16;
2511 drift = ((len+4)<<4) % 0x16;
2512 - if(drift ==0 )
2513 + if(drift ==0 )
2514 break;
2515 duration++;
2516 - if(drift > 6)
2517 + if(drift > 6)
2518 break;
2519 *ext=1;
2520 break;
2521 }
2522 -
2523 +
2524 return duration;
2525 }
2526 #endif
2527 @@ -1228,7 +1270,7 @@
2528 void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs)
2529 {
2530 struct net_device *dev = (struct net_device*)tx_urb->context;
2531 - struct r8180_priv *priv = ieee80211_priv(dev);
2532 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2533 if(tx_urb->status == 0)
2534 priv->stats.txlpokint++;
2535 else
2536 @@ -1249,55 +1291,55 @@
2537 if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) ||
2538 (msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){
2539 write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE);
2540 - write_nic_byte(dev, MSR, msr);
2541 + write_nic_byte(dev, MSR, msr);
2542 }
2543 -
2544 -
2545 +
2546 +
2547 }
2548
2549
2550 void rtl8187_net_update(struct net_device *dev)
2551 {
2552
2553 - struct r8180_priv *priv = ieee80211_priv(dev);
2554 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2555 struct ieee80211_network *net;
2556 net = & priv->ieee80211->current_network;
2557 -
2558 -
2559 +
2560 +
2561 write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]);
2562 write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]);
2563 //for(i=0;i<ETH_ALEN;i++)
2564 // write_nic_byte(dev,BSSID+i,net->bssid[i]);
2565
2566 rtl8180_update_msr(dev);
2567 -
2568 +
2569 // rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
2570 write_nic_word(dev, AtimWnd, 2);
2571 - write_nic_word(dev, AtimtrItv, 100);
2572 + write_nic_word(dev, AtimtrItv, 100);
2573 write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval);
2574 write_nic_word(dev, BcnIntTime, 100);
2575 -
2576 +
2577
2578 }
2579
2580 void rtl8187_beacon_tx(struct net_device *dev)
2581 {
2582
2583 - struct r8180_priv *priv = ieee80211_priv(dev);
2584 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2585 struct sk_buff *skb;
2586 int i = 0;
2587 -
2588 +
2589 rtl8187_net_update(dev);
2590 -
2591 - skb = ieee80211_get_beacon(priv->ieee80211);
2592 -
2593 -
2594 - if(!skb){
2595 +
2596 + skb = ieee80211_get_beacon_rtl7(priv->ieee80211);
2597 +
2598 +
2599 + if(!skb){
2600 DMESG("not enought memory for allocating beacon");
2601 return;
2602 }
2603 -
2604 -#if 0
2605 +
2606 +#if 0
2607 while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){
2608 msleep_interruptible_rtl(HZ/2);
2609 if(i++ > 20){
2610 @@ -1307,7 +1349,7 @@
2611 }
2612 #endif
2613 write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7));
2614 -
2615 +
2616 i=0;
2617 //while(!read_nic_byte(dev,BQREQ & (1<<7)))
2618 while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 )
2619 @@ -1318,16 +1360,16 @@
2620 return ;
2621 }
2622 }
2623 -
2624 +
2625 rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY,
2626 0, priv->ieee80211->basic_rate);
2627 -
2628 +
2629 }
2630
2631 void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs)
2632 {
2633 struct net_device *dev = (struct net_device*)tx_urb->context;
2634 - struct r8180_priv *priv = ieee80211_priv(dev);
2635 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2636 if(tx_urb->status == 0)
2637 priv->stats.txnpokint++;
2638 else
2639 @@ -1339,10 +1381,10 @@
2640 }
2641
2642
2643 -/* This function do the real dirty work: it sends a TX command
2644 - * descriptor plus data URB
2645 +/* This function do the real dirty work: it sends a TX command
2646 + * descriptor plus data URB
2647 */
2648 -
2649 +
2650 short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority,
2651 short morefrag, short rate)
2652 {
2653 @@ -1352,8 +1394,8 @@
2654 int pend ;
2655 int status;
2656 struct urb *tx_urb;
2657 - int urb_len;
2658 - struct r8180_priv *priv = ieee80211_priv(dev);
2659 + int urb_len;
2660 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2661 // int rate = ieeerate2rtlrate(priv->ieee80211->rate);
2662
2663 pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
2664 @@ -1365,32 +1407,32 @@
2665 priv->stats.txlpdrop++;
2666 return -1;
2667 }
2668 -
2669 -
2670 +
2671 +
2672 //tx = kmalloc((len + 4*3), GFP_ATOMIC);
2673 urb_len = len + 4*3;
2674 if((0 == urb_len%64)||(0 == urb_len%512)) {
2675 - urb_len += 1;
2676 + urb_len += 1;
2677 }
2678 tx = kmalloc(urb_len, GFP_ATOMIC);
2679 if(!tx) return -ENOMEM;
2680 - //printk(KERN_WARNING "urb_len = %d\n", urb_len);
2681 + //printk(KERN_WARNING "urb_len = %d\n", urb_len);
2682 tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
2683 -
2684 +
2685 if(!tx_urb){
2686 -
2687 +
2688 kfree(tx);
2689 return -ENOMEM;
2690 }
2691 -
2692 +
2693 memcpy(tx+3,txbuf,len);
2694 tx[0] = 0;
2695 tx[0] |= len & 0xfff;
2696 tx[0] |= (1<<15);
2697 -
2698 +
2699 // if(priv->shortpre)
2700 // tx[0] |= (1<<16);
2701 -
2702 +
2703 //if(len > priv->rts_threshold){
2704 // tx[0] |= (1<<23); //ENABLE RTS
2705 // tx[0] |= (1<<18); //ENABLE CTS
2706 @@ -1399,18 +1441,18 @@
2707 tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
2708 tx[0] |= (rate << 24);
2709 tx[1] = 0;
2710 -
2711 +
2712 // duration = rtl8180_len2duration(len,
2713 -// rate,&ext);
2714 +// rate,&ext);
2715 // tx[1] |= (duration & 0x7fff) <<16;
2716 // if(ext) tx[1] |= (1<<31);
2717
2718 -
2719 +
2720 // tx[2] = 0x303020;
2721 tx[2] = 3; // CW min
2722 tx[2] |= (7<<4); //CW max
2723 tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim
2724 -
2725 +
2726 // printk("%x\n%x\n",tx[0],tx[1]);
2727
2728 #ifdef DUMP_TX
2729 @@ -1421,7 +1463,7 @@
2730 printk("---------------\n");
2731 #endif
2732
2733 -
2734 +
2735 /* FIXME check what EP is for low/norm PRI */
2736 usb_fill_bulk_urb(tx_urb,priv->udev,
2737 usb_sndbulkpipe(priv->udev,(priority == LOW_PRIORITY) ? 2:3), tx,
2738 @@ -1438,54 +1480,54 @@
2739 }
2740 }
2741
2742 -
2743 +
2744
2745 void rtl8180_irq_rx_tasklet(struct r8180_priv * priv);
2746
2747
2748 short rtl8187_usb_initendpoints(struct net_device *dev)
2749 {
2750 - struct r8180_priv *priv = ieee80211_priv(dev);
2751 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2752 int i;
2753 -
2754 +
2755 priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
2756 -
2757 +
2758 for(i=0;i<MAX_RX_URB;i++){
2759 priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL);
2760 - if(!priv->rx_urb[i])
2761 + if(!priv->rx_urb[i])
2762 goto destroy;
2763 -
2764 +
2765 priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL);
2766 - if(!priv->rx_urb[i]->transfer_buffer)
2767 + if(!priv->rx_urb[i]->transfer_buffer)
2768 goto destroy1;
2769 -
2770 +
2771 priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE;
2772 }
2773 -
2774 +
2775 return 0;
2776 -
2777 +
2778 destroy1:
2779 usb_free_urb(priv->rx_urb[i]);
2780 -
2781 +
2782 destroy:
2783 while (--i >= 0){
2784 kfree(priv->rx_urb[i]->transfer_buffer);
2785 usb_free_urb(priv->rx_urb[i]);
2786 }
2787 -
2788 +
2789 kfree(priv->rx_urb);
2790 -
2791 +
2792 priv->rx_urb = NULL;
2793 DMESGE("Endpoint Alloc Failure");
2794 return -ENOMEM;
2795 -
2796 +
2797 }
2798
2799 void rtl8187_usb_deleteendpoints(struct net_device *dev)
2800 {
2801 - struct r8180_priv *priv = ieee80211_priv(dev);
2802 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2803 int i;
2804 -
2805 +
2806 if(priv->rx_urb){
2807 for(i=0;i<MAX_RX_URB;i++){
2808 usb_kill_urb(priv->rx_urb[i]);
2809 @@ -1494,9 +1536,9 @@
2810 }
2811 kfree(priv->rx_urb);
2812 priv->rx_urb = NULL;
2813 -
2814 +
2815 }
2816 -
2817 +
2818 }
2819
2820
2821 @@ -1505,16 +1547,16 @@
2822 int i;
2823 u16 word;
2824 int basic_rate,min_rr_rate,max_rr_rate;
2825 -
2826 -// struct r8180_priv *priv = ieee80211_priv(dev);
2827 -
2828 - //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
2829 +
2830 +// struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2831 +
2832 + //if (ieee80211_is_54g_rtl7(priv->ieee80211->current_network) &&
2833 // priv->ieee80211->state == IEEE80211_LINKED){
2834 basic_rate = ieeerate2rtlrate(240);
2835 min_rr_rate = ieeerate2rtlrate(60);
2836 max_rr_rate = ieeerate2rtlrate(240);
2837 -
2838 -//
2839 +
2840 +//
2841 // }else{
2842 // basic_rate = ieeerate2rtlrate(20);
2843 // min_rr_rate = ieeerate2rtlrate(10);
2844 @@ -1526,21 +1568,21 @@
2845
2846 word = read_nic_word(dev, BRSR);
2847 word &= ~BRSR_MBR_8185;
2848 -
2849 +
2850
2851 for(i=0;i<=basic_rate;i++)
2852 word |= (1<<i);
2853
2854 write_nic_word(dev, BRSR, word);
2855 - //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
2856 + DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
2857 }
2858
2859
2860 void rtl8187_link_change(struct net_device *dev)
2861 {
2862 // int i;
2863 -
2864 - struct r8180_priv *priv = ieee80211_priv(dev);
2865 +
2866 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2867 //write_nic_word(dev, BintrItv, net->beacon_interval);
2868 rtl8187_net_update(dev);
2869 /*update timing params*/
2870 @@ -1553,24 +1595,24 @@
2871
2872 short rtl8180_init(struct net_device *dev)
2873 {
2874 -
2875 - struct r8180_priv *priv = ieee80211_priv(dev);
2876 +
2877 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2878 int i, j;
2879 u16 word;
2880 - int ch;
2881 + int ch, chans;
2882 //u16 version;
2883 - //u8 hw_version;
2884 - //u8 config3;
2885 -
2886 + u8 hw_version;
2887 + u8 config3;
2888 +
2889 //FIXME: these constants are placed in a bad pleace.
2890
2891 // priv->txbuffsize = 1024;
2892 // priv->txringcount = 32;
2893 // priv->rxbuffersize = 1024;
2894 -// priv->rxringcount = 32;
2895 +// priv->rxringcount = 32;
2896 // priv->txbeaconcount = 3;
2897 // priv->rx_skb_complete = 1;
2898 - //priv->txnp_pending.ispending=0;
2899 + //priv->txnp_pending.ispending=0;
2900 /* ^^ the SKB does not containt a partial RXed
2901 * packet (is empty)
2902 */
2903 @@ -1580,15 +1622,24 @@
2904 return -1;
2905 }
2906 ch=channels;
2907 + chans=0;
2908 + for (i=1; i<=14; i++) {
2909 + if( (u8)(ch & 0x01) ) chans++;
2910 + ch >>= 1;
2911 + }
2912 + DMESG("Enabling %d channels.", chans);
2913 + ch=channels;
2914 // set channels 1..14 allowed in given locale
2915 for (i=1; i<=14; i++) {
2916 (priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
2917 ch >>= 1;
2918 }
2919 //memcpy(priv->stats,0,sizeof(struct Stats));
2920 -
2921 +
2922 //priv->irq_enabled=0;
2923 -
2924 +
2925 + priv->dev = dev;
2926 +
2927 // priv->stats.rxdmafail=0;
2928 priv->stats.txrdu=0;
2929 // priv->stats.rxrdu=0;
2930 @@ -1612,9 +1663,9 @@
2931 // priv->stats.txbeaconerr=0;
2932 priv->stats.txlperr=0;
2933 priv->stats.txlpokint=0;
2934 -
2935 +
2936 priv->ieee80211->iw_mode = IW_MODE_INFRA;
2937 -
2938 +
2939 priv->retry_rts = DEFAULT_RETRY_RTS;
2940 priv->retry_data = DEFAULT_RETRY_DATA;
2941 priv->ieee80211->rate = 110; //11 mbps
2942 @@ -1622,23 +1673,27 @@
2943 priv->ieee80211->mode = IEEE_G;
2944 priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
2945 spin_lock_init(&priv->tx_lock);
2946 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
2947 INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
2948 +#else
2949 + INIT_WORK(&priv->reset_wq, rtl8180_restart);
2950 +#endif
2951 sema_init(&priv->wx_sem,1);
2952 tasklet_init(&priv->irq_rx_tasklet,
2953 (void(*)(unsigned long))rtl8180_irq_rx_tasklet,
2954 (unsigned long)priv);
2955
2956 - //priv->ieee80211->func =
2957 + //priv->ieee80211->func =
2958 // kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL);
2959 //memset(priv->ieee80211->func, 0,
2960 // sizeof(struct ieee80211_helper_functions));
2961 - priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
2962 + priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
2963 priv->ieee80211->iw_mode = IW_MODE_INFRA;
2964 - priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
2965 - IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
2966 + priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
2967 + IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
2968 IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE |
2969 /*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE;
2970 -
2971 +
2972 priv->ieee80211->active_scan = 1;
2973 priv->ieee80211->rate = 110; //11 mbps
2974 priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION;
2975 @@ -1655,51 +1710,51 @@
2976 priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume;
2977 //priv->ieee80211->start_send_beacons = NULL;
2978 //priv->ieee80211->stop_send_beacons = NULL;
2979 -
2980 +
2981 priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
2982 -
2983 +
2984 priv->card_8185 = 2;
2985 priv->phy_ver = 2;
2986 priv->card_type = USB;
2987 -
2988 +
2989 #if 0
2990 hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
2991 -
2992 +
2993 switch (hw_version){
2994 case HW_VERID_R8185_ABC:
2995 - DMESG("MAC controller is a RTL8185 b/g");
2996 + DMESG("MAC controller is a RTL8185 b/g");
2997 priv->card_8185 = 1;
2998 /* you should not find a card with 8225 PHY ver < C*/
2999 priv->phy_ver = 2;
3000 break;
3001 -
3002 +
3003 case HW_VERID_R8185_D:
3004 - DMESG("MAC controller is a RTL8185 b/g (V. D)");
3005 + DMESG("MAC controller is a RTL8185 b/g (V. D)");
3006 priv->card_8185 = 2;
3007 /* you should not find a card with 8225 PHY ver < C*/
3008 priv->phy_ver = 2;
3009 break;
3010 -
3011 +
3012 case HW_VERID_R8180_ABCD:
3013 DMESG("MAC controller is a RTL8180");
3014 priv->card_8185 = 0;
3015 break;
3016 -
3017 +
3018 case HW_VERID_R8180_F:
3019 DMESG("MAC controller is a RTL8180 (v. F)");
3020 priv->card_8185 = 0;
3021 break;
3022 -
3023 +
3024 default:
3025 DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version);
3026 priv->card_8185 = 0;
3027 break;
3028 }
3029 -
3030 -
3031 +
3032 +
3033 /* you should not found any 8185 Ver B Card */
3034 priv->card_8185_Bversion = 0;
3035 -
3036 +
3037 config3 = read_nic_byte(dev, CONFIG3);
3038 if(config3 & 0x8){
3039 priv->card_type = CARDBUS;
3040 @@ -1715,13 +1770,19 @@
3041 #endif
3042 priv->enable_gpio0 = 0;
3043
3044 -
3045 +
3046 + hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
3047 + config3 = read_nic_byte(dev, CONFIG3);
3048 +
3049 + DMESG("MAC chip version: %02X", hw_version);
3050 + DMESG("Card type: %02X", config3);
3051 +
3052 /* commented out just because we already do
3053 this when resetting the card
3054 andrea 20050924
3055 */
3056 #if 0
3057 -
3058 +
3059 u8 txcr, txreg50;
3060 u32 txreg54, txreg60;
3061
3062 @@ -1757,8 +1818,8 @@
3063 // DMESG("<<txcr:%x>>", txcr);
3064
3065 #endif
3066 -
3067 - /*the eeprom type is stored in RCR register bit #6 */
3068 +
3069 + /*the eeprom type is stored in RCR register bit #6 */
3070 if (RCR_9356SEL & read_nic_dword(dev, RCR)){
3071 priv->epromtype=EPROM_93c56;
3072 DMESG("Reported EEPROM chip is a 93c56 (2Kbit)");
3073 @@ -1766,58 +1827,64 @@
3074 priv->epromtype=EPROM_93c46;
3075 DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
3076 }
3077 -
3078 +
3079 dev->get_stats = rtl8180_stats;
3080 -
3081 +
3082 dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
3083 dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
3084 dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff;
3085 dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8;
3086 dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff;
3087 dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8;
3088 -
3089 +
3090 DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr));
3091 -
3092 +
3093 for(i=1,j=0; i<6; i+=2,j++){
3094 -
3095 +
3096 word = eprom_read(dev,EPROM_TXPW0 + j);
3097 priv->chtxpwr[i]=word & 0xf;
3098 priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4;
3099 priv->chtxpwr[i+1]=(word & 0xf00)>>8;
3100 priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12;
3101 }
3102 -
3103 +
3104 for(i=1,j=0; i<4; i+=2,j++){
3105 -
3106 +
3107 word = eprom_read(dev,EPROM_TXPW1 + j);
3108 priv->chtxpwr[i+6]=word & 0xf;
3109 priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4;
3110 priv->chtxpwr[i+6+1]=(word & 0xf00)>>8;
3111 priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12;
3112 }
3113 -
3114 +
3115 for(i=1,j=0; i<4; i+=2,j++){
3116 -
3117 +
3118 word = eprom_read(dev,EPROM_TXPW2 + j);
3119 priv->chtxpwr[i+6+4]=word & 0xf;
3120 priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4;
3121 priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8;
3122 priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12;
3123 }
3124 -
3125 -
3126 +
3127 +
3128 priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
3129 -
3130 +
3131 +#ifdef DEBUG_TX_POWER
3132 + dump_tx_power(dev);
3133 +#endif
3134 +
3135 + DMESG("RF Chip ID: %02X", priv->rf_chip);
3136 +
3137 word = eprom_read(dev,EPROM_TXPW_BASE);
3138 priv->cck_txpwr_base = word & 0xf;
3139 priv->ofdm_txpwr_base = (word>>4) & 0xf;
3140 -
3141 +
3142 /* check RF frontend chipset */
3143 -
3144 +
3145 switch (priv->rf_chip) {
3146 -
3147 +
3148 case EPROM_RFCHIPID_RTL8225U:
3149 -
3150 +
3151 DMESG("Card reports RF frontend Realtek 8225");
3152 DMESGW("This driver has EXPERIMENTAL support for this chipset.");
3153 DMESGW("use it with care and at your own risk and");
3154 @@ -1834,28 +1901,28 @@
3155 DMESG("This seems a legacy 1st version radio");
3156 }
3157 priv->rf_close = rtl8225_rf_close;
3158 -
3159 +
3160 priv->max_sens = RTL8225_RF_MAX_SENS;
3161 priv->sens = RTL8225_RF_DEF_SENS;
3162 break;
3163 -
3164 +
3165 default:
3166 DMESGW("Unknown RF module %x",priv->rf_chip);
3167 DMESGW("Exiting...");
3168 return -1;
3169 -
3170 +
3171 }
3172 -
3173 +
3174 // DMESG("Energy threshold: %x",priv->cs_treshold);
3175 DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7);
3176 //DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2));
3177 -
3178 - if(rtl8187_usb_initendpoints(dev)!=0){
3179 +
3180 + if(rtl8187_usb_initendpoints(dev)!=0){
3181 DMESG("Endopoints initialization failed");
3182 return -ENOMEM;
3183 }
3184 -#if 0
3185 - if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
3186 +#if 0
3187 + if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
3188 return -ENOMEM;
3189
3190 if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
3191 @@ -1869,16 +1936,16 @@
3192 if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
3193 TX_LOWPRIORITY_RING_ADDR))
3194 return -ENOMEM;
3195 -
3196 -
3197 +
3198 +
3199 if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount))
3200 return -ENOMEM;
3201 #endif
3202 -
3203 +
3204
3205 #ifdef DEBUG_EPROM
3206 dump_eprom(dev);
3207 -#endif
3208 +#endif
3209 return 0;
3210
3211 }
3212 @@ -1898,7 +1965,7 @@
3213 rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
3214
3215 conf3 = read_nic_byte(dev, CONFIG3);
3216 - write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
3217 + write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
3218
3219 write_nic_dword(dev, ANAPARAM2, a);
3220
3221 @@ -1918,23 +1985,23 @@
3222
3223 conf3 = read_nic_byte(dev, CONFIG3);
3224 write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
3225 -
3226 +
3227 write_nic_dword(dev, ANAPARAM, a);
3228
3229 conf3 = read_nic_byte(dev, CONFIG3);
3230 write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
3231
3232 rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
3233 -
3234 +
3235 }
3236
3237
3238 void rtl8185_tx_antenna(struct net_device *dev, u8 ant)
3239 {
3240 - write_nic_byte(dev, TX_ANTENNA, ant);
3241 + write_nic_byte(dev, TX_ANTENNA, ant);
3242 force_pci_posting(dev);
3243 mdelay(1);
3244 -}
3245 +}
3246
3247
3248 void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data)
3249 @@ -1942,26 +2009,26 @@
3250 //u8 phyr;
3251 u32 phyw;
3252 // int i;
3253 -
3254 +
3255 adr |= 0x80;
3256 -
3257 +
3258 phyw= ((data<<8) | adr);
3259 -
3260 -
3261 -
3262 - // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
3263 +
3264 +
3265 +
3266 + // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
3267 write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24));
3268 write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16));
3269 write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8));
3270 write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) ));
3271
3272 //read_nic_dword(dev, PHY_ADR);
3273 -#if 0
3274 +#if 0
3275 for(i=0;i<10;i++){
3276 write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw);
3277 phyr = read_nic_byte(dev, PHY_READ);
3278 if(phyr == (data&0xff)) break;
3279 -
3280 +
3281 }
3282 #endif
3283 /* this is ok to fail when we write AGC table. check for AGC table might be
3284 @@ -1988,60 +2055,60 @@
3285
3286 void rtl8180_adapter_start(struct net_device *dev)
3287 {
3288 - struct r8180_priv *priv = ieee80211_priv(dev);
3289 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3290 //u32 anaparam;
3291 //u8 config3;
3292 -
3293 +
3294 //rtl8180_rtx_disable(dev);
3295 rtl8180_reset(dev);
3296
3297 write_nic_byte(dev,0x85,0);
3298 write_nic_byte(dev,0x91,0);
3299 -
3300 +
3301 /* light blink! */
3302 write_nic_byte(dev,0x85,4);
3303 write_nic_byte(dev,0x91,1);
3304 write_nic_byte(dev,0x90,0);
3305 -
3306 +
3307 priv->irq_mask = 0xffff;
3308 /*
3309 priv->dma_poll_mask = 0;
3310 priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT);
3311 -*/
3312 +*/
3313 // rtl8180_beacon_tx_disable(dev);
3314 -
3315 +
3316 rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
3317 write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]);
3318 write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff );
3319
3320 rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
3321 rtl8180_update_msr(dev);
3322 -
3323 +
3324 rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
3325 -
3326 +
3327 write_nic_word(dev,0xf4,0xffff);
3328 write_nic_byte(dev,
3329 - CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
3330 + CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
3331
3332 rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
3333 -
3334 - write_nic_dword(dev,INT_TIMEOUT,0);
3335 +
3336 + write_nic_dword(dev,INT_TIMEOUT,0);
3337
3338 #ifdef DEBUG_REGISTERS
3339 - rtl8180_dump_reg(dev);
3340 + rtl8180_dump_reg(dev);
3341 #endif
3342 -
3343 -
3344 - write_nic_byte(dev, WPA_CONFIG, 0);
3345 +
3346 +
3347 + write_nic_byte(dev, WPA_CONFIG, 0);
3348
3349 write_nic_byte(dev, RATE_FALLBACK, 0x81);
3350 rtl8187_set_rate(dev);
3351 -
3352 - priv->rf_init(dev);
3353 +
3354 + priv->rf_init(dev);
3355
3356 if(priv->rf_set_sens != NULL)
3357 - priv->rf_set_sens(dev,priv->sens);
3358 -
3359 + priv->rf_set_sens(dev,priv->sens);
3360 +
3361 write_nic_word(dev,0x5e,1);
3362
3363 #if 1
3364 @@ -2054,13 +2121,13 @@
3365 write_nic_byte(dev, 0xff, 0x60);
3366
3367 write_nic_word(dev,0x5e,0);
3368 -
3369 -
3370 +
3371 +
3372 rtl8180_irq_enable(dev);
3373 /*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY));
3374 -
3375 +
3376 DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY));
3377 -
3378 +
3379 DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY));
3380 if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK");
3381 if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK");
3382 @@ -2077,8 +2144,8 @@
3383 void rtl8180_start_tx_beacon(struct net_device *dev)
3384 {
3385 int i;
3386 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3387 - u16 word;
3388 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3389 + u16 word;
3390 DMESG("Enabling beacon TX");
3391 //write_nic_byte(dev, 0x42,0xe6);// TCR
3392 //rtl8180_init_beacon(dev);
3393 @@ -2091,41 +2158,41 @@
3394 //write_nic_word(dev,0x7a,0);
3395 //write_nic_word(dev,0x7a,0x8000);
3396
3397 -
3398 +
3399 word = read_nic_word(dev, BcnItv);
3400 word &= ~BcnItv_BcnItv; // clear Bcn_Itv
3401 write_nic_word(dev, BcnItv, word);
3402
3403 - write_nic_word(dev, AtimWnd,
3404 + write_nic_word(dev, AtimWnd,
3405 read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd);
3406 -
3407 +
3408 word = read_nic_word(dev, BintrItv);
3409 word &= ~BintrItv_BintrItv;
3410 -
3411 - //word |= priv->ieee80211->beacon_interval *
3412 +
3413 + //word |= priv->ieee80211->beacon_interval *
3414 // ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1);
3415 // FIXME:FIXME check if correct ^^ worked with 0x3e8;
3416 -
3417 +
3418 write_nic_word(dev, BintrItv, word);
3419 -
3420 +
3421 //write_nic_word(dev,0x2e,0xe002);
3422 //write_nic_dword(dev,0x30,0xb8c7832e);
3423 for(i=0; i<ETH_ALEN; i++)
3424 write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]);
3425 -
3426 +
3427 // rtl8180_update_msr(dev);
3428
3429 -
3430 +
3431 //write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */
3432 -
3433 +
3434 rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
3435 -
3436 +
3437 rtl8180_irq_enable(dev);
3438 -
3439 +
3440 /* VV !!!!!!!!!! VV*/
3441 /*
3442 rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
3443 - write_nic_byte(dev,0x9d,0x00);
3444 + write_nic_byte(dev,0x9d,0x00);
3445 rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
3446 */
3447 }
3448 @@ -2135,137 +2202,138 @@
3449 ***************************************************************************/
3450 static struct net_device_stats *rtl8180_stats(struct net_device *dev)
3451 {
3452 - struct r8180_priv *priv = ieee80211_priv(dev);
3453 -
3454 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3455 +
3456 return &priv->ieee80211->stats;
3457 }
3458
3459
3460 int _rtl8180_up(struct net_device *dev)
3461 {
3462 - struct r8180_priv *priv = ieee80211_priv(dev);
3463 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3464
3465 priv->up=1;
3466 -
3467 - //DMESG("Bringing up iface");
3468 +
3469 +// DMESG("Bringing up iface");
3470
3471 rtl8180_adapter_start(dev);
3472 -
3473 rtl8180_rx_enable(dev);
3474 -
3475 rtl8180_tx_enable(dev);
3476 -
3477 - ieee80211_softmac_start_protocol(priv->ieee80211);
3478 -
3479 - ieee80211_reset_queue(priv->ieee80211);
3480 + ieee80211_softmac_start_protocol_rtl7(priv->ieee80211);
3481 + ieee80211_reset_queue_rtl7(priv->ieee80211);
3482 if(!netif_queue_stopped(dev))
3483 netif_start_queue(dev);
3484 else
3485 netif_wake_queue(dev);
3486 -
3487 return 0;
3488 }
3489
3490
3491 int rtl8180_open(struct net_device *dev)
3492 {
3493 - struct r8180_priv *priv = ieee80211_priv(dev);
3494 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3495 int ret;
3496 -
3497 +
3498 down(&priv->wx_sem);
3499 +
3500 ret = rtl8180_up(dev);
3501 up(&priv->wx_sem);
3502 return ret;
3503 -
3504 +
3505 }
3506
3507
3508 int rtl8180_up(struct net_device *dev)
3509 {
3510 - struct r8180_priv *priv = ieee80211_priv(dev);
3511 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3512
3513 if (priv->up == 1) return -1;
3514 -
3515 +
3516 return _rtl8180_up(dev);
3517 }
3518
3519
3520 int rtl8180_close(struct net_device *dev)
3521 {
3522 - struct r8180_priv *priv = ieee80211_priv(dev);
3523 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3524 int ret;
3525 -
3526 +
3527 down(&priv->wx_sem);
3528 -
3529 +
3530 ret = rtl8180_down(dev);
3531 -
3532 +
3533 up(&priv->wx_sem);
3534 -
3535 +
3536 return ret;
3537
3538 }
3539
3540 int rtl8180_down(struct net_device *dev)
3541 {
3542 - struct r8180_priv *priv = ieee80211_priv(dev);
3543 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3544
3545 if (priv->up == 0) return -1;
3546 -
3547 +
3548 priv->up=0;
3549
3550 /* FIXME */
3551 if (!netif_queue_stopped(dev))
3552 netif_stop_queue(dev);
3553 -
3554 +
3555 rtl8180_rtx_disable(dev);
3556 rtl8180_irq_disable(dev);
3557
3558 - ieee80211_softmac_stop_protocol(priv->ieee80211);
3559 -
3560 + ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
3561 +
3562 return 0;
3563 }
3564
3565
3566 void rtl8180_commit(struct net_device *dev)
3567 {
3568 - struct r8180_priv *priv = ieee80211_priv(dev);
3569 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3570
3571 if (priv->up == 0) return ;
3572 -
3573 - ieee80211_softmac_stop_protocol(priv->ieee80211);
3574 -
3575 +
3576 + ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
3577 +
3578 rtl8180_irq_disable(dev);
3579 rtl8180_rtx_disable(dev);
3580 _rtl8180_up(dev);
3581 }
3582
3583 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
3584 +void rtl8180_restart(struct work_struct *work)
3585 +{
3586 + struct r8180_priv *priv = container_of(work, struct r8180_priv, reset_wq);
3587 + struct net_device *dev = priv->dev;
3588 +#else
3589 void rtl8180_restart(struct net_device *dev)
3590 {
3591 - struct r8180_priv *priv = ieee80211_priv(dev);
3592 -
3593 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3594 +#endif
3595 down(&priv->wx_sem);
3596 -
3597 rtl8180_commit(dev);
3598 -
3599 +
3600 up(&priv->wx_sem);
3601 }
3602
3603 static void r8180_set_multicast(struct net_device *dev)
3604 {
3605 - struct r8180_priv *priv = ieee80211_priv(dev);
3606 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3607 short promisc;
3608
3609 //down(&priv->wx_sem);
3610 -
3611 +
3612 /* FIXME FIXME */
3613 -
3614 +
3615 promisc = (dev->flags & IFF_PROMISC) ? 1:0;
3616 -
3617 +
3618 if (promisc != priv->promisc)
3619 // rtl8180_commit(dev);
3620 -
3621 +
3622 priv->promisc = promisc;
3623 -
3624 +
3625 //schedule_work(&priv->reset_wq);
3626 //up(&priv->wx_sem);
3627 }
3628 @@ -2273,17 +2341,17 @@
3629
3630 int r8180_set_mac_adr(struct net_device *dev, void *mac)
3631 {
3632 - struct r8180_priv *priv = ieee80211_priv(dev);
3633 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3634 struct sockaddr *addr = mac;
3635 -
3636 +
3637 down(&priv->wx_sem);
3638 -
3639 +
3640 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
3641 -
3642 +
3643 schedule_work(&priv->reset_wq);
3644 -
3645 +
3646 up(&priv->wx_sem);
3647 -
3648 +
3649 return 0;
3650 }
3651
3652 @@ -2291,16 +2359,17 @@
3653 /* based on ipw2200 driver */
3654 int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
3655 {
3656 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3657 -
3658 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3659 +
3660 +
3661 down(&priv->wx_sem);
3662 -
3663 +
3664 struct iwreq *wrq = (struct iwreq *)rq;
3665 -
3666 +
3667 int ret=-1;
3668 switch (cmd) {
3669 case RTL_IOCTL_WPA_SUPPLICANT:
3670 - ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
3671 + ret = ieee80211_wpa_supplicant_ioctl_rtl7(priv->ieee80211, &wrq->u.data);
3672 break;
3673
3674 default:
3675 @@ -2309,7 +2378,7 @@
3676 }
3677
3678 up(&priv->wx_sem);
3679 -
3680 +
3681 return ret;
3682 }
3683
3684 @@ -2321,9 +2390,9 @@
3685 int status,len,flen;
3686 struct sk_buff *skb;
3687 u32 *desc;
3688 -
3689 +
3690 //DMESG("rtl8187_rx_isr");
3691 -
3692 +
3693 struct ieee80211_rx_stats stats = {
3694 .signal = 0,
3695 .noise = -98,
3696 @@ -2335,17 +2404,17 @@
3697 //DMESG("RX %d ",rx_urb->status);
3698 status = rx_urb->status;
3699 if(status == 0){
3700 -
3701 +
3702 len = rx_urb->actual_length;
3703 - // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
3704 + // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
3705 len -= 4*4;/* 4 dword and 4 byte CRC */
3706 -
3707 +
3708 desc = (u32*)(rx_urb->transfer_buffer + len);
3709 -
3710 +
3711 flen = desc[0] & 0xfff;
3712 -
3713 +
3714 if( flen <= rx_urb->actual_length){
3715 -
3716 +
3717 stats.signal = (desc[1] & 0x7f00)>>8;
3718 stats.noise = desc[1] &0xff;
3719 stats.rate = desc[0] >> 20 & 0xf;
3720 @@ -2353,22 +2422,23 @@
3721 stats.mac_time[1] = desc[3];
3722 skb = dev_alloc_skb(flen-4);
3723 //skb_reserve(skb,2);
3724 - if(skb){
3725 + if(skb){
3726 memcpy(skb_put(skb,flen-4),
3727 rx_urb->transfer_buffer,flen -4);
3728 -
3729 +
3730 #ifdef DUMP_RX
3731 int i;
3732 for(i=0;i<flen-4;i++)
3733 printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]);
3734 printk("------RATE %x:w---------------\n",stats.rate);
3735 -
3736 +
3737 #endif
3738 priv->stats.rxok++;
3739 // priv->rxskb = skb;
3740 // priv->tempstats = &stats;
3741
3742 - if(!ieee80211_rx(priv->ieee80211,
3743 +
3744 + if(!ieee80211_rx_rtl7(priv->ieee80211,
3745 skb, &stats))
3746 dev_kfree_skb_any(skb);
3747 }
3748 @@ -2376,9 +2446,9 @@
3749 }else{
3750 priv->stats.rxstaterr++;
3751 priv->ieee80211->stats.rx_errors++;
3752 -
3753 +
3754 }
3755 -
3756 +
3757 if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb);
3758 else DMESG("RX process aborted due to explicit shutdown");
3759 }
3760 @@ -2396,20 +2466,20 @@
3761 struct r8180_priv *priv= NULL;
3762 struct usb_device *udev = interface_to_usbdev(intf);
3763
3764 -//printk("===> rtl8187_usb_probe()\n");
3765 -
3766 - dev = alloc_ieee80211(sizeof(struct r8180_priv));
3767 -
3768 +//printk("===> rtl8187_usb_probe()\n");
3769 +
3770 + dev = alloc_ieee80211_rtl7(sizeof(struct r8180_priv));
3771 +
3772 SET_MODULE_OWNER(dev);
3773 - usb_set_intfdata(intf, dev);
3774 -
3775 + usb_set_intfdata(intf, dev);
3776 +
3777 SET_NETDEV_DEV(dev, &intf->dev);
3778
3779 - priv = ieee80211_priv(dev);
3780 + priv = ieee80211_priv_rtl7(dev);
3781 priv->ieee80211 = netdev_priv(dev);
3782 -
3783 +
3784 priv->udev=udev;
3785 -
3786 +
3787 dev->open = rtl8180_open;
3788 dev->stop = rtl8180_close;
3789 //dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
3790 @@ -2418,41 +2488,46 @@
3791 dev->do_ioctl = rtl8180_ioctl;
3792 dev->set_multicast_list = r8180_set_multicast;
3793 dev->set_mac_address = r8180_set_mac_adr;
3794 +#if WIRELESS_EXT >= 12
3795 +#if WIRELESS_EXT < 17
3796 dev->get_wireless_stats = r8180_get_wireless_stats;
3797 +#endif
3798 + dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
3799 +#endif
3800 dev->type=ARPHRD_ETHER;
3801 -
3802 +
3803 if (dev_alloc_name(dev, ifname) < 0){
3804 DMESG("Oops: devname already taken! Trying wlan%%d...\n");
3805 ifname = "wlan%d";
3806 dev_alloc_name(dev, ifname);
3807 }
3808 -
3809 +
3810 // dev->open=rtl8180_init;
3811 -
3812 - if(rtl8180_init(dev)!=0){
3813 +
3814 + if(rtl8180_init(dev)!=0){
3815 DMESG("Initialization failed");
3816 goto fail;
3817 }
3818 -
3819 +
3820 netif_carrier_off(dev);
3821 netif_stop_queue(dev);
3822 -
3823 +
3824 register_netdev(dev);
3825 -
3826 +
3827 rtl8180_proc_init_one(dev);
3828 -
3829 -
3830 +
3831 +
3832 DMESG("Driver probe completed\n");
3833 - return 0;
3834 + return 0;
3835 +
3836
3837 -
3838 fail:
3839 - free_ieee80211(dev);
3840 -
3841 + free_ieee80211_rtl7(dev);
3842 +
3843 DMESG("wlan driver load failed\n");
3844 -
3845 +
3846 return -ENODEV;
3847 -
3848 +
3849 }
3850
3851
3852 @@ -2461,13 +2536,13 @@
3853 struct r8180_priv *priv;
3854 struct net_device *dev = usb_get_intfdata(intf);
3855 if(dev){
3856 -
3857 +
3858 unregister_netdev(dev);
3859 -
3860 - priv=ieee80211_priv(dev);
3861 -
3862 +
3863 + priv=ieee80211_priv_rtl7(dev);
3864 +
3865 rtl8180_proc_remove_one(dev);
3866 -
3867 +
3868 rtl8180_down(dev);
3869 priv->rf_close(dev);
3870 //rtl8180_rtx_disable(dev);
3871 @@ -2478,12 +2553,12 @@
3872
3873 }
3874 // pci_disable_device(pdev);
3875 - free_ieee80211(dev);
3876 + free_ieee80211_rtl7(dev);
3877 DMESG("wlan driver removed\n");
3878 }
3879
3880
3881 -static int __init rtl8187_usb_module_init(void)
3882 +static int __init rtl8187_usb_module_init_rtl7(void)
3883 {
3884 printk(KERN_INFO "\nLinux kernel driver for RTL8187 \
3885 based WLAN cards\n");
3886 @@ -2495,7 +2570,7 @@
3887 }
3888
3889
3890 -static void __exit rtl8187_usb_module_exit(void)
3891 +static void __exit rtl8187_usb_module_exit_rtl7(void)
3892 {
3893 usb_deregister(&rtl8187_usb_driver);
3894
3895 @@ -2508,14 +2583,14 @@
3896 {
3897 unsigned long flags;
3898 short enough_desc;
3899 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3900 -
3901 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3902 +
3903 spin_lock_irqsave(&priv->tx_lock,flags);
3904 enough_desc = check_nic_enought_desc(dev,pri);
3905 - spin_unlock_irqrestore(&priv->tx_lock,flags);
3906 -
3907 + spin_unlock_irqrestore(&priv->tx_lock,flags);
3908 +
3909 if(enough_desc)
3910 - ieee80211_wake_queue(priv->ieee80211);
3911 + ieee80211_wake_queue_rtl7(priv->ieee80211);
3912 }
3913
3914
3915 @@ -2523,5 +2598,5 @@
3916 /***************************************************************************
3917 ------------------- module init / exit stubs ----------------
3918 ****************************************************************************/
3919 -module_init(rtl8187_usb_module_init);
3920 -module_exit(rtl8187_usb_module_exit);
3921 +module_init(rtl8187_usb_module_init_rtl7);
3922 +module_exit(rtl8187_usb_module_exit_rtl7);
3923 diff -Naur rtl8187_orig/beta-8187/r8187.h rtl8187_txpower/beta-8187/r8187.h
3924 --- rtl8187_orig/beta-8187/r8187.h 2007-03-13 23:45:09.000000000 +0100
3925 +++ rtl8187_txpower/beta-8187/r8187.h 2007-04-23 00:08:15.000000000 +0200
3926 @@ -26,7 +26,6 @@
3927
3928 #include <linux/module.h>
3929 #include <linux/kernel.h>
3930 -#include <linux/config.h>
3931 #include <linux/init.h>
3932 #include <linux/ioport.h>
3933 #include <linux/sched.h>
3934 @@ -47,6 +46,12 @@
3935 #include <asm/io.h>
3936 #include <asm/semaphore.h>
3937
3938 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
3939 +#include <linux/config.h>
3940 +#else
3941 +#include <linux/autoconf.h>
3942 +#endif
3943 +
3944 #include "ieee80211.h"
3945
3946 #define EPROM_93c46 0
3947 @@ -148,7 +153,7 @@
3948 u8 challow[15]; //channels from 1 to 14, 0 not used
3949 short up;
3950 short crcmon; //if 1 allow bad crc frame reception in monitor mode
3951 -// short prism_hdr;
3952 + short prism_hdr;
3953
3954 // struct timer_list scan_timer;
3955 /*short scanpending;
3956 diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.c rtl8187_txpower/ieee80211/ieee80211_crypt.c
3957 --- rtl8187_orig/ieee80211/ieee80211_crypt.c 2007-03-13 23:45:09.000000000 +0100
3958 +++ rtl8187_txpower/ieee80211/ieee80211_crypt.c 2007-04-23 00:09:00.000000000 +0200
3959 @@ -11,7 +11,6 @@
3960 *
3961 */
3962
3963 -#include <linux/config.h>
3964 #include <linux/version.h>
3965 #include <linux/module.h>
3966 #include <linux/init.h>
3967 @@ -19,6 +18,12 @@
3968 #include <asm/string.h>
3969 #include <asm/errno.h>
3970
3971 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
3972 +#include <linux/config.h>
3973 +#else
3974 +#include <linux/autoconf.h>
3975 +#endif
3976 +
3977 #include "ieee80211.h"
3978
3979 MODULE_AUTHOR("Jouni Malinen");
3980 @@ -38,7 +43,7 @@
3981
3982 static struct ieee80211_crypto *hcrypt;
3983
3984 -void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
3985 +void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *ieee,
3986 int force)
3987 {
3988 struct list_head *ptr, *n;
3989 @@ -61,13 +66,13 @@
3990 }
3991 }
3992
3993 -void ieee80211_crypt_deinit_handler(unsigned long data)
3994 +void ieee80211_crypt_deinit_handler_rtl7(unsigned long data)
3995 {
3996 struct ieee80211_device *ieee = (struct ieee80211_device *)data;
3997 unsigned long flags;
3998
3999 spin_lock_irqsave(&ieee->lock, flags);
4000 - ieee80211_crypt_deinit_entries(ieee, 0);
4001 + ieee80211_crypt_deinit_entries_rtl7(ieee, 0);
4002 if (!list_empty(&ieee->crypt_deinit_list)) {
4003 printk(KERN_DEBUG "%s: entries remaining in delayed crypt "
4004 "deletion list\n", ieee->dev->name);
4005 @@ -78,7 +83,7 @@
4006
4007 }
4008
4009 -void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
4010 +void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
4011 struct ieee80211_crypt_data **crypt)
4012 {
4013 struct ieee80211_crypt_data *tmp;
4014 @@ -103,7 +108,7 @@
4015 spin_unlock_irqrestore(&ieee->lock, flags);
4016 }
4017
4018 -int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
4019 +int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
4020 {
4021 unsigned long flags;
4022 struct ieee80211_crypto_alg *alg;
4023 @@ -128,7 +133,7 @@
4024 return 0;
4025 }
4026
4027 -int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops)
4028 +int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
4029 {
4030 unsigned long flags;
4031 struct list_head *ptr;
4032 @@ -159,7 +164,7 @@
4033 }
4034
4035
4036 -struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name)
4037 +struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name)
4038 {
4039 unsigned long flags;
4040 struct list_head *ptr;
4041 @@ -186,13 +191,13 @@
4042 }
4043
4044
4045 -static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; }
4046 -static void ieee80211_crypt_null_deinit(void *priv) {}
4047 +static void * ieee80211_crypt_null_init_rtl7(int keyidx) { return (void *) 1; }
4048 +static void ieee80211_crypt_null_deinit_rtl7(void *priv) {}
4049
4050 static struct ieee80211_crypto_ops ieee80211_crypt_null = {
4051 .name = "NULL",
4052 - .init = ieee80211_crypt_null_init,
4053 - .deinit = ieee80211_crypt_null_deinit,
4054 + .init = ieee80211_crypt_null_init_rtl7,
4055 + .deinit = ieee80211_crypt_null_deinit_rtl7,
4056 .encrypt_mpdu = NULL,
4057 .decrypt_mpdu = NULL,
4058 .encrypt_msdu = NULL,
4059 @@ -205,7 +210,7 @@
4060 };
4061
4062
4063 -static int __init ieee80211_crypto_init(void)
4064 +static int __init ieee80211_crypto_init_rtl7(void)
4065 {
4066 int ret = -ENOMEM;
4067
4068 @@ -217,7 +222,7 @@
4069 INIT_LIST_HEAD(&hcrypt->algs);
4070 spin_lock_init(&hcrypt->lock);
4071
4072 - ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null);
4073 + ret = ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_null);
4074 if (ret < 0) {
4075 kfree(hcrypt);
4076 hcrypt = NULL;
4077 @@ -227,7 +232,7 @@
4078 }
4079
4080
4081 -static void __exit ieee80211_crypto_deinit(void)
4082 +static void __exit ieee80211_crypto_deinit_rtl7(void)
4083 {
4084 struct list_head *ptr, *n;
4085
4086 @@ -247,13 +252,13 @@
4087 kfree(hcrypt);
4088 }
4089
4090 -EXPORT_SYMBOL(ieee80211_crypt_deinit_entries);
4091 -EXPORT_SYMBOL(ieee80211_crypt_deinit_handler);
4092 -EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit);
4093 -
4094 -EXPORT_SYMBOL(ieee80211_register_crypto_ops);
4095 -EXPORT_SYMBOL(ieee80211_unregister_crypto_ops);
4096 -EXPORT_SYMBOL(ieee80211_get_crypto_ops);
4097 +EXPORT_SYMBOL(ieee80211_crypt_deinit_entries_rtl7);
4098 +EXPORT_SYMBOL(ieee80211_crypt_deinit_handler_rtl7);
4099 +EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit_rtl7);
4100 +
4101 +EXPORT_SYMBOL(ieee80211_register_crypto_ops_rtl7);
4102 +EXPORT_SYMBOL(ieee80211_unregister_crypto_ops_rtl7);
4103 +EXPORT_SYMBOL(ieee80211_get_crypto_ops_rtl7);
4104
4105 -module_init(ieee80211_crypto_init);
4106 -module_exit(ieee80211_crypto_deinit);
4107 +module_init(ieee80211_crypto_init_rtl7);
4108 +module_exit(ieee80211_crypto_deinit_rtl7);
4109 diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c rtl8187_txpower/ieee80211/ieee80211_crypt_ccmp.c
4110 --- rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c 2007-03-13 23:45:09.000000000 +0100
4111 +++ rtl8187_txpower/ieee80211/ieee80211_crypt_ccmp.c 2007-04-23 00:09:00.000000000 +0200
4112 @@ -9,7 +9,6 @@
4113 * more details.
4114 */
4115
4116 -#include <linux/config.h>
4117 #include <linux/version.h>
4118 #include <linux/module.h>
4119 #include <linux/init.h>
4120 @@ -22,11 +21,22 @@
4121 #include <asm/string.h>
4122 #include <linux/wireless.h>
4123
4124 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
4125 +#include <linux/config.h>
4126 +#else
4127 +#include <linux/autoconf.h>
4128 +#endif
4129 +
4130 #include "ieee80211.h"
4131
4132
4133 #include <linux/crypto.h>
4134 -#include <asm/scatterlist.h>
4135 +
4136 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
4137 + #include <asm/scatterlist.h>
4138 +#else
4139 + #include <linux/scatterlist.h>
4140 +#endif
4141
4142 MODULE_AUTHOR("Jouni Malinen");
4143 MODULE_DESCRIPTION("Host AP crypt: CCMP");
4144 @@ -59,7 +69,7 @@
4145 u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN];
4146 };
4147
4148 -void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
4149 +void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_tfm *tfm,
4150 const u8 pt[16], u8 ct[16])
4151 {
4152 struct scatterlist src, dst;
4153 @@ -75,7 +85,7 @@
4154 crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
4155 }
4156
4157 -static void * ieee80211_ccmp_init(int key_idx)
4158 +static void * ieee80211_ccmp_init_rtl7(int key_idx)
4159 {
4160 struct ieee80211_ccmp_data *priv;
4161
4162 @@ -105,7 +115,7 @@
4163 }
4164
4165
4166 -static void ieee80211_ccmp_deinit(void *priv)
4167 +static void ieee80211_ccmp_deinit_rtl7(void *priv)
4168 {
4169 struct ieee80211_ccmp_data *_priv = priv;
4170 if (_priv && _priv->tfm)
4171 @@ -114,7 +124,7 @@
4172 }
4173
4174
4175 -static inline void xor_block(u8 *b, u8 *a, size_t len)
4176 +static inline void xor_block_rtl7(u8 *b, u8 *a, size_t len)
4177 {
4178 int i;
4179 for (i = 0; i < len; i++)
4180 @@ -122,7 +132,7 @@
4181 }
4182
4183
4184 -static void ccmp_init_blocks(struct crypto_tfm *tfm,
4185 +static void ccmp_init_blocks_rtl7(struct crypto_tfm *tfm,
4186 struct ieee80211_hdr *hdr,
4187 u8 *pn, size_t dlen, u8 *b0, u8 *auth,
4188 u8 *s0)
4189 @@ -186,18 +196,18 @@
4190 }
4191
4192 /* Start with the first block and AAD */
4193 - ieee80211_ccmp_aes_encrypt(tfm, b0, auth);
4194 - xor_block(auth, aad, AES_BLOCK_LEN);
4195 - ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
4196 - xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
4197 - ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
4198 + ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, auth);
4199 + xor_block_rtl7(auth, aad, AES_BLOCK_LEN);
4200 + ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
4201 + xor_block_rtl7(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
4202 + ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
4203 b0[0] &= 0x07;
4204 b0[14] = b0[15] = 0;
4205 - ieee80211_ccmp_aes_encrypt(tfm, b0, s0);
4206 + ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, s0);
4207 }
4208
4209
4210 -static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
4211 +static int ieee80211_ccmp_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
4212 {
4213 struct ieee80211_ccmp_data *key = priv;
4214 int data_len, i, blocks, last, len;
4215 @@ -237,7 +247,7 @@
4216 *pos++ = key->tx_pn[0];
4217
4218 hdr = (struct ieee80211_hdr *) skb->data;
4219 - ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
4220 + ccmp_init_blocks_rtl7(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
4221
4222 blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
4223 last = data_len % AES_BLOCK_LEN;
4224 @@ -245,13 +255,13 @@
4225 for (i = 1; i <= blocks; i++) {
4226 len = (i == blocks && last) ? last : AES_BLOCK_LEN;
4227 /* Authentication */
4228 - xor_block(b, pos, len);
4229 - ieee80211_ccmp_aes_encrypt(key->tfm, b, b);
4230 + xor_block_rtl7(b, pos, len);
4231 + ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b, b);
4232 /* Encryption, with counter */
4233 b0[14] = (i >> 8) & 0xff;
4234 b0[15] = i & 0xff;
4235 - ieee80211_ccmp_aes_encrypt(key->tfm, b0, e);
4236 - xor_block(pos, e, len);
4237 + ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, e);
4238 + xor_block_rtl7(pos, e, len);
4239 pos += len;
4240 }
4241
4242 @@ -262,7 +272,7 @@
4243 }
4244
4245
4246 -static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
4247 +static int ieee80211_ccmp_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
4248 {
4249 struct ieee80211_ccmp_data *key = priv;
4250 u8 keyidx, *pos;
4251 @@ -326,8 +336,8 @@
4252 return -4;
4253 }
4254
4255 - ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b);
4256 - xor_block(mic, b, CCMP_MIC_LEN);
4257 + ccmp_init_blocks_rtl7(key->tfm, hdr, pn, data_len, b0, a, b);
4258 + xor_block_rtl7(mic, b, CCMP_MIC_LEN);
4259
4260 blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
4261 last = data_len % AES_BLOCK_LEN;
4262 @@ -337,11 +347,11 @@
4263 /* Decrypt, with counter */
4264 b0[14] = (i >> 8) & 0xff;
4265 b0[15] = i & 0xff;
4266 - ieee80211_ccmp_aes_encrypt(key->tfm, b0, b);
4267 - xor_block(pos, b, len);
4268 + ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, b);
4269 + xor_block_rtl7(pos, b, len);
4270 /* Authentication */
4271 - xor_block(a, pos, len);
4272 - ieee80211_ccmp_aes_encrypt(key->tfm, a, a);
4273 + xor_block_rtl7(a, pos, len);
4274 + ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, a, a);
4275 pos += len;
4276 }
4277
4278 @@ -365,7 +375,7 @@
4279 }
4280
4281
4282 -static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
4283 +static int ieee80211_ccmp_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
4284 {
4285 struct ieee80211_ccmp_data *data = priv;
4286 int keyidx;
4287 @@ -396,7 +406,7 @@
4288 }
4289
4290
4291 -static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
4292 +static int ieee80211_ccmp_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
4293 {
4294 struct ieee80211_ccmp_data *data = priv;
4295
4296 @@ -420,7 +430,7 @@
4297 }
4298
4299
4300 -static char * ieee80211_ccmp_print_stats(char *p, void *priv)
4301 +static char * ieee80211_ccmp_print_stats_rtl7(char *p, void *priv)
4302 {
4303 struct ieee80211_ccmp_data *ccmp = priv;
4304 p += sprintf(p, "key[%d] alg=CCMP key_set=%d "
4305 @@ -437,34 +447,34 @@
4306 }
4307
4308
4309 -static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
4310 +static struct ieee80211_crypto_ops ieee80211_crypt_ccmp_rtl7 = {
4311 .name = "CCMP",
4312 - .init = ieee80211_ccmp_init,
4313 - .deinit = ieee80211_ccmp_deinit,
4314 - .encrypt_mpdu = ieee80211_ccmp_encrypt,
4315 - .decrypt_mpdu = ieee80211_ccmp_decrypt,
4316 + .init = ieee80211_ccmp_init_rtl7,
4317 + .deinit = ieee80211_ccmp_deinit_rtl7,
4318 + .encrypt_mpdu = ieee80211_ccmp_encrypt_rtl7,
4319 + .decrypt_mpdu = ieee80211_ccmp_decrypt_rtl7,
4320 .encrypt_msdu = NULL,
4321 .decrypt_msdu = NULL,
4322 - .set_key = ieee80211_ccmp_set_key,
4323 - .get_key = ieee80211_ccmp_get_key,
4324 - .print_stats = ieee80211_ccmp_print_stats,
4325 + .set_key = ieee80211_ccmp_set_key_rtl7,
4326 + .get_key = ieee80211_ccmp_get_key_rtl7,
4327 + .print_stats = ieee80211_ccmp_print_stats_rtl7,
4328 .extra_prefix_len = CCMP_HDR_LEN,
4329 .extra_postfix_len = CCMP_MIC_LEN,
4330 .owner = THIS_MODULE,
4331 };
4332
4333
4334 -static int __init ieee80211_crypto_ccmp_init(void)
4335 +static int __init ieee80211_crypto_ccmp_init_rtl7(void)
4336 {
4337 - return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp);
4338 + return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
4339 }
4340
4341
4342 -static void __exit ieee80211_crypto_ccmp_exit(void)
4343 +static void __exit ieee80211_crypto_ccmp_exit_rtl7(void)
4344 {
4345 - ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
4346 + ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
4347 }
4348
4349
4350 -module_init(ieee80211_crypto_ccmp_init);
4351 -module_exit(ieee80211_crypto_ccmp_exit);
4352 +module_init(ieee80211_crypto_ccmp_init_rtl7);
4353 +module_exit(ieee80211_crypto_ccmp_exit_rtl7);
4354 diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.h rtl8187_txpower/ieee80211/ieee80211_crypt.h
4355 --- rtl8187_orig/ieee80211/ieee80211_crypt.h 2007-03-13 23:45:09.000000000 +0100
4356 +++ rtl8187_txpower/ieee80211/ieee80211_crypt.h 2007-04-23 00:09:03.000000000 +0200
4357 @@ -75,12 +75,12 @@
4358 atomic_t refcnt;
4359 };
4360
4361 -int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
4362 -int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
4363 -struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
4364 -void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
4365 -void ieee80211_crypt_deinit_handler(unsigned long);
4366 -void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
4367 +int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
4368 +int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
4369 +struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
4370 +void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
4371 +void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
4372 +void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
4373 struct ieee80211_crypt_data **crypt);
4374
4375 #endif
4376 diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c rtl8187_txpower/ieee80211/ieee80211_crypt_tkip.c
4377 --- rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c 2007-03-13 23:45:09.000000000 +0100
4378 +++ rtl8187_txpower/ieee80211/ieee80211_crypt_tkip.c 2007-04-23 00:09:00.000000000 +0200
4379 @@ -9,7 +9,6 @@
4380 * more details.
4381 */
4382
4383 -#include <linux/config.h>
4384 #include <linux/version.h>
4385 #include <linux/module.h>
4386 #include <linux/init.h>
4387 @@ -21,13 +20,24 @@
4388 #include <linux/if_arp.h>
4389 #include <asm/string.h>
4390
4391 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
4392 +#include <linux/config.h>
4393 +#else
4394 +#include <linux/autoconf.h>
4395 +#endif
4396 +
4397 #include "ieee80211.h"
4398
4399 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
4400 + #include <asm/scatterlist.h>
4401 +#else
4402 + #include <linux/scatterlist.h>
4403 +#endif
4404
4405 #include <linux/crypto.h>
4406 -#include <asm/scatterlist.h>
4407 #include <linux/crc32.h>
4408
4409 +
4410 MODULE_AUTHOR("Jouni Malinen");
4411 MODULE_DESCRIPTION("Host AP crypt: TKIP");
4412 MODULE_LICENSE("GPL");
4413 @@ -62,7 +72,7 @@
4414 u8 rx_hdr[16], tx_hdr[16];
4415 };
4416
4417 -static void * ieee80211_tkip_init(int key_idx)
4418 +static void * ieee80211_tkip_init_rtl7(int key_idx)
4419 {
4420 struct ieee80211_tkip_data *priv;
4421
4422 @@ -101,7 +111,7 @@
4423 }
4424
4425
4426 -static void ieee80211_tkip_deinit(void *priv)
4427 +static void ieee80211_tkip_deinit_rtl7(void *priv)
4428 {
4429 struct ieee80211_tkip_data *_priv = priv;
4430 if (_priv && _priv->tfm_michael)
4431 @@ -200,7 +210,7 @@
4432
4433 #define PHASE1_LOOP_COUNT 8
4434
4435 -static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
4436 +static void tkip_mixing_phase1_rtl7(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
4437 {
4438 int i, j;
4439
4440 @@ -222,7 +232,7 @@
4441 }
4442
4443
4444 -static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
4445 +static void tkip_mixing_phase2_rtl7(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
4446 u16 IV16)
4447 {
4448 /* Make temporary area overlap WEP seed so that the final copy can be
4449 @@ -268,7 +278,7 @@
4450 #endif
4451 }
4452
4453 -static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
4454 +static int ieee80211_tkip_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
4455 {
4456 struct ieee80211_tkip_data *tkey = priv;
4457 int len;
4458 @@ -283,11 +293,11 @@
4459
4460 hdr = (struct ieee80211_hdr *) skb->data;
4461 if (!tkey->tx_phase1_done) {
4462 - tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2,
4463 + tkip_mixing_phase1_rtl7(tkey->tx_ttak, tkey->key, hdr->addr2,
4464 tkey->tx_iv32);
4465 tkey->tx_phase1_done = 1;
4466 }
4467 - tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
4468 + tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
4469
4470 len = skb->len - hdr_len;
4471 pos = skb_push(skb, 8);
4472 @@ -325,7 +335,7 @@
4473 return 0;
4474 }
4475
4476 -static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
4477 +static int ieee80211_tkip_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
4478 {
4479 struct ieee80211_tkip_data *tkey = priv;
4480 u8 rc4key[16];
4481 @@ -382,10 +392,10 @@
4482 }
4483
4484 if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) {
4485 - tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
4486 + tkip_mixing_phase1_rtl7(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
4487 tkey->rx_phase1_done = 1;
4488 }
4489 - tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16);
4490 + tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->rx_ttak, iv16);
4491
4492 plen = skb->len - hdr_len - 12;
4493
4494 @@ -428,10 +438,14 @@
4495 }
4496
4497
4498 -static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
4499 +static int michael_mic_rtl7(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
4500 u8 *data, size_t data_len, u8 *mic)
4501 {
4502 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
4503 + struct hash_desc desc;
4504 +#endif
4505 struct scatterlist sg[2];
4506 + int ret=0;
4507
4508 if (tkey->tfm_michael == NULL) {
4509 printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
4510 @@ -445,15 +459,24 @@
4511 sg[1].offset = offset_in_page(data);
4512 sg[1].length = data_len;
4513
4514 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
4515 crypto_digest_init(tkey->tfm_michael);
4516 crypto_digest_setkey(tkey->tfm_michael, key, 8);
4517 crypto_digest_update(tkey->tfm_michael, sg, 2);
4518 crypto_digest_final(tkey->tfm_michael, mic);
4519 +#else
4520 + if (crypto_hash_setkey(tkey->tfm_michael, key, 8))
4521 + return -1;
4522
4523 - return 0;
4524 + desc.tfm = tkey->tfm_michael;
4525 + desc.flags = 0;
4526 + ret = crypto_hash_digest(&desc, sg, data_len + 16, mic);
4527 +#endif
4528 +
4529 + return ret;
4530 }
4531
4532 -static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
4533 +static void michael_mic_hdr_rtl7(struct sk_buff *skb, u8 *hdr)
4534 {
4535 struct ieee80211_hdr *hdr11;
4536
4537 @@ -483,7 +506,7 @@
4538 }
4539
4540
4541 -static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv)
4542 +static int ieee80211_michael_mic_add_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
4543 {
4544 struct ieee80211_tkip_data *tkey = priv;
4545 u8 *pos;
4546 @@ -495,9 +518,9 @@
4547 return -1;
4548 }
4549
4550 - michael_mic_hdr(skb, tkey->tx_hdr);
4551 + michael_mic_hdr_rtl7(skb, tkey->tx_hdr);
4552 pos = skb_put(skb, 8);
4553 - if (michael_mic(tkey, &tkey->key[16], tkey->tx_hdr,
4554 + if (michael_mic_rtl7(tkey, &tkey->key[16], tkey->tx_hdr,
4555 skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
4556 return -1;
4557
4558 @@ -506,7 +529,7 @@
4559
4560
4561 #if WIRELESS_EXT >= 18
4562 -static void ieee80211_michael_mic_failure(struct net_device *dev,
4563 +static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
4564 struct ieee80211_hdr *hdr,
4565 int keyidx)
4566 {
4567 @@ -527,7 +550,7 @@
4568 wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev);
4569 }
4570 #elif WIRELESS_EXT >= 15
4571 -static void ieee80211_michael_mic_failure(struct net_device *dev,
4572 +static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
4573 struct ieee80211_hdr *hdr,
4574 int keyidx)
4575 {
4576 @@ -543,7 +566,7 @@
4577 wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
4578 }
4579 #else /* WIRELESS_EXT >= 15 */
4580 -static inline void ieee80211_michael_mic_failure(struct net_device *dev,
4581 +static inline void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
4582 struct ieee80211_hdr *hdr,
4583 int keyidx)
4584 {
4585 @@ -551,7 +574,7 @@
4586 #endif /* WIRELESS_EXT >= 15 */
4587
4588
4589 -static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
4590 +static int ieee80211_michael_mic_verify_rtl7(struct sk_buff *skb, int keyidx,
4591 int hdr_len, void *priv)
4592 {
4593 struct ieee80211_tkip_data *tkey = priv;
4594 @@ -560,8 +583,8 @@
4595 if (!tkey->key_set)
4596 return -1;
4597
4598 - michael_mic_hdr(skb, tkey->rx_hdr);
4599 - if (michael_mic(tkey, &tkey->key[24], tkey->rx_hdr,
4600 + michael_mic_hdr_rtl7(skb, tkey->rx_hdr);
4601 + if (michael_mic_rtl7(tkey, &tkey->key[24], tkey->rx_hdr,
4602 skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
4603 return -1;
4604 if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
4605 @@ -572,7 +595,7 @@
4606 skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2),
4607 keyidx);
4608 if (skb->dev)
4609 - ieee80211_michael_mic_failure(skb->dev, hdr, keyidx);
4610 + ieee80211_michael_mic_failure_rtl7(skb->dev, hdr, keyidx);
4611 tkey->dot11RSNAStatsTKIPLocalMICFailures++;
4612 return -1;
4613 }
4614 @@ -588,7 +611,7 @@
4615 }
4616
4617
4618 -static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
4619 +static int ieee80211_tkip_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
4620 {
4621 struct ieee80211_tkip_data *tkey = priv;
4622 int keyidx;
4623 @@ -618,7 +641,7 @@
4624 }
4625
4626
4627 -static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv)
4628 +static int ieee80211_tkip_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
4629 {
4630 struct ieee80211_tkip_data *tkey = priv;
4631
4632 @@ -648,7 +671,7 @@
4633 }
4634
4635
4636 -static char * ieee80211_tkip_print_stats(char *p, void *priv)
4637 +static char * ieee80211_tkip_print_stats_rtl7(char *p, void *priv)
4638 {
4639 struct ieee80211_tkip_data *tkip = priv;
4640 p += sprintf(p, "key[%d] alg=TKIP key_set=%d "
4641 @@ -675,34 +698,34 @@
4642 }
4643
4644
4645 -static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
4646 +static struct ieee80211_crypto_ops ieee80211_crypt_tkip_rtl7 = {
4647 .name = "TKIP",
4648 - .init = ieee80211_tkip_init,
4649 - .deinit = ieee80211_tkip_deinit,
4650 - .encrypt_mpdu = ieee80211_tkip_encrypt,
4651 - .decrypt_mpdu = ieee80211_tkip_decrypt,
4652 - .encrypt_msdu = ieee80211_michael_mic_add,
4653 - .decrypt_msdu = ieee80211_michael_mic_verify,
4654 - .set_key = ieee80211_tkip_set_key,
4655 - .get_key = ieee80211_tkip_get_key,
4656 - .print_stats = ieee80211_tkip_print_stats,
4657 + .init = ieee80211_tkip_init_rtl7,
4658 + .deinit = ieee80211_tkip_deinit_rtl7,
4659 + .encrypt_mpdu = ieee80211_tkip_encrypt_rtl7,
4660 + .decrypt_mpdu = ieee80211_tkip_decrypt_rtl7,
4661 + .encrypt_msdu = ieee80211_michael_mic_add_rtl7,
4662 + .decrypt_msdu = ieee80211_michael_mic_verify_rtl7,
4663 + .set_key = ieee80211_tkip_set_key_rtl7,
4664 + .get_key = ieee80211_tkip_get_key_rtl7,
4665 + .print_stats = ieee80211_tkip_print_stats_rtl7,
4666 .extra_prefix_len = 4 + 4, /* IV + ExtIV */
4667 .extra_postfix_len = 8 + 4, /* MIC + ICV */
4668 .owner = THIS_MODULE,
4669 };
4670
4671
4672 -static int __init ieee80211_crypto_tkip_init(void)
4673 +static int __init ieee80211_crypto_tkip_init_rtl7(void)
4674 {
4675 - return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip);
4676 + return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
4677 }
4678
4679
4680 -static void __exit ieee80211_crypto_tkip_exit(void)
4681 +static void __exit ieee80211_crypto_tkip_exit_rtl7(void)
4682 {
4683 - ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip);
4684 + ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
4685 }
4686
4687
4688 -module_init(ieee80211_crypto_tkip_init);
4689 -module_exit(ieee80211_crypto_tkip_exit);
4690 +module_init(ieee80211_crypto_tkip_init_rtl7);
4691 +module_exit(ieee80211_crypto_tkip_exit_rtl7);
4692 diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_wep.c rtl8187_txpower/ieee80211/ieee80211_crypt_wep.c
4693 --- rtl8187_orig/ieee80211/ieee80211_crypt_wep.c 2007-03-13 23:45:09.000000000 +0100
4694 +++ rtl8187_txpower/ieee80211/ieee80211_crypt_wep.c 2007-04-23 00:09:00.000000000 +0200
4695 @@ -9,7 +9,6 @@
4696 * more details.
4697 */
4698
4699 -#include <linux/config.h>
4700 #include <linux/version.h>
4701 #include <linux/module.h>
4702 #include <linux/init.h>
4703 @@ -18,13 +17,24 @@
4704 #include <linux/skbuff.h>
4705 #include <asm/string.h>
4706
4707 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
4708 +#include <linux/config.h>
4709 +#else
4710 +#include <linux/autoconf.h>
4711 +#endif
4712 +
4713 #include "ieee80211.h"
4714
4715
4716 #include <linux/crypto.h>
4717 -#include <asm/scatterlist.h>
4718 #include <linux/crc32.h>
4719
4720 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
4721 + #include <asm/scatterlist.h>
4722 +#else
4723 + #include <linux/scatterlist.h>
4724 +#endif
4725 +
4726 MODULE_AUTHOR("Jouni Malinen");
4727 MODULE_DESCRIPTION("Host AP crypt: WEP");
4728 MODULE_LICENSE("GPL");
4729 @@ -40,7 +50,7 @@
4730 };
4731
4732
4733 -static void * prism2_wep_init(int keyidx)
4734 +static void * prism2_wep_init_rtl7(int keyidx)
4735 {
4736 struct prism2_wep_data *priv;
4737
4738 @@ -72,7 +82,7 @@
4739 }
4740
4741
4742 -static void prism2_wep_deinit(void *priv)
4743 +static void prism2_wep_deinit_rtl7(void *priv)
4744 {
4745 struct prism2_wep_data *_priv = priv;
4746 if (_priv && _priv->tfm)
4747 @@ -87,7 +97,7 @@
4748 *
4749 * WEP frame payload: IV + TX key idx, RC4(data), ICV = RC4(CRC32(data))
4750 */
4751 -static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
4752 +static int prism2_wep_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
4753 {
4754 struct prism2_wep_data *wep = priv;
4755 u32 crc, klen, len;
4756 @@ -151,7 +161,7 @@
4757 * Returns 0 if frame was decrypted successfully and ICV was correct and -1 on
4758 * failure. If frame is OK, IV and ICV will be removed.
4759 */
4760 -static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
4761 +static int prism2_wep_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
4762 {
4763 struct prism2_wep_data *wep = priv;
4764 u32 crc, klen, plen;
4765 @@ -203,7 +213,7 @@
4766 }
4767
4768
4769 -static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
4770 +static int prism2_wep_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
4771 {
4772 struct prism2_wep_data *wep = priv;
4773
4774 @@ -217,7 +227,7 @@
4775 }
4776
4777
4778 -static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv)
4779 +static int prism2_wep_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
4780 {
4781 struct prism2_wep_data *wep = priv;
4782
4783 @@ -230,7 +240,7 @@
4784 }
4785
4786
4787 -static char * prism2_wep_print_stats(char *p, void *priv)
4788 +static char * prism2_wep_print_stats_rtl7(char *p, void *priv)
4789 {
4790 struct prism2_wep_data *wep = priv;
4791 p += sprintf(p, "key[%d] alg=WEP len=%d\n",
4792 @@ -239,34 +249,34 @@
4793 }
4794
4795
4796 -static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
4797 +static struct ieee80211_crypto_ops ieee80211_crypt_wep_rtl7 = {
4798 .name = "WEP",
4799 - .init = prism2_wep_init,
4800 - .deinit = prism2_wep_deinit,
4801 - .encrypt_mpdu = prism2_wep_encrypt,
4802 - .decrypt_mpdu = prism2_wep_decrypt,
4803 + .init = prism2_wep_init_rtl7,
4804 + .deinit = prism2_wep_deinit_rtl7,
4805 + .encrypt_mpdu = prism2_wep_encrypt_rtl7,
4806 + .decrypt_mpdu = prism2_wep_decrypt_rtl7,
4807 .encrypt_msdu = NULL,
4808 .decrypt_msdu = NULL,
4809 - .set_key = prism2_wep_set_key,
4810 - .get_key = prism2_wep_get_key,
4811 - .print_stats = prism2_wep_print_stats,
4812 + .set_key = prism2_wep_set_key_rtl7,
4813 + .get_key = prism2_wep_get_key_rtl7,
4814 + .print_stats = prism2_wep_print_stats_rtl7,
4815 .extra_prefix_len = 4, /* IV */
4816 .extra_postfix_len = 4, /* ICV */
4817 .owner = THIS_MODULE,
4818 };
4819
4820
4821 -static int __init ieee80211_crypto_wep_init(void)
4822 +static int __init ieee80211_crypto_wep_init_rtl7(void)
4823 {
4824 - return ieee80211_register_crypto_ops(&ieee80211_crypt_wep);
4825 + return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
4826 }
4827
4828
4829 -static void __exit ieee80211_crypto_wep_exit(void)
4830 +static void __exit ieee80211_crypto_wep_exit_rtl7(void)
4831 {
4832 - ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep);
4833 + ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
4834 }
4835
4836
4837 -module_init(ieee80211_crypto_wep_init);
4838 -module_exit(ieee80211_crypto_wep_exit);
4839 +module_init(ieee80211_crypto_wep_init_rtl7);
4840 +module_exit(ieee80211_crypto_wep_exit_rtl7);
4841 diff -Naur rtl8187_orig/ieee80211/ieee80211.h rtl8187_txpower/ieee80211/ieee80211.h
4842 --- rtl8187_orig/ieee80211/ieee80211.h 2007-03-13 23:45:09.000000000 +0100
4843 +++ rtl8187_txpower/ieee80211/ieee80211.h 2007-04-23 00:09:03.000000000 +0200
4844 @@ -156,6 +156,22 @@
4845 struct list_head list;
4846 };
4847
4848 +#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
4849 +/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
4850 + * (from linux-wlan-ng) */
4851 +struct linux_wlan_ng_val {
4852 + u32 did;
4853 + u16 status, len;
4854 + u32 data;
4855 +} __attribute__ ((packed));
4856 +
4857 +struct linux_wlan_ng_prism_hdr {
4858 + u32 msgcode, msglen;
4859 + char devname[16];
4860 + struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
4861 + noise, rate, istx, frmlen;
4862 +} __attribute__ ((packed));
4863 +
4864 struct ieee80211_hdr {
4865 u16 frame_ctl;
4866 u16 duration_id;
4867 @@ -840,14 +856,14 @@
4868
4869
4870 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
4871 -extern inline int is_multicast_ether_addr(const u8 *addr)
4872 +extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
4873 {
4874 return ((addr[0] != 0xff) && (0x01 & addr[0]));
4875 }
4876 #endif
4877
4878 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
4879 -extern inline int is_broadcast_ether_addr(const u8 *addr)
4880 +extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
4881 {
4882 return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
4883 (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
4884 @@ -1015,10 +1031,16 @@
4885 struct timer_list beacon_timer;
4886
4887 struct work_struct associate_complete_wq;
4888 +
4889 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
4890 + struct delayed_work associate_retry_wq;
4891 + struct delayed_work softmac_scan_wq;
4892 +#else
4893 struct work_struct associate_retry_wq;
4894 + struct work_struct softmac_scan_wq;
4895 +#endif
4896 struct work_struct start_ibss_wq;
4897 struct work_struct associate_procedure_wq;
4898 - struct work_struct softmac_scan_wq;
4899 struct work_struct wx_sync_scan_wq;
4900
4901 struct workqueue_struct *wq;
4902 @@ -1154,12 +1176,12 @@
4903
4904
4905
4906 -extern inline void *ieee80211_priv(struct net_device *dev)
4907 +extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
4908 {
4909 return ((struct ieee80211_device *)netdev_priv(dev))->priv;
4910 }
4911
4912 -extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
4913 +extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
4914 {
4915 /* Single white space is for Linksys APs */
4916 if (essid_len == 1 && essid[0] == ' ')
4917 @@ -1175,7 +1197,7 @@
4918 return 1;
4919 }
4920
4921 -extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
4922 +extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
4923 {
4924 /*
4925 * It is possible for both access points and our device to support
4926 @@ -1201,7 +1223,7 @@
4927 return 0;
4928 }
4929
4930 -extern inline int ieee80211_get_hdrlen(u16 fc)
4931 +extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
4932 {
4933 int hdrlen = 24;
4934
4935 @@ -1229,140 +1251,144 @@
4936
4937
4938 /* ieee80211.c */
4939 -extern void free_ieee80211(struct net_device *dev);
4940 -extern struct net_device *alloc_ieee80211(int sizeof_priv);
4941 +extern void free_ieee80211_rtl7(struct net_device *dev);
4942 +extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
4943
4944 -extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
4945 +extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
4946
4947 /* ieee80211_tx.c */
4948
4949 -extern int ieee80211_encrypt_fragment(
4950 +extern int ieee80211_encrypt_fragment_rtl7(
4951 struct ieee80211_device *ieee,
4952 struct sk_buff *frag,
4953 int hdr_len);
4954
4955 -extern int ieee80211_xmit(struct sk_buff *skb,
4956 +extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
4957 struct net_device *dev);
4958 -extern void ieee80211_txb_free(struct ieee80211_txb *);
4959 +extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
4960
4961
4962 /* ieee80211_rx.c */
4963 -extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
4964 +extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
4965 struct ieee80211_rx_stats *rx_stats);
4966 -extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
4967 +extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
4968 struct ieee80211_hdr *header,
4969 struct ieee80211_rx_stats *stats);
4970
4971 /* ieee80211_wx.c */
4972 -extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
4973 +extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
4974 struct iw_request_info *info,
4975 union iwreq_data *wrqu, char *key);
4976 -extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
4977 +extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
4978 struct iw_request_info *info,
4979 union iwreq_data *wrqu, char *key);
4980 -extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
4981 +extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
4982 struct iw_request_info *info,
4983 union iwreq_data *wrqu, char *key);
4984 /* ieee80211_softmac.c */
4985 -extern short ieee80211_is_54g(struct ieee80211_network net);
4986 -extern short ieee80211_is_shortslot(struct ieee80211_network net);
4987 -extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
4988 +extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
4989 +extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
4990 +extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
4991 struct ieee80211_rx_stats *rx_stats, u16 type,
4992 u16 stype);
4993 -extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
4994 +extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
4995
4996 -extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
4997 -extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
4998 -extern void ieee80211_start_bss(struct ieee80211_device *ieee);
4999 -extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
5000 -extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
5001 -extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
5002 -extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
5003 -extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
5004 -extern void ieee80211_disassociate(struct ieee80211_device *ieee);
5005 -extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
5006 -extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
5007 -extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
5008 -extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
5009 -extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
5010 -extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
5011 -extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
5012 -extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
5013 -extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
5014 -extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
5015 -extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
5016 -extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
5017 -extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
5018 -extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
5019 -extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
5020 -extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
5021 +extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
5022 +extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
5023 +extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
5024 +extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
5025 +extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
5026 +extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
5027 +extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
5028 +extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
5029 +extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
5030 +extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
5031 +extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
5032 +extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
5033 +extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
5034 +extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
5035 +extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
5036 +extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
5037 +extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
5038 +extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
5039 +extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
5040 +extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
5041 +extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
5042 +extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
5043 +extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
5044 +extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
5045 +extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
5046
5047 /* ieee80211_softmac_wx.c */
5048
5049 -extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
5050 +extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
5051 struct iw_request_info *info,
5052 union iwreq_data *wrqu, char *ext);
5053
5054 -extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
5055 +extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
5056 struct iw_request_info *info,
5057 union iwreq_data *awrq,
5058 char *extra);
5059
5060 -extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
5061 +extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
5062
5063 -extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
5064 +extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
5065 struct iw_request_info *info,
5066 union iwreq_data *wrqu, char *extra);
5067
5068 -extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
5069 +extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
5070 struct iw_request_info *info,
5071 union iwreq_data *wrqu, char *extra);
5072
5073 -extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
5074 +extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
5075 union iwreq_data *wrqu, char *b);
5076
5077 -extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
5078 +extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
5079 union iwreq_data *wrqu, char *b);
5080
5081 -extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
5082 +extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
5083 struct iw_request_info *a,
5084 union iwreq_data *wrqu, char *extra);
5085
5086 -extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
5087 +extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
5088 union iwreq_data *wrqu, char *b);
5089
5090 -extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
5091 +extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
5092 union iwreq_data *wrqu, char *b);
5093
5094 -extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
5095 +extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
5096 union iwreq_data *wrqu, char *b);
5097
5098 -extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
5099 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
5100 +extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
5101 +#else
5102 +extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
5103 +#endif
5104
5105 -extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
5106 +extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
5107 struct iw_request_info *info,
5108 union iwreq_data *wrqu, char *extra);
5109
5110 -extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
5111 +extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
5112 struct iw_request_info *info,
5113 union iwreq_data *wrqu, char *extra);
5114
5115 -extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
5116 +extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
5117 struct iw_request_info *info,
5118 union iwreq_data *wrqu, char *extra);
5119
5120 -extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
5121 +extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
5122 struct iw_request_info *info,
5123 union iwreq_data *wrqu, char *extra);
5124
5125 -extern const long ieee80211_wlan_frequencies[];
5126 +extern const long ieee80211_wlan_frequencies_rtl7[];
5127
5128 -extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
5129 +extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
5130 {
5131 ieee->scans++;
5132 }
5133
5134 -extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
5135 +extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
5136 {
5137 return ieee->scans;
5138 }
5139 @@ -1372,7 +1398,7 @@
5140 const char *s = essid;
5141 char *d = escaped;
5142
5143 - if (ieee80211_is_empty_essid(essid, essid_len)) {
5144 + if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
5145 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
5146 return escaped;
5147 }
5148 diff -Naur rtl8187_orig/ieee80211/ieee80211_module.c rtl8187_txpower/ieee80211/ieee80211_module.c
5149 --- rtl8187_orig/ieee80211/ieee80211_module.c 2007-03-13 23:45:09.000000000 +0100
5150 +++ rtl8187_txpower/ieee80211/ieee80211_module.c 2007-04-23 00:09:00.000000000 +0200
5151 @@ -31,7 +31,6 @@
5152 *******************************************************************************/
5153
5154 #include <linux/compiler.h>
5155 -#include <linux/config.h>
5156 #include <linux/errno.h>
5157 #include <linux/if_arp.h>
5158 #include <linux/in6.h>
5159 @@ -52,6 +51,12 @@
5160 #include <asm/uaccess.h>
5161 #include <net/arp.h>
5162
5163 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
5164 +#include <linux/config.h>
5165 +#else
5166 +#include <linux/autoconf.h>
5167 +#endif
5168 +
5169 #include "ieee80211.h"
5170
5171 MODULE_DESCRIPTION("802.11 data/management/control stack");
5172 @@ -60,7 +65,7 @@
5173
5174 #define DRV_NAME "ieee80211"
5175
5176 -static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
5177 +static inline int ieee80211_networks_allocate_rtl7(struct ieee80211_device *ieee)
5178 {
5179 if (ieee->networks)
5180 return 0;
5181 @@ -80,7 +85,7 @@
5182 return 0;
5183 }
5184
5185 -static inline void ieee80211_networks_free(struct ieee80211_device *ieee)
5186 +static inline void ieee80211_networks_free_rtl7(struct ieee80211_device *ieee)
5187 {
5188 if (!ieee->networks)
5189 return;
5190 @@ -88,7 +93,7 @@
5191 ieee->networks = NULL;
5192 }
5193
5194 -static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee)
5195 +static inline void ieee80211_networks_initialize_rtl7(struct ieee80211_device *ieee)
5196 {
5197 int i;
5198
5199 @@ -99,7 +104,7 @@
5200 }
5201
5202
5203 -struct net_device *alloc_ieee80211(int sizeof_priv)
5204 +struct net_device *alloc_ieee80211_rtl7(int sizeof_priv)
5205 {
5206 struct ieee80211_device *ieee;
5207 struct net_device *dev;
5208 @@ -113,17 +118,17 @@
5209 goto failed;
5210 }
5211 ieee = netdev_priv(dev);
5212 - dev->hard_start_xmit = ieee80211_xmit;
5213 + dev->hard_start_xmit = ieee80211_xmit_rtl7;
5214
5215 ieee->dev = dev;
5216
5217 - err = ieee80211_networks_allocate(ieee);
5218 + err = ieee80211_networks_allocate_rtl7(ieee);
5219 if (err) {
5220 IEEE80211_ERROR("Unable to allocate beacon storage: %d\n",
5221 err);
5222 goto failed;
5223 }
5224 - ieee80211_networks_initialize(ieee);
5225 + ieee80211_networks_initialize_rtl7(ieee);
5226
5227 /* Default fragmentation threshold is maximum payload size */
5228 ieee->fts = DEFAULT_FTS;
5229 @@ -138,7 +143,7 @@
5230 INIT_LIST_HEAD(&ieee->crypt_deinit_list);
5231 init_timer(&ieee->crypt_deinit_timer);
5232 ieee->crypt_deinit_timer.data = (unsigned long)ieee;
5233 - ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler;
5234 + ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler_rtl7;
5235
5236 spin_lock_init(&ieee->lock);
5237
5238 @@ -149,7 +154,7 @@
5239 ieee->ieee802_1x = 1;
5240 ieee->raw_tx = 0;
5241
5242 - ieee80211_softmac_init(ieee);
5243 + ieee80211_softmac_init_rtl7(ieee);
5244
5245 for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++)
5246 INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]);
5247 @@ -167,7 +172,7 @@
5248 }
5249
5250
5251 -void free_ieee80211(struct net_device *dev)
5252 +void free_ieee80211_rtl7(struct net_device *dev)
5253 {
5254 struct ieee80211_device *ieee = netdev_priv(dev);
5255
5256 @@ -175,9 +180,9 @@
5257 struct list_head *p, *q;
5258
5259
5260 - ieee80211_softmac_free(ieee);
5261 + ieee80211_softmac_free_rtl7(ieee);
5262 del_timer_sync(&ieee->crypt_deinit_timer);
5263 - ieee80211_crypt_deinit_entries(ieee, 1);
5264 + ieee80211_crypt_deinit_entries_rtl7(ieee, 1);
5265
5266 for (i = 0; i < WEP_KEYS; i++) {
5267 struct ieee80211_crypt_data *crypt = ieee->crypt[i];
5268 @@ -191,7 +196,7 @@
5269 }
5270 }
5271
5272 - ieee80211_networks_free(ieee);
5273 + ieee80211_networks_free_rtl7(ieee);
5274
5275 for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) {
5276 list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) {
5277 @@ -210,13 +215,13 @@
5278 u32 ieee80211_debug_level = 0;
5279 struct proc_dir_entry *ieee80211_proc = NULL;
5280
5281 -static int show_debug_level(char *page, char **start, off_t offset,
5282 +static int show_debug_level_rtl7(char *page, char **start, off_t offset,
5283 int count, int *eof, void *data)
5284 {
5285 return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
5286 }
5287
5288 -static int store_debug_level(struct file *file, const char *buffer,
5289 +static int store_debug_level_rtl7(struct file *file, const char *buffer,
5290 unsigned long count, void *data)
5291 {
5292 char buf[] = "0x00000000";
5293 @@ -243,7 +248,7 @@
5294 return strnlen(buf, count);
5295 }
5296
5297 -static int __init ieee80211_init(void)
5298 +static int __init ieee80211_init_rtl7(void)
5299 {
5300 struct proc_dir_entry *e;
5301
5302 @@ -268,7 +273,7 @@
5303 return 0;
5304 }
5305
5306 -static void __exit ieee80211_exit(void)
5307 +static void __exit ieee80211_exit_rtl7(void)
5308 {
5309 if (ieee80211_proc) {
5310 remove_proc_entry("debug_level", ieee80211_proc);
5311 @@ -282,9 +287,9 @@
5312 MODULE_PARM_DESC(debug, "debug output mask");
5313
5314
5315 -module_exit(ieee80211_exit);
5316 -module_init(ieee80211_init);
5317 +module_exit(ieee80211_exit_rtl7);
5318 +module_init(ieee80211_init_rtl7);
5319 #endif
5320
5321 -EXPORT_SYMBOL(alloc_ieee80211);
5322 -EXPORT_SYMBOL(free_ieee80211);
5323 +EXPORT_SYMBOL(alloc_ieee80211_rtl7);
5324 +EXPORT_SYMBOL(free_ieee80211_rtl7);
5325 diff -Naur rtl8187_orig/ieee80211/ieee80211_rx.c rtl8187_txpower/ieee80211/ieee80211_rx.c
5326 --- rtl8187_orig/ieee80211/ieee80211_rx.c 2007-03-13 23:45:09.000000000 +0100
5327 +++ rtl8187_txpower/ieee80211/ieee80211_rx.c 2007-04-23 00:09:00.000000000 +0200
5328 @@ -22,7 +22,6 @@
5329
5330
5331 #include <linux/compiler.h>
5332 -#include <linux/config.h>
5333 #include <linux/errno.h>
5334 #include <linux/if_arp.h>
5335 #include <linux/in6.h>
5336 @@ -43,18 +42,85 @@
5337 #include <asm/uaccess.h>
5338 #include <linux/ctype.h>
5339
5340 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
5341 +#include <linux/config.h>
5342 +#else
5343 +#include <linux/autoconf.h>
5344 +#endif
5345 +
5346 +
5347 #include "ieee80211.h"
5348
5349 -static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
5350 +static inline void ieee80211_monitor_rx_rtl7(struct ieee80211_device *ieee,
5351 struct sk_buff *skb,
5352 struct ieee80211_rx_stats *rx_stats)
5353 {
5354 - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
5355 - u16 fc = le16_to_cpu(hdr->frame_ctl);
5356 + struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data;
5357 + u16 fc = le16_to_cpu(hdr1->frame_ctl);
5358 + int prism_header;
5359 + int hdrlen, phdrlen, head_need, tail_need;
5360 +
5361 + if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) {
5362 + prism_header = 1;
5363 + phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
5364 + } else {
5365 + prism_header = 0;
5366 + phdrlen = 0;
5367 + }
5368 +
5369 + hdrlen = ieee80211_get_hdrlen_rtl7(fc);
5370 +
5371 + /* check if there is enough room for extra data; if not, expand skb
5372 + * buffer to be large enough for the changes */
5373 + head_need = phdrlen;
5374 + tail_need = 0;
5375 +#ifdef PRISM2_ADD_BOGUS_CRC
5376 + tail_need += 4;
5377 +#endif /* PRISM2_ADD_BOGUS_CRC */
5378 +
5379 + head_need -= skb_headroom(skb);
5380 + tail_need -= skb_tailroom(skb);
5381 +
5382 + if (head_need > 0 || tail_need > 0) {
5383 + if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
5384 + tail_need > 0 ? tail_need : 0,
5385 + GFP_ATOMIC)) {
5386 + printk(KERN_DEBUG "%s: ieee80211_rx failed to "
5387 + "reallocate skb buffer\n", ieee->dev->name);
5388 + dev_kfree_skb_any(skb);
5389 + return;
5390 + }
5391 + }
5392 +
5393 + if (prism_header == 1) {
5394 + struct linux_wlan_ng_prism_hdr *hdr;
5395 + hdr = (struct linux_wlan_ng_prism_hdr *)
5396 + skb_push(skb, phdrlen);
5397 + memset(hdr, 0, phdrlen);
5398 + hdr->msgcode = LWNG_CAP_DID_BASE;
5399 + hdr->msglen = sizeof(*hdr);
5400 + memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname));
5401 +#define LWNG_SETVAL(f,i,s,l,d) \
5402 +hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
5403 +hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
5404 + LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
5405 + LWNG_SETVAL(mactime, 2, 0, 4, ((u32)rx_stats->mac_time));
5406 + LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
5407 + LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
5408 + LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
5409 + LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
5410 + LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
5411 + LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
5412 + LWNG_SETVAL(istx, 9, 0, 4, 0);
5413 + LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
5414 +#undef LWNG_SETVAL
5415 + }
5416
5417 skb->dev = ieee->dev;
5418 skb->mac.raw = skb->data;
5419 - skb_pull(skb, ieee80211_get_hdrlen(fc));
5420 + skb_pull(skb, hdrlen);
5421 + if (prism_header)
5422 + skb_pull(skb, phdrlen);
5423 skb->pkt_type = PACKET_OTHERHOST;
5424 skb->protocol = __constant_htons(ETH_P_80211_RAW);
5425 memset(skb->cb, 0, sizeof(skb->cb));
5426 @@ -64,7 +130,7 @@
5427
5428 /* Called only as a tasklet (software IRQ) */
5429 static struct ieee80211_frag_entry *
5430 -ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq,
5431 +ieee80211_frag_cache_find_rtl7(struct ieee80211_device *ieee, unsigned int seq,
5432 unsigned int frag, u8 *src, u8 *dst)
5433 {
5434 struct ieee80211_frag_entry *entry;
5435 @@ -94,7 +160,7 @@
5436
5437 /* Called only as a tasklet (software IRQ) */
5438 static struct sk_buff *
5439 -ieee80211_frag_cache_get(struct ieee80211_device *ieee,
5440 +ieee80211_frag_cache_get_rtl7(struct ieee80211_device *ieee,
5441 struct ieee80211_hdr *hdr)
5442 {
5443 struct sk_buff *skb = NULL;
5444 @@ -133,7 +199,7 @@
5445 } else {
5446 /* received a fragment of a frame for which the head fragment
5447 * should have already been received */
5448 - entry = ieee80211_frag_cache_find(ieee, seq, frag, hdr->addr2,
5449 + entry = ieee80211_frag_cache_find_rtl7(ieee, seq, frag, hdr->addr2,
5450 hdr->addr1);
5451 if (entry != NULL) {
5452 entry->last_frag = frag;
5453 @@ -146,7 +212,7 @@
5454
5455
5456 /* Called only as a tasklet (software IRQ) */
5457 -static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee,
5458 +static int ieee80211_frag_cache_invalidate_rtl7(struct ieee80211_device *ieee,
5459 struct ieee80211_hdr *hdr)
5460 {
5461 u16 sc;
5462 @@ -156,7 +222,7 @@
5463 sc = le16_to_cpu(hdr->seq_ctl);
5464 seq = WLAN_GET_SEQ_SEQ(sc);
5465
5466 - entry = ieee80211_frag_cache_find(ieee, seq, -1, hdr->addr2,
5467 + entry = ieee80211_frag_cache_find_rtl7(ieee, seq, -1, hdr->addr2,
5468 hdr->addr1);
5469
5470 if (entry == NULL) {
5471 @@ -178,7 +244,7 @@
5472 *
5473 * Called by ieee80211_rx */
5474 static inline int
5475 -ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
5476 +ieee80211_rx_frame_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
5477 struct ieee80211_rx_stats *rx_stats, u16 type,
5478 u16 stype)
5479 {
5480 @@ -187,8 +253,8 @@
5481 * response parser uses it
5482 */
5483 rx_stats->len = skb->len;
5484 - ieee80211_rx_mgt(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
5485 - ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype);
5486 + ieee80211_rx_mgt_rtl7(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
5487 + ieee80211_rx_frame_softmac_rtl7(ieee, skb, rx_stats, type, stype);
5488
5489 dev_kfree_skb_any(skb);
5490
5491 @@ -253,7 +319,7 @@
5492 /* No encapsulation header if EtherType < 0x600 (=length) */
5493
5494 /* Called by ieee80211_rx_frame_decrypt */
5495 -static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee,
5496 +static int ieee80211_is_eapol_frame_rtl7(struct ieee80211_device *ieee,
5497 struct sk_buff *skb)
5498 {
5499 struct net_device *dev = ieee->dev;
5500 @@ -294,7 +360,7 @@
5501
5502 /* Called only as a tasklet (software IRQ), by ieee80211_rx */
5503 static inline int
5504 -ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb,
5505 +ieee80211_rx_frame_decrypt_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
5506 struct ieee80211_crypt_data *crypt)
5507 {
5508 struct ieee80211_hdr *hdr;
5509 @@ -304,7 +370,7 @@
5510 return 0;
5511
5512 hdr = (struct ieee80211_hdr *) skb->data;
5513 - hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
5514 + hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
5515
5516 #ifdef CONFIG_IEEE80211_CRYPT_TKIP
5517 if (ieee->tkip_countermeasures &&
5518 @@ -339,7 +405,7 @@
5519
5520 /* Called only as a tasklet (software IRQ), by ieee80211_rx */
5521 static inline int
5522 -ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb,
5523 +ieee80211_rx_frame_decrypt_msdu_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
5524 int keyidx, struct ieee80211_crypt_data *crypt)
5525 {
5526 struct ieee80211_hdr *hdr;
5527 @@ -349,7 +415,7 @@
5528 return 0;
5529
5530 hdr = (struct ieee80211_hdr *) skb->data;
5531 - hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
5532 + hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
5533
5534 atomic_inc(&crypt->refcnt);
5535 res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
5536 @@ -367,7 +433,7 @@
5537
5538 /* this function is stolen from ipw2200 driver*/
5539 #define IEEE_PACKET_RETRY_TIME (5*HZ)
5540 -static int is_duplicate_packet(struct ieee80211_device *ieee,
5541 +static int is_duplicate_packet_rtl7(struct ieee80211_device *ieee,
5542 struct ieee80211_hdr *header)
5543 {
5544 // u16 fc = le16_to_cpu(header->frame_ctl);
5545 @@ -444,7 +510,7 @@
5546 /* All received frames are sent to this function. @skb contains the frame in
5547 * IEEE 802.11 format, i.e., in the format it was sent over air.
5548 * This function is called only as a tasklet (software IRQ). */
5549 -int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
5550 +int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
5551 struct ieee80211_rx_stats *rx_stats)
5552 {
5553 struct net_device *dev = ieee->dev;
5554 @@ -483,7 +549,7 @@
5555 sc = le16_to_cpu(hdr->seq_ctl);
5556
5557 frag = WLAN_GET_SEQ_FRAG(sc);
5558 - hdrlen = ieee80211_get_hdrlen(fc);
5559 + hdrlen = ieee80211_get_hdrlen_rtl7(fc);
5560
5561 #ifdef NOT_YET
5562 #if WIRELESS_EXT > 15
5563 @@ -501,12 +567,12 @@
5564 }
5565 #endif /* IW_WIRELESS_SPY */
5566 #endif /* WIRELESS_EXT > 15 */
5567 - hostap_update_rx_stats(local->ap, hdr, rx_stats);
5568 + hostap_update_rx_stats_rtl7(local->ap, hdr, rx_stats);
5569 #endif
5570
5571 #if WIRELESS_EXT > 15
5572 if (ieee->iw_mode == IW_MODE_MONITOR) {
5573 - ieee80211_monitor_rx(ieee, skb, rx_stats);
5574 + ieee80211_monitor_rx_rtl7(ieee, skb, rx_stats);
5575 stats->rx_packets++;
5576 stats->rx_bytes += skb->len;
5577 return 1;
5578 @@ -529,7 +595,7 @@
5579 * stations that do not support WEP key mapping). */
5580
5581 if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key)
5582 - (void) hostap_handle_sta_crypto(local, hdr, &crypt,
5583 + (void) hostap_handle_sta_crypto_rtl7(local, hdr, &crypt,
5584 &sta);
5585 #endif
5586
5587 @@ -555,7 +621,7 @@
5588 if (skb->len < IEEE80211_DATA_HDR3_LEN)
5589 goto rx_dropped;
5590
5591 - if (is_duplicate_packet(ieee, hdr))
5592 + if (is_duplicate_packet_rtl7(ieee, hdr))
5593 goto rx_dropped;
5594
5595
5596 @@ -575,7 +641,7 @@
5597 #endif
5598
5599
5600 - if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype))
5601 + if (ieee80211_rx_frame_mgmt_rtl7(ieee, skb, rx_stats, type, stype))
5602 goto rx_dropped;
5603 else
5604 goto rx_exit;
5605 @@ -606,7 +672,7 @@
5606 }
5607
5608 #ifdef NOT_YET
5609 - if (hostap_rx_frame_wds(ieee, hdr, fc, &wds))
5610 + if (hostap_rx_frame_wds_rtl7(ieee, hdr, fc, &wds))
5611 goto rx_dropped;
5612 if (wds) {
5613 skb->dev = dev = wds;
5614 @@ -619,7 +685,7 @@
5615 memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) {
5616 /* Frame from BSSID of the AP for which we are a client */
5617 skb->dev = dev = ieee->stadev;
5618 - stats = hostap_get_stats(dev);
5619 + stats = hostap_get_stats_rtl7(dev);
5620 from_assoc_ap = 1;
5621 }
5622 #endif
5623 @@ -630,7 +696,7 @@
5624 if ((ieee->iw_mode == IW_MODE_MASTER ||
5625 ieee->iw_mode == IW_MODE_REPEAT) &&
5626 !from_assoc_ap) {
5627 - switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats,
5628 + switch (hostap_handle_sta_rx_rtl7(ieee, dev, skb, rx_stats,
5629 wds != NULL)) {
5630 case AP_RX_CONTINUE_NOT_AUTHORIZED:
5631 frame_authorized = 0;
5632 @@ -664,7 +730,7 @@
5633 /* skb: hdr + (possibly fragmented, possibly encrypted) payload */
5634
5635 if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
5636 - (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0)
5637 + (keyidx = ieee80211_rx_frame_decrypt_rtl7(ieee, skb, crypt)) < 0)
5638 goto rx_dropped;
5639
5640 hdr = (struct ieee80211_hdr *) skb->data;
5641 @@ -674,7 +740,7 @@
5642 // ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
5643 if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) {
5644 int flen;
5645 - struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr);
5646 + struct sk_buff *frag_skb = ieee80211_frag_cache_get_rtl7(ieee, hdr);
5647 IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag);
5648
5649 if (!frag_skb) {
5650 @@ -694,7 +760,7 @@
5651 printk(KERN_WARNING "%s: host decrypted and "
5652 "reassembled frame did not fit skb\n",
5653 dev->name);
5654 - ieee80211_frag_cache_invalidate(ieee, hdr);
5655 + ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
5656 goto rx_dropped;
5657 }
5658
5659 @@ -722,19 +788,19 @@
5660 * delivered, so remove skb from fragment cache */
5661 skb = frag_skb;
5662 hdr = (struct ieee80211_hdr *) skb->data;
5663 - ieee80211_frag_cache_invalidate(ieee, hdr);
5664 + ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
5665 }
5666
5667 /* skb: hdr + (possible reassembled) full MSDU payload; possibly still
5668 * encrypted/authenticated */
5669 if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
5670 - ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt))
5671 + ieee80211_rx_frame_decrypt_msdu_rtl7(ieee, skb, keyidx, crypt))
5672 goto rx_dropped;
5673
5674 hdr = (struct ieee80211_hdr *) skb->data;
5675 if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) {
5676 if (/*ieee->ieee802_1x &&*/
5677 - ieee80211_is_eapol_frame(ieee, skb)) {
5678 + ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
5679 #ifdef CONFIG_IEEE80211_DEBUG
5680 /* pass unencrypted EAPOL frames even if encryption is
5681 * configured */
5682 @@ -763,7 +829,7 @@
5683 #endif
5684
5685 if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep &&
5686 - !ieee80211_is_eapol_frame(ieee, skb)) {
5687 + !ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
5688 IEEE80211_DEBUG_DROP(
5689 "dropped unencrypted RX data "
5690 "frame from " MAC_FMT
5691 @@ -896,7 +962,7 @@
5692
5693 #define MGMT_FRAME_FIXED_PART_LENGTH 0x24
5694
5695 -static inline int ieee80211_is_ofdm_rate(u8 rate)
5696 +static inline int ieee80211_is_ofdm_rate_rtl7(u8 rate)
5697 {
5698 switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
5699 case IEEE80211_OFDM_RATE_6MB:
5700 @@ -913,7 +979,7 @@
5701 }
5702
5703
5704 -static inline int ieee80211_network_init(
5705 +static inline int ieee80211_network_init_rtl7(
5706 struct ieee80211_device *ieee,
5707 struct ieee80211_probe_response *beacon,
5708 struct ieee80211_network *network,
5709 @@ -964,7 +1030,7 @@
5710
5711 switch (info_element->id) {
5712 case MFIE_TYPE_SSID:
5713 - if (ieee80211_is_empty_essid(info_element->data,
5714 + if (ieee80211_is_empty_essid_rtl7(info_element->data,
5715 info_element->len)) {
5716 network->flags |= NETWORK_EMPTY_ESSID;
5717 break;
5718 @@ -991,7 +1057,7 @@
5719 #ifdef CONFIG_IEEE80211_DEBUG
5720 p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
5721 #endif
5722 - if (ieee80211_is_ofdm_rate(info_element->data[i])) {
5723 + if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
5724 network->flags |= NETWORK_HAS_OFDM;
5725 if (info_element->data[i] &
5726 IEEE80211_BASIC_RATE_MASK)
5727 @@ -1014,7 +1080,7 @@
5728 #ifdef CONFIG_IEEE80211_DEBUG
5729 p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
5730 #endif
5731 - if (ieee80211_is_ofdm_rate(info_element->data[i])) {
5732 + if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
5733 network->flags |= NETWORK_HAS_OFDM;
5734 if (info_element->data[i] &
5735 IEEE80211_BASIC_RATE_MASK)
5736 @@ -1147,7 +1213,7 @@
5737 return 1;
5738 }
5739
5740 - if (ieee80211_is_empty_essid(network->ssid, network->ssid_len))
5741 + if (ieee80211_is_empty_essid_rtl7(network->ssid, network->ssid_len))
5742 network->flags |= NETWORK_EMPTY_ESSID;
5743
5744 memcpy(&network->stats, stats, sizeof(network->stats));
5745 @@ -1155,7 +1221,7 @@
5746 return 0;
5747 }
5748
5749 -static inline int is_same_network(struct ieee80211_network *src,
5750 +static inline int is_same_network_rtl7(struct ieee80211_network *src,
5751 struct ieee80211_network *dst)
5752 {
5753 /* A network is only a duplicate if the channel, BSSID, ESSID
5754 @@ -1172,7 +1238,7 @@
5755 (dst->capability & WLAN_CAPABILITY_BSS)));
5756 }
5757
5758 -static inline void update_network(struct ieee80211_network *dst,
5759 +static inline void update_network_rtl7(struct ieee80211_network *dst,
5760 struct ieee80211_network *src)
5761 {
5762 memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats));
5763 @@ -1204,7 +1270,7 @@
5764 /* dst->last_associate is not overwritten */
5765 }
5766
5767 -static inline void ieee80211_process_probe_response(
5768 +static inline void ieee80211_process_probe_response_rtl7(
5769 struct ieee80211_device *ieee,
5770 struct ieee80211_probe_response *beacon,
5771 struct ieee80211_rx_stats *stats)
5772 @@ -1239,7 +1305,7 @@
5773 (beacon->capability & (1<<0x1)) ? '1' : '0',
5774 (beacon->capability & (1<<0x0)) ? '1' : '0');
5775
5776 - if (ieee80211_network_init(ieee, beacon, &network, stats)) {
5777 + if (ieee80211_network_init_rtl7(ieee, beacon, &network, stats)) {
5778 IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n",
5779 escape_essid(info_element->data,
5780 info_element->len),
5781 @@ -1262,11 +1328,11 @@
5782
5783 spin_lock_irqsave(&ieee->lock, flags);
5784
5785 - if(is_same_network(&ieee->current_network, &network))
5786 - update_network(&ieee->current_network, &network);
5787 + if(is_same_network_rtl7(&ieee->current_network, &network))
5788 + update_network_rtl7(&ieee->current_network, &network);
5789
5790 list_for_each_entry(target, &ieee->network_list, list) {
5791 - if (is_same_network(target, &network))
5792 + if (is_same_network_rtl7(target, &network))
5793 break;
5794
5795 if ((oldest == NULL) ||
5796 @@ -1306,7 +1372,7 @@
5797 memcpy(target, &network, sizeof(*target));
5798 list_add_tail(&target->list, &ieee->network_list);
5799 if(ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)
5800 - ieee80211_softmac_new_net(ieee,&network);
5801 + ieee80211_softmac_new_net_rtl7(ieee,&network);
5802 } else {
5803 IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n",
5804 escape_essid(target->ssid,
5805 @@ -1321,15 +1387,15 @@
5806 * net and call the new_net handler
5807 */
5808 renew = !time_after(target->last_scanned + ieee->scan_age, jiffies);
5809 - update_network(target, &network);
5810 + update_network_rtl7(target, &network);
5811 if(renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE))
5812 - ieee80211_softmac_new_net(ieee,&network);
5813 + ieee80211_softmac_new_net_rtl7(ieee,&network);
5814 }
5815
5816 spin_unlock_irqrestore(&ieee->lock, flags);
5817 }
5818
5819 -void ieee80211_rx_mgt(struct ieee80211_device *ieee,
5820 +void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
5821 struct ieee80211_hdr *header,
5822 struct ieee80211_rx_stats *stats)
5823 {
5824 @@ -1339,7 +1405,7 @@
5825 IEEE80211_DEBUG_MGMT("received BEACON (%d)\n",
5826 WLAN_FC_GET_STYPE(header->frame_ctl));
5827 IEEE80211_DEBUG_SCAN("Beacon\n");
5828 - ieee80211_process_probe_response(
5829 + ieee80211_process_probe_response_rtl7(
5830 ieee, (struct ieee80211_probe_response *)header, stats);
5831 break;
5832
5833 @@ -1347,7 +1413,7 @@
5834 IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n",
5835 WLAN_FC_GET_STYPE(header->frame_ctl));
5836 IEEE80211_DEBUG_SCAN("Probe response\n");
5837 - ieee80211_process_probe_response(
5838 + ieee80211_process_probe_response_rtl7(
5839 ieee, (struct ieee80211_probe_response *)header, stats);
5840 break;
5841
5842 @@ -1355,5 +1421,5 @@
5843 }
5844
5845
5846 -EXPORT_SYMBOL(ieee80211_rx_mgt);
5847 -EXPORT_SYMBOL(ieee80211_rx);
5848 +EXPORT_SYMBOL(ieee80211_rx_mgt_rtl7);
5849 +EXPORT_SYMBOL(ieee80211_rx_rtl7);
5850 diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac.c rtl8187_txpower/ieee80211/ieee80211_softmac.c
5851 --- rtl8187_orig/ieee80211/ieee80211_softmac.c 2007-03-13 23:45:09.000000000 +0100
5852 +++ rtl8187_txpower/ieee80211/ieee80211_softmac.c 2007-04-23 00:09:00.000000000 +0200
5853 @@ -20,12 +20,12 @@
5854 #include <linux/delay.h>
5855 #include <linux/version.h>
5856
5857 -short ieee80211_is_54g(struct ieee80211_network net)
5858 +short ieee80211_is_54g_rtl7(struct ieee80211_network net)
5859 {
5860 return ((net.rates_ex_len > 0) || (net.rates_len > 4));
5861 }
5862
5863 -short ieee80211_is_shortslot(struct ieee80211_network net)
5864 +short ieee80211_is_shortslot_rtl7(struct ieee80211_network net)
5865 {
5866 return (net.capability & WLAN_CAPABILITY_SHORT_SLOT);
5867 }
5868 @@ -34,7 +34,7 @@
5869 * tag and the EXTENDED RATE MFIE tag if needed.
5870 * It encludes two bytes per tag for the tag itself and its len
5871 */
5872 -unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee)
5873 +unsigned int ieee80211_MFIE_rate_len_rtl7(struct ieee80211_device *ieee)
5874 {
5875 unsigned int rate_len = 0;
5876
5877 @@ -52,7 +52,7 @@
5878 * Then it updates the pointer so that
5879 * it points after the new MFIE tag added.
5880 */
5881 -void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p)
5882 +void ieee80211_MFIE_Brate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
5883 {
5884 u8 *tag = *tag_p;
5885
5886 @@ -69,7 +69,7 @@
5887 *tag_p = tag;
5888 }
5889
5890 -void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
5891 +void ieee80211_MFIE_Grate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
5892 {
5893 u8 *tag = *tag_p;
5894
5895 @@ -92,7 +92,7 @@
5896 *tag_p = tag;
5897 }
5898
5899 -void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb)
5900 +void enqueue_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
5901 {
5902 int nh;
5903 nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM;
5904 @@ -110,7 +110,7 @@
5905 //return 0;
5906 }
5907
5908 -struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee)
5909 +struct sk_buff *dequeue_mgmt_rtl7(struct ieee80211_device *ieee)
5910 {
5911 struct sk_buff *ret;
5912
5913 @@ -125,15 +125,15 @@
5914 return ret;
5915 }
5916
5917 -void init_mgmt_queue(struct ieee80211_device *ieee)
5918 +void init_mgmt_queue_rtl7(struct ieee80211_device *ieee)
5919 {
5920 ieee->mgmt_queue_tail = ieee->mgmt_queue_head = 0;
5921 }
5922
5923
5924 -void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl);
5925 +void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl);
5926
5927 -inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
5928 +inline void softmac_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
5929 {
5930 unsigned long flags;
5931 short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
5932 @@ -144,13 +144,13 @@
5933 spin_lock_irqsave(&ieee->lock, flags);
5934
5935 /* called with 2nd param 0, no mgmt lock required */
5936 - ieee80211_sta_wakeup(ieee,0);
5937 + ieee80211_sta_wakeup_rtl7(ieee,0);
5938
5939 if(single){
5940
5941 if(ieee->queue_stop){
5942
5943 - enqueue_mgmt(ieee,skb);
5944 + enqueue_mgmt_rtl7(ieee,skb);
5945
5946 }else{
5947 header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
5948 @@ -184,7 +184,7 @@
5949 }
5950
5951
5952 -inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
5953 +inline void softmac_ps_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
5954 {
5955
5956 short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
5957 @@ -219,7 +219,7 @@
5958 }
5959 }
5960
5961 -inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee)
5962 +inline struct sk_buff *ieee80211_probe_req_rtl7(struct ieee80211_device *ieee)
5963 {
5964 unsigned int len,rate_len;
5965 u8 *tag;
5966 @@ -228,7 +228,7 @@
5967
5968 len = ieee->current_network.ssid_len;
5969
5970 - rate_len = ieee80211_MFIE_rate_len(ieee);
5971 + rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
5972
5973 skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) +
5974 2 + len + rate_len);
5975 @@ -251,21 +251,21 @@
5976 memcpy(tag, ieee->current_network.ssid, len);
5977 tag += len;
5978
5979 - ieee80211_MFIE_Brate(ieee,&tag);
5980 - ieee80211_MFIE_Grate(ieee,&tag);
5981 + ieee80211_MFIE_Brate_rtl7(ieee,&tag);
5982 + ieee80211_MFIE_Grate_rtl7(ieee,&tag);
5983 return skb;
5984 }
5985
5986 -struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee);
5987 -void ieee80211_send_beacon(struct ieee80211_device *ieee)
5988 +struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee);
5989 +void ieee80211_send_beacon_rtl7(struct ieee80211_device *ieee)
5990 {
5991 struct sk_buff *skb;
5992
5993 unsigned long flags;
5994
5995 - skb = ieee80211_get_beacon_(ieee);
5996 + skb = ieee80211_get_beacon__rtl7(ieee);
5997 if (skb){
5998 - softmac_mgmt_xmit(skb, ieee);
5999 + softmac_mgmt_xmit_rtl7(skb, ieee);
6000 ieee->softmac_stats.tx_beacons++;
6001 }
6002
6003 @@ -279,37 +279,37 @@
6004 }
6005
6006
6007 -void ieee80211_send_beacon_cb(unsigned long _ieee)
6008 +void ieee80211_send_beacon_cb_rtl7(unsigned long _ieee)
6009 {
6010 struct ieee80211_device *ieee =
6011 (struct ieee80211_device *) _ieee;
6012 - ieee80211_send_beacon(ieee);
6013 + ieee80211_send_beacon_rtl7(ieee);
6014 }
6015
6016
6017 -void ieee80211_send_probe(struct ieee80211_device *ieee)
6018 +void ieee80211_send_probe_rtl7(struct ieee80211_device *ieee)
6019 {
6020 struct sk_buff *skb;
6021
6022 - skb = ieee80211_probe_req(ieee);
6023 + skb = ieee80211_probe_req_rtl7(ieee);
6024 if (skb){
6025 - softmac_mgmt_xmit(skb, ieee);
6026 + softmac_mgmt_xmit_rtl7(skb, ieee);
6027 ieee->softmac_stats.tx_probe_rq++;
6028 }
6029 }
6030
6031 -void ieee80211_send_probe_requests(struct ieee80211_device *ieee)
6032 +void ieee80211_send_probe_requests_rtl7(struct ieee80211_device *ieee)
6033 {
6034 if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)){
6035 - ieee80211_send_probe(ieee);
6036 - ieee80211_send_probe(ieee);
6037 + ieee80211_send_probe_rtl7(ieee);
6038 + ieee80211_send_probe_rtl7(ieee);
6039 }
6040 }
6041
6042 /* this performs syncro scan blocking the caller until all channels
6043 * in the allowed channel map has been checked.
6044 */
6045 -void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
6046 +void ieee80211_softmac_scan_syncro_rtl7(struct ieee80211_device *ieee)
6047 {
6048 short ch = 0;
6049
6050 @@ -349,7 +349,7 @@
6051
6052 ieee->set_chan(ieee->dev, ch);
6053
6054 - ieee80211_send_probe_requests(ieee);
6055 + ieee80211_send_probe_requests_rtl7(ieee);
6056
6057 /* this prevent excessive time wait when we
6058 * need to wait for a syncro scan to end..
6059 @@ -384,11 +384,17 @@
6060 }
6061 #endif
6062
6063 -void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
6064 -{
6065 - down(&ieee->scan_sem);
6066 -
6067 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
6068 +void ieee80211_softmac_scan_wq_rtl7(struct work_struct *work)
6069 +{
6070 + struct delayed_work *dwork = container_of(work, struct delayed_work, work);
6071 + struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
6072 +#else
6073 +void ieee80211_softmac_scan_wq_rtl7(struct ieee80211_device *ieee)
6074 +{
6075 +#endif
6076 short watchdog = 0;
6077 + down(&ieee->scan_sem);
6078
6079 do{
6080 ieee->current_network.channel =
6081 @@ -402,7 +408,7 @@
6082 goto out;
6083
6084 ieee->set_chan(ieee->dev, ieee->current_network.channel);
6085 - ieee80211_send_probe_requests(ieee);
6086 + ieee80211_send_probe_requests_rtl7(ieee);
6087
6088 #if 0
6089 ieee->.expires = jiffies + (IEEE80211_SOFTMAC_SCAN_TIME);
6090 @@ -427,19 +433,19 @@
6091 #endif
6092
6093
6094 -void ieee80211_beacons_start(struct ieee80211_device *ieee)
6095 +void ieee80211_beacons_start_rtl7(struct ieee80211_device *ieee)
6096 {
6097 unsigned long flags;
6098
6099 spin_lock_irqsave(&ieee->beacon_lock,flags);
6100
6101 ieee->beacon_txing = 1;
6102 - ieee80211_send_beacon(ieee);
6103 + ieee80211_send_beacon_rtl7(ieee);
6104
6105 spin_unlock_irqrestore(&ieee->beacon_lock,flags);
6106 }
6107
6108 -void ieee80211_beacons_stop(struct ieee80211_device *ieee)
6109 +void ieee80211_beacons_stop_rtl7(struct ieee80211_device *ieee)
6110 {
6111 unsigned long flags;
6112
6113 @@ -453,25 +459,25 @@
6114 }
6115
6116
6117 -void ieee80211_stop_send_beacons(struct ieee80211_device *ieee)
6118 +void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee)
6119 {
6120 if(ieee->stop_send_beacons)
6121 ieee->stop_send_beacons(ieee->dev);
6122 if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
6123 - ieee80211_beacons_stop(ieee);
6124 + ieee80211_beacons_stop_rtl7(ieee);
6125 }
6126
6127
6128 -void ieee80211_start_send_beacons(struct ieee80211_device *ieee)
6129 +void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee)
6130 {
6131 if(ieee->start_send_beacons)
6132 ieee->start_send_beacons(ieee->dev);
6133 if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
6134 - ieee80211_beacons_start(ieee);
6135 + ieee80211_beacons_start_rtl7(ieee);
6136 }
6137
6138
6139 -void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee)
6140 +void ieee80211_softmac_stop_scan_rtl7(struct ieee80211_device *ieee)
6141 {
6142 // unsigned long flags;
6143
6144 @@ -490,22 +496,22 @@
6145 up(&ieee->scan_sem);
6146 }
6147
6148 -void ieee80211_stop_scan(struct ieee80211_device *ieee)
6149 +void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee)
6150 {
6151 if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
6152 - ieee80211_softmac_stop_scan(ieee);
6153 + ieee80211_softmac_stop_scan_rtl7(ieee);
6154 else
6155 ieee->stop_scan(ieee->dev);
6156 }
6157
6158 /* called with ieee->lock held */
6159 -void ieee80211_start_scan(struct ieee80211_device *ieee)
6160 +void ieee80211_start_scan_rtl7(struct ieee80211_device *ieee)
6161 {
6162 if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
6163 if (ieee->scanning == 0){
6164 ieee->scanning = 1;
6165 //ieee80211_softmac_scan(ieee);
6166 - queue_work(ieee->wq, &ieee->softmac_scan_wq);
6167 + queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
6168 }
6169 }else
6170 ieee->start_scan(ieee->dev);
6171 @@ -513,18 +519,18 @@
6172 }
6173
6174 /* called with wx_sem held */
6175 -void ieee80211_start_scan_syncro(struct ieee80211_device *ieee)
6176 +void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee)
6177 {
6178 ieee->sync_scan_hurryup = 0;
6179
6180 if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
6181 - ieee80211_softmac_scan_syncro(ieee);
6182 + ieee80211_softmac_scan_syncro_rtl7(ieee);
6183 else
6184 ieee->scan_syncro(ieee->dev);
6185
6186 }
6187
6188 -inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon,
6189 +inline struct sk_buff *ieee80211_authentication_req_rtl7(struct ieee80211_network *beacon,
6190 struct ieee80211_device *ieee, int challengelen)
6191 {
6192 struct sk_buff *skb;
6193 @@ -557,7 +563,7 @@
6194
6195 }
6196
6197 -static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest)
6198 +static struct sk_buff* ieee80211_probe_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
6199 {
6200 u8 *tag;
6201 int beacon_size;
6202 @@ -578,7 +584,7 @@
6203 else
6204 atim_len = 0;
6205
6206 - if(ieee80211_is_54g(ieee->current_network))
6207 + if(ieee80211_is_54g_rtl7(ieee->current_network))
6208 erp_len = 3;
6209 else
6210 erp_len = 0;
6211 @@ -664,7 +670,7 @@
6212 }
6213
6214
6215 -struct sk_buff* ieee80211_assoc_resp(struct ieee80211_device *ieee, u8 *dest)
6216 +struct sk_buff* ieee80211_assoc_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
6217 {
6218 struct sk_buff *skb;
6219 u8* tag;
6220 @@ -673,7 +679,7 @@
6221 struct ieee80211_assoc_response_frame *assoc;
6222 short encrypt;
6223
6224 - unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
6225 + unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
6226 int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len;
6227
6228 skb = dev_alloc_skb(len);
6229 @@ -711,13 +717,13 @@
6230
6231 tag = (u8*) skb_put(skb, rate_len);
6232
6233 - ieee80211_MFIE_Brate(ieee, &tag);
6234 - ieee80211_MFIE_Grate(ieee, &tag);
6235 + ieee80211_MFIE_Brate_rtl7(ieee, &tag);
6236 + ieee80211_MFIE_Grate_rtl7(ieee, &tag);
6237
6238 return skb;
6239 }
6240
6241 -struct sk_buff* ieee80211_auth_resp(struct ieee80211_device *ieee,int status, u8 *dest)
6242 +struct sk_buff* ieee80211_auth_resp_rtl7(struct ieee80211_device *ieee,int status, u8 *dest)
6243 {
6244 struct sk_buff *skb;
6245 struct ieee80211_authentication *auth;
6246 @@ -744,7 +750,7 @@
6247
6248 }
6249
6250 -struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr)
6251 +struct sk_buff* ieee80211_null_func_rtl7(struct ieee80211_device *ieee,short pwr)
6252 {
6253 struct sk_buff *skb;
6254 struct ieee80211_hdr_3addr* hdr;
6255 @@ -770,35 +776,35 @@
6256 }
6257
6258
6259 -void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest)
6260 +void ieee80211_resp_to_assoc_rq_rtl7(struct ieee80211_device *ieee, u8* dest)
6261 {
6262 - struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest);
6263 + struct sk_buff *buf = ieee80211_assoc_resp_rtl7(ieee, dest);
6264
6265 if (buf)
6266 - softmac_mgmt_xmit(buf, ieee);
6267 + softmac_mgmt_xmit_rtl7(buf, ieee);
6268 }
6269
6270
6271 -void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest)
6272 +void ieee80211_resp_to_auth_rtl7(struct ieee80211_device *ieee, int s, u8* dest)
6273 {
6274 - struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest);
6275 + struct sk_buff *buf = ieee80211_auth_resp_rtl7(ieee, s, dest);
6276
6277 if (buf)
6278 - softmac_mgmt_xmit(buf, ieee);
6279 + softmac_mgmt_xmit_rtl7(buf, ieee);
6280 }
6281
6282
6283 -void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest)
6284 +void ieee80211_resp_to_probe_rtl7(struct ieee80211_device *ieee, u8 *dest)
6285 {
6286
6287 - struct sk_buff *buf = ieee80211_probe_resp(ieee, dest);
6288 + struct sk_buff *buf = ieee80211_probe_resp_rtl7(ieee, dest);
6289
6290 if (buf)
6291 - softmac_mgmt_xmit(buf, ieee);
6292 + softmac_mgmt_xmit_rtl7(buf, ieee);
6293 }
6294
6295
6296 -inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
6297 +inline struct sk_buff *ieee80211_association_req_rtl7(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
6298 {
6299 struct sk_buff *skb;
6300
6301 @@ -807,7 +813,7 @@
6302
6303 unsigned int wpa_len = beacon->wpa_ie_len;
6304
6305 - unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
6306 + unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
6307
6308
6309
6310 @@ -848,8 +854,8 @@
6311
6312 tag = skb_put(skb, rate_len);
6313
6314 - ieee80211_MFIE_Brate(ieee, &tag);
6315 - ieee80211_MFIE_Grate(ieee, &tag);
6316 + ieee80211_MFIE_Brate_rtl7(ieee, &tag);
6317 + ieee80211_MFIE_Grate_rtl7(ieee, &tag);
6318
6319 tag = skb_put(skb,wpa_len);
6320
6321 @@ -858,7 +864,7 @@
6322 return skb;
6323 }
6324
6325 -void ieee80211_associate_abort(struct ieee80211_device *ieee)
6326 +void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee)
6327 {
6328
6329 unsigned long flags;
6330 @@ -887,13 +893,13 @@
6331 spin_unlock_irqrestore(&ieee->lock, flags);
6332 }
6333
6334 -void ieee80211_associate_abort_cb(unsigned long dev)
6335 +void ieee80211_associate_abort_cb_rtl7(unsigned long dev)
6336 {
6337 - ieee80211_associate_abort((struct ieee80211_device *) dev);
6338 + ieee80211_associate_abort_rtl7((struct ieee80211_device *) dev);
6339 }
6340
6341
6342 -void ieee80211_associate_step1(struct ieee80211_device *ieee)
6343 +void ieee80211_associate_step1_rtl7(struct ieee80211_device *ieee)
6344 {
6345 struct ieee80211_network *beacon = &ieee->current_network;
6346 struct sk_buff *skb;
6347 @@ -901,20 +907,20 @@
6348 IEEE80211_DEBUG_MGMT("Stopping scan\n");
6349
6350 ieee->softmac_stats.tx_auth_rq++;
6351 - skb=ieee80211_authentication_req(beacon, ieee, 0);
6352 + skb=ieee80211_authentication_req_rtl7(beacon, ieee, 0);
6353
6354 if (!skb)
6355 - ieee80211_associate_abort(ieee);
6356 + ieee80211_associate_abort_rtl7(ieee);
6357 else{
6358 ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ;
6359 IEEE80211_DEBUG_MGMT("Sending authentication request\n");
6360 - softmac_mgmt_xmit(skb, ieee);
6361 + softmac_mgmt_xmit_rtl7(skb, ieee);
6362 ieee->associate_timer.expires = jiffies + (HZ / 2);
6363 add_timer(&ieee->associate_timer);
6364 }
6365 }
6366
6367 -void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
6368 +void ieee80211_auth_challenge_rtl7(struct ieee80211_device *ieee, u8 *challenge, int chlen)
6369 {
6370 u8 *c;
6371 struct sk_buff *skb;
6372 @@ -924,9 +930,9 @@
6373 ieee->associate_seq++;
6374 ieee->softmac_stats.tx_auth_rq++;
6375
6376 - skb = ieee80211_authentication_req(beacon, ieee, chlen+2);
6377 + skb = ieee80211_authentication_req_rtl7(beacon, ieee, chlen+2);
6378 if (!skb)
6379 - ieee80211_associate_abort(ieee);
6380 + ieee80211_associate_abort_rtl7(ieee);
6381 else{
6382 c = skb_put(skb, chlen+2);
6383 *(c++) = MFIE_TYPE_CHALLENGE;
6384 @@ -935,16 +941,16 @@
6385
6386 IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n");
6387
6388 - ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
6389 + ieee80211_encrypt_fragment_rtl7(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
6390
6391 - softmac_mgmt_xmit(skb, ieee);
6392 + softmac_mgmt_xmit_rtl7(skb, ieee);
6393 ieee->associate_timer.expires = jiffies + (HZ / 2);
6394 add_timer(&ieee->associate_timer);
6395 }
6396 kfree(challenge);
6397 }
6398
6399 -void ieee80211_associate_step2(struct ieee80211_device *ieee)
6400 +void ieee80211_associate_step2_rtl7(struct ieee80211_device *ieee)
6401 {
6402 struct sk_buff* skb;
6403 struct ieee80211_network *beacon = &ieee->current_network;
6404 @@ -954,20 +960,26 @@
6405 IEEE80211_DEBUG_MGMT("Sending association request\n");
6406
6407 ieee->softmac_stats.tx_ass_rq++;
6408 - skb=ieee80211_association_req(beacon, ieee);
6409 + skb=ieee80211_association_req_rtl7(beacon, ieee);
6410 if (!skb)
6411 - ieee80211_associate_abort(ieee);
6412 + ieee80211_associate_abort_rtl7(ieee);
6413 else{
6414 - softmac_mgmt_xmit(skb, ieee);
6415 + softmac_mgmt_xmit_rtl7(skb, ieee);
6416 ieee->associate_timer.expires = jiffies + (HZ / 2);
6417 add_timer(&ieee->associate_timer);
6418 }
6419 }
6420
6421 -void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
6422 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
6423 +void ieee80211_associate_complete_wq_rtl7(struct work_struct *work)
6424 +{
6425 + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
6426 +#else
6427 +void ieee80211_associate_complete_wq_rtl7(struct ieee80211_device *ieee)
6428 {
6429 +#endif
6430 printk(KERN_INFO "Associated successfully\n");
6431 - if(ieee80211_is_54g(ieee->current_network) &&
6432 + if(ieee80211_is_54g_rtl7(ieee->current_network) &&
6433 (ieee->modulation & IEEE80211_OFDM_MODULATION)){
6434
6435 ieee->rate = 540;
6436 @@ -977,13 +989,13 @@
6437 printk(KERN_INFO"Using B rates\n");
6438 }
6439 ieee->link_change(ieee->dev);
6440 - notify_wx_assoc_event(ieee);
6441 + notify_wx_assoc_event_rtl7(ieee);
6442 if (ieee->data_hard_resume)
6443 ieee->data_hard_resume(ieee->dev);
6444 netif_carrier_on(ieee->dev);
6445 }
6446
6447 -void ieee80211_associate_complete(struct ieee80211_device *ieee)
6448 +void ieee80211_associate_complete_rtl7(struct ieee80211_device *ieee)
6449 {
6450
6451 del_timer_sync(&ieee->associate_timer);
6452 @@ -995,24 +1007,29 @@
6453 queue_work(ieee->wq, &ieee->associate_complete_wq);
6454 }
6455
6456 -void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee)
6457 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
6458 +void ieee80211_associate_procedure_wq_rtl7(struct work_struct *work)
6459 +{
6460 + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
6461 +#else
6462 +void ieee80211_associate_procedure_wq_rtl7(struct ieee80211_device *ieee)
6463 {
6464 +#endif
6465 ieee->sync_scan_hurryup = 1;
6466 down(&ieee->wx_sem);
6467 -
6468 if (ieee->data_hard_stop)
6469 ieee->data_hard_stop(ieee->dev);
6470
6471 - ieee80211_stop_scan(ieee);
6472 + ieee80211_stop_scan_rtl7(ieee);
6473 ieee->set_chan(ieee->dev, ieee->current_network.channel);
6474
6475 ieee->associate_seq = 1;
6476 - ieee80211_associate_step1(ieee);
6477 + ieee80211_associate_step1_rtl7(ieee);
6478
6479 up(&ieee->wx_sem);
6480 }
6481
6482 -inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net)
6483 +inline void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net)
6484 {
6485
6486 u8 tmp_ssid[IW_ESSID_MAX_SIZE+1];
6487 @@ -1079,7 +1096,7 @@
6488 ieee->state = IEEE80211_ASSOCIATING;
6489 queue_work(ieee->wq, &ieee->associate_procedure_wq);
6490 }else{
6491 - if(ieee80211_is_54g(ieee->current_network) &&
6492 + if(ieee80211_is_54g_rtl7(ieee->current_network) &&
6493 (ieee->modulation & IEEE80211_OFDM_MODULATION)){
6494 ieee->rate = 540;
6495 printk(KERN_INFO"Using G rates\n");
6496 @@ -1092,17 +1109,15 @@
6497
6498 }
6499 }
6500 -
6501 }
6502
6503 -void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee)
6504 +void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee)
6505 {
6506
6507 unsigned long flags;
6508 struct ieee80211_network *target;
6509
6510 spin_lock_irqsave(&ieee->lock, flags);
6511 -
6512 list_for_each_entry(target, &ieee->network_list, list) {
6513
6514 /* if the state become different that NOLINK means
6515 @@ -1112,7 +1127,7 @@
6516 break;
6517
6518 //if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies))
6519 - ieee80211_softmac_new_net(ieee, target);
6520 + ieee80211_softmac_new_net_rtl7(ieee, target);
6521 }
6522
6523 spin_unlock_irqrestore(&ieee->lock, flags);
6524 @@ -1120,7 +1135,7 @@
6525 }
6526
6527
6528 -static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
6529 +static inline u16 auth_parse_rtl7(struct sk_buff *skb, u8** challenge, int *chlen)
6530 {
6531 struct ieee80211_authentication *a;
6532 u8 *t;
6533 @@ -1145,7 +1160,7 @@
6534 }
6535
6536
6537 -int auth_rq_parse(struct sk_buff *skb,u8* dest)
6538 +int auth_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
6539 {
6540 struct ieee80211_authentication *a;
6541
6542 @@ -1163,7 +1178,7 @@
6543 return WLAN_STATUS_SUCCESS;
6544 }
6545
6546 -static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
6547 +static short probe_rq_parse_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
6548 {
6549 u8 *tag;
6550 u8 *skbend;
6551 @@ -1201,7 +1216,7 @@
6552
6553 }
6554
6555 -int assoc_rq_parse(struct sk_buff *skb,u8* dest)
6556 +int assoc_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
6557 {
6558 struct ieee80211_assoc_request_frame *a;
6559
6560 @@ -1219,7 +1234,7 @@
6561 return 0;
6562 }
6563
6564 -static inline u16 assoc_parse(struct sk_buff *skb, int *aid)
6565 +static inline u16 assoc_parse_rtl7(struct sk_buff *skb, int *aid)
6566 {
6567 struct ieee80211_assoc_response_frame *a;
6568 if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
6569 @@ -1233,45 +1248,45 @@
6570 }
6571
6572 static inline void
6573 -ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
6574 +ieee80211_rx_probe_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
6575 {
6576 u8 dest[ETH_ALEN];
6577
6578 //IEEE80211DMESG("Rx probe");
6579 ieee->softmac_stats.rx_probe_rq++;
6580 //DMESG("Dest is "MACSTR, MAC2STR(dest));
6581 - if (probe_rq_parse(ieee, skb, dest)){
6582 + if (probe_rq_parse_rtl7(ieee, skb, dest)){
6583 //IEEE80211DMESG("Was for me!");
6584 ieee->softmac_stats.tx_probe_rs++;
6585 - ieee80211_resp_to_probe(ieee, dest);
6586 + ieee80211_resp_to_probe_rtl7(ieee, dest);
6587 }
6588 }
6589
6590 static inline void
6591 -ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
6592 +ieee80211_rx_auth_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
6593 {
6594 u8 dest[ETH_ALEN];
6595 int status;
6596 //IEEE80211DMESG("Rx probe");
6597 ieee->softmac_stats.rx_auth_rq++;
6598
6599 - if ((status = auth_rq_parse(skb, dest))!= -1){
6600 - ieee80211_resp_to_auth(ieee, status, dest);
6601 + if ((status = auth_rq_parse_rtl7(skb, dest))!= -1){
6602 + ieee80211_resp_to_auth_rtl7(ieee, status, dest);
6603 }
6604 //DMESG("Dest is "MACSTR, MAC2STR(dest));
6605
6606 }
6607
6608 static inline void
6609 -ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
6610 +ieee80211_rx_assoc_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
6611 {
6612
6613 u8 dest[ETH_ALEN];
6614 //unsigned long flags;
6615
6616 ieee->softmac_stats.rx_ass_rq++;
6617 - if (assoc_rq_parse(skb,dest) != -1){
6618 - ieee80211_resp_to_assoc_rq(ieee, dest);
6619 + if (assoc_rq_parse_rtl7(skb,dest) != -1){
6620 + ieee80211_resp_to_assoc_rq_rtl7(ieee, dest);
6621 }
6622
6623 printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest));
6624 @@ -1285,18 +1300,18 @@
6625
6626
6627
6628 -void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr)
6629 +void ieee80211_sta_ps_send_null_frame_rtl7(struct ieee80211_device *ieee, short pwr)
6630 {
6631
6632 - struct sk_buff *buf = ieee80211_null_func(ieee, pwr);
6633 + struct sk_buff *buf = ieee80211_null_func_rtl7(ieee, pwr);
6634
6635 if (buf)
6636 - softmac_ps_mgmt_xmit(buf, ieee);
6637 + softmac_ps_mgmt_xmit_rtl7(buf, ieee);
6638
6639 }
6640
6641
6642 -short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
6643 +short ieee80211_sta_ps_sleep_rtl7(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
6644 {
6645 int timeout = ieee->ps_timeout;
6646 u8 dtim;
6647 @@ -1343,7 +1358,7 @@
6648
6649 }
6650
6651 -inline void ieee80211_sta_ps(struct ieee80211_device *ieee)
6652 +inline void ieee80211_sta_ps_rtl7(struct ieee80211_device *ieee)
6653 {
6654
6655 u32 th,tl;
6656 @@ -1360,12 +1375,12 @@
6657 #warning CHECK_LOCK_HERE
6658 spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
6659
6660 - ieee80211_sta_wakeup(ieee, 1);
6661 + ieee80211_sta_wakeup_rtl7(ieee, 1);
6662
6663 spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
6664 }
6665
6666 - sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl);
6667 + sleep = ieee80211_sta_ps_sleep_rtl7(ieee,&th, &tl);
6668 /* 2 wake, 1 sleep, 0 do nothing */
6669 if(sleep == 0)
6670 goto out;
6671 @@ -1386,7 +1401,7 @@
6672
6673 ieee->ps_request_tx_ack(ieee->dev);
6674
6675 - ieee80211_sta_ps_send_null_frame(ieee,1);
6676 + ieee80211_sta_ps_send_null_frame_rtl7(ieee,1);
6677
6678 ieee->ps_th = th;
6679 ieee->ps_tl = tl;
6680 @@ -1400,7 +1415,7 @@
6681 #warning CHECK_LOCK_HERE
6682 spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
6683
6684 - ieee80211_sta_wakeup(ieee,1);
6685 + ieee80211_sta_wakeup_rtl7(ieee,1);
6686
6687 spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
6688 }
6689 @@ -1410,13 +1425,13 @@
6690
6691 }
6692
6693 -void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl)
6694 +void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl)
6695 {
6696 if(ieee->sta_sleep == 0){
6697 if(nl){
6698 printk("Warning: driver is probably failing to report TX ps error\n");
6699 ieee->ps_request_tx_ack(ieee->dev);
6700 - ieee80211_sta_ps_send_null_frame(ieee, 0);
6701 + ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
6702 }
6703 return;
6704
6705 @@ -1429,11 +1444,11 @@
6706
6707 if(nl){
6708 ieee->ps_request_tx_ack(ieee->dev);
6709 - ieee80211_sta_ps_send_null_frame(ieee, 0);
6710 + ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
6711 }
6712 }
6713
6714 -void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success)
6715 +void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success)
6716 {
6717 unsigned long flags,flags2;
6718
6719 @@ -1454,7 +1469,7 @@
6720
6721 if((ieee->sta_sleep == 0) && !success){
6722 spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
6723 - ieee80211_sta_ps_send_null_frame(ieee, 0);
6724 + ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
6725 spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
6726 }
6727 }
6728 @@ -1462,17 +1477,18 @@
6729 }
6730
6731 inline int
6732 -ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
6733 +ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
6734 struct ieee80211_rx_stats *rx_stats, u16 type,
6735 u16 stype)
6736 {
6737 struct ieee80211_hdr_3addr *header;
6738 - header = (struct ieee80211_hdr_3addr *) skb->data;
6739 u16 errcode;
6740 u8* challenge;
6741 int chlen;
6742 int aid;
6743
6744 + header = (struct ieee80211_hdr_3addr *) skb->data;
6745 +
6746 if(!ieee->proto_started)
6747 return 0;
6748
6749 @@ -1496,19 +1512,19 @@
6750 if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
6751 ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
6752 ieee->iw_mode == IW_MODE_INFRA){
6753 - if (0 == (errcode=assoc_parse(skb, &aid))){
6754 + if (0 == (errcode=assoc_parse_rtl7(skb, &aid))){
6755
6756 ieee->state=IEEE80211_LINKED;
6757 ieee->assoc_id = aid;
6758 ieee->softmac_stats.rx_ass_ok++;
6759
6760 - ieee80211_associate_complete(ieee);
6761 + ieee80211_associate_complete_rtl7(ieee);
6762 }else{
6763 ieee->softmac_stats.rx_ass_err++;
6764 IEEE80211_DEBUG_MGMT(
6765 "Association response status code 0x%x\n",
6766 errcode);
6767 - ieee80211_associate_abort(ieee);
6768 + ieee80211_associate_abort_rtl7(ieee);
6769 }
6770 }
6771 break;
6772 @@ -1519,7 +1535,7 @@
6773 if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
6774 ieee->iw_mode == IW_MODE_MASTER)
6775
6776 - ieee80211_rx_assoc_rq(ieee, skb);
6777 + ieee80211_rx_assoc_rq_rtl7(ieee, skb);
6778 break;
6779
6780 case IEEE80211_STYPE_AUTH:
6781 @@ -1530,23 +1546,23 @@
6782
6783 IEEE80211_DEBUG_MGMT("Received authentication response");
6784
6785 - if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){
6786 + if (0 == (errcode=auth_parse_rtl7(skb, &challenge, &chlen))){
6787 if(ieee->open_wep || !challenge){
6788 ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
6789 ieee->softmac_stats.rx_auth_rs_ok++;
6790
6791 - ieee80211_associate_step2(ieee);
6792 + ieee80211_associate_step2_rtl7(ieee);
6793 }else{
6794 - ieee80211_auth_challenge(ieee, challenge, chlen);
6795 + ieee80211_auth_challenge_rtl7(ieee, challenge, chlen);
6796 }
6797 }else{
6798 ieee->softmac_stats.rx_auth_rs_err++;
6799 IEEE80211_DEBUG_MGMT("Authentication respose status code 0x%x",errcode);
6800 - ieee80211_associate_abort(ieee);
6801 + ieee80211_associate_abort_rtl7(ieee);
6802 }
6803
6804 }else if (ieee->iw_mode == IW_MODE_MASTER){
6805 - ieee80211_rx_auth_rq(ieee, skb);
6806 + ieee80211_rx_auth_rq_rtl7(ieee, skb);
6807 }
6808 }
6809 break;
6810 @@ -1558,7 +1574,7 @@
6811 ieee->iw_mode == IW_MODE_MASTER) &&
6812 ieee->state == IEEE80211_LINKED))
6813
6814 - ieee80211_rx_probe_rq(ieee, skb);
6815 + ieee80211_rx_probe_rq_rtl7(ieee, skb);
6816 break;
6817
6818 case IEEE80211_STYPE_DISASSOC:
6819 @@ -1573,8 +1589,8 @@
6820 ieee->state = IEEE80211_ASSOCIATING;
6821 ieee->softmac_stats.reassoc++;
6822
6823 - notify_wx_assoc_event(ieee);
6824 -
6825 + notify_wx_assoc_event_rtl7(ieee);
6826 +
6827 queue_work(ieee->wq, &ieee->associate_procedure_wq);
6828 }
6829
6830 @@ -1610,7 +1626,7 @@
6831 * to the driver later, when it wakes the queue.
6832 */
6833
6834 -void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
6835 +void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
6836 {
6837
6838
6839 @@ -1643,7 +1659,7 @@
6840 #endif
6841
6842 /* called with 2nd parm 0, no tx mgmt lock required */
6843 - ieee80211_sta_wakeup(ieee,0);
6844 + ieee80211_sta_wakeup_rtl7(ieee,0);
6845
6846 for(i = 0; i < txb->nr_frags; i++) {
6847
6848 @@ -1662,7 +1678,7 @@
6849 }
6850 }
6851
6852 - ieee80211_txb_free(txb);
6853 + ieee80211_txb_free_rtl7(txb);
6854
6855 exit:
6856 spin_unlock_irqrestore(&ieee->lock,flags);
6857 @@ -1670,7 +1686,7 @@
6858 }
6859
6860 /* called with ieee->lock acquired */
6861 -void ieee80211_resume_tx(struct ieee80211_device *ieee)
6862 +void ieee80211_resume_tx_rtl7(struct ieee80211_device *ieee)
6863 {
6864 int i;
6865 for(i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) {
6866 @@ -1690,19 +1706,19 @@
6867 }
6868
6869
6870 - ieee80211_txb_free(ieee->tx_pending.txb);
6871 + ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
6872 ieee->tx_pending.txb = NULL;
6873 }
6874
6875
6876 -void ieee80211_reset_queue(struct ieee80211_device *ieee)
6877 +void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee)
6878 {
6879 unsigned long flags;
6880
6881 spin_lock_irqsave(&ieee->lock,flags);
6882 - init_mgmt_queue(ieee);
6883 + init_mgmt_queue_rtl7(ieee);
6884 if (ieee->tx_pending.txb){
6885 - ieee80211_txb_free(ieee->tx_pending.txb);
6886 + ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
6887 ieee->tx_pending.txb = NULL;
6888 }
6889 ieee->queue_stop = 0;
6890 @@ -1710,7 +1726,7 @@
6891
6892 }
6893
6894 -void ieee80211_wake_queue(struct ieee80211_device *ieee)
6895 +void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee)
6896 {
6897
6898 unsigned long flags;
6899 @@ -1723,7 +1739,7 @@
6900 ieee->queue_stop = 0;
6901
6902 if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){
6903 - while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){
6904 + while (!ieee->queue_stop && (skb = dequeue_mgmt_rtl7(ieee))){
6905
6906 header = (struct ieee80211_hdr_3addr *) skb->data;
6907
6908 @@ -1738,7 +1754,7 @@
6909 }
6910 }
6911 if (!ieee->queue_stop && ieee->tx_pending.txb)
6912 - ieee80211_resume_tx(ieee);
6913 + ieee80211_resume_tx_rtl7(ieee);
6914
6915 if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){
6916 ieee->softmac_stats.swtxawake++;
6917 @@ -1750,7 +1766,7 @@
6918 }
6919
6920
6921 -void ieee80211_stop_queue(struct ieee80211_device *ieee)
6922 +void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee)
6923 {
6924 //unsigned long flags;
6925 //spin_lock_irqsave(&ieee->lock,flags);
6926 @@ -1765,7 +1781,7 @@
6927 }
6928
6929
6930 -inline void ieee80211_randomize_cell(struct ieee80211_device *ieee)
6931 +inline void ieee80211_randomize_cell_rtl7(struct ieee80211_device *ieee)
6932 {
6933
6934 get_random_bytes(ieee->current_network.bssid, ETH_ALEN);
6935 @@ -1778,7 +1794,7 @@
6936 }
6937
6938 /* called in user context only */
6939 -void ieee80211_start_master_bss(struct ieee80211_device *ieee)
6940 +void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee)
6941 {
6942 ieee->assoc_id = 1;
6943
6944 @@ -1796,7 +1812,7 @@
6945 ieee->set_chan(ieee->dev, ieee->current_network.channel);
6946 ieee->state = IEEE80211_LINKED;
6947 ieee->link_change(ieee->dev);
6948 - notify_wx_assoc_event(ieee);
6949 + notify_wx_assoc_event_rtl7(ieee);
6950
6951 if (ieee->data_hard_resume)
6952 ieee->data_hard_resume(ieee->dev);
6953 @@ -1804,7 +1820,7 @@
6954 netif_carrier_on(ieee->dev);
6955 }
6956
6957 -void ieee80211_start_monitor_mode(struct ieee80211_device *ieee)
6958 +void ieee80211_start_monitor_mode_rtl7(struct ieee80211_device *ieee)
6959 {
6960 if(ieee->raw_tx){
6961
6962 @@ -1814,8 +1830,15 @@
6963 netif_carrier_on(ieee->dev);
6964 }
6965 }
6966 -void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
6967 +
6968 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
6969 +void ieee80211_start_ibss_wq_rtl7(struct work_struct *work)
6970 +{
6971 + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, start_ibss_wq);
6972 +#else
6973 +void ieee80211_start_ibss_wq_rtl7(struct ieee80211_device *ieee)
6974 {
6975 +#endif
6976
6977 /* iwconfig mode ad-hoc will schedule this and return
6978 * on the other hand this will block further iwconfig SET
6979 @@ -1834,7 +1857,7 @@
6980 }
6981
6982 /* check if we have this cell in our network list */
6983 - ieee80211_softmac_check_all_nets(ieee);
6984 + ieee80211_softmac_check_all_nets_rtl7(ieee);
6985
6986 /* if not then the state is not linked. Maybe the user swithced to
6987 * ad-hoc mode just after being in monitor mode, or just after
6988 @@ -1851,13 +1874,13 @@
6989 * associated.
6990 */
6991 if (ieee->state == IEEE80211_NOLINK)
6992 - ieee80211_start_scan_syncro(ieee);
6993 + ieee80211_start_scan_syncro_rtl7(ieee);
6994
6995 /* the network definitively is not here.. create a new cell */
6996 if (ieee->state == IEEE80211_NOLINK){
6997 printk("creating new IBSS cell\n");
6998 if(!ieee->wap_set)
6999 - ieee80211_randomize_cell(ieee);
7000 + ieee80211_randomize_cell_rtl7(ieee);
7001
7002 if(ieee->modulation & IEEE80211_CCK_MODULATION){
7003
7004 @@ -1901,9 +1924,9 @@
7005 ieee->set_chan(ieee->dev, ieee->current_network.channel);
7006 ieee->link_change(ieee->dev);
7007
7008 - notify_wx_assoc_event(ieee);
7009 + notify_wx_assoc_event_rtl7(ieee);
7010
7011 - ieee80211_start_send_beacons(ieee);
7012 + ieee80211_start_send_beacons_rtl7(ieee);
7013
7014 if (ieee->data_hard_resume)
7015 ieee->data_hard_resume(ieee->dev);
7016 @@ -1913,13 +1936,13 @@
7017 up(&ieee->wx_sem);
7018 }
7019
7020 -inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
7021 +inline void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee)
7022 {
7023 queue_work(ieee->wq, &ieee->start_ibss_wq);
7024 }
7025
7026 /* this is called only in user context, with wx_sem held */
7027 -void ieee80211_start_bss(struct ieee80211_device *ieee)
7028 +void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee)
7029 {
7030 unsigned long flags;
7031 /* check if we have already found the net we
7032 @@ -1927,7 +1950,7 @@
7033 * if not (we are disassociated and we are not
7034 * in associating / authenticating phase) start the background scanning.
7035 */
7036 - ieee80211_softmac_check_all_nets(ieee);
7037 + ieee80211_softmac_check_all_nets_rtl7(ieee);
7038
7039 /* ensure no-one start an associating process (thus setting
7040 * the ieee->state to ieee80211_ASSOCIATING) while we
7041 @@ -1937,34 +1960,42 @@
7042 * the rx path), so we cannot be in the middle of such function
7043 */
7044 spin_lock_irqsave(&ieee->lock, flags);
7045 -
7046 if (ieee->state == IEEE80211_NOLINK)
7047 - ieee80211_start_scan(ieee);
7048 + ieee80211_start_scan_rtl7(ieee);
7049
7050 spin_unlock_irqrestore(&ieee->lock, flags);
7051 }
7052
7053 /* called only in userspace context */
7054 -void ieee80211_disassociate(struct ieee80211_device *ieee)
7055 +void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee)
7056 {
7057 netif_carrier_off(ieee->dev);
7058
7059 if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)
7060 - ieee80211_reset_queue(ieee);
7061 + ieee80211_reset_queue_rtl7(ieee);
7062
7063 if (ieee->data_hard_stop)
7064 ieee->data_hard_stop(ieee->dev);
7065
7066 ieee->state = IEEE80211_NOLINK;
7067 ieee->link_change(ieee->dev);
7068 - notify_wx_assoc_event(ieee);
7069 + notify_wx_assoc_event_rtl7(ieee);
7070
7071 }
7072 -void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
7073 +
7074 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
7075 +void ieee80211_associate_retry_wq_rtl7(struct work_struct *work)
7076 {
7077 + struct delayed_work *dwork = container_of(work, struct delayed_work, work);
7078 + struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
7079 +#else
7080 +void ieee80211_associate_retry_wq_rtl7(struct ieee80211_device *ieee)
7081 +{
7082 +#endif
7083 unsigned long flags;
7084
7085 down(&ieee->wx_sem);
7086 +
7087 if(!ieee->proto_started)
7088 goto exit;
7089
7090 @@ -1986,12 +2017,12 @@
7091 */
7092 ieee->state = IEEE80211_NOLINK;
7093
7094 - ieee80211_softmac_check_all_nets(ieee);
7095 + ieee80211_softmac_check_all_nets_rtl7(ieee);
7096
7097 spin_lock_irqsave(&ieee->lock, flags);
7098
7099 if(ieee->state == IEEE80211_NOLINK)
7100 - ieee80211_start_scan(ieee);
7101 + ieee80211_start_scan_rtl7(ieee);
7102
7103 spin_unlock_irqrestore(&ieee->lock, flags);
7104
7105 @@ -1999,14 +2030,14 @@
7106 up(&ieee->wx_sem);
7107 }
7108
7109 -struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee)
7110 +struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee)
7111 {
7112 u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff};
7113
7114 struct sk_buff *skb;
7115 struct ieee80211_probe_response *b;
7116
7117 - skb = ieee80211_probe_resp(ieee, broadcast_addr);
7118 + skb = ieee80211_probe_resp_rtl7(ieee, broadcast_addr);
7119
7120 if (!skb)
7121 return NULL;
7122 @@ -2018,12 +2049,12 @@
7123
7124 }
7125
7126 -struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee)
7127 +struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee)
7128 {
7129 struct sk_buff *skb;
7130 struct ieee80211_probe_response *b;
7131
7132 - skb = ieee80211_get_beacon_(ieee);
7133 + skb = ieee80211_get_beacon__rtl7(ieee);
7134 if(!skb)
7135 return NULL;
7136
7137 @@ -2038,44 +2069,44 @@
7138 return skb;
7139 }
7140
7141 -void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee)
7142 +void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee)
7143 {
7144 ieee->sync_scan_hurryup = 1;
7145 down(&ieee->wx_sem);
7146 - ieee80211_stop_protocol(ieee);
7147 +
7148 + ieee80211_stop_protocol_rtl7(ieee);
7149 up(&ieee->wx_sem);
7150 }
7151
7152
7153 -void ieee80211_stop_protocol(struct ieee80211_device *ieee)
7154 +void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee)
7155 {
7156 if (!ieee->proto_started)
7157 return;
7158
7159 ieee->proto_started = 0;
7160
7161 - ieee80211_stop_send_beacons(ieee);
7162 + ieee80211_stop_send_beacons_rtl7(ieee);
7163
7164 del_timer_sync(&ieee->associate_timer);
7165 cancel_delayed_work(&ieee->associate_retry_wq);
7166
7167 - ieee80211_stop_scan(ieee);
7168 + ieee80211_stop_scan_rtl7(ieee);
7169
7170 - ieee80211_disassociate(ieee);
7171 + ieee80211_disassociate_rtl7(ieee);
7172 }
7173
7174 -void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee)
7175 +void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee)
7176 {
7177 ieee->sync_scan_hurryup = 0;
7178 down(&ieee->wx_sem);
7179 - ieee80211_start_protocol(ieee);
7180 + ieee80211_start_protocol_rtl7(ieee);
7181 up(&ieee->wx_sem);
7182 }
7183
7184 -void ieee80211_start_protocol(struct ieee80211_device *ieee)
7185 +void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee)
7186 {
7187 short ch = 0;
7188 -
7189 if (ieee->proto_started)
7190 return;
7191
7192 @@ -2094,9 +2125,7 @@
7193
7194 if (ieee->current_network.beacon_interval == 0)
7195 ieee->current_network.beacon_interval = 100;
7196 -
7197 ieee->set_chan(ieee->dev,ieee->current_network.channel);
7198 -
7199 ieee->last_seq_num = -1;
7200 ieee->last_frag_num = -1;
7201 ieee->last_packet_time = 0;
7202 @@ -2109,21 +2138,18 @@
7203 */
7204
7205 if (ieee->iw_mode == IW_MODE_INFRA)
7206 - ieee80211_start_bss(ieee);
7207 -
7208 + ieee80211_start_bss_rtl7(ieee);
7209 else if (ieee->iw_mode == IW_MODE_ADHOC)
7210 - ieee80211_start_ibss(ieee);
7211 -
7212 + ieee80211_start_ibss_rtl7(ieee);
7213 else if (ieee->iw_mode == IW_MODE_MASTER)
7214 - ieee80211_start_master_bss(ieee);
7215 -
7216 + ieee80211_start_master_bss_rtl7(ieee);
7217 else if(ieee->iw_mode == IW_MODE_MONITOR)
7218 - ieee80211_start_monitor_mode(ieee);
7219 + ieee80211_start_monitor_mode_rtl7(ieee);
7220 }
7221
7222
7223 #define DRV_NAME "Ieee80211"
7224 -void ieee80211_softmac_init(struct ieee80211_device *ieee)
7225 +void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee)
7226 {
7227 memset(&ieee->current_network, 0, sizeof(struct ieee80211_network));
7228
7229 @@ -2143,7 +2169,7 @@
7230 ieee->ps = IEEE80211_PS_DISABLED;
7231 ieee->sta_sleep = 0;
7232
7233 - init_mgmt_queue(ieee);
7234 + init_mgmt_queue_rtl7(ieee);
7235 #if 0
7236 init_timer(&ieee->scan_timer);
7237 ieee->scan_timer.data = (unsigned long)ieee;
7238 @@ -2153,25 +2179,34 @@
7239
7240 init_timer(&ieee->associate_timer);
7241 ieee->associate_timer.data = (unsigned long)ieee;
7242 - ieee->associate_timer.function = ieee80211_associate_abort_cb;
7243 + ieee->associate_timer.function = ieee80211_associate_abort_cb_rtl7;
7244
7245 init_timer(&ieee->beacon_timer);
7246 ieee->beacon_timer.data = (unsigned long) ieee;
7247 - ieee->beacon_timer.function = ieee80211_send_beacon_cb;
7248 + ieee->beacon_timer.function = ieee80211_send_beacon_cb_rtl7;
7249
7250 #ifdef PF_SYNCTHREAD
7251 ieee->wq = create_workqueue(DRV_NAME,0);
7252 #else
7253 ieee->wq = create_workqueue(DRV_NAME);
7254 #endif
7255 -
7256 - INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
7257 - INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
7258 - INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
7259 - INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
7260 - INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
7261 - INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
7262 -
7263 +
7264 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
7265 + INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq_rtl7,ieee);
7266 + INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq_rtl7,ieee);
7267 + INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq_rtl7,ieee);
7268 + INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq_rtl7,ieee);
7269 + INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq_rtl7,ieee);
7270 + INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq_rtl7,ieee);
7271 +#else
7272 + INIT_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq_rtl7);
7273 + INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq_rtl7);
7274 + INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq_rtl7);
7275 + INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq_rtl7);
7276 + INIT_DELAYED_WORK(&ieee->softmac_scan_wq, ieee80211_softmac_scan_wq_rtl7);
7277 + INIT_WORK(&ieee->wx_sync_scan_wq, ieee80211_wx_sync_scan_wq_rtl7);
7278 +#endif
7279 +
7280 sema_init(&ieee->wx_sem, 1);
7281 sema_init(&ieee->scan_sem, 1);
7282
7283 @@ -2179,12 +2214,12 @@
7284 spin_lock_init(&ieee->beacon_lock);
7285
7286 tasklet_init(&ieee->ps_task,
7287 - (void(*)(unsigned long)) ieee80211_sta_ps,
7288 + (void(*)(unsigned long)) ieee80211_sta_ps_rtl7,
7289 (unsigned long)ieee);
7290
7291 }
7292
7293 -void ieee80211_softmac_free(struct ieee80211_device *ieee)
7294 +void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee)
7295 {
7296 down(&ieee->wx_sem);
7297
7298 @@ -2201,7 +2236,7 @@
7299 ********************************************************/
7300
7301
7302 -static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value)
7303 +static int ieee80211_wpa_enable_rtl7(struct ieee80211_device *ieee, int value)
7304 {
7305 /* This is called when wpa_supplicant loads and closes the driver
7306 * interface. */
7307 @@ -2211,16 +2246,16 @@
7308 }
7309
7310
7311 -void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
7312 +void ieee80211_wpa_assoc_frame_rtl7(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
7313 {
7314 /* make sure WPA is enabled */
7315 - ieee80211_wpa_enable(ieee, 1);
7316 + ieee80211_wpa_enable_rtl7(ieee, 1);
7317
7318 - ieee80211_disassociate(ieee);
7319 + ieee80211_disassociate_rtl7(ieee);
7320 }
7321
7322
7323 -static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason)
7324 +static int ieee80211_wpa_mlme_rtl7(struct ieee80211_device *ieee, int command, int reason)
7325 {
7326
7327 int ret = 0;
7328 @@ -2231,7 +2266,7 @@
7329 break;
7330
7331 case IEEE_MLME_STA_DISASSOC:
7332 - ieee80211_disassociate(ieee);
7333 + ieee80211_disassociate_rtl7(ieee);
7334 break;
7335
7336 default:
7337 @@ -2243,7 +2278,7 @@
7338 }
7339
7340
7341 -static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee,
7342 +static int ieee80211_wpa_set_wpa_ie_rtl7(struct ieee80211_device *ieee,
7343 struct ieee_param *param, int plen)
7344 {
7345 u8 *buf;
7346 @@ -2267,14 +2302,14 @@
7347 ieee->wpa_ie_len = 0;
7348 }
7349
7350 - ieee80211_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
7351 + ieee80211_wpa_assoc_frame_rtl7(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
7352 return 0;
7353 }
7354
7355 #define AUTH_ALG_OPEN_SYSTEM 0x1
7356 #define AUTH_ALG_SHARED_KEY 0x2
7357
7358 -static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value)
7359 +static int ieee80211_wpa_set_auth_algs_rtl7(struct ieee80211_device *ieee, int value)
7360 {
7361
7362 struct ieee80211_security sec = {
7363 @@ -2300,13 +2335,13 @@
7364
7365
7366
7367 -static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value)
7368 +static int ieee80211_wpa_set_param_rtl7(struct ieee80211_device *ieee, u8 name, u32 value)
7369 {
7370 int ret=0;
7371
7372 switch (name) {
7373 case IEEE_PARAM_WPA_ENABLED:
7374 - ret = ieee80211_wpa_enable(ieee, value);
7375 + ret = ieee80211_wpa_enable_rtl7(ieee, value);
7376 break;
7377
7378 case IEEE_PARAM_TKIP_COUNTERMEASURES:
7379 @@ -2351,7 +2386,7 @@
7380 break;
7381
7382 case IEEE_PARAM_AUTH_ALGS:
7383 - ret = ieee80211_wpa_set_auth_algs(ieee, value);
7384 + ret = ieee80211_wpa_set_auth_algs_rtl7(ieee, value);
7385 break;
7386
7387 case IEEE_PARAM_IEEE_802_1X:
7388 @@ -2368,7 +2403,7 @@
7389
7390 /* implementation borrowed from hostap driver */
7391
7392 -static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
7393 +static int ieee80211_wpa_set_encryption_rtl7(struct ieee80211_device *ieee,
7394 struct ieee_param *param, int param_len)
7395 {
7396 int ret = 0;
7397 @@ -2407,7 +2442,7 @@
7398 //sec.encrypt = 0;
7399 sec.level = SEC_LEVEL_0;
7400 sec.flags |= SEC_ENABLED | SEC_LEVEL;
7401 - ieee80211_crypt_delayed_deinit(ieee, crypt);
7402 + ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
7403 }
7404 goto done;
7405 }
7406 @@ -2421,16 +2456,16 @@
7407 strcmp(param->u.crypt.alg, "TKIP"))
7408 goto skip_host_crypt;
7409
7410 - ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
7411 + ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
7412 if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
7413 - request_module("ieee80211_crypt_wep");
7414 - ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
7415 + request_module("ieee80211_crypt_wep_rtl7");
7416 + ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
7417 } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {
7418 - request_module("ieee80211_crypt_tkip");
7419 - ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
7420 + request_module("ieee80211_crypt_tkip_rtl7");
7421 + ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
7422 } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {
7423 - request_module("ieee80211_crypt_ccmp");
7424 - ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
7425 + request_module("ieee80211_crypt_ccmp_rtl7");
7426 + ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
7427 }
7428 if (ops == NULL) {
7429 printk("unknown crypto alg '%s'\n", param->u.crypt.alg);
7430 @@ -2442,7 +2477,7 @@
7431 if (*crypt == NULL || (*crypt)->ops != ops) {
7432 struct ieee80211_crypt_data *new_crypt;
7433
7434 - ieee80211_crypt_delayed_deinit(ieee, crypt);
7435 + ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
7436
7437 new_crypt = (struct ieee80211_crypt_data *)
7438 kmalloc(sizeof(*new_crypt), GFP_KERNEL);
7439 @@ -2525,7 +2560,7 @@
7440
7441
7442
7443 -int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p)
7444 +int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p)
7445 {
7446 struct ieee_param *param;
7447 int ret=0;
7448 @@ -2552,20 +2587,20 @@
7449 switch (param->cmd) {
7450
7451 case IEEE_CMD_SET_WPA_PARAM:
7452 - ret = ieee80211_wpa_set_param(ieee, param->u.wpa_param.name,
7453 + ret = ieee80211_wpa_set_param_rtl7(ieee, param->u.wpa_param.name,
7454 param->u.wpa_param.value);
7455 break;
7456
7457 case IEEE_CMD_SET_WPA_IE:
7458 - ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->length);
7459 + ret = ieee80211_wpa_set_wpa_ie_rtl7(ieee, param, p->length);
7460 break;
7461
7462 case IEEE_CMD_SET_ENCRYPTION:
7463 - ret = ieee80211_wpa_set_encryption(ieee, param, p->length);
7464 + ret = ieee80211_wpa_set_encryption_rtl7(ieee, param, p->length);
7465 break;
7466
7467 case IEEE_CMD_MLME:
7468 - ret = ieee80211_wpa_mlme(ieee, param->u.mlme.command,
7469 + ret = ieee80211_wpa_mlme_rtl7(ieee, param->u.mlme.command,
7470 param->u.mlme.reason_code);
7471 break;
7472
7473 @@ -2585,7 +2620,7 @@
7474 return ret;
7475 }
7476
7477 -void notify_wx_assoc_event(struct ieee80211_device *ieee)
7478 +void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee)
7479 {
7480 union iwreq_data wrqu;
7481 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
7482 @@ -2597,14 +2632,14 @@
7483 }
7484
7485
7486 -EXPORT_SYMBOL(ieee80211_get_beacon);
7487 -EXPORT_SYMBOL(ieee80211_wake_queue);
7488 -EXPORT_SYMBOL(ieee80211_stop_queue);
7489 -EXPORT_SYMBOL(ieee80211_reset_queue);
7490 -EXPORT_SYMBOL(ieee80211_softmac_stop_protocol);
7491 -EXPORT_SYMBOL(ieee80211_softmac_start_protocol);
7492 -EXPORT_SYMBOL(ieee80211_is_shortslot);
7493 -EXPORT_SYMBOL(ieee80211_is_54g);
7494 -EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl);
7495 -EXPORT_SYMBOL(ieee80211_ps_tx_ack);
7496 -//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame);
7497 +EXPORT_SYMBOL(ieee80211_get_beacon_rtl7);
7498 +EXPORT_SYMBOL(ieee80211_wake_queue_rtl7);
7499 +EXPORT_SYMBOL(ieee80211_stop_queue_rtl7);
7500 +EXPORT_SYMBOL(ieee80211_reset_queue_rtl7);
7501 +EXPORT_SYMBOL(ieee80211_softmac_stop_protocol_rtl7);
7502 +EXPORT_SYMBOL(ieee80211_softmac_start_protocol_rtl7);
7503 +EXPORT_SYMBOL(ieee80211_is_shortslot_rtl7);
7504 +EXPORT_SYMBOL(ieee80211_is_54g_rtl7);
7505 +EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl_rtl7);
7506 +EXPORT_SYMBOL(ieee80211_ps_tx_ack_rtl7);
7507 +//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame_rtl7);
7508 diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac_wx.c rtl8187_txpower/ieee80211/ieee80211_softmac_wx.c
7509 --- rtl8187_orig/ieee80211/ieee80211_softmac_wx.c 2007-03-13 23:45:09.000000000 +0100
7510 +++ rtl8187_txpower/ieee80211/ieee80211_softmac_wx.c 2007-04-23 00:09:00.000000000 +0200
7511 @@ -1,7 +1,7 @@
7512 /* IEEE 802.11 SoftMAC layer
7513 * Copyright (c) 2005 Andrea Merello <[email protected]>
7514 *
7515 - * Mostly extracted from the rtl8180-sa2400 driver for the
7516 + * Mostly extracted from the rtl8180-sa2400 driver for the
7517 * in-kernel generic ieee802.11 stack.
7518 *
7519 * Some pieces of code might be stolen from ipw2100 driver
7520 @@ -18,23 +18,23 @@
7521
7522 /* FIXME: add A freqs */
7523
7524 -const long ieee80211_wlan_frequencies[] = {
7525 - 2412, 2417, 2422, 2427,
7526 - 2432, 2437, 2442, 2447,
7527 - 2452, 2457, 2462, 2467,
7528 - 2472, 2484
7529 +const long ieee80211_wlan_frequencies_rtl7[] = {
7530 + 2412, 2417, 2422, 2427,
7531 + 2432, 2437, 2442, 2447,
7532 + 2452, 2457, 2462, 2467,
7533 + 2472, 2484
7534 };
7535
7536
7537 -int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
7538 +int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
7539 union iwreq_data *wrqu, char *b)
7540 {
7541 int ret;
7542 struct iw_freq *fwrq = & wrqu->freq;
7543
7544 down(&ieee->wx_sem);
7545 -
7546 - if(ieee->iw_mode == IW_MODE_INFRA){
7547 +
7548 + if(ieee->iw_mode == IW_MODE_INFRA){
7549 ret = -EOPNOTSUPP;
7550 goto out;
7551 }
7552 @@ -45,31 +45,31 @@
7553 fwrq->m <= (int) 2.487e8)) {
7554 int f = fwrq->m / 100000;
7555 int c = 0;
7556 -
7557 - while ((c < 14) && (f != ieee80211_wlan_frequencies[c]))
7558 +
7559 + while ((c < 14) && (f != ieee80211_wlan_frequencies_rtl7[c]))
7560 c++;
7561 -
7562 +
7563 /* hack to fall through */
7564 fwrq->e = 0;
7565 fwrq->m = c + 1;
7566 }
7567 }
7568 -
7569 - if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
7570 +
7571 + if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
7572 ret = -EOPNOTSUPP;
7573 goto out;
7574 -
7575 +
7576 }else { /* Set the channel */
7577 -
7578 -
7579 +
7580 +
7581 ieee->current_network.channel = fwrq->m;
7582 ieee->set_chan(ieee->dev, ieee->current_network.channel);
7583 -
7584 +
7585 if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
7586 if(ieee->state == IEEE80211_LINKED){
7587 -
7588 - ieee80211_stop_send_beacons(ieee);
7589 - ieee80211_start_send_beacons(ieee);
7590 +
7591 + ieee80211_stop_send_beacons_rtl7(ieee);
7592 + ieee80211_start_send_beacons_rtl7(ieee);
7593 }
7594 }
7595
7596 @@ -80,7 +80,7 @@
7597 }
7598
7599
7600 -int ieee80211_wx_get_freq(struct ieee80211_device *ieee,
7601 +int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee,
7602 struct iw_request_info *a,
7603 union iwreq_data *wrqu, char *b)
7604 {
7605 @@ -88,110 +88,110 @@
7606
7607 if (ieee->current_network.channel == 0)
7608 return -1;
7609 -
7610 +
7611 fwrq->m = ieee->current_network.channel;
7612 fwrq->e = 0;
7613 -
7614 +
7615 return 0;
7616 }
7617
7618 -int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
7619 - struct iw_request_info *info,
7620 +int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
7621 + struct iw_request_info *info,
7622 union iwreq_data *wrqu, char *extra)
7623 {
7624 - unsigned long flags;
7625 -
7626 + unsigned long flags;
7627 +
7628 wrqu->ap_addr.sa_family = ARPHRD_ETHER;
7629 -
7630 +
7631 if (ieee->iw_mode == IW_MODE_MONITOR)
7632 return -1;
7633 -
7634 +
7635 /* We want avoid to give to the user inconsistent infos*/
7636 spin_lock_irqsave(&ieee->lock, flags);
7637 -
7638 - if (ieee->state != IEEE80211_LINKED &&
7639 +
7640 + if (ieee->state != IEEE80211_LINKED &&
7641 ieee->state != IEEE80211_LINKED_SCANNING &&
7642 ieee->wap_set == 0)
7643 -
7644 +
7645 memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
7646 else
7647 - memcpy(wrqu->ap_addr.sa_data,
7648 + memcpy(wrqu->ap_addr.sa_data,
7649 ieee->current_network.bssid, ETH_ALEN);
7650 -
7651 +
7652 spin_unlock_irqrestore(&ieee->lock, flags);
7653 -
7654 +
7655 return 0;
7656 }
7657
7658
7659 -int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
7660 +int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
7661 struct iw_request_info *info,
7662 union iwreq_data *awrq,
7663 char *extra)
7664 {
7665 -
7666 +
7667 int ret = 0;
7668 u8 zero[] = {0,0,0,0,0,0};
7669 unsigned long flags;
7670 -
7671 +
7672 + struct sockaddr *temp = NULL;
7673 short ifup = ieee->proto_started;//dev->flags & IFF_UP;
7674 -
7675 +
7676 ieee->sync_scan_hurryup = 1;
7677 -
7678 +
7679 down(&ieee->wx_sem);
7680 -
7681 - struct sockaddr *temp = (struct sockaddr *)awrq;
7682 -
7683 +
7684 + temp = (struct sockaddr *)awrq;
7685 /* use ifconfig hw ether */
7686 if (ieee->iw_mode == IW_MODE_MASTER){
7687 ret = -1;
7688 goto out;
7689 }
7690 -
7691 +
7692 if (temp->sa_family != ARPHRD_ETHER){
7693 ret = -EINVAL;
7694 goto out;
7695 }
7696 -
7697 +
7698 if (ifup)
7699 - ieee80211_stop_protocol(ieee);
7700 -
7701 + ieee80211_stop_protocol_rtl7(ieee);
7702 +
7703 /* just to avoid to give inconsistent infos in the
7704 - * get wx method. not really needed otherwise
7705 + * get wx method. not really needed otherwise
7706 */
7707 spin_lock_irqsave(&ieee->lock, flags);
7708 -
7709 - memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
7710 +
7711 + memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
7712 ieee->wap_set = memcmp(temp->sa_data, zero,ETH_ALEN)!=0;
7713 -
7714 +
7715 spin_unlock_irqrestore(&ieee->lock, flags);
7716 -
7717 +
7718 if (ifup)
7719 - ieee80211_start_protocol(ieee);
7720 -
7721 + ieee80211_start_protocol_rtl7(ieee);
7722 +
7723 out:
7724 up(&ieee->wx_sem);
7725 return ret;
7726 }
7727 -
7728 - int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
7729 +
7730 + int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
7731 {
7732 int len,ret = 0;
7733 unsigned long flags;
7734 -
7735 +
7736 if (ieee->iw_mode == IW_MODE_MONITOR)
7737 return -1;
7738 -
7739 - /* We want avoid to give to the user inconsistent infos*/
7740 +
7741 + /* We want avoid to give to the user inconsistent infos*/
7742 spin_lock_irqsave(&ieee->lock, flags);
7743 -
7744 +
7745 if (ieee->current_network.ssid[0] == '\0' ||
7746 - ieee->current_network.ssid_len == 0){
7747 + ieee->current_network.ssid_len == 0){
7748 ret = -1;
7749 goto out;
7750 }
7751 -
7752 - if (ieee->state != IEEE80211_LINKED &&
7753 +
7754 + if (ieee->state != IEEE80211_LINKED &&
7755 ieee->state != IEEE80211_LINKED_SCANNING &&
7756 ieee->ssid_set == 0){
7757 ret = -1;
7758 @@ -204,59 +204,76 @@
7759
7760 out:
7761 spin_unlock_irqrestore(&ieee->lock, flags);
7762 -
7763 +
7764 return ret;
7765 -
7766 +
7767 }
7768
7769 -int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
7770 +int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
7771 struct iw_request_info *info,
7772 union iwreq_data *wrqu, char *extra)
7773 {
7774
7775 u32 target_rate = wrqu->bitrate.value;
7776 -
7777 +
7778 ieee->rate = target_rate/100000;
7779 //FIXME: we might want to limit rate also in management protocols.
7780 - return 0;
7781 + return 0;
7782 }
7783
7784
7785
7786 -int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
7787 - struct iw_request_info *info,
7788 +int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
7789 + struct iw_request_info *info,
7790 union iwreq_data *wrqu, char *extra)
7791 {
7792 -
7793 +
7794 wrqu->bitrate.value = ieee->rate * 100000;
7795 -
7796 +
7797 return 0;
7798 }
7799
7800 -int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
7801 +int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
7802 union iwreq_data *wrqu, char *b)
7803 {
7804 -
7805 + short prev = ieee->raw_tx;
7806 +
7807 ieee->sync_scan_hurryup = 1;
7808 -
7809 +
7810 down(&ieee->wx_sem);
7811 -
7812 +
7813 if (wrqu->mode == ieee->iw_mode)
7814 goto out;
7815 -
7816 +
7817 if (wrqu->mode == IW_MODE_MONITOR){
7818 -
7819 - ieee->dev->type = ARPHRD_IEEE80211;
7820 + ieee->dev->type = ARPHRD_IEEE80211_PRISM;
7821 }else{
7822 ieee->dev->type = ARPHRD_ETHER;
7823 }
7824 -
7825 +
7826 if (!ieee->proto_started){
7827 ieee->iw_mode = wrqu->mode;
7828 }else{
7829 - ieee80211_stop_protocol(ieee);
7830 + ieee80211_stop_protocol_rtl7(ieee);
7831 ieee->iw_mode = wrqu->mode;
7832 - ieee80211_start_protocol(ieee);
7833 + ieee80211_start_protocol_rtl7(ieee);
7834 + }
7835 +
7836 + if(ieee->iw_mode == IW_MODE_MONITOR)
7837 + {
7838 + ieee->raw_tx = 1;
7839 + if(prev == 0 && ieee->raw_tx){
7840 + if (ieee->data_hard_resume)
7841 + ieee->data_hard_resume(ieee->dev);
7842 +
7843 + netif_carrier_on(ieee->dev);
7844 + }
7845 +
7846 + netif_carrier_on(ieee->dev);
7847 + }
7848 + else
7849 + {
7850 + ieee->raw_tx = 0;
7851 }
7852
7853 out:
7854 @@ -264,120 +281,132 @@
7855 return 0;
7856 }
7857
7858 -void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
7859 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
7860 +void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work)
7861 {
7862 + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
7863 +#else
7864 +void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee)
7865 +{
7866 +#endif
7867 short chan;
7868
7869 chan = ieee->current_network.channel;
7870 -
7871 +
7872 netif_carrier_off(ieee->dev);
7873 -
7874 +
7875 if (ieee->data_hard_stop)
7876 ieee->data_hard_stop(ieee->dev);
7877 -
7878 - ieee80211_stop_send_beacons(ieee);
7879 -
7880 +
7881 + ieee80211_stop_send_beacons_rtl7(ieee);
7882 +
7883 ieee->state = IEEE80211_LINKED_SCANNING;
7884 ieee->link_change(ieee->dev);
7885 -
7886 - ieee80211_start_scan_syncro(ieee);
7887 -
7888 +
7889 + ieee80211_start_scan_syncro_rtl7(ieee);
7890 +
7891 ieee->set_chan(ieee->dev, chan);
7892 -
7893 +
7894 ieee->state = IEEE80211_LINKED;
7895 ieee->link_change(ieee->dev);
7896 -
7897 +
7898 if (ieee->data_hard_resume)
7899 ieee->data_hard_resume(ieee->dev);
7900 -
7901 +
7902 if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
7903 - ieee80211_start_send_beacons(ieee);
7904 -
7905 + ieee80211_start_send_beacons_rtl7(ieee);
7906 +
7907 netif_carrier_on(ieee->dev);
7908 -
7909 +
7910 up(&ieee->wx_sem);
7911 -
7912 +
7913 }
7914
7915 -int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
7916 +int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
7917 union iwreq_data *wrqu, char *b)
7918 {
7919 int ret = 0;
7920 -
7921 +
7922 down(&ieee->wx_sem);
7923 -
7924 - if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
7925 +
7926 + if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
7927 ret = -1;
7928 goto out;
7929 }
7930 -
7931 +
7932 if ( ieee->state == IEEE80211_LINKED){
7933 queue_work(ieee->wq, &ieee->wx_sync_scan_wq);
7934 /* intentionally forget to up sem */
7935 return 0;
7936 }
7937 -
7938 +
7939 out:
7940 up(&ieee->wx_sem);
7941 return ret;
7942 }
7943
7944 -int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
7945 +int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
7946 struct iw_request_info *a,
7947 union iwreq_data *wrqu, char *extra)
7948 {
7949 -
7950 +
7951 int ret=0,len;
7952 short proto_started;
7953 unsigned long flags;
7954 -
7955 +
7956 ieee->sync_scan_hurryup = 1;
7957 -
7958 +
7959 down(&ieee->wx_sem);
7960 -
7961 +
7962 proto_started = ieee->proto_started;
7963 -
7964 +
7965 if (wrqu->essid.length > IW_ESSID_MAX_SIZE){
7966 ret= -E2BIG;
7967 goto out;
7968 }
7969 -
7970 +
7971 if (ieee->iw_mode == IW_MODE_MONITOR){
7972 ret= -1;
7973 goto out;
7974 }
7975 -
7976 +
7977 if(proto_started)
7978 - ieee80211_stop_protocol(ieee);
7979 -
7980 + ieee80211_stop_protocol_rtl7(ieee);
7981 +
7982 /* this is just to be sure that the GET wx callback
7983 * has consisten infos. not needed otherwise
7984 */
7985 spin_lock_irqsave(&ieee->lock, flags);
7986 -
7987 +
7988 if (wrqu->essid.flags && wrqu->essid.length) {
7989 +#if WIRELESS_EXT > 20
7990 + len = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE);
7991 +#else
7992 len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
7993 -
7994 +#endif
7995 +
7996 strncpy(ieee->current_network.ssid, extra, len);
7997 ieee->current_network.ssid_len = len;
7998 ieee->ssid_set = 1;
7999 }
8000 - else{
8001 + else{
8002 ieee->ssid_set = 0;
8003 ieee->current_network.ssid[0] = '\0';
8004 ieee->current_network.ssid_len = 0;
8005 }
8006 -
8007 +
8008 spin_unlock_irqrestore(&ieee->lock, flags);
8009 -
8010 +
8011 if (proto_started)
8012 - ieee80211_start_protocol(ieee);
8013 + ieee80211_start_protocol_rtl7(ieee);
8014 out:
8015 up(&ieee->wx_sem);
8016 +
8017 +
8018 return ret;
8019 }
8020
8021 - int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
8022 + int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
8023 union iwreq_data *wrqu, char *b)
8024 {
8025
8026 @@ -385,23 +414,23 @@
8027 return 0;
8028 }
8029
8030 - int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
8031 - struct iw_request_info *info,
8032 + int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
8033 + struct iw_request_info *info,
8034 union iwreq_data *wrqu, char *extra)
8035 {
8036 -
8037 +
8038 int *parms = (int *)extra;
8039 int enable = (parms[0] > 0);
8040 short prev = ieee->raw_tx;
8041
8042 down(&ieee->wx_sem);
8043 -
8044 - if(enable)
8045 +
8046 + if(enable)
8047 ieee->raw_tx = 1;
8048 - else
8049 + else
8050 ieee->raw_tx = 0;
8051
8052 - printk(KERN_INFO"raw TX is %s\n",
8053 + printk(KERN_INFO"raw TX is %s\n",
8054 ieee->raw_tx ? "enabled" : "disabled");
8055
8056 if(ieee->iw_mode == IW_MODE_MONITOR)
8057 @@ -409,21 +438,21 @@
8058 if(prev == 0 && ieee->raw_tx){
8059 if (ieee->data_hard_resume)
8060 ieee->data_hard_resume(ieee->dev);
8061 -
8062 - netif_carrier_on(ieee->dev);
8063 +
8064 + netif_carrier_on(ieee->dev);
8065 }
8066 -
8067 +
8068 if(prev && ieee->raw_tx == 1)
8069 - netif_carrier_off(ieee->dev);
8070 + netif_carrier_off(ieee->dev);
8071 }
8072 -
8073 +
8074 up(&ieee->wx_sem);
8075 -
8076 +
8077 return 0;
8078 }
8079 -
8080 -int ieee80211_wx_get_name(struct ieee80211_device *ieee,
8081 - struct iw_request_info *info,
8082 +
8083 +int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
8084 + struct iw_request_info *info,
8085 union iwreq_data *wrqu, char *extra)
8086 {
8087 strcpy(wrqu->name, "802.11");
8088 @@ -433,20 +462,20 @@
8089 strcat(wrqu->name, "/g");
8090 }else if(ieee->modulation & IEEE80211_OFDM_MODULATION)
8091 strcat(wrqu->name, "g");
8092 -
8093 - if((ieee->state == IEEE80211_LINKED) ||
8094 +
8095 + if((ieee->state == IEEE80211_LINKED) ||
8096 (ieee->state == IEEE80211_LINKED_SCANNING))
8097 strcat(wrqu->name," linked");
8098 else if(ieee->state != IEEE80211_NOLINK)
8099 strcat(wrqu->name," link..");
8100 -
8101 -
8102 +
8103 +
8104 return 0;
8105 }
8106
8107
8108 /* this is mostly stolen from hostap */
8109 -int ieee80211_wx_set_power(struct ieee80211_device *ieee,
8110 +int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
8111 struct iw_request_info *info,
8112 union iwreq_data *wrqu, char *extra)
8113 {
8114 @@ -457,50 +486,50 @@
8115 (!ieee->ps_request_tx_ack) ||
8116 (!ieee->enter_sleep_state) ||
8117 (!ieee->ps_is_queue_empty)){
8118 -
8119 +
8120 printk("ERROR. PS mode is tryied to be use but\
8121 -driver missed a callback\n\n");
8122 -
8123 +driver missed a callback\n\n");
8124 +
8125 return -1;
8126 }
8127 -
8128 +
8129 down(&ieee->wx_sem);
8130 -
8131 +
8132 if (wrqu->power.disabled){
8133 ieee->ps = IEEE80211_PS_DISABLED;
8134 -
8135 +
8136 goto exit;
8137 }
8138 switch (wrqu->power.flags & IW_POWER_MODE) {
8139 case IW_POWER_UNICAST_R:
8140 ieee->ps = IEEE80211_PS_UNICAST;
8141 -
8142 +
8143 break;
8144 case IW_POWER_ALL_R:
8145 - ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
8146 + ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
8147 break;
8148 -
8149 +
8150 case IW_POWER_ON:
8151 ieee->ps = IEEE80211_PS_DISABLED;
8152 break;
8153 -
8154 +
8155 default:
8156 ret = -EINVAL;
8157 goto exit;
8158 }
8159
8160 if (wrqu->power.flags & IW_POWER_TIMEOUT) {
8161 -
8162 +
8163 ieee->ps_timeout = wrqu->power.value / 1000;
8164 printk("Timeout %d\n",ieee->ps_timeout);
8165 }
8166 -
8167 +
8168 if (wrqu->power.flags & IW_POWER_PERIOD) {
8169 -
8170 +
8171 ret = -EOPNOTSUPP;
8172 goto exit;
8173 //wrq->value / 1024;
8174 -
8175 +
8176 }
8177 exit:
8178 up(&ieee->wx_sem);
8179 @@ -509,15 +538,15 @@
8180 }
8181
8182 /* this is stolen from hostap */
8183 -int ieee80211_wx_get_power(struct ieee80211_device *ieee,
8184 +int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
8185 struct iw_request_info *info,
8186 union iwreq_data *wrqu, char *extra)
8187 {
8188 int ret =0;
8189 -
8190 +
8191 down(&ieee->wx_sem);
8192 -
8193 - if(ieee->ps == IEEE80211_PS_DISABLED){
8194 +
8195 + if(ieee->ps == IEEE80211_PS_DISABLED){
8196 wrqu->power.disabled = 1;
8197 goto exit;
8198 }
8199 @@ -547,19 +576,19 @@
8200
8201 }
8202
8203 -EXPORT_SYMBOL(ieee80211_wx_get_essid);
8204 -EXPORT_SYMBOL(ieee80211_wx_set_essid);
8205 -EXPORT_SYMBOL(ieee80211_wx_set_rate);
8206 -EXPORT_SYMBOL(ieee80211_wx_get_rate);
8207 -EXPORT_SYMBOL(ieee80211_wx_set_wap);
8208 -EXPORT_SYMBOL(ieee80211_wx_get_wap);
8209 -EXPORT_SYMBOL(ieee80211_wx_set_mode);
8210 -EXPORT_SYMBOL(ieee80211_wx_get_mode);
8211 -EXPORT_SYMBOL(ieee80211_wx_set_scan);
8212 -EXPORT_SYMBOL(ieee80211_wx_get_freq);
8213 -EXPORT_SYMBOL(ieee80211_wx_set_freq);
8214 -EXPORT_SYMBOL(ieee80211_wx_set_rawtx);
8215 -EXPORT_SYMBOL(ieee80211_wx_get_name);
8216 -EXPORT_SYMBOL(ieee80211_wx_set_power);
8217 -EXPORT_SYMBOL(ieee80211_wx_get_power);
8218 -EXPORT_SYMBOL(ieee80211_wlan_frequencies);
8219 +EXPORT_SYMBOL(ieee80211_wx_get_essid_rtl7);
8220 +EXPORT_SYMBOL(ieee80211_wx_set_essid_rtl7);
8221 +EXPORT_SYMBOL(ieee80211_wx_set_rate_rtl7);
8222 +EXPORT_SYMBOL(ieee80211_wx_get_rate_rtl7);
8223 +EXPORT_SYMBOL(ieee80211_wx_set_wap_rtl7);
8224 +EXPORT_SYMBOL(ieee80211_wx_get_wap_rtl7);
8225 +EXPORT_SYMBOL(ieee80211_wx_set_mode_rtl7);
8226 +EXPORT_SYMBOL(ieee80211_wx_get_mode_rtl7);
8227 +EXPORT_SYMBOL(ieee80211_wx_set_scan_rtl7);
8228 +EXPORT_SYMBOL(ieee80211_wx_get_freq_rtl7);
8229 +EXPORT_SYMBOL(ieee80211_wx_set_freq_rtl7);
8230 +EXPORT_SYMBOL(ieee80211_wx_set_rawtx_rtl7);
8231 +EXPORT_SYMBOL(ieee80211_wx_get_name_rtl7);
8232 +EXPORT_SYMBOL(ieee80211_wx_set_power_rtl7);
8233 +EXPORT_SYMBOL(ieee80211_wx_get_power_rtl7);
8234 +EXPORT_SYMBOL(ieee80211_wlan_frequencies_rtl7);
8235 diff -Naur rtl8187_orig/ieee80211/ieee80211_tx.c rtl8187_txpower/ieee80211/ieee80211_tx.c
8236 --- rtl8187_orig/ieee80211/ieee80211_tx.c 2007-03-13 23:45:09.000000000 +0100
8237 +++ rtl8187_txpower/ieee80211/ieee80211_tx.c 2007-04-23 00:09:00.000000000 +0200
8238 @@ -32,7 +32,6 @@
8239 ******************************************************************************/
8240
8241 #include <linux/compiler.h>
8242 -#include <linux/config.h>
8243 #include <linux/errno.h>
8244 #include <linux/if_arp.h>
8245 #include <linux/in6.h>
8246 @@ -52,6 +51,12 @@
8247 #include <linux/etherdevice.h>
8248 #include <asm/uaccess.h>
8249
8250 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
8251 +#include <linux/config.h>
8252 +#else
8253 +#include <linux/autoconf.h>
8254 +#endif
8255 +
8256 #include "ieee80211.h"
8257
8258
8259 @@ -155,7 +160,7 @@
8260 static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
8261 static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
8262
8263 -static inline int ieee80211_put_snap(u8 *data, u16 h_proto)
8264 +static inline int ieee80211_put_snap_rtl7(u8 *data, u16 h_proto)
8265 {
8266 struct ieee80211_snap_hdr *snap;
8267 u8 *oui;
8268 @@ -178,7 +183,7 @@
8269 return SNAP_SIZE + sizeof(u16);
8270 }
8271
8272 -int ieee80211_encrypt_fragment(
8273 +int ieee80211_encrypt_fragment_rtl7(
8274 struct ieee80211_device *ieee,
8275 struct sk_buff *frag,
8276 int hdr_len)
8277 @@ -225,7 +230,7 @@
8278 }
8279
8280
8281 -void ieee80211_txb_free(struct ieee80211_txb *txb) {
8282 +void ieee80211_txb_free_rtl7(struct ieee80211_txb *txb) {
8283 int i;
8284 if (unlikely(!txb))
8285 return;
8286 @@ -235,7 +240,7 @@
8287 kfree(txb);
8288 }
8289
8290 -struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
8291 +struct ieee80211_txb *ieee80211_alloc_txb_rtl7(int nr_frags, int txb_size,
8292 int gfp_mask)
8293 {
8294 struct ieee80211_txb *txb;
8295 @@ -267,7 +272,7 @@
8296 }
8297
8298 /* SKBs are added to the ieee->tx_queue. */
8299 -int ieee80211_xmit(struct sk_buff *skb,
8300 +int ieee80211_xmit_rtl7(struct sk_buff *skb,
8301 struct net_device *dev)
8302 {
8303 struct ieee80211_device *ieee = netdev_priv(dev);
8304 @@ -397,7 +402,7 @@
8305 /* When we allocate the TXB we allocate enough space for the reserve
8306 * and full fragment bytes (bytes_per_frag doesn't include prefix,
8307 * postfix, header, FCS, etc.) */
8308 - txb = ieee80211_alloc_txb(nr_frags, frag_size, GFP_ATOMIC);
8309 + txb = ieee80211_alloc_txb_rtl7(nr_frags, frag_size, GFP_ATOMIC);
8310 if (unlikely(!txb)) {
8311 printk(KERN_WARNING "%s: Could not allocate TXB\n",
8312 ieee->dev->name);
8313 @@ -432,7 +437,7 @@
8314
8315 /* Put a SNAP header on the first fragment */
8316 if (i == 0) {
8317 - ieee80211_put_snap(
8318 + ieee80211_put_snap_rtl7(
8319 skb_put(skb_frag, SNAP_SIZE + sizeof(u16)),
8320 ether_type);
8321 bytes -= SNAP_SIZE + sizeof(u16);
8322 @@ -446,7 +451,7 @@
8323 /* Encryption routine will move the header forward in order
8324 * to insert the IV between the header and the payload */
8325 if (encrypt)
8326 - ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
8327 + ieee80211_encrypt_fragment_rtl7(ieee, skb_frag, hdr_len);
8328 if (ieee->config &
8329 (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
8330 skb_put(skb_frag, 4);
8331 @@ -458,13 +463,14 @@
8332 ieee->seq_ctrl++;
8333 //---
8334 }else{
8335 - if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
8336 +// if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
8337 + if (unlikely(skb->len < 14)) {
8338 printk(KERN_WARNING "%s: skb too small (%d).\n",
8339 ieee->dev->name, skb->len);
8340 goto success;
8341 }
8342
8343 - txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC);
8344 + txb = ieee80211_alloc_txb_rtl7(1, skb->len, GFP_ATOMIC);
8345 if(!txb){
8346 printk(KERN_WARNING "%s: Could not allocate TXB\n",
8347 ieee->dev->name);
8348 @@ -481,14 +487,14 @@
8349 dev_kfree_skb_any(skb);
8350 if (txb) {
8351 if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE){
8352 - ieee80211_softmac_xmit(txb, ieee);
8353 + ieee80211_softmac_xmit_rtl7(txb, ieee);
8354 }else{
8355 if ((*ieee->hard_start_xmit)(txb, dev) == 0) {
8356 stats->tx_packets++;
8357 stats->tx_bytes += txb->payload_size;
8358 return 0;
8359 }
8360 - ieee80211_txb_free(txb);
8361 + ieee80211_txb_free_rtl7(txb);
8362 }
8363
8364
8365 @@ -504,4 +510,4 @@
8366
8367 }
8368
8369 -EXPORT_SYMBOL(ieee80211_txb_free);
8370 +EXPORT_SYMBOL(ieee80211_txb_free_rtl7);
8371 diff -Naur rtl8187_orig/ieee80211/ieee80211_wx.c rtl8187_txpower/ieee80211/ieee80211_wx.c
8372 --- rtl8187_orig/ieee80211/ieee80211_wx.c 2007-03-13 23:45:09.000000000 +0100
8373 +++ rtl8187_txpower/ieee80211/ieee80211_wx.c 2007-04-23 00:09:00.000000000 +0200
8374 @@ -40,7 +40,7 @@
8375 };
8376
8377 #define MAX_CUSTOM_LEN 64
8378 -static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
8379 +static inline char *ipw2100_translate_scan_rtl7(struct ieee80211_device *ieee,
8380 char *start, char *stop,
8381 struct ieee80211_network *network)
8382 {
8383 @@ -207,7 +207,7 @@
8384 return start;
8385 }
8386
8387 -int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
8388 +int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
8389 struct iw_request_info *info,
8390 union iwreq_data *wrqu, char *extra)
8391 {
8392 @@ -220,13 +220,14 @@
8393
8394 IEEE80211_DEBUG_WX("Getting scan\n");
8395 down(&ieee->wx_sem);
8396 + printk("GOT WX GET SCAN WX_SEM LOCK");
8397 spin_lock_irqsave(&ieee->lock, flags);
8398
8399 list_for_each_entry(network, &ieee->network_list, list) {
8400 i++;
8401 if (ieee->scan_age == 0 ||
8402 time_after(network->last_scanned + ieee->scan_age, jiffies))
8403 - ev = ipw2100_translate_scan(ieee, ev, stop, network);
8404 + ev = ipw2100_translate_scan_rtl7(ieee, ev, stop, network);
8405 else
8406 IEEE80211_DEBUG_SCAN(
8407 "Not showing network '%s ("
8408 @@ -247,7 +248,7 @@
8409 return 0;
8410 }
8411
8412 -int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
8413 +int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
8414 struct iw_request_info *info,
8415 union iwreq_data *wrqu, char *keybuf)
8416 {
8417 @@ -281,7 +282,7 @@
8418 if (key_provided && *crypt) {
8419 IEEE80211_DEBUG_WX("Disabling encryption on key %d.\n",
8420 key);
8421 - ieee80211_crypt_delayed_deinit(ieee, crypt);
8422 + ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
8423 } else
8424 IEEE80211_DEBUG_WX("Disabling encryption.\n");
8425
8426 @@ -291,7 +292,7 @@
8427 if (ieee->crypt[i] != NULL) {
8428 if (key_provided)
8429 break;
8430 - ieee80211_crypt_delayed_deinit(
8431 + ieee80211_crypt_delayed_deinit_rtl7(
8432 ieee, &ieee->crypt[i]);
8433 }
8434 }
8435 @@ -314,7 +315,7 @@
8436 strcmp((*crypt)->ops->name, "WEP") != 0) {
8437 /* changing to use WEP; deinit previously used algorithm
8438 * on this key */
8439 - ieee80211_crypt_delayed_deinit(ieee, crypt);
8440 + ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
8441 }
8442
8443 if (*crypt == NULL) {
8444 @@ -326,10 +327,10 @@
8445 if (new_crypt == NULL)
8446 return -ENOMEM;
8447 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
8448 - new_crypt->ops = ieee80211_get_crypto_ops("WEP");
8449 + new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
8450 if (!new_crypt->ops) {
8451 request_module("ieee80211_crypt_wep");
8452 - new_crypt->ops = ieee80211_get_crypto_ops("WEP");
8453 + new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
8454 }
8455
8456 if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
8457 @@ -418,7 +419,7 @@
8458 return 0;
8459 }
8460
8461 -int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
8462 +int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
8463 struct iw_request_info *info,
8464 union iwreq_data *wrqu, char *keybuf)
8465 {
8466 @@ -470,6 +471,6 @@
8467 }
8468
8469
8470 -EXPORT_SYMBOL(ieee80211_wx_get_scan);
8471 -EXPORT_SYMBOL(ieee80211_wx_set_encode);
8472 -EXPORT_SYMBOL(ieee80211_wx_get_encode);
8473 +EXPORT_SYMBOL(ieee80211_wx_get_scan_rtl7);
8474 +EXPORT_SYMBOL(ieee80211_wx_set_encode_rtl7);
8475 +EXPORT_SYMBOL(ieee80211_wx_get_encode_rtl7);