1diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/ieee80211_crypt.h rtl8187_linux_26.1010.0622.2006.modified/beta-8187/ieee80211_crypt.h 2--- rtl8187_linux_26.1010.0622.2006/beta-8187/ieee80211_crypt.h 2006-06-05 19:58:02.000000000 -0700 3+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/ieee80211_crypt.h 2010-05-19 22:18:51.849360466 -0700 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 23diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/ieee80211.h rtl8187_linux_26.1010.0622.2006.modified/beta-8187/ieee80211.h 24--- rtl8187_linux_26.1010.0622.2006/beta-8187/ieee80211.h 2006-06-05 19:58:02.000000000 -0700 25+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/ieee80211.h 2010-05-19 22:18:51.852693450 -0700 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,21 @@ 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+#if WIRELESS_EXT >= 22 405+static inline void *ieee80211_priv_rtl7(struct net_device *dev) 406+#else 407+extern inline void *ieee80211_priv_rtl7(struct net_device *dev) 408+#endif 409 { 410 return ((struct ieee80211_device *)netdev_priv(dev))->priv; 411 } 412 413-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) 414+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len) 415 { 416 /* Single white space is for Linksys APs */ 417 if (essid_len == 1 && essid[0] == ' ') 418@@ -1175,7 +1200,7 @@ 419 return 1; 420 } 421 422-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode) 423+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode) 424 { 425 /* 426 * It is possible for both access points and our device to support 427@@ -1201,7 +1226,7 @@ 428 return 0; 429 } 430 431-extern inline int ieee80211_get_hdrlen(u16 fc) 432+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc) 433 { 434 int hdrlen = 24; 435 436@@ -1229,140 +1254,144 @@ 437 438 439 /* ieee80211.c */ 440-extern void free_ieee80211(struct net_device *dev); 441-extern struct net_device *alloc_ieee80211(int sizeof_priv); 442+extern void free_ieee80211_rtl7(struct net_device *dev); 443+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv); 444 445-extern int ieee80211_set_encryption(struct ieee80211_device *ieee); 446+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee); 447 448 /* ieee80211_tx.c */ 449 450-extern int ieee80211_encrypt_fragment( 451+extern int ieee80211_encrypt_fragment_rtl7( 452 struct ieee80211_device *ieee, 453 struct sk_buff *frag, 454 int hdr_len); 455- 456-extern int ieee80211_xmit(struct sk_buff *skb, 457+ 458+extern int ieee80211_xmit_rtl7(struct sk_buff *skb, 459 struct net_device *dev); 460-extern void ieee80211_txb_free(struct ieee80211_txb *); 461+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *); 462 463 464 /* ieee80211_rx.c */ 465-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, 466+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, 467 struct ieee80211_rx_stats *rx_stats); 468-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, 469+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee, 470 struct ieee80211_hdr *header, 471 struct ieee80211_rx_stats *stats); 472 473 /* ieee80211_wx.c */ 474-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee, 475+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee, 476 struct iw_request_info *info, 477 union iwreq_data *wrqu, char *key); 478-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee, 479+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee, 480 struct iw_request_info *info, 481 union iwreq_data *wrqu, char *key); 482-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee, 483+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee, 484 struct iw_request_info *info, 485 union iwreq_data *wrqu, char *key); 486 /* ieee80211_softmac.c */ 487-extern short ieee80211_is_54g(struct ieee80211_network net); 488-extern short ieee80211_is_shortslot(struct ieee80211_network net); 489-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, 490+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net); 491+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net); 492+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, 493 struct ieee80211_rx_stats *rx_stats, u16 type, 494 u16 stype); 495-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net); 496+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net); 497 498-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee); 499-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee); 500-extern void ieee80211_start_bss(struct ieee80211_device *ieee); 501-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee); 502-extern void ieee80211_start_ibss(struct ieee80211_device *ieee); 503-extern void ieee80211_softmac_init(struct ieee80211_device *ieee); 504-extern void ieee80211_softmac_free(struct ieee80211_device *ieee); 505-extern void ieee80211_associate_abort(struct ieee80211_device *ieee); 506-extern void ieee80211_disassociate(struct ieee80211_device *ieee); 507-extern void ieee80211_stop_scan(struct ieee80211_device *ieee); 508-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee); 509-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee); 510-extern void ieee80211_start_protocol(struct ieee80211_device *ieee); 511-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee); 512-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee); 513-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee); 514-extern void ieee80211_reset_queue(struct ieee80211_device *ieee); 515-extern void ieee80211_wake_queue(struct ieee80211_device *ieee); 516-extern void ieee80211_stop_queue(struct ieee80211_device *ieee); 517-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee); 518-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee); 519-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee); 520-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p); 521-extern void notify_wx_assoc_event(struct ieee80211_device *ieee); 522-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success); 523+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee); 524+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee); 525+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee); 526+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee); 527+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee); 528+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee); 529+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee); 530+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee); 531+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee); 532+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee); 533+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee); 534+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee); 535+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee); 536+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee); 537+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee); 538+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee); 539+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee); 540+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee); 541+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee); 542+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee); 543+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee); 544+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee); 545+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p); 546+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee); 547+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success); 548 549 /* ieee80211_softmac_wx.c */ 550 551-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee, 552- struct iw_request_info *info, 553+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee, 554+ struct iw_request_info *info, 555 union iwreq_data *wrqu, char *ext); 556- 557-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee, 558+ 559+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee, 560 struct iw_request_info *info, 561 union iwreq_data *awrq, 562 char *extra); 563- 564-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b); 565 566-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee, 567+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b); 568+ 569+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee, 570 struct iw_request_info *info, 571 union iwreq_data *wrqu, char *extra); 572- 573-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee, 574- struct iw_request_info *info, 575+ 576+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee, 577+ struct iw_request_info *info, 578 union iwreq_data *wrqu, char *extra); 579- 580-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a, 581+ 582+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a, 583 union iwreq_data *wrqu, char *b); 584- 585-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a, 586+ 587+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a, 588 union iwreq_data *wrqu, char *b); 589- 590-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee, 591+ 592+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee, 593 struct iw_request_info *a, 594 union iwreq_data *wrqu, char *extra); 595- 596-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a, 597+ 598+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a, 599 union iwreq_data *wrqu, char *b); 600 601-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a, 602+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a, 603 union iwreq_data *wrqu, char *b); 604 605-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a, 606+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a, 607 union iwreq_data *wrqu, char *b); 608 609-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee); 610+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) 611+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work); 612+#else 613+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee); 614+#endif 615 616-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, 617- struct iw_request_info *info, 618+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee, 619+ struct iw_request_info *info, 620 union iwreq_data *wrqu, char *extra); 621- 622-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee, 623- struct iw_request_info *info, 624+ 625+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee, 626+ struct iw_request_info *info, 627 union iwreq_data *wrqu, char *extra); 628 629-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee, 630+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee, 631 struct iw_request_info *info, 632 union iwreq_data *wrqu, char *extra); 633 634-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee, 635+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee, 636 struct iw_request_info *info, 637 union iwreq_data *wrqu, char *extra); 638- 639-extern const long ieee80211_wlan_frequencies[]; 640 641-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee) 642+extern const long ieee80211_wlan_frequencies_rtl7[]; 643+ 644+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee) 645 { 646 ieee->scans++; 647 } 648 649-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee) 650+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee) 651 { 652 return ieee->scans; 653 } 654@@ -1372,7 +1401,7 @@ 655 const char *s = essid; 656 char *d = escaped; 657 658- if (ieee80211_is_empty_essid(essid, essid_len)) { 659+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) { 660 memcpy(escaped, "<hidden>", sizeof("<hidden>")); 661 return escaped; 662 } 663@@ -1390,4 +1419,5 @@ 664 *d = '\0'; 665 return escaped; 666 } 667+ 668 #endif /* IEEE80211_H */ 669diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/Makefile rtl8187_linux_26.1010.0622.2006.modified/beta-8187/Makefile 670--- rtl8187_linux_26.1010.0622.2006/beta-8187/Makefile 2006-06-05 19:58:00.000000000 -0700 671+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/Makefile 2010-05-19 22:18:51.859361932 -0700 672@@ -18,6 +18,8 @@ 673 KVER := $(shell uname -r) 674 KSRC := /lib/modules/$(KVER)/build 675 INSTALL_PREFIX := 676+PWD = $(shell pwd) 677+ 678 all: modules 679 680 clean: 681diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/modules.order rtl8187_linux_26.1010.0622.2006.modified/beta-8187/modules.order 682--- rtl8187_linux_26.1010.0622.2006/beta-8187/modules.order 1969-12-31 16:00:00.000000000 -0800 683+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/modules.order 2010-05-19 22:24:09.389327640 -0700 684@@ -0,0 +1 @@ 685+kernel//home/dsk/repos/rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.ko 686diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/Module.symvers rtl8187_linux_26.1010.0622.2006.modified/beta-8187/Module.symvers 687--- rtl8187_linux_26.1010.0622.2006/beta-8187/Module.symvers 1969-12-31 16:00:00.000000000 -0800 688+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/Module.symvers 2010-05-19 22:24:10.342666003 -0700 689@@ -0,0 +1,41 @@ 690+0x00000000 ieee80211_softmac_start_protocol_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 691+0x00000000 free_ieee80211_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 692+0x00000000 ieee80211_wx_get_name_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 693+0x00000000 ieee80211_wx_get_mode_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 694+0x00000000 ieee80211_wx_set_mode_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 695+0x00000000 ieee80211_wx_get_rate_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 696+0x00000000 ieee80211_wx_set_rate_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 697+0x00000000 ieee80211_wx_get_scan_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 698+0x00000000 ieee80211_wx_set_scan_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 699+0x00000000 ieee80211_wx_set_freq_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 700+0x00000000 ieee80211_wx_get_freq_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 701+0x00000000 ieee80211_register_crypto_ops_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl EXPORT_SYMBOL 702+0x00000000 ieee80211_ps_tx_ack_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 703+0x00000000 ieee80211_rx_mgt_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 704+0x00000000 ieee80211_unregister_crypto_ops_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl EXPORT_SYMBOL 705+0x00000000 ieee80211_wx_set_essid_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 706+0x00000000 ieee80211_wx_get_essid_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 707+0x00000000 ieee80211_stop_queue_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 708+0x00000000 ieee80211_rx_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 709+0x00000000 ieee80211_crypt_deinit_handler_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl EXPORT_SYMBOL 710+0x00000000 ieee80211_wx_get_wap_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 711+0x00000000 ieee80211_wx_set_wap_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 712+0x00000000 ieee80211_wlan_frequencies_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 713+0x00000000 ieee80211_get_crypto_ops_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl EXPORT_SYMBOL 714+0x00000000 ieee80211_xmit_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 715+0x00000000 ieee80211_wx_get_power_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 716+0x00000000 ieee80211_wx_set_power_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 717+0x00000000 ieee80211_crypt_deinit_entries_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl EXPORT_SYMBOL 718+0x00000000 ieee80211_is_54g_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 719+0x00000000 ieee80211_get_beacon_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 720+0x00000000 ieee80211_is_shortslot_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 721+0x00000000 ieee80211_wx_set_rawtx_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 722+0x00000000 ieee80211_reset_queue_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 723+0x00000000 ieee80211_softmac_stop_protocol_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 724+0x00000000 ieee80211_wpa_supplicant_ioctl_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 725+0x00000000 alloc_ieee80211_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 726+0x00000000 ieee80211_txb_free_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 727+0x00000000 ieee80211_wake_queue_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 728+0x00000000 ieee80211_crypt_delayed_deinit_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl EXPORT_SYMBOL 729+0x00000000 ieee80211_wx_get_encode_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 730+0x00000000 ieee80211_wx_set_encode_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 731diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_93cx6.c rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8180_93cx6.c 732--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_93cx6.c 2006-06-05 19:58:00.000000000 -0700 733+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8180_93cx6.c 2010-05-19 22:18:51.859361932 -0700 734@@ -87,7 +87,7 @@ 735 736 u32 eprom_read(struct net_device *dev, u32 addr) 737 { 738- struct r8180_priv *priv = ieee80211_priv(dev); 739+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 740 short read_cmd[]={1,1,0}; 741 short addr_str[8]; 742 int i; 743diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_hw.h rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8180_hw.h 744--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_hw.h 2006-06-05 19:58:00.000000000 -0700 745+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8180_hw.h 2010-05-19 22:18:51.862696872 -0700 746@@ -646,6 +646,7 @@ 747 #define FFER_INTR ((1<<15)) 748 #define FFER_GWAKE ((1<< 4)) 749 750- 751+#define MAX_TX_POWER 27 752+#define MIN_TX_POWER 20 753 754 #endif 755diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.c rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8180_rtl8225.c 756--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.c 2006-06-05 19:58:02.000000000 -0700 757+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8180_rtl8225.c 2010-05-19 22:18:51.866039146 -0700 758@@ -173,7 +173,7 @@ 759 760 void rtl8225_set_gain(struct net_device *dev, short gain) 761 { 762- struct r8180_priv *priv = ieee80211_priv(dev); 763+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 764 765 rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON); 766 767@@ -208,7 +208,7 @@ 768 { 769 #ifdef USE_8051_3WIRE 770 771- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 772+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 773 struct usb_device *udev = priv->udev; 774 //u8 bit; 775 u16 wReg80, wReg82, wReg84; 776@@ -255,7 +255,7 @@ 777 u16 out,select; 778 u8 bit; 779 u32 bangdata = (data << 4) | (adr & 0xf); 780- struct r8180_priv *priv = ieee80211_priv(dev); 781+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 782 783 out = read_nic_word(dev, RFPinsOutput) & 0xfff3; 784 785@@ -349,7 +349,7 @@ 786 787 void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch) 788 { 789- struct r8180_priv *priv = ieee80211_priv(dev); 790+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 791 792 int GainIdx; 793 int GainSetting; 794@@ -454,9 +454,9 @@ 795 796 void rtl8225_rf_set_chan(struct net_device *dev, short ch) 797 { 798- struct r8180_priv *priv = ieee80211_priv(dev); 799+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 800 short gset = (priv->ieee80211->state == IEEE80211_LINKED && 801- ieee80211_is_54g(priv->ieee80211->current_network)) || 802+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) || 803 priv->ieee80211->iw_mode == IW_MODE_MONITOR; 804 805 rtl8225_SetTXPowerLevel(dev, ch); 806@@ -474,7 +474,7 @@ 807 write_nic_byte(dev,DIFS,0x24); //DIFS: 36 808 809 if(priv->ieee80211->state == IEEE80211_LINKED && 810- ieee80211_is_shortslot(priv->ieee80211->current_network)) 811+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network)) 812 write_nic_byte(dev,SLOT,0x9); //SLOT: 9 813 814 else 815@@ -546,7 +546,7 @@ 816 817 void rtl8225_rf_init(struct net_device *dev) 818 { 819- struct r8180_priv *priv = ieee80211_priv(dev); 820+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 821 int i; 822 short channel = 1; 823 u16 brsr; 824diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.h rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8180_rtl8225.h 825--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.h 2006-06-05 19:58:00.000000000 -0700 826+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8180_rtl8225.h 2010-05-19 22:18:51.866039146 -0700 827@@ -44,3 +44,5 @@ 828 extern u32 rtl8225_chan[]; 829 830 #endif 831+ 832+void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch); 833diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225z2.c rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8180_rtl8225z2.c 834--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225z2.c 2006-06-05 19:58:02.000000000 -0700 835+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8180_rtl8225z2.c 2010-05-19 22:18:51.876029926 -0700 836@@ -2,12 +2,12 @@ 837 This is part of the rtl8180-sa2400 driver 838 released under the GPL (See file COPYING for details). 839 Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it> 840- 841- This files contains programming code for the rtl8225 842+ 843+ This files contains programming code for the rtl8225 844 radio frontend. 845- 846+ 847 *Many* thanks to Realtek Corp. for their great support! 848- 849+ 850 */ 851 852 853@@ -32,51 +32,68 @@ 854 }; 855 856 u8 rtl8225z2_gain_a[]={ 857- 0x13,0x27,0x5a,//,0x37,// -82dbm 858- 0x23,0x23,0x58,//,0x37,// -82dbm 859- 0x33,0x1f,0x56,//,0x37,// -82dbm 860- 0x43,0x1b,0x54,//,0x37,// -78dbm 861- 0x53,0x17,0x51,//,0x37,// -74dbm 862- 0x63,0x24,0x4f,//,0x37,// -70dbm 863- 0x73,0x0f,0x4c,//,0x37,// -66dbm 864+ 0x13,0x27,0x5a,//,0x37,// -82dbm 865+ 0x23,0x23,0x58,//,0x37,// -82dbm 866+ 0x33,0x1f,0x56,//,0x37,// -82dbm 867+ 0x43,0x1b,0x54,//,0x37,// -78dbm 868+ 0x53,0x17,0x51,//,0x37,// -74dbm 869+ 0x63,0x24,0x4f,//,0x37,// -70dbm 870+ 0x73,0x0f,0x4c,//,0x37,// -66dbm 871 }; 872 #if 0 873 u32 rtl8225_chan[] = { 874 0, //dummy channel 0 875- 0x085c, //1 876- 0x08dc, //2 877- 0x095c, //3 878- 0x09dc, //4 879- 0x0a5c, //5 880- 0x0adc, //6 881- 0x0b5c, //7 882- 0x0bdc, //8 883- 0x0c5c, //9 884- 0x0cdc, //10 885- 0x0d5c, //11 886- 0x0ddc, //12 887- 0x0e5c, //13 888+ 0x085c, //1 889+ 0x08dc, //2 890+ 0x095c, //3 891+ 0x09dc, //4 892+ 0x0a5c, //5 893+ 0x0adc, //6 894+ 0x0b5c, //7 895+ 0x0bdc, //8 896+ 0x0c5c, //9 897+ 0x0cdc, //10 898+ 0x0d5c, //11 899+ 0x0ddc, //12 900+ 0x0e5c, //13 901 //0x0f5c, //14 902- 0x0f72, // 14 903+ 0x0f72, // 14 904 }; 905 #endif 906 907+#if 1 908 //- 909-u16 rtl8225z2_rxgain[]={ 910+u16 rtl8225z2_rxgain[]={ 911 0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409, 912- 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541, 913+ 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541, 914 0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583, 915- 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644, 916+ 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644, 917 0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688, 918 0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745, 919 0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789, 920 0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793, 921- 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d, 922- 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9, 923- 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3, 924+ 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d, 925+ 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9, 926+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3, 927 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb 928 929 }; 930+#else 931+u16 rtl8225z2_rxgain[]={ 932+ 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0008, 0x0009, 933+ 0x000a, 0x000b, 0x0102, 0x0103, 0x0104, 0x0105, 0x0140, 0x0141, 934+ 0x0142, 0x0143, 0x0144, 0x0145, 0x0180, 0x0181, 0x0182, 0x0183, 935+ 0x0184, 0x0185, 0x0188, 0x0189, 0x018a, 0x018b, 0x0243, 0x0244, 936+ 0x0245, 0x0280, 0x0281, 0x0282, 0x0283, 0x0284, 0x0285, 0x0288, 937+ 0x0289, 0x028a, 0x028b, 0x028c, 0x0342, 0x0343, 0x0344, 0x0345, 938+ 0x0380, 0x0381, 0x0382, 0x0383, 0x0384, 0x0385, 0x0388, 0x0389, 939+ 0x038a, 0x038b, 0x038c, 0x038d, 0x0390, 0x0391, 0x0392, 0x0393, 940+ 0x0394, 0x0395, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 941+ 0x03a0, 0x03a1, 0x03a2, 0x03a3, 0x03a4, 0x03a5, 0x03a8, 0x03a9, 942+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3, 943+ 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb 944+}; 945+#endif 946 947 //2005.11.16, 948 u8 ZEBRA2_CCK_OFDM_GAIN_SETTING[]={ 949@@ -129,23 +146,30 @@ 950 void rtl8225z2_set_gain(struct net_device *dev, short gain) 951 { 952 u8* rtl8225_gain; 953- struct r8180_priv *priv = ieee80211_priv(dev); 954- 955+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 956+ 957 u8 mode = priv->ieee80211->mode; 958- 959- if(mode == IEEE_B || mode == IEEE_G) 960+ 961+ if((mode&IEEE_B) == IEEE_B || (mode&IEEE_G) == IEEE_G) { 962+ //printk(KERN_WARNING "mode ag!\n"); 963 rtl8225_gain = rtl8225z2_gain_bg; 964- else 965+ } else { 966 rtl8225_gain = rtl8225z2_gain_a; 967- 968+ //printk(KERN_WARNING "mode a!\n"); 969+ } 970+ 971 //write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 3]); 972 //write_phy_ofdm(dev, 0x19, rtl8225_gain[gain * 3 + 1]); 973 //write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 2]); 974 //2005.11.17, by ch-hsu 975 write_phy_ofdm(dev, 0x0b, rtl8225_gain[gain * 3]); 976+ mdelay(1); 977 write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 1]); 978+ mdelay(1); 979 write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 3 + 2]); 980- write_phy_ofdm(dev, 0x21, 0x37); 981+ mdelay(1); 982+ write_phy_ofdm(dev, 0x21, 0x17); 983+ mdelay(1); 984 985 } 986 987@@ -153,33 +177,33 @@ 988 989 void rtl8225_set_gain(struct net_device *dev, short gain) 990 { 991- struct r8180_priv *priv = ieee80211_priv(dev); 992- 993+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 994+ 995 rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON); 996- 997+ 998 if(priv->card_8185 == 2) 999 write_phy_ofdm(dev, 0x21, 0x27); 1000 else 1001 write_phy_ofdm(dev, 0x21, 0x37); 1002- 1003+ 1004 write_phy_ofdm(dev, 0x25, 0x20); 1005 write_phy_ofdm(dev, 0x11, 0x6); 1006- 1007+ 1008 if(priv->card_8185 == 1 && priv->card_8185_Bversion) 1009 write_phy_ofdm(dev, 0x27, 0x8); 1010 else 1011 write_phy_ofdm(dev, 0x27, 0x88); 1012- 1013+ 1014 write_phy_ofdm(dev, 0x14, 0); 1015 write_phy_ofdm(dev, 0x16, 0); 1016 write_phy_ofdm(dev, 0x15, 0x40); 1017 write_phy_ofdm(dev, 0x17, 0x40); 1018- 1019+ 1020 write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 4]); 1021 write_phy_ofdm(dev, 0x23, rtl8225_gain[gain * 4 + 1]); 1022 write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 4 + 2]); 1023 write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 4 + 3]); 1024- //rtl8225_set_gain_usb(dev, gain); 1025+ //rtl8225_set_gain_usb(dev, gain); 1026 } 1027 #endif 1028 1029@@ -193,7 +217,7 @@ 1030 // ThreeWireReg tdata; 1031 int i; 1032 short bit, rw; 1033- 1034+ 1035 u8 wLength = 6; 1036 u8 rLength = 12; 1037 u8 low2high = 0; 1038@@ -207,20 +231,20 @@ 1039 1040 dataRead = 0; 1041 1042- oval &= ~0xf; 1043+ oval &= ~0xf; 1044 1045 write_nic_word(dev, RFPinsOutput, oval | BB_HOST_BANG_EN ); udelay(4); 1046 1047 write_nic_word(dev, RFPinsOutput, oval ); udelay(5); 1048- 1049+ 1050 rw = 0; 1051- 1052+ 1053 mask = (low2high) ? 0x01 : (((u32)0x01)<<(32-1)); 1054 for(i = 0; i < wLength/2; i++) 1055 { 1056 bit = ((data2Write&mask) != 0) ? 1 : 0; 1057 write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(1); 1058- 1059+ 1060 write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2); 1061 write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2); 1062 1063@@ -233,9 +257,9 @@ 1064 write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(2); 1065 break; 1066 } 1067- 1068+ 1069 bit = ((data2Write&mask) != 0) ? 1: 0; 1070- 1071+ 1072 write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2); 1073 write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2); 1074 1075@@ -252,22 +276,22 @@ 1076 for(i = 0; i < rLength; i++) 1077 { 1078 write_nic_word(dev, RFPinsOutput, rw|oval); udelay(1); 1079- 1080+ 1081 write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2); 1082 write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2); 1083 write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2); 1084 tmp = read_nic_word(dev, RFPinsInput); 1085- 1086+ 1087 dataRead |= (tmp & BB_HOST_BANG_CLK ? mask : 0); 1088 1089 write_nic_word(dev, RFPinsOutput, (rw|oval)); udelay(2); 1090 1091 mask = (low2high) ? (mask<<1) : (mask>>1); 1092 } 1093- 1094+ 1095 write_nic_word(dev, RFPinsOutput, BB_HOST_BANG_EN|BB_HOST_BANG_RW|oval); udelay(2); 1096 1097- write_nic_word(dev, RFPinsEnable, oval2); 1098+ write_nic_word(dev, RFPinsEnable, oval2); 1099 write_nic_word(dev, RFPinsSelect, oval3); // Set To SW Switch 1100 write_nic_word(dev, RFPinsOutput, 0x3a0); 1101 1102@@ -280,61 +304,61 @@ 1103 u16 out,select; 1104 u8 bit; 1105 u32 bangdata = (data << 4) | (adr & 0xf); 1106- struct r8180_priv *priv = ieee80211_priv(dev); 1107- 1108+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 1109+ 1110 out = read_nic_word(dev, RFPinsOutput) & 0xfff3; 1111- 1112+ 1113 write_nic_word(dev,RFPinsEnable, 1114 (read_nic_word(dev,RFPinsEnable) | 0x7)); 1115- 1116+ 1117 select = read_nic_word(dev, RFPinsSelect); 1118- 1119- write_nic_word(dev, RFPinsSelect, select | 0x7 | 1120+ 1121+ write_nic_word(dev, RFPinsSelect, select | 0x7 | 1122 ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO)); 1123- 1124+ 1125 force_pci_posting(dev); 1126 udelay(10); 1127- 1128+ 1129 write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN );//| 0x1fff); 1130- 1131+ 1132 force_pci_posting(dev); 1133 udelay(2); 1134- 1135+ 1136 write_nic_word(dev, RFPinsOutput, out); 1137- 1138+ 1139 force_pci_posting(dev); 1140 udelay(10); 1141- 1142- 1143+ 1144+ 1145 for(i=15; i>=0;i--){ 1146- 1147+ 1148 bit = (bangdata & (1<<i)) >> i; 1149- 1150+ 1151 write_nic_word(dev, RFPinsOutput, bit | out); 1152- 1153+ 1154 write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK); 1155 write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK); 1156 1157 i--; 1158 bit = (bangdata & (1<<i)) >> i; 1159- 1160+ 1161 write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK); 1162 write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK); 1163 1164 write_nic_word(dev, RFPinsOutput, bit | out); 1165 1166 } 1167- 1168+ 1169 write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN); 1170- 1171+ 1172 force_pci_posting(dev); 1173 udelay(10); 1174 1175- write_nic_word(dev, RFPinsOutput, out | 1176+ write_nic_word(dev, RFPinsOutput, out | 1177 ((priv->card_type == USB) ? 4 : BB_HOST_BANG_EN)); 1178 1179- write_nic_word(dev, RFPinsSelect, select | 1180- ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO)); 1181+ write_nic_word(dev, RFPinsSelect, select | 1182+ ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO)); 1183 1184 if(priv->card_type == USB) 1185 mdelay(2); 1186@@ -348,30 +372,30 @@ 1187 short vz2 = 1; 1188 /* sw to reg pg 1 */ 1189 write_rtl8225(dev, 0, 0x1b7); 1190- 1191+ 1192 /* reg 8 pg 1 = 23*/ 1193 if( read_rtl8225(dev, 8) != 0x588) 1194 vz2 = 0; 1195- 1196- else /* reg 9 pg 1 = 24 */ 1197+ 1198+ else /* reg 9 pg 1 = 24 */ 1199 if( read_rtl8225(dev, 9) != 0x700) 1200 vz2 = 0; 1201- 1202- /* sw back to pg 0 */ 1203+ 1204+ /* sw back to pg 0 */ 1205 write_rtl8225(dev, 0, 0xb7); 1206 1207 return vz2; 1208- 1209+ 1210 } 1211 1212 #if 0 1213 void rtl8225_rf_close(struct net_device *dev) 1214 { 1215- write_rtl8225(dev, 0x4, 0x1f); 1216- 1217+ write_rtl8225(dev, 0x4, 0x1f); 1218+ 1219 force_pci_posting(dev); 1220 mdelay(1); 1221- 1222+ 1223 rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_OFF); 1224 rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_OFF); 1225 } 1226@@ -380,24 +404,24 @@ 1227 short rtl8225_rf_set_sens(struct net_device *dev, short sens) 1228 { 1229 if (sens <0 || sens > 6) return -1; 1230- 1231+ 1232 if(sens > 4) 1233 write_rtl8225(dev, 0x0c, 0x850); 1234- else 1235+ else 1236 write_rtl8225(dev, 0x0c, 0x50); 1237 1238 sens= 6-sens; 1239 rtl8225_set_gain(dev, sens); 1240- 1241+ 1242 write_phy_cck(dev, 0x41, rtl8225_threshold[sens]); 1243 return 0; 1244- 1245+ 1246 } 1247 #endif 1248 void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch) 1249 { 1250- struct r8180_priv *priv = ieee80211_priv(dev); 1251- 1252+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 1253+ 1254 // int GainIdx; 1255 // int GainSetting; 1256 int i; 1257@@ -406,44 +430,48 @@ 1258 u8 max_cck_power_level; 1259 //u8 min_cck_power_level; 1260 u8 max_ofdm_power_level; 1261- u8 min_ofdm_power_level; 1262+ u8 min_ofdm_power_level; 1263 u8 cck_power_level = 0xff & priv->chtxpwr[ch]; 1264 u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch]; 1265- 1266- 1267- max_cck_power_level = 15; 1268+ 1269+ 1270+ max_cck_power_level = 35; 1271 //min_cck_power_level = 0; 1272- max_ofdm_power_level = 25; // 12 -> 25 1273+ max_ofdm_power_level = 35; // 12 -> 25 1274 min_ofdm_power_level = 10; 1275- 1276+ 1277 /* CCK power setting */ 1278 if(cck_power_level > max_cck_power_level) 1279+ { 1280 cck_power_level = max_cck_power_level; 1281- 1282+ priv->chtxpwr[ch] = max_cck_power_level; 1283+ } 1284+ 1285 cck_power_level += priv->cck_txpwr_base; 1286- 1287+ 1288 if(cck_power_level > 35) 1289 cck_power_level = 35; 1290- 1291- if(ch == 14) 1292+ 1293+ if(ch == 14) 1294 cck_power_table = rtl8225z2_tx_power_cck_ch14; 1295- else 1296+ else 1297 cck_power_table = rtl8225z2_tx_power_cck; 1298- 1299- 1300+ 1301+ if(cck_power_level >= 20 && cck_power_level < 30) 1302+ cck_power_level = 19; 1303+ 1304 for(i=0;i<8;i++){ 1305- 1306 power = cck_power_table[i]; 1307 write_phy_cck(dev, 0x44 + i, power); 1308 } 1309- 1310+ 1311 //write_nic_byte(dev, TX_GAIN_CCK, power); 1312 //2005.11.17, 1313 write_nic_byte(dev, TX_GAIN_CCK, ZEBRA2_CCK_OFDM_GAIN_SETTING[cck_power_level]); 1314- 1315+ 1316 force_pci_posting(dev); 1317 mdelay(1); 1318- 1319+ 1320 /* OFDM power setting */ 1321 // Old: 1322 // if(ofdm_power_level > max_ofdm_power_level) 1323@@ -454,26 +482,26 @@ 1324 ofdm_power_level = max_ofdm_power_level; 1325 else 1326 ofdm_power_level += min_ofdm_power_level; 1327- 1328+ 1329 ofdm_power_level += priv->ofdm_txpwr_base; 1330- 1331+ 1332 if(ofdm_power_level > 35) 1333 ofdm_power_level = 35; 1334- 1335+ 1336 rtl8185_set_anaparam2(dev,RTL8225_ANAPARAM2_ON); 1337- 1338+ 1339 write_phy_ofdm(dev,2,0x42); 1340 write_phy_ofdm(dev,5,0); 1341 write_phy_ofdm(dev,6,0x40); 1342 write_phy_ofdm(dev,7,0); 1343- write_phy_ofdm(dev,8,0x40); 1344- 1345+ write_phy_ofdm(dev,8,0x40); 1346+ 1347 1348 //write_nic_byte(dev, TX_GAIN_OFDM, ofdm_power_level); 1349 //2005.11.17, 1350 write_nic_byte(dev, TX_GAIN_OFDM, ZEBRA2_CCK_OFDM_GAIN_SETTING[ofdm_power_level]); 1351 1352- 1353+ 1354 force_pci_posting(dev); 1355 mdelay(1); 1356 //write_nic_byte(dev, TX_AGC_CONTROL,4); 1357@@ -483,39 +511,39 @@ 1358 void rtl8225_set_mode(struct net_device *dev, short modeb) 1359 { 1360 write_phy_ofdm(dev, 0x15, (modeb ? 0x0 : 0x40)); 1361- write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40)); 1362+ write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40)); 1363 } 1364 #endif 1365 1366 void rtl8225z2_rf_set_chan(struct net_device *dev, short ch) 1367 { 1368- struct r8180_priv *priv = ieee80211_priv(dev); 1369+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 1370 short gset = (priv->ieee80211->state == IEEE80211_LINKED && 1371- ieee80211_is_54g(priv->ieee80211->current_network)) || 1372+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) || 1373 priv->ieee80211->iw_mode == IW_MODE_MONITOR; 1374- 1375+ 1376 rtl8225z2_SetTXPowerLevel(dev, ch); 1377- 1378+ 1379 write_rtl8225(dev, 0x7, rtl8225_chan[ch]); 1380- 1381+ 1382 force_pci_posting(dev); 1383 mdelay(10); 1384- 1385+ 1386 write_nic_byte(dev,SIFS,0x22);// SIFS: 0x22 1387- 1388+ 1389 if(gset) 1390- write_nic_byte(dev,DIFS,20); //DIFS: 20 1391+ write_nic_byte(dev,DIFS,20); //DIFS: 20 1392 else 1393- write_nic_byte(dev,DIFS,0x24); //DIFS: 36 1394- 1395+ write_nic_byte(dev,DIFS,0x24); //DIFS: 36 1396+ 1397 if(priv->ieee80211->state == IEEE80211_LINKED && 1398- ieee80211_is_shortslot(priv->ieee80211->current_network)) 1399+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network)) 1400 write_nic_byte(dev,SLOT,0x9); //SLOT: 9 1401- 1402+ 1403 else 1404 write_nic_byte(dev,SLOT,0x14); //SLOT: 20 (0x14) 1405- 1406- 1407+ 1408+ 1409 if(gset){ 1410 write_nic_byte(dev,EIFS,91 - 20); // EIFS: 91 (0x5B) 1411 write_nic_byte(dev,CW_VAL,0x73); //CW VALUE: 0x37 1412@@ -529,68 +557,68 @@ 1413 1414 } 1415 #if 0 1416-void rtl8225_host_pci_init(struct net_device *dev) 1417+void rtl8225_host_pci_init(struct net_device *dev) 1418 { 1419 write_nic_word(dev, RFPinsOutput, 0x480); 1420- 1421+ 1422 rtl8185_rf_pins_enable(dev); 1423- 1424+ 1425 //if(priv->card_8185 == 2 && priv->enable_gpio0 ) /* version D */ 1426 //write_nic_word(dev, RFPinsSelect, 0x88); 1427 //else 1428 write_nic_word(dev, RFPinsSelect, 0x88 | SW_CONTROL_GPIO); /* 0x488 | SW_CONTROL_GPIO */ 1429- 1430+ 1431 write_nic_byte(dev, GP_ENABLE, 0); 1432- 1433+ 1434 force_pci_posting(dev); 1435 mdelay(200); 1436- 1437+ 1438 write_nic_word(dev, GP_ENABLE, 0xff & (~(1<<6))); /* bit 6 is for RF on/off detection */ 1439 1440- 1441+ 1442 } 1443 1444-void rtl8225_host_usb_init(struct net_device *dev) 1445+void rtl8225_host_usb_init(struct net_device *dev) 1446 { 1447 write_nic_byte(dev,RFPinsSelect+1,0); 1448 1449 write_nic_byte(dev,GPIO,0); 1450- 1451+ 1452 write_nic_byte_E(dev,0x53,read_nic_byte_E(dev,0x53) | (1<<7)); 1453- 1454+ 1455 write_nic_byte(dev,RFPinsSelect+1,4); 1456 1457 write_nic_byte(dev,GPIO,0x20); 1458 1459 write_nic_byte(dev,GP_ENABLE,0); 1460 1461- 1462- /* Config BB & RF */ 1463+ 1464+ /* Config BB & RF */ 1465 write_nic_word(dev, RFPinsOutput, 0x80); 1466 1467 write_nic_word(dev, RFPinsSelect, 0x80); 1468 1469 write_nic_word(dev, RFPinsEnable, 0x80); 1470 1471- 1472+ 1473 mdelay(100); 1474 1475- mdelay(1000); 1476+ mdelay(1000); 1477 1478 } 1479 #endif 1480-void rtl8225z2_rf_init(struct net_device *dev) 1481+void rtl8225z2_rf_init(struct net_device *dev) 1482 { 1483- struct r8180_priv *priv = ieee80211_priv(dev); 1484+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 1485 int i; 1486 short channel = 1; 1487 u16 brsr; 1488 u32 data,addr; 1489- 1490+ 1491 priv->chan = channel; 1492 1493 rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON); 1494- 1495+ 1496 1497 if(priv->card_type == USB) 1498 rtl8225_host_usb_init(dev); 1499@@ -598,42 +626,42 @@ 1500 rtl8225_host_pci_init(dev); 1501 1502 write_nic_dword(dev, RF_TIMING, 0x000a8008); 1503- 1504+ 1505 brsr = read_nic_word(dev, BRSR); 1506- 1507- write_nic_word(dev, BRSR, 0xffff); 1508+ 1509+ write_nic_word(dev, BRSR, 0xffff); 1510 1511 1512 write_nic_dword(dev, RF_PARA, 0x100044); 1513- 1514+ 1515 #if 1 //0->1 1516 rtl8180_set_mode(dev, EPROM_CMD_CONFIG); 1517 write_nic_byte(dev, CONFIG3, 0x44); 1518 rtl8180_set_mode(dev, EPROM_CMD_NORMAL); 1519 #endif 1520- 1521- 1522+ 1523+ 1524 rtl8185_rf_pins_enable(dev); 1525 1526 // mdelay(1000); 1527 1528 write_rtl8225(dev, 0x0, 0x2bf); mdelay(1); 1529- 1530- 1531+ 1532+ 1533 write_rtl8225(dev, 0x1, 0xee0); mdelay(1); 1534 1535 write_rtl8225(dev, 0x2, 0x44d); mdelay(1); 1536 1537 write_rtl8225(dev, 0x3, 0x441); mdelay(1); 1538 1539- 1540+ 1541 write_rtl8225(dev, 0x4, 0x8c3);mdelay(1); 1542- 1543- 1544- 1545+ 1546+ 1547+ 1548 write_rtl8225(dev, 0x5, 0xc72);mdelay(1); 1549 // } 1550- 1551+ 1552 write_rtl8225(dev, 0x6, 0xe6); mdelay(1); 1553 1554 write_rtl8225(dev, 0x7, ((priv->card_type == USB)? 0x82a : rtl8225_chan[channel])); mdelay(1); 1555@@ -653,28 +681,28 @@ 1556 1557 write_rtl8225(dev, 0xe, 0x2b); mdelay(1); 1558 1559- write_rtl8225(dev, 0xf, 0x114); 1560- 1561- 1562+ write_rtl8225(dev, 0xf, 0x114); 1563+ 1564+ 1565 mdelay(100); 1566- 1567- 1568+ 1569+ 1570 //if(priv->card_type != USB) /* maybe not needed even for 8185 */ 1571-// write_rtl8225(dev, 0x7, rtl8225_chan[channel]); 1572- 1573+// write_rtl8225(dev, 0x7, rtl8225_chan[channel]); 1574+ 1575 write_rtl8225(dev, 0x0, 0x1b7); 1576- 1577+ 1578 for(i=0;i<95;i++){ 1579 write_rtl8225(dev, 0x1, (u8)(i+1)); 1580- 1581+ 1582 #if 0 1583- if(priv->phy_ver == 1) 1584+ if(priv->phy_ver == 1) 1585 /* version A */ 1586 write_rtl8225(dev, 0x2, rtl8225a_rxgain[i]); 1587 else 1588 #endif 1589 /* version B & C & D*/ 1590- 1591+ 1592 write_rtl8225(dev, 0x2, rtl8225z2_rxgain[i]); 1593 } 1594 write_rtl8225(dev, 0x3, 0x80); 1595@@ -683,16 +711,16 @@ 1596 write_rtl8225(dev, 0x0, 0xb7); 1597 1598 write_rtl8225(dev, 0x2, 0xc4d); 1599- 1600+ 1601 if(priv->card_type == USB){ 1602 // force_pci_posting(dev); 1603 mdelay(200); 1604- 1605+ 1606 write_rtl8225(dev, 0x2, 0x44d); 1607- 1608+ 1609 // force_pci_posting(dev); 1610 mdelay(100); 1611- 1612+ 1613 }//End of if(priv->card_type == USB) 1614 /* FIXME!! rtl8187 we have to check if calibrarion 1615 * is successful and eventually cal. again (repeat 1616@@ -713,23 +741,23 @@ 1617 } 1618 } 1619 //force_pci_posting(dev); 1620- 1621- mdelay(200); //200 for 8187 1622- 1623- 1624+ 1625+ mdelay(200); //200 for 8187 1626+ 1627+ 1628 // //if(priv->card_type != USB){ 1629 // write_rtl8225(dev, 0x2, 0x44d); 1630 // write_rtl8225(dev, 0x7, rtl8225_chan[channel]); 1631 // write_rtl8225(dev, 0x2, 0x47d); 1632-// 1633+// 1634 // force_pci_posting(dev); 1635 // mdelay(100); 1636-// 1637+// 1638 // write_rtl8225(dev, 0x2, 0x44d); 1639 // //} 1640- 1641- write_rtl8225(dev, 0x0, 0x2bf); 1642- 1643+ 1644+ write_rtl8225(dev, 0x0, 0x2bf); 1645+ 1646 if(priv->card_type != USB) 1647 rtl8185_rf_pins_enable(dev); 1648 //set up ZEBRA AGC table, 2005.11.17, 1649@@ -744,20 +772,20 @@ 1650 1651 mdelay(1); 1652 } 1653-#if 0 1654+#if 0 1655 for(i=0;i<128;i++){ 1656 write_phy_ofdm(dev, 0xb, rtl8225_agc[i]); 1657- 1658- mdelay(1); 1659+ 1660+ mdelay(1); 1661 write_phy_ofdm(dev, 0xa, (u8)i+ 0x80); 1662- 1663- mdelay(1); 1664+ 1665+ mdelay(1); 1666 } 1667 #endif 1668- 1669+ 1670 force_pci_posting(dev); 1671 mdelay(1); 1672- 1673+ 1674 write_phy_ofdm(dev, 0x0, 0x1); mdelay(1); 1675 write_phy_ofdm(dev, 0x1, 0x2); mdelay(1); 1676 write_phy_ofdm(dev, 0x2, ((priv->card_type == USB)? 0x42 : 0x62)); mdelay(1); 1677@@ -771,20 +799,20 @@ 1678 1679 write_phy_ofdm(dev, 0xa, 0x8); mdelay(1); 1680 1681- //write_phy_ofdm(dev, 0x18, 0xef); 1682+ //write_phy_ofdm(dev, 0x18, 0xef); 1683 // } 1684 //} 1685 write_phy_ofdm(dev, 0xb, 0x80); mdelay(1); 1686 1687 write_phy_ofdm(dev, 0xc, 0x1);mdelay(1); 1688 1689- 1690+ 1691 //if(priv->card_type != USB) 1692- write_phy_ofdm(dev, 0xd, 0x43); 1693- 1694+ write_phy_ofdm(dev, 0xd, 0x43); 1695+ 1696 write_phy_ofdm(dev, 0xe, 0xd3);mdelay(1); 1697 1698- 1699+ 1700 #if 0 1701 if(priv->card_8185 == 1){ 1702 if(priv->card_8185_Bversion) 1703@@ -796,17 +824,17 @@ 1704 write_phy_ofdm(dev, 0xf, 0x38);mdelay(1); 1705 /*ver D & 8187*/ 1706 // } 1707- 1708+ 1709 // if(priv->card_8185 == 1 && priv->card_8185_Bversion) 1710 // write_phy_ofdm(dev, 0x10, 0x04);/*ver B*/ 1711 // else 1712 write_phy_ofdm(dev, 0x10, 0x84);mdelay(1); 1713 /*ver C & D & 8187*/ 1714- 1715+ 1716 write_phy_ofdm(dev, 0x11, 0x07);mdelay(1); 1717 /*agc resp time 700*/ 1718 1719- 1720+ 1721 // if(priv->card_8185 == 2){ 1722 /* Ver D & 8187*/ 1723 write_phy_ofdm(dev, 0x12, 0x20);mdelay(1); 1724@@ -824,47 +852,46 @@ 1725 write_phy_ofdm(dev, 0x15, 0x40); mdelay(1); 1726 write_phy_ofdm(dev, 0x16, 0x0); mdelay(1); 1727 write_phy_ofdm(dev, 0x17, 0x40); mdelay(1); 1728- 1729+ 1730 // if (priv->card_type == USB) 1731 // write_phy_ofdm(dev, 0x18, 0xef); 1732- 1733+ 1734 write_phy_ofdm(dev, 0x18, 0xef);mdelay(1); 1735- 1736+ 1737 1738 write_phy_ofdm(dev, 0x19, 0x19); mdelay(1); 1739 write_phy_ofdm(dev, 0x1a, 0x20); mdelay(1); 1740 write_phy_ofdm(dev, 0x1b, 0x15);mdelay(1); 1741- 1742+ 1743 write_phy_ofdm(dev, 0x1c, 0x4);mdelay(1); 1744 1745 write_phy_ofdm(dev, 0x1d, 0xc5);mdelay(1); //2005.11.17, 1746- 1747+ 1748 write_phy_ofdm(dev, 0x1e, 0x95);mdelay(1); 1749 1750 write_phy_ofdm(dev, 0x1f, 0x75); mdelay(1); 1751 1752 // } 1753- 1754+ 1755 write_phy_ofdm(dev, 0x20, 0x1f);mdelay(1); 1756 1757 write_phy_ofdm(dev, 0x21, 0x17);mdelay(1); 1758- 1759+ 1760 write_phy_ofdm(dev, 0x22, 0x16);mdelay(1); 1761 1762 // if(priv->card_type != USB) 1763 write_phy_ofdm(dev, 0x23, 0x80);mdelay(1); //FIXME maybe not needed // <> 1764- 1765+ 1766 write_phy_ofdm(dev, 0x24, 0x46); mdelay(1); 1767 write_phy_ofdm(dev, 0x25, 0x00); mdelay(1); 1768 write_phy_ofdm(dev, 0x26, 0x90); mdelay(1); 1769 1770 write_phy_ofdm(dev, 0x27, 0x88); mdelay(1); 1771 1772- 1773+ 1774 // <> Set init. gain to m74dBm. 1775- 1776 rtl8225z2_set_gain(dev,4); 1777- 1778+ 1779 write_phy_cck(dev, 0x0, 0x98); mdelay(1); 1780 write_phy_cck(dev, 0x3, 0x20); mdelay(1); 1781 write_phy_cck(dev, 0x4, 0x7e); mdelay(1); 1782@@ -875,6 +902,9 @@ 1783 /* Ver C & D & 8187*/ 1784 1785 write_phy_cck(dev, 0x8, 0x2e);mdelay(1); 1786+ write_phy_cck(dev, 0x9, 0x11);mdelay(1); 1787+ write_phy_cck(dev, 0xa, 0x17);mdelay(1); 1788+ write_phy_cck(dev, 0xb, 0x11);mdelay(1); 1789 1790 write_phy_cck(dev, 0x10, ((priv->card_type == USB) ? 0x9b: 0x93)); mdelay(1); 1791 write_phy_cck(dev, 0x11, 0x88); mdelay(1); 1792@@ -885,52 +915,59 @@ 1793 else 1794 #endif 1795 write_phy_cck(dev, 0x13, 0xd0); /* Ver C & D & 8187*/ 1796- 1797- write_phy_cck(dev, 0x19, 0x0); 1798- write_phy_cck(dev, 0x1a, 0xa0); 1799- write_phy_cck(dev, 0x1b, 0x8); 1800- write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */ 1801- 1802- write_phy_cck(dev, 0x41, 0x8d);mdelay(1); 1803 1804- 1805+// write_phy_cck(dev, 0x19, 0x0); 1806+// write_phy_cck(dev, 0x1a, 0xa0); 1807+// write_phy_cck(dev, 0x1b, 0x8); 1808+// write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */ 1809+ write_phy_cck(dev, 0x19, 0x0); mdelay(1); 1810+ write_phy_cck(dev, 0x1a, 0xa0); mdelay(1); 1811+ write_phy_cck(dev, 0x1b, 0x8); mdelay(1); 1812+ write_phy_cck(dev, 0x1d, 0x0); mdelay(1); 1813+ write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */ mdelay(1); 1814+ write_phy_cck(dev, 0x41, 0x86); mdelay(1); 1815+ 1816+ 1817+// write_phy_cck(dev, 0x41, 0x8d);mdelay(1); 1818+ 1819+ 1820 write_phy_cck(dev, 0x42, 0x15); mdelay(1); 1821 write_phy_cck(dev, 0x43, 0x18); mdelay(1); 1822- 1823- 1824+ 1825+ 1826 write_phy_cck(dev, 0x44, 0x36); mdelay(1); 1827 write_phy_cck(dev, 0x45, 0x35); mdelay(1); 1828 write_phy_cck(dev, 0x46, 0x2e); mdelay(1); 1829 write_phy_cck(dev, 0x47, 0x25); mdelay(1); 1830 write_phy_cck(dev, 0x48, 0x1c); mdelay(1); 1831 write_phy_cck(dev, 0x49, 0x12); mdelay(1); 1832- write_phy_cck(dev, 0x4a, 0x9); mdelay(1); 1833- write_phy_cck(dev, 0x4b, 0x4); mdelay(1); 1834+ write_phy_cck(dev, 0x4a, 0x09); mdelay(1); 1835+ write_phy_cck(dev, 0x4b, 0x04); mdelay(1); 1836 write_phy_cck(dev, 0x4c, 0x5);mdelay(1); 1837 1838 1839 write_nic_byte(dev, 0x5b, 0x0d); mdelay(1); 1840 1841- 1842+ 1843 1844 // <> 1845 // // TESTR 0xb 8187 1846 // write_phy_cck(dev, 0x10, 0x93);// & 0xfb); 1847-// 1848+// 1849 // //if(priv->card_type != USB){ 1850 // write_phy_ofdm(dev, 0x2, 0x62); 1851 // write_phy_ofdm(dev, 0x6, 0x0); 1852 // write_phy_ofdm(dev, 0x8, 0x0); 1853 // //} 1854- 1855+ 1856 rtl8225z2_SetTXPowerLevel(dev, channel); 1857- 1858+ 1859 write_phy_cck(dev, 0x10, 0x9b); mdelay(1); /* Rx ant A, 0xdb for B */ 1860 write_phy_ofdm(dev, 0x26, 0x90); mdelay(1); /* Rx ant A, 0x10 for B */ 1861- 1862+ 1863 rtl8185_tx_antenna(dev, 0x3); /* TX ant A, 0x0 for B */ 1864- 1865- /* switch to high-speed 3-wire 1866+ 1867+ /* switch to high-speed 3-wire 1868 * last digit. 2 for both cck and ofdm 1869 */ 1870 if(priv->card_type == USB) 1871@@ -943,23 +980,23 @@ 1872 // if(priv->card_type != USB) 1873 // rtl8225_set_gain(dev, 4); /* FIXME this '1' is random */ // <> 1874 // rtl8225_set_mode(dev, 1); /* FIXME start in B mode */ // <> 1875-// 1876+// 1877 // /* make sure is waken up! */ 1878 // write_rtl8225(dev,0x4, 0x9ff); 1879-// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON); 1880+// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON); 1881 // rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON); 1882- 1883+ 1884 rtl8225_rf_set_chan(dev, priv->chan); 1885 1886 //write_nic_word(dev,BRSR,brsr); 1887- 1888+ 1889 //rtl8225z2_rf_set_mode(dev); 1890 } 1891 1892-void rtl8225z2_rf_set_mode(struct net_device *dev) 1893+void rtl8225z2_rf_set_mode(struct net_device *dev) 1894 { 1895- struct r8180_priv *priv = ieee80211_priv(dev); 1896- 1897+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 1898+ 1899 if(priv->ieee80211->mode == IEEE_A) 1900 { 1901 write_rtl8225(dev, 0x5, 0x1865); 1902@@ -970,15 +1007,15 @@ 1903 write_phy_ofdm(dev, 0xb, 0x99); 1904 write_phy_ofdm(dev, 0xf, 0x20); 1905 write_phy_ofdm(dev, 0x11, 0x7); 1906- 1907+ 1908 rtl8225z2_set_gain(dev,4); 1909- 1910+ 1911 write_phy_ofdm(dev,0x15, 0x40); 1912 write_phy_ofdm(dev,0x17, 0x40); 1913- 1914+ 1915 write_nic_dword(dev, 0x94,0x10000000); 1916 }else{ 1917- 1918+ 1919 write_rtl8225(dev, 0x5, 0x1864); 1920 write_nic_dword(dev, RF_PARA, 0x10044); 1921 write_nic_dword(dev, RF_TIMING, 0xa8008); 1922@@ -987,12 +1024,12 @@ 1923 write_phy_ofdm(dev, 0xb, 0x99); 1924 write_phy_ofdm(dev, 0xf, 0x20); 1925 write_phy_ofdm(dev, 0x11, 0x7); 1926- 1927+ 1928 rtl8225z2_set_gain(dev,4); 1929- 1930+ 1931 write_phy_ofdm(dev,0x15, 0x40); 1932 write_phy_ofdm(dev,0x17, 0x40); 1933- 1934+ 1935 write_nic_dword(dev, 0x94,0x04000002); 1936 } 1937 } 1938diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_wx.c rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8180_wx.c 1939--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_wx.c 2006-06-05 19:58:02.000000000 -0700 1940+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8180_wx.c 2010-05-19 22:18:51.882696872 -0700 1941@@ -1,19 +1,19 @@ 1942-/* 1943+/* 1944 This file contains wireless extension handlers. 1945 1946 This is part of rtl8180 OpenSource driver. 1947- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it> 1948+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it> 1949 Released under the terms of GPL (General Public Licence) 1950- 1951- Parts of this driver are based on the GPL part 1952+ 1953+ Parts of this driver are based on the GPL part 1954 of the official realtek driver. 1955- 1956- Parts of this driver are based on the rtl8180 driver skeleton 1957+ 1958+ Parts of this driver are based on the rtl8180 driver skeleton 1959 from Patric Schenke & Andres Salomon. 1960 1961 Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver. 1962- 1963- We want to tanks the Authors of those projects and the Ndiswrapper 1964+ 1965+ We want to tanks the Authors of those projects and the Ndiswrapper 1966 project Authors. 1967 */ 1968 1969@@ -21,20 +21,21 @@ 1970 1971 #include "r8187.h" 1972 #include "r8180_hw.h" 1973+#include "r8180_rtl8225.h" 1974 1975 1976 #define RATE_COUNT 4 1977 u32 rtl8180_rates[] = {1000000,2000000,5500000,11000000, 1978 6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000}; 1979- 1980+ 1981 1982 static int r8180_wx_get_freq(struct net_device *dev, 1983 struct iw_request_info *a, 1984 union iwreq_data *wrqu, char *b) 1985 { 1986- struct r8180_priv *priv = ieee80211_priv(dev); 1987- 1988- return ieee80211_wx_get_freq(priv->ieee80211,a,wrqu,b); 1989+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 1990+ 1991+ return ieee80211_wx_get_freq_rtl7(priv->ieee80211,a,wrqu,b); 1992 } 1993 1994 1995@@ -45,28 +46,28 @@ 1996 { 1997 int *parms = (int *)b; 1998 int bi = parms[0]; 1999- 2000- struct r8180_priv *priv = ieee80211_priv(dev); 2001- 2002+ 2003+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2004+ 2005 down(&priv->wx_sem); 2006 DMESG("setting beacon interval to %x",bi); 2007- 2008+ 2009 priv->ieee80211->beacon_interval=bi; 2010 rtl8180_commit(dev); 2011 up(&priv->wx_sem); 2012- 2013- return 0; 2014+ 2015+ return 0; 2016 } 2017 2018 2019 static int r8180_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa, 2020 union iwreq_data *wrqu, char *extra) 2021 { 2022- struct r8180_priv *priv=ieee80211_priv(dev); 2023+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev); 2024 int *parms = (int *)extra; 2025- 2026+ 2027 priv->ieee80211->force_associate = (parms[0] > 0); 2028- 2029+ 2030 2031 return 0; 2032 } 2033@@ -75,108 +76,228 @@ 2034 static int r8180_wx_get_mode(struct net_device *dev, struct iw_request_info *a, 2035 union iwreq_data *wrqu, char *b) 2036 { 2037- struct r8180_priv *priv=ieee80211_priv(dev); 2038+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev); 2039 2040- return ieee80211_wx_get_mode(priv->ieee80211,a,wrqu,b); 2041+ return ieee80211_wx_get_mode_rtl7(priv->ieee80211,a,wrqu,b); 2042 } 2043 2044 2045 2046-static int r8180_wx_get_rate(struct net_device *dev, 2047- struct iw_request_info *info, 2048+static int r8180_wx_get_rate(struct net_device *dev, 2049+ struct iw_request_info *info, 2050 union iwreq_data *wrqu, char *extra) 2051 { 2052- struct r8180_priv *priv = ieee80211_priv(dev); 2053- return ieee80211_wx_get_rate(priv->ieee80211,info,wrqu,extra); 2054+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2055+ return ieee80211_wx_get_rate_rtl7(priv->ieee80211,info,wrqu,extra); 2056 } 2057 2058 2059 2060-static int r8180_wx_set_rate(struct net_device *dev, 2061- struct iw_request_info *info, 2062+static int r8180_wx_set_rate(struct net_device *dev, 2063+ struct iw_request_info *info, 2064 union iwreq_data *wrqu, char *extra) 2065 { 2066 int ret; 2067- struct r8180_priv *priv = ieee80211_priv(dev); 2068- 2069+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2070+ 2071 down(&priv->wx_sem); 2072+ ret = ieee80211_wx_set_rate_rtl7(priv->ieee80211,info,wrqu,extra); 2073 2074- ret = ieee80211_wx_set_rate(priv->ieee80211,info,wrqu,extra); 2075- 2076 up(&priv->wx_sem); 2077- 2078+ 2079 return ret; 2080 } 2081 2082-static int r8180_wx_set_rawtx(struct net_device *dev, 2083- struct iw_request_info *info, 2084- union iwreq_data *wrqu, char *extra) 2085+static int r8180_wx_get_txpow(struct net_device *dev, 2086+ struct iw_request_info *info, 2087+ union iwreq_data *wrqu, char *extra) 2088 { 2089- struct r8180_priv *priv = ieee80211_priv(dev); 2090- int ret; 2091- 2092+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2093+ int i=0; 2094 down(&priv->wx_sem); 2095- 2096- ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra); 2097- 2098+ wrqu->power.value = 0; 2099+ for(i=0; i<15; i++) 2100+ { 2101+ if(priv->chtxpwr[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr[i]; 2102+ if(priv->chtxpwr_ofdm[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr_ofdm[i]; 2103+ } 2104+ wrqu->power.fixed = 1; 2105+ wrqu->power.flags = IW_TXPOW_DBM; 2106+ wrqu->power.disabled = 0; 2107 up(&priv->wx_sem); 2108- 2109+ 2110+ return 0; 2111+} 2112+ 2113+#if 1 2114+static int r8180_wx_set_txpow(struct net_device *dev, 2115+ struct iw_request_info *info, 2116+ union iwreq_data *wrqu, char *extra) 2117+{ 2118+ int ret = 0, i=0; 2119+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2120+ 2121+ down(&priv->wx_sem); 2122+ 2123+ if (wrqu->power.flags != IW_TXPOW_DBM) 2124+ { 2125+ ret = -EINVAL; 2126+ goto out; 2127+ } 2128+ 2129+ if(!(priv->highpower) && wrqu->power.value > priv->txpwr_max) 2130+ { 2131+ ret = -EINVAL; 2132+ goto out; 2133+ } 2134+ 2135+ if(wrqu->power.value > 35) 2136+ { 2137+ ret = -EINVAL; 2138+ goto out; 2139+ } 2140+ 2141+ if(wrqu->power.value < 0) 2142+ { 2143+ ret = -EINVAL; 2144+ goto out; 2145+ } 2146+ 2147+ for(i=1;i<15;i++) 2148+ { 2149+ priv->chtxpwr[i] = priv->chtxpwr_orig[i] - (priv->txpwr_max - wrqu->power.value); 2150+// if(priv->chtxpwr[i] > priv->chtxpwr_orig[i]) priv->chtxpwr[i] = 0; 2151+ 2152+ priv->chtxpwr_ofdm[i] = priv->chtxpwr_ofdm_orig[i] - (priv->txpwr_max - wrqu->power.value); 2153+// if(priv->chtxpwr_ofdm[i] > priv->chtxpwr_ofdm_orig[i]) priv->chtxpwr_ofdm[i] = 0; 2154+ } 2155+ rtl8225z2_SetTXPowerLevel(dev, 1); 2156+ 2157+ out: 2158+ up(&priv->wx_sem); 2159+ 2160 return ret; 2161- 2162+ 2163 } 2164+#endif 2165 2166-static int r8180_wx_set_crcmon(struct net_device *dev, 2167- struct iw_request_info *info, 2168+static int r8180_wx_set_crcmon(struct net_device *dev, 2169+ struct iw_request_info *info, 2170 union iwreq_data *wrqu, char *extra) 2171 { 2172- struct r8180_priv *priv = ieee80211_priv(dev); 2173+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2174 int *parms = (int *)extra; 2175 int enable = (parms[0] > 0); 2176 short prev = priv->crcmon; 2177 2178 down(&priv->wx_sem); 2179- 2180- if(enable) 2181+ 2182+ if(enable) 2183 priv->crcmon=1; 2184- else 2185+ else 2186 priv->crcmon=0; 2187 2188- DMESG("bad CRC in monitor mode are %s", 2189+ DMESG("bad CRC in monitor mode are %s", 2190 priv->crcmon ? "accepted" : "rejected"); 2191 2192 if(prev != priv->crcmon && priv->up){ 2193 rtl8180_down(dev); 2194 rtl8180_up(dev); 2195 } 2196- 2197+ 2198+ up(&priv->wx_sem); 2199+ 2200+ return 0; 2201+} 2202+ 2203+static int r8180_wx_set_fasttx(struct net_device *dev, 2204+ struct iw_request_info *info, 2205+ union iwreq_data *wrqu, char *extra) 2206+{ 2207+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2208+ int *parms = (int *)extra; 2209+ int enable = (parms[0] > 0); 2210+ short prev = priv->fasttx; 2211+ 2212+ down(&priv->wx_sem); 2213+ 2214+ if(enable) 2215+ priv->fasttx=1; 2216+ else 2217+ priv->fasttx=0; 2218+ 2219+ DMESG("Transmission method (regarding speed) set to: %s", 2220+ priv->fasttx ? "fast" : "normal"); 2221+ 2222+ if(prev != priv->fasttx && priv->up){ 2223+ rtl8180_down(dev); 2224+ rtl8180_up(dev); 2225+ } 2226+ 2227 up(&priv->wx_sem); 2228- 2229+ 2230+ return 0; 2231+} 2232+ 2233+static int r8180_wx_set_highpower(struct net_device *dev, 2234+ struct iw_request_info *info, 2235+ union iwreq_data *wrqu, char *extra) 2236+{ 2237+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2238+ int *parms = (int *)extra; 2239+ int enable = (parms[0] > 0); 2240+ int i=0; 2241+ short prev = priv->highpower; 2242+ 2243+ down(&priv->wx_sem); 2244+ 2245+ if(enable) 2246+ priv->highpower=1; 2247+ else 2248+ priv->highpower=0; 2249+ 2250+ DMESG("Increasable transmission power %s", 2251+ priv->highpower ? "enabled" : "disabled"); 2252+ 2253+ if( (prev != priv->highpower) && !(priv->highpower) && (priv->chtxpwr[1] > priv->chtxpwr_orig[1]) ) 2254+ { 2255+ for(i=1;i<15;i++) 2256+ { 2257+ priv->chtxpwr[i] = priv->chtxpwr_orig[i]; 2258+ priv->chtxpwr_ofdm[i] = priv->chtxpwr_ofdm_orig[i]; 2259+ } 2260+ rtl8225z2_SetTXPowerLevel(dev, 1); 2261+ wrqu->power.value = priv->txpwr_max; 2262+ } 2263+ 2264+ up(&priv->wx_sem); 2265+ 2266 return 0; 2267 } 2268 2269 static int r8180_wx_set_mode(struct net_device *dev, struct iw_request_info *a, 2270 union iwreq_data *wrqu, char *b) 2271 { 2272- struct r8180_priv *priv = ieee80211_priv(dev); 2273+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2274 int ret; 2275- 2276+ 2277 down(&priv->wx_sem); 2278- 2279- ret = ieee80211_wx_set_mode(priv->ieee80211,a,wrqu,b); 2280- 2281+ 2282+ ret = ieee80211_wx_set_mode_rtl7(priv->ieee80211,a,wrqu,b); 2283+ 2284 rtl8187_set_rxconf(dev); 2285- 2286+ 2287 up(&priv->wx_sem); 2288 return ret; 2289 } 2290 2291 2292-static int rtl8180_wx_get_range(struct net_device *dev, 2293- struct iw_request_info *info, 2294+static int rtl8180_wx_get_range(struct net_device *dev, 2295+ struct iw_request_info *info, 2296 union iwreq_data *wrqu, char *extra) 2297 { 2298 struct iw_range *range = (struct iw_range *)extra; 2299- struct r8180_priv *priv = ieee80211_priv(dev); 2300+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2301 u16 val; 2302 int i; 2303 2304@@ -186,26 +307,26 @@ 2305 /* Let's try to keep this struct in the same order as in 2306 * linux/include/wireless.h 2307 */ 2308- 2309+ 2310 /* TODO: See what values we can set, and remove the ones we can't 2311 * set, or fill them with some default data. 2312 */ 2313 2314 /* ~5 Mb/s real (802.11b) */ 2315- range->throughput = 5 * 1000 * 1000; 2316+ range->throughput = 5 * 1000 * 1000; 2317 2318 // TODO: Not used in 802.11b? 2319 // range->min_nwid; /* Minimal NWID we are able to set */ 2320 // TODO: Not used in 802.11b? 2321 // range->max_nwid; /* Maximal NWID we are able to set */ 2322- 2323+ 2324 /* Old Frequency (backward compat - moved lower ) */ 2325-// range->old_num_channels; 2326+// range->old_num_channels; 2327 // range->old_num_frequency; 2328 // range->old_freq[6]; /* Filler to keep "version" at the same offset */ 2329 if(priv->rf_set_sens != NULL) 2330 range->sensitivity = priv->max_sens; /* signal level threshold range */ 2331- 2332+ 2333 range->max_qual.qual = 100; 2334 /* TODO: Find real max RSSI and stick here */ 2335 range->max_qual.level = 0; 2336@@ -219,14 +340,14 @@ 2337 range->avg_qual.updated = 7; /* Updated all three */ 2338 2339 range->num_bitrates = RATE_COUNT; 2340- 2341+ 2342 for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) { 2343 range->bitrate[i] = rtl8180_rates[i]; 2344 } 2345- 2346+ 2347 range->min_frag = MIN_FRAG_THRESHOLD; 2348 range->max_frag = MAX_FRAG_THRESHOLD; 2349- 2350+ 2351 range->pm_capa = 0; 2352 2353 range->we_version_compiled = WIRELESS_EXT; 2354@@ -243,18 +364,18 @@ 2355 range->num_channels = 14; 2356 2357 for (i = 0, val = 0; i < 14; i++) { 2358- 2359+ 2360 // Include only legal frequencies for some countries 2361 if ((priv->challow)[i+1]) { 2362 range->freq[val].i = i + 1; 2363- range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000; 2364+ range->freq[val].m = ieee80211_wlan_frequencies_rtl7[i] * 100000; 2365 range->freq[val].e = 1; 2366 val++; 2367 } else { 2368 // FIXME: do we need to set anything for channels 2369 // we don't use ? 2370 } 2371- 2372+ 2373 if (val == IW_MAX_FREQUENCIES) 2374 break; 2375 } 2376@@ -267,15 +388,15 @@ 2377 static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a, 2378 union iwreq_data *wrqu, char *b) 2379 { 2380- struct r8180_priv *priv = ieee80211_priv(dev); 2381+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2382 int ret; 2383- 2384+ 2385 if(!priv->up) return -1; 2386- 2387+ 2388 down(&priv->wx_sem); 2389- 2390- ret = ieee80211_wx_set_scan(priv->ieee80211,a,wrqu,b); 2391- 2392+ 2393+ ret = ieee80211_wx_set_scan_rtl7(priv->ieee80211,a,wrqu,b); 2394+ 2395 up(&priv->wx_sem); 2396 return ret; 2397 } 2398@@ -286,50 +407,50 @@ 2399 { 2400 2401 int ret; 2402- struct r8180_priv *priv = ieee80211_priv(dev); 2403- 2404+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2405+ 2406 if(!priv->up) return -1; 2407- 2408+ 2409 down(&priv->wx_sem); 2410 2411- ret = ieee80211_wx_get_scan(priv->ieee80211,a,wrqu,b); 2412- 2413+ ret = ieee80211_wx_get_scan_rtl7(priv->ieee80211,a,wrqu,b); 2414+ 2415 up(&priv->wx_sem); 2416- 2417+ 2418 return ret; 2419 } 2420 2421 2422-static int r8180_wx_set_essid(struct net_device *dev, 2423+static int r8180_wx_set_essid(struct net_device *dev, 2424 struct iw_request_info *a, 2425 union iwreq_data *wrqu, char *b) 2426 { 2427- struct r8180_priv *priv = ieee80211_priv(dev); 2428- 2429+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2430+ 2431 int ret; 2432- 2433+ 2434 down(&priv->wx_sem); 2435- 2436- ret = ieee80211_wx_set_essid(priv->ieee80211,a,wrqu,b); 2437- 2438+ 2439+ ret = ieee80211_wx_set_essid_rtl7(priv->ieee80211,a,wrqu,b); 2440+ 2441 up(&priv->wx_sem); 2442 return ret; 2443 } 2444 2445 2446-static int r8180_wx_get_essid(struct net_device *dev, 2447+static int r8180_wx_get_essid(struct net_device *dev, 2448 struct iw_request_info *a, 2449 union iwreq_data *wrqu, char *b) 2450 { 2451 int ret; 2452- struct r8180_priv *priv = ieee80211_priv(dev); 2453- 2454+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2455+ 2456 down(&priv->wx_sem); 2457- 2458- ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b); 2459+ 2460+ ret = ieee80211_wx_get_essid_rtl7(priv->ieee80211, a, wrqu, b); 2461 2462 up(&priv->wx_sem); 2463- 2464+ 2465 return ret; 2466 } 2467 2468@@ -338,30 +459,30 @@ 2469 union iwreq_data *wrqu, char *b) 2470 { 2471 int ret; 2472- struct r8180_priv *priv = ieee80211_priv(dev); 2473- 2474+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2475+ 2476 down(&priv->wx_sem); 2477- 2478- ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b); 2479- 2480+ 2481+ ret = ieee80211_wx_set_freq_rtl7(priv->ieee80211, a, wrqu, b); 2482+ 2483 up(&priv->wx_sem); 2484 return ret; 2485 } 2486 2487-static int r8180_wx_get_name(struct net_device *dev, 2488- struct iw_request_info *info, 2489+static int r8180_wx_get_name(struct net_device *dev, 2490+ struct iw_request_info *info, 2491 union iwreq_data *wrqu, char *extra) 2492 { 2493- struct r8180_priv *priv = ieee80211_priv(dev); 2494- return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra); 2495+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2496+ return ieee80211_wx_get_name_rtl7(priv->ieee80211, info, wrqu, extra); 2497 } 2498 2499 2500-static int r8180_wx_set_frag(struct net_device *dev, 2501- struct iw_request_info *info, 2502+static int r8180_wx_set_frag(struct net_device *dev, 2503+ struct iw_request_info *info, 2504 union iwreq_data *wrqu, char *extra) 2505 { 2506- struct r8180_priv *priv = ieee80211_priv(dev); 2507+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2508 2509 if (wrqu->frag.disabled) 2510 priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD; 2511@@ -369,7 +490,7 @@ 2512 if (wrqu->frag.value < MIN_FRAG_THRESHOLD || 2513 wrqu->frag.value > MAX_FRAG_THRESHOLD) 2514 return -EINVAL; 2515- 2516+ 2517 priv->ieee80211->fts = wrqu->frag.value & ~0x1; 2518 } 2519 2520@@ -377,11 +498,11 @@ 2521 } 2522 2523 2524-static int r8180_wx_get_frag(struct net_device *dev, 2525- struct iw_request_info *info, 2526+static int r8180_wx_get_frag(struct net_device *dev, 2527+ struct iw_request_info *info, 2528 union iwreq_data *wrqu, char *extra) 2529 { 2530- struct r8180_priv *priv = ieee80211_priv(dev); 2531+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2532 2533 wrqu->frag.value = priv->ieee80211->fts; 2534 wrqu->frag.fixed = 0; /* no auto select */ 2535@@ -397,49 +518,49 @@ 2536 char *extra) 2537 { 2538 int ret; 2539- struct r8180_priv *priv = ieee80211_priv(dev); 2540- 2541+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2542+ 2543 down(&priv->wx_sem); 2544- 2545- ret = ieee80211_wx_set_wap(priv->ieee80211,info,awrq,extra); 2546- 2547+ 2548+ ret = ieee80211_wx_set_wap_rtl7(priv->ieee80211,info,awrq,extra); 2549+ 2550 up(&priv->wx_sem); 2551 return ret; 2552- 2553+ 2554 } 2555- 2556 2557-static int r8180_wx_get_wap(struct net_device *dev, 2558- struct iw_request_info *info, 2559+ 2560+static int r8180_wx_get_wap(struct net_device *dev, 2561+ struct iw_request_info *info, 2562 union iwreq_data *wrqu, char *extra) 2563 { 2564- struct r8180_priv *priv = ieee80211_priv(dev); 2565- 2566- return ieee80211_wx_get_wap(priv->ieee80211,info,wrqu,extra); 2567+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2568+ 2569+ return ieee80211_wx_get_wap_rtl7(priv->ieee80211,info,wrqu,extra); 2570 } 2571 2572 2573-static int r8180_wx_get_enc(struct net_device *dev, 2574- struct iw_request_info *info, 2575+static int r8180_wx_get_enc(struct net_device *dev, 2576+ struct iw_request_info *info, 2577 union iwreq_data *wrqu, char *key) 2578 { 2579- struct r8180_priv *priv = ieee80211_priv(dev); 2580- 2581- return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key); 2582+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2583+ 2584+ return ieee80211_wx_get_encode_rtl7(priv->ieee80211, info, wrqu, key); 2585 } 2586 2587-static int r8180_wx_set_enc(struct net_device *dev, 2588- struct iw_request_info *info, 2589+static int r8180_wx_set_enc(struct net_device *dev, 2590+ struct iw_request_info *info, 2591 union iwreq_data *wrqu, char *key) 2592 { 2593- struct r8180_priv *priv = ieee80211_priv(dev); 2594+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2595 int ret; 2596- 2597+ 2598 down(&priv->wx_sem); 2599- 2600+ 2601 DMESG("Setting SW wep key"); 2602- ret = ieee80211_wx_set_encode(priv->ieee80211,info,wrqu,key); 2603- 2604+ ret = ieee80211_wx_set_encode_rtl7(priv->ieee80211,info,wrqu,key); 2605+ 2606 up(&priv->wx_sem); 2607 return ret; 2608 } 2609@@ -447,28 +568,28 @@ 2610 2611 static int r8180_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union 2612 iwreq_data *wrqu, char *p){ 2613- 2614- struct r8180_priv *priv = ieee80211_priv(dev); 2615+ 2616+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2617 int *parms=(int*)p; 2618 int mode=parms[0]; 2619- 2620+ 2621 priv->ieee80211->active_scan = mode; 2622- 2623+ 2624 return 1; 2625 } 2626 2627 2628 2629-static int r8180_wx_set_retry(struct net_device *dev, 2630- struct iw_request_info *info, 2631+static int r8180_wx_set_retry(struct net_device *dev, 2632+ struct iw_request_info *info, 2633 union iwreq_data *wrqu, char *extra) 2634 { 2635- struct r8180_priv *priv = ieee80211_priv(dev); 2636+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2637 int err = 0; 2638- 2639+ 2640 down(&priv->wx_sem); 2641- 2642- if (wrqu->retry.flags & IW_RETRY_LIFETIME || 2643+ 2644+ if (wrqu->retry.flags & IW_RETRY_LIFETIME || 2645 wrqu->retry.disabled){ 2646 err = -EINVAL; 2647 goto exit; 2648@@ -485,13 +606,13 @@ 2649 if (wrqu->retry.flags & IW_RETRY_MAX) { 2650 priv->retry_rts = wrqu->retry.value; 2651 DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value); 2652- 2653+ 2654 }else { 2655 priv->retry_data = wrqu->retry.value; 2656 DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value); 2657 } 2658- 2659- /* FIXME ! 2660+ 2661+ /* FIXME ! 2662 * We might try to write directly the TX config register 2663 * or to restart just the (R)TX process. 2664 * I'm unsure if whole reset is really needed 2665@@ -503,28 +624,28 @@ 2666 rtl8180_rtx_disable(dev); 2667 rtl8180_rx_enable(dev); 2668 rtl8180_tx_enable(dev); 2669- 2670+ 2671 } 2672 */ 2673 exit: 2674 up(&priv->wx_sem); 2675- 2676+ 2677 return err; 2678 } 2679 2680-static int r8180_wx_get_retry(struct net_device *dev, 2681- struct iw_request_info *info, 2682+static int r8180_wx_get_retry(struct net_device *dev, 2683+ struct iw_request_info *info, 2684 union iwreq_data *wrqu, char *extra) 2685 { 2686- struct r8180_priv *priv = ieee80211_priv(dev); 2687- 2688+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2689+ 2690 2691 wrqu->retry.disabled = 0; /* can't be disabled */ 2692 2693- if ((wrqu->retry.flags & IW_RETRY_TYPE) == 2694- IW_RETRY_LIFETIME) 2695+ if ((wrqu->retry.flags & IW_RETRY_TYPE) == 2696+ IW_RETRY_LIFETIME) 2697 return -EINVAL; 2698- 2699+ 2700 if (wrqu->retry.flags & IW_RETRY_MAX) { 2701 wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MAX; 2702 wrqu->retry.value = priv->retry_rts; 2703@@ -533,30 +654,30 @@ 2704 wrqu->retry.value = priv->retry_data; 2705 } 2706 //DMESG("returning %d",wrqu->retry.value); 2707- 2708+ 2709 2710 return 0; 2711 } 2712 2713-static int r8180_wx_get_sens(struct net_device *dev, 2714- struct iw_request_info *info, 2715+static int r8180_wx_get_sens(struct net_device *dev, 2716+ struct iw_request_info *info, 2717 union iwreq_data *wrqu, char *extra) 2718 { 2719- struct r8180_priv *priv = ieee80211_priv(dev); 2720- if(priv->rf_set_sens == NULL) 2721+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2722+ if(priv->rf_set_sens == NULL) 2723 return -1; /* we have not this support for this radio */ 2724 wrqu->sens.value = priv->sens; 2725 return 0; 2726 } 2727 2728 2729-static int r8180_wx_set_sens(struct net_device *dev, 2730- struct iw_request_info *info, 2731+static int r8180_wx_set_sens(struct net_device *dev, 2732+ struct iw_request_info *info, 2733 union iwreq_data *wrqu, char *extra) 2734 { 2735- 2736- struct r8180_priv *priv = ieee80211_priv(dev); 2737- 2738+ 2739+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2740+ 2741 short err = 0; 2742 down(&priv->wx_sem); 2743 //DMESG("attempt to set sensivity to %ddb",wrqu->sens.value); 2744@@ -571,7 +692,7 @@ 2745 2746 exit: 2747 up(&priv->wx_sem); 2748- 2749+ 2750 return err; 2751 } 2752 2753@@ -623,50 +744,55 @@ 2754 dummy, /* SIOCGIWRTS */ 2755 r8180_wx_set_frag, /* SIOCSIWFRAG */ 2756 r8180_wx_get_frag, /* SIOCGIWFRAG */ 2757- dummy, /* SIOCSIWTXPOW */ 2758- dummy, /* SIOCGIWTXPOW */ 2759+ r8180_wx_set_txpow, /* SIOCSIWTXPOW */ 2760+ r8180_wx_get_txpow, /* SIOCGIWTXPOW */ 2761 r8180_wx_set_retry, /* SIOCSIWRETRY */ 2762 r8180_wx_get_retry, /* SIOCGIWRETRY */ 2763 r8180_wx_set_enc, /* SIOCSIWENCODE */ 2764 r8180_wx_get_enc, /* SIOCGIWENCODE */ 2765 dummy, /* SIOCSIWPOWER */ 2766 dummy, /* SIOCGIWPOWER */ 2767-}; 2768+}; 2769 2770 2771-static const struct iw_priv_args r8180_private_args[] = { 2772- 2773+static const struct iw_priv_args r8180_private_args[] = { 2774 { 2775- SIOCIWFIRSTPRIV + 0x0, 2776- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc" 2777- }, 2778- 2779+ SIOCIWFIRSTPRIV + 0x0, 2780+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "fasttx" 2781+ }, 2782+ 2783 { 2784 SIOCIWFIRSTPRIV + 0x1, 2785- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan" 2786- 2787+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "highpower" 2788 }, 2789+ 2790 { 2791- SIOCIWFIRSTPRIV + 0x2, 2792- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx" 2793+ SIOCIWFIRSTPRIV + 0x2, 2794+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc" 2795+ }, 2796+ 2797+ { 2798+ SIOCIWFIRSTPRIV + 0x3, 2799+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan" 2800+ 2801 } 2802 }; 2803 2804 2805 static iw_handler r8180_private_handler[] = { 2806-// r8180_wx_set_monitor, /* SIOCIWFIRSTPRIV */ 2807+ r8180_wx_set_fasttx, /* SIOCIWFIRSTPRIV */ 2808+ r8180_wx_set_highpower, /*SIOCIWSECONDPRIV*/ 2809 r8180_wx_set_crcmon, /*SIOCIWSECONDPRIV*/ 2810 // r8180_wx_set_forceassociate, 2811 // r8180_wx_set_beaconinterval, 2812 // r8180_wx_set_monitor_type, 2813 r8180_wx_set_scan_type, 2814- r8180_wx_set_rawtx, 2815 }; 2816 2817-#if WIRELESS_EXT >= 17 2818+#if WIRELESS_EXT >= 17 2819 static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev) 2820 { 2821- struct r8180_priv *priv = ieee80211_priv(dev); 2822+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 2823 2824 return &priv->wstats; 2825 } 2826@@ -679,8 +805,8 @@ 2827 .private = r8180_private_handler, 2828 .num_private = sizeof(r8180_private_handler) / sizeof(iw_handler), 2829 .num_private_args = sizeof(r8180_private_args) / sizeof(struct iw_priv_args), 2830-#if WIRELESS_EXT >= 17 2831+#if WIRELESS_EXT >= 17 2832 .get_wireless_stats = r8180_get_wireless_stats, 2833 #endif 2834- .private_args = (struct iw_priv_args *)r8180_private_args, 2835+ .private_args = (struct iw_priv_args *)r8180_private_args, 2836 }; 2837diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8187_core.c 2838--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c 2006-06-21 22:43:30.000000000 -0700 2839+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8187_core.c 2010-05-19 22:18:55.642702808 -0700 2840@@ -1,27 +1,27 @@ 2841 /* 2842 This is part of rtl8187 OpenSource driver - v 0.1 2843- Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it> 2844+ Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it> 2845 Released under the terms of GPL (General Public License) 2846- 2847- 2848- Parts of this driver are based on the rtl8180 driver skeleton 2849+ 2850+ 2851+ Parts of this driver are based on the rtl8180 driver skeleton 2852 from Patric Schenke & Andres Salomon. 2853 2854 Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers. 2855- 2856+ 2857 some ideas might be derived from David Young rtl8180 netbsd driver. 2858- 2859+ 2860 Parts of the usb code are from the r8150.c driver in linux kernel 2861- 2862+ 2863 Some ideas borrowed from the 8139too.c driver included in linux kernel. 2864- 2865- We (I?) want to thanks the Authors of those projecs and also the 2866+ 2867+ We (I?) want to thanks the Authors of those projecs and also the 2868 Ndiswrapper's project Authors. 2869- 2870- A special big thanks goes also to Realtek corp. for their help in my 2871- attempt to add RTL8187 and RTL8225 support, and to David Young also. 2872 2873- - Please note that this file is a modified version from rtl8180-sa2400 2874+ A special big thanks goes also to Realtek corp. for their help in my 2875+ attempt to add RTL8187 and RTL8225 support, and to David Young also. 2876+ 2877+ - Please note that this file is a modified version from rtl8180-sa2400 2878 drv. So some other people have contributed to this project, and they are 2879 thanked in the rtl8180-sa2400 CHANGELOG. 2880 */ 2881@@ -57,6 +57,7 @@ 2882 #undef DEBUG_IRQ_TASKLET 2883 #undef DEBUG_TX_ALLOC 2884 #undef DEBUG_TX_DESC 2885+#undef DEBUG_TX_POWER 2886 2887 //#define CONFIG_RTL8180_IO_MAP 2888 2889@@ -66,6 +67,9 @@ 2890 #include "r8180_93cx6.h" /* Card EEPROM */ 2891 #include "r8180_wx.h" 2892 2893+#if !(defined(CONFIG_USB_EHCI_HCD) || defined (CONFIG_USB_EHCI_HCD_MODULE)) 2894+ #error Build your kernel with ehci_hcd support! 2895+#endif 2896 2897 // FIXME: check if 2.6.7 is ok 2898 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7)) 2899@@ -98,6 +102,10 @@ 2900 #endif 2901 static int channels = 0x3fff; 2902 2903+// #define DEBUG_EPROM 2904+// #define DEBUG_REGISTERS 2905+// #define DEBUG_TX_POWER 2906+ 2907 MODULE_LICENSE("GPL"); 2908 MODULE_VERSION("V 1.1"); 2909 MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl); 2910@@ -137,7 +145,7 @@ 2911 2912 static int __devinit rtl8187_usb_probe(struct usb_interface *intf, 2913 const struct usb_device_id *id); 2914- 2915+ 2916 static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf); 2917 2918 static struct usb_driver rtl8187_usb_driver = { 2919@@ -158,13 +166,12 @@ 2920 #endif 2921 }; 2922 2923- 2924 void write_nic_byte_E(struct net_device *dev, int indx, u8 data) 2925 { 2926- 2927- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 2928+ 2929+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 2930 struct usb_device *udev = priv->udev; 2931- 2932+ 2933 usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 2934 RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, 2935 indx|0xfe00, 0, &data, 1, HZ / 2); 2936@@ -173,10 +180,10 @@ 2937 2938 void write_nic_byte(struct net_device *dev, int indx, u8 data) 2939 { 2940- 2941- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 2942+ 2943+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 2944 struct usb_device *udev = priv->udev; 2945- 2946+ 2947 usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 2948 RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, 2949 indx|0xff00, 0, &data, 1, HZ / 2); 2950@@ -185,10 +192,10 @@ 2951 2952 void write_nic_word(struct net_device *dev, int indx, u16 data) 2953 { 2954- 2955- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 2956+ 2957+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 2958 struct usb_device *udev = priv->udev; 2959- 2960+ 2961 usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 2962 RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, 2963 indx|0xff00, 0, &data, 2, HZ / 2); 2964@@ -197,23 +204,23 @@ 2965 2966 void write_nic_dword(struct net_device *dev, int indx, u32 data) 2967 { 2968- 2969- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 2970+ 2971+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 2972 struct usb_device *udev = priv->udev; 2973- 2974+ 2975 usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 2976 RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, 2977 indx|0xff00, 0, &data, 4, HZ / 2); 2978 } 2979- 2980- 2981- 2982+ 2983+ 2984+ 2985 u8 read_nic_byte(struct net_device *dev, int indx) 2986 { 2987 u8 data; 2988- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 2989+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 2990 struct usb_device *udev = priv->udev; 2991- 2992+ 2993 usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 2994 RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, 2995 indx|0xff00, 0, &data, 1, HZ / 2); 2996@@ -223,22 +230,22 @@ 2997 u8 read_nic_byte_E(struct net_device *dev, int indx) 2998 { 2999 u8 data; 3000- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 3001+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 3002 struct usb_device *udev = priv->udev; 3003- 3004+ 3005 usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 3006 RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, 3007 indx|0xfe00, 0, &data, 1, HZ / 2); 3008 return data; 3009 } 3010 3011- 3012+ 3013 u16 read_nic_word(struct net_device *dev, int indx) 3014 { 3015 u16 data; 3016- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 3017+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 3018 struct usb_device *udev = priv->udev; 3019- 3020+ 3021 usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 3022 RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, 3023 indx|0xff00, 0, &data, 2, HZ / 2); 3024@@ -249,16 +256,16 @@ 3025 u32 read_nic_dword(struct net_device *dev, int indx) 3026 { 3027 u32 data; 3028- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 3029+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 3030 struct usb_device *udev = priv->udev; 3031- 3032+ 3033 usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 3034 RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, 3035 indx|0xff00, 0, &data, 4, HZ / 2); 3036 return data; 3037 } 3038 3039-/* this might still called in what was the PHY rtl8185/rtl8187 common code 3040+/* this might still called in what was the PHY rtl8185/rtl8187 common code 3041 * plans are to possibilty turn it again in one common code... 3042 */ 3043 inline void force_pci_posting(struct net_device *dev) 3044@@ -271,7 +278,12 @@ 3045 //void set_nic_txring(struct net_device *dev); 3046 static struct net_device_stats *rtl8180_stats(struct net_device *dev); 3047 void rtl8180_commit(struct net_device *dev); 3048+ 3049+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) 3050+void rtl8180_restart(struct work_struct *work); 3051+#else 3052 void rtl8180_restart(struct net_device *dev); 3053+#endif 3054 3055 /**************************************************************************** 3056 -----------------------------PROCFS STUFF------------------------- 3057@@ -284,13 +296,13 @@ 3058 int *eof, void *data) 3059 { 3060 struct net_device *dev = data; 3061-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 3062- 3063+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 3064+ 3065 int len = 0; 3066 int i,n; 3067- 3068+ 3069 int max=0xff; 3070- 3071+ 3072 /* This dump the current register page */ 3073 for(n=0;n<=max;) 3074 { 3075@@ -307,7 +319,7 @@ 3076 len += snprintf(page + len, count - len,"\n"); 3077 3078 3079- 3080+ 3081 *eof = 1; 3082 return len; 3083 3084@@ -319,16 +331,16 @@ 3085 int *eof, void *data) 3086 { 3087 struct net_device *dev = data; 3088- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 3089- 3090+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 3091+ 3092 int len = 0; 3093- 3094+ 3095 len += snprintf(page + len, count - len, 3096 "NIC int: %lu\n" 3097 "Total int: %lu\n", 3098 priv->stats.ints, 3099 priv->stats.shints); 3100- 3101+ 3102 *eof = 1; 3103 return len; 3104 } 3105@@ -339,10 +351,10 @@ 3106 int *eof, void *data) 3107 { 3108 struct net_device *dev = data; 3109- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 3110- 3111+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 3112+ 3113 int len = 0; 3114- 3115+ 3116 len += snprintf(page + len, count - len, 3117 "TX normal priority ok int: %lu\n" 3118 "TX normal priority error int: %lu\n" 3119@@ -359,7 +371,7 @@ 3120 "TX HW queue: %d\n" 3121 "TX lp dropped: %lu\n" 3122 "TX np dropped: %lu\n" 3123- "TX total data packets %lu\n", 3124+ "TX total data packets %lu\n", 3125 // "TX beacon aborted: %lu\n", 3126 priv->stats.txnpokint, 3127 priv->stats.txnperr, 3128@@ -379,10 +391,10 @@ 3129 priv->stats.txdatapkt 3130 // priv->stats.txbeaconerr 3131 ); 3132- 3133+ 3134 *eof = 1; 3135 return len; 3136-} 3137+} 3138 3139 3140 3141@@ -391,10 +403,10 @@ 3142 int *eof, void *data) 3143 { 3144 struct net_device *dev = data; 3145- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 3146- 3147+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 3148+ 3149 int len = 0; 3150- 3151+ 3152 len += snprintf(page + len, count - len, 3153 "RX packets: %lu\n" 3154 "RX urb status error: %lu\n" 3155@@ -402,35 +414,44 @@ 3156 priv->stats.rxok, 3157 priv->stats.rxstaterr, 3158 priv->stats.rxurberr); 3159- 3160+ 3161 *eof = 1; 3162 return len; 3163-} 3164- 3165+} 3166 3167+#if WIRELESS_EXT < 17 3168 static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev) 3169 { 3170- struct r8180_priv *priv = ieee80211_priv(dev); 3171+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 3172 3173 return &priv->wstats; 3174 } 3175+#endif 3176 3177 void rtl8180_proc_module_init(void) 3178-{ 3179+{ 3180 DMESG("Initializing proc filesystem"); 3181+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) 3182 rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net); 3183+#else 3184+ rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, init_net.proc_net); 3185+#endif 3186 } 3187 3188 3189 void rtl8180_proc_module_remove(void) 3190 { 3191+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) 3192 remove_proc_entry(RTL8187_MODULE_NAME, proc_net); 3193+#else 3194+ remove_proc_entry(RTL8187_MODULE_NAME, init_net.proc_net); 3195+#endif 3196 } 3197 3198 3199 void rtl8180_proc_remove_one(struct net_device *dev) 3200 { 3201- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 3202+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 3203 if (priv->dir_dev) { 3204 // remove_proc_entry("stats-hw", priv->dir_dev); 3205 remove_proc_entry("stats-tx", priv->dir_dev); 3206@@ -447,9 +468,9 @@ 3207 void rtl8180_proc_init_one(struct net_device *dev) 3208 { 3209 struct proc_dir_entry *e; 3210- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 3211- priv->dir_dev = create_proc_entry(dev->name, 3212- S_IFDIR | S_IRUGO | S_IXUGO, 3213+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 3214+ priv->dir_dev = create_proc_entry(dev->name, 3215+ S_IFDIR | S_IRUGO | S_IXUGO, 3216 rtl8180_proc); 3217 if (!priv->dir_dev) { 3218 DMESGE("Unable to initialize /proc/net/rtl8187/%s\n", 3219@@ -459,7 +480,7 @@ 3220 #if 0 3221 e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO, 3222 priv->dir_dev, proc_get_stats_hw, dev); 3223- 3224+ 3225 if (!e) { 3226 DMESGE("Unable to initialize " 3227 "/proc/net/rtl8187/%s/stats-hw\n", 3228@@ -468,17 +489,17 @@ 3229 #endif 3230 e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO, 3231 priv->dir_dev, proc_get_stats_rx, dev); 3232- 3233+ 3234 if (!e) { 3235 DMESGE("Unable to initialize " 3236 "/proc/net/rtl8187/%s/stats-rx\n", 3237 dev->name); 3238 } 3239- 3240- 3241+ 3242+ 3243 e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO, 3244 priv->dir_dev, proc_get_stats_tx, dev); 3245- 3246+ 3247 if (!e) { 3248 DMESGE("Unable to initialize " 3249 "/proc/net/rtl8187/%s/stats-tx\n", 3250@@ -487,27 +508,27 @@ 3251 #if 0 3252 e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO, 3253 priv->dir_dev, proc_get_stats_ieee, dev); 3254- 3255+ 3256 if (!e) { 3257 DMESGE("Unable to initialize " 3258 "/proc/net/rtl8187/%s/stats-ieee\n", 3259 dev->name); 3260 } 3261- 3262- 3263+ 3264+ 3265 e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO, 3266 priv->dir_dev, proc_get_stats_ap, dev); 3267- 3268+ 3269 if (!e) { 3270 DMESGE("Unable to initialize " 3271 "/proc/net/rtl8187/%s/stats-ap\n", 3272 dev->name); 3273 } 3274 #endif 3275- 3276+ 3277 e = create_proc_read_entry("registers", S_IFREG | S_IRUGO, 3278 priv->dir_dev, proc_get_registers, dev); 3279- 3280+ 3281 if (!e) { 3282 DMESGE("Unable to initialize " 3283 "/proc/net/rtl8187/%s/registers\n", 3284@@ -523,14 +544,14 @@ 3285 { 3286 int i; 3287 u8 *buf =(u8*)buffer; 3288- 3289+ 3290 printk("ASCII BUFFER DUMP (len: %x):\n",len); 3291- 3292+ 3293 for(i=0;i<len;i++) 3294 printk("%c",buf[i]); 3295- 3296+ 3297 printk("\nBINARY BUFFER DUMP (len: %x):\n",len); 3298- 3299+ 3300 for(i=0;i<len;i++) 3301 printk("%x",buf[i]); 3302 3303@@ -539,17 +560,17 @@ 3304 3305 short check_nic_enought_desc(struct net_device *dev, priority_t priority) 3306 { 3307- struct r8180_priv *priv = ieee80211_priv(dev); 3308- 3309- int used = atomic_read((priority == NORM_PRIORITY) ? 3310+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 3311+ 3312+ int used = atomic_read((priority == NORM_PRIORITY) ? 3313 &priv->tx_np_pending : &priv->tx_lp_pending); 3314- 3315+ 3316 return (used < MAX_TX_URB); 3317 } 3318 3319 void tx_timeout(struct net_device *dev) 3320 { 3321- struct r8180_priv *priv = ieee80211_priv(dev); 3322+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 3323 //rtl8180_commit(dev); 3324 schedule_work(&priv->reset_wq); 3325 //DMESG("TXTIMEOUT"); 3326@@ -561,7 +582,20 @@ 3327 { 3328 int i; 3329 for(i=0; i<63; i++) 3330- DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i)); 3331+ DMESG("EEPROM addr %02X : %04X", i, eprom_read(dev,i)); 3332+} 3333+ 3334+/* this is only for debug */ 3335+void dump_tx_power(struct net_device *dev) 3336+{ 3337+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 3338+ int i; 3339+ DMESG("CCK TX-Power (b-mode):"); 3340+ for(i=1; i<=14; i++) 3341+ DMESG("Channel %d: %d", i, priv->chtxpwr[i]); 3342+ DMESG("OFDM TX-Power (g-mode):"); 3343+ for(i=1; i<=14; i++) 3344+ DMESG("Channel %d: %d", i, priv->chtxpwr_ofdm[i]); 3345 } 3346 3347 /* this is only for debug */ 3348@@ -570,14 +604,14 @@ 3349 int i; 3350 int n; 3351 int max=0xff; 3352- 3353- DMESG("Dumping NIC register map"); 3354- 3355+ 3356+ DMESG("Dumping NIC register map"); 3357+ 3358 for(n=0;n<=max;) 3359 { 3360- printk( "\nD: %2x> ", n); 3361+ printk( "\nD: %02X> ", n); 3362 for(i=0;i<16 && n<=max;i++,n++) 3363- printk("%2x ",read_nic_byte(dev,n)); 3364+ printk("%02X ",read_nic_byte(dev,n)); 3365 } 3366 printk("\n"); 3367 } 3368@@ -589,11 +623,11 @@ 3369 3370 void rtl8180_irq_enable(struct net_device *dev) 3371 { 3372- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 3373+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 3374 //priv->irq_enabled = 1; 3375 /* 3376- write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\ 3377- INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\ 3378+ write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\ 3379+ INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\ 3380 INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\ 3381 INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT); 3382 */ 3383@@ -603,7 +637,7 @@ 3384 3385 void rtl8180_irq_disable(struct net_device *dev) 3386 { 3387-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 3388+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 3389 3390 write_nic_word(dev,INTA_MASK,0); 3391 force_pci_posting(dev); 3392@@ -625,115 +659,119 @@ 3393 3394 void rtl8180_update_msr(struct net_device *dev) 3395 { 3396- struct r8180_priv *priv = ieee80211_priv(dev); 3397+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 3398 u8 msr; 3399- 3400+ 3401 msr = read_nic_byte(dev, MSR); 3402 msr &= ~ MSR_LINK_MASK; 3403- 3404+ 3405 /* do not change in link_state != WLAN_LINK_ASSOCIATED. 3406- * msr must be updated if the state is ASSOCIATING. 3407+ * msr must be updated if the state is ASSOCIATING. 3408 * this is intentional and make sense for ad-hoc and 3409 * master (see the create BSS/IBSS func) 3410 */ 3411- if (priv->ieee80211->state == IEEE80211_LINKED){ 3412- 3413+ if (priv->ieee80211->state == IEEE80211_LINKED){ 3414+ 3415 if (priv->ieee80211->iw_mode == IW_MODE_INFRA) 3416 msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT); 3417 else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC) 3418 msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT); 3419 else if (priv->ieee80211->iw_mode == IW_MODE_MASTER) 3420 msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT); 3421- 3422+ 3423 }else 3424 msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT); 3425- 3426+ 3427 write_nic_byte(dev, MSR, msr); 3428 } 3429 3430 void rtl8180_set_chan(struct net_device *dev,short ch) 3431 { 3432- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 3433+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 3434 u32 tx; 3435 priv->chan=ch; 3436 #if 0 3437- if(priv->ieee80211->iw_mode == IW_MODE_ADHOC || 3438+ if(priv->ieee80211->iw_mode == IW_MODE_ADHOC || 3439 priv->ieee80211->iw_mode == IW_MODE_MASTER){ 3440- 3441- priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED; 3442+ 3443+ priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED; 3444 priv->ieee80211->master_chan = ch; 3445- rtl8180_update_beacon_ch(dev); 3446+ rtl8180_update_beacon_ch(dev); 3447 } 3448 #endif 3449- 3450+ 3451 /* this hack should avoid frame TX during channel setting*/ 3452 tx = read_nic_dword(dev,TX_CONF); 3453 tx &= ~TX_LOOPBACK_MASK; 3454 3455-#ifndef LOOP_TEST 3456+#ifndef LOOP_TEST 3457 write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT)); 3458- 3459 priv->rf_set_chan(dev,priv->chan); 3460 mdelay(10); 3461- write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT)); 3462+ write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT)); 3463 #endif 3464 } 3465+ 3466+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 3467 void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs); 3468+#else 3469+void rtl8187_rx_isr(struct urb *rx_urb); 3470+#endif 3471 3472 3473 void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb) 3474 { 3475- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 3476+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 3477 int err; 3478- 3479+ 3480 // u8 *rx; 3481- 3482+ 3483 //DMESG("starting RX"); 3484 /*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC); 3485- if(!rx){ 3486+ if(!rx){ 3487 DMESGE("unable to allocate RX buffer"); 3488 return; 3489 }*/ 3490- 3491+ 3492 usb_fill_bulk_urb(rx_urb,priv->udev, 3493 usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer, 3494 RX_URB_SIZE,rtl8187_rx_isr,dev); 3495- err = usb_submit_urb(rx_urb, GFP_ATOMIC); 3496+ err = usb_submit_urb(rx_urb, GFP_ATOMIC); 3497 if(err && err != -EPERM){ 3498 DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status); 3499- 3500+ 3501 } 3502- 3503+ 3504 } 3505 3506 3507 void rtl8187_rx_initiate(struct net_device *dev) 3508 { 3509 int i; 3510- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 3511- 3512+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 3513+ 3514 if(!priv->rx_urb) 3515 DMESGE("Cannot intiate RX urb mechanism"); 3516- for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1 3517+ for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1 3518 rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]); 3519- 3520+ 3521 } 3522 3523 void rtl8187_set_rxconf(struct net_device *dev) 3524 { 3525- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 3526+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 3527 u32 rxconf; 3528- 3529+ 3530 rxconf=read_nic_dword(dev,RX_CONF); 3531 rxconf = rxconf &~ MAC_FILTER_MASK; 3532 rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT); 3533 rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT); 3534 rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT); 3535 rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT); 3536- rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT); 3537+ rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT); 3538 3539 if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode"); 3540- 3541+ 3542 if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \ 3543 dev->flags & IFF_PROMISC){ 3544 rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT); 3545@@ -741,40 +779,40 @@ 3546 rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT); 3547 rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT); 3548 } 3549- 3550+ 3551 /*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){ 3552 rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT); 3553 rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT); 3554 }*/ 3555- 3556+ 3557 if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){ 3558 rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT); 3559 rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT); 3560 } 3561- 3562+ 3563 if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR) 3564 rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT); 3565- 3566- 3567+ 3568+ 3569 rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK; 3570 rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT); 3571- 3572- 3573+ 3574+ 3575 rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT); 3576- 3577+ 3578 rxconf = rxconf &~ MAX_RX_DMA_MASK; 3579 rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT); 3580- 3581+ 3582 rxconf = rxconf | RCR_ONLYERLPKT; 3583- 3584+ 3585 // rxconf = rxconf &~ RCR_CS_MASK; 3586 // rxconf = rxconf | (1<<RCR_CS_SHIFT); 3587 3588- write_nic_dword(dev, RX_CONF, rxconf); 3589- 3590+ write_nic_dword(dev, RX_CONF, rxconf); 3591+ 3592 // V rtl suggested V // 3593 // write_nic_dword(dev, RX_CONF, 0x901ce70e); 3594- 3595+ 3596 //fix_rx_fifo(dev); 3597 // //set_nic_rxring(dev); 3598 #ifdef DEBUG_RX 3599@@ -785,23 +823,23 @@ 3600 void rtl8180_rx_enable(struct net_device *dev) 3601 { 3602 u8 cmd; 3603- 3604- 3605+ 3606+ 3607 rtl8187_rx_initiate(dev); 3608 3609- rtl8187_set_rxconf(dev); 3610+ rtl8187_set_rxconf(dev); 3611 3612 cmd=read_nic_byte(dev,CMD); 3613 write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT)); 3614 #if 0 3615- /* In rtl8139 driver seems that DMA threshold has to be written 3616- * after enabling RX, so we rewrite RX_CONFIG register 3617+ /* In rtl8139 driver seems that DMA threshold has to be written 3618+ * after enabling RX, so we rewrite RX_CONFIG register 3619 */ 3620 //mdelay(100); 3621- write_nic_dword(dev, RX_CONF, rxconf); 3622- 3623+ write_nic_dword(dev, RX_CONF, rxconf); 3624+ 3625 #endif 3626- 3627+ 3628 } 3629 3630 3631@@ -810,37 +848,37 @@ 3632 u8 cmd; 3633 u8 byte; 3634 u32 txconf; 3635- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 3636- 3637+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 3638+ 3639 byte = read_nic_byte(dev,CW_CONF); 3640 byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT); 3641 byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT); 3642 write_nic_byte(dev, CW_CONF, byte); 3643- 3644+ 3645 byte = read_nic_byte(dev, TX_AGC_CTL); 3646 byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT); 3647 byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT); 3648 byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT); 3649 write_nic_byte(dev, TX_AGC_CTL, byte); 3650- 3651+ 3652 txconf= read_nic_dword(dev,TX_CONF); 3653- 3654+ 3655 #if 0 3656 if(priv->card_8185){ 3657- 3658+ 3659 txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT); 3660- 3661+ 3662 }else{ 3663- 3664- if(priv->ieee80211->hw_seq) 3665+ 3666+ if(priv->ieee80211->hw_seq) 3667 txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT); 3668- else 3669+ else 3670 txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT); 3671 } 3672 #endif 3673 3674 txconf = txconf &~ TX_LOOPBACK_MASK; 3675- 3676+ 3677 #ifndef LOOP_TEST 3678 txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT); 3679 #else 3680@@ -848,23 +886,26 @@ 3681 #endif 3682 txconf = txconf &~ TCR_DPRETRY_MASK; 3683 txconf = txconf &~ TCR_RTSRETRY_MASK; 3684- 3685- txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long 3686- txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short 3687- 3688+ 3689+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR) 3690+ { 3691+ txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long 3692+ txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short 3693+ } 3694+ 3695 txconf = txconf &~ (1<<TX_NOCRC_SHIFT); 3696- 3697+ 3698 txconf = txconf &~ TCR_MXDMA_MASK; 3699 txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT); 3700- 3701+ 3702 txconf = txconf | TCR_CWMIN; 3703 txconf = txconf | TCR_DISCW; 3704 txconf = txconf &~ TCR_SWPLCPLEN; 3705- 3706+ 3707 txconf=txconf | (1<<TX_NOICV_SHIFT); 3708- 3709+ 3710 write_nic_dword(dev,TX_CONF,txconf); 3711- 3712+ 3713 // V RTL suggested V // 3714 // write_nic_dword(dev,TX_CONF,0x00e00707); 3715 3716@@ -872,9 +913,9 @@ 3717 #ifdef DEBUG_TX 3718 DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF)); 3719 #endif 3720- 3721+ 3722 cmd=read_nic_byte(dev,CMD); 3723- write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT)); 3724+ write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT)); 3725 3726 // mdelay(100); 3727 //write_nic_dword(dev,TX_CONF,txconf); 3728@@ -889,18 +930,18 @@ 3729 #if 0 3730 void rtl8180_beacon_tx_enable(struct net_device *dev) 3731 { 3732- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 3733+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 3734 priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT); 3735 rtl8180_set_mode(dev,EPROM_CMD_CONFIG); 3736- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask); 3737+ write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask); 3738 rtl8180_set_mode(dev,EPROM_CMD_NORMAL); 3739 } 3740 3741 3742 void rtl8180_ 3743-_disable(struct net_device *dev) 3744+_disable(struct net_device *dev) 3745 { 3746- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 3747+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 3748 priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT); 3749 rtl8180_set_mode(dev,EPROM_CMD_CONFIG); 3750 write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask); 3751@@ -914,8 +955,8 @@ 3752 { 3753 u8 cmd; 3754 int i; 3755- struct r8180_priv *priv = ieee80211_priv(dev); 3756- 3757+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 3758+ 3759 cmd=read_nic_byte(dev,CMD); 3760 write_nic_byte(dev, CMD, cmd &~ \ 3761 ((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT))); 3762@@ -926,9 +967,9 @@ 3763 usb_kill_urb(priv->rx_urb[i]); 3764 } 3765 /*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT)) 3766- udelay(10); 3767+ udelay(10); 3768 */ 3769- 3770+ 3771 // if(!priv->rx_skb_complete) 3772 // dev_kfree_skb_any(priv->rx_skb); 3773 } 3774@@ -939,14 +980,14 @@ 3775 #if 0 3776 int i; 3777 u32 *tmp; 3778- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 3779- 3780+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 3781+ 3782 priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev, 3783- sizeof(u32)*8*count, 3784+ sizeof(u32)*8*count, 3785 &priv->txbeaconringdma); 3786 if (!priv->txbeaconring) return -1; 3787 for (tmp=priv->txbeaconring,i=0;i<count;i++){ 3788- *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv 3789+ *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv 3790 /* 3791 *(tmp+2) = (u32)dma_tmp; 3792 *(tmp+3) = bufsize; 3793@@ -955,7 +996,7 @@ 3794 *(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4); 3795 else 3796 *(tmp+4) = (u32)priv->txbeaconringdma; 3797- 3798+ 3799 tmp=tmp+8; 3800 } 3801 #endif 3802@@ -965,15 +1006,15 @@ 3803 3804 void rtl8180_reset(struct net_device *dev) 3805 { 3806- 3807+ 3808 u8 cr; 3809- 3810+ 3811 /* make sure the analog power is on before 3812 * reset, otherwise reset may fail 3813 */ 3814 rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON); 3815 rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON); 3816- 3817+ 3818 rtl8180_irq_disable(dev); 3819 3820 mdelay(200); 3821@@ -981,19 +1022,19 @@ 3822 write_nic_byte_E(dev,0x18,0x11); 3823 write_nic_byte_E(dev,0x18,0x00); 3824 mdelay(200); 3825- 3826+ 3827 cr=read_nic_byte(dev,CMD); 3828 cr = cr & 2; 3829 cr = cr | (1<<CMD_RST_SHIFT); 3830 write_nic_byte(dev,CMD,cr); 3831- 3832+ 3833 force_pci_posting(dev); 3834- 3835+ 3836 mdelay(200); 3837- 3838- if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT)) 3839+ 3840+ if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT)) 3841 DMESGW("Card reset timeout!"); 3842- else 3843+ else 3844 DMESG("Card successfully reset"); 3845 3846 rtl8180_set_mode(dev,EPROM_CMD_LOAD); 3847@@ -1005,13 +1046,13 @@ 3848 */ 3849 rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON); 3850 rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON); 3851- 3852+ 3853 } 3854 3855 inline u16 ieeerate2rtlrate(int rate) 3856 { 3857 switch(rate){ 3858- case 10: 3859+ case 10: 3860 return 0; 3861 case 20: 3862 return 1; 3863@@ -1037,32 +1078,42 @@ 3864 return 11; 3865 default: 3866 return 3; 3867- 3868+ 3869 } 3870 } 3871 static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540}; 3872 inline u16 rtl8180_rate2rate(short rate) 3873 { 3874 if (rate >11) return 0; 3875- return rtl_rate[rate]; 3876+ return rtl_rate[rate]; 3877+} 3878+ 3879+inline u8 rtl8180_IsWirelessBMode(u16 rate) 3880+{ 3881+ if( ((rate <= 110) && (rate != 60) && (rate != 90)) || (rate == 220) ) 3882+ return 1; 3883+ else return 0; 3884 } 3885- 3886 3887+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 3888 void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs) 3889+#else 3890+void rtl8187_rx_isr(struct urb *rx_urb) 3891+#endif 3892 { 3893 struct net_device *dev = (struct net_device*)rx_urb->context; 3894- struct r8180_priv *priv = ieee80211_priv(dev); 3895+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 3896 3897 priv->rxurb_task = rx_urb; 3898 // DMESGW("David: Rx tasklet start!"); 3899- tasklet_schedule(&priv->irq_rx_tasklet); 3900+ tasklet_schedule(&priv->irq_rx_tasklet); 3901 // DMESGW("=David: Rx tasklet finish!"); 3902 } 3903 3904 #if 0 3905 void rtl8180_tx_queues_stop(struct net_device *dev) 3906 { 3907- //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 3908+ //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 3909 u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT); 3910 dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT); 3911 dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT); 3912@@ -1078,7 +1129,7 @@ 3913 { 3914 //FIXME !! 3915 #if 0 3916- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 3917+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 3918 priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT); 3919 rtl8180_set_mode(dev,EPROM_CMD_CONFIG); 3920 write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask); 3921@@ -1091,7 +1142,7 @@ 3922 { 3923 // FIXME !! 3924 #if 0 3925- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 3926+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 3927 priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT); 3928 rtl8180_set_mode(dev,EPROM_CMD_CONFIG); 3929 write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask); 3930@@ -1105,14 +1156,19 @@ 3931 */ 3932 void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate) 3933 { 3934- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 3935- 3936- short morefrag = 0; 3937+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 3938+ 3939+ short morefrag = 0; 3940 unsigned long flags; 3941 struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data; 3942 3943- if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS) 3944- morefrag = 1; 3945+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->ieee80211->raw_tx != 1) 3946+ { 3947+ if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS) 3948+ { 3949+ morefrag = 1; 3950+ } 3951+ } 3952 // DMESG("%x %x", h->frame_ctl, h->seq_ctl); 3953 /* 3954 * This function doesn't require lock because we make 3955@@ -1121,24 +1177,29 @@ 3956 * the ieee stack, or from the try_wake_queue (again trought 3957 * the ieee stack. 3958 */ 3959- spin_lock_irqsave(&priv->tx_lock,flags); 3960- 3961- //DMESG("TX"); 3962- if (!check_nic_enought_desc(dev, LOW_PRIORITY)){ 3963- DMESG("Error: no TX slot "); 3964- ieee80211_stop_queue(priv->ieee80211); 3965- } 3966- 3967- rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag, 3968- ieeerate2rtlrate(rate)); 3969- 3970- priv->stats.txdatapkt++; 3971- 3972- if (!check_nic_enought_desc(dev, LOW_PRIORITY)) 3973- ieee80211_stop_queue(priv->ieee80211); 3974- 3975- spin_unlock_irqrestore(&priv->tx_lock,flags); 3976- 3977+ 3978+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->fasttx == 0) 3979+ { 3980+ spin_lock_irqsave(&priv->tx_lock,flags); 3981+ //DMESG("TX"); 3982+ if (!check_nic_enought_desc(dev, LOW_PRIORITY)){ 3983+ DMESG("Error: no TX slot "); 3984+ ieee80211_stop_queue_rtl7(priv->ieee80211); 3985+ } 3986+ rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag, 3987+ ieeerate2rtlrate(rate)); 3988+ 3989+ priv->stats.txdatapkt++; 3990+ 3991+ if (!check_nic_enought_desc(dev, LOW_PRIORITY)) 3992+ ieee80211_stop_queue_rtl7(priv->ieee80211); 3993+ spin_unlock_irqrestore(&priv->tx_lock,flags); 3994+ } 3995+ else 3996+ { 3997+ rtl8180_tx_fast(dev, (u32*)skb->data, skb->len, ieeerate2rtlrate(rate)); 3998+ } 3999+ 4000 } 4001 #if 0 4002 /* This is a rough attempt to TX a frame 4003@@ -1148,12 +1209,12 @@ 4004 */ 4005 int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev) 4006 { 4007- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 4008+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 4009 int ret; 4010 unsigned long flags; 4011- 4012+ 4013 spin_lock_irqsave(&priv->tx_lock,flags); 4014- 4015+ 4016 ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE); 4017 /* 4018 int i; 4019@@ -1163,9 +1224,9 @@ 4020 */ 4021 priv->ieee80211->stats.tx_bytes+=skb->len; 4022 priv->ieee80211->stats.tx_packets++; 4023- 4024- spin_unlock_irqrestore(&priv->tx_lock,flags); 4025- 4026+ 4027+ spin_unlock_irqrestore(&priv->tx_lock,flags); 4028+ 4029 dev_kfree_skb_any(skb); 4030 return ret; 4031 } 4032@@ -1178,7 +1239,7 @@ 4033 u16 duration; 4034 u16 drift; 4035 *ext=0; 4036- 4037+ 4038 switch(rate){ 4039 case 0://1mbps 4040 *ext=0; 4041@@ -1187,7 +1248,7 @@ 4042 if(drift ==0 ) break; 4043 duration++; 4044 break; 4045- 4046+ 4047 case 1://2mbps 4048 *ext=0; 4049 duration = ((len+4)<<4) /0x4; 4050@@ -1195,40 +1256,44 @@ 4051 if(drift ==0 ) break; 4052 duration++; 4053 break; 4054- 4055+ 4056 case 2: //5.5mbps 4057 *ext=0; 4058 duration = ((len+4)<<4) /0xb; 4059 drift = ((len+4)<<4) % 0xb; 4060- if(drift ==0 ) 4061+ if(drift ==0 ) 4062 break; 4063 duration++; 4064 break; 4065- 4066+ 4067 default: 4068- case 3://11mbps 4069+ case 3://11mbps 4070 *ext=0; 4071 duration = ((len+4)<<4) /0x16; 4072 drift = ((len+4)<<4) % 0x16; 4073- if(drift ==0 ) 4074+ if(drift ==0 ) 4075 break; 4076 duration++; 4077- if(drift > 6) 4078+ if(drift > 6) 4079 break; 4080 *ext=1; 4081 break; 4082 } 4083- 4084+ 4085 return duration; 4086 } 4087 #endif 4088 4089 void rtl8180_try_wake_queue(struct net_device *dev, int pri); 4090 4091+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 4092 void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs) 4093+#else 4094+void rtl8187_lptx_isr(struct urb *tx_urb) 4095+#endif 4096 { 4097 struct net_device *dev = (struct net_device*)tx_urb->context; 4098- struct r8180_priv *priv = ieee80211_priv(dev); 4099+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 4100 if(tx_urb->status == 0) 4101 priv->stats.txlpokint++; 4102 else 4103@@ -1239,6 +1304,15 @@ 4104 rtl8180_try_wake_queue(dev,LOW_PRIORITY); 4105 } 4106 4107+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 4108+void rtl8187_lptx_isr_fast(struct urb *tx_urb, struct pt_regs *regs) 4109+#else 4110+void rtl8187_lptx_isr_fast(struct urb *tx_urb) 4111+#endif 4112+{ 4113+ kfree(tx_urb->transfer_buffer); 4114+ usb_free_urb(tx_urb); 4115+} 4116 4117 void rtl8187_beacon_stop(struct net_device *dev) 4118 { 4119@@ -1249,55 +1323,55 @@ 4120 if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) || 4121 (msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){ 4122 write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE); 4123- write_nic_byte(dev, MSR, msr); 4124+ write_nic_byte(dev, MSR, msr); 4125 } 4126- 4127- 4128+ 4129+ 4130 } 4131 4132 4133 void rtl8187_net_update(struct net_device *dev) 4134 { 4135 4136- struct r8180_priv *priv = ieee80211_priv(dev); 4137+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 4138 struct ieee80211_network *net; 4139 net = & priv->ieee80211->current_network; 4140- 4141- 4142+ 4143+ 4144 write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]); 4145 write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]); 4146 //for(i=0;i<ETH_ALEN;i++) 4147 // write_nic_byte(dev,BSSID+i,net->bssid[i]); 4148 4149 rtl8180_update_msr(dev); 4150- 4151+ 4152 // rtl8180_set_mode(dev,EPROM_CMD_CONFIG); 4153 write_nic_word(dev, AtimWnd, 2); 4154- write_nic_word(dev, AtimtrItv, 100); 4155+ write_nic_word(dev, AtimtrItv, 100); 4156 write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval); 4157 write_nic_word(dev, BcnIntTime, 100); 4158- 4159+ 4160 4161 } 4162 4163 void rtl8187_beacon_tx(struct net_device *dev) 4164 { 4165 4166- struct r8180_priv *priv = ieee80211_priv(dev); 4167+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 4168 struct sk_buff *skb; 4169 int i = 0; 4170- 4171+ 4172 rtl8187_net_update(dev); 4173- 4174- skb = ieee80211_get_beacon(priv->ieee80211); 4175- 4176- 4177- if(!skb){ 4178+ 4179+ skb = ieee80211_get_beacon_rtl7(priv->ieee80211); 4180+ 4181+ 4182+ if(!skb){ 4183 DMESG("not enought memory for allocating beacon"); 4184 return; 4185 } 4186- 4187-#if 0 4188+ 4189+#if 0 4190 while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){ 4191 msleep_interruptible_rtl(HZ/2); 4192 if(i++ > 20){ 4193@@ -1307,7 +1381,7 @@ 4194 } 4195 #endif 4196 write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7)); 4197- 4198+ 4199 i=0; 4200 //while(!read_nic_byte(dev,BQREQ & (1<<7))) 4201 while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 ) 4202@@ -1318,16 +1392,20 @@ 4203 return ; 4204 } 4205 } 4206- 4207+ 4208 rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 4209 0, priv->ieee80211->basic_rate); 4210- 4211+ 4212 } 4213 4214+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 4215 void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs) 4216+#else 4217+void rtl8187_nptx_isr(struct urb *tx_urb) 4218+#endif 4219 { 4220 struct net_device *dev = (struct net_device*)tx_urb->context; 4221- struct r8180_priv *priv = ieee80211_priv(dev); 4222+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 4223 if(tx_urb->status == 0) 4224 priv->stats.txnpokint++; 4225 else 4226@@ -1339,10 +1417,10 @@ 4227 } 4228 4229 4230-/* This function do the real dirty work: it sends a TX command 4231- * descriptor plus data URB 4232+/* This function do the real dirty work: it sends a TX command 4233+ * descriptor plus data URB 4234 */ 4235- 4236+ 4237 short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority, 4238 short morefrag, short rate) 4239 { 4240@@ -1352,12 +1430,12 @@ 4241 int pend ; 4242 int status; 4243 struct urb *tx_urb; 4244- int urb_len; 4245- struct r8180_priv *priv = ieee80211_priv(dev); 4246+ int urb_len; 4247+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 4248 // int rate = ieeerate2rtlrate(priv->ieee80211->rate); 4249 4250- pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending); 4251- /* we are locked here so the two atomic_read and inc are executed without interleaves */ 4252+ pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending); 4253+ /* we are locked here so the two atomic_read and inc are executed without interleaves */ 4254 if( pend > MAX_TX_URB){ 4255 if(priority == NORM_PRIORITY) 4256 priv->stats.txnpdrop++; 4257@@ -1365,52 +1443,38 @@ 4258 priv->stats.txlpdrop++; 4259 return -1; 4260 } 4261- 4262- 4263+ 4264 //tx = kmalloc((len + 4*3), GFP_ATOMIC); 4265 urb_len = len + 4*3; 4266 if((0 == urb_len%64)||(0 == urb_len%512)) { 4267- urb_len += 1; 4268+ urb_len += 1; 4269 } 4270 tx = kmalloc(urb_len, GFP_ATOMIC); 4271 if(!tx) return -ENOMEM; 4272- //printk(KERN_WARNING "urb_len = %d\n", urb_len); 4273+ //printk(KERN_WARNING "urb_len = %d\n", urb_len); 4274 tx_urb = usb_alloc_urb(0,GFP_ATOMIC); 4275- 4276+ 4277 if(!tx_urb){ 4278- 4279+ 4280 kfree(tx); 4281 return -ENOMEM; 4282 } 4283- 4284+ 4285 memcpy(tx+3,txbuf,len); 4286 tx[0] = 0; 4287 tx[0] |= len & 0xfff; 4288 tx[0] |= (1<<15); 4289- 4290-// if(priv->shortpre) 4291-// tx[0] |= (1<<16); 4292- 4293- //if(len > priv->rts_threshold){ 4294-// tx[0] |= (1<<23); //ENABLE RTS 4295-// tx[0] |= (1<<18); //ENABLE CTS 4296- //} 4297+ 4298 if(morefrag) tx[0] |= (1<<17); 4299 tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */ 4300 tx[0] |= (rate << 24); 4301 tx[1] = 0; 4302- 4303-// duration = rtl8180_len2duration(len, 4304-// rate,&ext); 4305-// tx[1] |= (duration & 0x7fff) <<16; 4306-// if(ext) tx[1] |= (1<<31); 4307 4308- 4309 // tx[2] = 0x303020; 4310 tx[2] = 3; // CW min 4311 tx[2] |= (7<<4); //CW max 4312 tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim 4313- 4314+ 4315 // printk("%x\n%x\n",tx[0],tx[1]); 4316 4317 #ifdef DUMP_TX 4318@@ -1421,7 +1485,7 @@ 4319 printk("---------------\n"); 4320 #endif 4321 4322- 4323+ 4324 /* FIXME check what EP is for low/norm PRI */ 4325 usb_fill_bulk_urb(tx_urb,priv->udev, 4326 usb_sndbulkpipe(priv->udev,(priority == LOW_PRIORITY) ? 2:3), tx, 4327@@ -1438,54 +1502,97 @@ 4328 } 4329 } 4330 4331- 4332+/* This function do the real dirty work: it sends a TX command 4333+ * descriptor plus data URB (fast) 4334+ */ 4335+ 4336+short rtl8180_tx_fast(struct net_device *dev, u32* txbuf, int len, short rate) 4337+{ 4338+ u32 *tx; 4339+ int status; 4340+ struct urb *tx_urb; 4341+ int urb_len; 4342+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 4343+ 4344+ urb_len = len + 4*3; 4345+ if((0 == urb_len%64)||(0 == urb_len%512)) { 4346+ urb_len += 1; 4347+ } 4348+ tx = kmalloc(urb_len, GFP_ATOMIC); 4349+ if(!tx) return -ENOMEM; 4350+ 4351+ tx_urb = usb_alloc_urb(0,GFP_ATOMIC); 4352+ 4353+ if(!tx_urb){ 4354+ kfree(tx); 4355+ return -ENOMEM; 4356+ } 4357+ 4358+ memcpy(tx+3,txbuf,len); 4359+ tx[0] = (len & 0xfff) + 0x8000; 4360+ tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */ 4361+ tx[0] |= (rate << 24); 4362+ tx[1] = 0; 4363+ tx[2] = 2931; 4364+ 4365+ /* FIXME check what EP is for low/norm PRI */ 4366+ usb_fill_bulk_urb(tx_urb,priv->udev, 4367+ usb_sndbulkpipe(priv->udev, 2), tx, urb_len, rtl8187_lptx_isr_fast, dev); 4368+ status = usb_submit_urb(tx_urb, GFP_ATOMIC); 4369+ if (!status){ 4370+ return 0; 4371+ }else{ 4372+ return -1; 4373+ } 4374+} 4375+ 4376 4377 void rtl8180_irq_rx_tasklet(struct r8180_priv * priv); 4378 4379 4380 short rtl8187_usb_initendpoints(struct net_device *dev) 4381 { 4382- struct r8180_priv *priv = ieee80211_priv(dev); 4383+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 4384 int i; 4385- 4386+ 4387 priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL); 4388- 4389+ 4390 for(i=0;i<MAX_RX_URB;i++){ 4391 priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL); 4392- if(!priv->rx_urb[i]) 4393+ if(!priv->rx_urb[i]) 4394 goto destroy; 4395- 4396+ 4397 priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL); 4398- if(!priv->rx_urb[i]->transfer_buffer) 4399+ if(!priv->rx_urb[i]->transfer_buffer) 4400 goto destroy1; 4401- 4402+ 4403 priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE; 4404 } 4405- 4406+ 4407 return 0; 4408- 4409+ 4410 destroy1: 4411 usb_free_urb(priv->rx_urb[i]); 4412- 4413+ 4414 destroy: 4415 while (--i >= 0){ 4416 kfree(priv->rx_urb[i]->transfer_buffer); 4417 usb_free_urb(priv->rx_urb[i]); 4418 } 4419- 4420+ 4421 kfree(priv->rx_urb); 4422- 4423+ 4424 priv->rx_urb = NULL; 4425 DMESGE("Endpoint Alloc Failure"); 4426 return -ENOMEM; 4427- 4428+ 4429 } 4430 4431 void rtl8187_usb_deleteendpoints(struct net_device *dev) 4432 { 4433- struct r8180_priv *priv = ieee80211_priv(dev); 4434+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 4435 int i; 4436- 4437+ 4438 if(priv->rx_urb){ 4439 for(i=0;i<MAX_RX_URB;i++){ 4440 usb_kill_urb(priv->rx_urb[i]); 4441@@ -1494,9 +1601,9 @@ 4442 } 4443 kfree(priv->rx_urb); 4444 priv->rx_urb = NULL; 4445- 4446+ 4447 } 4448- 4449+ 4450 } 4451 4452 4453@@ -1505,16 +1612,16 @@ 4454 int i; 4455 u16 word; 4456 int basic_rate,min_rr_rate,max_rr_rate; 4457- 4458-// struct r8180_priv *priv = ieee80211_priv(dev); 4459- 4460- //if (ieee80211_is_54g(priv->ieee80211->current_network) && 4461+ 4462+// struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 4463+ 4464+ //if (ieee80211_is_54g_rtl7(priv->ieee80211->current_network) && 4465 // priv->ieee80211->state == IEEE80211_LINKED){ 4466 basic_rate = ieeerate2rtlrate(240); 4467 min_rr_rate = ieeerate2rtlrate(60); 4468 max_rr_rate = ieeerate2rtlrate(240); 4469- 4470-// 4471+ 4472+// 4473 // }else{ 4474 // basic_rate = ieeerate2rtlrate(20); 4475 // min_rr_rate = ieeerate2rtlrate(10); 4476@@ -1526,21 +1633,21 @@ 4477 4478 word = read_nic_word(dev, BRSR); 4479 word &= ~BRSR_MBR_8185; 4480- 4481+ 4482 4483 for(i=0;i<=basic_rate;i++) 4484 word |= (1<<i); 4485 4486 write_nic_word(dev, BRSR, word); 4487- //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR)); 4488+ DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR)); 4489 } 4490 4491 4492 void rtl8187_link_change(struct net_device *dev) 4493 { 4494 // int i; 4495- 4496- struct r8180_priv *priv = ieee80211_priv(dev); 4497+ 4498+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 4499 //write_nic_word(dev, BintrItv, net->beacon_interval); 4500 rtl8187_net_update(dev); 4501 /*update timing params*/ 4502@@ -1553,24 +1660,24 @@ 4503 4504 short rtl8180_init(struct net_device *dev) 4505 { 4506- 4507- struct r8180_priv *priv = ieee80211_priv(dev); 4508+ 4509+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 4510 int i, j; 4511 u16 word; 4512- int ch; 4513+ int ch, chans; 4514 //u16 version; 4515- //u8 hw_version; 4516- //u8 config3; 4517- 4518+ u8 hw_version; 4519+ u8 config3; 4520+ 4521 //FIXME: these constants are placed in a bad pleace. 4522 4523 // priv->txbuffsize = 1024; 4524 // priv->txringcount = 32; 4525 // priv->rxbuffersize = 1024; 4526-// priv->rxringcount = 32; 4527+// priv->rxringcount = 32; 4528 // priv->txbeaconcount = 3; 4529 // priv->rx_skb_complete = 1; 4530- //priv->txnp_pending.ispending=0; 4531+ //priv->txnp_pending.ispending=0; 4532 /* ^^ the SKB does not containt a partial RXed 4533 * packet (is empty) 4534 */ 4535@@ -1580,15 +1687,24 @@ 4536 return -1; 4537 } 4538 ch=channels; 4539+ chans=0; 4540+ for (i=1; i<=14; i++) { 4541+ if( (u8)(ch & 0x01) ) chans++; 4542+ ch >>= 1; 4543+ } 4544+ DMESG("Enabling %d channels.", chans); 4545+ ch=channels; 4546 // set channels 1..14 allowed in given locale 4547 for (i=1; i<=14; i++) { 4548 (priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01); 4549 ch >>= 1; 4550 } 4551 //memcpy(priv->stats,0,sizeof(struct Stats)); 4552- 4553+ 4554 //priv->irq_enabled=0; 4555- 4556+ 4557+ priv->dev = dev; 4558+ 4559 // priv->stats.rxdmafail=0; 4560 priv->stats.txrdu=0; 4561 // priv->stats.rxrdu=0; 4562@@ -1612,33 +1728,37 @@ 4563 // priv->stats.txbeaconerr=0; 4564 priv->stats.txlperr=0; 4565 priv->stats.txlpokint=0; 4566- 4567+ 4568 priv->ieee80211->iw_mode = IW_MODE_INFRA; 4569- 4570+ 4571 priv->retry_rts = DEFAULT_RETRY_RTS; 4572 priv->retry_data = DEFAULT_RETRY_DATA; 4573 priv->ieee80211->rate = 110; //11 mbps 4574 priv->ieee80211->short_slot = 1; 4575- priv->ieee80211->mode = IEEE_G; 4576+ priv->ieee80211->mode = IEEE_G|IEEE_B; 4577 priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0; 4578 spin_lock_init(&priv->tx_lock); 4579+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) 4580 INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev); 4581+#else 4582+ INIT_WORK(&priv->reset_wq, rtl8180_restart); 4583+#endif 4584 sema_init(&priv->wx_sem,1); 4585 tasklet_init(&priv->irq_rx_tasklet, 4586 (void(*)(unsigned long))rtl8180_irq_rx_tasklet, 4587 (unsigned long)priv); 4588 4589- //priv->ieee80211->func = 4590+ //priv->ieee80211->func = 4591 // kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL); 4592 //memset(priv->ieee80211->func, 0, 4593 // sizeof(struct ieee80211_helper_functions)); 4594- priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL; 4595+ priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL; 4596 priv->ieee80211->iw_mode = IW_MODE_INFRA; 4597- priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN | 4598- IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ | 4599+ priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN | 4600+ IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ | 4601 IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE | 4602 /*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE; 4603- 4604+ 4605 priv->ieee80211->active_scan = 1; 4606 priv->ieee80211->rate = 110; //11 mbps 4607 priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION; 4608@@ -1655,51 +1775,51 @@ 4609 priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume; 4610 //priv->ieee80211->start_send_beacons = NULL; 4611 //priv->ieee80211->stop_send_beacons = NULL; 4612- 4613+ 4614 priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD; 4615- 4616+ 4617 priv->card_8185 = 2; 4618 priv->phy_ver = 2; 4619 priv->card_type = USB; 4620- 4621+ 4622 #if 0 4623 hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT; 4624- 4625+ 4626 switch (hw_version){ 4627 case HW_VERID_R8185_ABC: 4628- DMESG("MAC controller is a RTL8185 b/g"); 4629+ DMESG("MAC controller is a RTL8185 b/g"); 4630 priv->card_8185 = 1; 4631 /* you should not find a card with 8225 PHY ver < C*/ 4632 priv->phy_ver = 2; 4633 break; 4634- 4635+ 4636 case HW_VERID_R8185_D: 4637- DMESG("MAC controller is a RTL8185 b/g (V. D)"); 4638+ DMESG("MAC controller is a RTL8185 b/g (V. D)"); 4639 priv->card_8185 = 2; 4640 /* you should not find a card with 8225 PHY ver < C*/ 4641 priv->phy_ver = 2; 4642 break; 4643- 4644+ 4645 case HW_VERID_R8180_ABCD: 4646 DMESG("MAC controller is a RTL8180"); 4647 priv->card_8185 = 0; 4648 break; 4649- 4650+ 4651 case HW_VERID_R8180_F: 4652 DMESG("MAC controller is a RTL8180 (v. F)"); 4653 priv->card_8185 = 0; 4654 break; 4655- 4656+ 4657 default: 4658 DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version); 4659 priv->card_8185 = 0; 4660 break; 4661 } 4662- 4663- 4664+ 4665+ 4666 /* you should not found any 8185 Ver B Card */ 4667 priv->card_8185_Bversion = 0; 4668- 4669+ 4670 config3 = read_nic_byte(dev, CONFIG3); 4671 if(config3 & 0x8){ 4672 priv->card_type = CARDBUS; 4673@@ -1715,13 +1835,19 @@ 4674 #endif 4675 priv->enable_gpio0 = 0; 4676 4677- 4678+ 4679+ hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT; 4680+ config3 = read_nic_byte(dev, CONFIG3); 4681+ 4682+ DMESG("MAC chip version: %02X", hw_version); 4683+ DMESG("Card type: %02X", config3); 4684+ 4685 /* commented out just because we already do 4686 this when resetting the card 4687 andrea 20050924 4688 */ 4689 #if 0 4690- 4691+ 4692 u8 txcr, txreg50; 4693 u32 txreg54, txreg60; 4694 4695@@ -1757,8 +1883,8 @@ 4696 // DMESG("<<txcr:%x>>", txcr); 4697 4698 #endif 4699- 4700- /*the eeprom type is stored in RCR register bit #6 */ 4701+ 4702+ /*the eeprom type is stored in RCR register bit #6 */ 4703 if (RCR_9356SEL & read_nic_dword(dev, RCR)){ 4704 priv->epromtype=EPROM_93c56; 4705 DMESG("Reported EEPROM chip is a 93c56 (2Kbit)"); 4706@@ -1766,58 +1892,71 @@ 4707 priv->epromtype=EPROM_93c46; 4708 DMESG("Reported EEPROM chip is a 93c46 (1Kbit)"); 4709 } 4710- 4711- dev->get_stats = rtl8180_stats; 4712- 4713+ 4714 dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff; 4715 dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8; 4716 dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff; 4717 dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8; 4718 dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff; 4719 dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8; 4720- 4721+ 4722 DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr)); 4723- 4724+ 4725 for(i=1,j=0; i<6; i+=2,j++){ 4726- 4727+ 4728 word = eprom_read(dev,EPROM_TXPW0 + j); 4729 priv->chtxpwr[i]=word & 0xf; 4730 priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4; 4731 priv->chtxpwr[i+1]=(word & 0xf00)>>8; 4732 priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12; 4733 } 4734- 4735+ 4736 for(i=1,j=0; i<4; i+=2,j++){ 4737- 4738+ 4739 word = eprom_read(dev,EPROM_TXPW1 + j); 4740 priv->chtxpwr[i+6]=word & 0xf; 4741 priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4; 4742 priv->chtxpwr[i+6+1]=(word & 0xf00)>>8; 4743 priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12; 4744 } 4745- 4746+ 4747 for(i=1,j=0; i<4; i+=2,j++){ 4748- 4749+ 4750 word = eprom_read(dev,EPROM_TXPW2 + j); 4751 priv->chtxpwr[i+6+4]=word & 0xf; 4752 priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4; 4753 priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8; 4754 priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12; 4755 } 4756- 4757- 4758+ 4759+ 4760 priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID); 4761- 4762+ 4763+#ifdef DEBUG_TX_POWER 4764+ dump_tx_power(dev); 4765+#endif 4766+ 4767+ DMESG("RF Chip ID: %02X", priv->rf_chip); 4768+ 4769 word = eprom_read(dev,EPROM_TXPW_BASE); 4770 priv->cck_txpwr_base = word & 0xf; 4771 priv->ofdm_txpwr_base = (word>>4) & 0xf; 4772- 4773+ 4774+ priv->txpwr_max = 0; 4775+ for(i=1; i<15; i++) 4776+ { 4777+ if(priv->chtxpwr[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr[i]; 4778+ if(priv->chtxpwr_ofdm[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr_ofdm[i]; 4779+ priv->chtxpwr_orig[i] = priv->chtxpwr[i]; 4780+ priv->chtxpwr_ofdm_orig[i] = priv->chtxpwr_ofdm[i]; 4781+ } 4782+ 4783 /* check RF frontend chipset */ 4784- 4785+ 4786 switch (priv->rf_chip) { 4787- 4788+ 4789 case EPROM_RFCHIPID_RTL8225U: 4790- 4791+ 4792 DMESG("Card reports RF frontend Realtek 8225"); 4793 DMESGW("This driver has EXPERIMENTAL support for this chipset."); 4794 DMESGW("use it with care and at your own risk and"); 4795@@ -1834,28 +1973,28 @@ 4796 DMESG("This seems a legacy 1st version radio"); 4797 } 4798 priv->rf_close = rtl8225_rf_close; 4799- 4800+ 4801 priv->max_sens = RTL8225_RF_MAX_SENS; 4802 priv->sens = RTL8225_RF_DEF_SENS; 4803 break; 4804- 4805+ 4806 default: 4807 DMESGW("Unknown RF module %x",priv->rf_chip); 4808 DMESGW("Exiting..."); 4809 return -1; 4810- 4811+ 4812 } 4813- 4814+ 4815 // DMESG("Energy threshold: %x",priv->cs_treshold); 4816 DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7); 4817 //DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2)); 4818- 4819- if(rtl8187_usb_initendpoints(dev)!=0){ 4820+ 4821+ if(rtl8187_usb_initendpoints(dev)!=0){ 4822 DMESG("Endopoints initialization failed"); 4823 return -ENOMEM; 4824 } 4825-#if 0 4826- if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount)) 4827+#if 0 4828+ if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount)) 4829 return -ENOMEM; 4830 4831 if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount, 4832@@ -1869,16 +2008,16 @@ 4833 if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount, 4834 TX_LOWPRIORITY_RING_ADDR)) 4835 return -ENOMEM; 4836- 4837- 4838+ 4839+ 4840 if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount)) 4841 return -ENOMEM; 4842 #endif 4843- 4844+ 4845 4846 #ifdef DEBUG_EPROM 4847 dump_eprom(dev); 4848-#endif 4849+#endif 4850 return 0; 4851 4852 } 4853@@ -1898,7 +2037,7 @@ 4854 rtl8180_set_mode(dev, EPROM_CMD_CONFIG); 4855 4856 conf3 = read_nic_byte(dev, CONFIG3); 4857- write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT)); 4858+ write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT)); 4859 4860 write_nic_dword(dev, ANAPARAM2, a); 4861 4862@@ -1918,23 +2057,23 @@ 4863 4864 conf3 = read_nic_byte(dev, CONFIG3); 4865 write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT)); 4866- 4867+ 4868 write_nic_dword(dev, ANAPARAM, a); 4869 4870 conf3 = read_nic_byte(dev, CONFIG3); 4871 write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT)); 4872 4873 rtl8180_set_mode(dev, EPROM_CMD_NORMAL); 4874- 4875+ 4876 } 4877 4878 4879 void rtl8185_tx_antenna(struct net_device *dev, u8 ant) 4880 { 4881- write_nic_byte(dev, TX_ANTENNA, ant); 4882+ write_nic_byte(dev, TX_ANTENNA, ant); 4883 force_pci_posting(dev); 4884 mdelay(1); 4885-} 4886+} 4887 4888 4889 void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data) 4890@@ -1942,26 +2081,26 @@ 4891 //u8 phyr; 4892 u32 phyw; 4893 // int i; 4894- 4895+ 4896 adr |= 0x80; 4897- 4898+ 4899 phyw= ((data<<8) | adr); 4900- 4901- 4902- 4903- // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register. 4904+ 4905+ 4906+ 4907+ // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register. 4908 write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24)); 4909 write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16)); 4910 write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8)); 4911 write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) )); 4912 4913 //read_nic_dword(dev, PHY_ADR); 4914-#if 0 4915+#if 0 4916 for(i=0;i<10;i++){ 4917 write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw); 4918 phyr = read_nic_byte(dev, PHY_READ); 4919 if(phyr == (data&0xff)) break; 4920- 4921+ 4922 } 4923 #endif 4924 /* this is ok to fail when we write AGC table. check for AGC table might be 4925@@ -1988,60 +2127,60 @@ 4926 4927 void rtl8180_adapter_start(struct net_device *dev) 4928 { 4929- struct r8180_priv *priv = ieee80211_priv(dev); 4930+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 4931 //u32 anaparam; 4932 //u8 config3; 4933- 4934+ 4935 //rtl8180_rtx_disable(dev); 4936 rtl8180_reset(dev); 4937 4938 write_nic_byte(dev,0x85,0); 4939 write_nic_byte(dev,0x91,0); 4940- 4941+ 4942 /* light blink! */ 4943 write_nic_byte(dev,0x85,4); 4944 write_nic_byte(dev,0x91,1); 4945 write_nic_byte(dev,0x90,0); 4946- 4947+ 4948 priv->irq_mask = 0xffff; 4949 /* 4950 priv->dma_poll_mask = 0; 4951 priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT); 4952-*/ 4953+*/ 4954 // rtl8180_beacon_tx_disable(dev); 4955- 4956+ 4957 rtl8180_set_mode(dev, EPROM_CMD_CONFIG); 4958 write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]); 4959 write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff ); 4960 4961 rtl8180_set_mode(dev, EPROM_CMD_NORMAL); 4962 rtl8180_update_msr(dev); 4963- 4964+ 4965 rtl8180_set_mode(dev, EPROM_CMD_CONFIG); 4966- 4967+ 4968 write_nic_word(dev,0xf4,0xffff); 4969 write_nic_byte(dev, 4970- CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80); 4971+ CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80); 4972 4973 rtl8180_set_mode(dev,EPROM_CMD_NORMAL); 4974- 4975- write_nic_dword(dev,INT_TIMEOUT,0); 4976+ 4977+ write_nic_dword(dev,INT_TIMEOUT,0); 4978 4979 #ifdef DEBUG_REGISTERS 4980- rtl8180_dump_reg(dev); 4981+ rtl8180_dump_reg(dev); 4982 #endif 4983- 4984- 4985- write_nic_byte(dev, WPA_CONFIG, 0); 4986+ 4987+ 4988+ write_nic_byte(dev, WPA_CONFIG, 0); 4989 4990 write_nic_byte(dev, RATE_FALLBACK, 0x81); 4991 rtl8187_set_rate(dev); 4992- 4993- priv->rf_init(dev); 4994+ 4995+ priv->rf_init(dev); 4996 4997 if(priv->rf_set_sens != NULL) 4998- priv->rf_set_sens(dev,priv->sens); 4999- 5000+ priv->rf_set_sens(dev,priv->sens); 5001+ 5002 write_nic_word(dev,0x5e,1); 5003 5004 #if 1 5005@@ -2054,13 +2193,13 @@ 5006 write_nic_byte(dev, 0xff, 0x60); 5007 5008 write_nic_word(dev,0x5e,0); 5009- 5010- 5011+ 5012+ 5013 rtl8180_irq_enable(dev); 5014 /*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY)); 5015- 5016+ 5017 DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY)); 5018- 5019+ 5020 DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY)); 5021 if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK"); 5022 if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK"); 5023@@ -2077,8 +2216,8 @@ 5024 void rtl8180_start_tx_beacon(struct net_device *dev) 5025 { 5026 int i; 5027- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 5028- u16 word; 5029+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 5030+ u16 word; 5031 DMESG("Enabling beacon TX"); 5032 //write_nic_byte(dev, 0x42,0xe6);// TCR 5033 //rtl8180_init_beacon(dev); 5034@@ -2091,41 +2230,41 @@ 5035 //write_nic_word(dev,0x7a,0); 5036 //write_nic_word(dev,0x7a,0x8000); 5037 5038- 5039+ 5040 word = read_nic_word(dev, BcnItv); 5041 word &= ~BcnItv_BcnItv; // clear Bcn_Itv 5042 write_nic_word(dev, BcnItv, word); 5043 5044- write_nic_word(dev, AtimWnd, 5045+ write_nic_word(dev, AtimWnd, 5046 read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd); 5047- 5048+ 5049 word = read_nic_word(dev, BintrItv); 5050 word &= ~BintrItv_BintrItv; 5051- 5052- //word |= priv->ieee80211->beacon_interval * 5053+ 5054+ //word |= priv->ieee80211->beacon_interval * 5055 // ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1); 5056 // FIXME:FIXME check if correct ^^ worked with 0x3e8; 5057- 5058+ 5059 write_nic_word(dev, BintrItv, word); 5060- 5061+ 5062 //write_nic_word(dev,0x2e,0xe002); 5063 //write_nic_dword(dev,0x30,0xb8c7832e); 5064 for(i=0; i<ETH_ALEN; i++) 5065 write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]); 5066- 5067+ 5068 // rtl8180_update_msr(dev); 5069 5070- 5071+ 5072 //write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */ 5073- 5074+ 5075 rtl8180_set_mode(dev, EPROM_CMD_NORMAL); 5076- 5077+ 5078 rtl8180_irq_enable(dev); 5079- 5080+ 5081 /* VV !!!!!!!!!! VV*/ 5082 /* 5083 rtl8180_set_mode(dev,EPROM_CMD_CONFIG); 5084- write_nic_byte(dev,0x9d,0x00); 5085+ write_nic_byte(dev,0x9d,0x00); 5086 rtl8180_set_mode(dev,EPROM_CMD_NORMAL); 5087 */ 5088 } 5089@@ -2135,137 +2274,138 @@ 5090 ***************************************************************************/ 5091 static struct net_device_stats *rtl8180_stats(struct net_device *dev) 5092 { 5093- struct r8180_priv *priv = ieee80211_priv(dev); 5094- 5095+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 5096+ 5097 return &priv->ieee80211->stats; 5098 } 5099 5100 5101 int _rtl8180_up(struct net_device *dev) 5102 { 5103- struct r8180_priv *priv = ieee80211_priv(dev); 5104+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 5105 5106 priv->up=1; 5107- 5108- //DMESG("Bringing up iface"); 5109+ 5110+// DMESG("Bringing up iface"); 5111 5112 rtl8180_adapter_start(dev); 5113- 5114 rtl8180_rx_enable(dev); 5115- 5116 rtl8180_tx_enable(dev); 5117- 5118- ieee80211_softmac_start_protocol(priv->ieee80211); 5119- 5120- ieee80211_reset_queue(priv->ieee80211); 5121+ ieee80211_softmac_start_protocol_rtl7(priv->ieee80211); 5122+ ieee80211_reset_queue_rtl7(priv->ieee80211); 5123 if(!netif_queue_stopped(dev)) 5124 netif_start_queue(dev); 5125 else 5126 netif_wake_queue(dev); 5127- 5128 return 0; 5129 } 5130 5131 5132 int rtl8180_open(struct net_device *dev) 5133 { 5134- struct r8180_priv *priv = ieee80211_priv(dev); 5135+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 5136 int ret; 5137- 5138+ 5139 down(&priv->wx_sem); 5140+ 5141 ret = rtl8180_up(dev); 5142 up(&priv->wx_sem); 5143 return ret; 5144- 5145+ 5146 } 5147 5148 5149 int rtl8180_up(struct net_device *dev) 5150 { 5151- struct r8180_priv *priv = ieee80211_priv(dev); 5152+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 5153 5154 if (priv->up == 1) return -1; 5155- 5156+ 5157 return _rtl8180_up(dev); 5158 } 5159 5160 5161 int rtl8180_close(struct net_device *dev) 5162 { 5163- struct r8180_priv *priv = ieee80211_priv(dev); 5164+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 5165 int ret; 5166- 5167+ 5168 down(&priv->wx_sem); 5169- 5170+ 5171 ret = rtl8180_down(dev); 5172- 5173+ 5174 up(&priv->wx_sem); 5175- 5176+ 5177 return ret; 5178 5179 } 5180 5181 int rtl8180_down(struct net_device *dev) 5182 { 5183- struct r8180_priv *priv = ieee80211_priv(dev); 5184+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 5185 5186 if (priv->up == 0) return -1; 5187- 5188+ 5189 priv->up=0; 5190 5191 /* FIXME */ 5192 if (!netif_queue_stopped(dev)) 5193 netif_stop_queue(dev); 5194- 5195+ 5196 rtl8180_rtx_disable(dev); 5197 rtl8180_irq_disable(dev); 5198 5199- ieee80211_softmac_stop_protocol(priv->ieee80211); 5200- 5201+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211); 5202+ 5203 return 0; 5204 } 5205 5206 5207 void rtl8180_commit(struct net_device *dev) 5208 { 5209- struct r8180_priv *priv = ieee80211_priv(dev); 5210+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 5211 5212 if (priv->up == 0) return ; 5213- 5214- ieee80211_softmac_stop_protocol(priv->ieee80211); 5215- 5216+ 5217+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211); 5218+ 5219 rtl8180_irq_disable(dev); 5220 rtl8180_rtx_disable(dev); 5221 _rtl8180_up(dev); 5222 } 5223 5224+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) 5225+void rtl8180_restart(struct work_struct *work) 5226+{ 5227+ struct r8180_priv *priv = container_of(work, struct r8180_priv, reset_wq); 5228+ struct net_device *dev = priv->dev; 5229+#else 5230 void rtl8180_restart(struct net_device *dev) 5231 { 5232- struct r8180_priv *priv = ieee80211_priv(dev); 5233- 5234+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 5235+#endif 5236 down(&priv->wx_sem); 5237- 5238 rtl8180_commit(dev); 5239- 5240+ 5241 up(&priv->wx_sem); 5242 } 5243 5244 static void r8180_set_multicast(struct net_device *dev) 5245 { 5246- struct r8180_priv *priv = ieee80211_priv(dev); 5247+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 5248 short promisc; 5249 5250 //down(&priv->wx_sem); 5251- 5252+ 5253 /* FIXME FIXME */ 5254- 5255+ 5256 promisc = (dev->flags & IFF_PROMISC) ? 1:0; 5257- 5258+ 5259 if (promisc != priv->promisc) 5260 // rtl8180_commit(dev); 5261- 5262+ 5263 priv->promisc = promisc; 5264- 5265+ 5266 //schedule_work(&priv->reset_wq); 5267 //up(&priv->wx_sem); 5268 } 5269@@ -2273,17 +2413,17 @@ 5270 5271 int r8180_set_mac_adr(struct net_device *dev, void *mac) 5272 { 5273- struct r8180_priv *priv = ieee80211_priv(dev); 5274+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev); 5275 struct sockaddr *addr = mac; 5276- 5277+ 5278 down(&priv->wx_sem); 5279- 5280+ 5281 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); 5282- 5283+ 5284 schedule_work(&priv->reset_wq); 5285- 5286+ 5287 up(&priv->wx_sem); 5288- 5289+ 5290 return 0; 5291 } 5292 5293@@ -2291,16 +2431,18 @@ 5294 /* based on ipw2200 driver */ 5295 int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 5296 { 5297- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 5298- 5299+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 5300+ struct iwreq *wrq; 5301+ int ret; 5302+ 5303 down(&priv->wx_sem); 5304- 5305- struct iwreq *wrq = (struct iwreq *)rq; 5306- 5307- int ret=-1; 5308+ 5309+ wrq = (struct iwreq *)rq; 5310+ 5311+ ret=-1; 5312 switch (cmd) { 5313 case RTL_IOCTL_WPA_SUPPLICANT: 5314- ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data); 5315+ ret = ieee80211_wpa_supplicant_ioctl_rtl7(priv->ieee80211, &wrq->u.data); 5316 break; 5317 5318 default: 5319@@ -2309,7 +2451,7 @@ 5320 } 5321 5322 up(&priv->wx_sem); 5323- 5324+ 5325 return ret; 5326 } 5327 5328@@ -2320,10 +2462,11 @@ 5329 struct net_device *dev = (struct net_device*)rx_urb->context; 5330 int status,len,flen; 5331 struct sk_buff *skb; 5332- u32 *desc; 5333- 5334+ u8 *desc; 5335+ u8 signal,quality,rate; 5336+ 5337 //DMESG("rtl8187_rx_isr"); 5338- 5339+ 5340 struct ieee80211_rx_stats stats = { 5341 .signal = 0, 5342 .noise = -98, 5343@@ -2332,43 +2475,109 @@ 5344 .freq = IEEE80211_24GHZ_BAND, 5345 }; 5346 5347+ 5348 //DMESG("RX %d ",rx_urb->status); 5349 status = rx_urb->status; 5350 if(status == 0){ 5351- 5352+ 5353 len = rx_urb->actual_length; 5354- // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/ 5355+ // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/ 5356 len -= 4*4;/* 4 dword and 4 byte CRC */ 5357- 5358+#if 0 5359 desc = (u32*)(rx_urb->transfer_buffer + len); 5360- 5361+ 5362 flen = desc[0] & 0xfff; 5363- 5364+ 5365 if( flen <= rx_urb->actual_length){ 5366- 5367- stats.signal = (desc[1] & 0x7f00)>>8; 5368- stats.noise = desc[1] &0xff; 5369- stats.rate = desc[0] >> 20 & 0xf; 5370+ 5371+ //stats.signal = (desc[1] & 0x7f00)>>8; 5372+ //stats.noise = desc[1] &0xff; 5373+ signal=(desc[1]& (0xff0000))>>16; 5374+ signal=(signal&0xfe)>>1; // Modify by hikaru 6.6 5375+ 5376+ quality=(desc[1] & (0xff)); 5377+ 5378+ rate=(desc[0] &((1<<23)|(1<<22)|(1<<21)|(1<<20)))>>20; 5379+ // printk(KERN_INFO "rate is %d!\n",rate); 5380+ stats.rate = rtl8180_rate2rate(rate); 5381+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate); 5382+ //stats.rate = desc[0] >> 20 & 0xf; 5383 stats.mac_time[0] = desc[2]; 5384 stats.mac_time[1] = desc[3]; 5385+#endif 5386+ 5387+ desc = rx_urb->transfer_buffer + len; 5388+ 5389+ flen = ((desc[1] & 0x0f) << 8) + (desc[0] & 0xff); 5390+ 5391+ if( flen <= rx_urb->actual_length){ 5392+ //stats.signal = (desc[1] & 0x7f00)>>8; 5393+ //stats.noise = desc[1] &0xff; 5394+ signal=(desc[6]& 0xfe)>>1; 5395+ //signal=(signal&0xfe)>>1; // Modify by hikaru 6.6 5396+ 5397+ quality=desc[4] & 0xff; 5398+ 5399+ //rate=(desc[2] &((1<<7)|(1<<6)|(1<<5)|(1<<4)))>>4; 5400+ rate=(desc[2] & 0xf0)>>4; 5401+ // printk(KERN_INFO "rate is %d!\n",rate); 5402+ stats.rate = rtl8180_rate2rate(rate); 5403+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate); 5404+ //stats.rate = desc[0] >> 20 & 0xf; 5405+ stats.mac_time[0] = desc[8] + (desc[9]<<8) + (desc[10]<<16) + (desc[11]<<24); 5406+ stats.mac_time[1] = desc[12] + (desc[13]<<8) + (desc[14]<<16) + (desc[15]<<24); 5407+ 5408+ 5409+ //calculate link quality begin 5410+ if(!rtl8180_IsWirelessBMode(stats.rate) ) 5411+ { // OFDM rate. 5412+ if(signal>90) 5413+ signal=90; 5414+ else if(signal<25) 5415+ signal=25; 5416+ signal = (90-signal)*100/65; 5417+ } 5418+ else 5419+ { // CCK rate. 5420+ if(signal>95) 5421+ signal = 95; 5422+ else if(signal<30) 5423+ signal = 30; 5424+ signal =(95-signal )*100/65; 5425+ } 5426+ priv->wstats.qual.level = signal; 5427+ // printk(KERN_INFO "signal is %d!\n",signal); 5428+ if(quality > 64) 5429+ priv ->wstats.qual.qual = 0; 5430+ else 5431+ priv ->wstats.qual.qual = ((64-quality) * 100) / 64; // SQ value is the SIGNAL_QUALITY returned to IORequest, 5432+ //and this value only appear when STA is associated to AP or 5433+ // STA is in IBSS mode 5434+ // printk(KERN_INFO "quality is %d!\n",priv->wstats.qual.qual); 5435+ priv->wstats.qual.noise = 100 - priv ->wstats.qual.qual; 5436+ priv->wstats.qual.updated = 7; 5437+ if(priv->ieee80211->iw_mode == IW_MODE_MONITOR) 5438+ { 5439+ stats.signal = priv->wstats.qual.level; 5440+ stats.noise = priv->wstats.qual.noise; 5441+ } 5442+ //calculate link quality end 5443 skb = dev_alloc_skb(flen-4); 5444- //skb_reserve(skb,2); 5445- if(skb){ 5446+ if(skb){ 5447 memcpy(skb_put(skb,flen-4), 5448 rx_urb->transfer_buffer,flen -4); 5449- 5450+ 5451 #ifdef DUMP_RX 5452 int i; 5453 for(i=0;i<flen-4;i++) 5454 printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]); 5455 printk("------RATE %x:w---------------\n",stats.rate); 5456- 5457+ 5458 #endif 5459 priv->stats.rxok++; 5460 // priv->rxskb = skb; 5461 // priv->tempstats = &stats; 5462- 5463- if(!ieee80211_rx(priv->ieee80211, 5464+ if(!ieee80211_rx_rtl7(priv->ieee80211, 5465 skb, &stats)) 5466 dev_kfree_skb_any(skb); 5467 } 5468@@ -2376,9 +2585,8 @@ 5469 }else{ 5470 priv->stats.rxstaterr++; 5471 priv->ieee80211->stats.rx_errors++; 5472- 5473 } 5474- 5475+ 5476 if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb); 5477 else DMESG("RX process aborted due to explicit shutdown"); 5478 } 5479@@ -2387,6 +2595,19 @@ 5480 ---------------------------- USB_STUFF--------------------------- 5481 *****************************************************************************/ 5482 5483+#ifdef HAVE_NET_DEVICE_OPS 5484+static const struct net_device_ops rtl8180_netdev_ops = { 5485+ .ndo_open = rtl8180_open, 5486+ .ndo_stop = rtl8180_close, 5487+ .ndo_get_stats = rtl8180_stats, 5488+ .ndo_tx_timeout = tx_timeout, 5489+ .ndo_do_ioctl = rtl8180_ioctl, 5490+ .ndo_set_multicast_list = r8180_set_multicast, 5491+ .ndo_set_mac_address = r8180_set_mac_adr, 5492+ .ndo_start_xmit = ieee80211_xmit_rtl7, 5493+// .ndo_start_xmit = ieee80211_xmit, 5494+}; 5495+#endif 5496 5497 static int __devinit rtl8187_usb_probe(struct usb_interface *intf, 5498 const struct usb_device_id *id) 5499@@ -2396,63 +2617,76 @@ 5500 struct r8180_priv *priv= NULL; 5501 struct usb_device *udev = interface_to_usbdev(intf); 5502 5503-//printk("===> rtl8187_usb_probe()\n"); 5504- 5505- dev = alloc_ieee80211(sizeof(struct r8180_priv)); 5506- 5507+//printk("===> rtl8187_usb_probe()\n"); 5508+ 5509+ dev = alloc_ieee80211_rtl7(sizeof(struct r8180_priv)); 5510+ 5511+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) 5512 SET_MODULE_OWNER(dev); 5513- usb_set_intfdata(intf, dev); 5514- 5515+#endif 5516+ usb_set_intfdata(intf, dev); 5517+ 5518 SET_NETDEV_DEV(dev, &intf->dev); 5519 5520- priv = ieee80211_priv(dev); 5521+ priv = ieee80211_priv_rtl7(dev); 5522 priv->ieee80211 = netdev_priv(dev); 5523- 5524+ 5525 priv->udev=udev; 5526- 5527+ 5528+#ifdef HAVE_NET_DEVICE_OPS 5529+ dev->netdev_ops = &rtl8180_netdev_ops; 5530+#else 5531 dev->open = rtl8180_open; 5532 dev->stop = rtl8180_close; 5533+ dev->get_stats = rtl8180_stats; 5534 //dev->hard_start_xmit = rtl8180_8023_hard_start_xmit; 5535 dev->tx_timeout = tx_timeout; 5536 dev->wireless_handlers = &r8180_wx_handlers_def; 5537 dev->do_ioctl = rtl8180_ioctl; 5538 dev->set_multicast_list = r8180_set_multicast; 5539 dev->set_mac_address = r8180_set_mac_adr; 5540+#endif 5541+ 5542+#if WIRELESS_EXT >= 12 5543+#if WIRELESS_EXT < 17 5544 dev->get_wireless_stats = r8180_get_wireless_stats; 5545+#endif 5546+ dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def; 5547+#endif 5548 dev->type=ARPHRD_ETHER; 5549- 5550+ 5551 if (dev_alloc_name(dev, ifname) < 0){ 5552 DMESG("Oops: devname already taken! Trying wlan%%d...\n"); 5553 ifname = "wlan%d"; 5554 dev_alloc_name(dev, ifname); 5555 } 5556- 5557+ 5558 // dev->open=rtl8180_init; 5559- 5560- if(rtl8180_init(dev)!=0){ 5561+ 5562+ if(rtl8180_init(dev)!=0){ 5563 DMESG("Initialization failed"); 5564 goto fail; 5565 } 5566- 5567+ 5568 netif_carrier_off(dev); 5569 netif_stop_queue(dev); 5570- 5571+ 5572 register_netdev(dev); 5573- 5574+ 5575 rtl8180_proc_init_one(dev); 5576- 5577- 5578+ 5579+ 5580 DMESG("Driver probe completed\n"); 5581- return 0; 5582+ return 0; 5583+ 5584 5585- 5586 fail: 5587- free_ieee80211(dev); 5588- 5589+ free_ieee80211_rtl7(dev); 5590+ 5591 DMESG("wlan driver load failed\n"); 5592- 5593+ 5594 return -ENODEV; 5595- 5596+ 5597 } 5598 5599 5600@@ -2461,13 +2695,13 @@ 5601 struct r8180_priv *priv; 5602 struct net_device *dev = usb_get_intfdata(intf); 5603 if(dev){ 5604- 5605+ 5606 unregister_netdev(dev); 5607- 5608- priv=ieee80211_priv(dev); 5609- 5610+ 5611+ priv=ieee80211_priv_rtl7(dev); 5612+ 5613 rtl8180_proc_remove_one(dev); 5614- 5615+ 5616 rtl8180_down(dev); 5617 priv->rf_close(dev); 5618 //rtl8180_rtx_disable(dev); 5619@@ -2478,12 +2712,12 @@ 5620 5621 } 5622 // pci_disable_device(pdev); 5623- free_ieee80211(dev); 5624+ free_ieee80211_rtl7(dev); 5625 DMESG("wlan driver removed\n"); 5626 } 5627 5628 5629-static int __init rtl8187_usb_module_init(void) 5630+static int __init rtl8187_usb_module_init_rtl7(void) 5631 { 5632 printk(KERN_INFO "\nLinux kernel driver for RTL8187 \ 5633 based WLAN cards\n"); 5634@@ -2495,7 +2729,7 @@ 5635 } 5636 5637 5638-static void __exit rtl8187_usb_module_exit(void) 5639+static void __exit rtl8187_usb_module_exit_rtl7(void) 5640 { 5641 usb_deregister(&rtl8187_usb_driver); 5642 5643@@ -2508,14 +2742,14 @@ 5644 { 5645 unsigned long flags; 5646 short enough_desc; 5647- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 5648- 5649+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev); 5650+ 5651 spin_lock_irqsave(&priv->tx_lock,flags); 5652 enough_desc = check_nic_enought_desc(dev,pri); 5653- spin_unlock_irqrestore(&priv->tx_lock,flags); 5654- 5655+ spin_unlock_irqrestore(&priv->tx_lock,flags); 5656+ 5657 if(enough_desc) 5658- ieee80211_wake_queue(priv->ieee80211); 5659+ ieee80211_wake_queue_rtl7(priv->ieee80211); 5660 } 5661 5662 5663@@ -2523,5 +2757,5 @@ 5664 /*************************************************************************** 5665 ------------------- module init / exit stubs ---------------- 5666 ****************************************************************************/ 5667-module_init(rtl8187_usb_module_init); 5668-module_exit(rtl8187_usb_module_exit); 5669+module_init(rtl8187_usb_module_init_rtl7); 5670+module_exit(rtl8187_usb_module_exit_rtl7); 5671diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c~ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8187_core.c~ 5672--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c~ 2006-06-21 22:40:10.000000000 -0700 5673+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8187_core.c~ 1969-12-31 16:00:00.000000000 -0800 5674@@ -1,2527 +0,0 @@ 5675-/* 5676- This is part of rtl8187 OpenSource driver - v 0.1 5677- Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it> 5678- Released under the terms of GPL (General Public License) 5679- 5680- 5681- Parts of this driver are based on the rtl8180 driver skeleton 5682- from Patric Schenke & Andres Salomon. 5683- 5684- Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers. 5685- 5686- some ideas might be derived from David Young rtl8180 netbsd driver. 5687- 5688- Parts of the usb code are from the r8150.c driver in linux kernel 5689- 5690- Some ideas borrowed from the 8139too.c driver included in linux kernel. 5691- 5692- We (I?) want to thanks the Authors of those projecs and also the 5693- Ndiswrapper's project Authors. 5694- 5695- A special big thanks goes also to Realtek corp. for their help in my 5696- attempt to add RTL8187 and RTL8225 support, and to David Young also. 5697- 5698- - Please note that this file is a modified version from rtl8180-sa2400 5699- drv. So some other people have contributed to this project, and they are 5700- thanked in the rtl8180-sa2400 CHANGELOG. 5701-*/ 5702- 5703-#ifndef CONFIG_FORCE_HARD_FLOAT 5704-double __floatsidf (int i) { return i; } 5705-unsigned int __fixunsdfsi (double d) { return d; } 5706-double __adddf3(double a, double b) { return a+b; } 5707-double __addsf3(float a, float b) { return a+b; } 5708-double __subdf3(double a, double b) { return a-b; } 5709-double __extendsfdf2(float a) {return a;} 5710-#endif 5711- 5712-#undef LOOP_TEST 5713-#undef DUMP_RX 5714-#undef DUMP_TX 5715-#undef DEBUG_TX_DESC2 5716-#undef RX_DONT_PASS_UL 5717-#undef DEBUG_EPROM 5718-#undef DEBUG_RX_VERBOSE 5719-#undef DUMMY_RX 5720-#undef DEBUG_ZERO_RX 5721-#undef DEBUG_RX_SKB 5722-#undef DEBUG_TX_FRAG 5723-#undef DEBUG_RX_FRAG 5724-#undef DEBUG_TX_FILLDESC 5725-#undef DEBUG_TX 5726-#undef DEBUG_IRQ 5727-#undef DEBUG_RX 5728-#undef DEBUG_RXALLOC 5729-#undef DEBUG_REGISTERS 5730-#undef DEBUG_RING 5731-#undef DEBUG_IRQ_TASKLET 5732-#undef DEBUG_TX_ALLOC 5733-#undef DEBUG_TX_DESC 5734- 5735-//#define CONFIG_RTL8180_IO_MAP 5736- 5737-#include "r8180_hw.h" 5738-#include "r8187.h" 5739-#include "r8180_rtl8225.h" /* RTL8225 Radio frontend */ 5740-#include "r8180_93cx6.h" /* Card EEPROM */ 5741-#include "r8180_wx.h" 5742- 5743- 5744-// FIXME: check if 2.6.7 is ok 5745-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7)) 5746-#define usb_kill_urb usb_unlink_urb 5747-#endif 5748- 5749-#ifdef CONFIG_RTL8180_PM 5750-#include "r8180_pm.h" 5751-#endif 5752- 5753-#ifndef USB_VENDOR_ID_REALTEK 5754-#define USB_VENDOR_ID_REALTEK 0x0bda 5755-#endif 5756-#ifndef USB_VENDOR_ID_NETGEAR 5757-#define USB_VENDOR_ID_NETGEAR 0x0846 5758-#endif 5759- 5760-static struct usb_device_id rtl8187_usb_id_tbl[] = { 5761- {USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x8187)}, 5762- {USB_DEVICE(USB_VENDOR_ID_NETGEAR, 0x6100)}, 5763- {USB_DEVICE(USB_VENDOR_ID_NETGEAR, 0x6a00)}, 5764- 5765- {} 5766-}; 5767- 5768-static char* ifname = "wlan%d"; 5769-#if 0 5770-static int hwseqnum = 0; 5771-static int hwwep = 0; 5772-#endif 5773-static int channels = 0x3fff; 5774- 5775-MODULE_LICENSE("GPL"); 5776-MODULE_VERSION("V 1.1"); 5777-MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl); 5778-MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>"); 5779-MODULE_DESCRIPTION("Linux driver for Realtek RTL8187 WiFi cards"); 5780- 5781-#if 0 5782-MODULE_PARM(ifname,"s"); 5783-MODULE_PARM_DESC(devname," Net interface name, wlan%d=default"); 5784- 5785-MODULE_PARM(hwseqnum,"i"); 5786-MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default"); 5787- 5788-MODULE_PARM(hwwep,"i"); 5789-MODULE_PARM_DESC(hwwep," Try to use hardware WEP support. Still broken and not available on all cards"); 5790- 5791-MODULE_PARM(channels,"i"); 5792-MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI"); 5793-#endif 5794- 5795-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9) 5796-module_param(ifname, charp, S_IRUGO|S_IWUSR ); 5797-//module_param(hwseqnum,int, S_IRUGO|S_IWUSR); 5798-//module_param(hwwep,int, S_IRUGO|S_IWUSR); 5799-module_param(channels,int, S_IRUGO|S_IWUSR); 5800-#else 5801-MODULE_PARM(ifname, "s"); 5802-//MODULE_PARM(hwseqnum,"i"); 5803-//MODULE_PARM(hwwep,"i"); 5804-MODULE_PARM(channels,"i"); 5805-#endif 5806- 5807-MODULE_PARM_DESC(devname," Net interface name, wlan%d=default"); 5808-//MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default"); 5809-//MODULE_PARM_DESC(hwwep," Try to use hardware WEP support. Still broken and not available on all cards"); 5810-MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI"); 5811- 5812-static int __devinit rtl8187_usb_probe(struct usb_interface *intf, 5813- const struct usb_device_id *id); 5814- 5815-static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf); 5816- 5817-static struct usb_driver rtl8187_usb_driver = { 5818- 5819-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16) 5820- .owner = THIS_MODULE, 5821-#endif 5822- .name = RTL8187_MODULE_NAME, /* Driver name */ 5823- .id_table = rtl8187_usb_id_tbl, /* PCI_ID table */ 5824- .probe = rtl8187_usb_probe, /* probe fn */ 5825- .disconnect = rtl8187_usb_disconnect, /* remove fn */ 5826-#ifdef CONFIG_RTL8180_PM 5827- .suspend = rtl8180_suspend, /* PM suspend fn */ 5828- .resume = rtl8180_resume, /* PM resume fn */ 5829-#else 5830- .suspend = NULL, /* PM suspend fn */ 5831- .resume = NULL, /* PM resume fn */ 5832-#endif 5833-}; 5834- 5835- 5836-void write_nic_byte_E(struct net_device *dev, int indx, u8 data) 5837-{ 5838- 5839- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 5840- struct usb_device *udev = priv->udev; 5841- 5842- usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 5843- RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, 5844- indx|0xfe00, 0, &data, 1, HZ / 2); 5845-} 5846- 5847- 5848-void write_nic_byte(struct net_device *dev, int indx, u8 data) 5849-{ 5850- 5851- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 5852- struct usb_device *udev = priv->udev; 5853- 5854- usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 5855- RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, 5856- indx|0xff00, 0, &data, 1, HZ / 2); 5857-} 5858- 5859- 5860-void write_nic_word(struct net_device *dev, int indx, u16 data) 5861-{ 5862- 5863- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 5864- struct usb_device *udev = priv->udev; 5865- 5866- usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 5867- RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, 5868- indx|0xff00, 0, &data, 2, HZ / 2); 5869-} 5870- 5871- 5872-void write_nic_dword(struct net_device *dev, int indx, u32 data) 5873-{ 5874- 5875- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 5876- struct usb_device *udev = priv->udev; 5877- 5878- usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 5879- RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, 5880- indx|0xff00, 0, &data, 4, HZ / 2); 5881-} 5882- 5883- 5884- 5885-u8 read_nic_byte(struct net_device *dev, int indx) 5886-{ 5887- u8 data; 5888- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 5889- struct usb_device *udev = priv->udev; 5890- 5891- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 5892- RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, 5893- indx|0xff00, 0, &data, 1, HZ / 2); 5894- return data; 5895-} 5896- 5897-u8 read_nic_byte_E(struct net_device *dev, int indx) 5898-{ 5899- u8 data; 5900- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 5901- struct usb_device *udev = priv->udev; 5902- 5903- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 5904- RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, 5905- indx|0xfe00, 0, &data, 1, HZ / 2); 5906- return data; 5907-} 5908- 5909- 5910-u16 read_nic_word(struct net_device *dev, int indx) 5911-{ 5912- u16 data; 5913- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 5914- struct usb_device *udev = priv->udev; 5915- 5916- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 5917- RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, 5918- indx|0xff00, 0, &data, 2, HZ / 2); 5919- return data; 5920-} 5921- 5922- 5923-u32 read_nic_dword(struct net_device *dev, int indx) 5924-{ 5925- u32 data; 5926- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 5927- struct usb_device *udev = priv->udev; 5928- 5929- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 5930- RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, 5931- indx|0xff00, 0, &data, 4, HZ / 2); 5932- return data; 5933-} 5934- 5935-/* this might still called in what was the PHY rtl8185/rtl8187 common code 5936- * plans are to possibilty turn it again in one common code... 5937- */ 5938-inline void force_pci_posting(struct net_device *dev) 5939-{ 5940-} 5941- 5942- 5943-//irqreturn_t rtl8180_interrupt(int irq, void *netdev, struct pt_regs *regs); 5944-//void set_nic_rxring(struct net_device *dev); 5945-//void set_nic_txring(struct net_device *dev); 5946-static struct net_device_stats *rtl8180_stats(struct net_device *dev); 5947-void rtl8180_commit(struct net_device *dev); 5948-void rtl8180_restart(struct net_device *dev); 5949- 5950-/**************************************************************************** 5951- -----------------------------PROCFS STUFF------------------------- 5952-*****************************************************************************/ 5953- 5954-static struct proc_dir_entry *rtl8180_proc = NULL; 5955- 5956-static int proc_get_registers(char *page, char **start, 5957- off_t offset, int count, 5958- int *eof, void *data) 5959-{ 5960- struct net_device *dev = data; 5961-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 5962- 5963- int len = 0; 5964- int i,n; 5965- 5966- int max=0xff; 5967- 5968- /* This dump the current register page */ 5969- for(n=0;n<=max;) 5970- { 5971- //printk( "\nD: %2x> ", n); 5972- len += snprintf(page + len, count - len, 5973- "\nD: %2x > ",n); 5974- 5975- for(i=0;i<16 && n<=max;i++,n++) 5976- len += snprintf(page + len, count - len, 5977- "%2x ",read_nic_byte(dev,n)); 5978- 5979- // printk("%2x ",read_nic_byte(dev,n)); 5980- } 5981- len += snprintf(page + len, count - len,"\n"); 5982- 5983- 5984- 5985- *eof = 1; 5986- return len; 5987- 5988-} 5989- 5990-#if 0 5991-static int proc_get_stats_hw(char *page, char **start, 5992- off_t offset, int count, 5993- int *eof, void *data) 5994-{ 5995- struct net_device *dev = data; 5996- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 5997- 5998- int len = 0; 5999- 6000- len += snprintf(page + len, count - len, 6001- "NIC int: %lu\n" 6002- "Total int: %lu\n", 6003- priv->stats.ints, 6004- priv->stats.shints); 6005- 6006- *eof = 1; 6007- return len; 6008-} 6009-#endif 6010- 6011-static int proc_get_stats_tx(char *page, char **start, 6012- off_t offset, int count, 6013- int *eof, void *data) 6014-{ 6015- struct net_device *dev = data; 6016- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 6017- 6018- int len = 0; 6019- 6020- len += snprintf(page + len, count - len, 6021- "TX normal priority ok int: %lu\n" 6022- "TX normal priority error int: %lu\n" 6023-// "TX high priority ok int: %lu\n" 6024-// "TX high priority failed error int: %lu\n" 6025- "TX low priority ok int: %lu\n" 6026- "TX low priority failed error int: %lu\n" 6027- "TX queue resume: %lu\n" 6028- "TX queue stopped?: %d\n" 6029- "TX fifo overflow: %lu\n" 6030-// "TX beacon: %lu\n" 6031- "TX lp queue: %d\n" 6032- "TX np queue: %d\n" 6033- "TX HW queue: %d\n" 6034- "TX lp dropped: %lu\n" 6035- "TX np dropped: %lu\n" 6036- "TX total data packets %lu\n", 6037-// "TX beacon aborted: %lu\n", 6038- priv->stats.txnpokint, 6039- priv->stats.txnperr, 6040-// priv->stats.txhpokint, 6041-// priv->stats.txhperr, 6042- priv->stats.txlpokint, 6043- priv->stats.txlperr, 6044- priv->stats.txresumed, 6045- netif_queue_stopped(dev), 6046- priv->stats.txoverflow, 6047-// priv->stats.txbeacon, 6048- atomic_read(&(priv->tx_lp_pending)), 6049- atomic_read(&(priv->tx_np_pending)), 6050- read_nic_byte(dev, TXFIFOCOUNT), 6051- priv->stats.txlpdrop, 6052- priv->stats.txnpdrop, 6053- priv->stats.txdatapkt 6054-// priv->stats.txbeaconerr 6055- ); 6056- 6057- *eof = 1; 6058- return len; 6059-} 6060- 6061- 6062- 6063-static int proc_get_stats_rx(char *page, char **start, 6064- off_t offset, int count, 6065- int *eof, void *data) 6066-{ 6067- struct net_device *dev = data; 6068- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 6069- 6070- int len = 0; 6071- 6072- len += snprintf(page + len, count - len, 6073- "RX packets: %lu\n" 6074- "RX urb status error: %lu\n" 6075- "RX invalid urb error: %lu\n", 6076- priv->stats.rxok, 6077- priv->stats.rxstaterr, 6078- priv->stats.rxurberr); 6079- 6080- *eof = 1; 6081- return len; 6082-} 6083- 6084- 6085-static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev) 6086-{ 6087- struct r8180_priv *priv = ieee80211_priv(dev); 6088- 6089- return &priv->wstats; 6090-} 6091- 6092-void rtl8180_proc_module_init(void) 6093-{ 6094- DMESG("Initializing proc filesystem"); 6095- rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net); 6096-} 6097- 6098- 6099-void rtl8180_proc_module_remove(void) 6100-{ 6101- remove_proc_entry(RTL8187_MODULE_NAME, proc_net); 6102-} 6103- 6104- 6105-void rtl8180_proc_remove_one(struct net_device *dev) 6106-{ 6107- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 6108- if (priv->dir_dev) { 6109- // remove_proc_entry("stats-hw", priv->dir_dev); 6110- remove_proc_entry("stats-tx", priv->dir_dev); 6111- remove_proc_entry("stats-rx", priv->dir_dev); 6112- // remove_proc_entry("stats-ieee", priv->dir_dev); 6113- // remove_proc_entry("stats-ap", priv->dir_dev); 6114- remove_proc_entry("registers", priv->dir_dev); 6115- remove_proc_entry(dev->name, rtl8180_proc); 6116- priv->dir_dev = NULL; 6117- } 6118-} 6119- 6120- 6121-void rtl8180_proc_init_one(struct net_device *dev) 6122-{ 6123- struct proc_dir_entry *e; 6124- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 6125- priv->dir_dev = create_proc_entry(dev->name, 6126- S_IFDIR | S_IRUGO | S_IXUGO, 6127- rtl8180_proc); 6128- if (!priv->dir_dev) { 6129- DMESGE("Unable to initialize /proc/net/rtl8187/%s\n", 6130- dev->name); 6131- return; 6132- } 6133- #if 0 6134- e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO, 6135- priv->dir_dev, proc_get_stats_hw, dev); 6136- 6137- if (!e) { 6138- DMESGE("Unable to initialize " 6139- "/proc/net/rtl8187/%s/stats-hw\n", 6140- dev->name); 6141- } 6142- #endif 6143- e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO, 6144- priv->dir_dev, proc_get_stats_rx, dev); 6145- 6146- if (!e) { 6147- DMESGE("Unable to initialize " 6148- "/proc/net/rtl8187/%s/stats-rx\n", 6149- dev->name); 6150- } 6151- 6152- 6153- e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO, 6154- priv->dir_dev, proc_get_stats_tx, dev); 6155- 6156- if (!e) { 6157- DMESGE("Unable to initialize " 6158- "/proc/net/rtl8187/%s/stats-tx\n", 6159- dev->name); 6160- } 6161- #if 0 6162- e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO, 6163- priv->dir_dev, proc_get_stats_ieee, dev); 6164- 6165- if (!e) { 6166- DMESGE("Unable to initialize " 6167- "/proc/net/rtl8187/%s/stats-ieee\n", 6168- dev->name); 6169- } 6170- 6171- 6172- e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO, 6173- priv->dir_dev, proc_get_stats_ap, dev); 6174- 6175- if (!e) { 6176- DMESGE("Unable to initialize " 6177- "/proc/net/rtl8187/%s/stats-ap\n", 6178- dev->name); 6179- } 6180- #endif 6181- 6182- e = create_proc_read_entry("registers", S_IFREG | S_IRUGO, 6183- priv->dir_dev, proc_get_registers, dev); 6184- 6185- if (!e) { 6186- DMESGE("Unable to initialize " 6187- "/proc/net/rtl8187/%s/registers\n", 6188- dev->name); 6189- } 6190-} 6191-/**************************************************************************** 6192- -----------------------------MISC STUFF------------------------- 6193-*****************************************************************************/ 6194- 6195-/* this is only for debugging */ 6196-void print_buffer(u32 *buffer, int len) 6197-{ 6198- int i; 6199- u8 *buf =(u8*)buffer; 6200- 6201- printk("ASCII BUFFER DUMP (len: %x):\n",len); 6202- 6203- for(i=0;i<len;i++) 6204- printk("%c",buf[i]); 6205- 6206- printk("\nBINARY BUFFER DUMP (len: %x):\n",len); 6207- 6208- for(i=0;i<len;i++) 6209- printk("%x",buf[i]); 6210- 6211- printk("\n"); 6212-} 6213- 6214-short check_nic_enought_desc(struct net_device *dev, priority_t priority) 6215-{ 6216- struct r8180_priv *priv = ieee80211_priv(dev); 6217- 6218- int used = atomic_read((priority == NORM_PRIORITY) ? 6219- &priv->tx_np_pending : &priv->tx_lp_pending); 6220- 6221- return (used < MAX_TX_URB); 6222-} 6223- 6224-void tx_timeout(struct net_device *dev) 6225-{ 6226- struct r8180_priv *priv = ieee80211_priv(dev); 6227- //rtl8180_commit(dev); 6228- schedule_work(&priv->reset_wq); 6229- //DMESG("TXTIMEOUT"); 6230-} 6231- 6232- 6233-/* this is only for debug */ 6234-void dump_eprom(struct net_device *dev) 6235-{ 6236- int i; 6237- for(i=0; i<63; i++) 6238- DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i)); 6239-} 6240- 6241-/* this is only for debug */ 6242-void rtl8180_dump_reg(struct net_device *dev) 6243-{ 6244- int i; 6245- int n; 6246- int max=0xff; 6247- 6248- DMESG("Dumping NIC register map"); 6249- 6250- for(n=0;n<=max;) 6251- { 6252- printk( "\nD: %2x> ", n); 6253- for(i=0;i<16 && n<=max;i++,n++) 6254- printk("%2x ",read_nic_byte(dev,n)); 6255- } 6256- printk("\n"); 6257-} 6258- 6259-/**************************************************************************** 6260- ------------------------------HW STUFF--------------------------- 6261-*****************************************************************************/ 6262- 6263- 6264-void rtl8180_irq_enable(struct net_device *dev) 6265-{ 6266- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 6267- //priv->irq_enabled = 1; 6268-/* 6269- write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\ 6270- INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\ 6271- INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\ 6272- INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT); 6273-*/ 6274- write_nic_word(dev,INTA_MASK, priv->irq_mask); 6275-} 6276- 6277- 6278-void rtl8180_irq_disable(struct net_device *dev) 6279-{ 6280-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 6281- 6282- write_nic_word(dev,INTA_MASK,0); 6283- force_pci_posting(dev); 6284-// priv->irq_enabled = 0; 6285-} 6286- 6287- 6288-void rtl8180_set_mode(struct net_device *dev,int mode) 6289-{ 6290- u8 ecmd; 6291- ecmd=read_nic_byte(dev, EPROM_CMD); 6292- ecmd=ecmd &~ EPROM_CMD_OPERATING_MODE_MASK; 6293- ecmd=ecmd | (mode<<EPROM_CMD_OPERATING_MODE_SHIFT); 6294- ecmd=ecmd &~ (1<<EPROM_CS_SHIFT); 6295- ecmd=ecmd &~ (1<<EPROM_CK_SHIFT); 6296- write_nic_byte(dev, EPROM_CMD, ecmd); 6297-} 6298- 6299- 6300-void rtl8180_update_msr(struct net_device *dev) 6301-{ 6302- struct r8180_priv *priv = ieee80211_priv(dev); 6303- u8 msr; 6304- 6305- msr = read_nic_byte(dev, MSR); 6306- msr &= ~ MSR_LINK_MASK; 6307- 6308- /* do not change in link_state != WLAN_LINK_ASSOCIATED. 6309- * msr must be updated if the state is ASSOCIATING. 6310- * this is intentional and make sense for ad-hoc and 6311- * master (see the create BSS/IBSS func) 6312- */ 6313- if (priv->ieee80211->state == IEEE80211_LINKED){ 6314- 6315- if (priv->ieee80211->iw_mode == IW_MODE_INFRA) 6316- msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT); 6317- else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC) 6318- msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT); 6319- else if (priv->ieee80211->iw_mode == IW_MODE_MASTER) 6320- msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT); 6321- 6322- }else 6323- msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT); 6324- 6325- write_nic_byte(dev, MSR, msr); 6326-} 6327- 6328-void rtl8180_set_chan(struct net_device *dev,short ch) 6329-{ 6330- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 6331- u32 tx; 6332- priv->chan=ch; 6333- #if 0 6334- if(priv->ieee80211->iw_mode == IW_MODE_ADHOC || 6335- priv->ieee80211->iw_mode == IW_MODE_MASTER){ 6336- 6337- priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED; 6338- priv->ieee80211->master_chan = ch; 6339- rtl8180_update_beacon_ch(dev); 6340- } 6341- #endif 6342- 6343- /* this hack should avoid frame TX during channel setting*/ 6344- tx = read_nic_dword(dev,TX_CONF); 6345- tx &= ~TX_LOOPBACK_MASK; 6346- 6347-#ifndef LOOP_TEST 6348- write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT)); 6349- 6350- priv->rf_set_chan(dev,priv->chan); 6351- mdelay(10); 6352- write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT)); 6353-#endif 6354-} 6355-void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs); 6356- 6357- 6358-void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb) 6359-{ 6360- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 6361- int err; 6362- 6363-// u8 *rx; 6364- 6365- //DMESG("starting RX"); 6366- /*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC); 6367- if(!rx){ 6368- DMESGE("unable to allocate RX buffer"); 6369- return; 6370- }*/ 6371- 6372- usb_fill_bulk_urb(rx_urb,priv->udev, 6373- usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer, 6374- RX_URB_SIZE,rtl8187_rx_isr,dev); 6375- err = usb_submit_urb(rx_urb, GFP_ATOMIC); 6376- if(err && err != -EPERM){ 6377- DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status); 6378- 6379- } 6380- 6381-} 6382- 6383- 6384-void rtl8187_rx_initiate(struct net_device *dev) 6385-{ 6386- int i; 6387- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 6388- 6389- if(!priv->rx_urb) 6390- DMESGE("Cannot intiate RX urb mechanism"); 6391- for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1 6392- rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]); 6393- 6394-} 6395- 6396-void rtl8187_set_rxconf(struct net_device *dev) 6397-{ 6398- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 6399- u32 rxconf; 6400- 6401- rxconf=read_nic_dword(dev,RX_CONF); 6402- rxconf = rxconf &~ MAC_FILTER_MASK; 6403- rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT); 6404- rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT); 6405- rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT); 6406- rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT); 6407- rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT); 6408- 6409- if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode"); 6410- 6411- if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \ 6412- dev->flags & IFF_PROMISC){ 6413- rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT); 6414- }else{ 6415- rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT); 6416- rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT); 6417- } 6418- 6419- /*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){ 6420- rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT); 6421- rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT); 6422- }*/ 6423- 6424- if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){ 6425- rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT); 6426- rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT); 6427- } 6428- 6429- if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR) 6430- rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT); 6431- 6432- 6433- rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK; 6434- rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT); 6435- 6436- 6437- rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT); 6438- 6439- rxconf = rxconf &~ MAX_RX_DMA_MASK; 6440- rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT); 6441- 6442- rxconf = rxconf | RCR_ONLYERLPKT; 6443- 6444-// rxconf = rxconf &~ RCR_CS_MASK; 6445-// rxconf = rxconf | (1<<RCR_CS_SHIFT); 6446- 6447- write_nic_dword(dev, RX_CONF, rxconf); 6448- 6449- // V rtl suggested V // 6450-// write_nic_dword(dev, RX_CONF, 0x901ce70e); 6451- 6452- //fix_rx_fifo(dev); 6453-// //set_nic_rxring(dev); 6454- #ifdef DEBUG_RX 6455- DMESG("rxconf: %x %x",rxconf ,read_nic_dword(dev,RX_CONF)); 6456- #endif 6457-} 6458- 6459-void rtl8180_rx_enable(struct net_device *dev) 6460-{ 6461- u8 cmd; 6462- 6463- 6464- rtl8187_rx_initiate(dev); 6465- 6466- rtl8187_set_rxconf(dev); 6467- 6468- cmd=read_nic_byte(dev,CMD); 6469- write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT)); 6470-#if 0 6471- /* In rtl8139 driver seems that DMA threshold has to be written 6472- * after enabling RX, so we rewrite RX_CONFIG register 6473- */ 6474- //mdelay(100); 6475- write_nic_dword(dev, RX_CONF, rxconf); 6476- 6477-#endif 6478- 6479-} 6480- 6481- 6482-void rtl8180_tx_enable(struct net_device *dev) 6483-{ 6484- u8 cmd; 6485- u8 byte; 6486- u32 txconf; 6487- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 6488- 6489- byte = read_nic_byte(dev,CW_CONF); 6490- byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT); 6491- byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT); 6492- write_nic_byte(dev, CW_CONF, byte); 6493- 6494- byte = read_nic_byte(dev, TX_AGC_CTL); 6495- byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT); 6496- byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT); 6497- byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT); 6498- write_nic_byte(dev, TX_AGC_CTL, byte); 6499- 6500- txconf= read_nic_dword(dev,TX_CONF); 6501- 6502- #if 0 6503- if(priv->card_8185){ 6504- 6505- txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT); 6506- 6507- }else{ 6508- 6509- if(priv->ieee80211->hw_seq) 6510- txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT); 6511- else 6512- txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT); 6513- } 6514- #endif 6515- 6516- txconf = txconf &~ TX_LOOPBACK_MASK; 6517- 6518-#ifndef LOOP_TEST 6519- txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT); 6520-#else 6521- txconf = txconf | (TX_LOOPBACK_BASEBAND<<TX_LOOPBACK_SHIFT); 6522-#endif 6523- txconf = txconf &~ TCR_DPRETRY_MASK; 6524- txconf = txconf &~ TCR_RTSRETRY_MASK; 6525- 6526- txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long 6527- txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short 6528- 6529- txconf = txconf &~ (1<<TX_NOCRC_SHIFT); 6530- 6531- txconf = txconf &~ TCR_MXDMA_MASK; 6532- txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT); 6533- 6534- txconf = txconf | TCR_CWMIN; 6535- txconf = txconf | TCR_DISCW; 6536- txconf = txconf &~ TCR_SWPLCPLEN; 6537- 6538- txconf=txconf | (1<<TX_NOICV_SHIFT); 6539- 6540- write_nic_dword(dev,TX_CONF,txconf); 6541- 6542- // V RTL suggested V // 6543-// write_nic_dword(dev,TX_CONF,0x00e00707); 6544- 6545- 6546-#ifdef DEBUG_TX 6547- DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF)); 6548-#endif 6549- 6550- cmd=read_nic_byte(dev,CMD); 6551- write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT)); 6552- 6553-// mdelay(100); 6554- //write_nic_dword(dev,TX_CONF,txconf); 6555-// #endif 6556-/* 6557- rtl8180_set_mode(dev,EPROM_CMD_CONFIG); 6558- write_nic_byte(dev, TX_DMA_POLLING, priv->dma_poll_mask); 6559- rtl8180_set_mode(dev,EPROM_CMD_NORMAL); 6560- */ 6561-} 6562- 6563-#if 0 6564-void rtl8180_beacon_tx_enable(struct net_device *dev) 6565-{ 6566- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 6567- priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT); 6568- rtl8180_set_mode(dev,EPROM_CMD_CONFIG); 6569- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask); 6570- rtl8180_set_mode(dev,EPROM_CMD_NORMAL); 6571-} 6572- 6573- 6574-void rtl8180_ 6575-_disable(struct net_device *dev) 6576-{ 6577- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 6578- priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT); 6579- rtl8180_set_mode(dev,EPROM_CMD_CONFIG); 6580- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask); 6581- rtl8180_set_mode(dev,EPROM_CMD_NORMAL); 6582-} 6583- 6584-#endif 6585- 6586- 6587-void rtl8180_rtx_disable(struct net_device *dev) 6588-{ 6589- u8 cmd; 6590- int i; 6591- struct r8180_priv *priv = ieee80211_priv(dev); 6592- 6593- cmd=read_nic_byte(dev,CMD); 6594- write_nic_byte(dev, CMD, cmd &~ \ 6595- ((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT))); 6596- force_pci_posting(dev); 6597- mdelay(10); 6598- if(priv->rx_urb){ 6599- for(i=0;i<MAX_RX_URB;i++) 6600- usb_kill_urb(priv->rx_urb[i]); 6601- } 6602- /*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT)) 6603- udelay(10); 6604- */ 6605- 6606-// if(!priv->rx_skb_complete) 6607-// dev_kfree_skb_any(priv->rx_skb); 6608-} 6609- 6610- 6611-int alloc_tx_beacon_desc_ring(struct net_device *dev, int count) 6612-{ 6613- #if 0 6614- int i; 6615- u32 *tmp; 6616- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 6617- 6618- priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev, 6619- sizeof(u32)*8*count, 6620- &priv->txbeaconringdma); 6621- if (!priv->txbeaconring) return -1; 6622- for (tmp=priv->txbeaconring,i=0;i<count;i++){ 6623- *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv 6624- /* 6625- *(tmp+2) = (u32)dma_tmp; 6626- *(tmp+3) = bufsize; 6627- */ 6628- if(i+1<count) 6629- *(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4); 6630- else 6631- *(tmp+4) = (u32)priv->txbeaconringdma; 6632- 6633- tmp=tmp+8; 6634- } 6635- #endif 6636- return 0; 6637-} 6638- 6639- 6640-void rtl8180_reset(struct net_device *dev) 6641-{ 6642- 6643- u8 cr; 6644- 6645- /* make sure the analog power is on before 6646- * reset, otherwise reset may fail 6647- */ 6648- rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON); 6649- rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON); 6650- 6651- rtl8180_irq_disable(dev); 6652- 6653- mdelay(200); 6654- write_nic_byte_E(dev,0x18,0x10); 6655- write_nic_byte_E(dev,0x18,0x11); 6656- write_nic_byte_E(dev,0x18,0x00); 6657- mdelay(200); 6658- 6659- cr=read_nic_byte(dev,CMD); 6660- cr = cr & 2; 6661- cr = cr | (1<<CMD_RST_SHIFT); 6662- write_nic_byte(dev,CMD,cr); 6663- 6664- force_pci_posting(dev); 6665- 6666- mdelay(200); 6667- 6668- if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT)) 6669- DMESGW("Card reset timeout!"); 6670- else 6671- DMESG("Card successfully reset"); 6672- 6673- rtl8180_set_mode(dev,EPROM_CMD_LOAD); 6674- force_pci_posting(dev); 6675- mdelay(200); 6676- 6677- /* after the eeprom load cycle, make sure we have 6678- * correct anaparams 6679- */ 6680- rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON); 6681- rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON); 6682- 6683-} 6684- 6685-inline u16 ieeerate2rtlrate(int rate) 6686-{ 6687- switch(rate){ 6688- case 10: 6689- return 0; 6690- case 20: 6691- return 1; 6692- case 55: 6693- return 2; 6694- case 110: 6695- return 3; 6696- case 60: 6697- return 4; 6698- case 90: 6699- return 5; 6700- case 120: 6701- return 6; 6702- case 180: 6703- return 7; 6704- case 240: 6705- return 8; 6706- case 360: 6707- return 9; 6708- case 480: 6709- return 10; 6710- case 540: 6711- return 11; 6712- default: 6713- return 3; 6714- 6715- } 6716-} 6717-static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540}; 6718-inline u16 rtl8180_rate2rate(short rate) 6719-{ 6720- if (rate >11) return 0; 6721- return rtl_rate[rate]; 6722-} 6723- 6724- 6725-void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs) 6726-{ 6727- struct net_device *dev = (struct net_device*)rx_urb->context; 6728- struct r8180_priv *priv = ieee80211_priv(dev); 6729- 6730- priv->rxurb_task = rx_urb; 6731-// DMESGW("David: Rx tasklet start!"); 6732- tasklet_schedule(&priv->irq_rx_tasklet); 6733-// DMESGW("=David: Rx tasklet finish!"); 6734-} 6735- 6736-#if 0 6737-void rtl8180_tx_queues_stop(struct net_device *dev) 6738-{ 6739- //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 6740- u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT); 6741- dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT); 6742- dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT); 6743- dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT); 6744- 6745- rtl8180_set_mode(dev,EPROM_CMD_CONFIG); 6746- write_nic_byte(dev,TX_DMA_POLLING,dma_poll_mask); 6747- rtl8180_set_mode(dev,EPROM_CMD_NORMAL); 6748-} 6749-#endif 6750- 6751-void rtl8180_data_hard_stop(struct net_device *dev) 6752-{ 6753- //FIXME !! 6754- #if 0 6755- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 6756- priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT); 6757- rtl8180_set_mode(dev,EPROM_CMD_CONFIG); 6758- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask); 6759- rtl8180_set_mode(dev,EPROM_CMD_NORMAL); 6760- #endif 6761-} 6762- 6763- 6764-void rtl8180_data_hard_resume(struct net_device *dev) 6765-{ 6766- // FIXME !! 6767- #if 0 6768- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 6769- priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT); 6770- rtl8180_set_mode(dev,EPROM_CMD_CONFIG); 6771- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask); 6772- rtl8180_set_mode(dev,EPROM_CMD_NORMAL); 6773- #endif 6774-} 6775- 6776- 6777-/* this function TX data frames when the ieee80211 stack requires this. 6778- * It checks also if we need to stop the ieee tx queue, eventually do it 6779- */ 6780-void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate) 6781-{ 6782- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 6783- 6784- short morefrag = 0; 6785- unsigned long flags; 6786- struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data; 6787- 6788- if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS) 6789- morefrag = 1; 6790-// DMESG("%x %x", h->frame_ctl, h->seq_ctl); 6791- /* 6792- * This function doesn't require lock because we make 6793- * sure it's called with the tx_lock already acquired. 6794- * this come from the kernel's hard_xmit callback (trought 6795- * the ieee stack, or from the try_wake_queue (again trought 6796- * the ieee stack. 6797- */ 6798- spin_lock_irqsave(&priv->tx_lock,flags); 6799- 6800- //DMESG("TX"); 6801- if (!check_nic_enought_desc(dev, LOW_PRIORITY)){ 6802- DMESG("Error: no TX slot "); 6803- ieee80211_stop_queue(priv->ieee80211); 6804- } 6805- 6806- rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag, 6807- ieeerate2rtlrate(rate)); 6808- 6809- priv->stats.txdatapkt++; 6810- 6811- if (!check_nic_enought_desc(dev, LOW_PRIORITY)) 6812- ieee80211_stop_queue(priv->ieee80211); 6813- 6814- spin_unlock_irqrestore(&priv->tx_lock,flags); 6815- 6816-} 6817-#if 0 6818-/* This is a rough attempt to TX a frame 6819- * This is called by the ieee 80211 stack to TX management frames. 6820- * If the ring is full packet are dropped (for data frame the queue 6821- * is stopped before this can happen). 6822- */ 6823-int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev) 6824-{ 6825- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 6826- int ret; 6827- unsigned long flags; 6828- 6829- spin_lock_irqsave(&priv->tx_lock,flags); 6830- 6831- ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE); 6832-/* 6833- int i; 6834- for(i=0;i<skb->len;i++) 6835- printk("%x ", skb->data[i]); 6836- printk("--------------------\n"); 6837-*/ 6838- priv->ieee80211->stats.tx_bytes+=skb->len; 6839- priv->ieee80211->stats.tx_packets++; 6840- 6841- spin_unlock_irqrestore(&priv->tx_lock,flags); 6842- 6843- dev_kfree_skb_any(skb); 6844- return ret; 6845-} 6846-#endif 6847- 6848-#if 0 6849-// longpre 144+48 shortpre 72+24 6850-u16 rtl8180_len2duration(u32 len, short rate,short* ext) 6851-{ 6852- u16 duration; 6853- u16 drift; 6854- *ext=0; 6855- 6856- switch(rate){ 6857- case 0://1mbps 6858- *ext=0; 6859- duration = ((len+4)<<4) /0x2; 6860- drift = ((len+4)<<4) % 0x2; 6861- if(drift ==0 ) break; 6862- duration++; 6863- break; 6864- 6865- case 1://2mbps 6866- *ext=0; 6867- duration = ((len+4)<<4) /0x4; 6868- drift = ((len+4)<<4) % 0x4; 6869- if(drift ==0 ) break; 6870- duration++; 6871- break; 6872- 6873- case 2: //5.5mbps 6874- *ext=0; 6875- duration = ((len+4)<<4) /0xb; 6876- drift = ((len+4)<<4) % 0xb; 6877- if(drift ==0 ) 6878- break; 6879- duration++; 6880- break; 6881- 6882- default: 6883- case 3://11mbps 6884- *ext=0; 6885- duration = ((len+4)<<4) /0x16; 6886- drift = ((len+4)<<4) % 0x16; 6887- if(drift ==0 ) 6888- break; 6889- duration++; 6890- if(drift > 6) 6891- break; 6892- *ext=1; 6893- break; 6894- } 6895- 6896- return duration; 6897-} 6898-#endif 6899- 6900-void rtl8180_try_wake_queue(struct net_device *dev, int pri); 6901- 6902-void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs) 6903-{ 6904- struct net_device *dev = (struct net_device*)tx_urb->context; 6905- struct r8180_priv *priv = ieee80211_priv(dev); 6906- if(tx_urb->status == 0) 6907- priv->stats.txlpokint++; 6908- else 6909- priv->stats.txlperr++; 6910- kfree(tx_urb->transfer_buffer); 6911- usb_free_urb(tx_urb); 6912- atomic_dec(&priv->tx_lp_pending); 6913- rtl8180_try_wake_queue(dev,LOW_PRIORITY); 6914-} 6915- 6916- 6917-void rtl8187_beacon_stop(struct net_device *dev) 6918-{ 6919- u8 msr, msrm, msr2; 6920- msr = read_nic_byte(dev, MSR); 6921- msrm = msr & MSR_LINK_MASK; 6922- msr2 = msr & ~MSR_LINK_MASK; 6923- if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) || 6924- (msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){ 6925- write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE); 6926- write_nic_byte(dev, MSR, msr); 6927- } 6928- 6929- 6930-} 6931- 6932- 6933-void rtl8187_net_update(struct net_device *dev) 6934-{ 6935- 6936- struct r8180_priv *priv = ieee80211_priv(dev); 6937- struct ieee80211_network *net; 6938- net = & priv->ieee80211->current_network; 6939- 6940- 6941- write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]); 6942- write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]); 6943- //for(i=0;i<ETH_ALEN;i++) 6944- // write_nic_byte(dev,BSSID+i,net->bssid[i]); 6945- 6946- rtl8180_update_msr(dev); 6947- 6948-// rtl8180_set_mode(dev,EPROM_CMD_CONFIG); 6949- write_nic_word(dev, AtimWnd, 2); 6950- write_nic_word(dev, AtimtrItv, 100); 6951- write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval); 6952- write_nic_word(dev, BcnIntTime, 100); 6953- 6954- 6955-} 6956- 6957-void rtl8187_beacon_tx(struct net_device *dev) 6958-{ 6959- 6960- struct r8180_priv *priv = ieee80211_priv(dev); 6961- struct sk_buff *skb; 6962- int i = 0; 6963- 6964- rtl8187_net_update(dev); 6965- 6966- skb = ieee80211_get_beacon(priv->ieee80211); 6967- 6968- 6969- if(!skb){ 6970- DMESG("not enought memory for allocating beacon"); 6971- return; 6972- } 6973- 6974-#if 0 6975- while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){ 6976- msleep_interruptible_rtl(HZ/2); 6977- if(i++ > 20){ 6978- DMESG("get stuck to wait EP3 become ready"); 6979- return ; 6980- } 6981- } 6982-#endif 6983- write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7)); 6984- 6985- i=0; 6986- //while(!read_nic_byte(dev,BQREQ & (1<<7))) 6987- while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 ) 6988- { 6989- msleep_interruptible_rtl(HZ/2); 6990- if(i++ > 10){ 6991- DMESG("get stuck to wait HW beacon to be ready"); 6992- return ; 6993- } 6994- } 6995- 6996- rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 6997- 0, priv->ieee80211->basic_rate); 6998- 6999-} 7000- 7001-void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs) 7002-{ 7003- struct net_device *dev = (struct net_device*)tx_urb->context; 7004- struct r8180_priv *priv = ieee80211_priv(dev); 7005- if(tx_urb->status == 0) 7006- priv->stats.txnpokint++; 7007- else 7008- priv->stats.txnperr++; 7009- kfree(tx_urb->transfer_buffer); 7010- usb_free_urb(tx_urb); 7011- atomic_dec(&priv->tx_np_pending); 7012- //rtl8180_try_wake_queue(dev,NORM_PRIORITY); 7013-} 7014- 7015- 7016-/* This function do the real dirty work: it sends a TX command 7017- * descriptor plus data URB 7018- */ 7019- 7020-short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority, 7021- short morefrag, short rate) 7022-{ 7023- u32 *tx; 7024-// u16 duration; 7025-// short ext; 7026- int pend ; 7027- int status; 7028- struct urb *tx_urb; 7029- int urb_len; 7030- struct r8180_priv *priv = ieee80211_priv(dev); 7031-// int rate = ieeerate2rtlrate(priv->ieee80211->rate); 7032- 7033- pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending); 7034- /* we are locked here so the two atomic_read and inc are executed without interleaves */ 7035- if( pend > MAX_TX_URB){ 7036- if(priority == NORM_PRIORITY) 7037- priv->stats.txnpdrop++; 7038- else 7039- priv->stats.txlpdrop++; 7040- return -1; 7041- } 7042- 7043- 7044- //tx = kmalloc((len + 4*3), GFP_ATOMIC); 7045- urb_len = len + 4*3; 7046- if((0 == urb_len%64)||(0 == urb_len%512)) { 7047- urb_len += 1; 7048- } 7049- tx = kmalloc(urb_len, GFP_ATOMIC); 7050- if(!tx) return -ENOMEM; 7051-printk(KERN_WARNING "urb_len = %d\n", urb_len); 7052- tx_urb = usb_alloc_urb(0,GFP_ATOMIC); 7053- 7054- if(!tx_urb){ 7055- 7056- kfree(tx); 7057- return -ENOMEM; 7058- } 7059- 7060- memcpy(tx+3,txbuf,len); 7061- tx[0] = 0; 7062- tx[0] |= len & 0xfff; 7063- tx[0] |= (1<<15); 7064- 7065-// if(priv->shortpre) 7066-// tx[0] |= (1<<16); 7067- 7068- //if(len > priv->rts_threshold){ 7069-// tx[0] |= (1<<23); //ENABLE RTS 7070-// tx[0] |= (1<<18); //ENABLE CTS 7071- //} 7072- if(morefrag) tx[0] |= (1<<17); 7073- tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */ 7074- tx[0] |= (rate << 24); 7075- tx[1] = 0; 7076- 7077-// duration = rtl8180_len2duration(len, 7078-// rate,&ext); 7079-// tx[1] |= (duration & 0x7fff) <<16; 7080-// if(ext) tx[1] |= (1<<31); 7081- 7082- 7083-// tx[2] = 0x303020; 7084- tx[2] = 3; // CW min 7085- tx[2] |= (7<<4); //CW max 7086- tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim 7087- 7088-// printk("%x\n%x\n",tx[0],tx[1]); 7089- 7090- #ifdef DUMP_TX 7091- int i; 7092- printk("<Tx pkt>--rate %x---",rate); 7093- for (i = 0; i < (len + 3); i++) 7094- printk("%2x", ((u8*)tx)[i]); 7095- printk("---------------\n"); 7096- #endif 7097- 7098- 7099- /* FIXME check what EP is for low/norm PRI */ 7100- usb_fill_bulk_urb(tx_urb,priv->udev, 7101- usb_sndbulkpipe(priv->udev,(priority == LOW_PRIORITY) ? 2:3), tx, 7102- urb_len, (priority == LOW_PRIORITY)?rtl8187_lptx_isr:rtl8187_nptx_isr, dev); 7103- status = usb_submit_urb(tx_urb, GFP_ATOMIC); 7104- if (!status){ 7105- atomic_inc((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending); 7106- return 0; 7107- }else{ 7108- DMESGE("Error TX URB %d, error %d", 7109- atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending), 7110- status); 7111- return -1; 7112- } 7113-} 7114- 7115- 7116- 7117-void rtl8180_irq_rx_tasklet(struct r8180_priv * priv); 7118- 7119- 7120-short rtl8187_usb_initendpoints(struct net_device *dev) 7121-{ 7122- struct r8180_priv *priv = ieee80211_priv(dev); 7123- int i; 7124- 7125- priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL); 7126- 7127- for(i=0;i<MAX_RX_URB;i++){ 7128- priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL); 7129- if(!priv->rx_urb[i]) 7130- goto destroy; 7131- 7132- priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL); 7133- if(!priv->rx_urb[i]->transfer_buffer) 7134- goto destroy1; 7135- 7136- priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE; 7137- } 7138- 7139- return 0; 7140- 7141-destroy1: 7142- usb_free_urb(priv->rx_urb[i]); 7143- 7144-destroy: 7145- while (--i >= 0){ 7146- kfree(priv->rx_urb[i]->transfer_buffer); 7147- usb_free_urb(priv->rx_urb[i]); 7148- } 7149- 7150- kfree(priv->rx_urb); 7151- 7152- priv->rx_urb = NULL; 7153- DMESGE("Endpoint Alloc Failure"); 7154- return -ENOMEM; 7155- 7156-} 7157- 7158-void rtl8187_usb_deleteendpoints(struct net_device *dev) 7159-{ 7160- struct r8180_priv *priv = ieee80211_priv(dev); 7161- int i; 7162- 7163- if(priv->rx_urb){ 7164- for(i=0;i<MAX_RX_URB;i++){ 7165- usb_kill_urb(priv->rx_urb[i]); 7166- kfree(priv->rx_urb[i]->transfer_buffer); 7167- usb_free_urb(priv->rx_urb[i]); 7168- } 7169- kfree(priv->rx_urb); 7170- priv->rx_urb = NULL; 7171- 7172- } 7173- 7174-} 7175- 7176- 7177-void rtl8187_set_rate(struct net_device *dev) 7178-{ 7179- int i; 7180- u16 word; 7181- int basic_rate,min_rr_rate,max_rr_rate; 7182- 7183-// struct r8180_priv *priv = ieee80211_priv(dev); 7184- 7185- //if (ieee80211_is_54g(priv->ieee80211->current_network) && 7186-// priv->ieee80211->state == IEEE80211_LINKED){ 7187- basic_rate = ieeerate2rtlrate(240); 7188- min_rr_rate = ieeerate2rtlrate(60); 7189- max_rr_rate = ieeerate2rtlrate(240); 7190- 7191-// 7192-// }else{ 7193-// basic_rate = ieeerate2rtlrate(20); 7194-// min_rr_rate = ieeerate2rtlrate(10); 7195-// max_rr_rate = ieeerate2rtlrate(110); 7196-// } 7197- 7198- write_nic_byte(dev, RESP_RATE, 7199- max_rr_rate<<MAX_RESP_RATE_SHIFT| min_rr_rate<<MIN_RESP_RATE_SHIFT); 7200- 7201- word = read_nic_word(dev, BRSR); 7202- word &= ~BRSR_MBR_8185; 7203- 7204- 7205- for(i=0;i<=basic_rate;i++) 7206- word |= (1<<i); 7207- 7208- write_nic_word(dev, BRSR, word); 7209- //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR)); 7210-} 7211- 7212- 7213-void rtl8187_link_change(struct net_device *dev) 7214-{ 7215-// int i; 7216- 7217- struct r8180_priv *priv = ieee80211_priv(dev); 7218- //write_nic_word(dev, BintrItv, net->beacon_interval); 7219- rtl8187_net_update(dev); 7220- /*update timing params*/ 7221- rtl8180_set_chan(dev, priv->chan); 7222- 7223- rtl8187_set_rxconf(dev); 7224-} 7225- 7226-void rtl8180_irq_rx_tasklet(struct r8180_priv *priv); 7227- 7228-short rtl8180_init(struct net_device *dev) 7229-{ 7230- 7231- struct r8180_priv *priv = ieee80211_priv(dev); 7232- int i, j; 7233- u16 word; 7234- int ch; 7235- //u16 version; 7236- //u8 hw_version; 7237- //u8 config3; 7238- 7239- //FIXME: these constants are placed in a bad pleace. 7240- 7241-// priv->txbuffsize = 1024; 7242-// priv->txringcount = 32; 7243-// priv->rxbuffersize = 1024; 7244-// priv->rxringcount = 32; 7245-// priv->txbeaconcount = 3; 7246-// priv->rx_skb_complete = 1; 7247- //priv->txnp_pending.ispending=0; 7248- /* ^^ the SKB does not containt a partial RXed 7249- * packet (is empty) 7250- */ 7251- 7252- if(!channels){ 7253- DMESG("No channels, aborting"); 7254- return -1; 7255- } 7256- ch=channels; 7257- // set channels 1..14 allowed in given locale 7258- for (i=1; i<=14; i++) { 7259- (priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01); 7260- ch >>= 1; 7261- } 7262- //memcpy(priv->stats,0,sizeof(struct Stats)); 7263- 7264- //priv->irq_enabled=0; 7265- 7266-// priv->stats.rxdmafail=0; 7267- priv->stats.txrdu=0; 7268-// priv->stats.rxrdu=0; 7269-// priv->stats.rxnolast=0; 7270-// priv->stats.rxnodata=0; 7271- //priv->stats.rxreset=0; 7272- //priv->stats.rxwrkaround=0; 7273-// priv->stats.rxnopointer=0; 7274- priv->stats.txnperr=0; 7275- priv->stats.txresumed=0; 7276-// priv->stats.rxerr=0; 7277-// priv->stats.rxoverflow=0; 7278-// priv->stats.rxint=0; 7279- priv->stats.txnpokint=0; 7280- /*priv->stats.txhpokint=0; 7281- priv->stats.txhperr=0;*/ 7282- priv->stats.rxurberr=0; 7283- priv->stats.rxstaterr=0; 7284- priv->stats.txoverflow=0; 7285- priv->stats.rxok=0; 7286-// priv->stats.txbeaconerr=0; 7287- priv->stats.txlperr=0; 7288- priv->stats.txlpokint=0; 7289- 7290- priv->ieee80211->iw_mode = IW_MODE_INFRA; 7291- 7292- priv->retry_rts = DEFAULT_RETRY_RTS; 7293- priv->retry_data = DEFAULT_RETRY_DATA; 7294- priv->ieee80211->rate = 110; //11 mbps 7295- priv->ieee80211->short_slot = 1; 7296- priv->ieee80211->mode = IEEE_G; 7297- priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0; 7298- spin_lock_init(&priv->tx_lock); 7299- INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev); 7300- sema_init(&priv->wx_sem,1); 7301- tasklet_init(&priv->irq_rx_tasklet, 7302- (void(*)(unsigned long))rtl8180_irq_rx_tasklet, 7303- (unsigned long)priv); 7304- 7305- //priv->ieee80211->func = 7306- // kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL); 7307- //memset(priv->ieee80211->func, 0, 7308- // sizeof(struct ieee80211_helper_functions)); 7309- priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL; 7310- priv->ieee80211->iw_mode = IW_MODE_INFRA; 7311- priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN | 7312- IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ | 7313- IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE | 7314- /*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE; 7315- 7316- priv->ieee80211->active_scan = 1; 7317- priv->ieee80211->rate = 110; //11 mbps 7318- priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION; 7319- priv->ieee80211->host_encrypt = 1; 7320- priv->ieee80211->host_decrypt = 1; 7321- priv->ieee80211->start_send_beacons = rtl8187_beacon_tx; 7322- priv->ieee80211->stop_send_beacons = rtl8187_beacon_stop; 7323- //priv->ieee80211->softmac_hard_start_xmit = rtl8180_hard_start_xmit; 7324- priv->ieee80211->softmac_hard_start_xmit = NULL; 7325- priv->ieee80211->set_chan = rtl8180_set_chan; 7326- priv->ieee80211->link_change = rtl8187_link_change; 7327- priv->ieee80211->softmac_data_hard_start_xmit = rtl8180_hard_data_xmit; 7328- priv->ieee80211->data_hard_stop = rtl8180_data_hard_stop; 7329- priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume; 7330- //priv->ieee80211->start_send_beacons = NULL; 7331- //priv->ieee80211->stop_send_beacons = NULL; 7332- 7333- priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD; 7334- 7335- priv->card_8185 = 2; 7336- priv->phy_ver = 2; 7337- priv->card_type = USB; 7338- 7339- #if 0 7340- hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT; 7341- 7342- switch (hw_version){ 7343- case HW_VERID_R8185_ABC: 7344- DMESG("MAC controller is a RTL8185 b/g"); 7345- priv->card_8185 = 1; 7346- /* you should not find a card with 8225 PHY ver < C*/ 7347- priv->phy_ver = 2; 7348- break; 7349- 7350- case HW_VERID_R8185_D: 7351- DMESG("MAC controller is a RTL8185 b/g (V. D)"); 7352- priv->card_8185 = 2; 7353- /* you should not find a card with 8225 PHY ver < C*/ 7354- priv->phy_ver = 2; 7355- break; 7356- 7357- case HW_VERID_R8180_ABCD: 7358- DMESG("MAC controller is a RTL8180"); 7359- priv->card_8185 = 0; 7360- break; 7361- 7362- case HW_VERID_R8180_F: 7363- DMESG("MAC controller is a RTL8180 (v. F)"); 7364- priv->card_8185 = 0; 7365- break; 7366- 7367- default: 7368- DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version); 7369- priv->card_8185 = 0; 7370- break; 7371- } 7372- 7373- 7374- /* you should not found any 8185 Ver B Card */ 7375- priv->card_8185_Bversion = 0; 7376- 7377- config3 = read_nic_byte(dev, CONFIG3); 7378- if(config3 & 0x8){ 7379- priv->card_type = CARDBUS; 7380- DMESG("This is a CARDBUS NIC"); 7381- } 7382- else if( config3 & 0x4){ 7383- priv->card_type = MINIPCI; 7384- DMESG("This is a MINI-PCI NIC"); 7385- }else{ 7386- priv->card_type = PCI; 7387- DMESG("This is a PCI NIC"); 7388- } 7389- #endif 7390- priv->enable_gpio0 = 0; 7391- 7392- 7393- /* commented out just because we already do 7394- this when resetting the card 7395- andrea 20050924 7396- */ 7397- #if 0 7398- 7399- u8 txcr, txreg50; 7400- u32 txreg54, txreg60; 7401- 7402- /* enable A/D D/A register */ 7403- txcr = read_nic_byte(dev, 0x59); 7404-// DMESG("<txcr:%x>", txcr); 7405- //write_nic_word(dev, 0x59, 0x44); 7406- write_nic_byte(dev, 0x59, 0x44); 7407- //write_nic_byte(dev, 0x59, 0xea); 7408- txcr = read_nic_byte(dev, 0x59); 7409-// DMESG("<<txcr:%x>>", txcr); 7410- 7411- txreg50 = read_nic_byte(dev, 0x50); 7412- // DMESG("<txreg50:%x>", txreg50); 7413- write_nic_byte(dev, 0x50, 0xc0); 7414- txreg50 = read_nic_byte(dev, 0x50); 7415- // DMESG("<<txreg50:%x>>", txreg50); 7416- 7417- 7418- txreg54 = read_nic_dword(dev, 0x54); 7419- // DMESG("<txreg54:%x>", txreg54); 7420- txreg54 = 0xa0000a59; 7421- // DMESG("<<txreg54:%x>>", txreg54); 7422- write_nic_dword(dev, 0x54, txreg54); 7423- txreg54 = read_nic_dword(dev, 0x54); 7424- // DMESG("<<<txreg54:%x>>>", txreg54); 7425- 7426- txreg60 = read_nic_dword(dev, 0x60); 7427- // DMESG("<txreg60:%x>", txreg60); 7428- 7429- write_nic_byte(dev, 0x50, 0x0); 7430- txcr = read_nic_byte(dev, 0x50); 7431- // DMESG("<<txcr:%x>>", txcr); 7432- 7433-#endif 7434- 7435- /*the eeprom type is stored in RCR register bit #6 */ 7436- if (RCR_9356SEL & read_nic_dword(dev, RCR)){ 7437- priv->epromtype=EPROM_93c56; 7438- DMESG("Reported EEPROM chip is a 93c56 (2Kbit)"); 7439- }else{ 7440- priv->epromtype=EPROM_93c46; 7441- DMESG("Reported EEPROM chip is a 93c46 (1Kbit)"); 7442- } 7443- 7444- dev->get_stats = rtl8180_stats; 7445- 7446- dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff; 7447- dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8; 7448- dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff; 7449- dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8; 7450- dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff; 7451- dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8; 7452- 7453- DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr)); 7454- 7455- for(i=1,j=0; i<6; i+=2,j++){ 7456- 7457- word = eprom_read(dev,EPROM_TXPW0 + j); 7458- priv->chtxpwr[i]=word & 0xf; 7459- priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4; 7460- priv->chtxpwr[i+1]=(word & 0xf00)>>8; 7461- priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12; 7462- } 7463- 7464- for(i=1,j=0; i<4; i+=2,j++){ 7465- 7466- word = eprom_read(dev,EPROM_TXPW1 + j); 7467- priv->chtxpwr[i+6]=word & 0xf; 7468- priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4; 7469- priv->chtxpwr[i+6+1]=(word & 0xf00)>>8; 7470- priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12; 7471- } 7472- 7473- for(i=1,j=0; i<4; i+=2,j++){ 7474- 7475- word = eprom_read(dev,EPROM_TXPW2 + j); 7476- priv->chtxpwr[i+6+4]=word & 0xf; 7477- priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4; 7478- priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8; 7479- priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12; 7480- } 7481- 7482- 7483- priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID); 7484- 7485- word = eprom_read(dev,EPROM_TXPW_BASE); 7486- priv->cck_txpwr_base = word & 0xf; 7487- priv->ofdm_txpwr_base = (word>>4) & 0xf; 7488- 7489- /* check RF frontend chipset */ 7490- 7491- switch (priv->rf_chip) { 7492- 7493- case EPROM_RFCHIPID_RTL8225U: 7494- 7495- DMESG("Card reports RF frontend Realtek 8225"); 7496- DMESGW("This driver has EXPERIMENTAL support for this chipset."); 7497- DMESGW("use it with care and at your own risk and"); 7498- DMESGW("**PLEASE** REPORT SUCCESS/INSUCCESS TO andreamrl@tiscali.it"); 7499- if(rtl8225_is_V_z2(dev)){ 7500- priv->rf_init = rtl8225z2_rf_init; 7501- priv->rf_set_chan = rtl8225z2_rf_set_chan; 7502- priv->rf_set_sens = NULL; 7503- DMESG("This seems a new V2 radio"); 7504- }else{ 7505- priv->rf_init = rtl8225_rf_init; 7506- priv->rf_set_chan = rtl8225_rf_set_chan; 7507- priv->rf_set_sens = rtl8225_rf_set_sens; 7508- DMESG("This seems a legacy 1st version radio"); 7509- } 7510- priv->rf_close = rtl8225_rf_close; 7511- 7512- priv->max_sens = RTL8225_RF_MAX_SENS; 7513- priv->sens = RTL8225_RF_DEF_SENS; 7514- break; 7515- 7516- default: 7517- DMESGW("Unknown RF module %x",priv->rf_chip); 7518- DMESGW("Exiting..."); 7519- return -1; 7520- 7521- } 7522- 7523-// DMESG("Energy threshold: %x",priv->cs_treshold); 7524- DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7); 7525- //DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2)); 7526- 7527- if(rtl8187_usb_initendpoints(dev)!=0){ 7528- DMESG("Endopoints initialization failed"); 7529- return -ENOMEM; 7530- } 7531-#if 0 7532- if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount)) 7533- return -ENOMEM; 7534- 7535- if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount, 7536- TX_NORMPRIORITY_RING_ADDR)) 7537- return -ENOMEM; 7538- 7539- if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount, 7540- TX_HIGHPRIORITY_RING_ADDR)) 7541- return -ENOMEM; 7542- 7543- if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount, 7544- TX_LOWPRIORITY_RING_ADDR)) 7545- return -ENOMEM; 7546- 7547- 7548- if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount)) 7549- return -ENOMEM; 7550-#endif 7551- 7552- 7553-#ifdef DEBUG_EPROM 7554- dump_eprom(dev); 7555-#endif 7556- return 0; 7557- 7558-} 7559- 7560-void rtl8185_rf_pins_enable(struct net_device *dev) 7561-{ 7562-/* u16 tmp; 7563- tmp = read_nic_word(dev, RFPinsEnable);*/ 7564- write_nic_word(dev, RFPinsEnable, 0x1ff7);// | tmp); 7565-} 7566- 7567- 7568-void rtl8185_set_anaparam2(struct net_device *dev, u32 a) 7569-{ 7570- u8 conf3; 7571- 7572- rtl8180_set_mode(dev, EPROM_CMD_CONFIG); 7573- 7574- conf3 = read_nic_byte(dev, CONFIG3); 7575- write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT)); 7576- 7577- write_nic_dword(dev, ANAPARAM2, a); 7578- 7579- conf3 = read_nic_byte(dev, CONFIG3); 7580- write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT)); 7581- 7582- rtl8180_set_mode(dev, EPROM_CMD_NORMAL); 7583- 7584-} 7585- 7586- 7587-void rtl8180_set_anaparam(struct net_device *dev, u32 a) 7588-{ 7589- u8 conf3; 7590- 7591- rtl8180_set_mode(dev, EPROM_CMD_CONFIG); 7592- 7593- conf3 = read_nic_byte(dev, CONFIG3); 7594- write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT)); 7595- 7596- write_nic_dword(dev, ANAPARAM, a); 7597- 7598- conf3 = read_nic_byte(dev, CONFIG3); 7599- write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT)); 7600- 7601- rtl8180_set_mode(dev, EPROM_CMD_NORMAL); 7602- 7603-} 7604- 7605- 7606-void rtl8185_tx_antenna(struct net_device *dev, u8 ant) 7607-{ 7608- write_nic_byte(dev, TX_ANTENNA, ant); 7609- force_pci_posting(dev); 7610- mdelay(1); 7611-} 7612- 7613- 7614-void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data) 7615-{ 7616- //u8 phyr; 7617- u32 phyw; 7618-// int i; 7619- 7620- adr |= 0x80; 7621- 7622- phyw= ((data<<8) | adr); 7623- 7624- 7625- 7626- // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register. 7627- write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24)); 7628- write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16)); 7629- write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8)); 7630- write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) )); 7631- 7632- //read_nic_dword(dev, PHY_ADR); 7633-#if 0 7634- for(i=0;i<10;i++){ 7635- write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw); 7636- phyr = read_nic_byte(dev, PHY_READ); 7637- if(phyr == (data&0xff)) break; 7638- 7639- } 7640-#endif 7641- /* this is ok to fail when we write AGC table. check for AGC table might be 7642- * done by masking with 0x7f instead of 0xff 7643- */ 7644- //if(phyr != (data&0xff)) DMESGW("Phy write timeout %x %x %x", phyr, data, adr); 7645- mdelay(1); 7646-} 7647- 7648- 7649-inline void write_phy_ofdm (struct net_device *dev, u8 adr, u32 data) 7650-{ 7651- data = data & 0xff; 7652- rtl8187_write_phy(dev, adr, data); 7653-} 7654- 7655- 7656-void write_phy_cck (struct net_device *dev, u8 adr, u32 data) 7657-{ 7658- data = data & 0xff; 7659- rtl8187_write_phy(dev, adr, data | 0x10000); 7660-} 7661- 7662- 7663-void rtl8180_adapter_start(struct net_device *dev) 7664-{ 7665- struct r8180_priv *priv = ieee80211_priv(dev); 7666- //u32 anaparam; 7667- //u8 config3; 7668- 7669- //rtl8180_rtx_disable(dev); 7670- rtl8180_reset(dev); 7671- 7672- write_nic_byte(dev,0x85,0); 7673- write_nic_byte(dev,0x91,0); 7674- 7675- /* light blink! */ 7676- write_nic_byte(dev,0x85,4); 7677- write_nic_byte(dev,0x91,1); 7678- write_nic_byte(dev,0x90,0); 7679- 7680- priv->irq_mask = 0xffff; 7681-/* 7682- priv->dma_poll_mask = 0; 7683- priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT); 7684-*/ 7685-// rtl8180_beacon_tx_disable(dev); 7686- 7687- rtl8180_set_mode(dev, EPROM_CMD_CONFIG); 7688- write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]); 7689- write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff ); 7690- 7691- rtl8180_set_mode(dev, EPROM_CMD_NORMAL); 7692- rtl8180_update_msr(dev); 7693- 7694- rtl8180_set_mode(dev, EPROM_CMD_CONFIG); 7695- 7696- write_nic_word(dev,0xf4,0xffff); 7697- write_nic_byte(dev, 7698- CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80); 7699- 7700- rtl8180_set_mode(dev,EPROM_CMD_NORMAL); 7701- 7702- write_nic_dword(dev,INT_TIMEOUT,0); 7703- 7704-#ifdef DEBUG_REGISTERS 7705- rtl8180_dump_reg(dev); 7706-#endif 7707- 7708- 7709- write_nic_byte(dev, WPA_CONFIG, 0); 7710- 7711- write_nic_byte(dev, RATE_FALLBACK, 0x81); 7712- rtl8187_set_rate(dev); 7713- 7714- priv->rf_init(dev); 7715- 7716- if(priv->rf_set_sens != NULL) 7717- priv->rf_set_sens(dev,priv->sens); 7718- 7719- write_nic_word(dev,0x5e,1); 7720- 7721- #if 1 7722- //mdelay(1); 7723- write_nic_word(dev,0xfe,0x10); 7724-// mdelay(1); 7725- #endif 7726- write_nic_byte(dev, TALLY_SEL, 0x80);//Set NQ retry count 7727- 7728- write_nic_byte(dev, 0xff, 0x60); 7729- 7730- write_nic_word(dev,0x5e,0); 7731- 7732- 7733- rtl8180_irq_enable(dev); 7734- /*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY)); 7735- 7736- DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY)); 7737- 7738- DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY)); 7739- if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK"); 7740- if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK"); 7741- if(check_nic_enought_desc(dev,LOW_PRIORITY)) DMESG("LOW OK");*/ 7742-} 7743- 7744- 7745- 7746-/* this configures registers for beacon tx and enables it via 7747- * rtl8180_beacon_tx_enable(). rtl8180_beacon_tx_disable() might 7748- * be used to stop beacon transmission 7749- */ 7750-#if 0 7751-void rtl8180_start_tx_beacon(struct net_device *dev) 7752-{ 7753- int i; 7754- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 7755- u16 word; 7756- DMESG("Enabling beacon TX"); 7757- //write_nic_byte(dev, 0x42,0xe6);// TCR 7758- //rtl8180_init_beacon(dev); 7759- //set_nic_txring(dev); 7760-// rtl8180_prepare_beacon(dev); 7761- rtl8180_irq_disable(dev); 7762-// rtl8180_beacon_tx_enable(dev); 7763- rtl8180_set_mode(dev,EPROM_CMD_CONFIG); 7764- //write_nic_byte(dev,0x9d,0x20); //DMA Poll 7765- //write_nic_word(dev,0x7a,0); 7766- //write_nic_word(dev,0x7a,0x8000); 7767- 7768- 7769- word = read_nic_word(dev, BcnItv); 7770- word &= ~BcnItv_BcnItv; // clear Bcn_Itv 7771- write_nic_word(dev, BcnItv, word); 7772- 7773- write_nic_word(dev, AtimWnd, 7774- read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd); 7775- 7776- word = read_nic_word(dev, BintrItv); 7777- word &= ~BintrItv_BintrItv; 7778- 7779- //word |= priv->ieee80211->beacon_interval * 7780- // ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1); 7781- // FIXME:FIXME check if correct ^^ worked with 0x3e8; 7782- 7783- write_nic_word(dev, BintrItv, word); 7784- 7785- //write_nic_word(dev,0x2e,0xe002); 7786- //write_nic_dword(dev,0x30,0xb8c7832e); 7787- for(i=0; i<ETH_ALEN; i++) 7788- write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]); 7789- 7790-// rtl8180_update_msr(dev); 7791- 7792- 7793- //write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */ 7794- 7795- rtl8180_set_mode(dev, EPROM_CMD_NORMAL); 7796- 7797- rtl8180_irq_enable(dev); 7798- 7799- /* VV !!!!!!!!!! VV*/ 7800- /* 7801- rtl8180_set_mode(dev,EPROM_CMD_CONFIG); 7802- write_nic_byte(dev,0x9d,0x00); 7803- rtl8180_set_mode(dev,EPROM_CMD_NORMAL); 7804-*/ 7805-} 7806-#endif 7807-/*************************************************************************** 7808- -------------------------------NET STUFF--------------------------- 7809-***************************************************************************/ 7810-static struct net_device_stats *rtl8180_stats(struct net_device *dev) 7811-{ 7812- struct r8180_priv *priv = ieee80211_priv(dev); 7813- 7814- return &priv->ieee80211->stats; 7815-} 7816- 7817- 7818-int _rtl8180_up(struct net_device *dev) 7819-{ 7820- struct r8180_priv *priv = ieee80211_priv(dev); 7821- 7822- priv->up=1; 7823- 7824- //DMESG("Bringing up iface"); 7825- 7826- rtl8180_adapter_start(dev); 7827- 7828- rtl8180_rx_enable(dev); 7829- 7830- rtl8180_tx_enable(dev); 7831- 7832- ieee80211_softmac_start_protocol(priv->ieee80211); 7833- 7834- ieee80211_reset_queue(priv->ieee80211); 7835- if(!netif_queue_stopped(dev)) 7836- netif_start_queue(dev); 7837- else 7838- netif_wake_queue(dev); 7839- 7840- return 0; 7841-} 7842- 7843- 7844-int rtl8180_open(struct net_device *dev) 7845-{ 7846- struct r8180_priv *priv = ieee80211_priv(dev); 7847- int ret; 7848- 7849- down(&priv->wx_sem); 7850- ret = rtl8180_up(dev); 7851- up(&priv->wx_sem); 7852- return ret; 7853- 7854-} 7855- 7856- 7857-int rtl8180_up(struct net_device *dev) 7858-{ 7859- struct r8180_priv *priv = ieee80211_priv(dev); 7860- 7861- if (priv->up == 1) return -1; 7862- 7863- return _rtl8180_up(dev); 7864-} 7865- 7866- 7867-int rtl8180_close(struct net_device *dev) 7868-{ 7869- struct r8180_priv *priv = ieee80211_priv(dev); 7870- int ret; 7871- 7872- down(&priv->wx_sem); 7873- 7874- ret = rtl8180_down(dev); 7875- 7876- up(&priv->wx_sem); 7877- 7878- return ret; 7879- 7880-} 7881- 7882-int rtl8180_down(struct net_device *dev) 7883-{ 7884- struct r8180_priv *priv = ieee80211_priv(dev); 7885- 7886- if (priv->up == 0) return -1; 7887- 7888- priv->up=0; 7889- 7890-/* FIXME */ 7891- if (!netif_queue_stopped(dev)) 7892- netif_stop_queue(dev); 7893- 7894- rtl8180_rtx_disable(dev); 7895- rtl8180_irq_disable(dev); 7896- 7897- ieee80211_softmac_stop_protocol(priv->ieee80211); 7898- 7899- return 0; 7900-} 7901- 7902- 7903-void rtl8180_commit(struct net_device *dev) 7904-{ 7905- struct r8180_priv *priv = ieee80211_priv(dev); 7906- 7907- if (priv->up == 0) return ; 7908- 7909- ieee80211_softmac_stop_protocol(priv->ieee80211); 7910- 7911- rtl8180_irq_disable(dev); 7912- rtl8180_rtx_disable(dev); 7913- _rtl8180_up(dev); 7914-} 7915- 7916-void rtl8180_restart(struct net_device *dev) 7917-{ 7918- struct r8180_priv *priv = ieee80211_priv(dev); 7919- 7920- down(&priv->wx_sem); 7921- 7922- rtl8180_commit(dev); 7923- 7924- up(&priv->wx_sem); 7925-} 7926- 7927-static void r8180_set_multicast(struct net_device *dev) 7928-{ 7929- struct r8180_priv *priv = ieee80211_priv(dev); 7930- short promisc; 7931- 7932- //down(&priv->wx_sem); 7933- 7934- /* FIXME FIXME */ 7935- 7936- promisc = (dev->flags & IFF_PROMISC) ? 1:0; 7937- 7938- if (promisc != priv->promisc) 7939- // rtl8180_commit(dev); 7940- 7941- priv->promisc = promisc; 7942- 7943- //schedule_work(&priv->reset_wq); 7944- //up(&priv->wx_sem); 7945-} 7946- 7947- 7948-int r8180_set_mac_adr(struct net_device *dev, void *mac) 7949-{ 7950- struct r8180_priv *priv = ieee80211_priv(dev); 7951- struct sockaddr *addr = mac; 7952- 7953- down(&priv->wx_sem); 7954- 7955- memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); 7956- 7957- schedule_work(&priv->reset_wq); 7958- 7959- up(&priv->wx_sem); 7960- 7961- return 0; 7962-} 7963- 7964- 7965-/* based on ipw2200 driver */ 7966-int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 7967-{ 7968- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 7969- 7970- down(&priv->wx_sem); 7971- 7972- struct iwreq *wrq = (struct iwreq *)rq; 7973- 7974- int ret=-1; 7975- switch (cmd) { 7976- case RTL_IOCTL_WPA_SUPPLICANT: 7977- ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data); 7978- break; 7979- 7980- default: 7981- ret = -EOPNOTSUPP; 7982- break; 7983- } 7984- 7985- up(&priv->wx_sem); 7986- 7987- return ret; 7988-} 7989- 7990- 7991-void rtl8180_irq_rx_tasklet(struct r8180_priv *priv) 7992-{ 7993- struct urb *rx_urb = priv->rxurb_task; 7994- struct net_device *dev = (struct net_device*)rx_urb->context; 7995- int status,len,flen; 7996- struct sk_buff *skb; 7997- u32 *desc; 7998- 7999- //DMESG("rtl8187_rx_isr"); 8000- 8001- struct ieee80211_rx_stats stats = { 8002- .signal = 0, 8003- .noise = -98, 8004- .rate = 0, 8005- // .mac_time = jiffies, 8006- .freq = IEEE80211_24GHZ_BAND, 8007- }; 8008- 8009- //DMESG("RX %d ",rx_urb->status); 8010- status = rx_urb->status; 8011- if(status == 0){ 8012- 8013- len = rx_urb->actual_length; 8014- // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/ 8015- len -= 4*4;/* 4 dword and 4 byte CRC */ 8016- 8017- desc = (u32*)(rx_urb->transfer_buffer + len); 8018- 8019- flen = desc[0] & 0xfff; 8020- 8021- if( flen <= rx_urb->actual_length){ 8022- 8023- stats.signal = (desc[1] & 0x7f00)>>8; 8024- stats.noise = desc[1] &0xff; 8025- stats.rate = desc[0] >> 20 & 0xf; 8026- stats.mac_time[0] = desc[2]; 8027- stats.mac_time[1] = desc[3]; 8028- skb = dev_alloc_skb(flen-4); 8029- //skb_reserve(skb,2); 8030- if(skb){ 8031- memcpy(skb_put(skb,flen-4), 8032- rx_urb->transfer_buffer,flen -4); 8033- 8034- #ifdef DUMP_RX 8035- int i; 8036- for(i=0;i<flen-4;i++) 8037- printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]); 8038- printk("------RATE %x:w---------------\n",stats.rate); 8039- 8040- #endif 8041- priv->stats.rxok++; 8042- // priv->rxskb = skb; 8043- // priv->tempstats = &stats; 8044- 8045- if(!ieee80211_rx(priv->ieee80211, 8046- skb, &stats)) 8047- dev_kfree_skb_any(skb); 8048- } 8049- }else priv->stats.rxurberr++; 8050- }else{ 8051- priv->stats.rxstaterr++; 8052- priv->ieee80211->stats.rx_errors++; 8053- 8054- } 8055- 8056- if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb); 8057- else DMESG("RX process aborted due to explicit shutdown"); 8058-} 8059- 8060-/**************************************************************************** 8061- ---------------------------- USB_STUFF--------------------------- 8062-*****************************************************************************/ 8063- 8064- 8065-static int __devinit rtl8187_usb_probe(struct usb_interface *intf, 8066- const struct usb_device_id *id) 8067-{ 8068-// unsigned long ioaddr = 0; 8069- struct net_device *dev = NULL; 8070- struct r8180_priv *priv= NULL; 8071- struct usb_device *udev = interface_to_usbdev(intf); 8072- 8073-//printk("===> rtl8187_usb_probe()\n"); 8074- 8075- dev = alloc_ieee80211(sizeof(struct r8180_priv)); 8076- 8077- SET_MODULE_OWNER(dev); 8078- usb_set_intfdata(intf, dev); 8079- 8080- SET_NETDEV_DEV(dev, &intf->dev); 8081- 8082- priv = ieee80211_priv(dev); 8083- priv->ieee80211 = netdev_priv(dev); 8084- 8085- priv->udev=udev; 8086- 8087- dev->open = rtl8180_open; 8088- dev->stop = rtl8180_close; 8089- //dev->hard_start_xmit = rtl8180_8023_hard_start_xmit; 8090- dev->tx_timeout = tx_timeout; 8091- dev->wireless_handlers = &r8180_wx_handlers_def; 8092- dev->do_ioctl = rtl8180_ioctl; 8093- dev->set_multicast_list = r8180_set_multicast; 8094- dev->set_mac_address = r8180_set_mac_adr; 8095- dev->get_wireless_stats = r8180_get_wireless_stats; 8096- dev->type=ARPHRD_ETHER; 8097- 8098- if (dev_alloc_name(dev, ifname) < 0){ 8099- DMESG("Oops: devname already taken! Trying wlan%%d...\n"); 8100- ifname = "wlan%d"; 8101- dev_alloc_name(dev, ifname); 8102- } 8103- 8104-// dev->open=rtl8180_init; 8105- 8106- if(rtl8180_init(dev)!=0){ 8107- DMESG("Initialization failed"); 8108- goto fail; 8109- } 8110- 8111- netif_carrier_off(dev); 8112- netif_stop_queue(dev); 8113- 8114- register_netdev(dev); 8115- 8116- rtl8180_proc_init_one(dev); 8117- 8118- 8119- DMESG("Driver probe completed\n"); 8120- return 0; 8121- 8122- 8123-fail: 8124- free_ieee80211(dev); 8125- 8126- DMESG("wlan driver load failed\n"); 8127- 8128- return -ENODEV; 8129- 8130-} 8131- 8132- 8133-static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf) 8134-{ 8135- struct r8180_priv *priv; 8136- struct net_device *dev = usb_get_intfdata(intf); 8137- if(dev){ 8138- 8139- unregister_netdev(dev); 8140- 8141- priv=ieee80211_priv(dev); 8142- 8143- rtl8180_proc_remove_one(dev); 8144- 8145- rtl8180_down(dev); 8146- priv->rf_close(dev); 8147- //rtl8180_rtx_disable(dev); 8148- rtl8187_usb_deleteendpoints(dev); 8149- rtl8180_irq_disable(dev); 8150- rtl8180_reset(dev); 8151- mdelay(10); 8152- 8153- } 8154-// pci_disable_device(pdev); 8155- free_ieee80211(dev); 8156- DMESG("wlan driver removed\n"); 8157-} 8158- 8159- 8160-static int __init rtl8187_usb_module_init(void) 8161-{ 8162- printk(KERN_INFO "\nLinux kernel driver for RTL8187 \ 8163-based WLAN cards\n"); 8164- printk(KERN_INFO "Copyright (c) 2004-2005, Andrea Merello\n"); 8165- DMESG("Initializing module"); 8166- DMESG("Wireless extensions version %d", WIRELESS_EXT); 8167- rtl8180_proc_module_init(); 8168- return usb_register(&rtl8187_usb_driver); 8169-} 8170- 8171- 8172-static void __exit rtl8187_usb_module_exit(void) 8173-{ 8174- usb_deregister(&rtl8187_usb_driver); 8175- 8176- rtl8180_proc_module_remove(); 8177- DMESG("Exiting"); 8178-} 8179- 8180- 8181-void rtl8180_try_wake_queue(struct net_device *dev, int pri) 8182-{ 8183- unsigned long flags; 8184- short enough_desc; 8185- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 8186- 8187- spin_lock_irqsave(&priv->tx_lock,flags); 8188- enough_desc = check_nic_enought_desc(dev,pri); 8189- spin_unlock_irqrestore(&priv->tx_lock,flags); 8190- 8191- if(enough_desc) 8192- ieee80211_wake_queue(priv->ieee80211); 8193-} 8194- 8195- 8196- 8197-/*************************************************************************** 8198- ------------------- module init / exit stubs ---------------- 8199-****************************************************************************/ 8200-module_init(rtl8187_usb_module_init); 8201-module_exit(rtl8187_usb_module_exit); 8202diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8187.h 8203--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h 2006-06-05 23:48:10.000000000 -0700 8204+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8187.h 2010-05-19 22:23:52.586008695 -0700 8205@@ -1,17 +1,17 @@ 8206-/* 8207+/* 8208 This is part of rtl8187 OpenSource driver. 8209- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it> 8210+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it> 8211 Released under the terms of GPL (General Public Licence) 8212- 8213- Parts of this driver are based on the GPL part of the 8214+ 8215+ Parts of this driver are based on the GPL part of the 8216 official realtek driver 8217- 8218- Parts of this driver are based on the rtl8180 driver skeleton 8219+ 8220+ Parts of this driver are based on the rtl8180 driver skeleton 8221 from Patric Schenke & Andres Salomon 8222- 8223+ 8224 Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver 8225- 8226- We want to tanks the Authors of those projects and the Ndiswrapper 8227+ 8228+ We want to tanks the Authors of those projects and the Ndiswrapper 8229 project Authors. 8230 */ 8231 8232@@ -26,7 +26,6 @@ 8233 8234 #include <linux/module.h> 8235 #include <linux/kernel.h> 8236-#include <linux/config.h> 8237 #include <linux/init.h> 8238 #include <linux/ioport.h> 8239 #include <linux/sched.h> 8240@@ -44,8 +43,16 @@ 8241 #include <linux/if_arp.h> 8242 #include <linux/random.h> 8243 #include <linux/version.h> 8244+ 8245+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 8246 #include <asm/io.h> 8247 #include <asm/semaphore.h> 8248+#include <linux/config.h> 8249+#else 8250+#include <linux/io.h> 8251+#include <linux/semaphore.h> 8252+//#include <linux/autoconf.h> 8253+#endif 8254 8255 #include "ieee80211.h" 8256 8257@@ -68,7 +75,7 @@ 8258 { 8259 struct buffer *next; 8260 u32 *buf; 8261- 8262+ 8263 } buffer; 8264 8265 #if 0 8266@@ -123,18 +130,18 @@ 8267 short epromtype; 8268 int irq; 8269 struct ieee80211_device *ieee80211; 8270- 8271+ 8272 short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D */ 8273 short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */ 8274 short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */ 8275 short enable_gpio0; 8276 enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type; 8277 short hw_plcp_len; 8278- 8279+ 8280 // spinlock_t irq_lock; 8281 // spinlock_t irq_th_lock; 8282 spinlock_t tx_lock; 8283- 8284+ 8285 u16 irq_mask; 8286 // short irq_enabled; 8287 struct net_device *dev; 8288@@ -143,13 +150,18 @@ 8289 short max_sens; 8290 u8 chtxpwr[15]; //channels from 1 to 14, 0 not used 8291 u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used 8292+ u8 chtxpwr_orig[15]; //channels from 1 to 14, 0 not used 8293+ u8 chtxpwr_ofdm_orig[15]; //channels from 1 to 14, 0 not used 8294 u8 cck_txpwr_base; 8295 u8 ofdm_txpwr_base; 8296+ u8 txpwr_max; 8297 u8 challow[15]; //channels from 1 to 14, 0 not used 8298 short up; 8299 short crcmon; //if 1 allow bad crc frame reception in monitor mode 8300-// short prism_hdr; 8301- 8302+ short prism_hdr; 8303+ short fasttx; 8304+ short highpower; 8305+ 8306 // struct timer_list scan_timer; 8307 /*short scanpending; 8308 short stopscan;*/ 8309@@ -158,7 +170,7 @@ 8310 //u8 active_scan_num; 8311 struct semaphore wx_sem; 8312 // short hw_wep; 8313- 8314+ 8315 // short digphy; 8316 // short antb; 8317 // short diversity; 8318@@ -171,31 +183,31 @@ 8319 void (*rf_close)(struct net_device *dev); 8320 void (*rf_init)(struct net_device *dev); 8321 //short rate; 8322- short promisc; 8323+ short promisc; 8324 /*stats*/ 8325 struct Stats stats; 8326 struct iw_statistics wstats; 8327 struct proc_dir_entry *dir_dev; 8328- 8329+ 8330 /*RX stuff*/ 8331 // u32 *rxring; 8332 // u32 *rxringtail; 8333 // dma_addr_t rxringdma; 8334 struct urb **rx_urb; 8335- 8336+ 8337 //struct buffer *rxbuffer; 8338 //struct buffer *rxbufferhead; 8339 //int rxringcount; 8340 //u16 rxbuffersize; 8341- 8342- //struct sk_buff *rx_skb; 8343+ 8344+ //struct sk_buff *rx_skb; 8345 8346 //short rx_skb_complete; 8347 8348 //u32 rx_prevlen; 8349 atomic_t tx_lp_pending; 8350 atomic_t tx_np_pending; 8351-#if 0 8352+#if 0 8353 /*TX stuff*/ 8354 u32 *txlpring; 8355 u32 *txhpring; 8356@@ -225,7 +237,7 @@ 8357 struct urb *rxurb_task; 8358 // u8 dma_poll_mask; 8359 //short tx_suspend; 8360- 8361+ 8362 /* adhoc/master mode stuff */ 8363 #if 0 8364 u32 *txbeacontail; 8365@@ -239,22 +251,23 @@ 8366 //u16 master_beaconinterval; 8367 // u32 master_beaconsize; 8368 //u16 beacon_interval; 8369- 8370+ 8371 u8 retry_data; 8372 u8 retry_rts; 8373- 8374+ 8375 struct work_struct reset_wq; 8376- 8377+ 8378 }r8180_priv; 8379 8380 8381-typedef enum{ 8382+typedef enum{ 8383 LOW_PRIORITY , 8384- NORM_PRIORITY 8385+ NORM_PRIORITY 8386 } priority_t; 8387 8388 8389 short rtl8180_tx(struct net_device *dev,u32* skbuf, int len,priority_t priority,short morefrag,short rate); 8390+short rtl8180_tx_fast(struct net_device *dev,u32* skbuf, int len, short rate); 8391 8392 u8 read_nic_byte(struct net_device *dev, int x); 8393 u8 read_nic_byte_E(struct net_device *dev, int x); 8394diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h~ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8187.h~ 8395--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h~ 2006-06-05 19:58:02.000000000 -0700 8396+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8187.h~ 1969-12-31 16:00:00.000000000 -0800 8397@@ -1,288 +0,0 @@ 8398-/* 8399- This is part of rtl8187 OpenSource driver. 8400- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it> 8401- Released under the terms of GPL (General Public Licence) 8402- 8403- Parts of this driver are based on the GPL part of the 8404- official realtek driver 8405- 8406- Parts of this driver are based on the rtl8180 driver skeleton 8407- from Patric Schenke & Andres Salomon 8408- 8409- Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver 8410- 8411- We want to tanks the Authors of those projects and the Ndiswrapper 8412- project Authors. 8413-*/ 8414- 8415-#ifndef R8180H 8416-#define R8180H 8417- 8418- 8419-#define RTL8187_MODULE_NAME "rtl8187" 8420-#define DMESG(x,a...) printk(KERN_INFO RTL8187_MODULE_NAME ": " x "\n", ## a) 8421-#define DMESGW(x,a...) printk(KERN_WARNING RTL8187_MODULE_NAME ": WW:" x "\n", ## a) 8422-#define DMESGE(x,a...) printk(KERN_WARNING RTL8187_MODULE_NAME ": EE:" x "\n", ## a) 8423- 8424-#include <linux/module.h> 8425-#include <linux/kernel.h> 8426-#include <linux/config.h> 8427-#include <linux/init.h> 8428-#include <linux/ioport.h> 8429-#include <linux/sched.h> 8430-#include <linux/types.h> 8431-#include <linux/slab.h> 8432-#include <linux/netdevice.h> 8433-//#include <linux/pci.h> 8434-#include <linux/usb.h> 8435-#include <linux/etherdevice.h> 8436-#include <linux/delay.h> 8437-#include <linux/rtnetlink.h> //for rtnl_lock() 8438-#include <linux/wireless.h> 8439-#include <linux/timer.h> 8440-#include <linux/proc_fs.h> // Necessary because we use the proc fs 8441-#include <linux/if_arp.h> 8442-#include <linux/random.h> 8443-#include <linux/version.h> 8444-#include <asm/io.h> 8445-#include <asm/semaphore.h> 8446- 8447-#include "ieee80211.h" 8448- 8449-#define EPROM_93c46 0 8450-#define EPROM_93c56 1 8451- 8452-#define DEFAULT_FRAG_THRESHOLD 2342U 8453-#define MIN_FRAG_THRESHOLD 256U 8454-#define DEFAULT_BEACONINTERVAL 0x64U 8455-#define DEFAULT_BEACON_ESSID "Rtl8187" 8456- 8457-#define DEFAULT_SSID "" 8458-#define DEFAULT_RETRY_RTS 7 8459-#define DEFAULT_RETRY_DATA 7 8460-#define PRISM_HDR_SIZE 64 8461- 8462-#define RTL_IOCTL_WPA_SUPPLICANT SIOCIWFIRSTPRIV+30 8463- 8464-typedef struct buffer 8465-{ 8466- struct buffer *next; 8467- u32 *buf; 8468- 8469-} buffer; 8470- 8471-#if 0 8472- 8473-typedef struct tx_pendingbuf 8474-{ 8475- struct ieee80211_txb *txb; 8476- short ispending; 8477- short descfrag; 8478-} tx_pendigbuf; 8479- 8480-#endif 8481- 8482-typedef struct Stats 8483-{ 8484- unsigned long txrdu; 8485-// unsigned long rxrdu; 8486- //unsigned long rxnolast; 8487- //unsigned long rxnodata; 8488-// unsigned long rxreset; 8489-// unsigned long rxwrkaround; 8490-// unsigned long rxnopointer; 8491- unsigned long rxok; 8492- unsigned long rxurberr; 8493- unsigned long rxstaterr; 8494- unsigned long txnperr; 8495- unsigned long txnpdrop; 8496- unsigned long txresumed; 8497-// unsigned long rxerr; 8498-// unsigned long rxoverflow; 8499-// unsigned long rxint; 8500- unsigned long txnpokint; 8501-// unsigned long txhpokint; 8502-// unsigned long txhperr; 8503-// unsigned long ints; 8504-// unsigned long shints; 8505- unsigned long txoverflow; 8506-// unsigned long rxdmafail; 8507-// unsigned long txbeacon; 8508-// unsigned long txbeaconerr; 8509- unsigned long txlpokint; 8510- unsigned long txlpdrop; 8511- unsigned long txlperr; 8512- unsigned long txdatapkt; 8513-} Stats; 8514- 8515- 8516- 8517-typedef struct r8180_priv 8518-{ 8519- struct usb_device *udev; 8520- short epromtype; 8521- int irq; 8522- struct ieee80211_device *ieee80211; 8523- 8524- short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D */ 8525- short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */ 8526- short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */ 8527- short enable_gpio0; 8528- enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type; 8529- short hw_plcp_len; 8530- 8531-// spinlock_t irq_lock; 8532-// spinlock_t irq_th_lock; 8533- spinlock_t tx_lock; 8534- 8535- u16 irq_mask; 8536-// short irq_enabled; 8537- struct net_device *dev; 8538- short chan; 8539- short sens; 8540- short max_sens; 8541- u8 chtxpwr[15]; //channels from 1 to 14, 0 not used 8542- u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used 8543- u8 cck_txpwr_base; 8544- u8 ofdm_txpwr_base; 8545- u8 challow[15]; //channels from 1 to 14, 0 not used 8546- short up; 8547- short crcmon; //if 1 allow bad crc frame reception in monitor mode 8548-// short prism_hdr; 8549- 8550-// struct timer_list scan_timer; 8551- /*short scanpending; 8552- short stopscan;*/ 8553-// spinlock_t scan_lock; 8554-// u8 active_probe; 8555- //u8 active_scan_num; 8556- struct semaphore wx_sem; 8557-// short hw_wep; 8558- 8559-// short digphy; 8560-// short antb; 8561-// short diversity; 8562-// u8 cs_treshold; 8563-// short rcr_csense; 8564- short rf_chip; 8565-// u32 key0[4]; 8566- short (*rf_set_sens)(struct net_device *dev,short sens); 8567- void (*rf_set_chan)(struct net_device *dev,short ch); 8568- void (*rf_close)(struct net_device *dev); 8569- void (*rf_init)(struct net_device *dev); 8570- //short rate; 8571- short promisc; 8572- /*stats*/ 8573- struct Stats stats; 8574- struct iw_statistics wstats; 8575- struct proc_dir_entry *dir_dev; 8576- 8577- /*RX stuff*/ 8578-// u32 *rxring; 8579-// u32 *rxringtail; 8580-// dma_addr_t rxringdma; 8581- struct urb **rx_urb; 8582- 8583- //struct buffer *rxbuffer; 8584- //struct buffer *rxbufferhead; 8585- //int rxringcount; 8586- //u16 rxbuffersize; 8587- 8588- //struct sk_buff *rx_skb; 8589- 8590- //short rx_skb_complete; 8591- 8592- //u32 rx_prevlen; 8593- atomic_t tx_lp_pending; 8594- atomic_t tx_np_pending; 8595-#if 0 8596- /*TX stuff*/ 8597- u32 *txlpring; 8598- u32 *txhpring; 8599- u32 *txnpring; 8600- dma_addr_t txlpringdma; 8601- dma_addr_t txhpringdma; 8602- dma_addr_t txnpringdma; 8603- u32 *txlpringtail; 8604- u32 *txhpringtail; 8605- u32 *txnpringtail; 8606- u32 *txlpringhead; 8607- u32 *txhpringhead; 8608- u32 *txnpringhead; 8609- struct buffer *txlpbufs; 8610- struct buffer *txhpbufs; 8611- struct buffer *txnpbufs; 8612- struct buffer *txlpbufstail; 8613- struct buffer *txhpbufstail; 8614- struct buffer *txnpbufstail; 8615- int txringcount; 8616- int txbuffsize; 8617- 8618- //struct tx_pendingbuf txnp_pending; 8619- struct tasklet_struct irq_tx_tasklet; 8620-#endif 8621-// struct tasklet_struct irq_rx_tasklet; 8622-// u8 dma_poll_mask; 8623- //short tx_suspend; 8624- 8625- /* adhoc/master mode stuff */ 8626-#if 0 8627- u32 *txbeacontail; 8628- dma_addr_t txbeaconringdma; 8629- u32 *txbeaconring; 8630- int txbeaconcount; 8631-#endif 8632-// struct ieee_tx_beacon *beacon_buf; 8633- //char *master_essid; 8634-// dma_addr_t beacondmabuf; 8635- //u16 master_beaconinterval; 8636-// u32 master_beaconsize; 8637- //u16 beacon_interval; 8638- 8639- u8 retry_data; 8640- u8 retry_rts; 8641- 8642- struct work_struct reset_wq; 8643- 8644-}r8180_priv; 8645- 8646- 8647-typedef enum{ 8648- LOW_PRIORITY , 8649- NORM_PRIORITY 8650- } priority_t; 8651- 8652- 8653-short rtl8180_tx(struct net_device *dev,u32* skbuf, int len,priority_t priority,short morefrag,short rate); 8654- 8655-u8 read_nic_byte(struct net_device *dev, int x); 8656-u8 read_nic_byte_E(struct net_device *dev, int x); 8657-u32 read_nic_dword(struct net_device *dev, int x); 8658-u16 read_nic_word(struct net_device *dev, int x) ; 8659-void write_nic_byte(struct net_device *dev, int x,u8 y); 8660-void write_nic_byte_E(struct net_device *dev, int x,u8 y); 8661-void write_nic_word(struct net_device *dev, int x,u16 y); 8662-void write_nic_dword(struct net_device *dev, int x,u32 y); 8663-void force_pci_posting(struct net_device *dev); 8664- 8665-void rtl8180_rtx_disable(struct net_device *); 8666-void rtl8180_rx_enable(struct net_device *); 8667-void rtl8180_tx_enable(struct net_device *); 8668- 8669-void rtl8180_disassociate(struct net_device *dev); 8670-//void fix_rx_fifo(struct net_device *dev); 8671-void rtl8185_set_rf_pins_enable(struct net_device *dev,u32 a); 8672- 8673-void rtl8180_set_anaparam(struct net_device *dev,u32 a); 8674-void rtl8185_set_anaparam2(struct net_device *dev,u32 a); 8675-void rtl8180_update_msr(struct net_device *dev); 8676-int rtl8180_down(struct net_device *dev); 8677-int rtl8180_up(struct net_device *dev); 8678-void rtl8180_commit(struct net_device *dev); 8679-void rtl8180_set_chan(struct net_device *dev,short ch); 8680-void write_phy(struct net_device *dev, u8 adr, u8 data); 8681-void write_phy_cck(struct net_device *dev, u8 adr, u32 data); 8682-void write_phy_ofdm(struct net_device *dev, u8 adr, u32 data); 8683-void rtl8185_tx_antenna(struct net_device *dev, u8 ant); 8684-void rtl8187_set_rxconf(struct net_device *dev); 8685-#endif 8686diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/.tmp_versions/r8187.mod rtl8187_linux_26.1010.0622.2006.modified/beta-8187/.tmp_versions/r8187.mod 8687--- rtl8187_linux_26.1010.0622.2006/beta-8187/.tmp_versions/r8187.mod 2006-06-21 22:40:15.000000000 -0700 8688+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/.tmp_versions/r8187.mod 2010-05-19 22:24:09.366013373 -0700 8689@@ -1,2 +1,2 @@ 8690-/usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8187.ko 8691-/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 8692+/home/dsk/repos/rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.ko 8693+/home/dsk/repos/rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.o /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_93cx6.o /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_wx.o /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.o /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225z2.o 8694diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.c rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_crypt.c 8695--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.c 2006-06-05 19:57:56.000000000 -0700 8696+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_crypt.c 2010-05-19 22:22:30.982698060 -0700 8697@@ -11,7 +11,6 @@ 8698 * 8699 */ 8700 8701-#include <linux/config.h> 8702 #include <linux/version.h> 8703 #include <linux/module.h> 8704 #include <linux/init.h> 8705@@ -19,6 +18,12 @@ 8706 #include <asm/string.h> 8707 #include <asm/errno.h> 8708 8709+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 8710+#include <linux/config.h> 8711+#else 8712+//#include <linux/autoconf.h> 8713+#endif 8714+ 8715 #include "ieee80211.h" 8716 8717 MODULE_AUTHOR("Jouni Malinen"); 8718@@ -38,7 +43,7 @@ 8719 8720 static struct ieee80211_crypto *hcrypt; 8721 8722-void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, 8723+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *ieee, 8724 int force) 8725 { 8726 struct list_head *ptr, *n; 8727@@ -61,13 +66,13 @@ 8728 } 8729 } 8730 8731-void ieee80211_crypt_deinit_handler(unsigned long data) 8732+void ieee80211_crypt_deinit_handler_rtl7(unsigned long data) 8733 { 8734 struct ieee80211_device *ieee = (struct ieee80211_device *)data; 8735 unsigned long flags; 8736 8737 spin_lock_irqsave(&ieee->lock, flags); 8738- ieee80211_crypt_deinit_entries(ieee, 0); 8739+ ieee80211_crypt_deinit_entries_rtl7(ieee, 0); 8740 if (!list_empty(&ieee->crypt_deinit_list)) { 8741 printk(KERN_DEBUG "%s: entries remaining in delayed crypt " 8742 "deletion list\n", ieee->dev->name); 8743@@ -78,7 +83,7 @@ 8744 8745 } 8746 8747-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, 8748+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee, 8749 struct ieee80211_crypt_data **crypt) 8750 { 8751 struct ieee80211_crypt_data *tmp; 8752@@ -103,7 +108,7 @@ 8753 spin_unlock_irqrestore(&ieee->lock, flags); 8754 } 8755 8756-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops) 8757+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops) 8758 { 8759 unsigned long flags; 8760 struct ieee80211_crypto_alg *alg; 8761@@ -128,7 +133,7 @@ 8762 return 0; 8763 } 8764 8765-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops) 8766+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops) 8767 { 8768 unsigned long flags; 8769 struct list_head *ptr; 8770@@ -159,7 +164,7 @@ 8771 } 8772 8773 8774-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name) 8775+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name) 8776 { 8777 unsigned long flags; 8778 struct list_head *ptr; 8779@@ -186,13 +191,13 @@ 8780 } 8781 8782 8783-static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; } 8784-static void ieee80211_crypt_null_deinit(void *priv) {} 8785+static void * ieee80211_crypt_null_init_rtl7(int keyidx) { return (void *) 1; } 8786+static void ieee80211_crypt_null_deinit_rtl7(void *priv) {} 8787 8788 static struct ieee80211_crypto_ops ieee80211_crypt_null = { 8789 .name = "NULL", 8790- .init = ieee80211_crypt_null_init, 8791- .deinit = ieee80211_crypt_null_deinit, 8792+ .init = ieee80211_crypt_null_init_rtl7, 8793+ .deinit = ieee80211_crypt_null_deinit_rtl7, 8794 .encrypt_mpdu = NULL, 8795 .decrypt_mpdu = NULL, 8796 .encrypt_msdu = NULL, 8797@@ -205,7 +210,7 @@ 8798 }; 8799 8800 8801-static int __init ieee80211_crypto_init(void) 8802+static int __init ieee80211_crypto_init_rtl7(void) 8803 { 8804 int ret = -ENOMEM; 8805 8806@@ -217,7 +222,7 @@ 8807 INIT_LIST_HEAD(&hcrypt->algs); 8808 spin_lock_init(&hcrypt->lock); 8809 8810- ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null); 8811+ ret = ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_null); 8812 if (ret < 0) { 8813 kfree(hcrypt); 8814 hcrypt = NULL; 8815@@ -227,7 +232,7 @@ 8816 } 8817 8818 8819-static void __exit ieee80211_crypto_deinit(void) 8820+static void __exit ieee80211_crypto_deinit_rtl7(void) 8821 { 8822 struct list_head *ptr, *n; 8823 8824@@ -247,13 +252,13 @@ 8825 kfree(hcrypt); 8826 } 8827 8828-EXPORT_SYMBOL(ieee80211_crypt_deinit_entries); 8829-EXPORT_SYMBOL(ieee80211_crypt_deinit_handler); 8830-EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit); 8831- 8832-EXPORT_SYMBOL(ieee80211_register_crypto_ops); 8833-EXPORT_SYMBOL(ieee80211_unregister_crypto_ops); 8834-EXPORT_SYMBOL(ieee80211_get_crypto_ops); 8835+EXPORT_SYMBOL(ieee80211_crypt_deinit_entries_rtl7); 8836+EXPORT_SYMBOL(ieee80211_crypt_deinit_handler_rtl7); 8837+EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit_rtl7); 8838+ 8839+EXPORT_SYMBOL(ieee80211_register_crypto_ops_rtl7); 8840+EXPORT_SYMBOL(ieee80211_unregister_crypto_ops_rtl7); 8841+EXPORT_SYMBOL(ieee80211_get_crypto_ops_rtl7); 8842 8843-module_init(ieee80211_crypto_init); 8844-module_exit(ieee80211_crypto_deinit); 8845+module_init(ieee80211_crypto_init_rtl7); 8846+module_exit(ieee80211_crypto_deinit_rtl7); 8847diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_ccmp.c rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_crypt_ccmp.c 8848--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_ccmp.c 2006-06-05 19:58:00.000000000 -0700 8849+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_crypt_ccmp.c 2010-05-19 22:22:46.906050739 -0700 8850@@ -9,7 +9,6 @@ 8851 * more details. 8852 */ 8853 8854-#include <linux/config.h> 8855 #include <linux/version.h> 8856 #include <linux/module.h> 8857 #include <linux/init.h> 8858@@ -22,11 +21,22 @@ 8859 #include <asm/string.h> 8860 #include <linux/wireless.h> 8861 8862+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 8863+#include <linux/config.h> 8864+#else 8865+//#include <linux/autoconf.h> 8866+#endif 8867+ 8868 #include "ieee80211.h" 8869 8870 8871 #include <linux/crypto.h> 8872-#include <asm/scatterlist.h> 8873+ 8874+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) 8875+ #include <asm/scatterlist.h> 8876+#else 8877+ #include <linux/scatterlist.h> 8878+#endif 8879 8880 MODULE_AUTHOR("Jouni Malinen"); 8881 MODULE_DESCRIPTION("Host AP crypt: CCMP"); 8882@@ -51,7 +61,11 @@ 8883 8884 int key_idx; 8885 8886+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 8887 struct crypto_tfm *tfm; 8888+#else 8889+ struct crypto_cipher *tfm; 8890+#endif 8891 8892 /* scratch buffers for virt_to_page() (crypto API) */ 8893 u8 tx_b0[AES_BLOCK_LEN], tx_b[AES_BLOCK_LEN], 8894@@ -59,7 +73,8 @@ 8895 u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN]; 8896 }; 8897 8898-void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm, 8899+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 8900+void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_tfm *tfm, 8901 const u8 pt[16], u8 ct[16]) 8902 { 8903 struct scatterlist src, dst; 8904@@ -74,8 +89,15 @@ 8905 8906 crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN); 8907 } 8908+#else 8909+static inline void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_cipher *tfm, 8910+ const u8 pt[16], u8 ct[16]) 8911+{ 8912+ crypto_cipher_encrypt_one(tfm, ct, pt); 8913+} 8914+#endif 8915 8916-static void * ieee80211_ccmp_init(int key_idx) 8917+static void * ieee80211_ccmp_init_rtl7(int key_idx) 8918 { 8919 struct ieee80211_ccmp_data *priv; 8920 8921@@ -85,19 +107,33 @@ 8922 memset(priv, 0, sizeof(*priv)); 8923 priv->key_idx = key_idx; 8924 8925+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 8926 priv->tfm = crypto_alloc_tfm("aes", 0); 8927 if (priv->tfm == NULL) { 8928 printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate " 8929 "crypto API aes\n"); 8930 goto fail; 8931 } 8932+#else 8933+ priv->tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); 8934+ if (IS_ERR(priv->tfm)) { 8935+ printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate " 8936+ "crypto API aes\n"); 8937+ priv->tfm = NULL; 8938+ goto fail; 8939+ } 8940+#endif 8941 8942 return priv; 8943 8944 fail: 8945 if (priv) { 8946 if (priv->tfm) 8947+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 8948 crypto_free_tfm(priv->tfm); 8949+#else 8950+ crypto_free_cipher(priv->tfm); 8951+#endif 8952 kfree(priv); 8953 } 8954 8955@@ -105,16 +141,20 @@ 8956 } 8957 8958 8959-static void ieee80211_ccmp_deinit(void *priv) 8960+static void ieee80211_ccmp_deinit_rtl7(void *priv) 8961 { 8962 struct ieee80211_ccmp_data *_priv = priv; 8963 if (_priv && _priv->tfm) 8964+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 8965 crypto_free_tfm(_priv->tfm); 8966+#else 8967+ crypto_free_cipher(_priv->tfm); 8968+#endif 8969 kfree(priv); 8970 } 8971 8972 8973-static inline void xor_block(u8 *b, u8 *a, size_t len) 8974+static inline void xor_block_rtl7(u8 *b, u8 *a, size_t len) 8975 { 8976 int i; 8977 for (i = 0; i < len; i++) 8978@@ -122,7 +162,11 @@ 8979 } 8980 8981 8982-static void ccmp_init_blocks(struct crypto_tfm *tfm, 8983+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 8984+static void ccmp_init_blocks_rtl7(struct crypto_tfm *tfm, 8985+#else 8986+static void ccmp_init_blocks_rtl7(struct crypto_cipher *tfm, 8987+#endif 8988 struct ieee80211_hdr *hdr, 8989 u8 *pn, size_t dlen, u8 *b0, u8 *auth, 8990 u8 *s0) 8991@@ -186,18 +230,18 @@ 8992 } 8993 8994 /* Start with the first block and AAD */ 8995- ieee80211_ccmp_aes_encrypt(tfm, b0, auth); 8996- xor_block(auth, aad, AES_BLOCK_LEN); 8997- ieee80211_ccmp_aes_encrypt(tfm, auth, auth); 8998- xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN); 8999- ieee80211_ccmp_aes_encrypt(tfm, auth, auth); 9000+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, auth); 9001+ xor_block_rtl7(auth, aad, AES_BLOCK_LEN); 9002+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth); 9003+ xor_block_rtl7(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN); 9004+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth); 9005 b0[0] &= 0x07; 9006 b0[14] = b0[15] = 0; 9007- ieee80211_ccmp_aes_encrypt(tfm, b0, s0); 9008+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, s0); 9009 } 9010 9011 9012-static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) 9013+static int ieee80211_ccmp_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv) 9014 { 9015 struct ieee80211_ccmp_data *key = priv; 9016 int data_len, i, blocks, last, len; 9017@@ -237,7 +281,7 @@ 9018 *pos++ = key->tx_pn[0]; 9019 9020 hdr = (struct ieee80211_hdr *) skb->data; 9021- ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0); 9022+ ccmp_init_blocks_rtl7(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0); 9023 9024 blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN; 9025 last = data_len % AES_BLOCK_LEN; 9026@@ -245,13 +289,13 @@ 9027 for (i = 1; i <= blocks; i++) { 9028 len = (i == blocks && last) ? last : AES_BLOCK_LEN; 9029 /* Authentication */ 9030- xor_block(b, pos, len); 9031- ieee80211_ccmp_aes_encrypt(key->tfm, b, b); 9032+ xor_block_rtl7(b, pos, len); 9033+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b, b); 9034 /* Encryption, with counter */ 9035 b0[14] = (i >> 8) & 0xff; 9036 b0[15] = i & 0xff; 9037- ieee80211_ccmp_aes_encrypt(key->tfm, b0, e); 9038- xor_block(pos, e, len); 9039+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, e); 9040+ xor_block_rtl7(pos, e, len); 9041 pos += len; 9042 } 9043 9044@@ -262,7 +306,7 @@ 9045 } 9046 9047 9048-static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) 9049+static int ieee80211_ccmp_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv) 9050 { 9051 struct ieee80211_ccmp_data *key = priv; 9052 u8 keyidx, *pos; 9053@@ -326,8 +370,8 @@ 9054 return -4; 9055 } 9056 9057- ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b); 9058- xor_block(mic, b, CCMP_MIC_LEN); 9059+ ccmp_init_blocks_rtl7(key->tfm, hdr, pn, data_len, b0, a, b); 9060+ xor_block_rtl7(mic, b, CCMP_MIC_LEN); 9061 9062 blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN; 9063 last = data_len % AES_BLOCK_LEN; 9064@@ -337,11 +381,11 @@ 9065 /* Decrypt, with counter */ 9066 b0[14] = (i >> 8) & 0xff; 9067 b0[15] = i & 0xff; 9068- ieee80211_ccmp_aes_encrypt(key->tfm, b0, b); 9069- xor_block(pos, b, len); 9070+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, b); 9071+ xor_block_rtl7(pos, b, len); 9072 /* Authentication */ 9073- xor_block(a, pos, len); 9074- ieee80211_ccmp_aes_encrypt(key->tfm, a, a); 9075+ xor_block_rtl7(a, pos, len); 9076+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, a, a); 9077 pos += len; 9078 } 9079 9080@@ -365,11 +409,15 @@ 9081 } 9082 9083 9084-static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv) 9085+static int ieee80211_ccmp_set_key_rtl7(void *key, int len, u8 *seq, void *priv) 9086 { 9087 struct ieee80211_ccmp_data *data = priv; 9088 int keyidx; 9089+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 9090 struct crypto_tfm *tfm = data->tfm; 9091+#else 9092+ struct crypto_cipher *tfm = data->tfm; 9093+#endif 9094 9095 keyidx = data->key_idx; 9096 memset(data, 0, sizeof(*data)); 9097@@ -396,7 +444,7 @@ 9098 } 9099 9100 9101-static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv) 9102+static int ieee80211_ccmp_get_key_rtl7(void *key, int len, u8 *seq, void *priv) 9103 { 9104 struct ieee80211_ccmp_data *data = priv; 9105 9106@@ -420,7 +468,7 @@ 9107 } 9108 9109 9110-static char * ieee80211_ccmp_print_stats(char *p, void *priv) 9111+static char * ieee80211_ccmp_print_stats_rtl7(char *p, void *priv) 9112 { 9113 struct ieee80211_ccmp_data *ccmp = priv; 9114 p += sprintf(p, "key[%d] alg=CCMP key_set=%d " 9115@@ -437,34 +485,34 @@ 9116 } 9117 9118 9119-static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = { 9120+static struct ieee80211_crypto_ops ieee80211_crypt_ccmp_rtl7 = { 9121 .name = "CCMP", 9122- .init = ieee80211_ccmp_init, 9123- .deinit = ieee80211_ccmp_deinit, 9124- .encrypt_mpdu = ieee80211_ccmp_encrypt, 9125- .decrypt_mpdu = ieee80211_ccmp_decrypt, 9126+ .init = ieee80211_ccmp_init_rtl7, 9127+ .deinit = ieee80211_ccmp_deinit_rtl7, 9128+ .encrypt_mpdu = ieee80211_ccmp_encrypt_rtl7, 9129+ .decrypt_mpdu = ieee80211_ccmp_decrypt_rtl7, 9130 .encrypt_msdu = NULL, 9131 .decrypt_msdu = NULL, 9132- .set_key = ieee80211_ccmp_set_key, 9133- .get_key = ieee80211_ccmp_get_key, 9134- .print_stats = ieee80211_ccmp_print_stats, 9135+ .set_key = ieee80211_ccmp_set_key_rtl7, 9136+ .get_key = ieee80211_ccmp_get_key_rtl7, 9137+ .print_stats = ieee80211_ccmp_print_stats_rtl7, 9138 .extra_prefix_len = CCMP_HDR_LEN, 9139 .extra_postfix_len = CCMP_MIC_LEN, 9140 .owner = THIS_MODULE, 9141 }; 9142 9143 9144-static int __init ieee80211_crypto_ccmp_init(void) 9145+static int __init ieee80211_crypto_ccmp_init_rtl7(void) 9146 { 9147- return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp); 9148+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7); 9149 } 9150 9151 9152-static void __exit ieee80211_crypto_ccmp_exit(void) 9153+static void __exit ieee80211_crypto_ccmp_exit_rtl7(void) 9154 { 9155- ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp); 9156+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7); 9157 } 9158 9159 9160-module_init(ieee80211_crypto_ccmp_init); 9161-module_exit(ieee80211_crypto_ccmp_exit); 9162+module_init(ieee80211_crypto_ccmp_init_rtl7); 9163+module_exit(ieee80211_crypto_ccmp_exit_rtl7); 9164diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.h rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_crypt.h 9165--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.h 2006-06-05 19:58:00.000000000 -0700 9166+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_crypt.h 2010-05-19 22:18:51.936032580 -0700 9167@@ -75,12 +75,12 @@ 9168 atomic_t refcnt; 9169 }; 9170 9171-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); 9172-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); 9173-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name); 9174-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int); 9175-void ieee80211_crypt_deinit_handler(unsigned long); 9176-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, 9177+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops); 9178+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops); 9179+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name); 9180+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int); 9181+void ieee80211_crypt_deinit_handler_rtl7(unsigned long); 9182+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee, 9183 struct ieee80211_crypt_data **crypt); 9184 9185 #endif 9186diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_tkip.c rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_crypt_tkip.c 9187--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_tkip.c 2006-06-05 19:57:54.000000000 -0700 9188+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_crypt_tkip.c 2010-05-19 22:23:00.716049971 -0700 9189@@ -9,7 +9,6 @@ 9190 * more details. 9191 */ 9192 9193-#include <linux/config.h> 9194 #include <linux/version.h> 9195 #include <linux/module.h> 9196 #include <linux/init.h> 9197@@ -21,13 +20,24 @@ 9198 #include <linux/if_arp.h> 9199 #include <asm/string.h> 9200 9201+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 9202+#include <linux/config.h> 9203+#else 9204+//#include <linux/autoconf.h> 9205+#endif 9206+ 9207 #include "ieee80211.h" 9208 9209+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) 9210+ #include <asm/scatterlist.h> 9211+#else 9212+ #include <linux/scatterlist.h> 9213+#endif 9214 9215 #include <linux/crypto.h> 9216-#include <asm/scatterlist.h> 9217 #include <linux/crc32.h> 9218 9219+ 9220 MODULE_AUTHOR("Jouni Malinen"); 9221 MODULE_DESCRIPTION("Host AP crypt: TKIP"); 9222 MODULE_LICENSE("GPL"); 9223@@ -55,14 +65,21 @@ 9224 9225 int key_idx; 9226 9227+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) 9228 struct crypto_tfm *tfm_arc4; 9229 struct crypto_tfm *tfm_michael; 9230+#else 9231+ struct crypto_blkcipher *rx_tfm_arc4; 9232+ struct crypto_blkcipher *tx_tfm_arc4; 9233+ struct crypto_hash *rx_tfm_michael; 9234+ struct crypto_hash *tx_tfm_michael; 9235+#endif 9236 9237 /* scratch buffers for virt_to_page() (crypto API) */ 9238 u8 rx_hdr[16], tx_hdr[16]; 9239 }; 9240 9241-static void * ieee80211_tkip_init(int key_idx) 9242+static void * ieee80211_tkip_init_rtl7(int key_idx) 9243 { 9244 struct ieee80211_tkip_data *priv; 9245 9246@@ -72,28 +89,74 @@ 9247 memset(priv, 0, sizeof(*priv)); 9248 priv->key_idx = key_idx; 9249 9250+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) 9251 priv->tfm_arc4 = crypto_alloc_tfm("arc4", 0); 9252 if (priv->tfm_arc4 == NULL) { 9253 printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " 9254 "crypto API arc4\n"); 9255 goto fail; 9256 } 9257- 9258 priv->tfm_michael = crypto_alloc_tfm("michael_mic", 0); 9259 if (priv->tfm_michael == NULL) { 9260 printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " 9261 "crypto API michael_mic\n"); 9262 goto fail; 9263 } 9264+#else 9265+ priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); 9266+ if (IS_ERR(priv->tx_tfm_arc4)) { 9267+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " 9268+ "crypto API arc4\n"); 9269+ priv->tx_tfm_arc4 = NULL; 9270+ goto fail; 9271+ } 9272+ 9273+ priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0, 9274+ CRYPTO_ALG_ASYNC); 9275+ if (IS_ERR(priv->tx_tfm_michael)) { 9276+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " 9277+ "crypto API michael_mic\n"); 9278+ priv->tx_tfm_michael = NULL; 9279+ goto fail; 9280+ } 9281+ 9282+ priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); 9283+ if (IS_ERR(priv->rx_tfm_arc4)) { 9284+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " 9285+ "crypto API arc4\n"); 9286+ priv->rx_tfm_arc4 = NULL; 9287+ goto fail; 9288+ } 9289+ 9290+ priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0, 9291+ CRYPTO_ALG_ASYNC); 9292+ if (IS_ERR(priv->rx_tfm_michael)) { 9293+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " 9294+ "crypto API michael_mic\n"); 9295+ priv->rx_tfm_michael = NULL; 9296+ goto fail; 9297+ } 9298+#endif 9299 9300 return priv; 9301 9302 fail: 9303 if (priv) { 9304+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) 9305 if (priv->tfm_michael) 9306 crypto_free_tfm(priv->tfm_michael); 9307 if (priv->tfm_arc4) 9308 crypto_free_tfm(priv->tfm_arc4); 9309+#else 9310+ if (priv->tx_tfm_michael) 9311+ crypto_free_hash(priv->tx_tfm_michael); 9312+ if (priv->tx_tfm_arc4) 9313+ crypto_free_blkcipher(priv->tx_tfm_arc4); 9314+ if (priv->rx_tfm_michael) 9315+ crypto_free_hash(priv->rx_tfm_michael); 9316+ if (priv->rx_tfm_arc4) 9317+ crypto_free_blkcipher(priv->rx_tfm_arc4); 9318+#endif 9319 kfree(priv); 9320 } 9321 9322@@ -101,13 +164,26 @@ 9323 } 9324 9325 9326-static void ieee80211_tkip_deinit(void *priv) 9327+static void ieee80211_tkip_deinit_rtl7(void *priv) 9328 { 9329 struct ieee80211_tkip_data *_priv = priv; 9330+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) 9331 if (_priv && _priv->tfm_michael) 9332 crypto_free_tfm(_priv->tfm_michael); 9333 if (_priv && _priv->tfm_arc4) 9334 crypto_free_tfm(_priv->tfm_arc4); 9335+#else 9336+ if (_priv) { 9337+ if (_priv->tx_tfm_michael) 9338+ crypto_free_hash(_priv->tx_tfm_michael); 9339+ if (_priv->tx_tfm_arc4) 9340+ crypto_free_blkcipher(_priv->tx_tfm_arc4); 9341+ if (_priv->rx_tfm_michael) 9342+ crypto_free_hash(_priv->rx_tfm_michael); 9343+ if (_priv->rx_tfm_arc4) 9344+ crypto_free_blkcipher(_priv->rx_tfm_arc4); 9345+ } 9346+#endif 9347 kfree(priv); 9348 } 9349 9350@@ -200,7 +276,7 @@ 9351 9352 #define PHASE1_LOOP_COUNT 8 9353 9354-static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32) 9355+static void tkip_mixing_phase1_rtl7(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32) 9356 { 9357 int i, j; 9358 9359@@ -222,7 +298,7 @@ 9360 } 9361 9362 9363-static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, 9364+static void tkip_mixing_phase2_rtl7(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, 9365 u16 IV16) 9366 { 9367 /* Make temporary area overlap WEP seed so that the final copy can be 9368@@ -268,7 +344,7 @@ 9369 #endif 9370 } 9371 9372-static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) 9373+static int ieee80211_tkip_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv) 9374 { 9375 struct ieee80211_tkip_data *tkey = priv; 9376 int len; 9377@@ -276,6 +352,9 @@ 9378 struct ieee80211_hdr *hdr; 9379 u32 crc; 9380 struct scatterlist sg; 9381+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)) 9382+ struct blkcipher_desc desc = { .tfm = tkey->tx_tfm_arc4 }; 9383+#endif 9384 9385 if (skb_headroom(skb) < 8 || skb_tailroom(skb) < 4 || 9386 skb->len < hdr_len) 9387@@ -283,11 +362,11 @@ 9388 9389 hdr = (struct ieee80211_hdr *) skb->data; 9390 if (!tkey->tx_phase1_done) { 9391- tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2, 9392+ tkip_mixing_phase1_rtl7(tkey->tx_ttak, tkey->key, hdr->addr2, 9393 tkey->tx_iv32); 9394 tkey->tx_phase1_done = 1; 9395 } 9396- tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16); 9397+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16); 9398 9399 len = skb->len - hdr_len; 9400 pos = skb_push(skb, 8); 9401@@ -310,11 +389,23 @@ 9402 icv[2] = crc >> 16; 9403 icv[3] = crc >> 24; 9404 9405+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 9406 crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16); 9407+#else 9408+ crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16); 9409+#endif 9410+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) 9411 sg.page = virt_to_page(pos); 9412 sg.offset = offset_in_page(pos); 9413 sg.length = len + 4; 9414+#else 9415+ sg_set_page(&sg, virt_to_page(pos), len + 2, offset_in_page(pos)); 9416+#endif 9417+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 9418 crypto_cipher_encrypt(tkey->tfm_arc4, &sg, &sg, len + 4); 9419+#else 9420+ crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); 9421+#endif 9422 9423 tkey->tx_iv16++; 9424 if (tkey->tx_iv16 == 0) { 9425@@ -325,7 +416,7 @@ 9426 return 0; 9427 } 9428 9429-static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) 9430+static int ieee80211_tkip_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv) 9431 { 9432 struct ieee80211_tkip_data *tkey = priv; 9433 u8 rc4key[16]; 9434@@ -337,6 +428,9 @@ 9435 u32 crc; 9436 struct scatterlist sg; 9437 int plen; 9438+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)) 9439+ struct blkcipher_desc desc = { .tfm = tkey->rx_tfm_arc4 }; 9440+#endif 9441 9442 if (skb->len < hdr_len + 8 + 4) 9443 return -1; 9444@@ -382,18 +476,30 @@ 9445 } 9446 9447 if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) { 9448- tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32); 9449+ tkip_mixing_phase1_rtl7(tkey->rx_ttak, tkey->key, hdr->addr2, iv32); 9450 tkey->rx_phase1_done = 1; 9451 } 9452- tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16); 9453+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->rx_ttak, iv16); 9454 9455 plen = skb->len - hdr_len - 12; 9456 9457+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 9458 crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16); 9459+#else 9460+ crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); 9461+#endif 9462+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) 9463 sg.page = virt_to_page(pos); 9464 sg.offset = offset_in_page(pos); 9465 sg.length = plen + 4; 9466+#else 9467+ sg_set_page(&sg, virt_to_page(pos), plen + 4, offset_in_page(pos)); 9468+#endif 9469+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 9470 crypto_cipher_decrypt(tkey->tfm_arc4, &sg, &sg, plen + 4); 9471+#else 9472+ crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4); 9473+#endif 9474 9475 crc = ~crc32_le(~0, pos, plen); 9476 icv[0] = crc; 9477@@ -427,33 +533,59 @@ 9478 return keyidx; 9479 } 9480 9481- 9482-static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr, 9483+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) 9484+static int michael_mic_rtl7(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr, 9485 u8 *data, size_t data_len, u8 *mic) 9486 { 9487 struct scatterlist sg[2]; 9488 9489 if (tkey->tfm_michael == NULL) { 9490+#else 9491+static int michael_mic_rtl7(struct crypto_hash *tfm_michael, u8 *key, u8 *hdr, 9492+ u8 *data, size_t data_len, u8 *mic) 9493+{ 9494+ struct hash_desc desc; 9495+ struct scatterlist sg[2]; 9496+ 9497+ if (tfm_michael == NULL) { 9498+#endif 9499 printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n"); 9500 return -1; 9501 } 9502+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) 9503 sg[0].page = virt_to_page(hdr); 9504 sg[0].offset = offset_in_page(hdr); 9505 sg[0].length = 16; 9506+#else 9507+ sg_set_page(&sg[0], virt_to_page(hdr), 16, offset_in_page(hdr)); 9508+#endif 9509 9510+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) 9511 sg[1].page = virt_to_page(data); 9512 sg[1].offset = offset_in_page(data); 9513 sg[1].length = data_len; 9514+#else 9515+ sg_set_page(&sg[1], virt_to_page(data), data_len, offset_in_page(data)); 9516+#endif 9517 9518+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) 9519 crypto_digest_init(tkey->tfm_michael); 9520 crypto_digest_setkey(tkey->tfm_michael, key, 8); 9521 crypto_digest_update(tkey->tfm_michael, sg, 2); 9522 crypto_digest_final(tkey->tfm_michael, mic); 9523 9524 return 0; 9525+#else 9526+ if (crypto_hash_setkey(tfm_michael, key, 8)) 9527+ return -1; 9528+ 9529+ desc.tfm = tfm_michael; 9530+ desc.flags = 0; 9531+ return crypto_hash_digest(&desc, sg, data_len + 16, mic); 9532+#endif 9533 } 9534 9535-static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr) 9536+static void michael_mic_hdr_rtl7(struct sk_buff *skb, u8 *hdr) 9537 { 9538 struct ieee80211_hdr *hdr11; 9539 9540@@ -483,7 +615,7 @@ 9541 } 9542 9543 9544-static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv) 9545+static int ieee80211_michael_mic_add_rtl7(struct sk_buff *skb, int hdr_len, void *priv) 9546 { 9547 struct ieee80211_tkip_data *tkey = priv; 9548 u8 *pos; 9549@@ -495,18 +627,24 @@ 9550 return -1; 9551 } 9552 9553- michael_mic_hdr(skb, tkey->tx_hdr); 9554+ michael_mic_hdr_rtl7(skb, tkey->tx_hdr); 9555 pos = skb_put(skb, 8); 9556- if (michael_mic(tkey, &tkey->key[16], tkey->tx_hdr, 9557+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) 9558+ if (michael_mic_rtl7(tkey, &tkey->key[16], tkey->tx_hdr, 9559+ skb->data + hdr_len, skb->len - 8 - hdr_len, pos)) 9560+ return -1; 9561+#else 9562+ if (michael_mic_rtl7(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr, 9563 skb->data + hdr_len, skb->len - 8 - hdr_len, pos)) 9564 return -1; 9565+#endif 9566 9567 return 0; 9568 } 9569 9570 9571 #if WIRELESS_EXT >= 18 9572-static void ieee80211_michael_mic_failure(struct net_device *dev, 9573+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev, 9574 struct ieee80211_hdr *hdr, 9575 int keyidx) 9576 { 9577@@ -527,7 +665,7 @@ 9578 wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev); 9579 } 9580 #elif WIRELESS_EXT >= 15 9581-static void ieee80211_michael_mic_failure(struct net_device *dev, 9582+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev, 9583 struct ieee80211_hdr *hdr, 9584 int keyidx) 9585 { 9586@@ -543,7 +681,7 @@ 9587 wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf); 9588 } 9589 #else /* WIRELESS_EXT >= 15 */ 9590-static inline void ieee80211_michael_mic_failure(struct net_device *dev, 9591+static inline void ieee80211_michael_mic_failure_rtl7(struct net_device *dev, 9592 struct ieee80211_hdr *hdr, 9593 int keyidx) 9594 { 9595@@ -551,7 +689,7 @@ 9596 #endif /* WIRELESS_EXT >= 15 */ 9597 9598 9599-static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, 9600+static int ieee80211_michael_mic_verify_rtl7(struct sk_buff *skb, int keyidx, 9601 int hdr_len, void *priv) 9602 { 9603 struct ieee80211_tkip_data *tkey = priv; 9604@@ -560,10 +698,16 @@ 9605 if (!tkey->key_set) 9606 return -1; 9607 9608- michael_mic_hdr(skb, tkey->rx_hdr); 9609- if (michael_mic(tkey, &tkey->key[24], tkey->rx_hdr, 9610+ michael_mic_hdr_rtl7(skb, tkey->rx_hdr); 9611+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) 9612+ if (michael_mic_rtl7(tkey, &tkey->key[24], tkey->rx_hdr, 9613+ skb->data + hdr_len, skb->len - 8 - hdr_len, mic)) 9614+ return -1; 9615+#else 9616+ if (michael_mic_rtl7(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr, 9617 skb->data + hdr_len, skb->len - 8 - hdr_len, mic)) 9618 return -1; 9619+#endif 9620 if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) { 9621 struct ieee80211_hdr *hdr; 9622 hdr = (struct ieee80211_hdr *) skb->data; 9623@@ -572,7 +716,7 @@ 9624 skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2), 9625 keyidx); 9626 if (skb->dev) 9627- ieee80211_michael_mic_failure(skb->dev, hdr, keyidx); 9628+ ieee80211_michael_mic_failure_rtl7(skb->dev, hdr, keyidx); 9629 tkey->dot11RSNAStatsTKIPLocalMICFailures++; 9630 return -1; 9631 } 9632@@ -588,18 +732,33 @@ 9633 } 9634 9635 9636-static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv) 9637+static int ieee80211_tkip_set_key_rtl7(void *key, int len, u8 *seq, void *priv) 9638 { 9639 struct ieee80211_tkip_data *tkey = priv; 9640 int keyidx; 9641+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 9642 struct crypto_tfm *tfm = tkey->tfm_michael; 9643 struct crypto_tfm *tfm2 = tkey->tfm_arc4; 9644+#else 9645+ struct crypto_hash *tfm = tkey->tx_tfm_michael; 9646+ struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4; 9647+ struct crypto_hash *tfm3 = tkey->rx_tfm_michael; 9648+ struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4; 9649+#endif 9650 9651 keyidx = tkey->key_idx; 9652 memset(tkey, 0, sizeof(*tkey)); 9653 tkey->key_idx = keyidx; 9654+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 9655 tkey->tfm_michael = tfm; 9656 tkey->tfm_arc4 = tfm2; 9657+#else 9658+ tkey->tx_tfm_michael = tfm; 9659+ tkey->tx_tfm_arc4 = tfm2; 9660+ tkey->rx_tfm_michael = tfm3; 9661+ tkey->rx_tfm_arc4 = tfm4; 9662+#endif 9663+ 9664 if (len == TKIP_KEY_LEN) { 9665 memcpy(tkey->key, key, TKIP_KEY_LEN); 9666 tkey->key_set = 1; 9667@@ -618,7 +777,7 @@ 9668 } 9669 9670 9671-static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv) 9672+static int ieee80211_tkip_get_key_rtl7(void *key, int len, u8 *seq, void *priv) 9673 { 9674 struct ieee80211_tkip_data *tkey = priv; 9675 9676@@ -648,7 +807,7 @@ 9677 } 9678 9679 9680-static char * ieee80211_tkip_print_stats(char *p, void *priv) 9681+static char * ieee80211_tkip_print_stats_rtl7(char *p, void *priv) 9682 { 9683 struct ieee80211_tkip_data *tkip = priv; 9684 p += sprintf(p, "key[%d] alg=TKIP key_set=%d " 9685@@ -675,34 +834,34 @@ 9686 } 9687 9688 9689-static struct ieee80211_crypto_ops ieee80211_crypt_tkip = { 9690+static struct ieee80211_crypto_ops ieee80211_crypt_tkip_rtl7 = { 9691 .name = "TKIP", 9692- .init = ieee80211_tkip_init, 9693- .deinit = ieee80211_tkip_deinit, 9694- .encrypt_mpdu = ieee80211_tkip_encrypt, 9695- .decrypt_mpdu = ieee80211_tkip_decrypt, 9696- .encrypt_msdu = ieee80211_michael_mic_add, 9697- .decrypt_msdu = ieee80211_michael_mic_verify, 9698- .set_key = ieee80211_tkip_set_key, 9699- .get_key = ieee80211_tkip_get_key, 9700- .print_stats = ieee80211_tkip_print_stats, 9701+ .init = ieee80211_tkip_init_rtl7, 9702+ .deinit = ieee80211_tkip_deinit_rtl7, 9703+ .encrypt_mpdu = ieee80211_tkip_encrypt_rtl7, 9704+ .decrypt_mpdu = ieee80211_tkip_decrypt_rtl7, 9705+ .encrypt_msdu = ieee80211_michael_mic_add_rtl7, 9706+ .decrypt_msdu = ieee80211_michael_mic_verify_rtl7, 9707+ .set_key = ieee80211_tkip_set_key_rtl7, 9708+ .get_key = ieee80211_tkip_get_key_rtl7, 9709+ .print_stats = ieee80211_tkip_print_stats_rtl7, 9710 .extra_prefix_len = 4 + 4, /* IV + ExtIV */ 9711 .extra_postfix_len = 8 + 4, /* MIC + ICV */ 9712 .owner = THIS_MODULE, 9713 }; 9714 9715 9716-static int __init ieee80211_crypto_tkip_init(void) 9717+static int __init ieee80211_crypto_tkip_init_rtl7(void) 9718 { 9719- return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip); 9720+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7); 9721 } 9722 9723 9724-static void __exit ieee80211_crypto_tkip_exit(void) 9725+static void __exit ieee80211_crypto_tkip_exit_rtl7(void) 9726 { 9727- ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip); 9728+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7); 9729 } 9730 9731 9732-module_init(ieee80211_crypto_tkip_init); 9733-module_exit(ieee80211_crypto_tkip_exit); 9734+module_init(ieee80211_crypto_tkip_init_rtl7); 9735+module_exit(ieee80211_crypto_tkip_exit_rtl7); 9736diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_wep.c rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_crypt_wep.c 9737--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_wep.c 2006-06-05 19:57:54.000000000 -0700 9738+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_crypt_wep.c 2010-05-19 22:23:15.121856118 -0700 9739@@ -9,7 +9,6 @@ 9740 * more details. 9741 */ 9742 9743-#include <linux/config.h> 9744 #include <linux/version.h> 9745 #include <linux/module.h> 9746 #include <linux/init.h> 9747@@ -18,13 +17,24 @@ 9748 #include <linux/skbuff.h> 9749 #include <asm/string.h> 9750 9751+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 9752+#include <linux/config.h> 9753+#else 9754+//#include <linux/autoconf.h> 9755+#endif 9756+ 9757 #include "ieee80211.h" 9758 9759 9760 #include <linux/crypto.h> 9761-#include <asm/scatterlist.h> 9762 #include <linux/crc32.h> 9763 9764+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) 9765+ #include <asm/scatterlist.h> 9766+#else 9767+ #include <linux/scatterlist.h> 9768+#endif 9769+ 9770 MODULE_AUTHOR("Jouni Malinen"); 9771 MODULE_DESCRIPTION("Host AP crypt: WEP"); 9772 MODULE_LICENSE("GPL"); 9773@@ -36,11 +46,16 @@ 9774 u8 key[WEP_KEY_LEN + 1]; 9775 u8 key_len; 9776 u8 key_idx; 9777+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) 9778 struct crypto_tfm *tfm; 9779+#else 9780+ struct crypto_blkcipher *rx_tfm; 9781+ struct crypto_blkcipher *tx_tfm; 9782+#endif 9783 }; 9784 9785 9786-static void * prism2_wep_init(int keyidx) 9787+static void * prism2_wep_init_rtl7(int keyidx) 9788 { 9789 struct prism2_wep_data *priv; 9790 9791@@ -50,13 +65,30 @@ 9792 memset(priv, 0, sizeof(*priv)); 9793 priv->key_idx = keyidx; 9794 9795+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) 9796 priv->tfm = crypto_alloc_tfm("arc4", 0); 9797 if (priv->tfm == NULL) { 9798 printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " 9799 "crypto API arc4\n"); 9800 goto fail; 9801 } 9802+#else 9803+ priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); 9804+ if (IS_ERR(priv->tx_tfm)) { 9805+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " 9806+ "crypto API arc4\n"); 9807+ priv->tx_tfm = NULL; 9808+ goto fail; 9809+ } 9810 9811+ priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); 9812+ if (IS_ERR(priv->rx_tfm)) { 9813+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " 9814+ "crypto API arc4\n"); 9815+ priv->rx_tfm = NULL; 9816+ goto fail; 9817+ } 9818+#endif 9819 /* start WEP IV from a random value */ 9820 get_random_bytes(&priv->iv, 4); 9821 9822@@ -64,19 +96,35 @@ 9823 9824 fail: 9825 if (priv) { 9826+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) 9827 if (priv->tfm) 9828 crypto_free_tfm(priv->tfm); 9829+#else 9830+ if (priv->tx_tfm) 9831+ crypto_free_blkcipher(priv->tx_tfm); 9832+ if (priv->rx_tfm) 9833+ crypto_free_blkcipher(priv->rx_tfm); 9834+#endif 9835 kfree(priv); 9836 } 9837 return NULL; 9838 } 9839 9840 9841-static void prism2_wep_deinit(void *priv) 9842+static void prism2_wep_deinit_rtl7(void *priv) 9843 { 9844 struct prism2_wep_data *_priv = priv; 9845+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) 9846 if (_priv && _priv->tfm) 9847 crypto_free_tfm(_priv->tfm); 9848+#else 9849+ if (_priv) { 9850+ if (_priv->tx_tfm) 9851+ crypto_free_blkcipher(_priv->tx_tfm); 9852+ if (_priv->rx_tfm) 9853+ crypto_free_blkcipher(_priv->rx_tfm); 9854+ } 9855+#endif 9856 kfree(priv); 9857 } 9858 9859@@ -87,13 +135,16 @@ 9860 * 9861 * WEP frame payload: IV + TX key idx, RC4(data), ICV = RC4(CRC32(data)) 9862 */ 9863-static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) 9864+static int prism2_wep_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv) 9865 { 9866 struct prism2_wep_data *wep = priv; 9867 u32 crc, klen, len; 9868 u8 key[WEP_KEY_LEN + 3]; 9869 u8 *pos, *icv; 9870 struct scatterlist sg; 9871+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)) 9872+ struct blkcipher_desc desc = { .tfm = wep->tx_tfm }; 9873+#endif 9874 9875 if (skb_headroom(skb) < 4 || skb_tailroom(skb) < 4 || 9876 skb->len < hdr_len) 9877@@ -134,13 +185,25 @@ 9878 icv[2] = crc >> 16; 9879 icv[3] = crc >> 24; 9880 9881+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 9882 crypto_cipher_setkey(wep->tfm, key, klen); 9883+#else 9884+ crypto_blkcipher_setkey(wep->tx_tfm, key, klen); 9885+#endif 9886+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) 9887 sg.page = virt_to_page(pos); 9888 sg.offset = offset_in_page(pos); 9889 sg.length = len + 4; 9890- crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4); 9891+#else 9892+ sg_set_page(&sg, virt_to_page(pos), len + 4, offset_in_page(pos)); 9893+#endif 9894 9895+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 9896+ crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4); 9897 return 0; 9898+#else 9899+ return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); 9900+#endif 9901 } 9902 9903 9904@@ -151,13 +214,16 @@ 9905 * Returns 0 if frame was decrypted successfully and ICV was correct and -1 on 9906 * failure. If frame is OK, IV and ICV will be removed. 9907 */ 9908-static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) 9909+static int prism2_wep_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv) 9910 { 9911 struct prism2_wep_data *wep = priv; 9912 u32 crc, klen, plen; 9913 u8 key[WEP_KEY_LEN + 3]; 9914 u8 keyidx, *pos, icv[4]; 9915 struct scatterlist sg; 9916+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)) 9917+ struct blkcipher_desc desc = { .tfm = wep->rx_tfm }; 9918+#endif 9919 9920 if (skb->len < hdr_len + 8) 9921 return -1; 9922@@ -178,11 +244,26 @@ 9923 /* Apply RC4 to data and compute CRC32 over decrypted data */ 9924 plen = skb->len - hdr_len - 8; 9925 9926+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 9927 crypto_cipher_setkey(wep->tfm, key, klen); 9928+#else 9929+ crypto_blkcipher_setkey(wep->rx_tfm, key, klen); 9930+#endif 9931+ 9932+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) 9933 sg.page = virt_to_page(pos); 9934 sg.offset = offset_in_page(pos); 9935 sg.length = plen + 4; 9936+#else 9937+ sg_set_page(&sg, virt_to_page(pos), plen + 4, offset_in_page(pos)); 9938+#endif 9939+ 9940+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 9941 crypto_cipher_decrypt(wep->tfm, &sg, &sg, plen + 4); 9942+#else 9943+ if(crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) 9944+ return -7; 9945+#endif 9946 9947 crc = ~crc32_le(~0, pos, plen); 9948 icv[0] = crc; 9949@@ -203,7 +284,7 @@ 9950 } 9951 9952 9953-static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv) 9954+static int prism2_wep_set_key_rtl7(void *key, int len, u8 *seq, void *priv) 9955 { 9956 struct prism2_wep_data *wep = priv; 9957 9958@@ -217,7 +298,7 @@ 9959 } 9960 9961 9962-static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv) 9963+static int prism2_wep_get_key_rtl7(void *key, int len, u8 *seq, void *priv) 9964 { 9965 struct prism2_wep_data *wep = priv; 9966 9967@@ -230,7 +311,7 @@ 9968 } 9969 9970 9971-static char * prism2_wep_print_stats(char *p, void *priv) 9972+static char * prism2_wep_print_stats_rtl7(char *p, void *priv) 9973 { 9974 struct prism2_wep_data *wep = priv; 9975 p += sprintf(p, "key[%d] alg=WEP len=%d\n", 9976@@ -239,34 +320,34 @@ 9977 } 9978 9979 9980-static struct ieee80211_crypto_ops ieee80211_crypt_wep = { 9981+static struct ieee80211_crypto_ops ieee80211_crypt_wep_rtl7 = { 9982 .name = "WEP", 9983- .init = prism2_wep_init, 9984- .deinit = prism2_wep_deinit, 9985- .encrypt_mpdu = prism2_wep_encrypt, 9986- .decrypt_mpdu = prism2_wep_decrypt, 9987+ .init = prism2_wep_init_rtl7, 9988+ .deinit = prism2_wep_deinit_rtl7, 9989+ .encrypt_mpdu = prism2_wep_encrypt_rtl7, 9990+ .decrypt_mpdu = prism2_wep_decrypt_rtl7, 9991 .encrypt_msdu = NULL, 9992 .decrypt_msdu = NULL, 9993- .set_key = prism2_wep_set_key, 9994- .get_key = prism2_wep_get_key, 9995- .print_stats = prism2_wep_print_stats, 9996+ .set_key = prism2_wep_set_key_rtl7, 9997+ .get_key = prism2_wep_get_key_rtl7, 9998+ .print_stats = prism2_wep_print_stats_rtl7, 9999 .extra_prefix_len = 4, /* IV */ 10000 .extra_postfix_len = 4, /* ICV */ 10001 .owner = THIS_MODULE, 10002 }; 10003 10004 10005-static int __init ieee80211_crypto_wep_init(void) 10006+static int __init ieee80211_crypto_wep_init_rtl7(void) 10007 { 10008- return ieee80211_register_crypto_ops(&ieee80211_crypt_wep); 10009+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7); 10010 } 10011 10012 10013-static void __exit ieee80211_crypto_wep_exit(void) 10014+static void __exit ieee80211_crypto_wep_exit_rtl7(void) 10015 { 10016- ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep); 10017+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7); 10018 } 10019 10020 10021-module_init(ieee80211_crypto_wep_init); 10022-module_exit(ieee80211_crypto_wep_exit); 10023+module_init(ieee80211_crypto_wep_init_rtl7); 10024+module_exit(ieee80211_crypto_wep_exit_rtl7); 10025diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211.h rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211.h 10026--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211.h 2006-06-05 19:57:56.000000000 -0700 10027+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211.h 2010-05-19 22:18:51.949360395 -0700 10028@@ -120,7 +120,7 @@ 10029 static inline unsigned long msleep_interruptible_rtl(unsigned int msecs) 10030 { 10031 unsigned long timeout = MSECS(msecs) + 1; 10032- 10033+ 10034 while (timeout) { 10035 set_current_state(TASK_UNINTERRUPTIBLE); 10036 timeout = schedule_timeout(timeout); 10037@@ -156,6 +156,22 @@ 10038 struct list_head list; 10039 }; 10040 10041+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */ 10042+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header 10043+ * (from linux-wlan-ng) */ 10044+struct linux_wlan_ng_val { 10045+ u32 did; 10046+ u16 status, len; 10047+ u32 data; 10048+} __attribute__ ((packed)); 10049+ 10050+struct linux_wlan_ng_prism_hdr { 10051+ u32 msgcode, msglen; 10052+ char devname[16]; 10053+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal, 10054+ noise, rate, istx, frmlen; 10055+} __attribute__ ((packed)); 10056+ 10057 struct ieee80211_hdr { 10058 u16 frame_ctl; 10059 u16 duration_id; 10060@@ -798,7 +814,7 @@ 10061 10062 /* the card is not linked at all */ 10063 IEEE80211_NOLINK = 0, 10064- 10065+ 10066 /* IEEE80211_ASSOCIATING* are for BSS client mode 10067 * the driver shall not perform RX filtering unless 10068 * the state is LINKED. 10069@@ -806,31 +822,31 @@ 10070 * defaults to NOLINK for ALL the other states (including 10071 * LINKED_SCANNING) 10072 */ 10073- 10074+ 10075 /* the association procedure will start (wq scheduling)*/ 10076 IEEE80211_ASSOCIATING, 10077 IEEE80211_ASSOCIATING_RETRY, 10078- 10079+ 10080 /* the association procedure is sending AUTH request*/ 10081 IEEE80211_ASSOCIATING_AUTHENTICATING, 10082- 10083+ 10084 /* the association procedure has successfully authentcated 10085 * and is sending association request 10086 */ 10087 IEEE80211_ASSOCIATING_AUTHENTICATED, 10088- 10089+ 10090 /* the link is ok. the card associated to a BSS or linked 10091 * to a ibss cell or acting as an AP and creating the bss 10092 */ 10093 IEEE80211_LINKED, 10094- 10095+ 10096 /* same as LINKED, but the driver shall apply RX filter 10097 * rules as we are in NO_LINK mode. As the card is still 10098 * logically linked, but it is doing a syncro site survey 10099 * then it will be back to LINKED state. 10100 */ 10101 IEEE80211_LINKED_SCANNING, 10102- 10103+ 10104 }; 10105 10106 #define DEFAULT_MAX_SCAN_AGE (15 * HZ) 10107@@ -840,14 +856,14 @@ 10108 10109 10110 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11)) 10111-extern inline int is_multicast_ether_addr(const u8 *addr) 10112+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr) 10113 { 10114 return ((addr[0] != 0xff) && (0x01 & addr[0])); 10115 } 10116 #endif 10117 10118 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13)) 10119-extern inline int is_broadcast_ether_addr(const u8 *addr) 10120+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr) 10121 { 10122 return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \ 10123 (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); 10124@@ -870,7 +886,7 @@ 10125 struct net_device_stats stats; 10126 struct ieee80211_stats ieee_stats; 10127 struct ieee80211_softmac_stats softmac_stats; 10128- 10129+ 10130 /* Probe / Beacon management */ 10131 struct list_head network_free_list; 10132 struct list_head network_list; 10133@@ -881,7 +897,7 @@ 10134 int iw_mode; /* operating mode (IW_MODE_*) */ 10135 10136 spinlock_t lock; 10137- 10138+ 10139 int tx_headroom; /* Set to size of any additional room needed at front 10140 * of allocated Tx SKBs */ 10141 u32 config; 10142@@ -924,11 +940,11 @@ 10143 * ad-hoc is a mixture ;-). 10144 * Note that in infrastructure mode, even when not associated, 10145 * fields bssid and essid may be valid (if wpa_set and essid_set 10146- * are true) as thy carry the value set by the user via iwconfig 10147+ * are true) as thy carry the value set by the user via iwconfig 10148 */ 10149 struct ieee80211_network current_network; 10150 10151- 10152+ 10153 enum ieee80211_state state; 10154 10155 int short_slot; 10156@@ -936,33 +952,33 @@ 10157 int modulation; /* CCK, OFDM */ 10158 int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */ 10159 int abg_true; /* ABG flag */ 10160- 10161- /* used for forcing the ibss workqueue to terminate 10162+ 10163+ /* used for forcing the ibss workqueue to terminate 10164 * without wait for the syncro scan to terminate 10165 */ 10166- short sync_scan_hurryup; 10167- 10168+ short sync_scan_hurryup; 10169+ 10170 /* map of allowed channels. 0 is dummy */ 10171 // FIXME: remeber to default to a basic channel plan depending of the PHY type 10172 int channel_map[MAX_CHANNEL_NUMBER+1]; 10173- 10174+ 10175 int rate; /* current rate */ 10176 int basic_rate; 10177 //FIXME: pleace callback, see if redundant with softmac_features 10178 short active_scan; 10179- 10180+ 10181 /* this contains flags for selectively enable softmac support */ 10182 u16 softmac_features; 10183- 10184+ 10185 /* if the sequence control field is not filled by HW */ 10186 u16 seq_ctrl; 10187- 10188+ 10189 /* association procedure transaction sequence number */ 10190 u16 associate_seq; 10191- 10192+ 10193 /* AID for RTXed association responses */ 10194 u16 assoc_id; 10195- 10196+ 10197 /* power save mode related*/ 10198 short ps; 10199 short sta_sleep; 10200@@ -970,147 +986,153 @@ 10201 struct tasklet_struct ps_task; 10202 u32 ps_th; 10203 u32 ps_tl; 10204- 10205+ 10206 short raw_tx; 10207 /* used if IEEE_SOFTMAC_TX_QUEUE is set */ 10208 short queue_stop; 10209 short scanning; 10210 short proto_started; 10211- 10212+ 10213 struct semaphore wx_sem; 10214 struct semaphore scan_sem; 10215- 10216- spinlock_t mgmt_tx_lock; 10217+ 10218+ spinlock_t mgmt_tx_lock; 10219 spinlock_t beacon_lock; 10220 10221 short beacon_txing; 10222 10223 short wap_set; 10224 short ssid_set; 10225- 10226+ 10227 /* for discarding duplicated packets in IBSS */ 10228 struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE]; 10229- 10230+ 10231 /* for discarding duplicated packets in BSS */ 10232 u16 last_seq_num; 10233 u16 last_frag_num; 10234 unsigned long last_packet_time; 10235- 10236+ 10237 /* for PS mode */ 10238 unsigned long last_rx_ps_time; 10239- 10240+ 10241 /* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */ 10242 struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM]; 10243 int mgmt_queue_head; 10244 int mgmt_queue_tail; 10245- 10246- 10247+ 10248+ 10249 /* used if IEEE_SOFTMAC_TX_QUEUE is set */ 10250 struct tx_pending_t tx_pending; 10251- 10252+ 10253 /* used if IEEE_SOFTMAC_ASSOCIATE is set */ 10254 struct timer_list associate_timer; 10255 10256 /* used if IEEE_SOFTMAC_BEACONS is set */ 10257 struct timer_list beacon_timer; 10258- 10259+ 10260 struct work_struct associate_complete_wq; 10261+ 10262+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) 10263+ struct delayed_work associate_retry_wq; 10264+ struct delayed_work softmac_scan_wq; 10265+#else 10266 struct work_struct associate_retry_wq; 10267+ struct work_struct softmac_scan_wq; 10268+#endif 10269 struct work_struct start_ibss_wq; 10270 struct work_struct associate_procedure_wq; 10271- struct work_struct softmac_scan_wq; 10272 struct work_struct wx_sync_scan_wq; 10273- 10274+ 10275 struct workqueue_struct *wq; 10276 /* Callback functions */ 10277 void (*set_security)(struct net_device *dev, 10278 struct ieee80211_security *sec); 10279- 10280+ 10281 /* Used to TX data frame by using txb structs. 10282 * this is not used if in the softmac_features 10283 * is set the flag IEEE_SOFTMAC_TX_QUEUE 10284 */ 10285 int (*hard_start_xmit)(struct ieee80211_txb *txb, 10286 struct net_device *dev); 10287- 10288+ 10289 int (*reset_port)(struct net_device *dev); 10290 10291- /* Softmac-generated frames (mamagement) are TXed via this 10292- * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is 10293- * not set. As some cards may have different HW queues that 10294+ /* Softmac-generated frames (mamagement) are TXed via this 10295+ * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is 10296+ * not set. As some cards may have different HW queues that 10297 * one might want to use for data and management frames 10298 * the option to have two callbacks might be useful. 10299 * This fucntion can't sleep. 10300 */ 10301 int (*softmac_hard_start_xmit)(struct sk_buff *skb, 10302 struct net_device *dev); 10303- 10304+ 10305 /* used instead of hard_start_xmit (not softmac_hard_start_xmit) 10306 * if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data 10307 * frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set 10308 * then also management frames are sent via this callback. 10309 * This function can't sleep. 10310- */ 10311+ */ 10312 void (*softmac_data_hard_start_xmit)(struct sk_buff *skb, 10313 struct net_device *dev,int rate); 10314 10315 /* stops the HW queue for DATA frames. Useful to avoid 10316 * waste time to TX data frame when we are reassociating 10317 * This function can sleep. 10318- */ 10319+ */ 10320 void (*data_hard_stop)(struct net_device *dev); 10321- 10322+ 10323 /* OK this is complementar to data_poll_hard_stop */ 10324 void (*data_hard_resume)(struct net_device *dev); 10325- 10326+ 10327 /* ask to the driver to retune the radio . 10328 * This function can sleep. the driver should ensure 10329 * the radio has been swithced before return. 10330 */ 10331 void (*set_chan)(struct net_device *dev,short ch); 10332- 10333+ 10334 /* These are not used if the ieee stack takes care of 10335- * scanning (IEEE_SOFTMAC_SCAN feature set). 10336+ * scanning (IEEE_SOFTMAC_SCAN feature set). 10337 * In this case only the set_chan is used. 10338 * 10339 * The syncro version is similar to the start_scan but 10340 * does not return until all channels has been scanned. 10341- * this is called in user context and should sleep, 10342+ * this is called in user context and should sleep, 10343 * it is called in a work_queue when swithcing to ad-hoc mode 10344- * or in behalf of iwlist scan when the card is associated 10345- * and root user ask for a scan. 10346+ * or in behalf of iwlist scan when the card is associated 10347+ * and root user ask for a scan. 10348 * the fucntion stop_scan should stop both the syncro and 10349 * background scanning and can sleep. 10350- * The fucntion start_scan should initiate the background 10351+ * The fucntion start_scan should initiate the background 10352 * scanning and can't sleep. 10353- */ 10354+ */ 10355 void (*scan_syncro)(struct net_device *dev); 10356 void (*start_scan)(struct net_device *dev); 10357 void (*stop_scan)(struct net_device *dev); 10358- 10359+ 10360 /* indicate the driver that the link state is changed 10361 * for example it may indicate the card is associated now. 10362- * Driver might be interested in this to apply RX filter 10363- * rules or simply light the LINK led 10364+ * Driver might be interested in this to apply RX filter 10365+ * rules or simply light the LINK led 10366 */ 10367 void (*link_change)(struct net_device *dev); 10368- 10369+ 10370 /* these two function indicates to the HW when to start 10371- * and stop to send beacons. This is used when the 10372+ * and stop to send beacons. This is used when the 10373 * IEEE_SOFTMAC_BEACONS is not set. For now the 10374 * stop_send_bacons is NOT guaranteed to be called only 10375 * after start_send_beacons. 10376 */ 10377 void (*start_send_beacons) (struct net_device *dev); 10378 void (*stop_send_beacons) (struct net_device *dev); 10379- 10380+ 10381 /* power save mode related */ 10382 void (*sta_wake_up) (struct net_device *dev); 10383 void (*ps_request_tx_ack) (struct net_device *dev); 10384 void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl); 10385 short (*ps_is_queue_empty) (struct net_device *dev); 10386- 10387- 10388+ 10389+ 10390 /* This must be the last item so that it points to the data 10391 * allocated beyond this structure by alloc_ieee80211 */ 10392 u8 priv[0]; 10393@@ -1148,18 +1170,21 @@ 10394 #define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8) 10395 10396 /* Generate beacons. The stack will enqueue beacons 10397- * to the card 10398- */ 10399+ * to the card 10400+ */ 10401 #define IEEE_SOFTMAC_BEACONS (1<<6) 10402 10403 10404- 10405-extern inline void *ieee80211_priv(struct net_device *dev) 10406+#if WIRELESS_EXT >= 22 10407+static inline void *ieee80211_priv_rtl7(struct net_device *dev) 10408+#else 10409+extern inline void *ieee80211_priv_rtl7(struct net_device *dev) 10410+#endif 10411 { 10412 return ((struct ieee80211_device *)netdev_priv(dev))->priv; 10413 } 10414 10415-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) 10416+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len) 10417 { 10418 /* Single white space is for Linksys APs */ 10419 if (essid_len == 1 && essid[0] == ' ') 10420@@ -1175,7 +1200,7 @@ 10421 return 1; 10422 } 10423 10424-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode) 10425+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode) 10426 { 10427 /* 10428 * It is possible for both access points and our device to support 10429@@ -1201,7 +1226,7 @@ 10430 return 0; 10431 } 10432 10433-extern inline int ieee80211_get_hdrlen(u16 fc) 10434+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc) 10435 { 10436 int hdrlen = 24; 10437 10438@@ -1229,140 +1254,144 @@ 10439 10440 10441 /* ieee80211.c */ 10442-extern void free_ieee80211(struct net_device *dev); 10443-extern struct net_device *alloc_ieee80211(int sizeof_priv); 10444+extern void free_ieee80211_rtl7(struct net_device *dev); 10445+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv); 10446 10447-extern int ieee80211_set_encryption(struct ieee80211_device *ieee); 10448+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee); 10449 10450 /* ieee80211_tx.c */ 10451 10452-extern int ieee80211_encrypt_fragment( 10453+extern int ieee80211_encrypt_fragment_rtl7( 10454 struct ieee80211_device *ieee, 10455 struct sk_buff *frag, 10456 int hdr_len); 10457- 10458-extern int ieee80211_xmit(struct sk_buff *skb, 10459+ 10460+extern int ieee80211_xmit_rtl7(struct sk_buff *skb, 10461 struct net_device *dev); 10462-extern void ieee80211_txb_free(struct ieee80211_txb *); 10463+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *); 10464 10465 10466 /* ieee80211_rx.c */ 10467-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, 10468+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, 10469 struct ieee80211_rx_stats *rx_stats); 10470-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, 10471+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee, 10472 struct ieee80211_hdr *header, 10473 struct ieee80211_rx_stats *stats); 10474 10475 /* ieee80211_wx.c */ 10476-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee, 10477+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee, 10478 struct iw_request_info *info, 10479 union iwreq_data *wrqu, char *key); 10480-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee, 10481+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee, 10482 struct iw_request_info *info, 10483 union iwreq_data *wrqu, char *key); 10484-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee, 10485+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee, 10486 struct iw_request_info *info, 10487 union iwreq_data *wrqu, char *key); 10488 /* ieee80211_softmac.c */ 10489-extern short ieee80211_is_54g(struct ieee80211_network net); 10490-extern short ieee80211_is_shortslot(struct ieee80211_network net); 10491-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, 10492+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net); 10493+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net); 10494+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, 10495 struct ieee80211_rx_stats *rx_stats, u16 type, 10496 u16 stype); 10497-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net); 10498+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net); 10499 10500-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee); 10501-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee); 10502-extern void ieee80211_start_bss(struct ieee80211_device *ieee); 10503-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee); 10504-extern void ieee80211_start_ibss(struct ieee80211_device *ieee); 10505-extern void ieee80211_softmac_init(struct ieee80211_device *ieee); 10506-extern void ieee80211_softmac_free(struct ieee80211_device *ieee); 10507-extern void ieee80211_associate_abort(struct ieee80211_device *ieee); 10508-extern void ieee80211_disassociate(struct ieee80211_device *ieee); 10509-extern void ieee80211_stop_scan(struct ieee80211_device *ieee); 10510-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee); 10511-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee); 10512-extern void ieee80211_start_protocol(struct ieee80211_device *ieee); 10513-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee); 10514-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee); 10515-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee); 10516-extern void ieee80211_reset_queue(struct ieee80211_device *ieee); 10517-extern void ieee80211_wake_queue(struct ieee80211_device *ieee); 10518-extern void ieee80211_stop_queue(struct ieee80211_device *ieee); 10519-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee); 10520-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee); 10521-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee); 10522-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p); 10523-extern void notify_wx_assoc_event(struct ieee80211_device *ieee); 10524-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success); 10525+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee); 10526+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee); 10527+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee); 10528+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee); 10529+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee); 10530+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee); 10531+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee); 10532+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee); 10533+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee); 10534+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee); 10535+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee); 10536+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee); 10537+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee); 10538+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee); 10539+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee); 10540+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee); 10541+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee); 10542+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee); 10543+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee); 10544+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee); 10545+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee); 10546+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee); 10547+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p); 10548+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee); 10549+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success); 10550 10551 /* ieee80211_softmac_wx.c */ 10552 10553-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee, 10554- struct iw_request_info *info, 10555+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee, 10556+ struct iw_request_info *info, 10557 union iwreq_data *wrqu, char *ext); 10558- 10559-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee, 10560+ 10561+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee, 10562 struct iw_request_info *info, 10563 union iwreq_data *awrq, 10564 char *extra); 10565- 10566-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b); 10567 10568-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee, 10569+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b); 10570+ 10571+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee, 10572 struct iw_request_info *info, 10573 union iwreq_data *wrqu, char *extra); 10574- 10575-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee, 10576- struct iw_request_info *info, 10577+ 10578+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee, 10579+ struct iw_request_info *info, 10580 union iwreq_data *wrqu, char *extra); 10581- 10582-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a, 10583+ 10584+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a, 10585 union iwreq_data *wrqu, char *b); 10586- 10587-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a, 10588+ 10589+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a, 10590 union iwreq_data *wrqu, char *b); 10591- 10592-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee, 10593+ 10594+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee, 10595 struct iw_request_info *a, 10596 union iwreq_data *wrqu, char *extra); 10597- 10598-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a, 10599+ 10600+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a, 10601 union iwreq_data *wrqu, char *b); 10602 10603-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a, 10604+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a, 10605 union iwreq_data *wrqu, char *b); 10606 10607-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a, 10608+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a, 10609 union iwreq_data *wrqu, char *b); 10610 10611-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee); 10612+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) 10613+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work); 10614+#else 10615+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee); 10616+#endif 10617 10618-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, 10619- struct iw_request_info *info, 10620+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee, 10621+ struct iw_request_info *info, 10622 union iwreq_data *wrqu, char *extra); 10623- 10624-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee, 10625- struct iw_request_info *info, 10626+ 10627+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee, 10628+ struct iw_request_info *info, 10629 union iwreq_data *wrqu, char *extra); 10630 10631-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee, 10632+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee, 10633 struct iw_request_info *info, 10634 union iwreq_data *wrqu, char *extra); 10635 10636-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee, 10637+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee, 10638 struct iw_request_info *info, 10639 union iwreq_data *wrqu, char *extra); 10640- 10641-extern const long ieee80211_wlan_frequencies[]; 10642 10643-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee) 10644+extern const long ieee80211_wlan_frequencies_rtl7[]; 10645+ 10646+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee) 10647 { 10648 ieee->scans++; 10649 } 10650 10651-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee) 10652+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee) 10653 { 10654 return ieee->scans; 10655 } 10656@@ -1372,7 +1401,7 @@ 10657 const char *s = essid; 10658 char *d = escaped; 10659 10660- if (ieee80211_is_empty_essid(essid, essid_len)) { 10661+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) { 10662 memcpy(escaped, "<hidden>", sizeof("<hidden>")); 10663 return escaped; 10664 } 10665@@ -1390,4 +1419,5 @@ 10666 *d = '\0'; 10667 return escaped; 10668 } 10669+ 10670 #endif /* IEEE80211_H */ 10671diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_module.c rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_module.c 10672--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_module.c 2006-06-05 19:58:00.000000000 -0700 10673+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_module.c 2010-05-19 22:22:09.069343493 -0700 10674@@ -31,7 +31,6 @@ 10675 *******************************************************************************/ 10676 10677 #include <linux/compiler.h> 10678-#include <linux/config.h> 10679 #include <linux/errno.h> 10680 #include <linux/if_arp.h> 10681 #include <linux/in6.h> 10682@@ -52,6 +51,12 @@ 10683 #include <asm/uaccess.h> 10684 #include <net/arp.h> 10685 10686+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 10687+#include <linux/config.h> 10688+#else 10689+//#include <linux/autoconf.h> 10690+#endif 10691+ 10692 #include "ieee80211.h" 10693 10694 MODULE_DESCRIPTION("802.11 data/management/control stack"); 10695@@ -60,7 +65,7 @@ 10696 10697 #define DRV_NAME "ieee80211" 10698 10699-static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee) 10700+static inline int ieee80211_networks_allocate_rtl7(struct ieee80211_device *ieee) 10701 { 10702 if (ieee->networks) 10703 return 0; 10704@@ -80,7 +85,7 @@ 10705 return 0; 10706 } 10707 10708-static inline void ieee80211_networks_free(struct ieee80211_device *ieee) 10709+static inline void ieee80211_networks_free_rtl7(struct ieee80211_device *ieee) 10710 { 10711 if (!ieee->networks) 10712 return; 10713@@ -88,7 +93,7 @@ 10714 ieee->networks = NULL; 10715 } 10716 10717-static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee) 10718+static inline void ieee80211_networks_initialize_rtl7(struct ieee80211_device *ieee) 10719 { 10720 int i; 10721 10722@@ -99,7 +104,7 @@ 10723 } 10724 10725 10726-struct net_device *alloc_ieee80211(int sizeof_priv) 10727+struct net_device *alloc_ieee80211_rtl7(int sizeof_priv) 10728 { 10729 struct ieee80211_device *ieee; 10730 struct net_device *dev; 10731@@ -112,18 +117,22 @@ 10732 IEEE80211_ERROR("Unable to network device.\n"); 10733 goto failed; 10734 } 10735+ 10736+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) 10737 ieee = netdev_priv(dev); 10738- dev->hard_start_xmit = ieee80211_xmit; 10739+#else 10740+ ieee = (struct ieee80211_device *)dev->priv; 10741+#endif 10742 10743 ieee->dev = dev; 10744 10745- err = ieee80211_networks_allocate(ieee); 10746+ err = ieee80211_networks_allocate_rtl7(ieee); 10747 if (err) { 10748 IEEE80211_ERROR("Unable to allocate beacon storage: %d\n", 10749 err); 10750 goto failed; 10751 } 10752- ieee80211_networks_initialize(ieee); 10753+ ieee80211_networks_initialize_rtl7(ieee); 10754 10755 /* Default fragmentation threshold is maximum payload size */ 10756 ieee->fts = DEFAULT_FTS; 10757@@ -138,7 +147,7 @@ 10758 INIT_LIST_HEAD(&ieee->crypt_deinit_list); 10759 init_timer(&ieee->crypt_deinit_timer); 10760 ieee->crypt_deinit_timer.data = (unsigned long)ieee; 10761- ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler; 10762+ ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler_rtl7; 10763 10764 spin_lock_init(&ieee->lock); 10765 10766@@ -149,7 +158,7 @@ 10767 ieee->ieee802_1x = 1; 10768 ieee->raw_tx = 0; 10769 10770- ieee80211_softmac_init(ieee); 10771+ ieee80211_softmac_init_rtl7(ieee); 10772 10773 for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) 10774 INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]); 10775@@ -167,7 +176,7 @@ 10776 } 10777 10778 10779-void free_ieee80211(struct net_device *dev) 10780+void free_ieee80211_rtl7(struct net_device *dev) 10781 { 10782 struct ieee80211_device *ieee = netdev_priv(dev); 10783 10784@@ -175,9 +184,9 @@ 10785 struct list_head *p, *q; 10786 10787 10788- ieee80211_softmac_free(ieee); 10789+ ieee80211_softmac_free_rtl7(ieee); 10790 del_timer_sync(&ieee->crypt_deinit_timer); 10791- ieee80211_crypt_deinit_entries(ieee, 1); 10792+ ieee80211_crypt_deinit_entries_rtl7(ieee, 1); 10793 10794 for (i = 0; i < WEP_KEYS; i++) { 10795 struct ieee80211_crypt_data *crypt = ieee->crypt[i]; 10796@@ -191,7 +200,7 @@ 10797 } 10798 } 10799 10800- ieee80211_networks_free(ieee); 10801+ ieee80211_networks_free_rtl7(ieee); 10802 10803 for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) { 10804 list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) { 10805@@ -210,13 +219,13 @@ 10806 u32 ieee80211_debug_level = 0; 10807 struct proc_dir_entry *ieee80211_proc = NULL; 10808 10809-static int show_debug_level(char *page, char **start, off_t offset, 10810+static int show_debug_level_rtl7(char *page, char **start, off_t offset, 10811 int count, int *eof, void *data) 10812 { 10813 return snprintf(page, count, "0x%08X\n", ieee80211_debug_level); 10814 } 10815 10816-static int store_debug_level(struct file *file, const char *buffer, 10817+static int store_debug_level_rtl7(struct file *file, const char *buffer, 10818 unsigned long count, void *data) 10819 { 10820 char buf[] = "0x00000000"; 10821@@ -243,7 +252,7 @@ 10822 return strnlen(buf, count); 10823 } 10824 10825-static int __init ieee80211_init(void) 10826+static int __init ieee80211_init_rtl7(void) 10827 { 10828 struct proc_dir_entry *e; 10829 10830@@ -268,7 +277,7 @@ 10831 return 0; 10832 } 10833 10834-static void __exit ieee80211_exit(void) 10835+static void __exit ieee80211_exit_rtl7(void) 10836 { 10837 if (ieee80211_proc) { 10838 remove_proc_entry("debug_level", ieee80211_proc); 10839@@ -282,9 +291,9 @@ 10840 MODULE_PARM_DESC(debug, "debug output mask"); 10841 10842 10843-module_exit(ieee80211_exit); 10844-module_init(ieee80211_init); 10845+module_exit(ieee80211_exit_rtl7); 10846+module_init(ieee80211_init_rtl7); 10847 #endif 10848 10849-EXPORT_SYMBOL(alloc_ieee80211); 10850-EXPORT_SYMBOL(free_ieee80211); 10851+EXPORT_SYMBOL(alloc_ieee80211_rtl7); 10852+EXPORT_SYMBOL(free_ieee80211_rtl7); 10853diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_rx.c rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_rx.c 10854--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_rx.c 2006-06-05 19:58:00.000000000 -0700 10855+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_rx.c 2010-05-19 22:21:30.641869318 -0700 10856@@ -13,16 +13,15 @@ 10857 * more details. 10858 ****************************************************************************** 10859 10860- Few modifications for Realtek's Wi-Fi drivers by 10861+ Few modifications for Realtek's Wi-Fi drivers by 10862 Andrea Merello <andreamrl@tiscali.it> 10863- 10864- A special thanks goes to Realtek for their support ! 10865+ 10866+ A special thanks goes to Realtek for their support ! 10867 10868 ******************************************************************************/ 10869- 10870+ 10871 10872 #include <linux/compiler.h> 10873-#include <linux/config.h> 10874 #include <linux/errno.h> 10875 #include <linux/if_arp.h> 10876 #include <linux/in6.h> 10877@@ -43,18 +42,94 @@ 10878 #include <asm/uaccess.h> 10879 #include <linux/ctype.h> 10880 10881+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 10882+#include <linux/config.h> 10883+#else 10884+//#include <linux/autoconf.h> 10885+#endif 10886+ 10887+ 10888 #include "ieee80211.h" 10889 10890-static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee, 10891+static inline void ieee80211_monitor_rx_rtl7(struct ieee80211_device *ieee, 10892 struct sk_buff *skb, 10893 struct ieee80211_rx_stats *rx_stats) 10894 { 10895- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 10896- u16 fc = le16_to_cpu(hdr->frame_ctl); 10897+ struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data; 10898+ u16 fc = le16_to_cpu(hdr1->frame_ctl); 10899+ int prism_header; 10900+ int hdrlen, phdrlen, head_need, tail_need; 10901+ 10902+ if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) { 10903+ prism_header = 1; 10904+ phdrlen = sizeof(struct linux_wlan_ng_prism_hdr); 10905+ } else { 10906+ prism_header = 0; 10907+ phdrlen = 0; 10908+ } 10909+ 10910+ hdrlen = ieee80211_get_hdrlen_rtl7(fc); 10911+ 10912+ /* check if there is enough room for extra data; if not, expand skb 10913+ * buffer to be large enough for the changes */ 10914+ head_need = phdrlen; 10915+ tail_need = 0; 10916+#ifdef PRISM2_ADD_BOGUS_CRC 10917+ tail_need += 4; 10918+#endif /* PRISM2_ADD_BOGUS_CRC */ 10919+ 10920+ head_need -= skb_headroom(skb); 10921+ tail_need -= skb_tailroom(skb); 10922+ 10923+ if (head_need > 0 || tail_need > 0) { 10924+ if (pskb_expand_head(skb, head_need > 0 ? head_need : 0, 10925+ tail_need > 0 ? tail_need : 0, 10926+ GFP_ATOMIC)) { 10927+ printk(KERN_DEBUG "%s: ieee80211_rx failed to " 10928+ "reallocate skb buffer\n", ieee->dev->name); 10929+ dev_kfree_skb_any(skb); 10930+ return; 10931+ } 10932+ } 10933+ 10934+ if (prism_header == 1) { 10935+ struct linux_wlan_ng_prism_hdr *hdr; 10936+ hdr = (struct linux_wlan_ng_prism_hdr *) 10937+ skb_push(skb, phdrlen); 10938+ memset(hdr, 0, phdrlen); 10939+ hdr->msgcode = LWNG_CAP_DID_BASE; 10940+ hdr->msglen = sizeof(*hdr); 10941+ memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname)); 10942+#define LWNG_SETVAL(f,i,s,l,d) \ 10943+hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \ 10944+hdr->f.status = s; hdr->f.len = l; hdr->f.data = d 10945+ LWNG_SETVAL(hosttime, 1, 0, 4, jiffies); 10946+ 10947+ hdr->mactime.did = LWNG_CAP_DID_BASE | (2 << 12); 10948+ hdr->mactime.status = 0; 10949+ hdr->mactime.len = 4; 10950+ hdr->mactime.data = rx_stats->mac_time[0]; 10951+ 10952+ LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0); 10953+ LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0); 10954+ LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0); 10955+ LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal); 10956+ LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise); 10957+ LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5); 10958+ LWNG_SETVAL(istx, 9, 0, 4, 0); 10959+ LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen); 10960+#undef LWNG_SETVAL 10961+ } 10962 10963 skb->dev = ieee->dev; 10964+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)) 10965 skb->mac.raw = skb->data; 10966- skb_pull(skb, ieee80211_get_hdrlen(fc)); 10967+#else 10968+ skb_reset_mac_header(skb); 10969+#endif 10970+ skb_pull(skb, hdrlen); 10971+ if (prism_header) 10972+ skb_pull(skb, phdrlen); 10973 skb->pkt_type = PACKET_OTHERHOST; 10974 skb->protocol = __constant_htons(ETH_P_80211_RAW); 10975 memset(skb->cb, 0, sizeof(skb->cb)); 10976@@ -64,7 +139,7 @@ 10977 10978 /* Called only as a tasklet (software IRQ) */ 10979 static struct ieee80211_frag_entry * 10980-ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq, 10981+ieee80211_frag_cache_find_rtl7(struct ieee80211_device *ieee, unsigned int seq, 10982 unsigned int frag, u8 *src, u8 *dst) 10983 { 10984 struct ieee80211_frag_entry *entry; 10985@@ -94,7 +169,7 @@ 10986 10987 /* Called only as a tasklet (software IRQ) */ 10988 static struct sk_buff * 10989-ieee80211_frag_cache_get(struct ieee80211_device *ieee, 10990+ieee80211_frag_cache_get_rtl7(struct ieee80211_device *ieee, 10991 struct ieee80211_hdr *hdr) 10992 { 10993 struct sk_buff *skb = NULL; 10994@@ -133,7 +208,7 @@ 10995 } else { 10996 /* received a fragment of a frame for which the head fragment 10997 * should have already been received */ 10998- entry = ieee80211_frag_cache_find(ieee, seq, frag, hdr->addr2, 10999+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, frag, hdr->addr2, 11000 hdr->addr1); 11001 if (entry != NULL) { 11002 entry->last_frag = frag; 11003@@ -146,7 +221,7 @@ 11004 11005 11006 /* Called only as a tasklet (software IRQ) */ 11007-static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee, 11008+static int ieee80211_frag_cache_invalidate_rtl7(struct ieee80211_device *ieee, 11009 struct ieee80211_hdr *hdr) 11010 { 11011 u16 sc; 11012@@ -156,7 +231,7 @@ 11013 sc = le16_to_cpu(hdr->seq_ctl); 11014 seq = WLAN_GET_SEQ_SEQ(sc); 11015 11016- entry = ieee80211_frag_cache_find(ieee, seq, -1, hdr->addr2, 11017+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, -1, hdr->addr2, 11018 hdr->addr1); 11019 11020 if (entry == NULL) { 11021@@ -178,7 +253,7 @@ 11022 * 11023 * Called by ieee80211_rx */ 11024 static inline int 11025-ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb, 11026+ieee80211_rx_frame_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, 11027 struct ieee80211_rx_stats *rx_stats, u16 type, 11028 u16 stype) 11029 { 11030@@ -187,13 +262,13 @@ 11031 * response parser uses it 11032 */ 11033 rx_stats->len = skb->len; 11034- ieee80211_rx_mgt(ieee,(struct ieee80211_hdr *)skb->data,rx_stats); 11035- ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype); 11036+ ieee80211_rx_mgt_rtl7(ieee,(struct ieee80211_hdr *)skb->data,rx_stats); 11037+ ieee80211_rx_frame_softmac_rtl7(ieee, skb, rx_stats, type, stype); 11038 11039 dev_kfree_skb_any(skb); 11040- 11041+ 11042 return 0; 11043- 11044+ 11045 #ifdef NOT_YET 11046 if (ieee->iw_mode == IW_MODE_MASTER) { 11047 printk(KERN_DEBUG "%s: Master mode not yet suppported.\n", 11048@@ -253,7 +328,7 @@ 11049 /* No encapsulation header if EtherType < 0x600 (=length) */ 11050 11051 /* Called by ieee80211_rx_frame_decrypt */ 11052-static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee, 11053+static int ieee80211_is_eapol_frame_rtl7(struct ieee80211_device *ieee, 11054 struct sk_buff *skb) 11055 { 11056 struct net_device *dev = ieee->dev; 11057@@ -294,7 +369,7 @@ 11058 11059 /* Called only as a tasklet (software IRQ), by ieee80211_rx */ 11060 static inline int 11061-ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb, 11062+ieee80211_rx_frame_decrypt_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb, 11063 struct ieee80211_crypt_data *crypt) 11064 { 11065 struct ieee80211_hdr *hdr; 11066@@ -304,7 +379,7 @@ 11067 return 0; 11068 11069 hdr = (struct ieee80211_hdr *) skb->data; 11070- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); 11071+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl)); 11072 11073 #ifdef CONFIG_IEEE80211_CRYPT_TKIP 11074 if (ieee->tkip_countermeasures && 11075@@ -339,7 +414,7 @@ 11076 11077 /* Called only as a tasklet (software IRQ), by ieee80211_rx */ 11078 static inline int 11079-ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb, 11080+ieee80211_rx_frame_decrypt_msdu_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb, 11081 int keyidx, struct ieee80211_crypt_data *crypt) 11082 { 11083 struct ieee80211_hdr *hdr; 11084@@ -349,7 +424,7 @@ 11085 return 0; 11086 11087 hdr = (struct ieee80211_hdr *) skb->data; 11088- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); 11089+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl)); 11090 11091 atomic_inc(&crypt->refcnt); 11092 res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv); 11093@@ -367,7 +442,7 @@ 11094 11095 /* this function is stolen from ipw2200 driver*/ 11096 #define IEEE_PACKET_RETRY_TIME (5*HZ) 11097-static int is_duplicate_packet(struct ieee80211_device *ieee, 11098+static int is_duplicate_packet_rtl7(struct ieee80211_device *ieee, 11099 struct ieee80211_hdr *header) 11100 { 11101 // u16 fc = le16_to_cpu(header->frame_ctl); 11102@@ -413,7 +488,7 @@ 11103 last_seq = &ieee->last_seq_num; 11104 last_frag = &ieee->last_frag_num; 11105 last_time = &ieee->last_packet_time; 11106- 11107+ 11108 break; 11109 default: 11110 return 0; 11111@@ -436,7 +511,7 @@ 11112 drop: 11113 // BUG_ON(!(fc & IEEE80211_FCTL_RETRY)); 11114 // printk("DUP\n"); 11115- 11116+ 11117 return 1; 11118 } 11119 11120@@ -444,7 +519,7 @@ 11121 /* All received frames are sent to this function. @skb contains the frame in 11122 * IEEE 802.11 format, i.e., in the format it was sent over air. 11123 * This function is called only as a tasklet (software IRQ). */ 11124-int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, 11125+int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, 11126 struct ieee80211_rx_stats *rx_stats) 11127 { 11128 struct net_device *dev = ieee->dev; 11129@@ -481,9 +556,9 @@ 11130 type = WLAN_FC_GET_TYPE(fc); 11131 stype = WLAN_FC_GET_STYPE(fc); 11132 sc = le16_to_cpu(hdr->seq_ctl); 11133- 11134+ 11135 frag = WLAN_GET_SEQ_FRAG(sc); 11136- hdrlen = ieee80211_get_hdrlen(fc); 11137+ hdrlen = ieee80211_get_hdrlen_rtl7(fc); 11138 11139 #ifdef NOT_YET 11140 #if WIRELESS_EXT > 15 11141@@ -501,12 +576,12 @@ 11142 } 11143 #endif /* IW_WIRELESS_SPY */ 11144 #endif /* WIRELESS_EXT > 15 */ 11145- hostap_update_rx_stats(local->ap, hdr, rx_stats); 11146+ hostap_update_rx_stats_rtl7(local->ap, hdr, rx_stats); 11147 #endif 11148 11149 #if WIRELESS_EXT > 15 11150 if (ieee->iw_mode == IW_MODE_MONITOR) { 11151- ieee80211_monitor_rx(ieee, skb, rx_stats); 11152+ ieee80211_monitor_rx_rtl7(ieee, skb, rx_stats); 11153 stats->rx_packets++; 11154 stats->rx_bytes += skb->len; 11155 return 1; 11156@@ -529,7 +604,7 @@ 11157 * stations that do not support WEP key mapping). */ 11158 11159 if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key) 11160- (void) hostap_handle_sta_crypto(local, hdr, &crypt, 11161+ (void) hostap_handle_sta_crypto_rtl7(local, hdr, &crypt, 11162 &sta); 11163 #endif 11164 11165@@ -555,7 +630,7 @@ 11166 if (skb->len < IEEE80211_DATA_HDR3_LEN) 11167 goto rx_dropped; 11168 11169- if (is_duplicate_packet(ieee, hdr)) 11170+ if (is_duplicate_packet_rtl7(ieee, hdr)) 11171 goto rx_dropped; 11172 11173 11174@@ -573,9 +648,9 @@ 11175 goto rx_dropped; 11176 } 11177 #endif 11178- 11179- 11180- if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype)) 11181+ 11182+ 11183+ if (ieee80211_rx_frame_mgmt_rtl7(ieee, skb, rx_stats, type, stype)) 11184 goto rx_dropped; 11185 else 11186 goto rx_exit; 11187@@ -583,7 +658,7 @@ 11188 11189 11190 /* Data frame - extract src/dst addresses */ 11191- 11192+ 11193 switch (fc & (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) { 11194 case IEEE80211_FCTL_FROMDS: 11195 memcpy(dst, hdr->addr1, ETH_ALEN); 11196@@ -606,7 +681,7 @@ 11197 } 11198 11199 #ifdef NOT_YET 11200- if (hostap_rx_frame_wds(ieee, hdr, fc, &wds)) 11201+ if (hostap_rx_frame_wds_rtl7(ieee, hdr, fc, &wds)) 11202 goto rx_dropped; 11203 if (wds) { 11204 skb->dev = dev = wds; 11205@@ -619,7 +694,7 @@ 11206 memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) { 11207 /* Frame from BSSID of the AP for which we are a client */ 11208 skb->dev = dev = ieee->stadev; 11209- stats = hostap_get_stats(dev); 11210+ stats = hostap_get_stats_rtl7(dev); 11211 from_assoc_ap = 1; 11212 } 11213 #endif 11214@@ -630,7 +705,7 @@ 11215 if ((ieee->iw_mode == IW_MODE_MASTER || 11216 ieee->iw_mode == IW_MODE_REPEAT) && 11217 !from_assoc_ap) { 11218- switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats, 11219+ switch (hostap_handle_sta_rx_rtl7(ieee, dev, skb, rx_stats, 11220 wds != NULL)) { 11221 case AP_RX_CONTINUE_NOT_AUTHORIZED: 11222 frame_authorized = 0; 11223@@ -664,7 +739,7 @@ 11224 /* skb: hdr + (possibly fragmented, possibly encrypted) payload */ 11225 11226 if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) && 11227- (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0) 11228+ (keyidx = ieee80211_rx_frame_decrypt_rtl7(ieee, skb, crypt)) < 0) 11229 goto rx_dropped; 11230 11231 hdr = (struct ieee80211_hdr *) skb->data; 11232@@ -674,7 +749,7 @@ 11233 // ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) && 11234 if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) { 11235 int flen; 11236- struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr); 11237+ struct sk_buff *frag_skb = ieee80211_frag_cache_get_rtl7(ieee, hdr); 11238 IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag); 11239 11240 if (!frag_skb) { 11241@@ -694,7 +769,7 @@ 11242 printk(KERN_WARNING "%s: host decrypted and " 11243 "reassembled frame did not fit skb\n", 11244 dev->name); 11245- ieee80211_frag_cache_invalidate(ieee, hdr); 11246+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr); 11247 goto rx_dropped; 11248 } 11249 11250@@ -722,19 +797,19 @@ 11251 * delivered, so remove skb from fragment cache */ 11252 skb = frag_skb; 11253 hdr = (struct ieee80211_hdr *) skb->data; 11254- ieee80211_frag_cache_invalidate(ieee, hdr); 11255+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr); 11256 } 11257 11258 /* skb: hdr + (possible reassembled) full MSDU payload; possibly still 11259 * encrypted/authenticated */ 11260 if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) && 11261- ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt)) 11262+ ieee80211_rx_frame_decrypt_msdu_rtl7(ieee, skb, keyidx, crypt)) 11263 goto rx_dropped; 11264 11265 hdr = (struct ieee80211_hdr *) skb->data; 11266 if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) { 11267 if (/*ieee->ieee802_1x &&*/ 11268- ieee80211_is_eapol_frame(ieee, skb)) { 11269+ ieee80211_is_eapol_frame_rtl7(ieee, skb)) { 11270 #ifdef CONFIG_IEEE80211_DEBUG 11271 /* pass unencrypted EAPOL frames even if encryption is 11272 * configured */ 11273@@ -763,7 +838,7 @@ 11274 #endif 11275 11276 if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep && 11277- !ieee80211_is_eapol_frame(ieee, skb)) { 11278+ !ieee80211_is_eapol_frame_rtl7(ieee, skb)) { 11279 IEEE80211_DEBUG_DROP( 11280 "dropped unencrypted RX data " 11281 "frame from " MAC_FMT 11282@@ -861,7 +936,12 @@ 11283 if (skb2 != NULL) { 11284 /* send to wireless media */ 11285 skb2->protocol = __constant_htons(ETH_P_802_3); 11286+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)) 11287 skb2->mac.raw = skb2->nh.raw = skb2->data; 11288+#else 11289+ skb_reset_mac_header(skb2); 11290+ skb_reset_network_header(skb2); 11291+#endif 11292 /* skb2->nh.raw = skb2->data + ETH_HLEN; */ 11293 skb2->dev = dev; 11294 dev_queue_xmit(skb2); 11295@@ -896,7 +976,7 @@ 11296 11297 #define MGMT_FRAME_FIXED_PART_LENGTH 0x24 11298 11299-static inline int ieee80211_is_ofdm_rate(u8 rate) 11300+static inline int ieee80211_is_ofdm_rate_rtl7(u8 rate) 11301 { 11302 switch (rate & ~IEEE80211_BASIC_RATE_MASK) { 11303 case IEEE80211_OFDM_RATE_6MB: 11304@@ -913,7 +993,7 @@ 11305 } 11306 11307 11308-static inline int ieee80211_network_init( 11309+static inline int ieee80211_network_init_rtl7( 11310 struct ieee80211_device *ieee, 11311 struct ieee80211_probe_response *beacon, 11312 struct ieee80211_network *network, 11313@@ -964,7 +1044,7 @@ 11314 11315 switch (info_element->id) { 11316 case MFIE_TYPE_SSID: 11317- if (ieee80211_is_empty_essid(info_element->data, 11318+ if (ieee80211_is_empty_essid_rtl7(info_element->data, 11319 info_element->len)) { 11320 network->flags |= NETWORK_EMPTY_ESSID; 11321 break; 11322@@ -991,7 +1071,7 @@ 11323 #ifdef CONFIG_IEEE80211_DEBUG 11324 p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]); 11325 #endif 11326- if (ieee80211_is_ofdm_rate(info_element->data[i])) { 11327+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) { 11328 network->flags |= NETWORK_HAS_OFDM; 11329 if (info_element->data[i] & 11330 IEEE80211_BASIC_RATE_MASK) 11331@@ -1014,7 +1094,7 @@ 11332 #ifdef CONFIG_IEEE80211_DEBUG 11333 p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]); 11334 #endif 11335- if (ieee80211_is_ofdm_rate(info_element->data[i])) { 11336+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) { 11337 network->flags |= NETWORK_HAS_OFDM; 11338 if (info_element->data[i] & 11339 IEEE80211_BASIC_RATE_MASK) 11340@@ -1043,47 +1123,47 @@ 11341 break; 11342 11343 case MFIE_TYPE_TIM: 11344- 11345- if(info_element->len < 4) 11346+ 11347+ if(info_element->len < 4) 11348 break; 11349- 11350+ 11351 network->dtim_period = info_element->data[1]; 11352- 11353+ 11354 if(ieee->state != IEEE80211_LINKED) 11355 break; 11356- 11357- network->last_dtim_sta_time[0] = stats->mac_time[0]; 11358+ 11359+ network->last_dtim_sta_time[0] = stats->mac_time[0]; 11360 network->last_dtim_sta_time[1] = stats->mac_time[1]; 11361- 11362+ 11363 network->dtim_data = IEEE80211_DTIM_VALID; 11364- 11365- if(info_element->data[0] != 0) 11366+ 11367+ if(info_element->data[0] != 0) 11368 break; 11369- 11370+ 11371 if(info_element->data[2] & 1) 11372 network->dtim_data |= IEEE80211_DTIM_MBCAST; 11373- 11374+ 11375 offset = (info_element->data[2] >> 1)*2; 11376- 11377- //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id); 11378- 11379- if(ieee->assoc_id < offset || 11380+ 11381+ //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id); 11382+ 11383+ if(ieee->assoc_id < offset || 11384 ieee->assoc_id > 8*(offset + info_element->len -3)) 11385- 11386+ 11387 break; 11388- 11389- 11390+ 11391+ 11392 offset = offset + ieee->assoc_id / 8;// + ((aid % 8)? 0 : 1) ; 11393- 11394- // printk("offset:%x data:%x, ucast:%d\n", offset, 11395+ 11396+ // printk("offset:%x data:%x, ucast:%d\n", offset, 11397 // info_element->data[3+offset] , 11398 // info_element->data[3+offset] & (1<<(ieee->assoc_id%8))); 11399- 11400+ 11401 if(info_element->data[3+offset] & (1<<(ieee->assoc_id%8))) 11402 network->dtim_data |= IEEE80211_DTIM_UCAST; 11403- 11404+ 11405 break; 11406- 11407+ 11408 case MFIE_TYPE_IBSS_SET: 11409 IEEE80211_DEBUG_SCAN("MFIE_TYPE_IBSS_SET: ignored\n"); 11410 break; 11411@@ -1115,7 +1195,7 @@ 11412 memcpy(network->rsn_ie, info_element, 11413 network->rsn_ie_len); 11414 break; 11415- 11416+ 11417 default: 11418 IEEE80211_DEBUG_SCAN("unsupported IE %d\n", 11419 info_element->id); 11420@@ -1147,7 +1227,7 @@ 11421 return 1; 11422 } 11423 11424- if (ieee80211_is_empty_essid(network->ssid, network->ssid_len)) 11425+ if (ieee80211_is_empty_essid_rtl7(network->ssid, network->ssid_len)) 11426 network->flags |= NETWORK_EMPTY_ESSID; 11427 11428 memcpy(&network->stats, stats, sizeof(network->stats)); 11429@@ -1155,24 +1235,24 @@ 11430 return 0; 11431 } 11432 11433-static inline int is_same_network(struct ieee80211_network *src, 11434+static inline int is_same_network_rtl7(struct ieee80211_network *src, 11435 struct ieee80211_network *dst) 11436 { 11437 /* A network is only a duplicate if the channel, BSSID, ESSID 11438- * and the capability field (in particular IBSS and BSS) all match. 11439+ * and the capability field (in particular IBSS and BSS) all match. 11440 * We treat all <hidden> with the same BSSID and channel 11441 * as one network */ 11442 return ((src->ssid_len == dst->ssid_len) && 11443 (src->channel == dst->channel) && 11444 !memcmp(src->bssid, dst->bssid, ETH_ALEN) && 11445 !memcmp(src->ssid, dst->ssid, src->ssid_len) && 11446- ((src->capability & WLAN_CAPABILITY_IBSS) == 11447+ ((src->capability & WLAN_CAPABILITY_IBSS) == 11448 (dst->capability & WLAN_CAPABILITY_IBSS)) && 11449- ((src->capability & WLAN_CAPABILITY_BSS) == 11450+ ((src->capability & WLAN_CAPABILITY_BSS) == 11451 (dst->capability & WLAN_CAPABILITY_BSS))); 11452 } 11453 11454-static inline void update_network(struct ieee80211_network *dst, 11455+static inline void update_network_rtl7(struct ieee80211_network *dst, 11456 struct ieee80211_network *src) 11457 { 11458 memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats)); 11459@@ -1194,7 +1274,7 @@ 11460 dst->dtim_data = src->dtim_data; 11461 dst->last_dtim_sta_time[0] = src->last_dtim_sta_time[0]; 11462 dst->last_dtim_sta_time[1] = src->last_dtim_sta_time[1]; 11463- 11464+ 11465 memcpy(dst->wpa_ie, src->wpa_ie, src->wpa_ie_len); 11466 dst->wpa_ie_len = src->wpa_ie_len; 11467 memcpy(dst->rsn_ie, src->rsn_ie, src->rsn_ie_len); 11468@@ -1204,7 +1284,7 @@ 11469 /* dst->last_associate is not overwritten */ 11470 } 11471 11472-static inline void ieee80211_process_probe_response( 11473+static inline void ieee80211_process_probe_response_rtl7( 11474 struct ieee80211_device *ieee, 11475 struct ieee80211_probe_response *beacon, 11476 struct ieee80211_rx_stats *stats) 11477@@ -1239,7 +1319,7 @@ 11478 (beacon->capability & (1<<0x1)) ? '1' : '0', 11479 (beacon->capability & (1<<0x0)) ? '1' : '0'); 11480 11481- if (ieee80211_network_init(ieee, beacon, &network, stats)) { 11482+ if (ieee80211_network_init_rtl7(ieee, beacon, &network, stats)) { 11483 IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n", 11484 escape_essid(info_element->data, 11485 info_element->len), 11486@@ -1261,12 +1341,12 @@ 11487 * already there. */ 11488 11489 spin_lock_irqsave(&ieee->lock, flags); 11490- 11491- if(is_same_network(&ieee->current_network, &network)) 11492- update_network(&ieee->current_network, &network); 11493- 11494+ 11495+ if(is_same_network_rtl7(&ieee->current_network, &network)) 11496+ update_network_rtl7(&ieee->current_network, &network); 11497+ 11498 list_for_each_entry(target, &ieee->network_list, list) { 11499- if (is_same_network(target, &network)) 11500+ if (is_same_network_rtl7(target, &network)) 11501 break; 11502 11503 if ((oldest == NULL) || 11504@@ -1306,7 +1386,7 @@ 11505 memcpy(target, &network, sizeof(*target)); 11506 list_add_tail(&target->list, &ieee->network_list); 11507 if(ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) 11508- ieee80211_softmac_new_net(ieee,&network); 11509+ ieee80211_softmac_new_net_rtl7(ieee,&network); 11510 } else { 11511 IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n", 11512 escape_essid(target->ssid, 11513@@ -1315,39 +1395,39 @@ 11514 WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == 11515 IEEE80211_STYPE_PROBE_RESP ? 11516 "PROBE RESPONSE" : "BEACON"); 11517- 11518+ 11519 /* we have an entry and we are going to update it. But this entry may 11520- * be already expired. In this case we do the same as we found a new 11521+ * be already expired. In this case we do the same as we found a new 11522 * net and call the new_net handler 11523 */ 11524 renew = !time_after(target->last_scanned + ieee->scan_age, jiffies); 11525- update_network(target, &network); 11526+ update_network_rtl7(target, &network); 11527 if(renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)) 11528- ieee80211_softmac_new_net(ieee,&network); 11529+ ieee80211_softmac_new_net_rtl7(ieee,&network); 11530 } 11531 11532 spin_unlock_irqrestore(&ieee->lock, flags); 11533 } 11534 11535-void ieee80211_rx_mgt(struct ieee80211_device *ieee, 11536+void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee, 11537 struct ieee80211_hdr *header, 11538 struct ieee80211_rx_stats *stats) 11539 { 11540 switch (WLAN_FC_GET_STYPE(header->frame_ctl)) { 11541- 11542+ 11543 case IEEE80211_STYPE_BEACON: 11544 IEEE80211_DEBUG_MGMT("received BEACON (%d)\n", 11545 WLAN_FC_GET_STYPE(header->frame_ctl)); 11546 IEEE80211_DEBUG_SCAN("Beacon\n"); 11547- ieee80211_process_probe_response( 11548+ ieee80211_process_probe_response_rtl7( 11549 ieee, (struct ieee80211_probe_response *)header, stats); 11550 break; 11551- 11552+ 11553 case IEEE80211_STYPE_PROBE_RESP: 11554 IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n", 11555 WLAN_FC_GET_STYPE(header->frame_ctl)); 11556 IEEE80211_DEBUG_SCAN("Probe response\n"); 11557- ieee80211_process_probe_response( 11558+ ieee80211_process_probe_response_rtl7( 11559 ieee, (struct ieee80211_probe_response *)header, stats); 11560 break; 11561 11562@@ -1355,5 +1435,5 @@ 11563 } 11564 11565 11566-EXPORT_SYMBOL(ieee80211_rx_mgt); 11567-EXPORT_SYMBOL(ieee80211_rx); 11568+EXPORT_SYMBOL(ieee80211_rx_mgt_rtl7); 11569+EXPORT_SYMBOL(ieee80211_rx_rtl7); 11570diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac.c rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_softmac.c 11571--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac.c 2006-06-18 18:27:33.000000000 -0700 11572+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_softmac.c 2010-05-19 22:18:51.969358999 -0700 11573@@ -1,14 +1,14 @@ 11574 /* IEEE 802.11 SoftMAC layer 11575 * Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it> 11576 * 11577- * Mostly extracted from the rtl8180-sa2400 driver for the 11578+ * Mostly extracted from the rtl8180-sa2400 driver for the 11579 * in-kernel generic ieee802.11 stack. 11580 * 11581 * Few lines might be stolen from other part of the ieee80211 11582 * stack. Copyright who own it's copyright 11583 * 11584 * WPA code stolen from the ipw2200 driver. 11585- * Copyright who own it's copyright. 11586+ * Copyright who own it's copyright. 11587 * 11588 * released under the GPL 11589 */ 11590@@ -20,12 +20,12 @@ 11591 #include <linux/delay.h> 11592 #include <linux/version.h> 11593 11594-short ieee80211_is_54g(struct ieee80211_network net) 11595+short ieee80211_is_54g_rtl7(struct ieee80211_network net) 11596 { 11597 return ((net.rates_ex_len > 0) || (net.rates_len > 4)); 11598 } 11599 11600-short ieee80211_is_shortslot(struct ieee80211_network net) 11601+short ieee80211_is_shortslot_rtl7(struct ieee80211_network net) 11602 { 11603 return (net.capability & WLAN_CAPABILITY_SHORT_SLOT); 11604 } 11605@@ -34,28 +34,28 @@ 11606 * tag and the EXTENDED RATE MFIE tag if needed. 11607 * It encludes two bytes per tag for the tag itself and its len 11608 */ 11609-unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee) 11610+unsigned int ieee80211_MFIE_rate_len_rtl7(struct ieee80211_device *ieee) 11611 { 11612 unsigned int rate_len = 0; 11613- 11614+ 11615 if (ieee->modulation & IEEE80211_CCK_MODULATION) 11616 rate_len = IEEE80211_CCK_RATE_LEN + 2; 11617- 11618+ 11619 if (ieee->modulation & IEEE80211_OFDM_MODULATION) 11620- 11621+ 11622 rate_len += IEEE80211_OFDM_RATE_LEN + 2; 11623- 11624+ 11625 return rate_len; 11626 } 11627 11628-/* pleace the MFIE rate, tag to the memory (double) poined. 11629+/* pleace the MFIE rate, tag to the memory (double) poined. 11630 * Then it updates the pointer so that 11631 * it points after the new MFIE tag added. 11632- */ 11633-void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p) 11634+ */ 11635+void ieee80211_MFIE_Brate_rtl7(struct ieee80211_device *ieee, u8 **tag_p) 11636 { 11637- u8 *tag = *tag_p; 11638- 11639+ u8 *tag = *tag_p; 11640+ 11641 if (ieee->modulation & IEEE80211_CCK_MODULATION){ 11642 *tag++ = MFIE_TYPE_RATES; 11643 *tag++ = 4; 11644@@ -64,17 +64,17 @@ 11645 *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB; 11646 *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB; 11647 } 11648- 11649+ 11650 /* We may add an option for custom rates that specific HW might support */ 11651 *tag_p = tag; 11652 } 11653 11654-void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p) 11655-{ 11656- u8 *tag = *tag_p; 11657- 11658+void ieee80211_MFIE_Grate_rtl7(struct ieee80211_device *ieee, u8 **tag_p) 11659+{ 11660+ u8 *tag = *tag_p; 11661+ 11662 if (ieee->modulation & IEEE80211_OFDM_MODULATION){ 11663- 11664+ 11665 *tag++ = MFIE_TYPE_RATES_EX; 11666 *tag++ = 8; 11667 *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB; 11668@@ -85,73 +85,73 @@ 11669 *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB; 11670 *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB; 11671 *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB; 11672- 11673+ 11674 } 11675- 11676+ 11677 /* We may add an option for custom rates that specific HW might support */ 11678 *tag_p = tag; 11679 } 11680 11681-void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb) 11682+void enqueue_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb) 11683 { 11684 int nh; 11685 nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM; 11686- 11687+ 11688 /* 11689 * if the queue is full but we have newer frames then 11690 * just overwrites the oldest. 11691- * 11692+ * 11693 * if (nh == ieee->mgmt_queue_tail) 11694 * return -1; 11695- */ 11696+ */ 11697 ieee->mgmt_queue_head = nh; 11698 ieee->mgmt_queue_ring[nh] = skb; 11699- 11700+ 11701 //return 0; 11702 } 11703 11704-struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee) 11705+struct sk_buff *dequeue_mgmt_rtl7(struct ieee80211_device *ieee) 11706 { 11707 struct sk_buff *ret; 11708- 11709+ 11710 if(ieee->mgmt_queue_tail == ieee->mgmt_queue_head) 11711 return NULL; 11712- 11713+ 11714 ret = ieee->mgmt_queue_ring[ieee->mgmt_queue_tail]; 11715- 11716- ieee->mgmt_queue_tail = 11717+ 11718+ ieee->mgmt_queue_tail = 11719 (ieee->mgmt_queue_tail+1) % MGMT_QUEUE_NUM; 11720- 11721+ 11722 return ret; 11723 } 11724 11725-void init_mgmt_queue(struct ieee80211_device *ieee) 11726+void init_mgmt_queue_rtl7(struct ieee80211_device *ieee) 11727 { 11728 ieee->mgmt_queue_tail = ieee->mgmt_queue_head = 0; 11729 } 11730 11731 11732-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl); 11733+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl); 11734 11735-inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee) 11736+inline void softmac_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee) 11737 { 11738 unsigned long flags; 11739 short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE; 11740 struct ieee80211_hdr_3addr *header= 11741 (struct ieee80211_hdr_3addr *) skb->data; 11742- 11743- 11744+ 11745+ 11746 spin_lock_irqsave(&ieee->lock, flags); 11747- 11748+ 11749 /* called with 2nd param 0, no mgmt lock required */ 11750- ieee80211_sta_wakeup(ieee,0); 11751- 11752+ ieee80211_sta_wakeup_rtl7(ieee,0); 11753+ 11754 if(single){ 11755- 11756+ 11757 if(ieee->queue_stop){ 11758- 11759- enqueue_mgmt(ieee,skb); 11760- 11761+ 11762+ enqueue_mgmt_rtl7(ieee,skb); 11763+ 11764 }else{ 11765 header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4); 11766 11767@@ -159,119 +159,119 @@ 11768 ieee->seq_ctrl = 0; 11769 else 11770 ieee->seq_ctrl++; 11771- 11772+ 11773 /* avoid watchdog triggers */ 11774 ieee->dev->trans_start = jiffies; 11775 ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate); 11776 } 11777- 11778+ 11779 spin_unlock_irqrestore(&ieee->lock, flags); 11780 }else{ 11781 spin_unlock_irqrestore(&ieee->lock, flags); 11782 spin_lock_irqsave(&ieee->mgmt_tx_lock, flags); 11783- 11784+ 11785 header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4); 11786- 11787+ 11788 if (ieee->seq_ctrl == 0xFFF) 11789 ieee->seq_ctrl = 0; 11790 else 11791 ieee->seq_ctrl++; 11792- 11793+ 11794 ieee->softmac_hard_start_xmit(skb,ieee->dev); 11795- 11796+ 11797 spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags); 11798 } 11799 } 11800 11801 11802-inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee) 11803+inline void softmac_ps_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee) 11804 { 11805- 11806+ 11807 short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE; 11808 struct ieee80211_hdr_3addr *header = 11809 (struct ieee80211_hdr_3addr *) skb->data; 11810- 11811- 11812+ 11813+ 11814 if(single){ 11815- 11816+ 11817 header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4); 11818 11819 if (ieee->seq_ctrl == 0xFFF) 11820 ieee->seq_ctrl = 0; 11821 else 11822 ieee->seq_ctrl++; 11823- 11824+ 11825 /* avoid watchdog triggers */ 11826 ieee->dev->trans_start = jiffies; 11827 ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate); 11828- 11829+ 11830 }else{ 11831- 11832+ 11833 header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4); 11834- 11835+ 11836 if (ieee->seq_ctrl == 0xFFF) 11837 ieee->seq_ctrl = 0; 11838 else 11839 ieee->seq_ctrl++; 11840 11841 ieee->softmac_hard_start_xmit(skb,ieee->dev); 11842- 11843+ 11844 } 11845 } 11846 11847-inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee) 11848+inline struct sk_buff *ieee80211_probe_req_rtl7(struct ieee80211_device *ieee) 11849 { 11850 unsigned int len,rate_len; 11851 u8 *tag; 11852 struct sk_buff *skb; 11853 struct ieee80211_probe_request *req; 11854- 11855+ 11856 len = ieee->current_network.ssid_len; 11857- 11858- rate_len = ieee80211_MFIE_rate_len(ieee); 11859- 11860+ 11861+ rate_len = ieee80211_MFIE_rate_len_rtl7(ieee); 11862+ 11863 skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) + 11864 2 + len + rate_len); 11865- 11866- if (!skb) 11867+ 11868+ if (!skb) 11869 return NULL; 11870- 11871+ 11872 req = (struct ieee80211_probe_request *) skb_put(skb,sizeof(struct ieee80211_probe_request)); 11873 req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); 11874- req->header.duration_id = 0; //FIXME: is this OK ? 11875- 11876+ req->header.duration_id = 0; //FIXME: is this OK ? 11877+ 11878 memset(req->header.addr1, 0xff, ETH_ALEN); 11879 memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN); 11880 memset(req->header.addr3, 0xff, ETH_ALEN); 11881- 11882+ 11883 tag = (u8 *) skb_put(skb,len+2+rate_len); 11884- 11885+ 11886 *tag++ = MFIE_TYPE_SSID; 11887 *tag++ = len; 11888 memcpy(tag, ieee->current_network.ssid, len); 11889 tag += len; 11890- 11891- ieee80211_MFIE_Brate(ieee,&tag); 11892- ieee80211_MFIE_Grate(ieee,&tag); 11893+ 11894+ ieee80211_MFIE_Brate_rtl7(ieee,&tag); 11895+ ieee80211_MFIE_Grate_rtl7(ieee,&tag); 11896 return skb; 11897 } 11898 11899-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee); 11900-void ieee80211_send_beacon(struct ieee80211_device *ieee) 11901+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee); 11902+void ieee80211_send_beacon_rtl7(struct ieee80211_device *ieee) 11903 { 11904 struct sk_buff *skb; 11905- 11906- unsigned long flags; 11907- 11908- skb = ieee80211_get_beacon_(ieee); 11909+ 11910+ unsigned long flags; 11911+ 11912+ skb = ieee80211_get_beacon__rtl7(ieee); 11913 if (skb){ 11914- softmac_mgmt_xmit(skb, ieee); 11915+ softmac_mgmt_xmit_rtl7(skb, ieee); 11916 ieee->softmac_stats.tx_beacons++; 11917 } 11918 11919- ieee->beacon_timer.expires = jiffies + 11920+ ieee->beacon_timer.expires = jiffies + 11921 (MSECS( ieee->current_network.beacon_interval -5)); 11922- 11923+ 11924 spin_lock_irqsave(&ieee->beacon_lock,flags); 11925 if(ieee->beacon_txing) 11926 add_timer(&ieee->beacon_timer); 11927@@ -279,57 +279,57 @@ 11928 } 11929 11930 11931-void ieee80211_send_beacon_cb(unsigned long _ieee) 11932+void ieee80211_send_beacon_cb_rtl7(unsigned long _ieee) 11933 { 11934 struct ieee80211_device *ieee = 11935 (struct ieee80211_device *) _ieee; 11936- ieee80211_send_beacon(ieee); 11937+ ieee80211_send_beacon_rtl7(ieee); 11938 } 11939 11940 11941-void ieee80211_send_probe(struct ieee80211_device *ieee) 11942+void ieee80211_send_probe_rtl7(struct ieee80211_device *ieee) 11943 { 11944 struct sk_buff *skb; 11945- 11946- skb = ieee80211_probe_req(ieee); 11947+ 11948+ skb = ieee80211_probe_req_rtl7(ieee); 11949 if (skb){ 11950- softmac_mgmt_xmit(skb, ieee); 11951+ softmac_mgmt_xmit_rtl7(skb, ieee); 11952 ieee->softmac_stats.tx_probe_rq++; 11953 } 11954 } 11955 11956-void ieee80211_send_probe_requests(struct ieee80211_device *ieee) 11957+void ieee80211_send_probe_requests_rtl7(struct ieee80211_device *ieee) 11958 { 11959 if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)){ 11960- ieee80211_send_probe(ieee); 11961- ieee80211_send_probe(ieee); 11962+ ieee80211_send_probe_rtl7(ieee); 11963+ ieee80211_send_probe_rtl7(ieee); 11964 } 11965 } 11966 11967 /* this performs syncro scan blocking the caller until all channels 11968- * in the allowed channel map has been checked. 11969+ * in the allowed channel map has been checked. 11970 */ 11971-void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee) 11972+void ieee80211_softmac_scan_syncro_rtl7(struct ieee80211_device *ieee) 11973 { 11974 short ch = 0; 11975- 11976+ 11977 down(&ieee->scan_sem); 11978- 11979+ 11980 while(1) 11981 { 11982- 11983+ 11984 do{ 11985 ch++; 11986- if (ch > MAX_CHANNEL_NUMBER) 11987+ if (ch > MAX_CHANNEL_NUMBER) 11988 goto out; /* scan completed */ 11989- 11990+ 11991 }while(!ieee->channel_map[ch]); 11992- 11993+ 11994 /* this fuction can be called in two situations 11995 * 1- We have switched to ad-hoc mode and we are 11996 * performing a complete syncro scan before conclude 11997- * there are no interesting cell and to create a 11998- * new one. In this case the link state is 11999+ * there are no interesting cell and to create a 12000+ * new one. In this case the link state is 12001 * IEEE80211_NOLINK until we found an interesting cell. 12002 * If so the ieee8021_new_net, called by the RX path 12003 * will set the state to IEEE80211_LINKED, so we stop 12004@@ -342,24 +342,24 @@ 12005 * not filter RX frames and the channel is changing. 12006 * So the only situation in witch are interested is to check 12007 * if the state become LINKED because of the #1 situation 12008- */ 12009- 12010+ */ 12011+ 12012 if (ieee->state == IEEE80211_LINKED) 12013 goto out; 12014- 12015+ 12016 ieee->set_chan(ieee->dev, ch); 12017- 12018- ieee80211_send_probe_requests(ieee); 12019- 12020+ 12021+ ieee80211_send_probe_requests_rtl7(ieee); 12022+ 12023 /* this prevent excessive time wait when we 12024 * need to wait for a syncro scan to end.. 12025- */ 12026+ */ 12027 if (ieee->sync_scan_hurryup) 12028 goto out; 12029 12030 12031 msleep_interruptible_rtl(IEEE80211_SOFTMAC_SCAN_TIME); 12032- 12033+ 12034 } 12035 out: 12036 ieee->sync_scan_hurryup = 0; 12037@@ -370,43 +370,49 @@ 12038 void ieee80211_softmac_scan(struct ieee80211_device *ieee) 12039 { 12040 short watchdog = 0; 12041- 12042+ 12043 do{ 12044- ieee->current_network.channel = 12045+ ieee->current_network.channel = 12046 (ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER; 12047- if (watchdog++ > MAX_CHANNEL_NUMBER) 12048+ if (watchdog++ > MAX_CHANNEL_NUMBER) 12049 return; /* no good chans */ 12050- 12051+ 12052 }while(!ieee->channel_map[ieee->current_network.channel]); 12053- 12054+ 12055 12056 schedule_work(&ieee->softmac_scan_wq); 12057 } 12058 #endif 12059 12060-void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee) 12061-{ 12062- down(&ieee->scan_sem); 12063- 12064+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) 12065+void ieee80211_softmac_scan_wq_rtl7(struct work_struct *work) 12066+{ 12067+ struct delayed_work *dwork = container_of(work, struct delayed_work, work); 12068+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq); 12069+#else 12070+void ieee80211_softmac_scan_wq_rtl7(struct ieee80211_device *ieee) 12071+{ 12072+#endif 12073 short watchdog = 0; 12074- 12075+ down(&ieee->scan_sem); 12076+ 12077 do{ 12078- ieee->current_network.channel = 12079+ ieee->current_network.channel = 12080 (ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER; 12081- if (watchdog++ > MAX_CHANNEL_NUMBER) 12082+ if (watchdog++ > MAX_CHANNEL_NUMBER) 12083 goto out; /* no good chans */ 12084- 12085+ 12086 }while(!ieee->channel_map[ieee->current_network.channel]); 12087- 12088+ 12089 if (ieee->scanning == 0 ) 12090 goto out; 12091- 12092+ 12093 ieee->set_chan(ieee->dev, ieee->current_network.channel); 12094- ieee80211_send_probe_requests(ieee); 12095+ ieee80211_send_probe_requests_rtl7(ieee); 12096 12097-#if 0 12098+#if 0 12099 ieee->.expires = jiffies + (IEEE80211_SOFTMAC_SCAN_TIME); 12100- if (ieee->scanning == 1) 12101+ if (ieee->scanning == 1) 12102 add_timer(&ieee->scan_timer); 12103 #endif 12104 queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME); 12105@@ -419,7 +425,7 @@ 12106 { 12107 unsigned long flags; 12108 struct ieee80211_device *ieee = (struct ieee80211_device *)_dev; 12109- 12110+ 12111 spin_lock_irqsave(&ieee->lock, flags); 12112 ieee80211_softmac_scan(ieee); 12113 spin_unlock_irqrestore(&ieee->lock, flags); 12114@@ -427,19 +433,19 @@ 12115 #endif 12116 12117 12118-void ieee80211_beacons_start(struct ieee80211_device *ieee) 12119+void ieee80211_beacons_start_rtl7(struct ieee80211_device *ieee) 12120 { 12121- unsigned long flags; 12122+ unsigned long flags; 12123 12124 spin_lock_irqsave(&ieee->beacon_lock,flags); 12125 12126 ieee->beacon_txing = 1; 12127- ieee80211_send_beacon(ieee); 12128- 12129+ ieee80211_send_beacon_rtl7(ieee); 12130+ 12131 spin_unlock_irqrestore(&ieee->beacon_lock,flags); 12132 } 12133 12134-void ieee80211_beacons_stop(struct ieee80211_device *ieee) 12135+void ieee80211_beacons_stop_rtl7(struct ieee80211_device *ieee) 12136 { 12137 unsigned long flags; 12138 12139@@ -453,111 +459,111 @@ 12140 } 12141 12142 12143-void ieee80211_stop_send_beacons(struct ieee80211_device *ieee) 12144+void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee) 12145 { 12146 if(ieee->stop_send_beacons) 12147 ieee->stop_send_beacons(ieee->dev); 12148 if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS) 12149- ieee80211_beacons_stop(ieee); 12150+ ieee80211_beacons_stop_rtl7(ieee); 12151 } 12152 12153 12154-void ieee80211_start_send_beacons(struct ieee80211_device *ieee) 12155+void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee) 12156 { 12157 if(ieee->start_send_beacons) 12158 ieee->start_send_beacons(ieee->dev); 12159 if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS) 12160- ieee80211_beacons_start(ieee); 12161+ ieee80211_beacons_start_rtl7(ieee); 12162 } 12163 12164 12165-void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee) 12166+void ieee80211_softmac_stop_scan_rtl7(struct ieee80211_device *ieee) 12167 { 12168-// unsigned long flags; 12169- 12170+// unsigned long flags; 12171+ 12172 //ieee->sync_scan_hurryup = 1; 12173- 12174+ 12175 down(&ieee->scan_sem); 12176 // spin_lock_irqsave(&ieee->lock, flags); 12177- 12178+ 12179 if (ieee->scanning == 1){ 12180 ieee->scanning = 0; 12181 //del_timer_sync(&ieee->scan_timer); 12182 cancel_delayed_work(&ieee->softmac_scan_wq); 12183 } 12184- 12185+ 12186 // spin_unlock_irqrestore(&ieee->lock, flags); 12187 up(&ieee->scan_sem); 12188 } 12189 12190-void ieee80211_stop_scan(struct ieee80211_device *ieee) 12191+void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee) 12192 { 12193 if (ieee->softmac_features & IEEE_SOFTMAC_SCAN) 12194- ieee80211_softmac_stop_scan(ieee); 12195+ ieee80211_softmac_stop_scan_rtl7(ieee); 12196 else 12197 ieee->stop_scan(ieee->dev); 12198 } 12199 12200 /* called with ieee->lock held */ 12201-void ieee80211_start_scan(struct ieee80211_device *ieee) 12202+void ieee80211_start_scan_rtl7(struct ieee80211_device *ieee) 12203 { 12204- if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){ 12205+ if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){ 12206 if (ieee->scanning == 0){ 12207 ieee->scanning = 1; 12208 //ieee80211_softmac_scan(ieee); 12209- queue_work(ieee->wq, &ieee->softmac_scan_wq); 12210+ queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0); 12211 } 12212 }else 12213 ieee->start_scan(ieee->dev); 12214- 12215+ 12216 } 12217 12218 /* called with wx_sem held */ 12219-void ieee80211_start_scan_syncro(struct ieee80211_device *ieee) 12220+void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee) 12221 { 12222 ieee->sync_scan_hurryup = 0; 12223- 12224+ 12225 if (ieee->softmac_features & IEEE_SOFTMAC_SCAN) 12226- ieee80211_softmac_scan_syncro(ieee); 12227+ ieee80211_softmac_scan_syncro_rtl7(ieee); 12228 else 12229 ieee->scan_syncro(ieee->dev); 12230- 12231+ 12232 } 12233 12234-inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon, 12235+inline struct sk_buff *ieee80211_authentication_req_rtl7(struct ieee80211_network *beacon, 12236 struct ieee80211_device *ieee, int challengelen) 12237 { 12238- struct sk_buff *skb; 12239+ struct sk_buff *skb; 12240 struct ieee80211_authentication *auth; 12241- 12242- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen); 12243- 12244+ 12245+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen); 12246+ 12247 if (!skb) return NULL; 12248- 12249+ 12250 auth = (struct ieee80211_authentication *) 12251 skb_put(skb, sizeof(struct ieee80211_authentication)); 12252- 12253+ 12254 auth->header.frame_ctl = IEEE80211_STYPE_AUTH; 12255 if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP; 12256- 12257+ 12258 auth->header.duration_id = 0x013a; //FIXME 12259- 12260+ 12261 memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN); 12262 memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN); 12263 memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN); 12264- 12265+ 12266 auth->algorithm = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY; 12267- 12268+ 12269 auth->transaction = cpu_to_le16(ieee->associate_seq); 12270 ieee->associate_seq++; 12271- 12272+ 12273 auth->status = cpu_to_le16(WLAN_STATUS_SUCCESS); 12274- 12275+ 12276 return skb; 12277- 12278+ 12279 } 12280 12281-static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest) 12282+static struct sk_buff* ieee80211_probe_resp_rtl7(struct ieee80211_device *ieee, u8 *dest) 12283 { 12284 u8 *tag; 12285 int beacon_size; 12286@@ -566,23 +572,23 @@ 12287 int encrypt; 12288 int atim_len,erp_len; 12289 struct ieee80211_crypt_data* crypt; 12290- 12291+ 12292 char *ssid = ieee->current_network.ssid; 12293 int ssid_len = ieee->current_network.ssid_len; 12294 int rate_len = ieee->current_network.rates_len+2; 12295 int rate_ex_len = ieee->current_network.rates_ex_len; 12296 if(rate_ex_len > 0) rate_ex_len+=2; 12297- 12298+ 12299 if(ieee->current_network.capability & WLAN_CAPABILITY_IBSS) 12300 atim_len = 4; 12301 else 12302 atim_len = 0; 12303- 12304- if(ieee80211_is_54g(ieee->current_network)) 12305+ 12306+ if(ieee80211_is_54g_rtl7(ieee->current_network)) 12307 erp_len = 3; 12308 else 12309 erp_len = 0; 12310- 12311+ 12312 beacon_size = sizeof(struct ieee80211_probe_response)+ 12313 ssid_len 12314 +3 //channel 12315@@ -590,72 +596,72 @@ 12316 +rate_ex_len 12317 +atim_len 12318 +erp_len; 12319- 12320+ 12321 skb = dev_alloc_skb(beacon_size); 12322- 12323- if (!skb) 12324+ 12325+ if (!skb) 12326 return NULL; 12327- 12328+ 12329 beacon_buf = (struct ieee80211_probe_response*) skb_put(skb, beacon_size); 12330- 12331+ 12332 memcpy (beacon_buf->header.addr1, dest,ETH_ALEN); 12333 memcpy (beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN); 12334 memcpy (beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN); 12335 12336 beacon_buf->header.duration_id = 0; //FIXME 12337- beacon_buf->beacon_interval = 12338+ beacon_buf->beacon_interval = 12339 cpu_to_le16(ieee->current_network.beacon_interval); 12340- beacon_buf->capability = 12341+ beacon_buf->capability = 12342 cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_IBSS); 12343- 12344+ 12345 if(ieee->short_slot && (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_SLOT)) 12346- cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT)); 12347- 12348+ cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT)); 12349+ 12350 crypt = ieee->crypt[ieee->tx_keyidx]; 12351 12352- encrypt = ieee->host_encrypt && crypt && crypt->ops && 12353+ encrypt = ieee->host_encrypt && crypt && crypt->ops && 12354 (0 == strcmp(crypt->ops->name, "WEP")); 12355 12356- if (encrypt) 12357+ if (encrypt) 12358 beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); 12359- 12360- 12361+ 12362+ 12363 beacon_buf->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_RESP); 12364- 12365- beacon_buf->info_element.id = MFIE_TYPE_SSID; 12366+ 12367+ beacon_buf->info_element.id = MFIE_TYPE_SSID; 12368 beacon_buf->info_element.len = ssid_len; 12369- 12370+ 12371 tag = (u8*) beacon_buf->info_element.data; 12372- 12373+ 12374 memcpy(tag, ssid, ssid_len); 12375- 12376+ 12377 tag += ssid_len; 12378- 12379+ 12380 *(tag++) = MFIE_TYPE_RATES; 12381- *(tag++) = rate_len-2; 12382+ *(tag++) = rate_len-2; 12383 memcpy(tag,ieee->current_network.rates,rate_len-2); 12384 tag+=rate_len-2; 12385- 12386+ 12387 *(tag++) = MFIE_TYPE_DS_SET; 12388 *(tag++) = 1; 12389 *(tag++) = ieee->current_network.channel; 12390- 12391+ 12392 if(atim_len){ 12393 *(tag++) = MFIE_TYPE_IBSS_SET; 12394 *(tag++) = 2; 12395 *((u16*)(tag)) = cpu_to_le16(ieee->current_network.atim_window); 12396 tag+=2; 12397 } 12398- 12399+ 12400 if(erp_len){ 12401 *(tag++) = MFIE_TYPE_ERP; 12402 *(tag++) = 1; 12403- *(tag++) = 0; 12404+ *(tag++) = 0; 12405 } 12406- 12407+ 12408 if(rate_ex_len){ 12409 *(tag++) = MFIE_TYPE_RATES_EX; 12410- *(tag++) = rate_ex_len-2; 12411+ *(tag++) = rate_ex_len-2; 12412 memcpy(tag,ieee->current_network.rates_ex,rate_ex_len-2); 12413 tag+=rate_ex_len-2; 12414 } 12415@@ -664,208 +670,211 @@ 12416 } 12417 12418 12419-struct sk_buff* ieee80211_assoc_resp(struct ieee80211_device *ieee, u8 *dest) 12420+struct sk_buff* ieee80211_assoc_resp_rtl7(struct ieee80211_device *ieee, u8 *dest) 12421 { 12422 struct sk_buff *skb; 12423 u8* tag; 12424- 12425+ 12426 struct ieee80211_crypt_data* crypt; 12427 struct ieee80211_assoc_response_frame *assoc; 12428 short encrypt; 12429- 12430- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee); 12431+ 12432+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee); 12433 int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len; 12434- 12435- skb = dev_alloc_skb(len); 12436- 12437- if (!skb) 12438+ 12439+ skb = dev_alloc_skb(len); 12440+ 12441+ if (!skb) 12442 return NULL; 12443- 12444+ 12445 assoc = (struct ieee80211_assoc_response_frame *) 12446 skb_put(skb,sizeof(struct ieee80211_assoc_response_frame)); 12447- 12448+ 12449 assoc->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP); 12450 memcpy(assoc->header.addr1, dest,ETH_ALEN); 12451 memcpy(assoc->header.addr3, ieee->dev->dev_addr, ETH_ALEN); 12452 memcpy(assoc->header.addr2, ieee->dev->dev_addr, ETH_ALEN); 12453- assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ? 12454+ assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ? 12455 WLAN_CAPABILITY_BSS : WLAN_CAPABILITY_IBSS); 12456- 12457- 12458+ 12459+ 12460 if(ieee->short_slot) 12461 assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT); 12462- 12463+ 12464 if (ieee->host_encrypt) 12465 crypt = ieee->crypt[ieee->tx_keyidx]; 12466 else crypt = NULL; 12467- 12468+ 12469 encrypt = ( crypt && crypt->ops); 12470- 12471+ 12472 if (encrypt) 12473 assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); 12474- 12475+ 12476 assoc->status = 0; 12477 assoc->aid = cpu_to_le16(ieee->assoc_id); 12478 if (ieee->assoc_id == 0x2007) ieee->assoc_id=0; 12479 else ieee->assoc_id++; 12480- 12481+ 12482 tag = (u8*) skb_put(skb, rate_len); 12483- 12484- ieee80211_MFIE_Brate(ieee, &tag); 12485- ieee80211_MFIE_Grate(ieee, &tag); 12486- 12487+ 12488+ ieee80211_MFIE_Brate_rtl7(ieee, &tag); 12489+ ieee80211_MFIE_Grate_rtl7(ieee, &tag); 12490+ 12491 return skb; 12492 } 12493 12494-struct sk_buff* ieee80211_auth_resp(struct ieee80211_device *ieee,int status, u8 *dest) 12495+struct sk_buff* ieee80211_auth_resp_rtl7(struct ieee80211_device *ieee,int status, u8 *dest) 12496 { 12497 struct sk_buff *skb; 12498 struct ieee80211_authentication *auth; 12499- 12500- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1); 12501- 12502- if (!skb) 12503+ 12504+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1); 12505+ 12506+ if (!skb) 12507 return NULL; 12508- 12509+ 12510 skb->len = sizeof(struct ieee80211_authentication); 12511- 12512+ 12513 auth = (struct ieee80211_authentication *)skb->data; 12514- 12515+ 12516 auth->status = cpu_to_le16(status); 12517 auth->transaction = cpu_to_le16(2); 12518 auth->algorithm = cpu_to_le16(WLAN_AUTH_OPEN); 12519- 12520+ 12521 memcpy(auth->header.addr3, ieee->dev->dev_addr, ETH_ALEN); 12522 memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN); 12523 memcpy(auth->header.addr1, dest, ETH_ALEN); 12524- auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH); 12525+ auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH); 12526 return skb; 12527- 12528- 12529+ 12530+ 12531 } 12532 12533-struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr) 12534+struct sk_buff* ieee80211_null_func_rtl7(struct ieee80211_device *ieee,short pwr) 12535 { 12536 struct sk_buff *skb; 12537 struct ieee80211_hdr_3addr* hdr; 12538- 12539- skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr)); 12540- 12541- if (!skb) 12542+ 12543+ skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr)); 12544+ 12545+ if (!skb) 12546 return NULL; 12547- 12548+ 12549 hdr = (struct ieee80211_hdr_3addr*)skb_put(skb,sizeof(struct ieee80211_hdr_3addr)); 12550- 12551+ 12552 memcpy(hdr->addr1, ieee->current_network.bssid, ETH_ALEN); 12553 memcpy(hdr->addr2, ieee->dev->dev_addr, ETH_ALEN); 12554 memcpy(hdr->addr3, ieee->current_network.bssid, ETH_ALEN); 12555- 12556- hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA | 12557- IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS | 12558- (pwr ? IEEE80211_FCTL_PM:0)); 12559- 12560+ 12561+ hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA | 12562+ IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS | 12563+ (pwr ? IEEE80211_FCTL_PM:0)); 12564+ 12565 return skb; 12566- 12567- 12568+ 12569+ 12570 } 12571 12572 12573-void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest) 12574+void ieee80211_resp_to_assoc_rq_rtl7(struct ieee80211_device *ieee, u8* dest) 12575 { 12576- struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest); 12577- 12578+ struct sk_buff *buf = ieee80211_assoc_resp_rtl7(ieee, dest); 12579+ 12580 if (buf) 12581- softmac_mgmt_xmit(buf, ieee); 12582+ softmac_mgmt_xmit_rtl7(buf, ieee); 12583 } 12584 12585 12586-void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest) 12587+void ieee80211_resp_to_auth_rtl7(struct ieee80211_device *ieee, int s, u8* dest) 12588 { 12589- struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest); 12590- 12591+ struct sk_buff *buf = ieee80211_auth_resp_rtl7(ieee, s, dest); 12592+ 12593 if (buf) 12594- softmac_mgmt_xmit(buf, ieee); 12595+ softmac_mgmt_xmit_rtl7(buf, ieee); 12596 } 12597 12598 12599-void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest) 12600+void ieee80211_resp_to_probe_rtl7(struct ieee80211_device *ieee, u8 *dest) 12601 { 12602- 12603- struct sk_buff *buf = ieee80211_probe_resp(ieee, dest); 12604- 12605- if (buf) 12606- softmac_mgmt_xmit(buf, ieee); 12607+ 12608+ struct sk_buff *buf = ieee80211_probe_resp_rtl7(ieee, dest); 12609+ 12610+ if (buf) 12611+ softmac_mgmt_xmit_rtl7(buf, ieee); 12612 } 12613 12614 12615-inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee) 12616+inline struct sk_buff *ieee80211_association_req_rtl7(struct ieee80211_network *beacon,struct ieee80211_device *ieee) 12617 { 12618 struct sk_buff *skb; 12619- 12620+ 12621 struct ieee80211_assoc_request_frame *hdr; 12622 u8 *tag; 12623- 12624+ 12625 unsigned int wpa_len = beacon->wpa_ie_len; 12626- 12627- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee); 12628- 12629- 12630- 12631+ 12632+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee); 12633+ 12634+ 12635+ 12636 int len=sizeof(struct ieee80211_assoc_request_frame)+ 12637 + beacon->ssid_len//essid tagged val 12638 + rate_len//rates tagged val 12639 + wpa_len; 12640- 12641+ 12642 skb = dev_alloc_skb(len); 12643- 12644- if (!skb) 12645+ 12646+ if (!skb) 12647 return NULL; 12648- 12649+ 12650 hdr = (struct ieee80211_assoc_request_frame *) 12651 skb_put(skb, sizeof(struct ieee80211_assoc_request_frame)); 12652- 12653- 12654+ 12655+ 12656 hdr->header.frame_ctl = IEEE80211_STYPE_ASSOC_REQ; 12657 hdr->header.duration_id= 37; //FIXME 12658 memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN); 12659 memcpy(hdr->header.addr2, ieee->dev->dev_addr, ETH_ALEN); 12660 memcpy(hdr->header.addr3, beacon->bssid, ETH_ALEN); 12661- 12662+ 12663 hdr->capability = cpu_to_le16(WLAN_CAPABILITY_BSS); 12664- if (beacon->capability & WLAN_CAPABILITY_PRIVACY ) 12665+ if (beacon->capability & WLAN_CAPABILITY_PRIVACY ) 12666 hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); 12667- 12668+ 12669 if(ieee->short_slot) 12670 hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT); 12671- 12672+ 12673+ if(beacon->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) 12674+ hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_PREAMBLE); 12675+ 12676 hdr->listen_interval = 0xa; //FIXME 12677- 12678+ 12679 hdr->info_element.id = MFIE_TYPE_SSID; 12680 12681 hdr->info_element.len = beacon->ssid_len; 12682 tag = skb_put(skb, beacon->ssid_len); 12683 memcpy(tag, beacon->ssid, beacon->ssid_len); 12684- 12685- tag = skb_put(skb, rate_len); 12686- 12687- ieee80211_MFIE_Brate(ieee, &tag); 12688- ieee80211_MFIE_Grate(ieee, &tag); 12689- 12690+ 12691+ tag = skb_put(skb, rate_len); 12692+ 12693+ ieee80211_MFIE_Brate_rtl7(ieee, &tag); 12694+ ieee80211_MFIE_Grate_rtl7(ieee, &tag); 12695+ 12696 tag = skb_put(skb,wpa_len); 12697- 12698+ 12699 memcpy(tag,beacon->wpa_ie,wpa_len); 12700- 12701+ 12702 return skb; 12703 } 12704 12705-void ieee80211_associate_abort(struct ieee80211_device *ieee) 12706+void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee) 12707 { 12708- 12709+ 12710 unsigned long flags; 12711 spin_lock_irqsave(&ieee->lock, flags); 12712- 12713+ 12714 ieee->associate_seq++; 12715- 12716+ 12717 /* don't scan, and avoid to have the RX path possibily 12718 * try again to associate. Even do not react to AUTH or 12719 * ASSOC response. Just wait for the retry wq to be scheduled. 12720@@ -873,166 +882,181 @@ 12721 * with, so we retry or just get back to NO_LINK and scanning 12722 */ 12723 if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING){ 12724- IEEE80211_DEBUG_MGMT("Authentication failed\n"); 12725+ IEEE80211_DEBUG_MGMT("Authentication failed\n"); 12726 ieee->softmac_stats.no_auth_rs++; 12727 }else{ 12728- IEEE80211_DEBUG_MGMT("Association failed\n"); 12729+ IEEE80211_DEBUG_MGMT("Association failed\n"); 12730 ieee->softmac_stats.no_ass_rs++; 12731 } 12732- 12733+ 12734 ieee->state = IEEE80211_ASSOCIATING_RETRY; 12735- 12736+ 12737 queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, IEEE80211_SOFTMAC_ASSOC_RETRY_TIME); 12738- 12739+ 12740 spin_unlock_irqrestore(&ieee->lock, flags); 12741 } 12742 12743-void ieee80211_associate_abort_cb(unsigned long dev) 12744+void ieee80211_associate_abort_cb_rtl7(unsigned long dev) 12745 { 12746- ieee80211_associate_abort((struct ieee80211_device *) dev); 12747+ ieee80211_associate_abort_rtl7((struct ieee80211_device *) dev); 12748 } 12749 12750 12751-void ieee80211_associate_step1(struct ieee80211_device *ieee) 12752+void ieee80211_associate_step1_rtl7(struct ieee80211_device *ieee) 12753 { 12754 struct ieee80211_network *beacon = &ieee->current_network; 12755 struct sk_buff *skb; 12756- 12757+ 12758 IEEE80211_DEBUG_MGMT("Stopping scan\n"); 12759- 12760+ 12761 ieee->softmac_stats.tx_auth_rq++; 12762- skb=ieee80211_authentication_req(beacon, ieee, 0); 12763- 12764- if (!skb) 12765- ieee80211_associate_abort(ieee); 12766- else{ 12767+ skb=ieee80211_authentication_req_rtl7(beacon, ieee, 0); 12768+ 12769+ if (!skb) 12770+ ieee80211_associate_abort_rtl7(ieee); 12771+ else{ 12772 ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ; 12773 IEEE80211_DEBUG_MGMT("Sending authentication request\n"); 12774- softmac_mgmt_xmit(skb, ieee); 12775+ softmac_mgmt_xmit_rtl7(skb, ieee); 12776 ieee->associate_timer.expires = jiffies + (HZ / 2); 12777 add_timer(&ieee->associate_timer); 12778- } 12779+ } 12780 } 12781 12782-void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen) 12783+void ieee80211_auth_challenge_rtl7(struct ieee80211_device *ieee, u8 *challenge, int chlen) 12784 { 12785- u8 *c; 12786+ u8 *c; 12787 struct sk_buff *skb; 12788 struct ieee80211_network *beacon = &ieee->current_network; 12789 // int hlen = sizeof(struct ieee80211_authentication); 12790- 12791+ 12792 ieee->associate_seq++; 12793 ieee->softmac_stats.tx_auth_rq++; 12794- 12795- skb = ieee80211_authentication_req(beacon, ieee, chlen+2); 12796- if (!skb) 12797- ieee80211_associate_abort(ieee); 12798+ 12799+ skb = ieee80211_authentication_req_rtl7(beacon, ieee, chlen+2); 12800+ if (!skb) 12801+ ieee80211_associate_abort_rtl7(ieee); 12802 else{ 12803 c = skb_put(skb, chlen+2); 12804 *(c++) = MFIE_TYPE_CHALLENGE; 12805 *(c++) = chlen; 12806 memcpy(c, challenge, chlen); 12807- 12808+ 12809 IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n"); 12810- 12811- ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr )); 12812- 12813- softmac_mgmt_xmit(skb, ieee); 12814+ 12815+ ieee80211_encrypt_fragment_rtl7(ieee, skb, sizeof(struct ieee80211_hdr_3addr )); 12816+ 12817+ softmac_mgmt_xmit_rtl7(skb, ieee); 12818 ieee->associate_timer.expires = jiffies + (HZ / 2); 12819 add_timer(&ieee->associate_timer); 12820- } 12821+ } 12822 kfree(challenge); 12823 } 12824 12825-void ieee80211_associate_step2(struct ieee80211_device *ieee) 12826+void ieee80211_associate_step2_rtl7(struct ieee80211_device *ieee) 12827 { 12828 struct sk_buff* skb; 12829 struct ieee80211_network *beacon = &ieee->current_network; 12830- 12831+ 12832 del_timer_sync(&ieee->associate_timer); 12833- 12834+ 12835 IEEE80211_DEBUG_MGMT("Sending association request\n"); 12836- 12837+ 12838 ieee->softmac_stats.tx_ass_rq++; 12839- skb=ieee80211_association_req(beacon, ieee); 12840- if (!skb) 12841- ieee80211_associate_abort(ieee); 12842+ skb=ieee80211_association_req_rtl7(beacon, ieee); 12843+ if (!skb) 12844+ ieee80211_associate_abort_rtl7(ieee); 12845 else{ 12846- softmac_mgmt_xmit(skb, ieee); 12847+ softmac_mgmt_xmit_rtl7(skb, ieee); 12848 ieee->associate_timer.expires = jiffies + (HZ / 2); 12849 add_timer(&ieee->associate_timer); 12850- } 12851+ } 12852 } 12853 12854-void ieee80211_associate_complete_wq(struct ieee80211_device *ieee) 12855+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) 12856+void ieee80211_associate_complete_wq_rtl7(struct work_struct *work) 12857+{ 12858+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq); 12859+#else 12860+void ieee80211_associate_complete_wq_rtl7(struct ieee80211_device *ieee) 12861 { 12862+#endif 12863 printk(KERN_INFO "Associated successfully\n"); 12864- if(ieee80211_is_54g(ieee->current_network) && 12865+#if 0 12866+ if(ieee80211_is_54g_rtl7(ieee->current_network) && 12867 (ieee->modulation & IEEE80211_OFDM_MODULATION)){ 12868- 12869+ 12870 ieee->rate = 540; 12871 printk(KERN_INFO"Using G rates\n"); 12872 }else{ 12873 ieee->rate = 110; 12874 printk(KERN_INFO"Using B rates\n"); 12875 } 12876+#else 12877+ printk(KERN_INFO"Using %d MBit\n", (ieee->rate/10) ); 12878+#endif 12879 ieee->link_change(ieee->dev); 12880- notify_wx_assoc_event(ieee); 12881+ notify_wx_assoc_event_rtl7(ieee); 12882 if (ieee->data_hard_resume) 12883 ieee->data_hard_resume(ieee->dev); 12884 netif_carrier_on(ieee->dev); 12885 } 12886 12887-void ieee80211_associate_complete(struct ieee80211_device *ieee) 12888+void ieee80211_associate_complete_rtl7(struct ieee80211_device *ieee) 12889 { 12890 12891 del_timer_sync(&ieee->associate_timer); 12892- 12893+ 12894 ieee->seq_ctrl = 0; 12895 ieee->state = IEEE80211_LINKED; 12896 IEEE80211_DEBUG_MGMT("Successfully associated\n"); 12897- 12898+ 12899 queue_work(ieee->wq, &ieee->associate_complete_wq); 12900 } 12901 12902-void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee) 12903+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) 12904+void ieee80211_associate_procedure_wq_rtl7(struct work_struct *work) 12905 { 12906+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq); 12907+#else 12908+void ieee80211_associate_procedure_wq_rtl7(struct ieee80211_device *ieee) 12909+{ 12910+#endif 12911 ieee->sync_scan_hurryup = 1; 12912 down(&ieee->wx_sem); 12913- 12914 if (ieee->data_hard_stop) 12915 ieee->data_hard_stop(ieee->dev); 12916- 12917- ieee80211_stop_scan(ieee); 12918+ 12919+ ieee80211_stop_scan_rtl7(ieee); 12920 ieee->set_chan(ieee->dev, ieee->current_network.channel); 12921- 12922+ 12923 ieee->associate_seq = 1; 12924- ieee80211_associate_step1(ieee); 12925- 12926+ ieee80211_associate_step1_rtl7(ieee); 12927+ 12928 up(&ieee->wx_sem); 12929 } 12930 12931-inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net) 12932+inline void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net) 12933 { 12934- 12935+ 12936 u8 tmp_ssid[IW_ESSID_MAX_SIZE+1]; 12937 int tmp_ssid_len = 0; 12938- 12939+ 12940 short apset,ssidset,ssidbroad,apmatch,ssidmatch; 12941- 12942- /* we are interested in new new only if we are not associated 12943+ 12944+ /* we are interested in new new only if we are not associated 12945 * and we are not associating / authenticating 12946 */ 12947 if (ieee->state != IEEE80211_NOLINK) 12948- return; 12949- 12950+ return; 12951+ 12952 if ((ieee->iw_mode == IW_MODE_INFRA) && !(net->capability & WLAN_CAPABILITY_BSS)) 12953 return; 12954- 12955+ 12956 if ((ieee->iw_mode == IW_MODE_ADHOC) && !(net->capability & WLAN_CAPABILITY_IBSS)) 12957 return; 12958 12959- 12960+ 12961 if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC){ 12962 /* if the user specified the AP MAC, we need also the essid 12963 * This could be obtained by beacons or, if the network does not 12964@@ -1043,23 +1067,23 @@ 12965 ssidbroad = !(net->ssid_len == 0 || net->ssid[0]== '\0'); 12966 apmatch = (memcmp(ieee->current_network.bssid, net->bssid, ETH_ALEN)==0); 12967 ssidmatch = (0==strncmp(ieee->current_network.ssid, net->ssid, net->ssid_len)); 12968- 12969- 12970- 12971+ 12972+ 12973+ 12974 if ( /* if the user set the AP check if match. 12975 * if the network does not broadcast essid we check the user supplyed ANY essid 12976 * if the network does broadcast and the user does not set essid it is OK 12977 * if the network does broadcast and the user did set essid chech if essid match 12978 */ 12979- ( apset && apmatch && 12980- ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) || 12981+ ( apset && apmatch && 12982+ ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) || 12983 /* if the ap is not set, check that the user set the bssid 12984 * and the network does bradcast and that those two bssid matches 12985- */ 12986- (!apset && ssidset && ssidbroad && ssidmatch) 12987+ */ 12988+ (!apset && ssidset && ssidbroad && ssidmatch) 12989 ){ 12990- 12991- 12992+ 12993+ 12994 /* if the essid is hidden replace it with the 12995 * essid provided by the user. 12996 */ 12997@@ -1068,18 +1092,19 @@ 12998 tmp_ssid_len = ieee->current_network.ssid_len; 12999 } 13000 memcpy(&ieee->current_network, net, sizeof(struct ieee80211_network)); 13001- 13002+ 13003 if (!ssidbroad){ 13004 strncpy(ieee->current_network.ssid, tmp_ssid, IW_ESSID_MAX_SIZE); 13005 ieee->current_network.ssid_len = tmp_ssid_len; 13006 } 13007- printk(KERN_INFO"Linking with %s\n",ieee->current_network.ssid); 13008- 13009+ printk(KERN_INFO"Linking with \"%s\" rate: %d MBit\n",ieee->current_network.ssid, (ieee->rate/10)); 13010+ 13011 if (ieee->iw_mode == IW_MODE_INFRA){ 13012 ieee->state = IEEE80211_ASSOCIATING; 13013 queue_work(ieee->wq, &ieee->associate_procedure_wq); 13014 }else{ 13015- if(ieee80211_is_54g(ieee->current_network) && 13016+#if 0 13017+ if(ieee80211_is_54g_rtl7(ieee->current_network) && 13018 (ieee->modulation & IEEE80211_OFDM_MODULATION)){ 13019 ieee->rate = 540; 13020 printk(KERN_INFO"Using G rates\n"); 13021@@ -1087,44 +1112,45 @@ 13022 ieee->rate = 110; 13023 printk(KERN_INFO"Using B rates\n"); 13024 } 13025+#else 13026+ printk(KERN_INFO"Using %d MBit\n", (ieee->rate/10) ); 13027+#endif 13028 ieee->state = IEEE80211_LINKED; 13029 } 13030- 13031+ 13032 } 13033 } 13034- 13035 } 13036 13037-void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee) 13038+void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee) 13039 { 13040- 13041+ 13042 unsigned long flags; 13043 struct ieee80211_network *target; 13044- 13045+ 13046 spin_lock_irqsave(&ieee->lock, flags); 13047- 13048 list_for_each_entry(target, &ieee->network_list, list) { 13049- 13050+ 13051 /* if the state become different that NOLINK means 13052 * we had found what we are searching for 13053 */ 13054- if (ieee->state != IEEE80211_NOLINK) 13055+ if (ieee->state != IEEE80211_NOLINK) 13056 break; 13057- 13058+ 13059 //if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies)) 13060- ieee80211_softmac_new_net(ieee, target); 13061+ ieee80211_softmac_new_net_rtl7(ieee, target); 13062 } 13063- 13064+ 13065 spin_unlock_irqrestore(&ieee->lock, flags); 13066- 13067+ 13068 } 13069 13070 13071-static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen) 13072+static inline u16 auth_parse_rtl7(struct sk_buff *skb, u8** challenge, int *chlen) 13073 { 13074 struct ieee80211_authentication *a; 13075 u8 *t; 13076- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){ 13077+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){ 13078 IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n",skb->len); 13079 return 0xcafe; 13080 } 13081@@ -1132,58 +1158,58 @@ 13082 a = (struct ieee80211_authentication*) skb->data; 13083 if(skb->len > (sizeof(struct ieee80211_authentication) +3)){ 13084 t = skb->data + sizeof(struct ieee80211_authentication); 13085- 13086+ 13087 if(*(t++) == MFIE_TYPE_CHALLENGE){ 13088 *chlen = *(t++); 13089 *challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC); 13090 memcpy(*challenge, t, *chlen); 13091 } 13092 } 13093- 13094+ 13095 return cpu_to_le16(a->status); 13096- 13097+ 13098 } 13099 13100 13101-int auth_rq_parse(struct sk_buff *skb,u8* dest) 13102+int auth_rq_parse_rtl7(struct sk_buff *skb,u8* dest) 13103 { 13104 struct ieee80211_authentication *a; 13105- 13106- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){ 13107- IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len); 13108+ 13109+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){ 13110+ IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len); 13111 return -1; 13112 } 13113 a = (struct ieee80211_authentication*) skb->data; 13114- 13115+ 13116 memcpy(dest,a->header.addr2, ETH_ALEN); 13117- 13118- if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN) 13119+ 13120+ if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN) 13121 return WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG; 13122- 13123+ 13124 return WLAN_STATUS_SUCCESS; 13125 } 13126 13127-static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src) 13128+static short probe_rq_parse_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src) 13129 { 13130 u8 *tag; 13131 u8 *skbend; 13132 u8 *ssid=NULL; 13133 u8 ssidlen = 0; 13134- 13135+ 13136 struct ieee80211_hdr_3addr *header = 13137 (struct ieee80211_hdr_3addr *) skb->data; 13138- 13139- if (skb->len < sizeof (struct ieee80211_hdr_3addr )) 13140+ 13141+ if (skb->len < sizeof (struct ieee80211_hdr_3addr )) 13142 return -1; /* corrupted */ 13143- 13144+ 13145 memcpy(src,header->addr2, ETH_ALEN); 13146- 13147+ 13148 skbend = (u8*)skb->data + skb->len; 13149- 13150+ 13151 tag = skb->data + sizeof (struct ieee80211_hdr_3addr ); 13152- 13153+ 13154 while (tag+1 < skbend){ 13155- if (*tag == 0){ 13156+ if (*tag == 0){ 13157 ssid = tag+2; 13158 ssidlen = *(tag+1); 13159 break; 13160@@ -1192,88 +1218,88 @@ 13161 tag = tag + *(tag); /* point to the last data byte of the tag */ 13162 tag++; /* point to the next tag */ 13163 } 13164- 13165+ 13166 //IEEE80211DMESG("Card MAC address is "MACSTR, MAC2STR(src)); 13167 if (ssidlen == 0) return 1; 13168- 13169+ 13170 if (!ssid) return 1; /* ssid not found in tagged param */ 13171 return (!strncmp(ssid, ieee->current_network.ssid, ssidlen)); 13172- 13173+ 13174 } 13175 13176-int assoc_rq_parse(struct sk_buff *skb,u8* dest) 13177+int assoc_rq_parse_rtl7(struct sk_buff *skb,u8* dest) 13178 { 13179 struct ieee80211_assoc_request_frame *a; 13180- 13181- if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) - 13182- sizeof(struct ieee80211_info_element))) { 13183- 13184+ 13185+ if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) - 13186+ sizeof(struct ieee80211_info_element))) { 13187+ 13188 IEEE80211_DEBUG_MGMT("invalid len in auth request:%d \n", skb->len); 13189 return -1; 13190 } 13191- 13192+ 13193 a = (struct ieee80211_assoc_request_frame*) skb->data; 13194- 13195+ 13196 memcpy(dest,a->header.addr2,ETH_ALEN); 13197- 13198+ 13199 return 0; 13200 } 13201 13202-static inline u16 assoc_parse(struct sk_buff *skb, int *aid) 13203+static inline u16 assoc_parse_rtl7(struct sk_buff *skb, int *aid) 13204 { 13205 struct ieee80211_assoc_response_frame *a; 13206- if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){ 13207+ if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){ 13208 IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len); 13209 return 0xcafe; 13210 } 13211- 13212+ 13213 a = (struct ieee80211_assoc_response_frame*) skb->data; 13214 *aid = le16_to_cpu(a->aid) & 0x3fff; 13215 return le16_to_cpu(a->status); 13216 } 13217 13218 static inline void 13219-ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb) 13220+ieee80211_rx_probe_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb) 13221 { 13222 u8 dest[ETH_ALEN]; 13223- 13224+ 13225 //IEEE80211DMESG("Rx probe"); 13226 ieee->softmac_stats.rx_probe_rq++; 13227 //DMESG("Dest is "MACSTR, MAC2STR(dest)); 13228- if (probe_rq_parse(ieee, skb, dest)){ 13229+ if (probe_rq_parse_rtl7(ieee, skb, dest)){ 13230 //IEEE80211DMESG("Was for me!"); 13231 ieee->softmac_stats.tx_probe_rs++; 13232- ieee80211_resp_to_probe(ieee, dest); 13233+ ieee80211_resp_to_probe_rtl7(ieee, dest); 13234 } 13235 } 13236 13237 static inline void 13238-ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb) 13239+ieee80211_rx_auth_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb) 13240 { 13241 u8 dest[ETH_ALEN]; 13242 int status; 13243 //IEEE80211DMESG("Rx probe"); 13244 ieee->softmac_stats.rx_auth_rq++; 13245- 13246- if ((status = auth_rq_parse(skb, dest))!= -1){ 13247- ieee80211_resp_to_auth(ieee, status, dest); 13248+ 13249+ if ((status = auth_rq_parse_rtl7(skb, dest))!= -1){ 13250+ ieee80211_resp_to_auth_rtl7(ieee, status, dest); 13251 } 13252 //DMESG("Dest is "MACSTR, MAC2STR(dest)); 13253- 13254+ 13255 } 13256 13257 static inline void 13258-ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb) 13259+ieee80211_rx_assoc_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb) 13260 { 13261- 13262+ 13263 u8 dest[ETH_ALEN]; 13264 //unsigned long flags; 13265- 13266+ 13267 ieee->softmac_stats.rx_ass_rq++; 13268- if (assoc_rq_parse(skb,dest) != -1){ 13269- ieee80211_resp_to_assoc_rq(ieee, dest); 13270+ if (assoc_rq_parse_rtl7(skb,dest) != -1){ 13271+ ieee80211_resp_to_assoc_rq_rtl7(ieee, dest); 13272 } 13273- 13274+ 13275 printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest)); 13276 //FIXME 13277 #if 0 13278@@ -1285,25 +1311,25 @@ 13279 13280 13281 13282-void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr) 13283+void ieee80211_sta_ps_send_null_frame_rtl7(struct ieee80211_device *ieee, short pwr) 13284 { 13285- 13286- struct sk_buff *buf = ieee80211_null_func(ieee, pwr); 13287- 13288+ 13289+ struct sk_buff *buf = ieee80211_null_func_rtl7(ieee, pwr); 13290+ 13291 if (buf) 13292- softmac_ps_mgmt_xmit(buf, ieee); 13293+ softmac_ps_mgmt_xmit_rtl7(buf, ieee); 13294 13295-} 13296+} 13297 13298 13299-short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l) 13300-{ 13301+short ieee80211_sta_ps_sleep_rtl7(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l) 13302+{ 13303 int timeout = ieee->ps_timeout; 13304 u8 dtim; 13305 /*if(ieee->ps == IEEE80211_PS_DISABLED || 13306- ieee->iw_mode != IW_MODE_INFRA || 13307+ ieee->iw_mode != IW_MODE_INFRA || 13308 ieee->state != IEEE80211_LINKED) 13309- 13310+ 13311 return 0; 13312 */ 13313 dtim = ieee->current_network.dtim_data; 13314@@ -1312,133 +1338,133 @@ 13315 return 0; 13316 //printk("VALID\n"); 13317 ieee->current_network.dtim_data = IEEE80211_DTIM_INVALID; 13318- 13319+ 13320 if(dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST)& ieee->ps)) 13321 return 2; 13322- 13323+ 13324 if(!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout))) 13325 return 0; 13326- 13327+ 13328 if(!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout))) 13329 return 0; 13330- 13331+ 13332 if((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE ) && 13333 (ieee->mgmt_queue_tail != ieee->mgmt_queue_head)) 13334 return 0; 13335- 13336+ 13337 if(time_l){ 13338- *time_l = ieee->current_network.last_dtim_sta_time[0] 13339- + (ieee->current_network.beacon_interval 13340+ *time_l = ieee->current_network.last_dtim_sta_time[0] 13341+ + (ieee->current_network.beacon_interval 13342 * ieee->current_network.dtim_period) * 1000; 13343 } 13344- 13345+ 13346 if(time_h){ 13347 *time_h = ieee->current_network.last_dtim_sta_time[1]; 13348 if(time_l && *time_l < ieee->current_network.last_dtim_sta_time[0]) 13349 *time_h += 1; 13350 } 13351- 13352+ 13353 return 1; 13354- 13355- 13356+ 13357+ 13358 } 13359 13360-inline void ieee80211_sta_ps(struct ieee80211_device *ieee) 13361+inline void ieee80211_sta_ps_rtl7(struct ieee80211_device *ieee) 13362 { 13363 13364 u32 th,tl; 13365 short sleep; 13366- 13367+ 13368 unsigned long flags,flags2; 13369- 13370+ 13371 spin_lock_irqsave(&ieee->lock, flags); 13372- 13373+ 13374 if((ieee->ps == IEEE80211_PS_DISABLED || 13375- ieee->iw_mode != IW_MODE_INFRA || 13376+ ieee->iw_mode != IW_MODE_INFRA || 13377 ieee->state != IEEE80211_LINKED)){ 13378- 13379- #warning CHECK_LOCK_HERE 13380+ 13381+// #warning CHECK_LOCK_HERE 13382 spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); 13383- 13384- ieee80211_sta_wakeup(ieee, 1); 13385- 13386+ 13387+ ieee80211_sta_wakeup_rtl7(ieee, 1); 13388+ printk(KERN_WARNING "wakeup 1!\n" ); 13389 spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); 13390 } 13391- 13392- sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl); 13393+ 13394+ sleep = ieee80211_sta_ps_sleep_rtl7(ieee,&th, &tl); 13395 /* 2 wake, 1 sleep, 0 do nothing */ 13396 if(sleep == 0) 13397 goto out; 13398- 13399+ 13400 if(sleep == 1){ 13401- 13402+ 13403 if(ieee->sta_sleep == 1) 13404 ieee->enter_sleep_state(ieee->dev,th,tl); 13405- 13406+ 13407 else if(ieee->sta_sleep == 0){ 13408 // printk("send null 1\n"); 13409 spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); 13410- 13411+ 13412 if(ieee->ps_is_queue_empty(ieee->dev)){ 13413- 13414- 13415+ 13416+ 13417 ieee->sta_sleep = 2; 13418- 13419+ 13420 ieee->ps_request_tx_ack(ieee->dev); 13421- 13422- ieee80211_sta_ps_send_null_frame(ieee,1); 13423- 13424+ 13425+ ieee80211_sta_ps_send_null_frame_rtl7(ieee,1); 13426+ 13427 ieee->ps_th = th; 13428 ieee->ps_tl = tl; 13429- } 13430+ } 13431 spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); 13432- 13433+ 13434 } 13435- 13436- 13437+ 13438+ 13439 }else if(sleep == 2){ 13440-#warning CHECK_LOCK_HERE 13441+// #warning CHECK_LOCK_HERE 13442 spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); 13443- 13444- ieee80211_sta_wakeup(ieee,1); 13445- 13446+ 13447+ ieee80211_sta_wakeup_rtl7(ieee,1); 13448+ printk(KERN_WARNING "wakeup 2!\n" ); 13449 spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); 13450 } 13451 13452-out: 13453+out: 13454 spin_unlock_irqrestore(&ieee->lock, flags); 13455- 13456+ 13457 } 13458 13459-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl) 13460+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl) 13461 { 13462 if(ieee->sta_sleep == 0){ 13463 if(nl){ 13464 printk("Warning: driver is probably failing to report TX ps error\n"); 13465 ieee->ps_request_tx_ack(ieee->dev); 13466- ieee80211_sta_ps_send_null_frame(ieee, 0); 13467+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0); 13468 } 13469 return; 13470- 13471+ 13472 } 13473- 13474- if(ieee->sta_sleep == 1) 13475+ 13476+ if(ieee->sta_sleep == 1) 13477 ieee->sta_wake_up(ieee->dev); 13478- 13479+ 13480 ieee->sta_sleep = 0; 13481- 13482+ 13483 if(nl){ 13484 ieee->ps_request_tx_ack(ieee->dev); 13485- ieee80211_sta_ps_send_null_frame(ieee, 0); 13486+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0); 13487 } 13488 } 13489 13490-void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success) 13491+void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success) 13492 { 13493 unsigned long flags,flags2; 13494- 13495+ 13496 spin_lock_irqsave(&ieee->lock, flags); 13497- 13498+ 13499 if(ieee->sta_sleep == 2){ 13500 /* Null frame with PS bit set */ 13501 if(success){ 13502@@ -1451,10 +1477,10 @@ 13503 } 13504 /* 21112005 - tx again null without PS bit if lost */ 13505 else { 13506- 13507+ 13508 if((ieee->sta_sleep == 0) && !success){ 13509 spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); 13510- ieee80211_sta_ps_send_null_frame(ieee, 0); 13511+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0); 13512 spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); 13513 } 13514 } 13515@@ -1462,129 +1488,132 @@ 13516 } 13517 13518 inline int 13519-ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, 13520+ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, 13521 struct ieee80211_rx_stats *rx_stats, u16 type, 13522 u16 stype) 13523 { 13524 struct ieee80211_hdr_3addr *header; 13525- header = (struct ieee80211_hdr_3addr *) skb->data; 13526 u16 errcode; 13527 u8* challenge; 13528 int chlen; 13529 int aid; 13530- 13531+ 13532+ chlen = 0; 13533+ 13534+ header = (struct ieee80211_hdr_3addr *) skb->data; 13535+ 13536 if(!ieee->proto_started) 13537 return 0; 13538- 13539+ 13540 if(ieee->sta_sleep || (ieee->ps != IEEE80211_PS_DISABLED && 13541- ieee->iw_mode == IW_MODE_INFRA && 13542+ ieee->iw_mode == IW_MODE_INFRA && 13543 ieee->state == IEEE80211_LINKED)) 13544- 13545+ 13546 tasklet_schedule(&ieee->ps_task); 13547- 13548+ 13549 if(WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_PROBE_RESP && 13550 WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_BEACON) 13551 ieee->last_rx_ps_time = jiffies; 13552- 13553+ 13554 switch (WLAN_FC_GET_STYPE(header->frame_ctl)) { 13555- 13556+ 13557 case IEEE80211_STYPE_ASSOC_RESP: 13558 case IEEE80211_STYPE_REASSOC_RESP: 13559- 13560+ 13561 IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n", 13562 WLAN_FC_GET_STYPE(header->frame_ctl)); 13563 if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && 13564- ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED && 13565+ ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED && 13566 ieee->iw_mode == IW_MODE_INFRA){ 13567- if (0 == (errcode=assoc_parse(skb, &aid))){ 13568- 13569+ if (0 == (errcode=assoc_parse_rtl7(skb, &aid))){ 13570+ 13571 ieee->state=IEEE80211_LINKED; 13572 ieee->assoc_id = aid; 13573 ieee->softmac_stats.rx_ass_ok++; 13574- 13575- ieee80211_associate_complete(ieee); 13576+ 13577+ ieee80211_associate_complete_rtl7(ieee); 13578 }else{ 13579 ieee->softmac_stats.rx_ass_err++; 13580 IEEE80211_DEBUG_MGMT( 13581 "Association response status code 0x%x\n", 13582 errcode); 13583- ieee80211_associate_abort(ieee); 13584+ ieee80211_associate_abort_rtl7(ieee); 13585 } 13586 } 13587 break; 13588- 13589+ 13590 case IEEE80211_STYPE_ASSOC_REQ: 13591 case IEEE80211_STYPE_REASSOC_REQ: 13592- 13593+ 13594 if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && 13595 ieee->iw_mode == IW_MODE_MASTER) 13596- 13597- ieee80211_rx_assoc_rq(ieee, skb); 13598+ 13599+ ieee80211_rx_assoc_rq_rtl7(ieee, skb); 13600 break; 13601- 13602+ 13603 case IEEE80211_STYPE_AUTH: 13604- 13605+ 13606 if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE){ 13607- if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING && 13608+ if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING && 13609 ieee->iw_mode == IW_MODE_INFRA){ 13610- 13611+ 13612 IEEE80211_DEBUG_MGMT("Received authentication response"); 13613- 13614- if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){ 13615+ 13616+ if (0 == (errcode=auth_parse_rtl7(skb, &challenge, &chlen))){ 13617 if(ieee->open_wep || !challenge){ 13618 ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED; 13619 ieee->softmac_stats.rx_auth_rs_ok++; 13620- 13621- ieee80211_associate_step2(ieee); 13622+ 13623+ ieee80211_associate_step2_rtl7(ieee); 13624 }else{ 13625- ieee80211_auth_challenge(ieee, challenge, chlen); 13626+ ieee80211_auth_challenge_rtl7(ieee, challenge, chlen); 13627 } 13628 }else{ 13629 ieee->softmac_stats.rx_auth_rs_err++; 13630 IEEE80211_DEBUG_MGMT("Authentication respose status code 0x%x",errcode); 13631- ieee80211_associate_abort(ieee); 13632+ ieee80211_associate_abort_rtl7(ieee); 13633 } 13634- 13635+ 13636 }else if (ieee->iw_mode == IW_MODE_MASTER){ 13637- ieee80211_rx_auth_rq(ieee, skb); 13638+ ieee80211_rx_auth_rq_rtl7(ieee, skb); 13639 } 13640 } 13641 break; 13642- 13643+ 13644 case IEEE80211_STYPE_PROBE_REQ: 13645- 13646- if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) && 13647- ((ieee->iw_mode == IW_MODE_ADHOC || 13648+ 13649+ if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) && 13650+ ((ieee->iw_mode == IW_MODE_ADHOC || 13651 ieee->iw_mode == IW_MODE_MASTER) && 13652 ieee->state == IEEE80211_LINKED)) 13653- 13654- ieee80211_rx_probe_rq(ieee, skb); 13655+ 13656+ ieee80211_rx_probe_rq_rtl7(ieee, skb); 13657 break; 13658- 13659+ 13660 case IEEE80211_STYPE_DISASSOC: 13661 case IEEE80211_STYPE_DEAUTH: 13662- /* FIXME for now repeat all the association procedure 13663+ /* FIXME for now repeat all the association procedure 13664 * both for disassociation and deauthentication 13665 */ 13666 if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && 13667- ieee->state == IEEE80211_LINKED && 13668+ ieee->state == IEEE80211_LINKED && 13669 ieee->iw_mode == IW_MODE_INFRA){ 13670- 13671+ 13672 ieee->state = IEEE80211_ASSOCIATING; 13673 ieee->softmac_stats.reassoc++; 13674- 13675- notify_wx_assoc_event(ieee); 13676- 13677+ 13678+ notify_wx_assoc_event_rtl7(ieee); 13679+ 13680 queue_work(ieee->wq, &ieee->associate_procedure_wq); 13681 } 13682- 13683+ 13684 break; 13685- 13686- default: 13687+ 13688+ default: 13689 return -1; 13690 break; 13691 } 13692- 13693+ 13694 //dev_kfree_skb_any(skb); 13695 return 0; 13696 } 13697@@ -1602,21 +1631,21 @@ 13698 * This might be useful if each fragment need it's own 13699 * descriptor, thus just keep a total free memory > than 13700 * the max fragmentation treshold is not enought.. If the 13701- * ieee802.11 stack passed a TXB struct then you needed 13702- * to keep N free descriptors where 13703+ * ieee802.11 stack passed a TXB struct then you needed 13704+ * to keep N free descriptors where 13705 * N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD 13706 * In this way you need just one and the 802.11 stack 13707- * will take care of buffering fragments and pass them to 13708+ * will take care of buffering fragments and pass them to 13709 * to the driver later, when it wakes the queue. 13710- */ 13711- 13712-void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee) 13713+ */ 13714+ 13715+void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee) 13716 { 13717- 13718- 13719+ 13720+ 13721 unsigned long flags; 13722 int i; 13723- 13724+ 13725 spin_lock_irqsave(&ieee->lock,flags); 13726 #if 0 13727 if(ieee->queue_stop){ 13728@@ -1627,13 +1656,13 @@ 13729 err = 1; 13730 goto exit; 13731 } 13732- 13733+ 13734 ieee->stats.tx_bytes+=skb->len; 13735- 13736- 13737+ 13738+ 13739 txb=ieee80211_skb_to_txb(ieee,skb); 13740- 13741- 13742+ 13743+ 13744 if(txb==NULL){ 13745 IEEE80211DMESG("WW: IEEE stack failed to provide txb"); 13746 //dev_kfree_skb_any(skb); 13747@@ -1641,12 +1670,12 @@ 13748 goto exit; 13749 } 13750 #endif 13751- 13752+ 13753 /* called with 2nd parm 0, no tx mgmt lock required */ 13754- ieee80211_sta_wakeup(ieee,0); 13755+ ieee80211_sta_wakeup_rtl7(ieee,0); 13756 13757 for(i = 0; i < txb->nr_frags; i++) { 13758- 13759+ 13760 if (ieee->queue_stop){ 13761 ieee->tx_pending.txb = txb; 13762 ieee->tx_pending.frag = i; 13763@@ -1658,29 +1687,29 @@ 13764 //(i+1)<txb->nr_frags); 13765 ieee->stats.tx_packets++; 13766 ieee->stats.tx_bytes += txb->fragments[i]->len; 13767- ieee->dev->trans_start = jiffies; 13768+ ieee->dev->trans_start = jiffies; 13769 } 13770- } 13771- 13772- ieee80211_txb_free(txb); 13773- 13774+ } 13775+ 13776+ ieee80211_txb_free_rtl7(txb); 13777+ 13778 exit: 13779 spin_unlock_irqrestore(&ieee->lock,flags); 13780- 13781+ 13782 } 13783 13784 /* called with ieee->lock acquired */ 13785-void ieee80211_resume_tx(struct ieee80211_device *ieee) 13786+void ieee80211_resume_tx_rtl7(struct ieee80211_device *ieee) 13787 { 13788 int i; 13789 for(i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) { 13790- 13791+ 13792 if (ieee->queue_stop){ 13793 ieee->tx_pending.frag = i; 13794 return; 13795 }else{ 13796- 13797- ieee->softmac_data_hard_start_xmit( 13798+ 13799+ ieee->softmac_data_hard_start_xmit( 13800 ieee->tx_pending.txb->fragments[i], 13801 ieee->dev,ieee->rate); 13802 //(i+1)<ieee->tx_pending.txb->nr_frags); 13803@@ -1688,21 +1717,21 @@ 13804 ieee->dev->trans_start = jiffies; 13805 } 13806 } 13807- 13808- 13809- ieee80211_txb_free(ieee->tx_pending.txb); 13810+ 13811+ 13812+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb); 13813 ieee->tx_pending.txb = NULL; 13814 } 13815 13816 13817-void ieee80211_reset_queue(struct ieee80211_device *ieee) 13818+void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee) 13819 { 13820 unsigned long flags; 13821- 13822+ 13823 spin_lock_irqsave(&ieee->lock,flags); 13824- init_mgmt_queue(ieee); 13825+ init_mgmt_queue_rtl7(ieee); 13826 if (ieee->tx_pending.txb){ 13827- ieee80211_txb_free(ieee->tx_pending.txb); 13828+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb); 13829 ieee->tx_pending.txb = NULL; 13830 } 13831 ieee->queue_stop = 0; 13832@@ -1710,23 +1739,23 @@ 13833 13834 } 13835 13836-void ieee80211_wake_queue(struct ieee80211_device *ieee) 13837+void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee) 13838 { 13839 13840 unsigned long flags; 13841 struct sk_buff *skb; 13842 struct ieee80211_hdr_3addr *header; 13843- 13844+ 13845 spin_lock_irqsave(&ieee->lock,flags); 13846 if (! ieee->queue_stop) goto exit; 13847- 13848+ 13849 ieee->queue_stop = 0; 13850- 13851+ 13852 if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){ 13853- while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){ 13854- 13855+ while (!ieee->queue_stop && (skb = dequeue_mgmt_rtl7(ieee))){ 13856+ 13857 header = (struct ieee80211_hdr_3addr *) skb->data; 13858- 13859+ 13860 header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4); 13861 13862 if (ieee->seq_ctrl == 0xFFF) 13863@@ -1738,19 +1767,19 @@ 13864 } 13865 } 13866 if (!ieee->queue_stop && ieee->tx_pending.txb) 13867- ieee80211_resume_tx(ieee); 13868- 13869+ ieee80211_resume_tx_rtl7(ieee); 13870+ 13871 if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){ 13872 ieee->softmac_stats.swtxawake++; 13873 netif_wake_queue(ieee->dev); 13874 } 13875- 13876+ 13877 exit : 13878 spin_unlock_irqrestore(&ieee->lock,flags); 13879 } 13880 13881 13882-void ieee80211_stop_queue(struct ieee80211_device *ieee) 13883+void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee) 13884 { 13885 //unsigned long flags; 13886 //spin_lock_irqsave(&ieee->lock,flags); 13887@@ -1761,81 +1790,88 @@ 13888 } 13889 ieee->queue_stop = 1; 13890 //spin_unlock_irqrestore(&ieee->lock,flags); 13891- 13892+ 13893 } 13894 13895 13896-inline void ieee80211_randomize_cell(struct ieee80211_device *ieee) 13897+inline void ieee80211_randomize_cell_rtl7(struct ieee80211_device *ieee) 13898 { 13899- 13900+ 13901 get_random_bytes(ieee->current_network.bssid, ETH_ALEN); 13902- 13903+ 13904 /* an IBSS cell address must have the two less significant 13905- * bits of the first byte = 2 13906+ * bits of the first byte = 2 13907 */ 13908 ieee->current_network.bssid[0] &= ~0x01; 13909 ieee->current_network.bssid[0] |= 0x02; 13910 } 13911 13912 /* called in user context only */ 13913-void ieee80211_start_master_bss(struct ieee80211_device *ieee) 13914+void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee) 13915 { 13916 ieee->assoc_id = 1; 13917- 13918+ 13919 if (ieee->current_network.ssid_len == 0){ 13920- strncpy(ieee->current_network.ssid, 13921+ strncpy(ieee->current_network.ssid, 13922 IEEE80211_DEFAULT_TX_ESSID, 13923 IW_ESSID_MAX_SIZE); 13924- 13925+ 13926 ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID); 13927 ieee->ssid_set = 1; 13928 } 13929- 13930+ 13931 memcpy(ieee->current_network.bssid, ieee->dev->dev_addr, ETH_ALEN); 13932- 13933+ 13934 ieee->set_chan(ieee->dev, ieee->current_network.channel); 13935 ieee->state = IEEE80211_LINKED; 13936 ieee->link_change(ieee->dev); 13937- notify_wx_assoc_event(ieee); 13938- 13939+ notify_wx_assoc_event_rtl7(ieee); 13940+ 13941 if (ieee->data_hard_resume) 13942 ieee->data_hard_resume(ieee->dev); 13943- 13944+ 13945 netif_carrier_on(ieee->dev); 13946 } 13947 13948-void ieee80211_start_monitor_mode(struct ieee80211_device *ieee) 13949+void ieee80211_start_monitor_mode_rtl7(struct ieee80211_device *ieee) 13950 { 13951 if(ieee->raw_tx){ 13952- 13953+ 13954 if (ieee->data_hard_resume) 13955 ieee->data_hard_resume(ieee->dev); 13956- 13957+ 13958 netif_carrier_on(ieee->dev); 13959 } 13960 } 13961-void ieee80211_start_ibss_wq(struct ieee80211_device *ieee) 13962+ 13963+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) 13964+void ieee80211_start_ibss_wq_rtl7(struct work_struct *work) 13965+{ 13966+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, start_ibss_wq); 13967+#else 13968+void ieee80211_start_ibss_wq_rtl7(struct ieee80211_device *ieee) 13969 { 13970- 13971+#endif 13972+ 13973 /* iwconfig mode ad-hoc will schedule this and return 13974 * on the other hand this will block further iwconfig SET 13975 * operations because of the wx_sem hold. 13976 * Anyway some most set operations set a flag to speed-up 13977- * (abort) this wq (when syncro scanning) before sleeping 13978+ * (abort) this wq (when syncro scanning) before sleeping 13979 * on the semaphore 13980 */ 13981- 13982+ 13983 down(&ieee->wx_sem); 13984- 13985+ 13986 if (ieee->current_network.ssid_len == 0){ 13987 strcpy(ieee->current_network.ssid,IEEE80211_DEFAULT_TX_ESSID); 13988 ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID); 13989 ieee->ssid_set = 1; 13990- } 13991- 13992+ } 13993+ 13994 /* check if we have this cell in our network list */ 13995- ieee80211_softmac_check_all_nets(ieee); 13996- 13997+ ieee80211_softmac_check_all_nets_rtl7(ieee); 13998+ 13999 /* if not then the state is not linked. Maybe the user swithced to 14000 * ad-hoc mode just after being in monitor mode, or just after 14001 * being very few time in managed mode (so the card have had no 14002@@ -1851,29 +1887,29 @@ 14003 * associated. 14004 */ 14005 if (ieee->state == IEEE80211_NOLINK) 14006- ieee80211_start_scan_syncro(ieee); 14007+ ieee80211_start_scan_syncro_rtl7(ieee); 14008 14009 /* the network definitively is not here.. create a new cell */ 14010 if (ieee->state == IEEE80211_NOLINK){ 14011- printk("creating new IBSS cell\n"); 14012+ printk("creating new IBSS cell\n"); 14013 if(!ieee->wap_set) 14014- ieee80211_randomize_cell(ieee); 14015- 14016+ ieee80211_randomize_cell_rtl7(ieee); 14017+ 14018 if(ieee->modulation & IEEE80211_CCK_MODULATION){ 14019- 14020+ 14021 ieee->current_network.rates_len = 4; 14022- 14023+ 14024 ieee->current_network.rates[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB; 14025 ieee->current_network.rates[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB; 14026 ieee->current_network.rates[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB; 14027 ieee->current_network.rates[3] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB; 14028- 14029+ 14030 }else 14031 ieee->current_network.rates_len = 0; 14032- 14033+ 14034 if(ieee->modulation & IEEE80211_OFDM_MODULATION){ 14035 ieee->current_network.rates_ex_len = 8; 14036- 14037+ 14038 ieee->current_network.rates_ex[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB; 14039 ieee->current_network.rates_ex[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_9MB; 14040 ieee->current_network.rates_ex[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_12MB; 14041@@ -1882,44 +1918,44 @@ 14042 ieee->current_network.rates_ex[5] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB; 14043 ieee->current_network.rates_ex[6] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB; 14044 ieee->current_network.rates_ex[7] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB; 14045- 14046- ieee->rate = 540; 14047+ 14048+// ieee->rate = 540; 14049 }else{ 14050 ieee->current_network.rates_ex_len = 0; 14051- ieee->rate = 110; 14052+// ieee->rate = 110; 14053 } 14054- 14055+ 14056 ieee->current_network.atim_window = 0; 14057 ieee->current_network.capability = WLAN_CAPABILITY_IBSS; 14058 if(ieee->short_slot) 14059 ieee->current_network.capability |= WLAN_CAPABILITY_SHORT_SLOT; 14060- 14061+ 14062 } 14063- 14064+ 14065 ieee->state = IEEE80211_LINKED; 14066- 14067+ 14068 ieee->set_chan(ieee->dev, ieee->current_network.channel); 14069 ieee->link_change(ieee->dev); 14070- 14071- notify_wx_assoc_event(ieee); 14072- 14073- ieee80211_start_send_beacons(ieee); 14074- 14075+ 14076+ notify_wx_assoc_event_rtl7(ieee); 14077+ 14078+ ieee80211_start_send_beacons_rtl7(ieee); 14079+ 14080 if (ieee->data_hard_resume) 14081 ieee->data_hard_resume(ieee->dev); 14082- 14083+ 14084 netif_carrier_on(ieee->dev); 14085- 14086+ 14087 up(&ieee->wx_sem); 14088 } 14089 14090-inline void ieee80211_start_ibss(struct ieee80211_device *ieee) 14091+inline void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee) 14092 { 14093 queue_work(ieee->wq, &ieee->start_ibss_wq); 14094 } 14095 14096 /* this is called only in user context, with wx_sem held */ 14097-void ieee80211_start_bss(struct ieee80211_device *ieee) 14098+void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee) 14099 { 14100 unsigned long flags; 14101 /* check if we have already found the net we 14102@@ -1927,8 +1963,8 @@ 14103 * if not (we are disassociated and we are not 14104 * in associating / authenticating phase) start the background scanning. 14105 */ 14106- ieee80211_softmac_check_all_nets(ieee); 14107- 14108+ ieee80211_softmac_check_all_nets_rtl7(ieee); 14109+ 14110 /* ensure no-one start an associating process (thus setting 14111 * the ieee->state to ieee80211_ASSOCIATING) while we 14112 * have just cheked it and we are going to enable scan. 14113@@ -1937,41 +1973,49 @@ 14114 * the rx path), so we cannot be in the middle of such function 14115 */ 14116 spin_lock_irqsave(&ieee->lock, flags); 14117- 14118 if (ieee->state == IEEE80211_NOLINK) 14119- ieee80211_start_scan(ieee); 14120- 14121+ ieee80211_start_scan_rtl7(ieee); 14122+ 14123 spin_unlock_irqrestore(&ieee->lock, flags); 14124 } 14125 14126 /* called only in userspace context */ 14127-void ieee80211_disassociate(struct ieee80211_device *ieee) 14128+void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee) 14129 { 14130 netif_carrier_off(ieee->dev); 14131- 14132+ 14133 if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE) 14134- ieee80211_reset_queue(ieee); 14135- 14136+ ieee80211_reset_queue_rtl7(ieee); 14137+ 14138 if (ieee->data_hard_stop) 14139 ieee->data_hard_stop(ieee->dev); 14140- 14141+ 14142 ieee->state = IEEE80211_NOLINK; 14143 ieee->link_change(ieee->dev); 14144- notify_wx_assoc_event(ieee); 14145- 14146+ notify_wx_assoc_event_rtl7(ieee); 14147+ 14148 } 14149-void ieee80211_associate_retry_wq(struct ieee80211_device *ieee) 14150+ 14151+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) 14152+void ieee80211_associate_retry_wq_rtl7(struct work_struct *work) 14153+{ 14154+ struct delayed_work *dwork = container_of(work, struct delayed_work, work); 14155+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq); 14156+#else 14157+void ieee80211_associate_retry_wq_rtl7(struct ieee80211_device *ieee) 14158 { 14159+#endif 14160 unsigned long flags; 14161- 14162+ 14163 down(&ieee->wx_sem); 14164+ 14165 if(!ieee->proto_started) 14166 goto exit; 14167- 14168+ 14169 if(ieee->state != IEEE80211_ASSOCIATING_RETRY) 14170 goto exit; 14171- 14172- /* until we do not set the state to IEEE80211_NOLINK 14173+ 14174+ /* until we do not set the state to IEEE80211_NOLINK 14175 * there are no possibility to have someone else trying 14176 * to start an association procdure (we get here with 14177 * ieee->state = IEEE80211_ASSOCIATING). 14178@@ -1981,122 +2025,120 @@ 14179 * RX path works with ieee->lock held so there are no 14180 * problems. If we are still disassociated then start a scan. 14181 * the lock here is necessary to ensure no one try to start 14182- * an association procedure when we have just checked the 14183+ * an association procedure when we have just checked the 14184 * state and we are going to start the scan. 14185 */ 14186 ieee->state = IEEE80211_NOLINK; 14187 14188- ieee80211_softmac_check_all_nets(ieee); 14189- 14190+ ieee80211_softmac_check_all_nets_rtl7(ieee); 14191+ 14192 spin_lock_irqsave(&ieee->lock, flags); 14193- 14194+ 14195 if(ieee->state == IEEE80211_NOLINK) 14196- ieee80211_start_scan(ieee); 14197- 14198+ ieee80211_start_scan_rtl7(ieee); 14199+ 14200 spin_unlock_irqrestore(&ieee->lock, flags); 14201 14202 exit: 14203 up(&ieee->wx_sem); 14204 } 14205 14206-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee) 14207+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee) 14208 { 14209 u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff}; 14210- 14211+ 14212 struct sk_buff *skb; 14213 struct ieee80211_probe_response *b; 14214- 14215- skb = ieee80211_probe_resp(ieee, broadcast_addr); 14216- 14217- if (!skb) 14218+ 14219+ skb = ieee80211_probe_resp_rtl7(ieee, broadcast_addr); 14220+ 14221+ if (!skb) 14222 return NULL; 14223- 14224+ 14225 b = (struct ieee80211_probe_response *) skb->data; 14226 b->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_BEACON); 14227- 14228+ 14229 return skb; 14230- 14231+ 14232 } 14233 14234-struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee) 14235+struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee) 14236 { 14237 struct sk_buff *skb; 14238 struct ieee80211_probe_response *b; 14239- 14240- skb = ieee80211_get_beacon_(ieee); 14241- if(!skb) 14242+ 14243+ skb = ieee80211_get_beacon__rtl7(ieee); 14244+ if(!skb) 14245 return NULL; 14246- 14247- b = (struct ieee80211_probe_response *) skb->data; 14248+ 14249+ b = (struct ieee80211_probe_response *) skb->data; 14250 b->header.seq_ctrl = cpu_to_le16(ieee->seq_ctrl << 4); 14251- 14252+ 14253 if (ieee->seq_ctrl == 0xFFF) 14254 ieee->seq_ctrl = 0; 14255 else 14256 ieee->seq_ctrl++; 14257- 14258+ 14259 return skb; 14260 } 14261 14262-void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee) 14263+void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee) 14264 { 14265 ieee->sync_scan_hurryup = 1; 14266 down(&ieee->wx_sem); 14267- ieee80211_stop_protocol(ieee); 14268+ 14269+ ieee80211_stop_protocol_rtl7(ieee); 14270 up(&ieee->wx_sem); 14271 } 14272 14273 14274-void ieee80211_stop_protocol(struct ieee80211_device *ieee) 14275+void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee) 14276 { 14277 if (!ieee->proto_started) 14278 return; 14279- 14280+ 14281 ieee->proto_started = 0; 14282- 14283- ieee80211_stop_send_beacons(ieee); 14284- 14285+ 14286+ ieee80211_stop_send_beacons_rtl7(ieee); 14287+ 14288 del_timer_sync(&ieee->associate_timer); 14289- cancel_delayed_work(&ieee->associate_retry_wq); 14290- 14291- ieee80211_stop_scan(ieee); 14292+ cancel_delayed_work(&ieee->associate_retry_wq); 14293+ 14294+ ieee80211_stop_scan_rtl7(ieee); 14295 14296- ieee80211_disassociate(ieee); 14297+ ieee80211_disassociate_rtl7(ieee); 14298 } 14299 14300-void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee) 14301+void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee) 14302 { 14303 ieee->sync_scan_hurryup = 0; 14304 down(&ieee->wx_sem); 14305- ieee80211_start_protocol(ieee); 14306+ ieee80211_start_protocol_rtl7(ieee); 14307 up(&ieee->wx_sem); 14308 } 14309 14310-void ieee80211_start_protocol(struct ieee80211_device *ieee) 14311+void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee) 14312 { 14313 short ch = 0; 14314- 14315 if (ieee->proto_started) 14316 return; 14317- 14318+ 14319 ieee->proto_started = 1; 14320- 14321+ 14322 if (ieee->current_network.channel == 0){ 14323 do{ 14324 ch++; 14325- if (ch > MAX_CHANNEL_NUMBER) 14326+ if (ch > MAX_CHANNEL_NUMBER) 14327 return; /* no channel found */ 14328- 14329+ 14330 }while(!ieee->channel_map[ch]); 14331- 14332+ 14333 ieee->current_network.channel = ch; 14334 } 14335- 14336+ 14337 if (ieee->current_network.beacon_interval == 0) 14338 ieee->current_network.beacon_interval = 100; 14339- 14340 ieee->set_chan(ieee->dev,ieee->current_network.channel); 14341- 14342 ieee->last_seq_num = -1; 14343 ieee->last_frag_num = -1; 14344 ieee->last_packet_time = 0; 14345@@ -2107,30 +2149,27 @@ 14346 * attempts does not fail just because the user provide the essid 14347 * and the nic is still checking for the AP MAC ?? 14348 */ 14349- 14350+ 14351 if (ieee->iw_mode == IW_MODE_INFRA) 14352- ieee80211_start_bss(ieee); 14353- 14354+ ieee80211_start_bss_rtl7(ieee); 14355 else if (ieee->iw_mode == IW_MODE_ADHOC) 14356- ieee80211_start_ibss(ieee); 14357- 14358+ ieee80211_start_ibss_rtl7(ieee); 14359 else if (ieee->iw_mode == IW_MODE_MASTER) 14360- ieee80211_start_master_bss(ieee); 14361- 14362+ ieee80211_start_master_bss_rtl7(ieee); 14363 else if(ieee->iw_mode == IW_MODE_MONITOR) 14364- ieee80211_start_monitor_mode(ieee); 14365+ ieee80211_start_monitor_mode_rtl7(ieee); 14366 } 14367 14368 14369 #define DRV_NAME "Ieee80211" 14370-void ieee80211_softmac_init(struct ieee80211_device *ieee) 14371+void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee) 14372 { 14373 memset(&ieee->current_network, 0, sizeof(struct ieee80211_network)); 14374- 14375+ 14376 ieee->state = IEEE80211_NOLINK; 14377 ieee->sync_scan_hurryup = 0; 14378 ieee->seq_ctrl = 0; 14379- 14380+ 14381 ieee->assoc_id = 0; 14382 ieee->queue_stop = 0; 14383 ieee->scanning = 0; 14384@@ -2142,66 +2181,75 @@ 14385 ieee->rate = 3; 14386 ieee->ps = IEEE80211_PS_DISABLED; 14387 ieee->sta_sleep = 0; 14388- 14389- init_mgmt_queue(ieee); 14390+ 14391+ init_mgmt_queue_rtl7(ieee); 14392 #if 0 14393 init_timer(&ieee->scan_timer); 14394 ieee->scan_timer.data = (unsigned long)ieee; 14395 ieee->scan_timer.function = ieee80211_softmac_scan_cb; 14396 #endif 14397 ieee->tx_pending.txb = NULL; 14398- 14399+ 14400 init_timer(&ieee->associate_timer); 14401 ieee->associate_timer.data = (unsigned long)ieee; 14402- ieee->associate_timer.function = ieee80211_associate_abort_cb; 14403+ ieee->associate_timer.function = ieee80211_associate_abort_cb_rtl7; 14404 14405 init_timer(&ieee->beacon_timer); 14406 ieee->beacon_timer.data = (unsigned long) ieee; 14407- ieee->beacon_timer.function = ieee80211_send_beacon_cb; 14408- 14409+ ieee->beacon_timer.function = ieee80211_send_beacon_cb_rtl7; 14410+ 14411 #ifdef PF_SYNCTHREAD 14412 ieee->wq = create_workqueue(DRV_NAME,0); 14413-#else 14414+#else 14415 ieee->wq = create_workqueue(DRV_NAME); 14416 #endif 14417- 14418- INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee); 14419- INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee); 14420- INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee); 14421- INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee); 14422- INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee); 14423- INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee); 14424- 14425+ 14426+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) 14427+ INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq_rtl7,ieee); 14428+ INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq_rtl7,ieee); 14429+ INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq_rtl7,ieee); 14430+ INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq_rtl7,ieee); 14431+ INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq_rtl7,ieee); 14432+ INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq_rtl7,ieee); 14433+#else 14434+ INIT_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq_rtl7); 14435+ INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq_rtl7); 14436+ INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq_rtl7); 14437+ INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq_rtl7); 14438+ INIT_DELAYED_WORK(&ieee->softmac_scan_wq, ieee80211_softmac_scan_wq_rtl7); 14439+ INIT_WORK(&ieee->wx_sync_scan_wq, ieee80211_wx_sync_scan_wq_rtl7); 14440+#endif 14441+ 14442 sema_init(&ieee->wx_sem, 1); 14443 sema_init(&ieee->scan_sem, 1); 14444- 14445+ 14446 spin_lock_init(&ieee->mgmt_tx_lock); 14447 spin_lock_init(&ieee->beacon_lock); 14448- 14449+ 14450 tasklet_init(&ieee->ps_task, 14451- (void(*)(unsigned long)) ieee80211_sta_ps, 14452+ (void(*)(unsigned long)) ieee80211_sta_ps_rtl7, 14453 (unsigned long)ieee); 14454 14455 } 14456 14457-void ieee80211_softmac_free(struct ieee80211_device *ieee) 14458+void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee) 14459 { 14460 down(&ieee->wx_sem); 14461- 14462+ 14463 del_timer_sync(&ieee->associate_timer); 14464 cancel_delayed_work(&ieee->associate_retry_wq); 14465 destroy_workqueue(ieee->wq); 14466- 14467+ 14468 up(&ieee->wx_sem); 14469 } 14470 14471-/******************************************************** 14472+/******************************************************** 14473 * Start of WPA code. * 14474 * this is stolen from the ipw2200 driver * 14475 ********************************************************/ 14476 14477- 14478-static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value) 14479+ 14480+static int ieee80211_wpa_enable_rtl7(struct ieee80211_device *ieee, int value) 14481 { 14482 /* This is called when wpa_supplicant loads and closes the driver 14483 * interface. */ 14484@@ -2210,19 +2258,19 @@ 14485 return 0; 14486 } 14487 14488- 14489-void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len) 14490+ 14491+void ieee80211_wpa_assoc_frame_rtl7(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len) 14492 { 14493 /* make sure WPA is enabled */ 14494- ieee80211_wpa_enable(ieee, 1); 14495+ ieee80211_wpa_enable_rtl7(ieee, 1); 14496 14497- ieee80211_disassociate(ieee); 14498+ ieee80211_disassociate_rtl7(ieee); 14499 } 14500 14501 14502-static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason) 14503+static int ieee80211_wpa_mlme_rtl7(struct ieee80211_device *ieee, int command, int reason) 14504 { 14505- 14506+ 14507 int ret = 0; 14508 14509 switch (command) { 14510@@ -2231,7 +2279,7 @@ 14511 break; 14512 14513 case IEEE_MLME_STA_DISASSOC: 14514- ieee80211_disassociate(ieee); 14515+ ieee80211_disassociate_rtl7(ieee); 14516 break; 14517 14518 default: 14519@@ -2243,7 +2291,7 @@ 14520 } 14521 14522 14523-static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee, 14524+static int ieee80211_wpa_set_wpa_ie_rtl7(struct ieee80211_device *ieee, 14525 struct ieee_param *param, int plen) 14526 { 14527 u8 *buf; 14528@@ -2267,16 +2315,16 @@ 14529 ieee->wpa_ie_len = 0; 14530 } 14531 14532- ieee80211_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len); 14533+ ieee80211_wpa_assoc_frame_rtl7(ieee, ieee->wpa_ie, ieee->wpa_ie_len); 14534 return 0; 14535 } 14536 14537 #define AUTH_ALG_OPEN_SYSTEM 0x1 14538 #define AUTH_ALG_SHARED_KEY 0x2 14539 14540-static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value) 14541+static int ieee80211_wpa_set_auth_algs_rtl7(struct ieee80211_device *ieee, int value) 14542 { 14543- 14544+ 14545 struct ieee80211_security sec = { 14546 .flags = SEC_AUTH_MODE, 14547 }; 14548@@ -2300,13 +2348,13 @@ 14549 14550 14551 14552-static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value) 14553+static int ieee80211_wpa_set_param_rtl7(struct ieee80211_device *ieee, u8 name, u32 value) 14554 { 14555 int ret=0; 14556 14557 switch (name) { 14558 case IEEE_PARAM_WPA_ENABLED: 14559- ret = ieee80211_wpa_enable(ieee, value); 14560+ ret = ieee80211_wpa_enable_rtl7(ieee, value); 14561 break; 14562 14563 case IEEE_PARAM_TKIP_COUNTERMEASURES: 14564@@ -2351,7 +2399,7 @@ 14565 break; 14566 14567 case IEEE_PARAM_AUTH_ALGS: 14568- ret = ieee80211_wpa_set_auth_algs(ieee, value); 14569+ ret = ieee80211_wpa_set_auth_algs_rtl7(ieee, value); 14570 break; 14571 14572 case IEEE_PARAM_IEEE_802_1X: 14573@@ -2368,11 +2416,11 @@ 14574 14575 /* implementation borrowed from hostap driver */ 14576 14577-static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee, 14578+static int ieee80211_wpa_set_encryption_rtl7(struct ieee80211_device *ieee, 14579 struct ieee_param *param, int param_len) 14580 { 14581 int ret = 0; 14582- 14583+ 14584 struct ieee80211_crypto_ops *ops; 14585 struct ieee80211_crypt_data **crypt; 14586 14587@@ -2407,7 +2455,7 @@ 14588 //sec.encrypt = 0; 14589 sec.level = SEC_LEVEL_0; 14590 sec.flags |= SEC_ENABLED | SEC_LEVEL; 14591- ieee80211_crypt_delayed_deinit(ieee, crypt); 14592+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt); 14593 } 14594 goto done; 14595 } 14596@@ -2421,16 +2469,16 @@ 14597 strcmp(param->u.crypt.alg, "TKIP")) 14598 goto skip_host_crypt; 14599 14600- ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 14601+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg); 14602 if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) { 14603- request_module("ieee80211_crypt_wep"); 14604- ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 14605+ request_module("ieee80211_crypt_wep_rtl"); 14606+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg); 14607 } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) { 14608- request_module("ieee80211_crypt_tkip"); 14609- ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 14610+ request_module("ieee80211_crypt_tkip_rtl"); 14611+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg); 14612 } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) { 14613- request_module("ieee80211_crypt_ccmp"); 14614- ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 14615+ request_module("ieee80211_crypt_ccmp_rtl"); 14616+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg); 14617 } 14618 if (ops == NULL) { 14619 printk("unknown crypto alg '%s'\n", param->u.crypt.alg); 14620@@ -2442,7 +2490,7 @@ 14621 if (*crypt == NULL || (*crypt)->ops != ops) { 14622 struct ieee80211_crypt_data *new_crypt; 14623 14624- ieee80211_crypt_delayed_deinit(ieee, crypt); 14625+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt); 14626 14627 new_crypt = (struct ieee80211_crypt_data *) 14628 kmalloc(sizeof(*new_crypt), GFP_KERNEL); 14629@@ -2525,7 +2573,7 @@ 14630 14631 14632 14633-int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p) 14634+int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p) 14635 { 14636 struct ieee_param *param; 14637 int ret=0; 14638@@ -2537,7 +2585,7 @@ 14639 ret = -EINVAL; 14640 goto out; 14641 } 14642- 14643+ 14644 param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL); 14645 if (param == NULL){ 14646 ret = -ENOMEM; 14647@@ -2552,20 +2600,20 @@ 14648 switch (param->cmd) { 14649 14650 case IEEE_CMD_SET_WPA_PARAM: 14651- ret = ieee80211_wpa_set_param(ieee, param->u.wpa_param.name, 14652+ ret = ieee80211_wpa_set_param_rtl7(ieee, param->u.wpa_param.name, 14653 param->u.wpa_param.value); 14654 break; 14655 14656 case IEEE_CMD_SET_WPA_IE: 14657- ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->length); 14658+ ret = ieee80211_wpa_set_wpa_ie_rtl7(ieee, param, p->length); 14659 break; 14660 14661 case IEEE_CMD_SET_ENCRYPTION: 14662- ret = ieee80211_wpa_set_encryption(ieee, param, p->length); 14663+ ret = ieee80211_wpa_set_encryption_rtl7(ieee, param, p->length); 14664 break; 14665 14666 case IEEE_CMD_MLME: 14667- ret = ieee80211_wpa_mlme(ieee, param->u.mlme.command, 14668+ ret = ieee80211_wpa_mlme_rtl7(ieee, param->u.mlme.command, 14669 param->u.mlme.reason_code); 14670 break; 14671 14672@@ -2581,11 +2629,11 @@ 14673 kfree(param); 14674 out: 14675 up(&ieee->wx_sem); 14676- 14677+ 14678 return ret; 14679 } 14680 14681-void notify_wx_assoc_event(struct ieee80211_device *ieee) 14682+void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee) 14683 { 14684 union iwreq_data wrqu; 14685 wrqu.ap_addr.sa_family = ARPHRD_ETHER; 14686@@ -2597,14 +2645,14 @@ 14687 } 14688 14689 14690-EXPORT_SYMBOL(ieee80211_get_beacon); 14691-EXPORT_SYMBOL(ieee80211_wake_queue); 14692-EXPORT_SYMBOL(ieee80211_stop_queue); 14693-EXPORT_SYMBOL(ieee80211_reset_queue); 14694-EXPORT_SYMBOL(ieee80211_softmac_stop_protocol); 14695-EXPORT_SYMBOL(ieee80211_softmac_start_protocol); 14696-EXPORT_SYMBOL(ieee80211_is_shortslot); 14697-EXPORT_SYMBOL(ieee80211_is_54g); 14698-EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl); 14699-EXPORT_SYMBOL(ieee80211_ps_tx_ack); 14700-//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame); 14701+EXPORT_SYMBOL(ieee80211_get_beacon_rtl7); 14702+EXPORT_SYMBOL(ieee80211_wake_queue_rtl7); 14703+EXPORT_SYMBOL(ieee80211_stop_queue_rtl7); 14704+EXPORT_SYMBOL(ieee80211_reset_queue_rtl7); 14705+EXPORT_SYMBOL(ieee80211_softmac_stop_protocol_rtl7); 14706+EXPORT_SYMBOL(ieee80211_softmac_start_protocol_rtl7); 14707+EXPORT_SYMBOL(ieee80211_is_shortslot_rtl7); 14708+EXPORT_SYMBOL(ieee80211_is_54g_rtl7); 14709+EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl_rtl7); 14710+EXPORT_SYMBOL(ieee80211_ps_tx_ack_rtl7); 14711+//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame_rtl7); 14712diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac_wx.c rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_softmac_wx.c 14713--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac_wx.c 2006-06-05 19:57:54.000000000 -0700 14714+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_softmac_wx.c 2010-05-19 22:18:51.972696243 -0700 14715@@ -1,7 +1,7 @@ 14716 /* IEEE 802.11 SoftMAC layer 14717 * Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it> 14718 * 14719- * Mostly extracted from the rtl8180-sa2400 driver for the 14720+ * Mostly extracted from the rtl8180-sa2400 driver for the 14721 * in-kernel generic ieee802.11 stack. 14722 * 14723 * Some pieces of code might be stolen from ipw2100 driver 14724@@ -18,23 +18,23 @@ 14725 14726 /* FIXME: add A freqs */ 14727 14728-const long ieee80211_wlan_frequencies[] = { 14729- 2412, 2417, 2422, 2427, 14730- 2432, 2437, 2442, 2447, 14731- 2452, 2457, 2462, 2467, 14732- 2472, 2484 14733+const long ieee80211_wlan_frequencies_rtl7[] = { 14734+ 2412, 2417, 2422, 2427, 14735+ 2432, 2437, 2442, 2447, 14736+ 2452, 2457, 2462, 2467, 14737+ 2472, 2484 14738 }; 14739 14740 14741-int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a, 14742+int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a, 14743 union iwreq_data *wrqu, char *b) 14744 { 14745 int ret; 14746 struct iw_freq *fwrq = & wrqu->freq; 14747 14748 down(&ieee->wx_sem); 14749- 14750- if(ieee->iw_mode == IW_MODE_INFRA){ 14751+ 14752+ if(ieee->iw_mode == IW_MODE_INFRA){ 14753 ret = -EOPNOTSUPP; 14754 goto out; 14755 } 14756@@ -45,31 +45,31 @@ 14757 fwrq->m <= (int) 2.487e8)) { 14758 int f = fwrq->m / 100000; 14759 int c = 0; 14760- 14761- while ((c < 14) && (f != ieee80211_wlan_frequencies[c])) 14762+ 14763+ while ((c < 14) && (f != ieee80211_wlan_frequencies_rtl7[c])) 14764 c++; 14765- 14766+ 14767 /* hack to fall through */ 14768 fwrq->e = 0; 14769 fwrq->m = c + 1; 14770 } 14771 } 14772- 14773- if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){ 14774+ 14775+ if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){ 14776 ret = -EOPNOTSUPP; 14777 goto out; 14778- 14779+ 14780 }else { /* Set the channel */ 14781- 14782- 14783+ 14784+ 14785 ieee->current_network.channel = fwrq->m; 14786 ieee->set_chan(ieee->dev, ieee->current_network.channel); 14787- 14788+ 14789 if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER) 14790 if(ieee->state == IEEE80211_LINKED){ 14791- 14792- ieee80211_stop_send_beacons(ieee); 14793- ieee80211_start_send_beacons(ieee); 14794+ 14795+ ieee80211_stop_send_beacons_rtl7(ieee); 14796+ ieee80211_start_send_beacons_rtl7(ieee); 14797 } 14798 } 14799 14800@@ -80,7 +80,7 @@ 14801 } 14802 14803 14804-int ieee80211_wx_get_freq(struct ieee80211_device *ieee, 14805+int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, 14806 struct iw_request_info *a, 14807 union iwreq_data *wrqu, char *b) 14808 { 14809@@ -88,110 +88,110 @@ 14810 14811 if (ieee->current_network.channel == 0) 14812 return -1; 14813- 14814+ 14815 fwrq->m = ieee->current_network.channel; 14816 fwrq->e = 0; 14817- 14818+ 14819 return 0; 14820 } 14821 14822-int ieee80211_wx_get_wap(struct ieee80211_device *ieee, 14823- struct iw_request_info *info, 14824+int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee, 14825+ struct iw_request_info *info, 14826 union iwreq_data *wrqu, char *extra) 14827 { 14828- unsigned long flags; 14829- 14830+ unsigned long flags; 14831+ 14832 wrqu->ap_addr.sa_family = ARPHRD_ETHER; 14833- 14834+ 14835 if (ieee->iw_mode == IW_MODE_MONITOR) 14836 return -1; 14837- 14838+ 14839 /* We want avoid to give to the user inconsistent infos*/ 14840 spin_lock_irqsave(&ieee->lock, flags); 14841- 14842- if (ieee->state != IEEE80211_LINKED && 14843+ 14844+ if (ieee->state != IEEE80211_LINKED && 14845 ieee->state != IEEE80211_LINKED_SCANNING && 14846 ieee->wap_set == 0) 14847- 14848+ 14849 memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); 14850 else 14851- memcpy(wrqu->ap_addr.sa_data, 14852+ memcpy(wrqu->ap_addr.sa_data, 14853 ieee->current_network.bssid, ETH_ALEN); 14854- 14855+ 14856 spin_unlock_irqrestore(&ieee->lock, flags); 14857- 14858+ 14859 return 0; 14860 } 14861 14862 14863-int ieee80211_wx_set_wap(struct ieee80211_device *ieee, 14864+int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee, 14865 struct iw_request_info *info, 14866 union iwreq_data *awrq, 14867 char *extra) 14868 { 14869- 14870+ 14871 int ret = 0; 14872 u8 zero[] = {0,0,0,0,0,0}; 14873 unsigned long flags; 14874- 14875+ 14876+ struct sockaddr *temp = NULL; 14877 short ifup = ieee->proto_started;//dev->flags & IFF_UP; 14878- 14879+ 14880 ieee->sync_scan_hurryup = 1; 14881- 14882+ 14883 down(&ieee->wx_sem); 14884- 14885- struct sockaddr *temp = (struct sockaddr *)awrq; 14886- 14887+ 14888+ temp = (struct sockaddr *)awrq; 14889 /* use ifconfig hw ether */ 14890 if (ieee->iw_mode == IW_MODE_MASTER){ 14891 ret = -1; 14892 goto out; 14893 } 14894- 14895+ 14896 if (temp->sa_family != ARPHRD_ETHER){ 14897 ret = -EINVAL; 14898 goto out; 14899 } 14900- 14901+ 14902 if (ifup) 14903- ieee80211_stop_protocol(ieee); 14904- 14905+ ieee80211_stop_protocol_rtl7(ieee); 14906+ 14907 /* just to avoid to give inconsistent infos in the 14908- * get wx method. not really needed otherwise 14909+ * get wx method. not really needed otherwise 14910 */ 14911 spin_lock_irqsave(&ieee->lock, flags); 14912- 14913- memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN); 14914+ 14915+ memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN); 14916 ieee->wap_set = memcmp(temp->sa_data, zero,ETH_ALEN)!=0; 14917- 14918+ 14919 spin_unlock_irqrestore(&ieee->lock, flags); 14920- 14921+ 14922 if (ifup) 14923- ieee80211_start_protocol(ieee); 14924- 14925+ ieee80211_start_protocol_rtl7(ieee); 14926+ 14927 out: 14928 up(&ieee->wx_sem); 14929 return ret; 14930 } 14931- 14932- int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b) 14933+ 14934+ int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b) 14935 { 14936 int len,ret = 0; 14937 unsigned long flags; 14938- 14939+ 14940 if (ieee->iw_mode == IW_MODE_MONITOR) 14941 return -1; 14942- 14943- /* We want avoid to give to the user inconsistent infos*/ 14944+ 14945+ /* We want avoid to give to the user inconsistent infos*/ 14946 spin_lock_irqsave(&ieee->lock, flags); 14947- 14948+ 14949 if (ieee->current_network.ssid[0] == '\0' || 14950- ieee->current_network.ssid_len == 0){ 14951+ ieee->current_network.ssid_len == 0){ 14952 ret = -1; 14953 goto out; 14954 } 14955- 14956- if (ieee->state != IEEE80211_LINKED && 14957+ 14958+ if (ieee->state != IEEE80211_LINKED && 14959 ieee->state != IEEE80211_LINKED_SCANNING && 14960 ieee->ssid_set == 0){ 14961 ret = -1; 14962@@ -204,59 +204,76 @@ 14963 14964 out: 14965 spin_unlock_irqrestore(&ieee->lock, flags); 14966- 14967+ 14968 return ret; 14969- 14970+ 14971 } 14972 14973-int ieee80211_wx_set_rate(struct ieee80211_device *ieee, 14974+int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee, 14975 struct iw_request_info *info, 14976 union iwreq_data *wrqu, char *extra) 14977 { 14978 14979 u32 target_rate = wrqu->bitrate.value; 14980- 14981+ 14982 ieee->rate = target_rate/100000; 14983 //FIXME: we might want to limit rate also in management protocols. 14984- return 0; 14985+ return 0; 14986 } 14987 14988 14989 14990-int ieee80211_wx_get_rate(struct ieee80211_device *ieee, 14991- struct iw_request_info *info, 14992+int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee, 14993+ struct iw_request_info *info, 14994 union iwreq_data *wrqu, char *extra) 14995 { 14996- 14997+ 14998 wrqu->bitrate.value = ieee->rate * 100000; 14999- 15000+ 15001 return 0; 15002 } 15003 15004-int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a, 15005+int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a, 15006 union iwreq_data *wrqu, char *b) 15007 { 15008- 15009+ short prev = ieee->raw_tx; 15010+ 15011 ieee->sync_scan_hurryup = 1; 15012- 15013+ 15014 down(&ieee->wx_sem); 15015- 15016+ 15017 if (wrqu->mode == ieee->iw_mode) 15018 goto out; 15019- 15020+ 15021 if (wrqu->mode == IW_MODE_MONITOR){ 15022- 15023- ieee->dev->type = ARPHRD_IEEE80211; 15024+ ieee->dev->type = ARPHRD_IEEE80211_PRISM; 15025 }else{ 15026 ieee->dev->type = ARPHRD_ETHER; 15027 } 15028- 15029+ 15030 if (!ieee->proto_started){ 15031 ieee->iw_mode = wrqu->mode; 15032 }else{ 15033- ieee80211_stop_protocol(ieee); 15034+ ieee80211_stop_protocol_rtl7(ieee); 15035 ieee->iw_mode = wrqu->mode; 15036- ieee80211_start_protocol(ieee); 15037+ ieee80211_start_protocol_rtl7(ieee); 15038+ } 15039+ 15040+ if(ieee->iw_mode == IW_MODE_MONITOR) 15041+ { 15042+ ieee->raw_tx = 1; 15043+ if(prev == 0 && ieee->raw_tx){ 15044+ if (ieee->data_hard_resume) 15045+ ieee->data_hard_resume(ieee->dev); 15046+ 15047+ netif_carrier_on(ieee->dev); 15048+ } 15049+ 15050+ netif_carrier_on(ieee->dev); 15051+ } 15052+ else 15053+ { 15054+ ieee->raw_tx = 0; 15055 } 15056 15057 out: 15058@@ -264,120 +281,132 @@ 15059 return 0; 15060 } 15061 15062-void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee) 15063+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) 15064+void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work) 15065 { 15066+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq); 15067+#else 15068+void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee) 15069+{ 15070+#endif 15071 short chan; 15072 15073 chan = ieee->current_network.channel; 15074- 15075+ 15076 netif_carrier_off(ieee->dev); 15077- 15078+ 15079 if (ieee->data_hard_stop) 15080 ieee->data_hard_stop(ieee->dev); 15081- 15082- ieee80211_stop_send_beacons(ieee); 15083- 15084+ 15085+ ieee80211_stop_send_beacons_rtl7(ieee); 15086+ 15087 ieee->state = IEEE80211_LINKED_SCANNING; 15088 ieee->link_change(ieee->dev); 15089- 15090- ieee80211_start_scan_syncro(ieee); 15091- 15092+ 15093+ ieee80211_start_scan_syncro_rtl7(ieee); 15094+ 15095 ieee->set_chan(ieee->dev, chan); 15096- 15097+ 15098 ieee->state = IEEE80211_LINKED; 15099 ieee->link_change(ieee->dev); 15100- 15101+ 15102 if (ieee->data_hard_resume) 15103 ieee->data_hard_resume(ieee->dev); 15104- 15105+ 15106 if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER) 15107- ieee80211_start_send_beacons(ieee); 15108- 15109+ ieee80211_start_send_beacons_rtl7(ieee); 15110+ 15111 netif_carrier_on(ieee->dev); 15112- 15113+ 15114 up(&ieee->wx_sem); 15115- 15116+ 15117 } 15118 15119-int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a, 15120+int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a, 15121 union iwreq_data *wrqu, char *b) 15122 { 15123 int ret = 0; 15124- 15125+ 15126 down(&ieee->wx_sem); 15127- 15128- if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){ 15129+ 15130+ if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){ 15131 ret = -1; 15132 goto out; 15133 } 15134- 15135+ 15136 if ( ieee->state == IEEE80211_LINKED){ 15137 queue_work(ieee->wq, &ieee->wx_sync_scan_wq); 15138 /* intentionally forget to up sem */ 15139 return 0; 15140 } 15141- 15142+ 15143 out: 15144 up(&ieee->wx_sem); 15145 return ret; 15146 } 15147 15148-int ieee80211_wx_set_essid(struct ieee80211_device *ieee, 15149+int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee, 15150 struct iw_request_info *a, 15151 union iwreq_data *wrqu, char *extra) 15152 { 15153- 15154+ 15155 int ret=0,len; 15156 short proto_started; 15157 unsigned long flags; 15158- 15159+ 15160 ieee->sync_scan_hurryup = 1; 15161- 15162+ 15163 down(&ieee->wx_sem); 15164- 15165+ 15166 proto_started = ieee->proto_started; 15167- 15168+ 15169 if (wrqu->essid.length > IW_ESSID_MAX_SIZE){ 15170 ret= -E2BIG; 15171 goto out; 15172 } 15173- 15174+ 15175 if (ieee->iw_mode == IW_MODE_MONITOR){ 15176 ret= -1; 15177 goto out; 15178 } 15179- 15180+ 15181 if(proto_started) 15182- ieee80211_stop_protocol(ieee); 15183- 15184+ ieee80211_stop_protocol_rtl7(ieee); 15185+ 15186 /* this is just to be sure that the GET wx callback 15187 * has consisten infos. not needed otherwise 15188 */ 15189 spin_lock_irqsave(&ieee->lock, flags); 15190- 15191+ 15192 if (wrqu->essid.flags && wrqu->essid.length) { 15193+#if WIRELESS_EXT > 20 15194+ len = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE); 15195+#else 15196 len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE; 15197- 15198+#endif 15199+ 15200 strncpy(ieee->current_network.ssid, extra, len); 15201 ieee->current_network.ssid_len = len; 15202 ieee->ssid_set = 1; 15203 } 15204- else{ 15205+ else{ 15206 ieee->ssid_set = 0; 15207 ieee->current_network.ssid[0] = '\0'; 15208 ieee->current_network.ssid_len = 0; 15209 } 15210- 15211+ 15212 spin_unlock_irqrestore(&ieee->lock, flags); 15213- 15214+ 15215 if (proto_started) 15216- ieee80211_start_protocol(ieee); 15217+ ieee80211_start_protocol_rtl7(ieee); 15218 out: 15219 up(&ieee->wx_sem); 15220+ 15221+ 15222 return ret; 15223 } 15224 15225- int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a, 15226+ int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a, 15227 union iwreq_data *wrqu, char *b) 15228 { 15229 15230@@ -385,23 +414,23 @@ 15231 return 0; 15232 } 15233 15234- int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, 15235- struct iw_request_info *info, 15236+ int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee, 15237+ struct iw_request_info *info, 15238 union iwreq_data *wrqu, char *extra) 15239 { 15240- 15241+ 15242 int *parms = (int *)extra; 15243 int enable = (parms[0] > 0); 15244 short prev = ieee->raw_tx; 15245 15246 down(&ieee->wx_sem); 15247- 15248- if(enable) 15249+ 15250+ if(enable) 15251 ieee->raw_tx = 1; 15252- else 15253+ else 15254 ieee->raw_tx = 0; 15255 15256- printk(KERN_INFO"raw TX is %s\n", 15257+ printk(KERN_INFO"raw TX is %s\n", 15258 ieee->raw_tx ? "enabled" : "disabled"); 15259 15260 if(ieee->iw_mode == IW_MODE_MONITOR) 15261@@ -409,21 +438,21 @@ 15262 if(prev == 0 && ieee->raw_tx){ 15263 if (ieee->data_hard_resume) 15264 ieee->data_hard_resume(ieee->dev); 15265- 15266- netif_carrier_on(ieee->dev); 15267+ 15268+ netif_carrier_on(ieee->dev); 15269 } 15270- 15271+ 15272 if(prev && ieee->raw_tx == 1) 15273- netif_carrier_off(ieee->dev); 15274+ netif_carrier_off(ieee->dev); 15275 } 15276- 15277+ 15278 up(&ieee->wx_sem); 15279- 15280+ 15281 return 0; 15282 } 15283- 15284-int ieee80211_wx_get_name(struct ieee80211_device *ieee, 15285- struct iw_request_info *info, 15286+ 15287+int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee, 15288+ struct iw_request_info *info, 15289 union iwreq_data *wrqu, char *extra) 15290 { 15291 strcpy(wrqu->name, "802.11"); 15292@@ -433,20 +462,20 @@ 15293 strcat(wrqu->name, "/g"); 15294 }else if(ieee->modulation & IEEE80211_OFDM_MODULATION) 15295 strcat(wrqu->name, "g"); 15296- 15297- if((ieee->state == IEEE80211_LINKED) || 15298+ 15299+ if((ieee->state == IEEE80211_LINKED) || 15300 (ieee->state == IEEE80211_LINKED_SCANNING)) 15301 strcat(wrqu->name," linked"); 15302 else if(ieee->state != IEEE80211_NOLINK) 15303 strcat(wrqu->name," link.."); 15304- 15305- 15306+ 15307+ 15308 return 0; 15309 } 15310 15311 15312 /* this is mostly stolen from hostap */ 15313-int ieee80211_wx_set_power(struct ieee80211_device *ieee, 15314+int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee, 15315 struct iw_request_info *info, 15316 union iwreq_data *wrqu, char *extra) 15317 { 15318@@ -457,50 +486,50 @@ 15319 (!ieee->ps_request_tx_ack) || 15320 (!ieee->enter_sleep_state) || 15321 (!ieee->ps_is_queue_empty)){ 15322- 15323+ 15324 printk("ERROR. PS mode is tryied to be use but\ 15325-driver missed a callback\n\n"); 15326- 15327+driver missed a callback\n\n"); 15328+ 15329 return -1; 15330 } 15331- 15332+ 15333 down(&ieee->wx_sem); 15334- 15335+ 15336 if (wrqu->power.disabled){ 15337 ieee->ps = IEEE80211_PS_DISABLED; 15338- 15339+ 15340 goto exit; 15341 } 15342 switch (wrqu->power.flags & IW_POWER_MODE) { 15343 case IW_POWER_UNICAST_R: 15344 ieee->ps = IEEE80211_PS_UNICAST; 15345- 15346+ 15347 break; 15348 case IW_POWER_ALL_R: 15349- ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST; 15350+ ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST; 15351 break; 15352- 15353+ 15354 case IW_POWER_ON: 15355 ieee->ps = IEEE80211_PS_DISABLED; 15356 break; 15357- 15358+ 15359 default: 15360 ret = -EINVAL; 15361 goto exit; 15362 } 15363 15364 if (wrqu->power.flags & IW_POWER_TIMEOUT) { 15365- 15366+ 15367 ieee->ps_timeout = wrqu->power.value / 1000; 15368 printk("Timeout %d\n",ieee->ps_timeout); 15369 } 15370- 15371+ 15372 if (wrqu->power.flags & IW_POWER_PERIOD) { 15373- 15374+ 15375 ret = -EOPNOTSUPP; 15376 goto exit; 15377 //wrq->value / 1024; 15378- 15379+ 15380 } 15381 exit: 15382 up(&ieee->wx_sem); 15383@@ -509,15 +538,15 @@ 15384 } 15385 15386 /* this is stolen from hostap */ 15387-int ieee80211_wx_get_power(struct ieee80211_device *ieee, 15388+int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee, 15389 struct iw_request_info *info, 15390 union iwreq_data *wrqu, char *extra) 15391 { 15392 int ret =0; 15393- 15394+ 15395 down(&ieee->wx_sem); 15396- 15397- if(ieee->ps == IEEE80211_PS_DISABLED){ 15398+ 15399+ if(ieee->ps == IEEE80211_PS_DISABLED){ 15400 wrqu->power.disabled = 1; 15401 goto exit; 15402 } 15403@@ -547,19 +576,19 @@ 15404 15405 } 15406 15407-EXPORT_SYMBOL(ieee80211_wx_get_essid); 15408-EXPORT_SYMBOL(ieee80211_wx_set_essid); 15409-EXPORT_SYMBOL(ieee80211_wx_set_rate); 15410-EXPORT_SYMBOL(ieee80211_wx_get_rate); 15411-EXPORT_SYMBOL(ieee80211_wx_set_wap); 15412-EXPORT_SYMBOL(ieee80211_wx_get_wap); 15413-EXPORT_SYMBOL(ieee80211_wx_set_mode); 15414-EXPORT_SYMBOL(ieee80211_wx_get_mode); 15415-EXPORT_SYMBOL(ieee80211_wx_set_scan); 15416-EXPORT_SYMBOL(ieee80211_wx_get_freq); 15417-EXPORT_SYMBOL(ieee80211_wx_set_freq); 15418-EXPORT_SYMBOL(ieee80211_wx_set_rawtx); 15419-EXPORT_SYMBOL(ieee80211_wx_get_name); 15420-EXPORT_SYMBOL(ieee80211_wx_set_power); 15421-EXPORT_SYMBOL(ieee80211_wx_get_power); 15422-EXPORT_SYMBOL(ieee80211_wlan_frequencies); 15423+EXPORT_SYMBOL(ieee80211_wx_get_essid_rtl7); 15424+EXPORT_SYMBOL(ieee80211_wx_set_essid_rtl7); 15425+EXPORT_SYMBOL(ieee80211_wx_set_rate_rtl7); 15426+EXPORT_SYMBOL(ieee80211_wx_get_rate_rtl7); 15427+EXPORT_SYMBOL(ieee80211_wx_set_wap_rtl7); 15428+EXPORT_SYMBOL(ieee80211_wx_get_wap_rtl7); 15429+EXPORT_SYMBOL(ieee80211_wx_set_mode_rtl7); 15430+EXPORT_SYMBOL(ieee80211_wx_get_mode_rtl7); 15431+EXPORT_SYMBOL(ieee80211_wx_set_scan_rtl7); 15432+EXPORT_SYMBOL(ieee80211_wx_get_freq_rtl7); 15433+EXPORT_SYMBOL(ieee80211_wx_set_freq_rtl7); 15434+EXPORT_SYMBOL(ieee80211_wx_set_rawtx_rtl7); 15435+EXPORT_SYMBOL(ieee80211_wx_get_name_rtl7); 15436+EXPORT_SYMBOL(ieee80211_wx_set_power_rtl7); 15437+EXPORT_SYMBOL(ieee80211_wx_get_power_rtl7); 15438+EXPORT_SYMBOL(ieee80211_wlan_frequencies_rtl7); 15439diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_tx.c rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_tx.c 15440--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_tx.c 2006-06-05 19:57:54.000000000 -0700 15441+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_tx.c 2010-05-19 22:21:50.072722993 -0700 15442@@ -24,15 +24,14 @@ 15443 15444 ****************************************************************************** 15445 15446- Few modifications for Realtek's Wi-Fi drivers by 15447+ Few modifications for Realtek's Wi-Fi drivers by 15448 Andrea Merello <andreamrl@tiscali.it> 15449- 15450- A special thanks goes to Realtek for their support ! 15451+ 15452+ A special thanks goes to Realtek for their support ! 15453 15454 ******************************************************************************/ 15455 15456 #include <linux/compiler.h> 15457-#include <linux/config.h> 15458 #include <linux/errno.h> 15459 #include <linux/if_arp.h> 15460 #include <linux/in6.h> 15461@@ -52,6 +51,12 @@ 15462 #include <linux/etherdevice.h> 15463 #include <asm/uaccess.h> 15464 15465+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 15466+#include <linux/config.h> 15467+#else 15468+//#include <linux/autoconf.h> 15469+#endif 15470+ 15471 #include "ieee80211.h" 15472 15473 15474@@ -155,7 +160,7 @@ 15475 static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; 15476 static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; 15477 15478-static inline int ieee80211_put_snap(u8 *data, u16 h_proto) 15479+static inline int ieee80211_put_snap_rtl7(u8 *data, u16 h_proto) 15480 { 15481 struct ieee80211_snap_hdr *snap; 15482 u8 *oui; 15483@@ -178,7 +183,7 @@ 15484 return SNAP_SIZE + sizeof(u16); 15485 } 15486 15487-int ieee80211_encrypt_fragment( 15488+int ieee80211_encrypt_fragment_rtl7( 15489 struct ieee80211_device *ieee, 15490 struct sk_buff *frag, 15491 int hdr_len) 15492@@ -225,7 +230,7 @@ 15493 } 15494 15495 15496-void ieee80211_txb_free(struct ieee80211_txb *txb) { 15497+void ieee80211_txb_free_rtl7(struct ieee80211_txb *txb) { 15498 int i; 15499 if (unlikely(!txb)) 15500 return; 15501@@ -235,7 +240,7 @@ 15502 kfree(txb); 15503 } 15504 15505-struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size, 15506+struct ieee80211_txb *ieee80211_alloc_txb_rtl7(int nr_frags, int txb_size, 15507 int gfp_mask) 15508 { 15509 struct ieee80211_txb *txb; 15510@@ -267,7 +272,7 @@ 15511 } 15512 15513 /* SKBs are added to the ieee->tx_queue. */ 15514-int ieee80211_xmit(struct sk_buff *skb, 15515+int ieee80211_xmit_rtl7(struct sk_buff *skb, 15516 struct net_device *dev) 15517 { 15518 struct ieee80211_device *ieee = netdev_priv(dev); 15519@@ -299,27 +304,27 @@ 15520 } 15521 15522 if(likely(ieee->raw_tx == 0)){ 15523- 15524+ 15525 if (unlikely(skb->len < SNAP_SIZE + sizeof(u16))) { 15526 printk(KERN_WARNING "%s: skb too small (%d).\n", 15527 ieee->dev->name, skb->len); 15528 goto success; 15529 } 15530- 15531- 15532+ 15533+ 15534 ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto); 15535- 15536+ 15537 crypt = ieee->crypt[ieee->tx_keyidx]; 15538- 15539+ 15540 encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) && 15541 ieee->host_encrypt && crypt && crypt->ops; 15542- 15543+ 15544 if (!encrypt && ieee->ieee802_1x && 15545 ieee->drop_unencrypted && ether_type != ETH_P_PAE) { 15546 stats->tx_dropped++; 15547 goto success; 15548 } 15549- 15550+ 15551 #ifdef CONFIG_IEEE80211_DEBUG 15552 if (crypt && !encrypt && ether_type == ETH_P_PAE) { 15553 struct eapol *eap = (struct eapol *)(skb->data + 15554@@ -328,23 +333,23 @@ 15555 eap_get_type(eap->type)); 15556 } 15557 #endif 15558- 15559+ 15560 /* Save source and destination addresses */ 15561 memcpy(&dest, skb->data, ETH_ALEN); 15562 memcpy(&src, skb->data+ETH_ALEN, ETH_ALEN); 15563- 15564+ 15565 /* Advance the SKB to the start of the payload */ 15566 skb_pull(skb, sizeof(struct ethhdr)); 15567- 15568+ 15569 /* Determine total amount of storage required for TXB packets */ 15570 bytes = skb->len + SNAP_SIZE + sizeof(u16); 15571- 15572+ 15573 if (encrypt) 15574 fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA | 15575 IEEE80211_FCTL_WEP; 15576 else 15577 fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA; 15578- 15579+ 15580 if (ieee->iw_mode == IW_MODE_INFRA) { 15581 fc |= IEEE80211_FCTL_TODS; 15582 /* To DS: Addr1 = BSSID, Addr2 = SA, 15583@@ -360,9 +365,9 @@ 15584 memcpy(&header.addr3, ieee->current_network.bssid, ETH_ALEN); 15585 } 15586 header.frame_ctl = cpu_to_le16(fc); 15587- 15588+ 15589 hdr_len = IEEE80211_3ADDR_LEN; 15590- 15591+ 15592 /* Determine fragmentation size based on destination (multicast 15593 * and broadcast are not fragmented) */ 15594 if (is_multicast_ether_addr(dest) || 15595@@ -370,7 +375,7 @@ 15596 frag_size = MAX_FRAG_THRESHOLD; 15597 else 15598 frag_size = ieee->fts; 15599- 15600+ 15601 /* Determine amount of payload per fragment. Regardless of if 15602 * this stack is providing the full 802.11 header, one will 15603 * eventually be affixed to this fragment -- so we must account for 15604@@ -379,12 +384,12 @@ 15605 if (ieee->config & 15606 (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) 15607 bytes_per_frag -= IEEE80211_FCS_LEN; 15608- 15609+ 15610 /* Each fragment may need to have room for encryptiong pre/postfix */ 15611 if (encrypt) 15612 bytes_per_frag -= crypt->ops->extra_prefix_len + 15613 crypt->ops->extra_postfix_len; 15614- 15615+ 15616 /* Number of fragments is the total bytes_per_frag / 15617 * payload_per_fragment */ 15618 nr_frags = bytes / bytes_per_frag; 15619@@ -393,11 +398,11 @@ 15620 nr_frags++; 15621 else 15622 bytes_last_frag = bytes_per_frag; 15623- 15624+ 15625 /* When we allocate the TXB we allocate enough space for the reserve 15626 * and full fragment bytes (bytes_per_frag doesn't include prefix, 15627 * postfix, header, FCS, etc.) */ 15628- txb = ieee80211_alloc_txb(nr_frags, frag_size, GFP_ATOMIC); 15629+ txb = ieee80211_alloc_txb_rtl7(nr_frags, frag_size, GFP_ATOMIC); 15630 if (unlikely(!txb)) { 15631 printk(KERN_WARNING "%s: Could not allocate TXB\n", 15632 ieee->dev->name); 15633@@ -405,93 +410,94 @@ 15634 } 15635 txb->encrypted = encrypt; 15636 txb->payload_size = bytes; 15637- 15638+ 15639 for (i = 0; i < nr_frags; i++) { 15640 skb_frag = txb->fragments[i]; 15641- 15642+ 15643 if (encrypt) 15644 skb_reserve(skb_frag, crypt->ops->extra_prefix_len); 15645- 15646+ 15647 frag_hdr = (struct ieee80211_hdr *)skb_put(skb_frag, hdr_len); 15648 memcpy(frag_hdr, &header, hdr_len); 15649- 15650+ 15651 /* If this is not the last fragment, then add the MOREFRAGS 15652 * bit to the frame control */ 15653 if (i != nr_frags - 1) { 15654 frag_hdr->frame_ctl = cpu_to_le16( 15655 fc | IEEE80211_FCTL_MOREFRAGS); 15656 bytes = bytes_per_frag; 15657- 15658+ 15659 } else { 15660 /* The last fragment takes the remaining length */ 15661 bytes = bytes_last_frag; 15662 } 15663- 15664+ 15665 frag_hdr->seq_ctl = cpu_to_le16(ieee->seq_ctrl<<4 | i); 15666- 15667- 15668+ 15669+ 15670 /* Put a SNAP header on the first fragment */ 15671 if (i == 0) { 15672- ieee80211_put_snap( 15673+ ieee80211_put_snap_rtl7( 15674 skb_put(skb_frag, SNAP_SIZE + sizeof(u16)), 15675 ether_type); 15676 bytes -= SNAP_SIZE + sizeof(u16); 15677 } 15678- 15679+ 15680 memcpy(skb_put(skb_frag, bytes), skb->data, bytes); 15681- 15682+ 15683 /* Advance the SKB... */ 15684 skb_pull(skb, bytes); 15685- 15686+ 15687 /* Encryption routine will move the header forward in order 15688 * to insert the IV between the header and the payload */ 15689 if (encrypt) 15690- ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len); 15691+ ieee80211_encrypt_fragment_rtl7(ieee, skb_frag, hdr_len); 15692 if (ieee->config & 15693 (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) 15694 skb_put(skb_frag, 4); 15695 } 15696- // Advance sequence number in data frame. 15697+ // Advance sequence number in data frame. 15698 if (ieee->seq_ctrl == 0xFFF) 15699 ieee->seq_ctrl = 0; 15700 else 15701 ieee->seq_ctrl++; 15702 //--- 15703 }else{ 15704- if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) { 15705+// if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) { 15706+ if (unlikely(skb->len < 14)) { 15707 printk(KERN_WARNING "%s: skb too small (%d).\n", 15708 ieee->dev->name, skb->len); 15709 goto success; 15710 } 15711- 15712- txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC); 15713+ 15714+ txb = ieee80211_alloc_txb_rtl7(1, skb->len, GFP_ATOMIC); 15715 if(!txb){ 15716 printk(KERN_WARNING "%s: Could not allocate TXB\n", 15717 ieee->dev->name); 15718 goto failed; 15719 } 15720- 15721+ 15722 txb->encrypted = 0; 15723 txb->payload_size = skb->len; 15724 memcpy(skb_put(txb->fragments[0],skb->len), skb->data, skb->len); 15725- } 15726+ } 15727 15728 success: 15729 spin_unlock_irqrestore(&ieee->lock, flags); 15730 dev_kfree_skb_any(skb); 15731 if (txb) { 15732 if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE){ 15733- ieee80211_softmac_xmit(txb, ieee); 15734+ ieee80211_softmac_xmit_rtl7(txb, ieee); 15735 }else{ 15736 if ((*ieee->hard_start_xmit)(txb, dev) == 0) { 15737 stats->tx_packets++; 15738 stats->tx_bytes += txb->payload_size; 15739 return 0; 15740 } 15741- ieee80211_txb_free(txb); 15742+ ieee80211_txb_free_rtl7(txb); 15743 } 15744- 15745- 15746+ 15747+ 15748 } 15749 15750 return 0; 15751@@ -504,4 +510,5 @@ 15752 15753 } 15754 15755-EXPORT_SYMBOL(ieee80211_txb_free); 15756+EXPORT_SYMBOL(ieee80211_txb_free_rtl7); 15757+EXPORT_SYMBOL(ieee80211_xmit_rtl7); 15758diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_wx.c rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_wx.c 15759--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_wx.c 2006-06-05 19:57:56.000000000 -0700 15760+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_wx.c 2010-05-19 22:18:51.982705602 -0700 15761@@ -40,8 +40,9 @@ 15762 }; 15763 15764 #define MAX_CUSTOM_LEN 64 15765-static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, 15766- char *start, char *stop, 15767+static inline char *ipw2100_translate_scan_rtl7(struct ieee80211_device *ieee, 15768+ struct iw_request_info *info, 15769+ char *start, char *stop, 15770 struct ieee80211_network *network) 15771 { 15772 char custom[MAX_CUSTOM_LEN]; 15773@@ -54,7 +55,11 @@ 15774 iwe.cmd = SIOCGIWAP; 15775 iwe.u.ap_addr.sa_family = ARPHRD_ETHER; 15776 memcpy(iwe.u.ap_addr.sa_data, network->bssid, ETH_ALEN); 15777+#if WIRELESS_EXT >= 22 15778+ start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_ADDR_LEN); 15779+#else 15780 start = iwe_stream_add_event(start, stop, &iwe, IW_EV_ADDR_LEN); 15781+#endif 15782 15783 /* Remaining entries will be displayed in the order we provide them */ 15784 15785@@ -63,16 +68,28 @@ 15786 iwe.u.data.flags = 1; 15787 if (network->flags & NETWORK_EMPTY_ESSID) { 15788 iwe.u.data.length = sizeof("<hidden>"); 15789+#if WIRELESS_EXT >= 22 15790+ start = iwe_stream_add_point(info, start, stop, &iwe, "<hidden>"); 15791+#else 15792 start = iwe_stream_add_point(start, stop, &iwe, "<hidden>"); 15793+#endif 15794 } else { 15795 iwe.u.data.length = min(network->ssid_len, (u8)32); 15796+#if WIRELESS_EXT >= 22 15797+ start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid); 15798+#else 15799 start = iwe_stream_add_point(start, stop, &iwe, network->ssid); 15800+#endif 15801 } 15802 15803 /* Add the protocol name */ 15804 iwe.cmd = SIOCGIWNAME; 15805 snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11%s", ieee80211_modes[network->mode]); 15806+#if WIRELESS_EXT >= 22 15807+ start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_CHAR_LEN); 15808+#else 15809 start = iwe_stream_add_event(start, stop, &iwe, IW_EV_CHAR_LEN); 15810+#endif 15811 15812 /* Add mode */ 15813 iwe.cmd = SIOCGIWMODE; 15814@@ -83,8 +100,13 @@ 15815 else 15816 iwe.u.mode = IW_MODE_ADHOC; 15817 15818+#if WIRELESS_EXT >= 22 15819+ start = iwe_stream_add_event(info, start, stop, &iwe, 15820+ IW_EV_UINT_LEN); 15821+#else 15822 start = iwe_stream_add_event(start, stop, &iwe, 15823 IW_EV_UINT_LEN); 15824+#endif 15825 } 15826 15827 /* Add frequency/channel */ 15828@@ -94,7 +116,11 @@ 15829 iwe.u.freq.m = network->channel; 15830 iwe.u.freq.e = 0; 15831 iwe.u.freq.i = 0; 15832+#if WIRELESS_EXT >= 22 15833+ start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_FREQ_LEN); 15834+#else 15835 start = iwe_stream_add_event(start, stop, &iwe, IW_EV_FREQ_LEN); 15836+#endif 15837 15838 /* Add encryption capability */ 15839 iwe.cmd = SIOCGIWENCODE; 15840@@ -103,7 +129,11 @@ 15841 else 15842 iwe.u.data.flags = IW_ENCODE_DISABLED; 15843 iwe.u.data.length = 0; 15844+#if WIRELESS_EXT >= 22 15845+ start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid); 15846+#else 15847 start = iwe_stream_add_point(start, stop, &iwe, network->ssid); 15848+#endif 15849 15850 /* Add basic and extended rates */ 15851 max_rate = 0; 15852@@ -132,13 +162,22 @@ 15853 iwe.cmd = SIOCGIWRATE; 15854 iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; 15855 iwe.u.bitrate.value = max_rate * 500000; 15856+#if WIRELESS_EXT >= 22 15857+ start = iwe_stream_add_event(info, start, stop, &iwe, 15858+ IW_EV_PARAM_LEN); 15859+#else 15860 start = iwe_stream_add_event(start, stop, &iwe, 15861 IW_EV_PARAM_LEN); 15862+#endif 15863 15864 iwe.cmd = IWEVCUSTOM; 15865 iwe.u.data.length = p - custom; 15866 if (iwe.u.data.length) 15867+#if WIRELESS_EXT >= 22 15868+ start = iwe_stream_add_point(info, start, stop, &iwe, custom); 15869+#else 15870 start = iwe_stream_add_point(start, stop, &iwe, custom); 15871+#endif 15872 15873 /* Add quality statistics */ 15874 /* TODO: Fix these values... */ 15875@@ -154,14 +193,22 @@ 15876 if (!(network->stats.mask & IEEE80211_STATMASK_SIGNAL)) 15877 iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID; 15878 15879+#if WIRELESS_EXT >= 22 15880+ start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_QUAL_LEN); 15881+#else 15882 start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN); 15883+#endif 15884 15885 iwe.cmd = IWEVCUSTOM; 15886 p = custom; 15887 15888 iwe.u.data.length = p - custom; 15889 if (iwe.u.data.length) 15890+#if WIRELESS_EXT >= 22 15891+ start = iwe_stream_add_point(info, start, stop, &iwe, custom); 15892+#else 15893 start = iwe_stream_add_point(start, stop, &iwe, custom); 15894+#endif 15895 15896 if (ieee->wpa_enabled && network->wpa_ie_len){ 15897 char buf[MAX_WPA_IE_LEN * 2 + 30]; 15898@@ -175,7 +222,12 @@ 15899 memset(&iwe, 0, sizeof(iwe)); 15900 iwe.cmd = IWEVCUSTOM; 15901 iwe.u.data.length = strlen(buf); 15902+#if WIRELESS_EXT >= 22 15903+ start = iwe_stream_add_point(info, start, stop, &iwe, buf); 15904+#else 15905 start = iwe_stream_add_point(start, stop, &iwe, buf); 15906+#endif 15907+ 15908 } 15909 15910 if (ieee->wpa_enabled && network->rsn_ie_len){ 15911@@ -190,7 +242,11 @@ 15912 memset(&iwe, 0, sizeof(iwe)); 15913 iwe.cmd = IWEVCUSTOM; 15914 iwe.u.data.length = strlen(buf); 15915+#if WIRELESS_EXT >= 22 15916+ start = iwe_stream_add_point(info, start, stop, &iwe, buf); 15917+#else 15918 start = iwe_stream_add_point(start, stop, &iwe, buf); 15919+#endif 15920 } 15921 15922 /* Add EXTRA: Age to display seconds since last beacon/probe response 15923@@ -201,13 +257,17 @@ 15924 " Last beacon: %lums ago", (jiffies - network->last_scanned) / (HZ / 100)); 15925 iwe.u.data.length = p - custom; 15926 if (iwe.u.data.length) 15927+#if WIRELESS_EXT >= 22 15928+ start = iwe_stream_add_point(info, start, stop, &iwe, custom); 15929+#else 15930 start = iwe_stream_add_point(start, stop, &iwe, custom); 15931+#endif 15932 15933 15934 return start; 15935 } 15936 15937-int ieee80211_wx_get_scan(struct ieee80211_device *ieee, 15938+int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee, 15939 struct iw_request_info *info, 15940 union iwreq_data *wrqu, char *extra) 15941 { 15942@@ -220,13 +280,15 @@ 15943 15944 IEEE80211_DEBUG_WX("Getting scan\n"); 15945 down(&ieee->wx_sem); 15946+ printk("GOT WX GET SCAN WX_SEM LOCK"); 15947 spin_lock_irqsave(&ieee->lock, flags); 15948 15949 list_for_each_entry(network, &ieee->network_list, list) { 15950 i++; 15951 if (ieee->scan_age == 0 || 15952 time_after(network->last_scanned + ieee->scan_age, jiffies)) 15953- ev = ipw2100_translate_scan(ieee, ev, stop, network); 15954+ ev = ipw2100_translate_scan_rtl7(ieee, info, ev, 15955+stop, network); 15956 else 15957 IEEE80211_DEBUG_SCAN( 15958 "Not showing network '%s (" 15959@@ -247,7 +309,7 @@ 15960 return 0; 15961 } 15962 15963-int ieee80211_wx_set_encode(struct ieee80211_device *ieee, 15964+int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee, 15965 struct iw_request_info *info, 15966 union iwreq_data *wrqu, char *keybuf) 15967 { 15968@@ -259,6 +321,9 @@ 15969 int i, key, key_provided, len; 15970 struct ieee80211_crypt_data **crypt; 15971 15972+ if (erq->flags & IW_ENCODE_RESTRICTED) 15973+ return -EINVAL; 15974+ 15975 IEEE80211_DEBUG_WX("SET_ENCODE\n"); 15976 15977 key = erq->flags & IW_ENCODE_INDEX; 15978@@ -281,7 +346,7 @@ 15979 if (key_provided && *crypt) { 15980 IEEE80211_DEBUG_WX("Disabling encryption on key %d.\n", 15981 key); 15982- ieee80211_crypt_delayed_deinit(ieee, crypt); 15983+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt); 15984 } else 15985 IEEE80211_DEBUG_WX("Disabling encryption.\n"); 15986 15987@@ -291,7 +356,7 @@ 15988 if (ieee->crypt[i] != NULL) { 15989 if (key_provided) 15990 break; 15991- ieee80211_crypt_delayed_deinit( 15992+ ieee80211_crypt_delayed_deinit_rtl7( 15993 ieee, &ieee->crypt[i]); 15994 } 15995 } 15996@@ -314,7 +379,7 @@ 15997 strcmp((*crypt)->ops->name, "WEP") != 0) { 15998 /* changing to use WEP; deinit previously used algorithm 15999 * on this key */ 16000- ieee80211_crypt_delayed_deinit(ieee, crypt); 16001+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt); 16002 } 16003 16004 if (*crypt == NULL) { 16005@@ -326,10 +391,10 @@ 16006 if (new_crypt == NULL) 16007 return -ENOMEM; 16008 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); 16009- new_crypt->ops = ieee80211_get_crypto_ops("WEP"); 16010+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP"); 16011 if (!new_crypt->ops) { 16012- request_module("ieee80211_crypt_wep"); 16013- new_crypt->ops = ieee80211_get_crypto_ops("WEP"); 16014+ request_module("ieee80211_crypt_wep_rtl"); 16015+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP"); 16016 } 16017 16018 if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) 16019@@ -340,7 +405,7 @@ 16020 new_crypt = NULL; 16021 16022 printk(KERN_WARNING "%s: could not initialize WEP: " 16023- "load module ieee80211_crypt_wep\n", 16024+ "load module ieee80211_crypt_wep_rtl\n", 16025 dev->name); 16026 return -EOPNOTSUPP; 16027 } 16028@@ -418,7 +483,7 @@ 16029 return 0; 16030 } 16031 16032-int ieee80211_wx_get_encode(struct ieee80211_device *ieee, 16033+int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee, 16034 struct iw_request_info *info, 16035 union iwreq_data *wrqu, char *keybuf) 16036 { 16037@@ -430,7 +495,7 @@ 16038 16039 if(ieee->iw_mode == IW_MODE_MONITOR) 16040 return -1; 16041- 16042+ 16043 key = erq->flags & IW_ENCODE_INDEX; 16044 if (key) { 16045 if (key > WEP_KEYS) 16046@@ -470,6 +535,6 @@ 16047 } 16048 16049 16050-EXPORT_SYMBOL(ieee80211_wx_get_scan); 16051-EXPORT_SYMBOL(ieee80211_wx_set_encode); 16052-EXPORT_SYMBOL(ieee80211_wx_get_encode); 16053+EXPORT_SYMBOL(ieee80211_wx_get_scan_rtl7); 16054+EXPORT_SYMBOL(ieee80211_wx_set_encode_rtl7); 16055+EXPORT_SYMBOL(ieee80211_wx_get_encode_rtl7); 16056diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/Makefile rtl8187_linux_26.1010.0622.2006.modified/ieee80211/Makefile 16057--- rtl8187_linux_26.1010.0622.2006/ieee80211/Makefile 2006-06-05 19:57:54.000000000 -0700 16058+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/Makefile 2010-05-19 22:18:51.986075533 -0700 16059@@ -17,6 +17,7 @@ 16060 KVER := $(shell uname -r) 16061 KSRC := /lib/modules/$(KVER)/build 16062 INSTALL_PREFIX := 16063+PWD = $(shell pwd) 16064 16065 all: modules 16066 16067diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/modules.order rtl8187_linux_26.1010.0622.2006.modified/ieee80211/modules.order 16068--- rtl8187_linux_26.1010.0622.2006/ieee80211/modules.order 1969-12-31 16:00:00.000000000 -0800 16069+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/modules.order 2010-05-19 22:23:55.968503440 -0700 16070@@ -0,0 +1,5 @@ 16071+kernel//home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl.ko 16072+kernel//home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl.ko 16073+kernel//home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_wep-rtl.ko 16074+kernel//home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_tkip-rtl.ko 16075+kernel//home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_ccmp-rtl.ko 16076diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/Modules.symvers rtl8187_linux_26.1010.0622.2006.modified/ieee80211/Modules.symvers 16077--- rtl8187_linux_26.1010.0622.2006/ieee80211/Modules.symvers 2006-06-05 19:57:56.000000000 -0700 16078+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/Modules.symvers 1969-12-31 16:00:00.000000000 -0800 16079@@ -1,43 +0,0 @@ 16080-0x232e7944 ieee80211_wlan_frequencies /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16081-0xaeae102f free_ieee80211_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl 16082-0x279e265f ieee80211_crypt_deinit_handler net/ieee80211/ieee80211_crypt 16083-0xc2411d91 ieee80211_stop_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16084-0x6ece20e1 ieee80211_wx_get_name_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl 16085-0x5d3847ff ieee80211_rx_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16086-0x18612027 ieee80211_wx_get_scan_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16087-0xa0e03ce1 ieee80211_wx_get_name /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16088-0xee25f349 ieee80211_wx_get_mode /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16089-0x86013c3d ieee80211_wx_set_mode /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16090-0x04493cc0 ieee80211_wx_get_rate /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16091-0x6c6df3b4 ieee80211_wx_set_rate /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16092-0x82caec02 ieee80211_crypt_deinit_entries net/ieee80211/ieee80211_crypt 16093-0x347945bf ieee80211_wx_get_power /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16094-0x6379d455 ieee80211_wx_set_power /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16095-0xae62ed59 ieee80211_wx_set_scan /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16096-0x6621e172 ieee80211_wx_set_freq /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16097-0x0e052e06 ieee80211_wx_get_freq /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16098-0x283f9f5d ieee80211_unregister_crypto_ops net/ieee80211/ieee80211_crypt 16099-0x9da79aac ieee80211_is_shortslot /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16100-0x666032dc ieee80211_wx_get_wap /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16101-0x9f1cbe0e ieee80211_wx_set_wap /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16102-0x73d1d341 ieee80211_wx_set_rawtx /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16103-0x2c714184 ieee80211_is_54g /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16104-0x6892d598 ieee80211_wpa_supplicant_ioctl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16105-0xc062f1f5 ieee80211_ps_tx_ack /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16106-0x55534906 ieee80211_get_beacon /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16107-0xe2679638 ieee80211_crypt_delayed_deinit net/ieee80211/ieee80211_crypt 16108-0x3a0456bc free_ieee80211 net/ieee80211/ieee80211 16109-0x7e1ef2c8 ieee80211_wake_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16110-0xc1b81e9f ieee80211_register_crypto_ops net/ieee80211/ieee80211_crypt 16111-0x3f795a39 alloc_ieee80211 net/ieee80211/ieee80211 16112-0x89803c23 ieee80211_get_crypto_ops net/ieee80211/ieee80211_crypt 16113-0xc6caf2a4 ieee80211_txb_free net/ieee80211/ieee80211 16114-0x49c1422c ieee80211_rx_mgt net/ieee80211/ieee80211 16115-0xbf2b4ebd alloc_ieee80211_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl 16116-0xd155f7b8 ieee80211_softmac_stop_protocol /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16117-0x9ce2dcde ieee80211_softmac_start_protocol /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16118-0x00d74bba ieee80211_wx_get_encode_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16119-0x92b5d996 ieee80211_wx_set_encode_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16120-0x2ac9bf95 ieee80211_wx_set_essid /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16121-0x7dc92e7f ieee80211_wx_get_essid /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16122-0xd04740ca ieee80211_reset_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl 16123diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/Module.symvers rtl8187_linux_26.1010.0622.2006.modified/ieee80211/Module.symvers 16124--- rtl8187_linux_26.1010.0622.2006/ieee80211/Module.symvers 1969-12-31 16:00:00.000000000 -0800 16125+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/Module.symvers 2010-05-19 22:24:10.342666003 -0700 16126@@ -0,0 +1,41 @@ 16127+0x00000000 ieee80211_softmac_start_protocol_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16128+0x00000000 free_ieee80211_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16129+0x00000000 ieee80211_wx_get_name_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16130+0x00000000 ieee80211_wx_get_mode_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16131+0x00000000 ieee80211_wx_set_mode_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16132+0x00000000 ieee80211_wx_get_rate_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16133+0x00000000 ieee80211_wx_set_rate_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16134+0x00000000 ieee80211_wx_get_scan_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16135+0x00000000 ieee80211_wx_set_scan_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16136+0x00000000 ieee80211_wx_set_freq_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16137+0x00000000 ieee80211_wx_get_freq_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16138+0x00000000 ieee80211_register_crypto_ops_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl EXPORT_SYMBOL 16139+0x00000000 ieee80211_ps_tx_ack_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16140+0x00000000 ieee80211_rx_mgt_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16141+0x00000000 ieee80211_unregister_crypto_ops_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl EXPORT_SYMBOL 16142+0x00000000 ieee80211_wx_set_essid_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16143+0x00000000 ieee80211_wx_get_essid_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16144+0x00000000 ieee80211_stop_queue_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16145+0x00000000 ieee80211_rx_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16146+0x00000000 ieee80211_crypt_deinit_handler_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl EXPORT_SYMBOL 16147+0x00000000 ieee80211_wx_get_wap_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16148+0x00000000 ieee80211_wx_set_wap_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16149+0x00000000 ieee80211_wlan_frequencies_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16150+0x00000000 ieee80211_get_crypto_ops_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl EXPORT_SYMBOL 16151+0x00000000 ieee80211_xmit_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16152+0x00000000 ieee80211_wx_get_power_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16153+0x00000000 ieee80211_wx_set_power_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16154+0x00000000 ieee80211_crypt_deinit_entries_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl EXPORT_SYMBOL 16155+0x00000000 ieee80211_is_54g_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16156+0x00000000 ieee80211_get_beacon_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16157+0x00000000 ieee80211_is_shortslot_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16158+0x00000000 ieee80211_wx_set_rawtx_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16159+0x00000000 ieee80211_reset_queue_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16160+0x00000000 ieee80211_softmac_stop_protocol_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16161+0x00000000 ieee80211_wpa_supplicant_ioctl_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16162+0x00000000 alloc_ieee80211_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16163+0x00000000 ieee80211_txb_free_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16164+0x00000000 ieee80211_wake_queue_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16165+0x00000000 ieee80211_crypt_delayed_deinit_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl EXPORT_SYMBOL 16166+0x00000000 ieee80211_wx_get_encode_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16167+0x00000000 ieee80211_wx_set_encode_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL 16168diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod rtl8187_linux_26.1010.0622.2006.modified/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod 16169--- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod 2006-06-05 19:57:54.000000000 -0700 16170+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod 2010-05-19 22:23:55.941849065 -0700 16171@@ -1,2 +1,2 @@ 16172-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_ccmp-rtl.ko 16173-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_ccmp.o 16174+/home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_ccmp-rtl.ko 16175+/home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_ccmp.o 16176diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod rtl8187_linux_26.1010.0622.2006.modified/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod 16177--- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod 2006-06-05 19:57:54.000000000 -0700 16178+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod 2010-05-19 22:23:55.861848365 -0700 16179@@ -1,2 +1,2 @@ 16180-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt-rtl.ko 16181-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt.o 16182+/home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl.ko 16183+/home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.o 16184diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod rtl8187_linux_26.1010.0622.2006.modified/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod 16185--- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod 2006-06-05 19:57:54.000000000 -0700 16186+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod 2010-05-19 22:23:55.921850950 -0700 16187@@ -1,2 +1,2 @@ 16188-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_tkip-rtl.ko 16189-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_tkip.o 16190+/home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_tkip-rtl.ko 16191+/home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_tkip.o 16192diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod rtl8187_linux_26.1010.0622.2006.modified/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod 16193--- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod 2006-06-05 19:57:54.000000000 -0700 16194+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod 2010-05-19 22:23:55.888502601 -0700 16195@@ -1,2 +1,2 @@ 16196-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_wep-rtl.ko 16197-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_wep.o 16198+/home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_wep-rtl.ko 16199+/home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_wep.o 16200diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211-rtl.mod rtl8187_linux_26.1010.0622.2006.modified/ieee80211/.tmp_versions/ieee80211-rtl.mod 16201--- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211-rtl.mod 2006-06-05 19:57:54.000000000 -0700 16202+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/.tmp_versions/ieee80211-rtl.mod 2010-05-19 22:23:55.841835305 -0700 16203@@ -1,2 +1,2 @@ 16204-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211-rtl.ko 16205-/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 16206+/home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl.ko 16207+/home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac.o /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_rx.o /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_tx.o /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_wx.o /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_module.o /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac_wx.o 16208diff -Naur rtl8187_linux_26.1010.0622.2006/makedrv~ rtl8187_linux_26.1010.0622.2006.modified/makedrv~ 16209--- rtl8187_linux_26.1010.0622.2006/makedrv~ 2006-09-05 07:21:10.000000000 -0700 16210+++ rtl8187_linux_26.1010.0622.2006.modified/makedrv~ 1969-12-31 16:00:00.000000000 -0800 16211@@ -1,13 +0,0 @@ 16212-#!/bin/sh 16213- 16214-#tar -zxvf stack.tar.gz 16215-#tar -zxvf drv.tar.gz 16216-cd ieee80211 16217-make clean 16218-make 16219-cd ../beta-8187 16220-make clean 16221-make 16222-cd .. 16223- 16224- 16225diff -Naur rtl8187_linux_26.1010.0622.2006/Makefile rtl8187_linux_26.1010.0622.2006.modified/Makefile 16226--- rtl8187_linux_26.1010.0622.2006/Makefile 1969-12-31 16:00:00.000000000 -0800 16227+++ rtl8187_linux_26.1010.0622.2006.modified/Makefile 2010-05-19 22:18:52.002707069 -0700 16228@@ -0,0 +1,38 @@ 16229+prefix = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless 16230+r8187dir = $(prefix)/rtl8187 16231+ieeedir = $(prefix)/rtl_ieee80211 16232+ 16233+default: all 16234+ 16235+all: 16236+ -rm -f ieee80211/Module.symvers 2>/dev/null 16237+ -rm -f ieee80211/Modules.symvers 2>/dev/null 16238+ $(MAKE) -C ieee80211 $(@) 16239+ -chmod +x symvers 16240+ -./symvers 16241+ $(MAKE) -C beta-8187 $(@) 16242+ 16243+install: 16244+ install -d $(ieeedir) 16245+ install -d $(r8187dir) 16246+ install -m 644 ./ieee80211/*.ko $(ieeedir) 16247+ install -m 644 ./beta-8187/*.ko $(r8187dir) 16248+ -depmod -ae 16249+ 16250+uninstall: 16251+ -rm -f $(ieeedir)/ieee80211-rtl.ko 16252+ -rm -f $(ieeedir)/ieee80211_crypt-rtl.ko 16253+ -rm -f $(ieeedir)/ieee80211_crypt_ccmp-rtl.ko 16254+ -rm -f $(ieeedir)/ieee80211_crypt_tkip-rtl.ko 16255+ -rm -f $(ieeedir)/ieee80211_crypt_wep-rtl.ko 16256+ -rm -f $(r8187dir)/r8187.ko 16257+ -rm -fr $(ieeedir) 16258+ -rm -fr $(r8187dir) 16259+ -depmod -ae 16260+ 16261+clean: 16262+ $(MAKE) -C ieee80211 $(@) 16263+ $(MAKE) -C beta-8187 $(@) 16264+ 16265+distclean: clean 16266+ 16267diff -Naur rtl8187_linux_26.1010.0622.2006/ReadMe.txt~ rtl8187_linux_26.1010.0622.2006.modified/ReadMe.txt~ 16268--- rtl8187_linux_26.1010.0622.2006/ReadMe.txt~ 2006-06-06 10:58:00.000000000 -0700 16269+++ rtl8187_linux_26.1010.0622.2006.modified/ReadMe.txt~ 1969-12-31 16:00:00.000000000 -0800 16270@@ -1,129 +0,0 @@ 16271-Release Date: 2006-01-13, ver 1.1 16272-RTL8187 Linux driver version 1.1 16273- 16274- --This driver supports RealTek RTL8187 Wireless LAN driver for 16275- Fedora Core 2/3/4/5, Debian 3.1, Mandrake 10.2/Mandriva 2006, 16276- SUSE 9.3/10.1/10.2, Gentoo 3.1, etc. 16277- - Support Client mode for either infrastructure or adhoc mode 16278- - Support WEP and WPAPSK connection 16279- 16280-< Component > 16281-The driver is composed of several parts: 16282- 1. Module source code 16283- stack.tar.gz 16284- drv.tar.gz 16285- 16286- 2. Script ot build the modules 16287- makedrv 16288- 16289- 3. Script to load/unload modules 16290- wlan0up 16291- wlan0down 16292- 16293- 4. Script and configuration for DHCP 16294- wlan0dhcp 16295- ifcfg-wlan0 16296- 4. Supplicant source code: 16297- wpa_supplicant-0.4.9.tar.gz 16298- 16299- 5. Example of supplicant configuration file: 16300- wpa1.conf 16301- 16302-< Installation > 16303-Runing the scripts can finish all operations of building up modules 16304-from the source code and start the nic. 16305- 1. Build up the drivers from the source code 16306- ./makedrv 16307- 16308- 2. load the driver module to kernel and start up nic 16309- ./wlan0up 16310- 16311-< Set wireless lan MIBs > 16312-This driver uses Wireless Extension as an interface allowing you to set 16313-Wireless LAN specific parameters. 16314- 16315-Current driver supports "iwlist" to show the device status of nic 16316- iwlist wlan0 [parameters] 16317-where 16318- parameter explaination [parameters] 16319- ----------------------- ------------- 16320- Show available chan and freq freq / channel 16321- Show and Scan BSS and IBSS scan[ning] 16322- Show supported bit-rate rate / bit[rate] 16323- Show Power Management mode power 16324- 16325-For example: 16326- iwlist wlan0 channel 16327- iwlist wlan0 scan 16328- iwlist wlan0 rate 16329- iwlist wlan0 power 16330- 16331-Driver also supports "iwconfig", manipulate driver private ioctls, to set 16332-MIBs. 16333- 16334- iwconfig wlan0 [parameters] [val] 16335-where 16336- parameter explaination [parameters] [val] constraints 16337- ----------------------- ------------- ------------------ 16338- Connect to AP by address ap [mac_addr] 16339- Set the essid, join (I)BSS essid [essid] 16340- Set operation mode mode {Managed|Ad-hoc} 16341- Set keys and security mode key/enc[ryption] {N|open|restricted|off} 16342- 16343-For example: 16344- iwconfig wlan0 ap XX:XX:XX:XX:XX:XX 16345- iwconfig wlan0 essid "ap_name" 16346- iwconfig wlan0 mode Ad-hoc 16347- iwconfig wlan0 mode essid "name" mode Ad-hoc 16348- iwconfig wlan0 key 0123456789 [2] open 16349- iwconfig wlan0 key off 16350- iwconfig wlan0 key restricted [3] 0123456789 16351- 16352-< Getting IP address > 16353-After start up the nic, the network needs to obtain an IP address before 16354-transmit/receive data. 16355-This can be done by setting the static IP via "ifconfig wlan0 IP_ADDRESS" 16356-command, or using DHCP. 16357- 16358-If using DHCP, setting steps is as below: 16359- (1)connect to an AP via "iwconfig" settings 16360- iwconfig wlan0 essid [name] or 16361- iwconfig wlan0 ap XX:XX:XX:XX:XX:XX 16362- 16363- (2)run the script which run the dhclient 16364- ./wlan0dhcp 16365- 16366-< WPAPSK > 16367-WPA_SUPPLICANT help the network to communicate under the protection of WPAPSK 16368-mechanism 16369- 16370- (1)Unpack source code of WPA supplicant: 16371- tar -zxvf wpa_supplicant-0.4.9.tar.gz 16372- cd wpa_supplicant-0.4.9 16373- 16374- (2)Create .config file: 16375- cp defconfig .config 16376- 16377- (3)Edit .config file, uncomment the following line: 16378- #CONFIG_DRIVER_IPW=y. 16379- 16380- (4)Build WPA supplicant: 16381- make 16382- 16383- (5)Edit wpa_supplicant.conf to set up SSID and its passphrase. 16384- For example, the following setting in "wpa1.conf" means SSID 16385- to join is "BufAG54_Ch6" and its passphrase is "87654321". 16386- network={ 16387- ssid="BufAG54_Ch6" 16388- proto=WPA 16389- key_mgmt=WPA-PSK 16390- pairwise=CCMP TKIP 16391- group=CCMP TKIP WEP104 WEP40 16392- psk="87654321" 16393- priority=2 16394- } 16395- 16396- (6)Execute WPA supplicant (Assume 8187 and related modules had been 16397- loaded): 16398- ./wpa_supplicant -D ipw -c wpa1.conf -i wlan0 & 16399- 16400diff -Naur rtl8187_linux_26.1010.0622.2006/symvers rtl8187_linux_26.1010.0622.2006.modified/symvers 16401--- rtl8187_linux_26.1010.0622.2006/symvers 1969-12-31 16:00:00.000000000 -0800 16402+++ rtl8187_linux_26.1010.0622.2006.modified/symvers 2010-05-19 22:18:52.002707069 -0700 16403@@ -0,0 +1,25 @@ 16404+#!/bin/sh 16405+ 16406+cd beta-8187 16407+ 16408+if [ -e Module.symvers ] 16409+then 16410+ rm Module.symvers 16411+fi 16412+ 16413+if [ -e Modules.symvers ] 16414+then 16415+ rm Modules.symvers 16416+fi 16417+ 16418+if [ -e ../ieee80211/Module.symvers ] 16419+then 16420+ ln -sf ../ieee80211/Module.symvers ./ 16421+fi 16422+ 16423+if [ -e ../ieee80211/Modules.symvers ] 16424+then 16425+ ln -sf ../ieee80211/Modules.symvers ./ 16426+fi 16427+ 16428+cd .. 16429diff -Naur rtl8187_linux_26.1010.0622.2006/wlan0rmv rtl8187_linux_26.1010.0622.2006.modified/wlan0rmv 16430--- rtl8187_linux_26.1010.0622.2006/wlan0rmv 2006-09-05 07:21:10.000000000 -0700 16431+++ rtl8187_linux_26.1010.0622.2006.modified/wlan0rmv 2010-05-19 22:18:52.006031322 -0700 16432@@ -1,5 +1,9 @@ 16433 #!/bin/bash 16434 16435-rmmod r8180 16436-rmmod ieee80211_r8180 16437-rmmod ieee80211_crypt_r8180 16438+rmmod rtl8187 2>/dev/null 16439+rmmod r8187 2>/dev/null 16440+rmmod ieee80211_rtl 2>/dev/null 16441+rmmod ieee80211_crypt_ccmp_rtl 2>/dev/null 16442+rmmod ieee80211_crypt_tkip_rtl 2>/dev/null 16443+rmmod ieee80211_crypt_wep_rtl 2>/dev/null 16444+rmmod ieee80211_crypt_rtl 2>/dev/null 16445