nexmon – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 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 <andreamrl@tiscali.it> |
||
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-22 15:32:50.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 <andreamrl@tiscali.it> |
||
1894 | + Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it> |
||
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,228 @@ |
||
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(!(priv->highpower) && wrqu->power.value > priv->txpwr_max) |
||
2076 | + { |
||
2077 | + ret = -EINVAL; |
||
2078 | + goto out; |
||
2079 | + } |
||
2080 | + |
||
2081 | + if(wrqu->power.value > 35) |
||
2082 | + { |
||
2083 | + ret = -EINVAL; |
||
2084 | + goto out; |
||
2085 | + } |
||
2086 | + |
||
2087 | + if(wrqu->power.value < 0) |
||
2088 | + { |
||
2089 | + ret = -EINVAL; |
||
2090 | + goto out; |
||
2091 | + } |
||
2092 | + |
||
2093 | + for(i=1;i<15;i++) |
||
2094 | + { |
||
2095 | + priv->chtxpwr[i] = priv->chtxpwr_orig[i] - (priv->txpwr_max - wrqu->power.value); |
||
2096 | +// if(priv->chtxpwr[i] > priv->chtxpwr_orig[i]) priv->chtxpwr[i] = 0; |
||
2097 | + |
||
2098 | + priv->chtxpwr_ofdm[i] = priv->chtxpwr_ofdm_orig[i] - (priv->txpwr_max - wrqu->power.value); |
||
2099 | +// if(priv->chtxpwr_ofdm[i] > priv->chtxpwr_ofdm_orig[i]) priv->chtxpwr_ofdm[i] = 0; |
||
2100 | + } |
||
2101 | + rtl8225z2_SetTXPowerLevel(dev, 1); |
||
2102 | + |
||
2103 | + out: |
||
2104 | + up(&priv->wx_sem); |
||
2105 | + |
||
2106 | return ret; |
||
2107 | - |
||
2108 | + |
||
2109 | } |
||
2110 | +#endif |
||
2111 | |||
2112 | -static int r8180_wx_set_crcmon(struct net_device *dev, |
||
2113 | - struct iw_request_info *info, |
||
2114 | +static int r8180_wx_set_crcmon(struct net_device *dev, |
||
2115 | + struct iw_request_info *info, |
||
2116 | union iwreq_data *wrqu, char *extra) |
||
2117 | { |
||
2118 | - struct r8180_priv *priv = ieee80211_priv(dev); |
||
2119 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev); |
||
2120 | int *parms = (int *)extra; |
||
2121 | int enable = (parms[0] > 0); |
||
2122 | short prev = priv->crcmon; |
||
2123 | |||
2124 | down(&priv->wx_sem); |
||
2125 | - |
||
2126 | - if(enable) |
||
2127 | + |
||
2128 | + if(enable) |
||
2129 | priv->crcmon=1; |
||
2130 | - else |
||
2131 | + else |
||
2132 | priv->crcmon=0; |
||
2133 | |||
2134 | - DMESG("bad CRC in monitor mode are %s", |
||
2135 | + DMESG("bad CRC in monitor mode are %s", |
||
2136 | priv->crcmon ? "accepted" : "rejected"); |
||
2137 | |||
2138 | if(prev != priv->crcmon && priv->up){ |
||
2139 | rtl8180_down(dev); |
||
2140 | rtl8180_up(dev); |
||
2141 | } |
||
2142 | - |
||
2143 | + |
||
2144 | + up(&priv->wx_sem); |
||
2145 | + |
||
2146 | + return 0; |
||
2147 | +} |
||
2148 | + |
||
2149 | +static int r8180_wx_set_fasttx(struct net_device *dev, |
||
2150 | + struct iw_request_info *info, |
||
2151 | + union iwreq_data *wrqu, char *extra) |
||
2152 | +{ |
||
2153 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev); |
||
2154 | + int *parms = (int *)extra; |
||
2155 | + int enable = (parms[0] > 0); |
||
2156 | + short prev = priv->fasttx; |
||
2157 | + |
||
2158 | + down(&priv->wx_sem); |
||
2159 | + |
||
2160 | + if(enable) |
||
2161 | + priv->fasttx=1; |
||
2162 | + else |
||
2163 | + priv->fasttx=0; |
||
2164 | + |
||
2165 | + DMESG("Transmission method (regarding speed) set to: %s", |
||
2166 | + priv->fasttx ? "fast" : "normal"); |
||
2167 | + |
||
2168 | + if(prev != priv->fasttx && priv->up){ |
||
2169 | + rtl8180_down(dev); |
||
2170 | + rtl8180_up(dev); |
||
2171 | + } |
||
2172 | + |
||
2173 | up(&priv->wx_sem); |
||
2174 | - |
||
2175 | + |
||
2176 | + return 0; |
||
2177 | +} |
||
2178 | + |
||
2179 | +static int r8180_wx_set_highpower(struct net_device *dev, |
||
2180 | + struct iw_request_info *info, |
||
2181 | + union iwreq_data *wrqu, char *extra) |
||
2182 | +{ |
||
2183 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev); |
||
2184 | + int *parms = (int *)extra; |
||
2185 | + int enable = (parms[0] > 0); |
||
2186 | + int i=0; |
||
2187 | + short prev = priv->highpower; |
||
2188 | + |
||
2189 | + down(&priv->wx_sem); |
||
2190 | + |
||
2191 | + if(enable) |
||
2192 | + priv->highpower=1; |
||
2193 | + else |
||
2194 | + priv->highpower=0; |
||
2195 | + |
||
2196 | + DMESG("Increasable transmission power %s", |
||
2197 | + priv->highpower ? "enabled" : "disabled"); |
||
2198 | + |
||
2199 | + if( (prev != priv->highpower) && !(priv->highpower) && (priv->chtxpwr[1] > priv->chtxpwr_orig[1]) ) |
||
2200 | + { |
||
2201 | + for(i=1;i<15;i++) |
||
2202 | + { |
||
2203 | + priv->chtxpwr[i] = priv->chtxpwr_orig[i]; |
||
2204 | + priv->chtxpwr_ofdm[i] = priv->chtxpwr_ofdm_orig[i]; |
||
2205 | + } |
||
2206 | + rtl8225z2_SetTXPowerLevel(dev, 1); |
||
2207 | + wrqu->power.value = priv->txpwr_max; |
||
2208 | + } |
||
2209 | + |
||
2210 | + up(&priv->wx_sem); |
||
2211 | + |
||
2212 | return 0; |
||
2213 | } |
||
2214 | |||
2215 | static int r8180_wx_set_mode(struct net_device *dev, struct iw_request_info *a, |
||
2216 | union iwreq_data *wrqu, char *b) |
||
2217 | { |
||
2218 | - struct r8180_priv *priv = ieee80211_priv(dev); |
||
2219 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev); |
||
2220 | int ret; |
||
2221 | - |
||
2222 | + |
||
2223 | down(&priv->wx_sem); |
||
2224 | - |
||
2225 | - ret = ieee80211_wx_set_mode(priv->ieee80211,a,wrqu,b); |
||
2226 | - |
||
2227 | + |
||
2228 | + ret = ieee80211_wx_set_mode_rtl7(priv->ieee80211,a,wrqu,b); |
||
2229 | + |
||
2230 | rtl8187_set_rxconf(dev); |
||
2231 | - |
||
2232 | + |
||
2233 | up(&priv->wx_sem); |
||
2234 | return ret; |
||
2235 | } |
||
2236 | |||
2237 | |||
2238 | -static int rtl8180_wx_get_range(struct net_device *dev, |
||
2239 | - struct iw_request_info *info, |
||
2240 | +static int rtl8180_wx_get_range(struct net_device *dev, |
||
2241 | + struct iw_request_info *info, |
||
2242 | union iwreq_data *wrqu, char *extra) |
||
2243 | { |
||
2244 | struct iw_range *range = (struct iw_range *)extra; |
||
2245 | - struct r8180_priv *priv = ieee80211_priv(dev); |
||
2246 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev); |
||
2247 | u16 val; |
||
2248 | int i; |
||
2249 | |||
2250 | @@ -186,26 +307,26 @@ |
||
2251 | /* Let's try to keep this struct in the same order as in |
||
2252 | * linux/include/wireless.h |
||
2253 | */ |
||
2254 | - |
||
2255 | + |
||
2256 | /* TODO: See what values we can set, and remove the ones we can't |
||
2257 | * set, or fill them with some default data. |
||
2258 | */ |
||
2259 | |||
2260 | /* ~5 Mb/s real (802.11b) */ |
||
2261 | - range->throughput = 5 * 1000 * 1000; |
||
2262 | + range->throughput = 5 * 1000 * 1000; |
||
2263 | |||
2264 | // TODO: Not used in 802.11b? |
||
2265 | // range->min_nwid; /* Minimal NWID we are able to set */ |
||
2266 | // TODO: Not used in 802.11b? |
||
2267 | // range->max_nwid; /* Maximal NWID we are able to set */ |
||
2268 | - |
||
2269 | + |
||
2270 | /* Old Frequency (backward compat - moved lower ) */ |
||
2271 | -// range->old_num_channels; |
||
2272 | +// range->old_num_channels; |
||
2273 | // range->old_num_frequency; |
||
2274 | // range->old_freq[6]; /* Filler to keep "version" at the same offset */ |
||
2275 | if(priv->rf_set_sens != NULL) |
||
2276 | range->sensitivity = priv->max_sens; /* signal level threshold range */ |
||
2277 | - |
||
2278 | + |
||
2279 | range->max_qual.qual = 100; |
||
2280 | /* TODO: Find real max RSSI and stick here */ |
||
2281 | range->max_qual.level = 0; |
||
2282 | @@ -219,14 +340,14 @@ |
||
2283 | range->avg_qual.updated = 7; /* Updated all three */ |
||
2284 | |||
2285 | range->num_bitrates = RATE_COUNT; |
||
2286 | - |
||
2287 | + |
||
2288 | for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) { |
||
2289 | range->bitrate[i] = rtl8180_rates[i]; |
||
2290 | } |
||
2291 | - |
||
2292 | + |
||
2293 | range->min_frag = MIN_FRAG_THRESHOLD; |
||
2294 | range->max_frag = MAX_FRAG_THRESHOLD; |
||
2295 | - |
||
2296 | + |
||
2297 | range->pm_capa = 0; |
||
2298 | |||
2299 | range->we_version_compiled = WIRELESS_EXT; |
||
2300 | @@ -243,18 +364,18 @@ |
||
2301 | range->num_channels = 14; |
||
2302 | |||
2303 | for (i = 0, val = 0; i < 14; i++) { |
||
2304 | - |
||
2305 | + |
||
2306 | // Include only legal frequencies for some countries |
||
2307 | if ((priv->challow)[i+1]) { |
||
2308 | range->freq[val].i = i + 1; |
||
2309 | - range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000; |
||
2310 | + range->freq[val].m = ieee80211_wlan_frequencies_rtl7[i] * 100000; |
||
2311 | range->freq[val].e = 1; |
||
2312 | val++; |
||
2313 | } else { |
||
2314 | // FIXME: do we need to set anything for channels |
||
2315 | // we don't use ? |
||
2316 | } |
||
2317 | - |
||
2318 | + |
||
2319 | if (val == IW_MAX_FREQUENCIES) |
||
2320 | break; |
||
2321 | } |
||
2322 | @@ -267,15 +388,15 @@ |
||
2323 | static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a, |
||
2324 | union iwreq_data *wrqu, char *b) |
||
2325 | { |
||
2326 | - struct r8180_priv *priv = ieee80211_priv(dev); |
||
2327 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev); |
||
2328 | int ret; |
||
2329 | - |
||
2330 | + |
||
2331 | if(!priv->up) return -1; |
||
2332 | - |
||
2333 | + |
||
2334 | down(&priv->wx_sem); |
||
2335 | - |
||
2336 | - ret = ieee80211_wx_set_scan(priv->ieee80211,a,wrqu,b); |
||
2337 | - |
||
2338 | + |
||
2339 | + ret = ieee80211_wx_set_scan_rtl7(priv->ieee80211,a,wrqu,b); |
||
2340 | + |
||
2341 | up(&priv->wx_sem); |
||
2342 | return ret; |
||
2343 | } |
||
2344 | @@ -286,50 +407,50 @@ |
||
2345 | { |
||
2346 | |||
2347 | int ret; |
||
2348 | - struct r8180_priv *priv = ieee80211_priv(dev); |
||
2349 | - |
||
2350 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev); |
||
2351 | + |
||
2352 | if(!priv->up) return -1; |
||
2353 | - |
||
2354 | + |
||
2355 | down(&priv->wx_sem); |
||
2356 | |||
2357 | - ret = ieee80211_wx_get_scan(priv->ieee80211,a,wrqu,b); |
||
2358 | - |
||
2359 | + ret = ieee80211_wx_get_scan_rtl7(priv->ieee80211,a,wrqu,b); |
||
2360 | + |
||
2361 | up(&priv->wx_sem); |
||
2362 | - |
||
2363 | + |
||
2364 | return ret; |
||
2365 | } |
||
2366 | |||
2367 | |||
2368 | -static int r8180_wx_set_essid(struct net_device *dev, |
||
2369 | +static int r8180_wx_set_essid(struct net_device *dev, |
||
2370 | struct iw_request_info *a, |
||
2371 | union iwreq_data *wrqu, char *b) |
||
2372 | { |
||
2373 | - struct r8180_priv *priv = ieee80211_priv(dev); |
||
2374 | - |
||
2375 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev); |
||
2376 | + |
||
2377 | int ret; |
||
2378 | - |
||
2379 | + |
||
2380 | down(&priv->wx_sem); |
||
2381 | - |
||
2382 | - ret = ieee80211_wx_set_essid(priv->ieee80211,a,wrqu,b); |
||
2383 | - |
||
2384 | + |
||
2385 | + ret = ieee80211_wx_set_essid_rtl7(priv->ieee80211,a,wrqu,b); |
||
2386 | + |
||
2387 | up(&priv->wx_sem); |
||
2388 | return ret; |
||
2389 | } |
||
2390 | |||
2391 | |||
2392 | -static int r8180_wx_get_essid(struct net_device *dev, |
||
2393 | +static int r8180_wx_get_essid(struct net_device *dev, |
||
2394 | struct iw_request_info *a, |
||
2395 | union iwreq_data *wrqu, char *b) |
||
2396 | { |
||
2397 | int ret; |
||
2398 | - struct r8180_priv *priv = ieee80211_priv(dev); |
||
2399 | - |
||
2400 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev); |
||
2401 | + |
||
2402 | down(&priv->wx_sem); |
||
2403 | - |
||
2404 | - ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b); |
||
2405 | + |
||
2406 | + ret = ieee80211_wx_get_essid_rtl7(priv->ieee80211, a, wrqu, b); |
||
2407 | |||
2408 | up(&priv->wx_sem); |
||
2409 | - |
||
2410 | + |
||
2411 | return ret; |
||
2412 | } |
||
2413 | |||
2414 | @@ -338,30 +459,30 @@ |
||
2415 | union iwreq_data *wrqu, char *b) |
||
2416 | { |
||
2417 | int ret; |
||
2418 | - struct r8180_priv *priv = ieee80211_priv(dev); |
||
2419 | - |
||
2420 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev); |
||
2421 | + |
||
2422 | down(&priv->wx_sem); |
||
2423 | - |
||
2424 | - ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b); |
||
2425 | - |
||
2426 | + |
||
2427 | + ret = ieee80211_wx_set_freq_rtl7(priv->ieee80211, a, wrqu, b); |
||
2428 | + |
||
2429 | up(&priv->wx_sem); |
||
2430 | return ret; |
||
2431 | } |
||
2432 | |||
2433 | -static int r8180_wx_get_name(struct net_device *dev, |
||
2434 | - struct iw_request_info *info, |
||
2435 | +static int r8180_wx_get_name(struct net_device *dev, |
||
2436 | + struct iw_request_info *info, |
||
2437 | union iwreq_data *wrqu, char *extra) |
||
2438 | { |
||
2439 | - struct r8180_priv *priv = ieee80211_priv(dev); |
||
2440 | - return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra); |
||
2441 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev); |
||
2442 | + return ieee80211_wx_get_name_rtl7(priv->ieee80211, info, wrqu, extra); |
||
2443 | } |
||
2444 | |||
2445 | |||
2446 | -static int r8180_wx_set_frag(struct net_device *dev, |
||
2447 | - struct iw_request_info *info, |
||
2448 | +static int r8180_wx_set_frag(struct net_device *dev, |
||
2449 | + struct iw_request_info *info, |
||
2450 | union iwreq_data *wrqu, char *extra) |
||
2451 | { |
||
2452 | - struct r8180_priv *priv = ieee80211_priv(dev); |
||
2453 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev); |
||
2454 | |||
2455 | if (wrqu->frag.disabled) |
||
2456 | priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD; |
||
2457 | @@ -369,7 +490,7 @@ |
||
2458 | if (wrqu->frag.value < MIN_FRAG_THRESHOLD || |
||
2459 | wrqu->frag.value > MAX_FRAG_THRESHOLD) |
||
2460 | return -EINVAL; |
||
2461 | - |
||
2462 | + |
||
2463 | priv->ieee80211->fts = wrqu->frag.value & ~0x1; |
||
2464 | } |
||
2465 | |||
2466 | @@ -377,11 +498,11 @@ |
||
2467 | } |
||
2468 | |||
2469 | |||
2470 | -static int r8180_wx_get_frag(struct net_device *dev, |
||
2471 | - struct iw_request_info *info, |
||
2472 | +static int r8180_wx_get_frag(struct net_device *dev, |
||
2473 | + struct iw_request_info *info, |
||
2474 | union iwreq_data *wrqu, char *extra) |
||
2475 | { |
||
2476 | - struct r8180_priv *priv = ieee80211_priv(dev); |
||
2477 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev); |
||
2478 | |||
2479 | wrqu->frag.value = priv->ieee80211->fts; |
||
2480 | wrqu->frag.fixed = 0; /* no auto select */ |
||
2481 | @@ -397,49 +518,49 @@ |
||
2482 | char *extra) |
||
2483 | { |
||
2484 | int ret; |
||
2485 | - struct r8180_priv *priv = ieee80211_priv(dev); |
||
2486 | - |
||
2487 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev); |
||
2488 | + |
||
2489 | down(&priv->wx_sem); |
||
2490 | - |
||
2491 | - ret = ieee80211_wx_set_wap(priv->ieee80211,info,awrq,extra); |
||
2492 | - |
||
2493 | + |
||
2494 | + ret = ieee80211_wx_set_wap_rtl7(priv->ieee80211,info,awrq,extra); |
||
2495 | + |
||
2496 | up(&priv->wx_sem); |
||
2497 | return ret; |
||
2498 | - |
||
2499 | + |
||
2500 | } |
||
2501 | - |
||
2502 | |||
2503 | -static int r8180_wx_get_wap(struct net_device *dev, |
||
2504 | - struct iw_request_info *info, |
||
2505 | + |
||
2506 | +static int r8180_wx_get_wap(struct net_device *dev, |
||
2507 | + struct iw_request_info *info, |
||
2508 | union iwreq_data *wrqu, char *extra) |
||
2509 | { |
||
2510 | - struct r8180_priv *priv = ieee80211_priv(dev); |
||
2511 | - |
||
2512 | - return ieee80211_wx_get_wap(priv->ieee80211,info,wrqu,extra); |
||
2513 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev); |
||
2514 | + |
||
2515 | + return ieee80211_wx_get_wap_rtl7(priv->ieee80211,info,wrqu,extra); |
||
2516 | } |
||
2517 | |||
2518 | |||
2519 | -static int r8180_wx_get_enc(struct net_device *dev, |
||
2520 | - struct iw_request_info *info, |
||
2521 | +static int r8180_wx_get_enc(struct net_device *dev, |
||
2522 | + struct iw_request_info *info, |
||
2523 | union iwreq_data *wrqu, char *key) |
||
2524 | { |
||
2525 | - struct r8180_priv *priv = ieee80211_priv(dev); |
||
2526 | - |
||
2527 | - return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key); |
||
2528 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev); |
||
2529 | + |
||
2530 | + return ieee80211_wx_get_encode_rtl7(priv->ieee80211, info, wrqu, key); |
||
2531 | } |
||
2532 | |||
2533 | -static int r8180_wx_set_enc(struct net_device *dev, |
||
2534 | - struct iw_request_info *info, |
||
2535 | +static int r8180_wx_set_enc(struct net_device *dev, |
||
2536 | + struct iw_request_info *info, |
||
2537 | union iwreq_data *wrqu, char *key) |
||
2538 | { |
||
2539 | - struct r8180_priv *priv = ieee80211_priv(dev); |
||
2540 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev); |
||
2541 | int ret; |
||
2542 | - |
||
2543 | + |
||
2544 | down(&priv->wx_sem); |
||
2545 | - |
||
2546 | + |
||
2547 | DMESG("Setting SW wep key"); |
||
2548 | - ret = ieee80211_wx_set_encode(priv->ieee80211,info,wrqu,key); |
||
2549 | - |
||
2550 | + ret = ieee80211_wx_set_encode_rtl7(priv->ieee80211,info,wrqu,key); |
||
2551 | + |
||
2552 | up(&priv->wx_sem); |
||
2553 | return ret; |
||
2554 | } |
||
2555 | @@ -447,28 +568,28 @@ |
||
2556 | |||
2557 | static int r8180_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union |
||
2558 | iwreq_data *wrqu, char *p){ |
||
2559 | - |
||
2560 | - struct r8180_priv *priv = ieee80211_priv(dev); |
||
2561 | + |
||
2562 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev); |
||
2563 | int *parms=(int*)p; |
||
2564 | int mode=parms[0]; |
||
2565 | - |
||
2566 | + |
||
2567 | priv->ieee80211->active_scan = mode; |
||
2568 | - |
||
2569 | + |
||
2570 | return 1; |
||
2571 | } |
||
2572 | |||
2573 | |||
2574 | |||
2575 | -static int r8180_wx_set_retry(struct net_device *dev, |
||
2576 | - struct iw_request_info *info, |
||
2577 | +static int r8180_wx_set_retry(struct net_device *dev, |
||
2578 | + struct iw_request_info *info, |
||
2579 | union iwreq_data *wrqu, char *extra) |
||
2580 | { |
||
2581 | - struct r8180_priv *priv = ieee80211_priv(dev); |
||
2582 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev); |
||
2583 | int err = 0; |
||
2584 | - |
||
2585 | + |
||
2586 | down(&priv->wx_sem); |
||
2587 | - |
||
2588 | - if (wrqu->retry.flags & IW_RETRY_LIFETIME || |
||
2589 | + |
||
2590 | + if (wrqu->retry.flags & IW_RETRY_LIFETIME || |
||
2591 | wrqu->retry.disabled){ |
||
2592 | err = -EINVAL; |
||
2593 | goto exit; |
||
2594 | @@ -485,13 +606,13 @@ |
||
2595 | if (wrqu->retry.flags & IW_RETRY_MAX) { |
||
2596 | priv->retry_rts = wrqu->retry.value; |
||
2597 | DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value); |
||
2598 | - |
||
2599 | + |
||
2600 | }else { |
||
2601 | priv->retry_data = wrqu->retry.value; |
||
2602 | DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value); |
||
2603 | } |
||
2604 | - |
||
2605 | - /* FIXME ! |
||
2606 | + |
||
2607 | + /* FIXME ! |
||
2608 | * We might try to write directly the TX config register |
||
2609 | * or to restart just the (R)TX process. |
||
2610 | * I'm unsure if whole reset is really needed |
||
2611 | @@ -503,28 +624,28 @@ |
||
2612 | rtl8180_rtx_disable(dev); |
||
2613 | rtl8180_rx_enable(dev); |
||
2614 | rtl8180_tx_enable(dev); |
||
2615 | - |
||
2616 | + |
||
2617 | } |
||
2618 | */ |
||
2619 | exit: |
||
2620 | up(&priv->wx_sem); |
||
2621 | - |
||
2622 | + |
||
2623 | return err; |
||
2624 | } |
||
2625 | |||
2626 | -static int r8180_wx_get_retry(struct net_device *dev, |
||
2627 | - struct iw_request_info *info, |
||
2628 | +static int r8180_wx_get_retry(struct net_device *dev, |
||
2629 | + struct iw_request_info *info, |
||
2630 | union iwreq_data *wrqu, char *extra) |
||
2631 | { |
||
2632 | - struct r8180_priv *priv = ieee80211_priv(dev); |
||
2633 | - |
||
2634 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev); |
||
2635 | + |
||
2636 | |||
2637 | wrqu->retry.disabled = 0; /* can't be disabled */ |
||
2638 | |||
2639 | - if ((wrqu->retry.flags & IW_RETRY_TYPE) == |
||
2640 | - IW_RETRY_LIFETIME) |
||
2641 | + if ((wrqu->retry.flags & IW_RETRY_TYPE) == |
||
2642 | + IW_RETRY_LIFETIME) |
||
2643 | return -EINVAL; |
||
2644 | - |
||
2645 | + |
||
2646 | if (wrqu->retry.flags & IW_RETRY_MAX) { |
||
2647 | wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MAX; |
||
2648 | wrqu->retry.value = priv->retry_rts; |
||
2649 | @@ -533,30 +654,30 @@ |
||
2650 | wrqu->retry.value = priv->retry_data; |
||
2651 | } |
||
2652 | //DMESG("returning %d",wrqu->retry.value); |
||
2653 | - |
||
2654 | + |
||
2655 | |||
2656 | return 0; |
||
2657 | } |
||
2658 | |||
2659 | -static int r8180_wx_get_sens(struct net_device *dev, |
||
2660 | - struct iw_request_info *info, |
||
2661 | +static int r8180_wx_get_sens(struct net_device *dev, |
||
2662 | + struct iw_request_info *info, |
||
2663 | union iwreq_data *wrqu, char *extra) |
||
2664 | { |
||
2665 | - struct r8180_priv *priv = ieee80211_priv(dev); |
||
2666 | - if(priv->rf_set_sens == NULL) |
||
2667 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev); |
||
2668 | + if(priv->rf_set_sens == NULL) |
||
2669 | return -1; /* we have not this support for this radio */ |
||
2670 | wrqu->sens.value = priv->sens; |
||
2671 | return 0; |
||
2672 | } |
||
2673 | |||
2674 | |||
2675 | -static int r8180_wx_set_sens(struct net_device *dev, |
||
2676 | - struct iw_request_info *info, |
||
2677 | +static int r8180_wx_set_sens(struct net_device *dev, |
||
2678 | + struct iw_request_info *info, |
||
2679 | union iwreq_data *wrqu, char *extra) |
||
2680 | { |
||
2681 | - |
||
2682 | - struct r8180_priv *priv = ieee80211_priv(dev); |
||
2683 | - |
||
2684 | + |
||
2685 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev); |
||
2686 | + |
||
2687 | short err = 0; |
||
2688 | down(&priv->wx_sem); |
||
2689 | //DMESG("attempt to set sensivity to %ddb",wrqu->sens.value); |
||
2690 | @@ -571,7 +692,7 @@ |
||
2691 | |||
2692 | exit: |
||
2693 | up(&priv->wx_sem); |
||
2694 | - |
||
2695 | + |
||
2696 | return err; |
||
2697 | } |
||
2698 | |||
2699 | @@ -623,50 +744,55 @@ |
||
2700 | dummy, /* SIOCGIWRTS */ |
||
2701 | r8180_wx_set_frag, /* SIOCSIWFRAG */ |
||
2702 | r8180_wx_get_frag, /* SIOCGIWFRAG */ |
||
2703 | - dummy, /* SIOCSIWTXPOW */ |
||
2704 | - dummy, /* SIOCGIWTXPOW */ |
||
2705 | + r8180_wx_set_txpow, /* SIOCSIWTXPOW */ |
||
2706 | + r8180_wx_get_txpow, /* SIOCGIWTXPOW */ |
||
2707 | r8180_wx_set_retry, /* SIOCSIWRETRY */ |
||
2708 | r8180_wx_get_retry, /* SIOCGIWRETRY */ |
||
2709 | r8180_wx_set_enc, /* SIOCSIWENCODE */ |
||
2710 | r8180_wx_get_enc, /* SIOCGIWENCODE */ |
||
2711 | dummy, /* SIOCSIWPOWER */ |
||
2712 | dummy, /* SIOCGIWPOWER */ |
||
2713 | -}; |
||
2714 | +}; |
||
2715 | |||
2716 | |||
2717 | -static const struct iw_priv_args r8180_private_args[] = { |
||
2718 | - |
||
2719 | +static const struct iw_priv_args r8180_private_args[] = { |
||
2720 | { |
||
2721 | - SIOCIWFIRSTPRIV + 0x0, |
||
2722 | - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc" |
||
2723 | - }, |
||
2724 | - |
||
2725 | + SIOCIWFIRSTPRIV + 0x0, |
||
2726 | + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "fasttx" |
||
2727 | + }, |
||
2728 | + |
||
2729 | { |
||
2730 | SIOCIWFIRSTPRIV + 0x1, |
||
2731 | - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan" |
||
2732 | - |
||
2733 | + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "highpower" |
||
2734 | }, |
||
2735 | + |
||
2736 | { |
||
2737 | - SIOCIWFIRSTPRIV + 0x2, |
||
2738 | - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx" |
||
2739 | + SIOCIWFIRSTPRIV + 0x2, |
||
2740 | + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc" |
||
2741 | + }, |
||
2742 | + |
||
2743 | + { |
||
2744 | + SIOCIWFIRSTPRIV + 0x3, |
||
2745 | + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan" |
||
2746 | + |
||
2747 | } |
||
2748 | }; |
||
2749 | |||
2750 | |||
2751 | static iw_handler r8180_private_handler[] = { |
||
2752 | -// r8180_wx_set_monitor, /* SIOCIWFIRSTPRIV */ |
||
2753 | + r8180_wx_set_fasttx, /* SIOCIWFIRSTPRIV */ |
||
2754 | + r8180_wx_set_highpower, /*SIOCIWSECONDPRIV*/ |
||
2755 | r8180_wx_set_crcmon, /*SIOCIWSECONDPRIV*/ |
||
2756 | // r8180_wx_set_forceassociate, |
||
2757 | // r8180_wx_set_beaconinterval, |
||
2758 | // r8180_wx_set_monitor_type, |
||
2759 | r8180_wx_set_scan_type, |
||
2760 | - r8180_wx_set_rawtx, |
||
2761 | }; |
||
2762 | |||
2763 | -#if WIRELESS_EXT >= 17 |
||
2764 | +#if WIRELESS_EXT >= 17 |
||
2765 | static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev) |
||
2766 | { |
||
2767 | - struct r8180_priv *priv = ieee80211_priv(dev); |
||
2768 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev); |
||
2769 | |||
2770 | return &priv->wstats; |
||
2771 | } |
||
2772 | @@ -679,8 +805,8 @@ |
||
2773 | .private = r8180_private_handler, |
||
2774 | .num_private = sizeof(r8180_private_handler) / sizeof(iw_handler), |
||
2775 | .num_private_args = sizeof(r8180_private_args) / sizeof(struct iw_priv_args), |
||
2776 | -#if WIRELESS_EXT >= 17 |
||
2777 | +#if WIRELESS_EXT >= 17 |
||
2778 | .get_wireless_stats = r8180_get_wireless_stats, |
||
2779 | #endif |
||
2780 | - .private_args = (struct iw_priv_args *)r8180_private_args, |
||
2781 | + .private_args = (struct iw_priv_args *)r8180_private_args, |
||
2782 | }; |
||
2783 | 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 |
||
2784 | --- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c 2006-06-22 07:43:30.000000000 +0200 |
||
2785 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187_core.c 2008-02-15 00:37:05.000000000 +0100 |
||
2786 | @@ -1,27 +1,27 @@ |
||
2787 | /* |
||
2788 | This is part of rtl8187 OpenSource driver - v 0.1 |
||
2789 | - Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
|
||
2790 | + Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
|
||
2791 | Released under the terms of GPL (General Public License) |
||
2792 | -
|
||
2793 | -
|
||
2794 | - Parts of this driver are based on the rtl8180 driver skeleton
|
||
2795 | +
|
||
2796 | +
|
||
2797 | + Parts of this driver are based on the rtl8180 driver skeleton
|
||
2798 | from Patric Schenke & Andres Salomon. |
||
2799 | |||
2800 | Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers. |
||
2801 | -
|
||
2802 | +
|
||
2803 | some ideas might be derived from David Young rtl8180 netbsd driver. |
||
2804 | -
|
||
2805 | +
|
||
2806 | Parts of the usb code are from the r8150.c driver in linux kernel |
||
2807 | -
|
||
2808 | +
|
||
2809 | Some ideas borrowed from the 8139too.c driver included in linux kernel. |
||
2810 | -
|
||
2811 | - We (I?) want to thanks the Authors of those projecs and also the
|
||
2812 | +
|
||
2813 | + We (I?) want to thanks the Authors of those projecs and also the
|
||
2814 | Ndiswrapper's project Authors. |
||
2815 | -
|
||
2816 | - A special big thanks goes also to Realtek corp. for their help in my
|
||
2817 | - attempt to add RTL8187 and RTL8225 support, and to David Young also.
|
||
2818 | |||
2819 | - - Please note that this file is a modified version from rtl8180-sa2400
|
||
2820 | + A special big thanks goes also to Realtek corp. for their help in my
|
||
2821 | + attempt to add RTL8187 and RTL8225 support, and to David Young also.
|
||
2822 | +
|
||
2823 | + - Please note that this file is a modified version from rtl8180-sa2400
|
||
2824 | drv. So some other people have contributed to this project, and they are |
||
2825 | thanked in the rtl8180-sa2400 CHANGELOG. |
||
2826 | */ |
||
2827 | @@ -57,6 +57,7 @@ |
||
2828 | #undef DEBUG_IRQ_TASKLET |
||
2829 | #undef DEBUG_TX_ALLOC |
||
2830 | #undef DEBUG_TX_DESC |
||
2831 | +#undef DEBUG_TX_POWER
|
||
2832 | |||
2833 | //#define CONFIG_RTL8180_IO_MAP |
||
2834 | |||
2835 | @@ -66,6 +67,9 @@ |
||
2836 | #include "r8180_93cx6.h" /* Card EEPROM */ |
||
2837 | #include "r8180_wx.h" |
||
2838 | |||
2839 | +#if !(defined(CONFIG_USB_EHCI_HCD) || defined (CONFIG_USB_EHCI_HCD_MODULE))
|
||
2840 | + #error Build your kernel with ehci_hcd support!
|
||
2841 | +#endif
|
||
2842 | |||
2843 | // FIXME: check if 2.6.7 is ok |
||
2844 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7)) |
||
2845 | @@ -98,6 +102,10 @@ |
||
2846 | #endif |
||
2847 | static int channels = 0x3fff; |
||
2848 | |||
2849 | +// #define DEBUG_EPROM
|
||
2850 | +// #define DEBUG_REGISTERS
|
||
2851 | +// #define DEBUG_TX_POWER
|
||
2852 | +
|
||
2853 | MODULE_LICENSE("GPL"); |
||
2854 | MODULE_VERSION("V 1.1"); |
||
2855 | MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl); |
||
2856 | @@ -137,7 +145,7 @@ |
||
2857 | |||
2858 | static int __devinit rtl8187_usb_probe(struct usb_interface *intf, |
||
2859 | const struct usb_device_id *id); |
||
2860 | -
|
||
2861 | +
|
||
2862 | static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf); |
||
2863 | |||
2864 | static struct usb_driver rtl8187_usb_driver = { |
||
2865 | @@ -158,13 +166,12 @@ |
||
2866 | #endif |
||
2867 | }; |
||
2868 | |||
2869 | -
|
||
2870 | void write_nic_byte_E(struct net_device *dev, int indx, u8 data) |
||
2871 | { |
||
2872 | -
|
||
2873 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
2874 | +
|
||
2875 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
2876 | struct usb_device *udev = priv->udev; |
||
2877 | -
|
||
2878 | +
|
||
2879 | usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
||
2880 | RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, |
||
2881 | indx|0xfe00, 0, &data, 1, HZ / 2); |
||
2882 | @@ -173,10 +180,10 @@ |
||
2883 | |||
2884 | void write_nic_byte(struct net_device *dev, int indx, u8 data) |
||
2885 | { |
||
2886 | -
|
||
2887 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
2888 | +
|
||
2889 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
2890 | struct usb_device *udev = priv->udev; |
||
2891 | -
|
||
2892 | +
|
||
2893 | usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
||
2894 | RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, |
||
2895 | indx|0xff00, 0, &data, 1, HZ / 2); |
||
2896 | @@ -185,10 +192,10 @@ |
||
2897 | |||
2898 | void write_nic_word(struct net_device *dev, int indx, u16 data) |
||
2899 | { |
||
2900 | -
|
||
2901 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
2902 | +
|
||
2903 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
2904 | struct usb_device *udev = priv->udev; |
||
2905 | -
|
||
2906 | +
|
||
2907 | usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
||
2908 | RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, |
||
2909 | indx|0xff00, 0, &data, 2, HZ / 2); |
||
2910 | @@ -197,23 +204,23 @@ |
||
2911 | |||
2912 | void write_nic_dword(struct net_device *dev, int indx, u32 data) |
||
2913 | { |
||
2914 | -
|
||
2915 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
2916 | +
|
||
2917 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
2918 | struct usb_device *udev = priv->udev; |
||
2919 | -
|
||
2920 | +
|
||
2921 | usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
||
2922 | RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, |
||
2923 | indx|0xff00, 0, &data, 4, HZ / 2); |
||
2924 | } |
||
2925 | -
|
||
2926 | -
|
||
2927 | -
|
||
2928 | +
|
||
2929 | +
|
||
2930 | +
|
||
2931 | u8 read_nic_byte(struct net_device *dev, int indx) |
||
2932 | { |
||
2933 | u8 data; |
||
2934 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
2935 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
2936 | struct usb_device *udev = priv->udev; |
||
2937 | -
|
||
2938 | +
|
||
2939 | usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
||
2940 | RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, |
||
2941 | indx|0xff00, 0, &data, 1, HZ / 2); |
||
2942 | @@ -223,22 +230,22 @@ |
||
2943 | u8 read_nic_byte_E(struct net_device *dev, int indx) |
||
2944 | { |
||
2945 | u8 data; |
||
2946 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
2947 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
2948 | struct usb_device *udev = priv->udev; |
||
2949 | -
|
||
2950 | +
|
||
2951 | usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
||
2952 | RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, |
||
2953 | indx|0xfe00, 0, &data, 1, HZ / 2); |
||
2954 | return data; |
||
2955 | } |
||
2956 | |||
2957 | -
|
||
2958 | +
|
||
2959 | u16 read_nic_word(struct net_device *dev, int indx) |
||
2960 | { |
||
2961 | u16 data; |
||
2962 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
2963 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
2964 | struct usb_device *udev = priv->udev; |
||
2965 | -
|
||
2966 | +
|
||
2967 | usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
||
2968 | RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, |
||
2969 | indx|0xff00, 0, &data, 2, HZ / 2); |
||
2970 | @@ -249,16 +256,16 @@ |
||
2971 | u32 read_nic_dword(struct net_device *dev, int indx) |
||
2972 | { |
||
2973 | u32 data; |
||
2974 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
2975 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
2976 | struct usb_device *udev = priv->udev; |
||
2977 | -
|
||
2978 | +
|
||
2979 | usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
||
2980 | RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, |
||
2981 | indx|0xff00, 0, &data, 4, HZ / 2); |
||
2982 | return data; |
||
2983 | } |
||
2984 | |||
2985 | -/* this might still called in what was the PHY rtl8185/rtl8187 common code
|
||
2986 | +/* this might still called in what was the PHY rtl8185/rtl8187 common code
|
||
2987 | * plans are to possibilty turn it again in one common code... |
||
2988 | */ |
||
2989 | inline void force_pci_posting(struct net_device *dev) |
||
2990 | @@ -271,7 +278,12 @@ |
||
2991 | //void set_nic_txring(struct net_device *dev); |
||
2992 | static struct net_device_stats *rtl8180_stats(struct net_device *dev); |
||
2993 | void rtl8180_commit(struct net_device *dev); |
||
2994 | +
|
||
2995 | +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
|
||
2996 | +void rtl8180_restart(struct work_struct *work);
|
||
2997 | +#else
|
||
2998 | void rtl8180_restart(struct net_device *dev); |
||
2999 | +#endif
|
||
3000 | |||
3001 | /**************************************************************************** |
||
3002 | -----------------------------PROCFS STUFF------------------------- |
||
3003 | @@ -284,13 +296,13 @@ |
||
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 | int i,n; |
||
3013 | -
|
||
3014 | +
|
||
3015 | int max=0xff; |
||
3016 | -
|
||
3017 | +
|
||
3018 | /* This dump the current register page */ |
||
3019 | for(n=0;n<=max;) |
||
3020 | { |
||
3021 | @@ -307,7 +319,7 @@ |
||
3022 | len += snprintf(page + len, count - len,"\n"); |
||
3023 | |||
3024 | |||
3025 | -
|
||
3026 | +
|
||
3027 | *eof = 1; |
||
3028 | return len; |
||
3029 | |||
3030 | @@ -319,16 +331,16 @@ |
||
3031 | int *eof, void *data) |
||
3032 | { |
||
3033 | struct net_device *dev = data; |
||
3034 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
3035 | -
|
||
3036 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
3037 | +
|
||
3038 | int len = 0; |
||
3039 | -
|
||
3040 | +
|
||
3041 | len += snprintf(page + len, count - len, |
||
3042 | "NIC int: %lu\n" |
||
3043 | "Total int: %lu\n", |
||
3044 | priv->stats.ints, |
||
3045 | priv->stats.shints); |
||
3046 | -
|
||
3047 | +
|
||
3048 | *eof = 1; |
||
3049 | return len; |
||
3050 | } |
||
3051 | @@ -339,10 +351,10 @@ |
||
3052 | int *eof, void *data) |
||
3053 | { |
||
3054 | struct net_device *dev = data; |
||
3055 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
3056 | -
|
||
3057 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
3058 | +
|
||
3059 | int len = 0; |
||
3060 | -
|
||
3061 | +
|
||
3062 | len += snprintf(page + len, count - len, |
||
3063 | "TX normal priority ok int: %lu\n" |
||
3064 | "TX normal priority error int: %lu\n" |
||
3065 | @@ -359,7 +371,7 @@ |
||
3066 | "TX HW queue: %d\n" |
||
3067 | "TX lp dropped: %lu\n" |
||
3068 | "TX np dropped: %lu\n" |
||
3069 | - "TX total data packets %lu\n",
|
||
3070 | + "TX total data packets %lu\n",
|
||
3071 | // "TX beacon aborted: %lu\n", |
||
3072 | priv->stats.txnpokint, |
||
3073 | priv->stats.txnperr, |
||
3074 | @@ -379,10 +391,10 @@ |
||
3075 | priv->stats.txdatapkt |
||
3076 | // priv->stats.txbeaconerr |
||
3077 | ); |
||
3078 | -
|
||
3079 | +
|
||
3080 | *eof = 1; |
||
3081 | return len; |
||
3082 | -}
|
||
3083 | +}
|
||
3084 | |||
3085 | |||
3086 | |||
3087 | @@ -391,10 +403,10 @@ |
||
3088 | int *eof, void *data) |
||
3089 | { |
||
3090 | struct net_device *dev = data; |
||
3091 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
3092 | -
|
||
3093 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
3094 | +
|
||
3095 | int len = 0; |
||
3096 | -
|
||
3097 | +
|
||
3098 | len += snprintf(page + len, count - len, |
||
3099 | "RX packets: %lu\n" |
||
3100 | "RX urb status error: %lu\n" |
||
3101 | @@ -402,35 +414,44 @@ |
||
3102 | priv->stats.rxok, |
||
3103 | priv->stats.rxstaterr, |
||
3104 | priv->stats.rxurberr); |
||
3105 | -
|
||
3106 | +
|
||
3107 | *eof = 1; |
||
3108 | return len; |
||
3109 | -}
|
||
3110 | -
|
||
3111 | +}
|
||
3112 | |||
3113 | +#if WIRELESS_EXT < 17
|
||
3114 | static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev) |
||
3115 | { |
||
3116 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
3117 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
3118 | |||
3119 | return &priv->wstats; |
||
3120 | } |
||
3121 | +#endif
|
||
3122 | |||
3123 | void rtl8180_proc_module_init(void) |
||
3124 | -{
|
||
3125 | +{
|
||
3126 | DMESG("Initializing proc filesystem"); |
||
3127 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
|
||
3128 | rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net); |
||
3129 | +#else
|
||
3130 | + rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, init_net.proc_net);
|
||
3131 | +#endif
|
||
3132 | } |
||
3133 | |||
3134 | |||
3135 | void rtl8180_proc_module_remove(void) |
||
3136 | { |
||
3137 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
|
||
3138 | remove_proc_entry(RTL8187_MODULE_NAME, proc_net); |
||
3139 | +#else
|
||
3140 | + remove_proc_entry(RTL8187_MODULE_NAME, init_net.proc_net);
|
||
3141 | +#endif
|
||
3142 | } |
||
3143 | |||
3144 | |||
3145 | void rtl8180_proc_remove_one(struct net_device *dev) |
||
3146 | { |
||
3147 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
3148 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
3149 | if (priv->dir_dev) { |
||
3150 | // remove_proc_entry("stats-hw", priv->dir_dev); |
||
3151 | remove_proc_entry("stats-tx", priv->dir_dev); |
||
3152 | @@ -447,9 +468,9 @@ |
||
3153 | void rtl8180_proc_init_one(struct net_device *dev) |
||
3154 | { |
||
3155 | struct proc_dir_entry *e; |
||
3156 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
3157 | - priv->dir_dev = create_proc_entry(dev->name,
|
||
3158 | - S_IFDIR | S_IRUGO | S_IXUGO,
|
||
3159 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
3160 | + priv->dir_dev = create_proc_entry(dev->name,
|
||
3161 | + S_IFDIR | S_IRUGO | S_IXUGO,
|
||
3162 | rtl8180_proc); |
||
3163 | if (!priv->dir_dev) { |
||
3164 | DMESGE("Unable to initialize /proc/net/rtl8187/%s\n", |
||
3165 | @@ -459,7 +480,7 @@ |
||
3166 | #if 0 |
||
3167 | e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO, |
||
3168 | priv->dir_dev, proc_get_stats_hw, dev); |
||
3169 | -
|
||
3170 | +
|
||
3171 | if (!e) { |
||
3172 | DMESGE("Unable to initialize " |
||
3173 | "/proc/net/rtl8187/%s/stats-hw\n", |
||
3174 | @@ -468,17 +489,17 @@ |
||
3175 | #endif |
||
3176 | e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO, |
||
3177 | priv->dir_dev, proc_get_stats_rx, dev); |
||
3178 | -
|
||
3179 | +
|
||
3180 | if (!e) { |
||
3181 | DMESGE("Unable to initialize " |
||
3182 | "/proc/net/rtl8187/%s/stats-rx\n", |
||
3183 | dev->name); |
||
3184 | } |
||
3185 | -
|
||
3186 | -
|
||
3187 | +
|
||
3188 | +
|
||
3189 | e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO, |
||
3190 | priv->dir_dev, proc_get_stats_tx, dev); |
||
3191 | -
|
||
3192 | +
|
||
3193 | if (!e) { |
||
3194 | DMESGE("Unable to initialize " |
||
3195 | "/proc/net/rtl8187/%s/stats-tx\n", |
||
3196 | @@ -487,27 +508,27 @@ |
||
3197 | #if 0 |
||
3198 | e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO, |
||
3199 | priv->dir_dev, proc_get_stats_ieee, dev); |
||
3200 | -
|
||
3201 | +
|
||
3202 | if (!e) { |
||
3203 | DMESGE("Unable to initialize " |
||
3204 | "/proc/net/rtl8187/%s/stats-ieee\n", |
||
3205 | dev->name); |
||
3206 | } |
||
3207 | -
|
||
3208 | -
|
||
3209 | +
|
||
3210 | +
|
||
3211 | e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO, |
||
3212 | priv->dir_dev, proc_get_stats_ap, dev); |
||
3213 | -
|
||
3214 | +
|
||
3215 | if (!e) { |
||
3216 | DMESGE("Unable to initialize " |
||
3217 | "/proc/net/rtl8187/%s/stats-ap\n", |
||
3218 | dev->name); |
||
3219 | } |
||
3220 | #endif |
||
3221 | -
|
||
3222 | +
|
||
3223 | e = create_proc_read_entry("registers", S_IFREG | S_IRUGO, |
||
3224 | priv->dir_dev, proc_get_registers, dev); |
||
3225 | -
|
||
3226 | +
|
||
3227 | if (!e) { |
||
3228 | DMESGE("Unable to initialize " |
||
3229 | "/proc/net/rtl8187/%s/registers\n", |
||
3230 | @@ -523,14 +544,14 @@ |
||
3231 | { |
||
3232 | int i; |
||
3233 | u8 *buf =(u8*)buffer; |
||
3234 | -
|
||
3235 | +
|
||
3236 | printk("ASCII BUFFER DUMP (len: %x):\n",len); |
||
3237 | -
|
||
3238 | +
|
||
3239 | for(i=0;i<len;i++) |
||
3240 | printk("%c",buf[i]); |
||
3241 | -
|
||
3242 | +
|
||
3243 | printk("\nBINARY BUFFER DUMP (len: %x):\n",len); |
||
3244 | -
|
||
3245 | +
|
||
3246 | for(i=0;i<len;i++) |
||
3247 | printk("%x",buf[i]); |
||
3248 | |||
3249 | @@ -539,17 +560,17 @@ |
||
3250 | |||
3251 | short check_nic_enought_desc(struct net_device *dev, priority_t priority) |
||
3252 | { |
||
3253 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
3254 | -
|
||
3255 | - int used = atomic_read((priority == NORM_PRIORITY) ?
|
||
3256 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
3257 | +
|
||
3258 | + int used = atomic_read((priority == NORM_PRIORITY) ?
|
||
3259 | &priv->tx_np_pending : &priv->tx_lp_pending); |
||
3260 | -
|
||
3261 | +
|
||
3262 | return (used < MAX_TX_URB); |
||
3263 | } |
||
3264 | |||
3265 | void tx_timeout(struct net_device *dev) |
||
3266 | { |
||
3267 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
3268 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
3269 | //rtl8180_commit(dev); |
||
3270 | schedule_work(&priv->reset_wq); |
||
3271 | //DMESG("TXTIMEOUT"); |
||
3272 | @@ -561,7 +582,20 @@ |
||
3273 | { |
||
3274 | int i; |
||
3275 | for(i=0; i<63; i++) |
||
3276 | - DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
|
||
3277 | + DMESG("EEPROM addr %02X : %04X", i, eprom_read(dev,i));
|
||
3278 | +}
|
||
3279 | +
|
||
3280 | +/* this is only for debug */
|
||
3281 | +void dump_tx_power(struct net_device *dev)
|
||
3282 | +{
|
||
3283 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
3284 | + int i;
|
||
3285 | + DMESG("CCK TX-Power (b-mode):");
|
||
3286 | + for(i=1; i<=14; i++)
|
||
3287 | + DMESG("Channel %d: %d", i, priv->chtxpwr[i]);
|
||
3288 | + DMESG("OFDM TX-Power (g-mode):");
|
||
3289 | + for(i=1; i<=14; i++)
|
||
3290 | + DMESG("Channel %d: %d", i, priv->chtxpwr_ofdm[i]);
|
||
3291 | } |
||
3292 | |||
3293 | /* this is only for debug */ |
||
3294 | @@ -570,14 +604,14 @@ |
||
3295 | int i; |
||
3296 | int n; |
||
3297 | int max=0xff; |
||
3298 | -
|
||
3299 | - DMESG("Dumping NIC register map");
|
||
3300 | -
|
||
3301 | +
|
||
3302 | + DMESG("Dumping NIC register map");
|
||
3303 | +
|
||
3304 | for(n=0;n<=max;) |
||
3305 | { |
||
3306 | - printk( "\nD: %2x> ", n);
|
||
3307 | + printk( "\nD: %02X> ", n);
|
||
3308 | for(i=0;i<16 && n<=max;i++,n++) |
||
3309 | - printk("%2x ",read_nic_byte(dev,n));
|
||
3310 | + printk("%02X ",read_nic_byte(dev,n));
|
||
3311 | } |
||
3312 | printk("\n"); |
||
3313 | } |
||
3314 | @@ -589,11 +623,11 @@ |
||
3315 | |||
3316 | void rtl8180_irq_enable(struct net_device *dev) |
||
3317 | { |
||
3318 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
3319 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
3320 | //priv->irq_enabled = 1; |
||
3321 | /* |
||
3322 | - write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
|
||
3323 | - INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
|
||
3324 | + write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
|
||
3325 | + INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
|
||
3326 | INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\ |
||
3327 | INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT); |
||
3328 | */ |
||
3329 | @@ -603,7 +637,7 @@ |
||
3330 | |||
3331 | void rtl8180_irq_disable(struct net_device *dev) |
||
3332 | { |
||
3333 | -// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
3334 | +// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
3335 | |||
3336 | write_nic_word(dev,INTA_MASK,0); |
||
3337 | force_pci_posting(dev); |
||
3338 | @@ -625,115 +659,119 @@ |
||
3339 | |||
3340 | void rtl8180_update_msr(struct net_device *dev) |
||
3341 | { |
||
3342 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
3343 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
3344 | u8 msr; |
||
3345 | -
|
||
3346 | +
|
||
3347 | msr = read_nic_byte(dev, MSR); |
||
3348 | msr &= ~ MSR_LINK_MASK; |
||
3349 | -
|
||
3350 | +
|
||
3351 | /* do not change in link_state != WLAN_LINK_ASSOCIATED. |
||
3352 | - * msr must be updated if the state is ASSOCIATING.
|
||
3353 | + * msr must be updated if the state is ASSOCIATING.
|
||
3354 | * this is intentional and make sense for ad-hoc and |
||
3355 | * master (see the create BSS/IBSS func) |
||
3356 | */ |
||
3357 | - if (priv->ieee80211->state == IEEE80211_LINKED){
|
||
3358 | -
|
||
3359 | + if (priv->ieee80211->state == IEEE80211_LINKED){
|
||
3360 | +
|
||
3361 | if (priv->ieee80211->iw_mode == IW_MODE_INFRA) |
||
3362 | msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT); |
||
3363 | else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC) |
||
3364 | msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT); |
||
3365 | else if (priv->ieee80211->iw_mode == IW_MODE_MASTER) |
||
3366 | msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT); |
||
3367 | -
|
||
3368 | +
|
||
3369 | }else |
||
3370 | msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT); |
||
3371 | -
|
||
3372 | +
|
||
3373 | write_nic_byte(dev, MSR, msr); |
||
3374 | } |
||
3375 | |||
3376 | void rtl8180_set_chan(struct net_device *dev,short ch) |
||
3377 | { |
||
3378 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
3379 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
3380 | u32 tx; |
||
3381 | priv->chan=ch; |
||
3382 | #if 0 |
||
3383 | - if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
|
||
3384 | + if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
|
||
3385 | priv->ieee80211->iw_mode == IW_MODE_MASTER){ |
||
3386 | -
|
||
3387 | - priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
|
||
3388 | +
|
||
3389 | + priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
|
||
3390 | priv->ieee80211->master_chan = ch; |
||
3391 | - rtl8180_update_beacon_ch(dev);
|
||
3392 | + rtl8180_update_beacon_ch(dev);
|
||
3393 | } |
||
3394 | #endif |
||
3395 | -
|
||
3396 | +
|
||
3397 | /* this hack should avoid frame TX during channel setting*/ |
||
3398 | tx = read_nic_dword(dev,TX_CONF); |
||
3399 | tx &= ~TX_LOOPBACK_MASK; |
||
3400 | |||
3401 | -#ifndef LOOP_TEST
|
||
3402 | +#ifndef LOOP_TEST
|
||
3403 | write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT)); |
||
3404 | -
|
||
3405 | priv->rf_set_chan(dev,priv->chan); |
||
3406 | mdelay(10); |
||
3407 | - write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
|
||
3408 | + write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
|
||
3409 | #endif |
||
3410 | } |
||
3411 | +
|
||
3412 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
|
||
3413 | void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs); |
||
3414 | +#else
|
||
3415 | +void rtl8187_rx_isr(struct urb *rx_urb);
|
||
3416 | +#endif
|
||
3417 | |||
3418 | |||
3419 | void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb) |
||
3420 | { |
||
3421 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
3422 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
3423 | int err; |
||
3424 | -
|
||
3425 | +
|
||
3426 | // u8 *rx; |
||
3427 | -
|
||
3428 | +
|
||
3429 | //DMESG("starting RX"); |
||
3430 | /*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC); |
||
3431 | - if(!rx){
|
||
3432 | + if(!rx){
|
||
3433 | DMESGE("unable to allocate RX buffer"); |
||
3434 | return; |
||
3435 | }*/ |
||
3436 | -
|
||
3437 | +
|
||
3438 | usb_fill_bulk_urb(rx_urb,priv->udev, |
||
3439 | usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer, |
||
3440 | RX_URB_SIZE,rtl8187_rx_isr,dev); |
||
3441 | - err = usb_submit_urb(rx_urb, GFP_ATOMIC);
|
||
3442 | + err = usb_submit_urb(rx_urb, GFP_ATOMIC);
|
||
3443 | if(err && err != -EPERM){ |
||
3444 | DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status); |
||
3445 | -
|
||
3446 | +
|
||
3447 | } |
||
3448 | -
|
||
3449 | +
|
||
3450 | } |
||
3451 | |||
3452 | |||
3453 | void rtl8187_rx_initiate(struct net_device *dev) |
||
3454 | { |
||
3455 | int i; |
||
3456 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
3457 | -
|
||
3458 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
3459 | +
|
||
3460 | if(!priv->rx_urb) |
||
3461 | DMESGE("Cannot intiate RX urb mechanism"); |
||
3462 | - for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
|
||
3463 | + for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
|
||
3464 | rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]); |
||
3465 | -
|
||
3466 | +
|
||
3467 | } |
||
3468 | |||
3469 | void rtl8187_set_rxconf(struct net_device *dev) |
||
3470 | { |
||
3471 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
3472 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
3473 | u32 rxconf; |
||
3474 | -
|
||
3475 | +
|
||
3476 | rxconf=read_nic_dword(dev,RX_CONF); |
||
3477 | rxconf = rxconf &~ MAC_FILTER_MASK; |
||
3478 | rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT); |
||
3479 | rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT); |
||
3480 | rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT); |
||
3481 | rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT); |
||
3482 | - rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
|
||
3483 | + rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
|
||
3484 | |||
3485 | if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode"); |
||
3486 | -
|
||
3487 | +
|
||
3488 | if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \ |
||
3489 | dev->flags & IFF_PROMISC){ |
||
3490 | rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT); |
||
3491 | @@ -741,40 +779,40 @@ |
||
3492 | rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT); |
||
3493 | rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT); |
||
3494 | } |
||
3495 | -
|
||
3496 | +
|
||
3497 | /*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){ |
||
3498 | rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT); |
||
3499 | rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT); |
||
3500 | }*/ |
||
3501 | -
|
||
3502 | +
|
||
3503 | if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){ |
||
3504 | rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT); |
||
3505 | rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT); |
||
3506 | } |
||
3507 | -
|
||
3508 | +
|
||
3509 | if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR) |
||
3510 | rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT); |
||
3511 | -
|
||
3512 | -
|
||
3513 | +
|
||
3514 | +
|
||
3515 | rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK; |
||
3516 | rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT); |
||
3517 | -
|
||
3518 | -
|
||
3519 | +
|
||
3520 | +
|
||
3521 | rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT); |
||
3522 | -
|
||
3523 | +
|
||
3524 | rxconf = rxconf &~ MAX_RX_DMA_MASK; |
||
3525 | rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT); |
||
3526 | -
|
||
3527 | +
|
||
3528 | rxconf = rxconf | RCR_ONLYERLPKT; |
||
3529 | -
|
||
3530 | +
|
||
3531 | // rxconf = rxconf &~ RCR_CS_MASK; |
||
3532 | // rxconf = rxconf | (1<<RCR_CS_SHIFT); |
||
3533 | |||
3534 | - write_nic_dword(dev, RX_CONF, rxconf);
|
||
3535 | -
|
||
3536 | + write_nic_dword(dev, RX_CONF, rxconf);
|
||
3537 | +
|
||
3538 | // V rtl suggested V // |
||
3539 | // write_nic_dword(dev, RX_CONF, 0x901ce70e); |
||
3540 | -
|
||
3541 | +
|
||
3542 | //fix_rx_fifo(dev); |
||
3543 | // //set_nic_rxring(dev); |
||
3544 | #ifdef DEBUG_RX |
||
3545 | @@ -785,23 +823,23 @@ |
||
3546 | void rtl8180_rx_enable(struct net_device *dev) |
||
3547 | { |
||
3548 | u8 cmd; |
||
3549 | -
|
||
3550 | -
|
||
3551 | +
|
||
3552 | +
|
||
3553 | rtl8187_rx_initiate(dev); |
||
3554 | |||
3555 | - rtl8187_set_rxconf(dev);
|
||
3556 | + rtl8187_set_rxconf(dev);
|
||
3557 | |||
3558 | cmd=read_nic_byte(dev,CMD); |
||
3559 | write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT)); |
||
3560 | #if 0 |
||
3561 | - /* In rtl8139 driver seems that DMA threshold has to be written
|
||
3562 | - * after enabling RX, so we rewrite RX_CONFIG register
|
||
3563 | + /* In rtl8139 driver seems that DMA threshold has to be written
|
||
3564 | + * after enabling RX, so we rewrite RX_CONFIG register
|
||
3565 | */ |
||
3566 | //mdelay(100); |
||
3567 | - write_nic_dword(dev, RX_CONF, rxconf);
|
||
3568 | -
|
||
3569 | + write_nic_dword(dev, RX_CONF, rxconf);
|
||
3570 | +
|
||
3571 | #endif |
||
3572 | -
|
||
3573 | +
|
||
3574 | } |
||
3575 | |||
3576 | |||
3577 | @@ -810,37 +848,37 @@ |
||
3578 | u8 cmd; |
||
3579 | u8 byte; |
||
3580 | u32 txconf; |
||
3581 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
3582 | -
|
||
3583 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
3584 | +
|
||
3585 | byte = read_nic_byte(dev,CW_CONF); |
||
3586 | byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT); |
||
3587 | byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT); |
||
3588 | write_nic_byte(dev, CW_CONF, byte); |
||
3589 | -
|
||
3590 | +
|
||
3591 | byte = read_nic_byte(dev, TX_AGC_CTL); |
||
3592 | byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT); |
||
3593 | byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT); |
||
3594 | byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT); |
||
3595 | write_nic_byte(dev, TX_AGC_CTL, byte); |
||
3596 | -
|
||
3597 | +
|
||
3598 | txconf= read_nic_dword(dev,TX_CONF); |
||
3599 | -
|
||
3600 | +
|
||
3601 | #if 0 |
||
3602 | if(priv->card_8185){ |
||
3603 | -
|
||
3604 | +
|
||
3605 | txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT); |
||
3606 | -
|
||
3607 | +
|
||
3608 | }else{ |
||
3609 | -
|
||
3610 | - if(priv->ieee80211->hw_seq)
|
||
3611 | +
|
||
3612 | + if(priv->ieee80211->hw_seq)
|
||
3613 | txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT); |
||
3614 | - else
|
||
3615 | + else
|
||
3616 | txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT); |
||
3617 | } |
||
3618 | #endif |
||
3619 | |||
3620 | txconf = txconf &~ TX_LOOPBACK_MASK; |
||
3621 | -
|
||
3622 | +
|
||
3623 | #ifndef LOOP_TEST |
||
3624 | txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT); |
||
3625 | #else |
||
3626 | @@ -848,23 +886,26 @@ |
||
3627 | #endif |
||
3628 | txconf = txconf &~ TCR_DPRETRY_MASK; |
||
3629 | txconf = txconf &~ TCR_RTSRETRY_MASK; |
||
3630 | -
|
||
3631 | - txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
|
||
3632 | - txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
|
||
3633 | -
|
||
3634 | +
|
||
3635 | + if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
|
||
3636 | + {
|
||
3637 | + txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
|
||
3638 | + txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
|
||
3639 | + }
|
||
3640 | +
|
||
3641 | txconf = txconf &~ (1<<TX_NOCRC_SHIFT); |
||
3642 | -
|
||
3643 | +
|
||
3644 | txconf = txconf &~ TCR_MXDMA_MASK; |
||
3645 | txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT); |
||
3646 | -
|
||
3647 | +
|
||
3648 | txconf = txconf | TCR_CWMIN; |
||
3649 | txconf = txconf | TCR_DISCW; |
||
3650 | txconf = txconf &~ TCR_SWPLCPLEN; |
||
3651 | -
|
||
3652 | +
|
||
3653 | txconf=txconf | (1<<TX_NOICV_SHIFT); |
||
3654 | -
|
||
3655 | +
|
||
3656 | write_nic_dword(dev,TX_CONF,txconf); |
||
3657 | -
|
||
3658 | +
|
||
3659 | // V RTL suggested V // |
||
3660 | // write_nic_dword(dev,TX_CONF,0x00e00707); |
||
3661 | |||
3662 | @@ -872,9 +913,9 @@ |
||
3663 | #ifdef DEBUG_TX |
||
3664 | DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF)); |
||
3665 | #endif |
||
3666 | -
|
||
3667 | +
|
||
3668 | cmd=read_nic_byte(dev,CMD); |
||
3669 | - write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
|
||
3670 | + write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
|
||
3671 | |||
3672 | // mdelay(100); |
||
3673 | //write_nic_dword(dev,TX_CONF,txconf); |
||
3674 | @@ -889,18 +930,18 @@ |
||
3675 | #if 0 |
||
3676 | void rtl8180_beacon_tx_enable(struct net_device *dev) |
||
3677 | { |
||
3678 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
3679 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
3680 | priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT); |
||
3681 | rtl8180_set_mode(dev,EPROM_CMD_CONFIG); |
||
3682 | - write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
|
||
3683 | + write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
|
||
3684 | rtl8180_set_mode(dev,EPROM_CMD_NORMAL); |
||
3685 | } |
||
3686 | |||
3687 | |||
3688 | void rtl8180_ |
||
3689 | -_disable(struct net_device *dev)
|
||
3690 | +_disable(struct net_device *dev)
|
||
3691 | { |
||
3692 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
3693 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
3694 | priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT); |
||
3695 | rtl8180_set_mode(dev,EPROM_CMD_CONFIG); |
||
3696 | write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask); |
||
3697 | @@ -914,8 +955,8 @@ |
||
3698 | { |
||
3699 | u8 cmd; |
||
3700 | int i; |
||
3701 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
3702 | -
|
||
3703 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
3704 | +
|
||
3705 | cmd=read_nic_byte(dev,CMD); |
||
3706 | write_nic_byte(dev, CMD, cmd &~ \ |
||
3707 | ((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT))); |
||
3708 | @@ -926,9 +967,9 @@ |
||
3709 | usb_kill_urb(priv->rx_urb[i]); |
||
3710 | } |
||
3711 | /*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT)) |
||
3712 | - udelay(10);
|
||
3713 | + udelay(10);
|
||
3714 | */ |
||
3715 | -
|
||
3716 | +
|
||
3717 | // if(!priv->rx_skb_complete) |
||
3718 | // dev_kfree_skb_any(priv->rx_skb); |
||
3719 | } |
||
3720 | @@ -939,14 +980,14 @@ |
||
3721 | #if 0 |
||
3722 | int i; |
||
3723 | u32 *tmp; |
||
3724 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
3725 | -
|
||
3726 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
3727 | +
|
||
3728 | priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev, |
||
3729 | - sizeof(u32)*8*count,
|
||
3730 | + sizeof(u32)*8*count,
|
||
3731 | &priv->txbeaconringdma); |
||
3732 | if (!priv->txbeaconring) return -1; |
||
3733 | for (tmp=priv->txbeaconring,i=0;i<count;i++){ |
||
3734 | - *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
|
||
3735 | + *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
|
||
3736 | /* |
||
3737 | *(tmp+2) = (u32)dma_tmp; |
||
3738 | *(tmp+3) = bufsize; |
||
3739 | @@ -955,7 +996,7 @@ |
||
3740 | *(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4); |
||
3741 | else |
||
3742 | *(tmp+4) = (u32)priv->txbeaconringdma; |
||
3743 | -
|
||
3744 | +
|
||
3745 | tmp=tmp+8; |
||
3746 | } |
||
3747 | #endif |
||
3748 | @@ -965,15 +1006,15 @@ |
||
3749 | |||
3750 | void rtl8180_reset(struct net_device *dev) |
||
3751 | { |
||
3752 | -
|
||
3753 | +
|
||
3754 | u8 cr; |
||
3755 | -
|
||
3756 | +
|
||
3757 | /* make sure the analog power is on before |
||
3758 | * reset, otherwise reset may fail |
||
3759 | */ |
||
3760 | rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON); |
||
3761 | rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON); |
||
3762 | -
|
||
3763 | +
|
||
3764 | rtl8180_irq_disable(dev); |
||
3765 | |||
3766 | mdelay(200); |
||
3767 | @@ -981,19 +1022,19 @@ |
||
3768 | write_nic_byte_E(dev,0x18,0x11); |
||
3769 | write_nic_byte_E(dev,0x18,0x00); |
||
3770 | mdelay(200); |
||
3771 | -
|
||
3772 | +
|
||
3773 | cr=read_nic_byte(dev,CMD); |
||
3774 | cr = cr & 2; |
||
3775 | cr = cr | (1<<CMD_RST_SHIFT); |
||
3776 | write_nic_byte(dev,CMD,cr); |
||
3777 | -
|
||
3778 | +
|
||
3779 | force_pci_posting(dev); |
||
3780 | -
|
||
3781 | +
|
||
3782 | mdelay(200); |
||
3783 | -
|
||
3784 | - if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
|
||
3785 | +
|
||
3786 | + if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
|
||
3787 | DMESGW("Card reset timeout!"); |
||
3788 | - else
|
||
3789 | + else
|
||
3790 | DMESG("Card successfully reset"); |
||
3791 | |||
3792 | rtl8180_set_mode(dev,EPROM_CMD_LOAD); |
||
3793 | @@ -1005,13 +1046,13 @@ |
||
3794 | */ |
||
3795 | rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON); |
||
3796 | rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON); |
||
3797 | -
|
||
3798 | +
|
||
3799 | } |
||
3800 | |||
3801 | inline u16 ieeerate2rtlrate(int rate) |
||
3802 | { |
||
3803 | switch(rate){ |
||
3804 | - case 10:
|
||
3805 | + case 10:
|
||
3806 | return 0; |
||
3807 | case 20: |
||
3808 | return 1; |
||
3809 | @@ -1037,32 +1078,42 @@ |
||
3810 | return 11; |
||
3811 | default: |
||
3812 | return 3; |
||
3813 | -
|
||
3814 | +
|
||
3815 | } |
||
3816 | } |
||
3817 | static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540}; |
||
3818 | inline u16 rtl8180_rate2rate(short rate) |
||
3819 | { |
||
3820 | if (rate >11) return 0; |
||
3821 | - return rtl_rate[rate];
|
||
3822 | + return rtl_rate[rate];
|
||
3823 | +}
|
||
3824 | +
|
||
3825 | +inline u8 rtl8180_IsWirelessBMode(u16 rate)
|
||
3826 | +{
|
||
3827 | + if( ((rate <= 110) && (rate != 60) && (rate != 90)) || (rate == 220) )
|
||
3828 | + return 1;
|
||
3829 | + else return 0;
|
||
3830 | } |
||
3831 | -
|
||
3832 | |||
3833 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
|
||
3834 | void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs) |
||
3835 | +#else
|
||
3836 | +void rtl8187_rx_isr(struct urb *rx_urb)
|
||
3837 | +#endif
|
||
3838 | { |
||
3839 | struct net_device *dev = (struct net_device*)rx_urb->context; |
||
3840 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
3841 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
3842 | |||
3843 | priv->rxurb_task = rx_urb; |
||
3844 | // DMESGW("David: Rx tasklet start!"); |
||
3845 | - tasklet_schedule(&priv->irq_rx_tasklet);
|
||
3846 | + tasklet_schedule(&priv->irq_rx_tasklet);
|
||
3847 | // DMESGW("=David: Rx tasklet finish!"); |
||
3848 | } |
||
3849 | |||
3850 | #if 0 |
||
3851 | void rtl8180_tx_queues_stop(struct net_device *dev) |
||
3852 | { |
||
3853 | - //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
3854 | + //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
3855 | u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT); |
||
3856 | dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT); |
||
3857 | dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT); |
||
3858 | @@ -1078,7 +1129,7 @@ |
||
3859 | { |
||
3860 | //FIXME !! |
||
3861 | #if 0 |
||
3862 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
3863 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
3864 | priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT); |
||
3865 | rtl8180_set_mode(dev,EPROM_CMD_CONFIG); |
||
3866 | write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask); |
||
3867 | @@ -1091,7 +1142,7 @@ |
||
3868 | { |
||
3869 | // FIXME !! |
||
3870 | #if 0 |
||
3871 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
3872 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
3873 | priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT); |
||
3874 | rtl8180_set_mode(dev,EPROM_CMD_CONFIG); |
||
3875 | write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask); |
||
3876 | @@ -1105,14 +1156,19 @@ |
||
3877 | */ |
||
3878 | void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate) |
||
3879 | { |
||
3880 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
3881 | -
|
||
3882 | - short morefrag = 0;
|
||
3883 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
3884 | +
|
||
3885 | + short morefrag = 0;
|
||
3886 | unsigned long flags; |
||
3887 | struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data; |
||
3888 | |||
3889 | - if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
|
||
3890 | - morefrag = 1;
|
||
3891 | + if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->ieee80211->raw_tx != 1)
|
||
3892 | + {
|
||
3893 | + if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
|
||
3894 | + {
|
||
3895 | + morefrag = 1;
|
||
3896 | + }
|
||
3897 | + }
|
||
3898 | // DMESG("%x %x", h->frame_ctl, h->seq_ctl); |
||
3899 | /* |
||
3900 | * This function doesn't require lock because we make |
||
3901 | @@ -1121,24 +1177,29 @@ |
||
3902 | * the ieee stack, or from the try_wake_queue (again trought |
||
3903 | * the ieee stack. |
||
3904 | */ |
||
3905 | - spin_lock_irqsave(&priv->tx_lock,flags);
|
||
3906 | -
|
||
3907 | - //DMESG("TX");
|
||
3908 | - if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
|
||
3909 | - DMESG("Error: no TX slot ");
|
||
3910 | - ieee80211_stop_queue(priv->ieee80211);
|
||
3911 | - }
|
||
3912 | -
|
||
3913 | - rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
|
||
3914 | - ieeerate2rtlrate(rate));
|
||
3915 | -
|
||
3916 | - priv->stats.txdatapkt++;
|
||
3917 | -
|
||
3918 | - if (!check_nic_enought_desc(dev, LOW_PRIORITY))
|
||
3919 | - ieee80211_stop_queue(priv->ieee80211);
|
||
3920 | -
|
||
3921 | - spin_unlock_irqrestore(&priv->tx_lock,flags);
|
||
3922 | -
|
||
3923 | +
|
||
3924 | + if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->fasttx == 0)
|
||
3925 | + {
|
||
3926 | + spin_lock_irqsave(&priv->tx_lock,flags);
|
||
3927 | + //DMESG("TX");
|
||
3928 | + if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
|
||
3929 | + DMESG("Error: no TX slot ");
|
||
3930 | + ieee80211_stop_queue_rtl7(priv->ieee80211);
|
||
3931 | + }
|
||
3932 | + rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
|
||
3933 | + ieeerate2rtlrate(rate));
|
||
3934 | +
|
||
3935 | + priv->stats.txdatapkt++;
|
||
3936 | +
|
||
3937 | + if (!check_nic_enought_desc(dev, LOW_PRIORITY))
|
||
3938 | + ieee80211_stop_queue_rtl7(priv->ieee80211);
|
||
3939 | + spin_unlock_irqrestore(&priv->tx_lock,flags);
|
||
3940 | + }
|
||
3941 | + else
|
||
3942 | + {
|
||
3943 | + rtl8180_tx_fast(dev, (u32*)skb->data, skb->len, ieeerate2rtlrate(rate));
|
||
3944 | + }
|
||
3945 | +
|
||
3946 | } |
||
3947 | #if 0 |
||
3948 | /* This is a rough attempt to TX a frame |
||
3949 | @@ -1148,12 +1209,12 @@ |
||
3950 | */ |
||
3951 | int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev) |
||
3952 | { |
||
3953 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
3954 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
3955 | int ret; |
||
3956 | unsigned long flags; |
||
3957 | -
|
||
3958 | +
|
||
3959 | spin_lock_irqsave(&priv->tx_lock,flags); |
||
3960 | -
|
||
3961 | +
|
||
3962 | ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE); |
||
3963 | /* |
||
3964 | int i; |
||
3965 | @@ -1163,9 +1224,9 @@ |
||
3966 | */ |
||
3967 | priv->ieee80211->stats.tx_bytes+=skb->len; |
||
3968 | priv->ieee80211->stats.tx_packets++; |
||
3969 | -
|
||
3970 | - spin_unlock_irqrestore(&priv->tx_lock,flags);
|
||
3971 | -
|
||
3972 | +
|
||
3973 | + spin_unlock_irqrestore(&priv->tx_lock,flags);
|
||
3974 | +
|
||
3975 | dev_kfree_skb_any(skb); |
||
3976 | return ret; |
||
3977 | } |
||
3978 | @@ -1178,7 +1239,7 @@ |
||
3979 | u16 duration; |
||
3980 | u16 drift; |
||
3981 | *ext=0; |
||
3982 | -
|
||
3983 | +
|
||
3984 | switch(rate){ |
||
3985 | case 0://1mbps |
||
3986 | *ext=0; |
||
3987 | @@ -1187,7 +1248,7 @@ |
||
3988 | if(drift ==0 ) break; |
||
3989 | duration++; |
||
3990 | break; |
||
3991 | -
|
||
3992 | +
|
||
3993 | case 1://2mbps |
||
3994 | *ext=0; |
||
3995 | duration = ((len+4)<<4) /0x4; |
||
3996 | @@ -1195,40 +1256,44 @@ |
||
3997 | if(drift ==0 ) break; |
||
3998 | duration++; |
||
3999 | break; |
||
4000 | -
|
||
4001 | +
|
||
4002 | case 2: //5.5mbps |
||
4003 | *ext=0; |
||
4004 | duration = ((len+4)<<4) /0xb; |
||
4005 | drift = ((len+4)<<4) % 0xb; |
||
4006 | - if(drift ==0 )
|
||
4007 | + if(drift ==0 )
|
||
4008 | break; |
||
4009 | duration++; |
||
4010 | break; |
||
4011 | -
|
||
4012 | +
|
||
4013 | default: |
||
4014 | - case 3://11mbps
|
||
4015 | + case 3://11mbps
|
||
4016 | *ext=0; |
||
4017 | duration = ((len+4)<<4) /0x16; |
||
4018 | drift = ((len+4)<<4) % 0x16; |
||
4019 | - if(drift ==0 )
|
||
4020 | + if(drift ==0 )
|
||
4021 | break; |
||
4022 | duration++; |
||
4023 | - if(drift > 6)
|
||
4024 | + if(drift > 6)
|
||
4025 | break; |
||
4026 | *ext=1; |
||
4027 | break; |
||
4028 | } |
||
4029 | -
|
||
4030 | +
|
||
4031 | return duration; |
||
4032 | } |
||
4033 | #endif |
||
4034 | |||
4035 | void rtl8180_try_wake_queue(struct net_device *dev, int pri); |
||
4036 | |||
4037 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
|
||
4038 | void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs) |
||
4039 | +#else
|
||
4040 | +void rtl8187_lptx_isr(struct urb *tx_urb)
|
||
4041 | +#endif
|
||
4042 | { |
||
4043 | struct net_device *dev = (struct net_device*)tx_urb->context; |
||
4044 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
4045 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
4046 | if(tx_urb->status == 0) |
||
4047 | priv->stats.txlpokint++; |
||
4048 | else |
||
4049 | @@ -1239,6 +1304,15 @@ |
||
4050 | rtl8180_try_wake_queue(dev,LOW_PRIORITY); |
||
4051 | } |
||
4052 | |||
4053 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
|
||
4054 | +void rtl8187_lptx_isr_fast(struct urb *tx_urb, struct pt_regs *regs)
|
||
4055 | +#else
|
||
4056 | +void rtl8187_lptx_isr_fast(struct urb *tx_urb)
|
||
4057 | +#endif
|
||
4058 | +{
|
||
4059 | + kfree(tx_urb->transfer_buffer);
|
||
4060 | + usb_free_urb(tx_urb);
|
||
4061 | +}
|
||
4062 | |||
4063 | void rtl8187_beacon_stop(struct net_device *dev) |
||
4064 | { |
||
4065 | @@ -1249,55 +1323,55 @@ |
||
4066 | if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) || |
||
4067 | (msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){ |
||
4068 | write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE); |
||
4069 | - write_nic_byte(dev, MSR, msr);
|
||
4070 | + write_nic_byte(dev, MSR, msr);
|
||
4071 | } |
||
4072 | -
|
||
4073 | -
|
||
4074 | +
|
||
4075 | +
|
||
4076 | } |
||
4077 | |||
4078 | |||
4079 | void rtl8187_net_update(struct net_device *dev) |
||
4080 | { |
||
4081 | |||
4082 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
4083 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
4084 | struct ieee80211_network *net; |
||
4085 | net = & priv->ieee80211->current_network; |
||
4086 | -
|
||
4087 | -
|
||
4088 | +
|
||
4089 | +
|
||
4090 | write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]); |
||
4091 | write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]); |
||
4092 | //for(i=0;i<ETH_ALEN;i++) |
||
4093 | // write_nic_byte(dev,BSSID+i,net->bssid[i]); |
||
4094 | |||
4095 | rtl8180_update_msr(dev); |
||
4096 | -
|
||
4097 | +
|
||
4098 | // rtl8180_set_mode(dev,EPROM_CMD_CONFIG); |
||
4099 | write_nic_word(dev, AtimWnd, 2); |
||
4100 | - write_nic_word(dev, AtimtrItv, 100);
|
||
4101 | + write_nic_word(dev, AtimtrItv, 100);
|
||
4102 | write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval); |
||
4103 | write_nic_word(dev, BcnIntTime, 100); |
||
4104 | -
|
||
4105 | +
|
||
4106 | |||
4107 | } |
||
4108 | |||
4109 | void rtl8187_beacon_tx(struct net_device *dev) |
||
4110 | { |
||
4111 | |||
4112 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
4113 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
4114 | struct sk_buff *skb; |
||
4115 | int i = 0; |
||
4116 | -
|
||
4117 | +
|
||
4118 | rtl8187_net_update(dev); |
||
4119 | -
|
||
4120 | - skb = ieee80211_get_beacon(priv->ieee80211);
|
||
4121 | -
|
||
4122 | -
|
||
4123 | - if(!skb){
|
||
4124 | +
|
||
4125 | + skb = ieee80211_get_beacon_rtl7(priv->ieee80211);
|
||
4126 | +
|
||
4127 | +
|
||
4128 | + if(!skb){
|
||
4129 | DMESG("not enought memory for allocating beacon"); |
||
4130 | return; |
||
4131 | } |
||
4132 | -
|
||
4133 | -#if 0
|
||
4134 | +
|
||
4135 | +#if 0
|
||
4136 | while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){ |
||
4137 | msleep_interruptible_rtl(HZ/2); |
||
4138 | if(i++ > 20){ |
||
4139 | @@ -1307,7 +1381,7 @@ |
||
4140 | } |
||
4141 | #endif |
||
4142 | write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7)); |
||
4143 | -
|
||
4144 | +
|
||
4145 | i=0; |
||
4146 | //while(!read_nic_byte(dev,BQREQ & (1<<7))) |
||
4147 | while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 ) |
||
4148 | @@ -1318,16 +1392,20 @@ |
||
4149 | return ; |
||
4150 | } |
||
4151 | } |
||
4152 | -
|
||
4153 | +
|
||
4154 | rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, |
||
4155 | 0, priv->ieee80211->basic_rate); |
||
4156 | -
|
||
4157 | +
|
||
4158 | } |
||
4159 | |||
4160 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
|
||
4161 | void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs) |
||
4162 | +#else
|
||
4163 | +void rtl8187_nptx_isr(struct urb *tx_urb)
|
||
4164 | +#endif
|
||
4165 | { |
||
4166 | struct net_device *dev = (struct net_device*)tx_urb->context; |
||
4167 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
4168 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
4169 | if(tx_urb->status == 0) |
||
4170 | priv->stats.txnpokint++; |
||
4171 | else |
||
4172 | @@ -1339,10 +1417,10 @@ |
||
4173 | } |
||
4174 | |||
4175 | |||
4176 | -/* This function do the real dirty work: it sends a TX command
|
||
4177 | - * descriptor plus data URB
|
||
4178 | +/* This function do the real dirty work: it sends a TX command
|
||
4179 | + * descriptor plus data URB
|
||
4180 | */ |
||
4181 | -
|
||
4182 | +
|
||
4183 | short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority, |
||
4184 | short morefrag, short rate) |
||
4185 | { |
||
4186 | @@ -1352,12 +1430,12 @@ |
||
4187 | int pend ; |
||
4188 | int status; |
||
4189 | struct urb *tx_urb; |
||
4190 | - int urb_len;
|
||
4191 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
4192 | + int urb_len;
|
||
4193 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
4194 | // int rate = ieeerate2rtlrate(priv->ieee80211->rate); |
||
4195 | |||
4196 | - pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
|
||
4197 | - /* we are locked here so the two atomic_read and inc are executed without interleaves */
|
||
4198 | + pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
|
||
4199 | + /* we are locked here so the two atomic_read and inc are executed without interleaves */
|
||
4200 | if( pend > MAX_TX_URB){ |
||
4201 | if(priority == NORM_PRIORITY) |
||
4202 | priv->stats.txnpdrop++; |
||
4203 | @@ -1365,52 +1443,38 @@ |
||
4204 | priv->stats.txlpdrop++; |
||
4205 | return -1; |
||
4206 | } |
||
4207 | -
|
||
4208 | -
|
||
4209 | +
|
||
4210 | //tx = kmalloc((len + 4*3), GFP_ATOMIC); |
||
4211 | urb_len = len + 4*3; |
||
4212 | if((0 == urb_len%64)||(0 == urb_len%512)) { |
||
4213 | - urb_len += 1;
|
||
4214 | + urb_len += 1;
|
||
4215 | } |
||
4216 | tx = kmalloc(urb_len, GFP_ATOMIC); |
||
4217 | if(!tx) return -ENOMEM; |
||
4218 | - //printk(KERN_WARNING "urb_len = %d\n", urb_len);
|
||
4219 | + //printk(KERN_WARNING "urb_len = %d\n", urb_len);
|
||
4220 | tx_urb = usb_alloc_urb(0,GFP_ATOMIC); |
||
4221 | -
|
||
4222 | +
|
||
4223 | if(!tx_urb){ |
||
4224 | -
|
||
4225 | +
|
||
4226 | kfree(tx); |
||
4227 | return -ENOMEM; |
||
4228 | } |
||
4229 | -
|
||
4230 | +
|
||
4231 | memcpy(tx+3,txbuf,len); |
||
4232 | tx[0] = 0; |
||
4233 | tx[0] |= len & 0xfff; |
||
4234 | tx[0] |= (1<<15); |
||
4235 | -
|
||
4236 | -// if(priv->shortpre)
|
||
4237 | -// tx[0] |= (1<<16);
|
||
4238 | -
|
||
4239 | - //if(len > priv->rts_threshold){
|
||
4240 | -// tx[0] |= (1<<23); //ENABLE RTS
|
||
4241 | -// tx[0] |= (1<<18); //ENABLE CTS
|
||
4242 | - //}
|
||
4243 | +
|
||
4244 | if(morefrag) tx[0] |= (1<<17); |
||
4245 | tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */ |
||
4246 | tx[0] |= (rate << 24); |
||
4247 | tx[1] = 0; |
||
4248 | -
|
||
4249 | -// duration = rtl8180_len2duration(len,
|
||
4250 | -// rate,&ext);
|
||
4251 | -// tx[1] |= (duration & 0x7fff) <<16;
|
||
4252 | -// if(ext) tx[1] |= (1<<31);
|
||
4253 | |||
4254 | -
|
||
4255 | // tx[2] = 0x303020; |
||
4256 | tx[2] = 3; // CW min |
||
4257 | tx[2] |= (7<<4); //CW max |
||
4258 | tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim |
||
4259 | -
|
||
4260 | +
|
||
4261 | // printk("%x\n%x\n",tx[0],tx[1]); |
||
4262 | |||
4263 | #ifdef DUMP_TX |
||
4264 | @@ -1421,7 +1485,7 @@ |
||
4265 | printk("---------------\n"); |
||
4266 | #endif |
||
4267 | |||
4268 | -
|
||
4269 | +
|
||
4270 | /* FIXME check what EP is for low/norm PRI */ |
||
4271 | usb_fill_bulk_urb(tx_urb,priv->udev, |
||
4272 | usb_sndbulkpipe(priv->udev,(priority == LOW_PRIORITY) ? 2:3), tx, |
||
4273 | @@ -1438,54 +1502,97 @@ |
||
4274 | } |
||
4275 | } |
||
4276 | |||
4277 | -
|
||
4278 | +/* This function do the real dirty work: it sends a TX command
|
||
4279 | + * descriptor plus data URB (fast)
|
||
4280 | + */
|
||
4281 | +
|
||
4282 | +short rtl8180_tx_fast(struct net_device *dev, u32* txbuf, int len, short rate)
|
||
4283 | +{
|
||
4284 | + u32 *tx;
|
||
4285 | + int status;
|
||
4286 | + struct urb *tx_urb;
|
||
4287 | + int urb_len;
|
||
4288 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
4289 | +
|
||
4290 | + urb_len = len + 4*3;
|
||
4291 | + if((0 == urb_len%64)||(0 == urb_len%512)) {
|
||
4292 | + urb_len += 1;
|
||
4293 | + }
|
||
4294 | + tx = kmalloc(urb_len, GFP_ATOMIC);
|
||
4295 | + if(!tx) return -ENOMEM;
|
||
4296 | +
|
||
4297 | + tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
|
||
4298 | +
|
||
4299 | + if(!tx_urb){
|
||
4300 | + kfree(tx);
|
||
4301 | + return -ENOMEM;
|
||
4302 | + }
|
||
4303 | +
|
||
4304 | + memcpy(tx+3,txbuf,len);
|
||
4305 | + tx[0] = (len & 0xfff) + 0x8000;
|
||
4306 | + tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
|
||
4307 | + tx[0] |= (rate << 24);
|
||
4308 | + tx[1] = 0;
|
||
4309 | + tx[2] = 2931;
|
||
4310 | +
|
||
4311 | + /* FIXME check what EP is for low/norm PRI */
|
||
4312 | + usb_fill_bulk_urb(tx_urb,priv->udev,
|
||
4313 | + usb_sndbulkpipe(priv->udev, 2), tx, urb_len, rtl8187_lptx_isr_fast, dev);
|
||
4314 | + status = usb_submit_urb(tx_urb, GFP_ATOMIC);
|
||
4315 | + if (!status){
|
||
4316 | + return 0;
|
||
4317 | + }else{
|
||
4318 | + return -1;
|
||
4319 | + }
|
||
4320 | +}
|
||
4321 | +
|
||
4322 | |||
4323 | void rtl8180_irq_rx_tasklet(struct r8180_priv * priv); |
||
4324 | |||
4325 | |||
4326 | short rtl8187_usb_initendpoints(struct net_device *dev) |
||
4327 | { |
||
4328 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
4329 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
4330 | int i; |
||
4331 | -
|
||
4332 | +
|
||
4333 | priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL); |
||
4334 | -
|
||
4335 | +
|
||
4336 | for(i=0;i<MAX_RX_URB;i++){ |
||
4337 | priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL); |
||
4338 | - if(!priv->rx_urb[i])
|
||
4339 | + if(!priv->rx_urb[i])
|
||
4340 | goto destroy; |
||
4341 | -
|
||
4342 | +
|
||
4343 | priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL); |
||
4344 | - if(!priv->rx_urb[i]->transfer_buffer)
|
||
4345 | + if(!priv->rx_urb[i]->transfer_buffer)
|
||
4346 | goto destroy1; |
||
4347 | -
|
||
4348 | +
|
||
4349 | priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE; |
||
4350 | } |
||
4351 | -
|
||
4352 | +
|
||
4353 | return 0; |
||
4354 | -
|
||
4355 | +
|
||
4356 | destroy1: |
||
4357 | usb_free_urb(priv->rx_urb[i]); |
||
4358 | -
|
||
4359 | +
|
||
4360 | destroy: |
||
4361 | while (--i >= 0){ |
||
4362 | kfree(priv->rx_urb[i]->transfer_buffer); |
||
4363 | usb_free_urb(priv->rx_urb[i]); |
||
4364 | } |
||
4365 | -
|
||
4366 | +
|
||
4367 | kfree(priv->rx_urb); |
||
4368 | -
|
||
4369 | +
|
||
4370 | priv->rx_urb = NULL; |
||
4371 | DMESGE("Endpoint Alloc Failure"); |
||
4372 | return -ENOMEM; |
||
4373 | -
|
||
4374 | +
|
||
4375 | } |
||
4376 | |||
4377 | void rtl8187_usb_deleteendpoints(struct net_device *dev) |
||
4378 | { |
||
4379 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
4380 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
4381 | int i; |
||
4382 | -
|
||
4383 | +
|
||
4384 | if(priv->rx_urb){ |
||
4385 | for(i=0;i<MAX_RX_URB;i++){ |
||
4386 | usb_kill_urb(priv->rx_urb[i]); |
||
4387 | @@ -1494,9 +1601,9 @@ |
||
4388 | } |
||
4389 | kfree(priv->rx_urb); |
||
4390 | priv->rx_urb = NULL; |
||
4391 | -
|
||
4392 | +
|
||
4393 | } |
||
4394 | -
|
||
4395 | +
|
||
4396 | } |
||
4397 | |||
4398 | |||
4399 | @@ -1505,16 +1612,16 @@ |
||
4400 | int i; |
||
4401 | u16 word; |
||
4402 | int basic_rate,min_rr_rate,max_rr_rate; |
||
4403 | -
|
||
4404 | -// struct r8180_priv *priv = ieee80211_priv(dev);
|
||
4405 | -
|
||
4406 | - //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
|
||
4407 | +
|
||
4408 | +// struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
4409 | +
|
||
4410 | + //if (ieee80211_is_54g_rtl7(priv->ieee80211->current_network) &&
|
||
4411 | // priv->ieee80211->state == IEEE80211_LINKED){ |
||
4412 | basic_rate = ieeerate2rtlrate(240); |
||
4413 | min_rr_rate = ieeerate2rtlrate(60); |
||
4414 | max_rr_rate = ieeerate2rtlrate(240); |
||
4415 | -
|
||
4416 | -//
|
||
4417 | +
|
||
4418 | +//
|
||
4419 | // }else{ |
||
4420 | // basic_rate = ieeerate2rtlrate(20); |
||
4421 | // min_rr_rate = ieeerate2rtlrate(10); |
||
4422 | @@ -1526,21 +1633,21 @@ |
||
4423 | |||
4424 | word = read_nic_word(dev, BRSR); |
||
4425 | word &= ~BRSR_MBR_8185; |
||
4426 | -
|
||
4427 | +
|
||
4428 | |||
4429 | for(i=0;i<=basic_rate;i++) |
||
4430 | word |= (1<<i); |
||
4431 | |||
4432 | write_nic_word(dev, BRSR, word); |
||
4433 | - //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
|
||
4434 | + DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
|
||
4435 | } |
||
4436 | |||
4437 | |||
4438 | void rtl8187_link_change(struct net_device *dev) |
||
4439 | { |
||
4440 | // int i; |
||
4441 | -
|
||
4442 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
4443 | +
|
||
4444 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
4445 | //write_nic_word(dev, BintrItv, net->beacon_interval); |
||
4446 | rtl8187_net_update(dev); |
||
4447 | /*update timing params*/ |
||
4448 | @@ -1553,24 +1660,24 @@ |
||
4449 | |||
4450 | short rtl8180_init(struct net_device *dev) |
||
4451 | { |
||
4452 | -
|
||
4453 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
4454 | +
|
||
4455 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
4456 | int i, j; |
||
4457 | u16 word; |
||
4458 | - int ch;
|
||
4459 | + int ch, chans;
|
||
4460 | //u16 version; |
||
4461 | - //u8 hw_version;
|
||
4462 | - //u8 config3;
|
||
4463 | -
|
||
4464 | + u8 hw_version;
|
||
4465 | + u8 config3;
|
||
4466 | +
|
||
4467 | //FIXME: these constants are placed in a bad pleace. |
||
4468 | |||
4469 | // priv->txbuffsize = 1024; |
||
4470 | // priv->txringcount = 32; |
||
4471 | // priv->rxbuffersize = 1024; |
||
4472 | -// priv->rxringcount = 32;
|
||
4473 | +// priv->rxringcount = 32;
|
||
4474 | // priv->txbeaconcount = 3; |
||
4475 | // priv->rx_skb_complete = 1; |
||
4476 | - //priv->txnp_pending.ispending=0;
|
||
4477 | + //priv->txnp_pending.ispending=0;
|
||
4478 | /* ^^ the SKB does not containt a partial RXed |
||
4479 | * packet (is empty) |
||
4480 | */ |
||
4481 | @@ -1580,15 +1687,24 @@ |
||
4482 | return -1; |
||
4483 | } |
||
4484 | ch=channels; |
||
4485 | + chans=0;
|
||
4486 | + for (i=1; i<=14; i++) {
|
||
4487 | + if( (u8)(ch & 0x01) ) chans++;
|
||
4488 | + ch >>= 1;
|
||
4489 | + }
|
||
4490 | + DMESG("Enabling %d channels.", chans);
|
||
4491 | + ch=channels;
|
||
4492 | // set channels 1..14 allowed in given locale |
||
4493 | for (i=1; i<=14; i++) { |
||
4494 | (priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01); |
||
4495 | ch >>= 1; |
||
4496 | } |
||
4497 | //memcpy(priv->stats,0,sizeof(struct Stats)); |
||
4498 | -
|
||
4499 | +
|
||
4500 | //priv->irq_enabled=0; |
||
4501 | -
|
||
4502 | +
|
||
4503 | + priv->dev = dev;
|
||
4504 | +
|
||
4505 | // priv->stats.rxdmafail=0; |
||
4506 | priv->stats.txrdu=0; |
||
4507 | // priv->stats.rxrdu=0; |
||
4508 | @@ -1612,33 +1728,37 @@ |
||
4509 | // priv->stats.txbeaconerr=0; |
||
4510 | priv->stats.txlperr=0; |
||
4511 | priv->stats.txlpokint=0; |
||
4512 | -
|
||
4513 | +
|
||
4514 | priv->ieee80211->iw_mode = IW_MODE_INFRA; |
||
4515 | -
|
||
4516 | +
|
||
4517 | priv->retry_rts = DEFAULT_RETRY_RTS; |
||
4518 | priv->retry_data = DEFAULT_RETRY_DATA; |
||
4519 | priv->ieee80211->rate = 110; //11 mbps |
||
4520 | priv->ieee80211->short_slot = 1; |
||
4521 | - priv->ieee80211->mode = IEEE_G;
|
||
4522 | + priv->ieee80211->mode = IEEE_G|IEEE_B;
|
||
4523 | priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0; |
||
4524 | spin_lock_init(&priv->tx_lock); |
||
4525 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
|
||
4526 | INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev); |
||
4527 | +#else
|
||
4528 | + INIT_WORK(&priv->reset_wq, rtl8180_restart);
|
||
4529 | +#endif
|
||
4530 | sema_init(&priv->wx_sem,1); |
||
4531 | tasklet_init(&priv->irq_rx_tasklet, |
||
4532 | (void(*)(unsigned long))rtl8180_irq_rx_tasklet, |
||
4533 | (unsigned long)priv); |
||
4534 | |||
4535 | - //priv->ieee80211->func =
|
||
4536 | + //priv->ieee80211->func =
|
||
4537 | // kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL); |
||
4538 | //memset(priv->ieee80211->func, 0, |
||
4539 | // sizeof(struct ieee80211_helper_functions)); |
||
4540 | - priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
|
||
4541 | + priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
|
||
4542 | priv->ieee80211->iw_mode = IW_MODE_INFRA; |
||
4543 | - priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
|
||
4544 | - IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
|
||
4545 | + priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
|
||
4546 | + IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
|
||
4547 | IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE | |
||
4548 | /*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE; |
||
4549 | -
|
||
4550 | +
|
||
4551 | priv->ieee80211->active_scan = 1; |
||
4552 | priv->ieee80211->rate = 110; //11 mbps |
||
4553 | priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION; |
||
4554 | @@ -1655,51 +1775,51 @@ |
||
4555 | priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume; |
||
4556 | //priv->ieee80211->start_send_beacons = NULL; |
||
4557 | //priv->ieee80211->stop_send_beacons = NULL; |
||
4558 | -
|
||
4559 | +
|
||
4560 | priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD; |
||
4561 | -
|
||
4562 | +
|
||
4563 | priv->card_8185 = 2; |
||
4564 | priv->phy_ver = 2; |
||
4565 | priv->card_type = USB; |
||
4566 | -
|
||
4567 | +
|
||
4568 | #if 0 |
||
4569 | hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT; |
||
4570 | -
|
||
4571 | +
|
||
4572 | switch (hw_version){ |
||
4573 | case HW_VERID_R8185_ABC: |
||
4574 | - DMESG("MAC controller is a RTL8185 b/g");
|
||
4575 | + DMESG("MAC controller is a RTL8185 b/g");
|
||
4576 | priv->card_8185 = 1; |
||
4577 | /* you should not find a card with 8225 PHY ver < C*/ |
||
4578 | priv->phy_ver = 2; |
||
4579 | break; |
||
4580 | -
|
||
4581 | +
|
||
4582 | case HW_VERID_R8185_D: |
||
4583 | - DMESG("MAC controller is a RTL8185 b/g (V. D)");
|
||
4584 | + DMESG("MAC controller is a RTL8185 b/g (V. D)");
|
||
4585 | priv->card_8185 = 2; |
||
4586 | /* you should not find a card with 8225 PHY ver < C*/ |
||
4587 | priv->phy_ver = 2; |
||
4588 | break; |
||
4589 | -
|
||
4590 | +
|
||
4591 | case HW_VERID_R8180_ABCD: |
||
4592 | DMESG("MAC controller is a RTL8180"); |
||
4593 | priv->card_8185 = 0; |
||
4594 | break; |
||
4595 | -
|
||
4596 | +
|
||
4597 | case HW_VERID_R8180_F: |
||
4598 | DMESG("MAC controller is a RTL8180 (v. F)"); |
||
4599 | priv->card_8185 = 0; |
||
4600 | break; |
||
4601 | -
|
||
4602 | +
|
||
4603 | default: |
||
4604 | DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version); |
||
4605 | priv->card_8185 = 0; |
||
4606 | break; |
||
4607 | } |
||
4608 | -
|
||
4609 | -
|
||
4610 | +
|
||
4611 | +
|
||
4612 | /* you should not found any 8185 Ver B Card */ |
||
4613 | priv->card_8185_Bversion = 0; |
||
4614 | -
|
||
4615 | +
|
||
4616 | config3 = read_nic_byte(dev, CONFIG3); |
||
4617 | if(config3 & 0x8){ |
||
4618 | priv->card_type = CARDBUS; |
||
4619 | @@ -1715,13 +1835,19 @@ |
||
4620 | #endif |
||
4621 | priv->enable_gpio0 = 0; |
||
4622 | |||
4623 | -
|
||
4624 | +
|
||
4625 | + hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
|
||
4626 | + config3 = read_nic_byte(dev, CONFIG3);
|
||
4627 | +
|
||
4628 | + DMESG("MAC chip version: %02X", hw_version);
|
||
4629 | + DMESG("Card type: %02X", config3);
|
||
4630 | +
|
||
4631 | /* commented out just because we already do |
||
4632 | this when resetting the card |
||
4633 | andrea 20050924 |
||
4634 | */ |
||
4635 | #if 0 |
||
4636 | -
|
||
4637 | +
|
||
4638 | u8 txcr, txreg50; |
||
4639 | u32 txreg54, txreg60; |
||
4640 | |||
4641 | @@ -1757,8 +1883,8 @@ |
||
4642 | // DMESG("<<txcr:%x>>", txcr); |
||
4643 | |||
4644 | #endif |
||
4645 | -
|
||
4646 | - /*the eeprom type is stored in RCR register bit #6 */
|
||
4647 | +
|
||
4648 | + /*the eeprom type is stored in RCR register bit #6 */
|
||
4649 | if (RCR_9356SEL & read_nic_dword(dev, RCR)){ |
||
4650 | priv->epromtype=EPROM_93c56; |
||
4651 | DMESG("Reported EEPROM chip is a 93c56 (2Kbit)"); |
||
4652 | @@ -1766,58 +1892,73 @@ |
||
4653 | priv->epromtype=EPROM_93c46; |
||
4654 | DMESG("Reported EEPROM chip is a 93c46 (1Kbit)"); |
||
4655 | } |
||
4656 | -
|
||
4657 | +
|
||
4658 | dev->get_stats = rtl8180_stats; |
||
4659 | -
|
||
4660 | +
|
||
4661 | dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff; |
||
4662 | dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8; |
||
4663 | dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff; |
||
4664 | dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8; |
||
4665 | dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff; |
||
4666 | dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8; |
||
4667 | -
|
||
4668 | +
|
||
4669 | DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr)); |
||
4670 | -
|
||
4671 | +
|
||
4672 | for(i=1,j=0; i<6; i+=2,j++){ |
||
4673 | -
|
||
4674 | +
|
||
4675 | word = eprom_read(dev,EPROM_TXPW0 + j); |
||
4676 | priv->chtxpwr[i]=word & 0xf; |
||
4677 | priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4; |
||
4678 | priv->chtxpwr[i+1]=(word & 0xf00)>>8; |
||
4679 | priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12; |
||
4680 | } |
||
4681 | -
|
||
4682 | +
|
||
4683 | for(i=1,j=0; i<4; i+=2,j++){ |
||
4684 | -
|
||
4685 | +
|
||
4686 | word = eprom_read(dev,EPROM_TXPW1 + j); |
||
4687 | priv->chtxpwr[i+6]=word & 0xf; |
||
4688 | priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4; |
||
4689 | priv->chtxpwr[i+6+1]=(word & 0xf00)>>8; |
||
4690 | priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12; |
||
4691 | } |
||
4692 | -
|
||
4693 | +
|
||
4694 | for(i=1,j=0; i<4; i+=2,j++){ |
||
4695 | -
|
||
4696 | +
|
||
4697 | word = eprom_read(dev,EPROM_TXPW2 + j); |
||
4698 | priv->chtxpwr[i+6+4]=word & 0xf; |
||
4699 | priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4; |
||
4700 | priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8; |
||
4701 | priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12; |
||
4702 | } |
||
4703 | -
|
||
4704 | -
|
||
4705 | +
|
||
4706 | +
|
||
4707 | priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID); |
||
4708 | -
|
||
4709 | +
|
||
4710 | +#ifdef DEBUG_TX_POWER
|
||
4711 | + dump_tx_power(dev);
|
||
4712 | +#endif
|
||
4713 | +
|
||
4714 | + DMESG("RF Chip ID: %02X", priv->rf_chip);
|
||
4715 | +
|
||
4716 | word = eprom_read(dev,EPROM_TXPW_BASE); |
||
4717 | priv->cck_txpwr_base = word & 0xf; |
||
4718 | priv->ofdm_txpwr_base = (word>>4) & 0xf; |
||
4719 | -
|
||
4720 | +
|
||
4721 | + priv->txpwr_max = 0;
|
||
4722 | + for(i=1; i<15; i++)
|
||
4723 | + {
|
||
4724 | + if(priv->chtxpwr[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr[i];
|
||
4725 | + if(priv->chtxpwr_ofdm[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr_ofdm[i];
|
||
4726 | + priv->chtxpwr_orig[i] = priv->chtxpwr[i];
|
||
4727 | + priv->chtxpwr_ofdm_orig[i] = priv->chtxpwr_ofdm[i];
|
||
4728 | + }
|
||
4729 | +
|
||
4730 | /* check RF frontend chipset */ |
||
4731 | -
|
||
4732 | +
|
||
4733 | switch (priv->rf_chip) { |
||
4734 | -
|
||
4735 | +
|
||
4736 | case EPROM_RFCHIPID_RTL8225U: |
||
4737 | -
|
||
4738 | +
|
||
4739 | DMESG("Card reports RF frontend Realtek 8225"); |
||
4740 | DMESGW("This driver has EXPERIMENTAL support for this chipset."); |
||
4741 | DMESGW("use it with care and at your own risk and"); |
||
4742 | @@ -1834,28 +1975,28 @@ |
||
4743 | DMESG("This seems a legacy 1st version radio"); |
||
4744 | } |
||
4745 | priv->rf_close = rtl8225_rf_close; |
||
4746 | -
|
||
4747 | +
|
||
4748 | priv->max_sens = RTL8225_RF_MAX_SENS; |
||
4749 | priv->sens = RTL8225_RF_DEF_SENS; |
||
4750 | break; |
||
4751 | -
|
||
4752 | +
|
||
4753 | default: |
||
4754 | DMESGW("Unknown RF module %x",priv->rf_chip); |
||
4755 | DMESGW("Exiting..."); |
||
4756 | return -1; |
||
4757 | -
|
||
4758 | +
|
||
4759 | } |
||
4760 | -
|
||
4761 | +
|
||
4762 | // DMESG("Energy threshold: %x",priv->cs_treshold); |
||
4763 | DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7); |
||
4764 | //DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2)); |
||
4765 | -
|
||
4766 | - if(rtl8187_usb_initendpoints(dev)!=0){
|
||
4767 | +
|
||
4768 | + if(rtl8187_usb_initendpoints(dev)!=0){
|
||
4769 | DMESG("Endopoints initialization failed"); |
||
4770 | return -ENOMEM; |
||
4771 | } |
||
4772 | -#if 0
|
||
4773 | - if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
|
||
4774 | +#if 0
|
||
4775 | + if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
|
||
4776 | return -ENOMEM; |
||
4777 | |||
4778 | if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount, |
||
4779 | @@ -1869,16 +2010,16 @@ |
||
4780 | if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount, |
||
4781 | TX_LOWPRIORITY_RING_ADDR)) |
||
4782 | return -ENOMEM; |
||
4783 | -
|
||
4784 | -
|
||
4785 | +
|
||
4786 | +
|
||
4787 | if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount)) |
||
4788 | return -ENOMEM; |
||
4789 | #endif |
||
4790 | -
|
||
4791 | +
|
||
4792 | |||
4793 | #ifdef DEBUG_EPROM |
||
4794 | dump_eprom(dev); |
||
4795 | -#endif
|
||
4796 | +#endif
|
||
4797 | return 0; |
||
4798 | |||
4799 | } |
||
4800 | @@ -1898,7 +2039,7 @@ |
||
4801 | rtl8180_set_mode(dev, EPROM_CMD_CONFIG); |
||
4802 | |||
4803 | conf3 = read_nic_byte(dev, CONFIG3); |
||
4804 | - write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
|
||
4805 | + write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
|
||
4806 | |||
4807 | write_nic_dword(dev, ANAPARAM2, a); |
||
4808 | |||
4809 | @@ -1918,23 +2059,23 @@ |
||
4810 | |||
4811 | conf3 = read_nic_byte(dev, CONFIG3); |
||
4812 | write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT)); |
||
4813 | -
|
||
4814 | +
|
||
4815 | write_nic_dword(dev, ANAPARAM, a); |
||
4816 | |||
4817 | conf3 = read_nic_byte(dev, CONFIG3); |
||
4818 | write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT)); |
||
4819 | |||
4820 | rtl8180_set_mode(dev, EPROM_CMD_NORMAL); |
||
4821 | -
|
||
4822 | +
|
||
4823 | } |
||
4824 | |||
4825 | |||
4826 | void rtl8185_tx_antenna(struct net_device *dev, u8 ant) |
||
4827 | { |
||
4828 | - write_nic_byte(dev, TX_ANTENNA, ant);
|
||
4829 | + write_nic_byte(dev, TX_ANTENNA, ant);
|
||
4830 | force_pci_posting(dev); |
||
4831 | mdelay(1); |
||
4832 | -}
|
||
4833 | +}
|
||
4834 | |||
4835 | |||
4836 | void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data) |
||
4837 | @@ -1942,26 +2083,26 @@ |
||
4838 | //u8 phyr; |
||
4839 | u32 phyw; |
||
4840 | // int i; |
||
4841 | -
|
||
4842 | +
|
||
4843 | adr |= 0x80; |
||
4844 | -
|
||
4845 | +
|
||
4846 | phyw= ((data<<8) | adr); |
||
4847 | -
|
||
4848 | -
|
||
4849 | -
|
||
4850 | - // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
|
||
4851 | +
|
||
4852 | +
|
||
4853 | +
|
||
4854 | + // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
|
||
4855 | write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24)); |
||
4856 | write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16)); |
||
4857 | write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8)); |
||
4858 | write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) )); |
||
4859 | |||
4860 | //read_nic_dword(dev, PHY_ADR); |
||
4861 | -#if 0
|
||
4862 | +#if 0
|
||
4863 | for(i=0;i<10;i++){ |
||
4864 | write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw); |
||
4865 | phyr = read_nic_byte(dev, PHY_READ); |
||
4866 | if(phyr == (data&0xff)) break; |
||
4867 | -
|
||
4868 | +
|
||
4869 | } |
||
4870 | #endif |
||
4871 | /* this is ok to fail when we write AGC table. check for AGC table might be |
||
4872 | @@ -1988,60 +2129,60 @@ |
||
4873 | |||
4874 | void rtl8180_adapter_start(struct net_device *dev) |
||
4875 | { |
||
4876 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
4877 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
4878 | //u32 anaparam; |
||
4879 | //u8 config3; |
||
4880 | -
|
||
4881 | +
|
||
4882 | //rtl8180_rtx_disable(dev); |
||
4883 | rtl8180_reset(dev); |
||
4884 | |||
4885 | write_nic_byte(dev,0x85,0); |
||
4886 | write_nic_byte(dev,0x91,0); |
||
4887 | -
|
||
4888 | +
|
||
4889 | /* light blink! */ |
||
4890 | write_nic_byte(dev,0x85,4); |
||
4891 | write_nic_byte(dev,0x91,1); |
||
4892 | write_nic_byte(dev,0x90,0); |
||
4893 | -
|
||
4894 | +
|
||
4895 | priv->irq_mask = 0xffff; |
||
4896 | /* |
||
4897 | priv->dma_poll_mask = 0; |
||
4898 | priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT); |
||
4899 | -*/
|
||
4900 | +*/
|
||
4901 | // rtl8180_beacon_tx_disable(dev); |
||
4902 | -
|
||
4903 | +
|
||
4904 | rtl8180_set_mode(dev, EPROM_CMD_CONFIG); |
||
4905 | write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]); |
||
4906 | write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff ); |
||
4907 | |||
4908 | rtl8180_set_mode(dev, EPROM_CMD_NORMAL); |
||
4909 | rtl8180_update_msr(dev); |
||
4910 | -
|
||
4911 | +
|
||
4912 | rtl8180_set_mode(dev, EPROM_CMD_CONFIG); |
||
4913 | -
|
||
4914 | +
|
||
4915 | write_nic_word(dev,0xf4,0xffff); |
||
4916 | write_nic_byte(dev, |
||
4917 | - CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
|
||
4918 | + CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
|
||
4919 | |||
4920 | rtl8180_set_mode(dev,EPROM_CMD_NORMAL); |
||
4921 | -
|
||
4922 | - write_nic_dword(dev,INT_TIMEOUT,0);
|
||
4923 | +
|
||
4924 | + write_nic_dword(dev,INT_TIMEOUT,0);
|
||
4925 | |||
4926 | #ifdef DEBUG_REGISTERS |
||
4927 | - rtl8180_dump_reg(dev);
|
||
4928 | + rtl8180_dump_reg(dev);
|
||
4929 | #endif |
||
4930 | -
|
||
4931 | -
|
||
4932 | - write_nic_byte(dev, WPA_CONFIG, 0);
|
||
4933 | +
|
||
4934 | +
|
||
4935 | + write_nic_byte(dev, WPA_CONFIG, 0);
|
||
4936 | |||
4937 | write_nic_byte(dev, RATE_FALLBACK, 0x81); |
||
4938 | rtl8187_set_rate(dev); |
||
4939 | -
|
||
4940 | - priv->rf_init(dev);
|
||
4941 | +
|
||
4942 | + priv->rf_init(dev);
|
||
4943 | |||
4944 | if(priv->rf_set_sens != NULL) |
||
4945 | - priv->rf_set_sens(dev,priv->sens);
|
||
4946 | -
|
||
4947 | + priv->rf_set_sens(dev,priv->sens);
|
||
4948 | +
|
||
4949 | write_nic_word(dev,0x5e,1); |
||
4950 | |||
4951 | #if 1 |
||
4952 | @@ -2054,13 +2195,13 @@ |
||
4953 | write_nic_byte(dev, 0xff, 0x60); |
||
4954 | |||
4955 | write_nic_word(dev,0x5e,0); |
||
4956 | -
|
||
4957 | -
|
||
4958 | +
|
||
4959 | +
|
||
4960 | rtl8180_irq_enable(dev); |
||
4961 | /*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY)); |
||
4962 | -
|
||
4963 | +
|
||
4964 | DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY)); |
||
4965 | -
|
||
4966 | +
|
||
4967 | DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY)); |
||
4968 | if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK"); |
||
4969 | if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK"); |
||
4970 | @@ -2077,8 +2218,8 @@ |
||
4971 | void rtl8180_start_tx_beacon(struct net_device *dev) |
||
4972 | { |
||
4973 | int i; |
||
4974 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
4975 | - u16 word;
|
||
4976 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
4977 | + u16 word;
|
||
4978 | DMESG("Enabling beacon TX"); |
||
4979 | //write_nic_byte(dev, 0x42,0xe6);// TCR |
||
4980 | //rtl8180_init_beacon(dev); |
||
4981 | @@ -2091,41 +2232,41 @@ |
||
4982 | //write_nic_word(dev,0x7a,0); |
||
4983 | //write_nic_word(dev,0x7a,0x8000); |
||
4984 | |||
4985 | -
|
||
4986 | +
|
||
4987 | word = read_nic_word(dev, BcnItv); |
||
4988 | word &= ~BcnItv_BcnItv; // clear Bcn_Itv |
||
4989 | write_nic_word(dev, BcnItv, word); |
||
4990 | |||
4991 | - write_nic_word(dev, AtimWnd,
|
||
4992 | + write_nic_word(dev, AtimWnd,
|
||
4993 | read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd); |
||
4994 | -
|
||
4995 | +
|
||
4996 | word = read_nic_word(dev, BintrItv); |
||
4997 | word &= ~BintrItv_BintrItv; |
||
4998 | -
|
||
4999 | - //word |= priv->ieee80211->beacon_interval *
|
||
5000 | +
|
||
5001 | + //word |= priv->ieee80211->beacon_interval *
|
||
5002 | // ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1); |
||
5003 | // FIXME:FIXME check if correct ^^ worked with 0x3e8; |
||
5004 | -
|
||
5005 | +
|
||
5006 | write_nic_word(dev, BintrItv, word); |
||
5007 | -
|
||
5008 | +
|
||
5009 | //write_nic_word(dev,0x2e,0xe002); |
||
5010 | //write_nic_dword(dev,0x30,0xb8c7832e); |
||
5011 | for(i=0; i<ETH_ALEN; i++) |
||
5012 | write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]); |
||
5013 | -
|
||
5014 | +
|
||
5015 | // rtl8180_update_msr(dev); |
||
5016 | |||
5017 | -
|
||
5018 | +
|
||
5019 | //write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */ |
||
5020 | -
|
||
5021 | +
|
||
5022 | rtl8180_set_mode(dev, EPROM_CMD_NORMAL); |
||
5023 | -
|
||
5024 | +
|
||
5025 | rtl8180_irq_enable(dev); |
||
5026 | -
|
||
5027 | +
|
||
5028 | /* VV !!!!!!!!!! VV*/ |
||
5029 | /* |
||
5030 | rtl8180_set_mode(dev,EPROM_CMD_CONFIG); |
||
5031 | - write_nic_byte(dev,0x9d,0x00);
|
||
5032 | + write_nic_byte(dev,0x9d,0x00);
|
||
5033 | rtl8180_set_mode(dev,EPROM_CMD_NORMAL); |
||
5034 | */ |
||
5035 | } |
||
5036 | @@ -2135,137 +2276,138 @@ |
||
5037 | ***************************************************************************/ |
||
5038 | static struct net_device_stats *rtl8180_stats(struct net_device *dev) |
||
5039 | { |
||
5040 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
5041 | -
|
||
5042 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
5043 | +
|
||
5044 | return &priv->ieee80211->stats; |
||
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 | priv->up=1; |
||
5054 | -
|
||
5055 | - //DMESG("Bringing up iface");
|
||
5056 | +
|
||
5057 | +// DMESG("Bringing up iface");
|
||
5058 | |||
5059 | rtl8180_adapter_start(dev); |
||
5060 | -
|
||
5061 | rtl8180_rx_enable(dev); |
||
5062 | -
|
||
5063 | rtl8180_tx_enable(dev); |
||
5064 | -
|
||
5065 | - ieee80211_softmac_start_protocol(priv->ieee80211);
|
||
5066 | -
|
||
5067 | - ieee80211_reset_queue(priv->ieee80211);
|
||
5068 | + ieee80211_softmac_start_protocol_rtl7(priv->ieee80211);
|
||
5069 | + ieee80211_reset_queue_rtl7(priv->ieee80211);
|
||
5070 | if(!netif_queue_stopped(dev)) |
||
5071 | netif_start_queue(dev); |
||
5072 | else |
||
5073 | netif_wake_queue(dev); |
||
5074 | -
|
||
5075 | return 0; |
||
5076 | } |
||
5077 | |||
5078 | |||
5079 | int rtl8180_open(struct net_device *dev) |
||
5080 | { |
||
5081 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
5082 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
5083 | int ret; |
||
5084 | -
|
||
5085 | +
|
||
5086 | down(&priv->wx_sem); |
||
5087 | +
|
||
5088 | ret = rtl8180_up(dev); |
||
5089 | up(&priv->wx_sem); |
||
5090 | return ret; |
||
5091 | -
|
||
5092 | +
|
||
5093 | } |
||
5094 | |||
5095 | |||
5096 | int rtl8180_up(struct net_device *dev) |
||
5097 | { |
||
5098 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
5099 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
5100 | |||
5101 | if (priv->up == 1) return -1; |
||
5102 | -
|
||
5103 | +
|
||
5104 | return _rtl8180_up(dev); |
||
5105 | } |
||
5106 | |||
5107 | |||
5108 | int rtl8180_close(struct net_device *dev) |
||
5109 | { |
||
5110 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
5111 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
5112 | int ret; |
||
5113 | -
|
||
5114 | +
|
||
5115 | down(&priv->wx_sem); |
||
5116 | -
|
||
5117 | +
|
||
5118 | ret = rtl8180_down(dev); |
||
5119 | -
|
||
5120 | +
|
||
5121 | up(&priv->wx_sem); |
||
5122 | -
|
||
5123 | +
|
||
5124 | return ret; |
||
5125 | |||
5126 | } |
||
5127 | |||
5128 | int rtl8180_down(struct net_device *dev) |
||
5129 | { |
||
5130 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
5131 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
5132 | |||
5133 | if (priv->up == 0) return -1; |
||
5134 | -
|
||
5135 | +
|
||
5136 | priv->up=0; |
||
5137 | |||
5138 | /* FIXME */ |
||
5139 | if (!netif_queue_stopped(dev)) |
||
5140 | netif_stop_queue(dev); |
||
5141 | -
|
||
5142 | +
|
||
5143 | rtl8180_rtx_disable(dev); |
||
5144 | rtl8180_irq_disable(dev); |
||
5145 | |||
5146 | - ieee80211_softmac_stop_protocol(priv->ieee80211);
|
||
5147 | -
|
||
5148 | + ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
|
||
5149 | +
|
||
5150 | return 0; |
||
5151 | } |
||
5152 | |||
5153 | |||
5154 | void rtl8180_commit(struct net_device *dev) |
||
5155 | { |
||
5156 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
5157 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
5158 | |||
5159 | if (priv->up == 0) return ; |
||
5160 | -
|
||
5161 | - ieee80211_softmac_stop_protocol(priv->ieee80211);
|
||
5162 | -
|
||
5163 | +
|
||
5164 | + ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
|
||
5165 | +
|
||
5166 | rtl8180_irq_disable(dev); |
||
5167 | rtl8180_rtx_disable(dev); |
||
5168 | _rtl8180_up(dev); |
||
5169 | } |
||
5170 | |||
5171 | +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
|
||
5172 | +void rtl8180_restart(struct work_struct *work)
|
||
5173 | +{
|
||
5174 | + struct r8180_priv *priv = container_of(work, struct r8180_priv, reset_wq);
|
||
5175 | + struct net_device *dev = priv->dev;
|
||
5176 | +#else
|
||
5177 | void rtl8180_restart(struct net_device *dev) |
||
5178 | { |
||
5179 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
5180 | -
|
||
5181 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
5182 | +#endif
|
||
5183 | down(&priv->wx_sem); |
||
5184 | -
|
||
5185 | rtl8180_commit(dev); |
||
5186 | -
|
||
5187 | +
|
||
5188 | up(&priv->wx_sem); |
||
5189 | } |
||
5190 | |||
5191 | static void r8180_set_multicast(struct net_device *dev) |
||
5192 | { |
||
5193 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
5194 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
5195 | short promisc; |
||
5196 | |||
5197 | //down(&priv->wx_sem); |
||
5198 | -
|
||
5199 | +
|
||
5200 | /* FIXME FIXME */ |
||
5201 | -
|
||
5202 | +
|
||
5203 | promisc = (dev->flags & IFF_PROMISC) ? 1:0; |
||
5204 | -
|
||
5205 | +
|
||
5206 | if (promisc != priv->promisc) |
||
5207 | // rtl8180_commit(dev); |
||
5208 | -
|
||
5209 | +
|
||
5210 | priv->promisc = promisc; |
||
5211 | -
|
||
5212 | +
|
||
5213 | //schedule_work(&priv->reset_wq); |
||
5214 | //up(&priv->wx_sem); |
||
5215 | } |
||
5216 | @@ -2273,17 +2415,17 @@ |
||
5217 | |||
5218 | int r8180_set_mac_adr(struct net_device *dev, void *mac) |
||
5219 | { |
||
5220 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
5221 | + struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
|
||
5222 | struct sockaddr *addr = mac; |
||
5223 | -
|
||
5224 | +
|
||
5225 | down(&priv->wx_sem); |
||
5226 | -
|
||
5227 | +
|
||
5228 | memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); |
||
5229 | -
|
||
5230 | +
|
||
5231 | schedule_work(&priv->reset_wq); |
||
5232 | -
|
||
5233 | +
|
||
5234 | up(&priv->wx_sem); |
||
5235 | -
|
||
5236 | +
|
||
5237 | return 0; |
||
5238 | } |
||
5239 | |||
5240 | @@ -2291,16 +2433,18 @@ |
||
5241 | /* based on ipw2200 driver */ |
||
5242 | int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) |
||
5243 | { |
||
5244 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
5245 | -
|
||
5246 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
5247 | + struct iwreq *wrq;
|
||
5248 | + int ret;
|
||
5249 | +
|
||
5250 | down(&priv->wx_sem); |
||
5251 | -
|
||
5252 | - struct iwreq *wrq = (struct iwreq *)rq;
|
||
5253 | -
|
||
5254 | - int ret=-1;
|
||
5255 | +
|
||
5256 | + wrq = (struct iwreq *)rq;
|
||
5257 | +
|
||
5258 | + ret=-1;
|
||
5259 | switch (cmd) { |
||
5260 | case RTL_IOCTL_WPA_SUPPLICANT: |
||
5261 | - ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
|
||
5262 | + ret = ieee80211_wpa_supplicant_ioctl_rtl7(priv->ieee80211, &wrq->u.data);
|
||
5263 | break; |
||
5264 | |||
5265 | default: |
||
5266 | @@ -2309,7 +2453,7 @@ |
||
5267 | } |
||
5268 | |||
5269 | up(&priv->wx_sem); |
||
5270 | -
|
||
5271 | +
|
||
5272 | return ret; |
||
5273 | } |
||
5274 | |||
5275 | @@ -2320,10 +2464,11 @@ |
||
5276 | struct net_device *dev = (struct net_device*)rx_urb->context; |
||
5277 | int status,len,flen; |
||
5278 | struct sk_buff *skb; |
||
5279 | - u32 *desc;
|
||
5280 | -
|
||
5281 | + u8 *desc;
|
||
5282 | + u8 signal,quality,rate;
|
||
5283 | +
|
||
5284 | //DMESG("rtl8187_rx_isr"); |
||
5285 | -
|
||
5286 | +
|
||
5287 | struct ieee80211_rx_stats stats = { |
||
5288 | .signal = 0, |
||
5289 | .noise = -98, |
||
5290 | @@ -2332,43 +2477,109 @@ |
||
5291 | .freq = IEEE80211_24GHZ_BAND, |
||
5292 | }; |
||
5293 | |||
5294 | +
|
||
5295 | //DMESG("RX %d ",rx_urb->status); |
||
5296 | status = rx_urb->status; |
||
5297 | if(status == 0){ |
||
5298 | -
|
||
5299 | +
|
||
5300 | len = rx_urb->actual_length; |
||
5301 | - // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
|
||
5302 | + // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
|
||
5303 | len -= 4*4;/* 4 dword and 4 byte CRC */ |
||
5304 | -
|
||
5305 | +#if 0
|
||
5306 | desc = (u32*)(rx_urb->transfer_buffer + len); |
||
5307 | -
|
||
5308 | +
|
||
5309 | flen = desc[0] & 0xfff; |
||
5310 | -
|
||
5311 | +
|
||
5312 | if( flen <= rx_urb->actual_length){ |
||
5313 | -
|
||
5314 | - stats.signal = (desc[1] & 0x7f00)>>8;
|
||
5315 | - stats.noise = desc[1] &0xff;
|
||
5316 | - stats.rate = desc[0] >> 20 & 0xf;
|
||
5317 | +
|
||
5318 | + //stats.signal = (desc[1] & 0x7f00)>>8;
|
||
5319 | + //stats.noise = desc[1] &0xff;
|
||
5320 | + signal=(desc[1]& (0xff0000))>>16;
|
||
5321 | + signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
|
||
5322 | +
|
||
5323 | + quality=(desc[1] & (0xff));
|
||
5324 | +
|
||
5325 | + rate=(desc[0] &((1<<23)|(1<<22)|(1<<21)|(1<<20)))>>20;
|
||
5326 | + // printk(KERN_INFO "rate is %d!\n",rate);
|
||
5327 | + stats.rate = rtl8180_rate2rate(rate);
|
||
5328 | + // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
|
||
5329 | + //stats.rate = desc[0] >> 20 & 0xf;
|
||
5330 | stats.mac_time[0] = desc[2]; |
||
5331 | stats.mac_time[1] = desc[3]; |
||
5332 | +#endif
|
||
5333 | +
|
||
5334 | + desc = rx_urb->transfer_buffer + len;
|
||
5335 | +
|
||
5336 | + flen = ((desc[1] & 0x0f) << 8) + (desc[0] & 0xff);
|
||
5337 | +
|
||
5338 | + if( flen <= rx_urb->actual_length){
|
||
5339 | + //stats.signal = (desc[1] & 0x7f00)>>8;
|
||
5340 | + //stats.noise = desc[1] &0xff;
|
||
5341 | + signal=(desc[6]& 0xfe)>>1;
|
||
5342 | + //signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
|
||
5343 | +
|
||
5344 | + quality=desc[4] & 0xff;
|
||
5345 | +
|
||
5346 | + //rate=(desc[2] &((1<<7)|(1<<6)|(1<<5)|(1<<4)))>>4;
|
||
5347 | + rate=(desc[2] & 0xf0)>>4;
|
||
5348 | + // printk(KERN_INFO "rate is %d!\n",rate);
|
||
5349 | + stats.rate = rtl8180_rate2rate(rate);
|
||
5350 | + // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
|
||
5351 | + //stats.rate = desc[0] >> 20 & 0xf;
|
||
5352 | + stats.mac_time[0] = desc[8] + (desc[9]<<8) + (desc[10]<<16) + (desc[11]<<24);
|
||
5353 | + stats.mac_time[1] = desc[12] + (desc[13]<<8) + (desc[14]<<16) + (desc[15]<<24);
|
||
5354 | +
|
||
5355 | +
|
||
5356 | + //calculate link quality begin
|
||
5357 | + if(!rtl8180_IsWirelessBMode(stats.rate) )
|
||
5358 | + { // OFDM rate.
|
||
5359 | + if(signal>90)
|
||
5360 | + signal=90;
|
||
5361 | + else if(signal<25)
|
||
5362 | + signal=25;
|
||
5363 | + signal = (90-signal)*100/65;
|
||
5364 | + }
|
||
5365 | + else
|
||
5366 | + { // CCK rate.
|
||
5367 | + if(signal>95)
|
||
5368 | + signal = 95;
|
||
5369 | + else if(signal<30)
|
||
5370 | + signal = 30;
|
||
5371 | + signal =(95-signal )*100/65;
|
||
5372 | + }
|
||
5373 | + priv->wstats.qual.level = signal;
|
||
5374 | + // printk(KERN_INFO "signal is %d!\n",signal);
|
||
5375 | + if(quality > 64)
|
||
5376 | + priv ->wstats.qual.qual = 0;
|
||
5377 | + else
|
||
5378 | + priv ->wstats.qual.qual = ((64-quality) * 100) / 64; // SQ value is the SIGNAL_QUALITY returned to IORequest,
|
||
5379 | + //and this value only appear when STA is associated to AP or
|
||
5380 | + // STA is in IBSS mode
|
||
5381 | + // printk(KERN_INFO "quality is %d!\n",priv->wstats.qual.qual);
|
||
5382 | + priv->wstats.qual.noise = 100 - priv ->wstats.qual.qual;
|
||
5383 | + priv->wstats.qual.updated = 7;
|
||
5384 | + if(priv->ieee80211->iw_mode == IW_MODE_MONITOR)
|
||
5385 | + {
|
||
5386 | + stats.signal = priv->wstats.qual.level;
|
||
5387 | + stats.noise = priv->wstats.qual.noise;
|
||
5388 | + }
|
||
5389 | + //calculate link quality end
|
||
5390 | skb = dev_alloc_skb(flen-4); |
||
5391 | - //skb_reserve(skb,2);
|
||
5392 | - if(skb){
|
||
5393 | + if(skb){
|
||
5394 | memcpy(skb_put(skb,flen-4), |
||
5395 | rx_urb->transfer_buffer,flen -4); |
||
5396 | -
|
||
5397 | +
|
||
5398 | #ifdef DUMP_RX |
||
5399 | int i; |
||
5400 | for(i=0;i<flen-4;i++) |
||
5401 | printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]); |
||
5402 | printk("------RATE %x:w---------------\n",stats.rate); |
||
5403 | -
|
||
5404 | +
|
||
5405 | #endif |
||
5406 | priv->stats.rxok++; |
||
5407 | // priv->rxskb = skb; |
||
5408 | // priv->tempstats = &stats; |
||
5409 | -
|
||
5410 | - if(!ieee80211_rx(priv->ieee80211,
|
||
5411 | + if(!ieee80211_rx_rtl7(priv->ieee80211,
|
||
5412 | skb, &stats)) |
||
5413 | dev_kfree_skb_any(skb); |
||
5414 | } |
||
5415 | @@ -2376,9 +2587,8 @@ |
||
5416 | }else{ |
||
5417 | priv->stats.rxstaterr++; |
||
5418 | priv->ieee80211->stats.rx_errors++; |
||
5419 | -
|
||
5420 | } |
||
5421 | -
|
||
5422 | +
|
||
5423 | if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb); |
||
5424 | else DMESG("RX process aborted due to explicit shutdown"); |
||
5425 | } |
||
5426 | @@ -2396,20 +2606,22 @@ |
||
5427 | struct r8180_priv *priv= NULL; |
||
5428 | struct usb_device *udev = interface_to_usbdev(intf); |
||
5429 | |||
5430 | -//printk("===> rtl8187_usb_probe()\n");
|
||
5431 | -
|
||
5432 | - dev = alloc_ieee80211(sizeof(struct r8180_priv));
|
||
5433 | -
|
||
5434 | +//printk("===> rtl8187_usb_probe()\n");
|
||
5435 | +
|
||
5436 | + dev = alloc_ieee80211_rtl7(sizeof(struct r8180_priv));
|
||
5437 | +
|
||
5438 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
|
||
5439 | SET_MODULE_OWNER(dev); |
||
5440 | - usb_set_intfdata(intf, dev);
|
||
5441 | -
|
||
5442 | +#endif
|
||
5443 | + usb_set_intfdata(intf, dev);
|
||
5444 | +
|
||
5445 | SET_NETDEV_DEV(dev, &intf->dev); |
||
5446 | |||
5447 | - priv = ieee80211_priv(dev);
|
||
5448 | + priv = ieee80211_priv_rtl7(dev);
|
||
5449 | priv->ieee80211 = netdev_priv(dev); |
||
5450 | -
|
||
5451 | +
|
||
5452 | priv->udev=udev; |
||
5453 | -
|
||
5454 | +
|
||
5455 | dev->open = rtl8180_open; |
||
5456 | dev->stop = rtl8180_close; |
||
5457 | //dev->hard_start_xmit = rtl8180_8023_hard_start_xmit; |
||
5458 | @@ -2418,41 +2630,46 @@ |
||
5459 | dev->do_ioctl = rtl8180_ioctl; |
||
5460 | dev->set_multicast_list = r8180_set_multicast; |
||
5461 | dev->set_mac_address = r8180_set_mac_adr; |
||
5462 | +#if WIRELESS_EXT >= 12
|
||
5463 | +#if WIRELESS_EXT < 17
|
||
5464 | dev->get_wireless_stats = r8180_get_wireless_stats; |
||
5465 | +#endif
|
||
5466 | + dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
|
||
5467 | +#endif
|
||
5468 | dev->type=ARPHRD_ETHER; |
||
5469 | -
|
||
5470 | +
|
||
5471 | if (dev_alloc_name(dev, ifname) < 0){ |
||
5472 | DMESG("Oops: devname already taken! Trying wlan%%d...\n"); |
||
5473 | ifname = "wlan%d"; |
||
5474 | dev_alloc_name(dev, ifname); |
||
5475 | } |
||
5476 | -
|
||
5477 | +
|
||
5478 | // dev->open=rtl8180_init; |
||
5479 | -
|
||
5480 | - if(rtl8180_init(dev)!=0){
|
||
5481 | +
|
||
5482 | + if(rtl8180_init(dev)!=0){
|
||
5483 | DMESG("Initialization failed"); |
||
5484 | goto fail; |
||
5485 | } |
||
5486 | -
|
||
5487 | +
|
||
5488 | netif_carrier_off(dev); |
||
5489 | netif_stop_queue(dev); |
||
5490 | -
|
||
5491 | +
|
||
5492 | register_netdev(dev); |
||
5493 | -
|
||
5494 | +
|
||
5495 | rtl8180_proc_init_one(dev); |
||
5496 | -
|
||
5497 | -
|
||
5498 | +
|
||
5499 | +
|
||
5500 | DMESG("Driver probe completed\n"); |
||
5501 | - return 0;
|
||
5502 | + return 0;
|
||
5503 | +
|
||
5504 | |||
5505 | -
|
||
5506 | fail: |
||
5507 | - free_ieee80211(dev);
|
||
5508 | -
|
||
5509 | + free_ieee80211_rtl7(dev);
|
||
5510 | +
|
||
5511 | DMESG("wlan driver load failed\n"); |
||
5512 | -
|
||
5513 | +
|
||
5514 | return -ENODEV; |
||
5515 | -
|
||
5516 | +
|
||
5517 | } |
||
5518 | |||
5519 | |||
5520 | @@ -2461,13 +2678,13 @@ |
||
5521 | struct r8180_priv *priv; |
||
5522 | struct net_device *dev = usb_get_intfdata(intf); |
||
5523 | if(dev){ |
||
5524 | -
|
||
5525 | +
|
||
5526 | unregister_netdev(dev); |
||
5527 | -
|
||
5528 | - priv=ieee80211_priv(dev);
|
||
5529 | -
|
||
5530 | +
|
||
5531 | + priv=ieee80211_priv_rtl7(dev);
|
||
5532 | +
|
||
5533 | rtl8180_proc_remove_one(dev); |
||
5534 | -
|
||
5535 | +
|
||
5536 | rtl8180_down(dev); |
||
5537 | priv->rf_close(dev); |
||
5538 | //rtl8180_rtx_disable(dev); |
||
5539 | @@ -2478,12 +2695,12 @@ |
||
5540 | |||
5541 | } |
||
5542 | // pci_disable_device(pdev); |
||
5543 | - free_ieee80211(dev);
|
||
5544 | + free_ieee80211_rtl7(dev);
|
||
5545 | DMESG("wlan driver removed\n"); |
||
5546 | } |
||
5547 | |||
5548 | |||
5549 | -static int __init rtl8187_usb_module_init(void)
|
||
5550 | +static int __init rtl8187_usb_module_init_rtl7(void)
|
||
5551 | { |
||
5552 | printk(KERN_INFO "\nLinux kernel driver for RTL8187 \ |
||
5553 | based WLAN cards\n"); |
||
5554 | @@ -2495,7 +2712,7 @@ |
||
5555 | } |
||
5556 | |||
5557 | |||
5558 | -static void __exit rtl8187_usb_module_exit(void)
|
||
5559 | +static void __exit rtl8187_usb_module_exit_rtl7(void)
|
||
5560 | { |
||
5561 | usb_deregister(&rtl8187_usb_driver); |
||
5562 | |||
5563 | @@ -2508,14 +2725,14 @@ |
||
5564 | { |
||
5565 | unsigned long flags; |
||
5566 | short enough_desc; |
||
5567 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
5568 | -
|
||
5569 | + struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
|
||
5570 | +
|
||
5571 | spin_lock_irqsave(&priv->tx_lock,flags); |
||
5572 | enough_desc = check_nic_enought_desc(dev,pri); |
||
5573 | - spin_unlock_irqrestore(&priv->tx_lock,flags);
|
||
5574 | -
|
||
5575 | + spin_unlock_irqrestore(&priv->tx_lock,flags);
|
||
5576 | +
|
||
5577 | if(enough_desc) |
||
5578 | - ieee80211_wake_queue(priv->ieee80211);
|
||
5579 | + ieee80211_wake_queue_rtl7(priv->ieee80211);
|
||
5580 | } |
||
5581 | |||
5582 | |||
5583 | @@ -2523,5 +2740,5 @@ |
||
5584 | /*************************************************************************** |
||
5585 | ------------------- module init / exit stubs ---------------- |
||
5586 | ****************************************************************************/ |
||
5587 | -module_init(rtl8187_usb_module_init);
|
||
5588 | -module_exit(rtl8187_usb_module_exit);
|
||
5589 | +module_init(rtl8187_usb_module_init_rtl7);
|
||
5590 | +module_exit(rtl8187_usb_module_exit_rtl7);
|
||
5591 | 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~ |
||
5592 | --- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c~ 2006-06-22 07:40:10.000000000 +0200 |
||
5593 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187_core.c~ 1970-01-01 01:00:00.000000000 +0100 |
||
5594 | @@ -1,2527 +0,0 @@ |
||
5595 | -/*
|
||
5596 | - This is part of rtl8187 OpenSource driver - v 0.1
|
||
5597 | - Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
|
||
5598 | - Released under the terms of GPL (General Public License)
|
||
5599 | -
|
||
5600 | -
|
||
5601 | - Parts of this driver are based on the rtl8180 driver skeleton
|
||
5602 | - from Patric Schenke & Andres Salomon.
|
||
5603 | -
|
||
5604 | - Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers.
|
||
5605 | -
|
||
5606 | - some ideas might be derived from David Young rtl8180 netbsd driver.
|
||
5607 | -
|
||
5608 | - Parts of the usb code are from the r8150.c driver in linux kernel
|
||
5609 | -
|
||
5610 | - Some ideas borrowed from the 8139too.c driver included in linux kernel.
|
||
5611 | -
|
||
5612 | - We (I?) want to thanks the Authors of those projecs and also the
|
||
5613 | - Ndiswrapper's project Authors.
|
||
5614 | -
|
||
5615 | - A special big thanks goes also to Realtek corp. for their help in my
|
||
5616 | - attempt to add RTL8187 and RTL8225 support, and to David Young also.
|
||
5617 | -
|
||
5618 | - - Please note that this file is a modified version from rtl8180-sa2400
|
||
5619 | - drv. So some other people have contributed to this project, and they are
|
||
5620 | - thanked in the rtl8180-sa2400 CHANGELOG.
|
||
5621 | -*/
|
||
5622 | -
|
||
5623 | -#ifndef CONFIG_FORCE_HARD_FLOAT
|
||
5624 | -double __floatsidf (int i) { return i; }
|
||
5625 | -unsigned int __fixunsdfsi (double d) { return d; }
|
||
5626 | -double __adddf3(double a, double b) { return a+b; }
|
||
5627 | -double __addsf3(float a, float b) { return a+b; }
|
||
5628 | -double __subdf3(double a, double b) { return a-b; }
|
||
5629 | -double __extendsfdf2(float a) {return a;}
|
||
5630 | -#endif
|
||
5631 | -
|
||
5632 | -#undef LOOP_TEST
|
||
5633 | -#undef DUMP_RX
|
||
5634 | -#undef DUMP_TX
|
||
5635 | -#undef DEBUG_TX_DESC2
|
||
5636 | -#undef RX_DONT_PASS_UL
|
||
5637 | -#undef DEBUG_EPROM
|
||
5638 | -#undef DEBUG_RX_VERBOSE
|
||
5639 | -#undef DUMMY_RX
|
||
5640 | -#undef DEBUG_ZERO_RX
|
||
5641 | -#undef DEBUG_RX_SKB
|
||
5642 | -#undef DEBUG_TX_FRAG
|
||
5643 | -#undef DEBUG_RX_FRAG
|
||
5644 | -#undef DEBUG_TX_FILLDESC
|
||
5645 | -#undef DEBUG_TX
|
||
5646 | -#undef DEBUG_IRQ
|
||
5647 | -#undef DEBUG_RX
|
||
5648 | -#undef DEBUG_RXALLOC
|
||
5649 | -#undef DEBUG_REGISTERS
|
||
5650 | -#undef DEBUG_RING
|
||
5651 | -#undef DEBUG_IRQ_TASKLET
|
||
5652 | -#undef DEBUG_TX_ALLOC
|
||
5653 | -#undef DEBUG_TX_DESC
|
||
5654 | -
|
||
5655 | -//#define CONFIG_RTL8180_IO_MAP
|
||
5656 | -
|
||
5657 | -#include "r8180_hw.h"
|
||
5658 | -#include "r8187.h"
|
||
5659 | -#include "r8180_rtl8225.h" /* RTL8225 Radio frontend */
|
||
5660 | -#include "r8180_93cx6.h" /* Card EEPROM */
|
||
5661 | -#include "r8180_wx.h"
|
||
5662 | -
|
||
5663 | -
|
||
5664 | -// FIXME: check if 2.6.7 is ok
|
||
5665 | -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
|
||
5666 | -#define usb_kill_urb usb_unlink_urb
|
||
5667 | -#endif
|
||
5668 | -
|
||
5669 | -#ifdef CONFIG_RTL8180_PM
|
||
5670 | -#include "r8180_pm.h"
|
||
5671 | -#endif
|
||
5672 | -
|
||
5673 | -#ifndef USB_VENDOR_ID_REALTEK
|
||
5674 | -#define USB_VENDOR_ID_REALTEK 0x0bda
|
||
5675 | -#endif
|
||
5676 | -#ifndef USB_VENDOR_ID_NETGEAR
|
||
5677 | -#define USB_VENDOR_ID_NETGEAR 0x0846
|
||
5678 | -#endif
|
||
5679 | -
|
||
5680 | -static struct usb_device_id rtl8187_usb_id_tbl[] = {
|
||
5681 | - {USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x8187)},
|
||
5682 | - {USB_DEVICE(USB_VENDOR_ID_NETGEAR, 0x6100)},
|
||
5683 | - {USB_DEVICE(USB_VENDOR_ID_NETGEAR, 0x6a00)},
|
||
5684 | -
|
||
5685 | - {}
|
||
5686 | -};
|
||
5687 | -
|
||
5688 | -static char* ifname = "wlan%d";
|
||
5689 | -#if 0
|
||
5690 | -static int hwseqnum = 0;
|
||
5691 | -static int hwwep = 0;
|
||
5692 | -#endif
|
||
5693 | -static int channels = 0x3fff;
|
||
5694 | -
|
||
5695 | -MODULE_LICENSE("GPL");
|
||
5696 | -MODULE_VERSION("V 1.1");
|
||
5697 | -MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
|
||
5698 | -MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>");
|
||
5699 | -MODULE_DESCRIPTION("Linux driver for Realtek RTL8187 WiFi cards");
|
||
5700 | -
|
||
5701 | -#if 0
|
||
5702 | -MODULE_PARM(ifname,"s");
|
||
5703 | -MODULE_PARM_DESC(devname," Net interface name, wlan%d=default");
|
||
5704 | -
|
||
5705 | -MODULE_PARM(hwseqnum,"i");
|
||
5706 | -MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default");
|
||
5707 | -
|
||
5708 | -MODULE_PARM(hwwep,"i");
|
||
5709 | -MODULE_PARM_DESC(hwwep," Try to use hardware WEP support. Still broken and not available on all cards");
|
||
5710 | -
|
||
5711 | -MODULE_PARM(channels,"i");
|
||
5712 | -MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI");
|
||
5713 | -#endif
|
||
5714 | -
|
||
5715 | -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9)
|
||
5716 | -module_param(ifname, charp, S_IRUGO|S_IWUSR );
|
||
5717 | -//module_param(hwseqnum,int, S_IRUGO|S_IWUSR);
|
||
5718 | -//module_param(hwwep,int, S_IRUGO|S_IWUSR);
|
||
5719 | -module_param(channels,int, S_IRUGO|S_IWUSR);
|
||
5720 | -#else
|
||
5721 | -MODULE_PARM(ifname, "s");
|
||
5722 | -//MODULE_PARM(hwseqnum,"i");
|
||
5723 | -//MODULE_PARM(hwwep,"i");
|
||
5724 | -MODULE_PARM(channels,"i");
|
||
5725 | -#endif
|
||
5726 | -
|
||
5727 | -MODULE_PARM_DESC(devname," Net interface name, wlan%d=default");
|
||
5728 | -//MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default");
|
||
5729 | -//MODULE_PARM_DESC(hwwep," Try to use hardware WEP support. Still broken and not available on all cards");
|
||
5730 | -MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI");
|
||
5731 | -
|
||
5732 | -static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
|
||
5733 | - const struct usb_device_id *id);
|
||
5734 | -
|
||
5735 | -static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf);
|
||
5736 | -
|
||
5737 | -static struct usb_driver rtl8187_usb_driver = {
|
||
5738 | -
|
||
5739 | -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
|
||
5740 | - .owner = THIS_MODULE,
|
||
5741 | -#endif
|
||
5742 | - .name = RTL8187_MODULE_NAME, /* Driver name */
|
||
5743 | - .id_table = rtl8187_usb_id_tbl, /* PCI_ID table */
|
||
5744 | - .probe = rtl8187_usb_probe, /* probe fn */
|
||
5745 | - .disconnect = rtl8187_usb_disconnect, /* remove fn */
|
||
5746 | -#ifdef CONFIG_RTL8180_PM
|
||
5747 | - .suspend = rtl8180_suspend, /* PM suspend fn */
|
||
5748 | - .resume = rtl8180_resume, /* PM resume fn */
|
||
5749 | -#else
|
||
5750 | - .suspend = NULL, /* PM suspend fn */
|
||
5751 | - .resume = NULL, /* PM resume fn */
|
||
5752 | -#endif
|
||
5753 | -};
|
||
5754 | -
|
||
5755 | -
|
||
5756 | -void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
|
||
5757 | -{
|
||
5758 | -
|
||
5759 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
5760 | - struct usb_device *udev = priv->udev;
|
||
5761 | -
|
||
5762 | - usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
|
||
5763 | - RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
|
||
5764 | - indx|0xfe00, 0, &data, 1, HZ / 2);
|
||
5765 | -}
|
||
5766 | -
|
||
5767 | -
|
||
5768 | -void write_nic_byte(struct net_device *dev, int indx, u8 data)
|
||
5769 | -{
|
||
5770 | -
|
||
5771 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
5772 | - struct usb_device *udev = priv->udev;
|
||
5773 | -
|
||
5774 | - usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
|
||
5775 | - RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
|
||
5776 | - indx|0xff00, 0, &data, 1, HZ / 2);
|
||
5777 | -}
|
||
5778 | -
|
||
5779 | -
|
||
5780 | -void write_nic_word(struct net_device *dev, int indx, u16 data)
|
||
5781 | -{
|
||
5782 | -
|
||
5783 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
5784 | - struct usb_device *udev = priv->udev;
|
||
5785 | -
|
||
5786 | - usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
|
||
5787 | - RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
|
||
5788 | - indx|0xff00, 0, &data, 2, HZ / 2);
|
||
5789 | -}
|
||
5790 | -
|
||
5791 | -
|
||
5792 | -void write_nic_dword(struct net_device *dev, int indx, u32 data)
|
||
5793 | -{
|
||
5794 | -
|
||
5795 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
5796 | - struct usb_device *udev = priv->udev;
|
||
5797 | -
|
||
5798 | - usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
|
||
5799 | - RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
|
||
5800 | - indx|0xff00, 0, &data, 4, HZ / 2);
|
||
5801 | -}
|
||
5802 | -
|
||
5803 | -
|
||
5804 | -
|
||
5805 | -u8 read_nic_byte(struct net_device *dev, int indx)
|
||
5806 | -{
|
||
5807 | - u8 data;
|
||
5808 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
5809 | - struct usb_device *udev = priv->udev;
|
||
5810 | -
|
||
5811 | - usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
|
||
5812 | - RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
|
||
5813 | - indx|0xff00, 0, &data, 1, HZ / 2);
|
||
5814 | - return data;
|
||
5815 | -}
|
||
5816 | -
|
||
5817 | -u8 read_nic_byte_E(struct net_device *dev, int indx)
|
||
5818 | -{
|
||
5819 | - u8 data;
|
||
5820 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
5821 | - struct usb_device *udev = priv->udev;
|
||
5822 | -
|
||
5823 | - usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
|
||
5824 | - RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
|
||
5825 | - indx|0xfe00, 0, &data, 1, HZ / 2);
|
||
5826 | - return data;
|
||
5827 | -}
|
||
5828 | -
|
||
5829 | -
|
||
5830 | -u16 read_nic_word(struct net_device *dev, int indx)
|
||
5831 | -{
|
||
5832 | - u16 data;
|
||
5833 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
5834 | - struct usb_device *udev = priv->udev;
|
||
5835 | -
|
||
5836 | - usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
|
||
5837 | - RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
|
||
5838 | - indx|0xff00, 0, &data, 2, HZ / 2);
|
||
5839 | - return data;
|
||
5840 | -}
|
||
5841 | -
|
||
5842 | -
|
||
5843 | -u32 read_nic_dword(struct net_device *dev, int indx)
|
||
5844 | -{
|
||
5845 | - u32 data;
|
||
5846 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
5847 | - struct usb_device *udev = priv->udev;
|
||
5848 | -
|
||
5849 | - usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
|
||
5850 | - RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
|
||
5851 | - indx|0xff00, 0, &data, 4, HZ / 2);
|
||
5852 | - return data;
|
||
5853 | -}
|
||
5854 | -
|
||
5855 | -/* this might still called in what was the PHY rtl8185/rtl8187 common code
|
||
5856 | - * plans are to possibilty turn it again in one common code...
|
||
5857 | - */
|
||
5858 | -inline void force_pci_posting(struct net_device *dev)
|
||
5859 | -{
|
||
5860 | -}
|
||
5861 | -
|
||
5862 | -
|
||
5863 | -//irqreturn_t rtl8180_interrupt(int irq, void *netdev, struct pt_regs *regs);
|
||
5864 | -//void set_nic_rxring(struct net_device *dev);
|
||
5865 | -//void set_nic_txring(struct net_device *dev);
|
||
5866 | -static struct net_device_stats *rtl8180_stats(struct net_device *dev);
|
||
5867 | -void rtl8180_commit(struct net_device *dev);
|
||
5868 | -void rtl8180_restart(struct net_device *dev);
|
||
5869 | -
|
||
5870 | -/****************************************************************************
|
||
5871 | - -----------------------------PROCFS STUFF-------------------------
|
||
5872 | -*****************************************************************************/
|
||
5873 | -
|
||
5874 | -static struct proc_dir_entry *rtl8180_proc = NULL;
|
||
5875 | -
|
||
5876 | -static int proc_get_registers(char *page, char **start,
|
||
5877 | - off_t offset, int count,
|
||
5878 | - int *eof, void *data)
|
||
5879 | -{
|
||
5880 | - struct net_device *dev = data;
|
||
5881 | -// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
5882 | -
|
||
5883 | - int len = 0;
|
||
5884 | - int i,n;
|
||
5885 | -
|
||
5886 | - int max=0xff;
|
||
5887 | -
|
||
5888 | - /* This dump the current register page */
|
||
5889 | - for(n=0;n<=max;)
|
||
5890 | - {
|
||
5891 | - //printk( "\nD: %2x> ", n);
|
||
5892 | - len += snprintf(page + len, count - len,
|
||
5893 | - "\nD: %2x > ",n);
|
||
5894 | -
|
||
5895 | - for(i=0;i<16 && n<=max;i++,n++)
|
||
5896 | - len += snprintf(page + len, count - len,
|
||
5897 | - "%2x ",read_nic_byte(dev,n));
|
||
5898 | -
|
||
5899 | - // printk("%2x ",read_nic_byte(dev,n));
|
||
5900 | - }
|
||
5901 | - len += snprintf(page + len, count - len,"\n");
|
||
5902 | -
|
||
5903 | -
|
||
5904 | -
|
||
5905 | - *eof = 1;
|
||
5906 | - return len;
|
||
5907 | -
|
||
5908 | -}
|
||
5909 | -
|
||
5910 | -#if 0
|
||
5911 | -static int proc_get_stats_hw(char *page, char **start,
|
||
5912 | - off_t offset, int count,
|
||
5913 | - int *eof, void *data)
|
||
5914 | -{
|
||
5915 | - struct net_device *dev = data;
|
||
5916 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
5917 | -
|
||
5918 | - int len = 0;
|
||
5919 | -
|
||
5920 | - len += snprintf(page + len, count - len,
|
||
5921 | - "NIC int: %lu\n"
|
||
5922 | - "Total int: %lu\n",
|
||
5923 | - priv->stats.ints,
|
||
5924 | - priv->stats.shints);
|
||
5925 | -
|
||
5926 | - *eof = 1;
|
||
5927 | - return len;
|
||
5928 | -}
|
||
5929 | -#endif
|
||
5930 | -
|
||
5931 | -static int proc_get_stats_tx(char *page, char **start,
|
||
5932 | - off_t offset, int count,
|
||
5933 | - int *eof, void *data)
|
||
5934 | -{
|
||
5935 | - struct net_device *dev = data;
|
||
5936 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
5937 | -
|
||
5938 | - int len = 0;
|
||
5939 | -
|
||
5940 | - len += snprintf(page + len, count - len,
|
||
5941 | - "TX normal priority ok int: %lu\n"
|
||
5942 | - "TX normal priority error int: %lu\n"
|
||
5943 | -// "TX high priority ok int: %lu\n"
|
||
5944 | -// "TX high priority failed error int: %lu\n"
|
||
5945 | - "TX low priority ok int: %lu\n"
|
||
5946 | - "TX low priority failed error int: %lu\n"
|
||
5947 | - "TX queue resume: %lu\n"
|
||
5948 | - "TX queue stopped?: %d\n"
|
||
5949 | - "TX fifo overflow: %lu\n"
|
||
5950 | -// "TX beacon: %lu\n"
|
||
5951 | - "TX lp queue: %d\n"
|
||
5952 | - "TX np queue: %d\n"
|
||
5953 | - "TX HW queue: %d\n"
|
||
5954 | - "TX lp dropped: %lu\n"
|
||
5955 | - "TX np dropped: %lu\n"
|
||
5956 | - "TX total data packets %lu\n",
|
||
5957 | -// "TX beacon aborted: %lu\n",
|
||
5958 | - priv->stats.txnpokint,
|
||
5959 | - priv->stats.txnperr,
|
||
5960 | -// priv->stats.txhpokint,
|
||
5961 | -// priv->stats.txhperr,
|
||
5962 | - priv->stats.txlpokint,
|
||
5963 | - priv->stats.txlperr,
|
||
5964 | - priv->stats.txresumed,
|
||
5965 | - netif_queue_stopped(dev),
|
||
5966 | - priv->stats.txoverflow,
|
||
5967 | -// priv->stats.txbeacon,
|
||
5968 | - atomic_read(&(priv->tx_lp_pending)),
|
||
5969 | - atomic_read(&(priv->tx_np_pending)),
|
||
5970 | - read_nic_byte(dev, TXFIFOCOUNT),
|
||
5971 | - priv->stats.txlpdrop,
|
||
5972 | - priv->stats.txnpdrop,
|
||
5973 | - priv->stats.txdatapkt
|
||
5974 | -// priv->stats.txbeaconerr
|
||
5975 | - );
|
||
5976 | -
|
||
5977 | - *eof = 1;
|
||
5978 | - return len;
|
||
5979 | -}
|
||
5980 | -
|
||
5981 | -
|
||
5982 | -
|
||
5983 | -static int proc_get_stats_rx(char *page, char **start,
|
||
5984 | - off_t offset, int count,
|
||
5985 | - int *eof, void *data)
|
||
5986 | -{
|
||
5987 | - struct net_device *dev = data;
|
||
5988 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
5989 | -
|
||
5990 | - int len = 0;
|
||
5991 | -
|
||
5992 | - len += snprintf(page + len, count - len,
|
||
5993 | - "RX packets: %lu\n"
|
||
5994 | - "RX urb status error: %lu\n"
|
||
5995 | - "RX invalid urb error: %lu\n",
|
||
5996 | - priv->stats.rxok,
|
||
5997 | - priv->stats.rxstaterr,
|
||
5998 | - priv->stats.rxurberr);
|
||
5999 | -
|
||
6000 | - *eof = 1;
|
||
6001 | - return len;
|
||
6002 | -}
|
||
6003 | -
|
||
6004 | -
|
||
6005 | -static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
|
||
6006 | -{
|
||
6007 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
6008 | -
|
||
6009 | - return &priv->wstats;
|
||
6010 | -}
|
||
6011 | -
|
||
6012 | -void rtl8180_proc_module_init(void)
|
||
6013 | -{
|
||
6014 | - DMESG("Initializing proc filesystem");
|
||
6015 | - rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net);
|
||
6016 | -}
|
||
6017 | -
|
||
6018 | -
|
||
6019 | -void rtl8180_proc_module_remove(void)
|
||
6020 | -{
|
||
6021 | - remove_proc_entry(RTL8187_MODULE_NAME, proc_net);
|
||
6022 | -}
|
||
6023 | -
|
||
6024 | -
|
||
6025 | -void rtl8180_proc_remove_one(struct net_device *dev)
|
||
6026 | -{
|
||
6027 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
6028 | - if (priv->dir_dev) {
|
||
6029 | - // remove_proc_entry("stats-hw", priv->dir_dev);
|
||
6030 | - remove_proc_entry("stats-tx", priv->dir_dev);
|
||
6031 | - remove_proc_entry("stats-rx", priv->dir_dev);
|
||
6032 | - // remove_proc_entry("stats-ieee", priv->dir_dev);
|
||
6033 | - // remove_proc_entry("stats-ap", priv->dir_dev);
|
||
6034 | - remove_proc_entry("registers", priv->dir_dev);
|
||
6035 | - remove_proc_entry(dev->name, rtl8180_proc);
|
||
6036 | - priv->dir_dev = NULL;
|
||
6037 | - }
|
||
6038 | -}
|
||
6039 | -
|
||
6040 | -
|
||
6041 | -void rtl8180_proc_init_one(struct net_device *dev)
|
||
6042 | -{
|
||
6043 | - struct proc_dir_entry *e;
|
||
6044 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
6045 | - priv->dir_dev = create_proc_entry(dev->name,
|
||
6046 | - S_IFDIR | S_IRUGO | S_IXUGO,
|
||
6047 | - rtl8180_proc);
|
||
6048 | - if (!priv->dir_dev) {
|
||
6049 | - DMESGE("Unable to initialize /proc/net/rtl8187/%s\n",
|
||
6050 | - dev->name);
|
||
6051 | - return;
|
||
6052 | - }
|
||
6053 | - #if 0
|
||
6054 | - e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO,
|
||
6055 | - priv->dir_dev, proc_get_stats_hw, dev);
|
||
6056 | -
|
||
6057 | - if (!e) {
|
||
6058 | - DMESGE("Unable to initialize "
|
||
6059 | - "/proc/net/rtl8187/%s/stats-hw\n",
|
||
6060 | - dev->name);
|
||
6061 | - }
|
||
6062 | - #endif
|
||
6063 | - e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
|
||
6064 | - priv->dir_dev, proc_get_stats_rx, dev);
|
||
6065 | -
|
||
6066 | - if (!e) {
|
||
6067 | - DMESGE("Unable to initialize "
|
||
6068 | - "/proc/net/rtl8187/%s/stats-rx\n",
|
||
6069 | - dev->name);
|
||
6070 | - }
|
||
6071 | -
|
||
6072 | -
|
||
6073 | - e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
|
||
6074 | - priv->dir_dev, proc_get_stats_tx, dev);
|
||
6075 | -
|
||
6076 | - if (!e) {
|
||
6077 | - DMESGE("Unable to initialize "
|
||
6078 | - "/proc/net/rtl8187/%s/stats-tx\n",
|
||
6079 | - dev->name);
|
||
6080 | - }
|
||
6081 | - #if 0
|
||
6082 | - e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO,
|
||
6083 | - priv->dir_dev, proc_get_stats_ieee, dev);
|
||
6084 | -
|
||
6085 | - if (!e) {
|
||
6086 | - DMESGE("Unable to initialize "
|
||
6087 | - "/proc/net/rtl8187/%s/stats-ieee\n",
|
||
6088 | - dev->name);
|
||
6089 | - }
|
||
6090 | -
|
||
6091 | -
|
||
6092 | - e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
|
||
6093 | - priv->dir_dev, proc_get_stats_ap, dev);
|
||
6094 | -
|
||
6095 | - if (!e) {
|
||
6096 | - DMESGE("Unable to initialize "
|
||
6097 | - "/proc/net/rtl8187/%s/stats-ap\n",
|
||
6098 | - dev->name);
|
||
6099 | - }
|
||
6100 | - #endif
|
||
6101 | -
|
||
6102 | - e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
|
||
6103 | - priv->dir_dev, proc_get_registers, dev);
|
||
6104 | -
|
||
6105 | - if (!e) {
|
||
6106 | - DMESGE("Unable to initialize "
|
||
6107 | - "/proc/net/rtl8187/%s/registers\n",
|
||
6108 | - dev->name);
|
||
6109 | - }
|
||
6110 | -}
|
||
6111 | -/****************************************************************************
|
||
6112 | - -----------------------------MISC STUFF-------------------------
|
||
6113 | -*****************************************************************************/
|
||
6114 | -
|
||
6115 | -/* this is only for debugging */
|
||
6116 | -void print_buffer(u32 *buffer, int len)
|
||
6117 | -{
|
||
6118 | - int i;
|
||
6119 | - u8 *buf =(u8*)buffer;
|
||
6120 | -
|
||
6121 | - printk("ASCII BUFFER DUMP (len: %x):\n",len);
|
||
6122 | -
|
||
6123 | - for(i=0;i<len;i++)
|
||
6124 | - printk("%c",buf[i]);
|
||
6125 | -
|
||
6126 | - printk("\nBINARY BUFFER DUMP (len: %x):\n",len);
|
||
6127 | -
|
||
6128 | - for(i=0;i<len;i++)
|
||
6129 | - printk("%x",buf[i]);
|
||
6130 | -
|
||
6131 | - printk("\n");
|
||
6132 | -}
|
||
6133 | -
|
||
6134 | -short check_nic_enought_desc(struct net_device *dev, priority_t priority)
|
||
6135 | -{
|
||
6136 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
6137 | -
|
||
6138 | - int used = atomic_read((priority == NORM_PRIORITY) ?
|
||
6139 | - &priv->tx_np_pending : &priv->tx_lp_pending);
|
||
6140 | -
|
||
6141 | - return (used < MAX_TX_URB);
|
||
6142 | -}
|
||
6143 | -
|
||
6144 | -void tx_timeout(struct net_device *dev)
|
||
6145 | -{
|
||
6146 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
6147 | - //rtl8180_commit(dev);
|
||
6148 | - schedule_work(&priv->reset_wq);
|
||
6149 | - //DMESG("TXTIMEOUT");
|
||
6150 | -}
|
||
6151 | -
|
||
6152 | -
|
||
6153 | -/* this is only for debug */
|
||
6154 | -void dump_eprom(struct net_device *dev)
|
||
6155 | -{
|
||
6156 | - int i;
|
||
6157 | - for(i=0; i<63; i++)
|
||
6158 | - DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
|
||
6159 | -}
|
||
6160 | -
|
||
6161 | -/* this is only for debug */
|
||
6162 | -void rtl8180_dump_reg(struct net_device *dev)
|
||
6163 | -{
|
||
6164 | - int i;
|
||
6165 | - int n;
|
||
6166 | - int max=0xff;
|
||
6167 | -
|
||
6168 | - DMESG("Dumping NIC register map");
|
||
6169 | -
|
||
6170 | - for(n=0;n<=max;)
|
||
6171 | - {
|
||
6172 | - printk( "\nD: %2x> ", n);
|
||
6173 | - for(i=0;i<16 && n<=max;i++,n++)
|
||
6174 | - printk("%2x ",read_nic_byte(dev,n));
|
||
6175 | - }
|
||
6176 | - printk("\n");
|
||
6177 | -}
|
||
6178 | -
|
||
6179 | -/****************************************************************************
|
||
6180 | - ------------------------------HW STUFF---------------------------
|
||
6181 | -*****************************************************************************/
|
||
6182 | -
|
||
6183 | -
|
||
6184 | -void rtl8180_irq_enable(struct net_device *dev)
|
||
6185 | -{
|
||
6186 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
6187 | - //priv->irq_enabled = 1;
|
||
6188 | -/*
|
||
6189 | - write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
|
||
6190 | - INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
|
||
6191 | - INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
|
||
6192 | - INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
|
||
6193 | -*/
|
||
6194 | - write_nic_word(dev,INTA_MASK, priv->irq_mask);
|
||
6195 | -}
|
||
6196 | -
|
||
6197 | -
|
||
6198 | -void rtl8180_irq_disable(struct net_device *dev)
|
||
6199 | -{
|
||
6200 | -// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
6201 | -
|
||
6202 | - write_nic_word(dev,INTA_MASK,0);
|
||
6203 | - force_pci_posting(dev);
|
||
6204 | -// priv->irq_enabled = 0;
|
||
6205 | -}
|
||
6206 | -
|
||
6207 | -
|
||
6208 | -void rtl8180_set_mode(struct net_device *dev,int mode)
|
||
6209 | -{
|
||
6210 | - u8 ecmd;
|
||
6211 | - ecmd=read_nic_byte(dev, EPROM_CMD);
|
||
6212 | - ecmd=ecmd &~ EPROM_CMD_OPERATING_MODE_MASK;
|
||
6213 | - ecmd=ecmd | (mode<<EPROM_CMD_OPERATING_MODE_SHIFT);
|
||
6214 | - ecmd=ecmd &~ (1<<EPROM_CS_SHIFT);
|
||
6215 | - ecmd=ecmd &~ (1<<EPROM_CK_SHIFT);
|
||
6216 | - write_nic_byte(dev, EPROM_CMD, ecmd);
|
||
6217 | -}
|
||
6218 | -
|
||
6219 | -
|
||
6220 | -void rtl8180_update_msr(struct net_device *dev)
|
||
6221 | -{
|
||
6222 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
6223 | - u8 msr;
|
||
6224 | -
|
||
6225 | - msr = read_nic_byte(dev, MSR);
|
||
6226 | - msr &= ~ MSR_LINK_MASK;
|
||
6227 | -
|
||
6228 | - /* do not change in link_state != WLAN_LINK_ASSOCIATED.
|
||
6229 | - * msr must be updated if the state is ASSOCIATING.
|
||
6230 | - * this is intentional and make sense for ad-hoc and
|
||
6231 | - * master (see the create BSS/IBSS func)
|
||
6232 | - */
|
||
6233 | - if (priv->ieee80211->state == IEEE80211_LINKED){
|
||
6234 | -
|
||
6235 | - if (priv->ieee80211->iw_mode == IW_MODE_INFRA)
|
||
6236 | - msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT);
|
||
6237 | - else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
|
||
6238 | - msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT);
|
||
6239 | - else if (priv->ieee80211->iw_mode == IW_MODE_MASTER)
|
||
6240 | - msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT);
|
||
6241 | -
|
||
6242 | - }else
|
||
6243 | - msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT);
|
||
6244 | -
|
||
6245 | - write_nic_byte(dev, MSR, msr);
|
||
6246 | -}
|
||
6247 | -
|
||
6248 | -void rtl8180_set_chan(struct net_device *dev,short ch)
|
||
6249 | -{
|
||
6250 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
6251 | - u32 tx;
|
||
6252 | - priv->chan=ch;
|
||
6253 | - #if 0
|
||
6254 | - if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
|
||
6255 | - priv->ieee80211->iw_mode == IW_MODE_MASTER){
|
||
6256 | -
|
||
6257 | - priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
|
||
6258 | - priv->ieee80211->master_chan = ch;
|
||
6259 | - rtl8180_update_beacon_ch(dev);
|
||
6260 | - }
|
||
6261 | - #endif
|
||
6262 | -
|
||
6263 | - /* this hack should avoid frame TX during channel setting*/
|
||
6264 | - tx = read_nic_dword(dev,TX_CONF);
|
||
6265 | - tx &= ~TX_LOOPBACK_MASK;
|
||
6266 | -
|
||
6267 | -#ifndef LOOP_TEST
|
||
6268 | - write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
|
||
6269 | -
|
||
6270 | - priv->rf_set_chan(dev,priv->chan);
|
||
6271 | - mdelay(10);
|
||
6272 | - write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
|
||
6273 | -#endif
|
||
6274 | -}
|
||
6275 | -void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs);
|
||
6276 | -
|
||
6277 | -
|
||
6278 | -void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb)
|
||
6279 | -{
|
||
6280 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
6281 | - int err;
|
||
6282 | -
|
||
6283 | -// u8 *rx;
|
||
6284 | -
|
||
6285 | - //DMESG("starting RX");
|
||
6286 | - /*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC);
|
||
6287 | - if(!rx){
|
||
6288 | - DMESGE("unable to allocate RX buffer");
|
||
6289 | - return;
|
||
6290 | - }*/
|
||
6291 | -
|
||
6292 | - usb_fill_bulk_urb(rx_urb,priv->udev,
|
||
6293 | - usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer,
|
||
6294 | - RX_URB_SIZE,rtl8187_rx_isr,dev);
|
||
6295 | - err = usb_submit_urb(rx_urb, GFP_ATOMIC);
|
||
6296 | - if(err && err != -EPERM){
|
||
6297 | - DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status);
|
||
6298 | -
|
||
6299 | - }
|
||
6300 | -
|
||
6301 | -}
|
||
6302 | -
|
||
6303 | -
|
||
6304 | -void rtl8187_rx_initiate(struct net_device *dev)
|
||
6305 | -{
|
||
6306 | - int i;
|
||
6307 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
6308 | -
|
||
6309 | - if(!priv->rx_urb)
|
||
6310 | - DMESGE("Cannot intiate RX urb mechanism");
|
||
6311 | - for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
|
||
6312 | - rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]);
|
||
6313 | -
|
||
6314 | -}
|
||
6315 | -
|
||
6316 | -void rtl8187_set_rxconf(struct net_device *dev)
|
||
6317 | -{
|
||
6318 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
6319 | - u32 rxconf;
|
||
6320 | -
|
||
6321 | - rxconf=read_nic_dword(dev,RX_CONF);
|
||
6322 | - rxconf = rxconf &~ MAC_FILTER_MASK;
|
||
6323 | - rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT);
|
||
6324 | - rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
|
||
6325 | - rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
|
||
6326 | - rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
|
||
6327 | - rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
|
||
6328 | -
|
||
6329 | - if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
|
||
6330 | -
|
||
6331 | - if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
|
||
6332 | - dev->flags & IFF_PROMISC){
|
||
6333 | - rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
|
||
6334 | - }else{
|
||
6335 | - rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT);
|
||
6336 | - rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
|
||
6337 | - }
|
||
6338 | -
|
||
6339 | - /*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){
|
||
6340 | - rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
|
||
6341 | - rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
|
||
6342 | - }*/
|
||
6343 | -
|
||
6344 | - if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
|
||
6345 | - rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
|
||
6346 | - rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT);
|
||
6347 | - }
|
||
6348 | -
|
||
6349 | - if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
|
||
6350 | - rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
|
||
6351 | -
|
||
6352 | -
|
||
6353 | - rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
|
||
6354 | - rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
|
||
6355 | -
|
||
6356 | -
|
||
6357 | - rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
|
||
6358 | -
|
||
6359 | - rxconf = rxconf &~ MAX_RX_DMA_MASK;
|
||
6360 | - rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
|
||
6361 | -
|
||
6362 | - rxconf = rxconf | RCR_ONLYERLPKT;
|
||
6363 | -
|
||
6364 | -// rxconf = rxconf &~ RCR_CS_MASK;
|
||
6365 | -// rxconf = rxconf | (1<<RCR_CS_SHIFT);
|
||
6366 | -
|
||
6367 | - write_nic_dword(dev, RX_CONF, rxconf);
|
||
6368 | -
|
||
6369 | - // V rtl suggested V //
|
||
6370 | -// write_nic_dword(dev, RX_CONF, 0x901ce70e);
|
||
6371 | -
|
||
6372 | - //fix_rx_fifo(dev);
|
||
6373 | -// //set_nic_rxring(dev);
|
||
6374 | - #ifdef DEBUG_RX
|
||
6375 | - DMESG("rxconf: %x %x",rxconf ,read_nic_dword(dev,RX_CONF));
|
||
6376 | - #endif
|
||
6377 | -}
|
||
6378 | -
|
||
6379 | -void rtl8180_rx_enable(struct net_device *dev)
|
||
6380 | -{
|
||
6381 | - u8 cmd;
|
||
6382 | -
|
||
6383 | -
|
||
6384 | - rtl8187_rx_initiate(dev);
|
||
6385 | -
|
||
6386 | - rtl8187_set_rxconf(dev);
|
||
6387 | -
|
||
6388 | - cmd=read_nic_byte(dev,CMD);
|
||
6389 | - write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
|
||
6390 | -#if 0
|
||
6391 | - /* In rtl8139 driver seems that DMA threshold has to be written
|
||
6392 | - * after enabling RX, so we rewrite RX_CONFIG register
|
||
6393 | - */
|
||
6394 | - //mdelay(100);
|
||
6395 | - write_nic_dword(dev, RX_CONF, rxconf);
|
||
6396 | -
|
||
6397 | -#endif
|
||
6398 | -
|
||
6399 | -}
|
||
6400 | -
|
||
6401 | -
|
||
6402 | -void rtl8180_tx_enable(struct net_device *dev)
|
||
6403 | -{
|
||
6404 | - u8 cmd;
|
||
6405 | - u8 byte;
|
||
6406 | - u32 txconf;
|
||
6407 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
6408 | -
|
||
6409 | - byte = read_nic_byte(dev,CW_CONF);
|
||
6410 | - byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
|
||
6411 | - byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
|
||
6412 | - write_nic_byte(dev, CW_CONF, byte);
|
||
6413 | -
|
||
6414 | - byte = read_nic_byte(dev, TX_AGC_CTL);
|
||
6415 | - byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
|
||
6416 | - byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
|
||
6417 | - byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT);
|
||
6418 | - write_nic_byte(dev, TX_AGC_CTL, byte);
|
||
6419 | -
|
||
6420 | - txconf= read_nic_dword(dev,TX_CONF);
|
||
6421 | -
|
||
6422 | - #if 0
|
||
6423 | - if(priv->card_8185){
|
||
6424 | -
|
||
6425 | - txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
|
||
6426 | -
|
||
6427 | - }else{
|
||
6428 | -
|
||
6429 | - if(priv->ieee80211->hw_seq)
|
||
6430 | - txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
|
||
6431 | - else
|
||
6432 | - txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
|
||
6433 | - }
|
||
6434 | - #endif
|
||
6435 | -
|
||
6436 | - txconf = txconf &~ TX_LOOPBACK_MASK;
|
||
6437 | -
|
||
6438 | -#ifndef LOOP_TEST
|
||
6439 | - txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
|
||
6440 | -#else
|
||
6441 | - txconf = txconf | (TX_LOOPBACK_BASEBAND<<TX_LOOPBACK_SHIFT);
|
||
6442 | -#endif
|
||
6443 | - txconf = txconf &~ TCR_DPRETRY_MASK;
|
||
6444 | - txconf = txconf &~ TCR_RTSRETRY_MASK;
|
||
6445 | -
|
||
6446 | - txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
|
||
6447 | - txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
|
||
6448 | -
|
||
6449 | - txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
|
||
6450 | -
|
||
6451 | - txconf = txconf &~ TCR_MXDMA_MASK;
|
||
6452 | - txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
|
||
6453 | -
|
||
6454 | - txconf = txconf | TCR_CWMIN;
|
||
6455 | - txconf = txconf | TCR_DISCW;
|
||
6456 | - txconf = txconf &~ TCR_SWPLCPLEN;
|
||
6457 | -
|
||
6458 | - txconf=txconf | (1<<TX_NOICV_SHIFT);
|
||
6459 | -
|
||
6460 | - write_nic_dword(dev,TX_CONF,txconf);
|
||
6461 | -
|
||
6462 | - // V RTL suggested V //
|
||
6463 | -// write_nic_dword(dev,TX_CONF,0x00e00707);
|
||
6464 | -
|
||
6465 | -
|
||
6466 | -#ifdef DEBUG_TX
|
||
6467 | - DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF));
|
||
6468 | -#endif
|
||
6469 | -
|
||
6470 | - cmd=read_nic_byte(dev,CMD);
|
||
6471 | - write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
|
||
6472 | -
|
||
6473 | -// mdelay(100);
|
||
6474 | - //write_nic_dword(dev,TX_CONF,txconf);
|
||
6475 | -// #endif
|
||
6476 | -/*
|
||
6477 | - rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
|
||
6478 | - write_nic_byte(dev, TX_DMA_POLLING, priv->dma_poll_mask);
|
||
6479 | - rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
|
||
6480 | - */
|
||
6481 | -}
|
||
6482 | -
|
||
6483 | -#if 0
|
||
6484 | -void rtl8180_beacon_tx_enable(struct net_device *dev)
|
||
6485 | -{
|
||
6486 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
6487 | - priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
|
||
6488 | - rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
|
||
6489 | - write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
|
||
6490 | - rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
|
||
6491 | -}
|
||
6492 | -
|
||
6493 | -
|
||
6494 | -void rtl8180_
|
||
6495 | -_disable(struct net_device *dev)
|
||
6496 | -{
|
||
6497 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
6498 | - priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
|
||
6499 | - rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
|
||
6500 | - write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
|
||
6501 | - rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
|
||
6502 | -}
|
||
6503 | -
|
||
6504 | -#endif
|
||
6505 | -
|
||
6506 | -
|
||
6507 | -void rtl8180_rtx_disable(struct net_device *dev)
|
||
6508 | -{
|
||
6509 | - u8 cmd;
|
||
6510 | - int i;
|
||
6511 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
6512 | -
|
||
6513 | - cmd=read_nic_byte(dev,CMD);
|
||
6514 | - write_nic_byte(dev, CMD, cmd &~ \
|
||
6515 | - ((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
|
||
6516 | - force_pci_posting(dev);
|
||
6517 | - mdelay(10);
|
||
6518 | - if(priv->rx_urb){
|
||
6519 | - for(i=0;i<MAX_RX_URB;i++)
|
||
6520 | - usb_kill_urb(priv->rx_urb[i]);
|
||
6521 | - }
|
||
6522 | - /*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT))
|
||
6523 | - udelay(10);
|
||
6524 | - */
|
||
6525 | -
|
||
6526 | -// if(!priv->rx_skb_complete)
|
||
6527 | -// dev_kfree_skb_any(priv->rx_skb);
|
||
6528 | -}
|
||
6529 | -
|
||
6530 | -
|
||
6531 | -int alloc_tx_beacon_desc_ring(struct net_device *dev, int count)
|
||
6532 | -{
|
||
6533 | - #if 0
|
||
6534 | - int i;
|
||
6535 | - u32 *tmp;
|
||
6536 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
6537 | -
|
||
6538 | - priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
|
||
6539 | - sizeof(u32)*8*count,
|
||
6540 | - &priv->txbeaconringdma);
|
||
6541 | - if (!priv->txbeaconring) return -1;
|
||
6542 | - for (tmp=priv->txbeaconring,i=0;i<count;i++){
|
||
6543 | - *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
|
||
6544 | - /*
|
||
6545 | - *(tmp+2) = (u32)dma_tmp;
|
||
6546 | - *(tmp+3) = bufsize;
|
||
6547 | - */
|
||
6548 | - if(i+1<count)
|
||
6549 | - *(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
|
||
6550 | - else
|
||
6551 | - *(tmp+4) = (u32)priv->txbeaconringdma;
|
||
6552 | -
|
||
6553 | - tmp=tmp+8;
|
||
6554 | - }
|
||
6555 | - #endif
|
||
6556 | - return 0;
|
||
6557 | -}
|
||
6558 | -
|
||
6559 | -
|
||
6560 | -void rtl8180_reset(struct net_device *dev)
|
||
6561 | -{
|
||
6562 | -
|
||
6563 | - u8 cr;
|
||
6564 | -
|
||
6565 | - /* make sure the analog power is on before
|
||
6566 | - * reset, otherwise reset may fail
|
||
6567 | - */
|
||
6568 | - rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
|
||
6569 | - rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
|
||
6570 | -
|
||
6571 | - rtl8180_irq_disable(dev);
|
||
6572 | -
|
||
6573 | - mdelay(200);
|
||
6574 | - write_nic_byte_E(dev,0x18,0x10);
|
||
6575 | - write_nic_byte_E(dev,0x18,0x11);
|
||
6576 | - write_nic_byte_E(dev,0x18,0x00);
|
||
6577 | - mdelay(200);
|
||
6578 | -
|
||
6579 | - cr=read_nic_byte(dev,CMD);
|
||
6580 | - cr = cr & 2;
|
||
6581 | - cr = cr | (1<<CMD_RST_SHIFT);
|
||
6582 | - write_nic_byte(dev,CMD,cr);
|
||
6583 | -
|
||
6584 | - force_pci_posting(dev);
|
||
6585 | -
|
||
6586 | - mdelay(200);
|
||
6587 | -
|
||
6588 | - if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
|
||
6589 | - DMESGW("Card reset timeout!");
|
||
6590 | - else
|
||
6591 | - DMESG("Card successfully reset");
|
||
6592 | -
|
||
6593 | - rtl8180_set_mode(dev,EPROM_CMD_LOAD);
|
||
6594 | - force_pci_posting(dev);
|
||
6595 | - mdelay(200);
|
||
6596 | -
|
||
6597 | - /* after the eeprom load cycle, make sure we have
|
||
6598 | - * correct anaparams
|
||
6599 | - */
|
||
6600 | - rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
|
||
6601 | - rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
|
||
6602 | -
|
||
6603 | -}
|
||
6604 | -
|
||
6605 | -inline u16 ieeerate2rtlrate(int rate)
|
||
6606 | -{
|
||
6607 | - switch(rate){
|
||
6608 | - case 10:
|
||
6609 | - return 0;
|
||
6610 | - case 20:
|
||
6611 | - return 1;
|
||
6612 | - case 55:
|
||
6613 | - return 2;
|
||
6614 | - case 110:
|
||
6615 | - return 3;
|
||
6616 | - case 60:
|
||
6617 | - return 4;
|
||
6618 | - case 90:
|
||
6619 | - return 5;
|
||
6620 | - case 120:
|
||
6621 | - return 6;
|
||
6622 | - case 180:
|
||
6623 | - return 7;
|
||
6624 | - case 240:
|
||
6625 | - return 8;
|
||
6626 | - case 360:
|
||
6627 | - return 9;
|
||
6628 | - case 480:
|
||
6629 | - return 10;
|
||
6630 | - case 540:
|
||
6631 | - return 11;
|
||
6632 | - default:
|
||
6633 | - return 3;
|
||
6634 | -
|
||
6635 | - }
|
||
6636 | -}
|
||
6637 | -static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540};
|
||
6638 | -inline u16 rtl8180_rate2rate(short rate)
|
||
6639 | -{
|
||
6640 | - if (rate >11) return 0;
|
||
6641 | - return rtl_rate[rate];
|
||
6642 | -}
|
||
6643 | -
|
||
6644 | -
|
||
6645 | -void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
|
||
6646 | -{
|
||
6647 | - struct net_device *dev = (struct net_device*)rx_urb->context;
|
||
6648 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
6649 | -
|
||
6650 | - priv->rxurb_task = rx_urb;
|
||
6651 | -// DMESGW("David: Rx tasklet start!");
|
||
6652 | - tasklet_schedule(&priv->irq_rx_tasklet);
|
||
6653 | -// DMESGW("=David: Rx tasklet finish!");
|
||
6654 | -}
|
||
6655 | -
|
||
6656 | -#if 0
|
||
6657 | -void rtl8180_tx_queues_stop(struct net_device *dev)
|
||
6658 | -{
|
||
6659 | - //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
6660 | - u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
|
||
6661 | - dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
|
||
6662 | - dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
|
||
6663 | - dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
|
||
6664 | -
|
||
6665 | - rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
|
||
6666 | - write_nic_byte(dev,TX_DMA_POLLING,dma_poll_mask);
|
||
6667 | - rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
|
||
6668 | -}
|
||
6669 | -#endif
|
||
6670 | -
|
||
6671 | -void rtl8180_data_hard_stop(struct net_device *dev)
|
||
6672 | -{
|
||
6673 | - //FIXME !!
|
||
6674 | - #if 0
|
||
6675 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
6676 | - priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
|
||
6677 | - rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
|
||
6678 | - write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
|
||
6679 | - rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
|
||
6680 | - #endif
|
||
6681 | -}
|
||
6682 | -
|
||
6683 | -
|
||
6684 | -void rtl8180_data_hard_resume(struct net_device *dev)
|
||
6685 | -{
|
||
6686 | - // FIXME !!
|
||
6687 | - #if 0
|
||
6688 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
6689 | - priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
|
||
6690 | - rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
|
||
6691 | - write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
|
||
6692 | - rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
|
||
6693 | - #endif
|
||
6694 | -}
|
||
6695 | -
|
||
6696 | -
|
||
6697 | -/* this function TX data frames when the ieee80211 stack requires this.
|
||
6698 | - * It checks also if we need to stop the ieee tx queue, eventually do it
|
||
6699 | - */
|
||
6700 | -void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
|
||
6701 | -{
|
||
6702 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
6703 | -
|
||
6704 | - short morefrag = 0;
|
||
6705 | - unsigned long flags;
|
||
6706 | - struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
|
||
6707 | -
|
||
6708 | - if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
|
||
6709 | - morefrag = 1;
|
||
6710 | -// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
|
||
6711 | - /*
|
||
6712 | - * This function doesn't require lock because we make
|
||
6713 | - * sure it's called with the tx_lock already acquired.
|
||
6714 | - * this come from the kernel's hard_xmit callback (trought
|
||
6715 | - * the ieee stack, or from the try_wake_queue (again trought
|
||
6716 | - * the ieee stack.
|
||
6717 | - */
|
||
6718 | - spin_lock_irqsave(&priv->tx_lock,flags);
|
||
6719 | -
|
||
6720 | - //DMESG("TX");
|
||
6721 | - if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
|
||
6722 | - DMESG("Error: no TX slot ");
|
||
6723 | - ieee80211_stop_queue(priv->ieee80211);
|
||
6724 | - }
|
||
6725 | -
|
||
6726 | - rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
|
||
6727 | - ieeerate2rtlrate(rate));
|
||
6728 | -
|
||
6729 | - priv->stats.txdatapkt++;
|
||
6730 | -
|
||
6731 | - if (!check_nic_enought_desc(dev, LOW_PRIORITY))
|
||
6732 | - ieee80211_stop_queue(priv->ieee80211);
|
||
6733 | -
|
||
6734 | - spin_unlock_irqrestore(&priv->tx_lock,flags);
|
||
6735 | -
|
||
6736 | -}
|
||
6737 | -#if 0
|
||
6738 | -/* This is a rough attempt to TX a frame
|
||
6739 | - * This is called by the ieee 80211 stack to TX management frames.
|
||
6740 | - * If the ring is full packet are dropped (for data frame the queue
|
||
6741 | - * is stopped before this can happen).
|
||
6742 | - */
|
||
6743 | -int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
|
||
6744 | -{
|
||
6745 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
6746 | - int ret;
|
||
6747 | - unsigned long flags;
|
||
6748 | -
|
||
6749 | - spin_lock_irqsave(&priv->tx_lock,flags);
|
||
6750 | -
|
||
6751 | - ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE);
|
||
6752 | -/*
|
||
6753 | - int i;
|
||
6754 | - for(i=0;i<skb->len;i++)
|
||
6755 | - printk("%x ", skb->data[i]);
|
||
6756 | - printk("--------------------\n");
|
||
6757 | -*/
|
||
6758 | - priv->ieee80211->stats.tx_bytes+=skb->len;
|
||
6759 | - priv->ieee80211->stats.tx_packets++;
|
||
6760 | -
|
||
6761 | - spin_unlock_irqrestore(&priv->tx_lock,flags);
|
||
6762 | -
|
||
6763 | - dev_kfree_skb_any(skb);
|
||
6764 | - return ret;
|
||
6765 | -}
|
||
6766 | -#endif
|
||
6767 | -
|
||
6768 | -#if 0
|
||
6769 | -// longpre 144+48 shortpre 72+24
|
||
6770 | -u16 rtl8180_len2duration(u32 len, short rate,short* ext)
|
||
6771 | -{
|
||
6772 | - u16 duration;
|
||
6773 | - u16 drift;
|
||
6774 | - *ext=0;
|
||
6775 | -
|
||
6776 | - switch(rate){
|
||
6777 | - case 0://1mbps
|
||
6778 | - *ext=0;
|
||
6779 | - duration = ((len+4)<<4) /0x2;
|
||
6780 | - drift = ((len+4)<<4) % 0x2;
|
||
6781 | - if(drift ==0 ) break;
|
||
6782 | - duration++;
|
||
6783 | - break;
|
||
6784 | -
|
||
6785 | - case 1://2mbps
|
||
6786 | - *ext=0;
|
||
6787 | - duration = ((len+4)<<4) /0x4;
|
||
6788 | - drift = ((len+4)<<4) % 0x4;
|
||
6789 | - if(drift ==0 ) break;
|
||
6790 | - duration++;
|
||
6791 | - break;
|
||
6792 | -
|
||
6793 | - case 2: //5.5mbps
|
||
6794 | - *ext=0;
|
||
6795 | - duration = ((len+4)<<4) /0xb;
|
||
6796 | - drift = ((len+4)<<4) % 0xb;
|
||
6797 | - if(drift ==0 )
|
||
6798 | - break;
|
||
6799 | - duration++;
|
||
6800 | - break;
|
||
6801 | -
|
||
6802 | - default:
|
||
6803 | - case 3://11mbps
|
||
6804 | - *ext=0;
|
||
6805 | - duration = ((len+4)<<4) /0x16;
|
||
6806 | - drift = ((len+4)<<4) % 0x16;
|
||
6807 | - if(drift ==0 )
|
||
6808 | - break;
|
||
6809 | - duration++;
|
||
6810 | - if(drift > 6)
|
||
6811 | - break;
|
||
6812 | - *ext=1;
|
||
6813 | - break;
|
||
6814 | - }
|
||
6815 | -
|
||
6816 | - return duration;
|
||
6817 | -}
|
||
6818 | -#endif
|
||
6819 | -
|
||
6820 | -void rtl8180_try_wake_queue(struct net_device *dev, int pri);
|
||
6821 | -
|
||
6822 | -void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs)
|
||
6823 | -{
|
||
6824 | - struct net_device *dev = (struct net_device*)tx_urb->context;
|
||
6825 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
6826 | - if(tx_urb->status == 0)
|
||
6827 | - priv->stats.txlpokint++;
|
||
6828 | - else
|
||
6829 | - priv->stats.txlperr++;
|
||
6830 | - kfree(tx_urb->transfer_buffer);
|
||
6831 | - usb_free_urb(tx_urb);
|
||
6832 | - atomic_dec(&priv->tx_lp_pending);
|
||
6833 | - rtl8180_try_wake_queue(dev,LOW_PRIORITY);
|
||
6834 | -}
|
||
6835 | -
|
||
6836 | -
|
||
6837 | -void rtl8187_beacon_stop(struct net_device *dev)
|
||
6838 | -{
|
||
6839 | - u8 msr, msrm, msr2;
|
||
6840 | - msr = read_nic_byte(dev, MSR);
|
||
6841 | - msrm = msr & MSR_LINK_MASK;
|
||
6842 | - msr2 = msr & ~MSR_LINK_MASK;
|
||
6843 | - if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) ||
|
||
6844 | - (msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){
|
||
6845 | - write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE);
|
||
6846 | - write_nic_byte(dev, MSR, msr);
|
||
6847 | - }
|
||
6848 | -
|
||
6849 | -
|
||
6850 | -}
|
||
6851 | -
|
||
6852 | -
|
||
6853 | -void rtl8187_net_update(struct net_device *dev)
|
||
6854 | -{
|
||
6855 | -
|
||
6856 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
6857 | - struct ieee80211_network *net;
|
||
6858 | - net = & priv->ieee80211->current_network;
|
||
6859 | -
|
||
6860 | -
|
||
6861 | - write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]);
|
||
6862 | - write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]);
|
||
6863 | - //for(i=0;i<ETH_ALEN;i++)
|
||
6864 | - // write_nic_byte(dev,BSSID+i,net->bssid[i]);
|
||
6865 | -
|
||
6866 | - rtl8180_update_msr(dev);
|
||
6867 | -
|
||
6868 | -// rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
|
||
6869 | - write_nic_word(dev, AtimWnd, 2);
|
||
6870 | - write_nic_word(dev, AtimtrItv, 100);
|
||
6871 | - write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval);
|
||
6872 | - write_nic_word(dev, BcnIntTime, 100);
|
||
6873 | -
|
||
6874 | -
|
||
6875 | -}
|
||
6876 | -
|
||
6877 | -void rtl8187_beacon_tx(struct net_device *dev)
|
||
6878 | -{
|
||
6879 | -
|
||
6880 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
6881 | - struct sk_buff *skb;
|
||
6882 | - int i = 0;
|
||
6883 | -
|
||
6884 | - rtl8187_net_update(dev);
|
||
6885 | -
|
||
6886 | - skb = ieee80211_get_beacon(priv->ieee80211);
|
||
6887 | -
|
||
6888 | -
|
||
6889 | - if(!skb){
|
||
6890 | - DMESG("not enought memory for allocating beacon");
|
||
6891 | - return;
|
||
6892 | - }
|
||
6893 | -
|
||
6894 | -#if 0
|
||
6895 | - while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){
|
||
6896 | - msleep_interruptible_rtl(HZ/2);
|
||
6897 | - if(i++ > 20){
|
||
6898 | - DMESG("get stuck to wait EP3 become ready");
|
||
6899 | - return ;
|
||
6900 | - }
|
||
6901 | - }
|
||
6902 | -#endif
|
||
6903 | - write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7));
|
||
6904 | -
|
||
6905 | - i=0;
|
||
6906 | - //while(!read_nic_byte(dev,BQREQ & (1<<7)))
|
||
6907 | - while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 )
|
||
6908 | - {
|
||
6909 | - msleep_interruptible_rtl(HZ/2);
|
||
6910 | - if(i++ > 10){
|
||
6911 | - DMESG("get stuck to wait HW beacon to be ready");
|
||
6912 | - return ;
|
||
6913 | - }
|
||
6914 | - }
|
||
6915 | -
|
||
6916 | - rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY,
|
||
6917 | - 0, priv->ieee80211->basic_rate);
|
||
6918 | -
|
||
6919 | -}
|
||
6920 | -
|
||
6921 | -void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs)
|
||
6922 | -{
|
||
6923 | - struct net_device *dev = (struct net_device*)tx_urb->context;
|
||
6924 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
6925 | - if(tx_urb->status == 0)
|
||
6926 | - priv->stats.txnpokint++;
|
||
6927 | - else
|
||
6928 | - priv->stats.txnperr++;
|
||
6929 | - kfree(tx_urb->transfer_buffer);
|
||
6930 | - usb_free_urb(tx_urb);
|
||
6931 | - atomic_dec(&priv->tx_np_pending);
|
||
6932 | - //rtl8180_try_wake_queue(dev,NORM_PRIORITY);
|
||
6933 | -}
|
||
6934 | -
|
||
6935 | -
|
||
6936 | -/* This function do the real dirty work: it sends a TX command
|
||
6937 | - * descriptor plus data URB
|
||
6938 | - */
|
||
6939 | -
|
||
6940 | -short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority,
|
||
6941 | - short morefrag, short rate)
|
||
6942 | -{
|
||
6943 | - u32 *tx;
|
||
6944 | -// u16 duration;
|
||
6945 | -// short ext;
|
||
6946 | - int pend ;
|
||
6947 | - int status;
|
||
6948 | - struct urb *tx_urb;
|
||
6949 | - int urb_len;
|
||
6950 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
6951 | -// int rate = ieeerate2rtlrate(priv->ieee80211->rate);
|
||
6952 | -
|
||
6953 | - pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
|
||
6954 | - /* we are locked here so the two atomic_read and inc are executed without interleaves */
|
||
6955 | - if( pend > MAX_TX_URB){
|
||
6956 | - if(priority == NORM_PRIORITY)
|
||
6957 | - priv->stats.txnpdrop++;
|
||
6958 | - else
|
||
6959 | - priv->stats.txlpdrop++;
|
||
6960 | - return -1;
|
||
6961 | - }
|
||
6962 | -
|
||
6963 | -
|
||
6964 | - //tx = kmalloc((len + 4*3), GFP_ATOMIC);
|
||
6965 | - urb_len = len + 4*3;
|
||
6966 | - if((0 == urb_len%64)||(0 == urb_len%512)) {
|
||
6967 | - urb_len += 1;
|
||
6968 | - }
|
||
6969 | - tx = kmalloc(urb_len, GFP_ATOMIC);
|
||
6970 | - if(!tx) return -ENOMEM;
|
||
6971 | -printk(KERN_WARNING "urb_len = %d\n", urb_len);
|
||
6972 | - tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
|
||
6973 | -
|
||
6974 | - if(!tx_urb){
|
||
6975 | -
|
||
6976 | - kfree(tx);
|
||
6977 | - return -ENOMEM;
|
||
6978 | - }
|
||
6979 | -
|
||
6980 | - memcpy(tx+3,txbuf,len);
|
||
6981 | - tx[0] = 0;
|
||
6982 | - tx[0] |= len & 0xfff;
|
||
6983 | - tx[0] |= (1<<15);
|
||
6984 | -
|
||
6985 | -// if(priv->shortpre)
|
||
6986 | -// tx[0] |= (1<<16);
|
||
6987 | -
|
||
6988 | - //if(len > priv->rts_threshold){
|
||
6989 | -// tx[0] |= (1<<23); //ENABLE RTS
|
||
6990 | -// tx[0] |= (1<<18); //ENABLE CTS
|
||
6991 | - //}
|
||
6992 | - if(morefrag) tx[0] |= (1<<17);
|
||
6993 | - tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
|
||
6994 | - tx[0] |= (rate << 24);
|
||
6995 | - tx[1] = 0;
|
||
6996 | -
|
||
6997 | -// duration = rtl8180_len2duration(len,
|
||
6998 | -// rate,&ext);
|
||
6999 | -// tx[1] |= (duration & 0x7fff) <<16;
|
||
7000 | -// if(ext) tx[1] |= (1<<31);
|
||
7001 | -
|
||
7002 | -
|
||
7003 | -// tx[2] = 0x303020;
|
||
7004 | - tx[2] = 3; // CW min
|
||
7005 | - tx[2] |= (7<<4); //CW max
|
||
7006 | - tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim
|
||
7007 | -
|
||
7008 | -// printk("%x\n%x\n",tx[0],tx[1]);
|
||
7009 | -
|
||
7010 | - #ifdef DUMP_TX
|
||
7011 | - int i;
|
||
7012 | - printk("<Tx pkt>--rate %x---",rate);
|
||
7013 | - for (i = 0; i < (len + 3); i++)
|
||
7014 | - printk("%2x", ((u8*)tx)[i]);
|
||
7015 | - printk("---------------\n");
|
||
7016 | - #endif
|
||
7017 | -
|
||
7018 | -
|
||
7019 | - /* FIXME check what EP is for low/norm PRI */
|
||
7020 | - usb_fill_bulk_urb(tx_urb,priv->udev,
|
||
7021 | - usb_sndbulkpipe(priv->udev,(priority == LOW_PRIORITY) ? 2:3), tx,
|
||
7022 | - urb_len, (priority == LOW_PRIORITY)?rtl8187_lptx_isr:rtl8187_nptx_isr, dev);
|
||
7023 | - status = usb_submit_urb(tx_urb, GFP_ATOMIC);
|
||
7024 | - if (!status){
|
||
7025 | - atomic_inc((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
|
||
7026 | - return 0;
|
||
7027 | - }else{
|
||
7028 | - DMESGE("Error TX URB %d, error %d",
|
||
7029 | - atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending),
|
||
7030 | - status);
|
||
7031 | - return -1;
|
||
7032 | - }
|
||
7033 | -}
|
||
7034 | -
|
||
7035 | -
|
||
7036 | -
|
||
7037 | -void rtl8180_irq_rx_tasklet(struct r8180_priv * priv);
|
||
7038 | -
|
||
7039 | -
|
||
7040 | -short rtl8187_usb_initendpoints(struct net_device *dev)
|
||
7041 | -{
|
||
7042 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
7043 | - int i;
|
||
7044 | -
|
||
7045 | - priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
|
||
7046 | -
|
||
7047 | - for(i=0;i<MAX_RX_URB;i++){
|
||
7048 | - priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL);
|
||
7049 | - if(!priv->rx_urb[i])
|
||
7050 | - goto destroy;
|
||
7051 | -
|
||
7052 | - priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL);
|
||
7053 | - if(!priv->rx_urb[i]->transfer_buffer)
|
||
7054 | - goto destroy1;
|
||
7055 | -
|
||
7056 | - priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE;
|
||
7057 | - }
|
||
7058 | -
|
||
7059 | - return 0;
|
||
7060 | -
|
||
7061 | -destroy1:
|
||
7062 | - usb_free_urb(priv->rx_urb[i]);
|
||
7063 | -
|
||
7064 | -destroy:
|
||
7065 | - while (--i >= 0){
|
||
7066 | - kfree(priv->rx_urb[i]->transfer_buffer);
|
||
7067 | - usb_free_urb(priv->rx_urb[i]);
|
||
7068 | - }
|
||
7069 | -
|
||
7070 | - kfree(priv->rx_urb);
|
||
7071 | -
|
||
7072 | - priv->rx_urb = NULL;
|
||
7073 | - DMESGE("Endpoint Alloc Failure");
|
||
7074 | - return -ENOMEM;
|
||
7075 | -
|
||
7076 | -}
|
||
7077 | -
|
||
7078 | -void rtl8187_usb_deleteendpoints(struct net_device *dev)
|
||
7079 | -{
|
||
7080 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
7081 | - int i;
|
||
7082 | -
|
||
7083 | - if(priv->rx_urb){
|
||
7084 | - for(i=0;i<MAX_RX_URB;i++){
|
||
7085 | - usb_kill_urb(priv->rx_urb[i]);
|
||
7086 | - kfree(priv->rx_urb[i]->transfer_buffer);
|
||
7087 | - usb_free_urb(priv->rx_urb[i]);
|
||
7088 | - }
|
||
7089 | - kfree(priv->rx_urb);
|
||
7090 | - priv->rx_urb = NULL;
|
||
7091 | -
|
||
7092 | - }
|
||
7093 | -
|
||
7094 | -}
|
||
7095 | -
|
||
7096 | -
|
||
7097 | -void rtl8187_set_rate(struct net_device *dev)
|
||
7098 | -{
|
||
7099 | - int i;
|
||
7100 | - u16 word;
|
||
7101 | - int basic_rate,min_rr_rate,max_rr_rate;
|
||
7102 | -
|
||
7103 | -// struct r8180_priv *priv = ieee80211_priv(dev);
|
||
7104 | -
|
||
7105 | - //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
|
||
7106 | -// priv->ieee80211->state == IEEE80211_LINKED){
|
||
7107 | - basic_rate = ieeerate2rtlrate(240);
|
||
7108 | - min_rr_rate = ieeerate2rtlrate(60);
|
||
7109 | - max_rr_rate = ieeerate2rtlrate(240);
|
||
7110 | -
|
||
7111 | -//
|
||
7112 | -// }else{
|
||
7113 | -// basic_rate = ieeerate2rtlrate(20);
|
||
7114 | -// min_rr_rate = ieeerate2rtlrate(10);
|
||
7115 | -// max_rr_rate = ieeerate2rtlrate(110);
|
||
7116 | -// }
|
||
7117 | -
|
||
7118 | - write_nic_byte(dev, RESP_RATE,
|
||
7119 | - max_rr_rate<<MAX_RESP_RATE_SHIFT| min_rr_rate<<MIN_RESP_RATE_SHIFT);
|
||
7120 | -
|
||
7121 | - word = read_nic_word(dev, BRSR);
|
||
7122 | - word &= ~BRSR_MBR_8185;
|
||
7123 | -
|
||
7124 | -
|
||
7125 | - for(i=0;i<=basic_rate;i++)
|
||
7126 | - word |= (1<<i);
|
||
7127 | -
|
||
7128 | - write_nic_word(dev, BRSR, word);
|
||
7129 | - //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
|
||
7130 | -}
|
||
7131 | -
|
||
7132 | -
|
||
7133 | -void rtl8187_link_change(struct net_device *dev)
|
||
7134 | -{
|
||
7135 | -// int i;
|
||
7136 | -
|
||
7137 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
7138 | - //write_nic_word(dev, BintrItv, net->beacon_interval);
|
||
7139 | - rtl8187_net_update(dev);
|
||
7140 | - /*update timing params*/
|
||
7141 | - rtl8180_set_chan(dev, priv->chan);
|
||
7142 | -
|
||
7143 | - rtl8187_set_rxconf(dev);
|
||
7144 | -}
|
||
7145 | -
|
||
7146 | -void rtl8180_irq_rx_tasklet(struct r8180_priv *priv);
|
||
7147 | -
|
||
7148 | -short rtl8180_init(struct net_device *dev)
|
||
7149 | -{
|
||
7150 | -
|
||
7151 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
7152 | - int i, j;
|
||
7153 | - u16 word;
|
||
7154 | - int ch;
|
||
7155 | - //u16 version;
|
||
7156 | - //u8 hw_version;
|
||
7157 | - //u8 config3;
|
||
7158 | -
|
||
7159 | - //FIXME: these constants are placed in a bad pleace.
|
||
7160 | -
|
||
7161 | -// priv->txbuffsize = 1024;
|
||
7162 | -// priv->txringcount = 32;
|
||
7163 | -// priv->rxbuffersize = 1024;
|
||
7164 | -// priv->rxringcount = 32;
|
||
7165 | -// priv->txbeaconcount = 3;
|
||
7166 | -// priv->rx_skb_complete = 1;
|
||
7167 | - //priv->txnp_pending.ispending=0;
|
||
7168 | - /* ^^ the SKB does not containt a partial RXed
|
||
7169 | - * packet (is empty)
|
||
7170 | - */
|
||
7171 | -
|
||
7172 | - if(!channels){
|
||
7173 | - DMESG("No channels, aborting");
|
||
7174 | - return -1;
|
||
7175 | - }
|
||
7176 | - ch=channels;
|
||
7177 | - // set channels 1..14 allowed in given locale
|
||
7178 | - for (i=1; i<=14; i++) {
|
||
7179 | - (priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
|
||
7180 | - ch >>= 1;
|
||
7181 | - }
|
||
7182 | - //memcpy(priv->stats,0,sizeof(struct Stats));
|
||
7183 | -
|
||
7184 | - //priv->irq_enabled=0;
|
||
7185 | -
|
||
7186 | -// priv->stats.rxdmafail=0;
|
||
7187 | - priv->stats.txrdu=0;
|
||
7188 | -// priv->stats.rxrdu=0;
|
||
7189 | -// priv->stats.rxnolast=0;
|
||
7190 | -// priv->stats.rxnodata=0;
|
||
7191 | - //priv->stats.rxreset=0;
|
||
7192 | - //priv->stats.rxwrkaround=0;
|
||
7193 | -// priv->stats.rxnopointer=0;
|
||
7194 | - priv->stats.txnperr=0;
|
||
7195 | - priv->stats.txresumed=0;
|
||
7196 | -// priv->stats.rxerr=0;
|
||
7197 | -// priv->stats.rxoverflow=0;
|
||
7198 | -// priv->stats.rxint=0;
|
||
7199 | - priv->stats.txnpokint=0;
|
||
7200 | - /*priv->stats.txhpokint=0;
|
||
7201 | - priv->stats.txhperr=0;*/
|
||
7202 | - priv->stats.rxurberr=0;
|
||
7203 | - priv->stats.rxstaterr=0;
|
||
7204 | - priv->stats.txoverflow=0;
|
||
7205 | - priv->stats.rxok=0;
|
||
7206 | -// priv->stats.txbeaconerr=0;
|
||
7207 | - priv->stats.txlperr=0;
|
||
7208 | - priv->stats.txlpokint=0;
|
||
7209 | -
|
||
7210 | - priv->ieee80211->iw_mode = IW_MODE_INFRA;
|
||
7211 | -
|
||
7212 | - priv->retry_rts = DEFAULT_RETRY_RTS;
|
||
7213 | - priv->retry_data = DEFAULT_RETRY_DATA;
|
||
7214 | - priv->ieee80211->rate = 110; //11 mbps
|
||
7215 | - priv->ieee80211->short_slot = 1;
|
||
7216 | - priv->ieee80211->mode = IEEE_G;
|
||
7217 | - priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
|
||
7218 | - spin_lock_init(&priv->tx_lock);
|
||
7219 | - INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
|
||
7220 | - sema_init(&priv->wx_sem,1);
|
||
7221 | - tasklet_init(&priv->irq_rx_tasklet,
|
||
7222 | - (void(*)(unsigned long))rtl8180_irq_rx_tasklet,
|
||
7223 | - (unsigned long)priv);
|
||
7224 | -
|
||
7225 | - //priv->ieee80211->func =
|
||
7226 | - // kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL);
|
||
7227 | - //memset(priv->ieee80211->func, 0,
|
||
7228 | - // sizeof(struct ieee80211_helper_functions));
|
||
7229 | - priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
|
||
7230 | - priv->ieee80211->iw_mode = IW_MODE_INFRA;
|
||
7231 | - priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
|
||
7232 | - IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
|
||
7233 | - IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE |
|
||
7234 | - /*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE;
|
||
7235 | -
|
||
7236 | - priv->ieee80211->active_scan = 1;
|
||
7237 | - priv->ieee80211->rate = 110; //11 mbps
|
||
7238 | - priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION;
|
||
7239 | - priv->ieee80211->host_encrypt = 1;
|
||
7240 | - priv->ieee80211->host_decrypt = 1;
|
||
7241 | - priv->ieee80211->start_send_beacons = rtl8187_beacon_tx;
|
||
7242 | - priv->ieee80211->stop_send_beacons = rtl8187_beacon_stop;
|
||
7243 | - //priv->ieee80211->softmac_hard_start_xmit = rtl8180_hard_start_xmit;
|
||
7244 | - priv->ieee80211->softmac_hard_start_xmit = NULL;
|
||
7245 | - priv->ieee80211->set_chan = rtl8180_set_chan;
|
||
7246 | - priv->ieee80211->link_change = rtl8187_link_change;
|
||
7247 | - priv->ieee80211->softmac_data_hard_start_xmit = rtl8180_hard_data_xmit;
|
||
7248 | - priv->ieee80211->data_hard_stop = rtl8180_data_hard_stop;
|
||
7249 | - priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume;
|
||
7250 | - //priv->ieee80211->start_send_beacons = NULL;
|
||
7251 | - //priv->ieee80211->stop_send_beacons = NULL;
|
||
7252 | -
|
||
7253 | - priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
|
||
7254 | -
|
||
7255 | - priv->card_8185 = 2;
|
||
7256 | - priv->phy_ver = 2;
|
||
7257 | - priv->card_type = USB;
|
||
7258 | -
|
||
7259 | - #if 0
|
||
7260 | - hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
|
||
7261 | -
|
||
7262 | - switch (hw_version){
|
||
7263 | - case HW_VERID_R8185_ABC:
|
||
7264 | - DMESG("MAC controller is a RTL8185 b/g");
|
||
7265 | - priv->card_8185 = 1;
|
||
7266 | - /* you should not find a card with 8225 PHY ver < C*/
|
||
7267 | - priv->phy_ver = 2;
|
||
7268 | - break;
|
||
7269 | -
|
||
7270 | - case HW_VERID_R8185_D:
|
||
7271 | - DMESG("MAC controller is a RTL8185 b/g (V. D)");
|
||
7272 | - priv->card_8185 = 2;
|
||
7273 | - /* you should not find a card with 8225 PHY ver < C*/
|
||
7274 | - priv->phy_ver = 2;
|
||
7275 | - break;
|
||
7276 | -
|
||
7277 | - case HW_VERID_R8180_ABCD:
|
||
7278 | - DMESG("MAC controller is a RTL8180");
|
||
7279 | - priv->card_8185 = 0;
|
||
7280 | - break;
|
||
7281 | -
|
||
7282 | - case HW_VERID_R8180_F:
|
||
7283 | - DMESG("MAC controller is a RTL8180 (v. F)");
|
||
7284 | - priv->card_8185 = 0;
|
||
7285 | - break;
|
||
7286 | -
|
||
7287 | - default:
|
||
7288 | - DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version);
|
||
7289 | - priv->card_8185 = 0;
|
||
7290 | - break;
|
||
7291 | - }
|
||
7292 | -
|
||
7293 | -
|
||
7294 | - /* you should not found any 8185 Ver B Card */
|
||
7295 | - priv->card_8185_Bversion = 0;
|
||
7296 | -
|
||
7297 | - config3 = read_nic_byte(dev, CONFIG3);
|
||
7298 | - if(config3 & 0x8){
|
||
7299 | - priv->card_type = CARDBUS;
|
||
7300 | - DMESG("This is a CARDBUS NIC");
|
||
7301 | - }
|
||
7302 | - else if( config3 & 0x4){
|
||
7303 | - priv->card_type = MINIPCI;
|
||
7304 | - DMESG("This is a MINI-PCI NIC");
|
||
7305 | - }else{
|
||
7306 | - priv->card_type = PCI;
|
||
7307 | - DMESG("This is a PCI NIC");
|
||
7308 | - }
|
||
7309 | - #endif
|
||
7310 | - priv->enable_gpio0 = 0;
|
||
7311 | -
|
||
7312 | -
|
||
7313 | - /* commented out just because we already do
|
||
7314 | - this when resetting the card
|
||
7315 | - andrea 20050924
|
||
7316 | - */
|
||
7317 | - #if 0
|
||
7318 | -
|
||
7319 | - u8 txcr, txreg50;
|
||
7320 | - u32 txreg54, txreg60;
|
||
7321 | -
|
||
7322 | - /* enable A/D D/A register */
|
||
7323 | - txcr = read_nic_byte(dev, 0x59);
|
||
7324 | -// DMESG("<txcr:%x>", txcr);
|
||
7325 | - //write_nic_word(dev, 0x59, 0x44);
|
||
7326 | - write_nic_byte(dev, 0x59, 0x44);
|
||
7327 | - //write_nic_byte(dev, 0x59, 0xea);
|
||
7328 | - txcr = read_nic_byte(dev, 0x59);
|
||
7329 | -// DMESG("<<txcr:%x>>", txcr);
|
||
7330 | -
|
||
7331 | - txreg50 = read_nic_byte(dev, 0x50);
|
||
7332 | - // DMESG("<txreg50:%x>", txreg50);
|
||
7333 | - write_nic_byte(dev, 0x50, 0xc0);
|
||
7334 | - txreg50 = read_nic_byte(dev, 0x50);
|
||
7335 | - // DMESG("<<txreg50:%x>>", txreg50);
|
||
7336 | -
|
||
7337 | -
|
||
7338 | - txreg54 = read_nic_dword(dev, 0x54);
|
||
7339 | - // DMESG("<txreg54:%x>", txreg54);
|
||
7340 | - txreg54 = 0xa0000a59;
|
||
7341 | - // DMESG("<<txreg54:%x>>", txreg54);
|
||
7342 | - write_nic_dword(dev, 0x54, txreg54);
|
||
7343 | - txreg54 = read_nic_dword(dev, 0x54);
|
||
7344 | - // DMESG("<<<txreg54:%x>>>", txreg54);
|
||
7345 | -
|
||
7346 | - txreg60 = read_nic_dword(dev, 0x60);
|
||
7347 | - // DMESG("<txreg60:%x>", txreg60);
|
||
7348 | -
|
||
7349 | - write_nic_byte(dev, 0x50, 0x0);
|
||
7350 | - txcr = read_nic_byte(dev, 0x50);
|
||
7351 | - // DMESG("<<txcr:%x>>", txcr);
|
||
7352 | -
|
||
7353 | -#endif
|
||
7354 | -
|
||
7355 | - /*the eeprom type is stored in RCR register bit #6 */
|
||
7356 | - if (RCR_9356SEL & read_nic_dword(dev, RCR)){
|
||
7357 | - priv->epromtype=EPROM_93c56;
|
||
7358 | - DMESG("Reported EEPROM chip is a 93c56 (2Kbit)");
|
||
7359 | - }else{
|
||
7360 | - priv->epromtype=EPROM_93c46;
|
||
7361 | - DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
|
||
7362 | - }
|
||
7363 | -
|
||
7364 | - dev->get_stats = rtl8180_stats;
|
||
7365 | -
|
||
7366 | - dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
|
||
7367 | - dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
|
||
7368 | - dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff;
|
||
7369 | - dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8;
|
||
7370 | - dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff;
|
||
7371 | - dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8;
|
||
7372 | -
|
||
7373 | - DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr));
|
||
7374 | -
|
||
7375 | - for(i=1,j=0; i<6; i+=2,j++){
|
||
7376 | -
|
||
7377 | - word = eprom_read(dev,EPROM_TXPW0 + j);
|
||
7378 | - priv->chtxpwr[i]=word & 0xf;
|
||
7379 | - priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4;
|
||
7380 | - priv->chtxpwr[i+1]=(word & 0xf00)>>8;
|
||
7381 | - priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12;
|
||
7382 | - }
|
||
7383 | -
|
||
7384 | - for(i=1,j=0; i<4; i+=2,j++){
|
||
7385 | -
|
||
7386 | - word = eprom_read(dev,EPROM_TXPW1 + j);
|
||
7387 | - priv->chtxpwr[i+6]=word & 0xf;
|
||
7388 | - priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4;
|
||
7389 | - priv->chtxpwr[i+6+1]=(word & 0xf00)>>8;
|
||
7390 | - priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12;
|
||
7391 | - }
|
||
7392 | -
|
||
7393 | - for(i=1,j=0; i<4; i+=2,j++){
|
||
7394 | -
|
||
7395 | - word = eprom_read(dev,EPROM_TXPW2 + j);
|
||
7396 | - priv->chtxpwr[i+6+4]=word & 0xf;
|
||
7397 | - priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4;
|
||
7398 | - priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8;
|
||
7399 | - priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12;
|
||
7400 | - }
|
||
7401 | -
|
||
7402 | -
|
||
7403 | - priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
|
||
7404 | -
|
||
7405 | - word = eprom_read(dev,EPROM_TXPW_BASE);
|
||
7406 | - priv->cck_txpwr_base = word & 0xf;
|
||
7407 | - priv->ofdm_txpwr_base = (word>>4) & 0xf;
|
||
7408 | -
|
||
7409 | - /* check RF frontend chipset */
|
||
7410 | -
|
||
7411 | - switch (priv->rf_chip) {
|
||
7412 | -
|
||
7413 | - case EPROM_RFCHIPID_RTL8225U:
|
||
7414 | -
|
||
7415 | - DMESG("Card reports RF frontend Realtek 8225");
|
||
7416 | - DMESGW("This driver has EXPERIMENTAL support for this chipset.");
|
||
7417 | - DMESGW("use it with care and at your own risk and");
|
||
7418 | - DMESGW("**PLEASE** REPORT SUCCESS/INSUCCESS TO andreamrl@tiscali.it");
|
||
7419 | - if(rtl8225_is_V_z2(dev)){
|
||
7420 | - priv->rf_init = rtl8225z2_rf_init;
|
||
7421 | - priv->rf_set_chan = rtl8225z2_rf_set_chan;
|
||
7422 | - priv->rf_set_sens = NULL;
|
||
7423 | - DMESG("This seems a new V2 radio");
|
||
7424 | - }else{
|
||
7425 | - priv->rf_init = rtl8225_rf_init;
|
||
7426 | - priv->rf_set_chan = rtl8225_rf_set_chan;
|
||
7427 | - priv->rf_set_sens = rtl8225_rf_set_sens;
|
||
7428 | - DMESG("This seems a legacy 1st version radio");
|
||
7429 | - }
|
||
7430 | - priv->rf_close = rtl8225_rf_close;
|
||
7431 | -
|
||
7432 | - priv->max_sens = RTL8225_RF_MAX_SENS;
|
||
7433 | - priv->sens = RTL8225_RF_DEF_SENS;
|
||
7434 | - break;
|
||
7435 | -
|
||
7436 | - default:
|
||
7437 | - DMESGW("Unknown RF module %x",priv->rf_chip);
|
||
7438 | - DMESGW("Exiting...");
|
||
7439 | - return -1;
|
||
7440 | -
|
||
7441 | - }
|
||
7442 | -
|
||
7443 | -// DMESG("Energy threshold: %x",priv->cs_treshold);
|
||
7444 | - DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7);
|
||
7445 | - //DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2));
|
||
7446 | -
|
||
7447 | - if(rtl8187_usb_initendpoints(dev)!=0){
|
||
7448 | - DMESG("Endopoints initialization failed");
|
||
7449 | - return -ENOMEM;
|
||
7450 | - }
|
||
7451 | -#if 0
|
||
7452 | - if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
|
||
7453 | - return -ENOMEM;
|
||
7454 | -
|
||
7455 | - if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
|
||
7456 | - TX_NORMPRIORITY_RING_ADDR))
|
||
7457 | - return -ENOMEM;
|
||
7458 | -
|
||
7459 | - if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
|
||
7460 | - TX_HIGHPRIORITY_RING_ADDR))
|
||
7461 | - return -ENOMEM;
|
||
7462 | -
|
||
7463 | - if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
|
||
7464 | - TX_LOWPRIORITY_RING_ADDR))
|
||
7465 | - return -ENOMEM;
|
||
7466 | -
|
||
7467 | -
|
||
7468 | - if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount))
|
||
7469 | - return -ENOMEM;
|
||
7470 | -#endif
|
||
7471 | -
|
||
7472 | -
|
||
7473 | -#ifdef DEBUG_EPROM
|
||
7474 | - dump_eprom(dev);
|
||
7475 | -#endif
|
||
7476 | - return 0;
|
||
7477 | -
|
||
7478 | -}
|
||
7479 | -
|
||
7480 | -void rtl8185_rf_pins_enable(struct net_device *dev)
|
||
7481 | -{
|
||
7482 | -/* u16 tmp;
|
||
7483 | - tmp = read_nic_word(dev, RFPinsEnable);*/
|
||
7484 | - write_nic_word(dev, RFPinsEnable, 0x1ff7);// | tmp);
|
||
7485 | -}
|
||
7486 | -
|
||
7487 | -
|
||
7488 | -void rtl8185_set_anaparam2(struct net_device *dev, u32 a)
|
||
7489 | -{
|
||
7490 | - u8 conf3;
|
||
7491 | -
|
||
7492 | - rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
|
||
7493 | -
|
||
7494 | - conf3 = read_nic_byte(dev, CONFIG3);
|
||
7495 | - write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
|
||
7496 | -
|
||
7497 | - write_nic_dword(dev, ANAPARAM2, a);
|
||
7498 | -
|
||
7499 | - conf3 = read_nic_byte(dev, CONFIG3);
|
||
7500 | - write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
|
||
7501 | -
|
||
7502 | - rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
|
||
7503 | -
|
||
7504 | -}
|
||
7505 | -
|
||
7506 | -
|
||
7507 | -void rtl8180_set_anaparam(struct net_device *dev, u32 a)
|
||
7508 | -{
|
||
7509 | - u8 conf3;
|
||
7510 | -
|
||
7511 | - rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
|
||
7512 | -
|
||
7513 | - conf3 = read_nic_byte(dev, CONFIG3);
|
||
7514 | - write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
|
||
7515 | -
|
||
7516 | - write_nic_dword(dev, ANAPARAM, a);
|
||
7517 | -
|
||
7518 | - conf3 = read_nic_byte(dev, CONFIG3);
|
||
7519 | - write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
|
||
7520 | -
|
||
7521 | - rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
|
||
7522 | -
|
||
7523 | -}
|
||
7524 | -
|
||
7525 | -
|
||
7526 | -void rtl8185_tx_antenna(struct net_device *dev, u8 ant)
|
||
7527 | -{
|
||
7528 | - write_nic_byte(dev, TX_ANTENNA, ant);
|
||
7529 | - force_pci_posting(dev);
|
||
7530 | - mdelay(1);
|
||
7531 | -}
|
||
7532 | -
|
||
7533 | -
|
||
7534 | -void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data)
|
||
7535 | -{
|
||
7536 | - //u8 phyr;
|
||
7537 | - u32 phyw;
|
||
7538 | -// int i;
|
||
7539 | -
|
||
7540 | - adr |= 0x80;
|
||
7541 | -
|
||
7542 | - phyw= ((data<<8) | adr);
|
||
7543 | -
|
||
7544 | -
|
||
7545 | -
|
||
7546 | - // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
|
||
7547 | - write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24));
|
||
7548 | - write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16));
|
||
7549 | - write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8));
|
||
7550 | - write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) ));
|
||
7551 | -
|
||
7552 | - //read_nic_dword(dev, PHY_ADR);
|
||
7553 | -#if 0
|
||
7554 | - for(i=0;i<10;i++){
|
||
7555 | - write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw);
|
||
7556 | - phyr = read_nic_byte(dev, PHY_READ);
|
||
7557 | - if(phyr == (data&0xff)) break;
|
||
7558 | -
|
||
7559 | - }
|
||
7560 | -#endif
|
||
7561 | - /* this is ok to fail when we write AGC table. check for AGC table might be
|
||
7562 | - * done by masking with 0x7f instead of 0xff
|
||
7563 | - */
|
||
7564 | - //if(phyr != (data&0xff)) DMESGW("Phy write timeout %x %x %x", phyr, data, adr);
|
||
7565 | - mdelay(1);
|
||
7566 | -}
|
||
7567 | -
|
||
7568 | -
|
||
7569 | -inline void write_phy_ofdm (struct net_device *dev, u8 adr, u32 data)
|
||
7570 | -{
|
||
7571 | - data = data & 0xff;
|
||
7572 | - rtl8187_write_phy(dev, adr, data);
|
||
7573 | -}
|
||
7574 | -
|
||
7575 | -
|
||
7576 | -void write_phy_cck (struct net_device *dev, u8 adr, u32 data)
|
||
7577 | -{
|
||
7578 | - data = data & 0xff;
|
||
7579 | - rtl8187_write_phy(dev, adr, data | 0x10000);
|
||
7580 | -}
|
||
7581 | -
|
||
7582 | -
|
||
7583 | -void rtl8180_adapter_start(struct net_device *dev)
|
||
7584 | -{
|
||
7585 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
7586 | - //u32 anaparam;
|
||
7587 | - //u8 config3;
|
||
7588 | -
|
||
7589 | - //rtl8180_rtx_disable(dev);
|
||
7590 | - rtl8180_reset(dev);
|
||
7591 | -
|
||
7592 | - write_nic_byte(dev,0x85,0);
|
||
7593 | - write_nic_byte(dev,0x91,0);
|
||
7594 | -
|
||
7595 | - /* light blink! */
|
||
7596 | - write_nic_byte(dev,0x85,4);
|
||
7597 | - write_nic_byte(dev,0x91,1);
|
||
7598 | - write_nic_byte(dev,0x90,0);
|
||
7599 | -
|
||
7600 | - priv->irq_mask = 0xffff;
|
||
7601 | -/*
|
||
7602 | - priv->dma_poll_mask = 0;
|
||
7603 | - priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT);
|
||
7604 | -*/
|
||
7605 | -// rtl8180_beacon_tx_disable(dev);
|
||
7606 | -
|
||
7607 | - rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
|
||
7608 | - write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]);
|
||
7609 | - write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff );
|
||
7610 | -
|
||
7611 | - rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
|
||
7612 | - rtl8180_update_msr(dev);
|
||
7613 | -
|
||
7614 | - rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
|
||
7615 | -
|
||
7616 | - write_nic_word(dev,0xf4,0xffff);
|
||
7617 | - write_nic_byte(dev,
|
||
7618 | - CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
|
||
7619 | -
|
||
7620 | - rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
|
||
7621 | -
|
||
7622 | - write_nic_dword(dev,INT_TIMEOUT,0);
|
||
7623 | -
|
||
7624 | -#ifdef DEBUG_REGISTERS
|
||
7625 | - rtl8180_dump_reg(dev);
|
||
7626 | -#endif
|
||
7627 | -
|
||
7628 | -
|
||
7629 | - write_nic_byte(dev, WPA_CONFIG, 0);
|
||
7630 | -
|
||
7631 | - write_nic_byte(dev, RATE_FALLBACK, 0x81);
|
||
7632 | - rtl8187_set_rate(dev);
|
||
7633 | -
|
||
7634 | - priv->rf_init(dev);
|
||
7635 | -
|
||
7636 | - if(priv->rf_set_sens != NULL)
|
||
7637 | - priv->rf_set_sens(dev,priv->sens);
|
||
7638 | -
|
||
7639 | - write_nic_word(dev,0x5e,1);
|
||
7640 | -
|
||
7641 | - #if 1
|
||
7642 | - //mdelay(1);
|
||
7643 | - write_nic_word(dev,0xfe,0x10);
|
||
7644 | -// mdelay(1);
|
||
7645 | - #endif
|
||
7646 | - write_nic_byte(dev, TALLY_SEL, 0x80);//Set NQ retry count
|
||
7647 | -
|
||
7648 | - write_nic_byte(dev, 0xff, 0x60);
|
||
7649 | -
|
||
7650 | - write_nic_word(dev,0x5e,0);
|
||
7651 | -
|
||
7652 | -
|
||
7653 | - rtl8180_irq_enable(dev);
|
||
7654 | - /*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY));
|
||
7655 | -
|
||
7656 | - DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY));
|
||
7657 | -
|
||
7658 | - DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY));
|
||
7659 | - if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK");
|
||
7660 | - if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK");
|
||
7661 | - if(check_nic_enought_desc(dev,LOW_PRIORITY)) DMESG("LOW OK");*/
|
||
7662 | -}
|
||
7663 | -
|
||
7664 | -
|
||
7665 | -
|
||
7666 | -/* this configures registers for beacon tx and enables it via
|
||
7667 | - * rtl8180_beacon_tx_enable(). rtl8180_beacon_tx_disable() might
|
||
7668 | - * be used to stop beacon transmission
|
||
7669 | - */
|
||
7670 | -#if 0
|
||
7671 | -void rtl8180_start_tx_beacon(struct net_device *dev)
|
||
7672 | -{
|
||
7673 | - int i;
|
||
7674 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
7675 | - u16 word;
|
||
7676 | - DMESG("Enabling beacon TX");
|
||
7677 | - //write_nic_byte(dev, 0x42,0xe6);// TCR
|
||
7678 | - //rtl8180_init_beacon(dev);
|
||
7679 | - //set_nic_txring(dev);
|
||
7680 | -// rtl8180_prepare_beacon(dev);
|
||
7681 | - rtl8180_irq_disable(dev);
|
||
7682 | -// rtl8180_beacon_tx_enable(dev);
|
||
7683 | - rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
|
||
7684 | - //write_nic_byte(dev,0x9d,0x20); //DMA Poll
|
||
7685 | - //write_nic_word(dev,0x7a,0);
|
||
7686 | - //write_nic_word(dev,0x7a,0x8000);
|
||
7687 | -
|
||
7688 | -
|
||
7689 | - word = read_nic_word(dev, BcnItv);
|
||
7690 | - word &= ~BcnItv_BcnItv; // clear Bcn_Itv
|
||
7691 | - write_nic_word(dev, BcnItv, word);
|
||
7692 | -
|
||
7693 | - write_nic_word(dev, AtimWnd,
|
||
7694 | - read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd);
|
||
7695 | -
|
||
7696 | - word = read_nic_word(dev, BintrItv);
|
||
7697 | - word &= ~BintrItv_BintrItv;
|
||
7698 | -
|
||
7699 | - //word |= priv->ieee80211->beacon_interval *
|
||
7700 | - // ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1);
|
||
7701 | - // FIXME:FIXME check if correct ^^ worked with 0x3e8;
|
||
7702 | -
|
||
7703 | - write_nic_word(dev, BintrItv, word);
|
||
7704 | -
|
||
7705 | - //write_nic_word(dev,0x2e,0xe002);
|
||
7706 | - //write_nic_dword(dev,0x30,0xb8c7832e);
|
||
7707 | - for(i=0; i<ETH_ALEN; i++)
|
||
7708 | - write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]);
|
||
7709 | -
|
||
7710 | -// rtl8180_update_msr(dev);
|
||
7711 | -
|
||
7712 | -
|
||
7713 | - //write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */
|
||
7714 | -
|
||
7715 | - rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
|
||
7716 | -
|
||
7717 | - rtl8180_irq_enable(dev);
|
||
7718 | -
|
||
7719 | - /* VV !!!!!!!!!! VV*/
|
||
7720 | - /*
|
||
7721 | - rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
|
||
7722 | - write_nic_byte(dev,0x9d,0x00);
|
||
7723 | - rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
|
||
7724 | -*/
|
||
7725 | -}
|
||
7726 | -#endif
|
||
7727 | -/***************************************************************************
|
||
7728 | - -------------------------------NET STUFF---------------------------
|
||
7729 | -***************************************************************************/
|
||
7730 | -static struct net_device_stats *rtl8180_stats(struct net_device *dev)
|
||
7731 | -{
|
||
7732 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
7733 | -
|
||
7734 | - return &priv->ieee80211->stats;
|
||
7735 | -}
|
||
7736 | -
|
||
7737 | -
|
||
7738 | -int _rtl8180_up(struct net_device *dev)
|
||
7739 | -{
|
||
7740 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
7741 | -
|
||
7742 | - priv->up=1;
|
||
7743 | -
|
||
7744 | - //DMESG("Bringing up iface");
|
||
7745 | -
|
||
7746 | - rtl8180_adapter_start(dev);
|
||
7747 | -
|
||
7748 | - rtl8180_rx_enable(dev);
|
||
7749 | -
|
||
7750 | - rtl8180_tx_enable(dev);
|
||
7751 | -
|
||
7752 | - ieee80211_softmac_start_protocol(priv->ieee80211);
|
||
7753 | -
|
||
7754 | - ieee80211_reset_queue(priv->ieee80211);
|
||
7755 | - if(!netif_queue_stopped(dev))
|
||
7756 | - netif_start_queue(dev);
|
||
7757 | - else
|
||
7758 | - netif_wake_queue(dev);
|
||
7759 | -
|
||
7760 | - return 0;
|
||
7761 | -}
|
||
7762 | -
|
||
7763 | -
|
||
7764 | -int rtl8180_open(struct net_device *dev)
|
||
7765 | -{
|
||
7766 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
7767 | - int ret;
|
||
7768 | -
|
||
7769 | - down(&priv->wx_sem);
|
||
7770 | - ret = rtl8180_up(dev);
|
||
7771 | - up(&priv->wx_sem);
|
||
7772 | - return ret;
|
||
7773 | -
|
||
7774 | -}
|
||
7775 | -
|
||
7776 | -
|
||
7777 | -int rtl8180_up(struct net_device *dev)
|
||
7778 | -{
|
||
7779 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
7780 | -
|
||
7781 | - if (priv->up == 1) return -1;
|
||
7782 | -
|
||
7783 | - return _rtl8180_up(dev);
|
||
7784 | -}
|
||
7785 | -
|
||
7786 | -
|
||
7787 | -int rtl8180_close(struct net_device *dev)
|
||
7788 | -{
|
||
7789 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
7790 | - int ret;
|
||
7791 | -
|
||
7792 | - down(&priv->wx_sem);
|
||
7793 | -
|
||
7794 | - ret = rtl8180_down(dev);
|
||
7795 | -
|
||
7796 | - up(&priv->wx_sem);
|
||
7797 | -
|
||
7798 | - return ret;
|
||
7799 | -
|
||
7800 | -}
|
||
7801 | -
|
||
7802 | -int rtl8180_down(struct net_device *dev)
|
||
7803 | -{
|
||
7804 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
7805 | -
|
||
7806 | - if (priv->up == 0) return -1;
|
||
7807 | -
|
||
7808 | - priv->up=0;
|
||
7809 | -
|
||
7810 | -/* FIXME */
|
||
7811 | - if (!netif_queue_stopped(dev))
|
||
7812 | - netif_stop_queue(dev);
|
||
7813 | -
|
||
7814 | - rtl8180_rtx_disable(dev);
|
||
7815 | - rtl8180_irq_disable(dev);
|
||
7816 | -
|
||
7817 | - ieee80211_softmac_stop_protocol(priv->ieee80211);
|
||
7818 | -
|
||
7819 | - return 0;
|
||
7820 | -}
|
||
7821 | -
|
||
7822 | -
|
||
7823 | -void rtl8180_commit(struct net_device *dev)
|
||
7824 | -{
|
||
7825 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
7826 | -
|
||
7827 | - if (priv->up == 0) return ;
|
||
7828 | -
|
||
7829 | - ieee80211_softmac_stop_protocol(priv->ieee80211);
|
||
7830 | -
|
||
7831 | - rtl8180_irq_disable(dev);
|
||
7832 | - rtl8180_rtx_disable(dev);
|
||
7833 | - _rtl8180_up(dev);
|
||
7834 | -}
|
||
7835 | -
|
||
7836 | -void rtl8180_restart(struct net_device *dev)
|
||
7837 | -{
|
||
7838 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
7839 | -
|
||
7840 | - down(&priv->wx_sem);
|
||
7841 | -
|
||
7842 | - rtl8180_commit(dev);
|
||
7843 | -
|
||
7844 | - up(&priv->wx_sem);
|
||
7845 | -}
|
||
7846 | -
|
||
7847 | -static void r8180_set_multicast(struct net_device *dev)
|
||
7848 | -{
|
||
7849 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
7850 | - short promisc;
|
||
7851 | -
|
||
7852 | - //down(&priv->wx_sem);
|
||
7853 | -
|
||
7854 | - /* FIXME FIXME */
|
||
7855 | -
|
||
7856 | - promisc = (dev->flags & IFF_PROMISC) ? 1:0;
|
||
7857 | -
|
||
7858 | - if (promisc != priv->promisc)
|
||
7859 | - // rtl8180_commit(dev);
|
||
7860 | -
|
||
7861 | - priv->promisc = promisc;
|
||
7862 | -
|
||
7863 | - //schedule_work(&priv->reset_wq);
|
||
7864 | - //up(&priv->wx_sem);
|
||
7865 | -}
|
||
7866 | -
|
||
7867 | -
|
||
7868 | -int r8180_set_mac_adr(struct net_device *dev, void *mac)
|
||
7869 | -{
|
||
7870 | - struct r8180_priv *priv = ieee80211_priv(dev);
|
||
7871 | - struct sockaddr *addr = mac;
|
||
7872 | -
|
||
7873 | - down(&priv->wx_sem);
|
||
7874 | -
|
||
7875 | - memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
|
||
7876 | -
|
||
7877 | - schedule_work(&priv->reset_wq);
|
||
7878 | -
|
||
7879 | - up(&priv->wx_sem);
|
||
7880 | -
|
||
7881 | - return 0;
|
||
7882 | -}
|
||
7883 | -
|
||
7884 | -
|
||
7885 | -/* based on ipw2200 driver */
|
||
7886 | -int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||
7887 | -{
|
||
7888 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
7889 | -
|
||
7890 | - down(&priv->wx_sem);
|
||
7891 | -
|
||
7892 | - struct iwreq *wrq = (struct iwreq *)rq;
|
||
7893 | -
|
||
7894 | - int ret=-1;
|
||
7895 | - switch (cmd) {
|
||
7896 | - case RTL_IOCTL_WPA_SUPPLICANT:
|
||
7897 | - ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
|
||
7898 | - break;
|
||
7899 | -
|
||
7900 | - default:
|
||
7901 | - ret = -EOPNOTSUPP;
|
||
7902 | - break;
|
||
7903 | - }
|
||
7904 | -
|
||
7905 | - up(&priv->wx_sem);
|
||
7906 | -
|
||
7907 | - return ret;
|
||
7908 | -}
|
||
7909 | -
|
||
7910 | -
|
||
7911 | -void rtl8180_irq_rx_tasklet(struct r8180_priv *priv)
|
||
7912 | -{
|
||
7913 | - struct urb *rx_urb = priv->rxurb_task;
|
||
7914 | - struct net_device *dev = (struct net_device*)rx_urb->context;
|
||
7915 | - int status,len,flen;
|
||
7916 | - struct sk_buff *skb;
|
||
7917 | - u32 *desc;
|
||
7918 | -
|
||
7919 | - //DMESG("rtl8187_rx_isr");
|
||
7920 | -
|
||
7921 | - struct ieee80211_rx_stats stats = {
|
||
7922 | - .signal = 0,
|
||
7923 | - .noise = -98,
|
||
7924 | - .rate = 0,
|
||
7925 | - // .mac_time = jiffies,
|
||
7926 | - .freq = IEEE80211_24GHZ_BAND,
|
||
7927 | - };
|
||
7928 | -
|
||
7929 | - //DMESG("RX %d ",rx_urb->status);
|
||
7930 | - status = rx_urb->status;
|
||
7931 | - if(status == 0){
|
||
7932 | -
|
||
7933 | - len = rx_urb->actual_length;
|
||
7934 | - // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
|
||
7935 | - len -= 4*4;/* 4 dword and 4 byte CRC */
|
||
7936 | -
|
||
7937 | - desc = (u32*)(rx_urb->transfer_buffer + len);
|
||
7938 | -
|
||
7939 | - flen = desc[0] & 0xfff;
|
||
7940 | -
|
||
7941 | - if( flen <= rx_urb->actual_length){
|
||
7942 | -
|
||
7943 | - stats.signal = (desc[1] & 0x7f00)>>8;
|
||
7944 | - stats.noise = desc[1] &0xff;
|
||
7945 | - stats.rate = desc[0] >> 20 & 0xf;
|
||
7946 | - stats.mac_time[0] = desc[2];
|
||
7947 | - stats.mac_time[1] = desc[3];
|
||
7948 | - skb = dev_alloc_skb(flen-4);
|
||
7949 | - //skb_reserve(skb,2);
|
||
7950 | - if(skb){
|
||
7951 | - memcpy(skb_put(skb,flen-4),
|
||
7952 | - rx_urb->transfer_buffer,flen -4);
|
||
7953 | -
|
||
7954 | - #ifdef DUMP_RX
|
||
7955 | - int i;
|
||
7956 | - for(i=0;i<flen-4;i++)
|
||
7957 | - printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]);
|
||
7958 | - printk("------RATE %x:w---------------\n",stats.rate);
|
||
7959 | -
|
||
7960 | - #endif
|
||
7961 | - priv->stats.rxok++;
|
||
7962 | - // priv->rxskb = skb;
|
||
7963 | - // priv->tempstats = &stats;
|
||
7964 | -
|
||
7965 | - if(!ieee80211_rx(priv->ieee80211,
|
||
7966 | - skb, &stats))
|
||
7967 | - dev_kfree_skb_any(skb);
|
||
7968 | - }
|
||
7969 | - }else priv->stats.rxurberr++;
|
||
7970 | - }else{
|
||
7971 | - priv->stats.rxstaterr++;
|
||
7972 | - priv->ieee80211->stats.rx_errors++;
|
||
7973 | -
|
||
7974 | - }
|
||
7975 | -
|
||
7976 | - if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb);
|
||
7977 | - else DMESG("RX process aborted due to explicit shutdown");
|
||
7978 | -}
|
||
7979 | -
|
||
7980 | -/****************************************************************************
|
||
7981 | - ---------------------------- USB_STUFF---------------------------
|
||
7982 | -*****************************************************************************/
|
||
7983 | -
|
||
7984 | -
|
||
7985 | -static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
|
||
7986 | - const struct usb_device_id *id)
|
||
7987 | -{
|
||
7988 | -// unsigned long ioaddr = 0;
|
||
7989 | - struct net_device *dev = NULL;
|
||
7990 | - struct r8180_priv *priv= NULL;
|
||
7991 | - struct usb_device *udev = interface_to_usbdev(intf);
|
||
7992 | -
|
||
7993 | -//printk("===> rtl8187_usb_probe()\n");
|
||
7994 | -
|
||
7995 | - dev = alloc_ieee80211(sizeof(struct r8180_priv));
|
||
7996 | -
|
||
7997 | - SET_MODULE_OWNER(dev);
|
||
7998 | - usb_set_intfdata(intf, dev);
|
||
7999 | -
|
||
8000 | - SET_NETDEV_DEV(dev, &intf->dev);
|
||
8001 | -
|
||
8002 | - priv = ieee80211_priv(dev);
|
||
8003 | - priv->ieee80211 = netdev_priv(dev);
|
||
8004 | -
|
||
8005 | - priv->udev=udev;
|
||
8006 | -
|
||
8007 | - dev->open = rtl8180_open;
|
||
8008 | - dev->stop = rtl8180_close;
|
||
8009 | - //dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
|
||
8010 | - dev->tx_timeout = tx_timeout;
|
||
8011 | - dev->wireless_handlers = &r8180_wx_handlers_def;
|
||
8012 | - dev->do_ioctl = rtl8180_ioctl;
|
||
8013 | - dev->set_multicast_list = r8180_set_multicast;
|
||
8014 | - dev->set_mac_address = r8180_set_mac_adr;
|
||
8015 | - dev->get_wireless_stats = r8180_get_wireless_stats;
|
||
8016 | - dev->type=ARPHRD_ETHER;
|
||
8017 | -
|
||
8018 | - if (dev_alloc_name(dev, ifname) < 0){
|
||
8019 | - DMESG("Oops: devname already taken! Trying wlan%%d...\n");
|
||
8020 | - ifname = "wlan%d";
|
||
8021 | - dev_alloc_name(dev, ifname);
|
||
8022 | - }
|
||
8023 | -
|
||
8024 | -// dev->open=rtl8180_init;
|
||
8025 | -
|
||
8026 | - if(rtl8180_init(dev)!=0){
|
||
8027 | - DMESG("Initialization failed");
|
||
8028 | - goto fail;
|
||
8029 | - }
|
||
8030 | -
|
||
8031 | - netif_carrier_off(dev);
|
||
8032 | - netif_stop_queue(dev);
|
||
8033 | -
|
||
8034 | - register_netdev(dev);
|
||
8035 | -
|
||
8036 | - rtl8180_proc_init_one(dev);
|
||
8037 | -
|
||
8038 | -
|
||
8039 | - DMESG("Driver probe completed\n");
|
||
8040 | - return 0;
|
||
8041 | -
|
||
8042 | -
|
||
8043 | -fail:
|
||
8044 | - free_ieee80211(dev);
|
||
8045 | -
|
||
8046 | - DMESG("wlan driver load failed\n");
|
||
8047 | -
|
||
8048 | - return -ENODEV;
|
||
8049 | -
|
||
8050 | -}
|
||
8051 | -
|
||
8052 | -
|
||
8053 | -static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf)
|
||
8054 | -{
|
||
8055 | - struct r8180_priv *priv;
|
||
8056 | - struct net_device *dev = usb_get_intfdata(intf);
|
||
8057 | - if(dev){
|
||
8058 | -
|
||
8059 | - unregister_netdev(dev);
|
||
8060 | -
|
||
8061 | - priv=ieee80211_priv(dev);
|
||
8062 | -
|
||
8063 | - rtl8180_proc_remove_one(dev);
|
||
8064 | -
|
||
8065 | - rtl8180_down(dev);
|
||
8066 | - priv->rf_close(dev);
|
||
8067 | - //rtl8180_rtx_disable(dev);
|
||
8068 | - rtl8187_usb_deleteendpoints(dev);
|
||
8069 | - rtl8180_irq_disable(dev);
|
||
8070 | - rtl8180_reset(dev);
|
||
8071 | - mdelay(10);
|
||
8072 | -
|
||
8073 | - }
|
||
8074 | -// pci_disable_device(pdev);
|
||
8075 | - free_ieee80211(dev);
|
||
8076 | - DMESG("wlan driver removed\n");
|
||
8077 | -}
|
||
8078 | -
|
||
8079 | -
|
||
8080 | -static int __init rtl8187_usb_module_init(void)
|
||
8081 | -{
|
||
8082 | - printk(KERN_INFO "\nLinux kernel driver for RTL8187 \
|
||
8083 | -based WLAN cards\n");
|
||
8084 | - printk(KERN_INFO "Copyright (c) 2004-2005, Andrea Merello\n");
|
||
8085 | - DMESG("Initializing module");
|
||
8086 | - DMESG("Wireless extensions version %d", WIRELESS_EXT);
|
||
8087 | - rtl8180_proc_module_init();
|
||
8088 | - return usb_register(&rtl8187_usb_driver);
|
||
8089 | -}
|
||
8090 | -
|
||
8091 | -
|
||
8092 | -static void __exit rtl8187_usb_module_exit(void)
|
||
8093 | -{
|
||
8094 | - usb_deregister(&rtl8187_usb_driver);
|
||
8095 | -
|
||
8096 | - rtl8180_proc_module_remove();
|
||
8097 | - DMESG("Exiting");
|
||
8098 | -}
|
||
8099 | -
|
||
8100 | -
|
||
8101 | -void rtl8180_try_wake_queue(struct net_device *dev, int pri)
|
||
8102 | -{
|
||
8103 | - unsigned long flags;
|
||
8104 | - short enough_desc;
|
||
8105 | - struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
|
||
8106 | -
|
||
8107 | - spin_lock_irqsave(&priv->tx_lock,flags);
|
||
8108 | - enough_desc = check_nic_enought_desc(dev,pri);
|
||
8109 | - spin_unlock_irqrestore(&priv->tx_lock,flags);
|
||
8110 | -
|
||
8111 | - if(enough_desc)
|
||
8112 | - ieee80211_wake_queue(priv->ieee80211);
|
||
8113 | -}
|
||
8114 | -
|
||
8115 | -
|
||
8116 | -
|
||
8117 | -/***************************************************************************
|
||
8118 | - ------------------- module init / exit stubs ----------------
|
||
8119 | -****************************************************************************/
|
||
8120 | -module_init(rtl8187_usb_module_init);
|
||
8121 | -module_exit(rtl8187_usb_module_exit);
|
||
8122 | diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.h |
||
8123 | --- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h 2006-06-06 08:48:10.000000000 +0200 |
||
8124 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.h 2008-02-22 15:02:01.000000000 +0100 |
||
8125 | @@ -1,17 +1,17 @@ |
||
8126 | -/*
|
||
8127 | +/*
|
||
8128 | This is part of rtl8187 OpenSource driver. |
||
8129 | - Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
|
||
8130 | + Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
|
||
8131 | Released under the terms of GPL (General Public Licence) |
||
8132 | -
|
||
8133 | - Parts of this driver are based on the GPL part of the
|
||
8134 | +
|
||
8135 | + Parts of this driver are based on the GPL part of the
|
||
8136 | official realtek driver |
||
8137 | -
|
||
8138 | - Parts of this driver are based on the rtl8180 driver skeleton
|
||
8139 | +
|
||
8140 | + Parts of this driver are based on the rtl8180 driver skeleton
|
||
8141 | from Patric Schenke & Andres Salomon |
||
8142 | -
|
||
8143 | +
|
||
8144 | Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver |
||
8145 | -
|
||
8146 | - We want to tanks the Authors of those projects and the Ndiswrapper
|
||
8147 | +
|
||
8148 | + We want to tanks the Authors of those projects and the Ndiswrapper
|
||
8149 | project Authors. |
||
8150 | */ |
||
8151 | |||
8152 | @@ -26,7 +26,6 @@ |
||
8153 | |||
8154 | #include <linux/module.h> |
||
8155 | #include <linux/kernel.h> |
||
8156 | -#include <linux/config.h>
|
||
8157 | #include <linux/init.h> |
||
8158 | #include <linux/ioport.h> |
||
8159 | #include <linux/sched.h> |
||
8160 | @@ -47,6 +46,12 @@ |
||
8161 | #include <asm/io.h> |
||
8162 | #include <asm/semaphore.h> |
||
8163 | |||
8164 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
|
||
8165 | +#include <linux/config.h>
|
||
8166 | +#else
|
||
8167 | +#include <linux/autoconf.h>
|
||
8168 | +#endif
|
||
8169 | +
|
||
8170 | #include "ieee80211.h" |
||
8171 | |||
8172 | #define EPROM_93c46 0 |
||
8173 | @@ -68,7 +73,7 @@ |
||
8174 | { |
||
8175 | struct buffer *next; |
||
8176 | u32 *buf; |
||
8177 | -
|
||
8178 | +
|
||
8179 | } buffer; |
||
8180 | |||
8181 | #if 0 |
||
8182 | @@ -123,18 +128,18 @@ |
||
8183 | short epromtype; |
||
8184 | int irq; |
||
8185 | struct ieee80211_device *ieee80211; |
||
8186 | -
|
||
8187 | +
|
||
8188 | short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D */ |
||
8189 | short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */ |
||
8190 | short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */ |
||
8191 | short enable_gpio0; |
||
8192 | enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type; |
||
8193 | short hw_plcp_len; |
||
8194 | -
|
||
8195 | +
|
||
8196 | // spinlock_t irq_lock; |
||
8197 | // spinlock_t irq_th_lock; |
||
8198 | spinlock_t tx_lock; |
||
8199 | -
|
||
8200 | +
|
||
8201 | u16 irq_mask; |
||
8202 | // short irq_enabled; |
||
8203 | struct net_device *dev; |
||
8204 | @@ -143,13 +148,18 @@ |
||
8205 | short max_sens; |
||
8206 | u8 chtxpwr[15]; //channels from 1 to 14, 0 not used |
||
8207 | u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used |
||
8208 | + u8 chtxpwr_orig[15]; //channels from 1 to 14, 0 not used
|
||
8209 | + u8 chtxpwr_ofdm_orig[15]; //channels from 1 to 14, 0 not used
|
||
8210 | u8 cck_txpwr_base; |
||
8211 | u8 ofdm_txpwr_base; |
||
8212 | + u8 txpwr_max;
|
||
8213 | u8 challow[15]; //channels from 1 to 14, 0 not used |
||
8214 | short up; |
||
8215 | short crcmon; //if 1 allow bad crc frame reception in monitor mode |
||
8216 | -// short prism_hdr;
|
||
8217 | -
|
||
8218 | + short prism_hdr;
|
||
8219 | + short fasttx;
|
||
8220 | + short highpower;
|
||
8221 | +
|
||
8222 | // struct timer_list scan_timer; |
||
8223 | /*short scanpending; |
||
8224 | short stopscan;*/ |
||
8225 | @@ -158,7 +168,7 @@ |
||
8226 | //u8 active_scan_num; |
||
8227 | struct semaphore wx_sem; |
||
8228 | // short hw_wep; |
||
8229 | -
|
||
8230 | +
|
||
8231 | // short digphy; |
||
8232 | // short antb; |
||
8233 | // short diversity; |
||
8234 | @@ -171,31 +181,31 @@ |
||
8235 | void (*rf_close)(struct net_device *dev); |
||
8236 | void (*rf_init)(struct net_device *dev); |
||
8237 | //short rate; |
||
8238 | - short promisc;
|
||
8239 | + short promisc;
|
||
8240 | /*stats*/ |
||
8241 | struct Stats stats; |
||
8242 | struct iw_statistics wstats; |
||
8243 | struct proc_dir_entry *dir_dev; |
||
8244 | -
|
||
8245 | +
|
||
8246 | /*RX stuff*/ |
||
8247 | // u32 *rxring; |
||
8248 | // u32 *rxringtail; |
||
8249 | // dma_addr_t rxringdma; |
||
8250 | struct urb **rx_urb; |
||
8251 | -
|
||
8252 | +
|
||
8253 | //struct buffer *rxbuffer; |
||
8254 | //struct buffer *rxbufferhead; |
||
8255 | //int rxringcount; |
||
8256 | //u16 rxbuffersize; |
||
8257 | -
|
||
8258 | - //struct sk_buff *rx_skb;
|
||
8259 | +
|
||
8260 | + //struct sk_buff *rx_skb;
|
||
8261 | |||
8262 | //short rx_skb_complete; |
||
8263 | |||
8264 | //u32 rx_prevlen; |
||
8265 | atomic_t tx_lp_pending; |
||
8266 | atomic_t tx_np_pending; |
||
8267 | -#if 0
|
||
8268 | +#if 0
|
||
8269 | /*TX stuff*/ |
||
8270 | u32 *txlpring; |
||
8271 | u32 *txhpring; |
||
8272 | @@ -225,7 +235,7 @@ |
||
8273 | struct urb *rxurb_task; |
||
8274 | // u8 dma_poll_mask; |
||
8275 | //short tx_suspend; |
||
8276 | -
|
||
8277 | +
|
||
8278 | /* adhoc/master mode stuff */ |
||
8279 | #if 0 |
||
8280 | u32 *txbeacontail; |
||
8281 | @@ -239,22 +249,23 @@ |
||
8282 | //u16 master_beaconinterval; |
||
8283 | // u32 master_beaconsize; |
||
8284 | //u16 beacon_interval; |
||
8285 | -
|
||
8286 | +
|
||
8287 | u8 retry_data; |
||
8288 | u8 retry_rts; |
||
8289 | -
|
||
8290 | +
|
||
8291 | struct work_struct reset_wq; |
||
8292 | -
|
||
8293 | +
|
||
8294 | }r8180_priv; |
||
8295 | |||
8296 | |||
8297 | -typedef enum{
|
||
8298 | +typedef enum{
|
||
8299 | LOW_PRIORITY , |
||
8300 | - NORM_PRIORITY
|
||
8301 | + NORM_PRIORITY
|
||
8302 | } priority_t; |
||
8303 | |||
8304 | |||
8305 | short rtl8180_tx(struct net_device *dev,u32* skbuf, int len,priority_t priority,short morefrag,short rate); |
||
8306 | +short rtl8180_tx_fast(struct net_device *dev,u32* skbuf, int len, short rate);
|
||
8307 | |||
8308 | u8 read_nic_byte(struct net_device *dev, int x); |
||
8309 | u8 read_nic_byte_E(struct net_device *dev, int x); |
||
8310 | diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h~ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.h~ |
||
8311 | --- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h~ 2006-06-06 04:58:02.000000000 +0200 |
||
8312 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.h~ 1970-01-01 01:00:00.000000000 +0100 |
||
8313 | @@ -1,288 +0,0 @@ |
||
8314 | -/*
|
||
8315 | - This is part of rtl8187 OpenSource driver.
|
||
8316 | - Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
|
||
8317 | - Released under the terms of GPL (General Public Licence)
|
||
8318 | -
|
||
8319 | - Parts of this driver are based on the GPL part of the
|
||
8320 | - official realtek driver
|
||
8321 | -
|
||
8322 | - Parts of this driver are based on the rtl8180 driver skeleton
|
||
8323 | - from Patric Schenke & Andres Salomon
|
||
8324 | -
|
||
8325 | - Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
|
||
8326 | -
|
||
8327 | - We want to tanks the Authors of those projects and the Ndiswrapper
|
||
8328 | - project Authors.
|
||
8329 | -*/
|
||
8330 | -
|
||
8331 | -#ifndef R8180H
|
||
8332 | -#define R8180H
|
||
8333 | -
|
||
8334 | -
|
||
8335 | -#define RTL8187_MODULE_NAME "rtl8187"
|
||
8336 | -#define DMESG(x,a...) printk(KERN_INFO RTL8187_MODULE_NAME ": " x "\n", ## a)
|
||
8337 | -#define DMESGW(x,a...) printk(KERN_WARNING RTL8187_MODULE_NAME ": WW:" x "\n", ## a)
|
||
8338 | -#define DMESGE(x,a...) printk(KERN_WARNING RTL8187_MODULE_NAME ": EE:" x "\n", ## a)
|
||
8339 | -
|
||
8340 | -#include <linux/module.h>
|
||
8341 | -#include <linux/kernel.h>
|
||
8342 | -#include <linux/config.h>
|
||
8343 | -#include <linux/init.h>
|
||
8344 | -#include <linux/ioport.h>
|
||
8345 | -#include <linux/sched.h>
|
||
8346 | -#include <linux/types.h>
|
||
8347 | -#include <linux/slab.h>
|
||
8348 | -#include <linux/netdevice.h>
|
||
8349 | -//#include <linux/pci.h>
|
||
8350 | -#include <linux/usb.h>
|
||
8351 | -#include <linux/etherdevice.h>
|
||
8352 | -#include <linux/delay.h>
|
||
8353 | -#include <linux/rtnetlink.h> //for rtnl_lock()
|
||
8354 | -#include <linux/wireless.h>
|
||
8355 | -#include <linux/timer.h>
|
||
8356 | -#include <linux/proc_fs.h> // Necessary because we use the proc fs
|
||
8357 | -#include <linux/if_arp.h>
|
||
8358 | -#include <linux/random.h>
|
||
8359 | -#include <linux/version.h>
|
||
8360 | -#include <asm/io.h>
|
||
8361 | -#include <asm/semaphore.h>
|
||
8362 | -
|
||
8363 | -#include "ieee80211.h"
|
||
8364 | -
|
||
8365 | -#define EPROM_93c46 0
|
||
8366 | -#define EPROM_93c56 1
|
||
8367 | -
|
||
8368 | -#define DEFAULT_FRAG_THRESHOLD 2342U
|
||
8369 | -#define MIN_FRAG_THRESHOLD 256U
|
||
8370 | -#define DEFAULT_BEACONINTERVAL 0x64U
|
||
8371 | -#define DEFAULT_BEACON_ESSID "Rtl8187"
|
||
8372 | -
|
||
8373 | -#define DEFAULT_SSID ""
|
||
8374 | -#define DEFAULT_RETRY_RTS 7
|
||
8375 | -#define DEFAULT_RETRY_DATA 7
|
||
8376 | -#define PRISM_HDR_SIZE 64
|
||
8377 | -
|
||
8378 | -#define RTL_IOCTL_WPA_SUPPLICANT SIOCIWFIRSTPRIV+30
|
||
8379 | -
|
||
8380 | -typedef struct buffer
|
||
8381 | -{
|
||
8382 | - struct buffer *next;
|
||
8383 | - u32 *buf;
|
||
8384 | -
|
||
8385 | -} buffer;
|
||
8386 | -
|
||
8387 | -#if 0
|
||
8388 | -
|
||
8389 | -typedef struct tx_pendingbuf
|
||
8390 | -{
|
||
8391 | - struct ieee80211_txb *txb;
|
||
8392 | - short ispending;
|
||
8393 | - short descfrag;
|
||
8394 | -} tx_pendigbuf;
|
||
8395 | -
|
||
8396 | -#endif
|
||
8397 | -
|
||
8398 | -typedef struct Stats
|
||
8399 | -{
|
||
8400 | - unsigned long txrdu;
|
||
8401 | -// unsigned long rxrdu;
|
||
8402 | - //unsigned long rxnolast;
|
||
8403 | - //unsigned long rxnodata;
|
||
8404 | -// unsigned long rxreset;
|
||
8405 | -// unsigned long rxwrkaround;
|
||
8406 | -// unsigned long rxnopointer;
|
||
8407 | - unsigned long rxok;
|
||
8408 | - unsigned long rxurberr;
|
||
8409 | - unsigned long rxstaterr;
|
||
8410 | - unsigned long txnperr;
|
||
8411 | - unsigned long txnpdrop;
|
||
8412 | - unsigned long txresumed;
|
||
8413 | -// unsigned long rxerr;
|
||
8414 | -// unsigned long rxoverflow;
|
||
8415 | -// unsigned long rxint;
|
||
8416 | - unsigned long txnpokint;
|
||
8417 | -// unsigned long txhpokint;
|
||
8418 | -// unsigned long txhperr;
|
||
8419 | -// unsigned long ints;
|
||
8420 | -// unsigned long shints;
|
||
8421 | - unsigned long txoverflow;
|
||
8422 | -// unsigned long rxdmafail;
|
||
8423 | -// unsigned long txbeacon;
|
||
8424 | -// unsigned long txbeaconerr;
|
||
8425 | - unsigned long txlpokint;
|
||
8426 | - unsigned long txlpdrop;
|
||
8427 | - unsigned long txlperr;
|
||
8428 | - unsigned long txdatapkt;
|
||
8429 | -} Stats;
|
||
8430 | -
|
||
8431 | -
|
||
8432 | -
|
||
8433 | -typedef struct r8180_priv
|
||
8434 | -{
|
||
8435 | - struct usb_device *udev;
|
||
8436 | - short epromtype;
|
||
8437 | - int irq;
|
||
8438 | - struct ieee80211_device *ieee80211;
|
||
8439 | -
|
||
8440 | - short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D */
|
||
8441 | - short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */
|
||
8442 | - short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
|
||
8443 | - short enable_gpio0;
|
||
8444 | - enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type;
|
||
8445 | - short hw_plcp_len;
|
||
8446 | -
|
||
8447 | -// spinlock_t irq_lock;
|
||
8448 | -// spinlock_t irq_th_lock;
|
||
8449 | - spinlock_t tx_lock;
|
||
8450 | -
|
||
8451 | - u16 irq_mask;
|
||
8452 | -// short irq_enabled;
|
||
8453 | - struct net_device *dev;
|
||
8454 | - short chan;
|
||
8455 | - short sens;
|
||
8456 | - short max_sens;
|
||
8457 | - u8 chtxpwr[15]; //channels from 1 to 14, 0 not used
|
||
8458 | - u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used
|
||
8459 | - u8 cck_txpwr_base;
|
||
8460 | - u8 ofdm_txpwr_base;
|
||
8461 | - u8 challow[15]; //channels from 1 to 14, 0 not used
|
||
8462 | - short up;
|
||
8463 | - short crcmon; //if 1 allow bad crc frame reception in monitor mode
|
||
8464 | -// short prism_hdr;
|
||
8465 | -
|
||
8466 | -// struct timer_list scan_timer;
|
||
8467 | - /*short scanpending;
|
||
8468 | - short stopscan;*/
|
||
8469 | -// spinlock_t scan_lock;
|
||
8470 | -// u8 active_probe;
|
||
8471 | - //u8 active_scan_num;
|
||
8472 | - struct semaphore wx_sem;
|
||
8473 | -// short hw_wep;
|
||
8474 | -
|
||
8475 | -// short digphy;
|
||
8476 | -// short antb;
|
||
8477 | -// short diversity;
|
||
8478 | -// u8 cs_treshold;
|
||
8479 | -// short rcr_csense;
|
||
8480 | - short rf_chip;
|
||
8481 | -// u32 key0[4];
|
||
8482 | - short (*rf_set_sens)(struct net_device *dev,short sens);
|
||
8483 | - void (*rf_set_chan)(struct net_device *dev,short ch);
|
||
8484 | - void (*rf_close)(struct net_device *dev);
|
||
8485 | - void (*rf_init)(struct net_device *dev);
|
||
8486 | - //short rate;
|
||
8487 | - short promisc;
|
||
8488 | - /*stats*/
|
||
8489 | - struct Stats stats;
|
||
8490 | - struct iw_statistics wstats;
|
||
8491 | - struct proc_dir_entry *dir_dev;
|
||
8492 | -
|
||
8493 | - /*RX stuff*/
|
||
8494 | -// u32 *rxring;
|
||
8495 | -// u32 *rxringtail;
|
||
8496 | -// dma_addr_t rxringdma;
|
||
8497 | - struct urb **rx_urb;
|
||
8498 | -
|
||
8499 | - //struct buffer *rxbuffer;
|
||
8500 | - //struct buffer *rxbufferhead;
|
||
8501 | - //int rxringcount;
|
||
8502 | - //u16 rxbuffersize;
|
||
8503 | -
|
||
8504 | - //struct sk_buff *rx_skb;
|
||
8505 | -
|
||
8506 | - //short rx_skb_complete;
|
||
8507 | -
|
||
8508 | - //u32 rx_prevlen;
|
||
8509 | - atomic_t tx_lp_pending;
|
||
8510 | - atomic_t tx_np_pending;
|
||
8511 | -#if 0
|
||
8512 | - /*TX stuff*/
|
||
8513 | - u32 *txlpring;
|
||
8514 | - u32 *txhpring;
|
||
8515 | - u32 *txnpring;
|
||
8516 | - dma_addr_t txlpringdma;
|
||
8517 | - dma_addr_t txhpringdma;
|
||
8518 | - dma_addr_t txnpringdma;
|
||
8519 | - u32 *txlpringtail;
|
||
8520 | - u32 *txhpringtail;
|
||
8521 | - u32 *txnpringtail;
|
||
8522 | - u32 *txlpringhead;
|
||
8523 | - u32 *txhpringhead;
|
||
8524 | - u32 *txnpringhead;
|
||
8525 | - struct buffer *txlpbufs;
|
||
8526 | - struct buffer *txhpbufs;
|
||
8527 | - struct buffer *txnpbufs;
|
||
8528 | - struct buffer *txlpbufstail;
|
||
8529 | - struct buffer *txhpbufstail;
|
||
8530 | - struct buffer *txnpbufstail;
|
||
8531 | - int txringcount;
|
||
8532 | - int txbuffsize;
|
||
8533 | -
|
||
8534 | - //struct tx_pendingbuf txnp_pending;
|
||
8535 | - struct tasklet_struct irq_tx_tasklet;
|
||
8536 | -#endif
|
||
8537 | -// struct tasklet_struct irq_rx_tasklet;
|
||
8538 | -// u8 dma_poll_mask;
|
||
8539 | - //short tx_suspend;
|
||
8540 | -
|
||
8541 | - /* adhoc/master mode stuff */
|
||
8542 | -#if 0
|
||
8543 | - u32 *txbeacontail;
|
||
8544 | - dma_addr_t txbeaconringdma;
|
||
8545 | - u32 *txbeaconring;
|
||
8546 | - int txbeaconcount;
|
||
8547 | -#endif
|
||
8548 | -// struct ieee_tx_beacon *beacon_buf;
|
||
8549 | - //char *master_essid;
|
||
8550 | -// dma_addr_t beacondmabuf;
|
||
8551 | - //u16 master_beaconinterval;
|
||
8552 | -// u32 master_beaconsize;
|
||
8553 | - //u16 beacon_interval;
|
||
8554 | -
|
||
8555 | - u8 retry_data;
|
||
8556 | - u8 retry_rts;
|
||
8557 | -
|
||
8558 | - struct work_struct reset_wq;
|
||
8559 | -
|
||
8560 | -}r8180_priv;
|
||
8561 | -
|
||
8562 | -
|
||
8563 | -typedef enum{
|
||
8564 | - LOW_PRIORITY ,
|
||
8565 | - NORM_PRIORITY
|
||
8566 | - } priority_t;
|
||
8567 | -
|
||
8568 | -
|
||
8569 | -short rtl8180_tx(struct net_device *dev,u32* skbuf, int len,priority_t priority,short morefrag,short rate);
|
||
8570 | -
|
||
8571 | -u8 read_nic_byte(struct net_device *dev, int x);
|
||
8572 | -u8 read_nic_byte_E(struct net_device *dev, int x);
|
||
8573 | -u32 read_nic_dword(struct net_device *dev, int x);
|
||
8574 | -u16 read_nic_word(struct net_device *dev, int x) ;
|
||
8575 | -void write_nic_byte(struct net_device *dev, int x,u8 y);
|
||
8576 | -void write_nic_byte_E(struct net_device *dev, int x,u8 y);
|
||
8577 | -void write_nic_word(struct net_device *dev, int x,u16 y);
|
||
8578 | -void write_nic_dword(struct net_device *dev, int x,u32 y);
|
||
8579 | -void force_pci_posting(struct net_device *dev);
|
||
8580 | -
|
||
8581 | -void rtl8180_rtx_disable(struct net_device *);
|
||
8582 | -void rtl8180_rx_enable(struct net_device *);
|
||
8583 | -void rtl8180_tx_enable(struct net_device *);
|
||
8584 | -
|
||
8585 | -void rtl8180_disassociate(struct net_device *dev);
|
||
8586 | -//void fix_rx_fifo(struct net_device *dev);
|
||
8587 | -void rtl8185_set_rf_pins_enable(struct net_device *dev,u32 a);
|
||
8588 | -
|
||
8589 | -void rtl8180_set_anaparam(struct net_device *dev,u32 a);
|
||
8590 | -void rtl8185_set_anaparam2(struct net_device *dev,u32 a);
|
||
8591 | -void rtl8180_update_msr(struct net_device *dev);
|
||
8592 | -int rtl8180_down(struct net_device *dev);
|
||
8593 | -int rtl8180_up(struct net_device *dev);
|
||
8594 | -void rtl8180_commit(struct net_device *dev);
|
||
8595 | -void rtl8180_set_chan(struct net_device *dev,short ch);
|
||
8596 | -void write_phy(struct net_device *dev, u8 adr, u8 data);
|
||
8597 | -void write_phy_cck(struct net_device *dev, u8 adr, u32 data);
|
||
8598 | -void write_phy_ofdm(struct net_device *dev, u8 adr, u32 data);
|
||
8599 | -void rtl8185_tx_antenna(struct net_device *dev, u8 ant);
|
||
8600 | -void rtl8187_set_rxconf(struct net_device *dev);
|
||
8601 | -#endif
|
||
8602 | 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 |
||
8603 | --- rtl8187_linux_26.1010.0622.2006/beta-8187/.tmp_versions/r8187.mod 2006-06-22 07:40:15.000000000 +0200 |
||
8604 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/.tmp_versions/r8187.mod 2008-02-22 15:33:11.000000000 +0100 |
||
8605 | @@ -1,2 +1,2 @@ |
||
8606 | -/usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8187.ko |
||
8607 | -/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 |
||
8608 | +/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.ko |
||
8609 | +/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 |
||
8610 | diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.c |
||
8611 | --- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.c 2006-06-06 04:57:56.000000000 +0200 |
||
8612 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.c 2008-01-30 17:38:11.000000000 +0100 |
||
8613 | @@ -11,7 +11,6 @@ |
||
8614 | * |
||
8615 | */ |
||
8616 | |||
8617 | -#include <linux/config.h> |
||
8618 | #include <linux/version.h> |
||
8619 | #include <linux/module.h> |
||
8620 | #include <linux/init.h> |
||
8621 | @@ -19,6 +18,12 @@ |
||
8622 | #include <asm/string.h> |
||
8623 | #include <asm/errno.h> |
||
8624 | |||
8625 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) |
||
8626 | +#include <linux/config.h> |
||
8627 | +#else |
||
8628 | +#include <linux/autoconf.h> |
||
8629 | +#endif |
||
8630 | + |
||
8631 | #include "ieee80211.h" |
||
8632 | |||
8633 | MODULE_AUTHOR("Jouni Malinen"); |
||
8634 | @@ -38,7 +43,7 @@ |
||
8635 | |||
8636 | static struct ieee80211_crypto *hcrypt; |
||
8637 | |||
8638 | -void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, |
||
8639 | +void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *ieee, |
||
8640 | int force) |
||
8641 | { |
||
8642 | struct list_head *ptr, *n; |
||
8643 | @@ -61,13 +66,13 @@ |
||
8644 | } |
||
8645 | } |
||
8646 | |||
8647 | -void ieee80211_crypt_deinit_handler(unsigned long data) |
||
8648 | +void ieee80211_crypt_deinit_handler_rtl7(unsigned long data) |
||
8649 | { |
||
8650 | struct ieee80211_device *ieee = (struct ieee80211_device *)data; |
||
8651 | unsigned long flags; |
||
8652 | |||
8653 | spin_lock_irqsave(&ieee->lock, flags); |
||
8654 | - ieee80211_crypt_deinit_entries(ieee, 0); |
||
8655 | + ieee80211_crypt_deinit_entries_rtl7(ieee, 0); |
||
8656 | if (!list_empty(&ieee->crypt_deinit_list)) { |
||
8657 | printk(KERN_DEBUG "%s: entries remaining in delayed crypt " |
||
8658 | "deletion list\n", ieee->dev->name); |
||
8659 | @@ -78,7 +83,7 @@ |
||
8660 | |||
8661 | } |
||
8662 | |||
8663 | -void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, |
||
8664 | +void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee, |
||
8665 | struct ieee80211_crypt_data **crypt) |
||
8666 | { |
||
8667 | struct ieee80211_crypt_data *tmp; |
||
8668 | @@ -103,7 +108,7 @@ |
||
8669 | spin_unlock_irqrestore(&ieee->lock, flags); |
||
8670 | } |
||
8671 | |||
8672 | -int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops) |
||
8673 | +int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops) |
||
8674 | { |
||
8675 | unsigned long flags; |
||
8676 | struct ieee80211_crypto_alg *alg; |
||
8677 | @@ -128,7 +133,7 @@ |
||
8678 | return 0; |
||
8679 | } |
||
8680 | |||
8681 | -int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops) |
||
8682 | +int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops) |
||
8683 | { |
||
8684 | unsigned long flags; |
||
8685 | struct list_head *ptr; |
||
8686 | @@ -159,7 +164,7 @@ |
||
8687 | } |
||
8688 | |||
8689 | |||
8690 | -struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name) |
||
8691 | +struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name) |
||
8692 | { |
||
8693 | unsigned long flags; |
||
8694 | struct list_head *ptr; |
||
8695 | @@ -186,13 +191,13 @@ |
||
8696 | } |
||
8697 | |||
8698 | |||
8699 | -static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; } |
||
8700 | -static void ieee80211_crypt_null_deinit(void *priv) {} |
||
8701 | +static void * ieee80211_crypt_null_init_rtl7(int keyidx) { return (void *) 1; } |
||
8702 | +static void ieee80211_crypt_null_deinit_rtl7(void *priv) {} |
||
8703 | |||
8704 | static struct ieee80211_crypto_ops ieee80211_crypt_null = { |
||
8705 | .name = "NULL", |
||
8706 | - .init = ieee80211_crypt_null_init, |
||
8707 | - .deinit = ieee80211_crypt_null_deinit, |
||
8708 | + .init = ieee80211_crypt_null_init_rtl7, |
||
8709 | + .deinit = ieee80211_crypt_null_deinit_rtl7, |
||
8710 | .encrypt_mpdu = NULL, |
||
8711 | .decrypt_mpdu = NULL, |
||
8712 | .encrypt_msdu = NULL, |
||
8713 | @@ -205,7 +210,7 @@ |
||
8714 | }; |
||
8715 | |||
8716 | |||
8717 | -static int __init ieee80211_crypto_init(void) |
||
8718 | +static int __init ieee80211_crypto_init_rtl7(void) |
||
8719 | { |
||
8720 | int ret = -ENOMEM; |
||
8721 | |||
8722 | @@ -217,7 +222,7 @@ |
||
8723 | INIT_LIST_HEAD(&hcrypt->algs); |
||
8724 | spin_lock_init(&hcrypt->lock); |
||
8725 | |||
8726 | - ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null); |
||
8727 | + ret = ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_null); |
||
8728 | if (ret < 0) { |
||
8729 | kfree(hcrypt); |
||
8730 | hcrypt = NULL; |
||
8731 | @@ -227,7 +232,7 @@ |
||
8732 | } |
||
8733 | |||
8734 | |||
8735 | -static void __exit ieee80211_crypto_deinit(void) |
||
8736 | +static void __exit ieee80211_crypto_deinit_rtl7(void) |
||
8737 | { |
||
8738 | struct list_head *ptr, *n; |
||
8739 | |||
8740 | @@ -247,13 +252,13 @@ |
||
8741 | kfree(hcrypt); |
||
8742 | } |
||
8743 | |||
8744 | -EXPORT_SYMBOL(ieee80211_crypt_deinit_entries); |
||
8745 | -EXPORT_SYMBOL(ieee80211_crypt_deinit_handler); |
||
8746 | -EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit); |
||
8747 | - |
||
8748 | -EXPORT_SYMBOL(ieee80211_register_crypto_ops); |
||
8749 | -EXPORT_SYMBOL(ieee80211_unregister_crypto_ops); |
||
8750 | -EXPORT_SYMBOL(ieee80211_get_crypto_ops); |
||
8751 | +EXPORT_SYMBOL(ieee80211_crypt_deinit_entries_rtl7); |
||
8752 | +EXPORT_SYMBOL(ieee80211_crypt_deinit_handler_rtl7); |
||
8753 | +EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit_rtl7); |
||
8754 | + |
||
8755 | +EXPORT_SYMBOL(ieee80211_register_crypto_ops_rtl7); |
||
8756 | +EXPORT_SYMBOL(ieee80211_unregister_crypto_ops_rtl7); |
||
8757 | +EXPORT_SYMBOL(ieee80211_get_crypto_ops_rtl7); |
||
8758 | |||
8759 | -module_init(ieee80211_crypto_init); |
||
8760 | -module_exit(ieee80211_crypto_deinit); |
||
8761 | +module_init(ieee80211_crypto_init_rtl7); |
||
8762 | +module_exit(ieee80211_crypto_deinit_rtl7); |
||
8763 | 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 |
||
8764 | --- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_ccmp.c 2006-06-06 04:58:00.000000000 +0200 |
||
8765 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_ccmp.c 2008-01-30 17:38:11.000000000 +0100 |
||
8766 | @@ -9,7 +9,6 @@ |
||
8767 | * more details. |
||
8768 | */ |
||
8769 | |||
8770 | -#include <linux/config.h> |
||
8771 | #include <linux/version.h> |
||
8772 | #include <linux/module.h> |
||
8773 | #include <linux/init.h> |
||
8774 | @@ -22,11 +21,22 @@ |
||
8775 | #include <asm/string.h> |
||
8776 | #include <linux/wireless.h> |
||
8777 | |||
8778 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) |
||
8779 | +#include <linux/config.h> |
||
8780 | +#else |
||
8781 | +#include <linux/autoconf.h> |
||
8782 | +#endif |
||
8783 | + |
||
8784 | #include "ieee80211.h" |
||
8785 | |||
8786 | |||
8787 | #include <linux/crypto.h> |
||
8788 | -#include <asm/scatterlist.h> |
||
8789 | + |
||
8790 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) |
||
8791 | + #include <asm/scatterlist.h> |
||
8792 | +#else |
||
8793 | + #include <linux/scatterlist.h> |
||
8794 | +#endif |
||
8795 | |||
8796 | MODULE_AUTHOR("Jouni Malinen"); |
||
8797 | MODULE_DESCRIPTION("Host AP crypt: CCMP"); |
||
8798 | @@ -51,7 +61,11 @@ |
||
8799 | |||
8800 | int key_idx; |
||
8801 | |||
8802 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) |
||
8803 | struct crypto_tfm *tfm; |
||
8804 | +#else |
||
8805 | + struct crypto_cipher *tfm; |
||
8806 | +#endif |
||
8807 | |||
8808 | /* scratch buffers for virt_to_page() (crypto API) */ |
||
8809 | u8 tx_b0[AES_BLOCK_LEN], tx_b[AES_BLOCK_LEN], |
||
8810 | @@ -59,7 +73,8 @@ |
||
8811 | u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN]; |
||
8812 | }; |
||
8813 | |||
8814 | -void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm, |
||
8815 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) |
||
8816 | +void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_tfm *tfm, |
||
8817 | const u8 pt[16], u8 ct[16]) |
||
8818 | { |
||
8819 | struct scatterlist src, dst; |
||
8820 | @@ -74,8 +89,15 @@ |
||
8821 | |||
8822 | crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN); |
||
8823 | } |
||
8824 | +#else |
||
8825 | +static inline void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_cipher *tfm, |
||
8826 | + const u8 pt[16], u8 ct[16]) |
||
8827 | +{ |
||
8828 | + crypto_cipher_encrypt_one(tfm, ct, pt); |
||
8829 | +} |
||
8830 | +#endif |
||
8831 | |||
8832 | -static void * ieee80211_ccmp_init(int key_idx) |
||
8833 | +static void * ieee80211_ccmp_init_rtl7(int key_idx) |
||
8834 | { |
||
8835 | struct ieee80211_ccmp_data *priv; |
||
8836 | |||
8837 | @@ -85,19 +107,33 @@ |
||
8838 | memset(priv, 0, sizeof(*priv)); |
||
8839 | priv->key_idx = key_idx; |
||
8840 | |||
8841 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) |
||
8842 | priv->tfm = crypto_alloc_tfm("aes", 0); |
||
8843 | if (priv->tfm == NULL) { |
||
8844 | printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate " |
||
8845 | "crypto API aes\n"); |
||
8846 | goto fail; |
||
8847 | } |
||
8848 | +#else |
||
8849 | + priv->tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); |
||
8850 | + if (IS_ERR(priv->tfm)) { |
||
8851 | + printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate " |
||
8852 | + "crypto API aes\n"); |
||
8853 | + priv->tfm = NULL; |
||
8854 | + goto fail; |
||
8855 | + } |
||
8856 | +#endif |
||
8857 | |||
8858 | return priv; |
||
8859 | |||
8860 | fail: |
||
8861 | if (priv) { |
||
8862 | if (priv->tfm) |
||
8863 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) |
||
8864 | crypto_free_tfm(priv->tfm); |
||
8865 | +#else |
||
8866 | + crypto_free_cipher(priv->tfm); |
||
8867 | +#endif |
||
8868 | kfree(priv); |
||
8869 | } |
||
8870 | |||
8871 | @@ -105,16 +141,20 @@ |
||
8872 | } |
||
8873 | |||
8874 | |||
8875 | -static void ieee80211_ccmp_deinit(void *priv) |
||
8876 | +static void ieee80211_ccmp_deinit_rtl7(void *priv) |
||
8877 | { |
||
8878 | struct ieee80211_ccmp_data *_priv = priv; |
||
8879 | if (_priv && _priv->tfm) |
||
8880 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) |
||
8881 | crypto_free_tfm(_priv->tfm); |
||
8882 | +#else |
||
8883 | + crypto_free_cipher(_priv->tfm); |
||
8884 | +#endif |
||
8885 | kfree(priv); |
||
8886 | } |
||
8887 | |||
8888 | |||
8889 | -static inline void xor_block(u8 *b, u8 *a, size_t len) |
||
8890 | +static inline void xor_block_rtl7(u8 *b, u8 *a, size_t len) |
||
8891 | { |
||
8892 | int i; |
||
8893 | for (i = 0; i < len; i++) |
||
8894 | @@ -122,7 +162,11 @@ |
||
8895 | } |
||
8896 | |||
8897 | |||
8898 | -static void ccmp_init_blocks(struct crypto_tfm *tfm, |
||
8899 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) |
||
8900 | +static void ccmp_init_blocks_rtl7(struct crypto_tfm *tfm, |
||
8901 | +#else |
||
8902 | +static void ccmp_init_blocks_rtl7(struct crypto_cipher *tfm, |
||
8903 | +#endif |
||
8904 | struct ieee80211_hdr *hdr, |
||
8905 | u8 *pn, size_t dlen, u8 *b0, u8 *auth, |
||
8906 | u8 *s0) |
||
8907 | @@ -186,18 +230,18 @@ |
||
8908 | } |
||
8909 | |||
8910 | /* Start with the first block and AAD */ |
||
8911 | - ieee80211_ccmp_aes_encrypt(tfm, b0, auth); |
||
8912 | - xor_block(auth, aad, AES_BLOCK_LEN); |
||
8913 | - ieee80211_ccmp_aes_encrypt(tfm, auth, auth); |
||
8914 | - xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN); |
||
8915 | - ieee80211_ccmp_aes_encrypt(tfm, auth, auth); |
||
8916 | + ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, auth); |
||
8917 | + xor_block_rtl7(auth, aad, AES_BLOCK_LEN); |
||
8918 | + ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth); |
||
8919 | + xor_block_rtl7(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN); |
||
8920 | + ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth); |
||
8921 | b0[0] &= 0x07; |
||
8922 | b0[14] = b0[15] = 0; |
||
8923 | - ieee80211_ccmp_aes_encrypt(tfm, b0, s0); |
||
8924 | + ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, s0); |
||
8925 | } |
||
8926 | |||
8927 | |||
8928 | -static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) |
||
8929 | +static int ieee80211_ccmp_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv) |
||
8930 | { |
||
8931 | struct ieee80211_ccmp_data *key = priv; |
||
8932 | int data_len, i, blocks, last, len; |
||
8933 | @@ -237,7 +281,7 @@ |
||
8934 | *pos++ = key->tx_pn[0]; |
||
8935 | |||
8936 | hdr = (struct ieee80211_hdr *) skb->data; |
||
8937 | - ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0); |
||
8938 | + ccmp_init_blocks_rtl7(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0); |
||
8939 | |||
8940 | blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN; |
||
8941 | last = data_len % AES_BLOCK_LEN; |
||
8942 | @@ -245,13 +289,13 @@ |
||
8943 | for (i = 1; i <= blocks; i++) { |
||
8944 | len = (i == blocks && last) ? last : AES_BLOCK_LEN; |
||
8945 | /* Authentication */ |
||
8946 | - xor_block(b, pos, len); |
||
8947 | - ieee80211_ccmp_aes_encrypt(key->tfm, b, b); |
||
8948 | + xor_block_rtl7(b, pos, len); |
||
8949 | + ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b, b); |
||
8950 | /* Encryption, with counter */ |
||
8951 | b0[14] = (i >> 8) & 0xff; |
||
8952 | b0[15] = i & 0xff; |
||
8953 | - ieee80211_ccmp_aes_encrypt(key->tfm, b0, e); |
||
8954 | - xor_block(pos, e, len); |
||
8955 | + ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, e); |
||
8956 | + xor_block_rtl7(pos, e, len); |
||
8957 | pos += len; |
||
8958 | } |
||
8959 | |||
8960 | @@ -262,7 +306,7 @@ |
||
8961 | } |
||
8962 | |||
8963 | |||
8964 | -static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) |
||
8965 | +static int ieee80211_ccmp_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv) |
||
8966 | { |
||
8967 | struct ieee80211_ccmp_data *key = priv; |
||
8968 | u8 keyidx, *pos; |
||
8969 | @@ -326,8 +370,8 @@ |
||
8970 | return -4; |
||
8971 | } |
||
8972 | |||
8973 | - ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b); |
||
8974 | - xor_block(mic, b, CCMP_MIC_LEN); |
||
8975 | + ccmp_init_blocks_rtl7(key->tfm, hdr, pn, data_len, b0, a, b); |
||
8976 | + xor_block_rtl7(mic, b, CCMP_MIC_LEN); |
||
8977 | |||
8978 | blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN; |
||
8979 | last = data_len % AES_BLOCK_LEN; |
||
8980 | @@ -337,11 +381,11 @@ |
||
8981 | /* Decrypt, with counter */ |
||
8982 | b0[14] = (i >> 8) & 0xff; |
||
8983 | b0[15] = i & 0xff; |
||
8984 | - ieee80211_ccmp_aes_encrypt(key->tfm, b0, b); |
||
8985 | - xor_block(pos, b, len); |
||
8986 | + ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, b); |
||
8987 | + xor_block_rtl7(pos, b, len); |
||
8988 | /* Authentication */ |
||
8989 | - xor_block(a, pos, len); |
||
8990 | - ieee80211_ccmp_aes_encrypt(key->tfm, a, a); |
||
8991 | + xor_block_rtl7(a, pos, len); |
||
8992 | + ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, a, a); |
||
8993 | pos += len; |
||
8994 | } |
||
8995 | |||
8996 | @@ -365,11 +409,15 @@ |
||
8997 | } |
||
8998 | |||
8999 | |||
9000 | -static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv) |
||
9001 | +static int ieee80211_ccmp_set_key_rtl7(void *key, int len, u8 *seq, void *priv) |
||
9002 | { |
||
9003 | struct ieee80211_ccmp_data *data = priv; |
||
9004 | int keyidx; |
||
9005 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) |
||
9006 | struct crypto_tfm *tfm = data->tfm; |
||
9007 | +#else |
||
9008 | + struct crypto_cipher *tfm = data->tfm; |
||
9009 | +#endif |
||
9010 | |||
9011 | keyidx = data->key_idx; |
||
9012 | memset(data, 0, sizeof(*data)); |
||
9013 | @@ -396,7 +444,7 @@ |
||
9014 | } |
||
9015 | |||
9016 | |||
9017 | -static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv) |
||
9018 | +static int ieee80211_ccmp_get_key_rtl7(void *key, int len, u8 *seq, void *priv) |
||
9019 | { |
||
9020 | struct ieee80211_ccmp_data *data = priv; |
||
9021 | |||
9022 | @@ -420,7 +468,7 @@ |
||
9023 | } |
||
9024 | |||
9025 | |||
9026 | -static char * ieee80211_ccmp_print_stats(char *p, void *priv) |
||
9027 | +static char * ieee80211_ccmp_print_stats_rtl7(char *p, void *priv) |
||
9028 | { |
||
9029 | struct ieee80211_ccmp_data *ccmp = priv; |
||
9030 | p += sprintf(p, "key[%d] alg=CCMP key_set=%d " |
||
9031 | @@ -437,34 +485,34 @@ |
||
9032 | } |
||
9033 | |||
9034 | |||
9035 | -static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = { |
||
9036 | +static struct ieee80211_crypto_ops ieee80211_crypt_ccmp_rtl7 = { |
||
9037 | .name = "CCMP", |
||
9038 | - .init = ieee80211_ccmp_init, |
||
9039 | - .deinit = ieee80211_ccmp_deinit, |
||
9040 | - .encrypt_mpdu = ieee80211_ccmp_encrypt, |
||
9041 | - .decrypt_mpdu = ieee80211_ccmp_decrypt, |
||
9042 | + .init = ieee80211_ccmp_init_rtl7, |
||
9043 | + .deinit = ieee80211_ccmp_deinit_rtl7, |
||
9044 | + .encrypt_mpdu = ieee80211_ccmp_encrypt_rtl7, |
||
9045 | + .decrypt_mpdu = ieee80211_ccmp_decrypt_rtl7, |
||
9046 | .encrypt_msdu = NULL, |
||
9047 | .decrypt_msdu = NULL, |
||
9048 | - .set_key = ieee80211_ccmp_set_key, |
||
9049 | - .get_key = ieee80211_ccmp_get_key, |
||
9050 | - .print_stats = ieee80211_ccmp_print_stats, |
||
9051 | + .set_key = ieee80211_ccmp_set_key_rtl7, |
||
9052 | + .get_key = ieee80211_ccmp_get_key_rtl7, |
||
9053 | + .print_stats = ieee80211_ccmp_print_stats_rtl7, |
||
9054 | .extra_prefix_len = CCMP_HDR_LEN, |
||
9055 | .extra_postfix_len = CCMP_MIC_LEN, |
||
9056 | .owner = THIS_MODULE, |
||
9057 | }; |
||
9058 | |||
9059 | |||
9060 | -static int __init ieee80211_crypto_ccmp_init(void) |
||
9061 | +static int __init ieee80211_crypto_ccmp_init_rtl7(void) |
||
9062 | { |
||
9063 | - return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp); |
||
9064 | + return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7); |
||
9065 | } |
||
9066 | |||
9067 | |||
9068 | -static void __exit ieee80211_crypto_ccmp_exit(void) |
||
9069 | +static void __exit ieee80211_crypto_ccmp_exit_rtl7(void) |
||
9070 | { |
||
9071 | - ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp); |
||
9072 | + ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7); |
||
9073 | } |
||
9074 | |||
9075 | |||
9076 | -module_init(ieee80211_crypto_ccmp_init); |
||
9077 | -module_exit(ieee80211_crypto_ccmp_exit); |
||
9078 | +module_init(ieee80211_crypto_ccmp_init_rtl7); |
||
9079 | +module_exit(ieee80211_crypto_ccmp_exit_rtl7); |
||
9080 | diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.h rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.h |
||
9081 | --- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.h 2006-06-06 04:58:00.000000000 +0200 |
||
9082 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.h 2008-01-30 17:38:11.000000000 +0100 |
||
9083 | @@ -75,12 +75,12 @@ |
||
9084 | atomic_t refcnt; |
||
9085 | }; |
||
9086 | |||
9087 | -int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); |
||
9088 | -int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); |
||
9089 | -struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name); |
||
9090 | -void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int); |
||
9091 | -void ieee80211_crypt_deinit_handler(unsigned long); |
||
9092 | -void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, |
||
9093 | +int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops); |
||
9094 | +int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops); |
||
9095 | +struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name); |
||
9096 | +void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int); |
||
9097 | +void ieee80211_crypt_deinit_handler_rtl7(unsigned long); |
||
9098 | +void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee, |
||
9099 | struct ieee80211_crypt_data **crypt); |
||
9100 | |||
9101 | #endif |
||
9102 | 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 |
||
9103 | --- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_tkip.c 2006-06-06 04:57:54.000000000 +0200 |
||
9104 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_tkip.c 2008-01-30 17:39:05.000000000 +0100 |
||
9105 | @@ -9,7 +9,6 @@ |
||
9106 | * more details. |
||
9107 | */ |
||
9108 | |||
9109 | -#include <linux/config.h> |
||
9110 | #include <linux/version.h> |
||
9111 | #include <linux/module.h> |
||
9112 | #include <linux/init.h> |
||
9113 | @@ -21,13 +20,24 @@ |
||
9114 | #include <linux/if_arp.h> |
||
9115 | #include <asm/string.h> |
||
9116 | |||
9117 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) |
||
9118 | +#include <linux/config.h> |
||
9119 | +#else |
||
9120 | +#include <linux/autoconf.h> |
||
9121 | +#endif |
||
9122 | + |
||
9123 | #include "ieee80211.h" |
||
9124 | |||
9125 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) |
||
9126 | + #include <asm/scatterlist.h> |
||
9127 | +#else |
||
9128 | + #include <linux/scatterlist.h> |
||
9129 | +#endif |
||
9130 | |||
9131 | #include <linux/crypto.h> |
||
9132 | -#include <asm/scatterlist.h> |
||
9133 | #include <linux/crc32.h> |
||
9134 | |||
9135 | + |
||
9136 | MODULE_AUTHOR("Jouni Malinen"); |
||
9137 | MODULE_DESCRIPTION("Host AP crypt: TKIP"); |
||
9138 | MODULE_LICENSE("GPL"); |
||
9139 | @@ -55,14 +65,21 @@ |
||
9140 | |||
9141 | int key_idx; |
||
9142 | |||
9143 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) |
||
9144 | struct crypto_tfm *tfm_arc4; |
||
9145 | struct crypto_tfm *tfm_michael; |
||
9146 | +#else |
||
9147 | + struct crypto_blkcipher *rx_tfm_arc4; |
||
9148 | + struct crypto_blkcipher *tx_tfm_arc4; |
||
9149 | + struct crypto_hash *rx_tfm_michael; |
||
9150 | + struct crypto_hash *tx_tfm_michael; |
||
9151 | +#endif |
||
9152 | |||
9153 | /* scratch buffers for virt_to_page() (crypto API) */ |
||
9154 | u8 rx_hdr[16], tx_hdr[16]; |
||
9155 | }; |
||
9156 | |||
9157 | -static void * ieee80211_tkip_init(int key_idx) |
||
9158 | +static void * ieee80211_tkip_init_rtl7(int key_idx) |
||
9159 | { |
||
9160 | struct ieee80211_tkip_data *priv; |
||
9161 | |||
9162 | @@ -72,28 +89,74 @@ |
||
9163 | memset(priv, 0, sizeof(*priv)); |
||
9164 | priv->key_idx = key_idx; |
||
9165 | |||
9166 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) |
||
9167 | priv->tfm_arc4 = crypto_alloc_tfm("arc4", 0); |
||
9168 | if (priv->tfm_arc4 == NULL) { |
||
9169 | printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " |
||
9170 | "crypto API arc4\n"); |
||
9171 | goto fail; |
||
9172 | } |
||
9173 | - |
||
9174 | priv->tfm_michael = crypto_alloc_tfm("michael_mic", 0); |
||
9175 | if (priv->tfm_michael == NULL) { |
||
9176 | printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " |
||
9177 | "crypto API michael_mic\n"); |
||
9178 | goto fail; |
||
9179 | } |
||
9180 | +#else |
||
9181 | + priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); |
||
9182 | + if (IS_ERR(priv->tx_tfm_arc4)) { |
||
9183 | + printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " |
||
9184 | + "crypto API arc4\n"); |
||
9185 | + priv->tx_tfm_arc4 = NULL; |
||
9186 | + goto fail; |
||
9187 | + } |
||
9188 | + |
||
9189 | + priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0, |
||
9190 | + CRYPTO_ALG_ASYNC); |
||
9191 | + if (IS_ERR(priv->tx_tfm_michael)) { |
||
9192 | + printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " |
||
9193 | + "crypto API michael_mic\n"); |
||
9194 | + priv->tx_tfm_michael = NULL; |
||
9195 | + goto fail; |
||
9196 | + } |
||
9197 | + |
||
9198 | + priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); |
||
9199 | + if (IS_ERR(priv->rx_tfm_arc4)) { |
||
9200 | + printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " |
||
9201 | + "crypto API arc4\n"); |
||
9202 | + priv->rx_tfm_arc4 = NULL; |
||
9203 | + goto fail; |
||
9204 | + } |
||
9205 | + |
||
9206 | + priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0, |
||
9207 | + CRYPTO_ALG_ASYNC); |
||
9208 | + if (IS_ERR(priv->rx_tfm_michael)) { |
||
9209 | + printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " |
||
9210 | + "crypto API michael_mic\n"); |
||
9211 | + priv->rx_tfm_michael = NULL; |
||
9212 | + goto fail; |
||
9213 | + } |
||
9214 | +#endif |
||
9215 | |||
9216 | return priv; |
||
9217 | |||
9218 | fail: |
||
9219 | if (priv) { |
||
9220 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) |
||
9221 | if (priv->tfm_michael) |
||
9222 | crypto_free_tfm(priv->tfm_michael); |
||
9223 | if (priv->tfm_arc4) |
||
9224 | crypto_free_tfm(priv->tfm_arc4); |
||
9225 | +#else |
||
9226 | + if (priv->tx_tfm_michael) |
||
9227 | + crypto_free_hash(priv->tx_tfm_michael); |
||
9228 | + if (priv->tx_tfm_arc4) |
||
9229 | + crypto_free_blkcipher(priv->tx_tfm_arc4); |
||
9230 | + if (priv->rx_tfm_michael) |
||
9231 | + crypto_free_hash(priv->rx_tfm_michael); |
||
9232 | + if (priv->rx_tfm_arc4) |
||
9233 | + crypto_free_blkcipher(priv->rx_tfm_arc4); |
||
9234 | +#endif |
||
9235 | kfree(priv); |
||
9236 | } |
||
9237 | |||
9238 | @@ -101,13 +164,26 @@ |
||
9239 | } |
||
9240 | |||
9241 | |||
9242 | -static void ieee80211_tkip_deinit(void *priv) |
||
9243 | +static void ieee80211_tkip_deinit_rtl7(void *priv) |
||
9244 | { |
||
9245 | struct ieee80211_tkip_data *_priv = priv; |
||
9246 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) |
||
9247 | if (_priv && _priv->tfm_michael) |
||
9248 | crypto_free_tfm(_priv->tfm_michael); |
||
9249 | if (_priv && _priv->tfm_arc4) |
||
9250 | crypto_free_tfm(_priv->tfm_arc4); |
||
9251 | +#else |
||
9252 | + if (_priv) { |
||
9253 | + if (_priv->tx_tfm_michael) |
||
9254 | + crypto_free_hash(_priv->tx_tfm_michael); |
||
9255 | + if (_priv->tx_tfm_arc4) |
||
9256 | + crypto_free_blkcipher(_priv->tx_tfm_arc4); |
||
9257 | + if (_priv->rx_tfm_michael) |
||
9258 | + crypto_free_hash(_priv->rx_tfm_michael); |
||
9259 | + if (_priv->rx_tfm_arc4) |
||
9260 | + crypto_free_blkcipher(_priv->rx_tfm_arc4); |
||
9261 | + } |
||
9262 | +#endif |
||
9263 | kfree(priv); |
||
9264 | } |
||
9265 | |||
9266 | @@ -200,7 +276,7 @@ |
||
9267 | |||
9268 | #define PHASE1_LOOP_COUNT 8 |
||
9269 | |||
9270 | -static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32) |
||
9271 | +static void tkip_mixing_phase1_rtl7(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32) |
||
9272 | { |
||
9273 | int i, j; |
||
9274 | |||
9275 | @@ -222,7 +298,7 @@ |
||
9276 | } |
||
9277 | |||
9278 | |||
9279 | -static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, |
||
9280 | +static void tkip_mixing_phase2_rtl7(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, |
||
9281 | u16 IV16) |
||
9282 | { |
||
9283 | /* Make temporary area overlap WEP seed so that the final copy can be |
||
9284 | @@ -268,7 +344,7 @@ |
||
9285 | #endif |
||
9286 | } |
||
9287 | |||
9288 | -static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) |
||
9289 | +static int ieee80211_tkip_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv) |
||
9290 | { |
||
9291 | struct ieee80211_tkip_data *tkey = priv; |
||
9292 | int len; |
||
9293 | @@ -276,6 +352,9 @@ |
||
9294 | struct ieee80211_hdr *hdr; |
||
9295 | u32 crc; |
||
9296 | struct scatterlist sg; |
||
9297 | +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)) |
||
9298 | + struct blkcipher_desc desc = { .tfm = tkey->tx_tfm_arc4 }; |
||
9299 | +#endif |
||
9300 | |||
9301 | if (skb_headroom(skb) < 8 || skb_tailroom(skb) < 4 || |
||
9302 | skb->len < hdr_len) |
||
9303 | @@ -283,11 +362,11 @@ |
||
9304 | |||
9305 | hdr = (struct ieee80211_hdr *) skb->data; |
||
9306 | if (!tkey->tx_phase1_done) { |
||
9307 | - tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2, |
||
9308 | + tkip_mixing_phase1_rtl7(tkey->tx_ttak, tkey->key, hdr->addr2, |
||
9309 | tkey->tx_iv32); |
||
9310 | tkey->tx_phase1_done = 1; |
||
9311 | } |
||
9312 | - tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16); |
||
9313 | + tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16); |
||
9314 | |||
9315 | len = skb->len - hdr_len; |
||
9316 | pos = skb_push(skb, 8); |
||
9317 | @@ -310,11 +389,23 @@ |
||
9318 | icv[2] = crc >> 16; |
||
9319 | icv[3] = crc >> 24; |
||
9320 | |||
9321 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) |
||
9322 | crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16); |
||
9323 | +#else |
||
9324 | + crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16); |
||
9325 | +#endif |
||
9326 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) |
||
9327 | sg.page = virt_to_page(pos); |
||
9328 | sg.offset = offset_in_page(pos); |
||
9329 | sg.length = len + 4; |
||
9330 | +#else |
||
9331 | + sg_set_page(&sg, virt_to_page(pos), len + 2, offset_in_page(pos)); |
||
9332 | +#endif |
||
9333 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) |
||
9334 | crypto_cipher_encrypt(tkey->tfm_arc4, &sg, &sg, len + 4); |
||
9335 | +#else |
||
9336 | + crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); |
||
9337 | +#endif |
||
9338 | |||
9339 | tkey->tx_iv16++; |
||
9340 | if (tkey->tx_iv16 == 0) { |
||
9341 | @@ -325,7 +416,7 @@ |
||
9342 | return 0; |
||
9343 | } |
||
9344 | |||
9345 | -static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) |
||
9346 | +static int ieee80211_tkip_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv) |
||
9347 | { |
||
9348 | struct ieee80211_tkip_data *tkey = priv; |
||
9349 | u8 rc4key[16]; |
||
9350 | @@ -337,6 +428,9 @@ |
||
9351 | u32 crc; |
||
9352 | struct scatterlist sg; |
||
9353 | int plen; |
||
9354 | +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)) |
||
9355 | + struct blkcipher_desc desc = { .tfm = tkey->rx_tfm_arc4 }; |
||
9356 | +#endif |
||
9357 | |||
9358 | if (skb->len < hdr_len + 8 + 4) |
||
9359 | return -1; |
||
9360 | @@ -382,18 +476,30 @@ |
||
9361 | } |
||
9362 | |||
9363 | if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) { |
||
9364 | - tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32); |
||
9365 | + tkip_mixing_phase1_rtl7(tkey->rx_ttak, tkey->key, hdr->addr2, iv32); |
||
9366 | tkey->rx_phase1_done = 1; |
||
9367 | } |
||
9368 | - tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16); |
||
9369 | + tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->rx_ttak, iv16); |
||
9370 | |||
9371 | plen = skb->len - hdr_len - 12; |
||
9372 | |||
9373 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) |
||
9374 | crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16); |
||
9375 | +#else |
||
9376 | + crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); |
||
9377 | +#endif |
||
9378 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) |
||
9379 | sg.page = virt_to_page(pos); |
||
9380 | sg.offset = offset_in_page(pos); |
||
9381 | sg.length = plen + 4; |
||
9382 | +#else |
||
9383 | + sg_set_page(&sg, virt_to_page(pos), plen + 4, offset_in_page(pos)); |
||
9384 | +#endif |
||
9385 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) |
||
9386 | crypto_cipher_decrypt(tkey->tfm_arc4, &sg, &sg, plen + 4); |
||
9387 | +#else |
||
9388 | + crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4); |
||
9389 | +#endif |
||
9390 | |||
9391 | crc = ~crc32_le(~0, pos, plen); |
||
9392 | icv[0] = crc; |
||
9393 | @@ -427,33 +533,59 @@ |
||
9394 | return keyidx; |
||
9395 | } |
||
9396 | |||
9397 | - |
||
9398 | -static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr, |
||
9399 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) |
||
9400 | +static int michael_mic_rtl7(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr, |
||
9401 | u8 *data, size_t data_len, u8 *mic) |
||
9402 | { |
||
9403 | struct scatterlist sg[2]; |
||
9404 | |||
9405 | if (tkey->tfm_michael == NULL) { |
||
9406 | +#else |
||
9407 | +static int michael_mic_rtl7(struct crypto_hash *tfm_michael, u8 *key, u8 *hdr, |
||
9408 | + u8 *data, size_t data_len, u8 *mic) |
||
9409 | +{ |
||
9410 | + struct hash_desc desc; |
||
9411 | + struct scatterlist sg[2]; |
||
9412 | + |
||
9413 | + if (tfm_michael == NULL) { |
||
9414 | +#endif |
||
9415 | printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n"); |
||
9416 | return -1; |
||
9417 | } |
||
9418 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) |
||
9419 | sg[0].page = virt_to_page(hdr); |
||
9420 | sg[0].offset = offset_in_page(hdr); |
||
9421 | sg[0].length = 16; |
||
9422 | +#else |
||
9423 | + sg_set_page(&sg[0], virt_to_page(hdr), 16, offset_in_page(hdr)); |
||
9424 | +#endif |
||
9425 | |||
9426 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) |
||
9427 | sg[1].page = virt_to_page(data); |
||
9428 | sg[1].offset = offset_in_page(data); |
||
9429 | sg[1].length = data_len; |
||
9430 | +#else |
||
9431 | + sg_set_page(&sg[1], virt_to_page(data), data_len, offset_in_page(data)); |
||
9432 | +#endif |
||
9433 | |||
9434 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) |
||
9435 | crypto_digest_init(tkey->tfm_michael); |
||
9436 | crypto_digest_setkey(tkey->tfm_michael, key, 8); |
||
9437 | crypto_digest_update(tkey->tfm_michael, sg, 2); |
||
9438 | crypto_digest_final(tkey->tfm_michael, mic); |
||
9439 | |||
9440 | return 0; |
||
9441 | +#else |
||
9442 | + if (crypto_hash_setkey(tfm_michael, key, 8)) |
||
9443 | + return -1; |
||
9444 | + |
||
9445 | + desc.tfm = tfm_michael; |
||
9446 | + desc.flags = 0; |
||
9447 | + return crypto_hash_digest(&desc, sg, data_len + 16, mic); |
||
9448 | +#endif |
||
9449 | } |
||
9450 | |||
9451 | -static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr) |
||
9452 | +static void michael_mic_hdr_rtl7(struct sk_buff *skb, u8 *hdr) |
||
9453 | { |
||
9454 | struct ieee80211_hdr *hdr11; |
||
9455 | |||
9456 | @@ -483,7 +615,7 @@ |
||
9457 | } |
||
9458 | |||
9459 | |||
9460 | -static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv) |
||
9461 | +static int ieee80211_michael_mic_add_rtl7(struct sk_buff *skb, int hdr_len, void *priv) |
||
9462 | { |
||
9463 | struct ieee80211_tkip_data *tkey = priv; |
||
9464 | u8 *pos; |
||
9465 | @@ -495,18 +627,24 @@ |
||
9466 | return -1; |
||
9467 | } |
||
9468 | |||
9469 | - michael_mic_hdr(skb, tkey->tx_hdr); |
||
9470 | + michael_mic_hdr_rtl7(skb, tkey->tx_hdr); |
||
9471 | pos = skb_put(skb, 8); |
||
9472 | - if (michael_mic(tkey, &tkey->key[16], tkey->tx_hdr, |
||
9473 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) |
||
9474 | + if (michael_mic_rtl7(tkey, &tkey->key[16], tkey->tx_hdr, |
||
9475 | + skb->data + hdr_len, skb->len - 8 - hdr_len, pos)) |
||
9476 | + return -1; |
||
9477 | +#else |
||
9478 | + if (michael_mic_rtl7(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr, |
||
9479 | skb->data + hdr_len, skb->len - 8 - hdr_len, pos)) |
||
9480 | return -1; |
||
9481 | +#endif |
||
9482 | |||
9483 | return 0; |
||
9484 | } |
||
9485 | |||
9486 | |||
9487 | #if WIRELESS_EXT >= 18 |
||
9488 | -static void ieee80211_michael_mic_failure(struct net_device *dev, |
||
9489 | +static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev, |
||
9490 | struct ieee80211_hdr *hdr, |
||
9491 | int keyidx) |
||
9492 | { |
||
9493 | @@ -527,7 +665,7 @@ |
||
9494 | wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev); |
||
9495 | } |
||
9496 | #elif WIRELESS_EXT >= 15 |
||
9497 | -static void ieee80211_michael_mic_failure(struct net_device *dev, |
||
9498 | +static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev, |
||
9499 | struct ieee80211_hdr *hdr, |
||
9500 | int keyidx) |
||
9501 | { |
||
9502 | @@ -543,7 +681,7 @@ |
||
9503 | wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf); |
||
9504 | } |
||
9505 | #else /* WIRELESS_EXT >= 15 */ |
||
9506 | -static inline void ieee80211_michael_mic_failure(struct net_device *dev, |
||
9507 | +static inline void ieee80211_michael_mic_failure_rtl7(struct net_device *dev, |
||
9508 | struct ieee80211_hdr *hdr, |
||
9509 | int keyidx) |
||
9510 | { |
||
9511 | @@ -551,7 +689,7 @@ |
||
9512 | #endif /* WIRELESS_EXT >= 15 */ |
||
9513 | |||
9514 | |||
9515 | -static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, |
||
9516 | +static int ieee80211_michael_mic_verify_rtl7(struct sk_buff *skb, int keyidx, |
||
9517 | int hdr_len, void *priv) |
||
9518 | { |
||
9519 | struct ieee80211_tkip_data *tkey = priv; |
||
9520 | @@ -560,10 +698,16 @@ |
||
9521 | if (!tkey->key_set) |
||
9522 | return -1; |
||
9523 | |||
9524 | - michael_mic_hdr(skb, tkey->rx_hdr); |
||
9525 | - if (michael_mic(tkey, &tkey->key[24], tkey->rx_hdr, |
||
9526 | + michael_mic_hdr_rtl7(skb, tkey->rx_hdr); |
||
9527 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) |
||
9528 | + if (michael_mic_rtl7(tkey, &tkey->key[24], tkey->rx_hdr, |
||
9529 | + skb->data + hdr_len, skb->len - 8 - hdr_len, mic)) |
||
9530 | + return -1; |
||
9531 | +#else |
||
9532 | + if (michael_mic_rtl7(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr, |
||
9533 | skb->data + hdr_len, skb->len - 8 - hdr_len, mic)) |
||
9534 | return -1; |
||
9535 | +#endif |
||
9536 | if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) { |
||
9537 | struct ieee80211_hdr *hdr; |
||
9538 | hdr = (struct ieee80211_hdr *) skb->data; |
||
9539 | @@ -572,7 +716,7 @@ |
||
9540 | skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2), |
||
9541 | keyidx); |
||
9542 | if (skb->dev) |
||
9543 | - ieee80211_michael_mic_failure(skb->dev, hdr, keyidx); |
||
9544 | + ieee80211_michael_mic_failure_rtl7(skb->dev, hdr, keyidx); |
||
9545 | tkey->dot11RSNAStatsTKIPLocalMICFailures++; |
||
9546 | return -1; |
||
9547 | } |
||
9548 | @@ -588,18 +732,33 @@ |
||
9549 | } |
||
9550 | |||
9551 | |||
9552 | -static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv) |
||
9553 | +static int ieee80211_tkip_set_key_rtl7(void *key, int len, u8 *seq, void *priv) |
||
9554 | { |
||
9555 | struct ieee80211_tkip_data *tkey = priv; |
||
9556 | int keyidx; |
||
9557 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) |
||
9558 | struct crypto_tfm *tfm = tkey->tfm_michael; |
||
9559 | struct crypto_tfm *tfm2 = tkey->tfm_arc4; |
||
9560 | +#else |
||
9561 | + struct crypto_hash *tfm = tkey->tx_tfm_michael; |
||
9562 | + struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4; |
||
9563 | + struct crypto_hash *tfm3 = tkey->rx_tfm_michael; |
||
9564 | + struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4; |
||
9565 | +#endif |
||
9566 | |||
9567 | keyidx = tkey->key_idx; |
||
9568 | memset(tkey, 0, sizeof(*tkey)); |
||
9569 | tkey->key_idx = keyidx; |
||
9570 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) |
||
9571 | tkey->tfm_michael = tfm; |
||
9572 | tkey->tfm_arc4 = tfm2; |
||
9573 | +#else |
||
9574 | + tkey->tx_tfm_michael = tfm; |
||
9575 | + tkey->tx_tfm_arc4 = tfm2; |
||
9576 | + tkey->rx_tfm_michael = tfm3; |
||
9577 | + tkey->rx_tfm_arc4 = tfm4; |
||
9578 | +#endif |
||
9579 | + |
||
9580 | if (len == TKIP_KEY_LEN) { |
||
9581 | memcpy(tkey->key, key, TKIP_KEY_LEN); |
||
9582 | tkey->key_set = 1; |
||
9583 | @@ -618,7 +777,7 @@ |
||
9584 | } |
||
9585 | |||
9586 | |||
9587 | -static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv) |
||
9588 | +static int ieee80211_tkip_get_key_rtl7(void *key, int len, u8 *seq, void *priv) |
||
9589 | { |
||
9590 | struct ieee80211_tkip_data *tkey = priv; |
||
9591 | |||
9592 | @@ -648,7 +807,7 @@ |
||
9593 | } |
||
9594 | |||
9595 | |||
9596 | -static char * ieee80211_tkip_print_stats(char *p, void *priv) |
||
9597 | +static char * ieee80211_tkip_print_stats_rtl7(char *p, void *priv) |
||
9598 | { |
||
9599 | struct ieee80211_tkip_data *tkip = priv; |
||
9600 | p += sprintf(p, "key[%d] alg=TKIP key_set=%d " |
||
9601 | @@ -675,34 +834,34 @@ |
||
9602 | } |
||
9603 | |||
9604 | |||
9605 | -static struct ieee80211_crypto_ops ieee80211_crypt_tkip = { |
||
9606 | +static struct ieee80211_crypto_ops ieee80211_crypt_tkip_rtl7 = { |
||
9607 | .name = "TKIP", |
||
9608 | - .init = ieee80211_tkip_init, |
||
9609 | - .deinit = ieee80211_tkip_deinit, |
||
9610 | - .encrypt_mpdu = ieee80211_tkip_encrypt, |
||
9611 | - .decrypt_mpdu = ieee80211_tkip_decrypt, |
||
9612 | - .encrypt_msdu = ieee80211_michael_mic_add, |
||
9613 | - .decrypt_msdu = ieee80211_michael_mic_verify, |
||
9614 | - .set_key = ieee80211_tkip_set_key, |
||
9615 | - .get_key = ieee80211_tkip_get_key, |
||
9616 | - .print_stats = ieee80211_tkip_print_stats, |
||
9617 | + .init = ieee80211_tkip_init_rtl7, |
||
9618 | + .deinit = ieee80211_tkip_deinit_rtl7, |
||
9619 | + .encrypt_mpdu = ieee80211_tkip_encrypt_rtl7, |
||
9620 | + .decrypt_mpdu = ieee80211_tkip_decrypt_rtl7, |
||
9621 | + .encrypt_msdu = ieee80211_michael_mic_add_rtl7, |
||
9622 | + .decrypt_msdu = ieee80211_michael_mic_verify_rtl7, |
||
9623 | + .set_key = ieee80211_tkip_set_key_rtl7, |
||
9624 | + .get_key = ieee80211_tkip_get_key_rtl7, |
||
9625 | + .print_stats = ieee80211_tkip_print_stats_rtl7, |
||
9626 | .extra_prefix_len = 4 + 4, /* IV + ExtIV */ |
||
9627 | .extra_postfix_len = 8 + 4, /* MIC + ICV */ |
||
9628 | .owner = THIS_MODULE, |
||
9629 | }; |
||
9630 | |||
9631 | |||
9632 | -static int __init ieee80211_crypto_tkip_init(void) |
||
9633 | +static int __init ieee80211_crypto_tkip_init_rtl7(void) |
||
9634 | { |
||
9635 | - return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip); |
||
9636 | + return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7); |
||
9637 | } |
||
9638 | |||
9639 | |||
9640 | -static void __exit ieee80211_crypto_tkip_exit(void) |
||
9641 | +static void __exit ieee80211_crypto_tkip_exit_rtl7(void) |
||
9642 | { |
||
9643 | - ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip); |
||
9644 | + ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7); |
||
9645 | } |
||
9646 | |||
9647 | |||
9648 | -module_init(ieee80211_crypto_tkip_init); |
||
9649 | -module_exit(ieee80211_crypto_tkip_exit); |
||
9650 | +module_init(ieee80211_crypto_tkip_init_rtl7); |
||
9651 | +module_exit(ieee80211_crypto_tkip_exit_rtl7); |
||
9652 | 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 |
||
9653 | --- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_wep.c 2006-06-06 04:57:54.000000000 +0200 |
||
9654 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_wep.c 2008-01-30 17:39:05.000000000 +0100 |
||
9655 | @@ -9,7 +9,6 @@ |
||
9656 | * more details. |
||
9657 | */ |
||
9658 | |||
9659 | -#include <linux/config.h> |
||
9660 | #include <linux/version.h> |
||
9661 | #include <linux/module.h> |
||
9662 | #include <linux/init.h> |
||
9663 | @@ -18,13 +17,24 @@ |
||
9664 | #include <linux/skbuff.h> |
||
9665 | #include <asm/string.h> |
||
9666 | |||
9667 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) |
||
9668 | +#include <linux/config.h> |
||
9669 | +#else |
||
9670 | +#include <linux/autoconf.h> |
||
9671 | +#endif |
||
9672 | + |
||
9673 | #include "ieee80211.h" |
||
9674 | |||
9675 | |||
9676 | #include <linux/crypto.h> |
||
9677 | -#include <asm/scatterlist.h> |
||
9678 | #include <linux/crc32.h> |
||
9679 | |||
9680 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) |
||
9681 | + #include <asm/scatterlist.h> |
||
9682 | +#else |
||
9683 | + #include <linux/scatterlist.h> |
||
9684 | +#endif |
||
9685 | + |
||
9686 | MODULE_AUTHOR("Jouni Malinen"); |
||
9687 | MODULE_DESCRIPTION("Host AP crypt: WEP"); |
||
9688 | MODULE_LICENSE("GPL"); |
||
9689 | @@ -36,11 +46,16 @@ |
||
9690 | u8 key[WEP_KEY_LEN + 1]; |
||
9691 | u8 key_len; |
||
9692 | u8 key_idx; |
||
9693 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) |
||
9694 | struct crypto_tfm *tfm; |
||
9695 | +#else |
||
9696 | + struct crypto_blkcipher *rx_tfm; |
||
9697 | + struct crypto_blkcipher *tx_tfm; |
||
9698 | +#endif |
||
9699 | }; |
||
9700 | |||
9701 | |||
9702 | -static void * prism2_wep_init(int keyidx) |
||
9703 | +static void * prism2_wep_init_rtl7(int keyidx) |
||
9704 | { |
||
9705 | struct prism2_wep_data *priv; |
||
9706 | |||
9707 | @@ -50,13 +65,30 @@ |
||
9708 | memset(priv, 0, sizeof(*priv)); |
||
9709 | priv->key_idx = keyidx; |
||
9710 | |||
9711 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) |
||
9712 | priv->tfm = crypto_alloc_tfm("arc4", 0); |
||
9713 | if (priv->tfm == NULL) { |
||
9714 | printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " |
||
9715 | "crypto API arc4\n"); |
||
9716 | goto fail; |
||
9717 | } |
||
9718 | +#else |
||
9719 | + priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); |
||
9720 | + if (IS_ERR(priv->tx_tfm)) { |
||
9721 | + printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " |
||
9722 | + "crypto API arc4\n"); |
||
9723 | + priv->tx_tfm = NULL; |
||
9724 | + goto fail; |
||
9725 | + } |
||
9726 | |||
9727 | + priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); |
||
9728 | + if (IS_ERR(priv->rx_tfm)) { |
||
9729 | + printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " |
||
9730 | + "crypto API arc4\n"); |
||
9731 | + priv->rx_tfm = NULL; |
||
9732 | + goto fail; |
||
9733 | + } |
||
9734 | +#endif |
||
9735 | /* start WEP IV from a random value */ |
||
9736 | get_random_bytes(&priv->iv, 4); |
||
9737 | |||
9738 | @@ -64,19 +96,35 @@ |
||
9739 | |||
9740 | fail: |
||
9741 | if (priv) { |
||
9742 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) |
||
9743 | if (priv->tfm) |
||
9744 | crypto_free_tfm(priv->tfm); |
||
9745 | +#else |
||
9746 | + if (priv->tx_tfm) |
||
9747 | + crypto_free_blkcipher(priv->tx_tfm); |
||
9748 | + if (priv->rx_tfm) |
||
9749 | + crypto_free_blkcipher(priv->rx_tfm); |
||
9750 | +#endif |
||
9751 | kfree(priv); |
||
9752 | } |
||
9753 | return NULL; |
||
9754 | } |
||
9755 | |||
9756 | |||
9757 | -static void prism2_wep_deinit(void *priv) |
||
9758 | +static void prism2_wep_deinit_rtl7(void *priv) |
||
9759 | { |
||
9760 | struct prism2_wep_data *_priv = priv; |
||
9761 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) |
||
9762 | if (_priv && _priv->tfm) |
||
9763 | crypto_free_tfm(_priv->tfm); |
||
9764 | +#else |
||
9765 | + if (_priv) { |
||
9766 | + if (_priv->tx_tfm) |
||
9767 | + crypto_free_blkcipher(_priv->tx_tfm); |
||
9768 | + if (_priv->rx_tfm) |
||
9769 | + crypto_free_blkcipher(_priv->rx_tfm); |
||
9770 | + } |
||
9771 | +#endif |
||
9772 | kfree(priv); |
||
9773 | } |
||
9774 | |||
9775 | @@ -87,13 +135,16 @@ |
||
9776 | * |
||
9777 | * WEP frame payload: IV + TX key idx, RC4(data), ICV = RC4(CRC32(data)) |
||
9778 | */ |
||
9779 | -static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) |
||
9780 | +static int prism2_wep_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv) |
||
9781 | { |
||
9782 | struct prism2_wep_data *wep = priv; |
||
9783 | u32 crc, klen, len; |
||
9784 | u8 key[WEP_KEY_LEN + 3]; |
||
9785 | u8 *pos, *icv; |
||
9786 | struct scatterlist sg; |
||
9787 | +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)) |
||
9788 | + struct blkcipher_desc desc = { .tfm = wep->tx_tfm }; |
||
9789 | +#endif |
||
9790 | |||
9791 | if (skb_headroom(skb) < 4 || skb_tailroom(skb) < 4 || |
||
9792 | skb->len < hdr_len) |
||
9793 | @@ -134,13 +185,25 @@ |
||
9794 | icv[2] = crc >> 16; |
||
9795 | icv[3] = crc >> 24; |
||
9796 | |||
9797 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) |
||
9798 | crypto_cipher_setkey(wep->tfm, key, klen); |
||
9799 | +#else |
||
9800 | + crypto_blkcipher_setkey(wep->tx_tfm, key, klen); |
||
9801 | +#endif |
||
9802 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) |
||
9803 | sg.page = virt_to_page(pos); |
||
9804 | sg.offset = offset_in_page(pos); |
||
9805 | sg.length = len + 4; |
||
9806 | - crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4); |
||
9807 | +#else |
||
9808 | + sg_set_page(&sg, virt_to_page(pos), len + 4, offset_in_page(pos)); |
||
9809 | +#endif |
||
9810 | |||
9811 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) |
||
9812 | + crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4); |
||
9813 | return 0; |
||
9814 | +#else |
||
9815 | + return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); |
||
9816 | +#endif |
||
9817 | } |
||
9818 | |||
9819 | |||
9820 | @@ -151,13 +214,16 @@ |
||
9821 | * Returns 0 if frame was decrypted successfully and ICV was correct and -1 on |
||
9822 | * failure. If frame is OK, IV and ICV will be removed. |
||
9823 | */ |
||
9824 | -static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) |
||
9825 | +static int prism2_wep_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv) |
||
9826 | { |
||
9827 | struct prism2_wep_data *wep = priv; |
||
9828 | u32 crc, klen, plen; |
||
9829 | u8 key[WEP_KEY_LEN + 3]; |
||
9830 | u8 keyidx, *pos, icv[4]; |
||
9831 | struct scatterlist sg; |
||
9832 | +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)) |
||
9833 | + struct blkcipher_desc desc = { .tfm = wep->rx_tfm }; |
||
9834 | +#endif |
||
9835 | |||
9836 | if (skb->len < hdr_len + 8) |
||
9837 | return -1; |
||
9838 | @@ -178,11 +244,26 @@ |
||
9839 | /* Apply RC4 to data and compute CRC32 over decrypted data */ |
||
9840 | plen = skb->len - hdr_len - 8; |
||
9841 | |||
9842 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) |
||
9843 | crypto_cipher_setkey(wep->tfm, key, klen); |
||
9844 | +#else |
||
9845 | + crypto_blkcipher_setkey(wep->rx_tfm, key, klen); |
||
9846 | +#endif |
||
9847 | + |
||
9848 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) |
||
9849 | sg.page = virt_to_page(pos); |
||
9850 | sg.offset = offset_in_page(pos); |
||
9851 | sg.length = plen + 4; |
||
9852 | +#else |
||
9853 | + sg_set_page(&sg, virt_to_page(pos), plen + 4, offset_in_page(pos)); |
||
9854 | +#endif |
||
9855 | + |
||
9856 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) |
||
9857 | crypto_cipher_decrypt(wep->tfm, &sg, &sg, plen + 4); |
||
9858 | +#else |
||
9859 | + if(crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) |
||
9860 | + return -7; |
||
9861 | +#endif |
||
9862 | |||
9863 | crc = ~crc32_le(~0, pos, plen); |
||
9864 | icv[0] = crc; |
||
9865 | @@ -203,7 +284,7 @@ |
||
9866 | } |
||
9867 | |||
9868 | |||
9869 | -static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv) |
||
9870 | +static int prism2_wep_set_key_rtl7(void *key, int len, u8 *seq, void *priv) |
||
9871 | { |
||
9872 | struct prism2_wep_data *wep = priv; |
||
9873 | |||
9874 | @@ -217,7 +298,7 @@ |
||
9875 | } |
||
9876 | |||
9877 | |||
9878 | -static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv) |
||
9879 | +static int prism2_wep_get_key_rtl7(void *key, int len, u8 *seq, void *priv) |
||
9880 | { |
||
9881 | struct prism2_wep_data *wep = priv; |
||
9882 | |||
9883 | @@ -230,7 +311,7 @@ |
||
9884 | } |
||
9885 | |||
9886 | |||
9887 | -static char * prism2_wep_print_stats(char *p, void *priv) |
||
9888 | +static char * prism2_wep_print_stats_rtl7(char *p, void *priv) |
||
9889 | { |
||
9890 | struct prism2_wep_data *wep = priv; |
||
9891 | p += sprintf(p, "key[%d] alg=WEP len=%d\n", |
||
9892 | @@ -239,34 +320,34 @@ |
||
9893 | } |
||
9894 | |||
9895 | |||
9896 | -static struct ieee80211_crypto_ops ieee80211_crypt_wep = { |
||
9897 | +static struct ieee80211_crypto_ops ieee80211_crypt_wep_rtl7 = { |
||
9898 | .name = "WEP", |
||
9899 | - .init = prism2_wep_init, |
||
9900 | - .deinit = prism2_wep_deinit, |
||
9901 | - .encrypt_mpdu = prism2_wep_encrypt, |
||
9902 | - .decrypt_mpdu = prism2_wep_decrypt, |
||
9903 | + .init = prism2_wep_init_rtl7, |
||
9904 | + .deinit = prism2_wep_deinit_rtl7, |
||
9905 | + .encrypt_mpdu = prism2_wep_encrypt_rtl7, |
||
9906 | + .decrypt_mpdu = prism2_wep_decrypt_rtl7, |
||
9907 | .encrypt_msdu = NULL, |
||
9908 | .decrypt_msdu = NULL, |
||
9909 | - .set_key = prism2_wep_set_key, |
||
9910 | - .get_key = prism2_wep_get_key, |
||
9911 | - .print_stats = prism2_wep_print_stats, |
||
9912 | + .set_key = prism2_wep_set_key_rtl7, |
||
9913 | + .get_key = prism2_wep_get_key_rtl7, |
||
9914 | + .print_stats = prism2_wep_print_stats_rtl7, |
||
9915 | .extra_prefix_len = 4, /* IV */ |
||
9916 | .extra_postfix_len = 4, /* ICV */ |
||
9917 | .owner = THIS_MODULE, |
||
9918 | }; |
||
9919 | |||
9920 | |||
9921 | -static int __init ieee80211_crypto_wep_init(void) |
||
9922 | +static int __init ieee80211_crypto_wep_init_rtl7(void) |
||
9923 | { |
||
9924 | - return ieee80211_register_crypto_ops(&ieee80211_crypt_wep); |
||
9925 | + return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7); |
||
9926 | } |
||
9927 | |||
9928 | |||
9929 | -static void __exit ieee80211_crypto_wep_exit(void) |
||
9930 | +static void __exit ieee80211_crypto_wep_exit_rtl7(void) |
||
9931 | { |
||
9932 | - ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep); |
||
9933 | + ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7); |
||
9934 | } |
||
9935 | |||
9936 | |||
9937 | -module_init(ieee80211_crypto_wep_init); |
||
9938 | -module_exit(ieee80211_crypto_wep_exit); |
||
9939 | +module_init(ieee80211_crypto_wep_init_rtl7); |
||
9940 | +module_exit(ieee80211_crypto_wep_exit_rtl7); |
||
9941 | diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211.h rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211.h |
||
9942 | --- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211.h 2006-06-06 04:57:56.000000000 +0200 |
||
9943 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211.h 2008-01-30 17:38:11.000000000 +0100 |
||
9944 | @@ -120,7 +120,7 @@ |
||
9945 | static inline unsigned long msleep_interruptible_rtl(unsigned int msecs) |
||
9946 | { |
||
9947 | unsigned long timeout = MSECS(msecs) + 1; |
||
9948 | - |
||
9949 | + |
||
9950 | while (timeout) { |
||
9951 | set_current_state(TASK_UNINTERRUPTIBLE); |
||
9952 | timeout = schedule_timeout(timeout); |
||
9953 | @@ -156,6 +156,22 @@ |
||
9954 | struct list_head list; |
||
9955 | }; |
||
9956 | |||
9957 | +#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */ |
||
9958 | +/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header |
||
9959 | + * (from linux-wlan-ng) */ |
||
9960 | +struct linux_wlan_ng_val { |
||
9961 | + u32 did; |
||
9962 | + u16 status, len; |
||
9963 | + u32 data; |
||
9964 | +} __attribute__ ((packed)); |
||
9965 | + |
||
9966 | +struct linux_wlan_ng_prism_hdr { |
||
9967 | + u32 msgcode, msglen; |
||
9968 | + char devname[16]; |
||
9969 | + struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal, |
||
9970 | + noise, rate, istx, frmlen; |
||
9971 | +} __attribute__ ((packed)); |
||
9972 | + |
||
9973 | struct ieee80211_hdr { |
||
9974 | u16 frame_ctl; |
||
9975 | u16 duration_id; |
||
9976 | @@ -798,7 +814,7 @@ |
||
9977 | |||
9978 | /* the card is not linked at all */ |
||
9979 | IEEE80211_NOLINK = 0, |
||
9980 | - |
||
9981 | + |
||
9982 | /* IEEE80211_ASSOCIATING* are for BSS client mode |
||
9983 | * the driver shall not perform RX filtering unless |
||
9984 | * the state is LINKED. |
||
9985 | @@ -806,31 +822,31 @@ |
||
9986 | * defaults to NOLINK for ALL the other states (including |
||
9987 | * LINKED_SCANNING) |
||
9988 | */ |
||
9989 | - |
||
9990 | + |
||
9991 | /* the association procedure will start (wq scheduling)*/ |
||
9992 | IEEE80211_ASSOCIATING, |
||
9993 | IEEE80211_ASSOCIATING_RETRY, |
||
9994 | - |
||
9995 | + |
||
9996 | /* the association procedure is sending AUTH request*/ |
||
9997 | IEEE80211_ASSOCIATING_AUTHENTICATING, |
||
9998 | - |
||
9999 | + |
||
10000 | /* the association procedure has successfully authentcated |
||
10001 | * and is sending association request |
||
10002 | */ |
||
10003 | IEEE80211_ASSOCIATING_AUTHENTICATED, |
||
10004 | - |
||
10005 | + |
||
10006 | /* the link is ok. the card associated to a BSS or linked |
||
10007 | * to a ibss cell or acting as an AP and creating the bss |
||
10008 | */ |
||
10009 | IEEE80211_LINKED, |
||
10010 | - |
||
10011 | + |
||
10012 | /* same as LINKED, but the driver shall apply RX filter |
||
10013 | * rules as we are in NO_LINK mode. As the card is still |
||
10014 | * logically linked, but it is doing a syncro site survey |
||
10015 | * then it will be back to LINKED state. |
||
10016 | */ |
||
10017 | IEEE80211_LINKED_SCANNING, |
||
10018 | - |
||
10019 | + |
||
10020 | }; |
||
10021 | |||
10022 | #define DEFAULT_MAX_SCAN_AGE (15 * HZ) |
||
10023 | @@ -840,14 +856,14 @@ |
||
10024 | |||
10025 | |||
10026 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11)) |
||
10027 | -extern inline int is_multicast_ether_addr(const u8 *addr) |
||
10028 | +extern inline int is_multicast_ether_addr_rtl7(const u8 *addr) |
||
10029 | { |
||
10030 | return ((addr[0] != 0xff) && (0x01 & addr[0])); |
||
10031 | } |
||
10032 | #endif |
||
10033 | |||
10034 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13)) |
||
10035 | -extern inline int is_broadcast_ether_addr(const u8 *addr) |
||
10036 | +extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr) |
||
10037 | { |
||
10038 | return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \ |
||
10039 | (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); |
||
10040 | @@ -870,7 +886,7 @@ |
||
10041 | struct net_device_stats stats; |
||
10042 | struct ieee80211_stats ieee_stats; |
||
10043 | struct ieee80211_softmac_stats softmac_stats; |
||
10044 | - |
||
10045 | + |
||
10046 | /* Probe / Beacon management */ |
||
10047 | struct list_head network_free_list; |
||
10048 | struct list_head network_list; |
||
10049 | @@ -881,7 +897,7 @@ |
||
10050 | int iw_mode; /* operating mode (IW_MODE_*) */ |
||
10051 | |||
10052 | spinlock_t lock; |
||
10053 | - |
||
10054 | + |
||
10055 | int tx_headroom; /* Set to size of any additional room needed at front |
||
10056 | * of allocated Tx SKBs */ |
||
10057 | u32 config; |
||
10058 | @@ -924,11 +940,11 @@ |
||
10059 | * ad-hoc is a mixture ;-). |
||
10060 | * Note that in infrastructure mode, even when not associated, |
||
10061 | * fields bssid and essid may be valid (if wpa_set and essid_set |
||
10062 | - * are true) as thy carry the value set by the user via iwconfig |
||
10063 | + * are true) as thy carry the value set by the user via iwconfig |
||
10064 | */ |
||
10065 | struct ieee80211_network current_network; |
||
10066 | |||
10067 | - |
||
10068 | + |
||
10069 | enum ieee80211_state state; |
||
10070 | |||
10071 | int short_slot; |
||
10072 | @@ -936,33 +952,33 @@ |
||
10073 | int modulation; /* CCK, OFDM */ |
||
10074 | int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */ |
||
10075 | int abg_true; /* ABG flag */ |
||
10076 | - |
||
10077 | - /* used for forcing the ibss workqueue to terminate |
||
10078 | + |
||
10079 | + /* used for forcing the ibss workqueue to terminate |
||
10080 | * without wait for the syncro scan to terminate |
||
10081 | */ |
||
10082 | - short sync_scan_hurryup; |
||
10083 | - |
||
10084 | + short sync_scan_hurryup; |
||
10085 | + |
||
10086 | /* map of allowed channels. 0 is dummy */ |
||
10087 | // FIXME: remeber to default to a basic channel plan depending of the PHY type |
||
10088 | int channel_map[MAX_CHANNEL_NUMBER+1]; |
||
10089 | - |
||
10090 | + |
||
10091 | int rate; /* current rate */ |
||
10092 | int basic_rate; |
||
10093 | //FIXME: pleace callback, see if redundant with softmac_features |
||
10094 | short active_scan; |
||
10095 | - |
||
10096 | + |
||
10097 | /* this contains flags for selectively enable softmac support */ |
||
10098 | u16 softmac_features; |
||
10099 | - |
||
10100 | + |
||
10101 | /* if the sequence control field is not filled by HW */ |
||
10102 | u16 seq_ctrl; |
||
10103 | - |
||
10104 | + |
||
10105 | /* association procedure transaction sequence number */ |
||
10106 | u16 associate_seq; |
||
10107 | - |
||
10108 | + |
||
10109 | /* AID for RTXed association responses */ |
||
10110 | u16 assoc_id; |
||
10111 | - |
||
10112 | + |
||
10113 | /* power save mode related*/ |
||
10114 | short ps; |
||
10115 | short sta_sleep; |
||
10116 | @@ -970,147 +986,153 @@ |
||
10117 | struct tasklet_struct ps_task; |
||
10118 | u32 ps_th; |
||
10119 | u32 ps_tl; |
||
10120 | - |
||
10121 | + |
||
10122 | short raw_tx; |
||
10123 | /* used if IEEE_SOFTMAC_TX_QUEUE is set */ |
||
10124 | short queue_stop; |
||
10125 | short scanning; |
||
10126 | short proto_started; |
||
10127 | - |
||
10128 | + |
||
10129 | struct semaphore wx_sem; |
||
10130 | struct semaphore scan_sem; |
||
10131 | - |
||
10132 | - spinlock_t mgmt_tx_lock; |
||
10133 | + |
||
10134 | + spinlock_t mgmt_tx_lock; |
||
10135 | spinlock_t beacon_lock; |
||
10136 | |||
10137 | short beacon_txing; |
||
10138 | |||
10139 | short wap_set; |
||
10140 | short ssid_set; |
||
10141 | - |
||
10142 | + |
||
10143 | /* for discarding duplicated packets in IBSS */ |
||
10144 | struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE]; |
||
10145 | - |
||
10146 | + |
||
10147 | /* for discarding duplicated packets in BSS */ |
||
10148 | u16 last_seq_num; |
||
10149 | u16 last_frag_num; |
||
10150 | unsigned long last_packet_time; |
||
10151 | - |
||
10152 | + |
||
10153 | /* for PS mode */ |
||
10154 | unsigned long last_rx_ps_time; |
||
10155 | - |
||
10156 | + |
||
10157 | /* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */ |
||
10158 | struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM]; |
||
10159 | int mgmt_queue_head; |
||
10160 | int mgmt_queue_tail; |
||
10161 | - |
||
10162 | - |
||
10163 | + |
||
10164 | + |
||
10165 | /* used if IEEE_SOFTMAC_TX_QUEUE is set */ |
||
10166 | struct tx_pending_t tx_pending; |
||
10167 | - |
||
10168 | + |
||
10169 | /* used if IEEE_SOFTMAC_ASSOCIATE is set */ |
||
10170 | struct timer_list associate_timer; |
||
10171 | |||
10172 | /* used if IEEE_SOFTMAC_BEACONS is set */ |
||
10173 | struct timer_list beacon_timer; |
||
10174 | - |
||
10175 | + |
||
10176 | struct work_struct associate_complete_wq; |
||
10177 | + |
||
10178 | +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) |
||
10179 | + struct delayed_work associate_retry_wq; |
||
10180 | + struct delayed_work softmac_scan_wq; |
||
10181 | +#else |
||
10182 | struct work_struct associate_retry_wq; |
||
10183 | + struct work_struct softmac_scan_wq; |
||
10184 | +#endif |
||
10185 | struct work_struct start_ibss_wq; |
||
10186 | struct work_struct associate_procedure_wq; |
||
10187 | - struct work_struct softmac_scan_wq; |
||
10188 | struct work_struct wx_sync_scan_wq; |
||
10189 | - |
||
10190 | + |
||
10191 | struct workqueue_struct *wq; |
||
10192 | /* Callback functions */ |
||
10193 | void (*set_security)(struct net_device *dev, |
||
10194 | struct ieee80211_security *sec); |
||
10195 | - |
||
10196 | + |
||
10197 | /* Used to TX data frame by using txb structs. |
||
10198 | * this is not used if in the softmac_features |
||
10199 | * is set the flag IEEE_SOFTMAC_TX_QUEUE |
||
10200 | */ |
||
10201 | int (*hard_start_xmit)(struct ieee80211_txb *txb, |
||
10202 | struct net_device *dev); |
||
10203 | - |
||
10204 | + |
||
10205 | int (*reset_port)(struct net_device *dev); |
||
10206 | |||
10207 | - /* Softmac-generated frames (mamagement) are TXed via this |
||
10208 | - * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is |
||
10209 | - * not set. As some cards may have different HW queues that |
||
10210 | + /* Softmac-generated frames (mamagement) are TXed via this |
||
10211 | + * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is |
||
10212 | + * not set. As some cards may have different HW queues that |
||
10213 | * one might want to use for data and management frames |
||
10214 | * the option to have two callbacks might be useful. |
||
10215 | * This fucntion can't sleep. |
||
10216 | */ |
||
10217 | int (*softmac_hard_start_xmit)(struct sk_buff *skb, |
||
10218 | struct net_device *dev); |
||
10219 | - |
||
10220 | + |
||
10221 | /* used instead of hard_start_xmit (not softmac_hard_start_xmit) |
||
10222 | * if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data |
||
10223 | * frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set |
||
10224 | * then also management frames are sent via this callback. |
||
10225 | * This function can't sleep. |
||
10226 | - */ |
||
10227 | + */ |
||
10228 | void (*softmac_data_hard_start_xmit)(struct sk_buff *skb, |
||
10229 | struct net_device *dev,int rate); |
||
10230 | |||
10231 | /* stops the HW queue for DATA frames. Useful to avoid |
||
10232 | * waste time to TX data frame when we are reassociating |
||
10233 | * This function can sleep. |
||
10234 | - */ |
||
10235 | + */ |
||
10236 | void (*data_hard_stop)(struct net_device *dev); |
||
10237 | - |
||
10238 | + |
||
10239 | /* OK this is complementar to data_poll_hard_stop */ |
||
10240 | void (*data_hard_resume)(struct net_device *dev); |
||
10241 | - |
||
10242 | + |
||
10243 | /* ask to the driver to retune the radio . |
||
10244 | * This function can sleep. the driver should ensure |
||
10245 | * the radio has been swithced before return. |
||
10246 | */ |
||
10247 | void (*set_chan)(struct net_device *dev,short ch); |
||
10248 | - |
||
10249 | + |
||
10250 | /* These are not used if the ieee stack takes care of |
||
10251 | - * scanning (IEEE_SOFTMAC_SCAN feature set). |
||
10252 | + * scanning (IEEE_SOFTMAC_SCAN feature set). |
||
10253 | * In this case only the set_chan is used. |
||
10254 | * |
||
10255 | * The syncro version is similar to the start_scan but |
||
10256 | * does not return until all channels has been scanned. |
||
10257 | - * this is called in user context and should sleep, |
||
10258 | + * this is called in user context and should sleep, |
||
10259 | * it is called in a work_queue when swithcing to ad-hoc mode |
||
10260 | - * or in behalf of iwlist scan when the card is associated |
||
10261 | - * and root user ask for a scan. |
||
10262 | + * or in behalf of iwlist scan when the card is associated |
||
10263 | + * and root user ask for a scan. |
||
10264 | * the fucntion stop_scan should stop both the syncro and |
||
10265 | * background scanning and can sleep. |
||
10266 | - * The fucntion start_scan should initiate the background |
||
10267 | + * The fucntion start_scan should initiate the background |
||
10268 | * scanning and can't sleep. |
||
10269 | - */ |
||
10270 | + */ |
||
10271 | void (*scan_syncro)(struct net_device *dev); |
||
10272 | void (*start_scan)(struct net_device *dev); |
||
10273 | void (*stop_scan)(struct net_device *dev); |
||
10274 | - |
||
10275 | + |
||
10276 | /* indicate the driver that the link state is changed |
||
10277 | * for example it may indicate the card is associated now. |
||
10278 | - * Driver might be interested in this to apply RX filter |
||
10279 | - * rules or simply light the LINK led |
||
10280 | + * Driver might be interested in this to apply RX filter |
||
10281 | + * rules or simply light the LINK led |
||
10282 | */ |
||
10283 | void (*link_change)(struct net_device *dev); |
||
10284 | - |
||
10285 | + |
||
10286 | /* these two function indicates to the HW when to start |
||
10287 | - * and stop to send beacons. This is used when the |
||
10288 | + * and stop to send beacons. This is used when the |
||
10289 | * IEEE_SOFTMAC_BEACONS is not set. For now the |
||
10290 | * stop_send_bacons is NOT guaranteed to be called only |
||
10291 | * after start_send_beacons. |
||
10292 | */ |
||
10293 | void (*start_send_beacons) (struct net_device *dev); |
||
10294 | void (*stop_send_beacons) (struct net_device *dev); |
||
10295 | - |
||
10296 | + |
||
10297 | /* power save mode related */ |
||
10298 | void (*sta_wake_up) (struct net_device *dev); |
||
10299 | void (*ps_request_tx_ack) (struct net_device *dev); |
||
10300 | void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl); |
||
10301 | short (*ps_is_queue_empty) (struct net_device *dev); |
||
10302 | - |
||
10303 | - |
||
10304 | + |
||
10305 | + |
||
10306 | /* This must be the last item so that it points to the data |
||
10307 | * allocated beyond this structure by alloc_ieee80211 */ |
||
10308 | u8 priv[0]; |
||
10309 | @@ -1148,18 +1170,18 @@ |
||
10310 | #define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8) |
||
10311 | |||
10312 | /* Generate beacons. The stack will enqueue beacons |
||
10313 | - * to the card |
||
10314 | - */ |
||
10315 | + * to the card |
||
10316 | + */ |
||
10317 | #define IEEE_SOFTMAC_BEACONS (1<<6) |
||
10318 | |||
10319 | |||
10320 | |||
10321 | -extern inline void *ieee80211_priv(struct net_device *dev) |
||
10322 | +extern inline void *ieee80211_priv_rtl7(struct net_device *dev) |
||
10323 | { |
||
10324 | return ((struct ieee80211_device *)netdev_priv(dev))->priv; |
||
10325 | } |
||
10326 | |||
10327 | -extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) |
||
10328 | +extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len) |
||
10329 | { |
||
10330 | /* Single white space is for Linksys APs */ |
||
10331 | if (essid_len == 1 && essid[0] == ' ') |
||
10332 | @@ -1175,7 +1197,7 @@ |
||
10333 | return 1; |
||
10334 | } |
||
10335 | |||
10336 | -extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode) |
||
10337 | +extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode) |
||
10338 | { |
||
10339 | /* |
||
10340 | * It is possible for both access points and our device to support |
||
10341 | @@ -1201,7 +1223,7 @@ |
||
10342 | return 0; |
||
10343 | } |
||
10344 | |||
10345 | -extern inline int ieee80211_get_hdrlen(u16 fc) |
||
10346 | +extern inline int ieee80211_get_hdrlen_rtl7(u16 fc) |
||
10347 | { |
||
10348 | int hdrlen = 24; |
||
10349 | |||
10350 | @@ -1229,140 +1251,144 @@ |
||
10351 | |||
10352 | |||
10353 | /* ieee80211.c */ |
||
10354 | -extern void free_ieee80211(struct net_device *dev); |
||
10355 | -extern struct net_device *alloc_ieee80211(int sizeof_priv); |
||
10356 | +extern void free_ieee80211_rtl7(struct net_device *dev); |
||
10357 | +extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv); |
||
10358 | |||
10359 | -extern int ieee80211_set_encryption(struct ieee80211_device *ieee); |
||
10360 | +extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee); |
||
10361 | |||
10362 | /* ieee80211_tx.c */ |
||
10363 | |||
10364 | -extern int ieee80211_encrypt_fragment( |
||
10365 | +extern int ieee80211_encrypt_fragment_rtl7( |
||
10366 | struct ieee80211_device *ieee, |
||
10367 | struct sk_buff *frag, |
||
10368 | int hdr_len); |
||
10369 | - |
||
10370 | -extern int ieee80211_xmit(struct sk_buff *skb, |
||
10371 | + |
||
10372 | +extern int ieee80211_xmit_rtl7(struct sk_buff *skb, |
||
10373 | struct net_device *dev); |
||
10374 | -extern void ieee80211_txb_free(struct ieee80211_txb *); |
||
10375 | +extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *); |
||
10376 | |||
10377 | |||
10378 | /* ieee80211_rx.c */ |
||
10379 | -extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, |
||
10380 | +extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, |
||
10381 | struct ieee80211_rx_stats *rx_stats); |
||
10382 | -extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, |
||
10383 | +extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee, |
||
10384 | struct ieee80211_hdr *header, |
||
10385 | struct ieee80211_rx_stats *stats); |
||
10386 | |||
10387 | /* ieee80211_wx.c */ |
||
10388 | -extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee, |
||
10389 | +extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee, |
||
10390 | struct iw_request_info *info, |
||
10391 | union iwreq_data *wrqu, char *key); |
||
10392 | -extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee, |
||
10393 | +extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee, |
||
10394 | struct iw_request_info *info, |
||
10395 | union iwreq_data *wrqu, char *key); |
||
10396 | -extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee, |
||
10397 | +extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee, |
||
10398 | struct iw_request_info *info, |
||
10399 | union iwreq_data *wrqu, char *key); |
||
10400 | /* ieee80211_softmac.c */ |
||
10401 | -extern short ieee80211_is_54g(struct ieee80211_network net); |
||
10402 | -extern short ieee80211_is_shortslot(struct ieee80211_network net); |
||
10403 | -extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, |
||
10404 | +extern short ieee80211_is_54g_rtl7(struct ieee80211_network net); |
||
10405 | +extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net); |
||
10406 | +extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, |
||
10407 | struct ieee80211_rx_stats *rx_stats, u16 type, |
||
10408 | u16 stype); |
||
10409 | -extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net); |
||
10410 | +extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net); |
||
10411 | |||
10412 | -extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee); |
||
10413 | -extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee); |
||
10414 | -extern void ieee80211_start_bss(struct ieee80211_device *ieee); |
||
10415 | -extern void ieee80211_start_master_bss(struct ieee80211_device *ieee); |
||
10416 | -extern void ieee80211_start_ibss(struct ieee80211_device *ieee); |
||
10417 | -extern void ieee80211_softmac_init(struct ieee80211_device *ieee); |
||
10418 | -extern void ieee80211_softmac_free(struct ieee80211_device *ieee); |
||
10419 | -extern void ieee80211_associate_abort(struct ieee80211_device *ieee); |
||
10420 | -extern void ieee80211_disassociate(struct ieee80211_device *ieee); |
||
10421 | -extern void ieee80211_stop_scan(struct ieee80211_device *ieee); |
||
10422 | -extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee); |
||
10423 | -extern void ieee80211_check_all_nets(struct ieee80211_device *ieee); |
||
10424 | -extern void ieee80211_start_protocol(struct ieee80211_device *ieee); |
||
10425 | -extern void ieee80211_stop_protocol(struct ieee80211_device *ieee); |
||
10426 | -extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee); |
||
10427 | -extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee); |
||
10428 | -extern void ieee80211_reset_queue(struct ieee80211_device *ieee); |
||
10429 | -extern void ieee80211_wake_queue(struct ieee80211_device *ieee); |
||
10430 | -extern void ieee80211_stop_queue(struct ieee80211_device *ieee); |
||
10431 | -extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee); |
||
10432 | -extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee); |
||
10433 | -extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee); |
||
10434 | -extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p); |
||
10435 | -extern void notify_wx_assoc_event(struct ieee80211_device *ieee); |
||
10436 | -extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success); |
||
10437 | +extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee); |
||
10438 | +extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee); |
||
10439 | +extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee); |
||
10440 | +extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee); |
||
10441 | +extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee); |
||
10442 | +extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee); |
||
10443 | +extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee); |
||
10444 | +extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee); |
||
10445 | +extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee); |
||
10446 | +extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee); |
||
10447 | +extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee); |
||
10448 | +extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee); |
||
10449 | +extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee); |
||
10450 | +extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee); |
||
10451 | +extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee); |
||
10452 | +extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee); |
||
10453 | +extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee); |
||
10454 | +extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee); |
||
10455 | +extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee); |
||
10456 | +extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee); |
||
10457 | +extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee); |
||
10458 | +extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee); |
||
10459 | +extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p); |
||
10460 | +extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee); |
||
10461 | +extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success); |
||
10462 | |||
10463 | /* ieee80211_softmac_wx.c */ |
||
10464 | |||
10465 | -extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee, |
||
10466 | - struct iw_request_info *info, |
||
10467 | +extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee, |
||
10468 | + struct iw_request_info *info, |
||
10469 | union iwreq_data *wrqu, char *ext); |
||
10470 | - |
||
10471 | -extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee, |
||
10472 | + |
||
10473 | +extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee, |
||
10474 | struct iw_request_info *info, |
||
10475 | union iwreq_data *awrq, |
||
10476 | char *extra); |
||
10477 | - |
||
10478 | -extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b); |
||
10479 | |||
10480 | -extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee, |
||
10481 | +extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b); |
||
10482 | + |
||
10483 | +extern int ieee80211_wx_set_rate_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_rate(struct ieee80211_device *ieee, |
||
10488 | - struct iw_request_info *info, |
||
10489 | + |
||
10490 | +extern int ieee80211_wx_get_rate_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_mode(struct ieee80211_device *ieee, struct iw_request_info *a, |
||
10495 | + |
||
10496 | +extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a, |
||
10497 | union iwreq_data *wrqu, char *b); |
||
10498 | - |
||
10499 | -extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a, |
||
10500 | + |
||
10501 | +extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a, |
||
10502 | union iwreq_data *wrqu, char *b); |
||
10503 | - |
||
10504 | -extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee, |
||
10505 | + |
||
10506 | +extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee, |
||
10507 | struct iw_request_info *a, |
||
10508 | union iwreq_data *wrqu, char *extra); |
||
10509 | - |
||
10510 | -extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a, |
||
10511 | + |
||
10512 | +extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a, |
||
10513 | union iwreq_data *wrqu, char *b); |
||
10514 | |||
10515 | -extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a, |
||
10516 | +extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a, |
||
10517 | union iwreq_data *wrqu, char *b); |
||
10518 | |||
10519 | -extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a, |
||
10520 | +extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a, |
||
10521 | union iwreq_data *wrqu, char *b); |
||
10522 | |||
10523 | -extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee); |
||
10524 | +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) |
||
10525 | +extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work); |
||
10526 | +#else |
||
10527 | +extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee); |
||
10528 | +#endif |
||
10529 | |||
10530 | -extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, |
||
10531 | - struct iw_request_info *info, |
||
10532 | +extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee, |
||
10533 | + struct iw_request_info *info, |
||
10534 | union iwreq_data *wrqu, char *extra); |
||
10535 | - |
||
10536 | -extern int ieee80211_wx_get_name(struct ieee80211_device *ieee, |
||
10537 | - struct iw_request_info *info, |
||
10538 | + |
||
10539 | +extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee, |
||
10540 | + struct iw_request_info *info, |
||
10541 | union iwreq_data *wrqu, char *extra); |
||
10542 | |||
10543 | -extern int ieee80211_wx_set_power(struct ieee80211_device *ieee, |
||
10544 | +extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee, |
||
10545 | struct iw_request_info *info, |
||
10546 | union iwreq_data *wrqu, char *extra); |
||
10547 | |||
10548 | -extern int ieee80211_wx_get_power(struct ieee80211_device *ieee, |
||
10549 | +extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee, |
||
10550 | struct iw_request_info *info, |
||
10551 | union iwreq_data *wrqu, char *extra); |
||
10552 | - |
||
10553 | -extern const long ieee80211_wlan_frequencies[]; |
||
10554 | |||
10555 | -extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee) |
||
10556 | +extern const long ieee80211_wlan_frequencies_rtl7[]; |
||
10557 | + |
||
10558 | +extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee) |
||
10559 | { |
||
10560 | ieee->scans++; |
||
10561 | } |
||
10562 | |||
10563 | -extern inline int ieee80211_get_scans(struct ieee80211_device *ieee) |
||
10564 | +extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee) |
||
10565 | { |
||
10566 | return ieee->scans; |
||
10567 | } |
||
10568 | @@ -1372,7 +1398,7 @@ |
||
10569 | const char *s = essid; |
||
10570 | char *d = escaped; |
||
10571 | |||
10572 | - if (ieee80211_is_empty_essid(essid, essid_len)) { |
||
10573 | + if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) { |
||
10574 | memcpy(escaped, "<hidden>", sizeof("<hidden>")); |
||
10575 | return escaped; |
||
10576 | } |
||
10577 | @@ -1390,4 +1416,5 @@ |
||
10578 | *d = '\0'; |
||
10579 | return escaped; |
||
10580 | } |
||
10581 | + |
||
10582 | #endif /* IEEE80211_H */ |
||
10583 | diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_module.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_module.c |
||
10584 | --- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_module.c 2006-06-06 04:58:00.000000000 +0200 |
||
10585 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_module.c 2008-01-30 17:38:11.000000000 +0100 |
||
10586 | @@ -31,7 +31,6 @@ |
||
10587 | *******************************************************************************/ |
||
10588 | |||
10589 | #include <linux/compiler.h> |
||
10590 | -#include <linux/config.h> |
||
10591 | #include <linux/errno.h> |
||
10592 | #include <linux/if_arp.h> |
||
10593 | #include <linux/in6.h> |
||
10594 | @@ -52,6 +51,12 @@ |
||
10595 | #include <asm/uaccess.h> |
||
10596 | #include <net/arp.h> |
||
10597 | |||
10598 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) |
||
10599 | +#include <linux/config.h> |
||
10600 | +#else |
||
10601 | +#include <linux/autoconf.h> |
||
10602 | +#endif |
||
10603 | + |
||
10604 | #include "ieee80211.h" |
||
10605 | |||
10606 | MODULE_DESCRIPTION("802.11 data/management/control stack"); |
||
10607 | @@ -60,7 +65,7 @@ |
||
10608 | |||
10609 | #define DRV_NAME "ieee80211" |
||
10610 | |||
10611 | -static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee) |
||
10612 | +static inline int ieee80211_networks_allocate_rtl7(struct ieee80211_device *ieee) |
||
10613 | { |
||
10614 | if (ieee->networks) |
||
10615 | return 0; |
||
10616 | @@ -80,7 +85,7 @@ |
||
10617 | return 0; |
||
10618 | } |
||
10619 | |||
10620 | -static inline void ieee80211_networks_free(struct ieee80211_device *ieee) |
||
10621 | +static inline void ieee80211_networks_free_rtl7(struct ieee80211_device *ieee) |
||
10622 | { |
||
10623 | if (!ieee->networks) |
||
10624 | return; |
||
10625 | @@ -88,7 +93,7 @@ |
||
10626 | ieee->networks = NULL; |
||
10627 | } |
||
10628 | |||
10629 | -static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee) |
||
10630 | +static inline void ieee80211_networks_initialize_rtl7(struct ieee80211_device *ieee) |
||
10631 | { |
||
10632 | int i; |
||
10633 | |||
10634 | @@ -99,7 +104,7 @@ |
||
10635 | } |
||
10636 | |||
10637 | |||
10638 | -struct net_device *alloc_ieee80211(int sizeof_priv) |
||
10639 | +struct net_device *alloc_ieee80211_rtl7(int sizeof_priv) |
||
10640 | { |
||
10641 | struct ieee80211_device *ieee; |
||
10642 | struct net_device *dev; |
||
10643 | @@ -113,17 +118,17 @@ |
||
10644 | goto failed; |
||
10645 | } |
||
10646 | ieee = netdev_priv(dev); |
||
10647 | - dev->hard_start_xmit = ieee80211_xmit; |
||
10648 | + dev->hard_start_xmit = ieee80211_xmit_rtl7; |
||
10649 | |||
10650 | ieee->dev = dev; |
||
10651 | |||
10652 | - err = ieee80211_networks_allocate(ieee); |
||
10653 | + err = ieee80211_networks_allocate_rtl7(ieee); |
||
10654 | if (err) { |
||
10655 | IEEE80211_ERROR("Unable to allocate beacon storage: %d\n", |
||
10656 | err); |
||
10657 | goto failed; |
||
10658 | } |
||
10659 | - ieee80211_networks_initialize(ieee); |
||
10660 | + ieee80211_networks_initialize_rtl7(ieee); |
||
10661 | |||
10662 | /* Default fragmentation threshold is maximum payload size */ |
||
10663 | ieee->fts = DEFAULT_FTS; |
||
10664 | @@ -138,7 +143,7 @@ |
||
10665 | INIT_LIST_HEAD(&ieee->crypt_deinit_list); |
||
10666 | init_timer(&ieee->crypt_deinit_timer); |
||
10667 | ieee->crypt_deinit_timer.data = (unsigned long)ieee; |
||
10668 | - ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler; |
||
10669 | + ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler_rtl7; |
||
10670 | |||
10671 | spin_lock_init(&ieee->lock); |
||
10672 | |||
10673 | @@ -149,7 +154,7 @@ |
||
10674 | ieee->ieee802_1x = 1; |
||
10675 | ieee->raw_tx = 0; |
||
10676 | |||
10677 | - ieee80211_softmac_init(ieee); |
||
10678 | + ieee80211_softmac_init_rtl7(ieee); |
||
10679 | |||
10680 | for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) |
||
10681 | INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]); |
||
10682 | @@ -167,7 +172,7 @@ |
||
10683 | } |
||
10684 | |||
10685 | |||
10686 | -void free_ieee80211(struct net_device *dev) |
||
10687 | +void free_ieee80211_rtl7(struct net_device *dev) |
||
10688 | { |
||
10689 | struct ieee80211_device *ieee = netdev_priv(dev); |
||
10690 | |||
10691 | @@ -175,9 +180,9 @@ |
||
10692 | struct list_head *p, *q; |
||
10693 | |||
10694 | |||
10695 | - ieee80211_softmac_free(ieee); |
||
10696 | + ieee80211_softmac_free_rtl7(ieee); |
||
10697 | del_timer_sync(&ieee->crypt_deinit_timer); |
||
10698 | - ieee80211_crypt_deinit_entries(ieee, 1); |
||
10699 | + ieee80211_crypt_deinit_entries_rtl7(ieee, 1); |
||
10700 | |||
10701 | for (i = 0; i < WEP_KEYS; i++) { |
||
10702 | struct ieee80211_crypt_data *crypt = ieee->crypt[i]; |
||
10703 | @@ -191,7 +196,7 @@ |
||
10704 | } |
||
10705 | } |
||
10706 | |||
10707 | - ieee80211_networks_free(ieee); |
||
10708 | + ieee80211_networks_free_rtl7(ieee); |
||
10709 | |||
10710 | for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) { |
||
10711 | list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) { |
||
10712 | @@ -210,13 +215,13 @@ |
||
10713 | u32 ieee80211_debug_level = 0; |
||
10714 | struct proc_dir_entry *ieee80211_proc = NULL; |
||
10715 | |||
10716 | -static int show_debug_level(char *page, char **start, off_t offset, |
||
10717 | +static int show_debug_level_rtl7(char *page, char **start, off_t offset, |
||
10718 | int count, int *eof, void *data) |
||
10719 | { |
||
10720 | return snprintf(page, count, "0x%08X\n", ieee80211_debug_level); |
||
10721 | } |
||
10722 | |||
10723 | -static int store_debug_level(struct file *file, const char *buffer, |
||
10724 | +static int store_debug_level_rtl7(struct file *file, const char *buffer, |
||
10725 | unsigned long count, void *data) |
||
10726 | { |
||
10727 | char buf[] = "0x00000000"; |
||
10728 | @@ -243,7 +248,7 @@ |
||
10729 | return strnlen(buf, count); |
||
10730 | } |
||
10731 | |||
10732 | -static int __init ieee80211_init(void) |
||
10733 | +static int __init ieee80211_init_rtl7(void) |
||
10734 | { |
||
10735 | struct proc_dir_entry *e; |
||
10736 | |||
10737 | @@ -268,7 +273,7 @@ |
||
10738 | return 0; |
||
10739 | } |
||
10740 | |||
10741 | -static void __exit ieee80211_exit(void) |
||
10742 | +static void __exit ieee80211_exit_rtl7(void) |
||
10743 | { |
||
10744 | if (ieee80211_proc) { |
||
10745 | remove_proc_entry("debug_level", ieee80211_proc); |
||
10746 | @@ -282,9 +287,9 @@ |
||
10747 | MODULE_PARM_DESC(debug, "debug output mask"); |
||
10748 | |||
10749 | |||
10750 | -module_exit(ieee80211_exit); |
||
10751 | -module_init(ieee80211_init); |
||
10752 | +module_exit(ieee80211_exit_rtl7); |
||
10753 | +module_init(ieee80211_init_rtl7); |
||
10754 | #endif |
||
10755 | |||
10756 | -EXPORT_SYMBOL(alloc_ieee80211); |
||
10757 | -EXPORT_SYMBOL(free_ieee80211); |
||
10758 | +EXPORT_SYMBOL(alloc_ieee80211_rtl7); |
||
10759 | +EXPORT_SYMBOL(free_ieee80211_rtl7); |
||
10760 | diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_rx.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_rx.c |
||
10761 | --- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_rx.c 2006-06-06 04:58:00.000000000 +0200 |
||
10762 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_rx.c 2008-01-30 17:38:11.000000000 +0100 |
||
10763 | @@ -13,16 +13,15 @@ |
||
10764 | * more details. |
||
10765 | ****************************************************************************** |
||
10766 | |||
10767 | - Few modifications for Realtek's Wi-Fi drivers by |
||
10768 | + Few modifications for Realtek's Wi-Fi drivers by |
||
10769 | Andrea Merello <andreamrl@tiscali.it> |
||
10770 | - |
||
10771 | - A special thanks goes to Realtek for their support ! |
||
10772 | + |
||
10773 | + A special thanks goes to Realtek for their support ! |
||
10774 | |||
10775 | ******************************************************************************/ |
||
10776 | - |
||
10777 | + |
||
10778 | |||
10779 | #include <linux/compiler.h> |
||
10780 | -#include <linux/config.h> |
||
10781 | #include <linux/errno.h> |
||
10782 | #include <linux/if_arp.h> |
||
10783 | #include <linux/in6.h> |
||
10784 | @@ -43,18 +42,89 @@ |
||
10785 | #include <asm/uaccess.h> |
||
10786 | #include <linux/ctype.h> |
||
10787 | |||
10788 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) |
||
10789 | +#include <linux/config.h> |
||
10790 | +#else |
||
10791 | +#include <linux/autoconf.h> |
||
10792 | +#endif |
||
10793 | + |
||
10794 | + |
||
10795 | #include "ieee80211.h" |
||
10796 | |||
10797 | -static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee, |
||
10798 | +static inline void ieee80211_monitor_rx_rtl7(struct ieee80211_device *ieee, |
||
10799 | struct sk_buff *skb, |
||
10800 | struct ieee80211_rx_stats *rx_stats) |
||
10801 | { |
||
10802 | - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
||
10803 | - u16 fc = le16_to_cpu(hdr->frame_ctl); |
||
10804 | + struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data; |
||
10805 | + u16 fc = le16_to_cpu(hdr1->frame_ctl); |
||
10806 | + int prism_header; |
||
10807 | + int hdrlen, phdrlen, head_need, tail_need; |
||
10808 | + |
||
10809 | + if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) { |
||
10810 | + prism_header = 1; |
||
10811 | + phdrlen = sizeof(struct linux_wlan_ng_prism_hdr); |
||
10812 | + } else { |
||
10813 | + prism_header = 0; |
||
10814 | + phdrlen = 0; |
||
10815 | + } |
||
10816 | + |
||
10817 | + hdrlen = ieee80211_get_hdrlen_rtl7(fc); |
||
10818 | + |
||
10819 | + /* check if there is enough room for extra data; if not, expand skb |
||
10820 | + * buffer to be large enough for the changes */ |
||
10821 | + head_need = phdrlen; |
||
10822 | + tail_need = 0; |
||
10823 | +#ifdef PRISM2_ADD_BOGUS_CRC |
||
10824 | + tail_need += 4; |
||
10825 | +#endif /* PRISM2_ADD_BOGUS_CRC */ |
||
10826 | + |
||
10827 | + head_need -= skb_headroom(skb); |
||
10828 | + tail_need -= skb_tailroom(skb); |
||
10829 | + |
||
10830 | + if (head_need > 0 || tail_need > 0) { |
||
10831 | + if (pskb_expand_head(skb, head_need > 0 ? head_need : 0, |
||
10832 | + tail_need > 0 ? tail_need : 0, |
||
10833 | + GFP_ATOMIC)) { |
||
10834 | + printk(KERN_DEBUG "%s: ieee80211_rx failed to " |
||
10835 | + "reallocate skb buffer\n", ieee->dev->name); |
||
10836 | + dev_kfree_skb_any(skb); |
||
10837 | + return; |
||
10838 | + } |
||
10839 | + } |
||
10840 | + |
||
10841 | + if (prism_header == 1) { |
||
10842 | + struct linux_wlan_ng_prism_hdr *hdr; |
||
10843 | + hdr = (struct linux_wlan_ng_prism_hdr *) |
||
10844 | + skb_push(skb, phdrlen); |
||
10845 | + memset(hdr, 0, phdrlen); |
||
10846 | + hdr->msgcode = LWNG_CAP_DID_BASE; |
||
10847 | + hdr->msglen = sizeof(*hdr); |
||
10848 | + memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname)); |
||
10849 | +#define LWNG_SETVAL(f,i,s,l,d) \ |
||
10850 | +hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \ |
||
10851 | +hdr->f.status = s; hdr->f.len = l; hdr->f.data = d |
||
10852 | + LWNG_SETVAL(hosttime, 1, 0, 4, jiffies); |
||
10853 | + LWNG_SETVAL(mactime, 2, 0, 4, ((u32)rx_stats->mac_time)); |
||
10854 | + LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0); |
||
10855 | + LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0); |
||
10856 | + LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0); |
||
10857 | + LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal); |
||
10858 | + LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise); |
||
10859 | + LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5); |
||
10860 | + LWNG_SETVAL(istx, 9, 0, 4, 0); |
||
10861 | + LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen); |
||
10862 | +#undef LWNG_SETVAL |
||
10863 | + } |
||
10864 | |||
10865 | skb->dev = ieee->dev; |
||
10866 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)) |
||
10867 | skb->mac.raw = skb->data; |
||
10868 | - skb_pull(skb, ieee80211_get_hdrlen(fc)); |
||
10869 | +#else |
||
10870 | + skb_reset_mac_header(skb); |
||
10871 | +#endif |
||
10872 | + skb_pull(skb, hdrlen); |
||
10873 | + if (prism_header) |
||
10874 | + skb_pull(skb, phdrlen); |
||
10875 | skb->pkt_type = PACKET_OTHERHOST; |
||
10876 | skb->protocol = __constant_htons(ETH_P_80211_RAW); |
||
10877 | memset(skb->cb, 0, sizeof(skb->cb)); |
||
10878 | @@ -64,7 +134,7 @@ |
||
10879 | |||
10880 | /* Called only as a tasklet (software IRQ) */ |
||
10881 | static struct ieee80211_frag_entry * |
||
10882 | -ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq, |
||
10883 | +ieee80211_frag_cache_find_rtl7(struct ieee80211_device *ieee, unsigned int seq, |
||
10884 | unsigned int frag, u8 *src, u8 *dst) |
||
10885 | { |
||
10886 | struct ieee80211_frag_entry *entry; |
||
10887 | @@ -94,7 +164,7 @@ |
||
10888 | |||
10889 | /* Called only as a tasklet (software IRQ) */ |
||
10890 | static struct sk_buff * |
||
10891 | -ieee80211_frag_cache_get(struct ieee80211_device *ieee, |
||
10892 | +ieee80211_frag_cache_get_rtl7(struct ieee80211_device *ieee, |
||
10893 | struct ieee80211_hdr *hdr) |
||
10894 | { |
||
10895 | struct sk_buff *skb = NULL; |
||
10896 | @@ -133,7 +203,7 @@ |
||
10897 | } else { |
||
10898 | /* received a fragment of a frame for which the head fragment |
||
10899 | * should have already been received */ |
||
10900 | - entry = ieee80211_frag_cache_find(ieee, seq, frag, hdr->addr2, |
||
10901 | + entry = ieee80211_frag_cache_find_rtl7(ieee, seq, frag, hdr->addr2, |
||
10902 | hdr->addr1); |
||
10903 | if (entry != NULL) { |
||
10904 | entry->last_frag = frag; |
||
10905 | @@ -146,7 +216,7 @@ |
||
10906 | |||
10907 | |||
10908 | /* Called only as a tasklet (software IRQ) */ |
||
10909 | -static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee, |
||
10910 | +static int ieee80211_frag_cache_invalidate_rtl7(struct ieee80211_device *ieee, |
||
10911 | struct ieee80211_hdr *hdr) |
||
10912 | { |
||
10913 | u16 sc; |
||
10914 | @@ -156,7 +226,7 @@ |
||
10915 | sc = le16_to_cpu(hdr->seq_ctl); |
||
10916 | seq = WLAN_GET_SEQ_SEQ(sc); |
||
10917 | |||
10918 | - entry = ieee80211_frag_cache_find(ieee, seq, -1, hdr->addr2, |
||
10919 | + entry = ieee80211_frag_cache_find_rtl7(ieee, seq, -1, hdr->addr2, |
||
10920 | hdr->addr1); |
||
10921 | |||
10922 | if (entry == NULL) { |
||
10923 | @@ -178,7 +248,7 @@ |
||
10924 | * |
||
10925 | * Called by ieee80211_rx */ |
||
10926 | static inline int |
||
10927 | -ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb, |
||
10928 | +ieee80211_rx_frame_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, |
||
10929 | struct ieee80211_rx_stats *rx_stats, u16 type, |
||
10930 | u16 stype) |
||
10931 | { |
||
10932 | @@ -187,13 +257,13 @@ |
||
10933 | * response parser uses it |
||
10934 | */ |
||
10935 | rx_stats->len = skb->len; |
||
10936 | - ieee80211_rx_mgt(ieee,(struct ieee80211_hdr *)skb->data,rx_stats); |
||
10937 | - ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype); |
||
10938 | + ieee80211_rx_mgt_rtl7(ieee,(struct ieee80211_hdr *)skb->data,rx_stats); |
||
10939 | + ieee80211_rx_frame_softmac_rtl7(ieee, skb, rx_stats, type, stype); |
||
10940 | |||
10941 | dev_kfree_skb_any(skb); |
||
10942 | - |
||
10943 | + |
||
10944 | return 0; |
||
10945 | - |
||
10946 | + |
||
10947 | #ifdef NOT_YET |
||
10948 | if (ieee->iw_mode == IW_MODE_MASTER) { |
||
10949 | printk(KERN_DEBUG "%s: Master mode not yet suppported.\n", |
||
10950 | @@ -253,7 +323,7 @@ |
||
10951 | /* No encapsulation header if EtherType < 0x600 (=length) */ |
||
10952 | |||
10953 | /* Called by ieee80211_rx_frame_decrypt */ |
||
10954 | -static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee, |
||
10955 | +static int ieee80211_is_eapol_frame_rtl7(struct ieee80211_device *ieee, |
||
10956 | struct sk_buff *skb) |
||
10957 | { |
||
10958 | struct net_device *dev = ieee->dev; |
||
10959 | @@ -294,7 +364,7 @@ |
||
10960 | |||
10961 | /* Called only as a tasklet (software IRQ), by ieee80211_rx */ |
||
10962 | static inline int |
||
10963 | -ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb, |
||
10964 | +ieee80211_rx_frame_decrypt_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb, |
||
10965 | struct ieee80211_crypt_data *crypt) |
||
10966 | { |
||
10967 | struct ieee80211_hdr *hdr; |
||
10968 | @@ -304,7 +374,7 @@ |
||
10969 | return 0; |
||
10970 | |||
10971 | hdr = (struct ieee80211_hdr *) skb->data; |
||
10972 | - hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); |
||
10973 | + hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl)); |
||
10974 | |||
10975 | #ifdef CONFIG_IEEE80211_CRYPT_TKIP |
||
10976 | if (ieee->tkip_countermeasures && |
||
10977 | @@ -339,7 +409,7 @@ |
||
10978 | |||
10979 | /* Called only as a tasklet (software IRQ), by ieee80211_rx */ |
||
10980 | static inline int |
||
10981 | -ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb, |
||
10982 | +ieee80211_rx_frame_decrypt_msdu_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb, |
||
10983 | int keyidx, struct ieee80211_crypt_data *crypt) |
||
10984 | { |
||
10985 | struct ieee80211_hdr *hdr; |
||
10986 | @@ -349,7 +419,7 @@ |
||
10987 | return 0; |
||
10988 | |||
10989 | hdr = (struct ieee80211_hdr *) skb->data; |
||
10990 | - hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); |
||
10991 | + hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl)); |
||
10992 | |||
10993 | atomic_inc(&crypt->refcnt); |
||
10994 | res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv); |
||
10995 | @@ -367,7 +437,7 @@ |
||
10996 | |||
10997 | /* this function is stolen from ipw2200 driver*/ |
||
10998 | #define IEEE_PACKET_RETRY_TIME (5*HZ) |
||
10999 | -static int is_duplicate_packet(struct ieee80211_device *ieee, |
||
11000 | +static int is_duplicate_packet_rtl7(struct ieee80211_device *ieee, |
||
11001 | struct ieee80211_hdr *header) |
||
11002 | { |
||
11003 | // u16 fc = le16_to_cpu(header->frame_ctl); |
||
11004 | @@ -413,7 +483,7 @@ |
||
11005 | last_seq = &ieee->last_seq_num; |
||
11006 | last_frag = &ieee->last_frag_num; |
||
11007 | last_time = &ieee->last_packet_time; |
||
11008 | - |
||
11009 | + |
||
11010 | break; |
||
11011 | default: |
||
11012 | return 0; |
||
11013 | @@ -436,7 +506,7 @@ |
||
11014 | drop: |
||
11015 | // BUG_ON(!(fc & IEEE80211_FCTL_RETRY)); |
||
11016 | // printk("DUP\n"); |
||
11017 | - |
||
11018 | + |
||
11019 | return 1; |
||
11020 | } |
||
11021 | |||
11022 | @@ -444,7 +514,7 @@ |
||
11023 | /* All received frames are sent to this function. @skb contains the frame in |
||
11024 | * IEEE 802.11 format, i.e., in the format it was sent over air. |
||
11025 | * This function is called only as a tasklet (software IRQ). */ |
||
11026 | -int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, |
||
11027 | +int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, |
||
11028 | struct ieee80211_rx_stats *rx_stats) |
||
11029 | { |
||
11030 | struct net_device *dev = ieee->dev; |
||
11031 | @@ -481,9 +551,9 @@ |
||
11032 | type = WLAN_FC_GET_TYPE(fc); |
||
11033 | stype = WLAN_FC_GET_STYPE(fc); |
||
11034 | sc = le16_to_cpu(hdr->seq_ctl); |
||
11035 | - |
||
11036 | + |
||
11037 | frag = WLAN_GET_SEQ_FRAG(sc); |
||
11038 | - hdrlen = ieee80211_get_hdrlen(fc); |
||
11039 | + hdrlen = ieee80211_get_hdrlen_rtl7(fc); |
||
11040 | |||
11041 | #ifdef NOT_YET |
||
11042 | #if WIRELESS_EXT > 15 |
||
11043 | @@ -501,12 +571,12 @@ |
||
11044 | } |
||
11045 | #endif /* IW_WIRELESS_SPY */ |
||
11046 | #endif /* WIRELESS_EXT > 15 */ |
||
11047 | - hostap_update_rx_stats(local->ap, hdr, rx_stats); |
||
11048 | + hostap_update_rx_stats_rtl7(local->ap, hdr, rx_stats); |
||
11049 | #endif |
||
11050 | |||
11051 | #if WIRELESS_EXT > 15 |
||
11052 | if (ieee->iw_mode == IW_MODE_MONITOR) { |
||
11053 | - ieee80211_monitor_rx(ieee, skb, rx_stats); |
||
11054 | + ieee80211_monitor_rx_rtl7(ieee, skb, rx_stats); |
||
11055 | stats->rx_packets++; |
||
11056 | stats->rx_bytes += skb->len; |
||
11057 | return 1; |
||
11058 | @@ -529,7 +599,7 @@ |
||
11059 | * stations that do not support WEP key mapping). */ |
||
11060 | |||
11061 | if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key) |
||
11062 | - (void) hostap_handle_sta_crypto(local, hdr, &crypt, |
||
11063 | + (void) hostap_handle_sta_crypto_rtl7(local, hdr, &crypt, |
||
11064 | &sta); |
||
11065 | #endif |
||
11066 | |||
11067 | @@ -555,7 +625,7 @@ |
||
11068 | if (skb->len < IEEE80211_DATA_HDR3_LEN) |
||
11069 | goto rx_dropped; |
||
11070 | |||
11071 | - if (is_duplicate_packet(ieee, hdr)) |
||
11072 | + if (is_duplicate_packet_rtl7(ieee, hdr)) |
||
11073 | goto rx_dropped; |
||
11074 | |||
11075 | |||
11076 | @@ -573,9 +643,9 @@ |
||
11077 | goto rx_dropped; |
||
11078 | } |
||
11079 | #endif |
||
11080 | - |
||
11081 | - |
||
11082 | - if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype)) |
||
11083 | + |
||
11084 | + |
||
11085 | + if (ieee80211_rx_frame_mgmt_rtl7(ieee, skb, rx_stats, type, stype)) |
||
11086 | goto rx_dropped; |
||
11087 | else |
||
11088 | goto rx_exit; |
||
11089 | @@ -583,7 +653,7 @@ |
||
11090 | |||
11091 | |||
11092 | /* Data frame - extract src/dst addresses */ |
||
11093 | - |
||
11094 | + |
||
11095 | switch (fc & (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) { |
||
11096 | case IEEE80211_FCTL_FROMDS: |
||
11097 | memcpy(dst, hdr->addr1, ETH_ALEN); |
||
11098 | @@ -606,7 +676,7 @@ |
||
11099 | } |
||
11100 | |||
11101 | #ifdef NOT_YET |
||
11102 | - if (hostap_rx_frame_wds(ieee, hdr, fc, &wds)) |
||
11103 | + if (hostap_rx_frame_wds_rtl7(ieee, hdr, fc, &wds)) |
||
11104 | goto rx_dropped; |
||
11105 | if (wds) { |
||
11106 | skb->dev = dev = wds; |
||
11107 | @@ -619,7 +689,7 @@ |
||
11108 | memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) { |
||
11109 | /* Frame from BSSID of the AP for which we are a client */ |
||
11110 | skb->dev = dev = ieee->stadev; |
||
11111 | - stats = hostap_get_stats(dev); |
||
11112 | + stats = hostap_get_stats_rtl7(dev); |
||
11113 | from_assoc_ap = 1; |
||
11114 | } |
||
11115 | #endif |
||
11116 | @@ -630,7 +700,7 @@ |
||
11117 | if ((ieee->iw_mode == IW_MODE_MASTER || |
||
11118 | ieee->iw_mode == IW_MODE_REPEAT) && |
||
11119 | !from_assoc_ap) { |
||
11120 | - switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats, |
||
11121 | + switch (hostap_handle_sta_rx_rtl7(ieee, dev, skb, rx_stats, |
||
11122 | wds != NULL)) { |
||
11123 | case AP_RX_CONTINUE_NOT_AUTHORIZED: |
||
11124 | frame_authorized = 0; |
||
11125 | @@ -664,7 +734,7 @@ |
||
11126 | /* skb: hdr + (possibly fragmented, possibly encrypted) payload */ |
||
11127 | |||
11128 | if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) && |
||
11129 | - (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0) |
||
11130 | + (keyidx = ieee80211_rx_frame_decrypt_rtl7(ieee, skb, crypt)) < 0) |
||
11131 | goto rx_dropped; |
||
11132 | |||
11133 | hdr = (struct ieee80211_hdr *) skb->data; |
||
11134 | @@ -674,7 +744,7 @@ |
||
11135 | // ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) && |
||
11136 | if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) { |
||
11137 | int flen; |
||
11138 | - struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr); |
||
11139 | + struct sk_buff *frag_skb = ieee80211_frag_cache_get_rtl7(ieee, hdr); |
||
11140 | IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag); |
||
11141 | |||
11142 | if (!frag_skb) { |
||
11143 | @@ -694,7 +764,7 @@ |
||
11144 | printk(KERN_WARNING "%s: host decrypted and " |
||
11145 | "reassembled frame did not fit skb\n", |
||
11146 | dev->name); |
||
11147 | - ieee80211_frag_cache_invalidate(ieee, hdr); |
||
11148 | + ieee80211_frag_cache_invalidate_rtl7(ieee, hdr); |
||
11149 | goto rx_dropped; |
||
11150 | } |
||
11151 | |||
11152 | @@ -722,19 +792,19 @@ |
||
11153 | * delivered, so remove skb from fragment cache */ |
||
11154 | skb = frag_skb; |
||
11155 | hdr = (struct ieee80211_hdr *) skb->data; |
||
11156 | - ieee80211_frag_cache_invalidate(ieee, hdr); |
||
11157 | + ieee80211_frag_cache_invalidate_rtl7(ieee, hdr); |
||
11158 | } |
||
11159 | |||
11160 | /* skb: hdr + (possible reassembled) full MSDU payload; possibly still |
||
11161 | * encrypted/authenticated */ |
||
11162 | if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) && |
||
11163 | - ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt)) |
||
11164 | + ieee80211_rx_frame_decrypt_msdu_rtl7(ieee, skb, keyidx, crypt)) |
||
11165 | goto rx_dropped; |
||
11166 | |||
11167 | hdr = (struct ieee80211_hdr *) skb->data; |
||
11168 | if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) { |
||
11169 | if (/*ieee->ieee802_1x &&*/ |
||
11170 | - ieee80211_is_eapol_frame(ieee, skb)) { |
||
11171 | + ieee80211_is_eapol_frame_rtl7(ieee, skb)) { |
||
11172 | #ifdef CONFIG_IEEE80211_DEBUG |
||
11173 | /* pass unencrypted EAPOL frames even if encryption is |
||
11174 | * configured */ |
||
11175 | @@ -763,7 +833,7 @@ |
||
11176 | #endif |
||
11177 | |||
11178 | if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep && |
||
11179 | - !ieee80211_is_eapol_frame(ieee, skb)) { |
||
11180 | + !ieee80211_is_eapol_frame_rtl7(ieee, skb)) { |
||
11181 | IEEE80211_DEBUG_DROP( |
||
11182 | "dropped unencrypted RX data " |
||
11183 | "frame from " MAC_FMT |
||
11184 | @@ -861,7 +931,12 @@ |
||
11185 | if (skb2 != NULL) { |
||
11186 | /* send to wireless media */ |
||
11187 | skb2->protocol = __constant_htons(ETH_P_802_3); |
||
11188 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)) |
||
11189 | skb2->mac.raw = skb2->nh.raw = skb2->data; |
||
11190 | +#else |
||
11191 | + skb_reset_mac_header(skb2); |
||
11192 | + skb_reset_network_header(skb2); |
||
11193 | +#endif |
||
11194 | /* skb2->nh.raw = skb2->data + ETH_HLEN; */ |
||
11195 | skb2->dev = dev; |
||
11196 | dev_queue_xmit(skb2); |
||
11197 | @@ -896,7 +971,7 @@ |
||
11198 | |||
11199 | #define MGMT_FRAME_FIXED_PART_LENGTH 0x24 |
||
11200 | |||
11201 | -static inline int ieee80211_is_ofdm_rate(u8 rate) |
||
11202 | +static inline int ieee80211_is_ofdm_rate_rtl7(u8 rate) |
||
11203 | { |
||
11204 | switch (rate & ~IEEE80211_BASIC_RATE_MASK) { |
||
11205 | case IEEE80211_OFDM_RATE_6MB: |
||
11206 | @@ -913,7 +988,7 @@ |
||
11207 | } |
||
11208 | |||
11209 | |||
11210 | -static inline int ieee80211_network_init( |
||
11211 | +static inline int ieee80211_network_init_rtl7( |
||
11212 | struct ieee80211_device *ieee, |
||
11213 | struct ieee80211_probe_response *beacon, |
||
11214 | struct ieee80211_network *network, |
||
11215 | @@ -964,7 +1039,7 @@ |
||
11216 | |||
11217 | switch (info_element->id) { |
||
11218 | case MFIE_TYPE_SSID: |
||
11219 | - if (ieee80211_is_empty_essid(info_element->data, |
||
11220 | + if (ieee80211_is_empty_essid_rtl7(info_element->data, |
||
11221 | info_element->len)) { |
||
11222 | network->flags |= NETWORK_EMPTY_ESSID; |
||
11223 | break; |
||
11224 | @@ -991,7 +1066,7 @@ |
||
11225 | #ifdef CONFIG_IEEE80211_DEBUG |
||
11226 | p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]); |
||
11227 | #endif |
||
11228 | - if (ieee80211_is_ofdm_rate(info_element->data[i])) { |
||
11229 | + if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) { |
||
11230 | network->flags |= NETWORK_HAS_OFDM; |
||
11231 | if (info_element->data[i] & |
||
11232 | IEEE80211_BASIC_RATE_MASK) |
||
11233 | @@ -1014,7 +1089,7 @@ |
||
11234 | #ifdef CONFIG_IEEE80211_DEBUG |
||
11235 | p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]); |
||
11236 | #endif |
||
11237 | - if (ieee80211_is_ofdm_rate(info_element->data[i])) { |
||
11238 | + if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) { |
||
11239 | network->flags |= NETWORK_HAS_OFDM; |
||
11240 | if (info_element->data[i] & |
||
11241 | IEEE80211_BASIC_RATE_MASK) |
||
11242 | @@ -1043,47 +1118,47 @@ |
||
11243 | break; |
||
11244 | |||
11245 | case MFIE_TYPE_TIM: |
||
11246 | - |
||
11247 | - if(info_element->len < 4) |
||
11248 | + |
||
11249 | + if(info_element->len < 4) |
||
11250 | break; |
||
11251 | - |
||
11252 | + |
||
11253 | network->dtim_period = info_element->data[1]; |
||
11254 | - |
||
11255 | + |
||
11256 | if(ieee->state != IEEE80211_LINKED) |
||
11257 | break; |
||
11258 | - |
||
11259 | - network->last_dtim_sta_time[0] = stats->mac_time[0]; |
||
11260 | + |
||
11261 | + network->last_dtim_sta_time[0] = stats->mac_time[0]; |
||
11262 | network->last_dtim_sta_time[1] = stats->mac_time[1]; |
||
11263 | - |
||
11264 | + |
||
11265 | network->dtim_data = IEEE80211_DTIM_VALID; |
||
11266 | - |
||
11267 | - if(info_element->data[0] != 0) |
||
11268 | + |
||
11269 | + if(info_element->data[0] != 0) |
||
11270 | break; |
||
11271 | - |
||
11272 | + |
||
11273 | if(info_element->data[2] & 1) |
||
11274 | network->dtim_data |= IEEE80211_DTIM_MBCAST; |
||
11275 | - |
||
11276 | + |
||
11277 | offset = (info_element->data[2] >> 1)*2; |
||
11278 | - |
||
11279 | - //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id); |
||
11280 | - |
||
11281 | - if(ieee->assoc_id < offset || |
||
11282 | + |
||
11283 | + //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id); |
||
11284 | + |
||
11285 | + if(ieee->assoc_id < offset || |
||
11286 | ieee->assoc_id > 8*(offset + info_element->len -3)) |
||
11287 | - |
||
11288 | + |
||
11289 | break; |
||
11290 | - |
||
11291 | - |
||
11292 | + |
||
11293 | + |
||
11294 | offset = offset + ieee->assoc_id / 8;// + ((aid % 8)? 0 : 1) ; |
||
11295 | - |
||
11296 | - // printk("offset:%x data:%x, ucast:%d\n", offset, |
||
11297 | + |
||
11298 | + // printk("offset:%x data:%x, ucast:%d\n", offset, |
||
11299 | // info_element->data[3+offset] , |
||
11300 | // info_element->data[3+offset] & (1<<(ieee->assoc_id%8))); |
||
11301 | - |
||
11302 | + |
||
11303 | if(info_element->data[3+offset] & (1<<(ieee->assoc_id%8))) |
||
11304 | network->dtim_data |= IEEE80211_DTIM_UCAST; |
||
11305 | - |
||
11306 | + |
||
11307 | break; |
||
11308 | - |
||
11309 | + |
||
11310 | case MFIE_TYPE_IBSS_SET: |
||
11311 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_IBSS_SET: ignored\n"); |
||
11312 | break; |
||
11313 | @@ -1115,7 +1190,7 @@ |
||
11314 | memcpy(network->rsn_ie, info_element, |
||
11315 | network->rsn_ie_len); |
||
11316 | break; |
||
11317 | - |
||
11318 | + |
||
11319 | default: |
||
11320 | IEEE80211_DEBUG_SCAN("unsupported IE %d\n", |
||
11321 | info_element->id); |
||
11322 | @@ -1147,7 +1222,7 @@ |
||
11323 | return 1; |
||
11324 | } |
||
11325 | |||
11326 | - if (ieee80211_is_empty_essid(network->ssid, network->ssid_len)) |
||
11327 | + if (ieee80211_is_empty_essid_rtl7(network->ssid, network->ssid_len)) |
||
11328 | network->flags |= NETWORK_EMPTY_ESSID; |
||
11329 | |||
11330 | memcpy(&network->stats, stats, sizeof(network->stats)); |
||
11331 | @@ -1155,24 +1230,24 @@ |
||
11332 | return 0; |
||
11333 | } |
||
11334 | |||
11335 | -static inline int is_same_network(struct ieee80211_network *src, |
||
11336 | +static inline int is_same_network_rtl7(struct ieee80211_network *src, |
||
11337 | struct ieee80211_network *dst) |
||
11338 | { |
||
11339 | /* A network is only a duplicate if the channel, BSSID, ESSID |
||
11340 | - * and the capability field (in particular IBSS and BSS) all match. |
||
11341 | + * and the capability field (in particular IBSS and BSS) all match. |
||
11342 | * We treat all <hidden> with the same BSSID and channel |
||
11343 | * as one network */ |
||
11344 | return ((src->ssid_len == dst->ssid_len) && |
||
11345 | (src->channel == dst->channel) && |
||
11346 | !memcmp(src->bssid, dst->bssid, ETH_ALEN) && |
||
11347 | !memcmp(src->ssid, dst->ssid, src->ssid_len) && |
||
11348 | - ((src->capability & WLAN_CAPABILITY_IBSS) == |
||
11349 | + ((src->capability & WLAN_CAPABILITY_IBSS) == |
||
11350 | (dst->capability & WLAN_CAPABILITY_IBSS)) && |
||
11351 | - ((src->capability & WLAN_CAPABILITY_BSS) == |
||
11352 | + ((src->capability & WLAN_CAPABILITY_BSS) == |
||
11353 | (dst->capability & WLAN_CAPABILITY_BSS))); |
||
11354 | } |
||
11355 | |||
11356 | -static inline void update_network(struct ieee80211_network *dst, |
||
11357 | +static inline void update_network_rtl7(struct ieee80211_network *dst, |
||
11358 | struct ieee80211_network *src) |
||
11359 | { |
||
11360 | memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats)); |
||
11361 | @@ -1194,7 +1269,7 @@ |
||
11362 | dst->dtim_data = src->dtim_data; |
||
11363 | dst->last_dtim_sta_time[0] = src->last_dtim_sta_time[0]; |
||
11364 | dst->last_dtim_sta_time[1] = src->last_dtim_sta_time[1]; |
||
11365 | - |
||
11366 | + |
||
11367 | memcpy(dst->wpa_ie, src->wpa_ie, src->wpa_ie_len); |
||
11368 | dst->wpa_ie_len = src->wpa_ie_len; |
||
11369 | memcpy(dst->rsn_ie, src->rsn_ie, src->rsn_ie_len); |
||
11370 | @@ -1204,7 +1279,7 @@ |
||
11371 | /* dst->last_associate is not overwritten */ |
||
11372 | } |
||
11373 | |||
11374 | -static inline void ieee80211_process_probe_response( |
||
11375 | +static inline void ieee80211_process_probe_response_rtl7( |
||
11376 | struct ieee80211_device *ieee, |
||
11377 | struct ieee80211_probe_response *beacon, |
||
11378 | struct ieee80211_rx_stats *stats) |
||
11379 | @@ -1239,7 +1314,7 @@ |
||
11380 | (beacon->capability & (1<<0x1)) ? '1' : '0', |
||
11381 | (beacon->capability & (1<<0x0)) ? '1' : '0'); |
||
11382 | |||
11383 | - if (ieee80211_network_init(ieee, beacon, &network, stats)) { |
||
11384 | + if (ieee80211_network_init_rtl7(ieee, beacon, &network, stats)) { |
||
11385 | IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n", |
||
11386 | escape_essid(info_element->data, |
||
11387 | info_element->len), |
||
11388 | @@ -1261,12 +1336,12 @@ |
||
11389 | * already there. */ |
||
11390 | |||
11391 | spin_lock_irqsave(&ieee->lock, flags); |
||
11392 | - |
||
11393 | - if(is_same_network(&ieee->current_network, &network)) |
||
11394 | - update_network(&ieee->current_network, &network); |
||
11395 | - |
||
11396 | + |
||
11397 | + if(is_same_network_rtl7(&ieee->current_network, &network)) |
||
11398 | + update_network_rtl7(&ieee->current_network, &network); |
||
11399 | + |
||
11400 | list_for_each_entry(target, &ieee->network_list, list) { |
||
11401 | - if (is_same_network(target, &network)) |
||
11402 | + if (is_same_network_rtl7(target, &network)) |
||
11403 | break; |
||
11404 | |||
11405 | if ((oldest == NULL) || |
||
11406 | @@ -1306,7 +1381,7 @@ |
||
11407 | memcpy(target, &network, sizeof(*target)); |
||
11408 | list_add_tail(&target->list, &ieee->network_list); |
||
11409 | if(ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) |
||
11410 | - ieee80211_softmac_new_net(ieee,&network); |
||
11411 | + ieee80211_softmac_new_net_rtl7(ieee,&network); |
||
11412 | } else { |
||
11413 | IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n", |
||
11414 | escape_essid(target->ssid, |
||
11415 | @@ -1315,39 +1390,39 @@ |
||
11416 | WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == |
||
11417 | IEEE80211_STYPE_PROBE_RESP ? |
||
11418 | "PROBE RESPONSE" : "BEACON"); |
||
11419 | - |
||
11420 | + |
||
11421 | /* we have an entry and we are going to update it. But this entry may |
||
11422 | - * be already expired. In this case we do the same as we found a new |
||
11423 | + * be already expired. In this case we do the same as we found a new |
||
11424 | * net and call the new_net handler |
||
11425 | */ |
||
11426 | renew = !time_after(target->last_scanned + ieee->scan_age, jiffies); |
||
11427 | - update_network(target, &network); |
||
11428 | + update_network_rtl7(target, &network); |
||
11429 | if(renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)) |
||
11430 | - ieee80211_softmac_new_net(ieee,&network); |
||
11431 | + ieee80211_softmac_new_net_rtl7(ieee,&network); |
||
11432 | } |
||
11433 | |||
11434 | spin_unlock_irqrestore(&ieee->lock, flags); |
||
11435 | } |
||
11436 | |||
11437 | -void ieee80211_rx_mgt(struct ieee80211_device *ieee, |
||
11438 | +void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee, |
||
11439 | struct ieee80211_hdr *header, |
||
11440 | struct ieee80211_rx_stats *stats) |
||
11441 | { |
||
11442 | switch (WLAN_FC_GET_STYPE(header->frame_ctl)) { |
||
11443 | - |
||
11444 | + |
||
11445 | case IEEE80211_STYPE_BEACON: |
||
11446 | IEEE80211_DEBUG_MGMT("received BEACON (%d)\n", |
||
11447 | WLAN_FC_GET_STYPE(header->frame_ctl)); |
||
11448 | IEEE80211_DEBUG_SCAN("Beacon\n"); |
||
11449 | - ieee80211_process_probe_response( |
||
11450 | + ieee80211_process_probe_response_rtl7( |
||
11451 | ieee, (struct ieee80211_probe_response *)header, stats); |
||
11452 | break; |
||
11453 | - |
||
11454 | + |
||
11455 | case IEEE80211_STYPE_PROBE_RESP: |
||
11456 | IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n", |
||
11457 | WLAN_FC_GET_STYPE(header->frame_ctl)); |
||
11458 | IEEE80211_DEBUG_SCAN("Probe response\n"); |
||
11459 | - ieee80211_process_probe_response( |
||
11460 | + ieee80211_process_probe_response_rtl7( |
||
11461 | ieee, (struct ieee80211_probe_response *)header, stats); |
||
11462 | break; |
||
11463 | |||
11464 | @@ -1355,5 +1430,5 @@ |
||
11465 | } |
||
11466 | |||
11467 | |||
11468 | -EXPORT_SYMBOL(ieee80211_rx_mgt); |
||
11469 | -EXPORT_SYMBOL(ieee80211_rx); |
||
11470 | +EXPORT_SYMBOL(ieee80211_rx_mgt_rtl7); |
||
11471 | +EXPORT_SYMBOL(ieee80211_rx_rtl7); |
||
11472 | diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac.c |
||
11473 | --- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac.c 2006-06-19 03:27:33.000000000 +0200 |
||
11474 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac.c 2008-01-30 17:38:11.000000000 +0100 |
||
11475 | @@ -1,14 +1,14 @@ |
||
11476 | /* IEEE 802.11 SoftMAC layer |
||
11477 | * Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it> |
||
11478 | * |
||
11479 | - * Mostly extracted from the rtl8180-sa2400 driver for the |
||
11480 | + * Mostly extracted from the rtl8180-sa2400 driver for the |
||
11481 | * in-kernel generic ieee802.11 stack. |
||
11482 | * |
||
11483 | * Few lines might be stolen from other part of the ieee80211 |
||
11484 | * stack. Copyright who own it's copyright |
||
11485 | * |
||
11486 | * WPA code stolen from the ipw2200 driver. |
||
11487 | - * Copyright who own it's copyright. |
||
11488 | + * Copyright who own it's copyright. |
||
11489 | * |
||
11490 | * released under the GPL |
||
11491 | */ |
||
11492 | @@ -20,12 +20,12 @@ |
||
11493 | #include <linux/delay.h> |
||
11494 | #include <linux/version.h> |
||
11495 | |||
11496 | -short ieee80211_is_54g(struct ieee80211_network net) |
||
11497 | +short ieee80211_is_54g_rtl7(struct ieee80211_network net) |
||
11498 | { |
||
11499 | return ((net.rates_ex_len > 0) || (net.rates_len > 4)); |
||
11500 | } |
||
11501 | |||
11502 | -short ieee80211_is_shortslot(struct ieee80211_network net) |
||
11503 | +short ieee80211_is_shortslot_rtl7(struct ieee80211_network net) |
||
11504 | { |
||
11505 | return (net.capability & WLAN_CAPABILITY_SHORT_SLOT); |
||
11506 | } |
||
11507 | @@ -34,28 +34,28 @@ |
||
11508 | * tag and the EXTENDED RATE MFIE tag if needed. |
||
11509 | * It encludes two bytes per tag for the tag itself and its len |
||
11510 | */ |
||
11511 | -unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee) |
||
11512 | +unsigned int ieee80211_MFIE_rate_len_rtl7(struct ieee80211_device *ieee) |
||
11513 | { |
||
11514 | unsigned int rate_len = 0; |
||
11515 | - |
||
11516 | + |
||
11517 | if (ieee->modulation & IEEE80211_CCK_MODULATION) |
||
11518 | rate_len = IEEE80211_CCK_RATE_LEN + 2; |
||
11519 | - |
||
11520 | + |
||
11521 | if (ieee->modulation & IEEE80211_OFDM_MODULATION) |
||
11522 | - |
||
11523 | + |
||
11524 | rate_len += IEEE80211_OFDM_RATE_LEN + 2; |
||
11525 | - |
||
11526 | + |
||
11527 | return rate_len; |
||
11528 | } |
||
11529 | |||
11530 | -/* pleace the MFIE rate, tag to the memory (double) poined. |
||
11531 | +/* pleace the MFIE rate, tag to the memory (double) poined. |
||
11532 | * Then it updates the pointer so that |
||
11533 | * it points after the new MFIE tag added. |
||
11534 | - */ |
||
11535 | -void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p) |
||
11536 | + */ |
||
11537 | +void ieee80211_MFIE_Brate_rtl7(struct ieee80211_device *ieee, u8 **tag_p) |
||
11538 | { |
||
11539 | - u8 *tag = *tag_p; |
||
11540 | - |
||
11541 | + u8 *tag = *tag_p; |
||
11542 | + |
||
11543 | if (ieee->modulation & IEEE80211_CCK_MODULATION){ |
||
11544 | *tag++ = MFIE_TYPE_RATES; |
||
11545 | *tag++ = 4; |
||
11546 | @@ -64,17 +64,17 @@ |
||
11547 | *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB; |
||
11548 | *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB; |
||
11549 | } |
||
11550 | - |
||
11551 | + |
||
11552 | /* We may add an option for custom rates that specific HW might support */ |
||
11553 | *tag_p = tag; |
||
11554 | } |
||
11555 | |||
11556 | -void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p) |
||
11557 | -{ |
||
11558 | - u8 *tag = *tag_p; |
||
11559 | - |
||
11560 | +void ieee80211_MFIE_Grate_rtl7(struct ieee80211_device *ieee, u8 **tag_p) |
||
11561 | +{ |
||
11562 | + u8 *tag = *tag_p; |
||
11563 | + |
||
11564 | if (ieee->modulation & IEEE80211_OFDM_MODULATION){ |
||
11565 | - |
||
11566 | + |
||
11567 | *tag++ = MFIE_TYPE_RATES_EX; |
||
11568 | *tag++ = 8; |
||
11569 | *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB; |
||
11570 | @@ -85,73 +85,73 @@ |
||
11571 | *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB; |
||
11572 | *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB; |
||
11573 | *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB; |
||
11574 | - |
||
11575 | + |
||
11576 | } |
||
11577 | - |
||
11578 | + |
||
11579 | /* We may add an option for custom rates that specific HW might support */ |
||
11580 | *tag_p = tag; |
||
11581 | } |
||
11582 | |||
11583 | -void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb) |
||
11584 | +void enqueue_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb) |
||
11585 | { |
||
11586 | int nh; |
||
11587 | nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM; |
||
11588 | - |
||
11589 | + |
||
11590 | /* |
||
11591 | * if the queue is full but we have newer frames then |
||
11592 | * just overwrites the oldest. |
||
11593 | - * |
||
11594 | + * |
||
11595 | * if (nh == ieee->mgmt_queue_tail) |
||
11596 | * return -1; |
||
11597 | - */ |
||
11598 | + */ |
||
11599 | ieee->mgmt_queue_head = nh; |
||
11600 | ieee->mgmt_queue_ring[nh] = skb; |
||
11601 | - |
||
11602 | + |
||
11603 | //return 0; |
||
11604 | } |
||
11605 | |||
11606 | -struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee) |
||
11607 | +struct sk_buff *dequeue_mgmt_rtl7(struct ieee80211_device *ieee) |
||
11608 | { |
||
11609 | struct sk_buff *ret; |
||
11610 | - |
||
11611 | + |
||
11612 | if(ieee->mgmt_queue_tail == ieee->mgmt_queue_head) |
||
11613 | return NULL; |
||
11614 | - |
||
11615 | + |
||
11616 | ret = ieee->mgmt_queue_ring[ieee->mgmt_queue_tail]; |
||
11617 | - |
||
11618 | - ieee->mgmt_queue_tail = |
||
11619 | + |
||
11620 | + ieee->mgmt_queue_tail = |
||
11621 | (ieee->mgmt_queue_tail+1) % MGMT_QUEUE_NUM; |
||
11622 | - |
||
11623 | + |
||
11624 | return ret; |
||
11625 | } |
||
11626 | |||
11627 | -void init_mgmt_queue(struct ieee80211_device *ieee) |
||
11628 | +void init_mgmt_queue_rtl7(struct ieee80211_device *ieee) |
||
11629 | { |
||
11630 | ieee->mgmt_queue_tail = ieee->mgmt_queue_head = 0; |
||
11631 | } |
||
11632 | |||
11633 | |||
11634 | -void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl); |
||
11635 | +void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl); |
||
11636 | |||
11637 | -inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee) |
||
11638 | +inline void softmac_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee) |
||
11639 | { |
||
11640 | unsigned long flags; |
||
11641 | short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE; |
||
11642 | struct ieee80211_hdr_3addr *header= |
||
11643 | (struct ieee80211_hdr_3addr *) skb->data; |
||
11644 | - |
||
11645 | - |
||
11646 | + |
||
11647 | + |
||
11648 | spin_lock_irqsave(&ieee->lock, flags); |
||
11649 | - |
||
11650 | + |
||
11651 | /* called with 2nd param 0, no mgmt lock required */ |
||
11652 | - ieee80211_sta_wakeup(ieee,0); |
||
11653 | - |
||
11654 | + ieee80211_sta_wakeup_rtl7(ieee,0); |
||
11655 | + |
||
11656 | if(single){ |
||
11657 | - |
||
11658 | + |
||
11659 | if(ieee->queue_stop){ |
||
11660 | - |
||
11661 | - enqueue_mgmt(ieee,skb); |
||
11662 | - |
||
11663 | + |
||
11664 | + enqueue_mgmt_rtl7(ieee,skb); |
||
11665 | + |
||
11666 | }else{ |
||
11667 | header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4); |
||
11668 | |||
11669 | @@ -159,119 +159,119 @@ |
||
11670 | ieee->seq_ctrl = 0; |
||
11671 | else |
||
11672 | ieee->seq_ctrl++; |
||
11673 | - |
||
11674 | + |
||
11675 | /* avoid watchdog triggers */ |
||
11676 | ieee->dev->trans_start = jiffies; |
||
11677 | ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate); |
||
11678 | } |
||
11679 | - |
||
11680 | + |
||
11681 | spin_unlock_irqrestore(&ieee->lock, flags); |
||
11682 | }else{ |
||
11683 | spin_unlock_irqrestore(&ieee->lock, flags); |
||
11684 | spin_lock_irqsave(&ieee->mgmt_tx_lock, flags); |
||
11685 | - |
||
11686 | + |
||
11687 | header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4); |
||
11688 | - |
||
11689 | + |
||
11690 | if (ieee->seq_ctrl == 0xFFF) |
||
11691 | ieee->seq_ctrl = 0; |
||
11692 | else |
||
11693 | ieee->seq_ctrl++; |
||
11694 | - |
||
11695 | + |
||
11696 | ieee->softmac_hard_start_xmit(skb,ieee->dev); |
||
11697 | - |
||
11698 | + |
||
11699 | spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags); |
||
11700 | } |
||
11701 | } |
||
11702 | |||
11703 | |||
11704 | -inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee) |
||
11705 | +inline void softmac_ps_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee) |
||
11706 | { |
||
11707 | - |
||
11708 | + |
||
11709 | short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE; |
||
11710 | struct ieee80211_hdr_3addr *header = |
||
11711 | (struct ieee80211_hdr_3addr *) skb->data; |
||
11712 | - |
||
11713 | - |
||
11714 | + |
||
11715 | + |
||
11716 | if(single){ |
||
11717 | - |
||
11718 | + |
||
11719 | header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4); |
||
11720 | |||
11721 | if (ieee->seq_ctrl == 0xFFF) |
||
11722 | ieee->seq_ctrl = 0; |
||
11723 | else |
||
11724 | ieee->seq_ctrl++; |
||
11725 | - |
||
11726 | + |
||
11727 | /* avoid watchdog triggers */ |
||
11728 | ieee->dev->trans_start = jiffies; |
||
11729 | ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate); |
||
11730 | - |
||
11731 | + |
||
11732 | }else{ |
||
11733 | - |
||
11734 | + |
||
11735 | header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4); |
||
11736 | - |
||
11737 | + |
||
11738 | if (ieee->seq_ctrl == 0xFFF) |
||
11739 | ieee->seq_ctrl = 0; |
||
11740 | else |
||
11741 | ieee->seq_ctrl++; |
||
11742 | |||
11743 | ieee->softmac_hard_start_xmit(skb,ieee->dev); |
||
11744 | - |
||
11745 | + |
||
11746 | } |
||
11747 | } |
||
11748 | |||
11749 | -inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee) |
||
11750 | +inline struct sk_buff *ieee80211_probe_req_rtl7(struct ieee80211_device *ieee) |
||
11751 | { |
||
11752 | unsigned int len,rate_len; |
||
11753 | u8 *tag; |
||
11754 | struct sk_buff *skb; |
||
11755 | struct ieee80211_probe_request *req; |
||
11756 | - |
||
11757 | + |
||
11758 | len = ieee->current_network.ssid_len; |
||
11759 | - |
||
11760 | - rate_len = ieee80211_MFIE_rate_len(ieee); |
||
11761 | - |
||
11762 | + |
||
11763 | + rate_len = ieee80211_MFIE_rate_len_rtl7(ieee); |
||
11764 | + |
||
11765 | skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) + |
||
11766 | 2 + len + rate_len); |
||
11767 | - |
||
11768 | - if (!skb) |
||
11769 | + |
||
11770 | + if (!skb) |
||
11771 | return NULL; |
||
11772 | - |
||
11773 | + |
||
11774 | req = (struct ieee80211_probe_request *) skb_put(skb,sizeof(struct ieee80211_probe_request)); |
||
11775 | req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); |
||
11776 | - req->header.duration_id = 0; //FIXME: is this OK ? |
||
11777 | - |
||
11778 | + req->header.duration_id = 0; //FIXME: is this OK ? |
||
11779 | + |
||
11780 | memset(req->header.addr1, 0xff, ETH_ALEN); |
||
11781 | memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN); |
||
11782 | memset(req->header.addr3, 0xff, ETH_ALEN); |
||
11783 | - |
||
11784 | + |
||
11785 | tag = (u8 *) skb_put(skb,len+2+rate_len); |
||
11786 | - |
||
11787 | + |
||
11788 | *tag++ = MFIE_TYPE_SSID; |
||
11789 | *tag++ = len; |
||
11790 | memcpy(tag, ieee->current_network.ssid, len); |
||
11791 | tag += len; |
||
11792 | - |
||
11793 | - ieee80211_MFIE_Brate(ieee,&tag); |
||
11794 | - ieee80211_MFIE_Grate(ieee,&tag); |
||
11795 | + |
||
11796 | + ieee80211_MFIE_Brate_rtl7(ieee,&tag); |
||
11797 | + ieee80211_MFIE_Grate_rtl7(ieee,&tag); |
||
11798 | return skb; |
||
11799 | } |
||
11800 | |||
11801 | -struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee); |
||
11802 | -void ieee80211_send_beacon(struct ieee80211_device *ieee) |
||
11803 | +struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee); |
||
11804 | +void ieee80211_send_beacon_rtl7(struct ieee80211_device *ieee) |
||
11805 | { |
||
11806 | struct sk_buff *skb; |
||
11807 | - |
||
11808 | - unsigned long flags; |
||
11809 | - |
||
11810 | - skb = ieee80211_get_beacon_(ieee); |
||
11811 | + |
||
11812 | + unsigned long flags; |
||
11813 | + |
||
11814 | + skb = ieee80211_get_beacon__rtl7(ieee); |
||
11815 | if (skb){ |
||
11816 | - softmac_mgmt_xmit(skb, ieee); |
||
11817 | + softmac_mgmt_xmit_rtl7(skb, ieee); |
||
11818 | ieee->softmac_stats.tx_beacons++; |
||
11819 | } |
||
11820 | |||
11821 | - ieee->beacon_timer.expires = jiffies + |
||
11822 | + ieee->beacon_timer.expires = jiffies + |
||
11823 | (MSECS( ieee->current_network.beacon_interval -5)); |
||
11824 | - |
||
11825 | + |
||
11826 | spin_lock_irqsave(&ieee->beacon_lock,flags); |
||
11827 | if(ieee->beacon_txing) |
||
11828 | add_timer(&ieee->beacon_timer); |
||
11829 | @@ -279,57 +279,57 @@ |
||
11830 | } |
||
11831 | |||
11832 | |||
11833 | -void ieee80211_send_beacon_cb(unsigned long _ieee) |
||
11834 | +void ieee80211_send_beacon_cb_rtl7(unsigned long _ieee) |
||
11835 | { |
||
11836 | struct ieee80211_device *ieee = |
||
11837 | (struct ieee80211_device *) _ieee; |
||
11838 | - ieee80211_send_beacon(ieee); |
||
11839 | + ieee80211_send_beacon_rtl7(ieee); |
||
11840 | } |
||
11841 | |||
11842 | |||
11843 | -void ieee80211_send_probe(struct ieee80211_device *ieee) |
||
11844 | +void ieee80211_send_probe_rtl7(struct ieee80211_device *ieee) |
||
11845 | { |
||
11846 | struct sk_buff *skb; |
||
11847 | - |
||
11848 | - skb = ieee80211_probe_req(ieee); |
||
11849 | + |
||
11850 | + skb = ieee80211_probe_req_rtl7(ieee); |
||
11851 | if (skb){ |
||
11852 | - softmac_mgmt_xmit(skb, ieee); |
||
11853 | + softmac_mgmt_xmit_rtl7(skb, ieee); |
||
11854 | ieee->softmac_stats.tx_probe_rq++; |
||
11855 | } |
||
11856 | } |
||
11857 | |||
11858 | -void ieee80211_send_probe_requests(struct ieee80211_device *ieee) |
||
11859 | +void ieee80211_send_probe_requests_rtl7(struct ieee80211_device *ieee) |
||
11860 | { |
||
11861 | if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)){ |
||
11862 | - ieee80211_send_probe(ieee); |
||
11863 | - ieee80211_send_probe(ieee); |
||
11864 | + ieee80211_send_probe_rtl7(ieee); |
||
11865 | + ieee80211_send_probe_rtl7(ieee); |
||
11866 | } |
||
11867 | } |
||
11868 | |||
11869 | /* this performs syncro scan blocking the caller until all channels |
||
11870 | - * in the allowed channel map has been checked. |
||
11871 | + * in the allowed channel map has been checked. |
||
11872 | */ |
||
11873 | -void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee) |
||
11874 | +void ieee80211_softmac_scan_syncro_rtl7(struct ieee80211_device *ieee) |
||
11875 | { |
||
11876 | short ch = 0; |
||
11877 | - |
||
11878 | + |
||
11879 | down(&ieee->scan_sem); |
||
11880 | - |
||
11881 | + |
||
11882 | while(1) |
||
11883 | { |
||
11884 | - |
||
11885 | + |
||
11886 | do{ |
||
11887 | ch++; |
||
11888 | - if (ch > MAX_CHANNEL_NUMBER) |
||
11889 | + if (ch > MAX_CHANNEL_NUMBER) |
||
11890 | goto out; /* scan completed */ |
||
11891 | - |
||
11892 | + |
||
11893 | }while(!ieee->channel_map[ch]); |
||
11894 | - |
||
11895 | + |
||
11896 | /* this fuction can be called in two situations |
||
11897 | * 1- We have switched to ad-hoc mode and we are |
||
11898 | * performing a complete syncro scan before conclude |
||
11899 | - * there are no interesting cell and to create a |
||
11900 | - * new one. In this case the link state is |
||
11901 | + * there are no interesting cell and to create a |
||
11902 | + * new one. In this case the link state is |
||
11903 | * IEEE80211_NOLINK until we found an interesting cell. |
||
11904 | * If so the ieee8021_new_net, called by the RX path |
||
11905 | * will set the state to IEEE80211_LINKED, so we stop |
||
11906 | @@ -342,24 +342,24 @@ |
||
11907 | * not filter RX frames and the channel is changing. |
||
11908 | * So the only situation in witch are interested is to check |
||
11909 | * if the state become LINKED because of the #1 situation |
||
11910 | - */ |
||
11911 | - |
||
11912 | + */ |
||
11913 | + |
||
11914 | if (ieee->state == IEEE80211_LINKED) |
||
11915 | goto out; |
||
11916 | - |
||
11917 | + |
||
11918 | ieee->set_chan(ieee->dev, ch); |
||
11919 | - |
||
11920 | - ieee80211_send_probe_requests(ieee); |
||
11921 | - |
||
11922 | + |
||
11923 | + ieee80211_send_probe_requests_rtl7(ieee); |
||
11924 | + |
||
11925 | /* this prevent excessive time wait when we |
||
11926 | * need to wait for a syncro scan to end.. |
||
11927 | - */ |
||
11928 | + */ |
||
11929 | if (ieee->sync_scan_hurryup) |
||
11930 | goto out; |
||
11931 | |||
11932 | |||
11933 | msleep_interruptible_rtl(IEEE80211_SOFTMAC_SCAN_TIME); |
||
11934 | - |
||
11935 | + |
||
11936 | } |
||
11937 | out: |
||
11938 | ieee->sync_scan_hurryup = 0; |
||
11939 | @@ -370,43 +370,49 @@ |
||
11940 | void ieee80211_softmac_scan(struct ieee80211_device *ieee) |
||
11941 | { |
||
11942 | short watchdog = 0; |
||
11943 | - |
||
11944 | + |
||
11945 | do{ |
||
11946 | - ieee->current_network.channel = |
||
11947 | + ieee->current_network.channel = |
||
11948 | (ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER; |
||
11949 | - if (watchdog++ > MAX_CHANNEL_NUMBER) |
||
11950 | + if (watchdog++ > MAX_CHANNEL_NUMBER) |
||
11951 | return; /* no good chans */ |
||
11952 | - |
||
11953 | + |
||
11954 | }while(!ieee->channel_map[ieee->current_network.channel]); |
||
11955 | - |
||
11956 | + |
||
11957 | |||
11958 | schedule_work(&ieee->softmac_scan_wq); |
||
11959 | } |
||
11960 | #endif |
||
11961 | |||
11962 | -void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee) |
||
11963 | -{ |
||
11964 | - down(&ieee->scan_sem); |
||
11965 | - |
||
11966 | +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) |
||
11967 | +void ieee80211_softmac_scan_wq_rtl7(struct work_struct *work) |
||
11968 | +{ |
||
11969 | + struct delayed_work *dwork = container_of(work, struct delayed_work, work); |
||
11970 | + struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq); |
||
11971 | +#else |
||
11972 | +void ieee80211_softmac_scan_wq_rtl7(struct ieee80211_device *ieee) |
||
11973 | +{ |
||
11974 | +#endif |
||
11975 | short watchdog = 0; |
||
11976 | - |
||
11977 | + down(&ieee->scan_sem); |
||
11978 | + |
||
11979 | do{ |
||
11980 | - ieee->current_network.channel = |
||
11981 | + ieee->current_network.channel = |
||
11982 | (ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER; |
||
11983 | - if (watchdog++ > MAX_CHANNEL_NUMBER) |
||
11984 | + if (watchdog++ > MAX_CHANNEL_NUMBER) |
||
11985 | goto out; /* no good chans */ |
||
11986 | - |
||
11987 | + |
||
11988 | }while(!ieee->channel_map[ieee->current_network.channel]); |
||
11989 | - |
||
11990 | + |
||
11991 | if (ieee->scanning == 0 ) |
||
11992 | goto out; |
||
11993 | - |
||
11994 | + |
||
11995 | ieee->set_chan(ieee->dev, ieee->current_network.channel); |
||
11996 | - ieee80211_send_probe_requests(ieee); |
||
11997 | + ieee80211_send_probe_requests_rtl7(ieee); |
||
11998 | |||
11999 | -#if 0 |
||
12000 | +#if 0 |
||
12001 | ieee->.expires = jiffies + (IEEE80211_SOFTMAC_SCAN_TIME); |
||
12002 | - if (ieee->scanning == 1) |
||
12003 | + if (ieee->scanning == 1) |
||
12004 | add_timer(&ieee->scan_timer); |
||
12005 | #endif |
||
12006 | queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME); |
||
12007 | @@ -419,7 +425,7 @@ |
||
12008 | { |
||
12009 | unsigned long flags; |
||
12010 | struct ieee80211_device *ieee = (struct ieee80211_device *)_dev; |
||
12011 | - |
||
12012 | + |
||
12013 | spin_lock_irqsave(&ieee->lock, flags); |
||
12014 | ieee80211_softmac_scan(ieee); |
||
12015 | spin_unlock_irqrestore(&ieee->lock, flags); |
||
12016 | @@ -427,19 +433,19 @@ |
||
12017 | #endif |
||
12018 | |||
12019 | |||
12020 | -void ieee80211_beacons_start(struct ieee80211_device *ieee) |
||
12021 | +void ieee80211_beacons_start_rtl7(struct ieee80211_device *ieee) |
||
12022 | { |
||
12023 | - unsigned long flags; |
||
12024 | + unsigned long flags; |
||
12025 | |||
12026 | spin_lock_irqsave(&ieee->beacon_lock,flags); |
||
12027 | |||
12028 | ieee->beacon_txing = 1; |
||
12029 | - ieee80211_send_beacon(ieee); |
||
12030 | - |
||
12031 | + ieee80211_send_beacon_rtl7(ieee); |
||
12032 | + |
||
12033 | spin_unlock_irqrestore(&ieee->beacon_lock,flags); |
||
12034 | } |
||
12035 | |||
12036 | -void ieee80211_beacons_stop(struct ieee80211_device *ieee) |
||
12037 | +void ieee80211_beacons_stop_rtl7(struct ieee80211_device *ieee) |
||
12038 | { |
||
12039 | unsigned long flags; |
||
12040 | |||
12041 | @@ -453,111 +459,111 @@ |
||
12042 | } |
||
12043 | |||
12044 | |||
12045 | -void ieee80211_stop_send_beacons(struct ieee80211_device *ieee) |
||
12046 | +void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee) |
||
12047 | { |
||
12048 | if(ieee->stop_send_beacons) |
||
12049 | ieee->stop_send_beacons(ieee->dev); |
||
12050 | if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS) |
||
12051 | - ieee80211_beacons_stop(ieee); |
||
12052 | + ieee80211_beacons_stop_rtl7(ieee); |
||
12053 | } |
||
12054 | |||
12055 | |||
12056 | -void ieee80211_start_send_beacons(struct ieee80211_device *ieee) |
||
12057 | +void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee) |
||
12058 | { |
||
12059 | if(ieee->start_send_beacons) |
||
12060 | ieee->start_send_beacons(ieee->dev); |
||
12061 | if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS) |
||
12062 | - ieee80211_beacons_start(ieee); |
||
12063 | + ieee80211_beacons_start_rtl7(ieee); |
||
12064 | } |
||
12065 | |||
12066 | |||
12067 | -void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee) |
||
12068 | +void ieee80211_softmac_stop_scan_rtl7(struct ieee80211_device *ieee) |
||
12069 | { |
||
12070 | -// unsigned long flags; |
||
12071 | - |
||
12072 | +// unsigned long flags; |
||
12073 | + |
||
12074 | //ieee->sync_scan_hurryup = 1; |
||
12075 | - |
||
12076 | + |
||
12077 | down(&ieee->scan_sem); |
||
12078 | // spin_lock_irqsave(&ieee->lock, flags); |
||
12079 | - |
||
12080 | + |
||
12081 | if (ieee->scanning == 1){ |
||
12082 | ieee->scanning = 0; |
||
12083 | //del_timer_sync(&ieee->scan_timer); |
||
12084 | cancel_delayed_work(&ieee->softmac_scan_wq); |
||
12085 | } |
||
12086 | - |
||
12087 | + |
||
12088 | // spin_unlock_irqrestore(&ieee->lock, flags); |
||
12089 | up(&ieee->scan_sem); |
||
12090 | } |
||
12091 | |||
12092 | -void ieee80211_stop_scan(struct ieee80211_device *ieee) |
||
12093 | +void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee) |
||
12094 | { |
||
12095 | if (ieee->softmac_features & IEEE_SOFTMAC_SCAN) |
||
12096 | - ieee80211_softmac_stop_scan(ieee); |
||
12097 | + ieee80211_softmac_stop_scan_rtl7(ieee); |
||
12098 | else |
||
12099 | ieee->stop_scan(ieee->dev); |
||
12100 | } |
||
12101 | |||
12102 | /* called with ieee->lock held */ |
||
12103 | -void ieee80211_start_scan(struct ieee80211_device *ieee) |
||
12104 | +void ieee80211_start_scan_rtl7(struct ieee80211_device *ieee) |
||
12105 | { |
||
12106 | - if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){ |
||
12107 | + if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){ |
||
12108 | if (ieee->scanning == 0){ |
||
12109 | ieee->scanning = 1; |
||
12110 | //ieee80211_softmac_scan(ieee); |
||
12111 | - queue_work(ieee->wq, &ieee->softmac_scan_wq); |
||
12112 | + queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0); |
||
12113 | } |
||
12114 | }else |
||
12115 | ieee->start_scan(ieee->dev); |
||
12116 | - |
||
12117 | + |
||
12118 | } |
||
12119 | |||
12120 | /* called with wx_sem held */ |
||
12121 | -void ieee80211_start_scan_syncro(struct ieee80211_device *ieee) |
||
12122 | +void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee) |
||
12123 | { |
||
12124 | ieee->sync_scan_hurryup = 0; |
||
12125 | - |
||
12126 | + |
||
12127 | if (ieee->softmac_features & IEEE_SOFTMAC_SCAN) |
||
12128 | - ieee80211_softmac_scan_syncro(ieee); |
||
12129 | + ieee80211_softmac_scan_syncro_rtl7(ieee); |
||
12130 | else |
||
12131 | ieee->scan_syncro(ieee->dev); |
||
12132 | - |
||
12133 | + |
||
12134 | } |
||
12135 | |||
12136 | -inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon, |
||
12137 | +inline struct sk_buff *ieee80211_authentication_req_rtl7(struct ieee80211_network *beacon, |
||
12138 | struct ieee80211_device *ieee, int challengelen) |
||
12139 | { |
||
12140 | - struct sk_buff *skb; |
||
12141 | + struct sk_buff *skb; |
||
12142 | struct ieee80211_authentication *auth; |
||
12143 | - |
||
12144 | - skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen); |
||
12145 | - |
||
12146 | + |
||
12147 | + skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen); |
||
12148 | + |
||
12149 | if (!skb) return NULL; |
||
12150 | - |
||
12151 | + |
||
12152 | auth = (struct ieee80211_authentication *) |
||
12153 | skb_put(skb, sizeof(struct ieee80211_authentication)); |
||
12154 | - |
||
12155 | + |
||
12156 | auth->header.frame_ctl = IEEE80211_STYPE_AUTH; |
||
12157 | if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP; |
||
12158 | - |
||
12159 | + |
||
12160 | auth->header.duration_id = 0x013a; //FIXME |
||
12161 | - |
||
12162 | + |
||
12163 | memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN); |
||
12164 | memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN); |
||
12165 | memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN); |
||
12166 | - |
||
12167 | + |
||
12168 | auth->algorithm = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY; |
||
12169 | - |
||
12170 | + |
||
12171 | auth->transaction = cpu_to_le16(ieee->associate_seq); |
||
12172 | ieee->associate_seq++; |
||
12173 | - |
||
12174 | + |
||
12175 | auth->status = cpu_to_le16(WLAN_STATUS_SUCCESS); |
||
12176 | - |
||
12177 | + |
||
12178 | return skb; |
||
12179 | - |
||
12180 | + |
||
12181 | } |
||
12182 | |||
12183 | -static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest) |
||
12184 | +static struct sk_buff* ieee80211_probe_resp_rtl7(struct ieee80211_device *ieee, u8 *dest) |
||
12185 | { |
||
12186 | u8 *tag; |
||
12187 | int beacon_size; |
||
12188 | @@ -566,23 +572,23 @@ |
||
12189 | int encrypt; |
||
12190 | int atim_len,erp_len; |
||
12191 | struct ieee80211_crypt_data* crypt; |
||
12192 | - |
||
12193 | + |
||
12194 | char *ssid = ieee->current_network.ssid; |
||
12195 | int ssid_len = ieee->current_network.ssid_len; |
||
12196 | int rate_len = ieee->current_network.rates_len+2; |
||
12197 | int rate_ex_len = ieee->current_network.rates_ex_len; |
||
12198 | if(rate_ex_len > 0) rate_ex_len+=2; |
||
12199 | - |
||
12200 | + |
||
12201 | if(ieee->current_network.capability & WLAN_CAPABILITY_IBSS) |
||
12202 | atim_len = 4; |
||
12203 | else |
||
12204 | atim_len = 0; |
||
12205 | - |
||
12206 | - if(ieee80211_is_54g(ieee->current_network)) |
||
12207 | + |
||
12208 | + if(ieee80211_is_54g_rtl7(ieee->current_network)) |
||
12209 | erp_len = 3; |
||
12210 | else |
||
12211 | erp_len = 0; |
||
12212 | - |
||
12213 | + |
||
12214 | beacon_size = sizeof(struct ieee80211_probe_response)+ |
||
12215 | ssid_len |
||
12216 | +3 //channel |
||
12217 | @@ -590,72 +596,72 @@ |
||
12218 | +rate_ex_len |
||
12219 | +atim_len |
||
12220 | +erp_len; |
||
12221 | - |
||
12222 | + |
||
12223 | skb = dev_alloc_skb(beacon_size); |
||
12224 | - |
||
12225 | - if (!skb) |
||
12226 | + |
||
12227 | + if (!skb) |
||
12228 | return NULL; |
||
12229 | - |
||
12230 | + |
||
12231 | beacon_buf = (struct ieee80211_probe_response*) skb_put(skb, beacon_size); |
||
12232 | - |
||
12233 | + |
||
12234 | memcpy (beacon_buf->header.addr1, dest,ETH_ALEN); |
||
12235 | memcpy (beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN); |
||
12236 | memcpy (beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN); |
||
12237 | |||
12238 | beacon_buf->header.duration_id = 0; //FIXME |
||
12239 | - beacon_buf->beacon_interval = |
||
12240 | + beacon_buf->beacon_interval = |
||
12241 | cpu_to_le16(ieee->current_network.beacon_interval); |
||
12242 | - beacon_buf->capability = |
||
12243 | + beacon_buf->capability = |
||
12244 | cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_IBSS); |
||
12245 | - |
||
12246 | + |
||
12247 | if(ieee->short_slot && (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_SLOT)) |
||
12248 | - cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT)); |
||
12249 | - |
||
12250 | + cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT)); |
||
12251 | + |
||
12252 | crypt = ieee->crypt[ieee->tx_keyidx]; |
||
12253 | |||
12254 | - encrypt = ieee->host_encrypt && crypt && crypt->ops && |
||
12255 | + encrypt = ieee->host_encrypt && crypt && crypt->ops && |
||
12256 | (0 == strcmp(crypt->ops->name, "WEP")); |
||
12257 | |||
12258 | - if (encrypt) |
||
12259 | + if (encrypt) |
||
12260 | beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); |
||
12261 | - |
||
12262 | - |
||
12263 | + |
||
12264 | + |
||
12265 | beacon_buf->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_RESP); |
||
12266 | - |
||
12267 | - beacon_buf->info_element.id = MFIE_TYPE_SSID; |
||
12268 | + |
||
12269 | + beacon_buf->info_element.id = MFIE_TYPE_SSID; |
||
12270 | beacon_buf->info_element.len = ssid_len; |
||
12271 | - |
||
12272 | + |
||
12273 | tag = (u8*) beacon_buf->info_element.data; |
||
12274 | - |
||
12275 | + |
||
12276 | memcpy(tag, ssid, ssid_len); |
||
12277 | - |
||
12278 | + |
||
12279 | tag += ssid_len; |
||
12280 | - |
||
12281 | + |
||
12282 | *(tag++) = MFIE_TYPE_RATES; |
||
12283 | - *(tag++) = rate_len-2; |
||
12284 | + *(tag++) = rate_len-2; |
||
12285 | memcpy(tag,ieee->current_network.rates,rate_len-2); |
||
12286 | tag+=rate_len-2; |
||
12287 | - |
||
12288 | + |
||
12289 | *(tag++) = MFIE_TYPE_DS_SET; |
||
12290 | *(tag++) = 1; |
||
12291 | *(tag++) = ieee->current_network.channel; |
||
12292 | - |
||
12293 | + |
||
12294 | if(atim_len){ |
||
12295 | *(tag++) = MFIE_TYPE_IBSS_SET; |
||
12296 | *(tag++) = 2; |
||
12297 | *((u16*)(tag)) = cpu_to_le16(ieee->current_network.atim_window); |
||
12298 | tag+=2; |
||
12299 | } |
||
12300 | - |
||
12301 | + |
||
12302 | if(erp_len){ |
||
12303 | *(tag++) = MFIE_TYPE_ERP; |
||
12304 | *(tag++) = 1; |
||
12305 | - *(tag++) = 0; |
||
12306 | + *(tag++) = 0; |
||
12307 | } |
||
12308 | - |
||
12309 | + |
||
12310 | if(rate_ex_len){ |
||
12311 | *(tag++) = MFIE_TYPE_RATES_EX; |
||
12312 | - *(tag++) = rate_ex_len-2; |
||
12313 | + *(tag++) = rate_ex_len-2; |
||
12314 | memcpy(tag,ieee->current_network.rates_ex,rate_ex_len-2); |
||
12315 | tag+=rate_ex_len-2; |
||
12316 | } |
||
12317 | @@ -664,208 +670,211 @@ |
||
12318 | } |
||
12319 | |||
12320 | |||
12321 | -struct sk_buff* ieee80211_assoc_resp(struct ieee80211_device *ieee, u8 *dest) |
||
12322 | +struct sk_buff* ieee80211_assoc_resp_rtl7(struct ieee80211_device *ieee, u8 *dest) |
||
12323 | { |
||
12324 | struct sk_buff *skb; |
||
12325 | u8* tag; |
||
12326 | - |
||
12327 | + |
||
12328 | struct ieee80211_crypt_data* crypt; |
||
12329 | struct ieee80211_assoc_response_frame *assoc; |
||
12330 | short encrypt; |
||
12331 | - |
||
12332 | - unsigned int rate_len = ieee80211_MFIE_rate_len(ieee); |
||
12333 | + |
||
12334 | + unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee); |
||
12335 | int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len; |
||
12336 | - |
||
12337 | - skb = dev_alloc_skb(len); |
||
12338 | - |
||
12339 | - if (!skb) |
||
12340 | + |
||
12341 | + skb = dev_alloc_skb(len); |
||
12342 | + |
||
12343 | + if (!skb) |
||
12344 | return NULL; |
||
12345 | - |
||
12346 | + |
||
12347 | assoc = (struct ieee80211_assoc_response_frame *) |
||
12348 | skb_put(skb,sizeof(struct ieee80211_assoc_response_frame)); |
||
12349 | - |
||
12350 | + |
||
12351 | assoc->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP); |
||
12352 | memcpy(assoc->header.addr1, dest,ETH_ALEN); |
||
12353 | memcpy(assoc->header.addr3, ieee->dev->dev_addr, ETH_ALEN); |
||
12354 | memcpy(assoc->header.addr2, ieee->dev->dev_addr, ETH_ALEN); |
||
12355 | - assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ? |
||
12356 | + assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ? |
||
12357 | WLAN_CAPABILITY_BSS : WLAN_CAPABILITY_IBSS); |
||
12358 | - |
||
12359 | - |
||
12360 | + |
||
12361 | + |
||
12362 | if(ieee->short_slot) |
||
12363 | assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT); |
||
12364 | - |
||
12365 | + |
||
12366 | if (ieee->host_encrypt) |
||
12367 | crypt = ieee->crypt[ieee->tx_keyidx]; |
||
12368 | else crypt = NULL; |
||
12369 | - |
||
12370 | + |
||
12371 | encrypt = ( crypt && crypt->ops); |
||
12372 | - |
||
12373 | + |
||
12374 | if (encrypt) |
||
12375 | assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); |
||
12376 | - |
||
12377 | + |
||
12378 | assoc->status = 0; |
||
12379 | assoc->aid = cpu_to_le16(ieee->assoc_id); |
||
12380 | if (ieee->assoc_id == 0x2007) ieee->assoc_id=0; |
||
12381 | else ieee->assoc_id++; |
||
12382 | - |
||
12383 | + |
||
12384 | tag = (u8*) skb_put(skb, rate_len); |
||
12385 | - |
||
12386 | - ieee80211_MFIE_Brate(ieee, &tag); |
||
12387 | - ieee80211_MFIE_Grate(ieee, &tag); |
||
12388 | - |
||
12389 | + |
||
12390 | + ieee80211_MFIE_Brate_rtl7(ieee, &tag); |
||
12391 | + ieee80211_MFIE_Grate_rtl7(ieee, &tag); |
||
12392 | + |
||
12393 | return skb; |
||
12394 | } |
||
12395 | |||
12396 | -struct sk_buff* ieee80211_auth_resp(struct ieee80211_device *ieee,int status, u8 *dest) |
||
12397 | +struct sk_buff* ieee80211_auth_resp_rtl7(struct ieee80211_device *ieee,int status, u8 *dest) |
||
12398 | { |
||
12399 | struct sk_buff *skb; |
||
12400 | struct ieee80211_authentication *auth; |
||
12401 | - |
||
12402 | - skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1); |
||
12403 | - |
||
12404 | - if (!skb) |
||
12405 | + |
||
12406 | + skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1); |
||
12407 | + |
||
12408 | + if (!skb) |
||
12409 | return NULL; |
||
12410 | - |
||
12411 | + |
||
12412 | skb->len = sizeof(struct ieee80211_authentication); |
||
12413 | - |
||
12414 | + |
||
12415 | auth = (struct ieee80211_authentication *)skb->data; |
||
12416 | - |
||
12417 | + |
||
12418 | auth->status = cpu_to_le16(status); |
||
12419 | auth->transaction = cpu_to_le16(2); |
||
12420 | auth->algorithm = cpu_to_le16(WLAN_AUTH_OPEN); |
||
12421 | - |
||
12422 | + |
||
12423 | memcpy(auth->header.addr3, ieee->dev->dev_addr, ETH_ALEN); |
||
12424 | memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN); |
||
12425 | memcpy(auth->header.addr1, dest, ETH_ALEN); |
||
12426 | - auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH); |
||
12427 | + auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH); |
||
12428 | return skb; |
||
12429 | - |
||
12430 | - |
||
12431 | + |
||
12432 | + |
||
12433 | } |
||
12434 | |||
12435 | -struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr) |
||
12436 | +struct sk_buff* ieee80211_null_func_rtl7(struct ieee80211_device *ieee,short pwr) |
||
12437 | { |
||
12438 | struct sk_buff *skb; |
||
12439 | struct ieee80211_hdr_3addr* hdr; |
||
12440 | - |
||
12441 | - skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr)); |
||
12442 | - |
||
12443 | - if (!skb) |
||
12444 | + |
||
12445 | + skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr)); |
||
12446 | + |
||
12447 | + if (!skb) |
||
12448 | return NULL; |
||
12449 | - |
||
12450 | + |
||
12451 | hdr = (struct ieee80211_hdr_3addr*)skb_put(skb,sizeof(struct ieee80211_hdr_3addr)); |
||
12452 | - |
||
12453 | + |
||
12454 | memcpy(hdr->addr1, ieee->current_network.bssid, ETH_ALEN); |
||
12455 | memcpy(hdr->addr2, ieee->dev->dev_addr, ETH_ALEN); |
||
12456 | memcpy(hdr->addr3, ieee->current_network.bssid, ETH_ALEN); |
||
12457 | - |
||
12458 | - hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA | |
||
12459 | - IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS | |
||
12460 | - (pwr ? IEEE80211_FCTL_PM:0)); |
||
12461 | - |
||
12462 | + |
||
12463 | + hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA | |
||
12464 | + IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS | |
||
12465 | + (pwr ? IEEE80211_FCTL_PM:0)); |
||
12466 | + |
||
12467 | return skb; |
||
12468 | - |
||
12469 | - |
||
12470 | + |
||
12471 | + |
||
12472 | } |
||
12473 | |||
12474 | |||
12475 | -void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest) |
||
12476 | +void ieee80211_resp_to_assoc_rq_rtl7(struct ieee80211_device *ieee, u8* dest) |
||
12477 | { |
||
12478 | - struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest); |
||
12479 | - |
||
12480 | + struct sk_buff *buf = ieee80211_assoc_resp_rtl7(ieee, dest); |
||
12481 | + |
||
12482 | if (buf) |
||
12483 | - softmac_mgmt_xmit(buf, ieee); |
||
12484 | + softmac_mgmt_xmit_rtl7(buf, ieee); |
||
12485 | } |
||
12486 | |||
12487 | |||
12488 | -void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest) |
||
12489 | +void ieee80211_resp_to_auth_rtl7(struct ieee80211_device *ieee, int s, u8* dest) |
||
12490 | { |
||
12491 | - struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest); |
||
12492 | - |
||
12493 | + struct sk_buff *buf = ieee80211_auth_resp_rtl7(ieee, s, dest); |
||
12494 | + |
||
12495 | if (buf) |
||
12496 | - softmac_mgmt_xmit(buf, ieee); |
||
12497 | + softmac_mgmt_xmit_rtl7(buf, ieee); |
||
12498 | } |
||
12499 | |||
12500 | |||
12501 | -void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest) |
||
12502 | +void ieee80211_resp_to_probe_rtl7(struct ieee80211_device *ieee, u8 *dest) |
||
12503 | { |
||
12504 | - |
||
12505 | - struct sk_buff *buf = ieee80211_probe_resp(ieee, dest); |
||
12506 | - |
||
12507 | - if (buf) |
||
12508 | - softmac_mgmt_xmit(buf, ieee); |
||
12509 | + |
||
12510 | + struct sk_buff *buf = ieee80211_probe_resp_rtl7(ieee, dest); |
||
12511 | + |
||
12512 | + if (buf) |
||
12513 | + softmac_mgmt_xmit_rtl7(buf, ieee); |
||
12514 | } |
||
12515 | |||
12516 | |||
12517 | -inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee) |
||
12518 | +inline struct sk_buff *ieee80211_association_req_rtl7(struct ieee80211_network *beacon,struct ieee80211_device *ieee) |
||
12519 | { |
||
12520 | struct sk_buff *skb; |
||
12521 | - |
||
12522 | + |
||
12523 | struct ieee80211_assoc_request_frame *hdr; |
||
12524 | u8 *tag; |
||
12525 | - |
||
12526 | + |
||
12527 | unsigned int wpa_len = beacon->wpa_ie_len; |
||
12528 | - |
||
12529 | - unsigned int rate_len = ieee80211_MFIE_rate_len(ieee); |
||
12530 | - |
||
12531 | - |
||
12532 | - |
||
12533 | + |
||
12534 | + unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee); |
||
12535 | + |
||
12536 | + |
||
12537 | + |
||
12538 | int len=sizeof(struct ieee80211_assoc_request_frame)+ |
||
12539 | + beacon->ssid_len//essid tagged val |
||
12540 | + rate_len//rates tagged val |
||
12541 | + wpa_len; |
||
12542 | - |
||
12543 | + |
||
12544 | skb = dev_alloc_skb(len); |
||
12545 | - |
||
12546 | - if (!skb) |
||
12547 | + |
||
12548 | + if (!skb) |
||
12549 | return NULL; |
||
12550 | - |
||
12551 | + |
||
12552 | hdr = (struct ieee80211_assoc_request_frame *) |
||
12553 | skb_put(skb, sizeof(struct ieee80211_assoc_request_frame)); |
||
12554 | - |
||
12555 | - |
||
12556 | + |
||
12557 | + |
||
12558 | hdr->header.frame_ctl = IEEE80211_STYPE_ASSOC_REQ; |
||
12559 | hdr->header.duration_id= 37; //FIXME |
||
12560 | memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN); |
||
12561 | memcpy(hdr->header.addr2, ieee->dev->dev_addr, ETH_ALEN); |
||
12562 | memcpy(hdr->header.addr3, beacon->bssid, ETH_ALEN); |
||
12563 | - |
||
12564 | + |
||
12565 | hdr->capability = cpu_to_le16(WLAN_CAPABILITY_BSS); |
||
12566 | - if (beacon->capability & WLAN_CAPABILITY_PRIVACY ) |
||
12567 | + if (beacon->capability & WLAN_CAPABILITY_PRIVACY ) |
||
12568 | hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); |
||
12569 | - |
||
12570 | + |
||
12571 | if(ieee->short_slot) |
||
12572 | hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT); |
||
12573 | - |
||
12574 | + |
||
12575 | + if(beacon->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) |
||
12576 | + hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_PREAMBLE); |
||
12577 | + |
||
12578 | hdr->listen_interval = 0xa; //FIXME |
||
12579 | - |
||
12580 | + |
||
12581 | hdr->info_element.id = MFIE_TYPE_SSID; |
||
12582 | |||
12583 | hdr->info_element.len = beacon->ssid_len; |
||
12584 | tag = skb_put(skb, beacon->ssid_len); |
||
12585 | memcpy(tag, beacon->ssid, beacon->ssid_len); |
||
12586 | - |
||
12587 | - tag = skb_put(skb, rate_len); |
||
12588 | - |
||
12589 | - ieee80211_MFIE_Brate(ieee, &tag); |
||
12590 | - ieee80211_MFIE_Grate(ieee, &tag); |
||
12591 | - |
||
12592 | + |
||
12593 | + tag = skb_put(skb, rate_len); |
||
12594 | + |
||
12595 | + ieee80211_MFIE_Brate_rtl7(ieee, &tag); |
||
12596 | + ieee80211_MFIE_Grate_rtl7(ieee, &tag); |
||
12597 | + |
||
12598 | tag = skb_put(skb,wpa_len); |
||
12599 | - |
||
12600 | + |
||
12601 | memcpy(tag,beacon->wpa_ie,wpa_len); |
||
12602 | - |
||
12603 | + |
||
12604 | return skb; |
||
12605 | } |
||
12606 | |||
12607 | -void ieee80211_associate_abort(struct ieee80211_device *ieee) |
||
12608 | +void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee) |
||
12609 | { |
||
12610 | - |
||
12611 | + |
||
12612 | unsigned long flags; |
||
12613 | spin_lock_irqsave(&ieee->lock, flags); |
||
12614 | - |
||
12615 | + |
||
12616 | ieee->associate_seq++; |
||
12617 | - |
||
12618 | + |
||
12619 | /* don't scan, and avoid to have the RX path possibily |
||
12620 | * try again to associate. Even do not react to AUTH or |
||
12621 | * ASSOC response. Just wait for the retry wq to be scheduled. |
||
12622 | @@ -873,166 +882,181 @@ |
||
12623 | * with, so we retry or just get back to NO_LINK and scanning |
||
12624 | */ |
||
12625 | if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING){ |
||
12626 | - IEEE80211_DEBUG_MGMT("Authentication failed\n"); |
||
12627 | + IEEE80211_DEBUG_MGMT("Authentication failed\n"); |
||
12628 | ieee->softmac_stats.no_auth_rs++; |
||
12629 | }else{ |
||
12630 | - IEEE80211_DEBUG_MGMT("Association failed\n"); |
||
12631 | + IEEE80211_DEBUG_MGMT("Association failed\n"); |
||
12632 | ieee->softmac_stats.no_ass_rs++; |
||
12633 | } |
||
12634 | - |
||
12635 | + |
||
12636 | ieee->state = IEEE80211_ASSOCIATING_RETRY; |
||
12637 | - |
||
12638 | + |
||
12639 | queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, IEEE80211_SOFTMAC_ASSOC_RETRY_TIME); |
||
12640 | - |
||
12641 | + |
||
12642 | spin_unlock_irqrestore(&ieee->lock, flags); |
||
12643 | } |
||
12644 | |||
12645 | -void ieee80211_associate_abort_cb(unsigned long dev) |
||
12646 | +void ieee80211_associate_abort_cb_rtl7(unsigned long dev) |
||
12647 | { |
||
12648 | - ieee80211_associate_abort((struct ieee80211_device *) dev); |
||
12649 | + ieee80211_associate_abort_rtl7((struct ieee80211_device *) dev); |
||
12650 | } |
||
12651 | |||
12652 | |||
12653 | -void ieee80211_associate_step1(struct ieee80211_device *ieee) |
||
12654 | +void ieee80211_associate_step1_rtl7(struct ieee80211_device *ieee) |
||
12655 | { |
||
12656 | struct ieee80211_network *beacon = &ieee->current_network; |
||
12657 | struct sk_buff *skb; |
||
12658 | - |
||
12659 | + |
||
12660 | IEEE80211_DEBUG_MGMT("Stopping scan\n"); |
||
12661 | - |
||
12662 | + |
||
12663 | ieee->softmac_stats.tx_auth_rq++; |
||
12664 | - skb=ieee80211_authentication_req(beacon, ieee, 0); |
||
12665 | - |
||
12666 | - if (!skb) |
||
12667 | - ieee80211_associate_abort(ieee); |
||
12668 | - else{ |
||
12669 | + skb=ieee80211_authentication_req_rtl7(beacon, ieee, 0); |
||
12670 | + |
||
12671 | + if (!skb) |
||
12672 | + ieee80211_associate_abort_rtl7(ieee); |
||
12673 | + else{ |
||
12674 | ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ; |
||
12675 | IEEE80211_DEBUG_MGMT("Sending authentication request\n"); |
||
12676 | - softmac_mgmt_xmit(skb, ieee); |
||
12677 | + softmac_mgmt_xmit_rtl7(skb, ieee); |
||
12678 | ieee->associate_timer.expires = jiffies + (HZ / 2); |
||
12679 | add_timer(&ieee->associate_timer); |
||
12680 | - } |
||
12681 | + } |
||
12682 | } |
||
12683 | |||
12684 | -void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen) |
||
12685 | +void ieee80211_auth_challenge_rtl7(struct ieee80211_device *ieee, u8 *challenge, int chlen) |
||
12686 | { |
||
12687 | - u8 *c; |
||
12688 | + u8 *c; |
||
12689 | struct sk_buff *skb; |
||
12690 | struct ieee80211_network *beacon = &ieee->current_network; |
||
12691 | // int hlen = sizeof(struct ieee80211_authentication); |
||
12692 | - |
||
12693 | + |
||
12694 | ieee->associate_seq++; |
||
12695 | ieee->softmac_stats.tx_auth_rq++; |
||
12696 | - |
||
12697 | - skb = ieee80211_authentication_req(beacon, ieee, chlen+2); |
||
12698 | - if (!skb) |
||
12699 | - ieee80211_associate_abort(ieee); |
||
12700 | + |
||
12701 | + skb = ieee80211_authentication_req_rtl7(beacon, ieee, chlen+2); |
||
12702 | + if (!skb) |
||
12703 | + ieee80211_associate_abort_rtl7(ieee); |
||
12704 | else{ |
||
12705 | c = skb_put(skb, chlen+2); |
||
12706 | *(c++) = MFIE_TYPE_CHALLENGE; |
||
12707 | *(c++) = chlen; |
||
12708 | memcpy(c, challenge, chlen); |
||
12709 | - |
||
12710 | + |
||
12711 | IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n"); |
||
12712 | - |
||
12713 | - ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr )); |
||
12714 | - |
||
12715 | - softmac_mgmt_xmit(skb, ieee); |
||
12716 | + |
||
12717 | + ieee80211_encrypt_fragment_rtl7(ieee, skb, sizeof(struct ieee80211_hdr_3addr )); |
||
12718 | + |
||
12719 | + softmac_mgmt_xmit_rtl7(skb, ieee); |
||
12720 | ieee->associate_timer.expires = jiffies + (HZ / 2); |
||
12721 | add_timer(&ieee->associate_timer); |
||
12722 | - } |
||
12723 | + } |
||
12724 | kfree(challenge); |
||
12725 | } |
||
12726 | |||
12727 | -void ieee80211_associate_step2(struct ieee80211_device *ieee) |
||
12728 | +void ieee80211_associate_step2_rtl7(struct ieee80211_device *ieee) |
||
12729 | { |
||
12730 | struct sk_buff* skb; |
||
12731 | struct ieee80211_network *beacon = &ieee->current_network; |
||
12732 | - |
||
12733 | + |
||
12734 | del_timer_sync(&ieee->associate_timer); |
||
12735 | - |
||
12736 | + |
||
12737 | IEEE80211_DEBUG_MGMT("Sending association request\n"); |
||
12738 | - |
||
12739 | + |
||
12740 | ieee->softmac_stats.tx_ass_rq++; |
||
12741 | - skb=ieee80211_association_req(beacon, ieee); |
||
12742 | - if (!skb) |
||
12743 | - ieee80211_associate_abort(ieee); |
||
12744 | + skb=ieee80211_association_req_rtl7(beacon, ieee); |
||
12745 | + if (!skb) |
||
12746 | + ieee80211_associate_abort_rtl7(ieee); |
||
12747 | else{ |
||
12748 | - softmac_mgmt_xmit(skb, ieee); |
||
12749 | + softmac_mgmt_xmit_rtl7(skb, ieee); |
||
12750 | ieee->associate_timer.expires = jiffies + (HZ / 2); |
||
12751 | add_timer(&ieee->associate_timer); |
||
12752 | - } |
||
12753 | + } |
||
12754 | } |
||
12755 | |||
12756 | -void ieee80211_associate_complete_wq(struct ieee80211_device *ieee) |
||
12757 | +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) |
||
12758 | +void ieee80211_associate_complete_wq_rtl7(struct work_struct *work) |
||
12759 | +{ |
||
12760 | + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq); |
||
12761 | +#else |
||
12762 | +void ieee80211_associate_complete_wq_rtl7(struct ieee80211_device *ieee) |
||
12763 | { |
||
12764 | +#endif |
||
12765 | printk(KERN_INFO "Associated successfully\n"); |
||
12766 | - if(ieee80211_is_54g(ieee->current_network) && |
||
12767 | +#if 0 |
||
12768 | + if(ieee80211_is_54g_rtl7(ieee->current_network) && |
||
12769 | (ieee->modulation & IEEE80211_OFDM_MODULATION)){ |
||
12770 | - |
||
12771 | + |
||
12772 | ieee->rate = 540; |
||
12773 | printk(KERN_INFO"Using G rates\n"); |
||
12774 | }else{ |
||
12775 | ieee->rate = 110; |
||
12776 | printk(KERN_INFO"Using B rates\n"); |
||
12777 | } |
||
12778 | +#else |
||
12779 | + printk(KERN_INFO"Using %d MBit\n", (ieee->rate/10) ); |
||
12780 | +#endif |
||
12781 | ieee->link_change(ieee->dev); |
||
12782 | - notify_wx_assoc_event(ieee); |
||
12783 | + notify_wx_assoc_event_rtl7(ieee); |
||
12784 | if (ieee->data_hard_resume) |
||
12785 | ieee->data_hard_resume(ieee->dev); |
||
12786 | netif_carrier_on(ieee->dev); |
||
12787 | } |
||
12788 | |||
12789 | -void ieee80211_associate_complete(struct ieee80211_device *ieee) |
||
12790 | +void ieee80211_associate_complete_rtl7(struct ieee80211_device *ieee) |
||
12791 | { |
||
12792 | |||
12793 | del_timer_sync(&ieee->associate_timer); |
||
12794 | - |
||
12795 | + |
||
12796 | ieee->seq_ctrl = 0; |
||
12797 | ieee->state = IEEE80211_LINKED; |
||
12798 | IEEE80211_DEBUG_MGMT("Successfully associated\n"); |
||
12799 | - |
||
12800 | + |
||
12801 | queue_work(ieee->wq, &ieee->associate_complete_wq); |
||
12802 | } |
||
12803 | |||
12804 | -void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee) |
||
12805 | +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) |
||
12806 | +void ieee80211_associate_procedure_wq_rtl7(struct work_struct *work) |
||
12807 | { |
||
12808 | + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq); |
||
12809 | +#else |
||
12810 | +void ieee80211_associate_procedure_wq_rtl7(struct ieee80211_device *ieee) |
||
12811 | +{ |
||
12812 | +#endif |
||
12813 | ieee->sync_scan_hurryup = 1; |
||
12814 | down(&ieee->wx_sem); |
||
12815 | - |
||
12816 | if (ieee->data_hard_stop) |
||
12817 | ieee->data_hard_stop(ieee->dev); |
||
12818 | - |
||
12819 | - ieee80211_stop_scan(ieee); |
||
12820 | + |
||
12821 | + ieee80211_stop_scan_rtl7(ieee); |
||
12822 | ieee->set_chan(ieee->dev, ieee->current_network.channel); |
||
12823 | - |
||
12824 | + |
||
12825 | ieee->associate_seq = 1; |
||
12826 | - ieee80211_associate_step1(ieee); |
||
12827 | - |
||
12828 | + ieee80211_associate_step1_rtl7(ieee); |
||
12829 | + |
||
12830 | up(&ieee->wx_sem); |
||
12831 | } |
||
12832 | |||
12833 | -inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net) |
||
12834 | +inline void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net) |
||
12835 | { |
||
12836 | - |
||
12837 | + |
||
12838 | u8 tmp_ssid[IW_ESSID_MAX_SIZE+1]; |
||
12839 | int tmp_ssid_len = 0; |
||
12840 | - |
||
12841 | + |
||
12842 | short apset,ssidset,ssidbroad,apmatch,ssidmatch; |
||
12843 | - |
||
12844 | - /* we are interested in new new only if we are not associated |
||
12845 | + |
||
12846 | + /* we are interested in new new only if we are not associated |
||
12847 | * and we are not associating / authenticating |
||
12848 | */ |
||
12849 | if (ieee->state != IEEE80211_NOLINK) |
||
12850 | - return; |
||
12851 | - |
||
12852 | + return; |
||
12853 | + |
||
12854 | if ((ieee->iw_mode == IW_MODE_INFRA) && !(net->capability & WLAN_CAPABILITY_BSS)) |
||
12855 | return; |
||
12856 | - |
||
12857 | + |
||
12858 | if ((ieee->iw_mode == IW_MODE_ADHOC) && !(net->capability & WLAN_CAPABILITY_IBSS)) |
||
12859 | return; |
||
12860 | |||
12861 | - |
||
12862 | + |
||
12863 | if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC){ |
||
12864 | /* if the user specified the AP MAC, we need also the essid |
||
12865 | * This could be obtained by beacons or, if the network does not |
||
12866 | @@ -1043,23 +1067,23 @@ |
||
12867 | ssidbroad = !(net->ssid_len == 0 || net->ssid[0]== '\0'); |
||
12868 | apmatch = (memcmp(ieee->current_network.bssid, net->bssid, ETH_ALEN)==0); |
||
12869 | ssidmatch = (0==strncmp(ieee->current_network.ssid, net->ssid, net->ssid_len)); |
||
12870 | - |
||
12871 | - |
||
12872 | - |
||
12873 | + |
||
12874 | + |
||
12875 | + |
||
12876 | if ( /* if the user set the AP check if match. |
||
12877 | * if the network does not broadcast essid we check the user supplyed ANY essid |
||
12878 | * if the network does broadcast and the user does not set essid it is OK |
||
12879 | * if the network does broadcast and the user did set essid chech if essid match |
||
12880 | */ |
||
12881 | - ( apset && apmatch && |
||
12882 | - ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) || |
||
12883 | + ( apset && apmatch && |
||
12884 | + ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) || |
||
12885 | /* if the ap is not set, check that the user set the bssid |
||
12886 | * and the network does bradcast and that those two bssid matches |
||
12887 | - */ |
||
12888 | - (!apset && ssidset && ssidbroad && ssidmatch) |
||
12889 | + */ |
||
12890 | + (!apset && ssidset && ssidbroad && ssidmatch) |
||
12891 | ){ |
||
12892 | - |
||
12893 | - |
||
12894 | + |
||
12895 | + |
||
12896 | /* if the essid is hidden replace it with the |
||
12897 | * essid provided by the user. |
||
12898 | */ |
||
12899 | @@ -1068,18 +1092,19 @@ |
||
12900 | tmp_ssid_len = ieee->current_network.ssid_len; |
||
12901 | } |
||
12902 | memcpy(&ieee->current_network, net, sizeof(struct ieee80211_network)); |
||
12903 | - |
||
12904 | + |
||
12905 | if (!ssidbroad){ |
||
12906 | strncpy(ieee->current_network.ssid, tmp_ssid, IW_ESSID_MAX_SIZE); |
||
12907 | ieee->current_network.ssid_len = tmp_ssid_len; |
||
12908 | } |
||
12909 | - printk(KERN_INFO"Linking with %s\n",ieee->current_network.ssid); |
||
12910 | - |
||
12911 | + printk(KERN_INFO"Linking with \"%s\" rate: %d MBit\n",ieee->current_network.ssid, (ieee->rate/10)); |
||
12912 | + |
||
12913 | if (ieee->iw_mode == IW_MODE_INFRA){ |
||
12914 | ieee->state = IEEE80211_ASSOCIATING; |
||
12915 | queue_work(ieee->wq, &ieee->associate_procedure_wq); |
||
12916 | }else{ |
||
12917 | - if(ieee80211_is_54g(ieee->current_network) && |
||
12918 | +#if 0 |
||
12919 | + if(ieee80211_is_54g_rtl7(ieee->current_network) && |
||
12920 | (ieee->modulation & IEEE80211_OFDM_MODULATION)){ |
||
12921 | ieee->rate = 540; |
||
12922 | printk(KERN_INFO"Using G rates\n"); |
||
12923 | @@ -1087,44 +1112,45 @@ |
||
12924 | ieee->rate = 110; |
||
12925 | printk(KERN_INFO"Using B rates\n"); |
||
12926 | } |
||
12927 | +#else |
||
12928 | + printk(KERN_INFO"Using %d MBit\n", (ieee->rate/10) ); |
||
12929 | +#endif |
||
12930 | ieee->state = IEEE80211_LINKED; |
||
12931 | } |
||
12932 | - |
||
12933 | + |
||
12934 | } |
||
12935 | } |
||
12936 | - |
||
12937 | } |
||
12938 | |||
12939 | -void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee) |
||
12940 | +void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee) |
||
12941 | { |
||
12942 | - |
||
12943 | + |
||
12944 | unsigned long flags; |
||
12945 | struct ieee80211_network *target; |
||
12946 | - |
||
12947 | + |
||
12948 | spin_lock_irqsave(&ieee->lock, flags); |
||
12949 | - |
||
12950 | list_for_each_entry(target, &ieee->network_list, list) { |
||
12951 | - |
||
12952 | + |
||
12953 | /* if the state become different that NOLINK means |
||
12954 | * we had found what we are searching for |
||
12955 | */ |
||
12956 | - if (ieee->state != IEEE80211_NOLINK) |
||
12957 | + if (ieee->state != IEEE80211_NOLINK) |
||
12958 | break; |
||
12959 | - |
||
12960 | + |
||
12961 | //if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies)) |
||
12962 | - ieee80211_softmac_new_net(ieee, target); |
||
12963 | + ieee80211_softmac_new_net_rtl7(ieee, target); |
||
12964 | } |
||
12965 | - |
||
12966 | + |
||
12967 | spin_unlock_irqrestore(&ieee->lock, flags); |
||
12968 | - |
||
12969 | + |
||
12970 | } |
||
12971 | |||
12972 | |||
12973 | -static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen) |
||
12974 | +static inline u16 auth_parse_rtl7(struct sk_buff *skb, u8** challenge, int *chlen) |
||
12975 | { |
||
12976 | struct ieee80211_authentication *a; |
||
12977 | u8 *t; |
||
12978 | - if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){ |
||
12979 | + if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){ |
||
12980 | IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n",skb->len); |
||
12981 | return 0xcafe; |
||
12982 | } |
||
12983 | @@ -1132,58 +1158,58 @@ |
||
12984 | a = (struct ieee80211_authentication*) skb->data; |
||
12985 | if(skb->len > (sizeof(struct ieee80211_authentication) +3)){ |
||
12986 | t = skb->data + sizeof(struct ieee80211_authentication); |
||
12987 | - |
||
12988 | + |
||
12989 | if(*(t++) == MFIE_TYPE_CHALLENGE){ |
||
12990 | *chlen = *(t++); |
||
12991 | *challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC); |
||
12992 | memcpy(*challenge, t, *chlen); |
||
12993 | } |
||
12994 | } |
||
12995 | - |
||
12996 | + |
||
12997 | return cpu_to_le16(a->status); |
||
12998 | - |
||
12999 | + |
||
13000 | } |
||
13001 | |||
13002 | |||
13003 | -int auth_rq_parse(struct sk_buff *skb,u8* dest) |
||
13004 | +int auth_rq_parse_rtl7(struct sk_buff *skb,u8* dest) |
||
13005 | { |
||
13006 | struct ieee80211_authentication *a; |
||
13007 | - |
||
13008 | - if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){ |
||
13009 | - IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len); |
||
13010 | + |
||
13011 | + if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){ |
||
13012 | + IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len); |
||
13013 | return -1; |
||
13014 | } |
||
13015 | a = (struct ieee80211_authentication*) skb->data; |
||
13016 | - |
||
13017 | + |
||
13018 | memcpy(dest,a->header.addr2, ETH_ALEN); |
||
13019 | - |
||
13020 | - if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN) |
||
13021 | + |
||
13022 | + if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN) |
||
13023 | return WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG; |
||
13024 | - |
||
13025 | + |
||
13026 | return WLAN_STATUS_SUCCESS; |
||
13027 | } |
||
13028 | |||
13029 | -static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src) |
||
13030 | +static short probe_rq_parse_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src) |
||
13031 | { |
||
13032 | u8 *tag; |
||
13033 | u8 *skbend; |
||
13034 | u8 *ssid=NULL; |
||
13035 | u8 ssidlen = 0; |
||
13036 | - |
||
13037 | + |
||
13038 | struct ieee80211_hdr_3addr *header = |
||
13039 | (struct ieee80211_hdr_3addr *) skb->data; |
||
13040 | - |
||
13041 | - if (skb->len < sizeof (struct ieee80211_hdr_3addr )) |
||
13042 | + |
||
13043 | + if (skb->len < sizeof (struct ieee80211_hdr_3addr )) |
||
13044 | return -1; /* corrupted */ |
||
13045 | - |
||
13046 | + |
||
13047 | memcpy(src,header->addr2, ETH_ALEN); |
||
13048 | - |
||
13049 | + |
||
13050 | skbend = (u8*)skb->data + skb->len; |
||
13051 | - |
||
13052 | + |
||
13053 | tag = skb->data + sizeof (struct ieee80211_hdr_3addr ); |
||
13054 | - |
||
13055 | + |
||
13056 | while (tag+1 < skbend){ |
||
13057 | - if (*tag == 0){ |
||
13058 | + if (*tag == 0){ |
||
13059 | ssid = tag+2; |
||
13060 | ssidlen = *(tag+1); |
||
13061 | break; |
||
13062 | @@ -1192,88 +1218,88 @@ |
||
13063 | tag = tag + *(tag); /* point to the last data byte of the tag */ |
||
13064 | tag++; /* point to the next tag */ |
||
13065 | } |
||
13066 | - |
||
13067 | + |
||
13068 | //IEEE80211DMESG("Card MAC address is "MACSTR, MAC2STR(src)); |
||
13069 | if (ssidlen == 0) return 1; |
||
13070 | - |
||
13071 | + |
||
13072 | if (!ssid) return 1; /* ssid not found in tagged param */ |
||
13073 | return (!strncmp(ssid, ieee->current_network.ssid, ssidlen)); |
||
13074 | - |
||
13075 | + |
||
13076 | } |
||
13077 | |||
13078 | -int assoc_rq_parse(struct sk_buff *skb,u8* dest) |
||
13079 | +int assoc_rq_parse_rtl7(struct sk_buff *skb,u8* dest) |
||
13080 | { |
||
13081 | struct ieee80211_assoc_request_frame *a; |
||
13082 | - |
||
13083 | - if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) - |
||
13084 | - sizeof(struct ieee80211_info_element))) { |
||
13085 | - |
||
13086 | + |
||
13087 | + if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) - |
||
13088 | + sizeof(struct ieee80211_info_element))) { |
||
13089 | + |
||
13090 | IEEE80211_DEBUG_MGMT("invalid len in auth request:%d \n", skb->len); |
||
13091 | return -1; |
||
13092 | } |
||
13093 | - |
||
13094 | + |
||
13095 | a = (struct ieee80211_assoc_request_frame*) skb->data; |
||
13096 | - |
||
13097 | + |
||
13098 | memcpy(dest,a->header.addr2,ETH_ALEN); |
||
13099 | - |
||
13100 | + |
||
13101 | return 0; |
||
13102 | } |
||
13103 | |||
13104 | -static inline u16 assoc_parse(struct sk_buff *skb, int *aid) |
||
13105 | +static inline u16 assoc_parse_rtl7(struct sk_buff *skb, int *aid) |
||
13106 | { |
||
13107 | struct ieee80211_assoc_response_frame *a; |
||
13108 | - if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){ |
||
13109 | + if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){ |
||
13110 | IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len); |
||
13111 | return 0xcafe; |
||
13112 | } |
||
13113 | - |
||
13114 | + |
||
13115 | a = (struct ieee80211_assoc_response_frame*) skb->data; |
||
13116 | *aid = le16_to_cpu(a->aid) & 0x3fff; |
||
13117 | return le16_to_cpu(a->status); |
||
13118 | } |
||
13119 | |||
13120 | static inline void |
||
13121 | -ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb) |
||
13122 | +ieee80211_rx_probe_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb) |
||
13123 | { |
||
13124 | u8 dest[ETH_ALEN]; |
||
13125 | - |
||
13126 | + |
||
13127 | //IEEE80211DMESG("Rx probe"); |
||
13128 | ieee->softmac_stats.rx_probe_rq++; |
||
13129 | //DMESG("Dest is "MACSTR, MAC2STR(dest)); |
||
13130 | - if (probe_rq_parse(ieee, skb, dest)){ |
||
13131 | + if (probe_rq_parse_rtl7(ieee, skb, dest)){ |
||
13132 | //IEEE80211DMESG("Was for me!"); |
||
13133 | ieee->softmac_stats.tx_probe_rs++; |
||
13134 | - ieee80211_resp_to_probe(ieee, dest); |
||
13135 | + ieee80211_resp_to_probe_rtl7(ieee, dest); |
||
13136 | } |
||
13137 | } |
||
13138 | |||
13139 | static inline void |
||
13140 | -ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb) |
||
13141 | +ieee80211_rx_auth_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb) |
||
13142 | { |
||
13143 | u8 dest[ETH_ALEN]; |
||
13144 | int status; |
||
13145 | //IEEE80211DMESG("Rx probe"); |
||
13146 | ieee->softmac_stats.rx_auth_rq++; |
||
13147 | - |
||
13148 | - if ((status = auth_rq_parse(skb, dest))!= -1){ |
||
13149 | - ieee80211_resp_to_auth(ieee, status, dest); |
||
13150 | + |
||
13151 | + if ((status = auth_rq_parse_rtl7(skb, dest))!= -1){ |
||
13152 | + ieee80211_resp_to_auth_rtl7(ieee, status, dest); |
||
13153 | } |
||
13154 | //DMESG("Dest is "MACSTR, MAC2STR(dest)); |
||
13155 | - |
||
13156 | + |
||
13157 | } |
||
13158 | |||
13159 | static inline void |
||
13160 | -ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb) |
||
13161 | +ieee80211_rx_assoc_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb) |
||
13162 | { |
||
13163 | - |
||
13164 | + |
||
13165 | u8 dest[ETH_ALEN]; |
||
13166 | //unsigned long flags; |
||
13167 | - |
||
13168 | + |
||
13169 | ieee->softmac_stats.rx_ass_rq++; |
||
13170 | - if (assoc_rq_parse(skb,dest) != -1){ |
||
13171 | - ieee80211_resp_to_assoc_rq(ieee, dest); |
||
13172 | + if (assoc_rq_parse_rtl7(skb,dest) != -1){ |
||
13173 | + ieee80211_resp_to_assoc_rq_rtl7(ieee, dest); |
||
13174 | } |
||
13175 | - |
||
13176 | + |
||
13177 | printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest)); |
||
13178 | //FIXME |
||
13179 | #if 0 |
||
13180 | @@ -1285,25 +1311,25 @@ |
||
13181 | |||
13182 | |||
13183 | |||
13184 | -void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr) |
||
13185 | +void ieee80211_sta_ps_send_null_frame_rtl7(struct ieee80211_device *ieee, short pwr) |
||
13186 | { |
||
13187 | - |
||
13188 | - struct sk_buff *buf = ieee80211_null_func(ieee, pwr); |
||
13189 | - |
||
13190 | + |
||
13191 | + struct sk_buff *buf = ieee80211_null_func_rtl7(ieee, pwr); |
||
13192 | + |
||
13193 | if (buf) |
||
13194 | - softmac_ps_mgmt_xmit(buf, ieee); |
||
13195 | + softmac_ps_mgmt_xmit_rtl7(buf, ieee); |
||
13196 | |||
13197 | -} |
||
13198 | +} |
||
13199 | |||
13200 | |||
13201 | -short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l) |
||
13202 | -{ |
||
13203 | +short ieee80211_sta_ps_sleep_rtl7(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l) |
||
13204 | +{ |
||
13205 | int timeout = ieee->ps_timeout; |
||
13206 | u8 dtim; |
||
13207 | /*if(ieee->ps == IEEE80211_PS_DISABLED || |
||
13208 | - ieee->iw_mode != IW_MODE_INFRA || |
||
13209 | + ieee->iw_mode != IW_MODE_INFRA || |
||
13210 | ieee->state != IEEE80211_LINKED) |
||
13211 | - |
||
13212 | + |
||
13213 | return 0; |
||
13214 | */ |
||
13215 | dtim = ieee->current_network.dtim_data; |
||
13216 | @@ -1312,133 +1338,133 @@ |
||
13217 | return 0; |
||
13218 | //printk("VALID\n"); |
||
13219 | ieee->current_network.dtim_data = IEEE80211_DTIM_INVALID; |
||
13220 | - |
||
13221 | + |
||
13222 | if(dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST)& ieee->ps)) |
||
13223 | return 2; |
||
13224 | - |
||
13225 | + |
||
13226 | if(!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout))) |
||
13227 | return 0; |
||
13228 | - |
||
13229 | + |
||
13230 | if(!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout))) |
||
13231 | return 0; |
||
13232 | - |
||
13233 | + |
||
13234 | if((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE ) && |
||
13235 | (ieee->mgmt_queue_tail != ieee->mgmt_queue_head)) |
||
13236 | return 0; |
||
13237 | - |
||
13238 | + |
||
13239 | if(time_l){ |
||
13240 | - *time_l = ieee->current_network.last_dtim_sta_time[0] |
||
13241 | - + (ieee->current_network.beacon_interval |
||
13242 | + *time_l = ieee->current_network.last_dtim_sta_time[0] |
||
13243 | + + (ieee->current_network.beacon_interval |
||
13244 | * ieee->current_network.dtim_period) * 1000; |
||
13245 | } |
||
13246 | - |
||
13247 | + |
||
13248 | if(time_h){ |
||
13249 | *time_h = ieee->current_network.last_dtim_sta_time[1]; |
||
13250 | if(time_l && *time_l < ieee->current_network.last_dtim_sta_time[0]) |
||
13251 | *time_h += 1; |
||
13252 | } |
||
13253 | - |
||
13254 | + |
||
13255 | return 1; |
||
13256 | - |
||
13257 | - |
||
13258 | + |
||
13259 | + |
||
13260 | } |
||
13261 | |||
13262 | -inline void ieee80211_sta_ps(struct ieee80211_device *ieee) |
||
13263 | +inline void ieee80211_sta_ps_rtl7(struct ieee80211_device *ieee) |
||
13264 | { |
||
13265 | |||
13266 | u32 th,tl; |
||
13267 | short sleep; |
||
13268 | - |
||
13269 | + |
||
13270 | unsigned long flags,flags2; |
||
13271 | - |
||
13272 | + |
||
13273 | spin_lock_irqsave(&ieee->lock, flags); |
||
13274 | - |
||
13275 | + |
||
13276 | if((ieee->ps == IEEE80211_PS_DISABLED || |
||
13277 | - ieee->iw_mode != IW_MODE_INFRA || |
||
13278 | + ieee->iw_mode != IW_MODE_INFRA || |
||
13279 | ieee->state != IEEE80211_LINKED)){ |
||
13280 | - |
||
13281 | - #warning CHECK_LOCK_HERE |
||
13282 | + |
||
13283 | +// #warning CHECK_LOCK_HERE |
||
13284 | spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); |
||
13285 | - |
||
13286 | - ieee80211_sta_wakeup(ieee, 1); |
||
13287 | - |
||
13288 | + |
||
13289 | + ieee80211_sta_wakeup_rtl7(ieee, 1); |
||
13290 | + printk(KERN_WARNING "wakeup 1!\n" ); |
||
13291 | spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); |
||
13292 | } |
||
13293 | - |
||
13294 | - sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl); |
||
13295 | + |
||
13296 | + sleep = ieee80211_sta_ps_sleep_rtl7(ieee,&th, &tl); |
||
13297 | /* 2 wake, 1 sleep, 0 do nothing */ |
||
13298 | if(sleep == 0) |
||
13299 | goto out; |
||
13300 | - |
||
13301 | + |
||
13302 | if(sleep == 1){ |
||
13303 | - |
||
13304 | + |
||
13305 | if(ieee->sta_sleep == 1) |
||
13306 | ieee->enter_sleep_state(ieee->dev,th,tl); |
||
13307 | - |
||
13308 | + |
||
13309 | else if(ieee->sta_sleep == 0){ |
||
13310 | // printk("send null 1\n"); |
||
13311 | spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); |
||
13312 | - |
||
13313 | + |
||
13314 | if(ieee->ps_is_queue_empty(ieee->dev)){ |
||
13315 | - |
||
13316 | - |
||
13317 | + |
||
13318 | + |
||
13319 | ieee->sta_sleep = 2; |
||
13320 | - |
||
13321 | + |
||
13322 | ieee->ps_request_tx_ack(ieee->dev); |
||
13323 | - |
||
13324 | - ieee80211_sta_ps_send_null_frame(ieee,1); |
||
13325 | - |
||
13326 | + |
||
13327 | + ieee80211_sta_ps_send_null_frame_rtl7(ieee,1); |
||
13328 | + |
||
13329 | ieee->ps_th = th; |
||
13330 | ieee->ps_tl = tl; |
||
13331 | - } |
||
13332 | + } |
||
13333 | spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); |
||
13334 | - |
||
13335 | + |
||
13336 | } |
||
13337 | - |
||
13338 | - |
||
13339 | + |
||
13340 | + |
||
13341 | }else if(sleep == 2){ |
||
13342 | -#warning CHECK_LOCK_HERE |
||
13343 | +// #warning CHECK_LOCK_HERE |
||
13344 | spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); |
||
13345 | - |
||
13346 | - ieee80211_sta_wakeup(ieee,1); |
||
13347 | - |
||
13348 | + |
||
13349 | + ieee80211_sta_wakeup_rtl7(ieee,1); |
||
13350 | + printk(KERN_WARNING "wakeup 2!\n" ); |
||
13351 | spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); |
||
13352 | } |
||
13353 | |||
13354 | -out: |
||
13355 | +out: |
||
13356 | spin_unlock_irqrestore(&ieee->lock, flags); |
||
13357 | - |
||
13358 | + |
||
13359 | } |
||
13360 | |||
13361 | -void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl) |
||
13362 | +void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl) |
||
13363 | { |
||
13364 | if(ieee->sta_sleep == 0){ |
||
13365 | if(nl){ |
||
13366 | printk("Warning: driver is probably failing to report TX ps error\n"); |
||
13367 | ieee->ps_request_tx_ack(ieee->dev); |
||
13368 | - ieee80211_sta_ps_send_null_frame(ieee, 0); |
||
13369 | + ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0); |
||
13370 | } |
||
13371 | return; |
||
13372 | - |
||
13373 | + |
||
13374 | } |
||
13375 | - |
||
13376 | - if(ieee->sta_sleep == 1) |
||
13377 | + |
||
13378 | + if(ieee->sta_sleep == 1) |
||
13379 | ieee->sta_wake_up(ieee->dev); |
||
13380 | - |
||
13381 | + |
||
13382 | ieee->sta_sleep = 0; |
||
13383 | - |
||
13384 | + |
||
13385 | if(nl){ |
||
13386 | ieee->ps_request_tx_ack(ieee->dev); |
||
13387 | - ieee80211_sta_ps_send_null_frame(ieee, 0); |
||
13388 | + ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0); |
||
13389 | } |
||
13390 | } |
||
13391 | |||
13392 | -void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success) |
||
13393 | +void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success) |
||
13394 | { |
||
13395 | unsigned long flags,flags2; |
||
13396 | - |
||
13397 | + |
||
13398 | spin_lock_irqsave(&ieee->lock, flags); |
||
13399 | - |
||
13400 | + |
||
13401 | if(ieee->sta_sleep == 2){ |
||
13402 | /* Null frame with PS bit set */ |
||
13403 | if(success){ |
||
13404 | @@ -1451,10 +1477,10 @@ |
||
13405 | } |
||
13406 | /* 21112005 - tx again null without PS bit if lost */ |
||
13407 | else { |
||
13408 | - |
||
13409 | + |
||
13410 | if((ieee->sta_sleep == 0) && !success){ |
||
13411 | spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); |
||
13412 | - ieee80211_sta_ps_send_null_frame(ieee, 0); |
||
13413 | + ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0); |
||
13414 | spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); |
||
13415 | } |
||
13416 | } |
||
13417 | @@ -1462,129 +1488,132 @@ |
||
13418 | } |
||
13419 | |||
13420 | inline int |
||
13421 | -ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, |
||
13422 | +ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, |
||
13423 | struct ieee80211_rx_stats *rx_stats, u16 type, |
||
13424 | u16 stype) |
||
13425 | { |
||
13426 | struct ieee80211_hdr_3addr *header; |
||
13427 | - header = (struct ieee80211_hdr_3addr *) skb->data; |
||
13428 | u16 errcode; |
||
13429 | u8* challenge; |
||
13430 | int chlen; |
||
13431 | int aid; |
||
13432 | - |
||
13433 | + |
||
13434 | + chlen = 0; |
||
13435 | + |
||
13436 | + header = (struct ieee80211_hdr_3addr *) skb->data; |
||
13437 | + |
||
13438 | if(!ieee->proto_started) |
||
13439 | return 0; |
||
13440 | - |
||
13441 | + |
||
13442 | if(ieee->sta_sleep || (ieee->ps != IEEE80211_PS_DISABLED && |
||
13443 | - ieee->iw_mode == IW_MODE_INFRA && |
||
13444 | + ieee->iw_mode == IW_MODE_INFRA && |
||
13445 | ieee->state == IEEE80211_LINKED)) |
||
13446 | - |
||
13447 | + |
||
13448 | tasklet_schedule(&ieee->ps_task); |
||
13449 | - |
||
13450 | + |
||
13451 | if(WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_PROBE_RESP && |
||
13452 | WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_BEACON) |
||
13453 | ieee->last_rx_ps_time = jiffies; |
||
13454 | - |
||
13455 | + |
||
13456 | switch (WLAN_FC_GET_STYPE(header->frame_ctl)) { |
||
13457 | - |
||
13458 | + |
||
13459 | case IEEE80211_STYPE_ASSOC_RESP: |
||
13460 | case IEEE80211_STYPE_REASSOC_RESP: |
||
13461 | - |
||
13462 | + |
||
13463 | IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n", |
||
13464 | WLAN_FC_GET_STYPE(header->frame_ctl)); |
||
13465 | if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && |
||
13466 | - ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED && |
||
13467 | + ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED && |
||
13468 | ieee->iw_mode == IW_MODE_INFRA){ |
||
13469 | - if (0 == (errcode=assoc_parse(skb, &aid))){ |
||
13470 | - |
||
13471 | + if (0 == (errcode=assoc_parse_rtl7(skb, &aid))){ |
||
13472 | + |
||
13473 | ieee->state=IEEE80211_LINKED; |
||
13474 | ieee->assoc_id = aid; |
||
13475 | ieee->softmac_stats.rx_ass_ok++; |
||
13476 | - |
||
13477 | - ieee80211_associate_complete(ieee); |
||
13478 | + |
||
13479 | + ieee80211_associate_complete_rtl7(ieee); |
||
13480 | }else{ |
||
13481 | ieee->softmac_stats.rx_ass_err++; |
||
13482 | IEEE80211_DEBUG_MGMT( |
||
13483 | "Association response status code 0x%x\n", |
||
13484 | errcode); |
||
13485 | - ieee80211_associate_abort(ieee); |
||
13486 | + ieee80211_associate_abort_rtl7(ieee); |
||
13487 | } |
||
13488 | } |
||
13489 | break; |
||
13490 | - |
||
13491 | + |
||
13492 | case IEEE80211_STYPE_ASSOC_REQ: |
||
13493 | case IEEE80211_STYPE_REASSOC_REQ: |
||
13494 | - |
||
13495 | + |
||
13496 | if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && |
||
13497 | ieee->iw_mode == IW_MODE_MASTER) |
||
13498 | - |
||
13499 | - ieee80211_rx_assoc_rq(ieee, skb); |
||
13500 | + |
||
13501 | + ieee80211_rx_assoc_rq_rtl7(ieee, skb); |
||
13502 | break; |
||
13503 | - |
||
13504 | + |
||
13505 | case IEEE80211_STYPE_AUTH: |
||
13506 | - |
||
13507 | + |
||
13508 | if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE){ |
||
13509 | - if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING && |
||
13510 | + if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING && |
||
13511 | ieee->iw_mode == IW_MODE_INFRA){ |
||
13512 | - |
||
13513 | + |
||
13514 | IEEE80211_DEBUG_MGMT("Received authentication response"); |
||
13515 | - |
||
13516 | - if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){ |
||
13517 | + |
||
13518 | + if (0 == (errcode=auth_parse_rtl7(skb, &challenge, &chlen))){ |
||
13519 | if(ieee->open_wep || !challenge){ |
||
13520 | ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED; |
||
13521 | ieee->softmac_stats.rx_auth_rs_ok++; |
||
13522 | - |
||
13523 | - ieee80211_associate_step2(ieee); |
||
13524 | + |
||
13525 | + ieee80211_associate_step2_rtl7(ieee); |
||
13526 | }else{ |
||
13527 | - ieee80211_auth_challenge(ieee, challenge, chlen); |
||
13528 | + ieee80211_auth_challenge_rtl7(ieee, challenge, chlen); |
||
13529 | } |
||
13530 | }else{ |
||
13531 | ieee->softmac_stats.rx_auth_rs_err++; |
||
13532 | IEEE80211_DEBUG_MGMT("Authentication respose status code 0x%x",errcode); |
||
13533 | - ieee80211_associate_abort(ieee); |
||
13534 | + ieee80211_associate_abort_rtl7(ieee); |
||
13535 | } |
||
13536 | - |
||
13537 | + |
||
13538 | }else if (ieee->iw_mode == IW_MODE_MASTER){ |
||
13539 | - ieee80211_rx_auth_rq(ieee, skb); |
||
13540 | + ieee80211_rx_auth_rq_rtl7(ieee, skb); |
||
13541 | } |
||
13542 | } |
||
13543 | break; |
||
13544 | - |
||
13545 | + |
||
13546 | case IEEE80211_STYPE_PROBE_REQ: |
||
13547 | - |
||
13548 | - if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) && |
||
13549 | - ((ieee->iw_mode == IW_MODE_ADHOC || |
||
13550 | + |
||
13551 | + if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) && |
||
13552 | + ((ieee->iw_mode == IW_MODE_ADHOC || |
||
13553 | ieee->iw_mode == IW_MODE_MASTER) && |
||
13554 | ieee->state == IEEE80211_LINKED)) |
||
13555 | - |
||
13556 | - ieee80211_rx_probe_rq(ieee, skb); |
||
13557 | + |
||
13558 | + ieee80211_rx_probe_rq_rtl7(ieee, skb); |
||
13559 | break; |
||
13560 | - |
||
13561 | + |
||
13562 | case IEEE80211_STYPE_DISASSOC: |
||
13563 | case IEEE80211_STYPE_DEAUTH: |
||
13564 | - /* FIXME for now repeat all the association procedure |
||
13565 | + /* FIXME for now repeat all the association procedure |
||
13566 | * both for disassociation and deauthentication |
||
13567 | */ |
||
13568 | if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && |
||
13569 | - ieee->state == IEEE80211_LINKED && |
||
13570 | + ieee->state == IEEE80211_LINKED && |
||
13571 | ieee->iw_mode == IW_MODE_INFRA){ |
||
13572 | - |
||
13573 | + |
||
13574 | ieee->state = IEEE80211_ASSOCIATING; |
||
13575 | ieee->softmac_stats.reassoc++; |
||
13576 | - |
||
13577 | - notify_wx_assoc_event(ieee); |
||
13578 | - |
||
13579 | + |
||
13580 | + notify_wx_assoc_event_rtl7(ieee); |
||
13581 | + |
||
13582 | queue_work(ieee->wq, &ieee->associate_procedure_wq); |
||
13583 | } |
||
13584 | - |
||
13585 | + |
||
13586 | break; |
||
13587 | - |
||
13588 | - default: |
||
13589 | + |
||
13590 | + default: |
||
13591 | return -1; |
||
13592 | break; |
||
13593 | } |
||
13594 | - |
||
13595 | + |
||
13596 | //dev_kfree_skb_any(skb); |
||
13597 | return 0; |
||
13598 | } |
||
13599 | @@ -1602,21 +1631,21 @@ |
||
13600 | * This might be useful if each fragment need it's own |
||
13601 | * descriptor, thus just keep a total free memory > than |
||
13602 | * the max fragmentation treshold is not enought.. If the |
||
13603 | - * ieee802.11 stack passed a TXB struct then you needed |
||
13604 | - * to keep N free descriptors where |
||
13605 | + * ieee802.11 stack passed a TXB struct then you needed |
||
13606 | + * to keep N free descriptors where |
||
13607 | * N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD |
||
13608 | * In this way you need just one and the 802.11 stack |
||
13609 | - * will take care of buffering fragments and pass them to |
||
13610 | + * will take care of buffering fragments and pass them to |
||
13611 | * to the driver later, when it wakes the queue. |
||
13612 | - */ |
||
13613 | - |
||
13614 | -void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee) |
||
13615 | + */ |
||
13616 | + |
||
13617 | +void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee) |
||
13618 | { |
||
13619 | - |
||
13620 | - |
||
13621 | + |
||
13622 | + |
||
13623 | unsigned long flags; |
||
13624 | int i; |
||
13625 | - |
||
13626 | + |
||
13627 | spin_lock_irqsave(&ieee->lock,flags); |
||
13628 | #if 0 |
||
13629 | if(ieee->queue_stop){ |
||
13630 | @@ -1627,13 +1656,13 @@ |
||
13631 | err = 1; |
||
13632 | goto exit; |
||
13633 | } |
||
13634 | - |
||
13635 | + |
||
13636 | ieee->stats.tx_bytes+=skb->len; |
||
13637 | - |
||
13638 | - |
||
13639 | + |
||
13640 | + |
||
13641 | txb=ieee80211_skb_to_txb(ieee,skb); |
||
13642 | - |
||
13643 | - |
||
13644 | + |
||
13645 | + |
||
13646 | if(txb==NULL){ |
||
13647 | IEEE80211DMESG("WW: IEEE stack failed to provide txb"); |
||
13648 | //dev_kfree_skb_any(skb); |
||
13649 | @@ -1641,12 +1670,12 @@ |
||
13650 | goto exit; |
||
13651 | } |
||
13652 | #endif |
||
13653 | - |
||
13654 | + |
||
13655 | /* called with 2nd parm 0, no tx mgmt lock required */ |
||
13656 | - ieee80211_sta_wakeup(ieee,0); |
||
13657 | + ieee80211_sta_wakeup_rtl7(ieee,0); |
||
13658 | |||
13659 | for(i = 0; i < txb->nr_frags; i++) { |
||
13660 | - |
||
13661 | + |
||
13662 | if (ieee->queue_stop){ |
||
13663 | ieee->tx_pending.txb = txb; |
||
13664 | ieee->tx_pending.frag = i; |
||
13665 | @@ -1658,29 +1687,29 @@ |
||
13666 | //(i+1)<txb->nr_frags); |
||
13667 | ieee->stats.tx_packets++; |
||
13668 | ieee->stats.tx_bytes += txb->fragments[i]->len; |
||
13669 | - ieee->dev->trans_start = jiffies; |
||
13670 | + ieee->dev->trans_start = jiffies; |
||
13671 | } |
||
13672 | - } |
||
13673 | - |
||
13674 | - ieee80211_txb_free(txb); |
||
13675 | - |
||
13676 | + } |
||
13677 | + |
||
13678 | + ieee80211_txb_free_rtl7(txb); |
||
13679 | + |
||
13680 | exit: |
||
13681 | spin_unlock_irqrestore(&ieee->lock,flags); |
||
13682 | - |
||
13683 | + |
||
13684 | } |
||
13685 | |||
13686 | /* called with ieee->lock acquired */ |
||
13687 | -void ieee80211_resume_tx(struct ieee80211_device *ieee) |
||
13688 | +void ieee80211_resume_tx_rtl7(struct ieee80211_device *ieee) |
||
13689 | { |
||
13690 | int i; |
||
13691 | for(i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) { |
||
13692 | - |
||
13693 | + |
||
13694 | if (ieee->queue_stop){ |
||
13695 | ieee->tx_pending.frag = i; |
||
13696 | return; |
||
13697 | }else{ |
||
13698 | - |
||
13699 | - ieee->softmac_data_hard_start_xmit( |
||
13700 | + |
||
13701 | + ieee->softmac_data_hard_start_xmit( |
||
13702 | ieee->tx_pending.txb->fragments[i], |
||
13703 | ieee->dev,ieee->rate); |
||
13704 | //(i+1)<ieee->tx_pending.txb->nr_frags); |
||
13705 | @@ -1688,21 +1717,21 @@ |
||
13706 | ieee->dev->trans_start = jiffies; |
||
13707 | } |
||
13708 | } |
||
13709 | - |
||
13710 | - |
||
13711 | - ieee80211_txb_free(ieee->tx_pending.txb); |
||
13712 | + |
||
13713 | + |
||
13714 | + ieee80211_txb_free_rtl7(ieee->tx_pending.txb); |
||
13715 | ieee->tx_pending.txb = NULL; |
||
13716 | } |
||
13717 | |||
13718 | |||
13719 | -void ieee80211_reset_queue(struct ieee80211_device *ieee) |
||
13720 | +void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee) |
||
13721 | { |
||
13722 | unsigned long flags; |
||
13723 | - |
||
13724 | + |
||
13725 | spin_lock_irqsave(&ieee->lock,flags); |
||
13726 | - init_mgmt_queue(ieee); |
||
13727 | + init_mgmt_queue_rtl7(ieee); |
||
13728 | if (ieee->tx_pending.txb){ |
||
13729 | - ieee80211_txb_free(ieee->tx_pending.txb); |
||
13730 | + ieee80211_txb_free_rtl7(ieee->tx_pending.txb); |
||
13731 | ieee->tx_pending.txb = NULL; |
||
13732 | } |
||
13733 | ieee->queue_stop = 0; |
||
13734 | @@ -1710,23 +1739,23 @@ |
||
13735 | |||
13736 | } |
||
13737 | |||
13738 | -void ieee80211_wake_queue(struct ieee80211_device *ieee) |
||
13739 | +void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee) |
||
13740 | { |
||
13741 | |||
13742 | unsigned long flags; |
||
13743 | struct sk_buff *skb; |
||
13744 | struct ieee80211_hdr_3addr *header; |
||
13745 | - |
||
13746 | + |
||
13747 | spin_lock_irqsave(&ieee->lock,flags); |
||
13748 | if (! ieee->queue_stop) goto exit; |
||
13749 | - |
||
13750 | + |
||
13751 | ieee->queue_stop = 0; |
||
13752 | - |
||
13753 | + |
||
13754 | if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){ |
||
13755 | - while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){ |
||
13756 | - |
||
13757 | + while (!ieee->queue_stop && (skb = dequeue_mgmt_rtl7(ieee))){ |
||
13758 | + |
||
13759 | header = (struct ieee80211_hdr_3addr *) skb->data; |
||
13760 | - |
||
13761 | + |
||
13762 | header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4); |
||
13763 | |||
13764 | if (ieee->seq_ctrl == 0xFFF) |
||
13765 | @@ -1738,19 +1767,19 @@ |
||
13766 | } |
||
13767 | } |
||
13768 | if (!ieee->queue_stop && ieee->tx_pending.txb) |
||
13769 | - ieee80211_resume_tx(ieee); |
||
13770 | - |
||
13771 | + ieee80211_resume_tx_rtl7(ieee); |
||
13772 | + |
||
13773 | if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){ |
||
13774 | ieee->softmac_stats.swtxawake++; |
||
13775 | netif_wake_queue(ieee->dev); |
||
13776 | } |
||
13777 | - |
||
13778 | + |
||
13779 | exit : |
||
13780 | spin_unlock_irqrestore(&ieee->lock,flags); |
||
13781 | } |
||
13782 | |||
13783 | |||
13784 | -void ieee80211_stop_queue(struct ieee80211_device *ieee) |
||
13785 | +void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee) |
||
13786 | { |
||
13787 | //unsigned long flags; |
||
13788 | //spin_lock_irqsave(&ieee->lock,flags); |
||
13789 | @@ -1761,81 +1790,88 @@ |
||
13790 | } |
||
13791 | ieee->queue_stop = 1; |
||
13792 | //spin_unlock_irqrestore(&ieee->lock,flags); |
||
13793 | - |
||
13794 | + |
||
13795 | } |
||
13796 | |||
13797 | |||
13798 | -inline void ieee80211_randomize_cell(struct ieee80211_device *ieee) |
||
13799 | +inline void ieee80211_randomize_cell_rtl7(struct ieee80211_device *ieee) |
||
13800 | { |
||
13801 | - |
||
13802 | + |
||
13803 | get_random_bytes(ieee->current_network.bssid, ETH_ALEN); |
||
13804 | - |
||
13805 | + |
||
13806 | /* an IBSS cell address must have the two less significant |
||
13807 | - * bits of the first byte = 2 |
||
13808 | + * bits of the first byte = 2 |
||
13809 | */ |
||
13810 | ieee->current_network.bssid[0] &= ~0x01; |
||
13811 | ieee->current_network.bssid[0] |= 0x02; |
||
13812 | } |
||
13813 | |||
13814 | /* called in user context only */ |
||
13815 | -void ieee80211_start_master_bss(struct ieee80211_device *ieee) |
||
13816 | +void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee) |
||
13817 | { |
||
13818 | ieee->assoc_id = 1; |
||
13819 | - |
||
13820 | + |
||
13821 | if (ieee->current_network.ssid_len == 0){ |
||
13822 | - strncpy(ieee->current_network.ssid, |
||
13823 | + strncpy(ieee->current_network.ssid, |
||
13824 | IEEE80211_DEFAULT_TX_ESSID, |
||
13825 | IW_ESSID_MAX_SIZE); |
||
13826 | - |
||
13827 | + |
||
13828 | ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID); |
||
13829 | ieee->ssid_set = 1; |
||
13830 | } |
||
13831 | - |
||
13832 | + |
||
13833 | memcpy(ieee->current_network.bssid, ieee->dev->dev_addr, ETH_ALEN); |
||
13834 | - |
||
13835 | + |
||
13836 | ieee->set_chan(ieee->dev, ieee->current_network.channel); |
||
13837 | ieee->state = IEEE80211_LINKED; |
||
13838 | ieee->link_change(ieee->dev); |
||
13839 | - notify_wx_assoc_event(ieee); |
||
13840 | - |
||
13841 | + notify_wx_assoc_event_rtl7(ieee); |
||
13842 | + |
||
13843 | if (ieee->data_hard_resume) |
||
13844 | ieee->data_hard_resume(ieee->dev); |
||
13845 | - |
||
13846 | + |
||
13847 | netif_carrier_on(ieee->dev); |
||
13848 | } |
||
13849 | |||
13850 | -void ieee80211_start_monitor_mode(struct ieee80211_device *ieee) |
||
13851 | +void ieee80211_start_monitor_mode_rtl7(struct ieee80211_device *ieee) |
||
13852 | { |
||
13853 | if(ieee->raw_tx){ |
||
13854 | - |
||
13855 | + |
||
13856 | if (ieee->data_hard_resume) |
||
13857 | ieee->data_hard_resume(ieee->dev); |
||
13858 | - |
||
13859 | + |
||
13860 | netif_carrier_on(ieee->dev); |
||
13861 | } |
||
13862 | } |
||
13863 | -void ieee80211_start_ibss_wq(struct ieee80211_device *ieee) |
||
13864 | + |
||
13865 | +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) |
||
13866 | +void ieee80211_start_ibss_wq_rtl7(struct work_struct *work) |
||
13867 | +{ |
||
13868 | + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, start_ibss_wq); |
||
13869 | +#else |
||
13870 | +void ieee80211_start_ibss_wq_rtl7(struct ieee80211_device *ieee) |
||
13871 | { |
||
13872 | - |
||
13873 | +#endif |
||
13874 | + |
||
13875 | /* iwconfig mode ad-hoc will schedule this and return |
||
13876 | * on the other hand this will block further iwconfig SET |
||
13877 | * operations because of the wx_sem hold. |
||
13878 | * Anyway some most set operations set a flag to speed-up |
||
13879 | - * (abort) this wq (when syncro scanning) before sleeping |
||
13880 | + * (abort) this wq (when syncro scanning) before sleeping |
||
13881 | * on the semaphore |
||
13882 | */ |
||
13883 | - |
||
13884 | + |
||
13885 | down(&ieee->wx_sem); |
||
13886 | - |
||
13887 | + |
||
13888 | if (ieee->current_network.ssid_len == 0){ |
||
13889 | strcpy(ieee->current_network.ssid,IEEE80211_DEFAULT_TX_ESSID); |
||
13890 | ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID); |
||
13891 | ieee->ssid_set = 1; |
||
13892 | - } |
||
13893 | - |
||
13894 | + } |
||
13895 | + |
||
13896 | /* check if we have this cell in our network list */ |
||
13897 | - ieee80211_softmac_check_all_nets(ieee); |
||
13898 | - |
||
13899 | + ieee80211_softmac_check_all_nets_rtl7(ieee); |
||
13900 | + |
||
13901 | /* if not then the state is not linked. Maybe the user swithced to |
||
13902 | * ad-hoc mode just after being in monitor mode, or just after |
||
13903 | * being very few time in managed mode (so the card have had no |
||
13904 | @@ -1851,29 +1887,29 @@ |
||
13905 | * associated. |
||
13906 | */ |
||
13907 | if (ieee->state == IEEE80211_NOLINK) |
||
13908 | - ieee80211_start_scan_syncro(ieee); |
||
13909 | + ieee80211_start_scan_syncro_rtl7(ieee); |
||
13910 | |||
13911 | /* the network definitively is not here.. create a new cell */ |
||
13912 | if (ieee->state == IEEE80211_NOLINK){ |
||
13913 | - printk("creating new IBSS cell\n"); |
||
13914 | + printk("creating new IBSS cell\n"); |
||
13915 | if(!ieee->wap_set) |
||
13916 | - ieee80211_randomize_cell(ieee); |
||
13917 | - |
||
13918 | + ieee80211_randomize_cell_rtl7(ieee); |
||
13919 | + |
||
13920 | if(ieee->modulation & IEEE80211_CCK_MODULATION){ |
||
13921 | - |
||
13922 | + |
||
13923 | ieee->current_network.rates_len = 4; |
||
13924 | - |
||
13925 | + |
||
13926 | ieee->current_network.rates[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB; |
||
13927 | ieee->current_network.rates[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB; |
||
13928 | ieee->current_network.rates[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB; |
||
13929 | ieee->current_network.rates[3] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB; |
||
13930 | - |
||
13931 | + |
||
13932 | }else |
||
13933 | ieee->current_network.rates_len = 0; |
||
13934 | - |
||
13935 | + |
||
13936 | if(ieee->modulation & IEEE80211_OFDM_MODULATION){ |
||
13937 | ieee->current_network.rates_ex_len = 8; |
||
13938 | - |
||
13939 | + |
||
13940 | ieee->current_network.rates_ex[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB; |
||
13941 | ieee->current_network.rates_ex[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_9MB; |
||
13942 | ieee->current_network.rates_ex[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_12MB; |
||
13943 | @@ -1882,44 +1918,44 @@ |
||
13944 | ieee->current_network.rates_ex[5] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB; |
||
13945 | ieee->current_network.rates_ex[6] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB; |
||
13946 | ieee->current_network.rates_ex[7] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB; |
||
13947 | - |
||
13948 | - ieee->rate = 540; |
||
13949 | + |
||
13950 | +// ieee->rate = 540; |
||
13951 | }else{ |
||
13952 | ieee->current_network.rates_ex_len = 0; |
||
13953 | - ieee->rate = 110; |
||
13954 | +// ieee->rate = 110; |
||
13955 | } |
||
13956 | - |
||
13957 | + |
||
13958 | ieee->current_network.atim_window = 0; |
||
13959 | ieee->current_network.capability = WLAN_CAPABILITY_IBSS; |
||
13960 | if(ieee->short_slot) |
||
13961 | ieee->current_network.capability |= WLAN_CAPABILITY_SHORT_SLOT; |
||
13962 | - |
||
13963 | + |
||
13964 | } |
||
13965 | - |
||
13966 | + |
||
13967 | ieee->state = IEEE80211_LINKED; |
||
13968 | - |
||
13969 | + |
||
13970 | ieee->set_chan(ieee->dev, ieee->current_network.channel); |
||
13971 | ieee->link_change(ieee->dev); |
||
13972 | - |
||
13973 | - notify_wx_assoc_event(ieee); |
||
13974 | - |
||
13975 | - ieee80211_start_send_beacons(ieee); |
||
13976 | - |
||
13977 | + |
||
13978 | + notify_wx_assoc_event_rtl7(ieee); |
||
13979 | + |
||
13980 | + ieee80211_start_send_beacons_rtl7(ieee); |
||
13981 | + |
||
13982 | if (ieee->data_hard_resume) |
||
13983 | ieee->data_hard_resume(ieee->dev); |
||
13984 | - |
||
13985 | + |
||
13986 | netif_carrier_on(ieee->dev); |
||
13987 | - |
||
13988 | + |
||
13989 | up(&ieee->wx_sem); |
||
13990 | } |
||
13991 | |||
13992 | -inline void ieee80211_start_ibss(struct ieee80211_device *ieee) |
||
13993 | +inline void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee) |
||
13994 | { |
||
13995 | queue_work(ieee->wq, &ieee->start_ibss_wq); |
||
13996 | } |
||
13997 | |||
13998 | /* this is called only in user context, with wx_sem held */ |
||
13999 | -void ieee80211_start_bss(struct ieee80211_device *ieee) |
||
14000 | +void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee) |
||
14001 | { |
||
14002 | unsigned long flags; |
||
14003 | /* check if we have already found the net we |
||
14004 | @@ -1927,8 +1963,8 @@ |
||
14005 | * if not (we are disassociated and we are not |
||
14006 | * in associating / authenticating phase) start the background scanning. |
||
14007 | */ |
||
14008 | - ieee80211_softmac_check_all_nets(ieee); |
||
14009 | - |
||
14010 | + ieee80211_softmac_check_all_nets_rtl7(ieee); |
||
14011 | + |
||
14012 | /* ensure no-one start an associating process (thus setting |
||
14013 | * the ieee->state to ieee80211_ASSOCIATING) while we |
||
14014 | * have just cheked it and we are going to enable scan. |
||
14015 | @@ -1937,41 +1973,49 @@ |
||
14016 | * the rx path), so we cannot be in the middle of such function |
||
14017 | */ |
||
14018 | spin_lock_irqsave(&ieee->lock, flags); |
||
14019 | - |
||
14020 | if (ieee->state == IEEE80211_NOLINK) |
||
14021 | - ieee80211_start_scan(ieee); |
||
14022 | - |
||
14023 | + ieee80211_start_scan_rtl7(ieee); |
||
14024 | + |
||
14025 | spin_unlock_irqrestore(&ieee->lock, flags); |
||
14026 | } |
||
14027 | |||
14028 | /* called only in userspace context */ |
||
14029 | -void ieee80211_disassociate(struct ieee80211_device *ieee) |
||
14030 | +void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee) |
||
14031 | { |
||
14032 | netif_carrier_off(ieee->dev); |
||
14033 | - |
||
14034 | + |
||
14035 | if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE) |
||
14036 | - ieee80211_reset_queue(ieee); |
||
14037 | - |
||
14038 | + ieee80211_reset_queue_rtl7(ieee); |
||
14039 | + |
||
14040 | if (ieee->data_hard_stop) |
||
14041 | ieee->data_hard_stop(ieee->dev); |
||
14042 | - |
||
14043 | + |
||
14044 | ieee->state = IEEE80211_NOLINK; |
||
14045 | ieee->link_change(ieee->dev); |
||
14046 | - notify_wx_assoc_event(ieee); |
||
14047 | - |
||
14048 | + notify_wx_assoc_event_rtl7(ieee); |
||
14049 | + |
||
14050 | } |
||
14051 | -void ieee80211_associate_retry_wq(struct ieee80211_device *ieee) |
||
14052 | + |
||
14053 | +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) |
||
14054 | +void ieee80211_associate_retry_wq_rtl7(struct work_struct *work) |
||
14055 | +{ |
||
14056 | + struct delayed_work *dwork = container_of(work, struct delayed_work, work); |
||
14057 | + struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq); |
||
14058 | +#else |
||
14059 | +void ieee80211_associate_retry_wq_rtl7(struct ieee80211_device *ieee) |
||
14060 | { |
||
14061 | +#endif |
||
14062 | unsigned long flags; |
||
14063 | - |
||
14064 | + |
||
14065 | down(&ieee->wx_sem); |
||
14066 | + |
||
14067 | if(!ieee->proto_started) |
||
14068 | goto exit; |
||
14069 | - |
||
14070 | + |
||
14071 | if(ieee->state != IEEE80211_ASSOCIATING_RETRY) |
||
14072 | goto exit; |
||
14073 | - |
||
14074 | - /* until we do not set the state to IEEE80211_NOLINK |
||
14075 | + |
||
14076 | + /* until we do not set the state to IEEE80211_NOLINK |
||
14077 | * there are no possibility to have someone else trying |
||
14078 | * to start an association procdure (we get here with |
||
14079 | * ieee->state = IEEE80211_ASSOCIATING). |
||
14080 | @@ -1981,122 +2025,120 @@ |
||
14081 | * RX path works with ieee->lock held so there are no |
||
14082 | * problems. If we are still disassociated then start a scan. |
||
14083 | * the lock here is necessary to ensure no one try to start |
||
14084 | - * an association procedure when we have just checked the |
||
14085 | + * an association procedure when we have just checked the |
||
14086 | * state and we are going to start the scan. |
||
14087 | */ |
||
14088 | ieee->state = IEEE80211_NOLINK; |
||
14089 | |||
14090 | - ieee80211_softmac_check_all_nets(ieee); |
||
14091 | - |
||
14092 | + ieee80211_softmac_check_all_nets_rtl7(ieee); |
||
14093 | + |
||
14094 | spin_lock_irqsave(&ieee->lock, flags); |
||
14095 | - |
||
14096 | + |
||
14097 | if(ieee->state == IEEE80211_NOLINK) |
||
14098 | - ieee80211_start_scan(ieee); |
||
14099 | - |
||
14100 | + ieee80211_start_scan_rtl7(ieee); |
||
14101 | + |
||
14102 | spin_unlock_irqrestore(&ieee->lock, flags); |
||
14103 | |||
14104 | exit: |
||
14105 | up(&ieee->wx_sem); |
||
14106 | } |
||
14107 | |||
14108 | -struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee) |
||
14109 | +struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee) |
||
14110 | { |
||
14111 | u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff}; |
||
14112 | - |
||
14113 | + |
||
14114 | struct sk_buff *skb; |
||
14115 | struct ieee80211_probe_response *b; |
||
14116 | - |
||
14117 | - skb = ieee80211_probe_resp(ieee, broadcast_addr); |
||
14118 | - |
||
14119 | - if (!skb) |
||
14120 | + |
||
14121 | + skb = ieee80211_probe_resp_rtl7(ieee, broadcast_addr); |
||
14122 | + |
||
14123 | + if (!skb) |
||
14124 | return NULL; |
||
14125 | - |
||
14126 | + |
||
14127 | b = (struct ieee80211_probe_response *) skb->data; |
||
14128 | b->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_BEACON); |
||
14129 | - |
||
14130 | + |
||
14131 | return skb; |
||
14132 | - |
||
14133 | + |
||
14134 | } |
||
14135 | |||
14136 | -struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee) |
||
14137 | +struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee) |
||
14138 | { |
||
14139 | struct sk_buff *skb; |
||
14140 | struct ieee80211_probe_response *b; |
||
14141 | - |
||
14142 | - skb = ieee80211_get_beacon_(ieee); |
||
14143 | - if(!skb) |
||
14144 | + |
||
14145 | + skb = ieee80211_get_beacon__rtl7(ieee); |
||
14146 | + if(!skb) |
||
14147 | return NULL; |
||
14148 | - |
||
14149 | - b = (struct ieee80211_probe_response *) skb->data; |
||
14150 | + |
||
14151 | + b = (struct ieee80211_probe_response *) skb->data; |
||
14152 | b->header.seq_ctrl = cpu_to_le16(ieee->seq_ctrl << 4); |
||
14153 | - |
||
14154 | + |
||
14155 | if (ieee->seq_ctrl == 0xFFF) |
||
14156 | ieee->seq_ctrl = 0; |
||
14157 | else |
||
14158 | ieee->seq_ctrl++; |
||
14159 | - |
||
14160 | + |
||
14161 | return skb; |
||
14162 | } |
||
14163 | |||
14164 | -void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee) |
||
14165 | +void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee) |
||
14166 | { |
||
14167 | ieee->sync_scan_hurryup = 1; |
||
14168 | down(&ieee->wx_sem); |
||
14169 | - ieee80211_stop_protocol(ieee); |
||
14170 | + |
||
14171 | + ieee80211_stop_protocol_rtl7(ieee); |
||
14172 | up(&ieee->wx_sem); |
||
14173 | } |
||
14174 | |||
14175 | |||
14176 | -void ieee80211_stop_protocol(struct ieee80211_device *ieee) |
||
14177 | +void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee) |
||
14178 | { |
||
14179 | if (!ieee->proto_started) |
||
14180 | return; |
||
14181 | - |
||
14182 | + |
||
14183 | ieee->proto_started = 0; |
||
14184 | - |
||
14185 | - ieee80211_stop_send_beacons(ieee); |
||
14186 | - |
||
14187 | + |
||
14188 | + ieee80211_stop_send_beacons_rtl7(ieee); |
||
14189 | + |
||
14190 | del_timer_sync(&ieee->associate_timer); |
||
14191 | - cancel_delayed_work(&ieee->associate_retry_wq); |
||
14192 | - |
||
14193 | - ieee80211_stop_scan(ieee); |
||
14194 | + cancel_delayed_work(&ieee->associate_retry_wq); |
||
14195 | + |
||
14196 | + ieee80211_stop_scan_rtl7(ieee); |
||
14197 | |||
14198 | - ieee80211_disassociate(ieee); |
||
14199 | + ieee80211_disassociate_rtl7(ieee); |
||
14200 | } |
||
14201 | |||
14202 | -void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee) |
||
14203 | +void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee) |
||
14204 | { |
||
14205 | ieee->sync_scan_hurryup = 0; |
||
14206 | down(&ieee->wx_sem); |
||
14207 | - ieee80211_start_protocol(ieee); |
||
14208 | + ieee80211_start_protocol_rtl7(ieee); |
||
14209 | up(&ieee->wx_sem); |
||
14210 | } |
||
14211 | |||
14212 | -void ieee80211_start_protocol(struct ieee80211_device *ieee) |
||
14213 | +void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee) |
||
14214 | { |
||
14215 | short ch = 0; |
||
14216 | - |
||
14217 | if (ieee->proto_started) |
||
14218 | return; |
||
14219 | - |
||
14220 | + |
||
14221 | ieee->proto_started = 1; |
||
14222 | - |
||
14223 | + |
||
14224 | if (ieee->current_network.channel == 0){ |
||
14225 | do{ |
||
14226 | ch++; |
||
14227 | - if (ch > MAX_CHANNEL_NUMBER) |
||
14228 | + if (ch > MAX_CHANNEL_NUMBER) |
||
14229 | return; /* no channel found */ |
||
14230 | - |
||
14231 | + |
||
14232 | }while(!ieee->channel_map[ch]); |
||
14233 | - |
||
14234 | + |
||
14235 | ieee->current_network.channel = ch; |
||
14236 | } |
||
14237 | - |
||
14238 | + |
||
14239 | if (ieee->current_network.beacon_interval == 0) |
||
14240 | ieee->current_network.beacon_interval = 100; |
||
14241 | - |
||
14242 | ieee->set_chan(ieee->dev,ieee->current_network.channel); |
||
14243 | - |
||
14244 | ieee->last_seq_num = -1; |
||
14245 | ieee->last_frag_num = -1; |
||
14246 | ieee->last_packet_time = 0; |
||
14247 | @@ -2107,30 +2149,27 @@ |
||
14248 | * attempts does not fail just because the user provide the essid |
||
14249 | * and the nic is still checking for the AP MAC ?? |
||
14250 | */ |
||
14251 | - |
||
14252 | + |
||
14253 | if (ieee->iw_mode == IW_MODE_INFRA) |
||
14254 | - ieee80211_start_bss(ieee); |
||
14255 | - |
||
14256 | + ieee80211_start_bss_rtl7(ieee); |
||
14257 | else if (ieee->iw_mode == IW_MODE_ADHOC) |
||
14258 | - ieee80211_start_ibss(ieee); |
||
14259 | - |
||
14260 | + ieee80211_start_ibss_rtl7(ieee); |
||
14261 | else if (ieee->iw_mode == IW_MODE_MASTER) |
||
14262 | - ieee80211_start_master_bss(ieee); |
||
14263 | - |
||
14264 | + ieee80211_start_master_bss_rtl7(ieee); |
||
14265 | else if(ieee->iw_mode == IW_MODE_MONITOR) |
||
14266 | - ieee80211_start_monitor_mode(ieee); |
||
14267 | + ieee80211_start_monitor_mode_rtl7(ieee); |
||
14268 | } |
||
14269 | |||
14270 | |||
14271 | #define DRV_NAME "Ieee80211" |
||
14272 | -void ieee80211_softmac_init(struct ieee80211_device *ieee) |
||
14273 | +void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee) |
||
14274 | { |
||
14275 | memset(&ieee->current_network, 0, sizeof(struct ieee80211_network)); |
||
14276 | - |
||
14277 | + |
||
14278 | ieee->state = IEEE80211_NOLINK; |
||
14279 | ieee->sync_scan_hurryup = 0; |
||
14280 | ieee->seq_ctrl = 0; |
||
14281 | - |
||
14282 | + |
||
14283 | ieee->assoc_id = 0; |
||
14284 | ieee->queue_stop = 0; |
||
14285 | ieee->scanning = 0; |
||
14286 | @@ -2142,66 +2181,75 @@ |
||
14287 | ieee->rate = 3; |
||
14288 | ieee->ps = IEEE80211_PS_DISABLED; |
||
14289 | ieee->sta_sleep = 0; |
||
14290 | - |
||
14291 | - init_mgmt_queue(ieee); |
||
14292 | + |
||
14293 | + init_mgmt_queue_rtl7(ieee); |
||
14294 | #if 0 |
||
14295 | init_timer(&ieee->scan_timer); |
||
14296 | ieee->scan_timer.data = (unsigned long)ieee; |
||
14297 | ieee->scan_timer.function = ieee80211_softmac_scan_cb; |
||
14298 | #endif |
||
14299 | ieee->tx_pending.txb = NULL; |
||
14300 | - |
||
14301 | + |
||
14302 | init_timer(&ieee->associate_timer); |
||
14303 | ieee->associate_timer.data = (unsigned long)ieee; |
||
14304 | - ieee->associate_timer.function = ieee80211_associate_abort_cb; |
||
14305 | + ieee->associate_timer.function = ieee80211_associate_abort_cb_rtl7; |
||
14306 | |||
14307 | init_timer(&ieee->beacon_timer); |
||
14308 | ieee->beacon_timer.data = (unsigned long) ieee; |
||
14309 | - ieee->beacon_timer.function = ieee80211_send_beacon_cb; |
||
14310 | - |
||
14311 | + ieee->beacon_timer.function = ieee80211_send_beacon_cb_rtl7; |
||
14312 | + |
||
14313 | #ifdef PF_SYNCTHREAD |
||
14314 | ieee->wq = create_workqueue(DRV_NAME,0); |
||
14315 | -#else |
||
14316 | +#else |
||
14317 | ieee->wq = create_workqueue(DRV_NAME); |
||
14318 | #endif |
||
14319 | - |
||
14320 | - INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee); |
||
14321 | - INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee); |
||
14322 | - INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee); |
||
14323 | - INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee); |
||
14324 | - INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee); |
||
14325 | - INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee); |
||
14326 | - |
||
14327 | + |
||
14328 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) |
||
14329 | + INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq_rtl7,ieee); |
||
14330 | + INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq_rtl7,ieee); |
||
14331 | + INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq_rtl7,ieee); |
||
14332 | + INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq_rtl7,ieee); |
||
14333 | + INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq_rtl7,ieee); |
||
14334 | + INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq_rtl7,ieee); |
||
14335 | +#else |
||
14336 | + INIT_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq_rtl7); |
||
14337 | + INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq_rtl7); |
||
14338 | + INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq_rtl7); |
||
14339 | + INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq_rtl7); |
||
14340 | + INIT_DELAYED_WORK(&ieee->softmac_scan_wq, ieee80211_softmac_scan_wq_rtl7); |
||
14341 | + INIT_WORK(&ieee->wx_sync_scan_wq, ieee80211_wx_sync_scan_wq_rtl7); |
||
14342 | +#endif |
||
14343 | + |
||
14344 | sema_init(&ieee->wx_sem, 1); |
||
14345 | sema_init(&ieee->scan_sem, 1); |
||
14346 | - |
||
14347 | + |
||
14348 | spin_lock_init(&ieee->mgmt_tx_lock); |
||
14349 | spin_lock_init(&ieee->beacon_lock); |
||
14350 | - |
||
14351 | + |
||
14352 | tasklet_init(&ieee->ps_task, |
||
14353 | - (void(*)(unsigned long)) ieee80211_sta_ps, |
||
14354 | + (void(*)(unsigned long)) ieee80211_sta_ps_rtl7, |
||
14355 | (unsigned long)ieee); |
||
14356 | |||
14357 | } |
||
14358 | |||
14359 | -void ieee80211_softmac_free(struct ieee80211_device *ieee) |
||
14360 | +void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee) |
||
14361 | { |
||
14362 | down(&ieee->wx_sem); |
||
14363 | - |
||
14364 | + |
||
14365 | del_timer_sync(&ieee->associate_timer); |
||
14366 | cancel_delayed_work(&ieee->associate_retry_wq); |
||
14367 | destroy_workqueue(ieee->wq); |
||
14368 | - |
||
14369 | + |
||
14370 | up(&ieee->wx_sem); |
||
14371 | } |
||
14372 | |||
14373 | -/******************************************************** |
||
14374 | +/******************************************************** |
||
14375 | * Start of WPA code. * |
||
14376 | * this is stolen from the ipw2200 driver * |
||
14377 | ********************************************************/ |
||
14378 | |||
14379 | - |
||
14380 | -static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value) |
||
14381 | + |
||
14382 | +static int ieee80211_wpa_enable_rtl7(struct ieee80211_device *ieee, int value) |
||
14383 | { |
||
14384 | /* This is called when wpa_supplicant loads and closes the driver |
||
14385 | * interface. */ |
||
14386 | @@ -2210,19 +2258,19 @@ |
||
14387 | return 0; |
||
14388 | } |
||
14389 | |||
14390 | - |
||
14391 | -void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len) |
||
14392 | + |
||
14393 | +void ieee80211_wpa_assoc_frame_rtl7(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len) |
||
14394 | { |
||
14395 | /* make sure WPA is enabled */ |
||
14396 | - ieee80211_wpa_enable(ieee, 1); |
||
14397 | + ieee80211_wpa_enable_rtl7(ieee, 1); |
||
14398 | |||
14399 | - ieee80211_disassociate(ieee); |
||
14400 | + ieee80211_disassociate_rtl7(ieee); |
||
14401 | } |
||
14402 | |||
14403 | |||
14404 | -static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason) |
||
14405 | +static int ieee80211_wpa_mlme_rtl7(struct ieee80211_device *ieee, int command, int reason) |
||
14406 | { |
||
14407 | - |
||
14408 | + |
||
14409 | int ret = 0; |
||
14410 | |||
14411 | switch (command) { |
||
14412 | @@ -2231,7 +2279,7 @@ |
||
14413 | break; |
||
14414 | |||
14415 | case IEEE_MLME_STA_DISASSOC: |
||
14416 | - ieee80211_disassociate(ieee); |
||
14417 | + ieee80211_disassociate_rtl7(ieee); |
||
14418 | break; |
||
14419 | |||
14420 | default: |
||
14421 | @@ -2243,7 +2291,7 @@ |
||
14422 | } |
||
14423 | |||
14424 | |||
14425 | -static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee, |
||
14426 | +static int ieee80211_wpa_set_wpa_ie_rtl7(struct ieee80211_device *ieee, |
||
14427 | struct ieee_param *param, int plen) |
||
14428 | { |
||
14429 | u8 *buf; |
||
14430 | @@ -2267,16 +2315,16 @@ |
||
14431 | ieee->wpa_ie_len = 0; |
||
14432 | } |
||
14433 | |||
14434 | - ieee80211_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len); |
||
14435 | + ieee80211_wpa_assoc_frame_rtl7(ieee, ieee->wpa_ie, ieee->wpa_ie_len); |
||
14436 | return 0; |
||
14437 | } |
||
14438 | |||
14439 | #define AUTH_ALG_OPEN_SYSTEM 0x1 |
||
14440 | #define AUTH_ALG_SHARED_KEY 0x2 |
||
14441 | |||
14442 | -static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value) |
||
14443 | +static int ieee80211_wpa_set_auth_algs_rtl7(struct ieee80211_device *ieee, int value) |
||
14444 | { |
||
14445 | - |
||
14446 | + |
||
14447 | struct ieee80211_security sec = { |
||
14448 | .flags = SEC_AUTH_MODE, |
||
14449 | }; |
||
14450 | @@ -2300,13 +2348,13 @@ |
||
14451 | |||
14452 | |||
14453 | |||
14454 | -static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value) |
||
14455 | +static int ieee80211_wpa_set_param_rtl7(struct ieee80211_device *ieee, u8 name, u32 value) |
||
14456 | { |
||
14457 | int ret=0; |
||
14458 | |||
14459 | switch (name) { |
||
14460 | case IEEE_PARAM_WPA_ENABLED: |
||
14461 | - ret = ieee80211_wpa_enable(ieee, value); |
||
14462 | + ret = ieee80211_wpa_enable_rtl7(ieee, value); |
||
14463 | break; |
||
14464 | |||
14465 | case IEEE_PARAM_TKIP_COUNTERMEASURES: |
||
14466 | @@ -2351,7 +2399,7 @@ |
||
14467 | break; |
||
14468 | |||
14469 | case IEEE_PARAM_AUTH_ALGS: |
||
14470 | - ret = ieee80211_wpa_set_auth_algs(ieee, value); |
||
14471 | + ret = ieee80211_wpa_set_auth_algs_rtl7(ieee, value); |
||
14472 | break; |
||
14473 | |||
14474 | case IEEE_PARAM_IEEE_802_1X: |
||
14475 | @@ -2368,11 +2416,11 @@ |
||
14476 | |||
14477 | /* implementation borrowed from hostap driver */ |
||
14478 | |||
14479 | -static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee, |
||
14480 | +static int ieee80211_wpa_set_encryption_rtl7(struct ieee80211_device *ieee, |
||
14481 | struct ieee_param *param, int param_len) |
||
14482 | { |
||
14483 | int ret = 0; |
||
14484 | - |
||
14485 | + |
||
14486 | struct ieee80211_crypto_ops *ops; |
||
14487 | struct ieee80211_crypt_data **crypt; |
||
14488 | |||
14489 | @@ -2407,7 +2455,7 @@ |
||
14490 | //sec.encrypt = 0; |
||
14491 | sec.level = SEC_LEVEL_0; |
||
14492 | sec.flags |= SEC_ENABLED | SEC_LEVEL; |
||
14493 | - ieee80211_crypt_delayed_deinit(ieee, crypt); |
||
14494 | + ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt); |
||
14495 | } |
||
14496 | goto done; |
||
14497 | } |
||
14498 | @@ -2421,16 +2469,16 @@ |
||
14499 | strcmp(param->u.crypt.alg, "TKIP")) |
||
14500 | goto skip_host_crypt; |
||
14501 | |||
14502 | - ops = ieee80211_get_crypto_ops(param->u.crypt.alg); |
||
14503 | + ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg); |
||
14504 | if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) { |
||
14505 | - request_module("ieee80211_crypt_wep"); |
||
14506 | - ops = ieee80211_get_crypto_ops(param->u.crypt.alg); |
||
14507 | + request_module("ieee80211_crypt_wep_rtl"); |
||
14508 | + ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg); |
||
14509 | } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) { |
||
14510 | - request_module("ieee80211_crypt_tkip"); |
||
14511 | - ops = ieee80211_get_crypto_ops(param->u.crypt.alg); |
||
14512 | + request_module("ieee80211_crypt_tkip_rtl"); |
||
14513 | + ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg); |
||
14514 | } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) { |
||
14515 | - request_module("ieee80211_crypt_ccmp"); |
||
14516 | - ops = ieee80211_get_crypto_ops(param->u.crypt.alg); |
||
14517 | + request_module("ieee80211_crypt_ccmp_rtl"); |
||
14518 | + ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg); |
||
14519 | } |
||
14520 | if (ops == NULL) { |
||
14521 | printk("unknown crypto alg '%s'\n", param->u.crypt.alg); |
||
14522 | @@ -2442,7 +2490,7 @@ |
||
14523 | if (*crypt == NULL || (*crypt)->ops != ops) { |
||
14524 | struct ieee80211_crypt_data *new_crypt; |
||
14525 | |||
14526 | - ieee80211_crypt_delayed_deinit(ieee, crypt); |
||
14527 | + ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt); |
||
14528 | |||
14529 | new_crypt = (struct ieee80211_crypt_data *) |
||
14530 | kmalloc(sizeof(*new_crypt), GFP_KERNEL); |
||
14531 | @@ -2525,7 +2573,7 @@ |
||
14532 | |||
14533 | |||
14534 | |||
14535 | -int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p) |
||
14536 | +int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p) |
||
14537 | { |
||
14538 | struct ieee_param *param; |
||
14539 | int ret=0; |
||
14540 | @@ -2537,7 +2585,7 @@ |
||
14541 | ret = -EINVAL; |
||
14542 | goto out; |
||
14543 | } |
||
14544 | - |
||
14545 | + |
||
14546 | param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL); |
||
14547 | if (param == NULL){ |
||
14548 | ret = -ENOMEM; |
||
14549 | @@ -2552,20 +2600,20 @@ |
||
14550 | switch (param->cmd) { |
||
14551 | |||
14552 | case IEEE_CMD_SET_WPA_PARAM: |
||
14553 | - ret = ieee80211_wpa_set_param(ieee, param->u.wpa_param.name, |
||
14554 | + ret = ieee80211_wpa_set_param_rtl7(ieee, param->u.wpa_param.name, |
||
14555 | param->u.wpa_param.value); |
||
14556 | break; |
||
14557 | |||
14558 | case IEEE_CMD_SET_WPA_IE: |
||
14559 | - ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->length); |
||
14560 | + ret = ieee80211_wpa_set_wpa_ie_rtl7(ieee, param, p->length); |
||
14561 | break; |
||
14562 | |||
14563 | case IEEE_CMD_SET_ENCRYPTION: |
||
14564 | - ret = ieee80211_wpa_set_encryption(ieee, param, p->length); |
||
14565 | + ret = ieee80211_wpa_set_encryption_rtl7(ieee, param, p->length); |
||
14566 | break; |
||
14567 | |||
14568 | case IEEE_CMD_MLME: |
||
14569 | - ret = ieee80211_wpa_mlme(ieee, param->u.mlme.command, |
||
14570 | + ret = ieee80211_wpa_mlme_rtl7(ieee, param->u.mlme.command, |
||
14571 | param->u.mlme.reason_code); |
||
14572 | break; |
||
14573 | |||
14574 | @@ -2581,11 +2629,11 @@ |
||
14575 | kfree(param); |
||
14576 | out: |
||
14577 | up(&ieee->wx_sem); |
||
14578 | - |
||
14579 | + |
||
14580 | return ret; |
||
14581 | } |
||
14582 | |||
14583 | -void notify_wx_assoc_event(struct ieee80211_device *ieee) |
||
14584 | +void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee) |
||
14585 | { |
||
14586 | union iwreq_data wrqu; |
||
14587 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
||
14588 | @@ -2597,14 +2645,14 @@ |
||
14589 | } |
||
14590 | |||
14591 | |||
14592 | -EXPORT_SYMBOL(ieee80211_get_beacon); |
||
14593 | -EXPORT_SYMBOL(ieee80211_wake_queue); |
||
14594 | -EXPORT_SYMBOL(ieee80211_stop_queue); |
||
14595 | -EXPORT_SYMBOL(ieee80211_reset_queue); |
||
14596 | -EXPORT_SYMBOL(ieee80211_softmac_stop_protocol); |
||
14597 | -EXPORT_SYMBOL(ieee80211_softmac_start_protocol); |
||
14598 | -EXPORT_SYMBOL(ieee80211_is_shortslot); |
||
14599 | -EXPORT_SYMBOL(ieee80211_is_54g); |
||
14600 | -EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl); |
||
14601 | -EXPORT_SYMBOL(ieee80211_ps_tx_ack); |
||
14602 | -//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame); |
||
14603 | +EXPORT_SYMBOL(ieee80211_get_beacon_rtl7); |
||
14604 | +EXPORT_SYMBOL(ieee80211_wake_queue_rtl7); |
||
14605 | +EXPORT_SYMBOL(ieee80211_stop_queue_rtl7); |
||
14606 | +EXPORT_SYMBOL(ieee80211_reset_queue_rtl7); |
||
14607 | +EXPORT_SYMBOL(ieee80211_softmac_stop_protocol_rtl7); |
||
14608 | +EXPORT_SYMBOL(ieee80211_softmac_start_protocol_rtl7); |
||
14609 | +EXPORT_SYMBOL(ieee80211_is_shortslot_rtl7); |
||
14610 | +EXPORT_SYMBOL(ieee80211_is_54g_rtl7); |
||
14611 | +EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl_rtl7); |
||
14612 | +EXPORT_SYMBOL(ieee80211_ps_tx_ack_rtl7); |
||
14613 | +//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame_rtl7); |
||
14614 | 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 |
||
14615 | --- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac_wx.c 2006-06-06 04:57:54.000000000 +0200 |
||
14616 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac_wx.c 2008-01-30 17:38:11.000000000 +0100 |
||
14617 | @@ -1,7 +1,7 @@ |
||
14618 | /* IEEE 802.11 SoftMAC layer |
||
14619 | * Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it> |
||
14620 | * |
||
14621 | - * Mostly extracted from the rtl8180-sa2400 driver for the |
||
14622 | + * Mostly extracted from the rtl8180-sa2400 driver for the |
||
14623 | * in-kernel generic ieee802.11 stack. |
||
14624 | * |
||
14625 | * Some pieces of code might be stolen from ipw2100 driver |
||
14626 | @@ -18,23 +18,23 @@ |
||
14627 | |||
14628 | /* FIXME: add A freqs */ |
||
14629 | |||
14630 | -const long ieee80211_wlan_frequencies[] = { |
||
14631 | - 2412, 2417, 2422, 2427, |
||
14632 | - 2432, 2437, 2442, 2447, |
||
14633 | - 2452, 2457, 2462, 2467, |
||
14634 | - 2472, 2484 |
||
14635 | +const long ieee80211_wlan_frequencies_rtl7[] = { |
||
14636 | + 2412, 2417, 2422, 2427, |
||
14637 | + 2432, 2437, 2442, 2447, |
||
14638 | + 2452, 2457, 2462, 2467, |
||
14639 | + 2472, 2484 |
||
14640 | }; |
||
14641 | |||
14642 | |||
14643 | -int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a, |
||
14644 | +int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a, |
||
14645 | union iwreq_data *wrqu, char *b) |
||
14646 | { |
||
14647 | int ret; |
||
14648 | struct iw_freq *fwrq = & wrqu->freq; |
||
14649 | |||
14650 | down(&ieee->wx_sem); |
||
14651 | - |
||
14652 | - if(ieee->iw_mode == IW_MODE_INFRA){ |
||
14653 | + |
||
14654 | + if(ieee->iw_mode == IW_MODE_INFRA){ |
||
14655 | ret = -EOPNOTSUPP; |
||
14656 | goto out; |
||
14657 | } |
||
14658 | @@ -45,31 +45,31 @@ |
||
14659 | fwrq->m <= (int) 2.487e8)) { |
||
14660 | int f = fwrq->m / 100000; |
||
14661 | int c = 0; |
||
14662 | - |
||
14663 | - while ((c < 14) && (f != ieee80211_wlan_frequencies[c])) |
||
14664 | + |
||
14665 | + while ((c < 14) && (f != ieee80211_wlan_frequencies_rtl7[c])) |
||
14666 | c++; |
||
14667 | - |
||
14668 | + |
||
14669 | /* hack to fall through */ |
||
14670 | fwrq->e = 0; |
||
14671 | fwrq->m = c + 1; |
||
14672 | } |
||
14673 | } |
||
14674 | - |
||
14675 | - if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){ |
||
14676 | + |
||
14677 | + if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){ |
||
14678 | ret = -EOPNOTSUPP; |
||
14679 | goto out; |
||
14680 | - |
||
14681 | + |
||
14682 | }else { /* Set the channel */ |
||
14683 | - |
||
14684 | - |
||
14685 | + |
||
14686 | + |
||
14687 | ieee->current_network.channel = fwrq->m; |
||
14688 | ieee->set_chan(ieee->dev, ieee->current_network.channel); |
||
14689 | - |
||
14690 | + |
||
14691 | if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER) |
||
14692 | if(ieee->state == IEEE80211_LINKED){ |
||
14693 | - |
||
14694 | - ieee80211_stop_send_beacons(ieee); |
||
14695 | - ieee80211_start_send_beacons(ieee); |
||
14696 | + |
||
14697 | + ieee80211_stop_send_beacons_rtl7(ieee); |
||
14698 | + ieee80211_start_send_beacons_rtl7(ieee); |
||
14699 | } |
||
14700 | } |
||
14701 | |||
14702 | @@ -80,7 +80,7 @@ |
||
14703 | } |
||
14704 | |||
14705 | |||
14706 | -int ieee80211_wx_get_freq(struct ieee80211_device *ieee, |
||
14707 | +int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, |
||
14708 | struct iw_request_info *a, |
||
14709 | union iwreq_data *wrqu, char *b) |
||
14710 | { |
||
14711 | @@ -88,110 +88,110 @@ |
||
14712 | |||
14713 | if (ieee->current_network.channel == 0) |
||
14714 | return -1; |
||
14715 | - |
||
14716 | + |
||
14717 | fwrq->m = ieee->current_network.channel; |
||
14718 | fwrq->e = 0; |
||
14719 | - |
||
14720 | + |
||
14721 | return 0; |
||
14722 | } |
||
14723 | |||
14724 | -int ieee80211_wx_get_wap(struct ieee80211_device *ieee, |
||
14725 | - struct iw_request_info *info, |
||
14726 | +int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee, |
||
14727 | + struct iw_request_info *info, |
||
14728 | union iwreq_data *wrqu, char *extra) |
||
14729 | { |
||
14730 | - unsigned long flags; |
||
14731 | - |
||
14732 | + unsigned long flags; |
||
14733 | + |
||
14734 | wrqu->ap_addr.sa_family = ARPHRD_ETHER; |
||
14735 | - |
||
14736 | + |
||
14737 | if (ieee->iw_mode == IW_MODE_MONITOR) |
||
14738 | return -1; |
||
14739 | - |
||
14740 | + |
||
14741 | /* We want avoid to give to the user inconsistent infos*/ |
||
14742 | spin_lock_irqsave(&ieee->lock, flags); |
||
14743 | - |
||
14744 | - if (ieee->state != IEEE80211_LINKED && |
||
14745 | + |
||
14746 | + if (ieee->state != IEEE80211_LINKED && |
||
14747 | ieee->state != IEEE80211_LINKED_SCANNING && |
||
14748 | ieee->wap_set == 0) |
||
14749 | - |
||
14750 | + |
||
14751 | memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); |
||
14752 | else |
||
14753 | - memcpy(wrqu->ap_addr.sa_data, |
||
14754 | + memcpy(wrqu->ap_addr.sa_data, |
||
14755 | ieee->current_network.bssid, ETH_ALEN); |
||
14756 | - |
||
14757 | + |
||
14758 | spin_unlock_irqrestore(&ieee->lock, flags); |
||
14759 | - |
||
14760 | + |
||
14761 | return 0; |
||
14762 | } |
||
14763 | |||
14764 | |||
14765 | -int ieee80211_wx_set_wap(struct ieee80211_device *ieee, |
||
14766 | +int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee, |
||
14767 | struct iw_request_info *info, |
||
14768 | union iwreq_data *awrq, |
||
14769 | char *extra) |
||
14770 | { |
||
14771 | - |
||
14772 | + |
||
14773 | int ret = 0; |
||
14774 | u8 zero[] = {0,0,0,0,0,0}; |
||
14775 | unsigned long flags; |
||
14776 | - |
||
14777 | + |
||
14778 | + struct sockaddr *temp = NULL; |
||
14779 | short ifup = ieee->proto_started;//dev->flags & IFF_UP; |
||
14780 | - |
||
14781 | + |
||
14782 | ieee->sync_scan_hurryup = 1; |
||
14783 | - |
||
14784 | + |
||
14785 | down(&ieee->wx_sem); |
||
14786 | - |
||
14787 | - struct sockaddr *temp = (struct sockaddr *)awrq; |
||
14788 | - |
||
14789 | + |
||
14790 | + temp = (struct sockaddr *)awrq; |
||
14791 | /* use ifconfig hw ether */ |
||
14792 | if (ieee->iw_mode == IW_MODE_MASTER){ |
||
14793 | ret = -1; |
||
14794 | goto out; |
||
14795 | } |
||
14796 | - |
||
14797 | + |
||
14798 | if (temp->sa_family != ARPHRD_ETHER){ |
||
14799 | ret = -EINVAL; |
||
14800 | goto out; |
||
14801 | } |
||
14802 | - |
||
14803 | + |
||
14804 | if (ifup) |
||
14805 | - ieee80211_stop_protocol(ieee); |
||
14806 | - |
||
14807 | + ieee80211_stop_protocol_rtl7(ieee); |
||
14808 | + |
||
14809 | /* just to avoid to give inconsistent infos in the |
||
14810 | - * get wx method. not really needed otherwise |
||
14811 | + * get wx method. not really needed otherwise |
||
14812 | */ |
||
14813 | spin_lock_irqsave(&ieee->lock, flags); |
||
14814 | - |
||
14815 | - memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN); |
||
14816 | + |
||
14817 | + memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN); |
||
14818 | ieee->wap_set = memcmp(temp->sa_data, zero,ETH_ALEN)!=0; |
||
14819 | - |
||
14820 | + |
||
14821 | spin_unlock_irqrestore(&ieee->lock, flags); |
||
14822 | - |
||
14823 | + |
||
14824 | if (ifup) |
||
14825 | - ieee80211_start_protocol(ieee); |
||
14826 | - |
||
14827 | + ieee80211_start_protocol_rtl7(ieee); |
||
14828 | + |
||
14829 | out: |
||
14830 | up(&ieee->wx_sem); |
||
14831 | return ret; |
||
14832 | } |
||
14833 | - |
||
14834 | - int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b) |
||
14835 | + |
||
14836 | + int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b) |
||
14837 | { |
||
14838 | int len,ret = 0; |
||
14839 | unsigned long flags; |
||
14840 | - |
||
14841 | + |
||
14842 | if (ieee->iw_mode == IW_MODE_MONITOR) |
||
14843 | return -1; |
||
14844 | - |
||
14845 | - /* We want avoid to give to the user inconsistent infos*/ |
||
14846 | + |
||
14847 | + /* We want avoid to give to the user inconsistent infos*/ |
||
14848 | spin_lock_irqsave(&ieee->lock, flags); |
||
14849 | - |
||
14850 | + |
||
14851 | if (ieee->current_network.ssid[0] == '\0' || |
||
14852 | - ieee->current_network.ssid_len == 0){ |
||
14853 | + ieee->current_network.ssid_len == 0){ |
||
14854 | ret = -1; |
||
14855 | goto out; |
||
14856 | } |
||
14857 | - |
||
14858 | - if (ieee->state != IEEE80211_LINKED && |
||
14859 | + |
||
14860 | + if (ieee->state != IEEE80211_LINKED && |
||
14861 | ieee->state != IEEE80211_LINKED_SCANNING && |
||
14862 | ieee->ssid_set == 0){ |
||
14863 | ret = -1; |
||
14864 | @@ -204,59 +204,76 @@ |
||
14865 | |||
14866 | out: |
||
14867 | spin_unlock_irqrestore(&ieee->lock, flags); |
||
14868 | - |
||
14869 | + |
||
14870 | return ret; |
||
14871 | - |
||
14872 | + |
||
14873 | } |
||
14874 | |||
14875 | -int ieee80211_wx_set_rate(struct ieee80211_device *ieee, |
||
14876 | +int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee, |
||
14877 | struct iw_request_info *info, |
||
14878 | union iwreq_data *wrqu, char *extra) |
||
14879 | { |
||
14880 | |||
14881 | u32 target_rate = wrqu->bitrate.value; |
||
14882 | - |
||
14883 | + |
||
14884 | ieee->rate = target_rate/100000; |
||
14885 | //FIXME: we might want to limit rate also in management protocols. |
||
14886 | - return 0; |
||
14887 | + return 0; |
||
14888 | } |
||
14889 | |||
14890 | |||
14891 | |||
14892 | -int ieee80211_wx_get_rate(struct ieee80211_device *ieee, |
||
14893 | - struct iw_request_info *info, |
||
14894 | +int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee, |
||
14895 | + struct iw_request_info *info, |
||
14896 | union iwreq_data *wrqu, char *extra) |
||
14897 | { |
||
14898 | - |
||
14899 | + |
||
14900 | wrqu->bitrate.value = ieee->rate * 100000; |
||
14901 | - |
||
14902 | + |
||
14903 | return 0; |
||
14904 | } |
||
14905 | |||
14906 | -int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a, |
||
14907 | +int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a, |
||
14908 | union iwreq_data *wrqu, char *b) |
||
14909 | { |
||
14910 | - |
||
14911 | + short prev = ieee->raw_tx; |
||
14912 | + |
||
14913 | ieee->sync_scan_hurryup = 1; |
||
14914 | - |
||
14915 | + |
||
14916 | down(&ieee->wx_sem); |
||
14917 | - |
||
14918 | + |
||
14919 | if (wrqu->mode == ieee->iw_mode) |
||
14920 | goto out; |
||
14921 | - |
||
14922 | + |
||
14923 | if (wrqu->mode == IW_MODE_MONITOR){ |
||
14924 | - |
||
14925 | - ieee->dev->type = ARPHRD_IEEE80211; |
||
14926 | + ieee->dev->type = ARPHRD_IEEE80211_PRISM; |
||
14927 | }else{ |
||
14928 | ieee->dev->type = ARPHRD_ETHER; |
||
14929 | } |
||
14930 | - |
||
14931 | + |
||
14932 | if (!ieee->proto_started){ |
||
14933 | ieee->iw_mode = wrqu->mode; |
||
14934 | }else{ |
||
14935 | - ieee80211_stop_protocol(ieee); |
||
14936 | + ieee80211_stop_protocol_rtl7(ieee); |
||
14937 | ieee->iw_mode = wrqu->mode; |
||
14938 | - ieee80211_start_protocol(ieee); |
||
14939 | + ieee80211_start_protocol_rtl7(ieee); |
||
14940 | + } |
||
14941 | + |
||
14942 | + if(ieee->iw_mode == IW_MODE_MONITOR) |
||
14943 | + { |
||
14944 | + ieee->raw_tx = 1; |
||
14945 | + if(prev == 0 && ieee->raw_tx){ |
||
14946 | + if (ieee->data_hard_resume) |
||
14947 | + ieee->data_hard_resume(ieee->dev); |
||
14948 | + |
||
14949 | + netif_carrier_on(ieee->dev); |
||
14950 | + } |
||
14951 | + |
||
14952 | + netif_carrier_on(ieee->dev); |
||
14953 | + } |
||
14954 | + else |
||
14955 | + { |
||
14956 | + ieee->raw_tx = 0; |
||
14957 | } |
||
14958 | |||
14959 | out: |
||
14960 | @@ -264,120 +281,132 @@ |
||
14961 | return 0; |
||
14962 | } |
||
14963 | |||
14964 | -void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee) |
||
14965 | +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) |
||
14966 | +void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work) |
||
14967 | { |
||
14968 | + struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq); |
||
14969 | +#else |
||
14970 | +void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee) |
||
14971 | +{ |
||
14972 | +#endif |
||
14973 | short chan; |
||
14974 | |||
14975 | chan = ieee->current_network.channel; |
||
14976 | - |
||
14977 | + |
||
14978 | netif_carrier_off(ieee->dev); |
||
14979 | - |
||
14980 | + |
||
14981 | if (ieee->data_hard_stop) |
||
14982 | ieee->data_hard_stop(ieee->dev); |
||
14983 | - |
||
14984 | - ieee80211_stop_send_beacons(ieee); |
||
14985 | - |
||
14986 | + |
||
14987 | + ieee80211_stop_send_beacons_rtl7(ieee); |
||
14988 | + |
||
14989 | ieee->state = IEEE80211_LINKED_SCANNING; |
||
14990 | ieee->link_change(ieee->dev); |
||
14991 | - |
||
14992 | - ieee80211_start_scan_syncro(ieee); |
||
14993 | - |
||
14994 | + |
||
14995 | + ieee80211_start_scan_syncro_rtl7(ieee); |
||
14996 | + |
||
14997 | ieee->set_chan(ieee->dev, chan); |
||
14998 | - |
||
14999 | + |
||
15000 | ieee->state = IEEE80211_LINKED; |
||
15001 | ieee->link_change(ieee->dev); |
||
15002 | - |
||
15003 | + |
||
15004 | if (ieee->data_hard_resume) |
||
15005 | ieee->data_hard_resume(ieee->dev); |
||
15006 | - |
||
15007 | + |
||
15008 | if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER) |
||
15009 | - ieee80211_start_send_beacons(ieee); |
||
15010 | - |
||
15011 | + ieee80211_start_send_beacons_rtl7(ieee); |
||
15012 | + |
||
15013 | netif_carrier_on(ieee->dev); |
||
15014 | - |
||
15015 | + |
||
15016 | up(&ieee->wx_sem); |
||
15017 | - |
||
15018 | + |
||
15019 | } |
||
15020 | |||
15021 | -int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a, |
||
15022 | +int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a, |
||
15023 | union iwreq_data *wrqu, char *b) |
||
15024 | { |
||
15025 | int ret = 0; |
||
15026 | - |
||
15027 | + |
||
15028 | down(&ieee->wx_sem); |
||
15029 | - |
||
15030 | - if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){ |
||
15031 | + |
||
15032 | + if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){ |
||
15033 | ret = -1; |
||
15034 | goto out; |
||
15035 | } |
||
15036 | - |
||
15037 | + |
||
15038 | if ( ieee->state == IEEE80211_LINKED){ |
||
15039 | queue_work(ieee->wq, &ieee->wx_sync_scan_wq); |
||
15040 | /* intentionally forget to up sem */ |
||
15041 | return 0; |
||
15042 | } |
||
15043 | - |
||
15044 | + |
||
15045 | out: |
||
15046 | up(&ieee->wx_sem); |
||
15047 | return ret; |
||
15048 | } |
||
15049 | |||
15050 | -int ieee80211_wx_set_essid(struct ieee80211_device *ieee, |
||
15051 | +int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee, |
||
15052 | struct iw_request_info *a, |
||
15053 | union iwreq_data *wrqu, char *extra) |
||
15054 | { |
||
15055 | - |
||
15056 | + |
||
15057 | int ret=0,len; |
||
15058 | short proto_started; |
||
15059 | unsigned long flags; |
||
15060 | - |
||
15061 | + |
||
15062 | ieee->sync_scan_hurryup = 1; |
||
15063 | - |
||
15064 | + |
||
15065 | down(&ieee->wx_sem); |
||
15066 | - |
||
15067 | + |
||
15068 | proto_started = ieee->proto_started; |
||
15069 | - |
||
15070 | + |
||
15071 | if (wrqu->essid.length > IW_ESSID_MAX_SIZE){ |
||
15072 | ret= -E2BIG; |
||
15073 | goto out; |
||
15074 | } |
||
15075 | - |
||
15076 | + |
||
15077 | if (ieee->iw_mode == IW_MODE_MONITOR){ |
||
15078 | ret= -1; |
||
15079 | goto out; |
||
15080 | } |
||
15081 | - |
||
15082 | + |
||
15083 | if(proto_started) |
||
15084 | - ieee80211_stop_protocol(ieee); |
||
15085 | - |
||
15086 | + ieee80211_stop_protocol_rtl7(ieee); |
||
15087 | + |
||
15088 | /* this is just to be sure that the GET wx callback |
||
15089 | * has consisten infos. not needed otherwise |
||
15090 | */ |
||
15091 | spin_lock_irqsave(&ieee->lock, flags); |
||
15092 | - |
||
15093 | + |
||
15094 | if (wrqu->essid.flags && wrqu->essid.length) { |
||
15095 | +#if WIRELESS_EXT > 20 |
||
15096 | + len = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE); |
||
15097 | +#else |
||
15098 | len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE; |
||
15099 | - |
||
15100 | +#endif |
||
15101 | + |
||
15102 | strncpy(ieee->current_network.ssid, extra, len); |
||
15103 | ieee->current_network.ssid_len = len; |
||
15104 | ieee->ssid_set = 1; |
||
15105 | } |
||
15106 | - else{ |
||
15107 | + else{ |
||
15108 | ieee->ssid_set = 0; |
||
15109 | ieee->current_network.ssid[0] = '\0'; |
||
15110 | ieee->current_network.ssid_len = 0; |
||
15111 | } |
||
15112 | - |
||
15113 | + |
||
15114 | spin_unlock_irqrestore(&ieee->lock, flags); |
||
15115 | - |
||
15116 | + |
||
15117 | if (proto_started) |
||
15118 | - ieee80211_start_protocol(ieee); |
||
15119 | + ieee80211_start_protocol_rtl7(ieee); |
||
15120 | out: |
||
15121 | up(&ieee->wx_sem); |
||
15122 | + |
||
15123 | + |
||
15124 | return ret; |
||
15125 | } |
||
15126 | |||
15127 | - int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a, |
||
15128 | + int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a, |
||
15129 | union iwreq_data *wrqu, char *b) |
||
15130 | { |
||
15131 | |||
15132 | @@ -385,23 +414,23 @@ |
||
15133 | return 0; |
||
15134 | } |
||
15135 | |||
15136 | - int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, |
||
15137 | - struct iw_request_info *info, |
||
15138 | + int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee, |
||
15139 | + struct iw_request_info *info, |
||
15140 | union iwreq_data *wrqu, char *extra) |
||
15141 | { |
||
15142 | - |
||
15143 | + |
||
15144 | int *parms = (int *)extra; |
||
15145 | int enable = (parms[0] > 0); |
||
15146 | short prev = ieee->raw_tx; |
||
15147 | |||
15148 | down(&ieee->wx_sem); |
||
15149 | - |
||
15150 | - if(enable) |
||
15151 | + |
||
15152 | + if(enable) |
||
15153 | ieee->raw_tx = 1; |
||
15154 | - else |
||
15155 | + else |
||
15156 | ieee->raw_tx = 0; |
||
15157 | |||
15158 | - printk(KERN_INFO"raw TX is %s\n", |
||
15159 | + printk(KERN_INFO"raw TX is %s\n", |
||
15160 | ieee->raw_tx ? "enabled" : "disabled"); |
||
15161 | |||
15162 | if(ieee->iw_mode == IW_MODE_MONITOR) |
||
15163 | @@ -409,21 +438,21 @@ |
||
15164 | if(prev == 0 && ieee->raw_tx){ |
||
15165 | if (ieee->data_hard_resume) |
||
15166 | ieee->data_hard_resume(ieee->dev); |
||
15167 | - |
||
15168 | - netif_carrier_on(ieee->dev); |
||
15169 | + |
||
15170 | + netif_carrier_on(ieee->dev); |
||
15171 | } |
||
15172 | - |
||
15173 | + |
||
15174 | if(prev && ieee->raw_tx == 1) |
||
15175 | - netif_carrier_off(ieee->dev); |
||
15176 | + netif_carrier_off(ieee->dev); |
||
15177 | } |
||
15178 | - |
||
15179 | + |
||
15180 | up(&ieee->wx_sem); |
||
15181 | - |
||
15182 | + |
||
15183 | return 0; |
||
15184 | } |
||
15185 | - |
||
15186 | -int ieee80211_wx_get_name(struct ieee80211_device *ieee, |
||
15187 | - struct iw_request_info *info, |
||
15188 | + |
||
15189 | +int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee, |
||
15190 | + struct iw_request_info *info, |
||
15191 | union iwreq_data *wrqu, char *extra) |
||
15192 | { |
||
15193 | strcpy(wrqu->name, "802.11"); |
||
15194 | @@ -433,20 +462,20 @@ |
||
15195 | strcat(wrqu->name, "/g"); |
||
15196 | }else if(ieee->modulation & IEEE80211_OFDM_MODULATION) |
||
15197 | strcat(wrqu->name, "g"); |
||
15198 | - |
||
15199 | - if((ieee->state == IEEE80211_LINKED) || |
||
15200 | + |
||
15201 | + if((ieee->state == IEEE80211_LINKED) || |
||
15202 | (ieee->state == IEEE80211_LINKED_SCANNING)) |
||
15203 | strcat(wrqu->name," linked"); |
||
15204 | else if(ieee->state != IEEE80211_NOLINK) |
||
15205 | strcat(wrqu->name," link.."); |
||
15206 | - |
||
15207 | - |
||
15208 | + |
||
15209 | + |
||
15210 | return 0; |
||
15211 | } |
||
15212 | |||
15213 | |||
15214 | /* this is mostly stolen from hostap */ |
||
15215 | -int ieee80211_wx_set_power(struct ieee80211_device *ieee, |
||
15216 | +int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee, |
||
15217 | struct iw_request_info *info, |
||
15218 | union iwreq_data *wrqu, char *extra) |
||
15219 | { |
||
15220 | @@ -457,50 +486,50 @@ |
||
15221 | (!ieee->ps_request_tx_ack) || |
||
15222 | (!ieee->enter_sleep_state) || |
||
15223 | (!ieee->ps_is_queue_empty)){ |
||
15224 | - |
||
15225 | + |
||
15226 | printk("ERROR. PS mode is tryied to be use but\ |
||
15227 | -driver missed a callback\n\n"); |
||
15228 | - |
||
15229 | +driver missed a callback\n\n"); |
||
15230 | + |
||
15231 | return -1; |
||
15232 | } |
||
15233 | - |
||
15234 | + |
||
15235 | down(&ieee->wx_sem); |
||
15236 | - |
||
15237 | + |
||
15238 | if (wrqu->power.disabled){ |
||
15239 | ieee->ps = IEEE80211_PS_DISABLED; |
||
15240 | - |
||
15241 | + |
||
15242 | goto exit; |
||
15243 | } |
||
15244 | switch (wrqu->power.flags & IW_POWER_MODE) { |
||
15245 | case IW_POWER_UNICAST_R: |
||
15246 | ieee->ps = IEEE80211_PS_UNICAST; |
||
15247 | - |
||
15248 | + |
||
15249 | break; |
||
15250 | case IW_POWER_ALL_R: |
||
15251 | - ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST; |
||
15252 | + ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST; |
||
15253 | break; |
||
15254 | - |
||
15255 | + |
||
15256 | case IW_POWER_ON: |
||
15257 | ieee->ps = IEEE80211_PS_DISABLED; |
||
15258 | break; |
||
15259 | - |
||
15260 | + |
||
15261 | default: |
||
15262 | ret = -EINVAL; |
||
15263 | goto exit; |
||
15264 | } |
||
15265 | |||
15266 | if (wrqu->power.flags & IW_POWER_TIMEOUT) { |
||
15267 | - |
||
15268 | + |
||
15269 | ieee->ps_timeout = wrqu->power.value / 1000; |
||
15270 | printk("Timeout %d\n",ieee->ps_timeout); |
||
15271 | } |
||
15272 | - |
||
15273 | + |
||
15274 | if (wrqu->power.flags & IW_POWER_PERIOD) { |
||
15275 | - |
||
15276 | + |
||
15277 | ret = -EOPNOTSUPP; |
||
15278 | goto exit; |
||
15279 | //wrq->value / 1024; |
||
15280 | - |
||
15281 | + |
||
15282 | } |
||
15283 | exit: |
||
15284 | up(&ieee->wx_sem); |
||
15285 | @@ -509,15 +538,15 @@ |
||
15286 | } |
||
15287 | |||
15288 | /* this is stolen from hostap */ |
||
15289 | -int ieee80211_wx_get_power(struct ieee80211_device *ieee, |
||
15290 | +int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee, |
||
15291 | struct iw_request_info *info, |
||
15292 | union iwreq_data *wrqu, char *extra) |
||
15293 | { |
||
15294 | int ret =0; |
||
15295 | - |
||
15296 | + |
||
15297 | down(&ieee->wx_sem); |
||
15298 | - |
||
15299 | - if(ieee->ps == IEEE80211_PS_DISABLED){ |
||
15300 | + |
||
15301 | + if(ieee->ps == IEEE80211_PS_DISABLED){ |
||
15302 | wrqu->power.disabled = 1; |
||
15303 | goto exit; |
||
15304 | } |
||
15305 | @@ -547,19 +576,19 @@ |
||
15306 | |||
15307 | } |
||
15308 | |||
15309 | -EXPORT_SYMBOL(ieee80211_wx_get_essid); |
||
15310 | -EXPORT_SYMBOL(ieee80211_wx_set_essid); |
||
15311 | -EXPORT_SYMBOL(ieee80211_wx_set_rate); |
||
15312 | -EXPORT_SYMBOL(ieee80211_wx_get_rate); |
||
15313 | -EXPORT_SYMBOL(ieee80211_wx_set_wap); |
||
15314 | -EXPORT_SYMBOL(ieee80211_wx_get_wap); |
||
15315 | -EXPORT_SYMBOL(ieee80211_wx_set_mode); |
||
15316 | -EXPORT_SYMBOL(ieee80211_wx_get_mode); |
||
15317 | -EXPORT_SYMBOL(ieee80211_wx_set_scan); |
||
15318 | -EXPORT_SYMBOL(ieee80211_wx_get_freq); |
||
15319 | -EXPORT_SYMBOL(ieee80211_wx_set_freq); |
||
15320 | -EXPORT_SYMBOL(ieee80211_wx_set_rawtx); |
||
15321 | -EXPORT_SYMBOL(ieee80211_wx_get_name); |
||
15322 | -EXPORT_SYMBOL(ieee80211_wx_set_power); |
||
15323 | -EXPORT_SYMBOL(ieee80211_wx_get_power); |
||
15324 | -EXPORT_SYMBOL(ieee80211_wlan_frequencies); |
||
15325 | +EXPORT_SYMBOL(ieee80211_wx_get_essid_rtl7); |
||
15326 | +EXPORT_SYMBOL(ieee80211_wx_set_essid_rtl7); |
||
15327 | +EXPORT_SYMBOL(ieee80211_wx_set_rate_rtl7); |
||
15328 | +EXPORT_SYMBOL(ieee80211_wx_get_rate_rtl7); |
||
15329 | +EXPORT_SYMBOL(ieee80211_wx_set_wap_rtl7); |
||
15330 | +EXPORT_SYMBOL(ieee80211_wx_get_wap_rtl7); |
||
15331 | +EXPORT_SYMBOL(ieee80211_wx_set_mode_rtl7); |
||
15332 | +EXPORT_SYMBOL(ieee80211_wx_get_mode_rtl7); |
||
15333 | +EXPORT_SYMBOL(ieee80211_wx_set_scan_rtl7); |
||
15334 | +EXPORT_SYMBOL(ieee80211_wx_get_freq_rtl7); |
||
15335 | +EXPORT_SYMBOL(ieee80211_wx_set_freq_rtl7); |
||
15336 | +EXPORT_SYMBOL(ieee80211_wx_set_rawtx_rtl7); |
||
15337 | +EXPORT_SYMBOL(ieee80211_wx_get_name_rtl7); |
||
15338 | +EXPORT_SYMBOL(ieee80211_wx_set_power_rtl7); |
||
15339 | +EXPORT_SYMBOL(ieee80211_wx_get_power_rtl7); |
||
15340 | +EXPORT_SYMBOL(ieee80211_wlan_frequencies_rtl7); |
||
15341 | diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_tx.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_tx.c |
||
15342 | --- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_tx.c 2006-06-06 04:57:54.000000000 +0200 |
||
15343 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_tx.c 2008-01-30 17:38:11.000000000 +0100 |
||
15344 | @@ -24,15 +24,14 @@ |
||
15345 | |||
15346 | ****************************************************************************** |
||
15347 | |||
15348 | - Few modifications for Realtek's Wi-Fi drivers by |
||
15349 | + Few modifications for Realtek's Wi-Fi drivers by |
||
15350 | Andrea Merello <andreamrl@tiscali.it> |
||
15351 | - |
||
15352 | - A special thanks goes to Realtek for their support ! |
||
15353 | + |
||
15354 | + A special thanks goes to Realtek for their support ! |
||
15355 | |||
15356 | ******************************************************************************/ |
||
15357 | |||
15358 | #include <linux/compiler.h> |
||
15359 | -#include <linux/config.h> |
||
15360 | #include <linux/errno.h> |
||
15361 | #include <linux/if_arp.h> |
||
15362 | #include <linux/in6.h> |
||
15363 | @@ -52,6 +51,12 @@ |
||
15364 | #include <linux/etherdevice.h> |
||
15365 | #include <asm/uaccess.h> |
||
15366 | |||
15367 | +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) |
||
15368 | +#include <linux/config.h> |
||
15369 | +#else |
||
15370 | +#include <linux/autoconf.h> |
||
15371 | +#endif |
||
15372 | + |
||
15373 | #include "ieee80211.h" |
||
15374 | |||
15375 | |||
15376 | @@ -155,7 +160,7 @@ |
||
15377 | static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; |
||
15378 | static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; |
||
15379 | |||
15380 | -static inline int ieee80211_put_snap(u8 *data, u16 h_proto) |
||
15381 | +static inline int ieee80211_put_snap_rtl7(u8 *data, u16 h_proto) |
||
15382 | { |
||
15383 | struct ieee80211_snap_hdr *snap; |
||
15384 | u8 *oui; |
||
15385 | @@ -178,7 +183,7 @@ |
||
15386 | return SNAP_SIZE + sizeof(u16); |
||
15387 | } |
||
15388 | |||
15389 | -int ieee80211_encrypt_fragment( |
||
15390 | +int ieee80211_encrypt_fragment_rtl7( |
||
15391 | struct ieee80211_device *ieee, |
||
15392 | struct sk_buff *frag, |
||
15393 | int hdr_len) |
||
15394 | @@ -225,7 +230,7 @@ |
||
15395 | } |
||
15396 | |||
15397 | |||
15398 | -void ieee80211_txb_free(struct ieee80211_txb *txb) { |
||
15399 | +void ieee80211_txb_free_rtl7(struct ieee80211_txb *txb) { |
||
15400 | int i; |
||
15401 | if (unlikely(!txb)) |
||
15402 | return; |
||
15403 | @@ -235,7 +240,7 @@ |
||
15404 | kfree(txb); |
||
15405 | } |
||
15406 | |||
15407 | -struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size, |
||
15408 | +struct ieee80211_txb *ieee80211_alloc_txb_rtl7(int nr_frags, int txb_size, |
||
15409 | int gfp_mask) |
||
15410 | { |
||
15411 | struct ieee80211_txb *txb; |
||
15412 | @@ -267,7 +272,7 @@ |
||
15413 | } |
||
15414 | |||
15415 | /* SKBs are added to the ieee->tx_queue. */ |
||
15416 | -int ieee80211_xmit(struct sk_buff *skb, |
||
15417 | +int ieee80211_xmit_rtl7(struct sk_buff *skb, |
||
15418 | struct net_device *dev) |
||
15419 | { |
||
15420 | struct ieee80211_device *ieee = netdev_priv(dev); |
||
15421 | @@ -299,27 +304,27 @@ |
||
15422 | } |
||
15423 | |||
15424 | if(likely(ieee->raw_tx == 0)){ |
||
15425 | - |
||
15426 | + |
||
15427 | if (unlikely(skb->len < SNAP_SIZE + sizeof(u16))) { |
||
15428 | printk(KERN_WARNING "%s: skb too small (%d).\n", |
||
15429 | ieee->dev->name, skb->len); |
||
15430 | goto success; |
||
15431 | } |
||
15432 | - |
||
15433 | - |
||
15434 | + |
||
15435 | + |
||
15436 | ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto); |
||
15437 | - |
||
15438 | + |
||
15439 | crypt = ieee->crypt[ieee->tx_keyidx]; |
||
15440 | - |
||
15441 | + |
||
15442 | encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) && |
||
15443 | ieee->host_encrypt && crypt && crypt->ops; |
||
15444 | - |
||
15445 | + |
||
15446 | if (!encrypt && ieee->ieee802_1x && |
||
15447 | ieee->drop_unencrypted && ether_type != ETH_P_PAE) { |
||
15448 | stats->tx_dropped++; |
||
15449 | goto success; |
||
15450 | } |
||
15451 | - |
||
15452 | + |
||
15453 | #ifdef CONFIG_IEEE80211_DEBUG |
||
15454 | if (crypt && !encrypt && ether_type == ETH_P_PAE) { |
||
15455 | struct eapol *eap = (struct eapol *)(skb->data + |
||
15456 | @@ -328,23 +333,23 @@ |
||
15457 | eap_get_type(eap->type)); |
||
15458 | } |
||
15459 | #endif |
||
15460 | - |
||
15461 | + |
||
15462 | /* Save source and destination addresses */ |
||
15463 | memcpy(&dest, skb->data, ETH_ALEN); |
||
15464 | memcpy(&src, skb->data+ETH_ALEN, ETH_ALEN); |
||
15465 | - |
||
15466 | + |
||
15467 | /* Advance the SKB to the start of the payload */ |
||
15468 | skb_pull(skb, sizeof(struct ethhdr)); |
||
15469 | - |
||
15470 | + |
||
15471 | /* Determine total amount of storage required for TXB packets */ |
||
15472 | bytes = skb->len + SNAP_SIZE + sizeof(u16); |
||
15473 | - |
||
15474 | + |
||
15475 | if (encrypt) |
||
15476 | fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA | |
||
15477 | IEEE80211_FCTL_WEP; |
||
15478 | else |
||
15479 | fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA; |
||
15480 | - |
||
15481 | + |
||
15482 | if (ieee->iw_mode == IW_MODE_INFRA) { |
||
15483 | fc |= IEEE80211_FCTL_TODS; |
||
15484 | /* To DS: Addr1 = BSSID, Addr2 = SA, |
||
15485 | @@ -360,9 +365,9 @@ |
||
15486 | memcpy(&header.addr3, ieee->current_network.bssid, ETH_ALEN); |
||
15487 | } |
||
15488 | header.frame_ctl = cpu_to_le16(fc); |
||
15489 | - |
||
15490 | + |
||
15491 | hdr_len = IEEE80211_3ADDR_LEN; |
||
15492 | - |
||
15493 | + |
||
15494 | /* Determine fragmentation size based on destination (multicast |
||
15495 | * and broadcast are not fragmented) */ |
||
15496 | if (is_multicast_ether_addr(dest) || |
||
15497 | @@ -370,7 +375,7 @@ |
||
15498 | frag_size = MAX_FRAG_THRESHOLD; |
||
15499 | else |
||
15500 | frag_size = ieee->fts; |
||
15501 | - |
||
15502 | + |
||
15503 | /* Determine amount of payload per fragment. Regardless of if |
||
15504 | * this stack is providing the full 802.11 header, one will |
||
15505 | * eventually be affixed to this fragment -- so we must account for |
||
15506 | @@ -379,12 +384,12 @@ |
||
15507 | if (ieee->config & |
||
15508 | (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) |
||
15509 | bytes_per_frag -= IEEE80211_FCS_LEN; |
||
15510 | - |
||
15511 | + |
||
15512 | /* Each fragment may need to have room for encryptiong pre/postfix */ |
||
15513 | if (encrypt) |
||
15514 | bytes_per_frag -= crypt->ops->extra_prefix_len + |
||
15515 | crypt->ops->extra_postfix_len; |
||
15516 | - |
||
15517 | + |
||
15518 | /* Number of fragments is the total bytes_per_frag / |
||
15519 | * payload_per_fragment */ |
||
15520 | nr_frags = bytes / bytes_per_frag; |
||
15521 | @@ -393,11 +398,11 @@ |
||
15522 | nr_frags++; |
||
15523 | else |
||
15524 | bytes_last_frag = bytes_per_frag; |
||
15525 | - |
||
15526 | + |
||
15527 | /* When we allocate the TXB we allocate enough space for the reserve |
||
15528 | * and full fragment bytes (bytes_per_frag doesn't include prefix, |
||
15529 | * postfix, header, FCS, etc.) */ |
||
15530 | - txb = ieee80211_alloc_txb(nr_frags, frag_size, GFP_ATOMIC); |
||
15531 | + txb = ieee80211_alloc_txb_rtl7(nr_frags, frag_size, GFP_ATOMIC); |
||
15532 | if (unlikely(!txb)) { |
||
15533 | printk(KERN_WARNING "%s: Could not allocate TXB\n", |
||
15534 | ieee->dev->name); |
||
15535 | @@ -405,93 +410,94 @@ |
||
15536 | } |
||
15537 | txb->encrypted = encrypt; |
||
15538 | txb->payload_size = bytes; |
||
15539 | - |
||
15540 | + |
||
15541 | for (i = 0; i < nr_frags; i++) { |
||
15542 | skb_frag = txb->fragments[i]; |
||
15543 | - |
||
15544 | + |
||
15545 | if (encrypt) |
||
15546 | skb_reserve(skb_frag, crypt->ops->extra_prefix_len); |
||
15547 | - |
||
15548 | + |
||
15549 | frag_hdr = (struct ieee80211_hdr *)skb_put(skb_frag, hdr_len); |
||
15550 | memcpy(frag_hdr, &header, hdr_len); |
||
15551 | - |
||
15552 | + |
||
15553 | /* If this is not the last fragment, then add the MOREFRAGS |
||
15554 | * bit to the frame control */ |
||
15555 | if (i != nr_frags - 1) { |
||
15556 | frag_hdr->frame_ctl = cpu_to_le16( |
||
15557 | fc | IEEE80211_FCTL_MOREFRAGS); |
||
15558 | bytes = bytes_per_frag; |
||
15559 | - |
||
15560 | + |
||
15561 | } else { |
||
15562 | /* The last fragment takes the remaining length */ |
||
15563 | bytes = bytes_last_frag; |
||
15564 | } |
||
15565 | - |
||
15566 | + |
||
15567 | frag_hdr->seq_ctl = cpu_to_le16(ieee->seq_ctrl<<4 | i); |
||
15568 | - |
||
15569 | - |
||
15570 | + |
||
15571 | + |
||
15572 | /* Put a SNAP header on the first fragment */ |
||
15573 | if (i == 0) { |
||
15574 | - ieee80211_put_snap( |
||
15575 | + ieee80211_put_snap_rtl7( |
||
15576 | skb_put(skb_frag, SNAP_SIZE + sizeof(u16)), |
||
15577 | ether_type); |
||
15578 | bytes -= SNAP_SIZE + sizeof(u16); |
||
15579 | } |
||
15580 | - |
||
15581 | + |
||
15582 | memcpy(skb_put(skb_frag, bytes), skb->data, bytes); |
||
15583 | - |
||
15584 | + |
||
15585 | /* Advance the SKB... */ |
||
15586 | skb_pull(skb, bytes); |
||
15587 | - |
||
15588 | + |
||
15589 | /* Encryption routine will move the header forward in order |
||
15590 | * to insert the IV between the header and the payload */ |
||
15591 | if (encrypt) |
||
15592 | - ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len); |
||
15593 | + ieee80211_encrypt_fragment_rtl7(ieee, skb_frag, hdr_len); |
||
15594 | if (ieee->config & |
||
15595 | (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) |
||
15596 | skb_put(skb_frag, 4); |
||
15597 | } |
||
15598 | - // Advance sequence number in data frame. |
||
15599 | + // Advance sequence number in data frame. |
||
15600 | if (ieee->seq_ctrl == 0xFFF) |
||
15601 | ieee->seq_ctrl = 0; |
||
15602 | else |
||
15603 | ieee->seq_ctrl++; |
||
15604 | //--- |
||
15605 | }else{ |
||
15606 | - if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) { |
||
15607 | +// if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) { |
||
15608 | + if (unlikely(skb->len < 14)) { |
||
15609 | printk(KERN_WARNING "%s: skb too small (%d).\n", |
||
15610 | ieee->dev->name, skb->len); |
||
15611 | goto success; |
||
15612 | } |
||
15613 | - |
||
15614 | - txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC); |
||
15615 | + |
||
15616 | + txb = ieee80211_alloc_txb_rtl7(1, skb->len, GFP_ATOMIC); |
||
15617 | if(!txb){ |
||
15618 | printk(KERN_WARNING "%s: Could not allocate TXB\n", |
||
15619 | ieee->dev->name); |
||
15620 | goto failed; |
||
15621 | } |
||
15622 | - |
||
15623 | + |
||
15624 | txb->encrypted = 0; |
||
15625 | txb->payload_size = skb->len; |
||
15626 | memcpy(skb_put(txb->fragments[0],skb->len), skb->data, skb->len); |
||
15627 | - } |
||
15628 | + } |
||
15629 | |||
15630 | success: |
||
15631 | spin_unlock_irqrestore(&ieee->lock, flags); |
||
15632 | dev_kfree_skb_any(skb); |
||
15633 | if (txb) { |
||
15634 | if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE){ |
||
15635 | - ieee80211_softmac_xmit(txb, ieee); |
||
15636 | + ieee80211_softmac_xmit_rtl7(txb, ieee); |
||
15637 | }else{ |
||
15638 | if ((*ieee->hard_start_xmit)(txb, dev) == 0) { |
||
15639 | stats->tx_packets++; |
||
15640 | stats->tx_bytes += txb->payload_size; |
||
15641 | return 0; |
||
15642 | } |
||
15643 | - ieee80211_txb_free(txb); |
||
15644 | + ieee80211_txb_free_rtl7(txb); |
||
15645 | } |
||
15646 | - |
||
15647 | - |
||
15648 | + |
||
15649 | + |
||
15650 | } |
||
15651 | |||
15652 | return 0; |
||
15653 | @@ -504,4 +510,4 @@ |
||
15654 | |||
15655 | } |
||
15656 | |||
15657 | -EXPORT_SYMBOL(ieee80211_txb_free); |
||
15658 | +EXPORT_SYMBOL(ieee80211_txb_free_rtl7); |
||
15659 | diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_wx.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_wx.c |
||
15660 | --- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_wx.c 2006-06-06 04:57:56.000000000 +0200 |
||
15661 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_wx.c 2008-01-30 17:38:11.000000000 +0100 |
||
15662 | @@ -40,7 +40,7 @@ |
||
15663 | }; |
||
15664 | |||
15665 | #define MAX_CUSTOM_LEN 64 |
||
15666 | -static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, |
||
15667 | +static inline char *ipw2100_translate_scan_rtl7(struct ieee80211_device *ieee, |
||
15668 | char *start, char *stop, |
||
15669 | struct ieee80211_network *network) |
||
15670 | { |
||
15671 | @@ -207,7 +207,7 @@ |
||
15672 | return start; |
||
15673 | } |
||
15674 | |||
15675 | -int ieee80211_wx_get_scan(struct ieee80211_device *ieee, |
||
15676 | +int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee, |
||
15677 | struct iw_request_info *info, |
||
15678 | union iwreq_data *wrqu, char *extra) |
||
15679 | { |
||
15680 | @@ -220,13 +220,14 @@ |
||
15681 | |||
15682 | IEEE80211_DEBUG_WX("Getting scan\n"); |
||
15683 | down(&ieee->wx_sem); |
||
15684 | + printk("GOT WX GET SCAN WX_SEM LOCK"); |
||
15685 | spin_lock_irqsave(&ieee->lock, flags); |
||
15686 | |||
15687 | list_for_each_entry(network, &ieee->network_list, list) { |
||
15688 | i++; |
||
15689 | if (ieee->scan_age == 0 || |
||
15690 | time_after(network->last_scanned + ieee->scan_age, jiffies)) |
||
15691 | - ev = ipw2100_translate_scan(ieee, ev, stop, network); |
||
15692 | + ev = ipw2100_translate_scan_rtl7(ieee, ev, stop, network); |
||
15693 | else |
||
15694 | IEEE80211_DEBUG_SCAN( |
||
15695 | "Not showing network '%s (" |
||
15696 | @@ -247,7 +248,7 @@ |
||
15697 | return 0; |
||
15698 | } |
||
15699 | |||
15700 | -int ieee80211_wx_set_encode(struct ieee80211_device *ieee, |
||
15701 | +int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee, |
||
15702 | struct iw_request_info *info, |
||
15703 | union iwreq_data *wrqu, char *keybuf) |
||
15704 | { |
||
15705 | @@ -259,6 +260,9 @@ |
||
15706 | int i, key, key_provided, len; |
||
15707 | struct ieee80211_crypt_data **crypt; |
||
15708 | |||
15709 | + if (erq->flags & IW_ENCODE_RESTRICTED) |
||
15710 | + return -EINVAL; |
||
15711 | + |
||
15712 | IEEE80211_DEBUG_WX("SET_ENCODE\n"); |
||
15713 | |||
15714 | key = erq->flags & IW_ENCODE_INDEX; |
||
15715 | @@ -281,7 +285,7 @@ |
||
15716 | if (key_provided && *crypt) { |
||
15717 | IEEE80211_DEBUG_WX("Disabling encryption on key %d.\n", |
||
15718 | key); |
||
15719 | - ieee80211_crypt_delayed_deinit(ieee, crypt); |
||
15720 | + ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt); |
||
15721 | } else |
||
15722 | IEEE80211_DEBUG_WX("Disabling encryption.\n"); |
||
15723 | |||
15724 | @@ -291,7 +295,7 @@ |
||
15725 | if (ieee->crypt[i] != NULL) { |
||
15726 | if (key_provided) |
||
15727 | break; |
||
15728 | - ieee80211_crypt_delayed_deinit( |
||
15729 | + ieee80211_crypt_delayed_deinit_rtl7( |
||
15730 | ieee, &ieee->crypt[i]); |
||
15731 | } |
||
15732 | } |
||
15733 | @@ -314,7 +318,7 @@ |
||
15734 | strcmp((*crypt)->ops->name, "WEP") != 0) { |
||
15735 | /* changing to use WEP; deinit previously used algorithm |
||
15736 | * on this key */ |
||
15737 | - ieee80211_crypt_delayed_deinit(ieee, crypt); |
||
15738 | + ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt); |
||
15739 | } |
||
15740 | |||
15741 | if (*crypt == NULL) { |
||
15742 | @@ -326,10 +330,10 @@ |
||
15743 | if (new_crypt == NULL) |
||
15744 | return -ENOMEM; |
||
15745 | memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); |
||
15746 | - new_crypt->ops = ieee80211_get_crypto_ops("WEP"); |
||
15747 | + new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP"); |
||
15748 | if (!new_crypt->ops) { |
||
15749 | - request_module("ieee80211_crypt_wep"); |
||
15750 | - new_crypt->ops = ieee80211_get_crypto_ops("WEP"); |
||
15751 | + request_module("ieee80211_crypt_wep_rtl"); |
||
15752 | + new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP"); |
||
15753 | } |
||
15754 | |||
15755 | if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) |
||
15756 | @@ -340,7 +344,7 @@ |
||
15757 | new_crypt = NULL; |
||
15758 | |||
15759 | printk(KERN_WARNING "%s: could not initialize WEP: " |
||
15760 | - "load module ieee80211_crypt_wep\n", |
||
15761 | + "load module ieee80211_crypt_wep_rtl\n", |
||
15762 | dev->name); |
||
15763 | return -EOPNOTSUPP; |
||
15764 | } |
||
15765 | @@ -418,7 +422,7 @@ |
||
15766 | return 0; |
||
15767 | } |
||
15768 | |||
15769 | -int ieee80211_wx_get_encode(struct ieee80211_device *ieee, |
||
15770 | +int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee, |
||
15771 | struct iw_request_info *info, |
||
15772 | union iwreq_data *wrqu, char *keybuf) |
||
15773 | { |
||
15774 | @@ -430,7 +434,7 @@ |
||
15775 | |||
15776 | if(ieee->iw_mode == IW_MODE_MONITOR) |
||
15777 | return -1; |
||
15778 | - |
||
15779 | + |
||
15780 | key = erq->flags & IW_ENCODE_INDEX; |
||
15781 | if (key) { |
||
15782 | if (key > WEP_KEYS) |
||
15783 | @@ -470,6 +474,6 @@ |
||
15784 | } |
||
15785 | |||
15786 | |||
15787 | -EXPORT_SYMBOL(ieee80211_wx_get_scan); |
||
15788 | -EXPORT_SYMBOL(ieee80211_wx_set_encode); |
||
15789 | -EXPORT_SYMBOL(ieee80211_wx_get_encode); |
||
15790 | +EXPORT_SYMBOL(ieee80211_wx_get_scan_rtl7); |
||
15791 | +EXPORT_SYMBOL(ieee80211_wx_set_encode_rtl7); |
||
15792 | +EXPORT_SYMBOL(ieee80211_wx_get_encode_rtl7); |
||
15793 | diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/Makefile rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/Makefile |
||
15794 | --- rtl8187_linux_26.1010.0622.2006/ieee80211/Makefile 2006-06-06 04:57:54.000000000 +0200 |
||
15795 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/Makefile 2008-01-30 17:38:11.000000000 +0100 |
||
15796 | @@ -17,6 +17,7 @@ |
||
15797 | KVER := $(shell uname -r) |
||
15798 | KSRC := /lib/modules/$(KVER)/build |
||
15799 | INSTALL_PREFIX := |
||
15800 | +PWD = $(shell pwd) |
||
15801 | |||
15802 | all: modules |
||
15803 | |||
15804 | diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/Modules.symvers rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/Modules.symvers |
||
15805 | --- rtl8187_linux_26.1010.0622.2006/ieee80211/Modules.symvers 2006-06-06 04:57:56.000000000 +0200 |
||
15806 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/Modules.symvers 1970-01-01 01:00:00.000000000 +0100 |
||
15807 | @@ -1,43 +0,0 @@ |
||
15808 | -0x232e7944 ieee80211_wlan_frequencies /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15809 | -0xaeae102f free_ieee80211_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl |
||
15810 | -0x279e265f ieee80211_crypt_deinit_handler net/ieee80211/ieee80211_crypt |
||
15811 | -0xc2411d91 ieee80211_stop_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15812 | -0x6ece20e1 ieee80211_wx_get_name_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl |
||
15813 | -0x5d3847ff ieee80211_rx_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15814 | -0x18612027 ieee80211_wx_get_scan_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15815 | -0xa0e03ce1 ieee80211_wx_get_name /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15816 | -0xee25f349 ieee80211_wx_get_mode /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15817 | -0x86013c3d ieee80211_wx_set_mode /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15818 | -0x04493cc0 ieee80211_wx_get_rate /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15819 | -0x6c6df3b4 ieee80211_wx_set_rate /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15820 | -0x82caec02 ieee80211_crypt_deinit_entries net/ieee80211/ieee80211_crypt |
||
15821 | -0x347945bf ieee80211_wx_get_power /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15822 | -0x6379d455 ieee80211_wx_set_power /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15823 | -0xae62ed59 ieee80211_wx_set_scan /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15824 | -0x6621e172 ieee80211_wx_set_freq /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15825 | -0x0e052e06 ieee80211_wx_get_freq /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15826 | -0x283f9f5d ieee80211_unregister_crypto_ops net/ieee80211/ieee80211_crypt |
||
15827 | -0x9da79aac ieee80211_is_shortslot /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15828 | -0x666032dc ieee80211_wx_get_wap /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15829 | -0x9f1cbe0e ieee80211_wx_set_wap /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15830 | -0x73d1d341 ieee80211_wx_set_rawtx /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15831 | -0x2c714184 ieee80211_is_54g /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15832 | -0x6892d598 ieee80211_wpa_supplicant_ioctl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15833 | -0xc062f1f5 ieee80211_ps_tx_ack /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15834 | -0x55534906 ieee80211_get_beacon /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15835 | -0xe2679638 ieee80211_crypt_delayed_deinit net/ieee80211/ieee80211_crypt |
||
15836 | -0x3a0456bc free_ieee80211 net/ieee80211/ieee80211 |
||
15837 | -0x7e1ef2c8 ieee80211_wake_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15838 | -0xc1b81e9f ieee80211_register_crypto_ops net/ieee80211/ieee80211_crypt |
||
15839 | -0x3f795a39 alloc_ieee80211 net/ieee80211/ieee80211 |
||
15840 | -0x89803c23 ieee80211_get_crypto_ops net/ieee80211/ieee80211_crypt |
||
15841 | -0xc6caf2a4 ieee80211_txb_free net/ieee80211/ieee80211 |
||
15842 | -0x49c1422c ieee80211_rx_mgt net/ieee80211/ieee80211 |
||
15843 | -0xbf2b4ebd alloc_ieee80211_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl |
||
15844 | -0xd155f7b8 ieee80211_softmac_stop_protocol /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15845 | -0x9ce2dcde ieee80211_softmac_start_protocol /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15846 | -0x00d74bba ieee80211_wx_get_encode_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15847 | -0x92b5d996 ieee80211_wx_set_encode_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15848 | -0x2ac9bf95 ieee80211_wx_set_essid /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15849 | -0x7dc92e7f ieee80211_wx_get_essid /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15850 | -0xd04740ca ieee80211_reset_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl |
||
15851 | 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 |
||
15852 | --- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod 2006-06-06 04:57:54.000000000 +0200 |
||
15853 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod 2008-02-22 15:33:07.000000000 +0100 |
||
15854 | @@ -1,2 +1,2 @@ |
||
15855 | -/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_ccmp-rtl.ko |
||
15856 | -/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_ccmp.o |
||
15857 | +/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_ccmp-rtl.ko |
||
15858 | +/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_ccmp.o |
||
15859 | 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 |
||
15860 | --- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod 2006-06-06 04:57:54.000000000 +0200 |
||
15861 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod 2008-02-22 15:33:07.000000000 +0100 |
||
15862 | @@ -1,2 +1,2 @@ |
||
15863 | -/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt-rtl.ko |
||
15864 | -/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt.o |
||
15865 | +/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt-rtl.ko |
||
15866 | +/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.o |
||
15867 | 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 |
||
15868 | --- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod 2006-06-06 04:57:54.000000000 +0200 |
||
15869 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod 2008-02-22 15:33:07.000000000 +0100 |
||
15870 | @@ -1,2 +1,2 @@ |
||
15871 | -/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_tkip-rtl.ko |
||
15872 | -/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_tkip.o |
||
15873 | +/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_tkip-rtl.ko |
||
15874 | +/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_tkip.o |
||
15875 | 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 |
||
15876 | --- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod 2006-06-06 04:57:54.000000000 +0200 |
||
15877 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod 2008-02-22 15:33:07.000000000 +0100 |
||
15878 | @@ -1,2 +1,2 @@ |
||
15879 | -/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_wep-rtl.ko |
||
15880 | -/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_wep.o |
||
15881 | +/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_wep-rtl.ko |
||
15882 | +/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_wep.o |
||
15883 | 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 |
||
15884 | --- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211-rtl.mod 2006-06-06 04:57:54.000000000 +0200 |
||
15885 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211-rtl.mod 2008-02-22 15:33:07.000000000 +0100 |
||
15886 | @@ -1,2 +1,2 @@ |
||
15887 | -/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211-rtl.ko |
||
15888 | -/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 |
||
15889 | +/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211-rtl.ko |
||
15890 | +/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 |
||
15891 | diff -Naur rtl8187_linux_26.1010.0622.2006/makedrv~ rtl8187_linux_26.1010.0622.2006_rawtx/makedrv~ |
||
15892 | --- rtl8187_linux_26.1010.0622.2006/makedrv~ 2006-09-05 07:21:10.000000000 +0200 |
||
15893 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/makedrv~ 1970-01-01 01:00:00.000000000 +0100 |
||
15894 | @@ -1,13 +0,0 @@ |
||
15895 | -#!/bin/sh |
||
15896 | - |
||
15897 | -#tar -zxvf stack.tar.gz |
||
15898 | -#tar -zxvf drv.tar.gz |
||
15899 | -cd ieee80211 |
||
15900 | -make clean |
||
15901 | -make |
||
15902 | -cd ../beta-8187 |
||
15903 | -make clean |
||
15904 | -make |
||
15905 | -cd .. |
||
15906 | - |
||
15907 | - |
||
15908 | diff -Naur rtl8187_linux_26.1010.0622.2006/Makefile rtl8187_linux_26.1010.0622.2006_rawtx/Makefile |
||
15909 | --- rtl8187_linux_26.1010.0622.2006/Makefile 1970-01-01 01:00:00.000000000 +0100 |
||
15910 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/Makefile 2008-01-30 17:39:29.000000000 +0100 |
||
15911 | @@ -0,0 +1,38 @@ |
||
15912 | +prefix = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless |
||
15913 | +r8187dir = $(prefix)/rtl8187 |
||
15914 | +ieeedir = $(prefix)/rtl_ieee80211 |
||
15915 | + |
||
15916 | +default: all |
||
15917 | + |
||
15918 | +all: |
||
15919 | + -rm -f ieee80211/Module.symvers 2>/dev/null |
||
15920 | + -rm -f ieee80211/Modules.symvers 2>/dev/null |
||
15921 | + $(MAKE) -C ieee80211 $(@) |
||
15922 | + -chmod +x symvers |
||
15923 | + -./symvers |
||
15924 | + $(MAKE) -C beta-8187 $(@) |
||
15925 | + |
||
15926 | +install: |
||
15927 | + install -d $(ieeedir) |
||
15928 | + install -d $(r8187dir) |
||
15929 | + install -m 644 ./ieee80211/*.ko $(ieeedir) |
||
15930 | + install -m 644 ./beta-8187/*.ko $(r8187dir) |
||
15931 | + -depmod -ae |
||
15932 | + |
||
15933 | +uninstall: |
||
15934 | + -rm -f $(ieeedir)/ieee80211-rtl.ko |
||
15935 | + -rm -f $(ieeedir)/ieee80211_crypt-rtl.ko |
||
15936 | + -rm -f $(ieeedir)/ieee80211_crypt_ccmp-rtl.ko |
||
15937 | + -rm -f $(ieeedir)/ieee80211_crypt_tkip-rtl.ko |
||
15938 | + -rm -f $(ieeedir)/ieee80211_crypt_wep-rtl.ko |
||
15939 | + -rm -f $(r8187dir)/r8187.ko |
||
15940 | + -rm -fr $(ieeedir) |
||
15941 | + -rm -fr $(r8187dir) |
||
15942 | + -depmod -ae |
||
15943 | + |
||
15944 | +clean: |
||
15945 | + $(MAKE) -C ieee80211 $(@) |
||
15946 | + $(MAKE) -C beta-8187 $(@) |
||
15947 | + |
||
15948 | +distclean: clean |
||
15949 | + |
||
15950 | diff -Naur rtl8187_linux_26.1010.0622.2006/ReadMe.txt~ rtl8187_linux_26.1010.0622.2006_rawtx/ReadMe.txt~ |
||
15951 | --- rtl8187_linux_26.1010.0622.2006/ReadMe.txt~ 2006-06-06 10:58:00.000000000 +0200 |
||
15952 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/ReadMe.txt~ 1970-01-01 01:00:00.000000000 +0100 |
||
15953 | @@ -1,129 +0,0 @@ |
||
15954 | -Release Date: 2006-01-13, ver 1.1
|
||
15955 | -RTL8187 Linux driver version 1.1
|
||
15956 | -
|
||
15957 | - --This driver supports RealTek RTL8187 Wireless LAN driver for
|
||
15958 | - Fedora Core 2/3/4/5, Debian 3.1, Mandrake 10.2/Mandriva 2006,
|
||
15959 | - SUSE 9.3/10.1/10.2, Gentoo 3.1, etc.
|
||
15960 | - - Support Client mode for either infrastructure or adhoc mode
|
||
15961 | - - Support WEP and WPAPSK connection
|
||
15962 | -
|
||
15963 | -< Component >
|
||
15964 | -The driver is composed of several parts:
|
||
15965 | - 1. Module source code
|
||
15966 | - stack.tar.gz
|
||
15967 | - drv.tar.gz
|
||
15968 | -
|
||
15969 | - 2. Script ot build the modules
|
||
15970 | - makedrv
|
||
15971 | -
|
||
15972 | - 3. Script to load/unload modules
|
||
15973 | - wlan0up
|
||
15974 | - wlan0down
|
||
15975 | -
|
||
15976 | - 4. Script and configuration for DHCP
|
||
15977 | - wlan0dhcp
|
||
15978 | - ifcfg-wlan0
|
||
15979 | - 4. Supplicant source code:
|
||
15980 | - wpa_supplicant-0.4.9.tar.gz
|
||
15981 | -
|
||
15982 | - 5. Example of supplicant configuration file:
|
||
15983 | - wpa1.conf
|
||
15984 | -
|
||
15985 | -< Installation >
|
||
15986 | -Runing the scripts can finish all operations of building up modules
|
||
15987 | -from the source code and start the nic.
|
||
15988 | - 1. Build up the drivers from the source code
|
||
15989 | - ./makedrv
|
||
15990 | -
|
||
15991 | - 2. load the driver module to kernel and start up nic
|
||
15992 | - ./wlan0up
|
||
15993 | -
|
||
15994 | -< Set wireless lan MIBs >
|
||
15995 | -This driver uses Wireless Extension as an interface allowing you to set
|
||
15996 | -Wireless LAN specific parameters.
|
||
15997 | -
|
||
15998 | -Current driver supports "iwlist" to show the device status of nic
|
||
15999 | - iwlist wlan0 [parameters]
|
||
16000 | -where
|
||
16001 | - parameter explaination [parameters]
|
||
16002 | - ----------------------- -------------
|
||
16003 | - Show available chan and freq freq / channel
|
||
16004 | - Show and Scan BSS and IBSS scan[ning]
|
||
16005 | - Show supported bit-rate rate / bit[rate]
|
||
16006 | - Show Power Management mode power
|
||
16007 | -
|
||
16008 | -For example:
|
||
16009 | - iwlist wlan0 channel
|
||
16010 | - iwlist wlan0 scan
|
||
16011 | - iwlist wlan0 rate
|
||
16012 | - iwlist wlan0 power
|
||
16013 | -
|
||
16014 | -Driver also supports "iwconfig", manipulate driver private ioctls, to set
|
||
16015 | -MIBs.
|
||
16016 | -
|
||
16017 | - iwconfig wlan0 [parameters] [val]
|
||
16018 | -where
|
||
16019 | - parameter explaination [parameters] [val] constraints
|
||
16020 | - ----------------------- ------------- ------------------
|
||
16021 | - Connect to AP by address ap [mac_addr]
|
||
16022 | - Set the essid, join (I)BSS essid [essid]
|
||
16023 | - Set operation mode mode {Managed|Ad-hoc}
|
||
16024 | - Set keys and security mode key/enc[ryption] {N|open|restricted|off}
|
||
16025 | -
|
||
16026 | -For example:
|
||
16027 | - iwconfig wlan0 ap XX:XX:XX:XX:XX:XX
|
||
16028 | - iwconfig wlan0 essid "ap_name"
|
||
16029 | - iwconfig wlan0 mode Ad-hoc
|
||
16030 | - iwconfig wlan0 mode essid "name" mode Ad-hoc
|
||
16031 | - iwconfig wlan0 key 0123456789 [2] open
|
||
16032 | - iwconfig wlan0 key off
|
||
16033 | - iwconfig wlan0 key restricted [3] 0123456789
|
||
16034 | -
|
||
16035 | -< Getting IP address >
|
||
16036 | -After start up the nic, the network needs to obtain an IP address before
|
||
16037 | -transmit/receive data.
|
||
16038 | -This can be done by setting the static IP via "ifconfig wlan0 IP_ADDRESS"
|
||
16039 | -command, or using DHCP.
|
||
16040 | -
|
||
16041 | -If using DHCP, setting steps is as below:
|
||
16042 | - (1)connect to an AP via "iwconfig" settings
|
||
16043 | - iwconfig wlan0 essid [name] or
|
||
16044 | - iwconfig wlan0 ap XX:XX:XX:XX:XX:XX
|
||
16045 | -
|
||
16046 | - (2)run the script which run the dhclient
|
||
16047 | - ./wlan0dhcp
|
||
16048 | -
|
||
16049 | -< WPAPSK >
|
||
16050 | -WPA_SUPPLICANT help the network to communicate under the protection of WPAPSK
|
||
16051 | -mechanism
|
||
16052 | -
|
||
16053 | - (1)Unpack source code of WPA supplicant:
|
||
16054 | - tar -zxvf wpa_supplicant-0.4.9.tar.gz
|
||
16055 | - cd wpa_supplicant-0.4.9
|
||
16056 | -
|
||
16057 | - (2)Create .config file:
|
||
16058 | - cp defconfig .config
|
||
16059 | -
|
||
16060 | - (3)Edit .config file, uncomment the following line:
|
||
16061 | - #CONFIG_DRIVER_IPW=y.
|
||
16062 | -
|
||
16063 | - (4)Build WPA supplicant:
|
||
16064 | - make
|
||
16065 | -
|
||
16066 | - (5)Edit wpa_supplicant.conf to set up SSID and its passphrase.
|
||
16067 | - For example, the following setting in "wpa1.conf" means SSID
|
||
16068 | - to join is "BufAG54_Ch6" and its passphrase is "87654321".
|
||
16069 | - network={
|
||
16070 | - ssid="BufAG54_Ch6"
|
||
16071 | - proto=WPA
|
||
16072 | - key_mgmt=WPA-PSK
|
||
16073 | - pairwise=CCMP TKIP
|
||
16074 | - group=CCMP TKIP WEP104 WEP40
|
||
16075 | - psk="87654321"
|
||
16076 | - priority=2
|
||
16077 | - }
|
||
16078 | -
|
||
16079 | - (6)Execute WPA supplicant (Assume 8187 and related modules had been
|
||
16080 | - loaded):
|
||
16081 | - ./wpa_supplicant -D ipw -c wpa1.conf -i wlan0 &
|
||
16082 | -
|
||
16083 | diff -Naur rtl8187_linux_26.1010.0622.2006/symvers rtl8187_linux_26.1010.0622.2006_rawtx/symvers |
||
16084 | --- rtl8187_linux_26.1010.0622.2006/symvers 1970-01-01 01:00:00.000000000 +0100 |
||
16085 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/symvers 2008-01-30 17:38:11.000000000 +0100 |
||
16086 | @@ -0,0 +1,25 @@ |
||
16087 | +#!/bin/sh |
||
16088 | + |
||
16089 | +cd beta-8187 |
||
16090 | + |
||
16091 | +if [ -e Module.symvers ] |
||
16092 | +then |
||
16093 | + rm Module.symvers |
||
16094 | +fi |
||
16095 | + |
||
16096 | +if [ -e Modules.symvers ] |
||
16097 | +then |
||
16098 | + rm Modules.symvers |
||
16099 | +fi |
||
16100 | + |
||
16101 | +if [ -e ../ieee80211/Module.symvers ] |
||
16102 | +then |
||
16103 | + ln -sf ../ieee80211/Module.symvers ./ |
||
16104 | +fi |
||
16105 | + |
||
16106 | +if [ -e ../ieee80211/Modules.symvers ] |
||
16107 | +then |
||
16108 | + ln -sf ../ieee80211/Modules.symvers ./ |
||
16109 | +fi |
||
16110 | + |
||
16111 | +cd .. |
||
16112 | diff -Naur rtl8187_linux_26.1010.0622.2006/wlan0rmv rtl8187_linux_26.1010.0622.2006_rawtx/wlan0rmv |
||
16113 | --- rtl8187_linux_26.1010.0622.2006/wlan0rmv 2006-09-05 07:21:10.000000000 +0200 |
||
16114 | +++ rtl8187_linux_26.1010.0622.2006_rawtx/wlan0rmv 2008-01-30 17:38:11.000000000 +0100 |
||
16115 | @@ -1,5 +1,9 @@ |
||
16116 | #!/bin/bash |
||
16117 | |||
16118 | -rmmod r8180 |
||
16119 | -rmmod ieee80211_r8180 |
||
16120 | -rmmod ieee80211_crypt_r8180 |
||
16121 | +rmmod rtl8187 2>/dev/null |
||
16122 | +rmmod r8187 2>/dev/null |
||
16123 | +rmmod ieee80211_rtl 2>/dev/null |
||
16124 | +rmmod ieee80211_crypt_ccmp_rtl 2>/dev/null |
||
16125 | +rmmod ieee80211_crypt_tkip_rtl 2>/dev/null |
||
16126 | +rmmod ieee80211_crypt_wep_rtl 2>/dev/null |
||
16127 | +rmmod ieee80211_crypt_rtl 2>/dev/null |