nexmon – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 diff -Naur rtl8187_orig/beta-8187/ieee80211.h rtl8187_txpower/beta-8187/ieee80211.h
2 --- rtl8187_orig/beta-8187/ieee80211.h 2006-06-06 04:58:02.000000000 +0200
3 +++ rtl8187_txpower/beta-8187/ieee80211.h 2007-03-05 00:31:41.255175682 +0100
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 2006-06-06 04:58:00.000000000 +0200
310 +++ rtl8187_txpower/beta-8187/r8180_93cx6.c 2007-03-05 00:31:37.815123790 +0100
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 2006-06-06 04:58:00.000000000 +0200
322 +++ rtl8187_txpower/beta-8187/r8180_hw.h 2007-03-05 00:31:41.295176286 +0100
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 2006-06-06 04:58:02.000000000 +0200
334 +++ rtl8187_txpower/beta-8187/r8180_rtl8225.c 2007-03-05 00:31:37.935125600 +0100
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 2006-06-06 04:58:00.000000000 +0200
403 +++ rtl8187_txpower/beta-8187/r8180_rtl8225.h 2007-03-05 00:31:41.435178397 +0100
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 2006-06-06 04:58:02.000000000 +0200
412 +++ rtl8187_txpower/beta-8187/r8180_rtl8225z2.c 2007-03-05 00:31:38.025126958 +0100
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 2006-06-06 04:58:02.000000000 +0200
501 +++ rtl8187_txpower/beta-8187/r8180_wx.c 2007-03-05 00:31:38.045127259 +0100
502 @@ -21,6 +21,7 @@
503  
504 #include "r8187.h"
505 #include "r8180_hw.h"
506 +#include "r8180_rtl8225.h"
507  
508  
509 #define RATE_COUNT 4
510 @@ -32,9 +33,9 @@
511 struct iw_request_info *a,
512 union iwreq_data *wrqu, char *b)
513 {
514 - struct r8180_priv *priv = ieee80211_priv(dev);
515 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
516  
517 - return ieee80211_wx_get_freq(priv->ieee80211,a,wrqu,b);
518 + return ieee80211_wx_get_freq_rtl7(priv->ieee80211,a,wrqu,b);
519 }
520  
521  
522 @@ -46,7 +47,7 @@
523 int *parms = (int *)b;
524 int bi = parms[0];
525  
526 - struct r8180_priv *priv = ieee80211_priv(dev);
527 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
528  
529 down(&priv->wx_sem);
530 DMESG("setting beacon interval to %x",bi);
531 @@ -62,7 +63,7 @@
532 static int r8180_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa,
533 union iwreq_data *wrqu, char *extra)
534 {
535 - struct r8180_priv *priv=ieee80211_priv(dev);
536 + struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
537 int *parms = (int *)extra;
538  
539 priv->ieee80211->force_associate = (parms[0] > 0);
540 @@ -75,9 +76,9 @@
541 static int r8180_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
542 union iwreq_data *wrqu, char *b)
543 {
544 - struct r8180_priv *priv=ieee80211_priv(dev);
545 + struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
546  
547 - return ieee80211_wx_get_mode(priv->ieee80211,a,wrqu,b);
548 + return ieee80211_wx_get_mode_rtl7(priv->ieee80211,a,wrqu,b);
549 }
550  
551  
552 @@ -86,8 +87,8 @@
553 struct iw_request_info *info,
554 union iwreq_data *wrqu, char *extra)
555 {
556 - struct r8180_priv *priv = ieee80211_priv(dev);
557 - return ieee80211_wx_get_rate(priv->ieee80211,info,wrqu,extra);
558 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
559 + return ieee80211_wx_get_rate_rtl7(priv->ieee80211,info,wrqu,extra);
560 }
561  
562  
563 @@ -97,27 +98,83 @@
564 union iwreq_data *wrqu, char *extra)
565 {
566 int ret;
567 - struct r8180_priv *priv = ieee80211_priv(dev);
568 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
569  
570 down(&priv->wx_sem);
571 + ret = ieee80211_wx_set_rate_rtl7(priv->ieee80211,info,wrqu,extra);
572 +
573 + up(&priv->wx_sem);
574 +
575 + return ret;
576 +}
577 +
578 +static int r8180_wx_get_txpow(struct net_device *dev,
579 + struct iw_request_info *info,
580 + union iwreq_data *wrqu, char *extra)
581 +{
582 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
583 + down(&priv->wx_sem);
584 + wrqu->power.value = priv->chtxpwr_ofdm[1] + MIN_TX_POWER;
585 + wrqu->power.fixed = 1;
586 + wrqu->power.flags = IW_TXPOW_DBM;
587 + wrqu->power.disabled = 0;
588 + up(&priv->wx_sem);
589  
590 - ret = ieee80211_wx_set_rate(priv->ieee80211,info,wrqu,extra);
591 + return 0;
592 +}
593 +
594 +#if 0
595 +static int r8180_wx_set_txpow(struct net_device *dev,
596 + struct iw_request_info *info,
597 + union iwreq_data *wrqu, char *extra)
598 +{
599 + int ret = 0, i = 0;
600 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
601  
602 + down(&priv->wx_sem);
603 +
604 + if (wrqu->power.flags != IW_TXPOW_DBM)
605 + {
606 + ret = -EINVAL;
607 + goto out;
608 + }
609 +
610 + if(wrqu->power.value > MAX_TX_POWER)
611 + {
612 + ret = -EINVAL;
613 + goto out;
614 + }
615 +
616 + if(wrqu->power.value < MIN_TX_POWER)
617 + {
618 + ret = -EINVAL;
619 + goto out;
620 + }
621 +
622 + for(i=1;i<=14;i++)
623 + {
624 + priv->chtxpwr[i] = wrqu->power.value + 1 - MIN_TX_POWER;
625 + priv->chtxpwr_ofdm[i] = wrqu->power.value - MIN_TX_POWER;
626 + }
627 + rtl8225z2_SetTXPowerLevel(dev, 1);
628 +
629 + out:
630 up(&priv->wx_sem);
631  
632 return ret;
633 }
634 +#endif
635  
636 static int r8180_wx_set_rawtx(struct net_device *dev,
637 struct iw_request_info *info,
638 union iwreq_data *wrqu, char *extra)
639 {
640 - struct r8180_priv *priv = ieee80211_priv(dev);
641 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
642 int ret;
643  
644 down(&priv->wx_sem);
645  
646 - ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
647 + ret = ieee80211_wx_set_rawtx_rtl7(priv->ieee80211, info, wrqu, extra);
648  
649 up(&priv->wx_sem);
650  
651 @@ -129,7 +186,7 @@
652 struct iw_request_info *info,
653 union iwreq_data *wrqu, char *extra)
654 {
655 - struct r8180_priv *priv = ieee80211_priv(dev);
656 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
657 int *parms = (int *)extra;
658 int enable = (parms[0] > 0);
659 short prev = priv->crcmon;
660 @@ -157,12 +214,12 @@
661 static int r8180_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
662 union iwreq_data *wrqu, char *b)
663 {
664 - struct r8180_priv *priv = ieee80211_priv(dev);
665 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
666 int ret;
667  
668 down(&priv->wx_sem);
669  
670 - ret = ieee80211_wx_set_mode(priv->ieee80211,a,wrqu,b);
671 + ret = ieee80211_wx_set_mode_rtl7(priv->ieee80211,a,wrqu,b);
672  
673 rtl8187_set_rxconf(dev);
674  
675 @@ -176,7 +233,7 @@
676 union iwreq_data *wrqu, char *extra)
677 {
678 struct iw_range *range = (struct iw_range *)extra;
679 - struct r8180_priv *priv = ieee80211_priv(dev);
680 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
681 u16 val;
682 int i;
683  
684 @@ -247,7 +304,7 @@
685 // Include only legal frequencies for some countries
686 if ((priv->challow)[i+1]) {
687 range->freq[val].i = i + 1;
688 - range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000;
689 + range->freq[val].m = ieee80211_wlan_frequencies_rtl7[i] * 100000;
690 range->freq[val].e = 1;
691 val++;
692 } else {
693 @@ -267,14 +324,14 @@
694 static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
695 union iwreq_data *wrqu, char *b)
696 {
697 - struct r8180_priv *priv = ieee80211_priv(dev);
698 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
699 int ret;
700  
701 if(!priv->up) return -1;
702  
703 down(&priv->wx_sem);
704  
705 - ret = ieee80211_wx_set_scan(priv->ieee80211,a,wrqu,b);
706 + ret = ieee80211_wx_set_scan_rtl7(priv->ieee80211,a,wrqu,b);
707  
708 up(&priv->wx_sem);
709 return ret;
710 @@ -286,13 +343,13 @@
711 {
712  
713 int ret;
714 - struct r8180_priv *priv = ieee80211_priv(dev);
715 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
716  
717 if(!priv->up) return -1;
718  
719 down(&priv->wx_sem);
720  
721 - ret = ieee80211_wx_get_scan(priv->ieee80211,a,wrqu,b);
722 + ret = ieee80211_wx_get_scan_rtl7(priv->ieee80211,a,wrqu,b);
723  
724 up(&priv->wx_sem);
725  
726 @@ -304,13 +361,13 @@
727 struct iw_request_info *a,
728 union iwreq_data *wrqu, char *b)
729 {
730 - struct r8180_priv *priv = ieee80211_priv(dev);
731 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
732  
733 int ret;
734  
735 down(&priv->wx_sem);
736  
737 - ret = ieee80211_wx_set_essid(priv->ieee80211,a,wrqu,b);
738 + ret = ieee80211_wx_set_essid_rtl7(priv->ieee80211,a,wrqu,b);
739  
740 up(&priv->wx_sem);
741 return ret;
742 @@ -322,11 +379,11 @@
743 union iwreq_data *wrqu, char *b)
744 {
745 int ret;
746 - struct r8180_priv *priv = ieee80211_priv(dev);
747 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
748  
749 down(&priv->wx_sem);
750  
751 - ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b);
752 + ret = ieee80211_wx_get_essid_rtl7(priv->ieee80211, a, wrqu, b);
753  
754 up(&priv->wx_sem);
755  
756 @@ -338,11 +395,11 @@
757 union iwreq_data *wrqu, char *b)
758 {
759 int ret;
760 - struct r8180_priv *priv = ieee80211_priv(dev);
761 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
762  
763 down(&priv->wx_sem);
764  
765 - ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b);
766 + ret = ieee80211_wx_set_freq_rtl7(priv->ieee80211, a, wrqu, b);
767  
768 up(&priv->wx_sem);
769 return ret;
770 @@ -352,8 +409,8 @@
771 struct iw_request_info *info,
772 union iwreq_data *wrqu, char *extra)
773 {
774 - struct r8180_priv *priv = ieee80211_priv(dev);
775 - return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra);
776 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
777 + return ieee80211_wx_get_name_rtl7(priv->ieee80211, info, wrqu, extra);
778 }
779  
780  
781 @@ -361,7 +418,7 @@
782 struct iw_request_info *info,
783 union iwreq_data *wrqu, char *extra)
784 {
785 - struct r8180_priv *priv = ieee80211_priv(dev);
786 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
787  
788 if (wrqu->frag.disabled)
789 priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
790 @@ -381,7 +438,7 @@
791 struct iw_request_info *info,
792 union iwreq_data *wrqu, char *extra)
793 {
794 - struct r8180_priv *priv = ieee80211_priv(dev);
795 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
796  
797 wrqu->frag.value = priv->ieee80211->fts;
798 wrqu->frag.fixed = 0; /* no auto select */
799 @@ -397,11 +454,11 @@
800 char *extra)
801 {
802 int ret;
803 - struct r8180_priv *priv = ieee80211_priv(dev);
804 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
805  
806 down(&priv->wx_sem);
807  
808 - ret = ieee80211_wx_set_wap(priv->ieee80211,info,awrq,extra);
809 + ret = ieee80211_wx_set_wap_rtl7(priv->ieee80211,info,awrq,extra);
810  
811 up(&priv->wx_sem);
812 return ret;
813 @@ -413,9 +470,9 @@
814 struct iw_request_info *info,
815 union iwreq_data *wrqu, char *extra)
816 {
817 - struct r8180_priv *priv = ieee80211_priv(dev);
818 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
819  
820 - return ieee80211_wx_get_wap(priv->ieee80211,info,wrqu,extra);
821 + return ieee80211_wx_get_wap_rtl7(priv->ieee80211,info,wrqu,extra);
822 }
823  
824  
825 @@ -423,22 +480,22 @@
826 struct iw_request_info *info,
827 union iwreq_data *wrqu, char *key)
828 {
829 - struct r8180_priv *priv = ieee80211_priv(dev);
830 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
831  
832 - return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key);
833 + return ieee80211_wx_get_encode_rtl7(priv->ieee80211, info, wrqu, key);
834 }
835  
836 static int r8180_wx_set_enc(struct net_device *dev,
837 struct iw_request_info *info,
838 union iwreq_data *wrqu, char *key)
839 {
840 - struct r8180_priv *priv = ieee80211_priv(dev);
841 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
842 int ret;
843  
844 down(&priv->wx_sem);
845  
846 DMESG("Setting SW wep key");
847 - ret = ieee80211_wx_set_encode(priv->ieee80211,info,wrqu,key);
848 + ret = ieee80211_wx_set_encode_rtl7(priv->ieee80211,info,wrqu,key);
849  
850 up(&priv->wx_sem);
851 return ret;
852 @@ -448,7 +505,7 @@
853 static int r8180_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union
854 iwreq_data *wrqu, char *p){
855  
856 - struct r8180_priv *priv = ieee80211_priv(dev);
857 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
858 int *parms=(int*)p;
859 int mode=parms[0];
860  
861 @@ -463,7 +520,7 @@
862 struct iw_request_info *info,
863 union iwreq_data *wrqu, char *extra)
864 {
865 - struct r8180_priv *priv = ieee80211_priv(dev);
866 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
867 int err = 0;
868  
869 down(&priv->wx_sem);
870 @@ -516,7 +573,7 @@
871 struct iw_request_info *info,
872 union iwreq_data *wrqu, char *extra)
873 {
874 - struct r8180_priv *priv = ieee80211_priv(dev);
875 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
876  
877  
878 wrqu->retry.disabled = 0; /* can't be disabled */
879 @@ -542,7 +599,7 @@
880 struct iw_request_info *info,
881 union iwreq_data *wrqu, char *extra)
882 {
883 - struct r8180_priv *priv = ieee80211_priv(dev);
884 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
885 if(priv->rf_set_sens == NULL)
886 return -1; /* we have not this support for this radio */
887 wrqu->sens.value = priv->sens;
888 @@ -555,7 +612,7 @@
889 union iwreq_data *wrqu, char *extra)
890 {
891  
892 - struct r8180_priv *priv = ieee80211_priv(dev);
893 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
894  
895 short err = 0;
896 down(&priv->wx_sem);
897 @@ -624,7 +681,7 @@
898 r8180_wx_set_frag, /* SIOCSIWFRAG */
899 r8180_wx_get_frag, /* SIOCGIWFRAG */
900 dummy, /* SIOCSIWTXPOW */
901 - dummy, /* SIOCGIWTXPOW */
902 + r8180_wx_get_txpow, /* SIOCGIWTXPOW */
903 r8180_wx_set_retry, /* SIOCSIWRETRY */
904 r8180_wx_get_retry, /* SIOCGIWRETRY */
905 r8180_wx_set_enc, /* SIOCSIWENCODE */
906 @@ -666,7 +723,7 @@
907 #if WIRELESS_EXT >= 17
908 static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
909 {
910 - struct r8180_priv *priv = ieee80211_priv(dev);
911 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
912  
913 return &priv->wstats;
914 }
915 diff -Naur rtl8187_orig/beta-8187/r8187_core.c rtl8187_txpower/beta-8187/r8187_core.c
916 --- rtl8187_orig/beta-8187/r8187_core.c 2006-06-22 07:43:30.000000000 +0200
917 +++ rtl8187_txpower/beta-8187/r8187_core.c 2007-03-05 00:31:38.115128315 +0100
918 @@ -57,6 +57,7 @@
919 #undef DEBUG_IRQ_TASKLET
920 #undef DEBUG_TX_ALLOC
921 #undef DEBUG_TX_DESC
922 +#undef DEBUG_TX_POWER
923  
924 //#define CONFIG_RTL8180_IO_MAP
925  
926 @@ -98,6 +99,10 @@
927 #endif
928 static int channels = 0x3fff;
929  
930 +#define DEBUG_EPROM
931 +#define DEBUG_REGISTERS
932 +#define DEBUG_TX_POWER
933 +
934 MODULE_LICENSE("GPL");
935 MODULE_VERSION("V 1.1");
936 MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
937 @@ -158,11 +163,10 @@
938 #endif
939 };
940  
941 -
942 void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
943 {
944  
945 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
946 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
947 struct usb_device *udev = priv->udev;
948  
949 usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
950 @@ -174,7 +178,7 @@
951 void write_nic_byte(struct net_device *dev, int indx, u8 data)
952 {
953  
954 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
955 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
956 struct usb_device *udev = priv->udev;
957  
958 usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
959 @@ -186,7 +190,7 @@
960 void write_nic_word(struct net_device *dev, int indx, u16 data)
961 {
962  
963 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
964 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
965 struct usb_device *udev = priv->udev;
966  
967 usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
968 @@ -198,7 +202,7 @@
969 void write_nic_dword(struct net_device *dev, int indx, u32 data)
970 {
971  
972 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
973 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
974 struct usb_device *udev = priv->udev;
975  
976 usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
977 @@ -211,7 +215,7 @@
978 u8 read_nic_byte(struct net_device *dev, int indx)
979 {
980 u8 data;
981 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
982 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
983 struct usb_device *udev = priv->udev;
984  
985 usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
986 @@ -223,7 +227,7 @@
987 u8 read_nic_byte_E(struct net_device *dev, int indx)
988 {
989 u8 data;
990 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
991 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
992 struct usb_device *udev = priv->udev;
993  
994 usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
995 @@ -236,7 +240,7 @@
996 u16 read_nic_word(struct net_device *dev, int indx)
997 {
998 u16 data;
999 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1000 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1001 struct usb_device *udev = priv->udev;
1002  
1003 usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
1004 @@ -249,7 +253,7 @@
1005 u32 read_nic_dword(struct net_device *dev, int indx)
1006 {
1007 u32 data;
1008 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1009 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1010 struct usb_device *udev = priv->udev;
1011  
1012 usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
1013 @@ -271,7 +275,12 @@
1014 //void set_nic_txring(struct net_device *dev);
1015 static struct net_device_stats *rtl8180_stats(struct net_device *dev);
1016 void rtl8180_commit(struct net_device *dev);
1017 +
1018 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
1019 +void rtl8180_restart(struct work_struct *work);
1020 +#else
1021 void rtl8180_restart(struct net_device *dev);
1022 +#endif
1023  
1024 /****************************************************************************
1025 -----------------------------PROCFS STUFF-------------------------
1026 @@ -284,7 +293,7 @@
1027 int *eof, void *data)
1028 {
1029 struct net_device *dev = data;
1030 -// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1031 +// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1032  
1033 int len = 0;
1034 int i,n;
1035 @@ -319,7 +328,7 @@
1036 int *eof, void *data)
1037 {
1038 struct net_device *dev = data;
1039 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1040 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1041  
1042 int len = 0;
1043  
1044 @@ -339,7 +348,7 @@
1045 int *eof, void *data)
1046 {
1047 struct net_device *dev = data;
1048 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1049 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1050  
1051 int len = 0;
1052  
1053 @@ -391,7 +400,7 @@
1054 int *eof, void *data)
1055 {
1056 struct net_device *dev = data;
1057 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1058 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1059  
1060 int len = 0;
1061  
1062 @@ -407,13 +416,14 @@
1063 return len;
1064 }
1065  
1066 -
1067 +#if WIRELESS_EXT < 17
1068 static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
1069 {
1070 - struct r8180_priv *priv = ieee80211_priv(dev);
1071 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1072  
1073 return &priv->wstats;
1074 }
1075 +#endif
1076  
1077 void rtl8180_proc_module_init(void)
1078 {
1079 @@ -430,7 +440,7 @@
1080  
1081 void rtl8180_proc_remove_one(struct net_device *dev)
1082 {
1083 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1084 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1085 if (priv->dir_dev) {
1086 // remove_proc_entry("stats-hw", priv->dir_dev);
1087 remove_proc_entry("stats-tx", priv->dir_dev);
1088 @@ -447,7 +457,7 @@
1089 void rtl8180_proc_init_one(struct net_device *dev)
1090 {
1091 struct proc_dir_entry *e;
1092 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1093 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1094 priv->dir_dev = create_proc_entry(dev->name,
1095 S_IFDIR | S_IRUGO | S_IXUGO,
1096 rtl8180_proc);
1097 @@ -539,7 +549,7 @@
1098  
1099 short check_nic_enought_desc(struct net_device *dev, priority_t priority)
1100 {
1101 - struct r8180_priv *priv = ieee80211_priv(dev);
1102 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1103  
1104 int used = atomic_read((priority == NORM_PRIORITY) ?
1105 &priv->tx_np_pending : &priv->tx_lp_pending);
1106 @@ -549,7 +559,7 @@
1107  
1108 void tx_timeout(struct net_device *dev)
1109 {
1110 - struct r8180_priv *priv = ieee80211_priv(dev);
1111 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1112 //rtl8180_commit(dev);
1113 schedule_work(&priv->reset_wq);
1114 //DMESG("TXTIMEOUT");
1115 @@ -561,7 +571,20 @@
1116 {
1117 int i;
1118 for(i=0; i<63; i++)
1119 - DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
1120 + DMESG("EEPROM addr %02X : %04X", i, eprom_read(dev,i));
1121 +}
1122 +
1123 +/* this is only for debug */
1124 +void dump_tx_power(struct net_device *dev)
1125 +{
1126 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1127 + int i;
1128 + DMESG("CCK TX-Power (b-mode):");
1129 + for(i=1; i<=14; i++)
1130 + DMESG("Channel %d: %d", i, priv->chtxpwr[i]);
1131 + DMESG("OFDM TX-Power (g-mode):");
1132 + for(i=1; i<=14; i++)
1133 + DMESG("Channel %d: %d", i, priv->chtxpwr_ofdm[i]);
1134 }
1135  
1136 /* this is only for debug */
1137 @@ -575,9 +598,9 @@
1138  
1139 for(n=0;n<=max;)
1140 {
1141 - printk( "\nD: %2x> ", n);
1142 + printk( "\nD: %02X> ", n);
1143 for(i=0;i<16 && n<=max;i++,n++)
1144 - printk("%2x ",read_nic_byte(dev,n));
1145 + printk("%02X ",read_nic_byte(dev,n));
1146 }
1147 printk("\n");
1148 }
1149 @@ -589,7 +612,7 @@
1150  
1151 void rtl8180_irq_enable(struct net_device *dev)
1152 {
1153 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1154 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1155 //priv->irq_enabled = 1;
1156 /*
1157 write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
1158 @@ -603,7 +626,7 @@
1159  
1160 void rtl8180_irq_disable(struct net_device *dev)
1161 {
1162 -// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1163 +// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1164  
1165 write_nic_word(dev,INTA_MASK,0);
1166 force_pci_posting(dev);
1167 @@ -625,7 +648,7 @@
1168  
1169 void rtl8180_update_msr(struct net_device *dev)
1170 {
1171 - struct r8180_priv *priv = ieee80211_priv(dev);
1172 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1173 u8 msr;
1174  
1175 msr = read_nic_byte(dev, MSR);
1176 @@ -653,7 +676,7 @@
1177  
1178 void rtl8180_set_chan(struct net_device *dev,short ch)
1179 {
1180 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1181 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1182 u32 tx;
1183 priv->chan=ch;
1184 #if 0
1185 @@ -670,20 +693,20 @@
1186 tx = read_nic_dword(dev,TX_CONF);
1187 tx &= ~TX_LOOPBACK_MASK;
1188  
1189 -#ifndef LOOP_TEST
1190 +#ifndef LOOP_TEST
1191 write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
1192 -
1193 priv->rf_set_chan(dev,priv->chan);
1194 mdelay(10);
1195 - write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
1196 + write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
1197 #endif
1198 }
1199 +
1200 void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs);
1201  
1202  
1203 void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb)
1204 {
1205 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1206 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1207 int err;
1208  
1209 // u8 *rx;
1210 @@ -710,7 +733,7 @@
1211 void rtl8187_rx_initiate(struct net_device *dev)
1212 {
1213 int i;
1214 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1215 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1216  
1217 if(!priv->rx_urb)
1218 DMESGE("Cannot intiate RX urb mechanism");
1219 @@ -721,7 +744,7 @@
1220  
1221 void rtl8187_set_rxconf(struct net_device *dev)
1222 {
1223 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1224 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1225 u32 rxconf;
1226  
1227 rxconf=read_nic_dword(dev,RX_CONF);
1228 @@ -810,7 +833,7 @@
1229 u8 cmd;
1230 u8 byte;
1231 u32 txconf;
1232 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1233 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1234  
1235 byte = read_nic_byte(dev,CW_CONF);
1236 byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
1237 @@ -889,7 +912,7 @@
1238 #if 0
1239 void rtl8180_beacon_tx_enable(struct net_device *dev)
1240 {
1241 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1242 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1243 priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
1244 rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
1245 write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
1246 @@ -900,7 +923,7 @@
1247 void rtl8180_
1248 _disable(struct net_device *dev)
1249 {
1250 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1251 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1252 priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
1253 rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
1254 write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
1255 @@ -914,7 +937,7 @@
1256 {
1257 u8 cmd;
1258 int i;
1259 - struct r8180_priv *priv = ieee80211_priv(dev);
1260 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1261  
1262 cmd=read_nic_byte(dev,CMD);
1263 write_nic_byte(dev, CMD, cmd &~ \
1264 @@ -939,7 +962,7 @@
1265 #if 0
1266 int i;
1267 u32 *tmp;
1268 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1269 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1270  
1271 priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
1272 sizeof(u32)*8*count,
1273 @@ -1051,7 +1074,7 @@
1274 void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
1275 {
1276 struct net_device *dev = (struct net_device*)rx_urb->context;
1277 - struct r8180_priv *priv = ieee80211_priv(dev);
1278 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1279  
1280 priv->rxurb_task = rx_urb;
1281 // DMESGW("David: Rx tasklet start!");
1282 @@ -1062,7 +1085,7 @@
1283 #if 0
1284 void rtl8180_tx_queues_stop(struct net_device *dev)
1285 {
1286 - //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1287 + //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1288 u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
1289 dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
1290 dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
1291 @@ -1078,7 +1101,7 @@
1292 {
1293 //FIXME !!
1294 #if 0
1295 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1296 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1297 priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
1298 rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
1299 write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
1300 @@ -1091,7 +1114,7 @@
1301 {
1302 // FIXME !!
1303 #if 0
1304 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1305 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1306 priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
1307 rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
1308 write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
1309 @@ -1105,14 +1128,17 @@
1310 */
1311 void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
1312 {
1313 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1314 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1315  
1316 short morefrag = 0;
1317 unsigned long flags;
1318 struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
1319  
1320 if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
1321 - morefrag = 1;
1322 + {
1323 + if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->ieee80211->raw_tx != 1)
1324 + morefrag = 1;
1325 + }
1326 // DMESG("%x %x", h->frame_ctl, h->seq_ctl);
1327 /*
1328 * This function doesn't require lock because we make
1329 @@ -1126,7 +1152,7 @@
1330 //DMESG("TX");
1331 if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
1332 DMESG("Error: no TX slot ");
1333 - ieee80211_stop_queue(priv->ieee80211);
1334 + ieee80211_stop_queue_rtl7(priv->ieee80211);
1335 }
1336  
1337 rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
1338 @@ -1135,7 +1161,7 @@
1339 priv->stats.txdatapkt++;
1340  
1341 if (!check_nic_enought_desc(dev, LOW_PRIORITY))
1342 - ieee80211_stop_queue(priv->ieee80211);
1343 + ieee80211_stop_queue_rtl7(priv->ieee80211);
1344  
1345 spin_unlock_irqrestore(&priv->tx_lock,flags);
1346  
1347 @@ -1148,7 +1174,7 @@
1348 */
1349 int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
1350 {
1351 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1352 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1353 int ret;
1354 unsigned long flags;
1355  
1356 @@ -1228,7 +1254,7 @@
1357 void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs)
1358 {
1359 struct net_device *dev = (struct net_device*)tx_urb->context;
1360 - struct r8180_priv *priv = ieee80211_priv(dev);
1361 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1362 if(tx_urb->status == 0)
1363 priv->stats.txlpokint++;
1364 else
1365 @@ -1259,7 +1285,7 @@
1366 void rtl8187_net_update(struct net_device *dev)
1367 {
1368  
1369 - struct r8180_priv *priv = ieee80211_priv(dev);
1370 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1371 struct ieee80211_network *net;
1372 net = & priv->ieee80211->current_network;
1373  
1374 @@ -1283,13 +1309,13 @@
1375 void rtl8187_beacon_tx(struct net_device *dev)
1376 {
1377  
1378 - struct r8180_priv *priv = ieee80211_priv(dev);
1379 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1380 struct sk_buff *skb;
1381 int i = 0;
1382  
1383 rtl8187_net_update(dev);
1384  
1385 - skb = ieee80211_get_beacon(priv->ieee80211);
1386 + skb = ieee80211_get_beacon_rtl7(priv->ieee80211);
1387  
1388  
1389 if(!skb){
1390 @@ -1327,7 +1353,7 @@
1391 void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs)
1392 {
1393 struct net_device *dev = (struct net_device*)tx_urb->context;
1394 - struct r8180_priv *priv = ieee80211_priv(dev);
1395 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1396 if(tx_urb->status == 0)
1397 priv->stats.txnpokint++;
1398 else
1399 @@ -1353,7 +1379,7 @@
1400 int status;
1401 struct urb *tx_urb;
1402 int urb_len;
1403 - struct r8180_priv *priv = ieee80211_priv(dev);
1404 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1405 // int rate = ieeerate2rtlrate(priv->ieee80211->rate);
1406  
1407 pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
1408 @@ -1445,7 +1471,7 @@
1409  
1410 short rtl8187_usb_initendpoints(struct net_device *dev)
1411 {
1412 - struct r8180_priv *priv = ieee80211_priv(dev);
1413 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1414 int i;
1415  
1416 priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
1417 @@ -1483,7 +1509,7 @@
1418  
1419 void rtl8187_usb_deleteendpoints(struct net_device *dev)
1420 {
1421 - struct r8180_priv *priv = ieee80211_priv(dev);
1422 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1423 int i;
1424  
1425 if(priv->rx_urb){
1426 @@ -1506,9 +1532,9 @@
1427 u16 word;
1428 int basic_rate,min_rr_rate,max_rr_rate;
1429  
1430 -// struct r8180_priv *priv = ieee80211_priv(dev);
1431 +// struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1432  
1433 - //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
1434 + //if (ieee80211_is_54g_rtl7(priv->ieee80211->current_network) &&
1435 // priv->ieee80211->state == IEEE80211_LINKED){
1436 basic_rate = ieeerate2rtlrate(240);
1437 min_rr_rate = ieeerate2rtlrate(60);
1438 @@ -1532,7 +1558,7 @@
1439 word |= (1<<i);
1440  
1441 write_nic_word(dev, BRSR, word);
1442 - //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
1443 + DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
1444 }
1445  
1446  
1447 @@ -1540,7 +1566,7 @@
1448 {
1449 // int i;
1450  
1451 - struct r8180_priv *priv = ieee80211_priv(dev);
1452 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1453 //write_nic_word(dev, BintrItv, net->beacon_interval);
1454 rtl8187_net_update(dev);
1455 /*update timing params*/
1456 @@ -1554,13 +1580,13 @@
1457 short rtl8180_init(struct net_device *dev)
1458 {
1459  
1460 - struct r8180_priv *priv = ieee80211_priv(dev);
1461 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1462 int i, j;
1463 u16 word;
1464 - int ch;
1465 + int ch, chans;
1466 //u16 version;
1467 - //u8 hw_version;
1468 - //u8 config3;
1469 + u8 hw_version;
1470 + u8 config3;
1471  
1472 //FIXME: these constants are placed in a bad pleace.
1473  
1474 @@ -1580,6 +1606,13 @@
1475 return -1;
1476 }
1477 ch=channels;
1478 + chans=0;
1479 + for (i=1; i<=14; i++) {
1480 + if( (u8)(ch & 0x01) ) chans++;
1481 + ch >>= 1;
1482 + }
1483 + DMESG("Enabling %d channels.", chans);
1484 + ch=channels;
1485 // set channels 1..14 allowed in given locale
1486 for (i=1; i<=14; i++) {
1487 (priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
1488 @@ -1588,6 +1621,8 @@
1489 //memcpy(priv->stats,0,sizeof(struct Stats));
1490  
1491 //priv->irq_enabled=0;
1492 +
1493 + priv->dev = dev;
1494  
1495 // priv->stats.rxdmafail=0;
1496 priv->stats.txrdu=0;
1497 @@ -1622,7 +1657,11 @@
1498 priv->ieee80211->mode = IEEE_G;
1499 priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
1500 spin_lock_init(&priv->tx_lock);
1501 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
1502 INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
1503 +#else
1504 + INIT_WORK(&priv->reset_wq, rtl8180_restart);
1505 +#endif
1506 sema_init(&priv->wx_sem,1);
1507 tasklet_init(&priv->irq_rx_tasklet,
1508 (void(*)(unsigned long))rtl8180_irq_rx_tasklet,
1509 @@ -1716,6 +1755,12 @@
1510 priv->enable_gpio0 = 0;
1511  
1512  
1513 + hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
1514 + config3 = read_nic_byte(dev, CONFIG3);
1515 +
1516 + DMESG("MAC chip version: %02X", hw_version);
1517 + DMESG("Card type: %02X", config3);
1518 +
1519 /* commented out just because we already do
1520 this when resetting the card
1521 andrea 20050924
1522 @@ -1807,6 +1852,12 @@
1523  
1524  
1525 priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
1526 +
1527 +#ifdef DEBUG_TX_POWER
1528 + dump_tx_power(dev);
1529 +#endif
1530 +
1531 + DMESG("RF Chip ID: %02X", priv->rf_chip);
1532  
1533 word = eprom_read(dev,EPROM_TXPW_BASE);
1534 priv->cck_txpwr_base = word & 0xf;
1535 @@ -1988,7 +2039,7 @@
1536  
1537 void rtl8180_adapter_start(struct net_device *dev)
1538 {
1539 - struct r8180_priv *priv = ieee80211_priv(dev);
1540 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1541 //u32 anaparam;
1542 //u8 config3;
1543  
1544 @@ -2077,7 +2128,7 @@
1545 void rtl8180_start_tx_beacon(struct net_device *dev)
1546 {
1547 int i;
1548 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1549 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1550 u16 word;
1551 DMESG("Enabling beacon TX");
1552 //write_nic_byte(dev, 0x42,0xe6);// TCR
1553 @@ -2135,7 +2186,7 @@
1554 ***************************************************************************/
1555 static struct net_device_stats *rtl8180_stats(struct net_device *dev)
1556 {
1557 - struct r8180_priv *priv = ieee80211_priv(dev);
1558 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1559  
1560 return &priv->ieee80211->stats;
1561 }
1562 @@ -2143,36 +2194,32 @@
1563  
1564 int _rtl8180_up(struct net_device *dev)
1565 {
1566 - struct r8180_priv *priv = ieee80211_priv(dev);
1567 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1568  
1569 priv->up=1;
1570  
1571 - //DMESG("Bringing up iface");
1572 +// DMESG("Bringing up iface");
1573  
1574 rtl8180_adapter_start(dev);
1575 -
1576 rtl8180_rx_enable(dev);
1577 -
1578 rtl8180_tx_enable(dev);
1579 -
1580 - ieee80211_softmac_start_protocol(priv->ieee80211);
1581 -
1582 - ieee80211_reset_queue(priv->ieee80211);
1583 + ieee80211_softmac_start_protocol_rtl7(priv->ieee80211);
1584 + ieee80211_reset_queue_rtl7(priv->ieee80211);
1585 if(!netif_queue_stopped(dev))
1586 netif_start_queue(dev);
1587 else
1588 netif_wake_queue(dev);
1589 -
1590 return 0;
1591 }
1592  
1593  
1594 int rtl8180_open(struct net_device *dev)
1595 {
1596 - struct r8180_priv *priv = ieee80211_priv(dev);
1597 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1598 int ret;
1599  
1600 down(&priv->wx_sem);
1601 +
1602 ret = rtl8180_up(dev);
1603 up(&priv->wx_sem);
1604 return ret;
1605 @@ -2182,7 +2229,7 @@
1606  
1607 int rtl8180_up(struct net_device *dev)
1608 {
1609 - struct r8180_priv *priv = ieee80211_priv(dev);
1610 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1611  
1612 if (priv->up == 1) return -1;
1613  
1614 @@ -2192,7 +2239,7 @@
1615  
1616 int rtl8180_close(struct net_device *dev)
1617 {
1618 - struct r8180_priv *priv = ieee80211_priv(dev);
1619 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1620 int ret;
1621  
1622 down(&priv->wx_sem);
1623 @@ -2207,7 +2254,7 @@
1624  
1625 int rtl8180_down(struct net_device *dev)
1626 {
1627 - struct r8180_priv *priv = ieee80211_priv(dev);
1628 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1629  
1630 if (priv->up == 0) return -1;
1631  
1632 @@ -2220,7 +2267,7 @@
1633 rtl8180_rtx_disable(dev);
1634 rtl8180_irq_disable(dev);
1635  
1636 - ieee80211_softmac_stop_protocol(priv->ieee80211);
1637 + ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
1638  
1639 return 0;
1640 }
1641 @@ -2228,23 +2275,28 @@
1642  
1643 void rtl8180_commit(struct net_device *dev)
1644 {
1645 - struct r8180_priv *priv = ieee80211_priv(dev);
1646 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1647  
1648 if (priv->up == 0) return ;
1649  
1650 - ieee80211_softmac_stop_protocol(priv->ieee80211);
1651 + ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
1652  
1653 rtl8180_irq_disable(dev);
1654 rtl8180_rtx_disable(dev);
1655 _rtl8180_up(dev);
1656 }
1657  
1658 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
1659 +void rtl8180_restart(struct work_struct *work)
1660 +{
1661 + struct r8180_priv *priv = container_of(work, struct r8180_priv, reset_wq);
1662 + struct net_device *dev = priv->dev;
1663 +#else
1664 void rtl8180_restart(struct net_device *dev)
1665 {
1666 - struct r8180_priv *priv = ieee80211_priv(dev);
1667 -
1668 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1669 +#endif
1670 down(&priv->wx_sem);
1671 -
1672 rtl8180_commit(dev);
1673  
1674 up(&priv->wx_sem);
1675 @@ -2252,7 +2304,7 @@
1676  
1677 static void r8180_set_multicast(struct net_device *dev)
1678 {
1679 - struct r8180_priv *priv = ieee80211_priv(dev);
1680 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1681 short promisc;
1682  
1683 //down(&priv->wx_sem);
1684 @@ -2273,7 +2325,7 @@
1685  
1686 int r8180_set_mac_adr(struct net_device *dev, void *mac)
1687 {
1688 - struct r8180_priv *priv = ieee80211_priv(dev);
1689 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1690 struct sockaddr *addr = mac;
1691  
1692 down(&priv->wx_sem);
1693 @@ -2291,8 +2343,9 @@
1694 /* based on ipw2200 driver */
1695 int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1696 {
1697 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1698 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1699  
1700 +
1701 down(&priv->wx_sem);
1702  
1703 struct iwreq *wrq = (struct iwreq *)rq;
1704 @@ -2300,7 +2353,7 @@
1705 int ret=-1;
1706 switch (cmd) {
1707 case RTL_IOCTL_WPA_SUPPLICANT:
1708 - ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
1709 + ret = ieee80211_wpa_supplicant_ioctl_rtl7(priv->ieee80211, &wrq->u.data);
1710 break;
1711  
1712 default:
1713 @@ -2346,7 +2399,8 @@
1714  
1715 if( flen <= rx_urb->actual_length){
1716  
1717 - stats.signal = (desc[1] & 0x7f00)>>8;
1718 +// stats.signal = (desc[1] & 0x7f00)>>8;
1719 + stats.signal = (desc[1] & 0xff00)>>8;
1720 stats.noise = desc[1] &0xff;
1721 stats.rate = desc[0] >> 20 & 0xf;
1722 stats.mac_time[0] = desc[2];
1723 @@ -2368,7 +2422,9 @@
1724 // priv->rxskb = skb;
1725 // priv->tempstats = &stats;
1726  
1727 - if(!ieee80211_rx(priv->ieee80211,
1728 +
1729 + stats.signal -= stats.noise;
1730 + if(!ieee80211_rx_rtl7(priv->ieee80211,
1731 skb, &stats))
1732 dev_kfree_skb_any(skb);
1733 }
1734 @@ -2398,14 +2454,14 @@
1735  
1736 //printk("===> rtl8187_usb_probe()\n");
1737  
1738 - dev = alloc_ieee80211(sizeof(struct r8180_priv));
1739 + dev = alloc_ieee80211_rtl7(sizeof(struct r8180_priv));
1740  
1741 SET_MODULE_OWNER(dev);
1742 usb_set_intfdata(intf, dev);
1743  
1744 SET_NETDEV_DEV(dev, &intf->dev);
1745  
1746 - priv = ieee80211_priv(dev);
1747 + priv = ieee80211_priv_rtl7(dev);
1748 priv->ieee80211 = netdev_priv(dev);
1749  
1750 priv->udev=udev;
1751 @@ -2418,7 +2474,12 @@
1752 dev->do_ioctl = rtl8180_ioctl;
1753 dev->set_multicast_list = r8180_set_multicast;
1754 dev->set_mac_address = r8180_set_mac_adr;
1755 +#if WIRELESS_EXT >= 12
1756 +#if WIRELESS_EXT < 17
1757 dev->get_wireless_stats = r8180_get_wireless_stats;
1758 +#endif
1759 + dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
1760 +#endif
1761 dev->type=ARPHRD_ETHER;
1762  
1763 if (dev_alloc_name(dev, ifname) < 0){
1764 @@ -2447,7 +2508,7 @@
1765  
1766  
1767 fail:
1768 - free_ieee80211(dev);
1769 + free_ieee80211_rtl7(dev);
1770  
1771 DMESG("wlan driver load failed\n");
1772  
1773 @@ -2464,7 +2525,7 @@
1774  
1775 unregister_netdev(dev);
1776  
1777 - priv=ieee80211_priv(dev);
1778 + priv=ieee80211_priv_rtl7(dev);
1779  
1780 rtl8180_proc_remove_one(dev);
1781  
1782 @@ -2478,12 +2539,12 @@
1783  
1784 }
1785 // pci_disable_device(pdev);
1786 - free_ieee80211(dev);
1787 + free_ieee80211_rtl7(dev);
1788 DMESG("wlan driver removed\n");
1789 }
1790  
1791  
1792 -static int __init rtl8187_usb_module_init(void)
1793 +static int __init rtl8187_usb_module_init_rtl7(void)
1794 {
1795 printk(KERN_INFO "\nLinux kernel driver for RTL8187 \
1796 based WLAN cards\n");
1797 @@ -2495,7 +2556,7 @@
1798 }
1799  
1800  
1801 -static void __exit rtl8187_usb_module_exit(void)
1802 +static void __exit rtl8187_usb_module_exit_rtl7(void)
1803 {
1804 usb_deregister(&rtl8187_usb_driver);
1805  
1806 @@ -2508,14 +2569,14 @@
1807 {
1808 unsigned long flags;
1809 short enough_desc;
1810 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
1811 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
1812  
1813 spin_lock_irqsave(&priv->tx_lock,flags);
1814 enough_desc = check_nic_enought_desc(dev,pri);
1815 spin_unlock_irqrestore(&priv->tx_lock,flags);
1816  
1817 if(enough_desc)
1818 - ieee80211_wake_queue(priv->ieee80211);
1819 + ieee80211_wake_queue_rtl7(priv->ieee80211);
1820 }
1821  
1822  
1823 @@ -2523,5 +2584,5 @@
1824 /***************************************************************************
1825 ------------------- module init / exit stubs ----------------
1826 ****************************************************************************/
1827 -module_init(rtl8187_usb_module_init);
1828 -module_exit(rtl8187_usb_module_exit);
1829 +module_init(rtl8187_usb_module_init_rtl7);
1830 +module_exit(rtl8187_usb_module_exit_rtl7);
1831 diff -Naur rtl8187_orig/beta-8187/r8187.h rtl8187_txpower/beta-8187/r8187.h
1832 --- rtl8187_orig/beta-8187/r8187.h 2006-06-06 08:48:10.000000000 +0200
1833 +++ rtl8187_txpower/beta-8187/r8187.h 2007-03-05 00:31:41.535179906 +0100
1834 @@ -26,7 +26,6 @@
1835  
1836 #include <linux/module.h>
1837 #include <linux/kernel.h>
1838 -#include <linux/config.h>
1839 #include <linux/init.h>
1840 #include <linux/ioport.h>
1841 #include <linux/sched.h>
1842 @@ -47,6 +46,10 @@
1843 #include <asm/io.h>
1844 #include <asm/semaphore.h>
1845  
1846 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
1847 +#include <linux/config.h>
1848 +#endif
1849 +
1850 #include "ieee80211.h"
1851  
1852 #define EPROM_93c46 0
1853 @@ -148,7 +151,7 @@
1854 u8 challow[15]; //channels from 1 to 14, 0 not used
1855 short up;
1856 short crcmon; //if 1 allow bad crc frame reception in monitor mode
1857 -// short prism_hdr;
1858 + short prism_hdr;
1859  
1860 // struct timer_list scan_timer;
1861 /*short scanpending;
1862 diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.c rtl8187_txpower/ieee80211/ieee80211_crypt.c
1863 --- rtl8187_orig/ieee80211/ieee80211_crypt.c 2006-06-06 04:57:56.000000000 +0200
1864 +++ rtl8187_txpower/ieee80211/ieee80211_crypt.c 2007-03-05 00:31:52.275341919 +0100
1865 @@ -11,7 +11,6 @@
1866 *
1867 */
1868  
1869 -#include <linux/config.h>
1870 #include <linux/version.h>
1871 #include <linux/module.h>
1872 #include <linux/init.h>
1873 @@ -19,6 +18,10 @@
1874 #include <asm/string.h>
1875 #include <asm/errno.h>
1876  
1877 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
1878 +#include <linux/config.h>
1879 +#endif
1880 +
1881 #include "ieee80211.h"
1882  
1883 MODULE_AUTHOR("Jouni Malinen");
1884 @@ -38,7 +41,7 @@
1885  
1886 static struct ieee80211_crypto *hcrypt;
1887  
1888 -void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
1889 +void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *ieee,
1890 int force)
1891 {
1892 struct list_head *ptr, *n;
1893 @@ -61,13 +64,13 @@
1894 }
1895 }
1896  
1897 -void ieee80211_crypt_deinit_handler(unsigned long data)
1898 +void ieee80211_crypt_deinit_handler_rtl7(unsigned long data)
1899 {
1900 struct ieee80211_device *ieee = (struct ieee80211_device *)data;
1901 unsigned long flags;
1902  
1903 spin_lock_irqsave(&ieee->lock, flags);
1904 - ieee80211_crypt_deinit_entries(ieee, 0);
1905 + ieee80211_crypt_deinit_entries_rtl7(ieee, 0);
1906 if (!list_empty(&ieee->crypt_deinit_list)) {
1907 printk(KERN_DEBUG "%s: entries remaining in delayed crypt "
1908 "deletion list\n", ieee->dev->name);
1909 @@ -78,7 +81,7 @@
1910  
1911 }
1912  
1913 -void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
1914 +void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
1915 struct ieee80211_crypt_data **crypt)
1916 {
1917 struct ieee80211_crypt_data *tmp;
1918 @@ -103,7 +106,7 @@
1919 spin_unlock_irqrestore(&ieee->lock, flags);
1920 }
1921  
1922 -int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
1923 +int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
1924 {
1925 unsigned long flags;
1926 struct ieee80211_crypto_alg *alg;
1927 @@ -128,7 +131,7 @@
1928 return 0;
1929 }
1930  
1931 -int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops)
1932 +int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
1933 {
1934 unsigned long flags;
1935 struct list_head *ptr;
1936 @@ -159,7 +162,7 @@
1937 }
1938  
1939  
1940 -struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name)
1941 +struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name)
1942 {
1943 unsigned long flags;
1944 struct list_head *ptr;
1945 @@ -186,13 +189,13 @@
1946 }
1947  
1948  
1949 -static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; }
1950 -static void ieee80211_crypt_null_deinit(void *priv) {}
1951 +static void * ieee80211_crypt_null_init_rtl7(int keyidx) { return (void *) 1; }
1952 +static void ieee80211_crypt_null_deinit_rtl7(void *priv) {}
1953  
1954 static struct ieee80211_crypto_ops ieee80211_crypt_null = {
1955 .name = "NULL",
1956 - .init = ieee80211_crypt_null_init,
1957 - .deinit = ieee80211_crypt_null_deinit,
1958 + .init = ieee80211_crypt_null_init_rtl7,
1959 + .deinit = ieee80211_crypt_null_deinit_rtl7,
1960 .encrypt_mpdu = NULL,
1961 .decrypt_mpdu = NULL,
1962 .encrypt_msdu = NULL,
1963 @@ -205,7 +208,7 @@
1964 };
1965  
1966  
1967 -static int __init ieee80211_crypto_init(void)
1968 +static int __init ieee80211_crypto_init_rtl7(void)
1969 {
1970 int ret = -ENOMEM;
1971  
1972 @@ -217,7 +220,7 @@
1973 INIT_LIST_HEAD(&hcrypt->algs);
1974 spin_lock_init(&hcrypt->lock);
1975  
1976 - ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null);
1977 + ret = ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_null);
1978 if (ret < 0) {
1979 kfree(hcrypt);
1980 hcrypt = NULL;
1981 @@ -227,7 +230,7 @@
1982 }
1983  
1984  
1985 -static void __exit ieee80211_crypto_deinit(void)
1986 +static void __exit ieee80211_crypto_deinit_rtl7(void)
1987 {
1988 struct list_head *ptr, *n;
1989  
1990 @@ -247,13 +250,13 @@
1991 kfree(hcrypt);
1992 }
1993  
1994 -EXPORT_SYMBOL(ieee80211_crypt_deinit_entries);
1995 -EXPORT_SYMBOL(ieee80211_crypt_deinit_handler);
1996 -EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit);
1997 -
1998 -EXPORT_SYMBOL(ieee80211_register_crypto_ops);
1999 -EXPORT_SYMBOL(ieee80211_unregister_crypto_ops);
2000 -EXPORT_SYMBOL(ieee80211_get_crypto_ops);
2001 +EXPORT_SYMBOL(ieee80211_crypt_deinit_entries_rtl7);
2002 +EXPORT_SYMBOL(ieee80211_crypt_deinit_handler_rtl7);
2003 +EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit_rtl7);
2004 +
2005 +EXPORT_SYMBOL(ieee80211_register_crypto_ops_rtl7);
2006 +EXPORT_SYMBOL(ieee80211_unregister_crypto_ops_rtl7);
2007 +EXPORT_SYMBOL(ieee80211_get_crypto_ops_rtl7);
2008  
2009 -module_init(ieee80211_crypto_init);
2010 -module_exit(ieee80211_crypto_deinit);
2011 +module_init(ieee80211_crypto_init_rtl7);
2012 +module_exit(ieee80211_crypto_deinit_rtl7);
2013 diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c rtl8187_txpower/ieee80211/ieee80211_crypt_ccmp.c
2014 --- rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c 2006-06-06 04:58:00.000000000 +0200
2015 +++ rtl8187_txpower/ieee80211/ieee80211_crypt_ccmp.c 2007-03-05 00:31:52.295342221 +0100
2016 @@ -9,7 +9,6 @@
2017 * more details.
2018 */
2019  
2020 -#include <linux/config.h>
2021 #include <linux/version.h>
2022 #include <linux/module.h>
2023 #include <linux/init.h>
2024 @@ -22,11 +21,20 @@
2025 #include <asm/string.h>
2026 #include <linux/wireless.h>
2027  
2028 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
2029 + #include <linux/config.h>
2030 +#endif
2031 +
2032 #include "ieee80211.h"
2033  
2034  
2035 #include <linux/crypto.h>
2036 -#include <asm/scatterlist.h>
2037 +
2038 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
2039 + #include <asm/scatterlist.h>
2040 +#else
2041 + #include <linux/scatterlist.h>
2042 +#endif
2043  
2044 MODULE_AUTHOR("Jouni Malinen");
2045 MODULE_DESCRIPTION("Host AP crypt: CCMP");
2046 @@ -59,7 +67,7 @@
2047 u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN];
2048 };
2049  
2050 -void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
2051 +void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_tfm *tfm,
2052 const u8 pt[16], u8 ct[16])
2053 {
2054 struct scatterlist src, dst;
2055 @@ -75,7 +83,7 @@
2056 crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
2057 }
2058  
2059 -static void * ieee80211_ccmp_init(int key_idx)
2060 +static void * ieee80211_ccmp_init_rtl7(int key_idx)
2061 {
2062 struct ieee80211_ccmp_data *priv;
2063  
2064 @@ -105,7 +113,7 @@
2065 }
2066  
2067  
2068 -static void ieee80211_ccmp_deinit(void *priv)
2069 +static void ieee80211_ccmp_deinit_rtl7(void *priv)
2070 {
2071 struct ieee80211_ccmp_data *_priv = priv;
2072 if (_priv && _priv->tfm)
2073 @@ -114,7 +122,7 @@
2074 }
2075  
2076  
2077 -static inline void xor_block(u8 *b, u8 *a, size_t len)
2078 +static inline void xor_block_rtl7(u8 *b, u8 *a, size_t len)
2079 {
2080 int i;
2081 for (i = 0; i < len; i++)
2082 @@ -122,7 +130,7 @@
2083 }
2084  
2085  
2086 -static void ccmp_init_blocks(struct crypto_tfm *tfm,
2087 +static void ccmp_init_blocks_rtl7(struct crypto_tfm *tfm,
2088 struct ieee80211_hdr *hdr,
2089 u8 *pn, size_t dlen, u8 *b0, u8 *auth,
2090 u8 *s0)
2091 @@ -186,18 +194,18 @@
2092 }
2093  
2094 /* Start with the first block and AAD */
2095 - ieee80211_ccmp_aes_encrypt(tfm, b0, auth);
2096 - xor_block(auth, aad, AES_BLOCK_LEN);
2097 - ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
2098 - xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
2099 - ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
2100 + ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, auth);
2101 + xor_block_rtl7(auth, aad, AES_BLOCK_LEN);
2102 + ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
2103 + xor_block_rtl7(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
2104 + ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
2105 b0[0] &= 0x07;
2106 b0[14] = b0[15] = 0;
2107 - ieee80211_ccmp_aes_encrypt(tfm, b0, s0);
2108 + ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, s0);
2109 }
2110  
2111  
2112 -static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
2113 +static int ieee80211_ccmp_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
2114 {
2115 struct ieee80211_ccmp_data *key = priv;
2116 int data_len, i, blocks, last, len;
2117 @@ -237,7 +245,7 @@
2118 *pos++ = key->tx_pn[0];
2119  
2120 hdr = (struct ieee80211_hdr *) skb->data;
2121 - ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
2122 + ccmp_init_blocks_rtl7(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
2123  
2124 blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
2125 last = data_len % AES_BLOCK_LEN;
2126 @@ -245,13 +253,13 @@
2127 for (i = 1; i <= blocks; i++) {
2128 len = (i == blocks && last) ? last : AES_BLOCK_LEN;
2129 /* Authentication */
2130 - xor_block(b, pos, len);
2131 - ieee80211_ccmp_aes_encrypt(key->tfm, b, b);
2132 + xor_block_rtl7(b, pos, len);
2133 + ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b, b);
2134 /* Encryption, with counter */
2135 b0[14] = (i >> 8) & 0xff;
2136 b0[15] = i & 0xff;
2137 - ieee80211_ccmp_aes_encrypt(key->tfm, b0, e);
2138 - xor_block(pos, e, len);
2139 + ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, e);
2140 + xor_block_rtl7(pos, e, len);
2141 pos += len;
2142 }
2143  
2144 @@ -262,7 +270,7 @@
2145 }
2146  
2147  
2148 -static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
2149 +static int ieee80211_ccmp_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
2150 {
2151 struct ieee80211_ccmp_data *key = priv;
2152 u8 keyidx, *pos;
2153 @@ -326,8 +334,8 @@
2154 return -4;
2155 }
2156  
2157 - ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b);
2158 - xor_block(mic, b, CCMP_MIC_LEN);
2159 + ccmp_init_blocks_rtl7(key->tfm, hdr, pn, data_len, b0, a, b);
2160 + xor_block_rtl7(mic, b, CCMP_MIC_LEN);
2161  
2162 blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
2163 last = data_len % AES_BLOCK_LEN;
2164 @@ -337,11 +345,11 @@
2165 /* Decrypt, with counter */
2166 b0[14] = (i >> 8) & 0xff;
2167 b0[15] = i & 0xff;
2168 - ieee80211_ccmp_aes_encrypt(key->tfm, b0, b);
2169 - xor_block(pos, b, len);
2170 + ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, b);
2171 + xor_block_rtl7(pos, b, len);
2172 /* Authentication */
2173 - xor_block(a, pos, len);
2174 - ieee80211_ccmp_aes_encrypt(key->tfm, a, a);
2175 + xor_block_rtl7(a, pos, len);
2176 + ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, a, a);
2177 pos += len;
2178 }
2179  
2180 @@ -365,7 +373,7 @@
2181 }
2182  
2183  
2184 -static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
2185 +static int ieee80211_ccmp_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
2186 {
2187 struct ieee80211_ccmp_data *data = priv;
2188 int keyidx;
2189 @@ -396,7 +404,7 @@
2190 }
2191  
2192  
2193 -static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
2194 +static int ieee80211_ccmp_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
2195 {
2196 struct ieee80211_ccmp_data *data = priv;
2197  
2198 @@ -420,7 +428,7 @@
2199 }
2200  
2201  
2202 -static char * ieee80211_ccmp_print_stats(char *p, void *priv)
2203 +static char * ieee80211_ccmp_print_stats_rtl7(char *p, void *priv)
2204 {
2205 struct ieee80211_ccmp_data *ccmp = priv;
2206 p += sprintf(p, "key[%d] alg=CCMP key_set=%d "
2207 @@ -437,34 +445,34 @@
2208 }
2209  
2210  
2211 -static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
2212 +static struct ieee80211_crypto_ops ieee80211_crypt_ccmp_rtl7 = {
2213 .name = "CCMP",
2214 - .init = ieee80211_ccmp_init,
2215 - .deinit = ieee80211_ccmp_deinit,
2216 - .encrypt_mpdu = ieee80211_ccmp_encrypt,
2217 - .decrypt_mpdu = ieee80211_ccmp_decrypt,
2218 + .init = ieee80211_ccmp_init_rtl7,
2219 + .deinit = ieee80211_ccmp_deinit_rtl7,
2220 + .encrypt_mpdu = ieee80211_ccmp_encrypt_rtl7,
2221 + .decrypt_mpdu = ieee80211_ccmp_decrypt_rtl7,
2222 .encrypt_msdu = NULL,
2223 .decrypt_msdu = NULL,
2224 - .set_key = ieee80211_ccmp_set_key,
2225 - .get_key = ieee80211_ccmp_get_key,
2226 - .print_stats = ieee80211_ccmp_print_stats,
2227 + .set_key = ieee80211_ccmp_set_key_rtl7,
2228 + .get_key = ieee80211_ccmp_get_key_rtl7,
2229 + .print_stats = ieee80211_ccmp_print_stats_rtl7,
2230 .extra_prefix_len = CCMP_HDR_LEN,
2231 .extra_postfix_len = CCMP_MIC_LEN,
2232 .owner = THIS_MODULE,
2233 };
2234  
2235  
2236 -static int __init ieee80211_crypto_ccmp_init(void)
2237 +static int __init ieee80211_crypto_ccmp_init_rtl7(void)
2238 {
2239 - return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp);
2240 + return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
2241 }
2242  
2243  
2244 -static void __exit ieee80211_crypto_ccmp_exit(void)
2245 +static void __exit ieee80211_crypto_ccmp_exit_rtl7(void)
2246 {
2247 - ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
2248 + ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
2249 }
2250  
2251  
2252 -module_init(ieee80211_crypto_ccmp_init);
2253 -module_exit(ieee80211_crypto_ccmp_exit);
2254 +module_init(ieee80211_crypto_ccmp_init_rtl7);
2255 +module_exit(ieee80211_crypto_ccmp_exit_rtl7);
2256 diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.h rtl8187_txpower/ieee80211/ieee80211_crypt.h
2257 --- rtl8187_orig/ieee80211/ieee80211_crypt.h 2006-06-06 04:58:00.000000000 +0200
2258 +++ rtl8187_txpower/ieee80211/ieee80211_crypt.h 2007-03-05 00:31:49.235296061 +0100
2259 @@ -75,12 +75,12 @@
2260 atomic_t refcnt;
2261 };
2262  
2263 -int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
2264 -int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
2265 -struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
2266 -void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
2267 -void ieee80211_crypt_deinit_handler(unsigned long);
2268 -void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
2269 +int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
2270 +int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
2271 +struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
2272 +void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
2273 +void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
2274 +void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
2275 struct ieee80211_crypt_data **crypt);
2276  
2277 #endif
2278 diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c rtl8187_txpower/ieee80211/ieee80211_crypt_tkip.c
2279 --- rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c 2006-06-06 04:57:54.000000000 +0200
2280 +++ rtl8187_txpower/ieee80211/ieee80211_crypt_tkip.c 2007-03-05 00:31:52.355343126 +0100
2281 @@ -9,7 +9,6 @@
2282 * more details.
2283 */
2284  
2285 -#include <linux/config.h>
2286 #include <linux/version.h>
2287 #include <linux/module.h>
2288 #include <linux/init.h>
2289 @@ -21,13 +20,22 @@
2290 #include <linux/if_arp.h>
2291 #include <asm/string.h>
2292  
2293 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
2294 +#include <linux/config.h>
2295 +#endif
2296 +
2297 #include "ieee80211.h"
2298  
2299 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
2300 + #include <asm/scatterlist.h>
2301 +#else
2302 + #include <linux/scatterlist.h>
2303 +#endif
2304  
2305 #include <linux/crypto.h>
2306 -#include <asm/scatterlist.h>
2307 #include <linux/crc32.h>
2308  
2309 +
2310 MODULE_AUTHOR("Jouni Malinen");
2311 MODULE_DESCRIPTION("Host AP crypt: TKIP");
2312 MODULE_LICENSE("GPL");
2313 @@ -62,7 +70,7 @@
2314 u8 rx_hdr[16], tx_hdr[16];
2315 };
2316  
2317 -static void * ieee80211_tkip_init(int key_idx)
2318 +static void * ieee80211_tkip_init_rtl7(int key_idx)
2319 {
2320 struct ieee80211_tkip_data *priv;
2321  
2322 @@ -101,7 +109,7 @@
2323 }
2324  
2325  
2326 -static void ieee80211_tkip_deinit(void *priv)
2327 +static void ieee80211_tkip_deinit_rtl7(void *priv)
2328 {
2329 struct ieee80211_tkip_data *_priv = priv;
2330 if (_priv && _priv->tfm_michael)
2331 @@ -200,7 +208,7 @@
2332  
2333 #define PHASE1_LOOP_COUNT 8
2334  
2335 -static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
2336 +static void tkip_mixing_phase1_rtl7(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
2337 {
2338 int i, j;
2339  
2340 @@ -222,7 +230,7 @@
2341 }
2342  
2343  
2344 -static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
2345 +static void tkip_mixing_phase2_rtl7(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
2346 u16 IV16)
2347 {
2348 /* Make temporary area overlap WEP seed so that the final copy can be
2349 @@ -268,7 +276,7 @@
2350 #endif
2351 }
2352  
2353 -static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
2354 +static int ieee80211_tkip_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
2355 {
2356 struct ieee80211_tkip_data *tkey = priv;
2357 int len;
2358 @@ -283,11 +291,11 @@
2359  
2360 hdr = (struct ieee80211_hdr *) skb->data;
2361 if (!tkey->tx_phase1_done) {
2362 - tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2,
2363 + tkip_mixing_phase1_rtl7(tkey->tx_ttak, tkey->key, hdr->addr2,
2364 tkey->tx_iv32);
2365 tkey->tx_phase1_done = 1;
2366 }
2367 - tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
2368 + tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
2369  
2370 len = skb->len - hdr_len;
2371 pos = skb_push(skb, 8);
2372 @@ -325,7 +333,7 @@
2373 return 0;
2374 }
2375  
2376 -static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
2377 +static int ieee80211_tkip_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
2378 {
2379 struct ieee80211_tkip_data *tkey = priv;
2380 u8 rc4key[16];
2381 @@ -382,10 +390,10 @@
2382 }
2383  
2384 if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) {
2385 - tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
2386 + tkip_mixing_phase1_rtl7(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
2387 tkey->rx_phase1_done = 1;
2388 }
2389 - tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16);
2390 + tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->rx_ttak, iv16);
2391  
2392 plen = skb->len - hdr_len - 12;
2393  
2394 @@ -428,10 +436,14 @@
2395 }
2396  
2397  
2398 -static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
2399 +static int michael_mic_rtl7(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
2400 u8 *data, size_t data_len, u8 *mic)
2401 {
2402 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
2403 + struct hash_desc desc;
2404 +#endif
2405 struct scatterlist sg[2];
2406 + int ret=0;
2407  
2408 if (tkey->tfm_michael == NULL) {
2409 printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
2410 @@ -445,15 +457,24 @@
2411 sg[1].offset = offset_in_page(data);
2412 sg[1].length = data_len;
2413  
2414 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
2415 crypto_digest_init(tkey->tfm_michael);
2416 crypto_digest_setkey(tkey->tfm_michael, key, 8);
2417 crypto_digest_update(tkey->tfm_michael, sg, 2);
2418 crypto_digest_final(tkey->tfm_michael, mic);
2419 +#else
2420 + if (crypto_hash_setkey(tkey->tfm_michael, key, 8))
2421 + return -1;
2422  
2423 - return 0;
2424 + desc.tfm = tkey->tfm_michael;
2425 + desc.flags = 0;
2426 + ret = crypto_hash_digest(&desc, sg, data_len + 16, mic);
2427 +#endif
2428 +
2429 + return ret;
2430 }
2431  
2432 -static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
2433 +static void michael_mic_hdr_rtl7(struct sk_buff *skb, u8 *hdr)
2434 {
2435 struct ieee80211_hdr *hdr11;
2436  
2437 @@ -483,7 +504,7 @@
2438 }
2439  
2440  
2441 -static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv)
2442 +static int ieee80211_michael_mic_add_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
2443 {
2444 struct ieee80211_tkip_data *tkey = priv;
2445 u8 *pos;
2446 @@ -495,9 +516,9 @@
2447 return -1;
2448 }
2449  
2450 - michael_mic_hdr(skb, tkey->tx_hdr);
2451 + michael_mic_hdr_rtl7(skb, tkey->tx_hdr);
2452 pos = skb_put(skb, 8);
2453 - if (michael_mic(tkey, &tkey->key[16], tkey->tx_hdr,
2454 + if (michael_mic_rtl7(tkey, &tkey->key[16], tkey->tx_hdr,
2455 skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
2456 return -1;
2457  
2458 @@ -506,7 +527,7 @@
2459  
2460  
2461 #if WIRELESS_EXT >= 18
2462 -static void ieee80211_michael_mic_failure(struct net_device *dev,
2463 +static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
2464 struct ieee80211_hdr *hdr,
2465 int keyidx)
2466 {
2467 @@ -527,7 +548,7 @@
2468 wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev);
2469 }
2470 #elif WIRELESS_EXT >= 15
2471 -static void ieee80211_michael_mic_failure(struct net_device *dev,
2472 +static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
2473 struct ieee80211_hdr *hdr,
2474 int keyidx)
2475 {
2476 @@ -543,7 +564,7 @@
2477 wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
2478 }
2479 #else /* WIRELESS_EXT >= 15 */
2480 -static inline void ieee80211_michael_mic_failure(struct net_device *dev,
2481 +static inline void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
2482 struct ieee80211_hdr *hdr,
2483 int keyidx)
2484 {
2485 @@ -551,7 +572,7 @@
2486 #endif /* WIRELESS_EXT >= 15 */
2487  
2488  
2489 -static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
2490 +static int ieee80211_michael_mic_verify_rtl7(struct sk_buff *skb, int keyidx,
2491 int hdr_len, void *priv)
2492 {
2493 struct ieee80211_tkip_data *tkey = priv;
2494 @@ -560,8 +581,8 @@
2495 if (!tkey->key_set)
2496 return -1;
2497  
2498 - michael_mic_hdr(skb, tkey->rx_hdr);
2499 - if (michael_mic(tkey, &tkey->key[24], tkey->rx_hdr,
2500 + michael_mic_hdr_rtl7(skb, tkey->rx_hdr);
2501 + if (michael_mic_rtl7(tkey, &tkey->key[24], tkey->rx_hdr,
2502 skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
2503 return -1;
2504 if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
2505 @@ -572,7 +593,7 @@
2506 skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2),
2507 keyidx);
2508 if (skb->dev)
2509 - ieee80211_michael_mic_failure(skb->dev, hdr, keyidx);
2510 + ieee80211_michael_mic_failure_rtl7(skb->dev, hdr, keyidx);
2511 tkey->dot11RSNAStatsTKIPLocalMICFailures++;
2512 return -1;
2513 }
2514 @@ -588,7 +609,7 @@
2515 }
2516  
2517  
2518 -static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
2519 +static int ieee80211_tkip_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
2520 {
2521 struct ieee80211_tkip_data *tkey = priv;
2522 int keyidx;
2523 @@ -618,7 +639,7 @@
2524 }
2525  
2526  
2527 -static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv)
2528 +static int ieee80211_tkip_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
2529 {
2530 struct ieee80211_tkip_data *tkey = priv;
2531  
2532 @@ -648,7 +669,7 @@
2533 }
2534  
2535  
2536 -static char * ieee80211_tkip_print_stats(char *p, void *priv)
2537 +static char * ieee80211_tkip_print_stats_rtl7(char *p, void *priv)
2538 {
2539 struct ieee80211_tkip_data *tkip = priv;
2540 p += sprintf(p, "key[%d] alg=TKIP key_set=%d "
2541 @@ -675,34 +696,34 @@
2542 }
2543  
2544  
2545 -static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
2546 +static struct ieee80211_crypto_ops ieee80211_crypt_tkip_rtl7 = {
2547 .name = "TKIP",
2548 - .init = ieee80211_tkip_init,
2549 - .deinit = ieee80211_tkip_deinit,
2550 - .encrypt_mpdu = ieee80211_tkip_encrypt,
2551 - .decrypt_mpdu = ieee80211_tkip_decrypt,
2552 - .encrypt_msdu = ieee80211_michael_mic_add,
2553 - .decrypt_msdu = ieee80211_michael_mic_verify,
2554 - .set_key = ieee80211_tkip_set_key,
2555 - .get_key = ieee80211_tkip_get_key,
2556 - .print_stats = ieee80211_tkip_print_stats,
2557 + .init = ieee80211_tkip_init_rtl7,
2558 + .deinit = ieee80211_tkip_deinit_rtl7,
2559 + .encrypt_mpdu = ieee80211_tkip_encrypt_rtl7,
2560 + .decrypt_mpdu = ieee80211_tkip_decrypt_rtl7,
2561 + .encrypt_msdu = ieee80211_michael_mic_add_rtl7,
2562 + .decrypt_msdu = ieee80211_michael_mic_verify_rtl7,
2563 + .set_key = ieee80211_tkip_set_key_rtl7,
2564 + .get_key = ieee80211_tkip_get_key_rtl7,
2565 + .print_stats = ieee80211_tkip_print_stats_rtl7,
2566 .extra_prefix_len = 4 + 4, /* IV + ExtIV */
2567 .extra_postfix_len = 8 + 4, /* MIC + ICV */
2568 .owner = THIS_MODULE,
2569 };
2570  
2571  
2572 -static int __init ieee80211_crypto_tkip_init(void)
2573 +static int __init ieee80211_crypto_tkip_init_rtl7(void)
2574 {
2575 - return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip);
2576 + return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
2577 }
2578  
2579  
2580 -static void __exit ieee80211_crypto_tkip_exit(void)
2581 +static void __exit ieee80211_crypto_tkip_exit_rtl7(void)
2582 {
2583 - ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip);
2584 + ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
2585 }
2586  
2587  
2588 -module_init(ieee80211_crypto_tkip_init);
2589 -module_exit(ieee80211_crypto_tkip_exit);
2590 +module_init(ieee80211_crypto_tkip_init_rtl7);
2591 +module_exit(ieee80211_crypto_tkip_exit_rtl7);
2592 diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_wep.c rtl8187_txpower/ieee80211/ieee80211_crypt_wep.c
2593 --- rtl8187_orig/ieee80211/ieee80211_crypt_wep.c 2006-06-06 04:57:54.000000000 +0200
2594 +++ rtl8187_txpower/ieee80211/ieee80211_crypt_wep.c 2007-03-05 00:31:52.395343729 +0100
2595 @@ -9,7 +9,6 @@
2596 * more details.
2597 */
2598  
2599 -#include <linux/config.h>
2600 #include <linux/version.h>
2601 #include <linux/module.h>
2602 #include <linux/init.h>
2603 @@ -18,13 +17,22 @@
2604 #include <linux/skbuff.h>
2605 #include <asm/string.h>
2606  
2607 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
2608 +#include <linux/config.h>
2609 +#endif
2610 +
2611 #include "ieee80211.h"
2612  
2613  
2614 #include <linux/crypto.h>
2615 -#include <asm/scatterlist.h>
2616 #include <linux/crc32.h>
2617  
2618 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
2619 + #include <asm/scatterlist.h>
2620 +#else
2621 + #include <linux/scatterlist.h>
2622 +#endif
2623 +
2624 MODULE_AUTHOR("Jouni Malinen");
2625 MODULE_DESCRIPTION("Host AP crypt: WEP");
2626 MODULE_LICENSE("GPL");
2627 @@ -40,7 +48,7 @@
2628 };
2629  
2630  
2631 -static void * prism2_wep_init(int keyidx)
2632 +static void * prism2_wep_init_rtl7(int keyidx)
2633 {
2634 struct prism2_wep_data *priv;
2635  
2636 @@ -72,7 +80,7 @@
2637 }
2638  
2639  
2640 -static void prism2_wep_deinit(void *priv)
2641 +static void prism2_wep_deinit_rtl7(void *priv)
2642 {
2643 struct prism2_wep_data *_priv = priv;
2644 if (_priv && _priv->tfm)
2645 @@ -87,7 +95,7 @@
2646 *
2647 * WEP frame payload: IV + TX key idx, RC4(data), ICV = RC4(CRC32(data))
2648 */
2649 -static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
2650 +static int prism2_wep_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
2651 {
2652 struct prism2_wep_data *wep = priv;
2653 u32 crc, klen, len;
2654 @@ -151,7 +159,7 @@
2655 * Returns 0 if frame was decrypted successfully and ICV was correct and -1 on
2656 * failure. If frame is OK, IV and ICV will be removed.
2657 */
2658 -static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
2659 +static int prism2_wep_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
2660 {
2661 struct prism2_wep_data *wep = priv;
2662 u32 crc, klen, plen;
2663 @@ -203,7 +211,7 @@
2664 }
2665  
2666  
2667 -static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
2668 +static int prism2_wep_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
2669 {
2670 struct prism2_wep_data *wep = priv;
2671  
2672 @@ -217,7 +225,7 @@
2673 }
2674  
2675  
2676 -static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv)
2677 +static int prism2_wep_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
2678 {
2679 struct prism2_wep_data *wep = priv;
2680  
2681 @@ -230,7 +238,7 @@
2682 }
2683  
2684  
2685 -static char * prism2_wep_print_stats(char *p, void *priv)
2686 +static char * prism2_wep_print_stats_rtl7(char *p, void *priv)
2687 {
2688 struct prism2_wep_data *wep = priv;
2689 p += sprintf(p, "key[%d] alg=WEP len=%d\n",
2690 @@ -239,34 +247,34 @@
2691 }
2692  
2693  
2694 -static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
2695 +static struct ieee80211_crypto_ops ieee80211_crypt_wep_rtl7 = {
2696 .name = "WEP",
2697 - .init = prism2_wep_init,
2698 - .deinit = prism2_wep_deinit,
2699 - .encrypt_mpdu = prism2_wep_encrypt,
2700 - .decrypt_mpdu = prism2_wep_decrypt,
2701 + .init = prism2_wep_init_rtl7,
2702 + .deinit = prism2_wep_deinit_rtl7,
2703 + .encrypt_mpdu = prism2_wep_encrypt_rtl7,
2704 + .decrypt_mpdu = prism2_wep_decrypt_rtl7,
2705 .encrypt_msdu = NULL,
2706 .decrypt_msdu = NULL,
2707 - .set_key = prism2_wep_set_key,
2708 - .get_key = prism2_wep_get_key,
2709 - .print_stats = prism2_wep_print_stats,
2710 + .set_key = prism2_wep_set_key_rtl7,
2711 + .get_key = prism2_wep_get_key_rtl7,
2712 + .print_stats = prism2_wep_print_stats_rtl7,
2713 .extra_prefix_len = 4, /* IV */
2714 .extra_postfix_len = 4, /* ICV */
2715 .owner = THIS_MODULE,
2716 };
2717  
2718  
2719 -static int __init ieee80211_crypto_wep_init(void)
2720 +static int __init ieee80211_crypto_wep_init_rtl7(void)
2721 {
2722 - return ieee80211_register_crypto_ops(&ieee80211_crypt_wep);
2723 + return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
2724 }
2725  
2726  
2727 -static void __exit ieee80211_crypto_wep_exit(void)
2728 +static void __exit ieee80211_crypto_wep_exit_rtl7(void)
2729 {
2730 - ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep);
2731 + ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
2732 }
2733  
2734  
2735 -module_init(ieee80211_crypto_wep_init);
2736 -module_exit(ieee80211_crypto_wep_exit);
2737 +module_init(ieee80211_crypto_wep_init_rtl7);
2738 +module_exit(ieee80211_crypto_wep_exit_rtl7);
2739 diff -Naur rtl8187_orig/ieee80211/ieee80211.h rtl8187_txpower/ieee80211/ieee80211.h
2740 --- rtl8187_orig/ieee80211/ieee80211.h 2006-06-06 04:57:56.000000000 +0200
2741 +++ rtl8187_txpower/ieee80211/ieee80211.h 2007-03-05 00:31:49.235296061 +0100
2742 @@ -156,6 +156,22 @@
2743 struct list_head list;
2744 };
2745  
2746 +#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
2747 +/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
2748 + * (from linux-wlan-ng) */
2749 +struct linux_wlan_ng_val {
2750 + u32 did;
2751 + u16 status, len;
2752 + u32 data;
2753 +} __attribute__ ((packed));
2754 +
2755 +struct linux_wlan_ng_prism_hdr {
2756 + u32 msgcode, msglen;
2757 + char devname[16];
2758 + struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
2759 + noise, rate, istx, frmlen;
2760 +} __attribute__ ((packed));
2761 +
2762 struct ieee80211_hdr {
2763 u16 frame_ctl;
2764 u16 duration_id;
2765 @@ -840,14 +856,14 @@
2766  
2767  
2768 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
2769 -extern inline int is_multicast_ether_addr(const u8 *addr)
2770 +extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
2771 {
2772 return ((addr[0] != 0xff) && (0x01 & addr[0]));
2773 }
2774 #endif
2775  
2776 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
2777 -extern inline int is_broadcast_ether_addr(const u8 *addr)
2778 +extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
2779 {
2780 return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
2781 (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
2782 @@ -1015,10 +1031,16 @@
2783 struct timer_list beacon_timer;
2784  
2785 struct work_struct associate_complete_wq;
2786 +
2787 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
2788 + struct delayed_work associate_retry_wq;
2789 + struct delayed_work softmac_scan_wq;
2790 +#else
2791 struct work_struct associate_retry_wq;
2792 + struct work_struct softmac_scan_wq;
2793 +#endif
2794 struct work_struct start_ibss_wq;
2795 struct work_struct associate_procedure_wq;
2796 - struct work_struct softmac_scan_wq;
2797 struct work_struct wx_sync_scan_wq;
2798  
2799 struct workqueue_struct *wq;
2800 @@ -1154,12 +1176,12 @@
2801  
2802  
2803  
2804 -extern inline void *ieee80211_priv(struct net_device *dev)
2805 +extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
2806 {
2807 return ((struct ieee80211_device *)netdev_priv(dev))->priv;
2808 }
2809  
2810 -extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
2811 +extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
2812 {
2813 /* Single white space is for Linksys APs */
2814 if (essid_len == 1 && essid[0] == ' ')
2815 @@ -1175,7 +1197,7 @@
2816 return 1;
2817 }
2818  
2819 -extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
2820 +extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
2821 {
2822 /*
2823 * It is possible for both access points and our device to support
2824 @@ -1201,7 +1223,7 @@
2825 return 0;
2826 }
2827  
2828 -extern inline int ieee80211_get_hdrlen(u16 fc)
2829 +extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
2830 {
2831 int hdrlen = 24;
2832  
2833 @@ -1229,140 +1251,144 @@
2834  
2835  
2836 /* ieee80211.c */
2837 -extern void free_ieee80211(struct net_device *dev);
2838 -extern struct net_device *alloc_ieee80211(int sizeof_priv);
2839 +extern void free_ieee80211_rtl7(struct net_device *dev);
2840 +extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
2841  
2842 -extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
2843 +extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
2844  
2845 /* ieee80211_tx.c */
2846  
2847 -extern int ieee80211_encrypt_fragment(
2848 +extern int ieee80211_encrypt_fragment_rtl7(
2849 struct ieee80211_device *ieee,
2850 struct sk_buff *frag,
2851 int hdr_len);
2852  
2853 -extern int ieee80211_xmit(struct sk_buff *skb,
2854 +extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
2855 struct net_device *dev);
2856 -extern void ieee80211_txb_free(struct ieee80211_txb *);
2857 +extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
2858  
2859  
2860 /* ieee80211_rx.c */
2861 -extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
2862 +extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
2863 struct ieee80211_rx_stats *rx_stats);
2864 -extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
2865 +extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
2866 struct ieee80211_hdr *header,
2867 struct ieee80211_rx_stats *stats);
2868  
2869 /* ieee80211_wx.c */
2870 -extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
2871 +extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
2872 struct iw_request_info *info,
2873 union iwreq_data *wrqu, char *key);
2874 -extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
2875 +extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
2876 struct iw_request_info *info,
2877 union iwreq_data *wrqu, char *key);
2878 -extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
2879 +extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
2880 struct iw_request_info *info,
2881 union iwreq_data *wrqu, char *key);
2882 /* ieee80211_softmac.c */
2883 -extern short ieee80211_is_54g(struct ieee80211_network net);
2884 -extern short ieee80211_is_shortslot(struct ieee80211_network net);
2885 -extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
2886 +extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
2887 +extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
2888 +extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
2889 struct ieee80211_rx_stats *rx_stats, u16 type,
2890 u16 stype);
2891 -extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
2892 +extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
2893  
2894 -extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
2895 -extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
2896 -extern void ieee80211_start_bss(struct ieee80211_device *ieee);
2897 -extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
2898 -extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
2899 -extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
2900 -extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
2901 -extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
2902 -extern void ieee80211_disassociate(struct ieee80211_device *ieee);
2903 -extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
2904 -extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
2905 -extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
2906 -extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
2907 -extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
2908 -extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
2909 -extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
2910 -extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
2911 -extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
2912 -extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
2913 -extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
2914 -extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
2915 -extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
2916 -extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
2917 -extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
2918 -extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
2919 +extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
2920 +extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
2921 +extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
2922 +extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
2923 +extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
2924 +extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
2925 +extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
2926 +extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
2927 +extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
2928 +extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
2929 +extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
2930 +extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
2931 +extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
2932 +extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
2933 +extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
2934 +extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
2935 +extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
2936 +extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
2937 +extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
2938 +extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
2939 +extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
2940 +extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
2941 +extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
2942 +extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
2943 +extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
2944  
2945 /* ieee80211_softmac_wx.c */
2946  
2947 -extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
2948 +extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
2949 struct iw_request_info *info,
2950 union iwreq_data *wrqu, char *ext);
2951  
2952 -extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
2953 +extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
2954 struct iw_request_info *info,
2955 union iwreq_data *awrq,
2956 char *extra);
2957  
2958 -extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
2959 +extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
2960  
2961 -extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
2962 +extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
2963 struct iw_request_info *info,
2964 union iwreq_data *wrqu, char *extra);
2965  
2966 -extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
2967 +extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
2968 struct iw_request_info *info,
2969 union iwreq_data *wrqu, char *extra);
2970  
2971 -extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
2972 +extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
2973 union iwreq_data *wrqu, char *b);
2974  
2975 -extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
2976 +extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
2977 union iwreq_data *wrqu, char *b);
2978  
2979 -extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
2980 +extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
2981 struct iw_request_info *a,
2982 union iwreq_data *wrqu, char *extra);
2983  
2984 -extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
2985 +extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
2986 union iwreq_data *wrqu, char *b);
2987  
2988 -extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
2989 +extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
2990 union iwreq_data *wrqu, char *b);
2991  
2992 -extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
2993 +extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
2994 union iwreq_data *wrqu, char *b);
2995  
2996 -extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
2997 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
2998 +extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
2999 +#else
3000 +extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
3001 +#endif
3002  
3003 -extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
3004 +extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
3005 struct iw_request_info *info,
3006 union iwreq_data *wrqu, char *extra);
3007  
3008 -extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
3009 +extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
3010 struct iw_request_info *info,
3011 union iwreq_data *wrqu, char *extra);
3012  
3013 -extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
3014 +extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
3015 struct iw_request_info *info,
3016 union iwreq_data *wrqu, char *extra);
3017  
3018 -extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
3019 +extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
3020 struct iw_request_info *info,
3021 union iwreq_data *wrqu, char *extra);
3022  
3023 -extern const long ieee80211_wlan_frequencies[];
3024 +extern const long ieee80211_wlan_frequencies_rtl7[];
3025  
3026 -extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
3027 +extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
3028 {
3029 ieee->scans++;
3030 }
3031  
3032 -extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
3033 +extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
3034 {
3035 return ieee->scans;
3036 }
3037 @@ -1372,7 +1398,7 @@
3038 const char *s = essid;
3039 char *d = escaped;
3040  
3041 - if (ieee80211_is_empty_essid(essid, essid_len)) {
3042 + if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
3043 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
3044 return escaped;
3045 }
3046 diff -Naur rtl8187_orig/ieee80211/ieee80211_module.c rtl8187_txpower/ieee80211/ieee80211_module.c
3047 --- rtl8187_orig/ieee80211/ieee80211_module.c 2006-06-06 04:58:00.000000000 +0200
3048 +++ rtl8187_txpower/ieee80211/ieee80211_module.c 2007-03-05 00:31:52.435344332 +0100
3049 @@ -31,7 +31,6 @@
3050 *******************************************************************************/
3051  
3052 #include <linux/compiler.h>
3053 -#include <linux/config.h>
3054 #include <linux/errno.h>
3055 #include <linux/if_arp.h>
3056 #include <linux/in6.h>
3057 @@ -52,6 +51,10 @@
3058 #include <asm/uaccess.h>
3059 #include <net/arp.h>
3060  
3061 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
3062 +#include <linux/config.h>
3063 +#endif
3064 +
3065 #include "ieee80211.h"
3066  
3067 MODULE_DESCRIPTION("802.11 data/management/control stack");
3068 @@ -60,7 +63,7 @@
3069  
3070 #define DRV_NAME "ieee80211"
3071  
3072 -static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
3073 +static inline int ieee80211_networks_allocate_rtl7(struct ieee80211_device *ieee)
3074 {
3075 if (ieee->networks)
3076 return 0;
3077 @@ -80,7 +83,7 @@
3078 return 0;
3079 }
3080  
3081 -static inline void ieee80211_networks_free(struct ieee80211_device *ieee)
3082 +static inline void ieee80211_networks_free_rtl7(struct ieee80211_device *ieee)
3083 {
3084 if (!ieee->networks)
3085 return;
3086 @@ -88,7 +91,7 @@
3087 ieee->networks = NULL;
3088 }
3089  
3090 -static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee)
3091 +static inline void ieee80211_networks_initialize_rtl7(struct ieee80211_device *ieee)
3092 {
3093 int i;
3094  
3095 @@ -99,7 +102,7 @@
3096 }
3097  
3098  
3099 -struct net_device *alloc_ieee80211(int sizeof_priv)
3100 +struct net_device *alloc_ieee80211_rtl7(int sizeof_priv)
3101 {
3102 struct ieee80211_device *ieee;
3103 struct net_device *dev;
3104 @@ -113,17 +116,17 @@
3105 goto failed;
3106 }
3107 ieee = netdev_priv(dev);
3108 - dev->hard_start_xmit = ieee80211_xmit;
3109 + dev->hard_start_xmit = ieee80211_xmit_rtl7;
3110  
3111 ieee->dev = dev;
3112  
3113 - err = ieee80211_networks_allocate(ieee);
3114 + err = ieee80211_networks_allocate_rtl7(ieee);
3115 if (err) {
3116 IEEE80211_ERROR("Unable to allocate beacon storage: %d\n",
3117 err);
3118 goto failed;
3119 }
3120 - ieee80211_networks_initialize(ieee);
3121 + ieee80211_networks_initialize_rtl7(ieee);
3122  
3123 /* Default fragmentation threshold is maximum payload size */
3124 ieee->fts = DEFAULT_FTS;
3125 @@ -138,7 +141,7 @@
3126 INIT_LIST_HEAD(&ieee->crypt_deinit_list);
3127 init_timer(&ieee->crypt_deinit_timer);
3128 ieee->crypt_deinit_timer.data = (unsigned long)ieee;
3129 - ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler;
3130 + ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler_rtl7;
3131  
3132 spin_lock_init(&ieee->lock);
3133  
3134 @@ -149,7 +152,7 @@
3135 ieee->ieee802_1x = 1;
3136 ieee->raw_tx = 0;
3137  
3138 - ieee80211_softmac_init(ieee);
3139 + ieee80211_softmac_init_rtl7(ieee);
3140  
3141 for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++)
3142 INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]);
3143 @@ -167,7 +170,7 @@
3144 }
3145  
3146  
3147 -void free_ieee80211(struct net_device *dev)
3148 +void free_ieee80211_rtl7(struct net_device *dev)
3149 {
3150 struct ieee80211_device *ieee = netdev_priv(dev);
3151  
3152 @@ -175,9 +178,9 @@
3153 struct list_head *p, *q;
3154  
3155  
3156 - ieee80211_softmac_free(ieee);
3157 + ieee80211_softmac_free_rtl7(ieee);
3158 del_timer_sync(&ieee->crypt_deinit_timer);
3159 - ieee80211_crypt_deinit_entries(ieee, 1);
3160 + ieee80211_crypt_deinit_entries_rtl7(ieee, 1);
3161  
3162 for (i = 0; i < WEP_KEYS; i++) {
3163 struct ieee80211_crypt_data *crypt = ieee->crypt[i];
3164 @@ -191,7 +194,7 @@
3165 }
3166 }
3167  
3168 - ieee80211_networks_free(ieee);
3169 + ieee80211_networks_free_rtl7(ieee);
3170  
3171 for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) {
3172 list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) {
3173 @@ -210,13 +213,13 @@
3174 u32 ieee80211_debug_level = 0;
3175 struct proc_dir_entry *ieee80211_proc = NULL;
3176  
3177 -static int show_debug_level(char *page, char **start, off_t offset,
3178 +static int show_debug_level_rtl7(char *page, char **start, off_t offset,
3179 int count, int *eof, void *data)
3180 {
3181 return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
3182 }
3183  
3184 -static int store_debug_level(struct file *file, const char *buffer,
3185 +static int store_debug_level_rtl7(struct file *file, const char *buffer,
3186 unsigned long count, void *data)
3187 {
3188 char buf[] = "0x00000000";
3189 @@ -243,7 +246,7 @@
3190 return strnlen(buf, count);
3191 }
3192  
3193 -static int __init ieee80211_init(void)
3194 +static int __init ieee80211_init_rtl7(void)
3195 {
3196 struct proc_dir_entry *e;
3197  
3198 @@ -268,7 +271,7 @@
3199 return 0;
3200 }
3201  
3202 -static void __exit ieee80211_exit(void)
3203 +static void __exit ieee80211_exit_rtl7(void)
3204 {
3205 if (ieee80211_proc) {
3206 remove_proc_entry("debug_level", ieee80211_proc);
3207 @@ -282,9 +285,9 @@
3208 MODULE_PARM_DESC(debug, "debug output mask");
3209  
3210  
3211 -module_exit(ieee80211_exit);
3212 -module_init(ieee80211_init);
3213 +module_exit(ieee80211_exit_rtl7);
3214 +module_init(ieee80211_init_rtl7);
3215 #endif
3216  
3217 -EXPORT_SYMBOL(alloc_ieee80211);
3218 -EXPORT_SYMBOL(free_ieee80211);
3219 +EXPORT_SYMBOL(alloc_ieee80211_rtl7);
3220 +EXPORT_SYMBOL(free_ieee80211_rtl7);
3221 diff -Naur rtl8187_orig/ieee80211/ieee80211_rx.c rtl8187_txpower/ieee80211/ieee80211_rx.c
3222 --- rtl8187_orig/ieee80211/ieee80211_rx.c 2006-06-06 04:58:00.000000000 +0200
3223 +++ rtl8187_txpower/ieee80211/ieee80211_rx.c 2007-03-05 00:31:52.485345087 +0100
3224 @@ -22,7 +22,6 @@
3225  
3226  
3227 #include <linux/compiler.h>
3228 -#include <linux/config.h>
3229 #include <linux/errno.h>
3230 #include <linux/if_arp.h>
3231 #include <linux/in6.h>
3232 @@ -43,18 +42,83 @@
3233 #include <asm/uaccess.h>
3234 #include <linux/ctype.h>
3235  
3236 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
3237 +#include <linux/config.h>
3238 +#endif
3239 +
3240 +
3241 #include "ieee80211.h"
3242  
3243 -static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
3244 +static inline void ieee80211_monitor_rx_rtl7(struct ieee80211_device *ieee,
3245 struct sk_buff *skb,
3246 struct ieee80211_rx_stats *rx_stats)
3247 {
3248 - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
3249 - u16 fc = le16_to_cpu(hdr->frame_ctl);
3250 + struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data;
3251 + u16 fc = le16_to_cpu(hdr1->frame_ctl);
3252 + int prism_header;
3253 + int hdrlen, phdrlen, head_need, tail_need;
3254 +
3255 + if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) {
3256 + prism_header = 1;
3257 + phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
3258 + } else {
3259 + prism_header = 0;
3260 + phdrlen = 0;
3261 + }
3262 +
3263 + hdrlen = ieee80211_get_hdrlen_rtl7(fc);
3264 +
3265 + /* check if there is enough room for extra data; if not, expand skb
3266 + * buffer to be large enough for the changes */
3267 + head_need = phdrlen;
3268 + tail_need = 0;
3269 +#ifdef PRISM2_ADD_BOGUS_CRC
3270 + tail_need += 4;
3271 +#endif /* PRISM2_ADD_BOGUS_CRC */
3272 +
3273 + head_need -= skb_headroom(skb);
3274 + tail_need -= skb_tailroom(skb);
3275 +
3276 + if (head_need > 0 || tail_need > 0) {
3277 + if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
3278 + tail_need > 0 ? tail_need : 0,
3279 + GFP_ATOMIC)) {
3280 + printk(KERN_DEBUG "%s: ieee80211_rx failed to "
3281 + "reallocate skb buffer\n", ieee->dev->name);
3282 + dev_kfree_skb_any(skb);
3283 + return;
3284 + }
3285 + }
3286 +
3287 + if (prism_header == 1) {
3288 + struct linux_wlan_ng_prism_hdr *hdr;
3289 + hdr = (struct linux_wlan_ng_prism_hdr *)
3290 + skb_push(skb, phdrlen);
3291 + memset(hdr, 0, phdrlen);
3292 + hdr->msgcode = LWNG_CAP_DID_BASE;
3293 + hdr->msglen = sizeof(*hdr);
3294 + memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname));
3295 +#define LWNG_SETVAL(f,i,s,l,d) \
3296 +hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
3297 +hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
3298 + LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
3299 + LWNG_SETVAL(mactime, 2, 0, 4, ((u32)rx_stats->mac_time));
3300 + LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
3301 + LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
3302 + LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
3303 + LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
3304 + LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
3305 + LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
3306 + LWNG_SETVAL(istx, 9, 0, 4, 0);
3307 + LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
3308 +#undef LWNG_SETVAL
3309 + }
3310  
3311 skb->dev = ieee->dev;
3312 skb->mac.raw = skb->data;
3313 - skb_pull(skb, ieee80211_get_hdrlen(fc));
3314 + skb_pull(skb, hdrlen);
3315 + if (prism_header)
3316 + skb_pull(skb, phdrlen);
3317 skb->pkt_type = PACKET_OTHERHOST;
3318 skb->protocol = __constant_htons(ETH_P_80211_RAW);
3319 memset(skb->cb, 0, sizeof(skb->cb));
3320 @@ -64,7 +128,7 @@
3321  
3322 /* Called only as a tasklet (software IRQ) */
3323 static struct ieee80211_frag_entry *
3324 -ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq,
3325 +ieee80211_frag_cache_find_rtl7(struct ieee80211_device *ieee, unsigned int seq,
3326 unsigned int frag, u8 *src, u8 *dst)
3327 {
3328 struct ieee80211_frag_entry *entry;
3329 @@ -94,7 +158,7 @@
3330  
3331 /* Called only as a tasklet (software IRQ) */
3332 static struct sk_buff *
3333 -ieee80211_frag_cache_get(struct ieee80211_device *ieee,
3334 +ieee80211_frag_cache_get_rtl7(struct ieee80211_device *ieee,
3335 struct ieee80211_hdr *hdr)
3336 {
3337 struct sk_buff *skb = NULL;
3338 @@ -133,7 +197,7 @@
3339 } else {
3340 /* received a fragment of a frame for which the head fragment
3341 * should have already been received */
3342 - entry = ieee80211_frag_cache_find(ieee, seq, frag, hdr->addr2,
3343 + entry = ieee80211_frag_cache_find_rtl7(ieee, seq, frag, hdr->addr2,
3344 hdr->addr1);
3345 if (entry != NULL) {
3346 entry->last_frag = frag;
3347 @@ -146,7 +210,7 @@
3348  
3349  
3350 /* Called only as a tasklet (software IRQ) */
3351 -static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee,
3352 +static int ieee80211_frag_cache_invalidate_rtl7(struct ieee80211_device *ieee,
3353 struct ieee80211_hdr *hdr)
3354 {
3355 u16 sc;
3356 @@ -156,7 +220,7 @@
3357 sc = le16_to_cpu(hdr->seq_ctl);
3358 seq = WLAN_GET_SEQ_SEQ(sc);
3359  
3360 - entry = ieee80211_frag_cache_find(ieee, seq, -1, hdr->addr2,
3361 + entry = ieee80211_frag_cache_find_rtl7(ieee, seq, -1, hdr->addr2,
3362 hdr->addr1);
3363  
3364 if (entry == NULL) {
3365 @@ -178,7 +242,7 @@
3366 *
3367 * Called by ieee80211_rx */
3368 static inline int
3369 -ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
3370 +ieee80211_rx_frame_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
3371 struct ieee80211_rx_stats *rx_stats, u16 type,
3372 u16 stype)
3373 {
3374 @@ -187,8 +251,8 @@
3375 * response parser uses it
3376 */
3377 rx_stats->len = skb->len;
3378 - ieee80211_rx_mgt(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
3379 - ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype);
3380 + ieee80211_rx_mgt_rtl7(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
3381 + ieee80211_rx_frame_softmac_rtl7(ieee, skb, rx_stats, type, stype);
3382  
3383 dev_kfree_skb_any(skb);
3384  
3385 @@ -253,7 +317,7 @@
3386 /* No encapsulation header if EtherType < 0x600 (=length) */
3387  
3388 /* Called by ieee80211_rx_frame_decrypt */
3389 -static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee,
3390 +static int ieee80211_is_eapol_frame_rtl7(struct ieee80211_device *ieee,
3391 struct sk_buff *skb)
3392 {
3393 struct net_device *dev = ieee->dev;
3394 @@ -294,7 +358,7 @@
3395  
3396 /* Called only as a tasklet (software IRQ), by ieee80211_rx */
3397 static inline int
3398 -ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb,
3399 +ieee80211_rx_frame_decrypt_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
3400 struct ieee80211_crypt_data *crypt)
3401 {
3402 struct ieee80211_hdr *hdr;
3403 @@ -304,7 +368,7 @@
3404 return 0;
3405  
3406 hdr = (struct ieee80211_hdr *) skb->data;
3407 - hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
3408 + hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
3409  
3410 #ifdef CONFIG_IEEE80211_CRYPT_TKIP
3411 if (ieee->tkip_countermeasures &&
3412 @@ -339,7 +403,7 @@
3413  
3414 /* Called only as a tasklet (software IRQ), by ieee80211_rx */
3415 static inline int
3416 -ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb,
3417 +ieee80211_rx_frame_decrypt_msdu_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
3418 int keyidx, struct ieee80211_crypt_data *crypt)
3419 {
3420 struct ieee80211_hdr *hdr;
3421 @@ -349,7 +413,7 @@
3422 return 0;
3423  
3424 hdr = (struct ieee80211_hdr *) skb->data;
3425 - hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
3426 + hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
3427  
3428 atomic_inc(&crypt->refcnt);
3429 res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
3430 @@ -367,7 +431,7 @@
3431  
3432 /* this function is stolen from ipw2200 driver*/
3433 #define IEEE_PACKET_RETRY_TIME (5*HZ)
3434 -static int is_duplicate_packet(struct ieee80211_device *ieee,
3435 +static int is_duplicate_packet_rtl7(struct ieee80211_device *ieee,
3436 struct ieee80211_hdr *header)
3437 {
3438 // u16 fc = le16_to_cpu(header->frame_ctl);
3439 @@ -444,7 +508,7 @@
3440 /* All received frames are sent to this function. @skb contains the frame in
3441 * IEEE 802.11 format, i.e., in the format it was sent over air.
3442 * This function is called only as a tasklet (software IRQ). */
3443 -int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
3444 +int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
3445 struct ieee80211_rx_stats *rx_stats)
3446 {
3447 struct net_device *dev = ieee->dev;
3448 @@ -483,7 +547,7 @@
3449 sc = le16_to_cpu(hdr->seq_ctl);
3450  
3451 frag = WLAN_GET_SEQ_FRAG(sc);
3452 - hdrlen = ieee80211_get_hdrlen(fc);
3453 + hdrlen = ieee80211_get_hdrlen_rtl7(fc);
3454  
3455 #ifdef NOT_YET
3456 #if WIRELESS_EXT > 15
3457 @@ -501,12 +565,12 @@
3458 }
3459 #endif /* IW_WIRELESS_SPY */
3460 #endif /* WIRELESS_EXT > 15 */
3461 - hostap_update_rx_stats(local->ap, hdr, rx_stats);
3462 + hostap_update_rx_stats_rtl7(local->ap, hdr, rx_stats);
3463 #endif
3464  
3465 #if WIRELESS_EXT > 15
3466 if (ieee->iw_mode == IW_MODE_MONITOR) {
3467 - ieee80211_monitor_rx(ieee, skb, rx_stats);
3468 + ieee80211_monitor_rx_rtl7(ieee, skb, rx_stats);
3469 stats->rx_packets++;
3470 stats->rx_bytes += skb->len;
3471 return 1;
3472 @@ -529,7 +593,7 @@
3473 * stations that do not support WEP key mapping). */
3474  
3475 if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key)
3476 - (void) hostap_handle_sta_crypto(local, hdr, &crypt,
3477 + (void) hostap_handle_sta_crypto_rtl7(local, hdr, &crypt,
3478 &sta);
3479 #endif
3480  
3481 @@ -555,7 +619,7 @@
3482 if (skb->len < IEEE80211_DATA_HDR3_LEN)
3483 goto rx_dropped;
3484  
3485 - if (is_duplicate_packet(ieee, hdr))
3486 + if (is_duplicate_packet_rtl7(ieee, hdr))
3487 goto rx_dropped;
3488  
3489  
3490 @@ -575,7 +639,7 @@
3491 #endif
3492  
3493  
3494 - if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype))
3495 + if (ieee80211_rx_frame_mgmt_rtl7(ieee, skb, rx_stats, type, stype))
3496 goto rx_dropped;
3497 else
3498 goto rx_exit;
3499 @@ -606,7 +670,7 @@
3500 }
3501  
3502 #ifdef NOT_YET
3503 - if (hostap_rx_frame_wds(ieee, hdr, fc, &wds))
3504 + if (hostap_rx_frame_wds_rtl7(ieee, hdr, fc, &wds))
3505 goto rx_dropped;
3506 if (wds) {
3507 skb->dev = dev = wds;
3508 @@ -619,7 +683,7 @@
3509 memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) {
3510 /* Frame from BSSID of the AP for which we are a client */
3511 skb->dev = dev = ieee->stadev;
3512 - stats = hostap_get_stats(dev);
3513 + stats = hostap_get_stats_rtl7(dev);
3514 from_assoc_ap = 1;
3515 }
3516 #endif
3517 @@ -630,7 +694,7 @@
3518 if ((ieee->iw_mode == IW_MODE_MASTER ||
3519 ieee->iw_mode == IW_MODE_REPEAT) &&
3520 !from_assoc_ap) {
3521 - switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats,
3522 + switch (hostap_handle_sta_rx_rtl7(ieee, dev, skb, rx_stats,
3523 wds != NULL)) {
3524 case AP_RX_CONTINUE_NOT_AUTHORIZED:
3525 frame_authorized = 0;
3526 @@ -664,7 +728,7 @@
3527 /* skb: hdr + (possibly fragmented, possibly encrypted) payload */
3528  
3529 if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
3530 - (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0)
3531 + (keyidx = ieee80211_rx_frame_decrypt_rtl7(ieee, skb, crypt)) < 0)
3532 goto rx_dropped;
3533  
3534 hdr = (struct ieee80211_hdr *) skb->data;
3535 @@ -674,7 +738,7 @@
3536 // ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
3537 if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) {
3538 int flen;
3539 - struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr);
3540 + struct sk_buff *frag_skb = ieee80211_frag_cache_get_rtl7(ieee, hdr);
3541 IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag);
3542  
3543 if (!frag_skb) {
3544 @@ -694,7 +758,7 @@
3545 printk(KERN_WARNING "%s: host decrypted and "
3546 "reassembled frame did not fit skb\n",
3547 dev->name);
3548 - ieee80211_frag_cache_invalidate(ieee, hdr);
3549 + ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
3550 goto rx_dropped;
3551 }
3552  
3553 @@ -722,19 +786,19 @@
3554 * delivered, so remove skb from fragment cache */
3555 skb = frag_skb;
3556 hdr = (struct ieee80211_hdr *) skb->data;
3557 - ieee80211_frag_cache_invalidate(ieee, hdr);
3558 + ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
3559 }
3560  
3561 /* skb: hdr + (possible reassembled) full MSDU payload; possibly still
3562 * encrypted/authenticated */
3563 if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
3564 - ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt))
3565 + ieee80211_rx_frame_decrypt_msdu_rtl7(ieee, skb, keyidx, crypt))
3566 goto rx_dropped;
3567  
3568 hdr = (struct ieee80211_hdr *) skb->data;
3569 if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) {
3570 if (/*ieee->ieee802_1x &&*/
3571 - ieee80211_is_eapol_frame(ieee, skb)) {
3572 + ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
3573 #ifdef CONFIG_IEEE80211_DEBUG
3574 /* pass unencrypted EAPOL frames even if encryption is
3575 * configured */
3576 @@ -763,7 +827,7 @@
3577 #endif
3578  
3579 if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep &&
3580 - !ieee80211_is_eapol_frame(ieee, skb)) {
3581 + !ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
3582 IEEE80211_DEBUG_DROP(
3583 "dropped unencrypted RX data "
3584 "frame from " MAC_FMT
3585 @@ -896,7 +960,7 @@
3586  
3587 #define MGMT_FRAME_FIXED_PART_LENGTH 0x24
3588  
3589 -static inline int ieee80211_is_ofdm_rate(u8 rate)
3590 +static inline int ieee80211_is_ofdm_rate_rtl7(u8 rate)
3591 {
3592 switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
3593 case IEEE80211_OFDM_RATE_6MB:
3594 @@ -913,7 +977,7 @@
3595 }
3596  
3597  
3598 -static inline int ieee80211_network_init(
3599 +static inline int ieee80211_network_init_rtl7(
3600 struct ieee80211_device *ieee,
3601 struct ieee80211_probe_response *beacon,
3602 struct ieee80211_network *network,
3603 @@ -964,7 +1028,7 @@
3604  
3605 switch (info_element->id) {
3606 case MFIE_TYPE_SSID:
3607 - if (ieee80211_is_empty_essid(info_element->data,
3608 + if (ieee80211_is_empty_essid_rtl7(info_element->data,
3609 info_element->len)) {
3610 network->flags |= NETWORK_EMPTY_ESSID;
3611 break;
3612 @@ -991,7 +1055,7 @@
3613 #ifdef CONFIG_IEEE80211_DEBUG
3614 p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
3615 #endif
3616 - if (ieee80211_is_ofdm_rate(info_element->data[i])) {
3617 + if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
3618 network->flags |= NETWORK_HAS_OFDM;
3619 if (info_element->data[i] &
3620 IEEE80211_BASIC_RATE_MASK)
3621 @@ -1014,7 +1078,7 @@
3622 #ifdef CONFIG_IEEE80211_DEBUG
3623 p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
3624 #endif
3625 - if (ieee80211_is_ofdm_rate(info_element->data[i])) {
3626 + if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
3627 network->flags |= NETWORK_HAS_OFDM;
3628 if (info_element->data[i] &
3629 IEEE80211_BASIC_RATE_MASK)
3630 @@ -1147,7 +1211,7 @@
3631 return 1;
3632 }
3633  
3634 - if (ieee80211_is_empty_essid(network->ssid, network->ssid_len))
3635 + if (ieee80211_is_empty_essid_rtl7(network->ssid, network->ssid_len))
3636 network->flags |= NETWORK_EMPTY_ESSID;
3637  
3638 memcpy(&network->stats, stats, sizeof(network->stats));
3639 @@ -1155,7 +1219,7 @@
3640 return 0;
3641 }
3642  
3643 -static inline int is_same_network(struct ieee80211_network *src,
3644 +static inline int is_same_network_rtl7(struct ieee80211_network *src,
3645 struct ieee80211_network *dst)
3646 {
3647 /* A network is only a duplicate if the channel, BSSID, ESSID
3648 @@ -1172,7 +1236,7 @@
3649 (dst->capability & WLAN_CAPABILITY_BSS)));
3650 }
3651  
3652 -static inline void update_network(struct ieee80211_network *dst,
3653 +static inline void update_network_rtl7(struct ieee80211_network *dst,
3654 struct ieee80211_network *src)
3655 {
3656 memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats));
3657 @@ -1204,7 +1268,7 @@
3658 /* dst->last_associate is not overwritten */
3659 }
3660  
3661 -static inline void ieee80211_process_probe_response(
3662 +static inline void ieee80211_process_probe_response_rtl7(
3663 struct ieee80211_device *ieee,
3664 struct ieee80211_probe_response *beacon,
3665 struct ieee80211_rx_stats *stats)
3666 @@ -1239,7 +1303,7 @@
3667 (beacon->capability & (1<<0x1)) ? '1' : '0',
3668 (beacon->capability & (1<<0x0)) ? '1' : '0');
3669  
3670 - if (ieee80211_network_init(ieee, beacon, &network, stats)) {
3671 + if (ieee80211_network_init_rtl7(ieee, beacon, &network, stats)) {
3672 IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n",
3673 escape_essid(info_element->data,
3674 info_element->len),
3675 @@ -1262,11 +1326,11 @@
3676  
3677 spin_lock_irqsave(&ieee->lock, flags);
3678  
3679 - if(is_same_network(&ieee->current_network, &network))
3680 - update_network(&ieee->current_network, &network);
3681 + if(is_same_network_rtl7(&ieee->current_network, &network))
3682 + update_network_rtl7(&ieee->current_network, &network);
3683  
3684 list_for_each_entry(target, &ieee->network_list, list) {
3685 - if (is_same_network(target, &network))
3686 + if (is_same_network_rtl7(target, &network))
3687 break;
3688  
3689 if ((oldest == NULL) ||
3690 @@ -1306,7 +1370,7 @@
3691 memcpy(target, &network, sizeof(*target));
3692 list_add_tail(&target->list, &ieee->network_list);
3693 if(ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)
3694 - ieee80211_softmac_new_net(ieee,&network);
3695 + ieee80211_softmac_new_net_rtl7(ieee,&network);
3696 } else {
3697 IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n",
3698 escape_essid(target->ssid,
3699 @@ -1321,15 +1385,15 @@
3700 * net and call the new_net handler
3701 */
3702 renew = !time_after(target->last_scanned + ieee->scan_age, jiffies);
3703 - update_network(target, &network);
3704 + update_network_rtl7(target, &network);
3705 if(renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE))
3706 - ieee80211_softmac_new_net(ieee,&network);
3707 + ieee80211_softmac_new_net_rtl7(ieee,&network);
3708 }
3709  
3710 spin_unlock_irqrestore(&ieee->lock, flags);
3711 }
3712  
3713 -void ieee80211_rx_mgt(struct ieee80211_device *ieee,
3714 +void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
3715 struct ieee80211_hdr *header,
3716 struct ieee80211_rx_stats *stats)
3717 {
3718 @@ -1339,7 +1403,7 @@
3719 IEEE80211_DEBUG_MGMT("received BEACON (%d)\n",
3720 WLAN_FC_GET_STYPE(header->frame_ctl));
3721 IEEE80211_DEBUG_SCAN("Beacon\n");
3722 - ieee80211_process_probe_response(
3723 + ieee80211_process_probe_response_rtl7(
3724 ieee, (struct ieee80211_probe_response *)header, stats);
3725 break;
3726  
3727 @@ -1347,7 +1411,7 @@
3728 IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n",
3729 WLAN_FC_GET_STYPE(header->frame_ctl));
3730 IEEE80211_DEBUG_SCAN("Probe response\n");
3731 - ieee80211_process_probe_response(
3732 + ieee80211_process_probe_response_rtl7(
3733 ieee, (struct ieee80211_probe_response *)header, stats);
3734 break;
3735  
3736 @@ -1355,5 +1419,5 @@
3737 }
3738  
3739  
3740 -EXPORT_SYMBOL(ieee80211_rx_mgt);
3741 -EXPORT_SYMBOL(ieee80211_rx);
3742 +EXPORT_SYMBOL(ieee80211_rx_mgt_rtl7);
3743 +EXPORT_SYMBOL(ieee80211_rx_rtl7);
3744 diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac.c rtl8187_txpower/ieee80211/ieee80211_softmac.c
3745 --- rtl8187_orig/ieee80211/ieee80211_softmac.c 2006-06-19 03:27:33.000000000 +0200
3746 +++ rtl8187_txpower/ieee80211/ieee80211_softmac.c 2007-03-05 00:31:52.525345690 +0100
3747 @@ -20,12 +20,12 @@
3748 #include <linux/delay.h>
3749 #include <linux/version.h>
3750  
3751 -short ieee80211_is_54g(struct ieee80211_network net)
3752 +short ieee80211_is_54g_rtl7(struct ieee80211_network net)
3753 {
3754 return ((net.rates_ex_len > 0) || (net.rates_len > 4));
3755 }
3756  
3757 -short ieee80211_is_shortslot(struct ieee80211_network net)
3758 +short ieee80211_is_shortslot_rtl7(struct ieee80211_network net)
3759 {
3760 return (net.capability & WLAN_CAPABILITY_SHORT_SLOT);
3761 }
3762 @@ -34,7 +34,7 @@
3763 * tag and the EXTENDED RATE MFIE tag if needed.
3764 * It encludes two bytes per tag for the tag itself and its len
3765 */
3766 -unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee)
3767 +unsigned int ieee80211_MFIE_rate_len_rtl7(struct ieee80211_device *ieee)
3768 {
3769 unsigned int rate_len = 0;
3770  
3771 @@ -52,7 +52,7 @@
3772 * Then it updates the pointer so that
3773 * it points after the new MFIE tag added.
3774 */
3775 -void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p)
3776 +void ieee80211_MFIE_Brate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
3777 {
3778 u8 *tag = *tag_p;
3779  
3780 @@ -69,7 +69,7 @@
3781 *tag_p = tag;
3782 }
3783  
3784 -void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
3785 +void ieee80211_MFIE_Grate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
3786 {
3787 u8 *tag = *tag_p;
3788  
3789 @@ -92,7 +92,7 @@
3790 *tag_p = tag;
3791 }
3792  
3793 -void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb)
3794 +void enqueue_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
3795 {
3796 int nh;
3797 nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM;
3798 @@ -110,7 +110,7 @@
3799 //return 0;
3800 }
3801  
3802 -struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee)
3803 +struct sk_buff *dequeue_mgmt_rtl7(struct ieee80211_device *ieee)
3804 {
3805 struct sk_buff *ret;
3806  
3807 @@ -125,15 +125,15 @@
3808 return ret;
3809 }
3810  
3811 -void init_mgmt_queue(struct ieee80211_device *ieee)
3812 +void init_mgmt_queue_rtl7(struct ieee80211_device *ieee)
3813 {
3814 ieee->mgmt_queue_tail = ieee->mgmt_queue_head = 0;
3815 }
3816  
3817  
3818 -void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl);
3819 +void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl);
3820  
3821 -inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
3822 +inline void softmac_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
3823 {
3824 unsigned long flags;
3825 short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
3826 @@ -144,13 +144,13 @@
3827 spin_lock_irqsave(&ieee->lock, flags);
3828  
3829 /* called with 2nd param 0, no mgmt lock required */
3830 - ieee80211_sta_wakeup(ieee,0);
3831 + ieee80211_sta_wakeup_rtl7(ieee,0);
3832  
3833 if(single){
3834  
3835 if(ieee->queue_stop){
3836  
3837 - enqueue_mgmt(ieee,skb);
3838 + enqueue_mgmt_rtl7(ieee,skb);
3839  
3840 }else{
3841 header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
3842 @@ -184,7 +184,7 @@
3843 }
3844  
3845  
3846 -inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
3847 +inline void softmac_ps_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
3848 {
3849  
3850 short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
3851 @@ -219,7 +219,7 @@
3852 }
3853 }
3854  
3855 -inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee)
3856 +inline struct sk_buff *ieee80211_probe_req_rtl7(struct ieee80211_device *ieee)
3857 {
3858 unsigned int len,rate_len;
3859 u8 *tag;
3860 @@ -228,7 +228,7 @@
3861  
3862 len = ieee->current_network.ssid_len;
3863  
3864 - rate_len = ieee80211_MFIE_rate_len(ieee);
3865 + rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
3866  
3867 skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) +
3868 2 + len + rate_len);
3869 @@ -251,21 +251,21 @@
3870 memcpy(tag, ieee->current_network.ssid, len);
3871 tag += len;
3872  
3873 - ieee80211_MFIE_Brate(ieee,&tag);
3874 - ieee80211_MFIE_Grate(ieee,&tag);
3875 + ieee80211_MFIE_Brate_rtl7(ieee,&tag);
3876 + ieee80211_MFIE_Grate_rtl7(ieee,&tag);
3877 return skb;
3878 }
3879  
3880 -struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee);
3881 -void ieee80211_send_beacon(struct ieee80211_device *ieee)
3882 +struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee);
3883 +void ieee80211_send_beacon_rtl7(struct ieee80211_device *ieee)
3884 {
3885 struct sk_buff *skb;
3886  
3887 unsigned long flags;
3888  
3889 - skb = ieee80211_get_beacon_(ieee);
3890 + skb = ieee80211_get_beacon__rtl7(ieee);
3891 if (skb){
3892 - softmac_mgmt_xmit(skb, ieee);
3893 + softmac_mgmt_xmit_rtl7(skb, ieee);
3894 ieee->softmac_stats.tx_beacons++;
3895 }
3896  
3897 @@ -279,37 +279,37 @@
3898 }
3899  
3900  
3901 -void ieee80211_send_beacon_cb(unsigned long _ieee)
3902 +void ieee80211_send_beacon_cb_rtl7(unsigned long _ieee)
3903 {
3904 struct ieee80211_device *ieee =
3905 (struct ieee80211_device *) _ieee;
3906 - ieee80211_send_beacon(ieee);
3907 + ieee80211_send_beacon_rtl7(ieee);
3908 }
3909  
3910  
3911 -void ieee80211_send_probe(struct ieee80211_device *ieee)
3912 +void ieee80211_send_probe_rtl7(struct ieee80211_device *ieee)
3913 {
3914 struct sk_buff *skb;
3915  
3916 - skb = ieee80211_probe_req(ieee);
3917 + skb = ieee80211_probe_req_rtl7(ieee);
3918 if (skb){
3919 - softmac_mgmt_xmit(skb, ieee);
3920 + softmac_mgmt_xmit_rtl7(skb, ieee);
3921 ieee->softmac_stats.tx_probe_rq++;
3922 }
3923 }
3924  
3925 -void ieee80211_send_probe_requests(struct ieee80211_device *ieee)
3926 +void ieee80211_send_probe_requests_rtl7(struct ieee80211_device *ieee)
3927 {
3928 if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)){
3929 - ieee80211_send_probe(ieee);
3930 - ieee80211_send_probe(ieee);
3931 + ieee80211_send_probe_rtl7(ieee);
3932 + ieee80211_send_probe_rtl7(ieee);
3933 }
3934 }
3935  
3936 /* this performs syncro scan blocking the caller until all channels
3937 * in the allowed channel map has been checked.
3938 */
3939 -void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
3940 +void ieee80211_softmac_scan_syncro_rtl7(struct ieee80211_device *ieee)
3941 {
3942 short ch = 0;
3943  
3944 @@ -349,7 +349,7 @@
3945  
3946 ieee->set_chan(ieee->dev, ch);
3947  
3948 - ieee80211_send_probe_requests(ieee);
3949 + ieee80211_send_probe_requests_rtl7(ieee);
3950  
3951 /* this prevent excessive time wait when we
3952 * need to wait for a syncro scan to end..
3953 @@ -384,11 +384,17 @@
3954 }
3955 #endif
3956  
3957 -void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
3958 -{
3959 - down(&ieee->scan_sem);
3960 -
3961 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
3962 +void ieee80211_softmac_scan_wq_rtl7(struct work_struct *work)
3963 +{
3964 + struct delayed_work *dwork = container_of(work, struct delayed_work, work);
3965 + struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
3966 +#else
3967 +void ieee80211_softmac_scan_wq_rtl7(struct ieee80211_device *ieee)
3968 +{
3969 +#endif
3970 short watchdog = 0;
3971 + down(&ieee->scan_sem);
3972  
3973 do{
3974 ieee->current_network.channel =
3975 @@ -402,7 +408,7 @@
3976 goto out;
3977  
3978 ieee->set_chan(ieee->dev, ieee->current_network.channel);
3979 - ieee80211_send_probe_requests(ieee);
3980 + ieee80211_send_probe_requests_rtl7(ieee);
3981  
3982 #if 0
3983 ieee->.expires = jiffies + (IEEE80211_SOFTMAC_SCAN_TIME);
3984 @@ -427,19 +433,19 @@
3985 #endif
3986  
3987  
3988 -void ieee80211_beacons_start(struct ieee80211_device *ieee)
3989 +void ieee80211_beacons_start_rtl7(struct ieee80211_device *ieee)
3990 {
3991 unsigned long flags;
3992  
3993 spin_lock_irqsave(&ieee->beacon_lock,flags);
3994  
3995 ieee->beacon_txing = 1;
3996 - ieee80211_send_beacon(ieee);
3997 + ieee80211_send_beacon_rtl7(ieee);
3998  
3999 spin_unlock_irqrestore(&ieee->beacon_lock,flags);
4000 }
4001  
4002 -void ieee80211_beacons_stop(struct ieee80211_device *ieee)
4003 +void ieee80211_beacons_stop_rtl7(struct ieee80211_device *ieee)
4004 {
4005 unsigned long flags;
4006  
4007 @@ -453,25 +459,25 @@
4008 }
4009  
4010  
4011 -void ieee80211_stop_send_beacons(struct ieee80211_device *ieee)
4012 +void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee)
4013 {
4014 if(ieee->stop_send_beacons)
4015 ieee->stop_send_beacons(ieee->dev);
4016 if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
4017 - ieee80211_beacons_stop(ieee);
4018 + ieee80211_beacons_stop_rtl7(ieee);
4019 }
4020  
4021  
4022 -void ieee80211_start_send_beacons(struct ieee80211_device *ieee)
4023 +void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee)
4024 {
4025 if(ieee->start_send_beacons)
4026 ieee->start_send_beacons(ieee->dev);
4027 if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
4028 - ieee80211_beacons_start(ieee);
4029 + ieee80211_beacons_start_rtl7(ieee);
4030 }
4031  
4032  
4033 -void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee)
4034 +void ieee80211_softmac_stop_scan_rtl7(struct ieee80211_device *ieee)
4035 {
4036 // unsigned long flags;
4037  
4038 @@ -490,22 +496,22 @@
4039 up(&ieee->scan_sem);
4040 }
4041  
4042 -void ieee80211_stop_scan(struct ieee80211_device *ieee)
4043 +void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee)
4044 {
4045 if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
4046 - ieee80211_softmac_stop_scan(ieee);
4047 + ieee80211_softmac_stop_scan_rtl7(ieee);
4048 else
4049 ieee->stop_scan(ieee->dev);
4050 }
4051  
4052 /* called with ieee->lock held */
4053 -void ieee80211_start_scan(struct ieee80211_device *ieee)
4054 +void ieee80211_start_scan_rtl7(struct ieee80211_device *ieee)
4055 {
4056 if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
4057 if (ieee->scanning == 0){
4058 ieee->scanning = 1;
4059 //ieee80211_softmac_scan(ieee);
4060 - queue_work(ieee->wq, &ieee->softmac_scan_wq);
4061 + queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
4062 }
4063 }else
4064 ieee->start_scan(ieee->dev);
4065 @@ -513,18 +519,18 @@
4066 }
4067  
4068 /* called with wx_sem held */
4069 -void ieee80211_start_scan_syncro(struct ieee80211_device *ieee)
4070 +void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee)
4071 {
4072 ieee->sync_scan_hurryup = 0;
4073  
4074 if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
4075 - ieee80211_softmac_scan_syncro(ieee);
4076 + ieee80211_softmac_scan_syncro_rtl7(ieee);
4077 else
4078 ieee->scan_syncro(ieee->dev);
4079  
4080 }
4081  
4082 -inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon,
4083 +inline struct sk_buff *ieee80211_authentication_req_rtl7(struct ieee80211_network *beacon,
4084 struct ieee80211_device *ieee, int challengelen)
4085 {
4086 struct sk_buff *skb;
4087 @@ -557,7 +563,7 @@
4088  
4089 }
4090  
4091 -static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest)
4092 +static struct sk_buff* ieee80211_probe_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
4093 {
4094 u8 *tag;
4095 int beacon_size;
4096 @@ -578,7 +584,7 @@
4097 else
4098 atim_len = 0;
4099  
4100 - if(ieee80211_is_54g(ieee->current_network))
4101 + if(ieee80211_is_54g_rtl7(ieee->current_network))
4102 erp_len = 3;
4103 else
4104 erp_len = 0;
4105 @@ -664,7 +670,7 @@
4106 }
4107  
4108  
4109 -struct sk_buff* ieee80211_assoc_resp(struct ieee80211_device *ieee, u8 *dest)
4110 +struct sk_buff* ieee80211_assoc_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
4111 {
4112 struct sk_buff *skb;
4113 u8* tag;
4114 @@ -673,7 +679,7 @@
4115 struct ieee80211_assoc_response_frame *assoc;
4116 short encrypt;
4117  
4118 - unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
4119 + unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
4120 int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len;
4121  
4122 skb = dev_alloc_skb(len);
4123 @@ -711,13 +717,13 @@
4124  
4125 tag = (u8*) skb_put(skb, rate_len);
4126  
4127 - ieee80211_MFIE_Brate(ieee, &tag);
4128 - ieee80211_MFIE_Grate(ieee, &tag);
4129 + ieee80211_MFIE_Brate_rtl7(ieee, &tag);
4130 + ieee80211_MFIE_Grate_rtl7(ieee, &tag);
4131  
4132 return skb;
4133 }
4134  
4135 -struct sk_buff* ieee80211_auth_resp(struct ieee80211_device *ieee,int status, u8 *dest)
4136 +struct sk_buff* ieee80211_auth_resp_rtl7(struct ieee80211_device *ieee,int status, u8 *dest)
4137 {
4138 struct sk_buff *skb;
4139 struct ieee80211_authentication *auth;
4140 @@ -744,7 +750,7 @@
4141  
4142 }
4143  
4144 -struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr)
4145 +struct sk_buff* ieee80211_null_func_rtl7(struct ieee80211_device *ieee,short pwr)
4146 {
4147 struct sk_buff *skb;
4148 struct ieee80211_hdr_3addr* hdr;
4149 @@ -770,35 +776,35 @@
4150 }
4151  
4152  
4153 -void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest)
4154 +void ieee80211_resp_to_assoc_rq_rtl7(struct ieee80211_device *ieee, u8* dest)
4155 {
4156 - struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest);
4157 + struct sk_buff *buf = ieee80211_assoc_resp_rtl7(ieee, dest);
4158  
4159 if (buf)
4160 - softmac_mgmt_xmit(buf, ieee);
4161 + softmac_mgmt_xmit_rtl7(buf, ieee);
4162 }
4163  
4164  
4165 -void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest)
4166 +void ieee80211_resp_to_auth_rtl7(struct ieee80211_device *ieee, int s, u8* dest)
4167 {
4168 - struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest);
4169 + struct sk_buff *buf = ieee80211_auth_resp_rtl7(ieee, s, dest);
4170  
4171 if (buf)
4172 - softmac_mgmt_xmit(buf, ieee);
4173 + softmac_mgmt_xmit_rtl7(buf, ieee);
4174 }
4175  
4176  
4177 -void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest)
4178 +void ieee80211_resp_to_probe_rtl7(struct ieee80211_device *ieee, u8 *dest)
4179 {
4180  
4181 - struct sk_buff *buf = ieee80211_probe_resp(ieee, dest);
4182 + struct sk_buff *buf = ieee80211_probe_resp_rtl7(ieee, dest);
4183  
4184 if (buf)
4185 - softmac_mgmt_xmit(buf, ieee);
4186 + softmac_mgmt_xmit_rtl7(buf, ieee);
4187 }
4188  
4189  
4190 -inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
4191 +inline struct sk_buff *ieee80211_association_req_rtl7(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
4192 {
4193 struct sk_buff *skb;
4194  
4195 @@ -807,7 +813,7 @@
4196  
4197 unsigned int wpa_len = beacon->wpa_ie_len;
4198  
4199 - unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
4200 + unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
4201  
4202  
4203  
4204 @@ -848,8 +854,8 @@
4205  
4206 tag = skb_put(skb, rate_len);
4207  
4208 - ieee80211_MFIE_Brate(ieee, &tag);
4209 - ieee80211_MFIE_Grate(ieee, &tag);
4210 + ieee80211_MFIE_Brate_rtl7(ieee, &tag);
4211 + ieee80211_MFIE_Grate_rtl7(ieee, &tag);
4212  
4213 tag = skb_put(skb,wpa_len);
4214  
4215 @@ -858,7 +864,7 @@
4216 return skb;
4217 }
4218  
4219 -void ieee80211_associate_abort(struct ieee80211_device *ieee)
4220 +void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee)
4221 {
4222  
4223 unsigned long flags;
4224 @@ -887,13 +893,13 @@
4225 spin_unlock_irqrestore(&ieee->lock, flags);
4226 }
4227  
4228 -void ieee80211_associate_abort_cb(unsigned long dev)
4229 +void ieee80211_associate_abort_cb_rtl7(unsigned long dev)
4230 {
4231 - ieee80211_associate_abort((struct ieee80211_device *) dev);
4232 + ieee80211_associate_abort_rtl7((struct ieee80211_device *) dev);
4233 }
4234  
4235  
4236 -void ieee80211_associate_step1(struct ieee80211_device *ieee)
4237 +void ieee80211_associate_step1_rtl7(struct ieee80211_device *ieee)
4238 {
4239 struct ieee80211_network *beacon = &ieee->current_network;
4240 struct sk_buff *skb;
4241 @@ -901,20 +907,20 @@
4242 IEEE80211_DEBUG_MGMT("Stopping scan\n");
4243  
4244 ieee->softmac_stats.tx_auth_rq++;
4245 - skb=ieee80211_authentication_req(beacon, ieee, 0);
4246 + skb=ieee80211_authentication_req_rtl7(beacon, ieee, 0);
4247  
4248 if (!skb)
4249 - ieee80211_associate_abort(ieee);
4250 + ieee80211_associate_abort_rtl7(ieee);
4251 else{
4252 ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ;
4253 IEEE80211_DEBUG_MGMT("Sending authentication request\n");
4254 - softmac_mgmt_xmit(skb, ieee);
4255 + softmac_mgmt_xmit_rtl7(skb, ieee);
4256 ieee->associate_timer.expires = jiffies + (HZ / 2);
4257 add_timer(&ieee->associate_timer);
4258 }
4259 }
4260  
4261 -void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
4262 +void ieee80211_auth_challenge_rtl7(struct ieee80211_device *ieee, u8 *challenge, int chlen)
4263 {
4264 u8 *c;
4265 struct sk_buff *skb;
4266 @@ -924,9 +930,9 @@
4267 ieee->associate_seq++;
4268 ieee->softmac_stats.tx_auth_rq++;
4269  
4270 - skb = ieee80211_authentication_req(beacon, ieee, chlen+2);
4271 + skb = ieee80211_authentication_req_rtl7(beacon, ieee, chlen+2);
4272 if (!skb)
4273 - ieee80211_associate_abort(ieee);
4274 + ieee80211_associate_abort_rtl7(ieee);
4275 else{
4276 c = skb_put(skb, chlen+2);
4277 *(c++) = MFIE_TYPE_CHALLENGE;
4278 @@ -935,16 +941,16 @@
4279  
4280 IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n");
4281  
4282 - ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
4283 + ieee80211_encrypt_fragment_rtl7(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
4284  
4285 - softmac_mgmt_xmit(skb, ieee);
4286 + softmac_mgmt_xmit_rtl7(skb, ieee);
4287 ieee->associate_timer.expires = jiffies + (HZ / 2);
4288 add_timer(&ieee->associate_timer);
4289 }
4290 kfree(challenge);
4291 }
4292  
4293 -void ieee80211_associate_step2(struct ieee80211_device *ieee)
4294 +void ieee80211_associate_step2_rtl7(struct ieee80211_device *ieee)
4295 {
4296 struct sk_buff* skb;
4297 struct ieee80211_network *beacon = &ieee->current_network;
4298 @@ -954,20 +960,26 @@
4299 IEEE80211_DEBUG_MGMT("Sending association request\n");
4300  
4301 ieee->softmac_stats.tx_ass_rq++;
4302 - skb=ieee80211_association_req(beacon, ieee);
4303 + skb=ieee80211_association_req_rtl7(beacon, ieee);
4304 if (!skb)
4305 - ieee80211_associate_abort(ieee);
4306 + ieee80211_associate_abort_rtl7(ieee);
4307 else{
4308 - softmac_mgmt_xmit(skb, ieee);
4309 + softmac_mgmt_xmit_rtl7(skb, ieee);
4310 ieee->associate_timer.expires = jiffies + (HZ / 2);
4311 add_timer(&ieee->associate_timer);
4312 }
4313 }
4314  
4315 -void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
4316 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
4317 +void ieee80211_associate_complete_wq_rtl7(struct work_struct *work)
4318 +{
4319 + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
4320 +#else
4321 +void ieee80211_associate_complete_wq_rtl7(struct ieee80211_device *ieee)
4322 {
4323 +#endif
4324 printk(KERN_INFO "Associated successfully\n");
4325 - if(ieee80211_is_54g(ieee->current_network) &&
4326 + if(ieee80211_is_54g_rtl7(ieee->current_network) &&
4327 (ieee->modulation & IEEE80211_OFDM_MODULATION)){
4328  
4329 ieee->rate = 540;
4330 @@ -977,13 +989,13 @@
4331 printk(KERN_INFO"Using B rates\n");
4332 }
4333 ieee->link_change(ieee->dev);
4334 - notify_wx_assoc_event(ieee);
4335 + notify_wx_assoc_event_rtl7(ieee);
4336 if (ieee->data_hard_resume)
4337 ieee->data_hard_resume(ieee->dev);
4338 netif_carrier_on(ieee->dev);
4339 }
4340  
4341 -void ieee80211_associate_complete(struct ieee80211_device *ieee)
4342 +void ieee80211_associate_complete_rtl7(struct ieee80211_device *ieee)
4343 {
4344  
4345 del_timer_sync(&ieee->associate_timer);
4346 @@ -995,24 +1007,29 @@
4347 queue_work(ieee->wq, &ieee->associate_complete_wq);
4348 }
4349  
4350 -void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee)
4351 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
4352 +void ieee80211_associate_procedure_wq_rtl7(struct work_struct *work)
4353 +{
4354 + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
4355 +#else
4356 +void ieee80211_associate_procedure_wq_rtl7(struct ieee80211_device *ieee)
4357 {
4358 +#endif
4359 ieee->sync_scan_hurryup = 1;
4360 down(&ieee->wx_sem);
4361 -
4362 if (ieee->data_hard_stop)
4363 ieee->data_hard_stop(ieee->dev);
4364  
4365 - ieee80211_stop_scan(ieee);
4366 + ieee80211_stop_scan_rtl7(ieee);
4367 ieee->set_chan(ieee->dev, ieee->current_network.channel);
4368  
4369 ieee->associate_seq = 1;
4370 - ieee80211_associate_step1(ieee);
4371 + ieee80211_associate_step1_rtl7(ieee);
4372  
4373 up(&ieee->wx_sem);
4374 }
4375  
4376 -inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net)
4377 +inline void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net)
4378 {
4379  
4380 u8 tmp_ssid[IW_ESSID_MAX_SIZE+1];
4381 @@ -1079,7 +1096,7 @@
4382 ieee->state = IEEE80211_ASSOCIATING;
4383 queue_work(ieee->wq, &ieee->associate_procedure_wq);
4384 }else{
4385 - if(ieee80211_is_54g(ieee->current_network) &&
4386 + if(ieee80211_is_54g_rtl7(ieee->current_network) &&
4387 (ieee->modulation & IEEE80211_OFDM_MODULATION)){
4388 ieee->rate = 540;
4389 printk(KERN_INFO"Using G rates\n");
4390 @@ -1095,14 +1112,13 @@
4391  
4392 }
4393  
4394 -void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee)
4395 +void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee)
4396 {
4397  
4398 unsigned long flags;
4399 struct ieee80211_network *target;
4400  
4401 spin_lock_irqsave(&ieee->lock, flags);
4402 -
4403 list_for_each_entry(target, &ieee->network_list, list) {
4404  
4405 /* if the state become different that NOLINK means
4406 @@ -1112,7 +1128,7 @@
4407 break;
4408  
4409 //if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies))
4410 - ieee80211_softmac_new_net(ieee, target);
4411 + ieee80211_softmac_new_net_rtl7(ieee, target);
4412 }
4413  
4414 spin_unlock_irqrestore(&ieee->lock, flags);
4415 @@ -1120,7 +1136,7 @@
4416 }
4417  
4418  
4419 -static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
4420 +static inline u16 auth_parse_rtl7(struct sk_buff *skb, u8** challenge, int *chlen)
4421 {
4422 struct ieee80211_authentication *a;
4423 u8 *t;
4424 @@ -1145,7 +1161,7 @@
4425 }
4426  
4427  
4428 -int auth_rq_parse(struct sk_buff *skb,u8* dest)
4429 +int auth_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
4430 {
4431 struct ieee80211_authentication *a;
4432  
4433 @@ -1163,7 +1179,7 @@
4434 return WLAN_STATUS_SUCCESS;
4435 }
4436  
4437 -static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
4438 +static short probe_rq_parse_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
4439 {
4440 u8 *tag;
4441 u8 *skbend;
4442 @@ -1201,7 +1217,7 @@
4443  
4444 }
4445  
4446 -int assoc_rq_parse(struct sk_buff *skb,u8* dest)
4447 +int assoc_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
4448 {
4449 struct ieee80211_assoc_request_frame *a;
4450  
4451 @@ -1219,7 +1235,7 @@
4452 return 0;
4453 }
4454  
4455 -static inline u16 assoc_parse(struct sk_buff *skb, int *aid)
4456 +static inline u16 assoc_parse_rtl7(struct sk_buff *skb, int *aid)
4457 {
4458 struct ieee80211_assoc_response_frame *a;
4459 if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
4460 @@ -1233,45 +1249,45 @@
4461 }
4462  
4463 static inline void
4464 -ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
4465 +ieee80211_rx_probe_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
4466 {
4467 u8 dest[ETH_ALEN];
4468  
4469 //IEEE80211DMESG("Rx probe");
4470 ieee->softmac_stats.rx_probe_rq++;
4471 //DMESG("Dest is "MACSTR, MAC2STR(dest));
4472 - if (probe_rq_parse(ieee, skb, dest)){
4473 + if (probe_rq_parse_rtl7(ieee, skb, dest)){
4474 //IEEE80211DMESG("Was for me!");
4475 ieee->softmac_stats.tx_probe_rs++;
4476 - ieee80211_resp_to_probe(ieee, dest);
4477 + ieee80211_resp_to_probe_rtl7(ieee, dest);
4478 }
4479 }
4480  
4481 static inline void
4482 -ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
4483 +ieee80211_rx_auth_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
4484 {
4485 u8 dest[ETH_ALEN];
4486 int status;
4487 //IEEE80211DMESG("Rx probe");
4488 ieee->softmac_stats.rx_auth_rq++;
4489  
4490 - if ((status = auth_rq_parse(skb, dest))!= -1){
4491 - ieee80211_resp_to_auth(ieee, status, dest);
4492 + if ((status = auth_rq_parse_rtl7(skb, dest))!= -1){
4493 + ieee80211_resp_to_auth_rtl7(ieee, status, dest);
4494 }
4495 //DMESG("Dest is "MACSTR, MAC2STR(dest));
4496  
4497 }
4498  
4499 static inline void
4500 -ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
4501 +ieee80211_rx_assoc_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
4502 {
4503  
4504 u8 dest[ETH_ALEN];
4505 //unsigned long flags;
4506  
4507 ieee->softmac_stats.rx_ass_rq++;
4508 - if (assoc_rq_parse(skb,dest) != -1){
4509 - ieee80211_resp_to_assoc_rq(ieee, dest);
4510 + if (assoc_rq_parse_rtl7(skb,dest) != -1){
4511 + ieee80211_resp_to_assoc_rq_rtl7(ieee, dest);
4512 }
4513  
4514 printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest));
4515 @@ -1285,18 +1301,18 @@
4516  
4517  
4518  
4519 -void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr)
4520 +void ieee80211_sta_ps_send_null_frame_rtl7(struct ieee80211_device *ieee, short pwr)
4521 {
4522  
4523 - struct sk_buff *buf = ieee80211_null_func(ieee, pwr);
4524 + struct sk_buff *buf = ieee80211_null_func_rtl7(ieee, pwr);
4525  
4526 if (buf)
4527 - softmac_ps_mgmt_xmit(buf, ieee);
4528 + softmac_ps_mgmt_xmit_rtl7(buf, ieee);
4529  
4530 }
4531  
4532  
4533 -short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
4534 +short ieee80211_sta_ps_sleep_rtl7(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
4535 {
4536 int timeout = ieee->ps_timeout;
4537 u8 dtim;
4538 @@ -1343,7 +1359,7 @@
4539  
4540 }
4541  
4542 -inline void ieee80211_sta_ps(struct ieee80211_device *ieee)
4543 +inline void ieee80211_sta_ps_rtl7(struct ieee80211_device *ieee)
4544 {
4545  
4546 u32 th,tl;
4547 @@ -1360,12 +1376,12 @@
4548 #warning CHECK_LOCK_HERE
4549 spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
4550  
4551 - ieee80211_sta_wakeup(ieee, 1);
4552 + ieee80211_sta_wakeup_rtl7(ieee, 1);
4553  
4554 spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
4555 }
4556  
4557 - sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl);
4558 + sleep = ieee80211_sta_ps_sleep_rtl7(ieee,&th, &tl);
4559 /* 2 wake, 1 sleep, 0 do nothing */
4560 if(sleep == 0)
4561 goto out;
4562 @@ -1386,7 +1402,7 @@
4563  
4564 ieee->ps_request_tx_ack(ieee->dev);
4565  
4566 - ieee80211_sta_ps_send_null_frame(ieee,1);
4567 + ieee80211_sta_ps_send_null_frame_rtl7(ieee,1);
4568  
4569 ieee->ps_th = th;
4570 ieee->ps_tl = tl;
4571 @@ -1400,7 +1416,7 @@
4572 #warning CHECK_LOCK_HERE
4573 spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
4574  
4575 - ieee80211_sta_wakeup(ieee,1);
4576 + ieee80211_sta_wakeup_rtl7(ieee,1);
4577  
4578 spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
4579 }
4580 @@ -1410,13 +1426,13 @@
4581  
4582 }
4583  
4584 -void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl)
4585 +void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl)
4586 {
4587 if(ieee->sta_sleep == 0){
4588 if(nl){
4589 printk("Warning: driver is probably failing to report TX ps error\n");
4590 ieee->ps_request_tx_ack(ieee->dev);
4591 - ieee80211_sta_ps_send_null_frame(ieee, 0);
4592 + ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
4593 }
4594 return;
4595  
4596 @@ -1429,11 +1445,11 @@
4597  
4598 if(nl){
4599 ieee->ps_request_tx_ack(ieee->dev);
4600 - ieee80211_sta_ps_send_null_frame(ieee, 0);
4601 + ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
4602 }
4603 }
4604  
4605 -void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success)
4606 +void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success)
4607 {
4608 unsigned long flags,flags2;
4609  
4610 @@ -1454,7 +1470,7 @@
4611  
4612 if((ieee->sta_sleep == 0) && !success){
4613 spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
4614 - ieee80211_sta_ps_send_null_frame(ieee, 0);
4615 + ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
4616 spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
4617 }
4618 }
4619 @@ -1462,17 +1478,18 @@
4620 }
4621  
4622 inline int
4623 -ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
4624 +ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
4625 struct ieee80211_rx_stats *rx_stats, u16 type,
4626 u16 stype)
4627 {
4628 struct ieee80211_hdr_3addr *header;
4629 - header = (struct ieee80211_hdr_3addr *) skb->data;
4630 u16 errcode;
4631 u8* challenge;
4632 int chlen;
4633 int aid;
4634  
4635 + header = (struct ieee80211_hdr_3addr *) skb->data;
4636 +
4637 if(!ieee->proto_started)
4638 return 0;
4639  
4640 @@ -1496,19 +1513,19 @@
4641 if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
4642 ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
4643 ieee->iw_mode == IW_MODE_INFRA){
4644 - if (0 == (errcode=assoc_parse(skb, &aid))){
4645 + if (0 == (errcode=assoc_parse_rtl7(skb, &aid))){
4646  
4647 ieee->state=IEEE80211_LINKED;
4648 ieee->assoc_id = aid;
4649 ieee->softmac_stats.rx_ass_ok++;
4650  
4651 - ieee80211_associate_complete(ieee);
4652 + ieee80211_associate_complete_rtl7(ieee);
4653 }else{
4654 ieee->softmac_stats.rx_ass_err++;
4655 IEEE80211_DEBUG_MGMT(
4656 "Association response status code 0x%x\n",
4657 errcode);
4658 - ieee80211_associate_abort(ieee);
4659 + ieee80211_associate_abort_rtl7(ieee);
4660 }
4661 }
4662 break;
4663 @@ -1519,7 +1536,7 @@
4664 if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
4665 ieee->iw_mode == IW_MODE_MASTER)
4666  
4667 - ieee80211_rx_assoc_rq(ieee, skb);
4668 + ieee80211_rx_assoc_rq_rtl7(ieee, skb);
4669 break;
4670  
4671 case IEEE80211_STYPE_AUTH:
4672 @@ -1530,23 +1547,23 @@
4673  
4674 IEEE80211_DEBUG_MGMT("Received authentication response");
4675  
4676 - if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){
4677 + if (0 == (errcode=auth_parse_rtl7(skb, &challenge, &chlen))){
4678 if(ieee->open_wep || !challenge){
4679 ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
4680 ieee->softmac_stats.rx_auth_rs_ok++;
4681  
4682 - ieee80211_associate_step2(ieee);
4683 + ieee80211_associate_step2_rtl7(ieee);
4684 }else{
4685 - ieee80211_auth_challenge(ieee, challenge, chlen);
4686 + ieee80211_auth_challenge_rtl7(ieee, challenge, chlen);
4687 }
4688 }else{
4689 ieee->softmac_stats.rx_auth_rs_err++;
4690 IEEE80211_DEBUG_MGMT("Authentication respose status code 0x%x",errcode);
4691 - ieee80211_associate_abort(ieee);
4692 + ieee80211_associate_abort_rtl7(ieee);
4693 }
4694  
4695 }else if (ieee->iw_mode == IW_MODE_MASTER){
4696 - ieee80211_rx_auth_rq(ieee, skb);
4697 + ieee80211_rx_auth_rq_rtl7(ieee, skb);
4698 }
4699 }
4700 break;
4701 @@ -1558,7 +1575,7 @@
4702 ieee->iw_mode == IW_MODE_MASTER) &&
4703 ieee->state == IEEE80211_LINKED))
4704  
4705 - ieee80211_rx_probe_rq(ieee, skb);
4706 + ieee80211_rx_probe_rq_rtl7(ieee, skb);
4707 break;
4708  
4709 case IEEE80211_STYPE_DISASSOC:
4710 @@ -1573,8 +1590,8 @@
4711 ieee->state = IEEE80211_ASSOCIATING;
4712 ieee->softmac_stats.reassoc++;
4713  
4714 - notify_wx_assoc_event(ieee);
4715 -
4716 + notify_wx_assoc_event_rtl7(ieee);
4717 +
4718 queue_work(ieee->wq, &ieee->associate_procedure_wq);
4719 }
4720  
4721 @@ -1610,7 +1627,7 @@
4722 * to the driver later, when it wakes the queue.
4723 */
4724  
4725 -void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
4726 +void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
4727 {
4728  
4729  
4730 @@ -1643,7 +1660,7 @@
4731 #endif
4732  
4733 /* called with 2nd parm 0, no tx mgmt lock required */
4734 - ieee80211_sta_wakeup(ieee,0);
4735 + ieee80211_sta_wakeup_rtl7(ieee,0);
4736  
4737 for(i = 0; i < txb->nr_frags; i++) {
4738  
4739 @@ -1662,7 +1679,7 @@
4740 }
4741 }
4742  
4743 - ieee80211_txb_free(txb);
4744 + ieee80211_txb_free_rtl7(txb);
4745  
4746 exit:
4747 spin_unlock_irqrestore(&ieee->lock,flags);
4748 @@ -1670,7 +1687,7 @@
4749 }
4750  
4751 /* called with ieee->lock acquired */
4752 -void ieee80211_resume_tx(struct ieee80211_device *ieee)
4753 +void ieee80211_resume_tx_rtl7(struct ieee80211_device *ieee)
4754 {
4755 int i;
4756 for(i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) {
4757 @@ -1690,19 +1707,19 @@
4758 }
4759  
4760  
4761 - ieee80211_txb_free(ieee->tx_pending.txb);
4762 + ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
4763 ieee->tx_pending.txb = NULL;
4764 }
4765  
4766  
4767 -void ieee80211_reset_queue(struct ieee80211_device *ieee)
4768 +void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee)
4769 {
4770 unsigned long flags;
4771  
4772 spin_lock_irqsave(&ieee->lock,flags);
4773 - init_mgmt_queue(ieee);
4774 + init_mgmt_queue_rtl7(ieee);
4775 if (ieee->tx_pending.txb){
4776 - ieee80211_txb_free(ieee->tx_pending.txb);
4777 + ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
4778 ieee->tx_pending.txb = NULL;
4779 }
4780 ieee->queue_stop = 0;
4781 @@ -1710,7 +1727,7 @@
4782  
4783 }
4784  
4785 -void ieee80211_wake_queue(struct ieee80211_device *ieee)
4786 +void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee)
4787 {
4788  
4789 unsigned long flags;
4790 @@ -1723,7 +1740,7 @@
4791 ieee->queue_stop = 0;
4792  
4793 if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){
4794 - while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){
4795 + while (!ieee->queue_stop && (skb = dequeue_mgmt_rtl7(ieee))){
4796  
4797 header = (struct ieee80211_hdr_3addr *) skb->data;
4798  
4799 @@ -1738,7 +1755,7 @@
4800 }
4801 }
4802 if (!ieee->queue_stop && ieee->tx_pending.txb)
4803 - ieee80211_resume_tx(ieee);
4804 + ieee80211_resume_tx_rtl7(ieee);
4805  
4806 if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){
4807 ieee->softmac_stats.swtxawake++;
4808 @@ -1750,7 +1767,7 @@
4809 }
4810  
4811  
4812 -void ieee80211_stop_queue(struct ieee80211_device *ieee)
4813 +void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee)
4814 {
4815 //unsigned long flags;
4816 //spin_lock_irqsave(&ieee->lock,flags);
4817 @@ -1765,7 +1782,7 @@
4818 }
4819  
4820  
4821 -inline void ieee80211_randomize_cell(struct ieee80211_device *ieee)
4822 +inline void ieee80211_randomize_cell_rtl7(struct ieee80211_device *ieee)
4823 {
4824  
4825 get_random_bytes(ieee->current_network.bssid, ETH_ALEN);
4826 @@ -1778,7 +1795,7 @@
4827 }
4828  
4829 /* called in user context only */
4830 -void ieee80211_start_master_bss(struct ieee80211_device *ieee)
4831 +void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee)
4832 {
4833 ieee->assoc_id = 1;
4834  
4835 @@ -1796,7 +1813,7 @@
4836 ieee->set_chan(ieee->dev, ieee->current_network.channel);
4837 ieee->state = IEEE80211_LINKED;
4838 ieee->link_change(ieee->dev);
4839 - notify_wx_assoc_event(ieee);
4840 + notify_wx_assoc_event_rtl7(ieee);
4841  
4842 if (ieee->data_hard_resume)
4843 ieee->data_hard_resume(ieee->dev);
4844 @@ -1804,7 +1821,7 @@
4845 netif_carrier_on(ieee->dev);
4846 }
4847  
4848 -void ieee80211_start_monitor_mode(struct ieee80211_device *ieee)
4849 +void ieee80211_start_monitor_mode_rtl7(struct ieee80211_device *ieee)
4850 {
4851 if(ieee->raw_tx){
4852  
4853 @@ -1814,8 +1831,15 @@
4854 netif_carrier_on(ieee->dev);
4855 }
4856 }
4857 -void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
4858 +
4859 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
4860 +void ieee80211_start_ibss_wq_rtl7(struct work_struct *work)
4861 {
4862 + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, start_ibss_wq);
4863 +#else
4864 +void ieee80211_start_ibss_wq_rtl7(struct ieee80211_device *ieee)
4865 +{
4866 +#endif
4867  
4868 /* iwconfig mode ad-hoc will schedule this and return
4869 * on the other hand this will block further iwconfig SET
4870 @@ -1834,7 +1858,7 @@
4871 }
4872  
4873 /* check if we have this cell in our network list */
4874 - ieee80211_softmac_check_all_nets(ieee);
4875 + ieee80211_softmac_check_all_nets_rtl7(ieee);
4876  
4877 /* if not then the state is not linked. Maybe the user swithced to
4878 * ad-hoc mode just after being in monitor mode, or just after
4879 @@ -1851,13 +1875,13 @@
4880 * associated.
4881 */
4882 if (ieee->state == IEEE80211_NOLINK)
4883 - ieee80211_start_scan_syncro(ieee);
4884 + ieee80211_start_scan_syncro_rtl7(ieee);
4885  
4886 /* the network definitively is not here.. create a new cell */
4887 if (ieee->state == IEEE80211_NOLINK){
4888 printk("creating new IBSS cell\n");
4889 if(!ieee->wap_set)
4890 - ieee80211_randomize_cell(ieee);
4891 + ieee80211_randomize_cell_rtl7(ieee);
4892  
4893 if(ieee->modulation & IEEE80211_CCK_MODULATION){
4894  
4895 @@ -1901,9 +1925,9 @@
4896 ieee->set_chan(ieee->dev, ieee->current_network.channel);
4897 ieee->link_change(ieee->dev);
4898  
4899 - notify_wx_assoc_event(ieee);
4900 + notify_wx_assoc_event_rtl7(ieee);
4901  
4902 - ieee80211_start_send_beacons(ieee);
4903 + ieee80211_start_send_beacons_rtl7(ieee);
4904  
4905 if (ieee->data_hard_resume)
4906 ieee->data_hard_resume(ieee->dev);
4907 @@ -1913,13 +1937,13 @@
4908 up(&ieee->wx_sem);
4909 }
4910  
4911 -inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
4912 +inline void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee)
4913 {
4914 queue_work(ieee->wq, &ieee->start_ibss_wq);
4915 }
4916  
4917 /* this is called only in user context, with wx_sem held */
4918 -void ieee80211_start_bss(struct ieee80211_device *ieee)
4919 +void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee)
4920 {
4921 unsigned long flags;
4922 /* check if we have already found the net we
4923 @@ -1927,7 +1951,7 @@
4924 * if not (we are disassociated and we are not
4925 * in associating / authenticating phase) start the background scanning.
4926 */
4927 - ieee80211_softmac_check_all_nets(ieee);
4928 + ieee80211_softmac_check_all_nets_rtl7(ieee);
4929  
4930 /* ensure no-one start an associating process (thus setting
4931 * the ieee->state to ieee80211_ASSOCIATING) while we
4932 @@ -1937,34 +1961,42 @@
4933 * the rx path), so we cannot be in the middle of such function
4934 */
4935 spin_lock_irqsave(&ieee->lock, flags);
4936 -
4937 if (ieee->state == IEEE80211_NOLINK)
4938 - ieee80211_start_scan(ieee);
4939 + ieee80211_start_scan_rtl7(ieee);
4940  
4941 spin_unlock_irqrestore(&ieee->lock, flags);
4942 }
4943  
4944 /* called only in userspace context */
4945 -void ieee80211_disassociate(struct ieee80211_device *ieee)
4946 +void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee)
4947 {
4948 netif_carrier_off(ieee->dev);
4949  
4950 if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)
4951 - ieee80211_reset_queue(ieee);
4952 + ieee80211_reset_queue_rtl7(ieee);
4953  
4954 if (ieee->data_hard_stop)
4955 ieee->data_hard_stop(ieee->dev);
4956  
4957 ieee->state = IEEE80211_NOLINK;
4958 ieee->link_change(ieee->dev);
4959 - notify_wx_assoc_event(ieee);
4960 + notify_wx_assoc_event_rtl7(ieee);
4961  
4962 }
4963 -void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
4964 +
4965 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
4966 +void ieee80211_associate_retry_wq_rtl7(struct work_struct *work)
4967 +{
4968 + struct delayed_work *dwork = container_of(work, struct delayed_work, work);
4969 + struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
4970 +#else
4971 +void ieee80211_associate_retry_wq_rtl7(struct ieee80211_device *ieee)
4972 {
4973 +#endif
4974 unsigned long flags;
4975  
4976 down(&ieee->wx_sem);
4977 +
4978 if(!ieee->proto_started)
4979 goto exit;
4980  
4981 @@ -1986,12 +2018,12 @@
4982 */
4983 ieee->state = IEEE80211_NOLINK;
4984  
4985 - ieee80211_softmac_check_all_nets(ieee);
4986 + ieee80211_softmac_check_all_nets_rtl7(ieee);
4987  
4988 spin_lock_irqsave(&ieee->lock, flags);
4989  
4990 if(ieee->state == IEEE80211_NOLINK)
4991 - ieee80211_start_scan(ieee);
4992 + ieee80211_start_scan_rtl7(ieee);
4993  
4994 spin_unlock_irqrestore(&ieee->lock, flags);
4995  
4996 @@ -1999,14 +2031,14 @@
4997 up(&ieee->wx_sem);
4998 }
4999  
5000 -struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee)
5001 +struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee)
5002 {
5003 u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff};
5004  
5005 struct sk_buff *skb;
5006 struct ieee80211_probe_response *b;
5007  
5008 - skb = ieee80211_probe_resp(ieee, broadcast_addr);
5009 + skb = ieee80211_probe_resp_rtl7(ieee, broadcast_addr);
5010  
5011 if (!skb)
5012 return NULL;
5013 @@ -2018,12 +2050,12 @@
5014  
5015 }
5016  
5017 -struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee)
5018 +struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee)
5019 {
5020 struct sk_buff *skb;
5021 struct ieee80211_probe_response *b;
5022  
5023 - skb = ieee80211_get_beacon_(ieee);
5024 + skb = ieee80211_get_beacon__rtl7(ieee);
5025 if(!skb)
5026 return NULL;
5027  
5028 @@ -2038,44 +2070,44 @@
5029 return skb;
5030 }
5031  
5032 -void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee)
5033 +void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee)
5034 {
5035 ieee->sync_scan_hurryup = 1;
5036 down(&ieee->wx_sem);
5037 - ieee80211_stop_protocol(ieee);
5038 +
5039 + ieee80211_stop_protocol_rtl7(ieee);
5040 up(&ieee->wx_sem);
5041 }
5042  
5043  
5044 -void ieee80211_stop_protocol(struct ieee80211_device *ieee)
5045 +void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee)
5046 {
5047 if (!ieee->proto_started)
5048 return;
5049  
5050 ieee->proto_started = 0;
5051  
5052 - ieee80211_stop_send_beacons(ieee);
5053 + ieee80211_stop_send_beacons_rtl7(ieee);
5054  
5055 del_timer_sync(&ieee->associate_timer);
5056 cancel_delayed_work(&ieee->associate_retry_wq);
5057  
5058 - ieee80211_stop_scan(ieee);
5059 + ieee80211_stop_scan_rtl7(ieee);
5060  
5061 - ieee80211_disassociate(ieee);
5062 + ieee80211_disassociate_rtl7(ieee);
5063 }
5064  
5065 -void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee)
5066 +void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee)
5067 {
5068 ieee->sync_scan_hurryup = 0;
5069 down(&ieee->wx_sem);
5070 - ieee80211_start_protocol(ieee);
5071 + ieee80211_start_protocol_rtl7(ieee);
5072 up(&ieee->wx_sem);
5073 }
5074  
5075 -void ieee80211_start_protocol(struct ieee80211_device *ieee)
5076 +void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee)
5077 {
5078 short ch = 0;
5079 -
5080 if (ieee->proto_started)
5081 return;
5082  
5083 @@ -2094,9 +2126,7 @@
5084  
5085 if (ieee->current_network.beacon_interval == 0)
5086 ieee->current_network.beacon_interval = 100;
5087 -
5088 ieee->set_chan(ieee->dev,ieee->current_network.channel);
5089 -
5090 ieee->last_seq_num = -1;
5091 ieee->last_frag_num = -1;
5092 ieee->last_packet_time = 0;
5093 @@ -2109,21 +2139,18 @@
5094 */
5095  
5096 if (ieee->iw_mode == IW_MODE_INFRA)
5097 - ieee80211_start_bss(ieee);
5098 -
5099 + ieee80211_start_bss_rtl7(ieee);
5100 else if (ieee->iw_mode == IW_MODE_ADHOC)
5101 - ieee80211_start_ibss(ieee);
5102 -
5103 + ieee80211_start_ibss_rtl7(ieee);
5104 else if (ieee->iw_mode == IW_MODE_MASTER)
5105 - ieee80211_start_master_bss(ieee);
5106 -
5107 + ieee80211_start_master_bss_rtl7(ieee);
5108 else if(ieee->iw_mode == IW_MODE_MONITOR)
5109 - ieee80211_start_monitor_mode(ieee);
5110 + ieee80211_start_monitor_mode_rtl7(ieee);
5111 }
5112  
5113  
5114 #define DRV_NAME "Ieee80211"
5115 -void ieee80211_softmac_init(struct ieee80211_device *ieee)
5116 +void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee)
5117 {
5118 memset(&ieee->current_network, 0, sizeof(struct ieee80211_network));
5119  
5120 @@ -2143,7 +2170,7 @@
5121 ieee->ps = IEEE80211_PS_DISABLED;
5122 ieee->sta_sleep = 0;
5123  
5124 - init_mgmt_queue(ieee);
5125 + init_mgmt_queue_rtl7(ieee);
5126 #if 0
5127 init_timer(&ieee->scan_timer);
5128 ieee->scan_timer.data = (unsigned long)ieee;
5129 @@ -2153,25 +2180,34 @@
5130  
5131 init_timer(&ieee->associate_timer);
5132 ieee->associate_timer.data = (unsigned long)ieee;
5133 - ieee->associate_timer.function = ieee80211_associate_abort_cb;
5134 + ieee->associate_timer.function = ieee80211_associate_abort_cb_rtl7;
5135  
5136 init_timer(&ieee->beacon_timer);
5137 ieee->beacon_timer.data = (unsigned long) ieee;
5138 - ieee->beacon_timer.function = ieee80211_send_beacon_cb;
5139 + ieee->beacon_timer.function = ieee80211_send_beacon_cb_rtl7;
5140  
5141 #ifdef PF_SYNCTHREAD
5142 ieee->wq = create_workqueue(DRV_NAME,0);
5143 #else
5144 ieee->wq = create_workqueue(DRV_NAME);
5145 #endif
5146 -
5147 - INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
5148 - INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
5149 - INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
5150 - INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
5151 - INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
5152 - INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
5153 -
5154 +
5155 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
5156 + INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq_rtl7,ieee);
5157 + INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq_rtl7,ieee);
5158 + INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq_rtl7,ieee);
5159 + INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq_rtl7,ieee);
5160 + INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq_rtl7,ieee);
5161 + INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq_rtl7,ieee);
5162 +#else
5163 + INIT_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq_rtl7);
5164 + INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq_rtl7);
5165 + INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq_rtl7);
5166 + INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq_rtl7);
5167 + INIT_DELAYED_WORK(&ieee->softmac_scan_wq, ieee80211_softmac_scan_wq_rtl7);
5168 + INIT_WORK(&ieee->wx_sync_scan_wq, ieee80211_wx_sync_scan_wq_rtl7);
5169 +#endif
5170 +
5171 sema_init(&ieee->wx_sem, 1);
5172 sema_init(&ieee->scan_sem, 1);
5173  
5174 @@ -2179,12 +2215,12 @@
5175 spin_lock_init(&ieee->beacon_lock);
5176  
5177 tasklet_init(&ieee->ps_task,
5178 - (void(*)(unsigned long)) ieee80211_sta_ps,
5179 + (void(*)(unsigned long)) ieee80211_sta_ps_rtl7,
5180 (unsigned long)ieee);
5181  
5182 }
5183  
5184 -void ieee80211_softmac_free(struct ieee80211_device *ieee)
5185 +void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee)
5186 {
5187 down(&ieee->wx_sem);
5188  
5189 @@ -2201,7 +2237,7 @@
5190 ********************************************************/
5191  
5192  
5193 -static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value)
5194 +static int ieee80211_wpa_enable_rtl7(struct ieee80211_device *ieee, int value)
5195 {
5196 /* This is called when wpa_supplicant loads and closes the driver
5197 * interface. */
5198 @@ -2211,16 +2247,16 @@
5199 }
5200  
5201  
5202 -void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
5203 +void ieee80211_wpa_assoc_frame_rtl7(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
5204 {
5205 /* make sure WPA is enabled */
5206 - ieee80211_wpa_enable(ieee, 1);
5207 + ieee80211_wpa_enable_rtl7(ieee, 1);
5208  
5209 - ieee80211_disassociate(ieee);
5210 + ieee80211_disassociate_rtl7(ieee);
5211 }
5212  
5213  
5214 -static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason)
5215 +static int ieee80211_wpa_mlme_rtl7(struct ieee80211_device *ieee, int command, int reason)
5216 {
5217  
5218 int ret = 0;
5219 @@ -2231,7 +2267,7 @@
5220 break;
5221  
5222 case IEEE_MLME_STA_DISASSOC:
5223 - ieee80211_disassociate(ieee);
5224 + ieee80211_disassociate_rtl7(ieee);
5225 break;
5226  
5227 default:
5228 @@ -2243,7 +2279,7 @@
5229 }
5230  
5231  
5232 -static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee,
5233 +static int ieee80211_wpa_set_wpa_ie_rtl7(struct ieee80211_device *ieee,
5234 struct ieee_param *param, int plen)
5235 {
5236 u8 *buf;
5237 @@ -2267,14 +2303,14 @@
5238 ieee->wpa_ie_len = 0;
5239 }
5240  
5241 - ieee80211_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
5242 + ieee80211_wpa_assoc_frame_rtl7(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
5243 return 0;
5244 }
5245  
5246 #define AUTH_ALG_OPEN_SYSTEM 0x1
5247 #define AUTH_ALG_SHARED_KEY 0x2
5248  
5249 -static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value)
5250 +static int ieee80211_wpa_set_auth_algs_rtl7(struct ieee80211_device *ieee, int value)
5251 {
5252  
5253 struct ieee80211_security sec = {
5254 @@ -2300,13 +2336,13 @@
5255  
5256  
5257  
5258 -static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value)
5259 +static int ieee80211_wpa_set_param_rtl7(struct ieee80211_device *ieee, u8 name, u32 value)
5260 {
5261 int ret=0;
5262  
5263 switch (name) {
5264 case IEEE_PARAM_WPA_ENABLED:
5265 - ret = ieee80211_wpa_enable(ieee, value);
5266 + ret = ieee80211_wpa_enable_rtl7(ieee, value);
5267 break;
5268  
5269 case IEEE_PARAM_TKIP_COUNTERMEASURES:
5270 @@ -2351,7 +2387,7 @@
5271 break;
5272  
5273 case IEEE_PARAM_AUTH_ALGS:
5274 - ret = ieee80211_wpa_set_auth_algs(ieee, value);
5275 + ret = ieee80211_wpa_set_auth_algs_rtl7(ieee, value);
5276 break;
5277  
5278 case IEEE_PARAM_IEEE_802_1X:
5279 @@ -2368,7 +2404,7 @@
5280  
5281 /* implementation borrowed from hostap driver */
5282  
5283 -static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
5284 +static int ieee80211_wpa_set_encryption_rtl7(struct ieee80211_device *ieee,
5285 struct ieee_param *param, int param_len)
5286 {
5287 int ret = 0;
5288 @@ -2407,7 +2443,7 @@
5289 //sec.encrypt = 0;
5290 sec.level = SEC_LEVEL_0;
5291 sec.flags |= SEC_ENABLED | SEC_LEVEL;
5292 - ieee80211_crypt_delayed_deinit(ieee, crypt);
5293 + ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
5294 }
5295 goto done;
5296 }
5297 @@ -2421,16 +2457,16 @@
5298 strcmp(param->u.crypt.alg, "TKIP"))
5299 goto skip_host_crypt;
5300  
5301 - ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
5302 + ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
5303 if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
5304 - request_module("ieee80211_crypt_wep");
5305 - ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
5306 + request_module("ieee80211_crypt_wep_rtl7");
5307 + ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
5308 } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {
5309 - request_module("ieee80211_crypt_tkip");
5310 - ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
5311 + request_module("ieee80211_crypt_tkip_rtl7");
5312 + ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
5313 } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {
5314 - request_module("ieee80211_crypt_ccmp");
5315 - ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
5316 + request_module("ieee80211_crypt_ccmp_rtl7");
5317 + ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
5318 }
5319 if (ops == NULL) {
5320 printk("unknown crypto alg '%s'\n", param->u.crypt.alg);
5321 @@ -2442,7 +2478,7 @@
5322 if (*crypt == NULL || (*crypt)->ops != ops) {
5323 struct ieee80211_crypt_data *new_crypt;
5324  
5325 - ieee80211_crypt_delayed_deinit(ieee, crypt);
5326 + ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
5327  
5328 new_crypt = (struct ieee80211_crypt_data *)
5329 kmalloc(sizeof(*new_crypt), GFP_KERNEL);
5330 @@ -2525,7 +2561,7 @@
5331  
5332  
5333  
5334 -int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p)
5335 +int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p)
5336 {
5337 struct ieee_param *param;
5338 int ret=0;
5339 @@ -2552,20 +2588,20 @@
5340 switch (param->cmd) {
5341  
5342 case IEEE_CMD_SET_WPA_PARAM:
5343 - ret = ieee80211_wpa_set_param(ieee, param->u.wpa_param.name,
5344 + ret = ieee80211_wpa_set_param_rtl7(ieee, param->u.wpa_param.name,
5345 param->u.wpa_param.value);
5346 break;
5347  
5348 case IEEE_CMD_SET_WPA_IE:
5349 - ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->length);
5350 + ret = ieee80211_wpa_set_wpa_ie_rtl7(ieee, param, p->length);
5351 break;
5352  
5353 case IEEE_CMD_SET_ENCRYPTION:
5354 - ret = ieee80211_wpa_set_encryption(ieee, param, p->length);
5355 + ret = ieee80211_wpa_set_encryption_rtl7(ieee, param, p->length);
5356 break;
5357  
5358 case IEEE_CMD_MLME:
5359 - ret = ieee80211_wpa_mlme(ieee, param->u.mlme.command,
5360 + ret = ieee80211_wpa_mlme_rtl7(ieee, param->u.mlme.command,
5361 param->u.mlme.reason_code);
5362 break;
5363  
5364 @@ -2585,7 +2621,7 @@
5365 return ret;
5366 }
5367  
5368 -void notify_wx_assoc_event(struct ieee80211_device *ieee)
5369 +void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee)
5370 {
5371 union iwreq_data wrqu;
5372 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
5373 @@ -2597,14 +2633,14 @@
5374 }
5375  
5376  
5377 -EXPORT_SYMBOL(ieee80211_get_beacon);
5378 -EXPORT_SYMBOL(ieee80211_wake_queue);
5379 -EXPORT_SYMBOL(ieee80211_stop_queue);
5380 -EXPORT_SYMBOL(ieee80211_reset_queue);
5381 -EXPORT_SYMBOL(ieee80211_softmac_stop_protocol);
5382 -EXPORT_SYMBOL(ieee80211_softmac_start_protocol);
5383 -EXPORT_SYMBOL(ieee80211_is_shortslot);
5384 -EXPORT_SYMBOL(ieee80211_is_54g);
5385 -EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl);
5386 -EXPORT_SYMBOL(ieee80211_ps_tx_ack);
5387 -//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame);
5388 +EXPORT_SYMBOL(ieee80211_get_beacon_rtl7);
5389 +EXPORT_SYMBOL(ieee80211_wake_queue_rtl7);
5390 +EXPORT_SYMBOL(ieee80211_stop_queue_rtl7);
5391 +EXPORT_SYMBOL(ieee80211_reset_queue_rtl7);
5392 +EXPORT_SYMBOL(ieee80211_softmac_stop_protocol_rtl7);
5393 +EXPORT_SYMBOL(ieee80211_softmac_start_protocol_rtl7);
5394 +EXPORT_SYMBOL(ieee80211_is_shortslot_rtl7);
5395 +EXPORT_SYMBOL(ieee80211_is_54g_rtl7);
5396 +EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl_rtl7);
5397 +EXPORT_SYMBOL(ieee80211_ps_tx_ack_rtl7);
5398 +//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame_rtl7);
5399 diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac_wx.c rtl8187_txpower/ieee80211/ieee80211_softmac_wx.c
5400 --- rtl8187_orig/ieee80211/ieee80211_softmac_wx.c 2006-06-06 04:57:54.000000000 +0200
5401 +++ rtl8187_txpower/ieee80211/ieee80211_softmac_wx.c 2007-03-05 00:31:52.575346444 +0100
5402 @@ -18,7 +18,7 @@
5403  
5404 /* FIXME: add A freqs */
5405  
5406 -const long ieee80211_wlan_frequencies[] = {
5407 +const long ieee80211_wlan_frequencies_rtl7[] = {
5408 2412, 2417, 2422, 2427,
5409 2432, 2437, 2442, 2447,
5410 2452, 2457, 2462, 2467,
5411 @@ -26,7 +26,7 @@
5412 };
5413  
5414  
5415 -int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
5416 +int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
5417 union iwreq_data *wrqu, char *b)
5418 {
5419 int ret;
5420 @@ -46,7 +46,7 @@
5421 int f = fwrq->m / 100000;
5422 int c = 0;
5423  
5424 - while ((c < 14) && (f != ieee80211_wlan_frequencies[c]))
5425 + while ((c < 14) && (f != ieee80211_wlan_frequencies_rtl7[c]))
5426 c++;
5427  
5428 /* hack to fall through */
5429 @@ -68,8 +68,8 @@
5430 if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
5431 if(ieee->state == IEEE80211_LINKED){
5432  
5433 - ieee80211_stop_send_beacons(ieee);
5434 - ieee80211_start_send_beacons(ieee);
5435 + ieee80211_stop_send_beacons_rtl7(ieee);
5436 + ieee80211_start_send_beacons_rtl7(ieee);
5437 }
5438 }
5439  
5440 @@ -80,7 +80,7 @@
5441 }
5442  
5443  
5444 -int ieee80211_wx_get_freq(struct ieee80211_device *ieee,
5445 +int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee,
5446 struct iw_request_info *a,
5447 union iwreq_data *wrqu, char *b)
5448 {
5449 @@ -95,7 +95,7 @@
5450 return 0;
5451 }
5452  
5453 -int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
5454 +int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
5455 struct iw_request_info *info,
5456 union iwreq_data *wrqu, char *extra)
5457 {
5458 @@ -124,7 +124,7 @@
5459 }
5460  
5461  
5462 -int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
5463 +int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
5464 struct iw_request_info *info,
5465 union iwreq_data *awrq,
5466 char *extra)
5467 @@ -134,14 +134,14 @@
5468 u8 zero[] = {0,0,0,0,0,0};
5469 unsigned long flags;
5470  
5471 + struct sockaddr *temp = NULL;
5472 short ifup = ieee->proto_started;//dev->flags & IFF_UP;
5473  
5474 ieee->sync_scan_hurryup = 1;
5475  
5476 down(&ieee->wx_sem);
5477  
5478 - struct sockaddr *temp = (struct sockaddr *)awrq;
5479 -
5480 + temp = (struct sockaddr *)awrq;
5481 /* use ifconfig hw ether */
5482 if (ieee->iw_mode == IW_MODE_MASTER){
5483 ret = -1;
5484 @@ -154,7 +154,7 @@
5485 }
5486  
5487 if (ifup)
5488 - ieee80211_stop_protocol(ieee);
5489 + ieee80211_stop_protocol_rtl7(ieee);
5490  
5491 /* just to avoid to give inconsistent infos in the
5492 * get wx method. not really needed otherwise
5493 @@ -167,14 +167,14 @@
5494 spin_unlock_irqrestore(&ieee->lock, flags);
5495  
5496 if (ifup)
5497 - ieee80211_start_protocol(ieee);
5498 + ieee80211_start_protocol_rtl7(ieee);
5499  
5500 out:
5501 up(&ieee->wx_sem);
5502 return ret;
5503 }
5504  
5505 - int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
5506 + int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
5507 {
5508 int len,ret = 0;
5509 unsigned long flags;
5510 @@ -209,7 +209,7 @@
5511  
5512 }
5513  
5514 -int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
5515 +int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
5516 struct iw_request_info *info,
5517 union iwreq_data *wrqu, char *extra)
5518 {
5519 @@ -223,7 +223,7 @@
5520  
5521  
5522  
5523 -int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
5524 +int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
5525 struct iw_request_info *info,
5526 union iwreq_data *wrqu, char *extra)
5527 {
5528 @@ -233,7 +233,7 @@
5529 return 0;
5530 }
5531  
5532 -int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
5533 +int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
5534 union iwreq_data *wrqu, char *b)
5535 {
5536  
5537 @@ -245,8 +245,7 @@
5538 goto out;
5539  
5540 if (wrqu->mode == IW_MODE_MONITOR){
5541 -
5542 - ieee->dev->type = ARPHRD_IEEE80211;
5543 + ieee->dev->type = ARPHRD_IEEE80211_PRISM;
5544 }else{
5545 ieee->dev->type = ARPHRD_ETHER;
5546 }
5547 @@ -254,9 +253,9 @@
5548 if (!ieee->proto_started){
5549 ieee->iw_mode = wrqu->mode;
5550 }else{
5551 - ieee80211_stop_protocol(ieee);
5552 + ieee80211_stop_protocol_rtl7(ieee);
5553 ieee->iw_mode = wrqu->mode;
5554 - ieee80211_start_protocol(ieee);
5555 + ieee80211_start_protocol_rtl7(ieee);
5556 }
5557  
5558 out:
5559 @@ -264,8 +263,14 @@
5560 return 0;
5561 }
5562  
5563 -void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
5564 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
5565 +void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work)
5566 +{
5567 + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
5568 +#else
5569 +void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee)
5570 {
5571 +#endif
5572 short chan;
5573  
5574 chan = ieee->current_network.channel;
5575 @@ -275,12 +280,12 @@
5576 if (ieee->data_hard_stop)
5577 ieee->data_hard_stop(ieee->dev);
5578  
5579 - ieee80211_stop_send_beacons(ieee);
5580 + ieee80211_stop_send_beacons_rtl7(ieee);
5581  
5582 ieee->state = IEEE80211_LINKED_SCANNING;
5583 ieee->link_change(ieee->dev);
5584  
5585 - ieee80211_start_scan_syncro(ieee);
5586 + ieee80211_start_scan_syncro_rtl7(ieee);
5587  
5588 ieee->set_chan(ieee->dev, chan);
5589  
5590 @@ -291,7 +296,7 @@
5591 ieee->data_hard_resume(ieee->dev);
5592  
5593 if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
5594 - ieee80211_start_send_beacons(ieee);
5595 + ieee80211_start_send_beacons_rtl7(ieee);
5596  
5597 netif_carrier_on(ieee->dev);
5598  
5599 @@ -299,7 +304,7 @@
5600  
5601 }
5602  
5603 -int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
5604 +int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
5605 union iwreq_data *wrqu, char *b)
5606 {
5607 int ret = 0;
5608 @@ -322,7 +327,7 @@
5609 return ret;
5610 }
5611  
5612 -int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
5613 +int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
5614 struct iw_request_info *a,
5615 union iwreq_data *wrqu, char *extra)
5616 {
5617 @@ -348,7 +353,7 @@
5618 }
5619  
5620 if(proto_started)
5621 - ieee80211_stop_protocol(ieee);
5622 + ieee80211_stop_protocol_rtl7(ieee);
5623  
5624 /* this is just to be sure that the GET wx callback
5625 * has consisten infos. not needed otherwise
5626 @@ -356,7 +361,11 @@
5627 spin_lock_irqsave(&ieee->lock, flags);
5628  
5629 if (wrqu->essid.flags && wrqu->essid.length) {
5630 +#if WIRELESS_EXT > 20
5631 + len = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE);
5632 +#else
5633 len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
5634 +#endif
5635  
5636 strncpy(ieee->current_network.ssid, extra, len);
5637 ieee->current_network.ssid_len = len;
5638 @@ -371,13 +380,13 @@
5639 spin_unlock_irqrestore(&ieee->lock, flags);
5640  
5641 if (proto_started)
5642 - ieee80211_start_protocol(ieee);
5643 + ieee80211_start_protocol_rtl7(ieee);
5644 out:
5645 up(&ieee->wx_sem);
5646 return ret;
5647 }
5648  
5649 - int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
5650 + int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
5651 union iwreq_data *wrqu, char *b)
5652 {
5653  
5654 @@ -385,7 +394,7 @@
5655 return 0;
5656 }
5657  
5658 - int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
5659 + int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
5660 struct iw_request_info *info,
5661 union iwreq_data *wrqu, char *extra)
5662 {
5663 @@ -422,7 +431,7 @@
5664 return 0;
5665 }
5666  
5667 -int ieee80211_wx_get_name(struct ieee80211_device *ieee,
5668 +int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
5669 struct iw_request_info *info,
5670 union iwreq_data *wrqu, char *extra)
5671 {
5672 @@ -446,7 +455,7 @@
5673  
5674  
5675 /* this is mostly stolen from hostap */
5676 -int ieee80211_wx_set_power(struct ieee80211_device *ieee,
5677 +int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
5678 struct iw_request_info *info,
5679 union iwreq_data *wrqu, char *extra)
5680 {
5681 @@ -509,7 +518,7 @@
5682 }
5683  
5684 /* this is stolen from hostap */
5685 -int ieee80211_wx_get_power(struct ieee80211_device *ieee,
5686 +int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
5687 struct iw_request_info *info,
5688 union iwreq_data *wrqu, char *extra)
5689 {
5690 @@ -547,19 +556,19 @@
5691  
5692 }
5693  
5694 -EXPORT_SYMBOL(ieee80211_wx_get_essid);
5695 -EXPORT_SYMBOL(ieee80211_wx_set_essid);
5696 -EXPORT_SYMBOL(ieee80211_wx_set_rate);
5697 -EXPORT_SYMBOL(ieee80211_wx_get_rate);
5698 -EXPORT_SYMBOL(ieee80211_wx_set_wap);
5699 -EXPORT_SYMBOL(ieee80211_wx_get_wap);
5700 -EXPORT_SYMBOL(ieee80211_wx_set_mode);
5701 -EXPORT_SYMBOL(ieee80211_wx_get_mode);
5702 -EXPORT_SYMBOL(ieee80211_wx_set_scan);
5703 -EXPORT_SYMBOL(ieee80211_wx_get_freq);
5704 -EXPORT_SYMBOL(ieee80211_wx_set_freq);
5705 -EXPORT_SYMBOL(ieee80211_wx_set_rawtx);
5706 -EXPORT_SYMBOL(ieee80211_wx_get_name);
5707 -EXPORT_SYMBOL(ieee80211_wx_set_power);
5708 -EXPORT_SYMBOL(ieee80211_wx_get_power);
5709 -EXPORT_SYMBOL(ieee80211_wlan_frequencies);
5710 +EXPORT_SYMBOL(ieee80211_wx_get_essid_rtl7);
5711 +EXPORT_SYMBOL(ieee80211_wx_set_essid_rtl7);
5712 +EXPORT_SYMBOL(ieee80211_wx_set_rate_rtl7);
5713 +EXPORT_SYMBOL(ieee80211_wx_get_rate_rtl7);
5714 +EXPORT_SYMBOL(ieee80211_wx_set_wap_rtl7);
5715 +EXPORT_SYMBOL(ieee80211_wx_get_wap_rtl7);
5716 +EXPORT_SYMBOL(ieee80211_wx_set_mode_rtl7);
5717 +EXPORT_SYMBOL(ieee80211_wx_get_mode_rtl7);
5718 +EXPORT_SYMBOL(ieee80211_wx_set_scan_rtl7);
5719 +EXPORT_SYMBOL(ieee80211_wx_get_freq_rtl7);
5720 +EXPORT_SYMBOL(ieee80211_wx_set_freq_rtl7);
5721 +EXPORT_SYMBOL(ieee80211_wx_set_rawtx_rtl7);
5722 +EXPORT_SYMBOL(ieee80211_wx_get_name_rtl7);
5723 +EXPORT_SYMBOL(ieee80211_wx_set_power_rtl7);
5724 +EXPORT_SYMBOL(ieee80211_wx_get_power_rtl7);
5725 +EXPORT_SYMBOL(ieee80211_wlan_frequencies_rtl7);
5726 diff -Naur rtl8187_orig/ieee80211/ieee80211_tx.c rtl8187_txpower/ieee80211/ieee80211_tx.c
5727 --- rtl8187_orig/ieee80211/ieee80211_tx.c 2006-06-06 04:57:54.000000000 +0200
5728 +++ rtl8187_txpower/ieee80211/ieee80211_tx.c 2007-03-05 00:31:52.575346444 +0100
5729 @@ -32,7 +32,6 @@
5730 ******************************************************************************/
5731  
5732 #include <linux/compiler.h>
5733 -#include <linux/config.h>
5734 #include <linux/errno.h>
5735 #include <linux/if_arp.h>
5736 #include <linux/in6.h>
5737 @@ -52,6 +51,10 @@
5738 #include <linux/etherdevice.h>
5739 #include <asm/uaccess.h>
5740  
5741 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
5742 +#include <linux/config.h>
5743 +#endif
5744 +
5745 #include "ieee80211.h"
5746  
5747  
5748 @@ -155,7 +158,7 @@
5749 static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
5750 static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
5751  
5752 -static inline int ieee80211_put_snap(u8 *data, u16 h_proto)
5753 +static inline int ieee80211_put_snap_rtl7(u8 *data, u16 h_proto)
5754 {
5755 struct ieee80211_snap_hdr *snap;
5756 u8 *oui;
5757 @@ -178,7 +181,7 @@
5758 return SNAP_SIZE + sizeof(u16);
5759 }
5760  
5761 -int ieee80211_encrypt_fragment(
5762 +int ieee80211_encrypt_fragment_rtl7(
5763 struct ieee80211_device *ieee,
5764 struct sk_buff *frag,
5765 int hdr_len)
5766 @@ -225,7 +228,7 @@
5767 }
5768  
5769  
5770 -void ieee80211_txb_free(struct ieee80211_txb *txb) {
5771 +void ieee80211_txb_free_rtl7(struct ieee80211_txb *txb) {
5772 int i;
5773 if (unlikely(!txb))
5774 return;
5775 @@ -235,7 +238,7 @@
5776 kfree(txb);
5777 }
5778  
5779 -struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
5780 +struct ieee80211_txb *ieee80211_alloc_txb_rtl7(int nr_frags, int txb_size,
5781 int gfp_mask)
5782 {
5783 struct ieee80211_txb *txb;
5784 @@ -267,7 +270,7 @@
5785 }
5786  
5787 /* SKBs are added to the ieee->tx_queue. */
5788 -int ieee80211_xmit(struct sk_buff *skb,
5789 +int ieee80211_xmit_rtl7(struct sk_buff *skb,
5790 struct net_device *dev)
5791 {
5792 struct ieee80211_device *ieee = netdev_priv(dev);
5793 @@ -397,7 +400,7 @@
5794 /* When we allocate the TXB we allocate enough space for the reserve
5795 * and full fragment bytes (bytes_per_frag doesn't include prefix,
5796 * postfix, header, FCS, etc.) */
5797 - txb = ieee80211_alloc_txb(nr_frags, frag_size, GFP_ATOMIC);
5798 + txb = ieee80211_alloc_txb_rtl7(nr_frags, frag_size, GFP_ATOMIC);
5799 if (unlikely(!txb)) {
5800 printk(KERN_WARNING "%s: Could not allocate TXB\n",
5801 ieee->dev->name);
5802 @@ -432,7 +435,7 @@
5803  
5804 /* Put a SNAP header on the first fragment */
5805 if (i == 0) {
5806 - ieee80211_put_snap(
5807 + ieee80211_put_snap_rtl7(
5808 skb_put(skb_frag, SNAP_SIZE + sizeof(u16)),
5809 ether_type);
5810 bytes -= SNAP_SIZE + sizeof(u16);
5811 @@ -446,7 +449,7 @@
5812 /* Encryption routine will move the header forward in order
5813 * to insert the IV between the header and the payload */
5814 if (encrypt)
5815 - ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
5816 + ieee80211_encrypt_fragment_rtl7(ieee, skb_frag, hdr_len);
5817 if (ieee->config &
5818 (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
5819 skb_put(skb_frag, 4);
5820 @@ -458,13 +461,14 @@
5821 ieee->seq_ctrl++;
5822 //---
5823 }else{
5824 - if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
5825 +// if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
5826 + if (unlikely(skb->len < 14)) {
5827 printk(KERN_WARNING "%s: skb too small (%d).\n",
5828 ieee->dev->name, skb->len);
5829 goto success;
5830 }
5831  
5832 - txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC);
5833 + txb = ieee80211_alloc_txb_rtl7(1, skb->len, GFP_ATOMIC);
5834 if(!txb){
5835 printk(KERN_WARNING "%s: Could not allocate TXB\n",
5836 ieee->dev->name);
5837 @@ -481,14 +485,14 @@
5838 dev_kfree_skb_any(skb);
5839 if (txb) {
5840 if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE){
5841 - ieee80211_softmac_xmit(txb, ieee);
5842 + ieee80211_softmac_xmit_rtl7(txb, ieee);
5843 }else{
5844 if ((*ieee->hard_start_xmit)(txb, dev) == 0) {
5845 stats->tx_packets++;
5846 stats->tx_bytes += txb->payload_size;
5847 return 0;
5848 }
5849 - ieee80211_txb_free(txb);
5850 + ieee80211_txb_free_rtl7(txb);
5851 }
5852  
5853  
5854 @@ -504,4 +508,4 @@
5855  
5856 }
5857  
5858 -EXPORT_SYMBOL(ieee80211_txb_free);
5859 +EXPORT_SYMBOL(ieee80211_txb_free_rtl7);
5860 diff -Naur rtl8187_orig/ieee80211/ieee80211_wx.c rtl8187_txpower/ieee80211/ieee80211_wx.c
5861 --- rtl8187_orig/ieee80211/ieee80211_wx.c 2006-06-06 04:57:56.000000000 +0200
5862 +++ rtl8187_txpower/ieee80211/ieee80211_wx.c 2007-03-05 00:31:52.635347349 +0100
5863 @@ -40,7 +40,7 @@
5864 };
5865  
5866 #define MAX_CUSTOM_LEN 64
5867 -static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
5868 +static inline char *ipw2100_translate_scan_rtl7(struct ieee80211_device *ieee,
5869 char *start, char *stop,
5870 struct ieee80211_network *network)
5871 {
5872 @@ -207,7 +207,7 @@
5873 return start;
5874 }
5875  
5876 -int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
5877 +int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
5878 struct iw_request_info *info,
5879 union iwreq_data *wrqu, char *extra)
5880 {
5881 @@ -220,13 +220,14 @@
5882  
5883 IEEE80211_DEBUG_WX("Getting scan\n");
5884 down(&ieee->wx_sem);
5885 + printk("GOT WX GET SCAN WX_SEM LOCK");
5886 spin_lock_irqsave(&ieee->lock, flags);
5887  
5888 list_for_each_entry(network, &ieee->network_list, list) {
5889 i++;
5890 if (ieee->scan_age == 0 ||
5891 time_after(network->last_scanned + ieee->scan_age, jiffies))
5892 - ev = ipw2100_translate_scan(ieee, ev, stop, network);
5893 + ev = ipw2100_translate_scan_rtl7(ieee, ev, stop, network);
5894 else
5895 IEEE80211_DEBUG_SCAN(
5896 "Not showing network '%s ("
5897 @@ -247,7 +248,7 @@
5898 return 0;
5899 }
5900  
5901 -int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
5902 +int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
5903 struct iw_request_info *info,
5904 union iwreq_data *wrqu, char *keybuf)
5905 {
5906 @@ -281,7 +282,7 @@
5907 if (key_provided && *crypt) {
5908 IEEE80211_DEBUG_WX("Disabling encryption on key %d.\n",
5909 key);
5910 - ieee80211_crypt_delayed_deinit(ieee, crypt);
5911 + ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
5912 } else
5913 IEEE80211_DEBUG_WX("Disabling encryption.\n");
5914  
5915 @@ -291,7 +292,7 @@
5916 if (ieee->crypt[i] != NULL) {
5917 if (key_provided)
5918 break;
5919 - ieee80211_crypt_delayed_deinit(
5920 + ieee80211_crypt_delayed_deinit_rtl7(
5921 ieee, &ieee->crypt[i]);
5922 }
5923 }
5924 @@ -314,7 +315,7 @@
5925 strcmp((*crypt)->ops->name, "WEP") != 0) {
5926 /* changing to use WEP; deinit previously used algorithm
5927 * on this key */
5928 - ieee80211_crypt_delayed_deinit(ieee, crypt);
5929 + ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
5930 }
5931  
5932 if (*crypt == NULL) {
5933 @@ -326,10 +327,10 @@
5934 if (new_crypt == NULL)
5935 return -ENOMEM;
5936 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
5937 - new_crypt->ops = ieee80211_get_crypto_ops("WEP");
5938 + new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
5939 if (!new_crypt->ops) {
5940 request_module("ieee80211_crypt_wep");
5941 - new_crypt->ops = ieee80211_get_crypto_ops("WEP");
5942 + new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
5943 }
5944  
5945 if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
5946 @@ -418,7 +419,7 @@
5947 return 0;
5948 }
5949  
5950 -int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
5951 +int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
5952 struct iw_request_info *info,
5953 union iwreq_data *wrqu, char *keybuf)
5954 {
5955 @@ -470,6 +471,6 @@
5956 }
5957  
5958  
5959 -EXPORT_SYMBOL(ieee80211_wx_get_scan);
5960 -EXPORT_SYMBOL(ieee80211_wx_set_encode);
5961 -EXPORT_SYMBOL(ieee80211_wx_get_encode);
5962 +EXPORT_SYMBOL(ieee80211_wx_get_scan_rtl7);
5963 +EXPORT_SYMBOL(ieee80211_wx_set_encode_rtl7);
5964 +EXPORT_SYMBOL(ieee80211_wx_get_encode_rtl7);