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-02-17 13:42:56.967245565 +0100
4 @@ -156,6 +156,23 @@
5 struct list_head list;
6 };
7  
8 +#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
9 +#define IW_MODE_MONITOR_PRISM 15
10 +/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
11 + * (from linux-wlan-ng) */
12 +struct linux_wlan_ng_val {
13 + u32 did;
14 + u16 status, len;
15 + u32 data;
16 +} __attribute__ ((packed));
17 +
18 +struct linux_wlan_ng_prism_hdr {
19 + u32 msgcode, msglen;
20 + char devname[16];
21 + struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
22 + noise, rate, istx, frmlen;
23 +} __attribute__ ((packed));
24 +
25 struct ieee80211_hdr {
26 u16 frame_ctl;
27 u16 duration_id;
28 diff -Naur rtl8187_orig/beta-8187/r8180_hw.h rtl8187_txpower/beta-8187/r8180_hw.h
29 --- rtl8187_orig/beta-8187/r8180_hw.h 2006-06-06 04:58:00.000000000 +0200
30 +++ rtl8187_txpower/beta-8187/r8180_hw.h 2007-02-17 13:42:57.047246772 +0100
31 @@ -646,6 +646,7 @@
32 #define FFER_INTR ((1<<15))
33 #define FFER_GWAKE ((1<< 4))
34  
35 -
36 +#define MAX_TX_POWER 27
37 +#define MIN_TX_POWER 20
38  
39 #endif
40 diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.h rtl8187_txpower/beta-8187/r8180_rtl8225.h
41 --- rtl8187_orig/beta-8187/r8180_rtl8225.h 2006-06-06 04:58:00.000000000 +0200
42 +++ rtl8187_txpower/beta-8187/r8180_rtl8225.h 2007-02-17 13:42:57.127247979 +0100
43 @@ -44,3 +44,5 @@
44 extern u32 rtl8225_chan[];
45  
46 #endif
47 +
48 +void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
49 diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225z2.c rtl8187_txpower/beta-8187/r8180_rtl8225z2.c
50 --- rtl8187_orig/beta-8187/r8180_rtl8225z2.c 2006-06-06 04:58:02.000000000 +0200
51 +++ rtl8187_txpower/beta-8187/r8180_rtl8225z2.c 2007-02-17 13:42:53.757197143 +0100
52 @@ -418,7 +418,10 @@
53  
54 /* CCK power setting */
55 if(cck_power_level > max_cck_power_level)
56 + {
57 cck_power_level = max_cck_power_level;
58 + priv->chtxpwr[ch] = max_cck_power_level;
59 + }
60  
61 cck_power_level += priv->cck_txpwr_base;
62  
63 diff -Naur rtl8187_orig/beta-8187/r8180_wx.c rtl8187_txpower/beta-8187/r8180_wx.c
64 --- rtl8187_orig/beta-8187/r8180_wx.c 2006-06-06 04:58:02.000000000 +0200
65 +++ rtl8187_txpower/beta-8187/r8180_wx.c 2007-02-17 13:42:53.787197595 +0100
66 @@ -21,6 +21,7 @@
67  
68 #include "r8187.h"
69 #include "r8180_hw.h"
70 +#include "r8180_rtl8225.h"
71  
72  
73 #define RATE_COUNT 4
74 @@ -108,6 +109,63 @@
75 return ret;
76 }
77  
78 +static int r8180_wx_get_txpow(struct net_device *dev,
79 + struct iw_request_info *info,
80 + union iwreq_data *wrqu, char *extra)
81 +{
82 + struct r8180_priv *priv = ieee80211_priv(dev);
83 + down(&priv->wx_sem);
84 + wrqu->power.value = priv->chtxpwr_ofdm[1] + MIN_TX_POWER;
85 + wrqu->power.fixed = 1;
86 + wrqu->power.flags = IW_TXPOW_DBM;
87 + wrqu->power.disabled = 0;
88 + up(&priv->wx_sem);
89 +
90 + return 0;
91 +}
92 +
93 +#if 0
94 +static int r8180_wx_set_txpow(struct net_device *dev,
95 + struct iw_request_info *info,
96 + union iwreq_data *wrqu, char *extra)
97 +{
98 + int ret = 0, i = 0;
99 + struct r8180_priv *priv = ieee80211_priv(dev);
100 +
101 + down(&priv->wx_sem);
102 +
103 + if (wrqu->power.flags != IW_TXPOW_DBM)
104 + {
105 + ret = -EINVAL;
106 + goto out;
107 + }
108 +
109 + if(wrqu->power.value > MAX_TX_POWER)
110 + {
111 + ret = -EINVAL;
112 + goto out;
113 + }
114 +
115 + if(wrqu->power.value < MIN_TX_POWER)
116 + {
117 + ret = -EINVAL;
118 + goto out;
119 + }
120 +
121 + for(i=1;i<=14;i++)
122 + {
123 + priv->chtxpwr[i] = wrqu->power.value + 1 - MIN_TX_POWER;
124 + priv->chtxpwr_ofdm[i] = wrqu->power.value - MIN_TX_POWER;
125 + }
126 + rtl8225z2_SetTXPowerLevel(dev, 1);
127 +
128 + out:
129 + up(&priv->wx_sem);
130 +
131 + return ret;
132 +}
133 +#endif
134 +
135 static int r8180_wx_set_rawtx(struct net_device *dev,
136 struct iw_request_info *info,
137 union iwreq_data *wrqu, char *extra)
138 @@ -623,8 +681,8 @@
139 dummy, /* SIOCGIWRTS */
140 r8180_wx_set_frag, /* SIOCSIWFRAG */
141 r8180_wx_get_frag, /* SIOCGIWFRAG */
142 - dummy, /* SIOCSIWTXPOW */
143 - dummy, /* SIOCGIWTXPOW */
144 + NULL, /* SIOCSIWTXPOW */
145 + r8180_wx_get_txpow, /* SIOCGIWTXPOW */
146 r8180_wx_set_retry, /* SIOCSIWRETRY */
147 r8180_wx_get_retry, /* SIOCGIWRETRY */
148 r8180_wx_set_enc, /* SIOCSIWENCODE */
149 diff -Naur rtl8187_orig/beta-8187/r8187_core.c rtl8187_txpower/beta-8187/r8187_core.c
150 --- rtl8187_orig/beta-8187/r8187_core.c 2006-06-22 07:43:30.000000000 +0200
151 +++ rtl8187_txpower/beta-8187/r8187_core.c 2007-02-17 13:42:53.827198198 +0100
152 @@ -57,6 +57,7 @@
153 #undef DEBUG_IRQ_TASKLET
154 #undef DEBUG_TX_ALLOC
155 #undef DEBUG_TX_DESC
156 +#undef DEBUG_TX_POWER
157  
158 //#define CONFIG_RTL8180_IO_MAP
159  
160 @@ -98,6 +99,10 @@
161 #endif
162 static int channels = 0x3fff;
163  
164 +#define DEBUG_EPROM
165 +#define DEBUG_REGISTERS
166 +#define DEBUG_TX_POWER
167 +
168 MODULE_LICENSE("GPL");
169 MODULE_VERSION("V 1.1");
170 MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
171 @@ -158,7 +163,6 @@
172 #endif
173 };
174  
175 -
176 void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
177 {
178  
179 @@ -407,13 +411,14 @@
180 return len;
181 }
182  
183 -
184 +#if WIRELESS_EXT < 17
185 static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
186 {
187 struct r8180_priv *priv = ieee80211_priv(dev);
188  
189 return &priv->wstats;
190 }
191 +#endif
192  
193 void rtl8180_proc_module_init(void)
194 {
195 @@ -561,7 +566,20 @@
196 {
197 int i;
198 for(i=0; i<63; i++)
199 - DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
200 + DMESG("EEPROM addr %02X : %04X", i, eprom_read(dev,i));
201 +}
202 +
203 +/* this is only for debug */
204 +void dump_tx_power(struct net_device *dev)
205 +{
206 + struct r8180_priv *priv = ieee80211_priv(dev);
207 + int i;
208 + DMESG("CCK TX-Power (b-mode):");
209 + for(i=1; i<=14; i++)
210 + DMESG("Channel %d: %d", i, priv->chtxpwr[i]);
211 + DMESG("OFDM TX-Power (g-mode):");
212 + for(i=1; i<=14; i++)
213 + DMESG("Channel %d: %d", i, priv->chtxpwr_ofdm[i]);
214 }
215  
216 /* this is only for debug */
217 @@ -575,9 +593,9 @@
218  
219 for(n=0;n<=max;)
220 {
221 - printk( "\nD: %2x> ", n);
222 + printk( "\nD: %02X> ", n);
223 for(i=0;i<16 && n<=max;i++,n++)
224 - printk("%2x ",read_nic_byte(dev,n));
225 + printk("%02X ",read_nic_byte(dev,n));
226 }
227 printk("\n");
228 }
229 @@ -1112,7 +1130,10 @@
230 struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
231  
232 if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
233 - morefrag = 1;
234 + {
235 + if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->ieee80211->raw_tx != 1)
236 + morefrag = 1;
237 + }
238 // DMESG("%x %x", h->frame_ctl, h->seq_ctl);
239 /*
240 * This function doesn't require lock because we make
241 @@ -1557,10 +1578,10 @@
242 struct r8180_priv *priv = ieee80211_priv(dev);
243 int i, j;
244 u16 word;
245 - int ch;
246 + int ch, chans;
247 //u16 version;
248 - //u8 hw_version;
249 - //u8 config3;
250 + u8 hw_version;
251 + u8 config3;
252  
253 //FIXME: these constants are placed in a bad pleace.
254  
255 @@ -1580,6 +1601,13 @@
256 return -1;
257 }
258 ch=channels;
259 + chans=0;
260 + for (i=1; i<=14; i++) {
261 + if( (u8)(ch & 0x01) ) chans++;
262 + ch >>= 1;
263 + }
264 + DMESG("Enabling %d channels.", chans);
265 + ch=channels;
266 // set channels 1..14 allowed in given locale
267 for (i=1; i<=14; i++) {
268 (priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
269 @@ -1622,7 +1650,11 @@
270 priv->ieee80211->mode = IEEE_G;
271 priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
272 spin_lock_init(&priv->tx_lock);
273 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
274 INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
275 +#else
276 + INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart);
277 +#endif
278 sema_init(&priv->wx_sem,1);
279 tasklet_init(&priv->irq_rx_tasklet,
280 (void(*)(unsigned long))rtl8180_irq_rx_tasklet,
281 @@ -1716,6 +1748,12 @@
282 priv->enable_gpio0 = 0;
283  
284  
285 + hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
286 + config3 = read_nic_byte(dev, CONFIG3);
287 +
288 + DMESG("MAC chip version: %02X", hw_version);
289 + DMESG("Card type: %02X", config3);
290 +
291 /* commented out just because we already do
292 this when resetting the card
293 andrea 20050924
294 @@ -1807,6 +1845,12 @@
295  
296  
297 priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
298 +
299 +#ifdef DEBUG_TX_POWER
300 + dump_tx_power(dev);
301 +#endif
302 +
303 + DMESG("RF Chip ID: %02X", priv->rf_chip);
304  
305 word = eprom_read(dev,EPROM_TXPW_BASE);
306 priv->cck_txpwr_base = word & 0xf;
307 @@ -2291,13 +2335,17 @@
308 /* based on ipw2200 driver */
309 int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
310 {
311 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
312 + struct r8180_priv *priv = NULL;
313 + struct iwreq *wrq = NULL;
314 +
315 + int ret=-1;
316 +
317 + priv = (struct r8180_priv *)ieee80211_priv(dev);
318  
319 down(&priv->wx_sem);
320  
321 - struct iwreq *wrq = (struct iwreq *)rq;
322 -
323 - int ret=-1;
324 + wrq = (struct iwreq *)rq;
325 +
326 switch (cmd) {
327 case RTL_IOCTL_WPA_SUPPLICANT:
328 ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
329 @@ -2346,7 +2394,8 @@
330  
331 if( flen <= rx_urb->actual_length){
332  
333 - stats.signal = (desc[1] & 0x7f00)>>8;
334 +// stats.signal = (desc[1] & 0x7f00)>>8;
335 + stats.signal = (desc[1] & 0xff00)>>8;
336 stats.noise = desc[1] &0xff;
337 stats.rate = desc[0] >> 20 & 0xf;
338 stats.mac_time[0] = desc[2];
339 @@ -2368,6 +2417,8 @@
340 // priv->rxskb = skb;
341 // priv->tempstats = &stats;
342  
343 +
344 + stats.signal -= stats.noise;
345 if(!ieee80211_rx(priv->ieee80211,
346 skb, &stats))
347 dev_kfree_skb_any(skb);
348 @@ -2418,7 +2469,12 @@
349 dev->do_ioctl = rtl8180_ioctl;
350 dev->set_multicast_list = r8180_set_multicast;
351 dev->set_mac_address = r8180_set_mac_adr;
352 +#if WIRELESS_EXT >= 12
353 +#if WIRELESS_EXT < 17
354 dev->get_wireless_stats = r8180_get_wireless_stats;
355 +#endif
356 + dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
357 +#endif
358 dev->type=ARPHRD_ETHER;
359  
360 if (dev_alloc_name(dev, ifname) < 0){
361 diff -Naur rtl8187_orig/beta-8187/r8187.h rtl8187_txpower/beta-8187/r8187.h
362 --- rtl8187_orig/beta-8187/r8187.h 2006-06-06 08:48:10.000000000 +0200
363 +++ rtl8187_txpower/beta-8187/r8187.h 2007-02-17 13:42:57.197249035 +0100
364 @@ -26,7 +26,6 @@
365  
366 #include <linux/module.h>
367 #include <linux/kernel.h>
368 -#include <linux/config.h>
369 #include <linux/init.h>
370 #include <linux/ioport.h>
371 #include <linux/sched.h>
372 @@ -47,6 +46,10 @@
373 #include <asm/io.h>
374 #include <asm/semaphore.h>
375  
376 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
377 +#include <linux/config.h>
378 +#endif
379 +
380 #include "ieee80211.h"
381  
382 #define EPROM_93c46 0
383 @@ -148,7 +151,7 @@
384 u8 challow[15]; //channels from 1 to 14, 0 not used
385 short up;
386 short crcmon; //if 1 allow bad crc frame reception in monitor mode
387 -// short prism_hdr;
388 + short prism_hdr;
389  
390 // struct timer_list scan_timer;
391 /*short scanpending;
392 diff -Naur rtl8187_orig/beta-8187/r8187.mod.c rtl8187_txpower/beta-8187/r8187.mod.c
393 --- rtl8187_orig/beta-8187/r8187.mod.c 1970-01-01 01:00:00.000000000 +0100
394 +++ rtl8187_txpower/beta-8187/r8187.mod.c 2007-02-17 13:42:53.827198198 +0100
395 @@ -0,0 +1,25 @@
396 +#include <linux/module.h>
397 +#include <linux/vermagic.h>
398 +#include <linux/compiler.h>
399 +
400 +MODULE_INFO(vermagic, VERMAGIC_STRING);
401 +
402 +struct module __this_module
403 +__attribute__((section(".gnu.linkonce.this_module"))) = {
404 + .name = KBUILD_MODNAME,
405 + .init = init_module,
406 +#ifdef CONFIG_MODULE_UNLOAD
407 + .exit = cleanup_module,
408 +#endif
409 +};
410 +
411 +static const char __module_depends[]
412 +__attribute_used__
413 +__attribute__((section(".modinfo"))) =
414 +"depends=ieee80211-rtl";
415 +
416 +MODULE_ALIAS("usb:v0BDAp8187d*dc*dsc*dp*ic*isc*ip*");
417 +MODULE_ALIAS("usb:v0846p6100d*dc*dsc*dp*ic*isc*ip*");
418 +MODULE_ALIAS("usb:v0846p6A00d*dc*dsc*dp*ic*isc*ip*");
419 +
420 +MODULE_INFO(srcversion, "B76939EB1EA6331677B0BFF");
421 diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.c rtl8187_txpower/ieee80211/ieee80211_crypt.c
422 --- rtl8187_orig/ieee80211/ieee80211_crypt.c 2006-06-06 04:57:56.000000000 +0200
423 +++ rtl8187_txpower/ieee80211/ieee80211_crypt.c 2007-02-17 13:43:15.707528258 +0100
424 @@ -11,7 +11,6 @@
425 *
426 */
427  
428 -#include <linux/config.h>
429 #include <linux/version.h>
430 #include <linux/module.h>
431 #include <linux/init.h>
432 @@ -19,6 +18,10 @@
433 #include <asm/string.h>
434 #include <asm/errno.h>
435  
436 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
437 +#include <linux/config.h>
438 +#endif
439 +
440 #include "ieee80211.h"
441  
442 MODULE_AUTHOR("Jouni Malinen");
443 diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c rtl8187_txpower/ieee80211/ieee80211_crypt_ccmp.c
444 --- rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c 2006-06-06 04:58:00.000000000 +0200
445 +++ rtl8187_txpower/ieee80211/ieee80211_crypt_ccmp.c 2007-02-17 13:43:15.707528258 +0100
446 @@ -9,7 +9,6 @@
447 * more details.
448 */
449  
450 -#include <linux/config.h>
451 #include <linux/version.h>
452 #include <linux/module.h>
453 #include <linux/init.h>
454 @@ -22,11 +21,20 @@
455 #include <asm/string.h>
456 #include <linux/wireless.h>
457  
458 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
459 + #include <linux/config.h>
460 +#endif
461 +
462 #include "ieee80211.h"
463  
464  
465 #include <linux/crypto.h>
466 -#include <asm/scatterlist.h>
467 +
468 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
469 + #include <asm/scatterlist.h>
470 +#else
471 + #include <linux/scatterlist.h>
472 +#endif
473  
474 MODULE_AUTHOR("Jouni Malinen");
475 MODULE_DESCRIPTION("Host AP crypt: CCMP");
476 diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_ccmp-rtl.mod.c rtl8187_txpower/ieee80211/ieee80211_crypt_ccmp-rtl.mod.c
477 --- rtl8187_orig/ieee80211/ieee80211_crypt_ccmp-rtl.mod.c 1970-01-01 01:00:00.000000000 +0100
478 +++ rtl8187_txpower/ieee80211/ieee80211_crypt_ccmp-rtl.mod.c 2007-02-17 13:43:15.737528711 +0100
479 @@ -0,0 +1,20 @@
480 +#include <linux/module.h>
481 +#include <linux/vermagic.h>
482 +#include <linux/compiler.h>
483 +
484 +MODULE_INFO(vermagic, VERMAGIC_STRING);
485 +
486 +struct module __this_module
487 +__attribute__((section(".gnu.linkonce.this_module"))) = {
488 + .name = KBUILD_MODNAME,
489 + .init = init_module,
490 +#ifdef CONFIG_MODULE_UNLOAD
491 + .exit = cleanup_module,
492 +#endif
493 +};
494 +
495 +static const char __module_depends[]
496 +__attribute_used__
497 +__attribute__((section(".modinfo"))) =
498 +"depends=ieee80211_crypt";
499 +
500 diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt-rtl.mod.c rtl8187_txpower/ieee80211/ieee80211_crypt-rtl.mod.c
501 --- rtl8187_orig/ieee80211/ieee80211_crypt-rtl.mod.c 1970-01-01 01:00:00.000000000 +0100
502 +++ rtl8187_txpower/ieee80211/ieee80211_crypt-rtl.mod.c 2007-02-17 13:43:15.747528862 +0100
503 @@ -0,0 +1,20 @@
504 +#include <linux/module.h>
505 +#include <linux/vermagic.h>
506 +#include <linux/compiler.h>
507 +
508 +MODULE_INFO(vermagic, VERMAGIC_STRING);
509 +
510 +struct module __this_module
511 +__attribute__((section(".gnu.linkonce.this_module"))) = {
512 + .name = KBUILD_MODNAME,
513 + .init = init_module,
514 +#ifdef CONFIG_MODULE_UNLOAD
515 + .exit = cleanup_module,
516 +#endif
517 +};
518 +
519 +static const char __module_depends[]
520 +__attribute_used__
521 +__attribute__((section(".modinfo"))) =
522 +"depends=";
523 +
524 diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c rtl8187_txpower/ieee80211/ieee80211_crypt_tkip.c
525 --- rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c 2006-06-06 04:57:54.000000000 +0200
526 +++ rtl8187_txpower/ieee80211/ieee80211_crypt_tkip.c 2007-02-17 13:43:15.797529616 +0100
527 @@ -9,7 +9,6 @@
528 * more details.
529 */
530  
531 -#include <linux/config.h>
532 #include <linux/version.h>
533 #include <linux/module.h>
534 #include <linux/init.h>
535 @@ -21,13 +20,22 @@
536 #include <linux/if_arp.h>
537 #include <asm/string.h>
538  
539 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
540 +#include <linux/config.h>
541 +#endif
542 +
543 #include "ieee80211.h"
544  
545 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
546 + #include <asm/scatterlist.h>
547 +#else
548 + #include <linux/scatterlist.h>
549 +#endif
550  
551 #include <linux/crypto.h>
552 -#include <asm/scatterlist.h>
553 #include <linux/crc32.h>
554  
555 +
556 MODULE_AUTHOR("Jouni Malinen");
557 MODULE_DESCRIPTION("Host AP crypt: TKIP");
558 MODULE_LICENSE("GPL");
559 @@ -431,7 +439,11 @@
560 static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
561 u8 *data, size_t data_len, u8 *mic)
562 {
563 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
564 + struct hash_desc desc;
565 +#endif
566 struct scatterlist sg[2];
567 + int ret=0;
568  
569 if (tkey->tfm_michael == NULL) {
570 printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
571 @@ -445,12 +457,21 @@
572 sg[1].offset = offset_in_page(data);
573 sg[1].length = data_len;
574  
575 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
576 crypto_digest_init(tkey->tfm_michael);
577 crypto_digest_setkey(tkey->tfm_michael, key, 8);
578 crypto_digest_update(tkey->tfm_michael, sg, 2);
579 crypto_digest_final(tkey->tfm_michael, mic);
580 +#else
581 + if (crypto_hash_setkey(tkey->tfm_michael, key, 8))
582 + return -1;
583  
584 - return 0;
585 + desc.tfm = tkey->tfm_michael;
586 + desc.flags = 0;
587 + ret = crypto_hash_digest(&desc, sg, data_len + 16, mic);
588 +#endif
589 +
590 + return ret;
591 }
592  
593 static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
594 diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_tkip-rtl.mod.c rtl8187_txpower/ieee80211/ieee80211_crypt_tkip-rtl.mod.c
595 --- rtl8187_orig/ieee80211/ieee80211_crypt_tkip-rtl.mod.c 1970-01-01 01:00:00.000000000 +0100
596 +++ rtl8187_txpower/ieee80211/ieee80211_crypt_tkip-rtl.mod.c 2007-02-17 13:43:15.827530068 +0100
597 @@ -0,0 +1,20 @@
598 +#include <linux/module.h>
599 +#include <linux/vermagic.h>
600 +#include <linux/compiler.h>
601 +
602 +MODULE_INFO(vermagic, VERMAGIC_STRING);
603 +
604 +struct module __this_module
605 +__attribute__((section(".gnu.linkonce.this_module"))) = {
606 + .name = KBUILD_MODNAME,
607 + .init = init_module,
608 +#ifdef CONFIG_MODULE_UNLOAD
609 + .exit = cleanup_module,
610 +#endif
611 +};
612 +
613 +static const char __module_depends[]
614 +__attribute_used__
615 +__attribute__((section(".modinfo"))) =
616 +"depends=ieee80211_crypt";
617 +
618 diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_wep.c rtl8187_txpower/ieee80211/ieee80211_crypt_wep.c
619 --- rtl8187_orig/ieee80211/ieee80211_crypt_wep.c 2006-06-06 04:57:54.000000000 +0200
620 +++ rtl8187_txpower/ieee80211/ieee80211_crypt_wep.c 2007-02-17 13:43:15.837530219 +0100
621 @@ -9,7 +9,6 @@
622 * more details.
623 */
624  
625 -#include <linux/config.h>
626 #include <linux/version.h>
627 #include <linux/module.h>
628 #include <linux/init.h>
629 @@ -18,13 +17,22 @@
630 #include <linux/skbuff.h>
631 #include <asm/string.h>
632  
633 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
634 +#include <linux/config.h>
635 +#endif
636 +
637 #include "ieee80211.h"
638  
639  
640 #include <linux/crypto.h>
641 -#include <asm/scatterlist.h>
642 #include <linux/crc32.h>
643  
644 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
645 + #include <asm/scatterlist.h>
646 +#else
647 + #include <linux/scatterlist.h>
648 +#endif
649 +
650 MODULE_AUTHOR("Jouni Malinen");
651 MODULE_DESCRIPTION("Host AP crypt: WEP");
652 MODULE_LICENSE("GPL");
653 diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_wep-rtl.mod.c rtl8187_txpower/ieee80211/ieee80211_crypt_wep-rtl.mod.c
654 --- rtl8187_orig/ieee80211/ieee80211_crypt_wep-rtl.mod.c 1970-01-01 01:00:00.000000000 +0100
655 +++ rtl8187_txpower/ieee80211/ieee80211_crypt_wep-rtl.mod.c 2007-02-17 13:43:15.877530823 +0100
656 @@ -0,0 +1,20 @@
657 +#include <linux/module.h>
658 +#include <linux/vermagic.h>
659 +#include <linux/compiler.h>
660 +
661 +MODULE_INFO(vermagic, VERMAGIC_STRING);
662 +
663 +struct module __this_module
664 +__attribute__((section(".gnu.linkonce.this_module"))) = {
665 + .name = KBUILD_MODNAME,
666 + .init = init_module,
667 +#ifdef CONFIG_MODULE_UNLOAD
668 + .exit = cleanup_module,
669 +#endif
670 +};
671 +
672 +static const char __module_depends[]
673 +__attribute_used__
674 +__attribute__((section(".modinfo"))) =
675 +"depends=ieee80211_crypt";
676 +
677 diff -Naur rtl8187_orig/ieee80211/ieee80211.h rtl8187_txpower/ieee80211/ieee80211.h
678 --- rtl8187_orig/ieee80211/ieee80211.h 2006-06-06 04:57:56.000000000 +0200
679 +++ rtl8187_txpower/ieee80211/ieee80211.h 2007-02-17 13:43:11.897470784 +0100
680 @@ -156,6 +156,22 @@
681 struct list_head list;
682 };
683  
684 +#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
685 +/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
686 + * (from linux-wlan-ng) */
687 +struct linux_wlan_ng_val {
688 + u32 did;
689 + u16 status, len;
690 + u32 data;
691 +} __attribute__ ((packed));
692 +
693 +struct linux_wlan_ng_prism_hdr {
694 + u32 msgcode, msglen;
695 + char devname[16];
696 + struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
697 + noise, rate, istx, frmlen;
698 +} __attribute__ ((packed));
699 +
700 struct ieee80211_hdr {
701 u16 frame_ctl;
702 u16 duration_id;
703 diff -Naur rtl8187_orig/ieee80211/ieee80211_module.c rtl8187_txpower/ieee80211/ieee80211_module.c
704 --- rtl8187_orig/ieee80211/ieee80211_module.c 2006-06-06 04:58:00.000000000 +0200
705 +++ rtl8187_txpower/ieee80211/ieee80211_module.c 2007-02-17 13:43:15.907531275 +0100
706 @@ -31,7 +31,6 @@
707 *******************************************************************************/
708  
709 #include <linux/compiler.h>
710 -#include <linux/config.h>
711 #include <linux/errno.h>
712 #include <linux/if_arp.h>
713 #include <linux/in6.h>
714 @@ -52,6 +51,10 @@
715 #include <asm/uaccess.h>
716 #include <net/arp.h>
717  
718 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
719 +#include <linux/config.h>
720 +#endif
721 +
722 #include "ieee80211.h"
723  
724 MODULE_DESCRIPTION("802.11 data/management/control stack");
725 diff -Naur rtl8187_orig/ieee80211/ieee80211-rtl.mod.c rtl8187_txpower/ieee80211/ieee80211-rtl.mod.c
726 --- rtl8187_orig/ieee80211/ieee80211-rtl.mod.c 1970-01-01 01:00:00.000000000 +0100
727 +++ rtl8187_txpower/ieee80211/ieee80211-rtl.mod.c 2007-02-17 13:43:15.937531728 +0100
728 @@ -0,0 +1,16 @@
729 +#include <linux/module.h>
730 +#include <linux/vermagic.h>
731 +#include <linux/compiler.h>
732 +
733 +MODULE_INFO(vermagic, VERMAGIC_STRING);
734 +
735 +struct module __this_module
736 +__attribute__((section(".gnu.linkonce.this_module"))) = {
737 + .name = KBUILD_MODNAME,
738 +};
739 +
740 +static const char __module_depends[]
741 +__attribute_used__
742 +__attribute__((section(".modinfo"))) =
743 +"depends=ieee80211_crypt";
744 +
745 diff -Naur rtl8187_orig/ieee80211/ieee80211_rx.c rtl8187_txpower/ieee80211/ieee80211_rx.c
746 --- rtl8187_orig/ieee80211/ieee80211_rx.c 2006-06-06 04:58:00.000000000 +0200
747 +++ rtl8187_txpower/ieee80211/ieee80211_rx.c 2007-02-17 13:43:15.947531879 +0100
748 @@ -22,7 +22,6 @@
749  
750  
751 #include <linux/compiler.h>
752 -#include <linux/config.h>
753 #include <linux/errno.h>
754 #include <linux/if_arp.h>
755 #include <linux/in6.h>
756 @@ -43,18 +42,83 @@
757 #include <asm/uaccess.h>
758 #include <linux/ctype.h>
759  
760 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
761 +#include <linux/config.h>
762 +#endif
763 +
764 +
765 #include "ieee80211.h"
766  
767 static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
768 struct sk_buff *skb,
769 struct ieee80211_rx_stats *rx_stats)
770 {
771 - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
772 - u16 fc = le16_to_cpu(hdr->frame_ctl);
773 + struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data;
774 + u16 fc = le16_to_cpu(hdr1->frame_ctl);
775 + int prism_header;
776 + int hdrlen, phdrlen, head_need, tail_need;
777 +
778 + if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) {
779 + prism_header = 1;
780 + phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
781 + } else {
782 + prism_header = 0;
783 + phdrlen = 0;
784 + }
785 +
786 + hdrlen = ieee80211_get_hdrlen(fc);
787 +
788 + /* check if there is enough room for extra data; if not, expand skb
789 + * buffer to be large enough for the changes */
790 + head_need = phdrlen;
791 + tail_need = 0;
792 +#ifdef PRISM2_ADD_BOGUS_CRC
793 + tail_need += 4;
794 +#endif /* PRISM2_ADD_BOGUS_CRC */
795 +
796 + head_need -= skb_headroom(skb);
797 + tail_need -= skb_tailroom(skb);
798 +
799 + if (head_need > 0 || tail_need > 0) {
800 + if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
801 + tail_need > 0 ? tail_need : 0,
802 + GFP_ATOMIC)) {
803 + printk(KERN_DEBUG "%s: ieee80211_rx failed to "
804 + "reallocate skb buffer\n", ieee->dev->name);
805 + dev_kfree_skb_any(skb);
806 + return;
807 + }
808 + }
809 +
810 + if (prism_header == 1) {
811 + struct linux_wlan_ng_prism_hdr *hdr;
812 + hdr = (struct linux_wlan_ng_prism_hdr *)
813 + skb_push(skb, phdrlen);
814 + memset(hdr, 0, phdrlen);
815 + hdr->msgcode = LWNG_CAP_DID_BASE;
816 + hdr->msglen = sizeof(*hdr);
817 + memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname));
818 +#define LWNG_SETVAL(f,i,s,l,d) \
819 +hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
820 +hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
821 + LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
822 + LWNG_SETVAL(mactime, 2, 0, 4, ((u32)rx_stats->mac_time));
823 + LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
824 + LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
825 + LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
826 + LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
827 + LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
828 + LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
829 + LWNG_SETVAL(istx, 9, 0, 4, 0);
830 + LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
831 +#undef LWNG_SETVAL
832 + }
833  
834 skb->dev = ieee->dev;
835 skb->mac.raw = skb->data;
836 - skb_pull(skb, ieee80211_get_hdrlen(fc));
837 + skb_pull(skb, hdrlen);
838 + if (prism_header)
839 + skb_pull(skb, phdrlen);
840 skb->pkt_type = PACKET_OTHERHOST;
841 skb->protocol = __constant_htons(ETH_P_80211_RAW);
842 memset(skb->cb, 0, sizeof(skb->cb));
843 diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac.c rtl8187_txpower/ieee80211/ieee80211_softmac.c
844 --- rtl8187_orig/ieee80211/ieee80211_softmac.c 2006-06-19 03:27:33.000000000 +0200
845 +++ rtl8187_txpower/ieee80211/ieee80211_softmac.c 2007-02-17 13:43:15.987532482 +0100
846 @@ -386,9 +386,8 @@
847  
848 void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
849 {
850 - down(&ieee->scan_sem);
851 -
852 short watchdog = 0;
853 + down(&ieee->scan_sem);
854  
855 do{
856 ieee->current_network.channel =
857 @@ -1467,12 +1466,13 @@
858 u16 stype)
859 {
860 struct ieee80211_hdr_3addr *header;
861 - header = (struct ieee80211_hdr_3addr *) skb->data;
862 u16 errcode;
863 u8* challenge;
864 int chlen;
865 int aid;
866  
867 + header = (struct ieee80211_hdr_3addr *) skb->data;
868 +
869 if(!ieee->proto_started)
870 return 0;
871  
872 @@ -2165,12 +2165,21 @@
873 ieee->wq = create_workqueue(DRV_NAME);
874 #endif
875  
876 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
877 INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
878 INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
879 INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
880 INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
881 INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
882 INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
883 +#else
884 + INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq);
885 + INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq);
886 + INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq);
887 + INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq);
888 + INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq);
889 + INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq);
890 +#endif
891  
892 sema_init(&ieee->wx_sem, 1);
893 sema_init(&ieee->scan_sem, 1);
894 diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac_wx.c rtl8187_txpower/ieee80211/ieee80211_softmac_wx.c
895 --- rtl8187_orig/ieee80211/ieee80211_softmac_wx.c 2006-06-06 04:57:54.000000000 +0200
896 +++ rtl8187_txpower/ieee80211/ieee80211_softmac_wx.c 2007-02-17 13:43:16.057533538 +0100
897 @@ -134,14 +134,14 @@
898 u8 zero[] = {0,0,0,0,0,0};
899 unsigned long flags;
900  
901 + struct sockaddr *temp = NULL;
902 short ifup = ieee->proto_started;//dev->flags & IFF_UP;
903  
904 ieee->sync_scan_hurryup = 1;
905  
906 down(&ieee->wx_sem);
907  
908 - struct sockaddr *temp = (struct sockaddr *)awrq;
909 -
910 + temp = (struct sockaddr *)awrq;
911 /* use ifconfig hw ether */
912 if (ieee->iw_mode == IW_MODE_MASTER){
913 ret = -1;
914 @@ -245,8 +245,7 @@
915 goto out;
916  
917 if (wrqu->mode == IW_MODE_MONITOR){
918 -
919 - ieee->dev->type = ARPHRD_IEEE80211;
920 + ieee->dev->type = ARPHRD_IEEE80211_PRISM;
921 }else{
922 ieee->dev->type = ARPHRD_ETHER;
923 }
924 diff -Naur rtl8187_orig/ieee80211/ieee80211_tx.c rtl8187_txpower/ieee80211/ieee80211_tx.c
925 --- rtl8187_orig/ieee80211/ieee80211_tx.c 2006-06-06 04:57:54.000000000 +0200
926 +++ rtl8187_txpower/ieee80211/ieee80211_tx.c 2007-02-17 13:43:16.057533538 +0100
927 @@ -32,7 +32,6 @@
928 ******************************************************************************/
929  
930 #include <linux/compiler.h>
931 -#include <linux/config.h>
932 #include <linux/errno.h>
933 #include <linux/if_arp.h>
934 #include <linux/in6.h>
935 @@ -52,6 +51,10 @@
936 #include <linux/etherdevice.h>
937 #include <asm/uaccess.h>
938  
939 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
940 +#include <linux/config.h>
941 +#endif
942 +
943 #include "ieee80211.h"
944  
945  
946 @@ -458,7 +461,8 @@
947 ieee->seq_ctrl++;
948 //---
949 }else{
950 - if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
951 +// if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
952 + if (unlikely(skb->len < 14)) {
953 printk(KERN_WARNING "%s: skb too small (%d).\n",
954 ieee->dev->name, skb->len);
955 goto success;
956 diff -Naur rtl8187_orig/makedrv rtl8187_txpower/makedrv
957 --- rtl8187_orig/makedrv 2006-09-05 07:21:10.000000000 +0200
958 +++ rtl8187_txpower/makedrv 2007-02-17 13:42:37.616953671 +0100
959 @@ -5,6 +5,7 @@
960 cd ieee80211
961 make clean
962 make
963 +cp Module.symvers beta-8187/
964 cd ../beta-8187
965 make clean
966 make
967 diff -Naur rtl8187_orig/makedrvbk rtl8187_txpower/makedrvbk
968 --- rtl8187_orig/makedrvbk 2006-09-05 07:21:10.000000000 +0200
969 +++ rtl8187_txpower/makedrvbk 2007-02-17 13:42:41.357010089 +0100
970 @@ -1,9 +1,11 @@
971 #!/bin/bash
972  
973 cd ieee80211/
974 +rm Module.symvers
975 make clean
976 make
977 cd -
978 +cp ieee80211/Module.symvers beta-8187/
979 cd beta-8187/
980 make clean
981 make