Debian Codegraph @

patches/old/rtl8187_2.6.24v2.patch

raw
1 diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/ieee80211_crypt.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/ieee80211_crypt.h
2 --- rtl8187_linux_26.1010.0622.2006/beta-8187/ieee80211_crypt.h 2006-06-06 04:58:02.000000000 +0200
3 +++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/ieee80211_crypt.h 2008-01-30 17:38:10.000000000 +0100
4 @@ -75,12 +75,12 @@
5 atomic_t refcnt;
6 };
7
8 -int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
9 -int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
10 -struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
11 -void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
12 -void ieee80211_crypt_deinit_handler(unsigned long);
13 -void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
14 +int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
15 +int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
16 +struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
17 +void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
18 +void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
19 +void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
20 struct ieee80211_crypt_data **crypt);
21
22 #endif
23 diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/ieee80211.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/ieee80211.h
24 --- rtl8187_linux_26.1010.0622.2006/beta-8187/ieee80211.h 2006-06-06 04:58:02.000000000 +0200
25 +++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/ieee80211.h 2008-01-30 17:38:10.000000000 +0100
26 @@ -120,7 +120,7 @@
27 static inline unsigned long msleep_interruptible_rtl(unsigned int msecs)
28 {
29 unsigned long timeout = MSECS(msecs) + 1;
30 -
31 +
32 while (timeout) {
33 set_current_state(TASK_UNINTERRUPTIBLE);
34 timeout = schedule_timeout(timeout);
35 @@ -156,6 +156,22 @@
36 struct list_head list;
37 };
38
39 +#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
40 +/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
41 + * (from linux-wlan-ng) */
42 +struct linux_wlan_ng_val {
43 + u32 did;
44 + u16 status, len;
45 + u32 data;
46 +} __attribute__ ((packed));
47 +
48 +struct linux_wlan_ng_prism_hdr {
49 + u32 msgcode, msglen;
50 + char devname[16];
51 + struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
52 + noise, rate, istx, frmlen;
53 +} __attribute__ ((packed));
54 +
55 struct ieee80211_hdr {
56 u16 frame_ctl;
57 u16 duration_id;
58 @@ -798,7 +814,7 @@
59
60 /* the card is not linked at all */
61 IEEE80211_NOLINK = 0,
62 -
63 +
64 /* IEEE80211_ASSOCIATING* are for BSS client mode
65 * the driver shall not perform RX filtering unless
66 * the state is LINKED.
67 @@ -806,31 +822,31 @@
68 * defaults to NOLINK for ALL the other states (including
69 * LINKED_SCANNING)
70 */
71 -
72 +
73 /* the association procedure will start (wq scheduling)*/
74 IEEE80211_ASSOCIATING,
75 IEEE80211_ASSOCIATING_RETRY,
76 -
77 +
78 /* the association procedure is sending AUTH request*/
79 IEEE80211_ASSOCIATING_AUTHENTICATING,
80 -
81 +
82 /* the association procedure has successfully authentcated
83 * and is sending association request
84 */
85 IEEE80211_ASSOCIATING_AUTHENTICATED,
86 -
87 +
88 /* the link is ok. the card associated to a BSS or linked
89 * to a ibss cell or acting as an AP and creating the bss
90 */
91 IEEE80211_LINKED,
92 -
93 +
94 /* same as LINKED, but the driver shall apply RX filter
95 * rules as we are in NO_LINK mode. As the card is still
96 * logically linked, but it is doing a syncro site survey
97 * then it will be back to LINKED state.
98 */
99 IEEE80211_LINKED_SCANNING,
100 -
101 +
102 };
103
104 #define DEFAULT_MAX_SCAN_AGE (15 * HZ)
105 @@ -840,14 +856,14 @@
106
107
108 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
109 -extern inline int is_multicast_ether_addr(const u8 *addr)
110 +extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
111 {
112 return ((addr[0] != 0xff) && (0x01 & addr[0]));
113 }
114 #endif
115
116 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
117 -extern inline int is_broadcast_ether_addr(const u8 *addr)
118 +extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
119 {
120 return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
121 (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
122 @@ -870,7 +886,7 @@
123 struct net_device_stats stats;
124 struct ieee80211_stats ieee_stats;
125 struct ieee80211_softmac_stats softmac_stats;
126 -
127 +
128 /* Probe / Beacon management */
129 struct list_head network_free_list;
130 struct list_head network_list;
131 @@ -881,7 +897,7 @@
132 int iw_mode; /* operating mode (IW_MODE_*) */
133
134 spinlock_t lock;
135 -
136 +
137 int tx_headroom; /* Set to size of any additional room needed at front
138 * of allocated Tx SKBs */
139 u32 config;
140 @@ -924,11 +940,11 @@
141 * ad-hoc is a mixture ;-).
142 * Note that in infrastructure mode, even when not associated,
143 * fields bssid and essid may be valid (if wpa_set and essid_set
144 - * are true) as thy carry the value set by the user via iwconfig
145 + * are true) as thy carry the value set by the user via iwconfig
146 */
147 struct ieee80211_network current_network;
148
149 -
150 +
151 enum ieee80211_state state;
152
153 int short_slot;
154 @@ -936,33 +952,33 @@
155 int modulation; /* CCK, OFDM */
156 int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
157 int abg_true; /* ABG flag */
158 -
159 - /* used for forcing the ibss workqueue to terminate
160 +
161 + /* used for forcing the ibss workqueue to terminate
162 * without wait for the syncro scan to terminate
163 */
164 - short sync_scan_hurryup;
165 -
166 + short sync_scan_hurryup;
167 +
168 /* map of allowed channels. 0 is dummy */
169 // FIXME: remeber to default to a basic channel plan depending of the PHY type
170 int channel_map[MAX_CHANNEL_NUMBER+1];
171 -
172 +
173 int rate; /* current rate */
174 int basic_rate;
175 //FIXME: pleace callback, see if redundant with softmac_features
176 short active_scan;
177 -
178 +
179 /* this contains flags for selectively enable softmac support */
180 u16 softmac_features;
181 -
182 +
183 /* if the sequence control field is not filled by HW */
184 u16 seq_ctrl;
185 -
186 +
187 /* association procedure transaction sequence number */
188 u16 associate_seq;
189 -
190 +
191 /* AID for RTXed association responses */
192 u16 assoc_id;
193 -
194 +
195 /* power save mode related*/
196 short ps;
197 short sta_sleep;
198 @@ -970,147 +986,153 @@
199 struct tasklet_struct ps_task;
200 u32 ps_th;
201 u32 ps_tl;
202 -
203 +
204 short raw_tx;
205 /* used if IEEE_SOFTMAC_TX_QUEUE is set */
206 short queue_stop;
207 short scanning;
208 short proto_started;
209 -
210 +
211 struct semaphore wx_sem;
212 struct semaphore scan_sem;
213 -
214 - spinlock_t mgmt_tx_lock;
215 +
216 + spinlock_t mgmt_tx_lock;
217 spinlock_t beacon_lock;
218
219 short beacon_txing;
220
221 short wap_set;
222 short ssid_set;
223 -
224 +
225 /* for discarding duplicated packets in IBSS */
226 struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
227 -
228 +
229 /* for discarding duplicated packets in BSS */
230 u16 last_seq_num;
231 u16 last_frag_num;
232 unsigned long last_packet_time;
233 -
234 +
235 /* for PS mode */
236 unsigned long last_rx_ps_time;
237 -
238 +
239 /* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
240 struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM];
241 int mgmt_queue_head;
242 int mgmt_queue_tail;
243 -
244 -
245 +
246 +
247 /* used if IEEE_SOFTMAC_TX_QUEUE is set */
248 struct tx_pending_t tx_pending;
249 -
250 +
251 /* used if IEEE_SOFTMAC_ASSOCIATE is set */
252 struct timer_list associate_timer;
253
254 /* used if IEEE_SOFTMAC_BEACONS is set */
255 struct timer_list beacon_timer;
256 -
257 +
258 struct work_struct associate_complete_wq;
259 +
260 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
261 + struct delayed_work associate_retry_wq;
262 + struct delayed_work softmac_scan_wq;
263 +#else
264 struct work_struct associate_retry_wq;
265 + struct work_struct softmac_scan_wq;
266 +#endif
267 struct work_struct start_ibss_wq;
268 struct work_struct associate_procedure_wq;
269 - struct work_struct softmac_scan_wq;
270 struct work_struct wx_sync_scan_wq;
271 -
272 +
273 struct workqueue_struct *wq;
274 /* Callback functions */
275 void (*set_security)(struct net_device *dev,
276 struct ieee80211_security *sec);
277 -
278 +
279 /* Used to TX data frame by using txb structs.
280 * this is not used if in the softmac_features
281 * is set the flag IEEE_SOFTMAC_TX_QUEUE
282 */
283 int (*hard_start_xmit)(struct ieee80211_txb *txb,
284 struct net_device *dev);
285 -
286 +
287 int (*reset_port)(struct net_device *dev);
288
289 - /* Softmac-generated frames (mamagement) are TXed via this
290 - * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
291 - * not set. As some cards may have different HW queues that
292 + /* Softmac-generated frames (mamagement) are TXed via this
293 + * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
294 + * not set. As some cards may have different HW queues that
295 * one might want to use for data and management frames
296 * the option to have two callbacks might be useful.
297 * This fucntion can't sleep.
298 */
299 int (*softmac_hard_start_xmit)(struct sk_buff *skb,
300 struct net_device *dev);
301 -
302 +
303 /* used instead of hard_start_xmit (not softmac_hard_start_xmit)
304 * if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
305 * frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
306 * then also management frames are sent via this callback.
307 * This function can't sleep.
308 - */
309 + */
310 void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
311 struct net_device *dev,int rate);
312
313 /* stops the HW queue for DATA frames. Useful to avoid
314 * waste time to TX data frame when we are reassociating
315 * This function can sleep.
316 - */
317 + */
318 void (*data_hard_stop)(struct net_device *dev);
319 -
320 +
321 /* OK this is complementar to data_poll_hard_stop */
322 void (*data_hard_resume)(struct net_device *dev);
323 -
324 +
325 /* ask to the driver to retune the radio .
326 * This function can sleep. the driver should ensure
327 * the radio has been swithced before return.
328 */
329 void (*set_chan)(struct net_device *dev,short ch);
330 -
331 +
332 /* These are not used if the ieee stack takes care of
333 - * scanning (IEEE_SOFTMAC_SCAN feature set).
334 + * scanning (IEEE_SOFTMAC_SCAN feature set).
335 * In this case only the set_chan is used.
336 *
337 * The syncro version is similar to the start_scan but
338 * does not return until all channels has been scanned.
339 - * this is called in user context and should sleep,
340 + * this is called in user context and should sleep,
341 * it is called in a work_queue when swithcing to ad-hoc mode
342 - * or in behalf of iwlist scan when the card is associated
343 - * and root user ask for a scan.
344 + * or in behalf of iwlist scan when the card is associated
345 + * and root user ask for a scan.
346 * the fucntion stop_scan should stop both the syncro and
347 * background scanning and can sleep.
348 - * The fucntion start_scan should initiate the background
349 + * The fucntion start_scan should initiate the background
350 * scanning and can't sleep.
351 - */
352 + */
353 void (*scan_syncro)(struct net_device *dev);
354 void (*start_scan)(struct net_device *dev);
355 void (*stop_scan)(struct net_device *dev);
356 -
357 +
358 /* indicate the driver that the link state is changed
359 * for example it may indicate the card is associated now.
360 - * Driver might be interested in this to apply RX filter
361 - * rules or simply light the LINK led
362 + * Driver might be interested in this to apply RX filter
363 + * rules or simply light the LINK led
364 */
365 void (*link_change)(struct net_device *dev);
366 -
367 +
368 /* these two function indicates to the HW when to start
369 - * and stop to send beacons. This is used when the
370 + * and stop to send beacons. This is used when the
371 * IEEE_SOFTMAC_BEACONS is not set. For now the
372 * stop_send_bacons is NOT guaranteed to be called only
373 * after start_send_beacons.
374 */
375 void (*start_send_beacons) (struct net_device *dev);
376 void (*stop_send_beacons) (struct net_device *dev);
377 -
378 +
379 /* power save mode related */
380 void (*sta_wake_up) (struct net_device *dev);
381 void (*ps_request_tx_ack) (struct net_device *dev);
382 void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl);
383 short (*ps_is_queue_empty) (struct net_device *dev);
384 -
385 -
386 +
387 +
388 /* This must be the last item so that it points to the data
389 * allocated beyond this structure by alloc_ieee80211 */
390 u8 priv[0];
391 @@ -1148,18 +1170,18 @@
392 #define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
393
394 /* Generate beacons. The stack will enqueue beacons
395 - * to the card
396 - */
397 + * to the card
398 + */
399 #define IEEE_SOFTMAC_BEACONS (1<<6)
400
401
402
403 -extern inline void *ieee80211_priv(struct net_device *dev)
404 +extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
405 {
406 return ((struct ieee80211_device *)netdev_priv(dev))->priv;
407 }
408
409 -extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
410 +extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
411 {
412 /* Single white space is for Linksys APs */
413 if (essid_len == 1 && essid[0] == ' ')
414 @@ -1175,7 +1197,7 @@
415 return 1;
416 }
417
418 -extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
419 +extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
420 {
421 /*
422 * It is possible for both access points and our device to support
423 @@ -1201,7 +1223,7 @@
424 return 0;
425 }
426
427 -extern inline int ieee80211_get_hdrlen(u16 fc)
428 +extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
429 {
430 int hdrlen = 24;
431
432 @@ -1229,140 +1251,144 @@
433
434
435 /* ieee80211.c */
436 -extern void free_ieee80211(struct net_device *dev);
437 -extern struct net_device *alloc_ieee80211(int sizeof_priv);
438 +extern void free_ieee80211_rtl7(struct net_device *dev);
439 +extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
440
441 -extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
442 +extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
443
444 /* ieee80211_tx.c */
445
446 -extern int ieee80211_encrypt_fragment(
447 +extern int ieee80211_encrypt_fragment_rtl7(
448 struct ieee80211_device *ieee,
449 struct sk_buff *frag,
450 int hdr_len);
451 -
452 -extern int ieee80211_xmit(struct sk_buff *skb,
453 +
454 +extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
455 struct net_device *dev);
456 -extern void ieee80211_txb_free(struct ieee80211_txb *);
457 +extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
458
459
460 /* ieee80211_rx.c */
461 -extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
462 +extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
463 struct ieee80211_rx_stats *rx_stats);
464 -extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
465 +extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
466 struct ieee80211_hdr *header,
467 struct ieee80211_rx_stats *stats);
468
469 /* ieee80211_wx.c */
470 -extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
471 +extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
472 struct iw_request_info *info,
473 union iwreq_data *wrqu, char *key);
474 -extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
475 +extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
476 struct iw_request_info *info,
477 union iwreq_data *wrqu, char *key);
478 -extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
479 +extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
480 struct iw_request_info *info,
481 union iwreq_data *wrqu, char *key);
482 /* ieee80211_softmac.c */
483 -extern short ieee80211_is_54g(struct ieee80211_network net);
484 -extern short ieee80211_is_shortslot(struct ieee80211_network net);
485 -extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
486 +extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
487 +extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
488 +extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
489 struct ieee80211_rx_stats *rx_stats, u16 type,
490 u16 stype);
491 -extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
492 +extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
493
494 -extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
495 -extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
496 -extern void ieee80211_start_bss(struct ieee80211_device *ieee);
497 -extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
498 -extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
499 -extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
500 -extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
501 -extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
502 -extern void ieee80211_disassociate(struct ieee80211_device *ieee);
503 -extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
504 -extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
505 -extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
506 -extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
507 -extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
508 -extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
509 -extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
510 -extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
511 -extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
512 -extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
513 -extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
514 -extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
515 -extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
516 -extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
517 -extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
518 -extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
519 +extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
520 +extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
521 +extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
522 +extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
523 +extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
524 +extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
525 +extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
526 +extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
527 +extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
528 +extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
529 +extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
530 +extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
531 +extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
532 +extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
533 +extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
534 +extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
535 +extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
536 +extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
537 +extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
538 +extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
539 +extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
540 +extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
541 +extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
542 +extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
543 +extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
544
545 /* ieee80211_softmac_wx.c */
546
547 -extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
548 - struct iw_request_info *info,
549 +extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
550 + struct iw_request_info *info,
551 union iwreq_data *wrqu, char *ext);
552 -
553 -extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
554 +
555 +extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
556 struct iw_request_info *info,
557 union iwreq_data *awrq,
558 char *extra);
559 -
560 -extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
561
562 -extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
563 +extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
564 +
565 +extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
566 struct iw_request_info *info,
567 union iwreq_data *wrqu, char *extra);
568 -
569 -extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
570 - struct iw_request_info *info,
571 +
572 +extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
573 + struct iw_request_info *info,
574 union iwreq_data *wrqu, char *extra);
575 -
576 -extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
577 +
578 +extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
579 union iwreq_data *wrqu, char *b);
580 -
581 -extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
582 +
583 +extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
584 union iwreq_data *wrqu, char *b);
585 -
586 -extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
587 +
588 +extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
589 struct iw_request_info *a,
590 union iwreq_data *wrqu, char *extra);
591 -
592 -extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
593 +
594 +extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
595 union iwreq_data *wrqu, char *b);
596
597 -extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
598 +extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
599 union iwreq_data *wrqu, char *b);
600
601 -extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
602 +extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
603 union iwreq_data *wrqu, char *b);
604
605 -extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
606 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
607 +extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
608 +#else
609 +extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
610 +#endif
611
612 -extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
613 - struct iw_request_info *info,
614 +extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
615 + struct iw_request_info *info,
616 union iwreq_data *wrqu, char *extra);
617 -
618 -extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
619 - struct iw_request_info *info,
620 +
621 +extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
622 + struct iw_request_info *info,
623 union iwreq_data *wrqu, char *extra);
624
625 -extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
626 +extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
627 struct iw_request_info *info,
628 union iwreq_data *wrqu, char *extra);
629
630 -extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
631 +extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
632 struct iw_request_info *info,
633 union iwreq_data *wrqu, char *extra);
634 -
635 -extern const long ieee80211_wlan_frequencies[];
636
637 -extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
638 +extern const long ieee80211_wlan_frequencies_rtl7[];
639 +
640 +extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
641 {
642 ieee->scans++;
643 }
644
645 -extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
646 +extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
647 {
648 return ieee->scans;
649 }
650 @@ -1372,7 +1398,7 @@
651 const char *s = essid;
652 char *d = escaped;
653
654 - if (ieee80211_is_empty_essid(essid, essid_len)) {
655 + if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
656 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
657 return escaped;
658 }
659 @@ -1390,4 +1416,5 @@
660 *d = '\0';
661 return escaped;
662 }
663 +
664 #endif /* IEEE80211_H */
665 diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/Makefile rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/Makefile
666 --- rtl8187_linux_26.1010.0622.2006/beta-8187/Makefile 2006-06-06 04:58:00.000000000 +0200
667 +++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/Makefile 2008-01-30 17:38:10.000000000 +0100
668 @@ -18,6 +18,8 @@
669 KVER := $(shell uname -r)
670 KSRC := /lib/modules/$(KVER)/build
671 INSTALL_PREFIX :=
672 +PWD = $(shell pwd)
673 +
674 all: modules
675
676 clean:
677 diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_93cx6.c rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_93cx6.c
678 --- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_93cx6.c 2006-06-06 04:58:00.000000000 +0200
679 +++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_93cx6.c 2008-01-30 17:38:10.000000000 +0100
680 @@ -87,7 +87,7 @@
681
682 u32 eprom_read(struct net_device *dev, u32 addr)
683 {
684 - struct r8180_priv *priv = ieee80211_priv(dev);
685 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
686 short read_cmd[]={1,1,0};
687 short addr_str[8];
688 int i;
689 diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_hw.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_hw.h
690 --- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_hw.h 2006-06-06 04:58:00.000000000 +0200
691 +++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_hw.h 2008-01-30 17:38:11.000000000 +0100
692 @@ -646,6 +646,7 @@
693 #define FFER_INTR ((1<<15))
694 #define FFER_GWAKE ((1<< 4))
695
696 -
697 +#define MAX_TX_POWER 27
698 +#define MIN_TX_POWER 20
699
700 #endif
701 diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.c rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225.c
702 --- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.c 2006-06-06 04:58:02.000000000 +0200
703 +++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225.c 2008-01-30 17:38:11.000000000 +0100
704 @@ -173,7 +173,7 @@
705
706 void rtl8225_set_gain(struct net_device *dev, short gain)
707 {
708 - struct r8180_priv *priv = ieee80211_priv(dev);
709 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
710
711 rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
712
713 @@ -208,7 +208,7 @@
714 {
715 #ifdef USE_8051_3WIRE
716
717 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
718 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
719 struct usb_device *udev = priv->udev;
720 //u8 bit;
721 u16 wReg80, wReg82, wReg84;
722 @@ -255,7 +255,7 @@
723 u16 out,select;
724 u8 bit;
725 u32 bangdata = (data << 4) | (adr & 0xf);
726 - struct r8180_priv *priv = ieee80211_priv(dev);
727 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
728
729 out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
730
731 @@ -349,7 +349,7 @@
732
733 void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch)
734 {
735 - struct r8180_priv *priv = ieee80211_priv(dev);
736 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
737
738 int GainIdx;
739 int GainSetting;
740 @@ -454,9 +454,9 @@
741
742 void rtl8225_rf_set_chan(struct net_device *dev, short ch)
743 {
744 - struct r8180_priv *priv = ieee80211_priv(dev);
745 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
746 short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
747 - ieee80211_is_54g(priv->ieee80211->current_network)) ||
748 + ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
749 priv->ieee80211->iw_mode == IW_MODE_MONITOR;
750
751 rtl8225_SetTXPowerLevel(dev, ch);
752 @@ -474,7 +474,7 @@
753 write_nic_byte(dev,DIFS,0x24); //DIFS: 36
754
755 if(priv->ieee80211->state == IEEE80211_LINKED &&
756 - ieee80211_is_shortslot(priv->ieee80211->current_network))
757 + ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
758 write_nic_byte(dev,SLOT,0x9); //SLOT: 9
759
760 else
761 @@ -546,7 +546,7 @@
762
763 void rtl8225_rf_init(struct net_device *dev)
764 {
765 - struct r8180_priv *priv = ieee80211_priv(dev);
766 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
767 int i;
768 short channel = 1;
769 u16 brsr;
770 diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225.h
771 --- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.h 2006-06-06 04:58:00.000000000 +0200
772 +++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225.h 2008-01-30 17:38:11.000000000 +0100
773 @@ -44,3 +44,5 @@
774 extern u32 rtl8225_chan[];
775
776 #endif
777 +
778 +void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
779 diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225z2.c rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225z2.c
780 --- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225z2.c 2006-06-06 04:58:02.000000000 +0200
781 +++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225z2.c 2008-02-15 00:49:20.000000000 +0100
782 @@ -2,12 +2,12 @@
783 This is part of the rtl8180-sa2400 driver
784 released under the GPL (See file COPYING for details).
785 Copyright (c) 2005 Andrea Merello <[email protected]>
786 -
787 - This files contains programming code for the rtl8225
788 +
789 + This files contains programming code for the rtl8225
790 radio frontend.
791 -
792 +
793 *Many* thanks to Realtek Corp. for their great support!
794 -
795 +
796 */
797
798
799 @@ -32,51 +32,68 @@
800 };
801
802 u8 rtl8225z2_gain_a[]={
803 - 0x13,0x27,0x5a,//,0x37,// -82dbm
804 - 0x23,0x23,0x58,//,0x37,// -82dbm
805 - 0x33,0x1f,0x56,//,0x37,// -82dbm
806 - 0x43,0x1b,0x54,//,0x37,// -78dbm
807 - 0x53,0x17,0x51,//,0x37,// -74dbm
808 - 0x63,0x24,0x4f,//,0x37,// -70dbm
809 - 0x73,0x0f,0x4c,//,0x37,// -66dbm
810 + 0x13,0x27,0x5a,//,0x37,// -82dbm
811 + 0x23,0x23,0x58,//,0x37,// -82dbm
812 + 0x33,0x1f,0x56,//,0x37,// -82dbm
813 + 0x43,0x1b,0x54,//,0x37,// -78dbm
814 + 0x53,0x17,0x51,//,0x37,// -74dbm
815 + 0x63,0x24,0x4f,//,0x37,// -70dbm
816 + 0x73,0x0f,0x4c,//,0x37,// -66dbm
817 };
818 #if 0
819 u32 rtl8225_chan[] = {
820 0, //dummy channel 0
821 - 0x085c, //1
822 - 0x08dc, //2
823 - 0x095c, //3
824 - 0x09dc, //4
825 - 0x0a5c, //5
826 - 0x0adc, //6
827 - 0x0b5c, //7
828 - 0x0bdc, //8
829 - 0x0c5c, //9
830 - 0x0cdc, //10
831 - 0x0d5c, //11
832 - 0x0ddc, //12
833 - 0x0e5c, //13
834 + 0x085c, //1
835 + 0x08dc, //2
836 + 0x095c, //3
837 + 0x09dc, //4
838 + 0x0a5c, //5
839 + 0x0adc, //6
840 + 0x0b5c, //7
841 + 0x0bdc, //8
842 + 0x0c5c, //9
843 + 0x0cdc, //10
844 + 0x0d5c, //11
845 + 0x0ddc, //12
846 + 0x0e5c, //13
847 //0x0f5c, //14
848 - 0x0f72, // 14
849 + 0x0f72, // 14
850 };
851 #endif
852
853 +#if 1
854 //-
855 -u16 rtl8225z2_rxgain[]={
856 +u16 rtl8225z2_rxgain[]={
857 0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
858 - 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
859 + 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
860 0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
861 - 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
862 + 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
863 0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
864 0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
865 0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
866 0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
867 - 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
868 - 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
869 - 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
870 + 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
871 + 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
872 + 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
873 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
874
875 };
876 +#else
877 +u16 rtl8225z2_rxgain[]={
878 + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0008, 0x0009,
879 + 0x000a, 0x000b, 0x0102, 0x0103, 0x0104, 0x0105, 0x0140, 0x0141,
880 + 0x0142, 0x0143, 0x0144, 0x0145, 0x0180, 0x0181, 0x0182, 0x0183,
881 + 0x0184, 0x0185, 0x0188, 0x0189, 0x018a, 0x018b, 0x0243, 0x0244,
882 + 0x0245, 0x0280, 0x0281, 0x0282, 0x0283, 0x0284, 0x0285, 0x0288,
883 + 0x0289, 0x028a, 0x028b, 0x028c, 0x0342, 0x0343, 0x0344, 0x0345,
884 + 0x0380, 0x0381, 0x0382, 0x0383, 0x0384, 0x0385, 0x0388, 0x0389,
885 + 0x038a, 0x038b, 0x038c, 0x038d, 0x0390, 0x0391, 0x0392, 0x0393,
886 + 0x0394, 0x0395, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d,
887 + 0x03a0, 0x03a1, 0x03a2, 0x03a3, 0x03a4, 0x03a5, 0x03a8, 0x03a9,
888 + 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
889 + 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
890 +};
891 +#endif
892
893 //2005.11.16,
894 u8 ZEBRA2_CCK_OFDM_GAIN_SETTING[]={
895 @@ -129,23 +146,30 @@
896 void rtl8225z2_set_gain(struct net_device *dev, short gain)
897 {
898 u8* rtl8225_gain;
899 - struct r8180_priv *priv = ieee80211_priv(dev);
900 -
901 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
902 +
903 u8 mode = priv->ieee80211->mode;
904 -
905 - if(mode == IEEE_B || mode == IEEE_G)
906 +
907 + if((mode&IEEE_B) == IEEE_B || (mode&IEEE_G) == IEEE_G) {
908 + //printk(KERN_WARNING "mode ag!\n");
909 rtl8225_gain = rtl8225z2_gain_bg;
910 - else
911 + } else {
912 rtl8225_gain = rtl8225z2_gain_a;
913 -
914 + //printk(KERN_WARNING "mode a!\n");
915 + }
916 +
917 //write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 3]);
918 //write_phy_ofdm(dev, 0x19, rtl8225_gain[gain * 3 + 1]);
919 //write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 2]);
920 //2005.11.17, by ch-hsu
921 write_phy_ofdm(dev, 0x0b, rtl8225_gain[gain * 3]);
922 + mdelay(1);
923 write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 1]);
924 + mdelay(1);
925 write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 3 + 2]);
926 - write_phy_ofdm(dev, 0x21, 0x37);
927 + mdelay(1);
928 + write_phy_ofdm(dev, 0x21, 0x17);
929 + mdelay(1);
930
931 }
932
933 @@ -153,33 +177,33 @@
934
935 void rtl8225_set_gain(struct net_device *dev, short gain)
936 {
937 - struct r8180_priv *priv = ieee80211_priv(dev);
938 -
939 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
940 +
941 rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
942 -
943 +
944 if(priv->card_8185 == 2)
945 write_phy_ofdm(dev, 0x21, 0x27);
946 else
947 write_phy_ofdm(dev, 0x21, 0x37);
948 -
949 +
950 write_phy_ofdm(dev, 0x25, 0x20);
951 write_phy_ofdm(dev, 0x11, 0x6);
952 -
953 +
954 if(priv->card_8185 == 1 && priv->card_8185_Bversion)
955 write_phy_ofdm(dev, 0x27, 0x8);
956 else
957 write_phy_ofdm(dev, 0x27, 0x88);
958 -
959 +
960 write_phy_ofdm(dev, 0x14, 0);
961 write_phy_ofdm(dev, 0x16, 0);
962 write_phy_ofdm(dev, 0x15, 0x40);
963 write_phy_ofdm(dev, 0x17, 0x40);
964 -
965 +
966 write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 4]);
967 write_phy_ofdm(dev, 0x23, rtl8225_gain[gain * 4 + 1]);
968 write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 4 + 2]);
969 write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 4 + 3]);
970 - //rtl8225_set_gain_usb(dev, gain);
971 + //rtl8225_set_gain_usb(dev, gain);
972 }
973 #endif
974
975 @@ -193,7 +217,7 @@
976 // ThreeWireReg tdata;
977 int i;
978 short bit, rw;
979 -
980 +
981 u8 wLength = 6;
982 u8 rLength = 12;
983 u8 low2high = 0;
984 @@ -207,20 +231,20 @@
985
986 dataRead = 0;
987
988 - oval &= ~0xf;
989 + oval &= ~0xf;
990
991 write_nic_word(dev, RFPinsOutput, oval | BB_HOST_BANG_EN ); udelay(4);
992
993 write_nic_word(dev, RFPinsOutput, oval ); udelay(5);
994 -
995 +
996 rw = 0;
997 -
998 +
999 mask = (low2high) ? 0x01 : (((u32)0x01)<<(32-1));
1000 for(i = 0; i < wLength/2; i++)
1001 {
1002 bit = ((data2Write&mask) != 0) ? 1 : 0;
1003 write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(1);
1004 -
1005 +
1006 write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
1007 write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
1008
1009 @@ -233,9 +257,9 @@
1010 write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(2);
1011 break;
1012 }
1013 -
1014 +
1015 bit = ((data2Write&mask) != 0) ? 1: 0;
1016 -
1017 +
1018 write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
1019 write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
1020
1021 @@ -252,22 +276,22 @@
1022 for(i = 0; i < rLength; i++)
1023 {
1024 write_nic_word(dev, RFPinsOutput, rw|oval); udelay(1);
1025 -
1026 +
1027 write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
1028 write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
1029 write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
1030 tmp = read_nic_word(dev, RFPinsInput);
1031 -
1032 +
1033 dataRead |= (tmp & BB_HOST_BANG_CLK ? mask : 0);
1034
1035 write_nic_word(dev, RFPinsOutput, (rw|oval)); udelay(2);
1036
1037 mask = (low2high) ? (mask<<1) : (mask>>1);
1038 }
1039 -
1040 +
1041 write_nic_word(dev, RFPinsOutput, BB_HOST_BANG_EN|BB_HOST_BANG_RW|oval); udelay(2);
1042
1043 - write_nic_word(dev, RFPinsEnable, oval2);
1044 + write_nic_word(dev, RFPinsEnable, oval2);
1045 write_nic_word(dev, RFPinsSelect, oval3); // Set To SW Switch
1046 write_nic_word(dev, RFPinsOutput, 0x3a0);
1047
1048 @@ -280,61 +304,61 @@
1049 u16 out,select;
1050 u8 bit;
1051 u32 bangdata = (data << 4) | (adr & 0xf);
1052 - struct r8180_priv *priv = ieee80211_priv(dev);
1053 -
1054 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1055 +
1056 out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
1057 -
1058 +
1059 write_nic_word(dev,RFPinsEnable,
1060 (read_nic_word(dev,RFPinsEnable) | 0x7));
1061 -
1062 +
1063 select = read_nic_word(dev, RFPinsSelect);
1064 -
1065 - write_nic_word(dev, RFPinsSelect, select | 0x7 |
1066 +
1067 + write_nic_word(dev, RFPinsSelect, select | 0x7 |
1068 ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
1069 -
1070 +
1071 force_pci_posting(dev);
1072 udelay(10);
1073 -
1074 +
1075 write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN );//| 0x1fff);
1076 -
1077 +
1078 force_pci_posting(dev);
1079 udelay(2);
1080 -
1081 +
1082 write_nic_word(dev, RFPinsOutput, out);
1083 -
1084 +
1085 force_pci_posting(dev);
1086 udelay(10);
1087 -
1088 -
1089 +
1090 +
1091 for(i=15; i>=0;i--){
1092 -
1093 +
1094 bit = (bangdata & (1<<i)) >> i;
1095 -
1096 +
1097 write_nic_word(dev, RFPinsOutput, bit | out);
1098 -
1099 +
1100 write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
1101 write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
1102
1103 i--;
1104 bit = (bangdata & (1<<i)) >> i;
1105 -
1106 +
1107 write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
1108 write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
1109
1110 write_nic_word(dev, RFPinsOutput, bit | out);
1111
1112 }
1113 -
1114 +
1115 write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
1116 -
1117 +
1118 force_pci_posting(dev);
1119 udelay(10);
1120
1121 - write_nic_word(dev, RFPinsOutput, out |
1122 + write_nic_word(dev, RFPinsOutput, out |
1123 ((priv->card_type == USB) ? 4 : BB_HOST_BANG_EN));
1124
1125 - write_nic_word(dev, RFPinsSelect, select |
1126 - ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
1127 + write_nic_word(dev, RFPinsSelect, select |
1128 + ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
1129
1130 if(priv->card_type == USB)
1131 mdelay(2);
1132 @@ -348,30 +372,30 @@
1133 short vz2 = 1;
1134 /* sw to reg pg 1 */
1135 write_rtl8225(dev, 0, 0x1b7);
1136 -
1137 +
1138 /* reg 8 pg 1 = 23*/
1139 if( read_rtl8225(dev, 8) != 0x588)
1140 vz2 = 0;
1141 -
1142 - else /* reg 9 pg 1 = 24 */
1143 +
1144 + else /* reg 9 pg 1 = 24 */
1145 if( read_rtl8225(dev, 9) != 0x700)
1146 vz2 = 0;
1147 -
1148 - /* sw back to pg 0 */
1149 +
1150 + /* sw back to pg 0 */
1151 write_rtl8225(dev, 0, 0xb7);
1152
1153 return vz2;
1154 -
1155 +
1156 }
1157
1158 #if 0
1159 void rtl8225_rf_close(struct net_device *dev)
1160 {
1161 - write_rtl8225(dev, 0x4, 0x1f);
1162 -
1163 + write_rtl8225(dev, 0x4, 0x1f);
1164 +
1165 force_pci_posting(dev);
1166 mdelay(1);
1167 -
1168 +
1169 rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_OFF);
1170 rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_OFF);
1171 }
1172 @@ -380,24 +404,24 @@
1173 short rtl8225_rf_set_sens(struct net_device *dev, short sens)
1174 {
1175 if (sens <0 || sens > 6) return -1;
1176 -
1177 +
1178 if(sens > 4)
1179 write_rtl8225(dev, 0x0c, 0x850);
1180 - else
1181 + else
1182 write_rtl8225(dev, 0x0c, 0x50);
1183
1184 sens= 6-sens;
1185 rtl8225_set_gain(dev, sens);
1186 -
1187 +
1188 write_phy_cck(dev, 0x41, rtl8225_threshold[sens]);
1189 return 0;
1190 -
1191 +
1192 }
1193 #endif
1194 void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch)
1195 {
1196 - struct r8180_priv *priv = ieee80211_priv(dev);
1197 -
1198 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1199 +
1200 // int GainIdx;
1201 // int GainSetting;
1202 int i;
1203 @@ -406,44 +430,48 @@
1204 u8 max_cck_power_level;
1205 //u8 min_cck_power_level;
1206 u8 max_ofdm_power_level;
1207 - u8 min_ofdm_power_level;
1208 + u8 min_ofdm_power_level;
1209 u8 cck_power_level = 0xff & priv->chtxpwr[ch];
1210 u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch];
1211 -
1212 -
1213 - max_cck_power_level = 15;
1214 +
1215 +
1216 + max_cck_power_level = 35;
1217 //min_cck_power_level = 0;
1218 - max_ofdm_power_level = 25; // 12 -> 25
1219 + max_ofdm_power_level = 35; // 12 -> 25
1220 min_ofdm_power_level = 10;
1221 -
1222 +
1223 /* CCK power setting */
1224 if(cck_power_level > max_cck_power_level)
1225 + {
1226 cck_power_level = max_cck_power_level;
1227 -
1228 + priv->chtxpwr[ch] = max_cck_power_level;
1229 + }
1230 +
1231 cck_power_level += priv->cck_txpwr_base;
1232 -
1233 +
1234 if(cck_power_level > 35)
1235 cck_power_level = 35;
1236 -
1237 - if(ch == 14)
1238 +
1239 + if(ch == 14)
1240 cck_power_table = rtl8225z2_tx_power_cck_ch14;
1241 - else
1242 + else
1243 cck_power_table = rtl8225z2_tx_power_cck;
1244 -
1245 -
1246 +
1247 + if(cck_power_level >= 20 && cck_power_level < 30)
1248 + cck_power_level = 19;
1249 +
1250 for(i=0;i<8;i++){
1251 -
1252 power = cck_power_table[i];
1253 write_phy_cck(dev, 0x44 + i, power);
1254 }
1255 -
1256 +
1257 //write_nic_byte(dev, TX_GAIN_CCK, power);
1258 //2005.11.17,
1259 write_nic_byte(dev, TX_GAIN_CCK, ZEBRA2_CCK_OFDM_GAIN_SETTING[cck_power_level]);
1260 -
1261 +
1262 force_pci_posting(dev);
1263 mdelay(1);
1264 -
1265 +
1266 /* OFDM power setting */
1267 // Old:
1268 // if(ofdm_power_level > max_ofdm_power_level)
1269 @@ -454,26 +482,26 @@
1270 ofdm_power_level = max_ofdm_power_level;
1271 else
1272 ofdm_power_level += min_ofdm_power_level;
1273 -
1274 +
1275 ofdm_power_level += priv->ofdm_txpwr_base;
1276 -
1277 +
1278 if(ofdm_power_level > 35)
1279 ofdm_power_level = 35;
1280 -
1281 +
1282 rtl8185_set_anaparam2(dev,RTL8225_ANAPARAM2_ON);
1283 -
1284 +
1285 write_phy_ofdm(dev,2,0x42);
1286 write_phy_ofdm(dev,5,0);
1287 write_phy_ofdm(dev,6,0x40);
1288 write_phy_ofdm(dev,7,0);
1289 - write_phy_ofdm(dev,8,0x40);
1290 -
1291 + write_phy_ofdm(dev,8,0x40);
1292 +
1293
1294 //write_nic_byte(dev, TX_GAIN_OFDM, ofdm_power_level);
1295 //2005.11.17,
1296 write_nic_byte(dev, TX_GAIN_OFDM, ZEBRA2_CCK_OFDM_GAIN_SETTING[ofdm_power_level]);
1297
1298 -
1299 +
1300 force_pci_posting(dev);
1301 mdelay(1);
1302 //write_nic_byte(dev, TX_AGC_CONTROL,4);
1303 @@ -483,39 +511,39 @@
1304 void rtl8225_set_mode(struct net_device *dev, short modeb)
1305 {
1306 write_phy_ofdm(dev, 0x15, (modeb ? 0x0 : 0x40));
1307 - write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
1308 + write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
1309 }
1310 #endif
1311
1312 void rtl8225z2_rf_set_chan(struct net_device *dev, short ch)
1313 {
1314 - struct r8180_priv *priv = ieee80211_priv(dev);
1315 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1316 short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
1317 - ieee80211_is_54g(priv->ieee80211->current_network)) ||
1318 + ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
1319 priv->ieee80211->iw_mode == IW_MODE_MONITOR;
1320 -
1321 +
1322 rtl8225z2_SetTXPowerLevel(dev, ch);
1323 -
1324 +
1325 write_rtl8225(dev, 0x7, rtl8225_chan[ch]);
1326 -
1327 +
1328 force_pci_posting(dev);
1329 mdelay(10);
1330 -
1331 +
1332 write_nic_byte(dev,SIFS,0x22);// SIFS: 0x22
1333 -
1334 +
1335 if(gset)
1336 - write_nic_byte(dev,DIFS,20); //DIFS: 20
1337 + write_nic_byte(dev,DIFS,20); //DIFS: 20
1338 else
1339 - write_nic_byte(dev,DIFS,0x24); //DIFS: 36
1340 -
1341 + write_nic_byte(dev,DIFS,0x24); //DIFS: 36
1342 +
1343 if(priv->ieee80211->state == IEEE80211_LINKED &&
1344 - ieee80211_is_shortslot(priv->ieee80211->current_network))
1345 + ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
1346 write_nic_byte(dev,SLOT,0x9); //SLOT: 9
1347 -
1348 +
1349 else
1350 write_nic_byte(dev,SLOT,0x14); //SLOT: 20 (0x14)
1351 -
1352 -
1353 +
1354 +
1355 if(gset){
1356 write_nic_byte(dev,EIFS,91 - 20); // EIFS: 91 (0x5B)
1357 write_nic_byte(dev,CW_VAL,0x73); //CW VALUE: 0x37
1358 @@ -529,68 +557,68 @@
1359
1360 }
1361 #if 0
1362 -void rtl8225_host_pci_init(struct net_device *dev)
1363 +void rtl8225_host_pci_init(struct net_device *dev)
1364 {
1365 write_nic_word(dev, RFPinsOutput, 0x480);
1366 -
1367 +
1368 rtl8185_rf_pins_enable(dev);
1369 -
1370 +
1371 //if(priv->card_8185 == 2 && priv->enable_gpio0 ) /* version D */
1372 //write_nic_word(dev, RFPinsSelect, 0x88);
1373 //else
1374 write_nic_word(dev, RFPinsSelect, 0x88 | SW_CONTROL_GPIO); /* 0x488 | SW_CONTROL_GPIO */
1375 -
1376 +
1377 write_nic_byte(dev, GP_ENABLE, 0);
1378 -
1379 +
1380 force_pci_posting(dev);
1381 mdelay(200);
1382 -
1383 +
1384 write_nic_word(dev, GP_ENABLE, 0xff & (~(1<<6))); /* bit 6 is for RF on/off detection */
1385
1386 -
1387 +
1388 }
1389
1390 -void rtl8225_host_usb_init(struct net_device *dev)
1391 +void rtl8225_host_usb_init(struct net_device *dev)
1392 {
1393 write_nic_byte(dev,RFPinsSelect+1,0);
1394
1395 write_nic_byte(dev,GPIO,0);
1396 -
1397 +
1398 write_nic_byte_E(dev,0x53,read_nic_byte_E(dev,0x53) | (1<<7));
1399 -
1400 +
1401 write_nic_byte(dev,RFPinsSelect+1,4);
1402
1403 write_nic_byte(dev,GPIO,0x20);
1404
1405 write_nic_byte(dev,GP_ENABLE,0);
1406
1407 -
1408 - /* Config BB & RF */
1409 +
1410 + /* Config BB & RF */
1411 write_nic_word(dev, RFPinsOutput, 0x80);
1412
1413 write_nic_word(dev, RFPinsSelect, 0x80);
1414
1415 write_nic_word(dev, RFPinsEnable, 0x80);
1416
1417 -
1418 +
1419 mdelay(100);
1420
1421 - mdelay(1000);
1422 + mdelay(1000);
1423
1424 }
1425 #endif
1426 -void rtl8225z2_rf_init(struct net_device *dev)
1427 +void rtl8225z2_rf_init(struct net_device *dev)
1428 {
1429 - struct r8180_priv *priv = ieee80211_priv(dev);
1430 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1431 int i;
1432 short channel = 1;
1433 u16 brsr;
1434 u32 data,addr;
1435 -
1436 +
1437 priv->chan = channel;
1438
1439 rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
1440 -
1441 +
1442
1443 if(priv->card_type == USB)
1444 rtl8225_host_usb_init(dev);
1445 @@ -598,42 +626,42 @@
1446 rtl8225_host_pci_init(dev);
1447
1448 write_nic_dword(dev, RF_TIMING, 0x000a8008);
1449 -
1450 +
1451 brsr = read_nic_word(dev, BRSR);
1452 -
1453 - write_nic_word(dev, BRSR, 0xffff);
1454 +
1455 + write_nic_word(dev, BRSR, 0xffff);
1456
1457
1458 write_nic_dword(dev, RF_PARA, 0x100044);
1459 -
1460 +
1461 #if 1 //0->1
1462 rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
1463 write_nic_byte(dev, CONFIG3, 0x44);
1464 rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
1465 #endif
1466 -
1467 -
1468 +
1469 +
1470 rtl8185_rf_pins_enable(dev);
1471
1472 // mdelay(1000);
1473
1474 write_rtl8225(dev, 0x0, 0x2bf); mdelay(1);
1475 -
1476 -
1477 +
1478 +
1479 write_rtl8225(dev, 0x1, 0xee0); mdelay(1);
1480
1481 write_rtl8225(dev, 0x2, 0x44d); mdelay(1);
1482
1483 write_rtl8225(dev, 0x3, 0x441); mdelay(1);
1484
1485 -
1486 +
1487 write_rtl8225(dev, 0x4, 0x8c3);mdelay(1);
1488 -
1489 -
1490 -
1491 +
1492 +
1493 +
1494 write_rtl8225(dev, 0x5, 0xc72);mdelay(1);
1495 // }
1496 -
1497 +
1498 write_rtl8225(dev, 0x6, 0xe6); mdelay(1);
1499
1500 write_rtl8225(dev, 0x7, ((priv->card_type == USB)? 0x82a : rtl8225_chan[channel])); mdelay(1);
1501 @@ -653,28 +681,28 @@
1502
1503 write_rtl8225(dev, 0xe, 0x2b); mdelay(1);
1504
1505 - write_rtl8225(dev, 0xf, 0x114);
1506 -
1507 -
1508 + write_rtl8225(dev, 0xf, 0x114);
1509 +
1510 +
1511 mdelay(100);
1512 -
1513 -
1514 +
1515 +
1516 //if(priv->card_type != USB) /* maybe not needed even for 8185 */
1517 -// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
1518 -
1519 +// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
1520 +
1521 write_rtl8225(dev, 0x0, 0x1b7);
1522 -
1523 +
1524 for(i=0;i<95;i++){
1525 write_rtl8225(dev, 0x1, (u8)(i+1));
1526 -
1527 +
1528 #if 0
1529 - if(priv->phy_ver == 1)
1530 + if(priv->phy_ver == 1)
1531 /* version A */
1532 write_rtl8225(dev, 0x2, rtl8225a_rxgain[i]);
1533 else
1534 #endif
1535 /* version B & C & D*/
1536 -
1537 +
1538 write_rtl8225(dev, 0x2, rtl8225z2_rxgain[i]);
1539 }
1540 write_rtl8225(dev, 0x3, 0x80);
1541 @@ -683,16 +711,16 @@
1542 write_rtl8225(dev, 0x0, 0xb7);
1543
1544 write_rtl8225(dev, 0x2, 0xc4d);
1545 -
1546 +
1547 if(priv->card_type == USB){
1548 // force_pci_posting(dev);
1549 mdelay(200);
1550 -
1551 +
1552 write_rtl8225(dev, 0x2, 0x44d);
1553 -
1554 +
1555 // force_pci_posting(dev);
1556 mdelay(100);
1557 -
1558 +
1559 }//End of if(priv->card_type == USB)
1560 /* FIXME!! rtl8187 we have to check if calibrarion
1561 * is successful and eventually cal. again (repeat
1562 @@ -713,23 +741,23 @@
1563 }
1564 }
1565 //force_pci_posting(dev);
1566 -
1567 - mdelay(200); //200 for 8187
1568 -
1569 -
1570 +
1571 + mdelay(200); //200 for 8187
1572 +
1573 +
1574 // //if(priv->card_type != USB){
1575 // write_rtl8225(dev, 0x2, 0x44d);
1576 // write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
1577 // write_rtl8225(dev, 0x2, 0x47d);
1578 -//
1579 +//
1580 // force_pci_posting(dev);
1581 // mdelay(100);
1582 -//
1583 +//
1584 // write_rtl8225(dev, 0x2, 0x44d);
1585 // //}
1586 -
1587 - write_rtl8225(dev, 0x0, 0x2bf);
1588 -
1589 +
1590 + write_rtl8225(dev, 0x0, 0x2bf);
1591 +
1592 if(priv->card_type != USB)
1593 rtl8185_rf_pins_enable(dev);
1594 //set up ZEBRA AGC table, 2005.11.17,
1595 @@ -744,20 +772,20 @@
1596
1597 mdelay(1);
1598 }
1599 -#if 0
1600 +#if 0
1601 for(i=0;i<128;i++){
1602 write_phy_ofdm(dev, 0xb, rtl8225_agc[i]);
1603 -
1604 - mdelay(1);
1605 +
1606 + mdelay(1);
1607 write_phy_ofdm(dev, 0xa, (u8)i+ 0x80);
1608 -
1609 - mdelay(1);
1610 +
1611 + mdelay(1);
1612 }
1613 #endif
1614 -
1615 +
1616 force_pci_posting(dev);
1617 mdelay(1);
1618 -
1619 +
1620 write_phy_ofdm(dev, 0x0, 0x1); mdelay(1);
1621 write_phy_ofdm(dev, 0x1, 0x2); mdelay(1);
1622 write_phy_ofdm(dev, 0x2, ((priv->card_type == USB)? 0x42 : 0x62)); mdelay(1);
1623 @@ -771,20 +799,20 @@
1624
1625 write_phy_ofdm(dev, 0xa, 0x8); mdelay(1);
1626
1627 - //write_phy_ofdm(dev, 0x18, 0xef);
1628 + //write_phy_ofdm(dev, 0x18, 0xef);
1629 // }
1630 //}
1631 write_phy_ofdm(dev, 0xb, 0x80); mdelay(1);
1632
1633 write_phy_ofdm(dev, 0xc, 0x1);mdelay(1);
1634
1635 -
1636 +
1637 //if(priv->card_type != USB)
1638 - write_phy_ofdm(dev, 0xd, 0x43);
1639 -
1640 + write_phy_ofdm(dev, 0xd, 0x43);
1641 +
1642 write_phy_ofdm(dev, 0xe, 0xd3);mdelay(1);
1643
1644 -
1645 +
1646 #if 0
1647 if(priv->card_8185 == 1){
1648 if(priv->card_8185_Bversion)
1649 @@ -796,17 +824,17 @@
1650 write_phy_ofdm(dev, 0xf, 0x38);mdelay(1);
1651 /*ver D & 8187*/
1652 // }
1653 -
1654 +
1655 // if(priv->card_8185 == 1 && priv->card_8185_Bversion)
1656 // write_phy_ofdm(dev, 0x10, 0x04);/*ver B*/
1657 // else
1658 write_phy_ofdm(dev, 0x10, 0x84);mdelay(1);
1659 /*ver C & D & 8187*/
1660 -
1661 +
1662 write_phy_ofdm(dev, 0x11, 0x07);mdelay(1);
1663 /*agc resp time 700*/
1664
1665 -
1666 +
1667 // if(priv->card_8185 == 2){
1668 /* Ver D & 8187*/
1669 write_phy_ofdm(dev, 0x12, 0x20);mdelay(1);
1670 @@ -824,47 +852,46 @@
1671 write_phy_ofdm(dev, 0x15, 0x40); mdelay(1);
1672 write_phy_ofdm(dev, 0x16, 0x0); mdelay(1);
1673 write_phy_ofdm(dev, 0x17, 0x40); mdelay(1);
1674 -
1675 +
1676 // if (priv->card_type == USB)
1677 // write_phy_ofdm(dev, 0x18, 0xef);
1678 -
1679 +
1680 write_phy_ofdm(dev, 0x18, 0xef);mdelay(1);
1681 -
1682 +
1683
1684 write_phy_ofdm(dev, 0x19, 0x19); mdelay(1);
1685 write_phy_ofdm(dev, 0x1a, 0x20); mdelay(1);
1686 write_phy_ofdm(dev, 0x1b, 0x15);mdelay(1);
1687 -
1688 +
1689 write_phy_ofdm(dev, 0x1c, 0x4);mdelay(1);
1690
1691 write_phy_ofdm(dev, 0x1d, 0xc5);mdelay(1); //2005.11.17,
1692 -
1693 +
1694 write_phy_ofdm(dev, 0x1e, 0x95);mdelay(1);
1695
1696 write_phy_ofdm(dev, 0x1f, 0x75); mdelay(1);
1697
1698 // }
1699 -
1700 +
1701 write_phy_ofdm(dev, 0x20, 0x1f);mdelay(1);
1702
1703 write_phy_ofdm(dev, 0x21, 0x17);mdelay(1);
1704 -
1705 +
1706 write_phy_ofdm(dev, 0x22, 0x16);mdelay(1);
1707
1708 // if(priv->card_type != USB)
1709 write_phy_ofdm(dev, 0x23, 0x80);mdelay(1); //FIXME maybe not needed // <>
1710 -
1711 +
1712 write_phy_ofdm(dev, 0x24, 0x46); mdelay(1);
1713 write_phy_ofdm(dev, 0x25, 0x00); mdelay(1);
1714 write_phy_ofdm(dev, 0x26, 0x90); mdelay(1);
1715
1716 write_phy_ofdm(dev, 0x27, 0x88); mdelay(1);
1717
1718 -
1719 +
1720 // <> Set init. gain to m74dBm.
1721 -
1722 rtl8225z2_set_gain(dev,4);
1723 -
1724 +
1725 write_phy_cck(dev, 0x0, 0x98); mdelay(1);
1726 write_phy_cck(dev, 0x3, 0x20); mdelay(1);
1727 write_phy_cck(dev, 0x4, 0x7e); mdelay(1);
1728 @@ -875,6 +902,9 @@
1729 /* Ver C & D & 8187*/
1730
1731 write_phy_cck(dev, 0x8, 0x2e);mdelay(1);
1732 + write_phy_cck(dev, 0x9, 0x11);mdelay(1);
1733 + write_phy_cck(dev, 0xa, 0x17);mdelay(1);
1734 + write_phy_cck(dev, 0xb, 0x11);mdelay(1);
1735
1736 write_phy_cck(dev, 0x10, ((priv->card_type == USB) ? 0x9b: 0x93)); mdelay(1);
1737 write_phy_cck(dev, 0x11, 0x88); mdelay(1);
1738 @@ -885,52 +915,59 @@
1739 else
1740 #endif
1741 write_phy_cck(dev, 0x13, 0xd0); /* Ver C & D & 8187*/
1742 -
1743 - write_phy_cck(dev, 0x19, 0x0);
1744 - write_phy_cck(dev, 0x1a, 0xa0);
1745 - write_phy_cck(dev, 0x1b, 0x8);
1746 - write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
1747 -
1748 - write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
1749
1750 -
1751 +// write_phy_cck(dev, 0x19, 0x0);
1752 +// write_phy_cck(dev, 0x1a, 0xa0);
1753 +// write_phy_cck(dev, 0x1b, 0x8);
1754 +// write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
1755 + write_phy_cck(dev, 0x19, 0x0); mdelay(1);
1756 + write_phy_cck(dev, 0x1a, 0xa0); mdelay(1);
1757 + write_phy_cck(dev, 0x1b, 0x8); mdelay(1);
1758 + write_phy_cck(dev, 0x1d, 0x0); mdelay(1);
1759 + write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */ mdelay(1);
1760 + write_phy_cck(dev, 0x41, 0x86); mdelay(1);
1761 +
1762 +
1763 +// write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
1764 +
1765 +
1766 write_phy_cck(dev, 0x42, 0x15); mdelay(1);
1767 write_phy_cck(dev, 0x43, 0x18); mdelay(1);
1768 -
1769 -
1770 +
1771 +
1772 write_phy_cck(dev, 0x44, 0x36); mdelay(1);
1773 write_phy_cck(dev, 0x45, 0x35); mdelay(1);
1774 write_phy_cck(dev, 0x46, 0x2e); mdelay(1);
1775 write_phy_cck(dev, 0x47, 0x25); mdelay(1);
1776 write_phy_cck(dev, 0x48, 0x1c); mdelay(1);
1777 write_phy_cck(dev, 0x49, 0x12); mdelay(1);
1778 - write_phy_cck(dev, 0x4a, 0x9); mdelay(1);
1779 - write_phy_cck(dev, 0x4b, 0x4); mdelay(1);
1780 + write_phy_cck(dev, 0x4a, 0x09); mdelay(1);
1781 + write_phy_cck(dev, 0x4b, 0x04); mdelay(1);
1782 write_phy_cck(dev, 0x4c, 0x5);mdelay(1);
1783
1784
1785 write_nic_byte(dev, 0x5b, 0x0d); mdelay(1);
1786
1787 -
1788 +
1789
1790 // <>
1791 // // TESTR 0xb 8187
1792 // write_phy_cck(dev, 0x10, 0x93);// & 0xfb);
1793 -//
1794 +//
1795 // //if(priv->card_type != USB){
1796 // write_phy_ofdm(dev, 0x2, 0x62);
1797 // write_phy_ofdm(dev, 0x6, 0x0);
1798 // write_phy_ofdm(dev, 0x8, 0x0);
1799 // //}
1800 -
1801 +
1802 rtl8225z2_SetTXPowerLevel(dev, channel);
1803 -
1804 +
1805 write_phy_cck(dev, 0x10, 0x9b); mdelay(1); /* Rx ant A, 0xdb for B */
1806 write_phy_ofdm(dev, 0x26, 0x90); mdelay(1); /* Rx ant A, 0x10 for B */
1807 -
1808 +
1809 rtl8185_tx_antenna(dev, 0x3); /* TX ant A, 0x0 for B */
1810 -
1811 - /* switch to high-speed 3-wire
1812 +
1813 + /* switch to high-speed 3-wire
1814 * last digit. 2 for both cck and ofdm
1815 */
1816 if(priv->card_type == USB)
1817 @@ -943,23 +980,23 @@
1818 // if(priv->card_type != USB)
1819 // rtl8225_set_gain(dev, 4); /* FIXME this '1' is random */ // <>
1820 // rtl8225_set_mode(dev, 1); /* FIXME start in B mode */ // <>
1821 -//
1822 +//
1823 // /* make sure is waken up! */
1824 // write_rtl8225(dev,0x4, 0x9ff);
1825 -// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
1826 +// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
1827 // rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
1828 -
1829 +
1830 rtl8225_rf_set_chan(dev, priv->chan);
1831
1832 //write_nic_word(dev,BRSR,brsr);
1833 -
1834 +
1835 //rtl8225z2_rf_set_mode(dev);
1836 }
1837
1838 -void rtl8225z2_rf_set_mode(struct net_device *dev)
1839 +void rtl8225z2_rf_set_mode(struct net_device *dev)
1840 {
1841 - struct r8180_priv *priv = ieee80211_priv(dev);
1842 -
1843 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1844 +
1845 if(priv->ieee80211->mode == IEEE_A)
1846 {
1847 write_rtl8225(dev, 0x5, 0x1865);
1848 @@ -970,15 +1007,15 @@
1849 write_phy_ofdm(dev, 0xb, 0x99);
1850 write_phy_ofdm(dev, 0xf, 0x20);
1851 write_phy_ofdm(dev, 0x11, 0x7);
1852 -
1853 +
1854 rtl8225z2_set_gain(dev,4);
1855 -
1856 +
1857 write_phy_ofdm(dev,0x15, 0x40);
1858 write_phy_ofdm(dev,0x17, 0x40);
1859 -
1860 +
1861 write_nic_dword(dev, 0x94,0x10000000);
1862 }else{
1863 -
1864 +
1865 write_rtl8225(dev, 0x5, 0x1864);
1866 write_nic_dword(dev, RF_PARA, 0x10044);
1867 write_nic_dword(dev, RF_TIMING, 0xa8008);
1868 @@ -987,12 +1024,12 @@
1869 write_phy_ofdm(dev, 0xb, 0x99);
1870 write_phy_ofdm(dev, 0xf, 0x20);
1871 write_phy_ofdm(dev, 0x11, 0x7);
1872 -
1873 +
1874 rtl8225z2_set_gain(dev,4);
1875 -
1876 +
1877 write_phy_ofdm(dev,0x15, 0x40);
1878 write_phy_ofdm(dev,0x17, 0x40);
1879 -
1880 +
1881 write_nic_dword(dev, 0x94,0x04000002);
1882 }
1883 }
1884 diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_wx.c rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_wx.c
1885 --- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_wx.c 2006-06-06 04:58:02.000000000 +0200
1886 +++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_wx.c 2008-02-15 00:40:10.000000000 +0100
1887 @@ -1,19 +1,19 @@
1888 -/*
1889 +/*
1890 This file contains wireless extension handlers.
1891
1892 This is part of rtl8180 OpenSource driver.
1893 - Copyright (C) Andrea Merello 2004-2005 <[email protected]>
1894 + Copyright (C) Andrea Merello 2004-2005 <[email protected]>
1895 Released under the terms of GPL (General Public Licence)
1896 -
1897 - Parts of this driver are based on the GPL part
1898 +
1899 + Parts of this driver are based on the GPL part
1900 of the official realtek driver.
1901 -
1902 - Parts of this driver are based on the rtl8180 driver skeleton
1903 +
1904 + Parts of this driver are based on the rtl8180 driver skeleton
1905 from Patric Schenke & Andres Salomon.
1906
1907 Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver.
1908 -
1909 - We want to tanks the Authors of those projects and the Ndiswrapper
1910 +
1911 + We want to tanks the Authors of those projects and the Ndiswrapper
1912 project Authors.
1913 */
1914
1915 @@ -21,20 +21,21 @@
1916
1917 #include "r8187.h"
1918 #include "r8180_hw.h"
1919 +#include "r8180_rtl8225.h"
1920
1921
1922 #define RATE_COUNT 4
1923 u32 rtl8180_rates[] = {1000000,2000000,5500000,11000000,
1924 6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000};
1925 -
1926 +
1927
1928 static int r8180_wx_get_freq(struct net_device *dev,
1929 struct iw_request_info *a,
1930 union iwreq_data *wrqu, char *b)
1931 {
1932 - struct r8180_priv *priv = ieee80211_priv(dev);
1933 -
1934 - return ieee80211_wx_get_freq(priv->ieee80211,a,wrqu,b);
1935 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1936 +
1937 + return ieee80211_wx_get_freq_rtl7(priv->ieee80211,a,wrqu,b);
1938 }
1939
1940
1941 @@ -45,28 +46,28 @@
1942 {
1943 int *parms = (int *)b;
1944 int bi = parms[0];
1945 -
1946 - struct r8180_priv *priv = ieee80211_priv(dev);
1947 -
1948 +
1949 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
1950 +
1951 down(&priv->wx_sem);
1952 DMESG("setting beacon interval to %x",bi);
1953 -
1954 +
1955 priv->ieee80211->beacon_interval=bi;
1956 rtl8180_commit(dev);
1957 up(&priv->wx_sem);
1958 -
1959 - return 0;
1960 +
1961 + return 0;
1962 }
1963
1964
1965 static int r8180_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa,
1966 union iwreq_data *wrqu, char *extra)
1967 {
1968 - struct r8180_priv *priv=ieee80211_priv(dev);
1969 + struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
1970 int *parms = (int *)extra;
1971 -
1972 +
1973 priv->ieee80211->force_associate = (parms[0] > 0);
1974 -
1975 +
1976
1977 return 0;
1978 }
1979 @@ -75,108 +76,186 @@
1980 static int r8180_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
1981 union iwreq_data *wrqu, char *b)
1982 {
1983 - struct r8180_priv *priv=ieee80211_priv(dev);
1984 + struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
1985
1986 - return ieee80211_wx_get_mode(priv->ieee80211,a,wrqu,b);
1987 + return ieee80211_wx_get_mode_rtl7(priv->ieee80211,a,wrqu,b);
1988 }
1989
1990
1991
1992 -static int r8180_wx_get_rate(struct net_device *dev,
1993 - struct iw_request_info *info,
1994 +static int r8180_wx_get_rate(struct net_device *dev,
1995 + struct iw_request_info *info,
1996 union iwreq_data *wrqu, char *extra)
1997 {
1998 - struct r8180_priv *priv = ieee80211_priv(dev);
1999 - return ieee80211_wx_get_rate(priv->ieee80211,info,wrqu,extra);
2000 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2001 + return ieee80211_wx_get_rate_rtl7(priv->ieee80211,info,wrqu,extra);
2002 }
2003
2004
2005
2006 -static int r8180_wx_set_rate(struct net_device *dev,
2007 - struct iw_request_info *info,
2008 +static int r8180_wx_set_rate(struct net_device *dev,
2009 + struct iw_request_info *info,
2010 union iwreq_data *wrqu, char *extra)
2011 {
2012 int ret;
2013 - struct r8180_priv *priv = ieee80211_priv(dev);
2014 -
2015 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2016 +
2017 down(&priv->wx_sem);
2018 + ret = ieee80211_wx_set_rate_rtl7(priv->ieee80211,info,wrqu,extra);
2019
2020 - ret = ieee80211_wx_set_rate(priv->ieee80211,info,wrqu,extra);
2021 -
2022 up(&priv->wx_sem);
2023 -
2024 +
2025 return ret;
2026 }
2027
2028 -static int r8180_wx_set_rawtx(struct net_device *dev,
2029 - struct iw_request_info *info,
2030 - union iwreq_data *wrqu, char *extra)
2031 +static int r8180_wx_get_txpow(struct net_device *dev,
2032 + struct iw_request_info *info,
2033 + union iwreq_data *wrqu, char *extra)
2034 {
2035 - struct r8180_priv *priv = ieee80211_priv(dev);
2036 - int ret;
2037 -
2038 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2039 + int i=0;
2040 down(&priv->wx_sem);
2041 -
2042 - ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
2043 -
2044 + wrqu->power.value = 0;
2045 + for(i=0; i<15; i++)
2046 + {
2047 + if(priv->chtxpwr[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr[i];
2048 + if(priv->chtxpwr_ofdm[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr_ofdm[i];
2049 + }
2050 + wrqu->power.fixed = 1;
2051 + wrqu->power.flags = IW_TXPOW_DBM;
2052 + wrqu->power.disabled = 0;
2053 up(&priv->wx_sem);
2054 -
2055 +
2056 + return 0;
2057 +}
2058 +
2059 +#if 1
2060 +static int r8180_wx_set_txpow(struct net_device *dev,
2061 + struct iw_request_info *info,
2062 + union iwreq_data *wrqu, char *extra)
2063 +{
2064 + int ret = 0, i=0;
2065 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2066 +
2067 + down(&priv->wx_sem);
2068 +
2069 + if (wrqu->power.flags != IW_TXPOW_DBM)
2070 + {
2071 + ret = -EINVAL;
2072 + goto out;
2073 + }
2074 +
2075 + if(wrqu->power.value > 35)
2076 + {
2077 + ret = -EINVAL;
2078 + goto out;
2079 + }
2080 +
2081 + if(wrqu->power.value < 0)
2082 + {
2083 + ret = -EINVAL;
2084 + goto out;
2085 + }
2086 +
2087 + for(i=1;i<15;i++)
2088 + {
2089 + priv->chtxpwr[i] = priv->chtxpwr_orig[i] - (priv->txpwr_max - wrqu->power.value);
2090 +// if(priv->chtxpwr[i] > priv->chtxpwr_orig[i]) priv->chtxpwr[i] = 0;
2091 +
2092 + priv->chtxpwr_ofdm[i] = priv->chtxpwr_ofdm_orig[i] - (priv->txpwr_max - wrqu->power.value);
2093 +// if(priv->chtxpwr_ofdm[i] > priv->chtxpwr_ofdm_orig[i]) priv->chtxpwr_ofdm[i] = 0;
2094 + }
2095 + rtl8225z2_SetTXPowerLevel(dev, 1);
2096 +
2097 + out:
2098 + up(&priv->wx_sem);
2099 +
2100 return ret;
2101 -
2102 +
2103 }
2104 +#endif
2105
2106 -static int r8180_wx_set_crcmon(struct net_device *dev,
2107 - struct iw_request_info *info,
2108 +static int r8180_wx_set_crcmon(struct net_device *dev,
2109 + struct iw_request_info *info,
2110 union iwreq_data *wrqu, char *extra)
2111 {
2112 - struct r8180_priv *priv = ieee80211_priv(dev);
2113 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2114 int *parms = (int *)extra;
2115 int enable = (parms[0] > 0);
2116 short prev = priv->crcmon;
2117
2118 down(&priv->wx_sem);
2119 -
2120 - if(enable)
2121 +
2122 + if(enable)
2123 priv->crcmon=1;
2124 - else
2125 + else
2126 priv->crcmon=0;
2127
2128 - DMESG("bad CRC in monitor mode are %s",
2129 + DMESG("bad CRC in monitor mode are %s",
2130 priv->crcmon ? "accepted" : "rejected");
2131
2132 if(prev != priv->crcmon && priv->up){
2133 rtl8180_down(dev);
2134 rtl8180_up(dev);
2135 }
2136 -
2137 +
2138 up(&priv->wx_sem);
2139 -
2140 +
2141 + return 0;
2142 +}
2143 +
2144 +static int r8180_wx_set_fasttx(struct net_device *dev,
2145 + struct iw_request_info *info,
2146 + union iwreq_data *wrqu, char *extra)
2147 +{
2148 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2149 + int *parms = (int *)extra;
2150 + int enable = (parms[0] > 0);
2151 + short prev = priv->fasttx;
2152 +
2153 + down(&priv->wx_sem);
2154 +
2155 + if(enable)
2156 + priv->fasttx=1;
2157 + else
2158 + priv->fasttx=0;
2159 +
2160 + DMESG("Transmission method (regarding speed) set to: %s",
2161 + priv->fasttx ? "fast" : "normal");
2162 +
2163 + if(prev != priv->fasttx && priv->up){
2164 + rtl8180_down(dev);
2165 + rtl8180_up(dev);
2166 + }
2167 +
2168 + up(&priv->wx_sem);
2169 +
2170 return 0;
2171 }
2172
2173 static int r8180_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
2174 union iwreq_data *wrqu, char *b)
2175 {
2176 - struct r8180_priv *priv = ieee80211_priv(dev);
2177 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2178 int ret;
2179 -
2180 +
2181 down(&priv->wx_sem);
2182 -
2183 - ret = ieee80211_wx_set_mode(priv->ieee80211,a,wrqu,b);
2184 -
2185 +
2186 + ret = ieee80211_wx_set_mode_rtl7(priv->ieee80211,a,wrqu,b);
2187 +
2188 rtl8187_set_rxconf(dev);
2189 -
2190 +
2191 up(&priv->wx_sem);
2192 return ret;
2193 }
2194
2195
2196 -static int rtl8180_wx_get_range(struct net_device *dev,
2197 - struct iw_request_info *info,
2198 +static int rtl8180_wx_get_range(struct net_device *dev,
2199 + struct iw_request_info *info,
2200 union iwreq_data *wrqu, char *extra)
2201 {
2202 struct iw_range *range = (struct iw_range *)extra;
2203 - struct r8180_priv *priv = ieee80211_priv(dev);
2204 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2205 u16 val;
2206 int i;
2207
2208 @@ -186,26 +265,26 @@
2209 /* Let's try to keep this struct in the same order as in
2210 * linux/include/wireless.h
2211 */
2212 -
2213 +
2214 /* TODO: See what values we can set, and remove the ones we can't
2215 * set, or fill them with some default data.
2216 */
2217
2218 /* ~5 Mb/s real (802.11b) */
2219 - range->throughput = 5 * 1000 * 1000;
2220 + range->throughput = 5 * 1000 * 1000;
2221
2222 // TODO: Not used in 802.11b?
2223 // range->min_nwid; /* Minimal NWID we are able to set */
2224 // TODO: Not used in 802.11b?
2225 // range->max_nwid; /* Maximal NWID we are able to set */
2226 -
2227 +
2228 /* Old Frequency (backward compat - moved lower ) */
2229 -// range->old_num_channels;
2230 +// range->old_num_channels;
2231 // range->old_num_frequency;
2232 // range->old_freq[6]; /* Filler to keep "version" at the same offset */
2233 if(priv->rf_set_sens != NULL)
2234 range->sensitivity = priv->max_sens; /* signal level threshold range */
2235 -
2236 +
2237 range->max_qual.qual = 100;
2238 /* TODO: Find real max RSSI and stick here */
2239 range->max_qual.level = 0;
2240 @@ -219,14 +298,14 @@
2241 range->avg_qual.updated = 7; /* Updated all three */
2242
2243 range->num_bitrates = RATE_COUNT;
2244 -
2245 +
2246 for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) {
2247 range->bitrate[i] = rtl8180_rates[i];
2248 }
2249 -
2250 +
2251 range->min_frag = MIN_FRAG_THRESHOLD;
2252 range->max_frag = MAX_FRAG_THRESHOLD;
2253 -
2254 +
2255 range->pm_capa = 0;
2256
2257 range->we_version_compiled = WIRELESS_EXT;
2258 @@ -243,18 +322,18 @@
2259 range->num_channels = 14;
2260
2261 for (i = 0, val = 0; i < 14; i++) {
2262 -
2263 +
2264 // Include only legal frequencies for some countries
2265 if ((priv->challow)[i+1]) {
2266 range->freq[val].i = i + 1;
2267 - range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000;
2268 + range->freq[val].m = ieee80211_wlan_frequencies_rtl7[i] * 100000;
2269 range->freq[val].e = 1;
2270 val++;
2271 } else {
2272 // FIXME: do we need to set anything for channels
2273 // we don't use ?
2274 }
2275 -
2276 +
2277 if (val == IW_MAX_FREQUENCIES)
2278 break;
2279 }
2280 @@ -267,15 +346,15 @@
2281 static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
2282 union iwreq_data *wrqu, char *b)
2283 {
2284 - struct r8180_priv *priv = ieee80211_priv(dev);
2285 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2286 int ret;
2287 -
2288 +
2289 if(!priv->up) return -1;
2290 -
2291 +
2292 down(&priv->wx_sem);
2293 -
2294 - ret = ieee80211_wx_set_scan(priv->ieee80211,a,wrqu,b);
2295 -
2296 +
2297 + ret = ieee80211_wx_set_scan_rtl7(priv->ieee80211,a,wrqu,b);
2298 +
2299 up(&priv->wx_sem);
2300 return ret;
2301 }
2302 @@ -286,50 +365,50 @@
2303 {
2304
2305 int ret;
2306 - struct r8180_priv *priv = ieee80211_priv(dev);
2307 -
2308 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2309 +
2310 if(!priv->up) return -1;
2311 -
2312 +
2313 down(&priv->wx_sem);
2314
2315 - ret = ieee80211_wx_get_scan(priv->ieee80211,a,wrqu,b);
2316 -
2317 + ret = ieee80211_wx_get_scan_rtl7(priv->ieee80211,a,wrqu,b);
2318 +
2319 up(&priv->wx_sem);
2320 -
2321 +
2322 return ret;
2323 }
2324
2325
2326 -static int r8180_wx_set_essid(struct net_device *dev,
2327 +static int r8180_wx_set_essid(struct net_device *dev,
2328 struct iw_request_info *a,
2329 union iwreq_data *wrqu, char *b)
2330 {
2331 - struct r8180_priv *priv = ieee80211_priv(dev);
2332 -
2333 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2334 +
2335 int ret;
2336 -
2337 +
2338 down(&priv->wx_sem);
2339 -
2340 - ret = ieee80211_wx_set_essid(priv->ieee80211,a,wrqu,b);
2341 -
2342 +
2343 + ret = ieee80211_wx_set_essid_rtl7(priv->ieee80211,a,wrqu,b);
2344 +
2345 up(&priv->wx_sem);
2346 return ret;
2347 }
2348
2349
2350 -static int r8180_wx_get_essid(struct net_device *dev,
2351 +static int r8180_wx_get_essid(struct net_device *dev,
2352 struct iw_request_info *a,
2353 union iwreq_data *wrqu, char *b)
2354 {
2355 int ret;
2356 - struct r8180_priv *priv = ieee80211_priv(dev);
2357 -
2358 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2359 +
2360 down(&priv->wx_sem);
2361 -
2362 - ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b);
2363 +
2364 + ret = ieee80211_wx_get_essid_rtl7(priv->ieee80211, a, wrqu, b);
2365
2366 up(&priv->wx_sem);
2367 -
2368 +
2369 return ret;
2370 }
2371
2372 @@ -338,30 +417,30 @@
2373 union iwreq_data *wrqu, char *b)
2374 {
2375 int ret;
2376 - struct r8180_priv *priv = ieee80211_priv(dev);
2377 -
2378 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2379 +
2380 down(&priv->wx_sem);
2381 -
2382 - ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b);
2383 -
2384 +
2385 + ret = ieee80211_wx_set_freq_rtl7(priv->ieee80211, a, wrqu, b);
2386 +
2387 up(&priv->wx_sem);
2388 return ret;
2389 }
2390
2391 -static int r8180_wx_get_name(struct net_device *dev,
2392 - struct iw_request_info *info,
2393 +static int r8180_wx_get_name(struct net_device *dev,
2394 + struct iw_request_info *info,
2395 union iwreq_data *wrqu, char *extra)
2396 {
2397 - struct r8180_priv *priv = ieee80211_priv(dev);
2398 - return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra);
2399 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2400 + return ieee80211_wx_get_name_rtl7(priv->ieee80211, info, wrqu, extra);
2401 }
2402
2403
2404 -static int r8180_wx_set_frag(struct net_device *dev,
2405 - struct iw_request_info *info,
2406 +static int r8180_wx_set_frag(struct net_device *dev,
2407 + struct iw_request_info *info,
2408 union iwreq_data *wrqu, char *extra)
2409 {
2410 - struct r8180_priv *priv = ieee80211_priv(dev);
2411 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2412
2413 if (wrqu->frag.disabled)
2414 priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
2415 @@ -369,7 +448,7 @@
2416 if (wrqu->frag.value < MIN_FRAG_THRESHOLD ||
2417 wrqu->frag.value > MAX_FRAG_THRESHOLD)
2418 return -EINVAL;
2419 -
2420 +
2421 priv->ieee80211->fts = wrqu->frag.value & ~0x1;
2422 }
2423
2424 @@ -377,11 +456,11 @@
2425 }
2426
2427
2428 -static int r8180_wx_get_frag(struct net_device *dev,
2429 - struct iw_request_info *info,
2430 +static int r8180_wx_get_frag(struct net_device *dev,
2431 + struct iw_request_info *info,
2432 union iwreq_data *wrqu, char *extra)
2433 {
2434 - struct r8180_priv *priv = ieee80211_priv(dev);
2435 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2436
2437 wrqu->frag.value = priv->ieee80211->fts;
2438 wrqu->frag.fixed = 0; /* no auto select */
2439 @@ -397,49 +476,49 @@
2440 char *extra)
2441 {
2442 int ret;
2443 - struct r8180_priv *priv = ieee80211_priv(dev);
2444 -
2445 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2446 +
2447 down(&priv->wx_sem);
2448 -
2449 - ret = ieee80211_wx_set_wap(priv->ieee80211,info,awrq,extra);
2450 -
2451 +
2452 + ret = ieee80211_wx_set_wap_rtl7(priv->ieee80211,info,awrq,extra);
2453 +
2454 up(&priv->wx_sem);
2455 return ret;
2456 -
2457 +
2458 }
2459 -
2460
2461 -static int r8180_wx_get_wap(struct net_device *dev,
2462 - struct iw_request_info *info,
2463 +
2464 +static int r8180_wx_get_wap(struct net_device *dev,
2465 + struct iw_request_info *info,
2466 union iwreq_data *wrqu, char *extra)
2467 {
2468 - struct r8180_priv *priv = ieee80211_priv(dev);
2469 -
2470 - return ieee80211_wx_get_wap(priv->ieee80211,info,wrqu,extra);
2471 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2472 +
2473 + return ieee80211_wx_get_wap_rtl7(priv->ieee80211,info,wrqu,extra);
2474 }
2475
2476
2477 -static int r8180_wx_get_enc(struct net_device *dev,
2478 - struct iw_request_info *info,
2479 +static int r8180_wx_get_enc(struct net_device *dev,
2480 + struct iw_request_info *info,
2481 union iwreq_data *wrqu, char *key)
2482 {
2483 - struct r8180_priv *priv = ieee80211_priv(dev);
2484 -
2485 - return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key);
2486 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2487 +
2488 + return ieee80211_wx_get_encode_rtl7(priv->ieee80211, info, wrqu, key);
2489 }
2490
2491 -static int r8180_wx_set_enc(struct net_device *dev,
2492 - struct iw_request_info *info,
2493 +static int r8180_wx_set_enc(struct net_device *dev,
2494 + struct iw_request_info *info,
2495 union iwreq_data *wrqu, char *key)
2496 {
2497 - struct r8180_priv *priv = ieee80211_priv(dev);
2498 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2499 int ret;
2500 -
2501 +
2502 down(&priv->wx_sem);
2503 -
2504 +
2505 DMESG("Setting SW wep key");
2506 - ret = ieee80211_wx_set_encode(priv->ieee80211,info,wrqu,key);
2507 -
2508 + ret = ieee80211_wx_set_encode_rtl7(priv->ieee80211,info,wrqu,key);
2509 +
2510 up(&priv->wx_sem);
2511 return ret;
2512 }
2513 @@ -447,28 +526,28 @@
2514
2515 static int r8180_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union
2516 iwreq_data *wrqu, char *p){
2517 -
2518 - struct r8180_priv *priv = ieee80211_priv(dev);
2519 +
2520 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2521 int *parms=(int*)p;
2522 int mode=parms[0];
2523 -
2524 +
2525 priv->ieee80211->active_scan = mode;
2526 -
2527 +
2528 return 1;
2529 }
2530
2531
2532
2533 -static int r8180_wx_set_retry(struct net_device *dev,
2534 - struct iw_request_info *info,
2535 +static int r8180_wx_set_retry(struct net_device *dev,
2536 + struct iw_request_info *info,
2537 union iwreq_data *wrqu, char *extra)
2538 {
2539 - struct r8180_priv *priv = ieee80211_priv(dev);
2540 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2541 int err = 0;
2542 -
2543 +
2544 down(&priv->wx_sem);
2545 -
2546 - if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
2547 +
2548 + if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
2549 wrqu->retry.disabled){
2550 err = -EINVAL;
2551 goto exit;
2552 @@ -485,13 +564,13 @@
2553 if (wrqu->retry.flags & IW_RETRY_MAX) {
2554 priv->retry_rts = wrqu->retry.value;
2555 DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value);
2556 -
2557 +
2558 }else {
2559 priv->retry_data = wrqu->retry.value;
2560 DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value);
2561 }
2562 -
2563 - /* FIXME !
2564 +
2565 + /* FIXME !
2566 * We might try to write directly the TX config register
2567 * or to restart just the (R)TX process.
2568 * I'm unsure if whole reset is really needed
2569 @@ -503,28 +582,28 @@
2570 rtl8180_rtx_disable(dev);
2571 rtl8180_rx_enable(dev);
2572 rtl8180_tx_enable(dev);
2573 -
2574 +
2575 }
2576 */
2577 exit:
2578 up(&priv->wx_sem);
2579 -
2580 +
2581 return err;
2582 }
2583
2584 -static int r8180_wx_get_retry(struct net_device *dev,
2585 - struct iw_request_info *info,
2586 +static int r8180_wx_get_retry(struct net_device *dev,
2587 + struct iw_request_info *info,
2588 union iwreq_data *wrqu, char *extra)
2589 {
2590 - struct r8180_priv *priv = ieee80211_priv(dev);
2591 -
2592 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2593 +
2594
2595 wrqu->retry.disabled = 0; /* can't be disabled */
2596
2597 - if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
2598 - IW_RETRY_LIFETIME)
2599 + if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
2600 + IW_RETRY_LIFETIME)
2601 return -EINVAL;
2602 -
2603 +
2604 if (wrqu->retry.flags & IW_RETRY_MAX) {
2605 wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MAX;
2606 wrqu->retry.value = priv->retry_rts;
2607 @@ -533,30 +612,30 @@
2608 wrqu->retry.value = priv->retry_data;
2609 }
2610 //DMESG("returning %d",wrqu->retry.value);
2611 -
2612 +
2613
2614 return 0;
2615 }
2616
2617 -static int r8180_wx_get_sens(struct net_device *dev,
2618 - struct iw_request_info *info,
2619 +static int r8180_wx_get_sens(struct net_device *dev,
2620 + struct iw_request_info *info,
2621 union iwreq_data *wrqu, char *extra)
2622 {
2623 - struct r8180_priv *priv = ieee80211_priv(dev);
2624 - if(priv->rf_set_sens == NULL)
2625 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2626 + if(priv->rf_set_sens == NULL)
2627 return -1; /* we have not this support for this radio */
2628 wrqu->sens.value = priv->sens;
2629 return 0;
2630 }
2631
2632
2633 -static int r8180_wx_set_sens(struct net_device *dev,
2634 - struct iw_request_info *info,
2635 +static int r8180_wx_set_sens(struct net_device *dev,
2636 + struct iw_request_info *info,
2637 union iwreq_data *wrqu, char *extra)
2638 {
2639 -
2640 - struct r8180_priv *priv = ieee80211_priv(dev);
2641 -
2642 +
2643 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2644 +
2645 short err = 0;
2646 down(&priv->wx_sem);
2647 //DMESG("attempt to set sensivity to %ddb",wrqu->sens.value);
2648 @@ -571,7 +650,7 @@
2649
2650 exit:
2651 up(&priv->wx_sem);
2652 -
2653 +
2654 return err;
2655 }
2656
2657 @@ -623,50 +702,49 @@
2658 dummy, /* SIOCGIWRTS */
2659 r8180_wx_set_frag, /* SIOCSIWFRAG */
2660 r8180_wx_get_frag, /* SIOCGIWFRAG */
2661 - dummy, /* SIOCSIWTXPOW */
2662 - dummy, /* SIOCGIWTXPOW */
2663 + r8180_wx_set_txpow, /* SIOCSIWTXPOW */
2664 + r8180_wx_get_txpow, /* SIOCGIWTXPOW */
2665 r8180_wx_set_retry, /* SIOCSIWRETRY */
2666 r8180_wx_get_retry, /* SIOCGIWRETRY */
2667 r8180_wx_set_enc, /* SIOCSIWENCODE */
2668 r8180_wx_get_enc, /* SIOCGIWENCODE */
2669 dummy, /* SIOCSIWPOWER */
2670 dummy, /* SIOCGIWPOWER */
2671 -};
2672 +};
2673
2674
2675 -static const struct iw_priv_args r8180_private_args[] = {
2676 -
2677 +static const struct iw_priv_args r8180_private_args[] = {
2678 {
2679 - SIOCIWFIRSTPRIV + 0x0,
2680 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
2681 - },
2682 -
2683 + SIOCIWFIRSTPRIV + 0x0,
2684 + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "fasttx"
2685 + },
2686 +
2687 {
2688 SIOCIWFIRSTPRIV + 0x1,
2689 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
2690 -
2691 + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
2692 },
2693 +
2694 {
2695 - SIOCIWFIRSTPRIV + 0x2,
2696 - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx"
2697 + SIOCIWFIRSTPRIV + 0x2,
2698 + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
2699 +
2700 }
2701 };
2702
2703
2704 static iw_handler r8180_private_handler[] = {
2705 -// r8180_wx_set_monitor, /* SIOCIWFIRSTPRIV */
2706 + r8180_wx_set_fasttx, /* SIOCIWFIRSTPRIV */
2707 r8180_wx_set_crcmon, /*SIOCIWSECONDPRIV*/
2708 // r8180_wx_set_forceassociate,
2709 // r8180_wx_set_beaconinterval,
2710 // r8180_wx_set_monitor_type,
2711 r8180_wx_set_scan_type,
2712 - r8180_wx_set_rawtx,
2713 };
2714
2715 -#if WIRELESS_EXT >= 17
2716 +#if WIRELESS_EXT >= 17
2717 static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
2718 {
2719 - struct r8180_priv *priv = ieee80211_priv(dev);
2720 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
2721
2722 return &priv->wstats;
2723 }
2724 @@ -679,8 +757,8 @@
2725 .private = r8180_private_handler,
2726 .num_private = sizeof(r8180_private_handler) / sizeof(iw_handler),
2727 .num_private_args = sizeof(r8180_private_args) / sizeof(struct iw_priv_args),
2728 -#if WIRELESS_EXT >= 17
2729 +#if WIRELESS_EXT >= 17
2730 .get_wireless_stats = r8180_get_wireless_stats,
2731 #endif
2732 - .private_args = (struct iw_priv_args *)r8180_private_args,
2733 + .private_args = (struct iw_priv_args *)r8180_private_args,
2734 };
2735 diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187_core.c
2736 --- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c 2006-06-22 07:43:30.000000000 +0200
2737 +++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187_core.c 2008-02-15 00:37:05.000000000 +0100
2738 @@ -1,27 +1,27 @@
2739 /*
2740 This is part of rtl8187 OpenSource driver - v 0.1
2741 - Copyright (C) Andrea Merello 2005 <[email protected]>
2742 + Copyright (C) Andrea Merello 2005 <[email protected]>
2743 Released under the terms of GPL (General Public License)
2744 -
2745 -
2746 - Parts of this driver are based on the rtl8180 driver skeleton
2747 +
2748 +
2749 + Parts of this driver are based on the rtl8180 driver skeleton
2750 from Patric Schenke & Andres Salomon.
2751
2752 Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers.
2753 -
2754 +
2755 some ideas might be derived from David Young rtl8180 netbsd driver.
2756 -
2757 +
2758 Parts of the usb code are from the r8150.c driver in linux kernel
2759 -
2760 +
2761 Some ideas borrowed from the 8139too.c driver included in linux kernel.
2762 -
2763 - We (I?) want to thanks the Authors of those projecs and also the
2764 +
2765 + We (I?) want to thanks the Authors of those projecs and also the
2766 Ndiswrapper's project Authors.
2767 -
2768 - A special big thanks goes also to Realtek corp. for their help in my
2769 - attempt to add RTL8187 and RTL8225 support, and to David Young also.
2770
2771 - - Please note that this file is a modified version from rtl8180-sa2400
2772 + A special big thanks goes also to Realtek corp. for their help in my
2773 + attempt to add RTL8187 and RTL8225 support, and to David Young also.
2774 +
2775 + - Please note that this file is a modified version from rtl8180-sa2400
2776 drv. So some other people have contributed to this project, and they are
2777 thanked in the rtl8180-sa2400 CHANGELOG.
2778 */
2779 @@ -57,6 +57,7 @@
2780 #undef DEBUG_IRQ_TASKLET
2781 #undef DEBUG_TX_ALLOC
2782 #undef DEBUG_TX_DESC
2783 +#undef DEBUG_TX_POWER
2784
2785 //#define CONFIG_RTL8180_IO_MAP
2786
2787 @@ -66,6 +67,9 @@
2788 #include "r8180_93cx6.h" /* Card EEPROM */
2789 #include "r8180_wx.h"
2790
2791 +#if !(defined(CONFIG_USB_EHCI_HCD) || defined (CONFIG_USB_EHCI_HCD_MODULE))
2792 + #error Build your kernel with ehci_hcd support!
2793 +#endif
2794
2795 // FIXME: check if 2.6.7 is ok
2796 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
2797 @@ -98,6 +102,10 @@
2798 #endif
2799 static int channels = 0x3fff;
2800
2801 +// #define DEBUG_EPROM
2802 +// #define DEBUG_REGISTERS
2803 +// #define DEBUG_TX_POWER
2804 +
2805 MODULE_LICENSE("GPL");
2806 MODULE_VERSION("V 1.1");
2807 MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
2808 @@ -137,7 +145,7 @@
2809
2810 static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
2811 const struct usb_device_id *id);
2812 -
2813 +
2814 static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf);
2815
2816 static struct usb_driver rtl8187_usb_driver = {
2817 @@ -158,13 +166,12 @@
2818 #endif
2819 };
2820
2821 -
2822 void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
2823 {
2824 -
2825 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2826 +
2827 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2828 struct usb_device *udev = priv->udev;
2829 -
2830 +
2831 usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
2832 RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
2833 indx|0xfe00, 0, &data, 1, HZ / 2);
2834 @@ -173,10 +180,10 @@
2835
2836 void write_nic_byte(struct net_device *dev, int indx, u8 data)
2837 {
2838 -
2839 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2840 +
2841 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2842 struct usb_device *udev = priv->udev;
2843 -
2844 +
2845 usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
2846 RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
2847 indx|0xff00, 0, &data, 1, HZ / 2);
2848 @@ -185,10 +192,10 @@
2849
2850 void write_nic_word(struct net_device *dev, int indx, u16 data)
2851 {
2852 -
2853 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2854 +
2855 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2856 struct usb_device *udev = priv->udev;
2857 -
2858 +
2859 usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
2860 RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
2861 indx|0xff00, 0, &data, 2, HZ / 2);
2862 @@ -197,23 +204,23 @@
2863
2864 void write_nic_dword(struct net_device *dev, int indx, u32 data)
2865 {
2866 -
2867 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2868 +
2869 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2870 struct usb_device *udev = priv->udev;
2871 -
2872 +
2873 usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
2874 RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
2875 indx|0xff00, 0, &data, 4, HZ / 2);
2876 }
2877 -
2878 -
2879 -
2880 +
2881 +
2882 +
2883 u8 read_nic_byte(struct net_device *dev, int indx)
2884 {
2885 u8 data;
2886 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2887 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2888 struct usb_device *udev = priv->udev;
2889 -
2890 +
2891 usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
2892 RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
2893 indx|0xff00, 0, &data, 1, HZ / 2);
2894 @@ -223,22 +230,22 @@
2895 u8 read_nic_byte_E(struct net_device *dev, int indx)
2896 {
2897 u8 data;
2898 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2899 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2900 struct usb_device *udev = priv->udev;
2901 -
2902 +
2903 usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
2904 RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
2905 indx|0xfe00, 0, &data, 1, HZ / 2);
2906 return data;
2907 }
2908
2909 -
2910 +
2911 u16 read_nic_word(struct net_device *dev, int indx)
2912 {
2913 u16 data;
2914 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2915 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2916 struct usb_device *udev = priv->udev;
2917 -
2918 +
2919 usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
2920 RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
2921 indx|0xff00, 0, &data, 2, HZ / 2);
2922 @@ -249,16 +256,16 @@
2923 u32 read_nic_dword(struct net_device *dev, int indx)
2924 {
2925 u32 data;
2926 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2927 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2928 struct usb_device *udev = priv->udev;
2929 -
2930 +
2931 usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
2932 RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
2933 indx|0xff00, 0, &data, 4, HZ / 2);
2934 return data;
2935 }
2936
2937 -/* this might still called in what was the PHY rtl8185/rtl8187 common code
2938 +/* this might still called in what was the PHY rtl8185/rtl8187 common code
2939 * plans are to possibilty turn it again in one common code...
2940 */
2941 inline void force_pci_posting(struct net_device *dev)
2942 @@ -271,7 +278,12 @@
2943 //void set_nic_txring(struct net_device *dev);
2944 static struct net_device_stats *rtl8180_stats(struct net_device *dev);
2945 void rtl8180_commit(struct net_device *dev);
2946 +
2947 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
2948 +void rtl8180_restart(struct work_struct *work);
2949 +#else
2950 void rtl8180_restart(struct net_device *dev);
2951 +#endif
2952
2953 /****************************************************************************
2954 -----------------------------PROCFS STUFF-------------------------
2955 @@ -284,13 +296,13 @@
2956 int *eof, void *data)
2957 {
2958 struct net_device *dev = data;
2959 -// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2960 -
2961 +// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2962 +
2963 int len = 0;
2964 int i,n;
2965 -
2966 +
2967 int max=0xff;
2968 -
2969 +
2970 /* This dump the current register page */
2971 for(n=0;n<=max;)
2972 {
2973 @@ -307,7 +319,7 @@
2974 len += snprintf(page + len, count - len,"\n");
2975
2976
2977 -
2978 +
2979 *eof = 1;
2980 return len;
2981
2982 @@ -319,16 +331,16 @@
2983 int *eof, void *data)
2984 {
2985 struct net_device *dev = data;
2986 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
2987 -
2988 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
2989 +
2990 int len = 0;
2991 -
2992 +
2993 len += snprintf(page + len, count - len,
2994 "NIC int: %lu\n"
2995 "Total int: %lu\n",
2996 priv->stats.ints,
2997 priv->stats.shints);
2998 -
2999 +
3000 *eof = 1;
3001 return len;
3002 }
3003 @@ -339,10 +351,10 @@
3004 int *eof, void *data)
3005 {
3006 struct net_device *dev = data;
3007 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3008 -
3009 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3010 +
3011 int len = 0;
3012 -
3013 +
3014 len += snprintf(page + len, count - len,
3015 "TX normal priority ok int: %lu\n"
3016 "TX normal priority error int: %lu\n"
3017 @@ -359,7 +371,7 @@
3018 "TX HW queue: %d\n"
3019 "TX lp dropped: %lu\n"
3020 "TX np dropped: %lu\n"
3021 - "TX total data packets %lu\n",
3022 + "TX total data packets %lu\n",
3023 // "TX beacon aborted: %lu\n",
3024 priv->stats.txnpokint,
3025 priv->stats.txnperr,
3026 @@ -379,10 +391,10 @@
3027 priv->stats.txdatapkt
3028 // priv->stats.txbeaconerr
3029 );
3030 -
3031 +
3032 *eof = 1;
3033 return len;
3034 -}
3035 +}
3036
3037
3038
3039 @@ -391,10 +403,10 @@
3040 int *eof, void *data)
3041 {
3042 struct net_device *dev = data;
3043 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3044 -
3045 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3046 +
3047 int len = 0;
3048 -
3049 +
3050 len += snprintf(page + len, count - len,
3051 "RX packets: %lu\n"
3052 "RX urb status error: %lu\n"
3053 @@ -402,35 +414,44 @@
3054 priv->stats.rxok,
3055 priv->stats.rxstaterr,
3056 priv->stats.rxurberr);
3057 -
3058 +
3059 *eof = 1;
3060 return len;
3061 -}
3062 -
3063 +}
3064
3065 +#if WIRELESS_EXT < 17
3066 static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
3067 {
3068 - struct r8180_priv *priv = ieee80211_priv(dev);
3069 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3070
3071 return &priv->wstats;
3072 }
3073 +#endif
3074
3075 void rtl8180_proc_module_init(void)
3076 -{
3077 +{
3078 DMESG("Initializing proc filesystem");
3079 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
3080 rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net);
3081 +#else
3082 + rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, init_net.proc_net);
3083 +#endif
3084 }
3085
3086
3087 void rtl8180_proc_module_remove(void)
3088 {
3089 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
3090 remove_proc_entry(RTL8187_MODULE_NAME, proc_net);
3091 +#else
3092 + remove_proc_entry(RTL8187_MODULE_NAME, init_net.proc_net);
3093 +#endif
3094 }
3095
3096
3097 void rtl8180_proc_remove_one(struct net_device *dev)
3098 {
3099 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3100 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3101 if (priv->dir_dev) {
3102 // remove_proc_entry("stats-hw", priv->dir_dev);
3103 remove_proc_entry("stats-tx", priv->dir_dev);
3104 @@ -447,9 +468,9 @@
3105 void rtl8180_proc_init_one(struct net_device *dev)
3106 {
3107 struct proc_dir_entry *e;
3108 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3109 - priv->dir_dev = create_proc_entry(dev->name,
3110 - S_IFDIR | S_IRUGO | S_IXUGO,
3111 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3112 + priv->dir_dev = create_proc_entry(dev->name,
3113 + S_IFDIR | S_IRUGO | S_IXUGO,
3114 rtl8180_proc);
3115 if (!priv->dir_dev) {
3116 DMESGE("Unable to initialize /proc/net/rtl8187/%s\n",
3117 @@ -459,7 +480,7 @@
3118 #if 0
3119 e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO,
3120 priv->dir_dev, proc_get_stats_hw, dev);
3121 -
3122 +
3123 if (!e) {
3124 DMESGE("Unable to initialize "
3125 "/proc/net/rtl8187/%s/stats-hw\n",
3126 @@ -468,17 +489,17 @@
3127 #endif
3128 e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
3129 priv->dir_dev, proc_get_stats_rx, dev);
3130 -
3131 +
3132 if (!e) {
3133 DMESGE("Unable to initialize "
3134 "/proc/net/rtl8187/%s/stats-rx\n",
3135 dev->name);
3136 }
3137 -
3138 -
3139 +
3140 +
3141 e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
3142 priv->dir_dev, proc_get_stats_tx, dev);
3143 -
3144 +
3145 if (!e) {
3146 DMESGE("Unable to initialize "
3147 "/proc/net/rtl8187/%s/stats-tx\n",
3148 @@ -487,27 +508,27 @@
3149 #if 0
3150 e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO,
3151 priv->dir_dev, proc_get_stats_ieee, dev);
3152 -
3153 +
3154 if (!e) {
3155 DMESGE("Unable to initialize "
3156 "/proc/net/rtl8187/%s/stats-ieee\n",
3157 dev->name);
3158 }
3159 -
3160 -
3161 +
3162 +
3163 e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
3164 priv->dir_dev, proc_get_stats_ap, dev);
3165 -
3166 +
3167 if (!e) {
3168 DMESGE("Unable to initialize "
3169 "/proc/net/rtl8187/%s/stats-ap\n",
3170 dev->name);
3171 }
3172 #endif
3173 -
3174 +
3175 e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
3176 priv->dir_dev, proc_get_registers, dev);
3177 -
3178 +
3179 if (!e) {
3180 DMESGE("Unable to initialize "
3181 "/proc/net/rtl8187/%s/registers\n",
3182 @@ -523,14 +544,14 @@
3183 {
3184 int i;
3185 u8 *buf =(u8*)buffer;
3186 -
3187 +
3188 printk("ASCII BUFFER DUMP (len: %x):\n",len);
3189 -
3190 +
3191 for(i=0;i<len;i++)
3192 printk("%c",buf[i]);
3193 -
3194 +
3195 printk("\nBINARY BUFFER DUMP (len: %x):\n",len);
3196 -
3197 +
3198 for(i=0;i<len;i++)
3199 printk("%x",buf[i]);
3200
3201 @@ -539,17 +560,17 @@
3202
3203 short check_nic_enought_desc(struct net_device *dev, priority_t priority)
3204 {
3205 - struct r8180_priv *priv = ieee80211_priv(dev);
3206 -
3207 - int used = atomic_read((priority == NORM_PRIORITY) ?
3208 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3209 +
3210 + int used = atomic_read((priority == NORM_PRIORITY) ?
3211 &priv->tx_np_pending : &priv->tx_lp_pending);
3212 -
3213 +
3214 return (used < MAX_TX_URB);
3215 }
3216
3217 void tx_timeout(struct net_device *dev)
3218 {
3219 - struct r8180_priv *priv = ieee80211_priv(dev);
3220 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3221 //rtl8180_commit(dev);
3222 schedule_work(&priv->reset_wq);
3223 //DMESG("TXTIMEOUT");
3224 @@ -561,7 +582,20 @@
3225 {
3226 int i;
3227 for(i=0; i<63; i++)
3228 - DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
3229 + DMESG("EEPROM addr %02X : %04X", i, eprom_read(dev,i));
3230 +}
3231 +
3232 +/* this is only for debug */
3233 +void dump_tx_power(struct net_device *dev)
3234 +{
3235 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3236 + int i;
3237 + DMESG("CCK TX-Power (b-mode):");
3238 + for(i=1; i<=14; i++)
3239 + DMESG("Channel %d: %d", i, priv->chtxpwr[i]);
3240 + DMESG("OFDM TX-Power (g-mode):");
3241 + for(i=1; i<=14; i++)
3242 + DMESG("Channel %d: %d", i, priv->chtxpwr_ofdm[i]);
3243 }
3244
3245 /* this is only for debug */
3246 @@ -570,14 +604,14 @@
3247 int i;
3248 int n;
3249 int max=0xff;
3250 -
3251 - DMESG("Dumping NIC register map");
3252 -
3253 +
3254 + DMESG("Dumping NIC register map");
3255 +
3256 for(n=0;n<=max;)
3257 {
3258 - printk( "\nD: %2x> ", n);
3259 + printk( "\nD: %02X> ", n);
3260 for(i=0;i<16 && n<=max;i++,n++)
3261 - printk("%2x ",read_nic_byte(dev,n));
3262 + printk("%02X ",read_nic_byte(dev,n));
3263 }
3264 printk("\n");
3265 }
3266 @@ -589,11 +623,11 @@
3267
3268 void rtl8180_irq_enable(struct net_device *dev)
3269 {
3270 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3271 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3272 //priv->irq_enabled = 1;
3273 /*
3274 - write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
3275 - INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
3276 + write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
3277 + INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
3278 INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
3279 INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
3280 */
3281 @@ -603,7 +637,7 @@
3282
3283 void rtl8180_irq_disable(struct net_device *dev)
3284 {
3285 -// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3286 +// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3287
3288 write_nic_word(dev,INTA_MASK,0);
3289 force_pci_posting(dev);
3290 @@ -625,115 +659,119 @@
3291
3292 void rtl8180_update_msr(struct net_device *dev)
3293 {
3294 - struct r8180_priv *priv = ieee80211_priv(dev);
3295 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3296 u8 msr;
3297 -
3298 +
3299 msr = read_nic_byte(dev, MSR);
3300 msr &= ~ MSR_LINK_MASK;
3301 -
3302 +
3303 /* do not change in link_state != WLAN_LINK_ASSOCIATED.
3304 - * msr must be updated if the state is ASSOCIATING.
3305 + * msr must be updated if the state is ASSOCIATING.
3306 * this is intentional and make sense for ad-hoc and
3307 * master (see the create BSS/IBSS func)
3308 */
3309 - if (priv->ieee80211->state == IEEE80211_LINKED){
3310 -
3311 + if (priv->ieee80211->state == IEEE80211_LINKED){
3312 +
3313 if (priv->ieee80211->iw_mode == IW_MODE_INFRA)
3314 msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT);
3315 else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
3316 msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT);
3317 else if (priv->ieee80211->iw_mode == IW_MODE_MASTER)
3318 msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT);
3319 -
3320 +
3321 }else
3322 msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT);
3323 -
3324 +
3325 write_nic_byte(dev, MSR, msr);
3326 }
3327
3328 void rtl8180_set_chan(struct net_device *dev,short ch)
3329 {
3330 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3331 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3332 u32 tx;
3333 priv->chan=ch;
3334 #if 0
3335 - if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
3336 + if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
3337 priv->ieee80211->iw_mode == IW_MODE_MASTER){
3338 -
3339 - priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
3340 +
3341 + priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
3342 priv->ieee80211->master_chan = ch;
3343 - rtl8180_update_beacon_ch(dev);
3344 + rtl8180_update_beacon_ch(dev);
3345 }
3346 #endif
3347 -
3348 +
3349 /* this hack should avoid frame TX during channel setting*/
3350 tx = read_nic_dword(dev,TX_CONF);
3351 tx &= ~TX_LOOPBACK_MASK;
3352
3353 -#ifndef LOOP_TEST
3354 +#ifndef LOOP_TEST
3355 write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
3356 -
3357 priv->rf_set_chan(dev,priv->chan);
3358 mdelay(10);
3359 - write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
3360 + write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
3361 #endif
3362 }
3363 +
3364 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
3365 void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs);
3366 +#else
3367 +void rtl8187_rx_isr(struct urb *rx_urb);
3368 +#endif
3369
3370
3371 void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb)
3372 {
3373 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3374 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3375 int err;
3376 -
3377 +
3378 // u8 *rx;
3379 -
3380 +
3381 //DMESG("starting RX");
3382 /*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC);
3383 - if(!rx){
3384 + if(!rx){
3385 DMESGE("unable to allocate RX buffer");
3386 return;
3387 }*/
3388 -
3389 +
3390 usb_fill_bulk_urb(rx_urb,priv->udev,
3391 usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer,
3392 RX_URB_SIZE,rtl8187_rx_isr,dev);
3393 - err = usb_submit_urb(rx_urb, GFP_ATOMIC);
3394 + err = usb_submit_urb(rx_urb, GFP_ATOMIC);
3395 if(err && err != -EPERM){
3396 DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status);
3397 -
3398 +
3399 }
3400 -
3401 +
3402 }
3403
3404
3405 void rtl8187_rx_initiate(struct net_device *dev)
3406 {
3407 int i;
3408 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3409 -
3410 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3411 +
3412 if(!priv->rx_urb)
3413 DMESGE("Cannot intiate RX urb mechanism");
3414 - for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
3415 + for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
3416 rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]);
3417 -
3418 +
3419 }
3420
3421 void rtl8187_set_rxconf(struct net_device *dev)
3422 {
3423 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3424 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3425 u32 rxconf;
3426 -
3427 +
3428 rxconf=read_nic_dword(dev,RX_CONF);
3429 rxconf = rxconf &~ MAC_FILTER_MASK;
3430 rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT);
3431 rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
3432 rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
3433 rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
3434 - rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
3435 + rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
3436
3437 if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
3438 -
3439 +
3440 if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
3441 dev->flags & IFF_PROMISC){
3442 rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
3443 @@ -741,40 +779,40 @@
3444 rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT);
3445 rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
3446 }
3447 -
3448 +
3449 /*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){
3450 rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
3451 rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
3452 }*/
3453 -
3454 +
3455 if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
3456 rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
3457 rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT);
3458 }
3459 -
3460 +
3461 if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
3462 rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
3463 -
3464 -
3465 +
3466 +
3467 rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
3468 rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
3469 -
3470 -
3471 +
3472 +
3473 rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
3474 -
3475 +
3476 rxconf = rxconf &~ MAX_RX_DMA_MASK;
3477 rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
3478 -
3479 +
3480 rxconf = rxconf | RCR_ONLYERLPKT;
3481 -
3482 +
3483 // rxconf = rxconf &~ RCR_CS_MASK;
3484 // rxconf = rxconf | (1<<RCR_CS_SHIFT);
3485
3486 - write_nic_dword(dev, RX_CONF, rxconf);
3487 -
3488 + write_nic_dword(dev, RX_CONF, rxconf);
3489 +
3490 // V rtl suggested V //
3491 // write_nic_dword(dev, RX_CONF, 0x901ce70e);
3492 -
3493 +
3494 //fix_rx_fifo(dev);
3495 // //set_nic_rxring(dev);
3496 #ifdef DEBUG_RX
3497 @@ -785,23 +823,23 @@
3498 void rtl8180_rx_enable(struct net_device *dev)
3499 {
3500 u8 cmd;
3501 -
3502 -
3503 +
3504 +
3505 rtl8187_rx_initiate(dev);
3506
3507 - rtl8187_set_rxconf(dev);
3508 + rtl8187_set_rxconf(dev);
3509
3510 cmd=read_nic_byte(dev,CMD);
3511 write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
3512 #if 0
3513 - /* In rtl8139 driver seems that DMA threshold has to be written
3514 - * after enabling RX, so we rewrite RX_CONFIG register
3515 + /* In rtl8139 driver seems that DMA threshold has to be written
3516 + * after enabling RX, so we rewrite RX_CONFIG register
3517 */
3518 //mdelay(100);
3519 - write_nic_dword(dev, RX_CONF, rxconf);
3520 -
3521 + write_nic_dword(dev, RX_CONF, rxconf);
3522 +
3523 #endif
3524 -
3525 +
3526 }
3527
3528
3529 @@ -810,37 +848,37 @@
3530 u8 cmd;
3531 u8 byte;
3532 u32 txconf;
3533 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3534 -
3535 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3536 +
3537 byte = read_nic_byte(dev,CW_CONF);
3538 byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
3539 byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
3540 write_nic_byte(dev, CW_CONF, byte);
3541 -
3542 +
3543 byte = read_nic_byte(dev, TX_AGC_CTL);
3544 byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
3545 byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
3546 byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT);
3547 write_nic_byte(dev, TX_AGC_CTL, byte);
3548 -
3549 +
3550 txconf= read_nic_dword(dev,TX_CONF);
3551 -
3552 +
3553 #if 0
3554 if(priv->card_8185){
3555 -
3556 +
3557 txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
3558 -
3559 +
3560 }else{
3561 -
3562 - if(priv->ieee80211->hw_seq)
3563 +
3564 + if(priv->ieee80211->hw_seq)
3565 txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
3566 - else
3567 + else
3568 txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
3569 }
3570 #endif
3571
3572 txconf = txconf &~ TX_LOOPBACK_MASK;
3573 -
3574 +
3575 #ifndef LOOP_TEST
3576 txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
3577 #else
3578 @@ -848,23 +886,26 @@
3579 #endif
3580 txconf = txconf &~ TCR_DPRETRY_MASK;
3581 txconf = txconf &~ TCR_RTSRETRY_MASK;
3582 -
3583 - txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
3584 - txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
3585 -
3586 +
3587 + if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
3588 + {
3589 + txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
3590 + txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
3591 + }
3592 +
3593 txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
3594 -
3595 +
3596 txconf = txconf &~ TCR_MXDMA_MASK;
3597 txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
3598 -
3599 +
3600 txconf = txconf | TCR_CWMIN;
3601 txconf = txconf | TCR_DISCW;
3602 txconf = txconf &~ TCR_SWPLCPLEN;
3603 -
3604 +
3605 txconf=txconf | (1<<TX_NOICV_SHIFT);
3606 -
3607 +
3608 write_nic_dword(dev,TX_CONF,txconf);
3609 -
3610 +
3611 // V RTL suggested V //
3612 // write_nic_dword(dev,TX_CONF,0x00e00707);
3613
3614 @@ -872,9 +913,9 @@
3615 #ifdef DEBUG_TX
3616 DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF));
3617 #endif
3618 -
3619 +
3620 cmd=read_nic_byte(dev,CMD);
3621 - write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
3622 + write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
3623
3624 // mdelay(100);
3625 //write_nic_dword(dev,TX_CONF,txconf);
3626 @@ -889,18 +930,18 @@
3627 #if 0
3628 void rtl8180_beacon_tx_enable(struct net_device *dev)
3629 {
3630 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3631 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3632 priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
3633 rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
3634 - write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
3635 + write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
3636 rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
3637 }
3638
3639
3640 void rtl8180_
3641 -_disable(struct net_device *dev)
3642 +_disable(struct net_device *dev)
3643 {
3644 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3645 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3646 priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
3647 rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
3648 write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
3649 @@ -914,8 +955,8 @@
3650 {
3651 u8 cmd;
3652 int i;
3653 - struct r8180_priv *priv = ieee80211_priv(dev);
3654 -
3655 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3656 +
3657 cmd=read_nic_byte(dev,CMD);
3658 write_nic_byte(dev, CMD, cmd &~ \
3659 ((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
3660 @@ -926,9 +967,9 @@
3661 usb_kill_urb(priv->rx_urb[i]);
3662 }
3663 /*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT))
3664 - udelay(10);
3665 + udelay(10);
3666 */
3667 -
3668 +
3669 // if(!priv->rx_skb_complete)
3670 // dev_kfree_skb_any(priv->rx_skb);
3671 }
3672 @@ -939,14 +980,14 @@
3673 #if 0
3674 int i;
3675 u32 *tmp;
3676 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3677 -
3678 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3679 +
3680 priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
3681 - sizeof(u32)*8*count,
3682 + sizeof(u32)*8*count,
3683 &priv->txbeaconringdma);
3684 if (!priv->txbeaconring) return -1;
3685 for (tmp=priv->txbeaconring,i=0;i<count;i++){
3686 - *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
3687 + *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
3688 /*
3689 *(tmp+2) = (u32)dma_tmp;
3690 *(tmp+3) = bufsize;
3691 @@ -955,7 +996,7 @@
3692 *(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
3693 else
3694 *(tmp+4) = (u32)priv->txbeaconringdma;
3695 -
3696 +
3697 tmp=tmp+8;
3698 }
3699 #endif
3700 @@ -965,15 +1006,15 @@
3701
3702 void rtl8180_reset(struct net_device *dev)
3703 {
3704 -
3705 +
3706 u8 cr;
3707 -
3708 +
3709 /* make sure the analog power is on before
3710 * reset, otherwise reset may fail
3711 */
3712 rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
3713 rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
3714 -
3715 +
3716 rtl8180_irq_disable(dev);
3717
3718 mdelay(200);
3719 @@ -981,19 +1022,19 @@
3720 write_nic_byte_E(dev,0x18,0x11);
3721 write_nic_byte_E(dev,0x18,0x00);
3722 mdelay(200);
3723 -
3724 +
3725 cr=read_nic_byte(dev,CMD);
3726 cr = cr & 2;
3727 cr = cr | (1<<CMD_RST_SHIFT);
3728 write_nic_byte(dev,CMD,cr);
3729 -
3730 +
3731 force_pci_posting(dev);
3732 -
3733 +
3734 mdelay(200);
3735 -
3736 - if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
3737 +
3738 + if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
3739 DMESGW("Card reset timeout!");
3740 - else
3741 + else
3742 DMESG("Card successfully reset");
3743
3744 rtl8180_set_mode(dev,EPROM_CMD_LOAD);
3745 @@ -1005,13 +1046,13 @@
3746 */
3747 rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
3748 rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
3749 -
3750 +
3751 }
3752
3753 inline u16 ieeerate2rtlrate(int rate)
3754 {
3755 switch(rate){
3756 - case 10:
3757 + case 10:
3758 return 0;
3759 case 20:
3760 return 1;
3761 @@ -1037,32 +1078,42 @@
3762 return 11;
3763 default:
3764 return 3;
3765 -
3766 +
3767 }
3768 }
3769 static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540};
3770 inline u16 rtl8180_rate2rate(short rate)
3771 {
3772 if (rate >11) return 0;
3773 - return rtl_rate[rate];
3774 + return rtl_rate[rate];
3775 +}
3776 +
3777 +inline u8 rtl8180_IsWirelessBMode(u16 rate)
3778 +{
3779 + if( ((rate <= 110) && (rate != 60) && (rate != 90)) || (rate == 220) )
3780 + return 1;
3781 + else return 0;
3782 }
3783 -
3784
3785 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
3786 void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
3787 +#else
3788 +void rtl8187_rx_isr(struct urb *rx_urb)
3789 +#endif
3790 {
3791 struct net_device *dev = (struct net_device*)rx_urb->context;
3792 - struct r8180_priv *priv = ieee80211_priv(dev);
3793 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3794
3795 priv->rxurb_task = rx_urb;
3796 // DMESGW("David: Rx tasklet start!");
3797 - tasklet_schedule(&priv->irq_rx_tasklet);
3798 + tasklet_schedule(&priv->irq_rx_tasklet);
3799 // DMESGW("=David: Rx tasklet finish!");
3800 }
3801
3802 #if 0
3803 void rtl8180_tx_queues_stop(struct net_device *dev)
3804 {
3805 - //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3806 + //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3807 u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
3808 dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
3809 dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
3810 @@ -1078,7 +1129,7 @@
3811 {
3812 //FIXME !!
3813 #if 0
3814 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3815 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3816 priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
3817 rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
3818 write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
3819 @@ -1091,7 +1142,7 @@
3820 {
3821 // FIXME !!
3822 #if 0
3823 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3824 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3825 priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
3826 rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
3827 write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
3828 @@ -1105,14 +1156,19 @@
3829 */
3830 void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
3831 {
3832 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3833 -
3834 - short morefrag = 0;
3835 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3836 +
3837 + short morefrag = 0;
3838 unsigned long flags;
3839 struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
3840
3841 - if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
3842 - morefrag = 1;
3843 + if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->ieee80211->raw_tx != 1)
3844 + {
3845 + if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
3846 + {
3847 + morefrag = 1;
3848 + }
3849 + }
3850 // DMESG("%x %x", h->frame_ctl, h->seq_ctl);
3851 /*
3852 * This function doesn't require lock because we make
3853 @@ -1121,24 +1177,29 @@
3854 * the ieee stack, or from the try_wake_queue (again trought
3855 * the ieee stack.
3856 */
3857 - spin_lock_irqsave(&priv->tx_lock,flags);
3858 -
3859 - //DMESG("TX");
3860 - if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
3861 - DMESG("Error: no TX slot ");
3862 - ieee80211_stop_queue(priv->ieee80211);
3863 - }
3864 -
3865 - rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
3866 - ieeerate2rtlrate(rate));
3867 -
3868 - priv->stats.txdatapkt++;
3869 -
3870 - if (!check_nic_enought_desc(dev, LOW_PRIORITY))
3871 - ieee80211_stop_queue(priv->ieee80211);
3872 -
3873 - spin_unlock_irqrestore(&priv->tx_lock,flags);
3874 -
3875 +
3876 + if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->fasttx == 0)
3877 + {
3878 + spin_lock_irqsave(&priv->tx_lock,flags);
3879 + //DMESG("TX");
3880 + if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
3881 + DMESG("Error: no TX slot ");
3882 + ieee80211_stop_queue_rtl7(priv->ieee80211);
3883 + }
3884 + rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
3885 + ieeerate2rtlrate(rate));
3886 +
3887 + priv->stats.txdatapkt++;
3888 +
3889 + if (!check_nic_enought_desc(dev, LOW_PRIORITY))
3890 + ieee80211_stop_queue_rtl7(priv->ieee80211);
3891 + spin_unlock_irqrestore(&priv->tx_lock,flags);
3892 + }
3893 + else
3894 + {
3895 + rtl8180_tx_fast(dev, (u32*)skb->data, skb->len, ieeerate2rtlrate(rate));
3896 + }
3897 +
3898 }
3899 #if 0
3900 /* This is a rough attempt to TX a frame
3901 @@ -1148,12 +1209,12 @@
3902 */
3903 int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
3904 {
3905 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
3906 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
3907 int ret;
3908 unsigned long flags;
3909 -
3910 +
3911 spin_lock_irqsave(&priv->tx_lock,flags);
3912 -
3913 +
3914 ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE);
3915 /*
3916 int i;
3917 @@ -1163,9 +1224,9 @@
3918 */
3919 priv->ieee80211->stats.tx_bytes+=skb->len;
3920 priv->ieee80211->stats.tx_packets++;
3921 -
3922 - spin_unlock_irqrestore(&priv->tx_lock,flags);
3923 -
3924 +
3925 + spin_unlock_irqrestore(&priv->tx_lock,flags);
3926 +
3927 dev_kfree_skb_any(skb);
3928 return ret;
3929 }
3930 @@ -1178,7 +1239,7 @@
3931 u16 duration;
3932 u16 drift;
3933 *ext=0;
3934 -
3935 +
3936 switch(rate){
3937 case 0://1mbps
3938 *ext=0;
3939 @@ -1187,7 +1248,7 @@
3940 if(drift ==0 ) break;
3941 duration++;
3942 break;
3943 -
3944 +
3945 case 1://2mbps
3946 *ext=0;
3947 duration = ((len+4)<<4) /0x4;
3948 @@ -1195,40 +1256,44 @@
3949 if(drift ==0 ) break;
3950 duration++;
3951 break;
3952 -
3953 +
3954 case 2: //5.5mbps
3955 *ext=0;
3956 duration = ((len+4)<<4) /0xb;
3957 drift = ((len+4)<<4) % 0xb;
3958 - if(drift ==0 )
3959 + if(drift ==0 )
3960 break;
3961 duration++;
3962 break;
3963 -
3964 +
3965 default:
3966 - case 3://11mbps
3967 + case 3://11mbps
3968 *ext=0;
3969 duration = ((len+4)<<4) /0x16;
3970 drift = ((len+4)<<4) % 0x16;
3971 - if(drift ==0 )
3972 + if(drift ==0 )
3973 break;
3974 duration++;
3975 - if(drift > 6)
3976 + if(drift > 6)
3977 break;
3978 *ext=1;
3979 break;
3980 }
3981 -
3982 +
3983 return duration;
3984 }
3985 #endif
3986
3987 void rtl8180_try_wake_queue(struct net_device *dev, int pri);
3988
3989 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
3990 void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs)
3991 +#else
3992 +void rtl8187_lptx_isr(struct urb *tx_urb)
3993 +#endif
3994 {
3995 struct net_device *dev = (struct net_device*)tx_urb->context;
3996 - struct r8180_priv *priv = ieee80211_priv(dev);
3997 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
3998 if(tx_urb->status == 0)
3999 priv->stats.txlpokint++;
4000 else
4001 @@ -1239,6 +1304,15 @@
4002 rtl8180_try_wake_queue(dev,LOW_PRIORITY);
4003 }
4004
4005 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
4006 +void rtl8187_lptx_isr_fast(struct urb *tx_urb, struct pt_regs *regs)
4007 +#else
4008 +void rtl8187_lptx_isr_fast(struct urb *tx_urb)
4009 +#endif
4010 +{
4011 + kfree(tx_urb->transfer_buffer);
4012 + usb_free_urb(tx_urb);
4013 +}
4014
4015 void rtl8187_beacon_stop(struct net_device *dev)
4016 {
4017 @@ -1249,55 +1323,55 @@
4018 if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) ||
4019 (msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){
4020 write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE);
4021 - write_nic_byte(dev, MSR, msr);
4022 + write_nic_byte(dev, MSR, msr);
4023 }
4024 -
4025 -
4026 +
4027 +
4028 }
4029
4030
4031 void rtl8187_net_update(struct net_device *dev)
4032 {
4033
4034 - struct r8180_priv *priv = ieee80211_priv(dev);
4035 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
4036 struct ieee80211_network *net;
4037 net = & priv->ieee80211->current_network;
4038 -
4039 -
4040 +
4041 +
4042 write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]);
4043 write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]);
4044 //for(i=0;i<ETH_ALEN;i++)
4045 // write_nic_byte(dev,BSSID+i,net->bssid[i]);
4046
4047 rtl8180_update_msr(dev);
4048 -
4049 +
4050 // rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
4051 write_nic_word(dev, AtimWnd, 2);
4052 - write_nic_word(dev, AtimtrItv, 100);
4053 + write_nic_word(dev, AtimtrItv, 100);
4054 write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval);
4055 write_nic_word(dev, BcnIntTime, 100);
4056 -
4057 +
4058
4059 }
4060
4061 void rtl8187_beacon_tx(struct net_device *dev)
4062 {
4063
4064 - struct r8180_priv *priv = ieee80211_priv(dev);
4065 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
4066 struct sk_buff *skb;
4067 int i = 0;
4068 -
4069 +
4070 rtl8187_net_update(dev);
4071 -
4072 - skb = ieee80211_get_beacon(priv->ieee80211);
4073 -
4074 -
4075 - if(!skb){
4076 +
4077 + skb = ieee80211_get_beacon_rtl7(priv->ieee80211);
4078 +
4079 +
4080 + if(!skb){
4081 DMESG("not enought memory for allocating beacon");
4082 return;
4083 }
4084 -
4085 -#if 0
4086 +
4087 +#if 0
4088 while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){
4089 msleep_interruptible_rtl(HZ/2);
4090 if(i++ > 20){
4091 @@ -1307,7 +1381,7 @@
4092 }
4093 #endif
4094 write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7));
4095 -
4096 +
4097 i=0;
4098 //while(!read_nic_byte(dev,BQREQ & (1<<7)))
4099 while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 )
4100 @@ -1318,16 +1392,20 @@
4101 return ;
4102 }
4103 }
4104 -
4105 +
4106 rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY,
4107 0, priv->ieee80211->basic_rate);
4108 -
4109 +
4110 }
4111
4112 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
4113 void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs)
4114 +#else
4115 +void rtl8187_nptx_isr(struct urb *tx_urb)
4116 +#endif
4117 {
4118 struct net_device *dev = (struct net_device*)tx_urb->context;
4119 - struct r8180_priv *priv = ieee80211_priv(dev);
4120 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
4121 if(tx_urb->status == 0)
4122 priv->stats.txnpokint++;
4123 else
4124 @@ -1339,10 +1417,10 @@
4125 }
4126
4127
4128 -/* This function do the real dirty work: it sends a TX command
4129 - * descriptor plus data URB
4130 +/* This function do the real dirty work: it sends a TX command
4131 + * descriptor plus data URB
4132 */
4133 -
4134 +
4135 short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority,
4136 short morefrag, short rate)
4137 {
4138 @@ -1352,12 +1430,12 @@
4139 int pend ;
4140 int status;
4141 struct urb *tx_urb;
4142 - int urb_len;
4143 - struct r8180_priv *priv = ieee80211_priv(dev);
4144 + int urb_len;
4145 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
4146 // int rate = ieeerate2rtlrate(priv->ieee80211->rate);
4147
4148 - pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
4149 - /* we are locked here so the two atomic_read and inc are executed without interleaves */
4150 + pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
4151 + /* we are locked here so the two atomic_read and inc are executed without interleaves */
4152 if( pend > MAX_TX_URB){
4153 if(priority == NORM_PRIORITY)
4154 priv->stats.txnpdrop++;
4155 @@ -1365,52 +1443,38 @@
4156 priv->stats.txlpdrop++;
4157 return -1;
4158 }
4159 -
4160 -
4161 +
4162 //tx = kmalloc((len + 4*3), GFP_ATOMIC);
4163 urb_len = len + 4*3;
4164 if((0 == urb_len%64)||(0 == urb_len%512)) {
4165 - urb_len += 1;
4166 + urb_len += 1;
4167 }
4168 tx = kmalloc(urb_len, GFP_ATOMIC);
4169 if(!tx) return -ENOMEM;
4170 - //printk(KERN_WARNING "urb_len = %d\n", urb_len);
4171 + //printk(KERN_WARNING "urb_len = %d\n", urb_len);
4172 tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
4173 -
4174 +
4175 if(!tx_urb){
4176 -
4177 +
4178 kfree(tx);
4179 return -ENOMEM;
4180 }
4181 -
4182 +
4183 memcpy(tx+3,txbuf,len);
4184 tx[0] = 0;
4185 tx[0] |= len & 0xfff;
4186 tx[0] |= (1<<15);
4187 -
4188 -// if(priv->shortpre)
4189 -// tx[0] |= (1<<16);
4190 -
4191 - //if(len > priv->rts_threshold){
4192 -// tx[0] |= (1<<23); //ENABLE RTS
4193 -// tx[0] |= (1<<18); //ENABLE CTS
4194 - //}
4195 +
4196 if(morefrag) tx[0] |= (1<<17);
4197 tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
4198 tx[0] |= (rate << 24);
4199 tx[1] = 0;
4200 -
4201 -// duration = rtl8180_len2duration(len,
4202 -// rate,&ext);
4203 -// tx[1] |= (duration & 0x7fff) <<16;
4204 -// if(ext) tx[1] |= (1<<31);
4205
4206 -
4207 // tx[2] = 0x303020;
4208 tx[2] = 3; // CW min
4209 tx[2] |= (7<<4); //CW max
4210 tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim
4211 -
4212 +
4213 // printk("%x\n%x\n",tx[0],tx[1]);
4214
4215 #ifdef DUMP_TX
4216 @@ -1421,7 +1485,7 @@
4217 printk("---------------\n");
4218 #endif
4219
4220 -
4221 +
4222 /* FIXME check what EP is for low/norm PRI */
4223 usb_fill_bulk_urb(tx_urb,priv->udev,
4224 usb_sndbulkpipe(priv->udev,(priority == LOW_PRIORITY) ? 2:3), tx,
4225 @@ -1438,54 +1502,97 @@
4226 }
4227 }
4228
4229 -
4230 +/* This function do the real dirty work: it sends a TX command
4231 + * descriptor plus data URB (fast)
4232 + */
4233 +
4234 +short rtl8180_tx_fast(struct net_device *dev, u32* txbuf, int len, short rate)
4235 +{
4236 + u32 *tx;
4237 + int status;
4238 + struct urb *tx_urb;
4239 + int urb_len;
4240 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
4241 +
4242 + urb_len = len + 4*3;
4243 + if((0 == urb_len%64)||(0 == urb_len%512)) {
4244 + urb_len += 1;
4245 + }
4246 + tx = kmalloc(urb_len, GFP_ATOMIC);
4247 + if(!tx) return -ENOMEM;
4248 +
4249 + tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
4250 +
4251 + if(!tx_urb){
4252 + kfree(tx);
4253 + return -ENOMEM;
4254 + }
4255 +
4256 + memcpy(tx+3,txbuf,len);
4257 + tx[0] = (len & 0xfff) + 0x8000;
4258 + tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
4259 + tx[0] |= (rate << 24);
4260 + tx[1] = 0;
4261 + tx[2] = 2931;
4262 +
4263 + /* FIXME check what EP is for low/norm PRI */
4264 + usb_fill_bulk_urb(tx_urb,priv->udev,
4265 + usb_sndbulkpipe(priv->udev, 2), tx, urb_len, rtl8187_lptx_isr_fast, dev);
4266 + status = usb_submit_urb(tx_urb, GFP_ATOMIC);
4267 + if (!status){
4268 + return 0;
4269 + }else{
4270 + return -1;
4271 + }
4272 +}
4273 +
4274
4275 void rtl8180_irq_rx_tasklet(struct r8180_priv * priv);
4276
4277
4278 short rtl8187_usb_initendpoints(struct net_device *dev)
4279 {
4280 - struct r8180_priv *priv = ieee80211_priv(dev);
4281 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
4282 int i;
4283 -
4284 +
4285 priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
4286 -
4287 +
4288 for(i=0;i<MAX_RX_URB;i++){
4289 priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL);
4290 - if(!priv->rx_urb[i])
4291 + if(!priv->rx_urb[i])
4292 goto destroy;
4293 -
4294 +
4295 priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL);
4296 - if(!priv->rx_urb[i]->transfer_buffer)
4297 + if(!priv->rx_urb[i]->transfer_buffer)
4298 goto destroy1;
4299 -
4300 +
4301 priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE;
4302 }
4303 -
4304 +
4305 return 0;
4306 -
4307 +
4308 destroy1:
4309 usb_free_urb(priv->rx_urb[i]);
4310 -
4311 +
4312 destroy:
4313 while (--i >= 0){
4314 kfree(priv->rx_urb[i]->transfer_buffer);
4315 usb_free_urb(priv->rx_urb[i]);
4316 }
4317 -
4318 +
4319 kfree(priv->rx_urb);
4320 -
4321 +
4322 priv->rx_urb = NULL;
4323 DMESGE("Endpoint Alloc Failure");
4324 return -ENOMEM;
4325 -
4326 +
4327 }
4328
4329 void rtl8187_usb_deleteendpoints(struct net_device *dev)
4330 {
4331 - struct r8180_priv *priv = ieee80211_priv(dev);
4332 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
4333 int i;
4334 -
4335 +
4336 if(priv->rx_urb){
4337 for(i=0;i<MAX_RX_URB;i++){
4338 usb_kill_urb(priv->rx_urb[i]);
4339 @@ -1494,9 +1601,9 @@
4340 }
4341 kfree(priv->rx_urb);
4342 priv->rx_urb = NULL;
4343 -
4344 +
4345 }
4346 -
4347 +
4348 }
4349
4350
4351 @@ -1505,16 +1612,16 @@
4352 int i;
4353 u16 word;
4354 int basic_rate,min_rr_rate,max_rr_rate;
4355 -
4356 -// struct r8180_priv *priv = ieee80211_priv(dev);
4357 -
4358 - //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
4359 +
4360 +// struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
4361 +
4362 + //if (ieee80211_is_54g_rtl7(priv->ieee80211->current_network) &&
4363 // priv->ieee80211->state == IEEE80211_LINKED){
4364 basic_rate = ieeerate2rtlrate(240);
4365 min_rr_rate = ieeerate2rtlrate(60);
4366 max_rr_rate = ieeerate2rtlrate(240);
4367 -
4368 -//
4369 +
4370 +//
4371 // }else{
4372 // basic_rate = ieeerate2rtlrate(20);
4373 // min_rr_rate = ieeerate2rtlrate(10);
4374 @@ -1526,21 +1633,21 @@
4375
4376 word = read_nic_word(dev, BRSR);
4377 word &= ~BRSR_MBR_8185;
4378 -
4379 +
4380
4381 for(i=0;i<=basic_rate;i++)
4382 word |= (1<<i);
4383
4384 write_nic_word(dev, BRSR, word);
4385 - //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
4386 + DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
4387 }
4388
4389
4390 void rtl8187_link_change(struct net_device *dev)
4391 {
4392 // int i;
4393 -
4394 - struct r8180_priv *priv = ieee80211_priv(dev);
4395 +
4396 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
4397 //write_nic_word(dev, BintrItv, net->beacon_interval);
4398 rtl8187_net_update(dev);
4399 /*update timing params*/
4400 @@ -1553,24 +1660,24 @@
4401
4402 short rtl8180_init(struct net_device *dev)
4403 {
4404 -
4405 - struct r8180_priv *priv = ieee80211_priv(dev);
4406 +
4407 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
4408 int i, j;
4409 u16 word;
4410 - int ch;
4411 + int ch, chans;
4412 //u16 version;
4413 - //u8 hw_version;
4414 - //u8 config3;
4415 -
4416 + u8 hw_version;
4417 + u8 config3;
4418 +
4419 //FIXME: these constants are placed in a bad pleace.
4420
4421 // priv->txbuffsize = 1024;
4422 // priv->txringcount = 32;
4423 // priv->rxbuffersize = 1024;
4424 -// priv->rxringcount = 32;
4425 +// priv->rxringcount = 32;
4426 // priv->txbeaconcount = 3;
4427 // priv->rx_skb_complete = 1;
4428 - //priv->txnp_pending.ispending=0;
4429 + //priv->txnp_pending.ispending=0;
4430 /* ^^ the SKB does not containt a partial RXed
4431 * packet (is empty)
4432 */
4433 @@ -1580,15 +1687,24 @@
4434 return -1;
4435 }
4436 ch=channels;
4437 + chans=0;
4438 + for (i=1; i<=14; i++) {
4439 + if( (u8)(ch & 0x01) ) chans++;
4440 + ch >>= 1;
4441 + }
4442 + DMESG("Enabling %d channels.", chans);
4443 + ch=channels;
4444 // set channels 1..14 allowed in given locale
4445 for (i=1; i<=14; i++) {
4446 (priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
4447 ch >>= 1;
4448 }
4449 //memcpy(priv->stats,0,sizeof(struct Stats));
4450 -
4451 +
4452 //priv->irq_enabled=0;
4453 -
4454 +
4455 + priv->dev = dev;
4456 +
4457 // priv->stats.rxdmafail=0;
4458 priv->stats.txrdu=0;
4459 // priv->stats.rxrdu=0;
4460 @@ -1612,33 +1728,37 @@
4461 // priv->stats.txbeaconerr=0;
4462 priv->stats.txlperr=0;
4463 priv->stats.txlpokint=0;
4464 -
4465 +
4466 priv->ieee80211->iw_mode = IW_MODE_INFRA;
4467 -
4468 +
4469 priv->retry_rts = DEFAULT_RETRY_RTS;
4470 priv->retry_data = DEFAULT_RETRY_DATA;
4471 priv->ieee80211->rate = 110; //11 mbps
4472 priv->ieee80211->short_slot = 1;
4473 - priv->ieee80211->mode = IEEE_G;
4474 + priv->ieee80211->mode = IEEE_G|IEEE_B;
4475 priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
4476 spin_lock_init(&priv->tx_lock);
4477 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
4478 INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
4479 +#else
4480 + INIT_WORK(&priv->reset_wq, rtl8180_restart);
4481 +#endif
4482 sema_init(&priv->wx_sem,1);
4483 tasklet_init(&priv->irq_rx_tasklet,
4484 (void(*)(unsigned long))rtl8180_irq_rx_tasklet,
4485 (unsigned long)priv);
4486
4487 - //priv->ieee80211->func =
4488 + //priv->ieee80211->func =
4489 // kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL);
4490 //memset(priv->ieee80211->func, 0,
4491 // sizeof(struct ieee80211_helper_functions));
4492 - priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
4493 + priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
4494 priv->ieee80211->iw_mode = IW_MODE_INFRA;
4495 - priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
4496 - IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
4497 + priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
4498 + IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
4499 IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE |
4500 /*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE;
4501 -
4502 +
4503 priv->ieee80211->active_scan = 1;
4504 priv->ieee80211->rate = 110; //11 mbps
4505 priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION;
4506 @@ -1655,51 +1775,51 @@
4507 priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume;
4508 //priv->ieee80211->start_send_beacons = NULL;
4509 //priv->ieee80211->stop_send_beacons = NULL;
4510 -
4511 +
4512 priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
4513 -
4514 +
4515 priv->card_8185 = 2;
4516 priv->phy_ver = 2;
4517 priv->card_type = USB;
4518 -
4519 +
4520 #if 0
4521 hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
4522 -
4523 +
4524 switch (hw_version){
4525 case HW_VERID_R8185_ABC:
4526 - DMESG("MAC controller is a RTL8185 b/g");
4527 + DMESG("MAC controller is a RTL8185 b/g");
4528 priv->card_8185 = 1;
4529 /* you should not find a card with 8225 PHY ver < C*/
4530 priv->phy_ver = 2;
4531 break;
4532 -
4533 +
4534 case HW_VERID_R8185_D:
4535 - DMESG("MAC controller is a RTL8185 b/g (V. D)");
4536 + DMESG("MAC controller is a RTL8185 b/g (V. D)");
4537 priv->card_8185 = 2;
4538 /* you should not find a card with 8225 PHY ver < C*/
4539 priv->phy_ver = 2;
4540 break;
4541 -
4542 +
4543 case HW_VERID_R8180_ABCD:
4544 DMESG("MAC controller is a RTL8180");
4545 priv->card_8185 = 0;
4546 break;
4547 -
4548 +
4549 case HW_VERID_R8180_F:
4550 DMESG("MAC controller is a RTL8180 (v. F)");
4551 priv->card_8185 = 0;
4552 break;
4553 -
4554 +
4555 default:
4556 DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version);
4557 priv->card_8185 = 0;
4558 break;
4559 }
4560 -
4561 -
4562 +
4563 +
4564 /* you should not found any 8185 Ver B Card */
4565 priv->card_8185_Bversion = 0;
4566 -
4567 +
4568 config3 = read_nic_byte(dev, CONFIG3);
4569 if(config3 & 0x8){
4570 priv->card_type = CARDBUS;
4571 @@ -1715,13 +1835,19 @@
4572 #endif
4573 priv->enable_gpio0 = 0;
4574
4575 -
4576 +
4577 + hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
4578 + config3 = read_nic_byte(dev, CONFIG3);
4579 +
4580 + DMESG("MAC chip version: %02X", hw_version);
4581 + DMESG("Card type: %02X", config3);
4582 +
4583 /* commented out just because we already do
4584 this when resetting the card
4585 andrea 20050924
4586 */
4587 #if 0
4588 -
4589 +
4590 u8 txcr, txreg50;
4591 u32 txreg54, txreg60;
4592
4593 @@ -1757,8 +1883,8 @@
4594 // DMESG("<<txcr:%x>>", txcr);
4595
4596 #endif
4597 -
4598 - /*the eeprom type is stored in RCR register bit #6 */
4599 +
4600 + /*the eeprom type is stored in RCR register bit #6 */
4601 if (RCR_9356SEL & read_nic_dword(dev, RCR)){
4602 priv->epromtype=EPROM_93c56;
4603 DMESG("Reported EEPROM chip is a 93c56 (2Kbit)");
4604 @@ -1766,58 +1892,73 @@
4605 priv->epromtype=EPROM_93c46;
4606 DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
4607 }
4608 -
4609 +
4610 dev->get_stats = rtl8180_stats;
4611 -
4612 +
4613 dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
4614 dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
4615 dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff;
4616 dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8;
4617 dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff;
4618 dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8;
4619 -
4620 +
4621 DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr));
4622 -
4623 +
4624 for(i=1,j=0; i<6; i+=2,j++){
4625 -
4626 +
4627 word = eprom_read(dev,EPROM_TXPW0 + j);
4628 priv->chtxpwr[i]=word & 0xf;
4629 priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4;
4630 priv->chtxpwr[i+1]=(word & 0xf00)>>8;
4631 priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12;
4632 }
4633 -
4634 +
4635 for(i=1,j=0; i<4; i+=2,j++){
4636 -
4637 +
4638 word = eprom_read(dev,EPROM_TXPW1 + j);
4639 priv->chtxpwr[i+6]=word & 0xf;
4640 priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4;
4641 priv->chtxpwr[i+6+1]=(word & 0xf00)>>8;
4642 priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12;
4643 }
4644 -
4645 +
4646 for(i=1,j=0; i<4; i+=2,j++){
4647 -
4648 +
4649 word = eprom_read(dev,EPROM_TXPW2 + j);
4650 priv->chtxpwr[i+6+4]=word & 0xf;
4651 priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4;
4652 priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8;
4653 priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12;
4654 }
4655 -
4656 -
4657 +
4658 +
4659 priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
4660 -
4661 +
4662 +#ifdef DEBUG_TX_POWER
4663 + dump_tx_power(dev);
4664 +#endif
4665 +
4666 + DMESG("RF Chip ID: %02X", priv->rf_chip);
4667 +
4668 word = eprom_read(dev,EPROM_TXPW_BASE);
4669 priv->cck_txpwr_base = word & 0xf;
4670 priv->ofdm_txpwr_base = (word>>4) & 0xf;
4671 -
4672 +
4673 + priv->txpwr_max = 0;
4674 + for(i=1; i<15; i++)
4675 + {
4676 + if(priv->chtxpwr[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr[i];
4677 + if(priv->chtxpwr_ofdm[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr_ofdm[i];
4678 + priv->chtxpwr_orig[i] = priv->chtxpwr[i];
4679 + priv->chtxpwr_ofdm_orig[i] = priv->chtxpwr_ofdm[i];
4680 + }
4681 +
4682 /* check RF frontend chipset */
4683 -
4684 +
4685 switch (priv->rf_chip) {
4686 -
4687 +
4688 case EPROM_RFCHIPID_RTL8225U:
4689 -
4690 +
4691 DMESG("Card reports RF frontend Realtek 8225");
4692 DMESGW("This driver has EXPERIMENTAL support for this chipset.");
4693 DMESGW("use it with care and at your own risk and");
4694 @@ -1834,28 +1975,28 @@
4695 DMESG("This seems a legacy 1st version radio");
4696 }
4697 priv->rf_close = rtl8225_rf_close;
4698 -
4699 +
4700 priv->max_sens = RTL8225_RF_MAX_SENS;
4701 priv->sens = RTL8225_RF_DEF_SENS;
4702 break;
4703 -
4704 +
4705 default:
4706 DMESGW("Unknown RF module %x",priv->rf_chip);
4707 DMESGW("Exiting...");
4708 return -1;
4709 -
4710 +
4711 }
4712 -
4713 +
4714 // DMESG("Energy threshold: %x",priv->cs_treshold);
4715 DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7);
4716 //DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2));
4717 -
4718 - if(rtl8187_usb_initendpoints(dev)!=0){
4719 +
4720 + if(rtl8187_usb_initendpoints(dev)!=0){
4721 DMESG("Endopoints initialization failed");
4722 return -ENOMEM;
4723 }
4724 -#if 0
4725 - if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
4726 +#if 0
4727 + if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
4728 return -ENOMEM;
4729
4730 if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
4731 @@ -1869,16 +2010,16 @@
4732 if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
4733 TX_LOWPRIORITY_RING_ADDR))
4734 return -ENOMEM;
4735 -
4736 -
4737 +
4738 +
4739 if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount))
4740 return -ENOMEM;
4741 #endif
4742 -
4743 +
4744
4745 #ifdef DEBUG_EPROM
4746 dump_eprom(dev);
4747 -#endif
4748 +#endif
4749 return 0;
4750
4751 }
4752 @@ -1898,7 +2039,7 @@
4753 rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
4754
4755 conf3 = read_nic_byte(dev, CONFIG3);
4756 - write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
4757 + write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
4758
4759 write_nic_dword(dev, ANAPARAM2, a);
4760
4761 @@ -1918,23 +2059,23 @@
4762
4763 conf3 = read_nic_byte(dev, CONFIG3);
4764 write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
4765 -
4766 +
4767 write_nic_dword(dev, ANAPARAM, a);
4768
4769 conf3 = read_nic_byte(dev, CONFIG3);
4770 write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
4771
4772 rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
4773 -
4774 +
4775 }
4776
4777
4778 void rtl8185_tx_antenna(struct net_device *dev, u8 ant)
4779 {
4780 - write_nic_byte(dev, TX_ANTENNA, ant);
4781 + write_nic_byte(dev, TX_ANTENNA, ant);
4782 force_pci_posting(dev);
4783 mdelay(1);
4784 -}
4785 +}
4786
4787
4788 void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data)
4789 @@ -1942,26 +2083,26 @@
4790 //u8 phyr;
4791 u32 phyw;
4792 // int i;
4793 -
4794 +
4795 adr |= 0x80;
4796 -
4797 +
4798 phyw= ((data<<8) | adr);
4799 -
4800 -
4801 -
4802 - // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
4803 +
4804 +
4805 +
4806 + // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
4807 write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24));
4808 write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16));
4809 write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8));
4810 write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) ));
4811
4812 //read_nic_dword(dev, PHY_ADR);
4813 -#if 0
4814 +#if 0
4815 for(i=0;i<10;i++){
4816 write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw);
4817 phyr = read_nic_byte(dev, PHY_READ);
4818 if(phyr == (data&0xff)) break;
4819 -
4820 +
4821 }
4822 #endif
4823 /* this is ok to fail when we write AGC table. check for AGC table might be
4824 @@ -1988,60 +2129,60 @@
4825
4826 void rtl8180_adapter_start(struct net_device *dev)
4827 {
4828 - struct r8180_priv *priv = ieee80211_priv(dev);
4829 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
4830 //u32 anaparam;
4831 //u8 config3;
4832 -
4833 +
4834 //rtl8180_rtx_disable(dev);
4835 rtl8180_reset(dev);
4836
4837 write_nic_byte(dev,0x85,0);
4838 write_nic_byte(dev,0x91,0);
4839 -
4840 +
4841 /* light blink! */
4842 write_nic_byte(dev,0x85,4);
4843 write_nic_byte(dev,0x91,1);
4844 write_nic_byte(dev,0x90,0);
4845 -
4846 +
4847 priv->irq_mask = 0xffff;
4848 /*
4849 priv->dma_poll_mask = 0;
4850 priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT);
4851 -*/
4852 +*/
4853 // rtl8180_beacon_tx_disable(dev);
4854 -
4855 +
4856 rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
4857 write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]);
4858 write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff );
4859
4860 rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
4861 rtl8180_update_msr(dev);
4862 -
4863 +
4864 rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
4865 -
4866 +
4867 write_nic_word(dev,0xf4,0xffff);
4868 write_nic_byte(dev,
4869 - CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
4870 + CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
4871
4872 rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
4873 -
4874 - write_nic_dword(dev,INT_TIMEOUT,0);
4875 +
4876 + write_nic_dword(dev,INT_TIMEOUT,0);
4877
4878 #ifdef DEBUG_REGISTERS
4879 - rtl8180_dump_reg(dev);
4880 + rtl8180_dump_reg(dev);
4881 #endif
4882 -
4883 -
4884 - write_nic_byte(dev, WPA_CONFIG, 0);
4885 +
4886 +
4887 + write_nic_byte(dev, WPA_CONFIG, 0);
4888
4889 write_nic_byte(dev, RATE_FALLBACK, 0x81);
4890 rtl8187_set_rate(dev);
4891 -
4892 - priv->rf_init(dev);
4893 +
4894 + priv->rf_init(dev);
4895
4896 if(priv->rf_set_sens != NULL)
4897 - priv->rf_set_sens(dev,priv->sens);
4898 -
4899 + priv->rf_set_sens(dev,priv->sens);
4900 +
4901 write_nic_word(dev,0x5e,1);
4902
4903 #if 1
4904 @@ -2054,13 +2195,13 @@
4905 write_nic_byte(dev, 0xff, 0x60);
4906
4907 write_nic_word(dev,0x5e,0);
4908 -
4909 -
4910 +
4911 +
4912 rtl8180_irq_enable(dev);
4913 /*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY));
4914 -
4915 +
4916 DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY));
4917 -
4918 +
4919 DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY));
4920 if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK");
4921 if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK");
4922 @@ -2077,8 +2218,8 @@
4923 void rtl8180_start_tx_beacon(struct net_device *dev)
4924 {
4925 int i;
4926 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
4927 - u16 word;
4928 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
4929 + u16 word;
4930 DMESG("Enabling beacon TX");
4931 //write_nic_byte(dev, 0x42,0xe6);// TCR
4932 //rtl8180_init_beacon(dev);
4933 @@ -2091,41 +2232,41 @@
4934 //write_nic_word(dev,0x7a,0);
4935 //write_nic_word(dev,0x7a,0x8000);
4936
4937 -
4938 +
4939 word = read_nic_word(dev, BcnItv);
4940 word &= ~BcnItv_BcnItv; // clear Bcn_Itv
4941 write_nic_word(dev, BcnItv, word);
4942
4943 - write_nic_word(dev, AtimWnd,
4944 + write_nic_word(dev, AtimWnd,
4945 read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd);
4946 -
4947 +
4948 word = read_nic_word(dev, BintrItv);
4949 word &= ~BintrItv_BintrItv;
4950 -
4951 - //word |= priv->ieee80211->beacon_interval *
4952 +
4953 + //word |= priv->ieee80211->beacon_interval *
4954 // ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1);
4955 // FIXME:FIXME check if correct ^^ worked with 0x3e8;
4956 -
4957 +
4958 write_nic_word(dev, BintrItv, word);
4959 -
4960 +
4961 //write_nic_word(dev,0x2e,0xe002);
4962 //write_nic_dword(dev,0x30,0xb8c7832e);
4963 for(i=0; i<ETH_ALEN; i++)
4964 write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]);
4965 -
4966 +
4967 // rtl8180_update_msr(dev);
4968
4969 -
4970 +
4971 //write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */
4972 -
4973 +
4974 rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
4975 -
4976 +
4977 rtl8180_irq_enable(dev);
4978 -
4979 +
4980 /* VV !!!!!!!!!! VV*/
4981 /*
4982 rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
4983 - write_nic_byte(dev,0x9d,0x00);
4984 + write_nic_byte(dev,0x9d,0x00);
4985 rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
4986 */
4987 }
4988 @@ -2135,137 +2276,138 @@
4989 ***************************************************************************/
4990 static struct net_device_stats *rtl8180_stats(struct net_device *dev)
4991 {
4992 - struct r8180_priv *priv = ieee80211_priv(dev);
4993 -
4994 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
4995 +
4996 return &priv->ieee80211->stats;
4997 }
4998
4999
5000 int _rtl8180_up(struct net_device *dev)
5001 {
5002 - struct r8180_priv *priv = ieee80211_priv(dev);
5003 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
5004
5005 priv->up=1;
5006 -
5007 - //DMESG("Bringing up iface");
5008 +
5009 +// DMESG("Bringing up iface");
5010
5011 rtl8180_adapter_start(dev);
5012 -
5013 rtl8180_rx_enable(dev);
5014 -
5015 rtl8180_tx_enable(dev);
5016 -
5017 - ieee80211_softmac_start_protocol(priv->ieee80211);
5018 -
5019 - ieee80211_reset_queue(priv->ieee80211);
5020 + ieee80211_softmac_start_protocol_rtl7(priv->ieee80211);
5021 + ieee80211_reset_queue_rtl7(priv->ieee80211);
5022 if(!netif_queue_stopped(dev))
5023 netif_start_queue(dev);
5024 else
5025 netif_wake_queue(dev);
5026 -
5027 return 0;
5028 }
5029
5030
5031 int rtl8180_open(struct net_device *dev)
5032 {
5033 - struct r8180_priv *priv = ieee80211_priv(dev);
5034 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
5035 int ret;
5036 -
5037 +
5038 down(&priv->wx_sem);
5039 +
5040 ret = rtl8180_up(dev);
5041 up(&priv->wx_sem);
5042 return ret;
5043 -
5044 +
5045 }
5046
5047
5048 int rtl8180_up(struct net_device *dev)
5049 {
5050 - struct r8180_priv *priv = ieee80211_priv(dev);
5051 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
5052
5053 if (priv->up == 1) return -1;
5054 -
5055 +
5056 return _rtl8180_up(dev);
5057 }
5058
5059
5060 int rtl8180_close(struct net_device *dev)
5061 {
5062 - struct r8180_priv *priv = ieee80211_priv(dev);
5063 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
5064 int ret;
5065 -
5066 +
5067 down(&priv->wx_sem);
5068 -
5069 +
5070 ret = rtl8180_down(dev);
5071 -
5072 +
5073 up(&priv->wx_sem);
5074 -
5075 +
5076 return ret;
5077
5078 }
5079
5080 int rtl8180_down(struct net_device *dev)
5081 {
5082 - struct r8180_priv *priv = ieee80211_priv(dev);
5083 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
5084
5085 if (priv->up == 0) return -1;
5086 -
5087 +
5088 priv->up=0;
5089
5090 /* FIXME */
5091 if (!netif_queue_stopped(dev))
5092 netif_stop_queue(dev);
5093 -
5094 +
5095 rtl8180_rtx_disable(dev);
5096 rtl8180_irq_disable(dev);
5097
5098 - ieee80211_softmac_stop_protocol(priv->ieee80211);
5099 -
5100 + ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
5101 +
5102 return 0;
5103 }
5104
5105
5106 void rtl8180_commit(struct net_device *dev)
5107 {
5108 - struct r8180_priv *priv = ieee80211_priv(dev);
5109 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
5110
5111 if (priv->up == 0) return ;
5112 -
5113 - ieee80211_softmac_stop_protocol(priv->ieee80211);
5114 -
5115 +
5116 + ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
5117 +
5118 rtl8180_irq_disable(dev);
5119 rtl8180_rtx_disable(dev);
5120 _rtl8180_up(dev);
5121 }
5122
5123 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
5124 +void rtl8180_restart(struct work_struct *work)
5125 +{
5126 + struct r8180_priv *priv = container_of(work, struct r8180_priv, reset_wq);
5127 + struct net_device *dev = priv->dev;
5128 +#else
5129 void rtl8180_restart(struct net_device *dev)
5130 {
5131 - struct r8180_priv *priv = ieee80211_priv(dev);
5132 -
5133 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
5134 +#endif
5135 down(&priv->wx_sem);
5136 -
5137 rtl8180_commit(dev);
5138 -
5139 +
5140 up(&priv->wx_sem);
5141 }
5142
5143 static void r8180_set_multicast(struct net_device *dev)
5144 {
5145 - struct r8180_priv *priv = ieee80211_priv(dev);
5146 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
5147 short promisc;
5148
5149 //down(&priv->wx_sem);
5150 -
5151 +
5152 /* FIXME FIXME */
5153 -
5154 +
5155 promisc = (dev->flags & IFF_PROMISC) ? 1:0;
5156 -
5157 +
5158 if (promisc != priv->promisc)
5159 // rtl8180_commit(dev);
5160 -
5161 +
5162 priv->promisc = promisc;
5163 -
5164 +
5165 //schedule_work(&priv->reset_wq);
5166 //up(&priv->wx_sem);
5167 }
5168 @@ -2273,17 +2415,17 @@
5169
5170 int r8180_set_mac_adr(struct net_device *dev, void *mac)
5171 {
5172 - struct r8180_priv *priv = ieee80211_priv(dev);
5173 + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
5174 struct sockaddr *addr = mac;
5175 -
5176 +
5177 down(&priv->wx_sem);
5178 -
5179 +
5180 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
5181 -
5182 +
5183 schedule_work(&priv->reset_wq);
5184 -
5185 +
5186 up(&priv->wx_sem);
5187 -
5188 +
5189 return 0;
5190 }
5191
5192 @@ -2291,16 +2433,18 @@
5193 /* based on ipw2200 driver */
5194 int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
5195 {
5196 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
5197 -
5198 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
5199 + struct iwreq *wrq;
5200 + int ret;
5201 +
5202 down(&priv->wx_sem);
5203 -
5204 - struct iwreq *wrq = (struct iwreq *)rq;
5205 -
5206 - int ret=-1;
5207 +
5208 + wrq = (struct iwreq *)rq;
5209 +
5210 + ret=-1;
5211 switch (cmd) {
5212 case RTL_IOCTL_WPA_SUPPLICANT:
5213 - ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
5214 + ret = ieee80211_wpa_supplicant_ioctl_rtl7(priv->ieee80211, &wrq->u.data);
5215 break;
5216
5217 default:
5218 @@ -2309,7 +2453,7 @@
5219 }
5220
5221 up(&priv->wx_sem);
5222 -
5223 +
5224 return ret;
5225 }
5226
5227 @@ -2320,10 +2464,11 @@
5228 struct net_device *dev = (struct net_device*)rx_urb->context;
5229 int status,len,flen;
5230 struct sk_buff *skb;
5231 - u32 *desc;
5232 -
5233 + u8 *desc;
5234 + u8 signal,quality,rate;
5235 +
5236 //DMESG("rtl8187_rx_isr");
5237 -
5238 +
5239 struct ieee80211_rx_stats stats = {
5240 .signal = 0,
5241 .noise = -98,
5242 @@ -2332,43 +2477,109 @@
5243 .freq = IEEE80211_24GHZ_BAND,
5244 };
5245
5246 +
5247 //DMESG("RX %d ",rx_urb->status);
5248 status = rx_urb->status;
5249 if(status == 0){
5250 -
5251 +
5252 len = rx_urb->actual_length;
5253 - // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
5254 + // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
5255 len -= 4*4;/* 4 dword and 4 byte CRC */
5256 -
5257 +#if 0
5258 desc = (u32*)(rx_urb->transfer_buffer + len);
5259 -
5260 +
5261 flen = desc[0] & 0xfff;
5262 -
5263 +
5264 if( flen <= rx_urb->actual_length){
5265 -
5266 - stats.signal = (desc[1] & 0x7f00)>>8;
5267 - stats.noise = desc[1] &0xff;
5268 - stats.rate = desc[0] >> 20 & 0xf;
5269 +
5270 + //stats.signal = (desc[1] & 0x7f00)>>8;
5271 + //stats.noise = desc[1] &0xff;
5272 + signal=(desc[1]& (0xff0000))>>16;
5273 + signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
5274 +
5275 + quality=(desc[1] & (0xff));
5276 +
5277 + rate=(desc[0] &((1<<23)|(1<<22)|(1<<21)|(1<<20)))>>20;
5278 + // printk(KERN_INFO "rate is %d!\n",rate);
5279 + stats.rate = rtl8180_rate2rate(rate);
5280 + // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
5281 + //stats.rate = desc[0] >> 20 & 0xf;
5282 stats.mac_time[0] = desc[2];
5283 stats.mac_time[1] = desc[3];
5284 +#endif
5285 +
5286 + desc = rx_urb->transfer_buffer + len;
5287 +
5288 + flen = ((desc[1] & 0x0f) << 8) + (desc[0] & 0xff);
5289 +
5290 + if( flen <= rx_urb->actual_length){
5291 + //stats.signal = (desc[1] & 0x7f00)>>8;
5292 + //stats.noise = desc[1] &0xff;
5293 + signal=(desc[6]& 0xfe)>>1;
5294 + //signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
5295 +
5296 + quality=desc[4] & 0xff;
5297 +
5298 + //rate=(desc[2] &((1<<7)|(1<<6)|(1<<5)|(1<<4)))>>4;
5299 + rate=(desc[2] & 0xf0)>>4;
5300 + // printk(KERN_INFO "rate is %d!\n",rate);
5301 + stats.rate = rtl8180_rate2rate(rate);
5302 + // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
5303 + //stats.rate = desc[0] >> 20 & 0xf;
5304 + stats.mac_time[0] = desc[8] + (desc[9]<<8) + (desc[10]<<16) + (desc[11]<<24);
5305 + stats.mac_time[1] = desc[12] + (desc[13]<<8) + (desc[14]<<16) + (desc[15]<<24);
5306 +
5307 +
5308 + //calculate link quality begin
5309 + if(!rtl8180_IsWirelessBMode(stats.rate) )
5310 + { // OFDM rate.
5311 + if(signal>90)
5312 + signal=90;
5313 + else if(signal<25)
5314 + signal=25;
5315 + signal = (90-signal)*100/65;
5316 + }
5317 + else
5318 + { // CCK rate.
5319 + if(signal>95)
5320 + signal = 95;
5321 + else if(signal<30)
5322 + signal = 30;
5323 + signal =(95-signal )*100/65;
5324 + }
5325 + priv->wstats.qual.level = signal;
5326 + // printk(KERN_INFO "signal is %d!\n",signal);
5327 + if(quality > 64)
5328 + priv ->wstats.qual.qual = 0;
5329 + else
5330 + priv ->wstats.qual.qual = ((64-quality) * 100) / 64; // SQ value is the SIGNAL_QUALITY returned to IORequest,
5331 + //and this value only appear when STA is associated to AP or
5332 + // STA is in IBSS mode
5333 + // printk(KERN_INFO "quality is %d!\n",priv->wstats.qual.qual);
5334 + priv->wstats.qual.noise = 100 - priv ->wstats.qual.qual;
5335 + priv->wstats.qual.updated = 7;
5336 + if(priv->ieee80211->iw_mode == IW_MODE_MONITOR)
5337 + {
5338 + stats.signal = priv->wstats.qual.level;
5339 + stats.noise = priv->wstats.qual.noise;
5340 + }
5341 + //calculate link quality end
5342 skb = dev_alloc_skb(flen-4);
5343 - //skb_reserve(skb,2);
5344 - if(skb){
5345 + if(skb){
5346 memcpy(skb_put(skb,flen-4),
5347 rx_urb->transfer_buffer,flen -4);
5348 -
5349 +
5350 #ifdef DUMP_RX
5351 int i;
5352 for(i=0;i<flen-4;i++)
5353 printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]);
5354 printk("------RATE %x:w---------------\n",stats.rate);
5355 -
5356 +
5357 #endif
5358 priv->stats.rxok++;
5359 // priv->rxskb = skb;
5360 // priv->tempstats = &stats;
5361 -
5362 - if(!ieee80211_rx(priv->ieee80211,
5363 + if(!ieee80211_rx_rtl7(priv->ieee80211,
5364 skb, &stats))
5365 dev_kfree_skb_any(skb);
5366 }
5367 @@ -2376,9 +2587,8 @@
5368 }else{
5369 priv->stats.rxstaterr++;
5370 priv->ieee80211->stats.rx_errors++;
5371 -
5372 }
5373 -
5374 +
5375 if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb);
5376 else DMESG("RX process aborted due to explicit shutdown");
5377 }
5378 @@ -2396,20 +2606,22 @@
5379 struct r8180_priv *priv= NULL;
5380 struct usb_device *udev = interface_to_usbdev(intf);
5381
5382 -//printk("===> rtl8187_usb_probe()\n");
5383 -
5384 - dev = alloc_ieee80211(sizeof(struct r8180_priv));
5385 -
5386 +//printk("===> rtl8187_usb_probe()\n");
5387 +
5388 + dev = alloc_ieee80211_rtl7(sizeof(struct r8180_priv));
5389 +
5390 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
5391 SET_MODULE_OWNER(dev);
5392 - usb_set_intfdata(intf, dev);
5393 -
5394 +#endif
5395 + usb_set_intfdata(intf, dev);
5396 +
5397 SET_NETDEV_DEV(dev, &intf->dev);
5398
5399 - priv = ieee80211_priv(dev);
5400 + priv = ieee80211_priv_rtl7(dev);
5401 priv->ieee80211 = netdev_priv(dev);
5402 -
5403 +
5404 priv->udev=udev;
5405 -
5406 +
5407 dev->open = rtl8180_open;
5408 dev->stop = rtl8180_close;
5409 //dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
5410 @@ -2418,41 +2630,46 @@
5411 dev->do_ioctl = rtl8180_ioctl;
5412 dev->set_multicast_list = r8180_set_multicast;
5413 dev->set_mac_address = r8180_set_mac_adr;
5414 +#if WIRELESS_EXT >= 12
5415 +#if WIRELESS_EXT < 17
5416 dev->get_wireless_stats = r8180_get_wireless_stats;
5417 +#endif
5418 + dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
5419 +#endif
5420 dev->type=ARPHRD_ETHER;
5421 -
5422 +
5423 if (dev_alloc_name(dev, ifname) < 0){
5424 DMESG("Oops: devname already taken! Trying wlan%%d...\n");
5425 ifname = "wlan%d";
5426 dev_alloc_name(dev, ifname);
5427 }
5428 -
5429 +
5430 // dev->open=rtl8180_init;
5431 -
5432 - if(rtl8180_init(dev)!=0){
5433 +
5434 + if(rtl8180_init(dev)!=0){
5435 DMESG("Initialization failed");
5436 goto fail;
5437 }
5438 -
5439 +
5440 netif_carrier_off(dev);
5441 netif_stop_queue(dev);
5442 -
5443 +
5444 register_netdev(dev);
5445 -
5446 +
5447 rtl8180_proc_init_one(dev);
5448 -
5449 -
5450 +
5451 +
5452 DMESG("Driver probe completed\n");
5453 - return 0;
5454 + return 0;
5455 +
5456
5457 -
5458 fail:
5459 - free_ieee80211(dev);
5460 -
5461 + free_ieee80211_rtl7(dev);
5462 +
5463 DMESG("wlan driver load failed\n");
5464 -
5465 +
5466 return -ENODEV;
5467 -
5468 +
5469 }
5470
5471
5472 @@ -2461,13 +2678,13 @@
5473 struct r8180_priv *priv;
5474 struct net_device *dev = usb_get_intfdata(intf);
5475 if(dev){
5476 -
5477 +
5478 unregister_netdev(dev);
5479 -
5480 - priv=ieee80211_priv(dev);
5481 -
5482 +
5483 + priv=ieee80211_priv_rtl7(dev);
5484 +
5485 rtl8180_proc_remove_one(dev);
5486 -
5487 +
5488 rtl8180_down(dev);
5489 priv->rf_close(dev);
5490 //rtl8180_rtx_disable(dev);
5491 @@ -2478,12 +2695,12 @@
5492
5493 }
5494 // pci_disable_device(pdev);
5495 - free_ieee80211(dev);
5496 + free_ieee80211_rtl7(dev);
5497 DMESG("wlan driver removed\n");
5498 }
5499
5500
5501 -static int __init rtl8187_usb_module_init(void)
5502 +static int __init rtl8187_usb_module_init_rtl7(void)
5503 {
5504 printk(KERN_INFO "\nLinux kernel driver for RTL8187 \
5505 based WLAN cards\n");
5506 @@ -2495,7 +2712,7 @@
5507 }
5508
5509
5510 -static void __exit rtl8187_usb_module_exit(void)
5511 +static void __exit rtl8187_usb_module_exit_rtl7(void)
5512 {
5513 usb_deregister(&rtl8187_usb_driver);
5514
5515 @@ -2508,14 +2725,14 @@
5516 {
5517 unsigned long flags;
5518 short enough_desc;
5519 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
5520 -
5521 + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
5522 +
5523 spin_lock_irqsave(&priv->tx_lock,flags);
5524 enough_desc = check_nic_enought_desc(dev,pri);
5525 - spin_unlock_irqrestore(&priv->tx_lock,flags);
5526 -
5527 + spin_unlock_irqrestore(&priv->tx_lock,flags);
5528 +
5529 if(enough_desc)
5530 - ieee80211_wake_queue(priv->ieee80211);
5531 + ieee80211_wake_queue_rtl7(priv->ieee80211);
5532 }
5533
5534
5535 @@ -2523,5 +2740,5 @@
5536 /***************************************************************************
5537 ------------------- module init / exit stubs ----------------
5538 ****************************************************************************/
5539 -module_init(rtl8187_usb_module_init);
5540 -module_exit(rtl8187_usb_module_exit);
5541 +module_init(rtl8187_usb_module_init_rtl7);
5542 +module_exit(rtl8187_usb_module_exit_rtl7);
5543 diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c~ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187_core.c~
5544 --- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c~ 2006-06-22 07:40:10.000000000 +0200
5545 +++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187_core.c~ 1970-01-01 01:00:00.000000000 +0100
5546 @@ -1,2527 +0,0 @@
5547 -/*
5548 - This is part of rtl8187 OpenSource driver - v 0.1
5549 - Copyright (C) Andrea Merello 2005 <[email protected]>
5550 - Released under the terms of GPL (General Public License)
5551 -
5552 -
5553 - Parts of this driver are based on the rtl8180 driver skeleton
5554 - from Patric Schenke & Andres Salomon.
5555 -
5556 - Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers.
5557 -
5558 - some ideas might be derived from David Young rtl8180 netbsd driver.
5559 -
5560 - Parts of the usb code are from the r8150.c driver in linux kernel
5561 -
5562 - Some ideas borrowed from the 8139too.c driver included in linux kernel.
5563 -
5564 - We (I?) want to thanks the Authors of those projecs and also the
5565 - Ndiswrapper's project Authors.
5566 -
5567 - A special big thanks goes also to Realtek corp. for their help in my
5568 - attempt to add RTL8187 and RTL8225 support, and to David Young also.
5569 -
5570 - - Please note that this file is a modified version from rtl8180-sa2400
5571 - drv. So some other people have contributed to this project, and they are
5572 - thanked in the rtl8180-sa2400 CHANGELOG.
5573 -*/
5574 -
5575 -#ifndef CONFIG_FORCE_HARD_FLOAT
5576 -double __floatsidf (int i) { return i; }
5577 -unsigned int __fixunsdfsi (double d) { return d; }
5578 -double __adddf3(double a, double b) { return a+b; }
5579 -double __addsf3(float a, float b) { return a+b; }
5580 -double __subdf3(double a, double b) { return a-b; }
5581 -double __extendsfdf2(float a) {return a;}
5582 -#endif
5583 -
5584 -#undef LOOP_TEST
5585 -#undef DUMP_RX
5586 -#undef DUMP_TX
5587 -#undef DEBUG_TX_DESC2
5588 -#undef RX_DONT_PASS_UL
5589 -#undef DEBUG_EPROM
5590 -#undef DEBUG_RX_VERBOSE
5591 -#undef DUMMY_RX
5592 -#undef DEBUG_ZERO_RX
5593 -#undef DEBUG_RX_SKB
5594 -#undef DEBUG_TX_FRAG
5595 -#undef DEBUG_RX_FRAG
5596 -#undef DEBUG_TX_FILLDESC
5597 -#undef DEBUG_TX
5598 -#undef DEBUG_IRQ
5599 -#undef DEBUG_RX
5600 -#undef DEBUG_RXALLOC
5601 -#undef DEBUG_REGISTERS
5602 -#undef DEBUG_RING
5603 -#undef DEBUG_IRQ_TASKLET
5604 -#undef DEBUG_TX_ALLOC
5605 -#undef DEBUG_TX_DESC
5606 -
5607 -//#define CONFIG_RTL8180_IO_MAP
5608 -
5609 -#include "r8180_hw.h"
5610 -#include "r8187.h"
5611 -#include "r8180_rtl8225.h" /* RTL8225 Radio frontend */
5612 -#include "r8180_93cx6.h" /* Card EEPROM */
5613 -#include "r8180_wx.h"
5614 -
5615 -
5616 -// FIXME: check if 2.6.7 is ok
5617 -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
5618 -#define usb_kill_urb usb_unlink_urb
5619 -#endif
5620 -
5621 -#ifdef CONFIG_RTL8180_PM
5622 -#include "r8180_pm.h"
5623 -#endif
5624 -
5625 -#ifndef USB_VENDOR_ID_REALTEK
5626 -#define USB_VENDOR_ID_REALTEK 0x0bda
5627 -#endif
5628 -#ifndef USB_VENDOR_ID_NETGEAR
5629 -#define USB_VENDOR_ID_NETGEAR 0x0846
5630 -#endif
5631 -
5632 -static struct usb_device_id rtl8187_usb_id_tbl[] = {
5633 - {USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x8187)},
5634 - {USB_DEVICE(USB_VENDOR_ID_NETGEAR, 0x6100)},
5635 - {USB_DEVICE(USB_VENDOR_ID_NETGEAR, 0x6a00)},
5636 -
5637 - {}
5638 -};
5639 -
5640 -static char* ifname = "wlan%d";
5641 -#if 0
5642 -static int hwseqnum = 0;
5643 -static int hwwep = 0;
5644 -#endif
5645 -static int channels = 0x3fff;
5646 -
5647 -MODULE_LICENSE("GPL");
5648 -MODULE_VERSION("V 1.1");
5649 -MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
5650 -MODULE_AUTHOR("Andrea Merello <[email protected]>");
5651 -MODULE_DESCRIPTION("Linux driver for Realtek RTL8187 WiFi cards");
5652 -
5653 -#if 0
5654 -MODULE_PARM(ifname,"s");
5655 -MODULE_PARM_DESC(devname," Net interface name, wlan%d=default");
5656 -
5657 -MODULE_PARM(hwseqnum,"i");
5658 -MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default");
5659 -
5660 -MODULE_PARM(hwwep,"i");
5661 -MODULE_PARM_DESC(hwwep," Try to use hardware WEP support. Still broken and not available on all cards");
5662 -
5663 -MODULE_PARM(channels,"i");
5664 -MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI");
5665 -#endif
5666 -
5667 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9)
5668 -module_param(ifname, charp, S_IRUGO|S_IWUSR );
5669 -//module_param(hwseqnum,int, S_IRUGO|S_IWUSR);
5670 -//module_param(hwwep,int, S_IRUGO|S_IWUSR);
5671 -module_param(channels,int, S_IRUGO|S_IWUSR);
5672 -#else
5673 -MODULE_PARM(ifname, "s");
5674 -//MODULE_PARM(hwseqnum,"i");
5675 -//MODULE_PARM(hwwep,"i");
5676 -MODULE_PARM(channels,"i");
5677 -#endif
5678 -
5679 -MODULE_PARM_DESC(devname," Net interface name, wlan%d=default");
5680 -//MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default");
5681 -//MODULE_PARM_DESC(hwwep," Try to use hardware WEP support. Still broken and not available on all cards");
5682 -MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI");
5683 -
5684 -static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
5685 - const struct usb_device_id *id);
5686 -
5687 -static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf);
5688 -
5689 -static struct usb_driver rtl8187_usb_driver = {
5690 -
5691 -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
5692 - .owner = THIS_MODULE,
5693 -#endif
5694 - .name = RTL8187_MODULE_NAME, /* Driver name */
5695 - .id_table = rtl8187_usb_id_tbl, /* PCI_ID table */
5696 - .probe = rtl8187_usb_probe, /* probe fn */
5697 - .disconnect = rtl8187_usb_disconnect, /* remove fn */
5698 -#ifdef CONFIG_RTL8180_PM
5699 - .suspend = rtl8180_suspend, /* PM suspend fn */
5700 - .resume = rtl8180_resume, /* PM resume fn */
5701 -#else
5702 - .suspend = NULL, /* PM suspend fn */
5703 - .resume = NULL, /* PM resume fn */
5704 -#endif
5705 -};
5706 -
5707 -
5708 -void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
5709 -{
5710 -
5711 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
5712 - struct usb_device *udev = priv->udev;
5713 -
5714 - usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
5715 - RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
5716 - indx|0xfe00, 0, &data, 1, HZ / 2);
5717 -}
5718 -
5719 -
5720 -void write_nic_byte(struct net_device *dev, int indx, u8 data)
5721 -{
5722 -
5723 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
5724 - struct usb_device *udev = priv->udev;
5725 -
5726 - usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
5727 - RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
5728 - indx|0xff00, 0, &data, 1, HZ / 2);
5729 -}
5730 -
5731 -
5732 -void write_nic_word(struct net_device *dev, int indx, u16 data)
5733 -{
5734 -
5735 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
5736 - struct usb_device *udev = priv->udev;
5737 -
5738 - usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
5739 - RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
5740 - indx|0xff00, 0, &data, 2, HZ / 2);
5741 -}
5742 -
5743 -
5744 -void write_nic_dword(struct net_device *dev, int indx, u32 data)
5745 -{
5746 -
5747 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
5748 - struct usb_device *udev = priv->udev;
5749 -
5750 - usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
5751 - RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
5752 - indx|0xff00, 0, &data, 4, HZ / 2);
5753 -}
5754 -
5755 -
5756 -
5757 -u8 read_nic_byte(struct net_device *dev, int indx)
5758 -{
5759 - u8 data;
5760 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
5761 - struct usb_device *udev = priv->udev;
5762 -
5763 - usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
5764 - RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
5765 - indx|0xff00, 0, &data, 1, HZ / 2);
5766 - return data;
5767 -}
5768 -
5769 -u8 read_nic_byte_E(struct net_device *dev, int indx)
5770 -{
5771 - u8 data;
5772 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
5773 - struct usb_device *udev = priv->udev;
5774 -
5775 - usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
5776 - RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
5777 - indx|0xfe00, 0, &data, 1, HZ / 2);
5778 - return data;
5779 -}
5780 -
5781 -
5782 -u16 read_nic_word(struct net_device *dev, int indx)
5783 -{
5784 - u16 data;
5785 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
5786 - struct usb_device *udev = priv->udev;
5787 -
5788 - usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
5789 - RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
5790 - indx|0xff00, 0, &data, 2, HZ / 2);
5791 - return data;
5792 -}
5793 -
5794 -
5795 -u32 read_nic_dword(struct net_device *dev, int indx)
5796 -{
5797 - u32 data;
5798 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
5799 - struct usb_device *udev = priv->udev;
5800 -
5801 - usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
5802 - RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
5803 - indx|0xff00, 0, &data, 4, HZ / 2);
5804 - return data;
5805 -}
5806 -
5807 -/* this might still called in what was the PHY rtl8185/rtl8187 common code
5808 - * plans are to possibilty turn it again in one common code...
5809 - */
5810 -inline void force_pci_posting(struct net_device *dev)
5811 -{
5812 -}
5813 -
5814 -
5815 -//irqreturn_t rtl8180_interrupt(int irq, void *netdev, struct pt_regs *regs);
5816 -//void set_nic_rxring(struct net_device *dev);
5817 -//void set_nic_txring(struct net_device *dev);
5818 -static struct net_device_stats *rtl8180_stats(struct net_device *dev);
5819 -void rtl8180_commit(struct net_device *dev);
5820 -void rtl8180_restart(struct net_device *dev);
5821 -
5822 -/****************************************************************************
5823 - -----------------------------PROCFS STUFF-------------------------
5824 -*****************************************************************************/
5825 -
5826 -static struct proc_dir_entry *rtl8180_proc = NULL;
5827 -
5828 -static int proc_get_registers(char *page, char **start,
5829 - off_t offset, int count,
5830 - int *eof, void *data)
5831 -{
5832 - struct net_device *dev = data;
5833 -// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
5834 -
5835 - int len = 0;
5836 - int i,n;
5837 -
5838 - int max=0xff;
5839 -
5840 - /* This dump the current register page */
5841 - for(n=0;n<=max;)
5842 - {
5843 - //printk( "\nD: %2x> ", n);
5844 - len += snprintf(page + len, count - len,
5845 - "\nD: %2x > ",n);
5846 -
5847 - for(i=0;i<16 && n<=max;i++,n++)
5848 - len += snprintf(page + len, count - len,
5849 - "%2x ",read_nic_byte(dev,n));
5850 -
5851 - // printk("%2x ",read_nic_byte(dev,n));
5852 - }
5853 - len += snprintf(page + len, count - len,"\n");
5854 -
5855 -
5856 -
5857 - *eof = 1;
5858 - return len;
5859 -
5860 -}
5861 -
5862 -#if 0
5863 -static int proc_get_stats_hw(char *page, char **start,
5864 - off_t offset, int count,
5865 - int *eof, void *data)
5866 -{
5867 - struct net_device *dev = data;
5868 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
5869 -
5870 - int len = 0;
5871 -
5872 - len += snprintf(page + len, count - len,
5873 - "NIC int: %lu\n"
5874 - "Total int: %lu\n",
5875 - priv->stats.ints,
5876 - priv->stats.shints);
5877 -
5878 - *eof = 1;
5879 - return len;
5880 -}
5881 -#endif
5882 -
5883 -static int proc_get_stats_tx(char *page, char **start,
5884 - off_t offset, int count,
5885 - int *eof, void *data)
5886 -{
5887 - struct net_device *dev = data;
5888 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
5889 -
5890 - int len = 0;
5891 -
5892 - len += snprintf(page + len, count - len,
5893 - "TX normal priority ok int: %lu\n"
5894 - "TX normal priority error int: %lu\n"
5895 -// "TX high priority ok int: %lu\n"
5896 -// "TX high priority failed error int: %lu\n"
5897 - "TX low priority ok int: %lu\n"
5898 - "TX low priority failed error int: %lu\n"
5899 - "TX queue resume: %lu\n"
5900 - "TX queue stopped?: %d\n"
5901 - "TX fifo overflow: %lu\n"
5902 -// "TX beacon: %lu\n"
5903 - "TX lp queue: %d\n"
5904 - "TX np queue: %d\n"
5905 - "TX HW queue: %d\n"
5906 - "TX lp dropped: %lu\n"
5907 - "TX np dropped: %lu\n"
5908 - "TX total data packets %lu\n",
5909 -// "TX beacon aborted: %lu\n",
5910 - priv->stats.txnpokint,
5911 - priv->stats.txnperr,
5912 -// priv->stats.txhpokint,
5913 -// priv->stats.txhperr,
5914 - priv->stats.txlpokint,
5915 - priv->stats.txlperr,
5916 - priv->stats.txresumed,
5917 - netif_queue_stopped(dev),
5918 - priv->stats.txoverflow,
5919 -// priv->stats.txbeacon,
5920 - atomic_read(&(priv->tx_lp_pending)),
5921 - atomic_read(&(priv->tx_np_pending)),
5922 - read_nic_byte(dev, TXFIFOCOUNT),
5923 - priv->stats.txlpdrop,
5924 - priv->stats.txnpdrop,
5925 - priv->stats.txdatapkt
5926 -// priv->stats.txbeaconerr
5927 - );
5928 -
5929 - *eof = 1;
5930 - return len;
5931 -}
5932 -
5933 -
5934 -
5935 -static int proc_get_stats_rx(char *page, char **start,
5936 - off_t offset, int count,
5937 - int *eof, void *data)
5938 -{
5939 - struct net_device *dev = data;
5940 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
5941 -
5942 - int len = 0;
5943 -
5944 - len += snprintf(page + len, count - len,
5945 - "RX packets: %lu\n"
5946 - "RX urb status error: %lu\n"
5947 - "RX invalid urb error: %lu\n",
5948 - priv->stats.rxok,
5949 - priv->stats.rxstaterr,
5950 - priv->stats.rxurberr);
5951 -
5952 - *eof = 1;
5953 - return len;
5954 -}
5955 -
5956 -
5957 -static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
5958 -{
5959 - struct r8180_priv *priv = ieee80211_priv(dev);
5960 -
5961 - return &priv->wstats;
5962 -}
5963 -
5964 -void rtl8180_proc_module_init(void)
5965 -{
5966 - DMESG("Initializing proc filesystem");
5967 - rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net);
5968 -}
5969 -
5970 -
5971 -void rtl8180_proc_module_remove(void)
5972 -{
5973 - remove_proc_entry(RTL8187_MODULE_NAME, proc_net);
5974 -}
5975 -
5976 -
5977 -void rtl8180_proc_remove_one(struct net_device *dev)
5978 -{
5979 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
5980 - if (priv->dir_dev) {
5981 - // remove_proc_entry("stats-hw", priv->dir_dev);
5982 - remove_proc_entry("stats-tx", priv->dir_dev);
5983 - remove_proc_entry("stats-rx", priv->dir_dev);
5984 - // remove_proc_entry("stats-ieee", priv->dir_dev);
5985 - // remove_proc_entry("stats-ap", priv->dir_dev);
5986 - remove_proc_entry("registers", priv->dir_dev);
5987 - remove_proc_entry(dev->name, rtl8180_proc);
5988 - priv->dir_dev = NULL;
5989 - }
5990 -}
5991 -
5992 -
5993 -void rtl8180_proc_init_one(struct net_device *dev)
5994 -{
5995 - struct proc_dir_entry *e;
5996 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
5997 - priv->dir_dev = create_proc_entry(dev->name,
5998 - S_IFDIR | S_IRUGO | S_IXUGO,
5999 - rtl8180_proc);
6000 - if (!priv->dir_dev) {
6001 - DMESGE("Unable to initialize /proc/net/rtl8187/%s\n",
6002 - dev->name);
6003 - return;
6004 - }
6005 - #if 0
6006 - e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO,
6007 - priv->dir_dev, proc_get_stats_hw, dev);
6008 -
6009 - if (!e) {
6010 - DMESGE("Unable to initialize "
6011 - "/proc/net/rtl8187/%s/stats-hw\n",
6012 - dev->name);
6013 - }
6014 - #endif
6015 - e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
6016 - priv->dir_dev, proc_get_stats_rx, dev);
6017 -
6018 - if (!e) {
6019 - DMESGE("Unable to initialize "
6020 - "/proc/net/rtl8187/%s/stats-rx\n",
6021 - dev->name);
6022 - }
6023 -
6024 -
6025 - e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
6026 - priv->dir_dev, proc_get_stats_tx, dev);
6027 -
6028 - if (!e) {
6029 - DMESGE("Unable to initialize "
6030 - "/proc/net/rtl8187/%s/stats-tx\n",
6031 - dev->name);
6032 - }
6033 - #if 0
6034 - e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO,
6035 - priv->dir_dev, proc_get_stats_ieee, dev);
6036 -
6037 - if (!e) {
6038 - DMESGE("Unable to initialize "
6039 - "/proc/net/rtl8187/%s/stats-ieee\n",
6040 - dev->name);
6041 - }
6042 -
6043 -
6044 - e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
6045 - priv->dir_dev, proc_get_stats_ap, dev);
6046 -
6047 - if (!e) {
6048 - DMESGE("Unable to initialize "
6049 - "/proc/net/rtl8187/%s/stats-ap\n",
6050 - dev->name);
6051 - }
6052 - #endif
6053 -
6054 - e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
6055 - priv->dir_dev, proc_get_registers, dev);
6056 -
6057 - if (!e) {
6058 - DMESGE("Unable to initialize "
6059 - "/proc/net/rtl8187/%s/registers\n",
6060 - dev->name);
6061 - }
6062 -}
6063 -/****************************************************************************
6064 - -----------------------------MISC STUFF-------------------------
6065 -*****************************************************************************/
6066 -
6067 -/* this is only for debugging */
6068 -void print_buffer(u32 *buffer, int len)
6069 -{
6070 - int i;
6071 - u8 *buf =(u8*)buffer;
6072 -
6073 - printk("ASCII BUFFER DUMP (len: %x):\n",len);
6074 -
6075 - for(i=0;i<len;i++)
6076 - printk("%c",buf[i]);
6077 -
6078 - printk("\nBINARY BUFFER DUMP (len: %x):\n",len);
6079 -
6080 - for(i=0;i<len;i++)
6081 - printk("%x",buf[i]);
6082 -
6083 - printk("\n");
6084 -}
6085 -
6086 -short check_nic_enought_desc(struct net_device *dev, priority_t priority)
6087 -{
6088 - struct r8180_priv *priv = ieee80211_priv(dev);
6089 -
6090 - int used = atomic_read((priority == NORM_PRIORITY) ?
6091 - &priv->tx_np_pending : &priv->tx_lp_pending);
6092 -
6093 - return (used < MAX_TX_URB);
6094 -}
6095 -
6096 -void tx_timeout(struct net_device *dev)
6097 -{
6098 - struct r8180_priv *priv = ieee80211_priv(dev);
6099 - //rtl8180_commit(dev);
6100 - schedule_work(&priv->reset_wq);
6101 - //DMESG("TXTIMEOUT");
6102 -}
6103 -
6104 -
6105 -/* this is only for debug */
6106 -void dump_eprom(struct net_device *dev)
6107 -{
6108 - int i;
6109 - for(i=0; i<63; i++)
6110 - DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
6111 -}
6112 -
6113 -/* this is only for debug */
6114 -void rtl8180_dump_reg(struct net_device *dev)
6115 -{
6116 - int i;
6117 - int n;
6118 - int max=0xff;
6119 -
6120 - DMESG("Dumping NIC register map");
6121 -
6122 - for(n=0;n<=max;)
6123 - {
6124 - printk( "\nD: %2x> ", n);
6125 - for(i=0;i<16 && n<=max;i++,n++)
6126 - printk("%2x ",read_nic_byte(dev,n));
6127 - }
6128 - printk("\n");
6129 -}
6130 -
6131 -/****************************************************************************
6132 - ------------------------------HW STUFF---------------------------
6133 -*****************************************************************************/
6134 -
6135 -
6136 -void rtl8180_irq_enable(struct net_device *dev)
6137 -{
6138 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
6139 - //priv->irq_enabled = 1;
6140 -/*
6141 - write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
6142 - INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
6143 - INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
6144 - INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
6145 -*/
6146 - write_nic_word(dev,INTA_MASK, priv->irq_mask);
6147 -}
6148 -
6149 -
6150 -void rtl8180_irq_disable(struct net_device *dev)
6151 -{
6152 -// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
6153 -
6154 - write_nic_word(dev,INTA_MASK,0);
6155 - force_pci_posting(dev);
6156 -// priv->irq_enabled = 0;
6157 -}
6158 -
6159 -
6160 -void rtl8180_set_mode(struct net_device *dev,int mode)
6161 -{
6162 - u8 ecmd;
6163 - ecmd=read_nic_byte(dev, EPROM_CMD);
6164 - ecmd=ecmd &~ EPROM_CMD_OPERATING_MODE_MASK;
6165 - ecmd=ecmd | (mode<<EPROM_CMD_OPERATING_MODE_SHIFT);
6166 - ecmd=ecmd &~ (1<<EPROM_CS_SHIFT);
6167 - ecmd=ecmd &~ (1<<EPROM_CK_SHIFT);
6168 - write_nic_byte(dev, EPROM_CMD, ecmd);
6169 -}
6170 -
6171 -
6172 -void rtl8180_update_msr(struct net_device *dev)
6173 -{
6174 - struct r8180_priv *priv = ieee80211_priv(dev);
6175 - u8 msr;
6176 -
6177 - msr = read_nic_byte(dev, MSR);
6178 - msr &= ~ MSR_LINK_MASK;
6179 -
6180 - /* do not change in link_state != WLAN_LINK_ASSOCIATED.
6181 - * msr must be updated if the state is ASSOCIATING.
6182 - * this is intentional and make sense for ad-hoc and
6183 - * master (see the create BSS/IBSS func)
6184 - */
6185 - if (priv->ieee80211->state == IEEE80211_LINKED){
6186 -
6187 - if (priv->ieee80211->iw_mode == IW_MODE_INFRA)
6188 - msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT);
6189 - else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
6190 - msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT);
6191 - else if (priv->ieee80211->iw_mode == IW_MODE_MASTER)
6192 - msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT);
6193 -
6194 - }else
6195 - msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT);
6196 -
6197 - write_nic_byte(dev, MSR, msr);
6198 -}
6199 -
6200 -void rtl8180_set_chan(struct net_device *dev,short ch)
6201 -{
6202 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
6203 - u32 tx;
6204 - priv->chan=ch;
6205 - #if 0
6206 - if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
6207 - priv->ieee80211->iw_mode == IW_MODE_MASTER){
6208 -
6209 - priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
6210 - priv->ieee80211->master_chan = ch;
6211 - rtl8180_update_beacon_ch(dev);
6212 - }
6213 - #endif
6214 -
6215 - /* this hack should avoid frame TX during channel setting*/
6216 - tx = read_nic_dword(dev,TX_CONF);
6217 - tx &= ~TX_LOOPBACK_MASK;
6218 -
6219 -#ifndef LOOP_TEST
6220 - write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
6221 -
6222 - priv->rf_set_chan(dev,priv->chan);
6223 - mdelay(10);
6224 - write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
6225 -#endif
6226 -}
6227 -void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs);
6228 -
6229 -
6230 -void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb)
6231 -{
6232 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
6233 - int err;
6234 -
6235 -// u8 *rx;
6236 -
6237 - //DMESG("starting RX");
6238 - /*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC);
6239 - if(!rx){
6240 - DMESGE("unable to allocate RX buffer");
6241 - return;
6242 - }*/
6243 -
6244 - usb_fill_bulk_urb(rx_urb,priv->udev,
6245 - usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer,
6246 - RX_URB_SIZE,rtl8187_rx_isr,dev);
6247 - err = usb_submit_urb(rx_urb, GFP_ATOMIC);
6248 - if(err && err != -EPERM){
6249 - DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status);
6250 -
6251 - }
6252 -
6253 -}
6254 -
6255 -
6256 -void rtl8187_rx_initiate(struct net_device *dev)
6257 -{
6258 - int i;
6259 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
6260 -
6261 - if(!priv->rx_urb)
6262 - DMESGE("Cannot intiate RX urb mechanism");
6263 - for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
6264 - rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]);
6265 -
6266 -}
6267 -
6268 -void rtl8187_set_rxconf(struct net_device *dev)
6269 -{
6270 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
6271 - u32 rxconf;
6272 -
6273 - rxconf=read_nic_dword(dev,RX_CONF);
6274 - rxconf = rxconf &~ MAC_FILTER_MASK;
6275 - rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT);
6276 - rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
6277 - rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
6278 - rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
6279 - rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
6280 -
6281 - if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
6282 -
6283 - if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
6284 - dev->flags & IFF_PROMISC){
6285 - rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
6286 - }else{
6287 - rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT);
6288 - rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
6289 - }
6290 -
6291 - /*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){
6292 - rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
6293 - rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
6294 - }*/
6295 -
6296 - if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
6297 - rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
6298 - rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT);
6299 - }
6300 -
6301 - if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
6302 - rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
6303 -
6304 -
6305 - rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
6306 - rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
6307 -
6308 -
6309 - rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
6310 -
6311 - rxconf = rxconf &~ MAX_RX_DMA_MASK;
6312 - rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
6313 -
6314 - rxconf = rxconf | RCR_ONLYERLPKT;
6315 -
6316 -// rxconf = rxconf &~ RCR_CS_MASK;
6317 -// rxconf = rxconf | (1<<RCR_CS_SHIFT);
6318 -
6319 - write_nic_dword(dev, RX_CONF, rxconf);
6320 -
6321 - // V rtl suggested V //
6322 -// write_nic_dword(dev, RX_CONF, 0x901ce70e);
6323 -
6324 - //fix_rx_fifo(dev);
6325 -// //set_nic_rxring(dev);
6326 - #ifdef DEBUG_RX
6327 - DMESG("rxconf: %x %x",rxconf ,read_nic_dword(dev,RX_CONF));
6328 - #endif
6329 -}
6330 -
6331 -void rtl8180_rx_enable(struct net_device *dev)
6332 -{
6333 - u8 cmd;
6334 -
6335 -
6336 - rtl8187_rx_initiate(dev);
6337 -
6338 - rtl8187_set_rxconf(dev);
6339 -
6340 - cmd=read_nic_byte(dev,CMD);
6341 - write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
6342 -#if 0
6343 - /* In rtl8139 driver seems that DMA threshold has to be written
6344 - * after enabling RX, so we rewrite RX_CONFIG register
6345 - */
6346 - //mdelay(100);
6347 - write_nic_dword(dev, RX_CONF, rxconf);
6348 -
6349 -#endif
6350 -
6351 -}
6352 -
6353 -
6354 -void rtl8180_tx_enable(struct net_device *dev)
6355 -{
6356 - u8 cmd;
6357 - u8 byte;
6358 - u32 txconf;
6359 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
6360 -
6361 - byte = read_nic_byte(dev,CW_CONF);
6362 - byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
6363 - byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
6364 - write_nic_byte(dev, CW_CONF, byte);
6365 -
6366 - byte = read_nic_byte(dev, TX_AGC_CTL);
6367 - byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
6368 - byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
6369 - byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT);
6370 - write_nic_byte(dev, TX_AGC_CTL, byte);
6371 -
6372 - txconf= read_nic_dword(dev,TX_CONF);
6373 -
6374 - #if 0
6375 - if(priv->card_8185){
6376 -
6377 - txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
6378 -
6379 - }else{
6380 -
6381 - if(priv->ieee80211->hw_seq)
6382 - txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
6383 - else
6384 - txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
6385 - }
6386 - #endif
6387 -
6388 - txconf = txconf &~ TX_LOOPBACK_MASK;
6389 -
6390 -#ifndef LOOP_TEST
6391 - txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
6392 -#else
6393 - txconf = txconf | (TX_LOOPBACK_BASEBAND<<TX_LOOPBACK_SHIFT);
6394 -#endif
6395 - txconf = txconf &~ TCR_DPRETRY_MASK;
6396 - txconf = txconf &~ TCR_RTSRETRY_MASK;
6397 -
6398 - txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
6399 - txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
6400 -
6401 - txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
6402 -
6403 - txconf = txconf &~ TCR_MXDMA_MASK;
6404 - txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
6405 -
6406 - txconf = txconf | TCR_CWMIN;
6407 - txconf = txconf | TCR_DISCW;
6408 - txconf = txconf &~ TCR_SWPLCPLEN;
6409 -
6410 - txconf=txconf | (1<<TX_NOICV_SHIFT);
6411 -
6412 - write_nic_dword(dev,TX_CONF,txconf);
6413 -
6414 - // V RTL suggested V //
6415 -// write_nic_dword(dev,TX_CONF,0x00e00707);
6416 -
6417 -
6418 -#ifdef DEBUG_TX
6419 - DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF));
6420 -#endif
6421 -
6422 - cmd=read_nic_byte(dev,CMD);
6423 - write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
6424 -
6425 -// mdelay(100);
6426 - //write_nic_dword(dev,TX_CONF,txconf);
6427 -// #endif
6428 -/*
6429 - rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
6430 - write_nic_byte(dev, TX_DMA_POLLING, priv->dma_poll_mask);
6431 - rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
6432 - */
6433 -}
6434 -
6435 -#if 0
6436 -void rtl8180_beacon_tx_enable(struct net_device *dev)
6437 -{
6438 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
6439 - priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
6440 - rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
6441 - write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
6442 - rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
6443 -}
6444 -
6445 -
6446 -void rtl8180_
6447 -_disable(struct net_device *dev)
6448 -{
6449 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
6450 - priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
6451 - rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
6452 - write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
6453 - rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
6454 -}
6455 -
6456 -#endif
6457 -
6458 -
6459 -void rtl8180_rtx_disable(struct net_device *dev)
6460 -{
6461 - u8 cmd;
6462 - int i;
6463 - struct r8180_priv *priv = ieee80211_priv(dev);
6464 -
6465 - cmd=read_nic_byte(dev,CMD);
6466 - write_nic_byte(dev, CMD, cmd &~ \
6467 - ((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
6468 - force_pci_posting(dev);
6469 - mdelay(10);
6470 - if(priv->rx_urb){
6471 - for(i=0;i<MAX_RX_URB;i++)
6472 - usb_kill_urb(priv->rx_urb[i]);
6473 - }
6474 - /*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT))
6475 - udelay(10);
6476 - */
6477 -
6478 -// if(!priv->rx_skb_complete)
6479 -// dev_kfree_skb_any(priv->rx_skb);
6480 -}
6481 -
6482 -
6483 -int alloc_tx_beacon_desc_ring(struct net_device *dev, int count)
6484 -{
6485 - #if 0
6486 - int i;
6487 - u32 *tmp;
6488 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
6489 -
6490 - priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
6491 - sizeof(u32)*8*count,
6492 - &priv->txbeaconringdma);
6493 - if (!priv->txbeaconring) return -1;
6494 - for (tmp=priv->txbeaconring,i=0;i<count;i++){
6495 - *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
6496 - /*
6497 - *(tmp+2) = (u32)dma_tmp;
6498 - *(tmp+3) = bufsize;
6499 - */
6500 - if(i+1<count)
6501 - *(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
6502 - else
6503 - *(tmp+4) = (u32)priv->txbeaconringdma;
6504 -
6505 - tmp=tmp+8;
6506 - }
6507 - #endif
6508 - return 0;
6509 -}
6510 -
6511 -
6512 -void rtl8180_reset(struct net_device *dev)
6513 -{
6514 -
6515 - u8 cr;
6516 -
6517 - /* make sure the analog power is on before
6518 - * reset, otherwise reset may fail
6519 - */
6520 - rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
6521 - rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
6522 -
6523 - rtl8180_irq_disable(dev);
6524 -
6525 - mdelay(200);
6526 - write_nic_byte_E(dev,0x18,0x10);
6527 - write_nic_byte_E(dev,0x18,0x11);
6528 - write_nic_byte_E(dev,0x18,0x00);
6529 - mdelay(200);
6530 -
6531 - cr=read_nic_byte(dev,CMD);
6532 - cr = cr & 2;
6533 - cr = cr | (1<<CMD_RST_SHIFT);
6534 - write_nic_byte(dev,CMD,cr);
6535 -
6536 - force_pci_posting(dev);
6537 -
6538 - mdelay(200);
6539 -
6540 - if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
6541 - DMESGW("Card reset timeout!");
6542 - else
6543 - DMESG("Card successfully reset");
6544 -
6545 - rtl8180_set_mode(dev,EPROM_CMD_LOAD);
6546 - force_pci_posting(dev);
6547 - mdelay(200);
6548 -
6549 - /* after the eeprom load cycle, make sure we have
6550 - * correct anaparams
6551 - */
6552 - rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
6553 - rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
6554 -
6555 -}
6556 -
6557 -inline u16 ieeerate2rtlrate(int rate)
6558 -{
6559 - switch(rate){
6560 - case 10:
6561 - return 0;
6562 - case 20:
6563 - return 1;
6564 - case 55:
6565 - return 2;
6566 - case 110:
6567 - return 3;
6568 - case 60:
6569 - return 4;
6570 - case 90:
6571 - return 5;
6572 - case 120:
6573 - return 6;
6574 - case 180:
6575 - return 7;
6576 - case 240:
6577 - return 8;
6578 - case 360:
6579 - return 9;
6580 - case 480:
6581 - return 10;
6582 - case 540:
6583 - return 11;
6584 - default:
6585 - return 3;
6586 -
6587 - }
6588 -}
6589 -static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540};
6590 -inline u16 rtl8180_rate2rate(short rate)
6591 -{
6592 - if (rate >11) return 0;
6593 - return rtl_rate[rate];
6594 -}
6595 -
6596 -
6597 -void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
6598 -{
6599 - struct net_device *dev = (struct net_device*)rx_urb->context;
6600 - struct r8180_priv *priv = ieee80211_priv(dev);
6601 -
6602 - priv->rxurb_task = rx_urb;
6603 -// DMESGW("David: Rx tasklet start!");
6604 - tasklet_schedule(&priv->irq_rx_tasklet);
6605 -// DMESGW("=David: Rx tasklet finish!");
6606 -}
6607 -
6608 -#if 0
6609 -void rtl8180_tx_queues_stop(struct net_device *dev)
6610 -{
6611 - //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
6612 - u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
6613 - dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
6614 - dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
6615 - dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
6616 -
6617 - rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
6618 - write_nic_byte(dev,TX_DMA_POLLING,dma_poll_mask);
6619 - rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
6620 -}
6621 -#endif
6622 -
6623 -void rtl8180_data_hard_stop(struct net_device *dev)
6624 -{
6625 - //FIXME !!
6626 - #if 0
6627 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
6628 - priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
6629 - rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
6630 - write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
6631 - rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
6632 - #endif
6633 -}
6634 -
6635 -
6636 -void rtl8180_data_hard_resume(struct net_device *dev)
6637 -{
6638 - // FIXME !!
6639 - #if 0
6640 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
6641 - priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
6642 - rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
6643 - write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
6644 - rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
6645 - #endif
6646 -}
6647 -
6648 -
6649 -/* this function TX data frames when the ieee80211 stack requires this.
6650 - * It checks also if we need to stop the ieee tx queue, eventually do it
6651 - */
6652 -void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
6653 -{
6654 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
6655 -
6656 - short morefrag = 0;
6657 - unsigned long flags;
6658 - struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
6659 -
6660 - if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
6661 - morefrag = 1;
6662 -// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
6663 - /*
6664 - * This function doesn't require lock because we make
6665 - * sure it's called with the tx_lock already acquired.
6666 - * this come from the kernel's hard_xmit callback (trought
6667 - * the ieee stack, or from the try_wake_queue (again trought
6668 - * the ieee stack.
6669 - */
6670 - spin_lock_irqsave(&priv->tx_lock,flags);
6671 -
6672 - //DMESG("TX");
6673 - if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
6674 - DMESG("Error: no TX slot ");
6675 - ieee80211_stop_queue(priv->ieee80211);
6676 - }
6677 -
6678 - rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
6679 - ieeerate2rtlrate(rate));
6680 -
6681 - priv->stats.txdatapkt++;
6682 -
6683 - if (!check_nic_enought_desc(dev, LOW_PRIORITY))
6684 - ieee80211_stop_queue(priv->ieee80211);
6685 -
6686 - spin_unlock_irqrestore(&priv->tx_lock,flags);
6687 -
6688 -}
6689 -#if 0
6690 -/* This is a rough attempt to TX a frame
6691 - * This is called by the ieee 80211 stack to TX management frames.
6692 - * If the ring is full packet are dropped (for data frame the queue
6693 - * is stopped before this can happen).
6694 - */
6695 -int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
6696 -{
6697 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
6698 - int ret;
6699 - unsigned long flags;
6700 -
6701 - spin_lock_irqsave(&priv->tx_lock,flags);
6702 -
6703 - ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE);
6704 -/*
6705 - int i;
6706 - for(i=0;i<skb->len;i++)
6707 - printk("%x ", skb->data[i]);
6708 - printk("--------------------\n");
6709 -*/
6710 - priv->ieee80211->stats.tx_bytes+=skb->len;
6711 - priv->ieee80211->stats.tx_packets++;
6712 -
6713 - spin_unlock_irqrestore(&priv->tx_lock,flags);
6714 -
6715 - dev_kfree_skb_any(skb);
6716 - return ret;
6717 -}
6718 -#endif
6719 -
6720 -#if 0
6721 -// longpre 144+48 shortpre 72+24
6722 -u16 rtl8180_len2duration(u32 len, short rate,short* ext)
6723 -{
6724 - u16 duration;
6725 - u16 drift;
6726 - *ext=0;
6727 -
6728 - switch(rate){
6729 - case 0://1mbps
6730 - *ext=0;
6731 - duration = ((len+4)<<4) /0x2;
6732 - drift = ((len+4)<<4) % 0x2;
6733 - if(drift ==0 ) break;
6734 - duration++;
6735 - break;
6736 -
6737 - case 1://2mbps
6738 - *ext=0;
6739 - duration = ((len+4)<<4) /0x4;
6740 - drift = ((len+4)<<4) % 0x4;
6741 - if(drift ==0 ) break;
6742 - duration++;
6743 - break;
6744 -
6745 - case 2: //5.5mbps
6746 - *ext=0;
6747 - duration = ((len+4)<<4) /0xb;
6748 - drift = ((len+4)<<4) % 0xb;
6749 - if(drift ==0 )
6750 - break;
6751 - duration++;
6752 - break;
6753 -
6754 - default:
6755 - case 3://11mbps
6756 - *ext=0;
6757 - duration = ((len+4)<<4) /0x16;
6758 - drift = ((len+4)<<4) % 0x16;
6759 - if(drift ==0 )
6760 - break;
6761 - duration++;
6762 - if(drift > 6)
6763 - break;
6764 - *ext=1;
6765 - break;
6766 - }
6767 -
6768 - return duration;
6769 -}
6770 -#endif
6771 -
6772 -void rtl8180_try_wake_queue(struct net_device *dev, int pri);
6773 -
6774 -void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs)
6775 -{
6776 - struct net_device *dev = (struct net_device*)tx_urb->context;
6777 - struct r8180_priv *priv = ieee80211_priv(dev);
6778 - if(tx_urb->status == 0)
6779 - priv->stats.txlpokint++;
6780 - else
6781 - priv->stats.txlperr++;
6782 - kfree(tx_urb->transfer_buffer);
6783 - usb_free_urb(tx_urb);
6784 - atomic_dec(&priv->tx_lp_pending);
6785 - rtl8180_try_wake_queue(dev,LOW_PRIORITY);
6786 -}
6787 -
6788 -
6789 -void rtl8187_beacon_stop(struct net_device *dev)
6790 -{
6791 - u8 msr, msrm, msr2;
6792 - msr = read_nic_byte(dev, MSR);
6793 - msrm = msr & MSR_LINK_MASK;
6794 - msr2 = msr & ~MSR_LINK_MASK;
6795 - if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) ||
6796 - (msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){
6797 - write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE);
6798 - write_nic_byte(dev, MSR, msr);
6799 - }
6800 -
6801 -
6802 -}
6803 -
6804 -
6805 -void rtl8187_net_update(struct net_device *dev)
6806 -{
6807 -
6808 - struct r8180_priv *priv = ieee80211_priv(dev);
6809 - struct ieee80211_network *net;
6810 - net = & priv->ieee80211->current_network;
6811 -
6812 -
6813 - write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]);
6814 - write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]);
6815 - //for(i=0;i<ETH_ALEN;i++)
6816 - // write_nic_byte(dev,BSSID+i,net->bssid[i]);
6817 -
6818 - rtl8180_update_msr(dev);
6819 -
6820 -// rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
6821 - write_nic_word(dev, AtimWnd, 2);
6822 - write_nic_word(dev, AtimtrItv, 100);
6823 - write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval);
6824 - write_nic_word(dev, BcnIntTime, 100);
6825 -
6826 -
6827 -}
6828 -
6829 -void rtl8187_beacon_tx(struct net_device *dev)
6830 -{
6831 -
6832 - struct r8180_priv *priv = ieee80211_priv(dev);
6833 - struct sk_buff *skb;
6834 - int i = 0;
6835 -
6836 - rtl8187_net_update(dev);
6837 -
6838 - skb = ieee80211_get_beacon(priv->ieee80211);
6839 -
6840 -
6841 - if(!skb){
6842 - DMESG("not enought memory for allocating beacon");
6843 - return;
6844 - }
6845 -
6846 -#if 0
6847 - while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){
6848 - msleep_interruptible_rtl(HZ/2);
6849 - if(i++ > 20){
6850 - DMESG("get stuck to wait EP3 become ready");
6851 - return ;
6852 - }
6853 - }
6854 -#endif
6855 - write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7));
6856 -
6857 - i=0;
6858 - //while(!read_nic_byte(dev,BQREQ & (1<<7)))
6859 - while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 )
6860 - {
6861 - msleep_interruptible_rtl(HZ/2);
6862 - if(i++ > 10){
6863 - DMESG("get stuck to wait HW beacon to be ready");
6864 - return ;
6865 - }
6866 - }
6867 -
6868 - rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY,
6869 - 0, priv->ieee80211->basic_rate);
6870 -
6871 -}
6872 -
6873 -void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs)
6874 -{
6875 - struct net_device *dev = (struct net_device*)tx_urb->context;
6876 - struct r8180_priv *priv = ieee80211_priv(dev);
6877 - if(tx_urb->status == 0)
6878 - priv->stats.txnpokint++;
6879 - else
6880 - priv->stats.txnperr++;
6881 - kfree(tx_urb->transfer_buffer);
6882 - usb_free_urb(tx_urb);
6883 - atomic_dec(&priv->tx_np_pending);
6884 - //rtl8180_try_wake_queue(dev,NORM_PRIORITY);
6885 -}
6886 -
6887 -
6888 -/* This function do the real dirty work: it sends a TX command
6889 - * descriptor plus data URB
6890 - */
6891 -
6892 -short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority,
6893 - short morefrag, short rate)
6894 -{
6895 - u32 *tx;
6896 -// u16 duration;
6897 -// short ext;
6898 - int pend ;
6899 - int status;
6900 - struct urb *tx_urb;
6901 - int urb_len;
6902 - struct r8180_priv *priv = ieee80211_priv(dev);
6903 -// int rate = ieeerate2rtlrate(priv->ieee80211->rate);
6904 -
6905 - pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
6906 - /* we are locked here so the two atomic_read and inc are executed without interleaves */
6907 - if( pend > MAX_TX_URB){
6908 - if(priority == NORM_PRIORITY)
6909 - priv->stats.txnpdrop++;
6910 - else
6911 - priv->stats.txlpdrop++;
6912 - return -1;
6913 - }
6914 -
6915 -
6916 - //tx = kmalloc((len + 4*3), GFP_ATOMIC);
6917 - urb_len = len + 4*3;
6918 - if((0 == urb_len%64)||(0 == urb_len%512)) {
6919 - urb_len += 1;
6920 - }
6921 - tx = kmalloc(urb_len, GFP_ATOMIC);
6922 - if(!tx) return -ENOMEM;
6923 -printk(KERN_WARNING "urb_len = %d\n", urb_len);
6924 - tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
6925 -
6926 - if(!tx_urb){
6927 -
6928 - kfree(tx);
6929 - return -ENOMEM;
6930 - }
6931 -
6932 - memcpy(tx+3,txbuf,len);
6933 - tx[0] = 0;
6934 - tx[0] |= len & 0xfff;
6935 - tx[0] |= (1<<15);
6936 -
6937 -// if(priv->shortpre)
6938 -// tx[0] |= (1<<16);
6939 -
6940 - //if(len > priv->rts_threshold){
6941 -// tx[0] |= (1<<23); //ENABLE RTS
6942 -// tx[0] |= (1<<18); //ENABLE CTS
6943 - //}
6944 - if(morefrag) tx[0] |= (1<<17);
6945 - tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
6946 - tx[0] |= (rate << 24);
6947 - tx[1] = 0;
6948 -
6949 -// duration = rtl8180_len2duration(len,
6950 -// rate,&ext);
6951 -// tx[1] |= (duration & 0x7fff) <<16;
6952 -// if(ext) tx[1] |= (1<<31);
6953 -
6954 -
6955 -// tx[2] = 0x303020;
6956 - tx[2] = 3; // CW min
6957 - tx[2] |= (7<<4); //CW max
6958 - tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim
6959 -
6960 -// printk("%x\n%x\n",tx[0],tx[1]);
6961 -
6962 - #ifdef DUMP_TX
6963 - int i;
6964 - printk("<Tx pkt>--rate %x---",rate);
6965 - for (i = 0; i < (len + 3); i++)
6966 - printk("%2x", ((u8*)tx)[i]);
6967 - printk("---------------\n");
6968 - #endif
6969 -
6970 -
6971 - /* FIXME check what EP is for low/norm PRI */
6972 - usb_fill_bulk_urb(tx_urb,priv->udev,
6973 - usb_sndbulkpipe(priv->udev,(priority == LOW_PRIORITY) ? 2:3), tx,
6974 - urb_len, (priority == LOW_PRIORITY)?rtl8187_lptx_isr:rtl8187_nptx_isr, dev);
6975 - status = usb_submit_urb(tx_urb, GFP_ATOMIC);
6976 - if (!status){
6977 - atomic_inc((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
6978 - return 0;
6979 - }else{
6980 - DMESGE("Error TX URB %d, error %d",
6981 - atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending),
6982 - status);
6983 - return -1;
6984 - }
6985 -}
6986 -
6987 -
6988 -
6989 -void rtl8180_irq_rx_tasklet(struct r8180_priv * priv);
6990 -
6991 -
6992 -short rtl8187_usb_initendpoints(struct net_device *dev)
6993 -{
6994 - struct r8180_priv *priv = ieee80211_priv(dev);
6995 - int i;
6996 -
6997 - priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
6998 -
6999 - for(i=0;i<MAX_RX_URB;i++){
7000 - priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL);
7001 - if(!priv->rx_urb[i])
7002 - goto destroy;
7003 -
7004 - priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL);
7005 - if(!priv->rx_urb[i]->transfer_buffer)
7006 - goto destroy1;
7007 -
7008 - priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE;
7009 - }
7010 -
7011 - return 0;
7012 -
7013 -destroy1:
7014 - usb_free_urb(priv->rx_urb[i]);
7015 -
7016 -destroy:
7017 - while (--i >= 0){
7018 - kfree(priv->rx_urb[i]->transfer_buffer);
7019 - usb_free_urb(priv->rx_urb[i]);
7020 - }
7021 -
7022 - kfree(priv->rx_urb);
7023 -
7024 - priv->rx_urb = NULL;
7025 - DMESGE("Endpoint Alloc Failure");
7026 - return -ENOMEM;
7027 -
7028 -}
7029 -
7030 -void rtl8187_usb_deleteendpoints(struct net_device *dev)
7031 -{
7032 - struct r8180_priv *priv = ieee80211_priv(dev);
7033 - int i;
7034 -
7035 - if(priv->rx_urb){
7036 - for(i=0;i<MAX_RX_URB;i++){
7037 - usb_kill_urb(priv->rx_urb[i]);
7038 - kfree(priv->rx_urb[i]->transfer_buffer);
7039 - usb_free_urb(priv->rx_urb[i]);
7040 - }
7041 - kfree(priv->rx_urb);
7042 - priv->rx_urb = NULL;
7043 -
7044 - }
7045 -
7046 -}
7047 -
7048 -
7049 -void rtl8187_set_rate(struct net_device *dev)
7050 -{
7051 - int i;
7052 - u16 word;
7053 - int basic_rate,min_rr_rate,max_rr_rate;
7054 -
7055 -// struct r8180_priv *priv = ieee80211_priv(dev);
7056 -
7057 - //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
7058 -// priv->ieee80211->state == IEEE80211_LINKED){
7059 - basic_rate = ieeerate2rtlrate(240);
7060 - min_rr_rate = ieeerate2rtlrate(60);
7061 - max_rr_rate = ieeerate2rtlrate(240);
7062 -
7063 -//
7064 -// }else{
7065 -// basic_rate = ieeerate2rtlrate(20);
7066 -// min_rr_rate = ieeerate2rtlrate(10);
7067 -// max_rr_rate = ieeerate2rtlrate(110);
7068 -// }
7069 -
7070 - write_nic_byte(dev, RESP_RATE,
7071 - max_rr_rate<<MAX_RESP_RATE_SHIFT| min_rr_rate<<MIN_RESP_RATE_SHIFT);
7072 -
7073 - word = read_nic_word(dev, BRSR);
7074 - word &= ~BRSR_MBR_8185;
7075 -
7076 -
7077 - for(i=0;i<=basic_rate;i++)
7078 - word |= (1<<i);
7079 -
7080 - write_nic_word(dev, BRSR, word);
7081 - //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
7082 -}
7083 -
7084 -
7085 -void rtl8187_link_change(struct net_device *dev)
7086 -{
7087 -// int i;
7088 -
7089 - struct r8180_priv *priv = ieee80211_priv(dev);
7090 - //write_nic_word(dev, BintrItv, net->beacon_interval);
7091 - rtl8187_net_update(dev);
7092 - /*update timing params*/
7093 - rtl8180_set_chan(dev, priv->chan);
7094 -
7095 - rtl8187_set_rxconf(dev);
7096 -}
7097 -
7098 -void rtl8180_irq_rx_tasklet(struct r8180_priv *priv);
7099 -
7100 -short rtl8180_init(struct net_device *dev)
7101 -{
7102 -
7103 - struct r8180_priv *priv = ieee80211_priv(dev);
7104 - int i, j;
7105 - u16 word;
7106 - int ch;
7107 - //u16 version;
7108 - //u8 hw_version;
7109 - //u8 config3;
7110 -
7111 - //FIXME: these constants are placed in a bad pleace.
7112 -
7113 -// priv->txbuffsize = 1024;
7114 -// priv->txringcount = 32;
7115 -// priv->rxbuffersize = 1024;
7116 -// priv->rxringcount = 32;
7117 -// priv->txbeaconcount = 3;
7118 -// priv->rx_skb_complete = 1;
7119 - //priv->txnp_pending.ispending=0;
7120 - /* ^^ the SKB does not containt a partial RXed
7121 - * packet (is empty)
7122 - */
7123 -
7124 - if(!channels){
7125 - DMESG("No channels, aborting");
7126 - return -1;
7127 - }
7128 - ch=channels;
7129 - // set channels 1..14 allowed in given locale
7130 - for (i=1; i<=14; i++) {
7131 - (priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
7132 - ch >>= 1;
7133 - }
7134 - //memcpy(priv->stats,0,sizeof(struct Stats));
7135 -
7136 - //priv->irq_enabled=0;
7137 -
7138 -// priv->stats.rxdmafail=0;
7139 - priv->stats.txrdu=0;
7140 -// priv->stats.rxrdu=0;
7141 -// priv->stats.rxnolast=0;
7142 -// priv->stats.rxnodata=0;
7143 - //priv->stats.rxreset=0;
7144 - //priv->stats.rxwrkaround=0;
7145 -// priv->stats.rxnopointer=0;
7146 - priv->stats.txnperr=0;
7147 - priv->stats.txresumed=0;
7148 -// priv->stats.rxerr=0;
7149 -// priv->stats.rxoverflow=0;
7150 -// priv->stats.rxint=0;
7151 - priv->stats.txnpokint=0;
7152 - /*priv->stats.txhpokint=0;
7153 - priv->stats.txhperr=0;*/
7154 - priv->stats.rxurberr=0;
7155 - priv->stats.rxstaterr=0;
7156 - priv->stats.txoverflow=0;
7157 - priv->stats.rxok=0;
7158 -// priv->stats.txbeaconerr=0;
7159 - priv->stats.txlperr=0;
7160 - priv->stats.txlpokint=0;
7161 -
7162 - priv->ieee80211->iw_mode = IW_MODE_INFRA;
7163 -
7164 - priv->retry_rts = DEFAULT_RETRY_RTS;
7165 - priv->retry_data = DEFAULT_RETRY_DATA;
7166 - priv->ieee80211->rate = 110; //11 mbps
7167 - priv->ieee80211->short_slot = 1;
7168 - priv->ieee80211->mode = IEEE_G;
7169 - priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
7170 - spin_lock_init(&priv->tx_lock);
7171 - INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
7172 - sema_init(&priv->wx_sem,1);
7173 - tasklet_init(&priv->irq_rx_tasklet,
7174 - (void(*)(unsigned long))rtl8180_irq_rx_tasklet,
7175 - (unsigned long)priv);
7176 -
7177 - //priv->ieee80211->func =
7178 - // kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL);
7179 - //memset(priv->ieee80211->func, 0,
7180 - // sizeof(struct ieee80211_helper_functions));
7181 - priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
7182 - priv->ieee80211->iw_mode = IW_MODE_INFRA;
7183 - priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
7184 - IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
7185 - IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE |
7186 - /*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE;
7187 -
7188 - priv->ieee80211->active_scan = 1;
7189 - priv->ieee80211->rate = 110; //11 mbps
7190 - priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION;
7191 - priv->ieee80211->host_encrypt = 1;
7192 - priv->ieee80211->host_decrypt = 1;
7193 - priv->ieee80211->start_send_beacons = rtl8187_beacon_tx;
7194 - priv->ieee80211->stop_send_beacons = rtl8187_beacon_stop;
7195 - //priv->ieee80211->softmac_hard_start_xmit = rtl8180_hard_start_xmit;
7196 - priv->ieee80211->softmac_hard_start_xmit = NULL;
7197 - priv->ieee80211->set_chan = rtl8180_set_chan;
7198 - priv->ieee80211->link_change = rtl8187_link_change;
7199 - priv->ieee80211->softmac_data_hard_start_xmit = rtl8180_hard_data_xmit;
7200 - priv->ieee80211->data_hard_stop = rtl8180_data_hard_stop;
7201 - priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume;
7202 - //priv->ieee80211->start_send_beacons = NULL;
7203 - //priv->ieee80211->stop_send_beacons = NULL;
7204 -
7205 - priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
7206 -
7207 - priv->card_8185 = 2;
7208 - priv->phy_ver = 2;
7209 - priv->card_type = USB;
7210 -
7211 - #if 0
7212 - hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
7213 -
7214 - switch (hw_version){
7215 - case HW_VERID_R8185_ABC:
7216 - DMESG("MAC controller is a RTL8185 b/g");
7217 - priv->card_8185 = 1;
7218 - /* you should not find a card with 8225 PHY ver < C*/
7219 - priv->phy_ver = 2;
7220 - break;
7221 -
7222 - case HW_VERID_R8185_D:
7223 - DMESG("MAC controller is a RTL8185 b/g (V. D)");
7224 - priv->card_8185 = 2;
7225 - /* you should not find a card with 8225 PHY ver < C*/
7226 - priv->phy_ver = 2;
7227 - break;
7228 -
7229 - case HW_VERID_R8180_ABCD:
7230 - DMESG("MAC controller is a RTL8180");
7231 - priv->card_8185 = 0;
7232 - break;
7233 -
7234 - case HW_VERID_R8180_F:
7235 - DMESG("MAC controller is a RTL8180 (v. F)");
7236 - priv->card_8185 = 0;
7237 - break;
7238 -
7239 - default:
7240 - DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version);
7241 - priv->card_8185 = 0;
7242 - break;
7243 - }
7244 -
7245 -
7246 - /* you should not found any 8185 Ver B Card */
7247 - priv->card_8185_Bversion = 0;
7248 -
7249 - config3 = read_nic_byte(dev, CONFIG3);
7250 - if(config3 & 0x8){
7251 - priv->card_type = CARDBUS;
7252 - DMESG("This is a CARDBUS NIC");
7253 - }
7254 - else if( config3 & 0x4){
7255 - priv->card_type = MINIPCI;
7256 - DMESG("This is a MINI-PCI NIC");
7257 - }else{
7258 - priv->card_type = PCI;
7259 - DMESG("This is a PCI NIC");
7260 - }
7261 - #endif
7262 - priv->enable_gpio0 = 0;
7263 -
7264 -
7265 - /* commented out just because we already do
7266 - this when resetting the card
7267 - andrea 20050924
7268 - */
7269 - #if 0
7270 -
7271 - u8 txcr, txreg50;
7272 - u32 txreg54, txreg60;
7273 -
7274 - /* enable A/D D/A register */
7275 - txcr = read_nic_byte(dev, 0x59);
7276 -// DMESG("<txcr:%x>", txcr);
7277 - //write_nic_word(dev, 0x59, 0x44);
7278 - write_nic_byte(dev, 0x59, 0x44);
7279 - //write_nic_byte(dev, 0x59, 0xea);
7280 - txcr = read_nic_byte(dev, 0x59);
7281 -// DMESG("<<txcr:%x>>", txcr);
7282 -
7283 - txreg50 = read_nic_byte(dev, 0x50);
7284 - // DMESG("<txreg50:%x>", txreg50);
7285 - write_nic_byte(dev, 0x50, 0xc0);
7286 - txreg50 = read_nic_byte(dev, 0x50);
7287 - // DMESG("<<txreg50:%x>>", txreg50);
7288 -
7289 -
7290 - txreg54 = read_nic_dword(dev, 0x54);
7291 - // DMESG("<txreg54:%x>", txreg54);
7292 - txreg54 = 0xa0000a59;
7293 - // DMESG("<<txreg54:%x>>", txreg54);
7294 - write_nic_dword(dev, 0x54, txreg54);
7295 - txreg54 = read_nic_dword(dev, 0x54);
7296 - // DMESG("<<<txreg54:%x>>>", txreg54);
7297 -
7298 - txreg60 = read_nic_dword(dev, 0x60);
7299 - // DMESG("<txreg60:%x>", txreg60);
7300 -
7301 - write_nic_byte(dev, 0x50, 0x0);
7302 - txcr = read_nic_byte(dev, 0x50);
7303 - // DMESG("<<txcr:%x>>", txcr);
7304 -
7305 -#endif
7306 -
7307 - /*the eeprom type is stored in RCR register bit #6 */
7308 - if (RCR_9356SEL & read_nic_dword(dev, RCR)){
7309 - priv->epromtype=EPROM_93c56;
7310 - DMESG("Reported EEPROM chip is a 93c56 (2Kbit)");
7311 - }else{
7312 - priv->epromtype=EPROM_93c46;
7313 - DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
7314 - }
7315 -
7316 - dev->get_stats = rtl8180_stats;
7317 -
7318 - dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
7319 - dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
7320 - dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff;
7321 - dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8;
7322 - dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff;
7323 - dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8;
7324 -
7325 - DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr));
7326 -
7327 - for(i=1,j=0; i<6; i+=2,j++){
7328 -
7329 - word = eprom_read(dev,EPROM_TXPW0 + j);
7330 - priv->chtxpwr[i]=word & 0xf;
7331 - priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4;
7332 - priv->chtxpwr[i+1]=(word & 0xf00)>>8;
7333 - priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12;
7334 - }
7335 -
7336 - for(i=1,j=0; i<4; i+=2,j++){
7337 -
7338 - word = eprom_read(dev,EPROM_TXPW1 + j);
7339 - priv->chtxpwr[i+6]=word & 0xf;
7340 - priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4;
7341 - priv->chtxpwr[i+6+1]=(word & 0xf00)>>8;
7342 - priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12;
7343 - }
7344 -
7345 - for(i=1,j=0; i<4; i+=2,j++){
7346 -
7347 - word = eprom_read(dev,EPROM_TXPW2 + j);
7348 - priv->chtxpwr[i+6+4]=word & 0xf;
7349 - priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4;
7350 - priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8;
7351 - priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12;
7352 - }
7353 -
7354 -
7355 - priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
7356 -
7357 - word = eprom_read(dev,EPROM_TXPW_BASE);
7358 - priv->cck_txpwr_base = word & 0xf;
7359 - priv->ofdm_txpwr_base = (word>>4) & 0xf;
7360 -
7361 - /* check RF frontend chipset */
7362 -
7363 - switch (priv->rf_chip) {
7364 -
7365 - case EPROM_RFCHIPID_RTL8225U:
7366 -
7367 - DMESG("Card reports RF frontend Realtek 8225");
7368 - DMESGW("This driver has EXPERIMENTAL support for this chipset.");
7369 - DMESGW("use it with care and at your own risk and");
7370 - DMESGW("**PLEASE** REPORT SUCCESS/INSUCCESS TO [email protected]");
7371 - if(rtl8225_is_V_z2(dev)){
7372 - priv->rf_init = rtl8225z2_rf_init;
7373 - priv->rf_set_chan = rtl8225z2_rf_set_chan;
7374 - priv->rf_set_sens = NULL;
7375 - DMESG("This seems a new V2 radio");
7376 - }else{
7377 - priv->rf_init = rtl8225_rf_init;
7378 - priv->rf_set_chan = rtl8225_rf_set_chan;
7379 - priv->rf_set_sens = rtl8225_rf_set_sens;
7380 - DMESG("This seems a legacy 1st version radio");
7381 - }
7382 - priv->rf_close = rtl8225_rf_close;
7383 -
7384 - priv->max_sens = RTL8225_RF_MAX_SENS;
7385 - priv->sens = RTL8225_RF_DEF_SENS;
7386 - break;
7387 -
7388 - default:
7389 - DMESGW("Unknown RF module %x",priv->rf_chip);
7390 - DMESGW("Exiting...");
7391 - return -1;
7392 -
7393 - }
7394 -
7395 -// DMESG("Energy threshold: %x",priv->cs_treshold);
7396 - DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7);
7397 - //DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2));
7398 -
7399 - if(rtl8187_usb_initendpoints(dev)!=0){
7400 - DMESG("Endopoints initialization failed");
7401 - return -ENOMEM;
7402 - }
7403 -#if 0
7404 - if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
7405 - return -ENOMEM;
7406 -
7407 - if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
7408 - TX_NORMPRIORITY_RING_ADDR))
7409 - return -ENOMEM;
7410 -
7411 - if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
7412 - TX_HIGHPRIORITY_RING_ADDR))
7413 - return -ENOMEM;
7414 -
7415 - if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
7416 - TX_LOWPRIORITY_RING_ADDR))
7417 - return -ENOMEM;
7418 -
7419 -
7420 - if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount))
7421 - return -ENOMEM;
7422 -#endif
7423 -
7424 -
7425 -#ifdef DEBUG_EPROM
7426 - dump_eprom(dev);
7427 -#endif
7428 - return 0;
7429 -
7430 -}
7431 -
7432 -void rtl8185_rf_pins_enable(struct net_device *dev)
7433 -{
7434 -/* u16 tmp;
7435 - tmp = read_nic_word(dev, RFPinsEnable);*/
7436 - write_nic_word(dev, RFPinsEnable, 0x1ff7);// | tmp);
7437 -}
7438 -
7439 -
7440 -void rtl8185_set_anaparam2(struct net_device *dev, u32 a)
7441 -{
7442 - u8 conf3;
7443 -
7444 - rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
7445 -
7446 - conf3 = read_nic_byte(dev, CONFIG3);
7447 - write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
7448 -
7449 - write_nic_dword(dev, ANAPARAM2, a);
7450 -
7451 - conf3 = read_nic_byte(dev, CONFIG3);
7452 - write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
7453 -
7454 - rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
7455 -
7456 -}
7457 -
7458 -
7459 -void rtl8180_set_anaparam(struct net_device *dev, u32 a)
7460 -{
7461 - u8 conf3;
7462 -
7463 - rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
7464 -
7465 - conf3 = read_nic_byte(dev, CONFIG3);
7466 - write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
7467 -
7468 - write_nic_dword(dev, ANAPARAM, a);
7469 -
7470 - conf3 = read_nic_byte(dev, CONFIG3);
7471 - write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
7472 -
7473 - rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
7474 -
7475 -}
7476 -
7477 -
7478 -void rtl8185_tx_antenna(struct net_device *dev, u8 ant)
7479 -{
7480 - write_nic_byte(dev, TX_ANTENNA, ant);
7481 - force_pci_posting(dev);
7482 - mdelay(1);
7483 -}
7484 -
7485 -
7486 -void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data)
7487 -{
7488 - //u8 phyr;
7489 - u32 phyw;
7490 -// int i;
7491 -
7492 - adr |= 0x80;
7493 -
7494 - phyw= ((data<<8) | adr);
7495 -
7496 -
7497 -
7498 - // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
7499 - write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24));
7500 - write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16));
7501 - write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8));
7502 - write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) ));
7503 -
7504 - //read_nic_dword(dev, PHY_ADR);
7505 -#if 0
7506 - for(i=0;i<10;i++){
7507 - write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw);
7508 - phyr = read_nic_byte(dev, PHY_READ);
7509 - if(phyr == (data&0xff)) break;
7510 -
7511 - }
7512 -#endif
7513 - /* this is ok to fail when we write AGC table. check for AGC table might be
7514 - * done by masking with 0x7f instead of 0xff
7515 - */
7516 - //if(phyr != (data&0xff)) DMESGW("Phy write timeout %x %x %x", phyr, data, adr);
7517 - mdelay(1);
7518 -}
7519 -
7520 -
7521 -inline void write_phy_ofdm (struct net_device *dev, u8 adr, u32 data)
7522 -{
7523 - data = data & 0xff;
7524 - rtl8187_write_phy(dev, adr, data);
7525 -}
7526 -
7527 -
7528 -void write_phy_cck (struct net_device *dev, u8 adr, u32 data)
7529 -{
7530 - data = data & 0xff;
7531 - rtl8187_write_phy(dev, adr, data | 0x10000);
7532 -}
7533 -
7534 -
7535 -void rtl8180_adapter_start(struct net_device *dev)
7536 -{
7537 - struct r8180_priv *priv = ieee80211_priv(dev);
7538 - //u32 anaparam;
7539 - //u8 config3;
7540 -
7541 - //rtl8180_rtx_disable(dev);
7542 - rtl8180_reset(dev);
7543 -
7544 - write_nic_byte(dev,0x85,0);
7545 - write_nic_byte(dev,0x91,0);
7546 -
7547 - /* light blink! */
7548 - write_nic_byte(dev,0x85,4);
7549 - write_nic_byte(dev,0x91,1);
7550 - write_nic_byte(dev,0x90,0);
7551 -
7552 - priv->irq_mask = 0xffff;
7553 -/*
7554 - priv->dma_poll_mask = 0;
7555 - priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT);
7556 -*/
7557 -// rtl8180_beacon_tx_disable(dev);
7558 -
7559 - rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
7560 - write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]);
7561 - write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff );
7562 -
7563 - rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
7564 - rtl8180_update_msr(dev);
7565 -
7566 - rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
7567 -
7568 - write_nic_word(dev,0xf4,0xffff);
7569 - write_nic_byte(dev,
7570 - CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
7571 -
7572 - rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
7573 -
7574 - write_nic_dword(dev,INT_TIMEOUT,0);
7575 -
7576 -#ifdef DEBUG_REGISTERS
7577 - rtl8180_dump_reg(dev);
7578 -#endif
7579 -
7580 -
7581 - write_nic_byte(dev, WPA_CONFIG, 0);
7582 -
7583 - write_nic_byte(dev, RATE_FALLBACK, 0x81);
7584 - rtl8187_set_rate(dev);
7585 -
7586 - priv->rf_init(dev);
7587 -
7588 - if(priv->rf_set_sens != NULL)
7589 - priv->rf_set_sens(dev,priv->sens);
7590 -
7591 - write_nic_word(dev,0x5e,1);
7592 -
7593 - #if 1
7594 - //mdelay(1);
7595 - write_nic_word(dev,0xfe,0x10);
7596 -// mdelay(1);
7597 - #endif
7598 - write_nic_byte(dev, TALLY_SEL, 0x80);//Set NQ retry count
7599 -
7600 - write_nic_byte(dev, 0xff, 0x60);
7601 -
7602 - write_nic_word(dev,0x5e,0);
7603 -
7604 -
7605 - rtl8180_irq_enable(dev);
7606 - /*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY));
7607 -
7608 - DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY));
7609 -
7610 - DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY));
7611 - if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK");
7612 - if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK");
7613 - if(check_nic_enought_desc(dev,LOW_PRIORITY)) DMESG("LOW OK");*/
7614 -}
7615 -
7616 -
7617 -
7618 -/* this configures registers for beacon tx and enables it via
7619 - * rtl8180_beacon_tx_enable(). rtl8180_beacon_tx_disable() might
7620 - * be used to stop beacon transmission
7621 - */
7622 -#if 0
7623 -void rtl8180_start_tx_beacon(struct net_device *dev)
7624 -{
7625 - int i;
7626 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
7627 - u16 word;
7628 - DMESG("Enabling beacon TX");
7629 - //write_nic_byte(dev, 0x42,0xe6);// TCR
7630 - //rtl8180_init_beacon(dev);
7631 - //set_nic_txring(dev);
7632 -// rtl8180_prepare_beacon(dev);
7633 - rtl8180_irq_disable(dev);
7634 -// rtl8180_beacon_tx_enable(dev);
7635 - rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
7636 - //write_nic_byte(dev,0x9d,0x20); //DMA Poll
7637 - //write_nic_word(dev,0x7a,0);
7638 - //write_nic_word(dev,0x7a,0x8000);
7639 -
7640 -
7641 - word = read_nic_word(dev, BcnItv);
7642 - word &= ~BcnItv_BcnItv; // clear Bcn_Itv
7643 - write_nic_word(dev, BcnItv, word);
7644 -
7645 - write_nic_word(dev, AtimWnd,
7646 - read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd);
7647 -
7648 - word = read_nic_word(dev, BintrItv);
7649 - word &= ~BintrItv_BintrItv;
7650 -
7651 - //word |= priv->ieee80211->beacon_interval *
7652 - // ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1);
7653 - // FIXME:FIXME check if correct ^^ worked with 0x3e8;
7654 -
7655 - write_nic_word(dev, BintrItv, word);
7656 -
7657 - //write_nic_word(dev,0x2e,0xe002);
7658 - //write_nic_dword(dev,0x30,0xb8c7832e);
7659 - for(i=0; i<ETH_ALEN; i++)
7660 - write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]);
7661 -
7662 -// rtl8180_update_msr(dev);
7663 -
7664 -
7665 - //write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */
7666 -
7667 - rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
7668 -
7669 - rtl8180_irq_enable(dev);
7670 -
7671 - /* VV !!!!!!!!!! VV*/
7672 - /*
7673 - rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
7674 - write_nic_byte(dev,0x9d,0x00);
7675 - rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
7676 -*/
7677 -}
7678 -#endif
7679 -/***************************************************************************
7680 - -------------------------------NET STUFF---------------------------
7681 -***************************************************************************/
7682 -static struct net_device_stats *rtl8180_stats(struct net_device *dev)
7683 -{
7684 - struct r8180_priv *priv = ieee80211_priv(dev);
7685 -
7686 - return &priv->ieee80211->stats;
7687 -}
7688 -
7689 -
7690 -int _rtl8180_up(struct net_device *dev)
7691 -{
7692 - struct r8180_priv *priv = ieee80211_priv(dev);
7693 -
7694 - priv->up=1;
7695 -
7696 - //DMESG("Bringing up iface");
7697 -
7698 - rtl8180_adapter_start(dev);
7699 -
7700 - rtl8180_rx_enable(dev);
7701 -
7702 - rtl8180_tx_enable(dev);
7703 -
7704 - ieee80211_softmac_start_protocol(priv->ieee80211);
7705 -
7706 - ieee80211_reset_queue(priv->ieee80211);
7707 - if(!netif_queue_stopped(dev))
7708 - netif_start_queue(dev);
7709 - else
7710 - netif_wake_queue(dev);
7711 -
7712 - return 0;
7713 -}
7714 -
7715 -
7716 -int rtl8180_open(struct net_device *dev)
7717 -{
7718 - struct r8180_priv *priv = ieee80211_priv(dev);
7719 - int ret;
7720 -
7721 - down(&priv->wx_sem);
7722 - ret = rtl8180_up(dev);
7723 - up(&priv->wx_sem);
7724 - return ret;
7725 -
7726 -}
7727 -
7728 -
7729 -int rtl8180_up(struct net_device *dev)
7730 -{
7731 - struct r8180_priv *priv = ieee80211_priv(dev);
7732 -
7733 - if (priv->up == 1) return -1;
7734 -
7735 - return _rtl8180_up(dev);
7736 -}
7737 -
7738 -
7739 -int rtl8180_close(struct net_device *dev)
7740 -{
7741 - struct r8180_priv *priv = ieee80211_priv(dev);
7742 - int ret;
7743 -
7744 - down(&priv->wx_sem);
7745 -
7746 - ret = rtl8180_down(dev);
7747 -
7748 - up(&priv->wx_sem);
7749 -
7750 - return ret;
7751 -
7752 -}
7753 -
7754 -int rtl8180_down(struct net_device *dev)
7755 -{
7756 - struct r8180_priv *priv = ieee80211_priv(dev);
7757 -
7758 - if (priv->up == 0) return -1;
7759 -
7760 - priv->up=0;
7761 -
7762 -/* FIXME */
7763 - if (!netif_queue_stopped(dev))
7764 - netif_stop_queue(dev);
7765 -
7766 - rtl8180_rtx_disable(dev);
7767 - rtl8180_irq_disable(dev);
7768 -
7769 - ieee80211_softmac_stop_protocol(priv->ieee80211);
7770 -
7771 - return 0;
7772 -}
7773 -
7774 -
7775 -void rtl8180_commit(struct net_device *dev)
7776 -{
7777 - struct r8180_priv *priv = ieee80211_priv(dev);
7778 -
7779 - if (priv->up == 0) return ;
7780 -
7781 - ieee80211_softmac_stop_protocol(priv->ieee80211);
7782 -
7783 - rtl8180_irq_disable(dev);
7784 - rtl8180_rtx_disable(dev);
7785 - _rtl8180_up(dev);
7786 -}
7787 -
7788 -void rtl8180_restart(struct net_device *dev)
7789 -{
7790 - struct r8180_priv *priv = ieee80211_priv(dev);
7791 -
7792 - down(&priv->wx_sem);
7793 -
7794 - rtl8180_commit(dev);
7795 -
7796 - up(&priv->wx_sem);
7797 -}
7798 -
7799 -static void r8180_set_multicast(struct net_device *dev)
7800 -{
7801 - struct r8180_priv *priv = ieee80211_priv(dev);
7802 - short promisc;
7803 -
7804 - //down(&priv->wx_sem);
7805 -
7806 - /* FIXME FIXME */
7807 -
7808 - promisc = (dev->flags & IFF_PROMISC) ? 1:0;
7809 -
7810 - if (promisc != priv->promisc)
7811 - // rtl8180_commit(dev);
7812 -
7813 - priv->promisc = promisc;
7814 -
7815 - //schedule_work(&priv->reset_wq);
7816 - //up(&priv->wx_sem);
7817 -}
7818 -
7819 -
7820 -int r8180_set_mac_adr(struct net_device *dev, void *mac)
7821 -{
7822 - struct r8180_priv *priv = ieee80211_priv(dev);
7823 - struct sockaddr *addr = mac;
7824 -
7825 - down(&priv->wx_sem);
7826 -
7827 - memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
7828 -
7829 - schedule_work(&priv->reset_wq);
7830 -
7831 - up(&priv->wx_sem);
7832 -
7833 - return 0;
7834 -}
7835 -
7836 -
7837 -/* based on ipw2200 driver */
7838 -int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
7839 -{
7840 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
7841 -
7842 - down(&priv->wx_sem);
7843 -
7844 - struct iwreq *wrq = (struct iwreq *)rq;
7845 -
7846 - int ret=-1;
7847 - switch (cmd) {
7848 - case RTL_IOCTL_WPA_SUPPLICANT:
7849 - ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
7850 - break;
7851 -
7852 - default:
7853 - ret = -EOPNOTSUPP;
7854 - break;
7855 - }
7856 -
7857 - up(&priv->wx_sem);
7858 -
7859 - return ret;
7860 -}
7861 -
7862 -
7863 -void rtl8180_irq_rx_tasklet(struct r8180_priv *priv)
7864 -{
7865 - struct urb *rx_urb = priv->rxurb_task;
7866 - struct net_device *dev = (struct net_device*)rx_urb->context;
7867 - int status,len,flen;
7868 - struct sk_buff *skb;
7869 - u32 *desc;
7870 -
7871 - //DMESG("rtl8187_rx_isr");
7872 -
7873 - struct ieee80211_rx_stats stats = {
7874 - .signal = 0,
7875 - .noise = -98,
7876 - .rate = 0,
7877 - // .mac_time = jiffies,
7878 - .freq = IEEE80211_24GHZ_BAND,
7879 - };
7880 -
7881 - //DMESG("RX %d ",rx_urb->status);
7882 - status = rx_urb->status;
7883 - if(status == 0){
7884 -
7885 - len = rx_urb->actual_length;
7886 - // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
7887 - len -= 4*4;/* 4 dword and 4 byte CRC */
7888 -
7889 - desc = (u32*)(rx_urb->transfer_buffer + len);
7890 -
7891 - flen = desc[0] & 0xfff;
7892 -
7893 - if( flen <= rx_urb->actual_length){
7894 -
7895 - stats.signal = (desc[1] & 0x7f00)>>8;
7896 - stats.noise = desc[1] &0xff;
7897 - stats.rate = desc[0] >> 20 & 0xf;
7898 - stats.mac_time[0] = desc[2];
7899 - stats.mac_time[1] = desc[3];
7900 - skb = dev_alloc_skb(flen-4);
7901 - //skb_reserve(skb,2);
7902 - if(skb){
7903 - memcpy(skb_put(skb,flen-4),
7904 - rx_urb->transfer_buffer,flen -4);
7905 -
7906 - #ifdef DUMP_RX
7907 - int i;
7908 - for(i=0;i<flen-4;i++)
7909 - printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]);
7910 - printk("------RATE %x:w---------------\n",stats.rate);
7911 -
7912 - #endif
7913 - priv->stats.rxok++;
7914 - // priv->rxskb = skb;
7915 - // priv->tempstats = &stats;
7916 -
7917 - if(!ieee80211_rx(priv->ieee80211,
7918 - skb, &stats))
7919 - dev_kfree_skb_any(skb);
7920 - }
7921 - }else priv->stats.rxurberr++;
7922 - }else{
7923 - priv->stats.rxstaterr++;
7924 - priv->ieee80211->stats.rx_errors++;
7925 -
7926 - }
7927 -
7928 - if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb);
7929 - else DMESG("RX process aborted due to explicit shutdown");
7930 -}
7931 -
7932 -/****************************************************************************
7933 - ---------------------------- USB_STUFF---------------------------
7934 -*****************************************************************************/
7935 -
7936 -
7937 -static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
7938 - const struct usb_device_id *id)
7939 -{
7940 -// unsigned long ioaddr = 0;
7941 - struct net_device *dev = NULL;
7942 - struct r8180_priv *priv= NULL;
7943 - struct usb_device *udev = interface_to_usbdev(intf);
7944 -
7945 -//printk("===> rtl8187_usb_probe()\n");
7946 -
7947 - dev = alloc_ieee80211(sizeof(struct r8180_priv));
7948 -
7949 - SET_MODULE_OWNER(dev);
7950 - usb_set_intfdata(intf, dev);
7951 -
7952 - SET_NETDEV_DEV(dev, &intf->dev);
7953 -
7954 - priv = ieee80211_priv(dev);
7955 - priv->ieee80211 = netdev_priv(dev);
7956 -
7957 - priv->udev=udev;
7958 -
7959 - dev->open = rtl8180_open;
7960 - dev->stop = rtl8180_close;
7961 - //dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
7962 - dev->tx_timeout = tx_timeout;
7963 - dev->wireless_handlers = &r8180_wx_handlers_def;
7964 - dev->do_ioctl = rtl8180_ioctl;
7965 - dev->set_multicast_list = r8180_set_multicast;
7966 - dev->set_mac_address = r8180_set_mac_adr;
7967 - dev->get_wireless_stats = r8180_get_wireless_stats;
7968 - dev->type=ARPHRD_ETHER;
7969 -
7970 - if (dev_alloc_name(dev, ifname) < 0){
7971 - DMESG("Oops: devname already taken! Trying wlan%%d...\n");
7972 - ifname = "wlan%d";
7973 - dev_alloc_name(dev, ifname);
7974 - }
7975 -
7976 -// dev->open=rtl8180_init;
7977 -
7978 - if(rtl8180_init(dev)!=0){
7979 - DMESG("Initialization failed");
7980 - goto fail;
7981 - }
7982 -
7983 - netif_carrier_off(dev);
7984 - netif_stop_queue(dev);
7985 -
7986 - register_netdev(dev);
7987 -
7988 - rtl8180_proc_init_one(dev);
7989 -
7990 -
7991 - DMESG("Driver probe completed\n");
7992 - return 0;
7993 -
7994 -
7995 -fail:
7996 - free_ieee80211(dev);
7997 -
7998 - DMESG("wlan driver load failed\n");
7999 -
8000 - return -ENODEV;
8001 -
8002 -}
8003 -
8004 -
8005 -static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf)
8006 -{
8007 - struct r8180_priv *priv;
8008 - struct net_device *dev = usb_get_intfdata(intf);
8009 - if(dev){
8010 -
8011 - unregister_netdev(dev);
8012 -
8013 - priv=ieee80211_priv(dev);
8014 -
8015 - rtl8180_proc_remove_one(dev);
8016 -
8017 - rtl8180_down(dev);
8018 - priv->rf_close(dev);
8019 - //rtl8180_rtx_disable(dev);
8020 - rtl8187_usb_deleteendpoints(dev);
8021 - rtl8180_irq_disable(dev);
8022 - rtl8180_reset(dev);
8023 - mdelay(10);
8024 -
8025 - }
8026 -// pci_disable_device(pdev);
8027 - free_ieee80211(dev);
8028 - DMESG("wlan driver removed\n");
8029 -}
8030 -
8031 -
8032 -static int __init rtl8187_usb_module_init(void)
8033 -{
8034 - printk(KERN_INFO "\nLinux kernel driver for RTL8187 \
8035 -based WLAN cards\n");
8036 - printk(KERN_INFO "Copyright (c) 2004-2005, Andrea Merello\n");
8037 - DMESG("Initializing module");
8038 - DMESG("Wireless extensions version %d", WIRELESS_EXT);
8039 - rtl8180_proc_module_init();
8040 - return usb_register(&rtl8187_usb_driver);
8041 -}
8042 -
8043 -
8044 -static void __exit rtl8187_usb_module_exit(void)
8045 -{
8046 - usb_deregister(&rtl8187_usb_driver);
8047 -
8048 - rtl8180_proc_module_remove();
8049 - DMESG("Exiting");
8050 -}
8051 -
8052 -
8053 -void rtl8180_try_wake_queue(struct net_device *dev, int pri)
8054 -{
8055 - unsigned long flags;
8056 - short enough_desc;
8057 - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
8058 -
8059 - spin_lock_irqsave(&priv->tx_lock,flags);
8060 - enough_desc = check_nic_enought_desc(dev,pri);
8061 - spin_unlock_irqrestore(&priv->tx_lock,flags);
8062 -
8063 - if(enough_desc)
8064 - ieee80211_wake_queue(priv->ieee80211);
8065 -}
8066 -
8067 -
8068 -
8069 -/***************************************************************************
8070 - ------------------- module init / exit stubs ----------------
8071 -****************************************************************************/
8072 -module_init(rtl8187_usb_module_init);
8073 -module_exit(rtl8187_usb_module_exit);
8074 diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.h
8075 --- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h 2006-06-06 08:48:10.000000000 +0200
8076 +++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.h 2008-01-30 17:38:11.000000000 +0100
8077 @@ -1,17 +1,17 @@
8078 -/*
8079 +/*
8080 This is part of rtl8187 OpenSource driver.
8081 - Copyright (C) Andrea Merello 2004-2005 <[email protected]>
8082 + Copyright (C) Andrea Merello 2004-2005 <[email protected]>
8083 Released under the terms of GPL (General Public Licence)
8084 -
8085 - Parts of this driver are based on the GPL part of the
8086 +
8087 + Parts of this driver are based on the GPL part of the
8088 official realtek driver
8089 -
8090 - Parts of this driver are based on the rtl8180 driver skeleton
8091 +
8092 + Parts of this driver are based on the rtl8180 driver skeleton
8093 from Patric Schenke & Andres Salomon
8094 -
8095 +
8096 Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
8097 -
8098 - We want to tanks the Authors of those projects and the Ndiswrapper
8099 +
8100 + We want to tanks the Authors of those projects and the Ndiswrapper
8101 project Authors.
8102 */
8103
8104 @@ -26,7 +26,6 @@
8105
8106 #include <linux/module.h>
8107 #include <linux/kernel.h>
8108 -#include <linux/config.h>
8109 #include <linux/init.h>
8110 #include <linux/ioport.h>
8111 #include <linux/sched.h>
8112 @@ -47,6 +46,12 @@
8113 #include <asm/io.h>
8114 #include <asm/semaphore.h>
8115
8116 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
8117 +#include <linux/config.h>
8118 +#else
8119 +#include <linux/autoconf.h>
8120 +#endif
8121 +
8122 #include "ieee80211.h"
8123
8124 #define EPROM_93c46 0
8125 @@ -68,7 +73,7 @@
8126 {
8127 struct buffer *next;
8128 u32 *buf;
8129 -
8130 +
8131 } buffer;
8132
8133 #if 0
8134 @@ -123,18 +128,18 @@
8135 short epromtype;
8136 int irq;
8137 struct ieee80211_device *ieee80211;
8138 -
8139 +
8140 short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D */
8141 short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */
8142 short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
8143 short enable_gpio0;
8144 enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type;
8145 short hw_plcp_len;
8146 -
8147 +
8148 // spinlock_t irq_lock;
8149 // spinlock_t irq_th_lock;
8150 spinlock_t tx_lock;
8151 -
8152 +
8153 u16 irq_mask;
8154 // short irq_enabled;
8155 struct net_device *dev;
8156 @@ -143,13 +148,17 @@
8157 short max_sens;
8158 u8 chtxpwr[15]; //channels from 1 to 14, 0 not used
8159 u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used
8160 + u8 chtxpwr_orig[15]; //channels from 1 to 14, 0 not used
8161 + u8 chtxpwr_ofdm_orig[15]; //channels from 1 to 14, 0 not used
8162 u8 cck_txpwr_base;
8163 u8 ofdm_txpwr_base;
8164 + u8 txpwr_max;
8165 u8 challow[15]; //channels from 1 to 14, 0 not used
8166 short up;
8167 short crcmon; //if 1 allow bad crc frame reception in monitor mode
8168 -// short prism_hdr;
8169 -
8170 + short prism_hdr;
8171 + short fasttx;
8172 +
8173 // struct timer_list scan_timer;
8174 /*short scanpending;
8175 short stopscan;*/
8176 @@ -158,7 +167,7 @@
8177 //u8 active_scan_num;
8178 struct semaphore wx_sem;
8179 // short hw_wep;
8180 -
8181 +
8182 // short digphy;
8183 // short antb;
8184 // short diversity;
8185 @@ -171,31 +180,31 @@
8186 void (*rf_close)(struct net_device *dev);
8187 void (*rf_init)(struct net_device *dev);
8188 //short rate;
8189 - short promisc;
8190 + short promisc;
8191 /*stats*/
8192 struct Stats stats;
8193 struct iw_statistics wstats;
8194 struct proc_dir_entry *dir_dev;
8195 -
8196 +
8197 /*RX stuff*/
8198 // u32 *rxring;
8199 // u32 *rxringtail;
8200 // dma_addr_t rxringdma;
8201 struct urb **rx_urb;
8202 -
8203 +
8204 //struct buffer *rxbuffer;
8205 //struct buffer *rxbufferhead;
8206 //int rxringcount;
8207 //u16 rxbuffersize;
8208 -
8209 - //struct sk_buff *rx_skb;
8210 +
8211 + //struct sk_buff *rx_skb;
8212
8213 //short rx_skb_complete;
8214
8215 //u32 rx_prevlen;
8216 atomic_t tx_lp_pending;
8217 atomic_t tx_np_pending;
8218 -#if 0
8219 +#if 0
8220 /*TX stuff*/
8221 u32 *txlpring;
8222 u32 *txhpring;
8223 @@ -225,7 +234,7 @@
8224 struct urb *rxurb_task;
8225 // u8 dma_poll_mask;
8226 //short tx_suspend;
8227 -
8228 +
8229 /* adhoc/master mode stuff */
8230 #if 0
8231 u32 *txbeacontail;
8232 @@ -239,22 +248,23 @@
8233 //u16 master_beaconinterval;
8234 // u32 master_beaconsize;
8235 //u16 beacon_interval;
8236 -
8237 +
8238 u8 retry_data;
8239 u8 retry_rts;
8240 -
8241 +
8242 struct work_struct reset_wq;
8243 -
8244 +
8245 }r8180_priv;
8246
8247
8248 -typedef enum{
8249 +typedef enum{
8250 LOW_PRIORITY ,
8251 - NORM_PRIORITY
8252 + NORM_PRIORITY
8253 } priority_t;
8254
8255
8256 short rtl8180_tx(struct net_device *dev,u32* skbuf, int len,priority_t priority,short morefrag,short rate);
8257 +short rtl8180_tx_fast(struct net_device *dev,u32* skbuf, int len, short rate);
8258
8259 u8 read_nic_byte(struct net_device *dev, int x);
8260 u8 read_nic_byte_E(struct net_device *dev, int x);
8261 diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h~ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.h~
8262 --- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h~ 2006-06-06 04:58:02.000000000 +0200
8263 +++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.h~ 1970-01-01 01:00:00.000000000 +0100
8264 @@ -1,288 +0,0 @@
8265 -/*
8266 - This is part of rtl8187 OpenSource driver.
8267 - Copyright (C) Andrea Merello 2004-2005 <[email protected]>
8268 - Released under the terms of GPL (General Public Licence)
8269 -
8270 - Parts of this driver are based on the GPL part of the
8271 - official realtek driver
8272 -
8273 - Parts of this driver are based on the rtl8180 driver skeleton
8274 - from Patric Schenke & Andres Salomon
8275 -
8276 - Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
8277 -
8278 - We want to tanks the Authors of those projects and the Ndiswrapper
8279 - project Authors.
8280 -*/
8281 -
8282 -#ifndef R8180H
8283 -#define R8180H
8284 -
8285 -
8286 -#define RTL8187_MODULE_NAME "rtl8187"
8287 -#define DMESG(x,a...) printk(KERN_INFO RTL8187_MODULE_NAME ": " x "\n", ## a)
8288 -#define DMESGW(x,a...) printk(KERN_WARNING RTL8187_MODULE_NAME ": WW:" x "\n", ## a)
8289 -#define DMESGE(x,a...) printk(KERN_WARNING RTL8187_MODULE_NAME ": EE:" x "\n", ## a)
8290 -
8291 -#include <linux/module.h>
8292 -#include <linux/kernel.h>
8293 -#include <linux/config.h>
8294 -#include <linux/init.h>
8295 -#include <linux/ioport.h>
8296 -#include <linux/sched.h>
8297 -#include <linux/types.h>
8298 -#include <linux/slab.h>
8299 -#include <linux/netdevice.h>
8300 -//#include <linux/pci.h>
8301 -#include <linux/usb.h>
8302 -#include <linux/etherdevice.h>
8303 -#include <linux/delay.h>
8304 -#include <linux/rtnetlink.h> //for rtnl_lock()
8305 -#include <linux/wireless.h>
8306 -#include <linux/timer.h>
8307 -#include <linux/proc_fs.h> // Necessary because we use the proc fs
8308 -#include <linux/if_arp.h>
8309 -#include <linux/random.h>
8310 -#include <linux/version.h>
8311 -#include <asm/io.h>
8312 -#include <asm/semaphore.h>
8313 -
8314 -#include "ieee80211.h"
8315 -
8316 -#define EPROM_93c46 0
8317 -#define EPROM_93c56 1
8318 -
8319 -#define DEFAULT_FRAG_THRESHOLD 2342U
8320 -#define MIN_FRAG_THRESHOLD 256U
8321 -#define DEFAULT_BEACONINTERVAL 0x64U
8322 -#define DEFAULT_BEACON_ESSID "Rtl8187"
8323 -
8324 -#define DEFAULT_SSID ""
8325 -#define DEFAULT_RETRY_RTS 7
8326 -#define DEFAULT_RETRY_DATA 7
8327 -#define PRISM_HDR_SIZE 64
8328 -
8329 -#define RTL_IOCTL_WPA_SUPPLICANT SIOCIWFIRSTPRIV+30
8330 -
8331 -typedef struct buffer
8332 -{
8333 - struct buffer *next;
8334 - u32 *buf;
8335 -
8336 -} buffer;
8337 -
8338 -#if 0
8339 -
8340 -typedef struct tx_pendingbuf
8341 -{
8342 - struct ieee80211_txb *txb;
8343 - short ispending;
8344 - short descfrag;
8345 -} tx_pendigbuf;
8346 -
8347 -#endif
8348 -
8349 -typedef struct Stats
8350 -{
8351 - unsigned long txrdu;
8352 -// unsigned long rxrdu;
8353 - //unsigned long rxnolast;
8354 - //unsigned long rxnodata;
8355 -// unsigned long rxreset;
8356 -// unsigned long rxwrkaround;
8357 -// unsigned long rxnopointer;
8358 - unsigned long rxok;
8359 - unsigned long rxurberr;
8360 - unsigned long rxstaterr;
8361 - unsigned long txnperr;
8362 - unsigned long txnpdrop;
8363 - unsigned long txresumed;
8364 -// unsigned long rxerr;
8365 -// unsigned long rxoverflow;
8366 -// unsigned long rxint;
8367 - unsigned long txnpokint;
8368 -// unsigned long txhpokint;
8369 -// unsigned long txhperr;
8370 -// unsigned long ints;
8371 -// unsigned long shints;
8372 - unsigned long txoverflow;
8373 -// unsigned long rxdmafail;
8374 -// unsigned long txbeacon;
8375 -// unsigned long txbeaconerr;
8376 - unsigned long txlpokint;
8377 - unsigned long txlpdrop;
8378 - unsigned long txlperr;
8379 - unsigned long txdatapkt;
8380 -} Stats;
8381 -
8382 -
8383 -
8384 -typedef struct r8180_priv
8385 -{
8386 - struct usb_device *udev;
8387 - short epromtype;
8388 - int irq;
8389 - struct ieee80211_device *ieee80211;
8390 -
8391 - short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D */
8392 - short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */
8393 - short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
8394 - short enable_gpio0;
8395 - enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type;
8396 - short hw_plcp_len;
8397 -
8398 -// spinlock_t irq_lock;
8399 -// spinlock_t irq_th_lock;
8400 - spinlock_t tx_lock;
8401 -
8402 - u16 irq_mask;
8403 -// short irq_enabled;
8404 - struct net_device *dev;
8405 - short chan;
8406 - short sens;
8407 - short max_sens;
8408 - u8 chtxpwr[15]; //channels from 1 to 14, 0 not used
8409 - u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used
8410 - u8 cck_txpwr_base;
8411 - u8 ofdm_txpwr_base;
8412 - u8 challow[15]; //channels from 1 to 14, 0 not used
8413 - short up;
8414 - short crcmon; //if 1 allow bad crc frame reception in monitor mode
8415 -// short prism_hdr;
8416 -
8417 -// struct timer_list scan_timer;
8418 - /*short scanpending;
8419 - short stopscan;*/
8420 -// spinlock_t scan_lock;
8421 -// u8 active_probe;
8422 - //u8 active_scan_num;
8423 - struct semaphore wx_sem;
8424 -// short hw_wep;
8425 -
8426 -// short digphy;
8427 -// short antb;
8428 -// short diversity;
8429 -// u8 cs_treshold;
8430 -// short rcr_csense;
8431 - short rf_chip;
8432 -// u32 key0[4];
8433 - short (*rf_set_sens)(struct net_device *dev,short sens);
8434 - void (*rf_set_chan)(struct net_device *dev,short ch);
8435 - void (*rf_close)(struct net_device *dev);
8436 - void (*rf_init)(struct net_device *dev);
8437 - //short rate;
8438 - short promisc;
8439 - /*stats*/
8440 - struct Stats stats;
8441 - struct iw_statistics wstats;
8442 - struct proc_dir_entry *dir_dev;
8443 -
8444 - /*RX stuff*/
8445 -// u32 *rxring;
8446 -// u32 *rxringtail;
8447 -// dma_addr_t rxringdma;
8448 - struct urb **rx_urb;
8449 -
8450 - //struct buffer *rxbuffer;
8451 - //struct buffer *rxbufferhead;
8452 - //int rxringcount;
8453 - //u16 rxbuffersize;
8454 -
8455 - //struct sk_buff *rx_skb;
8456 -
8457 - //short rx_skb_complete;
8458 -
8459 - //u32 rx_prevlen;
8460 - atomic_t tx_lp_pending;
8461 - atomic_t tx_np_pending;
8462 -#if 0
8463 - /*TX stuff*/
8464 - u32 *txlpring;
8465 - u32 *txhpring;
8466 - u32 *txnpring;
8467 - dma_addr_t txlpringdma;
8468 - dma_addr_t txhpringdma;
8469 - dma_addr_t txnpringdma;
8470 - u32 *txlpringtail;
8471 - u32 *txhpringtail;
8472 - u32 *txnpringtail;
8473 - u32 *txlpringhead;
8474 - u32 *txhpringhead;
8475 - u32 *txnpringhead;
8476 - struct buffer *txlpbufs;
8477 - struct buffer *txhpbufs;
8478 - struct buffer *txnpbufs;
8479 - struct buffer *txlpbufstail;
8480 - struct buffer *txhpbufstail;
8481 - struct buffer *txnpbufstail;
8482 - int txringcount;
8483 - int txbuffsize;
8484 -
8485 - //struct tx_pendingbuf txnp_pending;
8486 - struct tasklet_struct irq_tx_tasklet;
8487 -#endif
8488 -// struct tasklet_struct irq_rx_tasklet;
8489 -// u8 dma_poll_mask;
8490 - //short tx_suspend;
8491 -
8492 - /* adhoc/master mode stuff */
8493 -#if 0
8494 - u32 *txbeacontail;
8495 - dma_addr_t txbeaconringdma;
8496 - u32 *txbeaconring;
8497 - int txbeaconcount;
8498 -#endif
8499 -// struct ieee_tx_beacon *beacon_buf;
8500 - //char *master_essid;
8501 -// dma_addr_t beacondmabuf;
8502 - //u16 master_beaconinterval;
8503 -// u32 master_beaconsize;
8504 - //u16 beacon_interval;
8505 -
8506 - u8 retry_data;
8507 - u8 retry_rts;
8508 -
8509 - struct work_struct reset_wq;
8510 -
8511 -}r8180_priv;
8512 -
8513 -
8514 -typedef enum{
8515 - LOW_PRIORITY ,
8516 - NORM_PRIORITY
8517 - } priority_t;
8518 -
8519 -
8520 -short rtl8180_tx(struct net_device *dev,u32* skbuf, int len,priority_t priority,short morefrag,short rate);
8521 -
8522 -u8 read_nic_byte(struct net_device *dev, int x);
8523 -u8 read_nic_byte_E(struct net_device *dev, int x);
8524 -u32 read_nic_dword(struct net_device *dev, int x);
8525 -u16 read_nic_word(struct net_device *dev, int x) ;
8526 -void write_nic_byte(struct net_device *dev, int x,u8 y);
8527 -void write_nic_byte_E(struct net_device *dev, int x,u8 y);
8528 -void write_nic_word(struct net_device *dev, int x,u16 y);
8529 -void write_nic_dword(struct net_device *dev, int x,u32 y);
8530 -void force_pci_posting(struct net_device *dev);
8531 -
8532 -void rtl8180_rtx_disable(struct net_device *);
8533 -void rtl8180_rx_enable(struct net_device *);
8534 -void rtl8180_tx_enable(struct net_device *);
8535 -
8536 -void rtl8180_disassociate(struct net_device *dev);
8537 -//void fix_rx_fifo(struct net_device *dev);
8538 -void rtl8185_set_rf_pins_enable(struct net_device *dev,u32 a);
8539 -
8540 -void rtl8180_set_anaparam(struct net_device *dev,u32 a);
8541 -void rtl8185_set_anaparam2(struct net_device *dev,u32 a);
8542 -void rtl8180_update_msr(struct net_device *dev);
8543 -int rtl8180_down(struct net_device *dev);
8544 -int rtl8180_up(struct net_device *dev);
8545 -void rtl8180_commit(struct net_device *dev);
8546 -void rtl8180_set_chan(struct net_device *dev,short ch);
8547 -void write_phy(struct net_device *dev, u8 adr, u8 data);
8548 -void write_phy_cck(struct net_device *dev, u8 adr, u32 data);
8549 -void write_phy_ofdm(struct net_device *dev, u8 adr, u32 data);
8550 -void rtl8185_tx_antenna(struct net_device *dev, u8 ant);
8551 -void rtl8187_set_rxconf(struct net_device *dev);
8552 -#endif
8553 diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/.tmp_versions/r8187.mod rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/.tmp_versions/r8187.mod
8554 --- rtl8187_linux_26.1010.0622.2006/beta-8187/.tmp_versions/r8187.mod 2006-06-22 07:40:15.000000000 +0200
8555 +++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/.tmp_versions/r8187.mod 2008-02-15 00:49:48.000000000 +0100
8556 @@ -1,2 +1,2 @@
8557 -/usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8187.ko
8558 -/usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8187_core.o /usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8180_93cx6.o /usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8180_wx.o /usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8180_rtl8225.o /usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8180_rtl8225z2.o
8559 +/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.ko
8560 +/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187_core.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_93cx6.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_wx.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225z2.o
8561 diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.c
8562 --- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.c 2006-06-06 04:57:56.000000000 +0200
8563 +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.c 2008-01-30 17:38:11.000000000 +0100
8564 @@ -11,7 +11,6 @@
8565 *
8566 */
8567
8568 -#include <linux/config.h>
8569 #include <linux/version.h>
8570 #include <linux/module.h>
8571 #include <linux/init.h>
8572 @@ -19,6 +18,12 @@
8573 #include <asm/string.h>
8574 #include <asm/errno.h>
8575
8576 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
8577 +#include <linux/config.h>
8578 +#else
8579 +#include <linux/autoconf.h>
8580 +#endif
8581 +
8582 #include "ieee80211.h"
8583
8584 MODULE_AUTHOR("Jouni Malinen");
8585 @@ -38,7 +43,7 @@
8586
8587 static struct ieee80211_crypto *hcrypt;
8588
8589 -void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
8590 +void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *ieee,
8591 int force)
8592 {
8593 struct list_head *ptr, *n;
8594 @@ -61,13 +66,13 @@
8595 }
8596 }
8597
8598 -void ieee80211_crypt_deinit_handler(unsigned long data)
8599 +void ieee80211_crypt_deinit_handler_rtl7(unsigned long data)
8600 {
8601 struct ieee80211_device *ieee = (struct ieee80211_device *)data;
8602 unsigned long flags;
8603
8604 spin_lock_irqsave(&ieee->lock, flags);
8605 - ieee80211_crypt_deinit_entries(ieee, 0);
8606 + ieee80211_crypt_deinit_entries_rtl7(ieee, 0);
8607 if (!list_empty(&ieee->crypt_deinit_list)) {
8608 printk(KERN_DEBUG "%s: entries remaining in delayed crypt "
8609 "deletion list\n", ieee->dev->name);
8610 @@ -78,7 +83,7 @@
8611
8612 }
8613
8614 -void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
8615 +void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
8616 struct ieee80211_crypt_data **crypt)
8617 {
8618 struct ieee80211_crypt_data *tmp;
8619 @@ -103,7 +108,7 @@
8620 spin_unlock_irqrestore(&ieee->lock, flags);
8621 }
8622
8623 -int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
8624 +int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
8625 {
8626 unsigned long flags;
8627 struct ieee80211_crypto_alg *alg;
8628 @@ -128,7 +133,7 @@
8629 return 0;
8630 }
8631
8632 -int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops)
8633 +int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
8634 {
8635 unsigned long flags;
8636 struct list_head *ptr;
8637 @@ -159,7 +164,7 @@
8638 }
8639
8640
8641 -struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name)
8642 +struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name)
8643 {
8644 unsigned long flags;
8645 struct list_head *ptr;
8646 @@ -186,13 +191,13 @@
8647 }
8648
8649
8650 -static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; }
8651 -static void ieee80211_crypt_null_deinit(void *priv) {}
8652 +static void * ieee80211_crypt_null_init_rtl7(int keyidx) { return (void *) 1; }
8653 +static void ieee80211_crypt_null_deinit_rtl7(void *priv) {}
8654
8655 static struct ieee80211_crypto_ops ieee80211_crypt_null = {
8656 .name = "NULL",
8657 - .init = ieee80211_crypt_null_init,
8658 - .deinit = ieee80211_crypt_null_deinit,
8659 + .init = ieee80211_crypt_null_init_rtl7,
8660 + .deinit = ieee80211_crypt_null_deinit_rtl7,
8661 .encrypt_mpdu = NULL,
8662 .decrypt_mpdu = NULL,
8663 .encrypt_msdu = NULL,
8664 @@ -205,7 +210,7 @@
8665 };
8666
8667
8668 -static int __init ieee80211_crypto_init(void)
8669 +static int __init ieee80211_crypto_init_rtl7(void)
8670 {
8671 int ret = -ENOMEM;
8672
8673 @@ -217,7 +222,7 @@
8674 INIT_LIST_HEAD(&hcrypt->algs);
8675 spin_lock_init(&hcrypt->lock);
8676
8677 - ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null);
8678 + ret = ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_null);
8679 if (ret < 0) {
8680 kfree(hcrypt);
8681 hcrypt = NULL;
8682 @@ -227,7 +232,7 @@
8683 }
8684
8685
8686 -static void __exit ieee80211_crypto_deinit(void)
8687 +static void __exit ieee80211_crypto_deinit_rtl7(void)
8688 {
8689 struct list_head *ptr, *n;
8690
8691 @@ -247,13 +252,13 @@
8692 kfree(hcrypt);
8693 }
8694
8695 -EXPORT_SYMBOL(ieee80211_crypt_deinit_entries);
8696 -EXPORT_SYMBOL(ieee80211_crypt_deinit_handler);
8697 -EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit);
8698 -
8699 -EXPORT_SYMBOL(ieee80211_register_crypto_ops);
8700 -EXPORT_SYMBOL(ieee80211_unregister_crypto_ops);
8701 -EXPORT_SYMBOL(ieee80211_get_crypto_ops);
8702 +EXPORT_SYMBOL(ieee80211_crypt_deinit_entries_rtl7);
8703 +EXPORT_SYMBOL(ieee80211_crypt_deinit_handler_rtl7);
8704 +EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit_rtl7);
8705 +
8706 +EXPORT_SYMBOL(ieee80211_register_crypto_ops_rtl7);
8707 +EXPORT_SYMBOL(ieee80211_unregister_crypto_ops_rtl7);
8708 +EXPORT_SYMBOL(ieee80211_get_crypto_ops_rtl7);
8709
8710 -module_init(ieee80211_crypto_init);
8711 -module_exit(ieee80211_crypto_deinit);
8712 +module_init(ieee80211_crypto_init_rtl7);
8713 +module_exit(ieee80211_crypto_deinit_rtl7);
8714 diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_ccmp.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_ccmp.c
8715 --- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_ccmp.c 2006-06-06 04:58:00.000000000 +0200
8716 +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_ccmp.c 2008-01-30 17:38:11.000000000 +0100
8717 @@ -9,7 +9,6 @@
8718 * more details.
8719 */
8720
8721 -#include <linux/config.h>
8722 #include <linux/version.h>
8723 #include <linux/module.h>
8724 #include <linux/init.h>
8725 @@ -22,11 +21,22 @@
8726 #include <asm/string.h>
8727 #include <linux/wireless.h>
8728
8729 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
8730 +#include <linux/config.h>
8731 +#else
8732 +#include <linux/autoconf.h>
8733 +#endif
8734 +
8735 #include "ieee80211.h"
8736
8737
8738 #include <linux/crypto.h>
8739 -#include <asm/scatterlist.h>
8740 +
8741 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
8742 + #include <asm/scatterlist.h>
8743 +#else
8744 + #include <linux/scatterlist.h>
8745 +#endif
8746
8747 MODULE_AUTHOR("Jouni Malinen");
8748 MODULE_DESCRIPTION("Host AP crypt: CCMP");
8749 @@ -51,7 +61,11 @@
8750
8751 int key_idx;
8752
8753 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
8754 struct crypto_tfm *tfm;
8755 +#else
8756 + struct crypto_cipher *tfm;
8757 +#endif
8758
8759 /* scratch buffers for virt_to_page() (crypto API) */
8760 u8 tx_b0[AES_BLOCK_LEN], tx_b[AES_BLOCK_LEN],
8761 @@ -59,7 +73,8 @@
8762 u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN];
8763 };
8764
8765 -void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
8766 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
8767 +void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_tfm *tfm,
8768 const u8 pt[16], u8 ct[16])
8769 {
8770 struct scatterlist src, dst;
8771 @@ -74,8 +89,15 @@
8772
8773 crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
8774 }
8775 +#else
8776 +static inline void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_cipher *tfm,
8777 + const u8 pt[16], u8 ct[16])
8778 +{
8779 + crypto_cipher_encrypt_one(tfm, ct, pt);
8780 +}
8781 +#endif
8782
8783 -static void * ieee80211_ccmp_init(int key_idx)
8784 +static void * ieee80211_ccmp_init_rtl7(int key_idx)
8785 {
8786 struct ieee80211_ccmp_data *priv;
8787
8788 @@ -85,19 +107,33 @@
8789 memset(priv, 0, sizeof(*priv));
8790 priv->key_idx = key_idx;
8791
8792 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
8793 priv->tfm = crypto_alloc_tfm("aes", 0);
8794 if (priv->tfm == NULL) {
8795 printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
8796 "crypto API aes\n");
8797 goto fail;
8798 }
8799 +#else
8800 + priv->tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
8801 + if (IS_ERR(priv->tfm)) {
8802 + printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
8803 + "crypto API aes\n");
8804 + priv->tfm = NULL;
8805 + goto fail;
8806 + }
8807 +#endif
8808
8809 return priv;
8810
8811 fail:
8812 if (priv) {
8813 if (priv->tfm)
8814 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
8815 crypto_free_tfm(priv->tfm);
8816 +#else
8817 + crypto_free_cipher(priv->tfm);
8818 +#endif
8819 kfree(priv);
8820 }
8821
8822 @@ -105,16 +141,20 @@
8823 }
8824
8825
8826 -static void ieee80211_ccmp_deinit(void *priv)
8827 +static void ieee80211_ccmp_deinit_rtl7(void *priv)
8828 {
8829 struct ieee80211_ccmp_data *_priv = priv;
8830 if (_priv && _priv->tfm)
8831 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
8832 crypto_free_tfm(_priv->tfm);
8833 +#else
8834 + crypto_free_cipher(_priv->tfm);
8835 +#endif
8836 kfree(priv);
8837 }
8838
8839
8840 -static inline void xor_block(u8 *b, u8 *a, size_t len)
8841 +static inline void xor_block_rtl7(u8 *b, u8 *a, size_t len)
8842 {
8843 int i;
8844 for (i = 0; i < len; i++)
8845 @@ -122,7 +162,11 @@
8846 }
8847
8848
8849 -static void ccmp_init_blocks(struct crypto_tfm *tfm,
8850 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
8851 +static void ccmp_init_blocks_rtl7(struct crypto_tfm *tfm,
8852 +#else
8853 +static void ccmp_init_blocks_rtl7(struct crypto_cipher *tfm,
8854 +#endif
8855 struct ieee80211_hdr *hdr,
8856 u8 *pn, size_t dlen, u8 *b0, u8 *auth,
8857 u8 *s0)
8858 @@ -186,18 +230,18 @@
8859 }
8860
8861 /* Start with the first block and AAD */
8862 - ieee80211_ccmp_aes_encrypt(tfm, b0, auth);
8863 - xor_block(auth, aad, AES_BLOCK_LEN);
8864 - ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
8865 - xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
8866 - ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
8867 + ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, auth);
8868 + xor_block_rtl7(auth, aad, AES_BLOCK_LEN);
8869 + ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
8870 + xor_block_rtl7(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
8871 + ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
8872 b0[0] &= 0x07;
8873 b0[14] = b0[15] = 0;
8874 - ieee80211_ccmp_aes_encrypt(tfm, b0, s0);
8875 + ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, s0);
8876 }
8877
8878
8879 -static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
8880 +static int ieee80211_ccmp_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
8881 {
8882 struct ieee80211_ccmp_data *key = priv;
8883 int data_len, i, blocks, last, len;
8884 @@ -237,7 +281,7 @@
8885 *pos++ = key->tx_pn[0];
8886
8887 hdr = (struct ieee80211_hdr *) skb->data;
8888 - ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
8889 + ccmp_init_blocks_rtl7(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
8890
8891 blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
8892 last = data_len % AES_BLOCK_LEN;
8893 @@ -245,13 +289,13 @@
8894 for (i = 1; i <= blocks; i++) {
8895 len = (i == blocks && last) ? last : AES_BLOCK_LEN;
8896 /* Authentication */
8897 - xor_block(b, pos, len);
8898 - ieee80211_ccmp_aes_encrypt(key->tfm, b, b);
8899 + xor_block_rtl7(b, pos, len);
8900 + ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b, b);
8901 /* Encryption, with counter */
8902 b0[14] = (i >> 8) & 0xff;
8903 b0[15] = i & 0xff;
8904 - ieee80211_ccmp_aes_encrypt(key->tfm, b0, e);
8905 - xor_block(pos, e, len);
8906 + ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, e);
8907 + xor_block_rtl7(pos, e, len);
8908 pos += len;
8909 }
8910
8911 @@ -262,7 +306,7 @@
8912 }
8913
8914
8915 -static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
8916 +static int ieee80211_ccmp_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
8917 {
8918 struct ieee80211_ccmp_data *key = priv;
8919 u8 keyidx, *pos;
8920 @@ -326,8 +370,8 @@
8921 return -4;
8922 }
8923
8924 - ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b);
8925 - xor_block(mic, b, CCMP_MIC_LEN);
8926 + ccmp_init_blocks_rtl7(key->tfm, hdr, pn, data_len, b0, a, b);
8927 + xor_block_rtl7(mic, b, CCMP_MIC_LEN);
8928
8929 blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
8930 last = data_len % AES_BLOCK_LEN;
8931 @@ -337,11 +381,11 @@
8932 /* Decrypt, with counter */
8933 b0[14] = (i >> 8) & 0xff;
8934 b0[15] = i & 0xff;
8935 - ieee80211_ccmp_aes_encrypt(key->tfm, b0, b);
8936 - xor_block(pos, b, len);
8937 + ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, b);
8938 + xor_block_rtl7(pos, b, len);
8939 /* Authentication */
8940 - xor_block(a, pos, len);
8941 - ieee80211_ccmp_aes_encrypt(key->tfm, a, a);
8942 + xor_block_rtl7(a, pos, len);
8943 + ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, a, a);
8944 pos += len;
8945 }
8946
8947 @@ -365,11 +409,15 @@
8948 }
8949
8950
8951 -static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
8952 +static int ieee80211_ccmp_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
8953 {
8954 struct ieee80211_ccmp_data *data = priv;
8955 int keyidx;
8956 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
8957 struct crypto_tfm *tfm = data->tfm;
8958 +#else
8959 + struct crypto_cipher *tfm = data->tfm;
8960 +#endif
8961
8962 keyidx = data->key_idx;
8963 memset(data, 0, sizeof(*data));
8964 @@ -396,7 +444,7 @@
8965 }
8966
8967
8968 -static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
8969 +static int ieee80211_ccmp_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
8970 {
8971 struct ieee80211_ccmp_data *data = priv;
8972
8973 @@ -420,7 +468,7 @@
8974 }
8975
8976
8977 -static char * ieee80211_ccmp_print_stats(char *p, void *priv)
8978 +static char * ieee80211_ccmp_print_stats_rtl7(char *p, void *priv)
8979 {
8980 struct ieee80211_ccmp_data *ccmp = priv;
8981 p += sprintf(p, "key[%d] alg=CCMP key_set=%d "
8982 @@ -437,34 +485,34 @@
8983 }
8984
8985
8986 -static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
8987 +static struct ieee80211_crypto_ops ieee80211_crypt_ccmp_rtl7 = {
8988 .name = "CCMP",
8989 - .init = ieee80211_ccmp_init,
8990 - .deinit = ieee80211_ccmp_deinit,
8991 - .encrypt_mpdu = ieee80211_ccmp_encrypt,
8992 - .decrypt_mpdu = ieee80211_ccmp_decrypt,
8993 + .init = ieee80211_ccmp_init_rtl7,
8994 + .deinit = ieee80211_ccmp_deinit_rtl7,
8995 + .encrypt_mpdu = ieee80211_ccmp_encrypt_rtl7,
8996 + .decrypt_mpdu = ieee80211_ccmp_decrypt_rtl7,
8997 .encrypt_msdu = NULL,
8998 .decrypt_msdu = NULL,
8999 - .set_key = ieee80211_ccmp_set_key,
9000 - .get_key = ieee80211_ccmp_get_key,
9001 - .print_stats = ieee80211_ccmp_print_stats,
9002 + .set_key = ieee80211_ccmp_set_key_rtl7,
9003 + .get_key = ieee80211_ccmp_get_key_rtl7,
9004 + .print_stats = ieee80211_ccmp_print_stats_rtl7,
9005 .extra_prefix_len = CCMP_HDR_LEN,
9006 .extra_postfix_len = CCMP_MIC_LEN,
9007 .owner = THIS_MODULE,
9008 };
9009
9010
9011 -static int __init ieee80211_crypto_ccmp_init(void)
9012 +static int __init ieee80211_crypto_ccmp_init_rtl7(void)
9013 {
9014 - return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp);
9015 + return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
9016 }
9017
9018
9019 -static void __exit ieee80211_crypto_ccmp_exit(void)
9020 +static void __exit ieee80211_crypto_ccmp_exit_rtl7(void)
9021 {
9022 - ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
9023 + ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
9024 }
9025
9026
9027 -module_init(ieee80211_crypto_ccmp_init);
9028 -module_exit(ieee80211_crypto_ccmp_exit);
9029 +module_init(ieee80211_crypto_ccmp_init_rtl7);
9030 +module_exit(ieee80211_crypto_ccmp_exit_rtl7);
9031 diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.h rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.h
9032 --- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.h 2006-06-06 04:58:00.000000000 +0200
9033 +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.h 2008-01-30 17:38:11.000000000 +0100
9034 @@ -75,12 +75,12 @@
9035 atomic_t refcnt;
9036 };
9037
9038 -int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
9039 -int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
9040 -struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
9041 -void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
9042 -void ieee80211_crypt_deinit_handler(unsigned long);
9043 -void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
9044 +int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
9045 +int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
9046 +struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
9047 +void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
9048 +void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
9049 +void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
9050 struct ieee80211_crypt_data **crypt);
9051
9052 #endif
9053 diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_tkip.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_tkip.c
9054 --- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_tkip.c 2006-06-06 04:57:54.000000000 +0200
9055 +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_tkip.c 2008-01-30 17:39:05.000000000 +0100
9056 @@ -9,7 +9,6 @@
9057 * more details.
9058 */
9059
9060 -#include <linux/config.h>
9061 #include <linux/version.h>
9062 #include <linux/module.h>
9063 #include <linux/init.h>
9064 @@ -21,13 +20,24 @@
9065 #include <linux/if_arp.h>
9066 #include <asm/string.h>
9067
9068 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
9069 +#include <linux/config.h>
9070 +#else
9071 +#include <linux/autoconf.h>
9072 +#endif
9073 +
9074 #include "ieee80211.h"
9075
9076 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
9077 + #include <asm/scatterlist.h>
9078 +#else
9079 + #include <linux/scatterlist.h>
9080 +#endif
9081
9082 #include <linux/crypto.h>
9083 -#include <asm/scatterlist.h>
9084 #include <linux/crc32.h>
9085
9086 +
9087 MODULE_AUTHOR("Jouni Malinen");
9088 MODULE_DESCRIPTION("Host AP crypt: TKIP");
9089 MODULE_LICENSE("GPL");
9090 @@ -55,14 +65,21 @@
9091
9092 int key_idx;
9093
9094 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
9095 struct crypto_tfm *tfm_arc4;
9096 struct crypto_tfm *tfm_michael;
9097 +#else
9098 + struct crypto_blkcipher *rx_tfm_arc4;
9099 + struct crypto_blkcipher *tx_tfm_arc4;
9100 + struct crypto_hash *rx_tfm_michael;
9101 + struct crypto_hash *tx_tfm_michael;
9102 +#endif
9103
9104 /* scratch buffers for virt_to_page() (crypto API) */
9105 u8 rx_hdr[16], tx_hdr[16];
9106 };
9107
9108 -static void * ieee80211_tkip_init(int key_idx)
9109 +static void * ieee80211_tkip_init_rtl7(int key_idx)
9110 {
9111 struct ieee80211_tkip_data *priv;
9112
9113 @@ -72,28 +89,74 @@
9114 memset(priv, 0, sizeof(*priv));
9115 priv->key_idx = key_idx;
9116
9117 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
9118 priv->tfm_arc4 = crypto_alloc_tfm("arc4", 0);
9119 if (priv->tfm_arc4 == NULL) {
9120 printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
9121 "crypto API arc4\n");
9122 goto fail;
9123 }
9124 -
9125 priv->tfm_michael = crypto_alloc_tfm("michael_mic", 0);
9126 if (priv->tfm_michael == NULL) {
9127 printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
9128 "crypto API michael_mic\n");
9129 goto fail;
9130 }
9131 +#else
9132 + priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
9133 + if (IS_ERR(priv->tx_tfm_arc4)) {
9134 + printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
9135 + "crypto API arc4\n");
9136 + priv->tx_tfm_arc4 = NULL;
9137 + goto fail;
9138 + }
9139 +
9140 + priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
9141 + CRYPTO_ALG_ASYNC);
9142 + if (IS_ERR(priv->tx_tfm_michael)) {
9143 + printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
9144 + "crypto API michael_mic\n");
9145 + priv->tx_tfm_michael = NULL;
9146 + goto fail;
9147 + }
9148 +
9149 + priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
9150 + if (IS_ERR(priv->rx_tfm_arc4)) {
9151 + printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
9152 + "crypto API arc4\n");
9153 + priv->rx_tfm_arc4 = NULL;
9154 + goto fail;
9155 + }
9156 +
9157 + priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
9158 + CRYPTO_ALG_ASYNC);
9159 + if (IS_ERR(priv->rx_tfm_michael)) {
9160 + printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
9161 + "crypto API michael_mic\n");
9162 + priv->rx_tfm_michael = NULL;
9163 + goto fail;
9164 + }
9165 +#endif
9166
9167 return priv;
9168
9169 fail:
9170 if (priv) {
9171 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
9172 if (priv->tfm_michael)
9173 crypto_free_tfm(priv->tfm_michael);
9174 if (priv->tfm_arc4)
9175 crypto_free_tfm(priv->tfm_arc4);
9176 +#else
9177 + if (priv->tx_tfm_michael)
9178 + crypto_free_hash(priv->tx_tfm_michael);
9179 + if (priv->tx_tfm_arc4)
9180 + crypto_free_blkcipher(priv->tx_tfm_arc4);
9181 + if (priv->rx_tfm_michael)
9182 + crypto_free_hash(priv->rx_tfm_michael);
9183 + if (priv->rx_tfm_arc4)
9184 + crypto_free_blkcipher(priv->rx_tfm_arc4);
9185 +#endif
9186 kfree(priv);
9187 }
9188
9189 @@ -101,13 +164,26 @@
9190 }
9191
9192
9193 -static void ieee80211_tkip_deinit(void *priv)
9194 +static void ieee80211_tkip_deinit_rtl7(void *priv)
9195 {
9196 struct ieee80211_tkip_data *_priv = priv;
9197 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
9198 if (_priv && _priv->tfm_michael)
9199 crypto_free_tfm(_priv->tfm_michael);
9200 if (_priv && _priv->tfm_arc4)
9201 crypto_free_tfm(_priv->tfm_arc4);
9202 +#else
9203 + if (_priv) {
9204 + if (_priv->tx_tfm_michael)
9205 + crypto_free_hash(_priv->tx_tfm_michael);
9206 + if (_priv->tx_tfm_arc4)
9207 + crypto_free_blkcipher(_priv->tx_tfm_arc4);
9208 + if (_priv->rx_tfm_michael)
9209 + crypto_free_hash(_priv->rx_tfm_michael);
9210 + if (_priv->rx_tfm_arc4)
9211 + crypto_free_blkcipher(_priv->rx_tfm_arc4);
9212 + }
9213 +#endif
9214 kfree(priv);
9215 }
9216
9217 @@ -200,7 +276,7 @@
9218
9219 #define PHASE1_LOOP_COUNT 8
9220
9221 -static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
9222 +static void tkip_mixing_phase1_rtl7(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
9223 {
9224 int i, j;
9225
9226 @@ -222,7 +298,7 @@
9227 }
9228
9229
9230 -static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
9231 +static void tkip_mixing_phase2_rtl7(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
9232 u16 IV16)
9233 {
9234 /* Make temporary area overlap WEP seed so that the final copy can be
9235 @@ -268,7 +344,7 @@
9236 #endif
9237 }
9238
9239 -static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
9240 +static int ieee80211_tkip_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
9241 {
9242 struct ieee80211_tkip_data *tkey = priv;
9243 int len;
9244 @@ -276,6 +352,9 @@
9245 struct ieee80211_hdr *hdr;
9246 u32 crc;
9247 struct scatterlist sg;
9248 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
9249 + struct blkcipher_desc desc = { .tfm = tkey->tx_tfm_arc4 };
9250 +#endif
9251
9252 if (skb_headroom(skb) < 8 || skb_tailroom(skb) < 4 ||
9253 skb->len < hdr_len)
9254 @@ -283,11 +362,11 @@
9255
9256 hdr = (struct ieee80211_hdr *) skb->data;
9257 if (!tkey->tx_phase1_done) {
9258 - tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2,
9259 + tkip_mixing_phase1_rtl7(tkey->tx_ttak, tkey->key, hdr->addr2,
9260 tkey->tx_iv32);
9261 tkey->tx_phase1_done = 1;
9262 }
9263 - tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
9264 + tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
9265
9266 len = skb->len - hdr_len;
9267 pos = skb_push(skb, 8);
9268 @@ -310,11 +389,23 @@
9269 icv[2] = crc >> 16;
9270 icv[3] = crc >> 24;
9271
9272 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
9273 crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16);
9274 +#else
9275 + crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16);
9276 +#endif
9277 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
9278 sg.page = virt_to_page(pos);
9279 sg.offset = offset_in_page(pos);
9280 sg.length = len + 4;
9281 +#else
9282 + sg_set_page(&sg, virt_to_page(pos), len + 2, offset_in_page(pos));
9283 +#endif
9284 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
9285 crypto_cipher_encrypt(tkey->tfm_arc4, &sg, &sg, len + 4);
9286 +#else
9287 + crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
9288 +#endif
9289
9290 tkey->tx_iv16++;
9291 if (tkey->tx_iv16 == 0) {
9292 @@ -325,7 +416,7 @@
9293 return 0;
9294 }
9295
9296 -static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
9297 +static int ieee80211_tkip_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
9298 {
9299 struct ieee80211_tkip_data *tkey = priv;
9300 u8 rc4key[16];
9301 @@ -337,6 +428,9 @@
9302 u32 crc;
9303 struct scatterlist sg;
9304 int plen;
9305 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
9306 + struct blkcipher_desc desc = { .tfm = tkey->rx_tfm_arc4 };
9307 +#endif
9308
9309 if (skb->len < hdr_len + 8 + 4)
9310 return -1;
9311 @@ -382,18 +476,30 @@
9312 }
9313
9314 if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) {
9315 - tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
9316 + tkip_mixing_phase1_rtl7(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
9317 tkey->rx_phase1_done = 1;
9318 }
9319 - tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16);
9320 + tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->rx_ttak, iv16);
9321
9322 plen = skb->len - hdr_len - 12;
9323
9324 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
9325 crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16);
9326 +#else
9327 + crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16);
9328 +#endif
9329 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
9330 sg.page = virt_to_page(pos);
9331 sg.offset = offset_in_page(pos);
9332 sg.length = plen + 4;
9333 +#else
9334 + sg_set_page(&sg, virt_to_page(pos), plen + 4, offset_in_page(pos));
9335 +#endif
9336 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
9337 crypto_cipher_decrypt(tkey->tfm_arc4, &sg, &sg, plen + 4);
9338 +#else
9339 + crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4);
9340 +#endif
9341
9342 crc = ~crc32_le(~0, pos, plen);
9343 icv[0] = crc;
9344 @@ -427,33 +533,59 @@
9345 return keyidx;
9346 }
9347
9348 -
9349 -static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
9350 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
9351 +static int michael_mic_rtl7(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
9352 u8 *data, size_t data_len, u8 *mic)
9353 {
9354 struct scatterlist sg[2];
9355
9356 if (tkey->tfm_michael == NULL) {
9357 +#else
9358 +static int michael_mic_rtl7(struct crypto_hash *tfm_michael, u8 *key, u8 *hdr,
9359 + u8 *data, size_t data_len, u8 *mic)
9360 +{
9361 + struct hash_desc desc;
9362 + struct scatterlist sg[2];
9363 +
9364 + if (tfm_michael == NULL) {
9365 +#endif
9366 printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
9367 return -1;
9368 }
9369 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
9370 sg[0].page = virt_to_page(hdr);
9371 sg[0].offset = offset_in_page(hdr);
9372 sg[0].length = 16;
9373 +#else
9374 + sg_set_page(&sg[0], virt_to_page(hdr), 16, offset_in_page(hdr));
9375 +#endif
9376
9377 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
9378 sg[1].page = virt_to_page(data);
9379 sg[1].offset = offset_in_page(data);
9380 sg[1].length = data_len;
9381 +#else
9382 + sg_set_page(&sg[1], virt_to_page(data), data_len, offset_in_page(data));
9383 +#endif
9384
9385 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
9386 crypto_digest_init(tkey->tfm_michael);
9387 crypto_digest_setkey(tkey->tfm_michael, key, 8);
9388 crypto_digest_update(tkey->tfm_michael, sg, 2);
9389 crypto_digest_final(tkey->tfm_michael, mic);
9390
9391 return 0;
9392 +#else
9393 + if (crypto_hash_setkey(tfm_michael, key, 8))
9394 + return -1;
9395 +
9396 + desc.tfm = tfm_michael;
9397 + desc.flags = 0;
9398 + return crypto_hash_digest(&desc, sg, data_len + 16, mic);
9399 +#endif
9400 }
9401
9402 -static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
9403 +static void michael_mic_hdr_rtl7(struct sk_buff *skb, u8 *hdr)
9404 {
9405 struct ieee80211_hdr *hdr11;
9406
9407 @@ -483,7 +615,7 @@
9408 }
9409
9410
9411 -static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv)
9412 +static int ieee80211_michael_mic_add_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
9413 {
9414 struct ieee80211_tkip_data *tkey = priv;
9415 u8 *pos;
9416 @@ -495,18 +627,24 @@
9417 return -1;
9418 }
9419
9420 - michael_mic_hdr(skb, tkey->tx_hdr);
9421 + michael_mic_hdr_rtl7(skb, tkey->tx_hdr);
9422 pos = skb_put(skb, 8);
9423 - if (michael_mic(tkey, &tkey->key[16], tkey->tx_hdr,
9424 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
9425 + if (michael_mic_rtl7(tkey, &tkey->key[16], tkey->tx_hdr,
9426 + skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
9427 + return -1;
9428 +#else
9429 + if (michael_mic_rtl7(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr,
9430 skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
9431 return -1;
9432 +#endif
9433
9434 return 0;
9435 }
9436
9437
9438 #if WIRELESS_EXT >= 18
9439 -static void ieee80211_michael_mic_failure(struct net_device *dev,
9440 +static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
9441 struct ieee80211_hdr *hdr,
9442 int keyidx)
9443 {
9444 @@ -527,7 +665,7 @@
9445 wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev);
9446 }
9447 #elif WIRELESS_EXT >= 15
9448 -static void ieee80211_michael_mic_failure(struct net_device *dev,
9449 +static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
9450 struct ieee80211_hdr *hdr,
9451 int keyidx)
9452 {
9453 @@ -543,7 +681,7 @@
9454 wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
9455 }
9456 #else /* WIRELESS_EXT >= 15 */
9457 -static inline void ieee80211_michael_mic_failure(struct net_device *dev,
9458 +static inline void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
9459 struct ieee80211_hdr *hdr,
9460 int keyidx)
9461 {
9462 @@ -551,7 +689,7 @@
9463 #endif /* WIRELESS_EXT >= 15 */
9464
9465
9466 -static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
9467 +static int ieee80211_michael_mic_verify_rtl7(struct sk_buff *skb, int keyidx,
9468 int hdr_len, void *priv)
9469 {
9470 struct ieee80211_tkip_data *tkey = priv;
9471 @@ -560,10 +698,16 @@
9472 if (!tkey->key_set)
9473 return -1;
9474
9475 - michael_mic_hdr(skb, tkey->rx_hdr);
9476 - if (michael_mic(tkey, &tkey->key[24], tkey->rx_hdr,
9477 + michael_mic_hdr_rtl7(skb, tkey->rx_hdr);
9478 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
9479 + if (michael_mic_rtl7(tkey, &tkey->key[24], tkey->rx_hdr,
9480 + skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
9481 + return -1;
9482 +#else
9483 + if (michael_mic_rtl7(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr,
9484 skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
9485 return -1;
9486 +#endif
9487 if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
9488 struct ieee80211_hdr *hdr;
9489 hdr = (struct ieee80211_hdr *) skb->data;
9490 @@ -572,7 +716,7 @@
9491 skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2),
9492 keyidx);
9493 if (skb->dev)
9494 - ieee80211_michael_mic_failure(skb->dev, hdr, keyidx);
9495 + ieee80211_michael_mic_failure_rtl7(skb->dev, hdr, keyidx);
9496 tkey->dot11RSNAStatsTKIPLocalMICFailures++;
9497 return -1;
9498 }
9499 @@ -588,18 +732,33 @@
9500 }
9501
9502
9503 -static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
9504 +static int ieee80211_tkip_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
9505 {
9506 struct ieee80211_tkip_data *tkey = priv;
9507 int keyidx;
9508 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
9509 struct crypto_tfm *tfm = tkey->tfm_michael;
9510 struct crypto_tfm *tfm2 = tkey->tfm_arc4;
9511 +#else
9512 + struct crypto_hash *tfm = tkey->tx_tfm_michael;
9513 + struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4;
9514 + struct crypto_hash *tfm3 = tkey->rx_tfm_michael;
9515 + struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4;
9516 +#endif
9517
9518 keyidx = tkey->key_idx;
9519 memset(tkey, 0, sizeof(*tkey));
9520 tkey->key_idx = keyidx;
9521 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
9522 tkey->tfm_michael = tfm;
9523 tkey->tfm_arc4 = tfm2;
9524 +#else
9525 + tkey->tx_tfm_michael = tfm;
9526 + tkey->tx_tfm_arc4 = tfm2;
9527 + tkey->rx_tfm_michael = tfm3;
9528 + tkey->rx_tfm_arc4 = tfm4;
9529 +#endif
9530 +
9531 if (len == TKIP_KEY_LEN) {
9532 memcpy(tkey->key, key, TKIP_KEY_LEN);
9533 tkey->key_set = 1;
9534 @@ -618,7 +777,7 @@
9535 }
9536
9537
9538 -static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv)
9539 +static int ieee80211_tkip_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
9540 {
9541 struct ieee80211_tkip_data *tkey = priv;
9542
9543 @@ -648,7 +807,7 @@
9544 }
9545
9546
9547 -static char * ieee80211_tkip_print_stats(char *p, void *priv)
9548 +static char * ieee80211_tkip_print_stats_rtl7(char *p, void *priv)
9549 {
9550 struct ieee80211_tkip_data *tkip = priv;
9551 p += sprintf(p, "key[%d] alg=TKIP key_set=%d "
9552 @@ -675,34 +834,34 @@
9553 }
9554
9555
9556 -static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
9557 +static struct ieee80211_crypto_ops ieee80211_crypt_tkip_rtl7 = {
9558 .name = "TKIP",
9559 - .init = ieee80211_tkip_init,
9560 - .deinit = ieee80211_tkip_deinit,
9561 - .encrypt_mpdu = ieee80211_tkip_encrypt,
9562 - .decrypt_mpdu = ieee80211_tkip_decrypt,
9563 - .encrypt_msdu = ieee80211_michael_mic_add,
9564 - .decrypt_msdu = ieee80211_michael_mic_verify,
9565 - .set_key = ieee80211_tkip_set_key,
9566 - .get_key = ieee80211_tkip_get_key,
9567 - .print_stats = ieee80211_tkip_print_stats,
9568 + .init = ieee80211_tkip_init_rtl7,
9569 + .deinit = ieee80211_tkip_deinit_rtl7,
9570 + .encrypt_mpdu = ieee80211_tkip_encrypt_rtl7,
9571 + .decrypt_mpdu = ieee80211_tkip_decrypt_rtl7,
9572 + .encrypt_msdu = ieee80211_michael_mic_add_rtl7,
9573 + .decrypt_msdu = ieee80211_michael_mic_verify_rtl7,
9574 + .set_key = ieee80211_tkip_set_key_rtl7,
9575 + .get_key = ieee80211_tkip_get_key_rtl7,
9576 + .print_stats = ieee80211_tkip_print_stats_rtl7,
9577 .extra_prefix_len = 4 + 4, /* IV + ExtIV */
9578 .extra_postfix_len = 8 + 4, /* MIC + ICV */
9579 .owner = THIS_MODULE,
9580 };
9581
9582
9583 -static int __init ieee80211_crypto_tkip_init(void)
9584 +static int __init ieee80211_crypto_tkip_init_rtl7(void)
9585 {
9586 - return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip);
9587 + return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
9588 }
9589
9590
9591 -static void __exit ieee80211_crypto_tkip_exit(void)
9592 +static void __exit ieee80211_crypto_tkip_exit_rtl7(void)
9593 {
9594 - ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip);
9595 + ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
9596 }
9597
9598
9599 -module_init(ieee80211_crypto_tkip_init);
9600 -module_exit(ieee80211_crypto_tkip_exit);
9601 +module_init(ieee80211_crypto_tkip_init_rtl7);
9602 +module_exit(ieee80211_crypto_tkip_exit_rtl7);
9603 diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_wep.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_wep.c
9604 --- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_wep.c 2006-06-06 04:57:54.000000000 +0200
9605 +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_wep.c 2008-01-30 17:39:05.000000000 +0100
9606 @@ -9,7 +9,6 @@
9607 * more details.
9608 */
9609
9610 -#include <linux/config.h>
9611 #include <linux/version.h>
9612 #include <linux/module.h>
9613 #include <linux/init.h>
9614 @@ -18,13 +17,24 @@
9615 #include <linux/skbuff.h>
9616 #include <asm/string.h>
9617
9618 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
9619 +#include <linux/config.h>
9620 +#else
9621 +#include <linux/autoconf.h>
9622 +#endif
9623 +
9624 #include "ieee80211.h"
9625
9626
9627 #include <linux/crypto.h>
9628 -#include <asm/scatterlist.h>
9629 #include <linux/crc32.h>
9630
9631 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
9632 + #include <asm/scatterlist.h>
9633 +#else
9634 + #include <linux/scatterlist.h>
9635 +#endif
9636 +
9637 MODULE_AUTHOR("Jouni Malinen");
9638 MODULE_DESCRIPTION("Host AP crypt: WEP");
9639 MODULE_LICENSE("GPL");
9640 @@ -36,11 +46,16 @@
9641 u8 key[WEP_KEY_LEN + 1];
9642 u8 key_len;
9643 u8 key_idx;
9644 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
9645 struct crypto_tfm *tfm;
9646 +#else
9647 + struct crypto_blkcipher *rx_tfm;
9648 + struct crypto_blkcipher *tx_tfm;
9649 +#endif
9650 };
9651
9652
9653 -static void * prism2_wep_init(int keyidx)
9654 +static void * prism2_wep_init_rtl7(int keyidx)
9655 {
9656 struct prism2_wep_data *priv;
9657
9658 @@ -50,13 +65,30 @@
9659 memset(priv, 0, sizeof(*priv));
9660 priv->key_idx = keyidx;
9661
9662 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
9663 priv->tfm = crypto_alloc_tfm("arc4", 0);
9664 if (priv->tfm == NULL) {
9665 printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
9666 "crypto API arc4\n");
9667 goto fail;
9668 }
9669 +#else
9670 + priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
9671 + if (IS_ERR(priv->tx_tfm)) {
9672 + printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
9673 + "crypto API arc4\n");
9674 + priv->tx_tfm = NULL;
9675 + goto fail;
9676 + }
9677
9678 + priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
9679 + if (IS_ERR(priv->rx_tfm)) {
9680 + printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
9681 + "crypto API arc4\n");
9682 + priv->rx_tfm = NULL;
9683 + goto fail;
9684 + }
9685 +#endif
9686 /* start WEP IV from a random value */
9687 get_random_bytes(&priv->iv, 4);
9688
9689 @@ -64,19 +96,35 @@
9690
9691 fail:
9692 if (priv) {
9693 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
9694 if (priv->tfm)
9695 crypto_free_tfm(priv->tfm);
9696 +#else
9697 + if (priv->tx_tfm)
9698 + crypto_free_blkcipher(priv->tx_tfm);
9699 + if (priv->rx_tfm)
9700 + crypto_free_blkcipher(priv->rx_tfm);
9701 +#endif
9702 kfree(priv);
9703 }
9704 return NULL;
9705 }
9706
9707
9708 -static void prism2_wep_deinit(void *priv)
9709 +static void prism2_wep_deinit_rtl7(void *priv)
9710 {
9711 struct prism2_wep_data *_priv = priv;
9712 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
9713 if (_priv && _priv->tfm)
9714 crypto_free_tfm(_priv->tfm);
9715 +#else
9716 + if (_priv) {
9717 + if (_priv->tx_tfm)
9718 + crypto_free_blkcipher(_priv->tx_tfm);
9719 + if (_priv->rx_tfm)
9720 + crypto_free_blkcipher(_priv->rx_tfm);
9721 + }
9722 +#endif
9723 kfree(priv);
9724 }
9725
9726 @@ -87,13 +135,16 @@
9727 *
9728 * WEP frame payload: IV + TX key idx, RC4(data), ICV = RC4(CRC32(data))
9729 */
9730 -static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
9731 +static int prism2_wep_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
9732 {
9733 struct prism2_wep_data *wep = priv;
9734 u32 crc, klen, len;
9735 u8 key[WEP_KEY_LEN + 3];
9736 u8 *pos, *icv;
9737 struct scatterlist sg;
9738 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
9739 + struct blkcipher_desc desc = { .tfm = wep->tx_tfm };
9740 +#endif
9741
9742 if (skb_headroom(skb) < 4 || skb_tailroom(skb) < 4 ||
9743 skb->len < hdr_len)
9744 @@ -134,13 +185,25 @@
9745 icv[2] = crc >> 16;
9746 icv[3] = crc >> 24;
9747
9748 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
9749 crypto_cipher_setkey(wep->tfm, key, klen);
9750 +#else
9751 + crypto_blkcipher_setkey(wep->tx_tfm, key, klen);
9752 +#endif
9753 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
9754 sg.page = virt_to_page(pos);
9755 sg.offset = offset_in_page(pos);
9756 sg.length = len + 4;
9757 - crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
9758 +#else
9759 + sg_set_page(&sg, virt_to_page(pos), len + 4, offset_in_page(pos));
9760 +#endif
9761
9762 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
9763 + crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
9764 return 0;
9765 +#else
9766 + return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
9767 +#endif
9768 }
9769
9770
9771 @@ -151,13 +214,16 @@
9772 * Returns 0 if frame was decrypted successfully and ICV was correct and -1 on
9773 * failure. If frame is OK, IV and ICV will be removed.
9774 */
9775 -static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
9776 +static int prism2_wep_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
9777 {
9778 struct prism2_wep_data *wep = priv;
9779 u32 crc, klen, plen;
9780 u8 key[WEP_KEY_LEN + 3];
9781 u8 keyidx, *pos, icv[4];
9782 struct scatterlist sg;
9783 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
9784 + struct blkcipher_desc desc = { .tfm = wep->rx_tfm };
9785 +#endif
9786
9787 if (skb->len < hdr_len + 8)
9788 return -1;
9789 @@ -178,11 +244,26 @@
9790 /* Apply RC4 to data and compute CRC32 over decrypted data */
9791 plen = skb->len - hdr_len - 8;
9792
9793 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
9794 crypto_cipher_setkey(wep->tfm, key, klen);
9795 +#else
9796 + crypto_blkcipher_setkey(wep->rx_tfm, key, klen);
9797 +#endif
9798 +
9799 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
9800 sg.page = virt_to_page(pos);
9801 sg.offset = offset_in_page(pos);
9802 sg.length = plen + 4;
9803 +#else
9804 + sg_set_page(&sg, virt_to_page(pos), plen + 4, offset_in_page(pos));
9805 +#endif
9806 +
9807 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
9808 crypto_cipher_decrypt(wep->tfm, &sg, &sg, plen + 4);
9809 +#else
9810 + if(crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4))
9811 + return -7;
9812 +#endif
9813
9814 crc = ~crc32_le(~0, pos, plen);
9815 icv[0] = crc;
9816 @@ -203,7 +284,7 @@
9817 }
9818
9819
9820 -static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
9821 +static int prism2_wep_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
9822 {
9823 struct prism2_wep_data *wep = priv;
9824
9825 @@ -217,7 +298,7 @@
9826 }
9827
9828
9829 -static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv)
9830 +static int prism2_wep_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
9831 {
9832 struct prism2_wep_data *wep = priv;
9833
9834 @@ -230,7 +311,7 @@
9835 }
9836
9837
9838 -static char * prism2_wep_print_stats(char *p, void *priv)
9839 +static char * prism2_wep_print_stats_rtl7(char *p, void *priv)
9840 {
9841 struct prism2_wep_data *wep = priv;
9842 p += sprintf(p, "key[%d] alg=WEP len=%d\n",
9843 @@ -239,34 +320,34 @@
9844 }
9845
9846
9847 -static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
9848 +static struct ieee80211_crypto_ops ieee80211_crypt_wep_rtl7 = {
9849 .name = "WEP",
9850 - .init = prism2_wep_init,
9851 - .deinit = prism2_wep_deinit,
9852 - .encrypt_mpdu = prism2_wep_encrypt,
9853 - .decrypt_mpdu = prism2_wep_decrypt,
9854 + .init = prism2_wep_init_rtl7,
9855 + .deinit = prism2_wep_deinit_rtl7,
9856 + .encrypt_mpdu = prism2_wep_encrypt_rtl7,
9857 + .decrypt_mpdu = prism2_wep_decrypt_rtl7,
9858 .encrypt_msdu = NULL,
9859 .decrypt_msdu = NULL,
9860 - .set_key = prism2_wep_set_key,
9861 - .get_key = prism2_wep_get_key,
9862 - .print_stats = prism2_wep_print_stats,
9863 + .set_key = prism2_wep_set_key_rtl7,
9864 + .get_key = prism2_wep_get_key_rtl7,
9865 + .print_stats = prism2_wep_print_stats_rtl7,
9866 .extra_prefix_len = 4, /* IV */
9867 .extra_postfix_len = 4, /* ICV */
9868 .owner = THIS_MODULE,
9869 };
9870
9871
9872 -static int __init ieee80211_crypto_wep_init(void)
9873 +static int __init ieee80211_crypto_wep_init_rtl7(void)
9874 {
9875 - return ieee80211_register_crypto_ops(&ieee80211_crypt_wep);
9876 + return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
9877 }
9878
9879
9880 -static void __exit ieee80211_crypto_wep_exit(void)
9881 +static void __exit ieee80211_crypto_wep_exit_rtl7(void)
9882 {
9883 - ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep);
9884 + ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
9885 }
9886
9887
9888 -module_init(ieee80211_crypto_wep_init);
9889 -module_exit(ieee80211_crypto_wep_exit);
9890 +module_init(ieee80211_crypto_wep_init_rtl7);
9891 +module_exit(ieee80211_crypto_wep_exit_rtl7);
9892 diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211.h rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211.h
9893 --- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211.h 2006-06-06 04:57:56.000000000 +0200
9894 +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211.h 2008-01-30 17:38:11.000000000 +0100
9895 @@ -120,7 +120,7 @@
9896 static inline unsigned long msleep_interruptible_rtl(unsigned int msecs)
9897 {
9898 unsigned long timeout = MSECS(msecs) + 1;
9899 -
9900 +
9901 while (timeout) {
9902 set_current_state(TASK_UNINTERRUPTIBLE);
9903 timeout = schedule_timeout(timeout);
9904 @@ -156,6 +156,22 @@
9905 struct list_head list;
9906 };
9907
9908 +#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
9909 +/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
9910 + * (from linux-wlan-ng) */
9911 +struct linux_wlan_ng_val {
9912 + u32 did;
9913 + u16 status, len;
9914 + u32 data;
9915 +} __attribute__ ((packed));
9916 +
9917 +struct linux_wlan_ng_prism_hdr {
9918 + u32 msgcode, msglen;
9919 + char devname[16];
9920 + struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
9921 + noise, rate, istx, frmlen;
9922 +} __attribute__ ((packed));
9923 +
9924 struct ieee80211_hdr {
9925 u16 frame_ctl;
9926 u16 duration_id;
9927 @@ -798,7 +814,7 @@
9928
9929 /* the card is not linked at all */
9930 IEEE80211_NOLINK = 0,
9931 -
9932 +
9933 /* IEEE80211_ASSOCIATING* are for BSS client mode
9934 * the driver shall not perform RX filtering unless
9935 * the state is LINKED.
9936 @@ -806,31 +822,31 @@
9937 * defaults to NOLINK for ALL the other states (including
9938 * LINKED_SCANNING)
9939 */
9940 -
9941 +
9942 /* the association procedure will start (wq scheduling)*/
9943 IEEE80211_ASSOCIATING,
9944 IEEE80211_ASSOCIATING_RETRY,
9945 -
9946 +
9947 /* the association procedure is sending AUTH request*/
9948 IEEE80211_ASSOCIATING_AUTHENTICATING,
9949 -
9950 +
9951 /* the association procedure has successfully authentcated
9952 * and is sending association request
9953 */
9954 IEEE80211_ASSOCIATING_AUTHENTICATED,
9955 -
9956 +
9957 /* the link is ok. the card associated to a BSS or linked
9958 * to a ibss cell or acting as an AP and creating the bss
9959 */
9960 IEEE80211_LINKED,
9961 -
9962 +
9963 /* same as LINKED, but the driver shall apply RX filter
9964 * rules as we are in NO_LINK mode. As the card is still
9965 * logically linked, but it is doing a syncro site survey
9966 * then it will be back to LINKED state.
9967 */
9968 IEEE80211_LINKED_SCANNING,
9969 -
9970 +
9971 };
9972
9973 #define DEFAULT_MAX_SCAN_AGE (15 * HZ)
9974 @@ -840,14 +856,14 @@
9975
9976
9977 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
9978 -extern inline int is_multicast_ether_addr(const u8 *addr)
9979 +extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
9980 {
9981 return ((addr[0] != 0xff) && (0x01 & addr[0]));
9982 }
9983 #endif
9984
9985 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
9986 -extern inline int is_broadcast_ether_addr(const u8 *addr)
9987 +extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
9988 {
9989 return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
9990 (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
9991 @@ -870,7 +886,7 @@
9992 struct net_device_stats stats;
9993 struct ieee80211_stats ieee_stats;
9994 struct ieee80211_softmac_stats softmac_stats;
9995 -
9996 +
9997 /* Probe / Beacon management */
9998 struct list_head network_free_list;
9999 struct list_head network_list;
10000 @@ -881,7 +897,7 @@
10001 int iw_mode; /* operating mode (IW_MODE_*) */
10002
10003 spinlock_t lock;
10004 -
10005 +
10006 int tx_headroom; /* Set to size of any additional room needed at front
10007 * of allocated Tx SKBs */
10008 u32 config;
10009 @@ -924,11 +940,11 @@
10010 * ad-hoc is a mixture ;-).
10011 * Note that in infrastructure mode, even when not associated,
10012 * fields bssid and essid may be valid (if wpa_set and essid_set
10013 - * are true) as thy carry the value set by the user via iwconfig
10014 + * are true) as thy carry the value set by the user via iwconfig
10015 */
10016 struct ieee80211_network current_network;
10017
10018 -
10019 +
10020 enum ieee80211_state state;
10021
10022 int short_slot;
10023 @@ -936,33 +952,33 @@
10024 int modulation; /* CCK, OFDM */
10025 int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
10026 int abg_true; /* ABG flag */
10027 -
10028 - /* used for forcing the ibss workqueue to terminate
10029 +
10030 + /* used for forcing the ibss workqueue to terminate
10031 * without wait for the syncro scan to terminate
10032 */
10033 - short sync_scan_hurryup;
10034 -
10035 + short sync_scan_hurryup;
10036 +
10037 /* map of allowed channels. 0 is dummy */
10038 // FIXME: remeber to default to a basic channel plan depending of the PHY type
10039 int channel_map[MAX_CHANNEL_NUMBER+1];
10040 -
10041 +
10042 int rate; /* current rate */
10043 int basic_rate;
10044 //FIXME: pleace callback, see if redundant with softmac_features
10045 short active_scan;
10046 -
10047 +
10048 /* this contains flags for selectively enable softmac support */
10049 u16 softmac_features;
10050 -
10051 +
10052 /* if the sequence control field is not filled by HW */
10053 u16 seq_ctrl;
10054 -
10055 +
10056 /* association procedure transaction sequence number */
10057 u16 associate_seq;
10058 -
10059 +
10060 /* AID for RTXed association responses */
10061 u16 assoc_id;
10062 -
10063 +
10064 /* power save mode related*/
10065 short ps;
10066 short sta_sleep;
10067 @@ -970,147 +986,153 @@
10068 struct tasklet_struct ps_task;
10069 u32 ps_th;
10070 u32 ps_tl;
10071 -
10072 +
10073 short raw_tx;
10074 /* used if IEEE_SOFTMAC_TX_QUEUE is set */
10075 short queue_stop;
10076 short scanning;
10077 short proto_started;
10078 -
10079 +
10080 struct semaphore wx_sem;
10081 struct semaphore scan_sem;
10082 -
10083 - spinlock_t mgmt_tx_lock;
10084 +
10085 + spinlock_t mgmt_tx_lock;
10086 spinlock_t beacon_lock;
10087
10088 short beacon_txing;
10089
10090 short wap_set;
10091 short ssid_set;
10092 -
10093 +
10094 /* for discarding duplicated packets in IBSS */
10095 struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
10096 -
10097 +
10098 /* for discarding duplicated packets in BSS */
10099 u16 last_seq_num;
10100 u16 last_frag_num;
10101 unsigned long last_packet_time;
10102 -
10103 +
10104 /* for PS mode */
10105 unsigned long last_rx_ps_time;
10106 -
10107 +
10108 /* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
10109 struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM];
10110 int mgmt_queue_head;
10111 int mgmt_queue_tail;
10112 -
10113 -
10114 +
10115 +
10116 /* used if IEEE_SOFTMAC_TX_QUEUE is set */
10117 struct tx_pending_t tx_pending;
10118 -
10119 +
10120 /* used if IEEE_SOFTMAC_ASSOCIATE is set */
10121 struct timer_list associate_timer;
10122
10123 /* used if IEEE_SOFTMAC_BEACONS is set */
10124 struct timer_list beacon_timer;
10125 -
10126 +
10127 struct work_struct associate_complete_wq;
10128 +
10129 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
10130 + struct delayed_work associate_retry_wq;
10131 + struct delayed_work softmac_scan_wq;
10132 +#else
10133 struct work_struct associate_retry_wq;
10134 + struct work_struct softmac_scan_wq;
10135 +#endif
10136 struct work_struct start_ibss_wq;
10137 struct work_struct associate_procedure_wq;
10138 - struct work_struct softmac_scan_wq;
10139 struct work_struct wx_sync_scan_wq;
10140 -
10141 +
10142 struct workqueue_struct *wq;
10143 /* Callback functions */
10144 void (*set_security)(struct net_device *dev,
10145 struct ieee80211_security *sec);
10146 -
10147 +
10148 /* Used to TX data frame by using txb structs.
10149 * this is not used if in the softmac_features
10150 * is set the flag IEEE_SOFTMAC_TX_QUEUE
10151 */
10152 int (*hard_start_xmit)(struct ieee80211_txb *txb,
10153 struct net_device *dev);
10154 -
10155 +
10156 int (*reset_port)(struct net_device *dev);
10157
10158 - /* Softmac-generated frames (mamagement) are TXed via this
10159 - * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
10160 - * not set. As some cards may have different HW queues that
10161 + /* Softmac-generated frames (mamagement) are TXed via this
10162 + * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
10163 + * not set. As some cards may have different HW queues that
10164 * one might want to use for data and management frames
10165 * the option to have two callbacks might be useful.
10166 * This fucntion can't sleep.
10167 */
10168 int (*softmac_hard_start_xmit)(struct sk_buff *skb,
10169 struct net_device *dev);
10170 -
10171 +
10172 /* used instead of hard_start_xmit (not softmac_hard_start_xmit)
10173 * if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
10174 * frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
10175 * then also management frames are sent via this callback.
10176 * This function can't sleep.
10177 - */
10178 + */
10179 void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
10180 struct net_device *dev,int rate);
10181
10182 /* stops the HW queue for DATA frames. Useful to avoid
10183 * waste time to TX data frame when we are reassociating
10184 * This function can sleep.
10185 - */
10186 + */
10187 void (*data_hard_stop)(struct net_device *dev);
10188 -
10189 +
10190 /* OK this is complementar to data_poll_hard_stop */
10191 void (*data_hard_resume)(struct net_device *dev);
10192 -
10193 +
10194 /* ask to the driver to retune the radio .
10195 * This function can sleep. the driver should ensure
10196 * the radio has been swithced before return.
10197 */
10198 void (*set_chan)(struct net_device *dev,short ch);
10199 -
10200 +
10201 /* These are not used if the ieee stack takes care of
10202 - * scanning (IEEE_SOFTMAC_SCAN feature set).
10203 + * scanning (IEEE_SOFTMAC_SCAN feature set).
10204 * In this case only the set_chan is used.
10205 *
10206 * The syncro version is similar to the start_scan but
10207 * does not return until all channels has been scanned.
10208 - * this is called in user context and should sleep,
10209 + * this is called in user context and should sleep,
10210 * it is called in a work_queue when swithcing to ad-hoc mode
10211 - * or in behalf of iwlist scan when the card is associated
10212 - * and root user ask for a scan.
10213 + * or in behalf of iwlist scan when the card is associated
10214 + * and root user ask for a scan.
10215 * the fucntion stop_scan should stop both the syncro and
10216 * background scanning and can sleep.
10217 - * The fucntion start_scan should initiate the background
10218 + * The fucntion start_scan should initiate the background
10219 * scanning and can't sleep.
10220 - */
10221 + */
10222 void (*scan_syncro)(struct net_device *dev);
10223 void (*start_scan)(struct net_device *dev);
10224 void (*stop_scan)(struct net_device *dev);
10225 -
10226 +
10227 /* indicate the driver that the link state is changed
10228 * for example it may indicate the card is associated now.
10229 - * Driver might be interested in this to apply RX filter
10230 - * rules or simply light the LINK led
10231 + * Driver might be interested in this to apply RX filter
10232 + * rules or simply light the LINK led
10233 */
10234 void (*link_change)(struct net_device *dev);
10235 -
10236 +
10237 /* these two function indicates to the HW when to start
10238 - * and stop to send beacons. This is used when the
10239 + * and stop to send beacons. This is used when the
10240 * IEEE_SOFTMAC_BEACONS is not set. For now the
10241 * stop_send_bacons is NOT guaranteed to be called only
10242 * after start_send_beacons.
10243 */
10244 void (*start_send_beacons) (struct net_device *dev);
10245 void (*stop_send_beacons) (struct net_device *dev);
10246 -
10247 +
10248 /* power save mode related */
10249 void (*sta_wake_up) (struct net_device *dev);
10250 void (*ps_request_tx_ack) (struct net_device *dev);
10251 void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl);
10252 short (*ps_is_queue_empty) (struct net_device *dev);
10253 -
10254 -
10255 +
10256 +
10257 /* This must be the last item so that it points to the data
10258 * allocated beyond this structure by alloc_ieee80211 */
10259 u8 priv[0];
10260 @@ -1148,18 +1170,18 @@
10261 #define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
10262
10263 /* Generate beacons. The stack will enqueue beacons
10264 - * to the card
10265 - */
10266 + * to the card
10267 + */
10268 #define IEEE_SOFTMAC_BEACONS (1<<6)
10269
10270
10271
10272 -extern inline void *ieee80211_priv(struct net_device *dev)
10273 +extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
10274 {
10275 return ((struct ieee80211_device *)netdev_priv(dev))->priv;
10276 }
10277
10278 -extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
10279 +extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
10280 {
10281 /* Single white space is for Linksys APs */
10282 if (essid_len == 1 && essid[0] == ' ')
10283 @@ -1175,7 +1197,7 @@
10284 return 1;
10285 }
10286
10287 -extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
10288 +extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
10289 {
10290 /*
10291 * It is possible for both access points and our device to support
10292 @@ -1201,7 +1223,7 @@
10293 return 0;
10294 }
10295
10296 -extern inline int ieee80211_get_hdrlen(u16 fc)
10297 +extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
10298 {
10299 int hdrlen = 24;
10300
10301 @@ -1229,140 +1251,144 @@
10302
10303
10304 /* ieee80211.c */
10305 -extern void free_ieee80211(struct net_device *dev);
10306 -extern struct net_device *alloc_ieee80211(int sizeof_priv);
10307 +extern void free_ieee80211_rtl7(struct net_device *dev);
10308 +extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
10309
10310 -extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
10311 +extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
10312
10313 /* ieee80211_tx.c */
10314
10315 -extern int ieee80211_encrypt_fragment(
10316 +extern int ieee80211_encrypt_fragment_rtl7(
10317 struct ieee80211_device *ieee,
10318 struct sk_buff *frag,
10319 int hdr_len);
10320 -
10321 -extern int ieee80211_xmit(struct sk_buff *skb,
10322 +
10323 +extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
10324 struct net_device *dev);
10325 -extern void ieee80211_txb_free(struct ieee80211_txb *);
10326 +extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
10327
10328
10329 /* ieee80211_rx.c */
10330 -extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
10331 +extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
10332 struct ieee80211_rx_stats *rx_stats);
10333 -extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
10334 +extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
10335 struct ieee80211_hdr *header,
10336 struct ieee80211_rx_stats *stats);
10337
10338 /* ieee80211_wx.c */
10339 -extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
10340 +extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
10341 struct iw_request_info *info,
10342 union iwreq_data *wrqu, char *key);
10343 -extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
10344 +extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
10345 struct iw_request_info *info,
10346 union iwreq_data *wrqu, char *key);
10347 -extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
10348 +extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
10349 struct iw_request_info *info,
10350 union iwreq_data *wrqu, char *key);
10351 /* ieee80211_softmac.c */
10352 -extern short ieee80211_is_54g(struct ieee80211_network net);
10353 -extern short ieee80211_is_shortslot(struct ieee80211_network net);
10354 -extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
10355 +extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
10356 +extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
10357 +extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
10358 struct ieee80211_rx_stats *rx_stats, u16 type,
10359 u16 stype);
10360 -extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
10361 +extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
10362
10363 -extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
10364 -extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
10365 -extern void ieee80211_start_bss(struct ieee80211_device *ieee);
10366 -extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
10367 -extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
10368 -extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
10369 -extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
10370 -extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
10371 -extern void ieee80211_disassociate(struct ieee80211_device *ieee);
10372 -extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
10373 -extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
10374 -extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
10375 -extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
10376 -extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
10377 -extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
10378 -extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
10379 -extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
10380 -extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
10381 -extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
10382 -extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
10383 -extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
10384 -extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
10385 -extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
10386 -extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
10387 -extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
10388 +extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
10389 +extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
10390 +extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
10391 +extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
10392 +extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
10393 +extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
10394 +extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
10395 +extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
10396 +extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
10397 +extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
10398 +extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
10399 +extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
10400 +extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
10401 +extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
10402 +extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
10403 +extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
10404 +extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
10405 +extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
10406 +extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
10407 +extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
10408 +extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
10409 +extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
10410 +extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
10411 +extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
10412 +extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
10413
10414 /* ieee80211_softmac_wx.c */
10415
10416 -extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
10417 - struct iw_request_info *info,
10418 +extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
10419 + struct iw_request_info *info,
10420 union iwreq_data *wrqu, char *ext);
10421 -
10422 -extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
10423 +
10424 +extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
10425 struct iw_request_info *info,
10426 union iwreq_data *awrq,
10427 char *extra);
10428 -
10429 -extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
10430
10431 -extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
10432 +extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
10433 +
10434 +extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
10435 struct iw_request_info *info,
10436 union iwreq_data *wrqu, char *extra);
10437 -
10438 -extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
10439 - struct iw_request_info *info,
10440 +
10441 +extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
10442 + struct iw_request_info *info,
10443 union iwreq_data *wrqu, char *extra);
10444 -
10445 -extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
10446 +
10447 +extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
10448 union iwreq_data *wrqu, char *b);
10449 -
10450 -extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
10451 +
10452 +extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
10453 union iwreq_data *wrqu, char *b);
10454 -
10455 -extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
10456 +
10457 +extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
10458 struct iw_request_info *a,
10459 union iwreq_data *wrqu, char *extra);
10460 -
10461 -extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
10462 +
10463 +extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
10464 union iwreq_data *wrqu, char *b);
10465
10466 -extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
10467 +extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
10468 union iwreq_data *wrqu, char *b);
10469
10470 -extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
10471 +extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
10472 union iwreq_data *wrqu, char *b);
10473
10474 -extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
10475 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
10476 +extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
10477 +#else
10478 +extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
10479 +#endif
10480
10481 -extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
10482 - struct iw_request_info *info,
10483 +extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
10484 + struct iw_request_info *info,
10485 union iwreq_data *wrqu, char *extra);
10486 -
10487 -extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
10488 - struct iw_request_info *info,
10489 +
10490 +extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
10491 + struct iw_request_info *info,
10492 union iwreq_data *wrqu, char *extra);
10493
10494 -extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
10495 +extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
10496 struct iw_request_info *info,
10497 union iwreq_data *wrqu, char *extra);
10498
10499 -extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
10500 +extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
10501 struct iw_request_info *info,
10502 union iwreq_data *wrqu, char *extra);
10503 -
10504 -extern const long ieee80211_wlan_frequencies[];
10505
10506 -extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
10507 +extern const long ieee80211_wlan_frequencies_rtl7[];
10508 +
10509 +extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
10510 {
10511 ieee->scans++;
10512 }
10513
10514 -extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
10515 +extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
10516 {
10517 return ieee->scans;
10518 }
10519 @@ -1372,7 +1398,7 @@
10520 const char *s = essid;
10521 char *d = escaped;
10522
10523 - if (ieee80211_is_empty_essid(essid, essid_len)) {
10524 + if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
10525 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
10526 return escaped;
10527 }
10528 @@ -1390,4 +1416,5 @@
10529 *d = '\0';
10530 return escaped;
10531 }
10532 +
10533 #endif /* IEEE80211_H */
10534 diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_module.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_module.c
10535 --- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_module.c 2006-06-06 04:58:00.000000000 +0200
10536 +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_module.c 2008-01-30 17:38:11.000000000 +0100
10537 @@ -31,7 +31,6 @@
10538 *******************************************************************************/
10539
10540 #include <linux/compiler.h>
10541 -#include <linux/config.h>
10542 #include <linux/errno.h>
10543 #include <linux/if_arp.h>
10544 #include <linux/in6.h>
10545 @@ -52,6 +51,12 @@
10546 #include <asm/uaccess.h>
10547 #include <net/arp.h>
10548
10549 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
10550 +#include <linux/config.h>
10551 +#else
10552 +#include <linux/autoconf.h>
10553 +#endif
10554 +
10555 #include "ieee80211.h"
10556
10557 MODULE_DESCRIPTION("802.11 data/management/control stack");
10558 @@ -60,7 +65,7 @@
10559
10560 #define DRV_NAME "ieee80211"
10561
10562 -static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
10563 +static inline int ieee80211_networks_allocate_rtl7(struct ieee80211_device *ieee)
10564 {
10565 if (ieee->networks)
10566 return 0;
10567 @@ -80,7 +85,7 @@
10568 return 0;
10569 }
10570
10571 -static inline void ieee80211_networks_free(struct ieee80211_device *ieee)
10572 +static inline void ieee80211_networks_free_rtl7(struct ieee80211_device *ieee)
10573 {
10574 if (!ieee->networks)
10575 return;
10576 @@ -88,7 +93,7 @@
10577 ieee->networks = NULL;
10578 }
10579
10580 -static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee)
10581 +static inline void ieee80211_networks_initialize_rtl7(struct ieee80211_device *ieee)
10582 {
10583 int i;
10584
10585 @@ -99,7 +104,7 @@
10586 }
10587
10588
10589 -struct net_device *alloc_ieee80211(int sizeof_priv)
10590 +struct net_device *alloc_ieee80211_rtl7(int sizeof_priv)
10591 {
10592 struct ieee80211_device *ieee;
10593 struct net_device *dev;
10594 @@ -113,17 +118,17 @@
10595 goto failed;
10596 }
10597 ieee = netdev_priv(dev);
10598 - dev->hard_start_xmit = ieee80211_xmit;
10599 + dev->hard_start_xmit = ieee80211_xmit_rtl7;
10600
10601 ieee->dev = dev;
10602
10603 - err = ieee80211_networks_allocate(ieee);
10604 + err = ieee80211_networks_allocate_rtl7(ieee);
10605 if (err) {
10606 IEEE80211_ERROR("Unable to allocate beacon storage: %d\n",
10607 err);
10608 goto failed;
10609 }
10610 - ieee80211_networks_initialize(ieee);
10611 + ieee80211_networks_initialize_rtl7(ieee);
10612
10613 /* Default fragmentation threshold is maximum payload size */
10614 ieee->fts = DEFAULT_FTS;
10615 @@ -138,7 +143,7 @@
10616 INIT_LIST_HEAD(&ieee->crypt_deinit_list);
10617 init_timer(&ieee->crypt_deinit_timer);
10618 ieee->crypt_deinit_timer.data = (unsigned long)ieee;
10619 - ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler;
10620 + ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler_rtl7;
10621
10622 spin_lock_init(&ieee->lock);
10623
10624 @@ -149,7 +154,7 @@
10625 ieee->ieee802_1x = 1;
10626 ieee->raw_tx = 0;
10627
10628 - ieee80211_softmac_init(ieee);
10629 + ieee80211_softmac_init_rtl7(ieee);
10630
10631 for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++)
10632 INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]);
10633 @@ -167,7 +172,7 @@
10634 }
10635
10636
10637 -void free_ieee80211(struct net_device *dev)
10638 +void free_ieee80211_rtl7(struct net_device *dev)
10639 {
10640 struct ieee80211_device *ieee = netdev_priv(dev);
10641
10642 @@ -175,9 +180,9 @@
10643 struct list_head *p, *q;
10644
10645
10646 - ieee80211_softmac_free(ieee);
10647 + ieee80211_softmac_free_rtl7(ieee);
10648 del_timer_sync(&ieee->crypt_deinit_timer);
10649 - ieee80211_crypt_deinit_entries(ieee, 1);
10650 + ieee80211_crypt_deinit_entries_rtl7(ieee, 1);
10651
10652 for (i = 0; i < WEP_KEYS; i++) {
10653 struct ieee80211_crypt_data *crypt = ieee->crypt[i];
10654 @@ -191,7 +196,7 @@
10655 }
10656 }
10657
10658 - ieee80211_networks_free(ieee);
10659 + ieee80211_networks_free_rtl7(ieee);
10660
10661 for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) {
10662 list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) {
10663 @@ -210,13 +215,13 @@
10664 u32 ieee80211_debug_level = 0;
10665 struct proc_dir_entry *ieee80211_proc = NULL;
10666
10667 -static int show_debug_level(char *page, char **start, off_t offset,
10668 +static int show_debug_level_rtl7(char *page, char **start, off_t offset,
10669 int count, int *eof, void *data)
10670 {
10671 return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
10672 }
10673
10674 -static int store_debug_level(struct file *file, const char *buffer,
10675 +static int store_debug_level_rtl7(struct file *file, const char *buffer,
10676 unsigned long count, void *data)
10677 {
10678 char buf[] = "0x00000000";
10679 @@ -243,7 +248,7 @@
10680 return strnlen(buf, count);
10681 }
10682
10683 -static int __init ieee80211_init(void)
10684 +static int __init ieee80211_init_rtl7(void)
10685 {
10686 struct proc_dir_entry *e;
10687
10688 @@ -268,7 +273,7 @@
10689 return 0;
10690 }
10691
10692 -static void __exit ieee80211_exit(void)
10693 +static void __exit ieee80211_exit_rtl7(void)
10694 {
10695 if (ieee80211_proc) {
10696 remove_proc_entry("debug_level", ieee80211_proc);
10697 @@ -282,9 +287,9 @@
10698 MODULE_PARM_DESC(debug, "debug output mask");
10699
10700
10701 -module_exit(ieee80211_exit);
10702 -module_init(ieee80211_init);
10703 +module_exit(ieee80211_exit_rtl7);
10704 +module_init(ieee80211_init_rtl7);
10705 #endif
10706
10707 -EXPORT_SYMBOL(alloc_ieee80211);
10708 -EXPORT_SYMBOL(free_ieee80211);
10709 +EXPORT_SYMBOL(alloc_ieee80211_rtl7);
10710 +EXPORT_SYMBOL(free_ieee80211_rtl7);
10711 diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_rx.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_rx.c
10712 --- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_rx.c 2006-06-06 04:58:00.000000000 +0200
10713 +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_rx.c 2008-01-30 17:38:11.000000000 +0100
10714 @@ -13,16 +13,15 @@
10715 * more details.
10716 ******************************************************************************
10717
10718 - Few modifications for Realtek's Wi-Fi drivers by
10719 + Few modifications for Realtek's Wi-Fi drivers by
10720 Andrea Merello <[email protected]>
10721 -
10722 - A special thanks goes to Realtek for their support !
10723 +
10724 + A special thanks goes to Realtek for their support !
10725
10726 ******************************************************************************/
10727 -
10728 +
10729
10730 #include <linux/compiler.h>
10731 -#include <linux/config.h>
10732 #include <linux/errno.h>
10733 #include <linux/if_arp.h>
10734 #include <linux/in6.h>
10735 @@ -43,18 +42,89 @@
10736 #include <asm/uaccess.h>
10737 #include <linux/ctype.h>
10738
10739 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
10740 +#include <linux/config.h>
10741 +#else
10742 +#include <linux/autoconf.h>
10743 +#endif
10744 +
10745 +
10746 #include "ieee80211.h"
10747
10748 -static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
10749 +static inline void ieee80211_monitor_rx_rtl7(struct ieee80211_device *ieee,
10750 struct sk_buff *skb,
10751 struct ieee80211_rx_stats *rx_stats)
10752 {
10753 - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
10754 - u16 fc = le16_to_cpu(hdr->frame_ctl);
10755 + struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data;
10756 + u16 fc = le16_to_cpu(hdr1->frame_ctl);
10757 + int prism_header;
10758 + int hdrlen, phdrlen, head_need, tail_need;
10759 +
10760 + if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) {
10761 + prism_header = 1;
10762 + phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
10763 + } else {
10764 + prism_header = 0;
10765 + phdrlen = 0;
10766 + }
10767 +
10768 + hdrlen = ieee80211_get_hdrlen_rtl7(fc);
10769 +
10770 + /* check if there is enough room for extra data; if not, expand skb
10771 + * buffer to be large enough for the changes */
10772 + head_need = phdrlen;
10773 + tail_need = 0;
10774 +#ifdef PRISM2_ADD_BOGUS_CRC
10775 + tail_need += 4;
10776 +#endif /* PRISM2_ADD_BOGUS_CRC */
10777 +
10778 + head_need -= skb_headroom(skb);
10779 + tail_need -= skb_tailroom(skb);
10780 +
10781 + if (head_need > 0 || tail_need > 0) {
10782 + if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
10783 + tail_need > 0 ? tail_need : 0,
10784 + GFP_ATOMIC)) {
10785 + printk(KERN_DEBUG "%s: ieee80211_rx failed to "
10786 + "reallocate skb buffer\n", ieee->dev->name);
10787 + dev_kfree_skb_any(skb);
10788 + return;
10789 + }
10790 + }
10791 +
10792 + if (prism_header == 1) {
10793 + struct linux_wlan_ng_prism_hdr *hdr;
10794 + hdr = (struct linux_wlan_ng_prism_hdr *)
10795 + skb_push(skb, phdrlen);
10796 + memset(hdr, 0, phdrlen);
10797 + hdr->msgcode = LWNG_CAP_DID_BASE;
10798 + hdr->msglen = sizeof(*hdr);
10799 + memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname));
10800 +#define LWNG_SETVAL(f,i,s,l,d) \
10801 +hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
10802 +hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
10803 + LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
10804 + LWNG_SETVAL(mactime, 2, 0, 4, ((u32)rx_stats->mac_time));
10805 + LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
10806 + LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
10807 + LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
10808 + LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
10809 + LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
10810 + LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
10811 + LWNG_SETVAL(istx, 9, 0, 4, 0);
10812 + LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
10813 +#undef LWNG_SETVAL
10814 + }
10815
10816 skb->dev = ieee->dev;
10817 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
10818 skb->mac.raw = skb->data;
10819 - skb_pull(skb, ieee80211_get_hdrlen(fc));
10820 +#else
10821 + skb_reset_mac_header(skb);
10822 +#endif
10823 + skb_pull(skb, hdrlen);
10824 + if (prism_header)
10825 + skb_pull(skb, phdrlen);
10826 skb->pkt_type = PACKET_OTHERHOST;
10827 skb->protocol = __constant_htons(ETH_P_80211_RAW);
10828 memset(skb->cb, 0, sizeof(skb->cb));
10829 @@ -64,7 +134,7 @@
10830
10831 /* Called only as a tasklet (software IRQ) */
10832 static struct ieee80211_frag_entry *
10833 -ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq,
10834 +ieee80211_frag_cache_find_rtl7(struct ieee80211_device *ieee, unsigned int seq,
10835 unsigned int frag, u8 *src, u8 *dst)
10836 {
10837 struct ieee80211_frag_entry *entry;
10838 @@ -94,7 +164,7 @@
10839
10840 /* Called only as a tasklet (software IRQ) */
10841 static struct sk_buff *
10842 -ieee80211_frag_cache_get(struct ieee80211_device *ieee,
10843 +ieee80211_frag_cache_get_rtl7(struct ieee80211_device *ieee,
10844 struct ieee80211_hdr *hdr)
10845 {
10846 struct sk_buff *skb = NULL;
10847 @@ -133,7 +203,7 @@
10848 } else {
10849 /* received a fragment of a frame for which the head fragment
10850 * should have already been received */
10851 - entry = ieee80211_frag_cache_find(ieee, seq, frag, hdr->addr2,
10852 + entry = ieee80211_frag_cache_find_rtl7(ieee, seq, frag, hdr->addr2,
10853 hdr->addr1);
10854 if (entry != NULL) {
10855 entry->last_frag = frag;
10856 @@ -146,7 +216,7 @@
10857
10858
10859 /* Called only as a tasklet (software IRQ) */
10860 -static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee,
10861 +static int ieee80211_frag_cache_invalidate_rtl7(struct ieee80211_device *ieee,
10862 struct ieee80211_hdr *hdr)
10863 {
10864 u16 sc;
10865 @@ -156,7 +226,7 @@
10866 sc = le16_to_cpu(hdr->seq_ctl);
10867 seq = WLAN_GET_SEQ_SEQ(sc);
10868
10869 - entry = ieee80211_frag_cache_find(ieee, seq, -1, hdr->addr2,
10870 + entry = ieee80211_frag_cache_find_rtl7(ieee, seq, -1, hdr->addr2,
10871 hdr->addr1);
10872
10873 if (entry == NULL) {
10874 @@ -178,7 +248,7 @@
10875 *
10876 * Called by ieee80211_rx */
10877 static inline int
10878 -ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
10879 +ieee80211_rx_frame_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
10880 struct ieee80211_rx_stats *rx_stats, u16 type,
10881 u16 stype)
10882 {
10883 @@ -187,13 +257,13 @@
10884 * response parser uses it
10885 */
10886 rx_stats->len = skb->len;
10887 - ieee80211_rx_mgt(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
10888 - ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype);
10889 + ieee80211_rx_mgt_rtl7(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
10890 + ieee80211_rx_frame_softmac_rtl7(ieee, skb, rx_stats, type, stype);
10891
10892 dev_kfree_skb_any(skb);
10893 -
10894 +
10895 return 0;
10896 -
10897 +
10898 #ifdef NOT_YET
10899 if (ieee->iw_mode == IW_MODE_MASTER) {
10900 printk(KERN_DEBUG "%s: Master mode not yet suppported.\n",
10901 @@ -253,7 +323,7 @@
10902 /* No encapsulation header if EtherType < 0x600 (=length) */
10903
10904 /* Called by ieee80211_rx_frame_decrypt */
10905 -static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee,
10906 +static int ieee80211_is_eapol_frame_rtl7(struct ieee80211_device *ieee,
10907 struct sk_buff *skb)
10908 {
10909 struct net_device *dev = ieee->dev;
10910 @@ -294,7 +364,7 @@
10911
10912 /* Called only as a tasklet (software IRQ), by ieee80211_rx */
10913 static inline int
10914 -ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb,
10915 +ieee80211_rx_frame_decrypt_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
10916 struct ieee80211_crypt_data *crypt)
10917 {
10918 struct ieee80211_hdr *hdr;
10919 @@ -304,7 +374,7 @@
10920 return 0;
10921
10922 hdr = (struct ieee80211_hdr *) skb->data;
10923 - hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
10924 + hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
10925
10926 #ifdef CONFIG_IEEE80211_CRYPT_TKIP
10927 if (ieee->tkip_countermeasures &&
10928 @@ -339,7 +409,7 @@
10929
10930 /* Called only as a tasklet (software IRQ), by ieee80211_rx */
10931 static inline int
10932 -ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb,
10933 +ieee80211_rx_frame_decrypt_msdu_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
10934 int keyidx, struct ieee80211_crypt_data *crypt)
10935 {
10936 struct ieee80211_hdr *hdr;
10937 @@ -349,7 +419,7 @@
10938 return 0;
10939
10940 hdr = (struct ieee80211_hdr *) skb->data;
10941 - hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
10942 + hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
10943
10944 atomic_inc(&crypt->refcnt);
10945 res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
10946 @@ -367,7 +437,7 @@
10947
10948 /* this function is stolen from ipw2200 driver*/
10949 #define IEEE_PACKET_RETRY_TIME (5*HZ)
10950 -static int is_duplicate_packet(struct ieee80211_device *ieee,
10951 +static int is_duplicate_packet_rtl7(struct ieee80211_device *ieee,
10952 struct ieee80211_hdr *header)
10953 {
10954 // u16 fc = le16_to_cpu(header->frame_ctl);
10955 @@ -413,7 +483,7 @@
10956 last_seq = &ieee->last_seq_num;
10957 last_frag = &ieee->last_frag_num;
10958 last_time = &ieee->last_packet_time;
10959 -
10960 +
10961 break;
10962 default:
10963 return 0;
10964 @@ -436,7 +506,7 @@
10965 drop:
10966 // BUG_ON(!(fc & IEEE80211_FCTL_RETRY));
10967 // printk("DUP\n");
10968 -
10969 +
10970 return 1;
10971 }
10972
10973 @@ -444,7 +514,7 @@
10974 /* All received frames are sent to this function. @skb contains the frame in
10975 * IEEE 802.11 format, i.e., in the format it was sent over air.
10976 * This function is called only as a tasklet (software IRQ). */
10977 -int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
10978 +int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
10979 struct ieee80211_rx_stats *rx_stats)
10980 {
10981 struct net_device *dev = ieee->dev;
10982 @@ -481,9 +551,9 @@
10983 type = WLAN_FC_GET_TYPE(fc);
10984 stype = WLAN_FC_GET_STYPE(fc);
10985 sc = le16_to_cpu(hdr->seq_ctl);
10986 -
10987 +
10988 frag = WLAN_GET_SEQ_FRAG(sc);
10989 - hdrlen = ieee80211_get_hdrlen(fc);
10990 + hdrlen = ieee80211_get_hdrlen_rtl7(fc);
10991
10992 #ifdef NOT_YET
10993 #if WIRELESS_EXT > 15
10994 @@ -501,12 +571,12 @@
10995 }
10996 #endif /* IW_WIRELESS_SPY */
10997 #endif /* WIRELESS_EXT > 15 */
10998 - hostap_update_rx_stats(local->ap, hdr, rx_stats);
10999 + hostap_update_rx_stats_rtl7(local->ap, hdr, rx_stats);
11000 #endif
11001
11002 #if WIRELESS_EXT > 15
11003 if (ieee->iw_mode == IW_MODE_MONITOR) {
11004 - ieee80211_monitor_rx(ieee, skb, rx_stats);
11005 + ieee80211_monitor_rx_rtl7(ieee, skb, rx_stats);
11006 stats->rx_packets++;
11007 stats->rx_bytes += skb->len;
11008 return 1;
11009 @@ -529,7 +599,7 @@
11010 * stations that do not support WEP key mapping). */
11011
11012 if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key)
11013 - (void) hostap_handle_sta_crypto(local, hdr, &crypt,
11014 + (void) hostap_handle_sta_crypto_rtl7(local, hdr, &crypt,
11015 &sta);
11016 #endif
11017
11018 @@ -555,7 +625,7 @@
11019 if (skb->len < IEEE80211_DATA_HDR3_LEN)
11020 goto rx_dropped;
11021
11022 - if (is_duplicate_packet(ieee, hdr))
11023 + if (is_duplicate_packet_rtl7(ieee, hdr))
11024 goto rx_dropped;
11025
11026
11027 @@ -573,9 +643,9 @@
11028 goto rx_dropped;
11029 }
11030 #endif
11031 -
11032 -
11033 - if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype))
11034 +
11035 +
11036 + if (ieee80211_rx_frame_mgmt_rtl7(ieee, skb, rx_stats, type, stype))
11037 goto rx_dropped;
11038 else
11039 goto rx_exit;
11040 @@ -583,7 +653,7 @@
11041
11042
11043 /* Data frame - extract src/dst addresses */
11044 -
11045 +
11046 switch (fc & (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) {
11047 case IEEE80211_FCTL_FROMDS:
11048 memcpy(dst, hdr->addr1, ETH_ALEN);
11049 @@ -606,7 +676,7 @@
11050 }
11051
11052 #ifdef NOT_YET
11053 - if (hostap_rx_frame_wds(ieee, hdr, fc, &wds))
11054 + if (hostap_rx_frame_wds_rtl7(ieee, hdr, fc, &wds))
11055 goto rx_dropped;
11056 if (wds) {
11057 skb->dev = dev = wds;
11058 @@ -619,7 +689,7 @@
11059 memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) {
11060 /* Frame from BSSID of the AP for which we are a client */
11061 skb->dev = dev = ieee->stadev;
11062 - stats = hostap_get_stats(dev);
11063 + stats = hostap_get_stats_rtl7(dev);
11064 from_assoc_ap = 1;
11065 }
11066 #endif
11067 @@ -630,7 +700,7 @@
11068 if ((ieee->iw_mode == IW_MODE_MASTER ||
11069 ieee->iw_mode == IW_MODE_REPEAT) &&
11070 !from_assoc_ap) {
11071 - switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats,
11072 + switch (hostap_handle_sta_rx_rtl7(ieee, dev, skb, rx_stats,
11073 wds != NULL)) {
11074 case AP_RX_CONTINUE_NOT_AUTHORIZED:
11075 frame_authorized = 0;
11076 @@ -664,7 +734,7 @@
11077 /* skb: hdr + (possibly fragmented, possibly encrypted) payload */
11078
11079 if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
11080 - (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0)
11081 + (keyidx = ieee80211_rx_frame_decrypt_rtl7(ieee, skb, crypt)) < 0)
11082 goto rx_dropped;
11083
11084 hdr = (struct ieee80211_hdr *) skb->data;
11085 @@ -674,7 +744,7 @@
11086 // ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
11087 if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) {
11088 int flen;
11089 - struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr);
11090 + struct sk_buff *frag_skb = ieee80211_frag_cache_get_rtl7(ieee, hdr);
11091 IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag);
11092
11093 if (!frag_skb) {
11094 @@ -694,7 +764,7 @@
11095 printk(KERN_WARNING "%s: host decrypted and "
11096 "reassembled frame did not fit skb\n",
11097 dev->name);
11098 - ieee80211_frag_cache_invalidate(ieee, hdr);
11099 + ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
11100 goto rx_dropped;
11101 }
11102
11103 @@ -722,19 +792,19 @@
11104 * delivered, so remove skb from fragment cache */
11105 skb = frag_skb;
11106 hdr = (struct ieee80211_hdr *) skb->data;
11107 - ieee80211_frag_cache_invalidate(ieee, hdr);
11108 + ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
11109 }
11110
11111 /* skb: hdr + (possible reassembled) full MSDU payload; possibly still
11112 * encrypted/authenticated */
11113 if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
11114 - ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt))
11115 + ieee80211_rx_frame_decrypt_msdu_rtl7(ieee, skb, keyidx, crypt))
11116 goto rx_dropped;
11117
11118 hdr = (struct ieee80211_hdr *) skb->data;
11119 if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) {
11120 if (/*ieee->ieee802_1x &&*/
11121 - ieee80211_is_eapol_frame(ieee, skb)) {
11122 + ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
11123 #ifdef CONFIG_IEEE80211_DEBUG
11124 /* pass unencrypted EAPOL frames even if encryption is
11125 * configured */
11126 @@ -763,7 +833,7 @@
11127 #endif
11128
11129 if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep &&
11130 - !ieee80211_is_eapol_frame(ieee, skb)) {
11131 + !ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
11132 IEEE80211_DEBUG_DROP(
11133 "dropped unencrypted RX data "
11134 "frame from " MAC_FMT
11135 @@ -861,7 +931,12 @@
11136 if (skb2 != NULL) {
11137 /* send to wireless media */
11138 skb2->protocol = __constant_htons(ETH_P_802_3);
11139 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
11140 skb2->mac.raw = skb2->nh.raw = skb2->data;
11141 +#else
11142 + skb_reset_mac_header(skb2);
11143 + skb_reset_network_header(skb2);
11144 +#endif
11145 /* skb2->nh.raw = skb2->data + ETH_HLEN; */
11146 skb2->dev = dev;
11147 dev_queue_xmit(skb2);
11148 @@ -896,7 +971,7 @@
11149
11150 #define MGMT_FRAME_FIXED_PART_LENGTH 0x24
11151
11152 -static inline int ieee80211_is_ofdm_rate(u8 rate)
11153 +static inline int ieee80211_is_ofdm_rate_rtl7(u8 rate)
11154 {
11155 switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
11156 case IEEE80211_OFDM_RATE_6MB:
11157 @@ -913,7 +988,7 @@
11158 }
11159
11160
11161 -static inline int ieee80211_network_init(
11162 +static inline int ieee80211_network_init_rtl7(
11163 struct ieee80211_device *ieee,
11164 struct ieee80211_probe_response *beacon,
11165 struct ieee80211_network *network,
11166 @@ -964,7 +1039,7 @@
11167
11168 switch (info_element->id) {
11169 case MFIE_TYPE_SSID:
11170 - if (ieee80211_is_empty_essid(info_element->data,
11171 + if (ieee80211_is_empty_essid_rtl7(info_element->data,
11172 info_element->len)) {
11173 network->flags |= NETWORK_EMPTY_ESSID;
11174 break;
11175 @@ -991,7 +1066,7 @@
11176 #ifdef CONFIG_IEEE80211_DEBUG
11177 p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
11178 #endif
11179 - if (ieee80211_is_ofdm_rate(info_element->data[i])) {
11180 + if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
11181 network->flags |= NETWORK_HAS_OFDM;
11182 if (info_element->data[i] &
11183 IEEE80211_BASIC_RATE_MASK)
11184 @@ -1014,7 +1089,7 @@
11185 #ifdef CONFIG_IEEE80211_DEBUG
11186 p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
11187 #endif
11188 - if (ieee80211_is_ofdm_rate(info_element->data[i])) {
11189 + if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
11190 network->flags |= NETWORK_HAS_OFDM;
11191 if (info_element->data[i] &
11192 IEEE80211_BASIC_RATE_MASK)
11193 @@ -1043,47 +1118,47 @@
11194 break;
11195
11196 case MFIE_TYPE_TIM:
11197 -
11198 - if(info_element->len < 4)
11199 +
11200 + if(info_element->len < 4)
11201 break;
11202 -
11203 +
11204 network->dtim_period = info_element->data[1];
11205 -
11206 +
11207 if(ieee->state != IEEE80211_LINKED)
11208 break;
11209 -
11210 - network->last_dtim_sta_time[0] = stats->mac_time[0];
11211 +
11212 + network->last_dtim_sta_time[0] = stats->mac_time[0];
11213 network->last_dtim_sta_time[1] = stats->mac_time[1];
11214 -
11215 +
11216 network->dtim_data = IEEE80211_DTIM_VALID;
11217 -
11218 - if(info_element->data[0] != 0)
11219 +
11220 + if(info_element->data[0] != 0)
11221 break;
11222 -
11223 +
11224 if(info_element->data[2] & 1)
11225 network->dtim_data |= IEEE80211_DTIM_MBCAST;
11226 -
11227 +
11228 offset = (info_element->data[2] >> 1)*2;
11229 -
11230 - //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id);
11231 -
11232 - if(ieee->assoc_id < offset ||
11233 +
11234 + //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id);
11235 +
11236 + if(ieee->assoc_id < offset ||
11237 ieee->assoc_id > 8*(offset + info_element->len -3))
11238 -
11239 +
11240 break;
11241 -
11242 -
11243 +
11244 +
11245 offset = offset + ieee->assoc_id / 8;// + ((aid % 8)? 0 : 1) ;
11246 -
11247 - // printk("offset:%x data:%x, ucast:%d\n", offset,
11248 +
11249 + // printk("offset:%x data:%x, ucast:%d\n", offset,
11250 // info_element->data[3+offset] ,
11251 // info_element->data[3+offset] & (1<<(ieee->assoc_id%8)));
11252 -
11253 +
11254 if(info_element->data[3+offset] & (1<<(ieee->assoc_id%8)))
11255 network->dtim_data |= IEEE80211_DTIM_UCAST;
11256 -
11257 +
11258 break;
11259 -
11260 +
11261 case MFIE_TYPE_IBSS_SET:
11262 IEEE80211_DEBUG_SCAN("MFIE_TYPE_IBSS_SET: ignored\n");
11263 break;
11264 @@ -1115,7 +1190,7 @@
11265 memcpy(network->rsn_ie, info_element,
11266 network->rsn_ie_len);
11267 break;
11268 -
11269 +
11270 default:
11271 IEEE80211_DEBUG_SCAN("unsupported IE %d\n",
11272 info_element->id);
11273 @@ -1147,7 +1222,7 @@
11274 return 1;
11275 }
11276
11277 - if (ieee80211_is_empty_essid(network->ssid, network->ssid_len))
11278 + if (ieee80211_is_empty_essid_rtl7(network->ssid, network->ssid_len))
11279 network->flags |= NETWORK_EMPTY_ESSID;
11280
11281 memcpy(&network->stats, stats, sizeof(network->stats));
11282 @@ -1155,24 +1230,24 @@
11283 return 0;
11284 }
11285
11286 -static inline int is_same_network(struct ieee80211_network *src,
11287 +static inline int is_same_network_rtl7(struct ieee80211_network *src,
11288 struct ieee80211_network *dst)
11289 {
11290 /* A network is only a duplicate if the channel, BSSID, ESSID
11291 - * and the capability field (in particular IBSS and BSS) all match.
11292 + * and the capability field (in particular IBSS and BSS) all match.
11293 * We treat all <hidden> with the same BSSID and channel
11294 * as one network */
11295 return ((src->ssid_len == dst->ssid_len) &&
11296 (src->channel == dst->channel) &&
11297 !memcmp(src->bssid, dst->bssid, ETH_ALEN) &&
11298 !memcmp(src->ssid, dst->ssid, src->ssid_len) &&
11299 - ((src->capability & WLAN_CAPABILITY_IBSS) ==
11300 + ((src->capability & WLAN_CAPABILITY_IBSS) ==
11301 (dst->capability & WLAN_CAPABILITY_IBSS)) &&
11302 - ((src->capability & WLAN_CAPABILITY_BSS) ==
11303 + ((src->capability & WLAN_CAPABILITY_BSS) ==
11304 (dst->capability & WLAN_CAPABILITY_BSS)));
11305 }
11306
11307 -static inline void update_network(struct ieee80211_network *dst,
11308 +static inline void update_network_rtl7(struct ieee80211_network *dst,
11309 struct ieee80211_network *src)
11310 {
11311 memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats));
11312 @@ -1194,7 +1269,7 @@
11313 dst->dtim_data = src->dtim_data;
11314 dst->last_dtim_sta_time[0] = src->last_dtim_sta_time[0];
11315 dst->last_dtim_sta_time[1] = src->last_dtim_sta_time[1];
11316 -
11317 +
11318 memcpy(dst->wpa_ie, src->wpa_ie, src->wpa_ie_len);
11319 dst->wpa_ie_len = src->wpa_ie_len;
11320 memcpy(dst->rsn_ie, src->rsn_ie, src->rsn_ie_len);
11321 @@ -1204,7 +1279,7 @@
11322 /* dst->last_associate is not overwritten */
11323 }
11324
11325 -static inline void ieee80211_process_probe_response(
11326 +static inline void ieee80211_process_probe_response_rtl7(
11327 struct ieee80211_device *ieee,
11328 struct ieee80211_probe_response *beacon,
11329 struct ieee80211_rx_stats *stats)
11330 @@ -1239,7 +1314,7 @@
11331 (beacon->capability & (1<<0x1)) ? '1' : '0',
11332 (beacon->capability & (1<<0x0)) ? '1' : '0');
11333
11334 - if (ieee80211_network_init(ieee, beacon, &network, stats)) {
11335 + if (ieee80211_network_init_rtl7(ieee, beacon, &network, stats)) {
11336 IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n",
11337 escape_essid(info_element->data,
11338 info_element->len),
11339 @@ -1261,12 +1336,12 @@
11340 * already there. */
11341
11342 spin_lock_irqsave(&ieee->lock, flags);
11343 -
11344 - if(is_same_network(&ieee->current_network, &network))
11345 - update_network(&ieee->current_network, &network);
11346 -
11347 +
11348 + if(is_same_network_rtl7(&ieee->current_network, &network))
11349 + update_network_rtl7(&ieee->current_network, &network);
11350 +
11351 list_for_each_entry(target, &ieee->network_list, list) {
11352 - if (is_same_network(target, &network))
11353 + if (is_same_network_rtl7(target, &network))
11354 break;
11355
11356 if ((oldest == NULL) ||
11357 @@ -1306,7 +1381,7 @@
11358 memcpy(target, &network, sizeof(*target));
11359 list_add_tail(&target->list, &ieee->network_list);
11360 if(ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)
11361 - ieee80211_softmac_new_net(ieee,&network);
11362 + ieee80211_softmac_new_net_rtl7(ieee,&network);
11363 } else {
11364 IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n",
11365 escape_essid(target->ssid,
11366 @@ -1315,39 +1390,39 @@
11367 WLAN_FC_GET_STYPE(beacon->header.frame_ctl) ==
11368 IEEE80211_STYPE_PROBE_RESP ?
11369 "PROBE RESPONSE" : "BEACON");
11370 -
11371 +
11372 /* we have an entry and we are going to update it. But this entry may
11373 - * be already expired. In this case we do the same as we found a new
11374 + * be already expired. In this case we do the same as we found a new
11375 * net and call the new_net handler
11376 */
11377 renew = !time_after(target->last_scanned + ieee->scan_age, jiffies);
11378 - update_network(target, &network);
11379 + update_network_rtl7(target, &network);
11380 if(renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE))
11381 - ieee80211_softmac_new_net(ieee,&network);
11382 + ieee80211_softmac_new_net_rtl7(ieee,&network);
11383 }
11384
11385 spin_unlock_irqrestore(&ieee->lock, flags);
11386 }
11387
11388 -void ieee80211_rx_mgt(struct ieee80211_device *ieee,
11389 +void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
11390 struct ieee80211_hdr *header,
11391 struct ieee80211_rx_stats *stats)
11392 {
11393 switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
11394 -
11395 +
11396 case IEEE80211_STYPE_BEACON:
11397 IEEE80211_DEBUG_MGMT("received BEACON (%d)\n",
11398 WLAN_FC_GET_STYPE(header->frame_ctl));
11399 IEEE80211_DEBUG_SCAN("Beacon\n");
11400 - ieee80211_process_probe_response(
11401 + ieee80211_process_probe_response_rtl7(
11402 ieee, (struct ieee80211_probe_response *)header, stats);
11403 break;
11404 -
11405 +
11406 case IEEE80211_STYPE_PROBE_RESP:
11407 IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n",
11408 WLAN_FC_GET_STYPE(header->frame_ctl));
11409 IEEE80211_DEBUG_SCAN("Probe response\n");
11410 - ieee80211_process_probe_response(
11411 + ieee80211_process_probe_response_rtl7(
11412 ieee, (struct ieee80211_probe_response *)header, stats);
11413 break;
11414
11415 @@ -1355,5 +1430,5 @@
11416 }
11417
11418
11419 -EXPORT_SYMBOL(ieee80211_rx_mgt);
11420 -EXPORT_SYMBOL(ieee80211_rx);
11421 +EXPORT_SYMBOL(ieee80211_rx_mgt_rtl7);
11422 +EXPORT_SYMBOL(ieee80211_rx_rtl7);
11423 diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac.c
11424 --- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac.c 2006-06-19 03:27:33.000000000 +0200
11425 +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac.c 2008-01-30 17:38:11.000000000 +0100
11426 @@ -1,14 +1,14 @@
11427 /* IEEE 802.11 SoftMAC layer
11428 * Copyright (c) 2005 Andrea Merello <[email protected]>
11429 *
11430 - * Mostly extracted from the rtl8180-sa2400 driver for the
11431 + * Mostly extracted from the rtl8180-sa2400 driver for the
11432 * in-kernel generic ieee802.11 stack.
11433 *
11434 * Few lines might be stolen from other part of the ieee80211
11435 * stack. Copyright who own it's copyright
11436 *
11437 * WPA code stolen from the ipw2200 driver.
11438 - * Copyright who own it's copyright.
11439 + * Copyright who own it's copyright.
11440 *
11441 * released under the GPL
11442 */
11443 @@ -20,12 +20,12 @@
11444 #include <linux/delay.h>
11445 #include <linux/version.h>
11446
11447 -short ieee80211_is_54g(struct ieee80211_network net)
11448 +short ieee80211_is_54g_rtl7(struct ieee80211_network net)
11449 {
11450 return ((net.rates_ex_len > 0) || (net.rates_len > 4));
11451 }
11452
11453 -short ieee80211_is_shortslot(struct ieee80211_network net)
11454 +short ieee80211_is_shortslot_rtl7(struct ieee80211_network net)
11455 {
11456 return (net.capability & WLAN_CAPABILITY_SHORT_SLOT);
11457 }
11458 @@ -34,28 +34,28 @@
11459 * tag and the EXTENDED RATE MFIE tag if needed.
11460 * It encludes two bytes per tag for the tag itself and its len
11461 */
11462 -unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee)
11463 +unsigned int ieee80211_MFIE_rate_len_rtl7(struct ieee80211_device *ieee)
11464 {
11465 unsigned int rate_len = 0;
11466 -
11467 +
11468 if (ieee->modulation & IEEE80211_CCK_MODULATION)
11469 rate_len = IEEE80211_CCK_RATE_LEN + 2;
11470 -
11471 +
11472 if (ieee->modulation & IEEE80211_OFDM_MODULATION)
11473 -
11474 +
11475 rate_len += IEEE80211_OFDM_RATE_LEN + 2;
11476 -
11477 +
11478 return rate_len;
11479 }
11480
11481 -/* pleace the MFIE rate, tag to the memory (double) poined.
11482 +/* pleace the MFIE rate, tag to the memory (double) poined.
11483 * Then it updates the pointer so that
11484 * it points after the new MFIE tag added.
11485 - */
11486 -void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p)
11487 + */
11488 +void ieee80211_MFIE_Brate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
11489 {
11490 - u8 *tag = *tag_p;
11491 -
11492 + u8 *tag = *tag_p;
11493 +
11494 if (ieee->modulation & IEEE80211_CCK_MODULATION){
11495 *tag++ = MFIE_TYPE_RATES;
11496 *tag++ = 4;
11497 @@ -64,17 +64,17 @@
11498 *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
11499 *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
11500 }
11501 -
11502 +
11503 /* We may add an option for custom rates that specific HW might support */
11504 *tag_p = tag;
11505 }
11506
11507 -void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
11508 -{
11509 - u8 *tag = *tag_p;
11510 -
11511 +void ieee80211_MFIE_Grate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
11512 +{
11513 + u8 *tag = *tag_p;
11514 +
11515 if (ieee->modulation & IEEE80211_OFDM_MODULATION){
11516 -
11517 +
11518 *tag++ = MFIE_TYPE_RATES_EX;
11519 *tag++ = 8;
11520 *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
11521 @@ -85,73 +85,73 @@
11522 *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
11523 *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
11524 *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
11525 -
11526 +
11527 }
11528 -
11529 +
11530 /* We may add an option for custom rates that specific HW might support */
11531 *tag_p = tag;
11532 }
11533
11534 -void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb)
11535 +void enqueue_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
11536 {
11537 int nh;
11538 nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM;
11539 -
11540 +
11541 /*
11542 * if the queue is full but we have newer frames then
11543 * just overwrites the oldest.
11544 - *
11545 + *
11546 * if (nh == ieee->mgmt_queue_tail)
11547 * return -1;
11548 - */
11549 + */
11550 ieee->mgmt_queue_head = nh;
11551 ieee->mgmt_queue_ring[nh] = skb;
11552 -
11553 +
11554 //return 0;
11555 }
11556
11557 -struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee)
11558 +struct sk_buff *dequeue_mgmt_rtl7(struct ieee80211_device *ieee)
11559 {
11560 struct sk_buff *ret;
11561 -
11562 +
11563 if(ieee->mgmt_queue_tail == ieee->mgmt_queue_head)
11564 return NULL;
11565 -
11566 +
11567 ret = ieee->mgmt_queue_ring[ieee->mgmt_queue_tail];
11568 -
11569 - ieee->mgmt_queue_tail =
11570 +
11571 + ieee->mgmt_queue_tail =
11572 (ieee->mgmt_queue_tail+1) % MGMT_QUEUE_NUM;
11573 -
11574 +
11575 return ret;
11576 }
11577
11578 -void init_mgmt_queue(struct ieee80211_device *ieee)
11579 +void init_mgmt_queue_rtl7(struct ieee80211_device *ieee)
11580 {
11581 ieee->mgmt_queue_tail = ieee->mgmt_queue_head = 0;
11582 }
11583
11584
11585 -void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl);
11586 +void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl);
11587
11588 -inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
11589 +inline void softmac_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
11590 {
11591 unsigned long flags;
11592 short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
11593 struct ieee80211_hdr_3addr *header=
11594 (struct ieee80211_hdr_3addr *) skb->data;
11595 -
11596 -
11597 +
11598 +
11599 spin_lock_irqsave(&ieee->lock, flags);
11600 -
11601 +
11602 /* called with 2nd param 0, no mgmt lock required */
11603 - ieee80211_sta_wakeup(ieee,0);
11604 -
11605 + ieee80211_sta_wakeup_rtl7(ieee,0);
11606 +
11607 if(single){
11608 -
11609 +
11610 if(ieee->queue_stop){
11611 -
11612 - enqueue_mgmt(ieee,skb);
11613 -
11614 +
11615 + enqueue_mgmt_rtl7(ieee,skb);
11616 +
11617 }else{
11618 header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
11619
11620 @@ -159,119 +159,119 @@
11621 ieee->seq_ctrl = 0;
11622 else
11623 ieee->seq_ctrl++;
11624 -
11625 +
11626 /* avoid watchdog triggers */
11627 ieee->dev->trans_start = jiffies;
11628 ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
11629 }
11630 -
11631 +
11632 spin_unlock_irqrestore(&ieee->lock, flags);
11633 }else{
11634 spin_unlock_irqrestore(&ieee->lock, flags);
11635 spin_lock_irqsave(&ieee->mgmt_tx_lock, flags);
11636 -
11637 +
11638 header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
11639 -
11640 +
11641 if (ieee->seq_ctrl == 0xFFF)
11642 ieee->seq_ctrl = 0;
11643 else
11644 ieee->seq_ctrl++;
11645 -
11646 +
11647 ieee->softmac_hard_start_xmit(skb,ieee->dev);
11648 -
11649 +
11650 spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags);
11651 }
11652 }
11653
11654
11655 -inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
11656 +inline void softmac_ps_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
11657 {
11658 -
11659 +
11660 short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
11661 struct ieee80211_hdr_3addr *header =
11662 (struct ieee80211_hdr_3addr *) skb->data;
11663 -
11664 -
11665 +
11666 +
11667 if(single){
11668 -
11669 +
11670 header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
11671
11672 if (ieee->seq_ctrl == 0xFFF)
11673 ieee->seq_ctrl = 0;
11674 else
11675 ieee->seq_ctrl++;
11676 -
11677 +
11678 /* avoid watchdog triggers */
11679 ieee->dev->trans_start = jiffies;
11680 ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
11681 -
11682 +
11683 }else{
11684 -
11685 +
11686 header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
11687 -
11688 +
11689 if (ieee->seq_ctrl == 0xFFF)
11690 ieee->seq_ctrl = 0;
11691 else
11692 ieee->seq_ctrl++;
11693
11694 ieee->softmac_hard_start_xmit(skb,ieee->dev);
11695 -
11696 +
11697 }
11698 }
11699
11700 -inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee)
11701 +inline struct sk_buff *ieee80211_probe_req_rtl7(struct ieee80211_device *ieee)
11702 {
11703 unsigned int len,rate_len;
11704 u8 *tag;
11705 struct sk_buff *skb;
11706 struct ieee80211_probe_request *req;
11707 -
11708 +
11709 len = ieee->current_network.ssid_len;
11710 -
11711 - rate_len = ieee80211_MFIE_rate_len(ieee);
11712 -
11713 +
11714 + rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
11715 +
11716 skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) +
11717 2 + len + rate_len);
11718 -
11719 - if (!skb)
11720 +
11721 + if (!skb)
11722 return NULL;
11723 -
11724 +
11725 req = (struct ieee80211_probe_request *) skb_put(skb,sizeof(struct ieee80211_probe_request));
11726 req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ);
11727 - req->header.duration_id = 0; //FIXME: is this OK ?
11728 -
11729 + req->header.duration_id = 0; //FIXME: is this OK ?
11730 +
11731 memset(req->header.addr1, 0xff, ETH_ALEN);
11732 memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
11733 memset(req->header.addr3, 0xff, ETH_ALEN);
11734 -
11735 +
11736 tag = (u8 *) skb_put(skb,len+2+rate_len);
11737 -
11738 +
11739 *tag++ = MFIE_TYPE_SSID;
11740 *tag++ = len;
11741 memcpy(tag, ieee->current_network.ssid, len);
11742 tag += len;
11743 -
11744 - ieee80211_MFIE_Brate(ieee,&tag);
11745 - ieee80211_MFIE_Grate(ieee,&tag);
11746 +
11747 + ieee80211_MFIE_Brate_rtl7(ieee,&tag);
11748 + ieee80211_MFIE_Grate_rtl7(ieee,&tag);
11749 return skb;
11750 }
11751
11752 -struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee);
11753 -void ieee80211_send_beacon(struct ieee80211_device *ieee)
11754 +struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee);
11755 +void ieee80211_send_beacon_rtl7(struct ieee80211_device *ieee)
11756 {
11757 struct sk_buff *skb;
11758 -
11759 - unsigned long flags;
11760 -
11761 - skb = ieee80211_get_beacon_(ieee);
11762 +
11763 + unsigned long flags;
11764 +
11765 + skb = ieee80211_get_beacon__rtl7(ieee);
11766 if (skb){
11767 - softmac_mgmt_xmit(skb, ieee);
11768 + softmac_mgmt_xmit_rtl7(skb, ieee);
11769 ieee->softmac_stats.tx_beacons++;
11770 }
11771
11772 - ieee->beacon_timer.expires = jiffies +
11773 + ieee->beacon_timer.expires = jiffies +
11774 (MSECS( ieee->current_network.beacon_interval -5));
11775 -
11776 +
11777 spin_lock_irqsave(&ieee->beacon_lock,flags);
11778 if(ieee->beacon_txing)
11779 add_timer(&ieee->beacon_timer);
11780 @@ -279,57 +279,57 @@
11781 }
11782
11783
11784 -void ieee80211_send_beacon_cb(unsigned long _ieee)
11785 +void ieee80211_send_beacon_cb_rtl7(unsigned long _ieee)
11786 {
11787 struct ieee80211_device *ieee =
11788 (struct ieee80211_device *) _ieee;
11789 - ieee80211_send_beacon(ieee);
11790 + ieee80211_send_beacon_rtl7(ieee);
11791 }
11792
11793
11794 -void ieee80211_send_probe(struct ieee80211_device *ieee)
11795 +void ieee80211_send_probe_rtl7(struct ieee80211_device *ieee)
11796 {
11797 struct sk_buff *skb;
11798 -
11799 - skb = ieee80211_probe_req(ieee);
11800 +
11801 + skb = ieee80211_probe_req_rtl7(ieee);
11802 if (skb){
11803 - softmac_mgmt_xmit(skb, ieee);
11804 + softmac_mgmt_xmit_rtl7(skb, ieee);
11805 ieee->softmac_stats.tx_probe_rq++;
11806 }
11807 }
11808
11809 -void ieee80211_send_probe_requests(struct ieee80211_device *ieee)
11810 +void ieee80211_send_probe_requests_rtl7(struct ieee80211_device *ieee)
11811 {
11812 if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)){
11813 - ieee80211_send_probe(ieee);
11814 - ieee80211_send_probe(ieee);
11815 + ieee80211_send_probe_rtl7(ieee);
11816 + ieee80211_send_probe_rtl7(ieee);
11817 }
11818 }
11819
11820 /* this performs syncro scan blocking the caller until all channels
11821 - * in the allowed channel map has been checked.
11822 + * in the allowed channel map has been checked.
11823 */
11824 -void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
11825 +void ieee80211_softmac_scan_syncro_rtl7(struct ieee80211_device *ieee)
11826 {
11827 short ch = 0;
11828 -
11829 +
11830 down(&ieee->scan_sem);
11831 -
11832 +
11833 while(1)
11834 {
11835 -
11836 +
11837 do{
11838 ch++;
11839 - if (ch > MAX_CHANNEL_NUMBER)
11840 + if (ch > MAX_CHANNEL_NUMBER)
11841 goto out; /* scan completed */
11842 -
11843 +
11844 }while(!ieee->channel_map[ch]);
11845 -
11846 +
11847 /* this fuction can be called in two situations
11848 * 1- We have switched to ad-hoc mode and we are
11849 * performing a complete syncro scan before conclude
11850 - * there are no interesting cell and to create a
11851 - * new one. In this case the link state is
11852 + * there are no interesting cell and to create a
11853 + * new one. In this case the link state is
11854 * IEEE80211_NOLINK until we found an interesting cell.
11855 * If so the ieee8021_new_net, called by the RX path
11856 * will set the state to IEEE80211_LINKED, so we stop
11857 @@ -342,24 +342,24 @@
11858 * not filter RX frames and the channel is changing.
11859 * So the only situation in witch are interested is to check
11860 * if the state become LINKED because of the #1 situation
11861 - */
11862 -
11863 + */
11864 +
11865 if (ieee->state == IEEE80211_LINKED)
11866 goto out;
11867 -
11868 +
11869 ieee->set_chan(ieee->dev, ch);
11870 -
11871 - ieee80211_send_probe_requests(ieee);
11872 -
11873 +
11874 + ieee80211_send_probe_requests_rtl7(ieee);
11875 +
11876 /* this prevent excessive time wait when we
11877 * need to wait for a syncro scan to end..
11878 - */
11879 + */
11880 if (ieee->sync_scan_hurryup)
11881 goto out;
11882
11883
11884 msleep_interruptible_rtl(IEEE80211_SOFTMAC_SCAN_TIME);
11885 -
11886 +
11887 }
11888 out:
11889 ieee->sync_scan_hurryup = 0;
11890 @@ -370,43 +370,49 @@
11891 void ieee80211_softmac_scan(struct ieee80211_device *ieee)
11892 {
11893 short watchdog = 0;
11894 -
11895 +
11896 do{
11897 - ieee->current_network.channel =
11898 + ieee->current_network.channel =
11899 (ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
11900 - if (watchdog++ > MAX_CHANNEL_NUMBER)
11901 + if (watchdog++ > MAX_CHANNEL_NUMBER)
11902 return; /* no good chans */
11903 -
11904 +
11905 }while(!ieee->channel_map[ieee->current_network.channel]);
11906 -
11907 +
11908
11909 schedule_work(&ieee->softmac_scan_wq);
11910 }
11911 #endif
11912
11913 -void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
11914 -{
11915 - down(&ieee->scan_sem);
11916 -
11917 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
11918 +void ieee80211_softmac_scan_wq_rtl7(struct work_struct *work)
11919 +{
11920 + struct delayed_work *dwork = container_of(work, struct delayed_work, work);
11921 + struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
11922 +#else
11923 +void ieee80211_softmac_scan_wq_rtl7(struct ieee80211_device *ieee)
11924 +{
11925 +#endif
11926 short watchdog = 0;
11927 -
11928 + down(&ieee->scan_sem);
11929 +
11930 do{
11931 - ieee->current_network.channel =
11932 + ieee->current_network.channel =
11933 (ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
11934 - if (watchdog++ > MAX_CHANNEL_NUMBER)
11935 + if (watchdog++ > MAX_CHANNEL_NUMBER)
11936 goto out; /* no good chans */
11937 -
11938 +
11939 }while(!ieee->channel_map[ieee->current_network.channel]);
11940 -
11941 +
11942 if (ieee->scanning == 0 )
11943 goto out;
11944 -
11945 +
11946 ieee->set_chan(ieee->dev, ieee->current_network.channel);
11947 - ieee80211_send_probe_requests(ieee);
11948 + ieee80211_send_probe_requests_rtl7(ieee);
11949
11950 -#if 0
11951 +#if 0
11952 ieee->.expires = jiffies + (IEEE80211_SOFTMAC_SCAN_TIME);
11953 - if (ieee->scanning == 1)
11954 + if (ieee->scanning == 1)
11955 add_timer(&ieee->scan_timer);
11956 #endif
11957 queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME);
11958 @@ -419,7 +425,7 @@
11959 {
11960 unsigned long flags;
11961 struct ieee80211_device *ieee = (struct ieee80211_device *)_dev;
11962 -
11963 +
11964 spin_lock_irqsave(&ieee->lock, flags);
11965 ieee80211_softmac_scan(ieee);
11966 spin_unlock_irqrestore(&ieee->lock, flags);
11967 @@ -427,19 +433,19 @@
11968 #endif
11969
11970
11971 -void ieee80211_beacons_start(struct ieee80211_device *ieee)
11972 +void ieee80211_beacons_start_rtl7(struct ieee80211_device *ieee)
11973 {
11974 - unsigned long flags;
11975 + unsigned long flags;
11976
11977 spin_lock_irqsave(&ieee->beacon_lock,flags);
11978
11979 ieee->beacon_txing = 1;
11980 - ieee80211_send_beacon(ieee);
11981 -
11982 + ieee80211_send_beacon_rtl7(ieee);
11983 +
11984 spin_unlock_irqrestore(&ieee->beacon_lock,flags);
11985 }
11986
11987 -void ieee80211_beacons_stop(struct ieee80211_device *ieee)
11988 +void ieee80211_beacons_stop_rtl7(struct ieee80211_device *ieee)
11989 {
11990 unsigned long flags;
11991
11992 @@ -453,111 +459,111 @@
11993 }
11994
11995
11996 -void ieee80211_stop_send_beacons(struct ieee80211_device *ieee)
11997 +void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee)
11998 {
11999 if(ieee->stop_send_beacons)
12000 ieee->stop_send_beacons(ieee->dev);
12001 if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
12002 - ieee80211_beacons_stop(ieee);
12003 + ieee80211_beacons_stop_rtl7(ieee);
12004 }
12005
12006
12007 -void ieee80211_start_send_beacons(struct ieee80211_device *ieee)
12008 +void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee)
12009 {
12010 if(ieee->start_send_beacons)
12011 ieee->start_send_beacons(ieee->dev);
12012 if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
12013 - ieee80211_beacons_start(ieee);
12014 + ieee80211_beacons_start_rtl7(ieee);
12015 }
12016
12017
12018 -void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee)
12019 +void ieee80211_softmac_stop_scan_rtl7(struct ieee80211_device *ieee)
12020 {
12021 -// unsigned long flags;
12022 -
12023 +// unsigned long flags;
12024 +
12025 //ieee->sync_scan_hurryup = 1;
12026 -
12027 +
12028 down(&ieee->scan_sem);
12029 // spin_lock_irqsave(&ieee->lock, flags);
12030 -
12031 +
12032 if (ieee->scanning == 1){
12033 ieee->scanning = 0;
12034 //del_timer_sync(&ieee->scan_timer);
12035 cancel_delayed_work(&ieee->softmac_scan_wq);
12036 }
12037 -
12038 +
12039 // spin_unlock_irqrestore(&ieee->lock, flags);
12040 up(&ieee->scan_sem);
12041 }
12042
12043 -void ieee80211_stop_scan(struct ieee80211_device *ieee)
12044 +void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee)
12045 {
12046 if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
12047 - ieee80211_softmac_stop_scan(ieee);
12048 + ieee80211_softmac_stop_scan_rtl7(ieee);
12049 else
12050 ieee->stop_scan(ieee->dev);
12051 }
12052
12053 /* called with ieee->lock held */
12054 -void ieee80211_start_scan(struct ieee80211_device *ieee)
12055 +void ieee80211_start_scan_rtl7(struct ieee80211_device *ieee)
12056 {
12057 - if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
12058 + if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
12059 if (ieee->scanning == 0){
12060 ieee->scanning = 1;
12061 //ieee80211_softmac_scan(ieee);
12062 - queue_work(ieee->wq, &ieee->softmac_scan_wq);
12063 + queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
12064 }
12065 }else
12066 ieee->start_scan(ieee->dev);
12067 -
12068 +
12069 }
12070
12071 /* called with wx_sem held */
12072 -void ieee80211_start_scan_syncro(struct ieee80211_device *ieee)
12073 +void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee)
12074 {
12075 ieee->sync_scan_hurryup = 0;
12076 -
12077 +
12078 if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
12079 - ieee80211_softmac_scan_syncro(ieee);
12080 + ieee80211_softmac_scan_syncro_rtl7(ieee);
12081 else
12082 ieee->scan_syncro(ieee->dev);
12083 -
12084 +
12085 }
12086
12087 -inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon,
12088 +inline struct sk_buff *ieee80211_authentication_req_rtl7(struct ieee80211_network *beacon,
12089 struct ieee80211_device *ieee, int challengelen)
12090 {
12091 - struct sk_buff *skb;
12092 + struct sk_buff *skb;
12093 struct ieee80211_authentication *auth;
12094 -
12095 - skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
12096 -
12097 +
12098 + skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
12099 +
12100 if (!skb) return NULL;
12101 -
12102 +
12103 auth = (struct ieee80211_authentication *)
12104 skb_put(skb, sizeof(struct ieee80211_authentication));
12105 -
12106 +
12107 auth->header.frame_ctl = IEEE80211_STYPE_AUTH;
12108 if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP;
12109 -
12110 +
12111 auth->header.duration_id = 0x013a; //FIXME
12112 -
12113 +
12114 memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN);
12115 memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
12116 memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN);
12117 -
12118 +
12119 auth->algorithm = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY;
12120 -
12121 +
12122 auth->transaction = cpu_to_le16(ieee->associate_seq);
12123 ieee->associate_seq++;
12124 -
12125 +
12126 auth->status = cpu_to_le16(WLAN_STATUS_SUCCESS);
12127 -
12128 +
12129 return skb;
12130 -
12131 +
12132 }
12133
12134 -static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest)
12135 +static struct sk_buff* ieee80211_probe_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
12136 {
12137 u8 *tag;
12138 int beacon_size;
12139 @@ -566,23 +572,23 @@
12140 int encrypt;
12141 int atim_len,erp_len;
12142 struct ieee80211_crypt_data* crypt;
12143 -
12144 +
12145 char *ssid = ieee->current_network.ssid;
12146 int ssid_len = ieee->current_network.ssid_len;
12147 int rate_len = ieee->current_network.rates_len+2;
12148 int rate_ex_len = ieee->current_network.rates_ex_len;
12149 if(rate_ex_len > 0) rate_ex_len+=2;
12150 -
12151 +
12152 if(ieee->current_network.capability & WLAN_CAPABILITY_IBSS)
12153 atim_len = 4;
12154 else
12155 atim_len = 0;
12156 -
12157 - if(ieee80211_is_54g(ieee->current_network))
12158 +
12159 + if(ieee80211_is_54g_rtl7(ieee->current_network))
12160 erp_len = 3;
12161 else
12162 erp_len = 0;
12163 -
12164 +
12165 beacon_size = sizeof(struct ieee80211_probe_response)+
12166 ssid_len
12167 +3 //channel
12168 @@ -590,72 +596,72 @@
12169 +rate_ex_len
12170 +atim_len
12171 +erp_len;
12172 -
12173 +
12174 skb = dev_alloc_skb(beacon_size);
12175 -
12176 - if (!skb)
12177 +
12178 + if (!skb)
12179 return NULL;
12180 -
12181 +
12182 beacon_buf = (struct ieee80211_probe_response*) skb_put(skb, beacon_size);
12183 -
12184 +
12185 memcpy (beacon_buf->header.addr1, dest,ETH_ALEN);
12186 memcpy (beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
12187 memcpy (beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN);
12188
12189 beacon_buf->header.duration_id = 0; //FIXME
12190 - beacon_buf->beacon_interval =
12191 + beacon_buf->beacon_interval =
12192 cpu_to_le16(ieee->current_network.beacon_interval);
12193 - beacon_buf->capability =
12194 + beacon_buf->capability =
12195 cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_IBSS);
12196 -
12197 +
12198 if(ieee->short_slot && (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_SLOT))
12199 - cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
12200 -
12201 + cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
12202 +
12203 crypt = ieee->crypt[ieee->tx_keyidx];
12204
12205 - encrypt = ieee->host_encrypt && crypt && crypt->ops &&
12206 + encrypt = ieee->host_encrypt && crypt && crypt->ops &&
12207 (0 == strcmp(crypt->ops->name, "WEP"));
12208
12209 - if (encrypt)
12210 + if (encrypt)
12211 beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
12212 -
12213 -
12214 +
12215 +
12216 beacon_buf->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_RESP);
12217 -
12218 - beacon_buf->info_element.id = MFIE_TYPE_SSID;
12219 +
12220 + beacon_buf->info_element.id = MFIE_TYPE_SSID;
12221 beacon_buf->info_element.len = ssid_len;
12222 -
12223 +
12224 tag = (u8*) beacon_buf->info_element.data;
12225 -
12226 +
12227 memcpy(tag, ssid, ssid_len);
12228 -
12229 +
12230 tag += ssid_len;
12231 -
12232 +
12233 *(tag++) = MFIE_TYPE_RATES;
12234 - *(tag++) = rate_len-2;
12235 + *(tag++) = rate_len-2;
12236 memcpy(tag,ieee->current_network.rates,rate_len-2);
12237 tag+=rate_len-2;
12238 -
12239 +
12240 *(tag++) = MFIE_TYPE_DS_SET;
12241 *(tag++) = 1;
12242 *(tag++) = ieee->current_network.channel;
12243 -
12244 +
12245 if(atim_len){
12246 *(tag++) = MFIE_TYPE_IBSS_SET;
12247 *(tag++) = 2;
12248 *((u16*)(tag)) = cpu_to_le16(ieee->current_network.atim_window);
12249 tag+=2;
12250 }
12251 -
12252 +
12253 if(erp_len){
12254 *(tag++) = MFIE_TYPE_ERP;
12255 *(tag++) = 1;
12256 - *(tag++) = 0;
12257 + *(tag++) = 0;
12258 }
12259 -
12260 +
12261 if(rate_ex_len){
12262 *(tag++) = MFIE_TYPE_RATES_EX;
12263 - *(tag++) = rate_ex_len-2;
12264 + *(tag++) = rate_ex_len-2;
12265 memcpy(tag,ieee->current_network.rates_ex,rate_ex_len-2);
12266 tag+=rate_ex_len-2;
12267 }
12268 @@ -664,208 +670,211 @@
12269 }
12270
12271
12272 -struct sk_buff* ieee80211_assoc_resp(struct ieee80211_device *ieee, u8 *dest)
12273 +struct sk_buff* ieee80211_assoc_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
12274 {
12275 struct sk_buff *skb;
12276 u8* tag;
12277 -
12278 +
12279 struct ieee80211_crypt_data* crypt;
12280 struct ieee80211_assoc_response_frame *assoc;
12281 short encrypt;
12282 -
12283 - unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
12284 +
12285 + unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
12286 int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len;
12287 -
12288 - skb = dev_alloc_skb(len);
12289 -
12290 - if (!skb)
12291 +
12292 + skb = dev_alloc_skb(len);
12293 +
12294 + if (!skb)
12295 return NULL;
12296 -
12297 +
12298 assoc = (struct ieee80211_assoc_response_frame *)
12299 skb_put(skb,sizeof(struct ieee80211_assoc_response_frame));
12300 -
12301 +
12302 assoc->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP);
12303 memcpy(assoc->header.addr1, dest,ETH_ALEN);
12304 memcpy(assoc->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
12305 memcpy(assoc->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
12306 - assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
12307 + assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
12308 WLAN_CAPABILITY_BSS : WLAN_CAPABILITY_IBSS);
12309 -
12310 -
12311 +
12312 +
12313 if(ieee->short_slot)
12314 assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
12315 -
12316 +
12317 if (ieee->host_encrypt)
12318 crypt = ieee->crypt[ieee->tx_keyidx];
12319 else crypt = NULL;
12320 -
12321 +
12322 encrypt = ( crypt && crypt->ops);
12323 -
12324 +
12325 if (encrypt)
12326 assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
12327 -
12328 +
12329 assoc->status = 0;
12330 assoc->aid = cpu_to_le16(ieee->assoc_id);
12331 if (ieee->assoc_id == 0x2007) ieee->assoc_id=0;
12332 else ieee->assoc_id++;
12333 -
12334 +
12335 tag = (u8*) skb_put(skb, rate_len);
12336 -
12337 - ieee80211_MFIE_Brate(ieee, &tag);
12338 - ieee80211_MFIE_Grate(ieee, &tag);
12339 -
12340 +
12341 + ieee80211_MFIE_Brate_rtl7(ieee, &tag);
12342 + ieee80211_MFIE_Grate_rtl7(ieee, &tag);
12343 +
12344 return skb;
12345 }
12346
12347 -struct sk_buff* ieee80211_auth_resp(struct ieee80211_device *ieee,int status, u8 *dest)
12348 +struct sk_buff* ieee80211_auth_resp_rtl7(struct ieee80211_device *ieee,int status, u8 *dest)
12349 {
12350 struct sk_buff *skb;
12351 struct ieee80211_authentication *auth;
12352 -
12353 - skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
12354 -
12355 - if (!skb)
12356 +
12357 + skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
12358 +
12359 + if (!skb)
12360 return NULL;
12361 -
12362 +
12363 skb->len = sizeof(struct ieee80211_authentication);
12364 -
12365 +
12366 auth = (struct ieee80211_authentication *)skb->data;
12367 -
12368 +
12369 auth->status = cpu_to_le16(status);
12370 auth->transaction = cpu_to_le16(2);
12371 auth->algorithm = cpu_to_le16(WLAN_AUTH_OPEN);
12372 -
12373 +
12374 memcpy(auth->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
12375 memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
12376 memcpy(auth->header.addr1, dest, ETH_ALEN);
12377 - auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
12378 + auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
12379 return skb;
12380 -
12381 -
12382 +
12383 +
12384 }
12385
12386 -struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr)
12387 +struct sk_buff* ieee80211_null_func_rtl7(struct ieee80211_device *ieee,short pwr)
12388 {
12389 struct sk_buff *skb;
12390 struct ieee80211_hdr_3addr* hdr;
12391 -
12392 - skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
12393 -
12394 - if (!skb)
12395 +
12396 + skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
12397 +
12398 + if (!skb)
12399 return NULL;
12400 -
12401 +
12402 hdr = (struct ieee80211_hdr_3addr*)skb_put(skb,sizeof(struct ieee80211_hdr_3addr));
12403 -
12404 +
12405 memcpy(hdr->addr1, ieee->current_network.bssid, ETH_ALEN);
12406 memcpy(hdr->addr2, ieee->dev->dev_addr, ETH_ALEN);
12407 memcpy(hdr->addr3, ieee->current_network.bssid, ETH_ALEN);
12408 -
12409 - hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
12410 - IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
12411 - (pwr ? IEEE80211_FCTL_PM:0));
12412 -
12413 +
12414 + hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
12415 + IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
12416 + (pwr ? IEEE80211_FCTL_PM:0));
12417 +
12418 return skb;
12419 -
12420 -
12421 +
12422 +
12423 }
12424
12425
12426 -void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest)
12427 +void ieee80211_resp_to_assoc_rq_rtl7(struct ieee80211_device *ieee, u8* dest)
12428 {
12429 - struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest);
12430 -
12431 + struct sk_buff *buf = ieee80211_assoc_resp_rtl7(ieee, dest);
12432 +
12433 if (buf)
12434 - softmac_mgmt_xmit(buf, ieee);
12435 + softmac_mgmt_xmit_rtl7(buf, ieee);
12436 }
12437
12438
12439 -void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest)
12440 +void ieee80211_resp_to_auth_rtl7(struct ieee80211_device *ieee, int s, u8* dest)
12441 {
12442 - struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest);
12443 -
12444 + struct sk_buff *buf = ieee80211_auth_resp_rtl7(ieee, s, dest);
12445 +
12446 if (buf)
12447 - softmac_mgmt_xmit(buf, ieee);
12448 + softmac_mgmt_xmit_rtl7(buf, ieee);
12449 }
12450
12451
12452 -void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest)
12453 +void ieee80211_resp_to_probe_rtl7(struct ieee80211_device *ieee, u8 *dest)
12454 {
12455 -
12456 - struct sk_buff *buf = ieee80211_probe_resp(ieee, dest);
12457 -
12458 - if (buf)
12459 - softmac_mgmt_xmit(buf, ieee);
12460 +
12461 + struct sk_buff *buf = ieee80211_probe_resp_rtl7(ieee, dest);
12462 +
12463 + if (buf)
12464 + softmac_mgmt_xmit_rtl7(buf, ieee);
12465 }
12466
12467
12468 -inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
12469 +inline struct sk_buff *ieee80211_association_req_rtl7(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
12470 {
12471 struct sk_buff *skb;
12472 -
12473 +
12474 struct ieee80211_assoc_request_frame *hdr;
12475 u8 *tag;
12476 -
12477 +
12478 unsigned int wpa_len = beacon->wpa_ie_len;
12479 -
12480 - unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
12481 -
12482 -
12483 -
12484 +
12485 + unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
12486 +
12487 +
12488 +
12489 int len=sizeof(struct ieee80211_assoc_request_frame)+
12490 + beacon->ssid_len//essid tagged val
12491 + rate_len//rates tagged val
12492 + wpa_len;
12493 -
12494 +
12495 skb = dev_alloc_skb(len);
12496 -
12497 - if (!skb)
12498 +
12499 + if (!skb)
12500 return NULL;
12501 -
12502 +
12503 hdr = (struct ieee80211_assoc_request_frame *)
12504 skb_put(skb, sizeof(struct ieee80211_assoc_request_frame));
12505 -
12506 -
12507 +
12508 +
12509 hdr->header.frame_ctl = IEEE80211_STYPE_ASSOC_REQ;
12510 hdr->header.duration_id= 37; //FIXME
12511 memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN);
12512 memcpy(hdr->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
12513 memcpy(hdr->header.addr3, beacon->bssid, ETH_ALEN);
12514 -
12515 +
12516 hdr->capability = cpu_to_le16(WLAN_CAPABILITY_BSS);
12517 - if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
12518 + if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
12519 hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
12520 -
12521 +
12522 if(ieee->short_slot)
12523 hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
12524 -
12525 +
12526 + if(beacon->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
12527 + hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_PREAMBLE);
12528 +
12529 hdr->listen_interval = 0xa; //FIXME
12530 -
12531 +
12532 hdr->info_element.id = MFIE_TYPE_SSID;
12533
12534 hdr->info_element.len = beacon->ssid_len;
12535 tag = skb_put(skb, beacon->ssid_len);
12536 memcpy(tag, beacon->ssid, beacon->ssid_len);
12537 -
12538 - tag = skb_put(skb, rate_len);
12539 -
12540 - ieee80211_MFIE_Brate(ieee, &tag);
12541 - ieee80211_MFIE_Grate(ieee, &tag);
12542 -
12543 +
12544 + tag = skb_put(skb, rate_len);
12545 +
12546 + ieee80211_MFIE_Brate_rtl7(ieee, &tag);
12547 + ieee80211_MFIE_Grate_rtl7(ieee, &tag);
12548 +
12549 tag = skb_put(skb,wpa_len);
12550 -
12551 +
12552 memcpy(tag,beacon->wpa_ie,wpa_len);
12553 -
12554 +
12555 return skb;
12556 }
12557
12558 -void ieee80211_associate_abort(struct ieee80211_device *ieee)
12559 +void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee)
12560 {
12561 -
12562 +
12563 unsigned long flags;
12564 spin_lock_irqsave(&ieee->lock, flags);
12565 -
12566 +
12567 ieee->associate_seq++;
12568 -
12569 +
12570 /* don't scan, and avoid to have the RX path possibily
12571 * try again to associate. Even do not react to AUTH or
12572 * ASSOC response. Just wait for the retry wq to be scheduled.
12573 @@ -873,166 +882,181 @@
12574 * with, so we retry or just get back to NO_LINK and scanning
12575 */
12576 if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING){
12577 - IEEE80211_DEBUG_MGMT("Authentication failed\n");
12578 + IEEE80211_DEBUG_MGMT("Authentication failed\n");
12579 ieee->softmac_stats.no_auth_rs++;
12580 }else{
12581 - IEEE80211_DEBUG_MGMT("Association failed\n");
12582 + IEEE80211_DEBUG_MGMT("Association failed\n");
12583 ieee->softmac_stats.no_ass_rs++;
12584 }
12585 -
12586 +
12587 ieee->state = IEEE80211_ASSOCIATING_RETRY;
12588 -
12589 +
12590 queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, IEEE80211_SOFTMAC_ASSOC_RETRY_TIME);
12591 -
12592 +
12593 spin_unlock_irqrestore(&ieee->lock, flags);
12594 }
12595
12596 -void ieee80211_associate_abort_cb(unsigned long dev)
12597 +void ieee80211_associate_abort_cb_rtl7(unsigned long dev)
12598 {
12599 - ieee80211_associate_abort((struct ieee80211_device *) dev);
12600 + ieee80211_associate_abort_rtl7((struct ieee80211_device *) dev);
12601 }
12602
12603
12604 -void ieee80211_associate_step1(struct ieee80211_device *ieee)
12605 +void ieee80211_associate_step1_rtl7(struct ieee80211_device *ieee)
12606 {
12607 struct ieee80211_network *beacon = &ieee->current_network;
12608 struct sk_buff *skb;
12609 -
12610 +
12611 IEEE80211_DEBUG_MGMT("Stopping scan\n");
12612 -
12613 +
12614 ieee->softmac_stats.tx_auth_rq++;
12615 - skb=ieee80211_authentication_req(beacon, ieee, 0);
12616 -
12617 - if (!skb)
12618 - ieee80211_associate_abort(ieee);
12619 - else{
12620 + skb=ieee80211_authentication_req_rtl7(beacon, ieee, 0);
12621 +
12622 + if (!skb)
12623 + ieee80211_associate_abort_rtl7(ieee);
12624 + else{
12625 ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ;
12626 IEEE80211_DEBUG_MGMT("Sending authentication request\n");
12627 - softmac_mgmt_xmit(skb, ieee);
12628 + softmac_mgmt_xmit_rtl7(skb, ieee);
12629 ieee->associate_timer.expires = jiffies + (HZ / 2);
12630 add_timer(&ieee->associate_timer);
12631 - }
12632 + }
12633 }
12634
12635 -void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
12636 +void ieee80211_auth_challenge_rtl7(struct ieee80211_device *ieee, u8 *challenge, int chlen)
12637 {
12638 - u8 *c;
12639 + u8 *c;
12640 struct sk_buff *skb;
12641 struct ieee80211_network *beacon = &ieee->current_network;
12642 // int hlen = sizeof(struct ieee80211_authentication);
12643 -
12644 +
12645 ieee->associate_seq++;
12646 ieee->softmac_stats.tx_auth_rq++;
12647 -
12648 - skb = ieee80211_authentication_req(beacon, ieee, chlen+2);
12649 - if (!skb)
12650 - ieee80211_associate_abort(ieee);
12651 +
12652 + skb = ieee80211_authentication_req_rtl7(beacon, ieee, chlen+2);
12653 + if (!skb)
12654 + ieee80211_associate_abort_rtl7(ieee);
12655 else{
12656 c = skb_put(skb, chlen+2);
12657 *(c++) = MFIE_TYPE_CHALLENGE;
12658 *(c++) = chlen;
12659 memcpy(c, challenge, chlen);
12660 -
12661 +
12662 IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n");
12663 -
12664 - ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
12665 -
12666 - softmac_mgmt_xmit(skb, ieee);
12667 +
12668 + ieee80211_encrypt_fragment_rtl7(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
12669 +
12670 + softmac_mgmt_xmit_rtl7(skb, ieee);
12671 ieee->associate_timer.expires = jiffies + (HZ / 2);
12672 add_timer(&ieee->associate_timer);
12673 - }
12674 + }
12675 kfree(challenge);
12676 }
12677
12678 -void ieee80211_associate_step2(struct ieee80211_device *ieee)
12679 +void ieee80211_associate_step2_rtl7(struct ieee80211_device *ieee)
12680 {
12681 struct sk_buff* skb;
12682 struct ieee80211_network *beacon = &ieee->current_network;
12683 -
12684 +
12685 del_timer_sync(&ieee->associate_timer);
12686 -
12687 +
12688 IEEE80211_DEBUG_MGMT("Sending association request\n");
12689 -
12690 +
12691 ieee->softmac_stats.tx_ass_rq++;
12692 - skb=ieee80211_association_req(beacon, ieee);
12693 - if (!skb)
12694 - ieee80211_associate_abort(ieee);
12695 + skb=ieee80211_association_req_rtl7(beacon, ieee);
12696 + if (!skb)
12697 + ieee80211_associate_abort_rtl7(ieee);
12698 else{
12699 - softmac_mgmt_xmit(skb, ieee);
12700 + softmac_mgmt_xmit_rtl7(skb, ieee);
12701 ieee->associate_timer.expires = jiffies + (HZ / 2);
12702 add_timer(&ieee->associate_timer);
12703 - }
12704 + }
12705 }
12706
12707 -void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
12708 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
12709 +void ieee80211_associate_complete_wq_rtl7(struct work_struct *work)
12710 +{
12711 + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
12712 +#else
12713 +void ieee80211_associate_complete_wq_rtl7(struct ieee80211_device *ieee)
12714 {
12715 +#endif
12716 printk(KERN_INFO "Associated successfully\n");
12717 - if(ieee80211_is_54g(ieee->current_network) &&
12718 +#if 0
12719 + if(ieee80211_is_54g_rtl7(ieee->current_network) &&
12720 (ieee->modulation & IEEE80211_OFDM_MODULATION)){
12721 -
12722 +
12723 ieee->rate = 540;
12724 printk(KERN_INFO"Using G rates\n");
12725 }else{
12726 ieee->rate = 110;
12727 printk(KERN_INFO"Using B rates\n");
12728 }
12729 +#else
12730 + printk(KERN_INFO"Using %d MBit\n", (ieee->rate/10) );
12731 +#endif
12732 ieee->link_change(ieee->dev);
12733 - notify_wx_assoc_event(ieee);
12734 + notify_wx_assoc_event_rtl7(ieee);
12735 if (ieee->data_hard_resume)
12736 ieee->data_hard_resume(ieee->dev);
12737 netif_carrier_on(ieee->dev);
12738 }
12739
12740 -void ieee80211_associate_complete(struct ieee80211_device *ieee)
12741 +void ieee80211_associate_complete_rtl7(struct ieee80211_device *ieee)
12742 {
12743
12744 del_timer_sync(&ieee->associate_timer);
12745 -
12746 +
12747 ieee->seq_ctrl = 0;
12748 ieee->state = IEEE80211_LINKED;
12749 IEEE80211_DEBUG_MGMT("Successfully associated\n");
12750 -
12751 +
12752 queue_work(ieee->wq, &ieee->associate_complete_wq);
12753 }
12754
12755 -void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee)
12756 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
12757 +void ieee80211_associate_procedure_wq_rtl7(struct work_struct *work)
12758 {
12759 + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
12760 +#else
12761 +void ieee80211_associate_procedure_wq_rtl7(struct ieee80211_device *ieee)
12762 +{
12763 +#endif
12764 ieee->sync_scan_hurryup = 1;
12765 down(&ieee->wx_sem);
12766 -
12767 if (ieee->data_hard_stop)
12768 ieee->data_hard_stop(ieee->dev);
12769 -
12770 - ieee80211_stop_scan(ieee);
12771 +
12772 + ieee80211_stop_scan_rtl7(ieee);
12773 ieee->set_chan(ieee->dev, ieee->current_network.channel);
12774 -
12775 +
12776 ieee->associate_seq = 1;
12777 - ieee80211_associate_step1(ieee);
12778 -
12779 + ieee80211_associate_step1_rtl7(ieee);
12780 +
12781 up(&ieee->wx_sem);
12782 }
12783
12784 -inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net)
12785 +inline void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net)
12786 {
12787 -
12788 +
12789 u8 tmp_ssid[IW_ESSID_MAX_SIZE+1];
12790 int tmp_ssid_len = 0;
12791 -
12792 +
12793 short apset,ssidset,ssidbroad,apmatch,ssidmatch;
12794 -
12795 - /* we are interested in new new only if we are not associated
12796 +
12797 + /* we are interested in new new only if we are not associated
12798 * and we are not associating / authenticating
12799 */
12800 if (ieee->state != IEEE80211_NOLINK)
12801 - return;
12802 -
12803 + return;
12804 +
12805 if ((ieee->iw_mode == IW_MODE_INFRA) && !(net->capability & WLAN_CAPABILITY_BSS))
12806 return;
12807 -
12808 +
12809 if ((ieee->iw_mode == IW_MODE_ADHOC) && !(net->capability & WLAN_CAPABILITY_IBSS))
12810 return;
12811
12812 -
12813 +
12814 if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC){
12815 /* if the user specified the AP MAC, we need also the essid
12816 * This could be obtained by beacons or, if the network does not
12817 @@ -1043,23 +1067,23 @@
12818 ssidbroad = !(net->ssid_len == 0 || net->ssid[0]== '\0');
12819 apmatch = (memcmp(ieee->current_network.bssid, net->bssid, ETH_ALEN)==0);
12820 ssidmatch = (0==strncmp(ieee->current_network.ssid, net->ssid, net->ssid_len));
12821 -
12822 -
12823 -
12824 +
12825 +
12826 +
12827 if ( /* if the user set the AP check if match.
12828 * if the network does not broadcast essid we check the user supplyed ANY essid
12829 * if the network does broadcast and the user does not set essid it is OK
12830 * if the network does broadcast and the user did set essid chech if essid match
12831 */
12832 - ( apset && apmatch &&
12833 - ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
12834 + ( apset && apmatch &&
12835 + ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
12836 /* if the ap is not set, check that the user set the bssid
12837 * and the network does bradcast and that those two bssid matches
12838 - */
12839 - (!apset && ssidset && ssidbroad && ssidmatch)
12840 + */
12841 + (!apset && ssidset && ssidbroad && ssidmatch)
12842 ){
12843 -
12844 -
12845 +
12846 +
12847 /* if the essid is hidden replace it with the
12848 * essid provided by the user.
12849 */
12850 @@ -1068,18 +1092,19 @@
12851 tmp_ssid_len = ieee->current_network.ssid_len;
12852 }
12853 memcpy(&ieee->current_network, net, sizeof(struct ieee80211_network));
12854 -
12855 +
12856 if (!ssidbroad){
12857 strncpy(ieee->current_network.ssid, tmp_ssid, IW_ESSID_MAX_SIZE);
12858 ieee->current_network.ssid_len = tmp_ssid_len;
12859 }
12860 - printk(KERN_INFO"Linking with %s\n",ieee->current_network.ssid);
12861 -
12862 + printk(KERN_INFO"Linking with \"%s\" rate: %d MBit\n",ieee->current_network.ssid, (ieee->rate/10));
12863 +
12864 if (ieee->iw_mode == IW_MODE_INFRA){
12865 ieee->state = IEEE80211_ASSOCIATING;
12866 queue_work(ieee->wq, &ieee->associate_procedure_wq);
12867 }else{
12868 - if(ieee80211_is_54g(ieee->current_network) &&
12869 +#if 0
12870 + if(ieee80211_is_54g_rtl7(ieee->current_network) &&
12871 (ieee->modulation & IEEE80211_OFDM_MODULATION)){
12872 ieee->rate = 540;
12873 printk(KERN_INFO"Using G rates\n");
12874 @@ -1087,44 +1112,45 @@
12875 ieee->rate = 110;
12876 printk(KERN_INFO"Using B rates\n");
12877 }
12878 +#else
12879 + printk(KERN_INFO"Using %d MBit\n", (ieee->rate/10) );
12880 +#endif
12881 ieee->state = IEEE80211_LINKED;
12882 }
12883 -
12884 +
12885 }
12886 }
12887 -
12888 }
12889
12890 -void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee)
12891 +void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee)
12892 {
12893 -
12894 +
12895 unsigned long flags;
12896 struct ieee80211_network *target;
12897 -
12898 +
12899 spin_lock_irqsave(&ieee->lock, flags);
12900 -
12901 list_for_each_entry(target, &ieee->network_list, list) {
12902 -
12903 +
12904 /* if the state become different that NOLINK means
12905 * we had found what we are searching for
12906 */
12907 - if (ieee->state != IEEE80211_NOLINK)
12908 + if (ieee->state != IEEE80211_NOLINK)
12909 break;
12910 -
12911 +
12912 //if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies))
12913 - ieee80211_softmac_new_net(ieee, target);
12914 + ieee80211_softmac_new_net_rtl7(ieee, target);
12915 }
12916 -
12917 +
12918 spin_unlock_irqrestore(&ieee->lock, flags);
12919 -
12920 +
12921 }
12922
12923
12924 -static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
12925 +static inline u16 auth_parse_rtl7(struct sk_buff *skb, u8** challenge, int *chlen)
12926 {
12927 struct ieee80211_authentication *a;
12928 u8 *t;
12929 - if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
12930 + if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
12931 IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n",skb->len);
12932 return 0xcafe;
12933 }
12934 @@ -1132,58 +1158,58 @@
12935 a = (struct ieee80211_authentication*) skb->data;
12936 if(skb->len > (sizeof(struct ieee80211_authentication) +3)){
12937 t = skb->data + sizeof(struct ieee80211_authentication);
12938 -
12939 +
12940 if(*(t++) == MFIE_TYPE_CHALLENGE){
12941 *chlen = *(t++);
12942 *challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC);
12943 memcpy(*challenge, t, *chlen);
12944 }
12945 }
12946 -
12947 +
12948 return cpu_to_le16(a->status);
12949 -
12950 +
12951 }
12952
12953
12954 -int auth_rq_parse(struct sk_buff *skb,u8* dest)
12955 +int auth_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
12956 {
12957 struct ieee80211_authentication *a;
12958 -
12959 - if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
12960 - IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
12961 +
12962 + if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
12963 + IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
12964 return -1;
12965 }
12966 a = (struct ieee80211_authentication*) skb->data;
12967 -
12968 +
12969 memcpy(dest,a->header.addr2, ETH_ALEN);
12970 -
12971 - if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
12972 +
12973 + if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
12974 return WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG;
12975 -
12976 +
12977 return WLAN_STATUS_SUCCESS;
12978 }
12979
12980 -static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
12981 +static short probe_rq_parse_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
12982 {
12983 u8 *tag;
12984 u8 *skbend;
12985 u8 *ssid=NULL;
12986 u8 ssidlen = 0;
12987 -
12988 +
12989 struct ieee80211_hdr_3addr *header =
12990 (struct ieee80211_hdr_3addr *) skb->data;
12991 -
12992 - if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
12993 +
12994 + if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
12995 return -1; /* corrupted */
12996 -
12997 +
12998 memcpy(src,header->addr2, ETH_ALEN);
12999 -
13000 +
13001 skbend = (u8*)skb->data + skb->len;
13002 -
13003 +
13004 tag = skb->data + sizeof (struct ieee80211_hdr_3addr );
13005 -
13006 +
13007 while (tag+1 < skbend){
13008 - if (*tag == 0){
13009 + if (*tag == 0){
13010 ssid = tag+2;
13011 ssidlen = *(tag+1);
13012 break;
13013 @@ -1192,88 +1218,88 @@
13014 tag = tag + *(tag); /* point to the last data byte of the tag */
13015 tag++; /* point to the next tag */
13016 }
13017 -
13018 +
13019 //IEEE80211DMESG("Card MAC address is "MACSTR, MAC2STR(src));
13020 if (ssidlen == 0) return 1;
13021 -
13022 +
13023 if (!ssid) return 1; /* ssid not found in tagged param */
13024 return (!strncmp(ssid, ieee->current_network.ssid, ssidlen));
13025 -
13026 +
13027 }
13028
13029 -int assoc_rq_parse(struct sk_buff *skb,u8* dest)
13030 +int assoc_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
13031 {
13032 struct ieee80211_assoc_request_frame *a;
13033 -
13034 - if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
13035 - sizeof(struct ieee80211_info_element))) {
13036 -
13037 +
13038 + if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
13039 + sizeof(struct ieee80211_info_element))) {
13040 +
13041 IEEE80211_DEBUG_MGMT("invalid len in auth request:%d \n", skb->len);
13042 return -1;
13043 }
13044 -
13045 +
13046 a = (struct ieee80211_assoc_request_frame*) skb->data;
13047 -
13048 +
13049 memcpy(dest,a->header.addr2,ETH_ALEN);
13050 -
13051 +
13052 return 0;
13053 }
13054
13055 -static inline u16 assoc_parse(struct sk_buff *skb, int *aid)
13056 +static inline u16 assoc_parse_rtl7(struct sk_buff *skb, int *aid)
13057 {
13058 struct ieee80211_assoc_response_frame *a;
13059 - if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
13060 + if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
13061 IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len);
13062 return 0xcafe;
13063 }
13064 -
13065 +
13066 a = (struct ieee80211_assoc_response_frame*) skb->data;
13067 *aid = le16_to_cpu(a->aid) & 0x3fff;
13068 return le16_to_cpu(a->status);
13069 }
13070
13071 static inline void
13072 -ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
13073 +ieee80211_rx_probe_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
13074 {
13075 u8 dest[ETH_ALEN];
13076 -
13077 +
13078 //IEEE80211DMESG("Rx probe");
13079 ieee->softmac_stats.rx_probe_rq++;
13080 //DMESG("Dest is "MACSTR, MAC2STR(dest));
13081 - if (probe_rq_parse(ieee, skb, dest)){
13082 + if (probe_rq_parse_rtl7(ieee, skb, dest)){
13083 //IEEE80211DMESG("Was for me!");
13084 ieee->softmac_stats.tx_probe_rs++;
13085 - ieee80211_resp_to_probe(ieee, dest);
13086 + ieee80211_resp_to_probe_rtl7(ieee, dest);
13087 }
13088 }
13089
13090 static inline void
13091 -ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
13092 +ieee80211_rx_auth_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
13093 {
13094 u8 dest[ETH_ALEN];
13095 int status;
13096 //IEEE80211DMESG("Rx probe");
13097 ieee->softmac_stats.rx_auth_rq++;
13098 -
13099 - if ((status = auth_rq_parse(skb, dest))!= -1){
13100 - ieee80211_resp_to_auth(ieee, status, dest);
13101 +
13102 + if ((status = auth_rq_parse_rtl7(skb, dest))!= -1){
13103 + ieee80211_resp_to_auth_rtl7(ieee, status, dest);
13104 }
13105 //DMESG("Dest is "MACSTR, MAC2STR(dest));
13106 -
13107 +
13108 }
13109
13110 static inline void
13111 -ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
13112 +ieee80211_rx_assoc_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
13113 {
13114 -
13115 +
13116 u8 dest[ETH_ALEN];
13117 //unsigned long flags;
13118 -
13119 +
13120 ieee->softmac_stats.rx_ass_rq++;
13121 - if (assoc_rq_parse(skb,dest) != -1){
13122 - ieee80211_resp_to_assoc_rq(ieee, dest);
13123 + if (assoc_rq_parse_rtl7(skb,dest) != -1){
13124 + ieee80211_resp_to_assoc_rq_rtl7(ieee, dest);
13125 }
13126 -
13127 +
13128 printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest));
13129 //FIXME
13130 #if 0
13131 @@ -1285,25 +1311,25 @@
13132
13133
13134
13135 -void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr)
13136 +void ieee80211_sta_ps_send_null_frame_rtl7(struct ieee80211_device *ieee, short pwr)
13137 {
13138 -
13139 - struct sk_buff *buf = ieee80211_null_func(ieee, pwr);
13140 -
13141 +
13142 + struct sk_buff *buf = ieee80211_null_func_rtl7(ieee, pwr);
13143 +
13144 if (buf)
13145 - softmac_ps_mgmt_xmit(buf, ieee);
13146 + softmac_ps_mgmt_xmit_rtl7(buf, ieee);
13147
13148 -}
13149 +}
13150
13151
13152 -short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
13153 -{
13154 +short ieee80211_sta_ps_sleep_rtl7(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
13155 +{
13156 int timeout = ieee->ps_timeout;
13157 u8 dtim;
13158 /*if(ieee->ps == IEEE80211_PS_DISABLED ||
13159 - ieee->iw_mode != IW_MODE_INFRA ||
13160 + ieee->iw_mode != IW_MODE_INFRA ||
13161 ieee->state != IEEE80211_LINKED)
13162 -
13163 +
13164 return 0;
13165 */
13166 dtim = ieee->current_network.dtim_data;
13167 @@ -1312,133 +1338,133 @@
13168 return 0;
13169 //printk("VALID\n");
13170 ieee->current_network.dtim_data = IEEE80211_DTIM_INVALID;
13171 -
13172 +
13173 if(dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST)& ieee->ps))
13174 return 2;
13175 -
13176 +
13177 if(!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout)))
13178 return 0;
13179 -
13180 +
13181 if(!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout)))
13182 return 0;
13183 -
13184 +
13185 if((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE ) &&
13186 (ieee->mgmt_queue_tail != ieee->mgmt_queue_head))
13187 return 0;
13188 -
13189 +
13190 if(time_l){
13191 - *time_l = ieee->current_network.last_dtim_sta_time[0]
13192 - + (ieee->current_network.beacon_interval
13193 + *time_l = ieee->current_network.last_dtim_sta_time[0]
13194 + + (ieee->current_network.beacon_interval
13195 * ieee->current_network.dtim_period) * 1000;
13196 }
13197 -
13198 +
13199 if(time_h){
13200 *time_h = ieee->current_network.last_dtim_sta_time[1];
13201 if(time_l && *time_l < ieee->current_network.last_dtim_sta_time[0])
13202 *time_h += 1;
13203 }
13204 -
13205 +
13206 return 1;
13207 -
13208 -
13209 +
13210 +
13211 }
13212
13213 -inline void ieee80211_sta_ps(struct ieee80211_device *ieee)
13214 +inline void ieee80211_sta_ps_rtl7(struct ieee80211_device *ieee)
13215 {
13216
13217 u32 th,tl;
13218 short sleep;
13219 -
13220 +
13221 unsigned long flags,flags2;
13222 -
13223 +
13224 spin_lock_irqsave(&ieee->lock, flags);
13225 -
13226 +
13227 if((ieee->ps == IEEE80211_PS_DISABLED ||
13228 - ieee->iw_mode != IW_MODE_INFRA ||
13229 + ieee->iw_mode != IW_MODE_INFRA ||
13230 ieee->state != IEEE80211_LINKED)){
13231 -
13232 - #warning CHECK_LOCK_HERE
13233 +
13234 +// #warning CHECK_LOCK_HERE
13235 spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
13236 -
13237 - ieee80211_sta_wakeup(ieee, 1);
13238 -
13239 +
13240 + ieee80211_sta_wakeup_rtl7(ieee, 1);
13241 + printk(KERN_WARNING "wakeup 1!\n" );
13242 spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
13243 }
13244 -
13245 - sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl);
13246 +
13247 + sleep = ieee80211_sta_ps_sleep_rtl7(ieee,&th, &tl);
13248 /* 2 wake, 1 sleep, 0 do nothing */
13249 if(sleep == 0)
13250 goto out;
13251 -
13252 +
13253 if(sleep == 1){
13254 -
13255 +
13256 if(ieee->sta_sleep == 1)
13257 ieee->enter_sleep_state(ieee->dev,th,tl);
13258 -
13259 +
13260 else if(ieee->sta_sleep == 0){
13261 // printk("send null 1\n");
13262 spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
13263 -
13264 +
13265 if(ieee->ps_is_queue_empty(ieee->dev)){
13266 -
13267 -
13268 +
13269 +
13270 ieee->sta_sleep = 2;
13271 -
13272 +
13273 ieee->ps_request_tx_ack(ieee->dev);
13274 -
13275 - ieee80211_sta_ps_send_null_frame(ieee,1);
13276 -
13277 +
13278 + ieee80211_sta_ps_send_null_frame_rtl7(ieee,1);
13279 +
13280 ieee->ps_th = th;
13281 ieee->ps_tl = tl;
13282 - }
13283 + }
13284 spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
13285 -
13286 +
13287 }
13288 -
13289 -
13290 +
13291 +
13292 }else if(sleep == 2){
13293 -#warning CHECK_LOCK_HERE
13294 +// #warning CHECK_LOCK_HERE
13295 spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
13296 -
13297 - ieee80211_sta_wakeup(ieee,1);
13298 -
13299 +
13300 + ieee80211_sta_wakeup_rtl7(ieee,1);
13301 + printk(KERN_WARNING "wakeup 2!\n" );
13302 spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
13303 }
13304
13305 -out:
13306 +out:
13307 spin_unlock_irqrestore(&ieee->lock, flags);
13308 -
13309 +
13310 }
13311
13312 -void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl)
13313 +void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl)
13314 {
13315 if(ieee->sta_sleep == 0){
13316 if(nl){
13317 printk("Warning: driver is probably failing to report TX ps error\n");
13318 ieee->ps_request_tx_ack(ieee->dev);
13319 - ieee80211_sta_ps_send_null_frame(ieee, 0);
13320 + ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
13321 }
13322 return;
13323 -
13324 +
13325 }
13326 -
13327 - if(ieee->sta_sleep == 1)
13328 +
13329 + if(ieee->sta_sleep == 1)
13330 ieee->sta_wake_up(ieee->dev);
13331 -
13332 +
13333 ieee->sta_sleep = 0;
13334 -
13335 +
13336 if(nl){
13337 ieee->ps_request_tx_ack(ieee->dev);
13338 - ieee80211_sta_ps_send_null_frame(ieee, 0);
13339 + ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
13340 }
13341 }
13342
13343 -void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success)
13344 +void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success)
13345 {
13346 unsigned long flags,flags2;
13347 -
13348 +
13349 spin_lock_irqsave(&ieee->lock, flags);
13350 -
13351 +
13352 if(ieee->sta_sleep == 2){
13353 /* Null frame with PS bit set */
13354 if(success){
13355 @@ -1451,10 +1477,10 @@
13356 }
13357 /* 21112005 - tx again null without PS bit if lost */
13358 else {
13359 -
13360 +
13361 if((ieee->sta_sleep == 0) && !success){
13362 spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
13363 - ieee80211_sta_ps_send_null_frame(ieee, 0);
13364 + ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
13365 spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
13366 }
13367 }
13368 @@ -1462,129 +1488,132 @@
13369 }
13370
13371 inline int
13372 -ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
13373 +ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
13374 struct ieee80211_rx_stats *rx_stats, u16 type,
13375 u16 stype)
13376 {
13377 struct ieee80211_hdr_3addr *header;
13378 - header = (struct ieee80211_hdr_3addr *) skb->data;
13379 u16 errcode;
13380 u8* challenge;
13381 int chlen;
13382 int aid;
13383 -
13384 +
13385 + chlen = 0;
13386 +
13387 + header = (struct ieee80211_hdr_3addr *) skb->data;
13388 +
13389 if(!ieee->proto_started)
13390 return 0;
13391 -
13392 +
13393 if(ieee->sta_sleep || (ieee->ps != IEEE80211_PS_DISABLED &&
13394 - ieee->iw_mode == IW_MODE_INFRA &&
13395 + ieee->iw_mode == IW_MODE_INFRA &&
13396 ieee->state == IEEE80211_LINKED))
13397 -
13398 +
13399 tasklet_schedule(&ieee->ps_task);
13400 -
13401 +
13402 if(WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_PROBE_RESP &&
13403 WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_BEACON)
13404 ieee->last_rx_ps_time = jiffies;
13405 -
13406 +
13407 switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
13408 -
13409 +
13410 case IEEE80211_STYPE_ASSOC_RESP:
13411 case IEEE80211_STYPE_REASSOC_RESP:
13412 -
13413 +
13414 IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n",
13415 WLAN_FC_GET_STYPE(header->frame_ctl));
13416 if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
13417 - ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
13418 + ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
13419 ieee->iw_mode == IW_MODE_INFRA){
13420 - if (0 == (errcode=assoc_parse(skb, &aid))){
13421 -
13422 + if (0 == (errcode=assoc_parse_rtl7(skb, &aid))){
13423 +
13424 ieee->state=IEEE80211_LINKED;
13425 ieee->assoc_id = aid;
13426 ieee->softmac_stats.rx_ass_ok++;
13427 -
13428 - ieee80211_associate_complete(ieee);
13429 +
13430 + ieee80211_associate_complete_rtl7(ieee);
13431 }else{
13432 ieee->softmac_stats.rx_ass_err++;
13433 IEEE80211_DEBUG_MGMT(
13434 "Association response status code 0x%x\n",
13435 errcode);
13436 - ieee80211_associate_abort(ieee);
13437 + ieee80211_associate_abort_rtl7(ieee);
13438 }
13439 }
13440 break;
13441 -
13442 +
13443 case IEEE80211_STYPE_ASSOC_REQ:
13444 case IEEE80211_STYPE_REASSOC_REQ:
13445 -
13446 +
13447 if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
13448 ieee->iw_mode == IW_MODE_MASTER)
13449 -
13450 - ieee80211_rx_assoc_rq(ieee, skb);
13451 +
13452 + ieee80211_rx_assoc_rq_rtl7(ieee, skb);
13453 break;
13454 -
13455 +
13456 case IEEE80211_STYPE_AUTH:
13457 -
13458 +
13459 if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE){
13460 - if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
13461 + if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
13462 ieee->iw_mode == IW_MODE_INFRA){
13463 -
13464 +
13465 IEEE80211_DEBUG_MGMT("Received authentication response");
13466 -
13467 - if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){
13468 +
13469 + if (0 == (errcode=auth_parse_rtl7(skb, &challenge, &chlen))){
13470 if(ieee->open_wep || !challenge){
13471 ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
13472 ieee->softmac_stats.rx_auth_rs_ok++;
13473 -
13474 - ieee80211_associate_step2(ieee);
13475 +
13476 + ieee80211_associate_step2_rtl7(ieee);
13477 }else{
13478 - ieee80211_auth_challenge(ieee, challenge, chlen);
13479 + ieee80211_auth_challenge_rtl7(ieee, challenge, chlen);
13480 }
13481 }else{
13482 ieee->softmac_stats.rx_auth_rs_err++;
13483 IEEE80211_DEBUG_MGMT("Authentication respose status code 0x%x",errcode);
13484 - ieee80211_associate_abort(ieee);
13485 + ieee80211_associate_abort_rtl7(ieee);
13486 }
13487 -
13488 +
13489 }else if (ieee->iw_mode == IW_MODE_MASTER){
13490 - ieee80211_rx_auth_rq(ieee, skb);
13491 + ieee80211_rx_auth_rq_rtl7(ieee, skb);
13492 }
13493 }
13494 break;
13495 -
13496 +
13497 case IEEE80211_STYPE_PROBE_REQ:
13498 -
13499 - if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
13500 - ((ieee->iw_mode == IW_MODE_ADHOC ||
13501 +
13502 + if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
13503 + ((ieee->iw_mode == IW_MODE_ADHOC ||
13504 ieee->iw_mode == IW_MODE_MASTER) &&
13505 ieee->state == IEEE80211_LINKED))
13506 -
13507 - ieee80211_rx_probe_rq(ieee, skb);
13508 +
13509 + ieee80211_rx_probe_rq_rtl7(ieee, skb);
13510 break;
13511 -
13512 +
13513 case IEEE80211_STYPE_DISASSOC:
13514 case IEEE80211_STYPE_DEAUTH:
13515 - /* FIXME for now repeat all the association procedure
13516 + /* FIXME for now repeat all the association procedure
13517 * both for disassociation and deauthentication
13518 */
13519 if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
13520 - ieee->state == IEEE80211_LINKED &&
13521 + ieee->state == IEEE80211_LINKED &&
13522 ieee->iw_mode == IW_MODE_INFRA){
13523 -
13524 +
13525 ieee->state = IEEE80211_ASSOCIATING;
13526 ieee->softmac_stats.reassoc++;
13527 -
13528 - notify_wx_assoc_event(ieee);
13529 -
13530 +
13531 + notify_wx_assoc_event_rtl7(ieee);
13532 +
13533 queue_work(ieee->wq, &ieee->associate_procedure_wq);
13534 }
13535 -
13536 +
13537 break;
13538 -
13539 - default:
13540 +
13541 + default:
13542 return -1;
13543 break;
13544 }
13545 -
13546 +
13547 //dev_kfree_skb_any(skb);
13548 return 0;
13549 }
13550 @@ -1602,21 +1631,21 @@
13551 * This might be useful if each fragment need it's own
13552 * descriptor, thus just keep a total free memory > than
13553 * the max fragmentation treshold is not enought.. If the
13554 - * ieee802.11 stack passed a TXB struct then you needed
13555 - * to keep N free descriptors where
13556 + * ieee802.11 stack passed a TXB struct then you needed
13557 + * to keep N free descriptors where
13558 * N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD
13559 * In this way you need just one and the 802.11 stack
13560 - * will take care of buffering fragments and pass them to
13561 + * will take care of buffering fragments and pass them to
13562 * to the driver later, when it wakes the queue.
13563 - */
13564 -
13565 -void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
13566 + */
13567 +
13568 +void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
13569 {
13570 -
13571 -
13572 +
13573 +
13574 unsigned long flags;
13575 int i;
13576 -
13577 +
13578 spin_lock_irqsave(&ieee->lock,flags);
13579 #if 0
13580 if(ieee->queue_stop){
13581 @@ -1627,13 +1656,13 @@
13582 err = 1;
13583 goto exit;
13584 }
13585 -
13586 +
13587 ieee->stats.tx_bytes+=skb->len;
13588 -
13589 -
13590 +
13591 +
13592 txb=ieee80211_skb_to_txb(ieee,skb);
13593 -
13594 -
13595 +
13596 +
13597 if(txb==NULL){
13598 IEEE80211DMESG("WW: IEEE stack failed to provide txb");
13599 //dev_kfree_skb_any(skb);
13600 @@ -1641,12 +1670,12 @@
13601 goto exit;
13602 }
13603 #endif
13604 -
13605 +
13606 /* called with 2nd parm 0, no tx mgmt lock required */
13607 - ieee80211_sta_wakeup(ieee,0);
13608 + ieee80211_sta_wakeup_rtl7(ieee,0);
13609
13610 for(i = 0; i < txb->nr_frags; i++) {
13611 -
13612 +
13613 if (ieee->queue_stop){
13614 ieee->tx_pending.txb = txb;
13615 ieee->tx_pending.frag = i;
13616 @@ -1658,29 +1687,29 @@
13617 //(i+1)<txb->nr_frags);
13618 ieee->stats.tx_packets++;
13619 ieee->stats.tx_bytes += txb->fragments[i]->len;
13620 - ieee->dev->trans_start = jiffies;
13621 + ieee->dev->trans_start = jiffies;
13622 }
13623 - }
13624 -
13625 - ieee80211_txb_free(txb);
13626 -
13627 + }
13628 +
13629 + ieee80211_txb_free_rtl7(txb);
13630 +
13631 exit:
13632 spin_unlock_irqrestore(&ieee->lock,flags);
13633 -
13634 +
13635 }
13636
13637 /* called with ieee->lock acquired */
13638 -void ieee80211_resume_tx(struct ieee80211_device *ieee)
13639 +void ieee80211_resume_tx_rtl7(struct ieee80211_device *ieee)
13640 {
13641 int i;
13642 for(i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) {
13643 -
13644 +
13645 if (ieee->queue_stop){
13646 ieee->tx_pending.frag = i;
13647 return;
13648 }else{
13649 -
13650 - ieee->softmac_data_hard_start_xmit(
13651 +
13652 + ieee->softmac_data_hard_start_xmit(
13653 ieee->tx_pending.txb->fragments[i],
13654 ieee->dev,ieee->rate);
13655 //(i+1)<ieee->tx_pending.txb->nr_frags);
13656 @@ -1688,21 +1717,21 @@
13657 ieee->dev->trans_start = jiffies;
13658 }
13659 }
13660 -
13661 -
13662 - ieee80211_txb_free(ieee->tx_pending.txb);
13663 +
13664 +
13665 + ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
13666 ieee->tx_pending.txb = NULL;
13667 }
13668
13669
13670 -void ieee80211_reset_queue(struct ieee80211_device *ieee)
13671 +void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee)
13672 {
13673 unsigned long flags;
13674 -
13675 +
13676 spin_lock_irqsave(&ieee->lock,flags);
13677 - init_mgmt_queue(ieee);
13678 + init_mgmt_queue_rtl7(ieee);
13679 if (ieee->tx_pending.txb){
13680 - ieee80211_txb_free(ieee->tx_pending.txb);
13681 + ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
13682 ieee->tx_pending.txb = NULL;
13683 }
13684 ieee->queue_stop = 0;
13685 @@ -1710,23 +1739,23 @@
13686
13687 }
13688
13689 -void ieee80211_wake_queue(struct ieee80211_device *ieee)
13690 +void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee)
13691 {
13692
13693 unsigned long flags;
13694 struct sk_buff *skb;
13695 struct ieee80211_hdr_3addr *header;
13696 -
13697 +
13698 spin_lock_irqsave(&ieee->lock,flags);
13699 if (! ieee->queue_stop) goto exit;
13700 -
13701 +
13702 ieee->queue_stop = 0;
13703 -
13704 +
13705 if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){
13706 - while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){
13707 -
13708 + while (!ieee->queue_stop && (skb = dequeue_mgmt_rtl7(ieee))){
13709 +
13710 header = (struct ieee80211_hdr_3addr *) skb->data;
13711 -
13712 +
13713 header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
13714
13715 if (ieee->seq_ctrl == 0xFFF)
13716 @@ -1738,19 +1767,19 @@
13717 }
13718 }
13719 if (!ieee->queue_stop && ieee->tx_pending.txb)
13720 - ieee80211_resume_tx(ieee);
13721 -
13722 + ieee80211_resume_tx_rtl7(ieee);
13723 +
13724 if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){
13725 ieee->softmac_stats.swtxawake++;
13726 netif_wake_queue(ieee->dev);
13727 }
13728 -
13729 +
13730 exit :
13731 spin_unlock_irqrestore(&ieee->lock,flags);
13732 }
13733
13734
13735 -void ieee80211_stop_queue(struct ieee80211_device *ieee)
13736 +void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee)
13737 {
13738 //unsigned long flags;
13739 //spin_lock_irqsave(&ieee->lock,flags);
13740 @@ -1761,81 +1790,88 @@
13741 }
13742 ieee->queue_stop = 1;
13743 //spin_unlock_irqrestore(&ieee->lock,flags);
13744 -
13745 +
13746 }
13747
13748
13749 -inline void ieee80211_randomize_cell(struct ieee80211_device *ieee)
13750 +inline void ieee80211_randomize_cell_rtl7(struct ieee80211_device *ieee)
13751 {
13752 -
13753 +
13754 get_random_bytes(ieee->current_network.bssid, ETH_ALEN);
13755 -
13756 +
13757 /* an IBSS cell address must have the two less significant
13758 - * bits of the first byte = 2
13759 + * bits of the first byte = 2
13760 */
13761 ieee->current_network.bssid[0] &= ~0x01;
13762 ieee->current_network.bssid[0] |= 0x02;
13763 }
13764
13765 /* called in user context only */
13766 -void ieee80211_start_master_bss(struct ieee80211_device *ieee)
13767 +void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee)
13768 {
13769 ieee->assoc_id = 1;
13770 -
13771 +
13772 if (ieee->current_network.ssid_len == 0){
13773 - strncpy(ieee->current_network.ssid,
13774 + strncpy(ieee->current_network.ssid,
13775 IEEE80211_DEFAULT_TX_ESSID,
13776 IW_ESSID_MAX_SIZE);
13777 -
13778 +
13779 ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
13780 ieee->ssid_set = 1;
13781 }
13782 -
13783 +
13784 memcpy(ieee->current_network.bssid, ieee->dev->dev_addr, ETH_ALEN);
13785 -
13786 +
13787 ieee->set_chan(ieee->dev, ieee->current_network.channel);
13788 ieee->state = IEEE80211_LINKED;
13789 ieee->link_change(ieee->dev);
13790 - notify_wx_assoc_event(ieee);
13791 -
13792 + notify_wx_assoc_event_rtl7(ieee);
13793 +
13794 if (ieee->data_hard_resume)
13795 ieee->data_hard_resume(ieee->dev);
13796 -
13797 +
13798 netif_carrier_on(ieee->dev);
13799 }
13800
13801 -void ieee80211_start_monitor_mode(struct ieee80211_device *ieee)
13802 +void ieee80211_start_monitor_mode_rtl7(struct ieee80211_device *ieee)
13803 {
13804 if(ieee->raw_tx){
13805 -
13806 +
13807 if (ieee->data_hard_resume)
13808 ieee->data_hard_resume(ieee->dev);
13809 -
13810 +
13811 netif_carrier_on(ieee->dev);
13812 }
13813 }
13814 -void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
13815 +
13816 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
13817 +void ieee80211_start_ibss_wq_rtl7(struct work_struct *work)
13818 +{
13819 + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, start_ibss_wq);
13820 +#else
13821 +void ieee80211_start_ibss_wq_rtl7(struct ieee80211_device *ieee)
13822 {
13823 -
13824 +#endif
13825 +
13826 /* iwconfig mode ad-hoc will schedule this and return
13827 * on the other hand this will block further iwconfig SET
13828 * operations because of the wx_sem hold.
13829 * Anyway some most set operations set a flag to speed-up
13830 - * (abort) this wq (when syncro scanning) before sleeping
13831 + * (abort) this wq (when syncro scanning) before sleeping
13832 * on the semaphore
13833 */
13834 -
13835 +
13836 down(&ieee->wx_sem);
13837 -
13838 +
13839 if (ieee->current_network.ssid_len == 0){
13840 strcpy(ieee->current_network.ssid,IEEE80211_DEFAULT_TX_ESSID);
13841 ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
13842 ieee->ssid_set = 1;
13843 - }
13844 -
13845 + }
13846 +
13847 /* check if we have this cell in our network list */
13848 - ieee80211_softmac_check_all_nets(ieee);
13849 -
13850 + ieee80211_softmac_check_all_nets_rtl7(ieee);
13851 +
13852 /* if not then the state is not linked. Maybe the user swithced to
13853 * ad-hoc mode just after being in monitor mode, or just after
13854 * being very few time in managed mode (so the card have had no
13855 @@ -1851,29 +1887,29 @@
13856 * associated.
13857 */
13858 if (ieee->state == IEEE80211_NOLINK)
13859 - ieee80211_start_scan_syncro(ieee);
13860 + ieee80211_start_scan_syncro_rtl7(ieee);
13861
13862 /* the network definitively is not here.. create a new cell */
13863 if (ieee->state == IEEE80211_NOLINK){
13864 - printk("creating new IBSS cell\n");
13865 + printk("creating new IBSS cell\n");
13866 if(!ieee->wap_set)
13867 - ieee80211_randomize_cell(ieee);
13868 -
13869 + ieee80211_randomize_cell_rtl7(ieee);
13870 +
13871 if(ieee->modulation & IEEE80211_CCK_MODULATION){
13872 -
13873 +
13874 ieee->current_network.rates_len = 4;
13875 -
13876 +
13877 ieee->current_network.rates[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB;
13878 ieee->current_network.rates[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB;
13879 ieee->current_network.rates[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
13880 ieee->current_network.rates[3] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
13881 -
13882 +
13883 }else
13884 ieee->current_network.rates_len = 0;
13885 -
13886 +
13887 if(ieee->modulation & IEEE80211_OFDM_MODULATION){
13888 ieee->current_network.rates_ex_len = 8;
13889 -
13890 +
13891 ieee->current_network.rates_ex[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
13892 ieee->current_network.rates_ex[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_9MB;
13893 ieee->current_network.rates_ex[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_12MB;
13894 @@ -1882,44 +1918,44 @@
13895 ieee->current_network.rates_ex[5] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
13896 ieee->current_network.rates_ex[6] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
13897 ieee->current_network.rates_ex[7] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
13898 -
13899 - ieee->rate = 540;
13900 +
13901 +// ieee->rate = 540;
13902 }else{
13903 ieee->current_network.rates_ex_len = 0;
13904 - ieee->rate = 110;
13905 +// ieee->rate = 110;
13906 }
13907 -
13908 +
13909 ieee->current_network.atim_window = 0;
13910 ieee->current_network.capability = WLAN_CAPABILITY_IBSS;
13911 if(ieee->short_slot)
13912 ieee->current_network.capability |= WLAN_CAPABILITY_SHORT_SLOT;
13913 -
13914 +
13915 }
13916 -
13917 +
13918 ieee->state = IEEE80211_LINKED;
13919 -
13920 +
13921 ieee->set_chan(ieee->dev, ieee->current_network.channel);
13922 ieee->link_change(ieee->dev);
13923 -
13924 - notify_wx_assoc_event(ieee);
13925 -
13926 - ieee80211_start_send_beacons(ieee);
13927 -
13928 +
13929 + notify_wx_assoc_event_rtl7(ieee);
13930 +
13931 + ieee80211_start_send_beacons_rtl7(ieee);
13932 +
13933 if (ieee->data_hard_resume)
13934 ieee->data_hard_resume(ieee->dev);
13935 -
13936 +
13937 netif_carrier_on(ieee->dev);
13938 -
13939 +
13940 up(&ieee->wx_sem);
13941 }
13942
13943 -inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
13944 +inline void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee)
13945 {
13946 queue_work(ieee->wq, &ieee->start_ibss_wq);
13947 }
13948
13949 /* this is called only in user context, with wx_sem held */
13950 -void ieee80211_start_bss(struct ieee80211_device *ieee)
13951 +void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee)
13952 {
13953 unsigned long flags;
13954 /* check if we have already found the net we
13955 @@ -1927,8 +1963,8 @@
13956 * if not (we are disassociated and we are not
13957 * in associating / authenticating phase) start the background scanning.
13958 */
13959 - ieee80211_softmac_check_all_nets(ieee);
13960 -
13961 + ieee80211_softmac_check_all_nets_rtl7(ieee);
13962 +
13963 /* ensure no-one start an associating process (thus setting
13964 * the ieee->state to ieee80211_ASSOCIATING) while we
13965 * have just cheked it and we are going to enable scan.
13966 @@ -1937,41 +1973,49 @@
13967 * the rx path), so we cannot be in the middle of such function
13968 */
13969 spin_lock_irqsave(&ieee->lock, flags);
13970 -
13971 if (ieee->state == IEEE80211_NOLINK)
13972 - ieee80211_start_scan(ieee);
13973 -
13974 + ieee80211_start_scan_rtl7(ieee);
13975 +
13976 spin_unlock_irqrestore(&ieee->lock, flags);
13977 }
13978
13979 /* called only in userspace context */
13980 -void ieee80211_disassociate(struct ieee80211_device *ieee)
13981 +void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee)
13982 {
13983 netif_carrier_off(ieee->dev);
13984 -
13985 +
13986 if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)
13987 - ieee80211_reset_queue(ieee);
13988 -
13989 + ieee80211_reset_queue_rtl7(ieee);
13990 +
13991 if (ieee->data_hard_stop)
13992 ieee->data_hard_stop(ieee->dev);
13993 -
13994 +
13995 ieee->state = IEEE80211_NOLINK;
13996 ieee->link_change(ieee->dev);
13997 - notify_wx_assoc_event(ieee);
13998 -
13999 + notify_wx_assoc_event_rtl7(ieee);
14000 +
14001 }
14002 -void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
14003 +
14004 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
14005 +void ieee80211_associate_retry_wq_rtl7(struct work_struct *work)
14006 +{
14007 + struct delayed_work *dwork = container_of(work, struct delayed_work, work);
14008 + struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
14009 +#else
14010 +void ieee80211_associate_retry_wq_rtl7(struct ieee80211_device *ieee)
14011 {
14012 +#endif
14013 unsigned long flags;
14014 -
14015 +
14016 down(&ieee->wx_sem);
14017 +
14018 if(!ieee->proto_started)
14019 goto exit;
14020 -
14021 +
14022 if(ieee->state != IEEE80211_ASSOCIATING_RETRY)
14023 goto exit;
14024 -
14025 - /* until we do not set the state to IEEE80211_NOLINK
14026 +
14027 + /* until we do not set the state to IEEE80211_NOLINK
14028 * there are no possibility to have someone else trying
14029 * to start an association procdure (we get here with
14030 * ieee->state = IEEE80211_ASSOCIATING).
14031 @@ -1981,122 +2025,120 @@
14032 * RX path works with ieee->lock held so there are no
14033 * problems. If we are still disassociated then start a scan.
14034 * the lock here is necessary to ensure no one try to start
14035 - * an association procedure when we have just checked the
14036 + * an association procedure when we have just checked the
14037 * state and we are going to start the scan.
14038 */
14039 ieee->state = IEEE80211_NOLINK;
14040
14041 - ieee80211_softmac_check_all_nets(ieee);
14042 -
14043 + ieee80211_softmac_check_all_nets_rtl7(ieee);
14044 +
14045 spin_lock_irqsave(&ieee->lock, flags);
14046 -
14047 +
14048 if(ieee->state == IEEE80211_NOLINK)
14049 - ieee80211_start_scan(ieee);
14050 -
14051 + ieee80211_start_scan_rtl7(ieee);
14052 +
14053 spin_unlock_irqrestore(&ieee->lock, flags);
14054
14055 exit:
14056 up(&ieee->wx_sem);
14057 }
14058
14059 -struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee)
14060 +struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee)
14061 {
14062 u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff};
14063 -
14064 +
14065 struct sk_buff *skb;
14066 struct ieee80211_probe_response *b;
14067 -
14068 - skb = ieee80211_probe_resp(ieee, broadcast_addr);
14069 -
14070 - if (!skb)
14071 +
14072 + skb = ieee80211_probe_resp_rtl7(ieee, broadcast_addr);
14073 +
14074 + if (!skb)
14075 return NULL;
14076 -
14077 +
14078 b = (struct ieee80211_probe_response *) skb->data;
14079 b->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_BEACON);
14080 -
14081 +
14082 return skb;
14083 -
14084 +
14085 }
14086
14087 -struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee)
14088 +struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee)
14089 {
14090 struct sk_buff *skb;
14091 struct ieee80211_probe_response *b;
14092 -
14093 - skb = ieee80211_get_beacon_(ieee);
14094 - if(!skb)
14095 +
14096 + skb = ieee80211_get_beacon__rtl7(ieee);
14097 + if(!skb)
14098 return NULL;
14099 -
14100 - b = (struct ieee80211_probe_response *) skb->data;
14101 +
14102 + b = (struct ieee80211_probe_response *) skb->data;
14103 b->header.seq_ctrl = cpu_to_le16(ieee->seq_ctrl << 4);
14104 -
14105 +
14106 if (ieee->seq_ctrl == 0xFFF)
14107 ieee->seq_ctrl = 0;
14108 else
14109 ieee->seq_ctrl++;
14110 -
14111 +
14112 return skb;
14113 }
14114
14115 -void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee)
14116 +void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee)
14117 {
14118 ieee->sync_scan_hurryup = 1;
14119 down(&ieee->wx_sem);
14120 - ieee80211_stop_protocol(ieee);
14121 +
14122 + ieee80211_stop_protocol_rtl7(ieee);
14123 up(&ieee->wx_sem);
14124 }
14125
14126
14127 -void ieee80211_stop_protocol(struct ieee80211_device *ieee)
14128 +void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee)
14129 {
14130 if (!ieee->proto_started)
14131 return;
14132 -
14133 +
14134 ieee->proto_started = 0;
14135 -
14136 - ieee80211_stop_send_beacons(ieee);
14137 -
14138 +
14139 + ieee80211_stop_send_beacons_rtl7(ieee);
14140 +
14141 del_timer_sync(&ieee->associate_timer);
14142 - cancel_delayed_work(&ieee->associate_retry_wq);
14143 -
14144 - ieee80211_stop_scan(ieee);
14145 + cancel_delayed_work(&ieee->associate_retry_wq);
14146 +
14147 + ieee80211_stop_scan_rtl7(ieee);
14148
14149 - ieee80211_disassociate(ieee);
14150 + ieee80211_disassociate_rtl7(ieee);
14151 }
14152
14153 -void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee)
14154 +void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee)
14155 {
14156 ieee->sync_scan_hurryup = 0;
14157 down(&ieee->wx_sem);
14158 - ieee80211_start_protocol(ieee);
14159 + ieee80211_start_protocol_rtl7(ieee);
14160 up(&ieee->wx_sem);
14161 }
14162
14163 -void ieee80211_start_protocol(struct ieee80211_device *ieee)
14164 +void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee)
14165 {
14166 short ch = 0;
14167 -
14168 if (ieee->proto_started)
14169 return;
14170 -
14171 +
14172 ieee->proto_started = 1;
14173 -
14174 +
14175 if (ieee->current_network.channel == 0){
14176 do{
14177 ch++;
14178 - if (ch > MAX_CHANNEL_NUMBER)
14179 + if (ch > MAX_CHANNEL_NUMBER)
14180 return; /* no channel found */
14181 -
14182 +
14183 }while(!ieee->channel_map[ch]);
14184 -
14185 +
14186 ieee->current_network.channel = ch;
14187 }
14188 -
14189 +
14190 if (ieee->current_network.beacon_interval == 0)
14191 ieee->current_network.beacon_interval = 100;
14192 -
14193 ieee->set_chan(ieee->dev,ieee->current_network.channel);
14194 -
14195 ieee->last_seq_num = -1;
14196 ieee->last_frag_num = -1;
14197 ieee->last_packet_time = 0;
14198 @@ -2107,30 +2149,27 @@
14199 * attempts does not fail just because the user provide the essid
14200 * and the nic is still checking for the AP MAC ??
14201 */
14202 -
14203 +
14204 if (ieee->iw_mode == IW_MODE_INFRA)
14205 - ieee80211_start_bss(ieee);
14206 -
14207 + ieee80211_start_bss_rtl7(ieee);
14208 else if (ieee->iw_mode == IW_MODE_ADHOC)
14209 - ieee80211_start_ibss(ieee);
14210 -
14211 + ieee80211_start_ibss_rtl7(ieee);
14212 else if (ieee->iw_mode == IW_MODE_MASTER)
14213 - ieee80211_start_master_bss(ieee);
14214 -
14215 + ieee80211_start_master_bss_rtl7(ieee);
14216 else if(ieee->iw_mode == IW_MODE_MONITOR)
14217 - ieee80211_start_monitor_mode(ieee);
14218 + ieee80211_start_monitor_mode_rtl7(ieee);
14219 }
14220
14221
14222 #define DRV_NAME "Ieee80211"
14223 -void ieee80211_softmac_init(struct ieee80211_device *ieee)
14224 +void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee)
14225 {
14226 memset(&ieee->current_network, 0, sizeof(struct ieee80211_network));
14227 -
14228 +
14229 ieee->state = IEEE80211_NOLINK;
14230 ieee->sync_scan_hurryup = 0;
14231 ieee->seq_ctrl = 0;
14232 -
14233 +
14234 ieee->assoc_id = 0;
14235 ieee->queue_stop = 0;
14236 ieee->scanning = 0;
14237 @@ -2142,66 +2181,75 @@
14238 ieee->rate = 3;
14239 ieee->ps = IEEE80211_PS_DISABLED;
14240 ieee->sta_sleep = 0;
14241 -
14242 - init_mgmt_queue(ieee);
14243 +
14244 + init_mgmt_queue_rtl7(ieee);
14245 #if 0
14246 init_timer(&ieee->scan_timer);
14247 ieee->scan_timer.data = (unsigned long)ieee;
14248 ieee->scan_timer.function = ieee80211_softmac_scan_cb;
14249 #endif
14250 ieee->tx_pending.txb = NULL;
14251 -
14252 +
14253 init_timer(&ieee->associate_timer);
14254 ieee->associate_timer.data = (unsigned long)ieee;
14255 - ieee->associate_timer.function = ieee80211_associate_abort_cb;
14256 + ieee->associate_timer.function = ieee80211_associate_abort_cb_rtl7;
14257
14258 init_timer(&ieee->beacon_timer);
14259 ieee->beacon_timer.data = (unsigned long) ieee;
14260 - ieee->beacon_timer.function = ieee80211_send_beacon_cb;
14261 -
14262 + ieee->beacon_timer.function = ieee80211_send_beacon_cb_rtl7;
14263 +
14264 #ifdef PF_SYNCTHREAD
14265 ieee->wq = create_workqueue(DRV_NAME,0);
14266 -#else
14267 +#else
14268 ieee->wq = create_workqueue(DRV_NAME);
14269 #endif
14270 -
14271 - INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
14272 - INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
14273 - INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
14274 - INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
14275 - INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
14276 - INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
14277 -
14278 +
14279 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
14280 + INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq_rtl7,ieee);
14281 + INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq_rtl7,ieee);
14282 + INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq_rtl7,ieee);
14283 + INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq_rtl7,ieee);
14284 + INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq_rtl7,ieee);
14285 + INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq_rtl7,ieee);
14286 +#else
14287 + INIT_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq_rtl7);
14288 + INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq_rtl7);
14289 + INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq_rtl7);
14290 + INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq_rtl7);
14291 + INIT_DELAYED_WORK(&ieee->softmac_scan_wq, ieee80211_softmac_scan_wq_rtl7);
14292 + INIT_WORK(&ieee->wx_sync_scan_wq, ieee80211_wx_sync_scan_wq_rtl7);
14293 +#endif
14294 +
14295 sema_init(&ieee->wx_sem, 1);
14296 sema_init(&ieee->scan_sem, 1);
14297 -
14298 +
14299 spin_lock_init(&ieee->mgmt_tx_lock);
14300 spin_lock_init(&ieee->beacon_lock);
14301 -
14302 +
14303 tasklet_init(&ieee->ps_task,
14304 - (void(*)(unsigned long)) ieee80211_sta_ps,
14305 + (void(*)(unsigned long)) ieee80211_sta_ps_rtl7,
14306 (unsigned long)ieee);
14307
14308 }
14309
14310 -void ieee80211_softmac_free(struct ieee80211_device *ieee)
14311 +void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee)
14312 {
14313 down(&ieee->wx_sem);
14314 -
14315 +
14316 del_timer_sync(&ieee->associate_timer);
14317 cancel_delayed_work(&ieee->associate_retry_wq);
14318 destroy_workqueue(ieee->wq);
14319 -
14320 +
14321 up(&ieee->wx_sem);
14322 }
14323
14324 -/********************************************************
14325 +/********************************************************
14326 * Start of WPA code. *
14327 * this is stolen from the ipw2200 driver *
14328 ********************************************************/
14329
14330 -
14331 -static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value)
14332 +
14333 +static int ieee80211_wpa_enable_rtl7(struct ieee80211_device *ieee, int value)
14334 {
14335 /* This is called when wpa_supplicant loads and closes the driver
14336 * interface. */
14337 @@ -2210,19 +2258,19 @@
14338 return 0;
14339 }
14340
14341 -
14342 -void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
14343 +
14344 +void ieee80211_wpa_assoc_frame_rtl7(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
14345 {
14346 /* make sure WPA is enabled */
14347 - ieee80211_wpa_enable(ieee, 1);
14348 + ieee80211_wpa_enable_rtl7(ieee, 1);
14349
14350 - ieee80211_disassociate(ieee);
14351 + ieee80211_disassociate_rtl7(ieee);
14352 }
14353
14354
14355 -static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason)
14356 +static int ieee80211_wpa_mlme_rtl7(struct ieee80211_device *ieee, int command, int reason)
14357 {
14358 -
14359 +
14360 int ret = 0;
14361
14362 switch (command) {
14363 @@ -2231,7 +2279,7 @@
14364 break;
14365
14366 case IEEE_MLME_STA_DISASSOC:
14367 - ieee80211_disassociate(ieee);
14368 + ieee80211_disassociate_rtl7(ieee);
14369 break;
14370
14371 default:
14372 @@ -2243,7 +2291,7 @@
14373 }
14374
14375
14376 -static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee,
14377 +static int ieee80211_wpa_set_wpa_ie_rtl7(struct ieee80211_device *ieee,
14378 struct ieee_param *param, int plen)
14379 {
14380 u8 *buf;
14381 @@ -2267,16 +2315,16 @@
14382 ieee->wpa_ie_len = 0;
14383 }
14384
14385 - ieee80211_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
14386 + ieee80211_wpa_assoc_frame_rtl7(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
14387 return 0;
14388 }
14389
14390 #define AUTH_ALG_OPEN_SYSTEM 0x1
14391 #define AUTH_ALG_SHARED_KEY 0x2
14392
14393 -static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value)
14394 +static int ieee80211_wpa_set_auth_algs_rtl7(struct ieee80211_device *ieee, int value)
14395 {
14396 -
14397 +
14398 struct ieee80211_security sec = {
14399 .flags = SEC_AUTH_MODE,
14400 };
14401 @@ -2300,13 +2348,13 @@
14402
14403
14404
14405 -static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value)
14406 +static int ieee80211_wpa_set_param_rtl7(struct ieee80211_device *ieee, u8 name, u32 value)
14407 {
14408 int ret=0;
14409
14410 switch (name) {
14411 case IEEE_PARAM_WPA_ENABLED:
14412 - ret = ieee80211_wpa_enable(ieee, value);
14413 + ret = ieee80211_wpa_enable_rtl7(ieee, value);
14414 break;
14415
14416 case IEEE_PARAM_TKIP_COUNTERMEASURES:
14417 @@ -2351,7 +2399,7 @@
14418 break;
14419
14420 case IEEE_PARAM_AUTH_ALGS:
14421 - ret = ieee80211_wpa_set_auth_algs(ieee, value);
14422 + ret = ieee80211_wpa_set_auth_algs_rtl7(ieee, value);
14423 break;
14424
14425 case IEEE_PARAM_IEEE_802_1X:
14426 @@ -2368,11 +2416,11 @@
14427
14428 /* implementation borrowed from hostap driver */
14429
14430 -static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
14431 +static int ieee80211_wpa_set_encryption_rtl7(struct ieee80211_device *ieee,
14432 struct ieee_param *param, int param_len)
14433 {
14434 int ret = 0;
14435 -
14436 +
14437 struct ieee80211_crypto_ops *ops;
14438 struct ieee80211_crypt_data **crypt;
14439
14440 @@ -2407,7 +2455,7 @@
14441 //sec.encrypt = 0;
14442 sec.level = SEC_LEVEL_0;
14443 sec.flags |= SEC_ENABLED | SEC_LEVEL;
14444 - ieee80211_crypt_delayed_deinit(ieee, crypt);
14445 + ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
14446 }
14447 goto done;
14448 }
14449 @@ -2421,16 +2469,16 @@
14450 strcmp(param->u.crypt.alg, "TKIP"))
14451 goto skip_host_crypt;
14452
14453 - ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
14454 + ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
14455 if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
14456 - request_module("ieee80211_crypt_wep");
14457 - ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
14458 + request_module("ieee80211_crypt_wep_rtl");
14459 + ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
14460 } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {
14461 - request_module("ieee80211_crypt_tkip");
14462 - ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
14463 + request_module("ieee80211_crypt_tkip_rtl");
14464 + ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
14465 } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {
14466 - request_module("ieee80211_crypt_ccmp");
14467 - ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
14468 + request_module("ieee80211_crypt_ccmp_rtl");
14469 + ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
14470 }
14471 if (ops == NULL) {
14472 printk("unknown crypto alg '%s'\n", param->u.crypt.alg);
14473 @@ -2442,7 +2490,7 @@
14474 if (*crypt == NULL || (*crypt)->ops != ops) {
14475 struct ieee80211_crypt_data *new_crypt;
14476
14477 - ieee80211_crypt_delayed_deinit(ieee, crypt);
14478 + ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
14479
14480 new_crypt = (struct ieee80211_crypt_data *)
14481 kmalloc(sizeof(*new_crypt), GFP_KERNEL);
14482 @@ -2525,7 +2573,7 @@
14483
14484
14485
14486 -int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p)
14487 +int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p)
14488 {
14489 struct ieee_param *param;
14490 int ret=0;
14491 @@ -2537,7 +2585,7 @@
14492 ret = -EINVAL;
14493 goto out;
14494 }
14495 -
14496 +
14497 param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
14498 if (param == NULL){
14499 ret = -ENOMEM;
14500 @@ -2552,20 +2600,20 @@
14501 switch (param->cmd) {
14502
14503 case IEEE_CMD_SET_WPA_PARAM:
14504 - ret = ieee80211_wpa_set_param(ieee, param->u.wpa_param.name,
14505 + ret = ieee80211_wpa_set_param_rtl7(ieee, param->u.wpa_param.name,
14506 param->u.wpa_param.value);
14507 break;
14508
14509 case IEEE_CMD_SET_WPA_IE:
14510 - ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->length);
14511 + ret = ieee80211_wpa_set_wpa_ie_rtl7(ieee, param, p->length);
14512 break;
14513
14514 case IEEE_CMD_SET_ENCRYPTION:
14515 - ret = ieee80211_wpa_set_encryption(ieee, param, p->length);
14516 + ret = ieee80211_wpa_set_encryption_rtl7(ieee, param, p->length);
14517 break;
14518
14519 case IEEE_CMD_MLME:
14520 - ret = ieee80211_wpa_mlme(ieee, param->u.mlme.command,
14521 + ret = ieee80211_wpa_mlme_rtl7(ieee, param->u.mlme.command,
14522 param->u.mlme.reason_code);
14523 break;
14524
14525 @@ -2581,11 +2629,11 @@
14526 kfree(param);
14527 out:
14528 up(&ieee->wx_sem);
14529 -
14530 +
14531 return ret;
14532 }
14533
14534 -void notify_wx_assoc_event(struct ieee80211_device *ieee)
14535 +void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee)
14536 {
14537 union iwreq_data wrqu;
14538 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
14539 @@ -2597,14 +2645,14 @@
14540 }
14541
14542
14543 -EXPORT_SYMBOL(ieee80211_get_beacon);
14544 -EXPORT_SYMBOL(ieee80211_wake_queue);
14545 -EXPORT_SYMBOL(ieee80211_stop_queue);
14546 -EXPORT_SYMBOL(ieee80211_reset_queue);
14547 -EXPORT_SYMBOL(ieee80211_softmac_stop_protocol);
14548 -EXPORT_SYMBOL(ieee80211_softmac_start_protocol);
14549 -EXPORT_SYMBOL(ieee80211_is_shortslot);
14550 -EXPORT_SYMBOL(ieee80211_is_54g);
14551 -EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl);
14552 -EXPORT_SYMBOL(ieee80211_ps_tx_ack);
14553 -//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame);
14554 +EXPORT_SYMBOL(ieee80211_get_beacon_rtl7);
14555 +EXPORT_SYMBOL(ieee80211_wake_queue_rtl7);
14556 +EXPORT_SYMBOL(ieee80211_stop_queue_rtl7);
14557 +EXPORT_SYMBOL(ieee80211_reset_queue_rtl7);
14558 +EXPORT_SYMBOL(ieee80211_softmac_stop_protocol_rtl7);
14559 +EXPORT_SYMBOL(ieee80211_softmac_start_protocol_rtl7);
14560 +EXPORT_SYMBOL(ieee80211_is_shortslot_rtl7);
14561 +EXPORT_SYMBOL(ieee80211_is_54g_rtl7);
14562 +EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl_rtl7);
14563 +EXPORT_SYMBOL(ieee80211_ps_tx_ack_rtl7);
14564 +//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame_rtl7);
14565 diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac_wx.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac_wx.c
14566 --- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac_wx.c 2006-06-06 04:57:54.000000000 +0200
14567 +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac_wx.c 2008-01-30 17:38:11.000000000 +0100
14568 @@ -1,7 +1,7 @@
14569 /* IEEE 802.11 SoftMAC layer
14570 * Copyright (c) 2005 Andrea Merello <[email protected]>
14571 *
14572 - * Mostly extracted from the rtl8180-sa2400 driver for the
14573 + * Mostly extracted from the rtl8180-sa2400 driver for the
14574 * in-kernel generic ieee802.11 stack.
14575 *
14576 * Some pieces of code might be stolen from ipw2100 driver
14577 @@ -18,23 +18,23 @@
14578
14579 /* FIXME: add A freqs */
14580
14581 -const long ieee80211_wlan_frequencies[] = {
14582 - 2412, 2417, 2422, 2427,
14583 - 2432, 2437, 2442, 2447,
14584 - 2452, 2457, 2462, 2467,
14585 - 2472, 2484
14586 +const long ieee80211_wlan_frequencies_rtl7[] = {
14587 + 2412, 2417, 2422, 2427,
14588 + 2432, 2437, 2442, 2447,
14589 + 2452, 2457, 2462, 2467,
14590 + 2472, 2484
14591 };
14592
14593
14594 -int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
14595 +int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
14596 union iwreq_data *wrqu, char *b)
14597 {
14598 int ret;
14599 struct iw_freq *fwrq = & wrqu->freq;
14600
14601 down(&ieee->wx_sem);
14602 -
14603 - if(ieee->iw_mode == IW_MODE_INFRA){
14604 +
14605 + if(ieee->iw_mode == IW_MODE_INFRA){
14606 ret = -EOPNOTSUPP;
14607 goto out;
14608 }
14609 @@ -45,31 +45,31 @@
14610 fwrq->m <= (int) 2.487e8)) {
14611 int f = fwrq->m / 100000;
14612 int c = 0;
14613 -
14614 - while ((c < 14) && (f != ieee80211_wlan_frequencies[c]))
14615 +
14616 + while ((c < 14) && (f != ieee80211_wlan_frequencies_rtl7[c]))
14617 c++;
14618 -
14619 +
14620 /* hack to fall through */
14621 fwrq->e = 0;
14622 fwrq->m = c + 1;
14623 }
14624 }
14625 -
14626 - if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
14627 +
14628 + if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
14629 ret = -EOPNOTSUPP;
14630 goto out;
14631 -
14632 +
14633 }else { /* Set the channel */
14634 -
14635 -
14636 +
14637 +
14638 ieee->current_network.channel = fwrq->m;
14639 ieee->set_chan(ieee->dev, ieee->current_network.channel);
14640 -
14641 +
14642 if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
14643 if(ieee->state == IEEE80211_LINKED){
14644 -
14645 - ieee80211_stop_send_beacons(ieee);
14646 - ieee80211_start_send_beacons(ieee);
14647 +
14648 + ieee80211_stop_send_beacons_rtl7(ieee);
14649 + ieee80211_start_send_beacons_rtl7(ieee);
14650 }
14651 }
14652
14653 @@ -80,7 +80,7 @@
14654 }
14655
14656
14657 -int ieee80211_wx_get_freq(struct ieee80211_device *ieee,
14658 +int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee,
14659 struct iw_request_info *a,
14660 union iwreq_data *wrqu, char *b)
14661 {
14662 @@ -88,110 +88,110 @@
14663
14664 if (ieee->current_network.channel == 0)
14665 return -1;
14666 -
14667 +
14668 fwrq->m = ieee->current_network.channel;
14669 fwrq->e = 0;
14670 -
14671 +
14672 return 0;
14673 }
14674
14675 -int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
14676 - struct iw_request_info *info,
14677 +int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
14678 + struct iw_request_info *info,
14679 union iwreq_data *wrqu, char *extra)
14680 {
14681 - unsigned long flags;
14682 -
14683 + unsigned long flags;
14684 +
14685 wrqu->ap_addr.sa_family = ARPHRD_ETHER;
14686 -
14687 +
14688 if (ieee->iw_mode == IW_MODE_MONITOR)
14689 return -1;
14690 -
14691 +
14692 /* We want avoid to give to the user inconsistent infos*/
14693 spin_lock_irqsave(&ieee->lock, flags);
14694 -
14695 - if (ieee->state != IEEE80211_LINKED &&
14696 +
14697 + if (ieee->state != IEEE80211_LINKED &&
14698 ieee->state != IEEE80211_LINKED_SCANNING &&
14699 ieee->wap_set == 0)
14700 -
14701 +
14702 memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
14703 else
14704 - memcpy(wrqu->ap_addr.sa_data,
14705 + memcpy(wrqu->ap_addr.sa_data,
14706 ieee->current_network.bssid, ETH_ALEN);
14707 -
14708 +
14709 spin_unlock_irqrestore(&ieee->lock, flags);
14710 -
14711 +
14712 return 0;
14713 }
14714
14715
14716 -int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
14717 +int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
14718 struct iw_request_info *info,
14719 union iwreq_data *awrq,
14720 char *extra)
14721 {
14722 -
14723 +
14724 int ret = 0;
14725 u8 zero[] = {0,0,0,0,0,0};
14726 unsigned long flags;
14727 -
14728 +
14729 + struct sockaddr *temp = NULL;
14730 short ifup = ieee->proto_started;//dev->flags & IFF_UP;
14731 -
14732 +
14733 ieee->sync_scan_hurryup = 1;
14734 -
14735 +
14736 down(&ieee->wx_sem);
14737 -
14738 - struct sockaddr *temp = (struct sockaddr *)awrq;
14739 -
14740 +
14741 + temp = (struct sockaddr *)awrq;
14742 /* use ifconfig hw ether */
14743 if (ieee->iw_mode == IW_MODE_MASTER){
14744 ret = -1;
14745 goto out;
14746 }
14747 -
14748 +
14749 if (temp->sa_family != ARPHRD_ETHER){
14750 ret = -EINVAL;
14751 goto out;
14752 }
14753 -
14754 +
14755 if (ifup)
14756 - ieee80211_stop_protocol(ieee);
14757 -
14758 + ieee80211_stop_protocol_rtl7(ieee);
14759 +
14760 /* just to avoid to give inconsistent infos in the
14761 - * get wx method. not really needed otherwise
14762 + * get wx method. not really needed otherwise
14763 */
14764 spin_lock_irqsave(&ieee->lock, flags);
14765 -
14766 - memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
14767 +
14768 + memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
14769 ieee->wap_set = memcmp(temp->sa_data, zero,ETH_ALEN)!=0;
14770 -
14771 +
14772 spin_unlock_irqrestore(&ieee->lock, flags);
14773 -
14774 +
14775 if (ifup)
14776 - ieee80211_start_protocol(ieee);
14777 -
14778 + ieee80211_start_protocol_rtl7(ieee);
14779 +
14780 out:
14781 up(&ieee->wx_sem);
14782 return ret;
14783 }
14784 -
14785 - int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
14786 +
14787 + int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
14788 {
14789 int len,ret = 0;
14790 unsigned long flags;
14791 -
14792 +
14793 if (ieee->iw_mode == IW_MODE_MONITOR)
14794 return -1;
14795 -
14796 - /* We want avoid to give to the user inconsistent infos*/
14797 +
14798 + /* We want avoid to give to the user inconsistent infos*/
14799 spin_lock_irqsave(&ieee->lock, flags);
14800 -
14801 +
14802 if (ieee->current_network.ssid[0] == '\0' ||
14803 - ieee->current_network.ssid_len == 0){
14804 + ieee->current_network.ssid_len == 0){
14805 ret = -1;
14806 goto out;
14807 }
14808 -
14809 - if (ieee->state != IEEE80211_LINKED &&
14810 +
14811 + if (ieee->state != IEEE80211_LINKED &&
14812 ieee->state != IEEE80211_LINKED_SCANNING &&
14813 ieee->ssid_set == 0){
14814 ret = -1;
14815 @@ -204,59 +204,76 @@
14816
14817 out:
14818 spin_unlock_irqrestore(&ieee->lock, flags);
14819 -
14820 +
14821 return ret;
14822 -
14823 +
14824 }
14825
14826 -int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
14827 +int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
14828 struct iw_request_info *info,
14829 union iwreq_data *wrqu, char *extra)
14830 {
14831
14832 u32 target_rate = wrqu->bitrate.value;
14833 -
14834 +
14835 ieee->rate = target_rate/100000;
14836 //FIXME: we might want to limit rate also in management protocols.
14837 - return 0;
14838 + return 0;
14839 }
14840
14841
14842
14843 -int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
14844 - struct iw_request_info *info,
14845 +int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
14846 + struct iw_request_info *info,
14847 union iwreq_data *wrqu, char *extra)
14848 {
14849 -
14850 +
14851 wrqu->bitrate.value = ieee->rate * 100000;
14852 -
14853 +
14854 return 0;
14855 }
14856
14857 -int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
14858 +int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
14859 union iwreq_data *wrqu, char *b)
14860 {
14861 -
14862 + short prev = ieee->raw_tx;
14863 +
14864 ieee->sync_scan_hurryup = 1;
14865 -
14866 +
14867 down(&ieee->wx_sem);
14868 -
14869 +
14870 if (wrqu->mode == ieee->iw_mode)
14871 goto out;
14872 -
14873 +
14874 if (wrqu->mode == IW_MODE_MONITOR){
14875 -
14876 - ieee->dev->type = ARPHRD_IEEE80211;
14877 + ieee->dev->type = ARPHRD_IEEE80211_PRISM;
14878 }else{
14879 ieee->dev->type = ARPHRD_ETHER;
14880 }
14881 -
14882 +
14883 if (!ieee->proto_started){
14884 ieee->iw_mode = wrqu->mode;
14885 }else{
14886 - ieee80211_stop_protocol(ieee);
14887 + ieee80211_stop_protocol_rtl7(ieee);
14888 ieee->iw_mode = wrqu->mode;
14889 - ieee80211_start_protocol(ieee);
14890 + ieee80211_start_protocol_rtl7(ieee);
14891 + }
14892 +
14893 + if(ieee->iw_mode == IW_MODE_MONITOR)
14894 + {
14895 + ieee->raw_tx = 1;
14896 + if(prev == 0 && ieee->raw_tx){
14897 + if (ieee->data_hard_resume)
14898 + ieee->data_hard_resume(ieee->dev);
14899 +
14900 + netif_carrier_on(ieee->dev);
14901 + }
14902 +
14903 + netif_carrier_on(ieee->dev);
14904 + }
14905 + else
14906 + {
14907 + ieee->raw_tx = 0;
14908 }
14909
14910 out:
14911 @@ -264,120 +281,132 @@
14912 return 0;
14913 }
14914
14915 -void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
14916 +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
14917 +void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work)
14918 {
14919 + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
14920 +#else
14921 +void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee)
14922 +{
14923 +#endif
14924 short chan;
14925
14926 chan = ieee->current_network.channel;
14927 -
14928 +
14929 netif_carrier_off(ieee->dev);
14930 -
14931 +
14932 if (ieee->data_hard_stop)
14933 ieee->data_hard_stop(ieee->dev);
14934 -
14935 - ieee80211_stop_send_beacons(ieee);
14936 -
14937 +
14938 + ieee80211_stop_send_beacons_rtl7(ieee);
14939 +
14940 ieee->state = IEEE80211_LINKED_SCANNING;
14941 ieee->link_change(ieee->dev);
14942 -
14943 - ieee80211_start_scan_syncro(ieee);
14944 -
14945 +
14946 + ieee80211_start_scan_syncro_rtl7(ieee);
14947 +
14948 ieee->set_chan(ieee->dev, chan);
14949 -
14950 +
14951 ieee->state = IEEE80211_LINKED;
14952 ieee->link_change(ieee->dev);
14953 -
14954 +
14955 if (ieee->data_hard_resume)
14956 ieee->data_hard_resume(ieee->dev);
14957 -
14958 +
14959 if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
14960 - ieee80211_start_send_beacons(ieee);
14961 -
14962 + ieee80211_start_send_beacons_rtl7(ieee);
14963 +
14964 netif_carrier_on(ieee->dev);
14965 -
14966 +
14967 up(&ieee->wx_sem);
14968 -
14969 +
14970 }
14971
14972 -int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
14973 +int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
14974 union iwreq_data *wrqu, char *b)
14975 {
14976 int ret = 0;
14977 -
14978 +
14979 down(&ieee->wx_sem);
14980 -
14981 - if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
14982 +
14983 + if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
14984 ret = -1;
14985 goto out;
14986 }
14987 -
14988 +
14989 if ( ieee->state == IEEE80211_LINKED){
14990 queue_work(ieee->wq, &ieee->wx_sync_scan_wq);
14991 /* intentionally forget to up sem */
14992 return 0;
14993 }
14994 -
14995 +
14996 out:
14997 up(&ieee->wx_sem);
14998 return ret;
14999 }
15000
15001 -int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
15002 +int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
15003 struct iw_request_info *a,
15004 union iwreq_data *wrqu, char *extra)
15005 {
15006 -
15007 +
15008 int ret=0,len;
15009 short proto_started;
15010 unsigned long flags;
15011 -
15012 +
15013 ieee->sync_scan_hurryup = 1;
15014 -
15015 +
15016 down(&ieee->wx_sem);
15017 -
15018 +
15019 proto_started = ieee->proto_started;
15020 -
15021 +
15022 if (wrqu->essid.length > IW_ESSID_MAX_SIZE){
15023 ret= -E2BIG;
15024 goto out;
15025 }
15026 -
15027 +
15028 if (ieee->iw_mode == IW_MODE_MONITOR){
15029 ret= -1;
15030 goto out;
15031 }
15032 -
15033 +
15034 if(proto_started)
15035 - ieee80211_stop_protocol(ieee);
15036 -
15037 + ieee80211_stop_protocol_rtl7(ieee);
15038 +
15039 /* this is just to be sure that the GET wx callback
15040 * has consisten infos. not needed otherwise
15041 */
15042 spin_lock_irqsave(&ieee->lock, flags);
15043 -
15044 +
15045 if (wrqu->essid.flags && wrqu->essid.length) {
15046 +#if WIRELESS_EXT > 20
15047 + len = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE);
15048 +#else
15049 len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
15050 -
15051 +#endif
15052 +
15053 strncpy(ieee->current_network.ssid, extra, len);
15054 ieee->current_network.ssid_len = len;
15055 ieee->ssid_set = 1;
15056 }
15057 - else{
15058 + else{
15059 ieee->ssid_set = 0;
15060 ieee->current_network.ssid[0] = '\0';
15061 ieee->current_network.ssid_len = 0;
15062 }
15063 -
15064 +
15065 spin_unlock_irqrestore(&ieee->lock, flags);
15066 -
15067 +
15068 if (proto_started)
15069 - ieee80211_start_protocol(ieee);
15070 + ieee80211_start_protocol_rtl7(ieee);
15071 out:
15072 up(&ieee->wx_sem);
15073 +
15074 +
15075 return ret;
15076 }
15077
15078 - int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
15079 + int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
15080 union iwreq_data *wrqu, char *b)
15081 {
15082
15083 @@ -385,23 +414,23 @@
15084 return 0;
15085 }
15086
15087 - int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
15088 - struct iw_request_info *info,
15089 + int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
15090 + struct iw_request_info *info,
15091 union iwreq_data *wrqu, char *extra)
15092 {
15093 -
15094 +
15095 int *parms = (int *)extra;
15096 int enable = (parms[0] > 0);
15097 short prev = ieee->raw_tx;
15098
15099 down(&ieee->wx_sem);
15100 -
15101 - if(enable)
15102 +
15103 + if(enable)
15104 ieee->raw_tx = 1;
15105 - else
15106 + else
15107 ieee->raw_tx = 0;
15108
15109 - printk(KERN_INFO"raw TX is %s\n",
15110 + printk(KERN_INFO"raw TX is %s\n",
15111 ieee->raw_tx ? "enabled" : "disabled");
15112
15113 if(ieee->iw_mode == IW_MODE_MONITOR)
15114 @@ -409,21 +438,21 @@
15115 if(prev == 0 && ieee->raw_tx){
15116 if (ieee->data_hard_resume)
15117 ieee->data_hard_resume(ieee->dev);
15118 -
15119 - netif_carrier_on(ieee->dev);
15120 +
15121 + netif_carrier_on(ieee->dev);
15122 }
15123 -
15124 +
15125 if(prev && ieee->raw_tx == 1)
15126 - netif_carrier_off(ieee->dev);
15127 + netif_carrier_off(ieee->dev);
15128 }
15129 -
15130 +
15131 up(&ieee->wx_sem);
15132 -
15133 +
15134 return 0;
15135 }
15136 -
15137 -int ieee80211_wx_get_name(struct ieee80211_device *ieee,
15138 - struct iw_request_info *info,
15139 +
15140 +int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
15141 + struct iw_request_info *info,
15142 union iwreq_data *wrqu, char *extra)
15143 {
15144 strcpy(wrqu->name, "802.11");
15145 @@ -433,20 +462,20 @@
15146 strcat(wrqu->name, "/g");
15147 }else if(ieee->modulation & IEEE80211_OFDM_MODULATION)
15148 strcat(wrqu->name, "g");
15149 -
15150 - if((ieee->state == IEEE80211_LINKED) ||
15151 +
15152 + if((ieee->state == IEEE80211_LINKED) ||
15153 (ieee->state == IEEE80211_LINKED_SCANNING))
15154 strcat(wrqu->name," linked");
15155 else if(ieee->state != IEEE80211_NOLINK)
15156 strcat(wrqu->name," link..");
15157 -
15158 -
15159 +
15160 +
15161 return 0;
15162 }
15163
15164
15165 /* this is mostly stolen from hostap */
15166 -int ieee80211_wx_set_power(struct ieee80211_device *ieee,
15167 +int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
15168 struct iw_request_info *info,
15169 union iwreq_data *wrqu, char *extra)
15170 {
15171 @@ -457,50 +486,50 @@
15172 (!ieee->ps_request_tx_ack) ||
15173 (!ieee->enter_sleep_state) ||
15174 (!ieee->ps_is_queue_empty)){
15175 -
15176 +
15177 printk("ERROR. PS mode is tryied to be use but\
15178 -driver missed a callback\n\n");
15179 -
15180 +driver missed a callback\n\n");
15181 +
15182 return -1;
15183 }
15184 -
15185 +
15186 down(&ieee->wx_sem);
15187 -
15188 +
15189 if (wrqu->power.disabled){
15190 ieee->ps = IEEE80211_PS_DISABLED;
15191 -
15192 +
15193 goto exit;
15194 }
15195 switch (wrqu->power.flags & IW_POWER_MODE) {
15196 case IW_POWER_UNICAST_R:
15197 ieee->ps = IEEE80211_PS_UNICAST;
15198 -
15199 +
15200 break;
15201 case IW_POWER_ALL_R:
15202 - ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
15203 + ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
15204 break;
15205 -
15206 +
15207 case IW_POWER_ON:
15208 ieee->ps = IEEE80211_PS_DISABLED;
15209 break;
15210 -
15211 +
15212 default:
15213 ret = -EINVAL;
15214 goto exit;
15215 }
15216
15217 if (wrqu->power.flags & IW_POWER_TIMEOUT) {
15218 -
15219 +
15220 ieee->ps_timeout = wrqu->power.value / 1000;
15221 printk("Timeout %d\n",ieee->ps_timeout);
15222 }
15223 -
15224 +
15225 if (wrqu->power.flags & IW_POWER_PERIOD) {
15226 -
15227 +
15228 ret = -EOPNOTSUPP;
15229 goto exit;
15230 //wrq->value / 1024;
15231 -
15232 +
15233 }
15234 exit:
15235 up(&ieee->wx_sem);
15236 @@ -509,15 +538,15 @@
15237 }
15238
15239 /* this is stolen from hostap */
15240 -int ieee80211_wx_get_power(struct ieee80211_device *ieee,
15241 +int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
15242 struct iw_request_info *info,
15243 union iwreq_data *wrqu, char *extra)
15244 {
15245 int ret =0;
15246 -
15247 +
15248 down(&ieee->wx_sem);
15249 -
15250 - if(ieee->ps == IEEE80211_PS_DISABLED){
15251 +
15252 + if(ieee->ps == IEEE80211_PS_DISABLED){
15253 wrqu->power.disabled = 1;
15254 goto exit;
15255 }
15256 @@ -547,19 +576,19 @@
15257
15258 }
15259
15260 -EXPORT_SYMBOL(ieee80211_wx_get_essid);
15261 -EXPORT_SYMBOL(ieee80211_wx_set_essid);
15262 -EXPORT_SYMBOL(ieee80211_wx_set_rate);
15263 -EXPORT_SYMBOL(ieee80211_wx_get_rate);
15264 -EXPORT_SYMBOL(ieee80211_wx_set_wap);
15265 -EXPORT_SYMBOL(ieee80211_wx_get_wap);
15266 -EXPORT_SYMBOL(ieee80211_wx_set_mode);
15267 -EXPORT_SYMBOL(ieee80211_wx_get_mode);
15268 -EXPORT_SYMBOL(ieee80211_wx_set_scan);
15269 -EXPORT_SYMBOL(ieee80211_wx_get_freq);
15270 -EXPORT_SYMBOL(ieee80211_wx_set_freq);
15271 -EXPORT_SYMBOL(ieee80211_wx_set_rawtx);
15272 -EXPORT_SYMBOL(ieee80211_wx_get_name);
15273 -EXPORT_SYMBOL(ieee80211_wx_set_power);
15274 -EXPORT_SYMBOL(ieee80211_wx_get_power);
15275 -EXPORT_SYMBOL(ieee80211_wlan_frequencies);
15276 +EXPORT_SYMBOL(ieee80211_wx_get_essid_rtl7);
15277 +EXPORT_SYMBOL(ieee80211_wx_set_essid_rtl7);
15278 +EXPORT_SYMBOL(ieee80211_wx_set_rate_rtl7);
15279 +EXPORT_SYMBOL(ieee80211_wx_get_rate_rtl7);
15280 +EXPORT_SYMBOL(ieee80211_wx_set_wap_rtl7);
15281 +EXPORT_SYMBOL(ieee80211_wx_get_wap_rtl7);
15282 +EXPORT_SYMBOL(ieee80211_wx_set_mode_rtl7);
15283 +EXPORT_SYMBOL(ieee80211_wx_get_mode_rtl7);
15284 +EXPORT_SYMBOL(ieee80211_wx_set_scan_rtl7);
15285 +EXPORT_SYMBOL(ieee80211_wx_get_freq_rtl7);
15286 +EXPORT_SYMBOL(ieee80211_wx_set_freq_rtl7);
15287 +EXPORT_SYMBOL(ieee80211_wx_set_rawtx_rtl7);
15288 +EXPORT_SYMBOL(ieee80211_wx_get_name_rtl7);
15289 +EXPORT_SYMBOL(ieee80211_wx_set_power_rtl7);
15290 +EXPORT_SYMBOL(ieee80211_wx_get_power_rtl7);
15291 +EXPORT_SYMBOL(ieee80211_wlan_frequencies_rtl7);
15292 diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_tx.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_tx.c
15293 --- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_tx.c 2006-06-06 04:57:54.000000000 +0200
15294 +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_tx.c 2008-01-30 17:38:11.000000000 +0100
15295 @@ -24,15 +24,14 @@
15296
15297 ******************************************************************************
15298
15299 - Few modifications for Realtek's Wi-Fi drivers by
15300 + Few modifications for Realtek's Wi-Fi drivers by
15301 Andrea Merello <[email protected]>
15302 -
15303 - A special thanks goes to Realtek for their support !
15304 +
15305 + A special thanks goes to Realtek for their support !
15306
15307 ******************************************************************************/
15308
15309 #include <linux/compiler.h>
15310 -#include <linux/config.h>
15311 #include <linux/errno.h>
15312 #include <linux/if_arp.h>
15313 #include <linux/in6.h>
15314 @@ -52,6 +51,12 @@
15315 #include <linux/etherdevice.h>
15316 #include <asm/uaccess.h>
15317
15318 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
15319 +#include <linux/config.h>
15320 +#else
15321 +#include <linux/autoconf.h>
15322 +#endif
15323 +
15324 #include "ieee80211.h"
15325
15326
15327 @@ -155,7 +160,7 @@
15328 static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
15329 static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
15330
15331 -static inline int ieee80211_put_snap(u8 *data, u16 h_proto)
15332 +static inline int ieee80211_put_snap_rtl7(u8 *data, u16 h_proto)
15333 {
15334 struct ieee80211_snap_hdr *snap;
15335 u8 *oui;
15336 @@ -178,7 +183,7 @@
15337 return SNAP_SIZE + sizeof(u16);
15338 }
15339
15340 -int ieee80211_encrypt_fragment(
15341 +int ieee80211_encrypt_fragment_rtl7(
15342 struct ieee80211_device *ieee,
15343 struct sk_buff *frag,
15344 int hdr_len)
15345 @@ -225,7 +230,7 @@
15346 }
15347
15348
15349 -void ieee80211_txb_free(struct ieee80211_txb *txb) {
15350 +void ieee80211_txb_free_rtl7(struct ieee80211_txb *txb) {
15351 int i;
15352 if (unlikely(!txb))
15353 return;
15354 @@ -235,7 +240,7 @@
15355 kfree(txb);
15356 }
15357
15358 -struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
15359 +struct ieee80211_txb *ieee80211_alloc_txb_rtl7(int nr_frags, int txb_size,
15360 int gfp_mask)
15361 {
15362 struct ieee80211_txb *txb;
15363 @@ -267,7 +272,7 @@
15364 }
15365
15366 /* SKBs are added to the ieee->tx_queue. */
15367 -int ieee80211_xmit(struct sk_buff *skb,
15368 +int ieee80211_xmit_rtl7(struct sk_buff *skb,
15369 struct net_device *dev)
15370 {
15371 struct ieee80211_device *ieee = netdev_priv(dev);
15372 @@ -299,27 +304,27 @@
15373 }
15374
15375 if(likely(ieee->raw_tx == 0)){
15376 -
15377 +
15378 if (unlikely(skb->len < SNAP_SIZE + sizeof(u16))) {
15379 printk(KERN_WARNING "%s: skb too small (%d).\n",
15380 ieee->dev->name, skb->len);
15381 goto success;
15382 }
15383 -
15384 -
15385 +
15386 +
15387 ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto);
15388 -
15389 +
15390 crypt = ieee->crypt[ieee->tx_keyidx];
15391 -
15392 +
15393 encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) &&
15394 ieee->host_encrypt && crypt && crypt->ops;
15395 -
15396 +
15397 if (!encrypt && ieee->ieee802_1x &&
15398 ieee->drop_unencrypted && ether_type != ETH_P_PAE) {
15399 stats->tx_dropped++;
15400 goto success;
15401 }
15402 -
15403 +
15404 #ifdef CONFIG_IEEE80211_DEBUG
15405 if (crypt && !encrypt && ether_type == ETH_P_PAE) {
15406 struct eapol *eap = (struct eapol *)(skb->data +
15407 @@ -328,23 +333,23 @@
15408 eap_get_type(eap->type));
15409 }
15410 #endif
15411 -
15412 +
15413 /* Save source and destination addresses */
15414 memcpy(&dest, skb->data, ETH_ALEN);
15415 memcpy(&src, skb->data+ETH_ALEN, ETH_ALEN);
15416 -
15417 +
15418 /* Advance the SKB to the start of the payload */
15419 skb_pull(skb, sizeof(struct ethhdr));
15420 -
15421 +
15422 /* Determine total amount of storage required for TXB packets */
15423 bytes = skb->len + SNAP_SIZE + sizeof(u16);
15424 -
15425 +
15426 if (encrypt)
15427 fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA |
15428 IEEE80211_FCTL_WEP;
15429 else
15430 fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA;
15431 -
15432 +
15433 if (ieee->iw_mode == IW_MODE_INFRA) {
15434 fc |= IEEE80211_FCTL_TODS;
15435 /* To DS: Addr1 = BSSID, Addr2 = SA,
15436 @@ -360,9 +365,9 @@
15437 memcpy(&header.addr3, ieee->current_network.bssid, ETH_ALEN);
15438 }
15439 header.frame_ctl = cpu_to_le16(fc);
15440 -
15441 +
15442 hdr_len = IEEE80211_3ADDR_LEN;
15443 -
15444 +
15445 /* Determine fragmentation size based on destination (multicast
15446 * and broadcast are not fragmented) */
15447 if (is_multicast_ether_addr(dest) ||
15448 @@ -370,7 +375,7 @@
15449 frag_size = MAX_FRAG_THRESHOLD;
15450 else
15451 frag_size = ieee->fts;
15452 -
15453 +
15454 /* Determine amount of payload per fragment. Regardless of if
15455 * this stack is providing the full 802.11 header, one will
15456 * eventually be affixed to this fragment -- so we must account for
15457 @@ -379,12 +384,12 @@
15458 if (ieee->config &
15459 (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
15460 bytes_per_frag -= IEEE80211_FCS_LEN;
15461 -
15462 +
15463 /* Each fragment may need to have room for encryptiong pre/postfix */
15464 if (encrypt)
15465 bytes_per_frag -= crypt->ops->extra_prefix_len +
15466 crypt->ops->extra_postfix_len;
15467 -
15468 +
15469 /* Number of fragments is the total bytes_per_frag /
15470 * payload_per_fragment */
15471 nr_frags = bytes / bytes_per_frag;
15472 @@ -393,11 +398,11 @@
15473 nr_frags++;
15474 else
15475 bytes_last_frag = bytes_per_frag;
15476 -
15477 +
15478 /* When we allocate the TXB we allocate enough space for the reserve
15479 * and full fragment bytes (bytes_per_frag doesn't include prefix,
15480 * postfix, header, FCS, etc.) */
15481 - txb = ieee80211_alloc_txb(nr_frags, frag_size, GFP_ATOMIC);
15482 + txb = ieee80211_alloc_txb_rtl7(nr_frags, frag_size, GFP_ATOMIC);
15483 if (unlikely(!txb)) {
15484 printk(KERN_WARNING "%s: Could not allocate TXB\n",
15485 ieee->dev->name);
15486 @@ -405,93 +410,94 @@
15487 }
15488 txb->encrypted = encrypt;
15489 txb->payload_size = bytes;
15490 -
15491 +
15492 for (i = 0; i < nr_frags; i++) {
15493 skb_frag = txb->fragments[i];
15494 -
15495 +
15496 if (encrypt)
15497 skb_reserve(skb_frag, crypt->ops->extra_prefix_len);
15498 -
15499 +
15500 frag_hdr = (struct ieee80211_hdr *)skb_put(skb_frag, hdr_len);
15501 memcpy(frag_hdr, &header, hdr_len);
15502 -
15503 +
15504 /* If this is not the last fragment, then add the MOREFRAGS
15505 * bit to the frame control */
15506 if (i != nr_frags - 1) {
15507 frag_hdr->frame_ctl = cpu_to_le16(
15508 fc | IEEE80211_FCTL_MOREFRAGS);
15509 bytes = bytes_per_frag;
15510 -
15511 +
15512 } else {
15513 /* The last fragment takes the remaining length */
15514 bytes = bytes_last_frag;
15515 }
15516 -
15517 +
15518 frag_hdr->seq_ctl = cpu_to_le16(ieee->seq_ctrl<<4 | i);
15519 -
15520 -
15521 +
15522 +
15523 /* Put a SNAP header on the first fragment */
15524 if (i == 0) {
15525 - ieee80211_put_snap(
15526 + ieee80211_put_snap_rtl7(
15527 skb_put(skb_frag, SNAP_SIZE + sizeof(u16)),
15528 ether_type);
15529 bytes -= SNAP_SIZE + sizeof(u16);
15530 }
15531 -
15532 +
15533 memcpy(skb_put(skb_frag, bytes), skb->data, bytes);
15534 -
15535 +
15536 /* Advance the SKB... */
15537 skb_pull(skb, bytes);
15538 -
15539 +
15540 /* Encryption routine will move the header forward in order
15541 * to insert the IV between the header and the payload */
15542 if (encrypt)
15543 - ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
15544 + ieee80211_encrypt_fragment_rtl7(ieee, skb_frag, hdr_len);
15545 if (ieee->config &
15546 (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
15547 skb_put(skb_frag, 4);
15548 }
15549 - // Advance sequence number in data frame.
15550 + // Advance sequence number in data frame.
15551 if (ieee->seq_ctrl == 0xFFF)
15552 ieee->seq_ctrl = 0;
15553 else
15554 ieee->seq_ctrl++;
15555 //---
15556 }else{
15557 - if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
15558 +// if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
15559 + if (unlikely(skb->len < 14)) {
15560 printk(KERN_WARNING "%s: skb too small (%d).\n",
15561 ieee->dev->name, skb->len);
15562 goto success;
15563 }
15564 -
15565 - txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC);
15566 +
15567 + txb = ieee80211_alloc_txb_rtl7(1, skb->len, GFP_ATOMIC);
15568 if(!txb){
15569 printk(KERN_WARNING "%s: Could not allocate TXB\n",
15570 ieee->dev->name);
15571 goto failed;
15572 }
15573 -
15574 +
15575 txb->encrypted = 0;
15576 txb->payload_size = skb->len;
15577 memcpy(skb_put(txb->fragments[0],skb->len), skb->data, skb->len);
15578 - }
15579 + }
15580
15581 success:
15582 spin_unlock_irqrestore(&ieee->lock, flags);
15583 dev_kfree_skb_any(skb);
15584 if (txb) {
15585 if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE){
15586 - ieee80211_softmac_xmit(txb, ieee);
15587 + ieee80211_softmac_xmit_rtl7(txb, ieee);
15588 }else{
15589 if ((*ieee->hard_start_xmit)(txb, dev) == 0) {
15590 stats->tx_packets++;
15591 stats->tx_bytes += txb->payload_size;
15592 return 0;
15593 }
15594 - ieee80211_txb_free(txb);
15595 + ieee80211_txb_free_rtl7(txb);
15596 }
15597 -
15598 -
15599 +
15600 +
15601 }
15602
15603 return 0;
15604 @@ -504,4 +510,4 @@
15605
15606 }
15607
15608 -EXPORT_SYMBOL(ieee80211_txb_free);
15609 +EXPORT_SYMBOL(ieee80211_txb_free_rtl7);
15610 diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_wx.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_wx.c
15611 --- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_wx.c 2006-06-06 04:57:56.000000000 +0200
15612 +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_wx.c 2008-01-30 17:38:11.000000000 +0100
15613 @@ -40,7 +40,7 @@
15614 };
15615
15616 #define MAX_CUSTOM_LEN 64
15617 -static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
15618 +static inline char *ipw2100_translate_scan_rtl7(struct ieee80211_device *ieee,
15619 char *start, char *stop,
15620 struct ieee80211_network *network)
15621 {
15622 @@ -207,7 +207,7 @@
15623 return start;
15624 }
15625
15626 -int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
15627 +int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
15628 struct iw_request_info *info,
15629 union iwreq_data *wrqu, char *extra)
15630 {
15631 @@ -220,13 +220,14 @@
15632
15633 IEEE80211_DEBUG_WX("Getting scan\n");
15634 down(&ieee->wx_sem);
15635 + printk("GOT WX GET SCAN WX_SEM LOCK");
15636 spin_lock_irqsave(&ieee->lock, flags);
15637
15638 list_for_each_entry(network, &ieee->network_list, list) {
15639 i++;
15640 if (ieee->scan_age == 0 ||
15641 time_after(network->last_scanned + ieee->scan_age, jiffies))
15642 - ev = ipw2100_translate_scan(ieee, ev, stop, network);
15643 + ev = ipw2100_translate_scan_rtl7(ieee, ev, stop, network);
15644 else
15645 IEEE80211_DEBUG_SCAN(
15646 "Not showing network '%s ("
15647 @@ -247,7 +248,7 @@
15648 return 0;
15649 }
15650
15651 -int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
15652 +int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
15653 struct iw_request_info *info,
15654 union iwreq_data *wrqu, char *keybuf)
15655 {
15656 @@ -259,6 +260,9 @@
15657 int i, key, key_provided, len;
15658 struct ieee80211_crypt_data **crypt;
15659
15660 + if (erq->flags & IW_ENCODE_RESTRICTED)
15661 + return -EINVAL;
15662 +
15663 IEEE80211_DEBUG_WX("SET_ENCODE\n");
15664
15665 key = erq->flags & IW_ENCODE_INDEX;
15666 @@ -281,7 +285,7 @@
15667 if (key_provided && *crypt) {
15668 IEEE80211_DEBUG_WX("Disabling encryption on key %d.\n",
15669 key);
15670 - ieee80211_crypt_delayed_deinit(ieee, crypt);
15671 + ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
15672 } else
15673 IEEE80211_DEBUG_WX("Disabling encryption.\n");
15674
15675 @@ -291,7 +295,7 @@
15676 if (ieee->crypt[i] != NULL) {
15677 if (key_provided)
15678 break;
15679 - ieee80211_crypt_delayed_deinit(
15680 + ieee80211_crypt_delayed_deinit_rtl7(
15681 ieee, &ieee->crypt[i]);
15682 }
15683 }
15684 @@ -314,7 +318,7 @@
15685 strcmp((*crypt)->ops->name, "WEP") != 0) {
15686 /* changing to use WEP; deinit previously used algorithm
15687 * on this key */
15688 - ieee80211_crypt_delayed_deinit(ieee, crypt);
15689 + ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
15690 }
15691
15692 if (*crypt == NULL) {
15693 @@ -326,10 +330,10 @@
15694 if (new_crypt == NULL)
15695 return -ENOMEM;
15696 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
15697 - new_crypt->ops = ieee80211_get_crypto_ops("WEP");
15698 + new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
15699 if (!new_crypt->ops) {
15700 - request_module("ieee80211_crypt_wep");
15701 - new_crypt->ops = ieee80211_get_crypto_ops("WEP");
15702 + request_module("ieee80211_crypt_wep_rtl");
15703 + new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
15704 }
15705
15706 if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
15707 @@ -340,7 +344,7 @@
15708 new_crypt = NULL;
15709
15710 printk(KERN_WARNING "%s: could not initialize WEP: "
15711 - "load module ieee80211_crypt_wep\n",
15712 + "load module ieee80211_crypt_wep_rtl\n",
15713 dev->name);
15714 return -EOPNOTSUPP;
15715 }
15716 @@ -418,7 +422,7 @@
15717 return 0;
15718 }
15719
15720 -int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
15721 +int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
15722 struct iw_request_info *info,
15723 union iwreq_data *wrqu, char *keybuf)
15724 {
15725 @@ -430,7 +434,7 @@
15726
15727 if(ieee->iw_mode == IW_MODE_MONITOR)
15728 return -1;
15729 -
15730 +
15731 key = erq->flags & IW_ENCODE_INDEX;
15732 if (key) {
15733 if (key > WEP_KEYS)
15734 @@ -470,6 +474,6 @@
15735 }
15736
15737
15738 -EXPORT_SYMBOL(ieee80211_wx_get_scan);
15739 -EXPORT_SYMBOL(ieee80211_wx_set_encode);
15740 -EXPORT_SYMBOL(ieee80211_wx_get_encode);
15741 +EXPORT_SYMBOL(ieee80211_wx_get_scan_rtl7);
15742 +EXPORT_SYMBOL(ieee80211_wx_set_encode_rtl7);
15743 +EXPORT_SYMBOL(ieee80211_wx_get_encode_rtl7);
15744 diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/Makefile rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/Makefile
15745 --- rtl8187_linux_26.1010.0622.2006/ieee80211/Makefile 2006-06-06 04:57:54.000000000 +0200
15746 +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/Makefile 2008-01-30 17:38:11.000000000 +0100
15747 @@ -17,6 +17,7 @@
15748 KVER := $(shell uname -r)
15749 KSRC := /lib/modules/$(KVER)/build
15750 INSTALL_PREFIX :=
15751 +PWD = $(shell pwd)
15752
15753 all: modules
15754
15755 diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/Modules.symvers rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/Modules.symvers
15756 --- rtl8187_linux_26.1010.0622.2006/ieee80211/Modules.symvers 2006-06-06 04:57:56.000000000 +0200
15757 +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/Modules.symvers 1970-01-01 01:00:00.000000000 +0100
15758 @@ -1,43 +0,0 @@
15759 -0x232e7944 ieee80211_wlan_frequencies /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15760 -0xaeae102f free_ieee80211_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
15761 -0x279e265f ieee80211_crypt_deinit_handler net/ieee80211/ieee80211_crypt
15762 -0xc2411d91 ieee80211_stop_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15763 -0x6ece20e1 ieee80211_wx_get_name_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
15764 -0x5d3847ff ieee80211_rx_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15765 -0x18612027 ieee80211_wx_get_scan_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15766 -0xa0e03ce1 ieee80211_wx_get_name /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15767 -0xee25f349 ieee80211_wx_get_mode /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15768 -0x86013c3d ieee80211_wx_set_mode /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15769 -0x04493cc0 ieee80211_wx_get_rate /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15770 -0x6c6df3b4 ieee80211_wx_set_rate /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15771 -0x82caec02 ieee80211_crypt_deinit_entries net/ieee80211/ieee80211_crypt
15772 -0x347945bf ieee80211_wx_get_power /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15773 -0x6379d455 ieee80211_wx_set_power /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15774 -0xae62ed59 ieee80211_wx_set_scan /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15775 -0x6621e172 ieee80211_wx_set_freq /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15776 -0x0e052e06 ieee80211_wx_get_freq /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15777 -0x283f9f5d ieee80211_unregister_crypto_ops net/ieee80211/ieee80211_crypt
15778 -0x9da79aac ieee80211_is_shortslot /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15779 -0x666032dc ieee80211_wx_get_wap /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15780 -0x9f1cbe0e ieee80211_wx_set_wap /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15781 -0x73d1d341 ieee80211_wx_set_rawtx /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15782 -0x2c714184 ieee80211_is_54g /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15783 -0x6892d598 ieee80211_wpa_supplicant_ioctl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15784 -0xc062f1f5 ieee80211_ps_tx_ack /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15785 -0x55534906 ieee80211_get_beacon /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15786 -0xe2679638 ieee80211_crypt_delayed_deinit net/ieee80211/ieee80211_crypt
15787 -0x3a0456bc free_ieee80211 net/ieee80211/ieee80211
15788 -0x7e1ef2c8 ieee80211_wake_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15789 -0xc1b81e9f ieee80211_register_crypto_ops net/ieee80211/ieee80211_crypt
15790 -0x3f795a39 alloc_ieee80211 net/ieee80211/ieee80211
15791 -0x89803c23 ieee80211_get_crypto_ops net/ieee80211/ieee80211_crypt
15792 -0xc6caf2a4 ieee80211_txb_free net/ieee80211/ieee80211
15793 -0x49c1422c ieee80211_rx_mgt net/ieee80211/ieee80211
15794 -0xbf2b4ebd alloc_ieee80211_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
15795 -0xd155f7b8 ieee80211_softmac_stop_protocol /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15796 -0x9ce2dcde ieee80211_softmac_start_protocol /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15797 -0x00d74bba ieee80211_wx_get_encode_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15798 -0x92b5d996 ieee80211_wx_set_encode_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15799 -0x2ac9bf95 ieee80211_wx_set_essid /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15800 -0x7dc92e7f ieee80211_wx_get_essid /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15801 -0xd04740ca ieee80211_reset_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
15802 diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod
15803 --- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod 2006-06-06 04:57:54.000000000 +0200
15804 +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod 2008-02-15 00:49:47.000000000 +0100
15805 @@ -1,2 +1,2 @@
15806 -/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_ccmp-rtl.ko
15807 -/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_ccmp.o
15808 +/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_ccmp-rtl.ko
15809 +/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_ccmp.o
15810 diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod
15811 --- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod 2006-06-06 04:57:54.000000000 +0200
15812 +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod 2008-02-15 00:49:47.000000000 +0100
15813 @@ -1,2 +1,2 @@
15814 -/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt-rtl.ko
15815 -/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt.o
15816 +/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt-rtl.ko
15817 +/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.o
15818 diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod
15819 --- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod 2006-06-06 04:57:54.000000000 +0200
15820 +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod 2008-02-15 00:49:47.000000000 +0100
15821 @@ -1,2 +1,2 @@
15822 -/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_tkip-rtl.ko
15823 -/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_tkip.o
15824 +/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_tkip-rtl.ko
15825 +/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_tkip.o
15826 diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod
15827 --- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod 2006-06-06 04:57:54.000000000 +0200
15828 +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod 2008-02-15 00:49:47.000000000 +0100
15829 @@ -1,2 +1,2 @@
15830 -/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_wep-rtl.ko
15831 -/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_wep.o
15832 +/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_wep-rtl.ko
15833 +/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_wep.o
15834 diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211-rtl.mod rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211-rtl.mod
15835 --- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211-rtl.mod 2006-06-06 04:57:54.000000000 +0200
15836 +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211-rtl.mod 2008-02-15 00:49:47.000000000 +0100
15837 @@ -1,2 +1,2 @@
15838 -/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211-rtl.ko
15839 -/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_softmac.o /usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_rx.o /usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_tx.o /usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_wx.o /usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_module.o /usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_softmac_wx.o
15840 +/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211-rtl.ko
15841 +/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_rx.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_tx.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_wx.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_module.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac_wx.o
15842 diff -Naur rtl8187_linux_26.1010.0622.2006/makedrv~ rtl8187_linux_26.1010.0622.2006_rawtx/makedrv~
15843 --- rtl8187_linux_26.1010.0622.2006/makedrv~ 2006-09-05 07:21:10.000000000 +0200
15844 +++ rtl8187_linux_26.1010.0622.2006_rawtx/makedrv~ 1970-01-01 01:00:00.000000000 +0100
15845 @@ -1,13 +0,0 @@
15846 -#!/bin/sh
15847 -
15848 -#tar -zxvf stack.tar.gz
15849 -#tar -zxvf drv.tar.gz
15850 -cd ieee80211
15851 -make clean
15852 -make
15853 -cd ../beta-8187
15854 -make clean
15855 -make
15856 -cd ..
15857 -
15858 -
15859 diff -Naur rtl8187_linux_26.1010.0622.2006/Makefile rtl8187_linux_26.1010.0622.2006_rawtx/Makefile
15860 --- rtl8187_linux_26.1010.0622.2006/Makefile 1970-01-01 01:00:00.000000000 +0100
15861 +++ rtl8187_linux_26.1010.0622.2006_rawtx/Makefile 2008-01-30 17:39:29.000000000 +0100
15862 @@ -0,0 +1,38 @@
15863 +prefix = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless
15864 +r8187dir = $(prefix)/rtl8187
15865 +ieeedir = $(prefix)/rtl_ieee80211
15866 +
15867 +default: all
15868 +
15869 +all:
15870 + -rm -f ieee80211/Module.symvers 2>/dev/null
15871 + -rm -f ieee80211/Modules.symvers 2>/dev/null
15872 + $(MAKE) -C ieee80211 $(@)
15873 + -chmod +x symvers
15874 + -./symvers
15875 + $(MAKE) -C beta-8187 $(@)
15876 +
15877 +install:
15878 + install -d $(ieeedir)
15879 + install -d $(r8187dir)
15880 + install -m 644 ./ieee80211/*.ko $(ieeedir)
15881 + install -m 644 ./beta-8187/*.ko $(r8187dir)
15882 + -depmod -ae
15883 +
15884 +uninstall:
15885 + -rm -f $(ieeedir)/ieee80211-rtl.ko
15886 + -rm -f $(ieeedir)/ieee80211_crypt-rtl.ko
15887 + -rm -f $(ieeedir)/ieee80211_crypt_ccmp-rtl.ko
15888 + -rm -f $(ieeedir)/ieee80211_crypt_tkip-rtl.ko
15889 + -rm -f $(ieeedir)/ieee80211_crypt_wep-rtl.ko
15890 + -rm -f $(r8187dir)/r8187.ko
15891 + -rm -fr $(ieeedir)
15892 + -rm -fr $(r8187dir)
15893 + -depmod -ae
15894 +
15895 +clean:
15896 + $(MAKE) -C ieee80211 $(@)
15897 + $(MAKE) -C beta-8187 $(@)
15898 +
15899 +distclean: clean
15900 +
15901 diff -Naur rtl8187_linux_26.1010.0622.2006/ReadMe.txt~ rtl8187_linux_26.1010.0622.2006_rawtx/ReadMe.txt~
15902 --- rtl8187_linux_26.1010.0622.2006/ReadMe.txt~ 2006-06-06 10:58:00.000000000 +0200
15903 +++ rtl8187_linux_26.1010.0622.2006_rawtx/ReadMe.txt~ 1970-01-01 01:00:00.000000000 +0100
15904 @@ -1,129 +0,0 @@
15905 -Release Date: 2006-01-13, ver 1.1
15906 -RTL8187 Linux driver version 1.1
15907 -
15908 - --This driver supports RealTek RTL8187 Wireless LAN driver for
15909 - Fedora Core 2/3/4/5, Debian 3.1, Mandrake 10.2/Mandriva 2006,
15910 - SUSE 9.3/10.1/10.2, Gentoo 3.1, etc.
15911 - - Support Client mode for either infrastructure or adhoc mode
15912 - - Support WEP and WPAPSK connection
15913 -
15914 -< Component >
15915 -The driver is composed of several parts:
15916 - 1. Module source code
15917 - stack.tar.gz
15918 - drv.tar.gz
15919 -
15920 - 2. Script ot build the modules
15921 - makedrv
15922 -
15923 - 3. Script to load/unload modules
15924 - wlan0up
15925 - wlan0down
15926 -
15927 - 4. Script and configuration for DHCP
15928 - wlan0dhcp
15929 - ifcfg-wlan0
15930 - 4. Supplicant source code:
15931 - wpa_supplicant-0.4.9.tar.gz
15932 -
15933 - 5. Example of supplicant configuration file:
15934 - wpa1.conf
15935 -
15936 -< Installation >
15937 -Runing the scripts can finish all operations of building up modules
15938 -from the source code and start the nic.
15939 - 1. Build up the drivers from the source code
15940 - ./makedrv
15941 -
15942 - 2. load the driver module to kernel and start up nic
15943 - ./wlan0up
15944 -
15945 -< Set wireless lan MIBs >
15946 -This driver uses Wireless Extension as an interface allowing you to set
15947 -Wireless LAN specific parameters.
15948 -
15949 -Current driver supports "iwlist" to show the device status of nic
15950 - iwlist wlan0 [parameters]
15951 -where
15952 - parameter explaination [parameters]
15953 - ----------------------- -------------
15954 - Show available chan and freq freq / channel
15955 - Show and Scan BSS and IBSS scan[ning]
15956 - Show supported bit-rate rate / bit[rate]
15957 - Show Power Management mode power
15958 -
15959 -For example:
15960 - iwlist wlan0 channel
15961 - iwlist wlan0 scan
15962 - iwlist wlan0 rate
15963 - iwlist wlan0 power
15964 -
15965 -Driver also supports "iwconfig", manipulate driver private ioctls, to set
15966 -MIBs.
15967 -
15968 - iwconfig wlan0 [parameters] [val]
15969 -where
15970 - parameter explaination [parameters] [val] constraints
15971 - ----------------------- ------------- ------------------
15972 - Connect to AP by address ap [mac_addr]
15973 - Set the essid, join (I)BSS essid [essid]
15974 - Set operation mode mode {Managed|Ad-hoc}
15975 - Set keys and security mode key/enc[ryption] {N|open|restricted|off}
15976 -
15977 -For example:
15978 - iwconfig wlan0 ap XX:XX:XX:XX:XX:XX
15979 - iwconfig wlan0 essid "ap_name"
15980 - iwconfig wlan0 mode Ad-hoc
15981 - iwconfig wlan0 mode essid "name" mode Ad-hoc
15982 - iwconfig wlan0 key 0123456789 [2] open
15983 - iwconfig wlan0 key off
15984 - iwconfig wlan0 key restricted [3] 0123456789
15985 -
15986 -< Getting IP address >
15987 -After start up the nic, the network needs to obtain an IP address before
15988 -transmit/receive data.
15989 -This can be done by setting the static IP via "ifconfig wlan0 IP_ADDRESS"
15990 -command, or using DHCP.
15991 -
15992 -If using DHCP, setting steps is as below:
15993 - (1)connect to an AP via "iwconfig" settings
15994 - iwconfig wlan0 essid [name] or
15995 - iwconfig wlan0 ap XX:XX:XX:XX:XX:XX
15996 -
15997 - (2)run the script which run the dhclient
15998 - ./wlan0dhcp
15999 -
16000 -< WPAPSK >
16001 -WPA_SUPPLICANT help the network to communicate under the protection of WPAPSK
16002 -mechanism
16003 -
16004 - (1)Unpack source code of WPA supplicant:
16005 - tar -zxvf wpa_supplicant-0.4.9.tar.gz
16006 - cd wpa_supplicant-0.4.9
16007 -
16008 - (2)Create .config file:
16009 - cp defconfig .config
16010 -
16011 - (3)Edit .config file, uncomment the following line:
16012 - #CONFIG_DRIVER_IPW=y.
16013 -
16014 - (4)Build WPA supplicant:
16015 - make
16016 -
16017 - (5)Edit wpa_supplicant.conf to set up SSID and its passphrase.
16018 - For example, the following setting in "wpa1.conf" means SSID
16019 - to join is "BufAG54_Ch6" and its passphrase is "87654321".
16020 - network={
16021 - ssid="BufAG54_Ch6"
16022 - proto=WPA
16023 - key_mgmt=WPA-PSK
16024 - pairwise=CCMP TKIP
16025 - group=CCMP TKIP WEP104 WEP40
16026 - psk="87654321"
16027 - priority=2
16028 - }
16029 -
16030 - (6)Execute WPA supplicant (Assume 8187 and related modules had been
16031 - loaded):
16032 - ./wpa_supplicant -D ipw -c wpa1.conf -i wlan0 &
16033 -
16034 diff -Naur rtl8187_linux_26.1010.0622.2006/symvers rtl8187_linux_26.1010.0622.2006_rawtx/symvers
16035 --- rtl8187_linux_26.1010.0622.2006/symvers 1970-01-01 01:00:00.000000000 +0100
16036 +++ rtl8187_linux_26.1010.0622.2006_rawtx/symvers 2008-01-30 17:38:11.000000000 +0100
16037 @@ -0,0 +1,25 @@
16038 +#!/bin/sh
16039 +
16040 +cd beta-8187
16041 +
16042 +if [ -e Module.symvers ]
16043 +then
16044 + rm Module.symvers
16045 +fi
16046 +
16047 +if [ -e Modules.symvers ]
16048 +then
16049 + rm Modules.symvers
16050 +fi
16051 +
16052 +if [ -e ../ieee80211/Module.symvers ]
16053 +then
16054 + ln -sf ../ieee80211/Module.symvers ./
16055 +fi
16056 +
16057 +if [ -e ../ieee80211/Modules.symvers ]
16058 +then
16059 + ln -sf ../ieee80211/Modules.symvers ./
16060 +fi
16061 +
16062 +cd ..
16063 diff -Naur rtl8187_linux_26.1010.0622.2006/wlan0rmv rtl8187_linux_26.1010.0622.2006_rawtx/wlan0rmv
16064 --- rtl8187_linux_26.1010.0622.2006/wlan0rmv 2006-09-05 07:21:10.000000000 +0200
16065 +++ rtl8187_linux_26.1010.0622.2006_rawtx/wlan0rmv 2008-01-30 17:38:11.000000000 +0100
16066 @@ -1,5 +1,9 @@
16067 #!/bin/bash
16068
16069 -rmmod r8180
16070 -rmmod ieee80211_r8180
16071 -rmmod ieee80211_crypt_r8180
16072 +rmmod rtl8187 2>/dev/null
16073 +rmmod r8187 2>/dev/null
16074 +rmmod ieee80211_rtl 2>/dev/null
16075 +rmmod ieee80211_crypt_ccmp_rtl 2>/dev/null
16076 +rmmod ieee80211_crypt_tkip_rtl 2>/dev/null
16077 +rmmod ieee80211_crypt_wep_rtl 2>/dev/null
16078 +rmmod ieee80211_crypt_rtl 2>/dev/null