aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/staging/rtl8192u/ieee80211.h157
-rw-r--r--drivers/staging/rtl8192u/ieee80211/EndianFree.h5
-rw-r--r--drivers/staging/rtl8192u/ieee80211/crypto_compat.h30
-rw-r--r--drivers/staging/rtl8192u/ieee80211/dot11d.c16
-rw-r--r--drivers/staging/rtl8192u/ieee80211/ieee80211.h157
-rw-r--r--drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h7
-rw-r--r--drivers/staging/rtl8192u/ieee80211/ieee80211_module.c2
-rw-r--r--drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c110
-rw-r--r--drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c242
-rw-r--r--drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c78
-rw-r--r--drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c17
-rw-r--r--drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c154
-rw-r--r--drivers/staging/rtl8192u/ieee80211/internal.h16
-rw-r--r--drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c42
-rw-r--r--drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c259
-rw-r--r--drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h166
-rw-r--r--drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c26
-rw-r--r--drivers/staging/rtl8192u/r8192U.h104
-rw-r--r--drivers/staging/rtl8192u/r8192U_core.c1083
-rw-r--r--drivers/staging/rtl8192u/r8192U_dm.c288
-rw-r--r--drivers/staging/rtl8192u/r8192U_dm.h55
-rw-r--r--drivers/staging/rtl8192u/r8192U_hw.h335
-rw-r--r--drivers/staging/rtl8192u/r8192U_wx.c82
-rw-r--r--drivers/staging/rtl8192u/r819xU_cmdpkt.c31
-rw-r--r--drivers/staging/rtl8192u/r819xU_cmdpkt.h10
-rw-r--r--drivers/staging/rtl8192u/r819xU_firmware.c266
-rw-r--r--drivers/staging/rtl8192u/r819xU_firmware.h41
-rw-r--r--drivers/staging/rtl8192u/r819xU_phy.c49
-rw-r--r--drivers/staging/rtl8192u/r819xU_phy.h4
29 files changed, 1 insertions, 3831 deletions
diff --git a/drivers/staging/rtl8192u/ieee80211.h b/drivers/staging/rtl8192u/ieee80211.h
index f5795855904b..3a47f1213e85 100644
--- a/drivers/staging/rtl8192u/ieee80211.h
+++ b/drivers/staging/rtl8192u/ieee80211.h
@@ -27,12 +27,7 @@
27#include <linux/kernel.h> /* ARRAY_SIZE */ 27#include <linux/kernel.h> /* ARRAY_SIZE */
28#include <linux/version.h> 28#include <linux/version.h>
29#include <linux/module.h> 29#include <linux/module.h>
30#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
31#include <linux/jiffies.h> 30#include <linux/jiffies.h>
32#else
33#include <linux/jffs.h>
34#include <linux/tqueue.h>
35#endif
36#include <linux/timer.h> 31#include <linux/timer.h>
37#include <linux/sched.h> 32#include <linux/sched.h>
38 33
@@ -43,11 +38,6 @@
43#include "ieee80211/rtl819x_BA.h" 38#include "ieee80211/rtl819x_BA.h"
44#include "ieee80211/rtl819x_TS.h" 39#include "ieee80211/rtl819x_TS.h"
45 40
46#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
47#ifndef bool
48typedef enum{false = 0, true} bool;
49#endif
50#endif
51 41
52#ifndef IW_MODE_MONITOR 42#ifndef IW_MODE_MONITOR
53#define IW_MODE_MONITOR 6 43#define IW_MODE_MONITOR 6
@@ -57,24 +47,6 @@ typedef enum{false = 0, true} bool;
57#define IWEVCUSTOM 0x8c02 47#define IWEVCUSTOM 0x8c02
58#endif 48#endif
59 49
60#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
61#ifndef __bitwise
62#define __bitwise __attribute__((bitwise))
63#endif
64typedef __u16 __le16;
65#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,27))
66struct iw_spy_data{
67 /* --- Standard spy support --- */
68 int spy_number;
69 u_char spy_address[IW_MAX_SPY][ETH_ALEN];
70 struct iw_quality spy_stat[IW_MAX_SPY];
71 /* --- Enhanced spy support (event) */
72 struct iw_quality spy_thr_low; /* Low threshold */
73 struct iw_quality spy_thr_high; /* High threshold */
74 u_char spy_thr_under[IW_MAX_SPY];
75};
76#endif
77#endif
78 50
79#ifndef container_of 51#ifndef container_of
80/** 52/**
@@ -425,46 +397,10 @@ typedef struct ieee_param {
425#define IW_QUAL_NOISE_UPDATED 0x4 397#define IW_QUAL_NOISE_UPDATED 0x4
426#endif 398#endif
427 399
428#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
429static inline void tq_init(struct tq_struct * task, void(*func)(void *), void *data)
430{
431 task->routine = func;
432 task->data = data;
433 //task->next = NULL;
434 INIT_LIST_HEAD(&task->list);
435 task->sync = 0;
436}
437#endif
438 400
439// linux under 2.6.9 release may not support it, so modify it for common use 401// linux under 2.6.9 release may not support it, so modify it for common use
440#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9))
441//#define MSECS(t) (1000 * ((t) / HZ) + 1000 * ((t) % HZ) / HZ)
442#define MSECS(t) (HZ * ((t) / 1000) + (HZ * ((t) % 1000)) / 1000)
443static inline unsigned long msleep_interruptible_rsl(unsigned int msecs)
444{
445 unsigned long timeout = MSECS(msecs) + 1;
446
447 while (timeout) {
448 set_current_state(TASK_INTERRUPTIBLE);
449 timeout = schedule_timeout(timeout);
450 }
451 return timeout;
452}
453#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,31))
454static inline void msleep(unsigned int msecs)
455{
456 unsigned long timeout = MSECS(msecs) + 1;
457
458 while (timeout) {
459 set_current_state(TASK_UNINTERRUPTIBLE);
460 timeout = schedule_timeout(timeout);
461 }
462}
463#endif
464#else
465#define MSECS(t) msecs_to_jiffies(t) 402#define MSECS(t) msecs_to_jiffies(t)
466#define msleep_interruptible_rsl msleep_interruptible 403#define msleep_interruptible_rsl msleep_interruptible
467#endif
468 404
469#define IEEE80211_DATA_LEN 2304 405#define IEEE80211_DATA_LEN 2304
470/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section 406/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
@@ -926,7 +862,6 @@ struct ieee_ibss_seq {
926 * information for frames received. Not setting these will not cause 862 * information for frames received. Not setting these will not cause
927 * any adverse affects. */ 863 * any adverse affects. */
928struct ieee80211_rx_stats { 864struct ieee80211_rx_stats {
929#if 1
930 u32 mac_time[2]; 865 u32 mac_time[2];
931 s8 rssi; 866 s8 rssi;
932 u8 signal; 867 u8 signal;
@@ -988,7 +923,6 @@ struct ieee80211_rx_stats {
988 bool bToSelfBA; //cosa add for rssi 923 bool bToSelfBA; //cosa add for rssi
989 char cck_adc_pwdb[4]; //cosa add for rx path selection 924 char cck_adc_pwdb[4]; //cosa add for rx path selection
990 u16 Seq_Num; 925 u16 Seq_Num;
991#endif
992 926
993}; 927};
994 928
@@ -1336,7 +1270,6 @@ typedef union _frameqos {
1336#define QOS_OUI_PARAM_SUB_TYPE 1 1270#define QOS_OUI_PARAM_SUB_TYPE 1
1337#define QOS_VERSION_1 1 1271#define QOS_VERSION_1 1
1338#define QOS_AIFSN_MIN_VALUE 2 1272#define QOS_AIFSN_MIN_VALUE 2
1339#if 1
1340struct ieee80211_qos_information_element { 1273struct ieee80211_qos_information_element {
1341 u8 elementID; 1274 u8 elementID;
1342 u8 length; 1275 u8 length;
@@ -1411,7 +1344,6 @@ struct ieee80211_wmm_tspec_elem {
1411 u16 surp_band_allow; 1344 u16 surp_band_allow;
1412 u16 medium_time; 1345 u16 medium_time;
1413}__attribute__((packed)); 1346}__attribute__((packed));
1414#endif
1415enum eap_type { 1347enum eap_type {
1416 EAP_PACKET = 0, 1348 EAP_PACKET = 0,
1417 EAPOL_START, 1349 EAPOL_START,
@@ -1534,14 +1466,12 @@ enum {WMM_all_frame, WMM_two_frame, WMM_four_frame, WMM_six_frame};
1534 1466
1535//UP Mapping to AC, using in MgntQuery_SequenceNumber() and maybe for DSCP 1467//UP Mapping to AC, using in MgntQuery_SequenceNumber() and maybe for DSCP
1536//#define UP2AC(up) ((up<3) ? ((up==0)?1:0) : (up>>1)) 1468//#define UP2AC(up) ((up<3) ? ((up==0)?1:0) : (up>>1))
1537#if 1
1538#define UP2AC(up) ( \ 1469#define UP2AC(up) ( \
1539 ((up) < 1) ? WME_AC_BE : \ 1470 ((up) < 1) ? WME_AC_BE : \
1540 ((up) < 3) ? WME_AC_BK : \ 1471 ((up) < 3) ? WME_AC_BK : \
1541 ((up) < 4) ? WME_AC_BE : \ 1472 ((up) < 4) ? WME_AC_BE : \
1542 ((up) < 6) ? WME_AC_VI : \ 1473 ((up) < 6) ? WME_AC_VI : \
1543 WME_AC_VO) 1474 WME_AC_VO)
1544#endif
1545//AC Mapping to UP, using in Tx part for selecting the corresponding TX queue 1475//AC Mapping to UP, using in Tx part for selecting the corresponding TX queue
1546#define AC2UP(_ac) ( \ 1476#define AC2UP(_ac) ( \
1547 ((_ac) == WME_AC_VO) ? 6 : \ 1477 ((_ac) == WME_AC_VO) ? 6 : \
@@ -1597,12 +1527,7 @@ struct ieee80211_network {
1597 /* Ensure null-terminated for any debug msgs */ 1527 /* Ensure null-terminated for any debug msgs */
1598 u8 ssid[IW_ESSID_MAX_SIZE + 1]; 1528 u8 ssid[IW_ESSID_MAX_SIZE + 1];
1599 u8 ssid_len; 1529 u8 ssid_len;
1600#if 1
1601 struct ieee80211_qos_data qos_data; 1530 struct ieee80211_qos_data qos_data;
1602#else
1603 // Qos related. Added by Annie, 2005-11-01.
1604 BSS_QOS BssQos;
1605#endif
1606 //added by amy for LEAP 1531 //added by amy for LEAP
1607 bool bWithAironetIE; 1532 bool bWithAironetIE;
1608 bool bCkipSupported; 1533 bool bCkipSupported;
@@ -1667,7 +1592,6 @@ struct ieee80211_network {
1667 struct list_head list; 1592 struct list_head list;
1668}; 1593};
1669 1594
1670#if 1
1671enum ieee80211_state { 1595enum ieee80211_state {
1672 1596
1673 /* the card is not linked at all */ 1597 /* the card is not linked at all */
@@ -1706,17 +1630,6 @@ enum ieee80211_state {
1706 IEEE80211_LINKED_SCANNING, 1630 IEEE80211_LINKED_SCANNING,
1707 1631
1708}; 1632};
1709#else
1710enum ieee80211_state {
1711 IEEE80211_UNINITIALIZED = 0,
1712 IEEE80211_INITIALIZED,
1713 IEEE80211_ASSOCIATING,
1714 IEEE80211_ASSOCIATED,
1715 IEEE80211_AUTHENTICATING,
1716 IEEE80211_AUTHENTICATED,
1717 IEEE80211_SHUTDOWN
1718};
1719#endif
1720 1633
1721#define DEFAULT_MAX_SCAN_AGE (15 * HZ) 1634#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
1722#define DEFAULT_FTS 2346 1635#define DEFAULT_FTS 2346
@@ -1735,20 +1648,7 @@ enum ieee80211_state {
1735#define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \ 1648#define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \
1736 IEEE80211_52GHZ_MIN_CHANNEL + 1) 1649 IEEE80211_52GHZ_MIN_CHANNEL + 1)
1737 1650
1738#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
1739extern inline int is_multicast_ether_addr(const u8 *addr)
1740{
1741 return ((addr[0] != 0xff) && (0x01 & addr[0]));
1742}
1743#endif
1744 1651
1745#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
1746extern inline int is_broadcast_ether_addr(const u8 *addr)
1747{
1748 return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
1749 (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
1750}
1751#endif
1752 1652
1753typedef struct tx_pending_t{ 1653typedef struct tx_pending_t{
1754 int frag; 1654 int frag;
@@ -1826,11 +1726,7 @@ typedef struct _RT_POWER_SAVE_CONTROL
1826 bool bIPSModeBackup; 1726 bool bIPSModeBackup;
1827 bool bSwRfProcessing; 1727 bool bSwRfProcessing;
1828 RT_RF_POWER_STATE eInactivePowerState; 1728 RT_RF_POWER_STATE eInactivePowerState;
1829#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1830 struct work_struct InactivePsWorkItem; 1729 struct work_struct InactivePsWorkItem;
1831#else
1832 struct tq_struct InactivePsWorkItem;
1833#endif
1834 struct timer_list InactivePsTimer; 1730 struct timer_list InactivePsTimer;
1835 1731
1836 // Return point for join action 1732 // Return point for join action
@@ -2195,32 +2091,13 @@ struct ieee80211_device {
2195 2091
2196 /* used if IEEE_SOFTMAC_BEACONS is set */ 2092 /* used if IEEE_SOFTMAC_BEACONS is set */
2197 struct timer_list beacon_timer; 2093 struct timer_list beacon_timer;
2198#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2199 struct work_struct associate_complete_wq; 2094 struct work_struct associate_complete_wq;
2200 struct work_struct associate_procedure_wq; 2095 struct work_struct associate_procedure_wq;
2201#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
2202 struct delayed_work softmac_scan_wq; 2096 struct delayed_work softmac_scan_wq;
2203 struct delayed_work associate_retry_wq; 2097 struct delayed_work associate_retry_wq;
2204 struct delayed_work start_ibss_wq; 2098 struct delayed_work start_ibss_wq;
2205#else
2206 struct work_struct softmac_scan_wq;
2207 struct work_struct associate_retry_wq;
2208 struct work_struct start_ibss_wq;
2209#endif
2210 struct work_struct wx_sync_scan_wq; 2099 struct work_struct wx_sync_scan_wq;
2211 struct workqueue_struct *wq; 2100 struct workqueue_struct *wq;
2212#else
2213 /* used for periodly scan */
2214 struct timer_list scan_timer;
2215
2216 struct tq_struct associate_complete_wq;
2217 struct tq_struct associate_retry_wq;
2218 struct tq_struct start_ibss_wq;
2219 struct tq_struct associate_procedure_wq;
2220 struct tq_struct softmac_scan_wq;
2221 struct tq_struct wx_sync_scan_wq;
2222
2223#endif
2224 // Qos related. Added by Annie, 2005-11-01. 2101 // Qos related. Added by Annie, 2005-11-01.
2225 //STA_QOS StaQos; 2102 //STA_QOS StaQos;
2226 2103
@@ -2320,35 +2197,9 @@ struct ieee80211_device {
2320 void (*ps_request_tx_ack) (struct net_device *dev); 2197 void (*ps_request_tx_ack) (struct net_device *dev);
2321 void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl); 2198 void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl);
2322 short (*ps_is_queue_empty) (struct net_device *dev); 2199 short (*ps_is_queue_empty) (struct net_device *dev);
2323#if 0
2324 /* Typical STA methods */
2325 int (*handle_auth) (struct net_device * dev,
2326 struct ieee80211_auth * auth);
2327 int (*handle_deauth) (struct net_device * dev,
2328 struct ieee80211_deauth * auth);
2329 int (*handle_action) (struct net_device * dev,
2330 struct ieee80211_action * action,
2331 struct ieee80211_rx_stats * stats);
2332 int (*handle_disassoc) (struct net_device * dev,
2333 struct ieee80211_disassoc * assoc);
2334#endif
2335 int (*handle_beacon) (struct net_device * dev, struct ieee80211_beacon * beacon, struct ieee80211_network * network); 2200 int (*handle_beacon) (struct net_device * dev, struct ieee80211_beacon * beacon, struct ieee80211_network * network);
2336#if 0
2337 int (*handle_probe_response) (struct net_device * dev,
2338 struct ieee80211_probe_response * resp,
2339 struct ieee80211_network * network);
2340 int (*handle_probe_request) (struct net_device * dev,
2341 struct ieee80211_probe_request * req,
2342 struct ieee80211_rx_stats * stats);
2343#endif
2344 int (*handle_assoc_response) (struct net_device * dev, struct ieee80211_assoc_response_frame * resp, struct ieee80211_network * network); 2201 int (*handle_assoc_response) (struct net_device * dev, struct ieee80211_assoc_response_frame * resp, struct ieee80211_network * network);
2345 2202
2346#if 0
2347 /* Typical AP methods */
2348 int (*handle_assoc_request) (struct net_device * dev);
2349 int (*handle_reassoc_request) (struct net_device * dev,
2350 struct ieee80211_reassoc_request * req);
2351#endif
2352 2203
2353 /* check whether Tx hw resouce available */ 2204 /* check whether Tx hw resouce available */
2354 short (*check_nic_enough_desc)(struct net_device *dev, int queue_index); 2205 short (*check_nic_enough_desc)(struct net_device *dev, int queue_index);
@@ -2406,11 +2257,7 @@ struct ieee80211_device {
2406 2257
2407static inline void *ieee80211_priv(struct net_device *dev) 2258static inline void *ieee80211_priv(struct net_device *dev)
2408{ 2259{
2409#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2410 return ((struct ieee80211_device *)netdev_priv(dev))->priv; 2260 return ((struct ieee80211_device *)netdev_priv(dev))->priv;
2411#else
2412 return ((struct ieee80211_device *)dev->priv)->priv;
2413#endif
2414} 2261}
2415 2262
2416extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) 2263extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
@@ -2663,11 +2510,7 @@ extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_reques
2663 union iwreq_data *wrqu, char *b); 2510 union iwreq_data *wrqu, char *b);
2664 2511
2665//extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee); 2512//extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
2666#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
2667extern void ieee80211_wx_sync_scan_wq(struct work_struct *work); 2513extern void ieee80211_wx_sync_scan_wq(struct work_struct *work);
2668#else
2669 extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
2670#endif
2671 2514
2672 2515
2673extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, 2516extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
diff --git a/drivers/staging/rtl8192u/ieee80211/EndianFree.h b/drivers/staging/rtl8192u/ieee80211/EndianFree.h
index 0c417a6234a9..dc85fb913dc2 100644
--- a/drivers/staging/rtl8192u/ieee80211/EndianFree.h
+++ b/drivers/staging/rtl8192u/ieee80211/EndianFree.h
@@ -7,11 +7,6 @@
7 * 2. Before write integer to IO. 7 * 2. Before write integer to IO.
8 * 3. After read integer from IO. 8 * 3. After read integer from IO.
9 */ 9 */
10#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
11#ifndef bool
12typedef enum{false = 0, true} bool;
13#endif
14#endif
15 10
16#define __MACHINE_LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ 11#define __MACHINE_LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
17#define __MACHINE_BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net, ppc */ 12#define __MACHINE_BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net, ppc */
diff --git a/drivers/staging/rtl8192u/ieee80211/crypto_compat.h b/drivers/staging/rtl8192u/ieee80211/crypto_compat.h
index c7f26ffa2485..da486588f1c0 100644
--- a/drivers/staging/rtl8192u/ieee80211/crypto_compat.h
+++ b/drivers/staging/rtl8192u/ieee80211/crypto_compat.h
@@ -30,35 +30,6 @@ static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm,
30 return tfm->crt_cipher.cit_decrypt(tfm, dst, src, nbytes); 30 return tfm->crt_cipher.cit_decrypt(tfm, dst, src, nbytes);
31} 31}
32 32
33#if 0
34/*
35 * crypto_free_tfm - Free crypto transform
36 * @tfm: Transform to free
37 *
38 * crypto_free_tfm() frees up the transform and any associated resources,
39 * then drops the refcount on the associated algorithm.
40 */
41void crypto_free_tfm(struct crypto_tfm *tfm)
42{
43 struct crypto_alg *alg;
44 int size;
45
46 if (unlikely(!tfm))
47 return;
48
49 alg = tfm->__crt_alg;
50 size = sizeof(*tfm) + alg->cra_ctxsize;
51
52 if (alg->cra_exit)
53 alg->cra_exit(tfm);
54 crypto_exit_ops(tfm);
55 crypto_mod_put(alg);
56 memset(tfm, 0, size);
57 kfree(tfm);
58}
59
60#endif
61#if 1
62 struct crypto_tfm *crypto_alloc_tfm(const char *name, u32 flags) 33 struct crypto_tfm *crypto_alloc_tfm(const char *name, u32 flags)
63{ 34{
64 struct crypto_tfm *tfm = NULL; 35 struct crypto_tfm *tfm = NULL;
@@ -83,7 +54,6 @@ void crypto_free_tfm(struct crypto_tfm *tfm)
83 54
84 return tfm; 55 return tfm;
85} 56}
86#endif
87//EXPORT_SYMBOL_GPL(crypto_alloc_tfm); 57//EXPORT_SYMBOL_GPL(crypto_alloc_tfm);
88//EXPORT_SYMBOL_GPL(crypto_free_tfm); 58//EXPORT_SYMBOL_GPL(crypto_free_tfm);
89 59
diff --git a/drivers/staging/rtl8192u/ieee80211/dot11d.c b/drivers/staging/rtl8192u/ieee80211/dot11d.c
index e5f2dedc4372..b91cbfcfa71f 100644
--- a/drivers/staging/rtl8192u/ieee80211/dot11d.c
+++ b/drivers/staging/rtl8192u/ieee80211/dot11d.c
@@ -35,10 +35,6 @@ Dot11d_Reset(struct ieee80211_device *ieee)
35{ 35{
36 u32 i; 36 u32 i;
37 PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(ieee); 37 PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(ieee);
38#if 0
39 if(!pDot11dInfo->bEnabled)
40 return;
41#endif
42 // Clear old channel map 38 // Clear old channel map
43 memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1); 39 memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1);
44 memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1); 40 memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1);
@@ -108,14 +104,12 @@ Dot11d_UpdateCountryIe(
108 104
109 pTriple = (PCHNL_TXPOWER_TRIPLE)((u8*)pTriple + 3); 105 pTriple = (PCHNL_TXPOWER_TRIPLE)((u8*)pTriple + 3);
110 } 106 }
111#if 1
112 //printk("Dot11d_UpdateCountryIe(): Channel List:\n"); 107 //printk("Dot11d_UpdateCountryIe(): Channel List:\n");
113 printk("Channel List:"); 108 printk("Channel List:");
114 for(i=1; i<= MAX_CHANNEL_NUMBER; i++) 109 for(i=1; i<= MAX_CHANNEL_NUMBER; i++)
115 if(pDot11dInfo->channel_map[i] > 0) 110 if(pDot11dInfo->channel_map[i] > 0)
116 printk(" %d", i); 111 printk(" %d", i);
117 printk("\n"); 112 printk("\n");
118#endif
119 113
120 UPDATE_CIE_SRC(dev, pTaddr); 114 UPDATE_CIE_SRC(dev, pTaddr);
121 115
@@ -218,7 +212,6 @@ int ToLegalChannel(
218 212
219 return default_chn; 213 return default_chn;
220} 214}
221#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
222EXPORT_SYMBOL(Dot11d_Init); 215EXPORT_SYMBOL(Dot11d_Init);
223EXPORT_SYMBOL(Dot11d_Reset); 216EXPORT_SYMBOL(Dot11d_Reset);
224EXPORT_SYMBOL(Dot11d_UpdateCountryIe); 217EXPORT_SYMBOL(Dot11d_UpdateCountryIe);
@@ -226,14 +219,5 @@ EXPORT_SYMBOL(DOT11D_GetMaxTxPwrInDbm);
226EXPORT_SYMBOL(DOT11D_ScanComplete); 219EXPORT_SYMBOL(DOT11D_ScanComplete);
227EXPORT_SYMBOL(IsLegalChannel); 220EXPORT_SYMBOL(IsLegalChannel);
228EXPORT_SYMBOL(ToLegalChannel); 221EXPORT_SYMBOL(ToLegalChannel);
229#else
230EXPORT_SYMBOL_NOVERS(Dot11d_Init);
231EXPORT_SYMBOL_NOVERS(Dot11d_Reset);
232EXPORT_SYMBOL_NOVERS(Dot11d_UpdateCountryIe);
233EXPORT_SYMBOL_NOVERS(DOT11D_GetMaxTxPwrInDbm);
234EXPORT_SYMBOL_NOVERS(DOT11D_ScanComplete);
235EXPORT_SYMBOL_NOVERS(IsLegalChannel);
236EXPORT_SYMBOL_NOVERS(ToLegalChannel);
237#endif
238 222
239#endif 223#endif
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
index 0dd773733f6b..10908e123b86 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
@@ -27,12 +27,7 @@
27#include <linux/kernel.h> /* ARRAY_SIZE */ 27#include <linux/kernel.h> /* ARRAY_SIZE */
28#include <linux/version.h> 28#include <linux/version.h>
29#include <linux/module.h> 29#include <linux/module.h>
30#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
31#include <linux/jiffies.h> 30#include <linux/jiffies.h>
32#else
33#include <linux/jffs.h>
34#include <linux/tqueue.h>
35#endif
36#include <linux/timer.h> 31#include <linux/timer.h>
37#include <linux/sched.h> 32#include <linux/sched.h>
38 33
@@ -43,11 +38,6 @@
43#include "rtl819x_BA.h" 38#include "rtl819x_BA.h"
44#include "rtl819x_TS.h" 39#include "rtl819x_TS.h"
45 40
46#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
47#ifndef bool
48typedef enum{false = 0, true} bool;
49#endif
50#endif
51 41
52#ifndef IW_MODE_MONITOR 42#ifndef IW_MODE_MONITOR
53#define IW_MODE_MONITOR 6 43#define IW_MODE_MONITOR 6
@@ -57,24 +47,6 @@ typedef enum{false = 0, true} bool;
57#define IWEVCUSTOM 0x8c02 47#define IWEVCUSTOM 0x8c02
58#endif 48#endif
59 49
60#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
61#ifndef __bitwise
62#define __bitwise __attribute__((bitwise))
63#endif
64typedef __u16 __le16;
65#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,27))
66struct iw_spy_data{
67 /* --- Standard spy support --- */
68 int spy_number;
69 u_char spy_address[IW_MAX_SPY][ETH_ALEN];
70 struct iw_quality spy_stat[IW_MAX_SPY];
71 /* --- Enhanced spy support (event) */
72 struct iw_quality spy_thr_low; /* Low threshold */
73 struct iw_quality spy_thr_high; /* High threshold */
74 u_char spy_thr_under[IW_MAX_SPY];
75};
76#endif
77#endif
78 50
79#ifndef container_of 51#ifndef container_of
80/** 52/**
@@ -425,46 +397,10 @@ typedef struct ieee_param {
425#define IW_QUAL_NOISE_UPDATED 0x4 397#define IW_QUAL_NOISE_UPDATED 0x4
426#endif 398#endif
427 399
428#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
429static inline void tq_init(struct tq_struct * task, void(*func)(void *), void *data)
430{
431 task->routine = func;
432 task->data = data;
433 //task->next = NULL;
434 INIT_LIST_HEAD(&task->list);
435 task->sync = 0;
436}
437#endif
438 400
439// linux under 2.6.9 release may not support it, so modify it for common use 401// linux under 2.6.9 release may not support it, so modify it for common use
440#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9))
441//#define MSECS(t) (1000 * ((t) / HZ) + 1000 * ((t) % HZ) / HZ)
442#define MSECS(t) (HZ * ((t) / 1000) + (HZ * ((t) % 1000)) / 1000)
443static inline unsigned long msleep_interruptible_rsl(unsigned int msecs)
444{
445 unsigned long timeout = MSECS(msecs) + 1;
446
447 while (timeout) {
448 set_current_state(TASK_INTERRUPTIBLE);
449 timeout = schedule_timeout(timeout);
450 }
451 return timeout;
452}
453#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,31))
454static inline void msleep(unsigned int msecs)
455{
456 unsigned long timeout = MSECS(msecs) + 1;
457
458 while (timeout) {
459 set_current_state(TASK_UNINTERRUPTIBLE);
460 timeout = schedule_timeout(timeout);
461 }
462}
463#endif
464#else
465#define MSECS(t) msecs_to_jiffies(t) 402#define MSECS(t) msecs_to_jiffies(t)
466#define msleep_interruptible_rsl msleep_interruptible 403#define msleep_interruptible_rsl msleep_interruptible
467#endif
468 404
469#define IEEE80211_DATA_LEN 2304 405#define IEEE80211_DATA_LEN 2304
470/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section 406/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
@@ -926,7 +862,6 @@ struct ieee_ibss_seq {
926 * information for frames received. Not setting these will not cause 862 * information for frames received. Not setting these will not cause
927 * any adverse affects. */ 863 * any adverse affects. */
928struct ieee80211_rx_stats { 864struct ieee80211_rx_stats {
929#if 1
930 u32 mac_time[2]; 865 u32 mac_time[2];
931 s8 rssi; 866 s8 rssi;
932 u8 signal; 867 u8 signal;
@@ -988,7 +923,6 @@ struct ieee80211_rx_stats {
988 bool bToSelfBA; //cosa add for rssi 923 bool bToSelfBA; //cosa add for rssi
989 char cck_adc_pwdb[4]; //cosa add for rx path selection 924 char cck_adc_pwdb[4]; //cosa add for rx path selection
990 u16 Seq_Num; 925 u16 Seq_Num;
991#endif
992 926
993}; 927};
994 928
@@ -1336,7 +1270,6 @@ typedef union _frameqos {
1336#define QOS_OUI_PARAM_SUB_TYPE 1 1270#define QOS_OUI_PARAM_SUB_TYPE 1
1337#define QOS_VERSION_1 1 1271#define QOS_VERSION_1 1
1338#define QOS_AIFSN_MIN_VALUE 2 1272#define QOS_AIFSN_MIN_VALUE 2
1339#if 1
1340struct ieee80211_qos_information_element { 1273struct ieee80211_qos_information_element {
1341 u8 elementID; 1274 u8 elementID;
1342 u8 length; 1275 u8 length;
@@ -1411,7 +1344,6 @@ struct ieee80211_wmm_tspec_elem {
1411 u16 surp_band_allow; 1344 u16 surp_band_allow;
1412 u16 medium_time; 1345 u16 medium_time;
1413}__attribute__((packed)); 1346}__attribute__((packed));
1414#endif
1415enum eap_type { 1347enum eap_type {
1416 EAP_PACKET = 0, 1348 EAP_PACKET = 0,
1417 EAPOL_START, 1349 EAPOL_START,
@@ -1534,14 +1466,12 @@ enum {WMM_all_frame, WMM_two_frame, WMM_four_frame, WMM_six_frame};
1534 1466
1535//UP Mapping to AC, using in MgntQuery_SequenceNumber() and maybe for DSCP 1467//UP Mapping to AC, using in MgntQuery_SequenceNumber() and maybe for DSCP
1536//#define UP2AC(up) ((up<3) ? ((up==0)?1:0) : (up>>1)) 1468//#define UP2AC(up) ((up<3) ? ((up==0)?1:0) : (up>>1))
1537#if 1
1538#define UP2AC(up) ( \ 1469#define UP2AC(up) ( \
1539 ((up) < 1) ? WME_AC_BE : \ 1470 ((up) < 1) ? WME_AC_BE : \
1540 ((up) < 3) ? WME_AC_BK : \ 1471 ((up) < 3) ? WME_AC_BK : \
1541 ((up) < 4) ? WME_AC_BE : \ 1472 ((up) < 4) ? WME_AC_BE : \
1542 ((up) < 6) ? WME_AC_VI : \ 1473 ((up) < 6) ? WME_AC_VI : \
1543 WME_AC_VO) 1474 WME_AC_VO)
1544#endif
1545//AC Mapping to UP, using in Tx part for selecting the corresponding TX queue 1475//AC Mapping to UP, using in Tx part for selecting the corresponding TX queue
1546#define AC2UP(_ac) ( \ 1476#define AC2UP(_ac) ( \
1547 ((_ac) == WME_AC_VO) ? 6 : \ 1477 ((_ac) == WME_AC_VO) ? 6 : \
@@ -1597,12 +1527,7 @@ struct ieee80211_network {
1597 /* Ensure null-terminated for any debug msgs */ 1527 /* Ensure null-terminated for any debug msgs */
1598 u8 ssid[IW_ESSID_MAX_SIZE + 1]; 1528 u8 ssid[IW_ESSID_MAX_SIZE + 1];
1599 u8 ssid_len; 1529 u8 ssid_len;
1600#if 1
1601 struct ieee80211_qos_data qos_data; 1530 struct ieee80211_qos_data qos_data;
1602#else
1603 // Qos related. Added by Annie, 2005-11-01.
1604 BSS_QOS BssQos;
1605#endif
1606 1531
1607 //added by amy for LEAP 1532 //added by amy for LEAP
1608 bool bWithAironetIE; 1533 bool bWithAironetIE;
@@ -1668,7 +1593,6 @@ struct ieee80211_network {
1668 struct list_head list; 1593 struct list_head list;
1669}; 1594};
1670 1595
1671#if 1
1672enum ieee80211_state { 1596enum ieee80211_state {
1673 1597
1674 /* the card is not linked at all */ 1598 /* the card is not linked at all */
@@ -1707,17 +1631,6 @@ enum ieee80211_state {
1707 IEEE80211_LINKED_SCANNING, 1631 IEEE80211_LINKED_SCANNING,
1708 1632
1709}; 1633};
1710#else
1711enum ieee80211_state {
1712 IEEE80211_UNINITIALIZED = 0,
1713 IEEE80211_INITIALIZED,
1714 IEEE80211_ASSOCIATING,
1715 IEEE80211_ASSOCIATED,
1716 IEEE80211_AUTHENTICATING,
1717 IEEE80211_AUTHENTICATED,
1718 IEEE80211_SHUTDOWN
1719};
1720#endif
1721 1634
1722#define DEFAULT_MAX_SCAN_AGE (15 * HZ) 1635#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
1723#define DEFAULT_FTS 2346 1636#define DEFAULT_FTS 2346
@@ -1736,20 +1649,7 @@ enum ieee80211_state {
1736#define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \ 1649#define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \
1737 IEEE80211_52GHZ_MIN_CHANNEL + 1) 1650 IEEE80211_52GHZ_MIN_CHANNEL + 1)
1738 1651
1739#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
1740extern inline int is_multicast_ether_addr(const u8 *addr)
1741{
1742 return ((addr[0] != 0xff) && (0x01 & addr[0]));
1743}
1744#endif
1745 1652
1746#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
1747extern inline int is_broadcast_ether_addr(const u8 *addr)
1748{
1749 return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
1750 (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
1751}
1752#endif
1753 1653
1754typedef struct tx_pending_t{ 1654typedef struct tx_pending_t{
1755 int frag; 1655 int frag;
@@ -1827,11 +1727,7 @@ typedef struct _RT_POWER_SAVE_CONTROL
1827 bool bIPSModeBackup; 1727 bool bIPSModeBackup;
1828 bool bSwRfProcessing; 1728 bool bSwRfProcessing;
1829 RT_RF_POWER_STATE eInactivePowerState; 1729 RT_RF_POWER_STATE eInactivePowerState;
1830#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1831 struct work_struct InactivePsWorkItem; 1730 struct work_struct InactivePsWorkItem;
1832#else
1833 struct tq_struct InactivePsWorkItem;
1834#endif
1835 struct timer_list InactivePsTimer; 1731 struct timer_list InactivePsTimer;
1836 1732
1837 // Return point for join action 1733 // Return point for join action
@@ -2196,32 +2092,13 @@ struct ieee80211_device {
2196 2092
2197 /* used if IEEE_SOFTMAC_BEACONS is set */ 2093 /* used if IEEE_SOFTMAC_BEACONS is set */
2198 struct timer_list beacon_timer; 2094 struct timer_list beacon_timer;
2199#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2200 struct work_struct associate_complete_wq; 2095 struct work_struct associate_complete_wq;
2201 struct work_struct associate_procedure_wq; 2096 struct work_struct associate_procedure_wq;
2202#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
2203 struct delayed_work softmac_scan_wq; 2097 struct delayed_work softmac_scan_wq;
2204 struct delayed_work associate_retry_wq; 2098 struct delayed_work associate_retry_wq;
2205 struct delayed_work start_ibss_wq; 2099 struct delayed_work start_ibss_wq;
2206#else
2207 struct work_struct softmac_scan_wq;
2208 struct work_struct associate_retry_wq;
2209 struct work_struct start_ibss_wq;
2210#endif
2211 struct work_struct wx_sync_scan_wq; 2100 struct work_struct wx_sync_scan_wq;
2212 struct workqueue_struct *wq; 2101 struct workqueue_struct *wq;
2213#else
2214 /* used for periodly scan */
2215 struct timer_list scan_timer;
2216
2217 struct tq_struct associate_complete_wq;
2218 struct tq_struct associate_retry_wq;
2219 struct tq_struct start_ibss_wq;
2220 struct tq_struct associate_procedure_wq;
2221 struct tq_struct softmac_scan_wq;
2222 struct tq_struct wx_sync_scan_wq;
2223
2224#endif
2225 // Qos related. Added by Annie, 2005-11-01. 2102 // Qos related. Added by Annie, 2005-11-01.
2226 //STA_QOS StaQos; 2103 //STA_QOS StaQos;
2227 2104
@@ -2321,35 +2198,9 @@ struct ieee80211_device {
2321 void (*ps_request_tx_ack) (struct net_device *dev); 2198 void (*ps_request_tx_ack) (struct net_device *dev);
2322 void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl); 2199 void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl);
2323 short (*ps_is_queue_empty) (struct net_device *dev); 2200 short (*ps_is_queue_empty) (struct net_device *dev);
2324#if 0
2325 /* Typical STA methods */
2326 int (*handle_auth) (struct net_device * dev,
2327 struct ieee80211_auth * auth);
2328 int (*handle_deauth) (struct net_device * dev,
2329 struct ieee80211_deauth * auth);
2330 int (*handle_action) (struct net_device * dev,
2331 struct ieee80211_action * action,
2332 struct ieee80211_rx_stats * stats);
2333 int (*handle_disassoc) (struct net_device * dev,
2334 struct ieee80211_disassoc * assoc);
2335#endif
2336 int (*handle_beacon) (struct net_device * dev, struct ieee80211_beacon * beacon, struct ieee80211_network * network); 2201 int (*handle_beacon) (struct net_device * dev, struct ieee80211_beacon * beacon, struct ieee80211_network * network);
2337#if 0
2338 int (*handle_probe_response) (struct net_device * dev,
2339 struct ieee80211_probe_response * resp,
2340 struct ieee80211_network * network);
2341 int (*handle_probe_request) (struct net_device * dev,
2342 struct ieee80211_probe_request * req,
2343 struct ieee80211_rx_stats * stats);
2344#endif
2345 int (*handle_assoc_response) (struct net_device * dev, struct ieee80211_assoc_response_frame * resp, struct ieee80211_network * network); 2202 int (*handle_assoc_response) (struct net_device * dev, struct ieee80211_assoc_response_frame * resp, struct ieee80211_network * network);
2346 2203
2347#if 0
2348 /* Typical AP methods */
2349 int (*handle_assoc_request) (struct net_device * dev);
2350 int (*handle_reassoc_request) (struct net_device * dev,
2351 struct ieee80211_reassoc_request * req);
2352#endif
2353 2204
2354 /* check whether Tx hw resouce available */ 2205 /* check whether Tx hw resouce available */
2355 short (*check_nic_enough_desc)(struct net_device *dev, int queue_index); 2206 short (*check_nic_enough_desc)(struct net_device *dev, int queue_index);
@@ -2407,11 +2258,7 @@ struct ieee80211_device {
2407 2258
2408static inline void *ieee80211_priv(struct net_device *dev) 2259static inline void *ieee80211_priv(struct net_device *dev)
2409{ 2260{
2410#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2411 return ((struct ieee80211_device *)netdev_priv(dev))->priv; 2261 return ((struct ieee80211_device *)netdev_priv(dev))->priv;
2412#else
2413 return ((struct ieee80211_device *)dev->priv)->priv;
2414#endif
2415} 2262}
2416 2263
2417extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) 2264extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
@@ -2664,11 +2511,7 @@ extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_reques
2664 union iwreq_data *wrqu, char *b); 2511 union iwreq_data *wrqu, char *b);
2665 2512
2666//extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee); 2513//extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
2667#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
2668extern void ieee80211_wx_sync_scan_wq(struct work_struct *work); 2514extern void ieee80211_wx_sync_scan_wq(struct work_struct *work);
2669#else
2670 extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
2671#endif
2672 2515
2673 2516
2674extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, 2517extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h
index a84df4b76489..b58a3bcc0dc0 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h
@@ -82,12 +82,5 @@ void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
82void ieee80211_crypt_deinit_handler(unsigned long); 82void ieee80211_crypt_deinit_handler(unsigned long);
83void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, 83void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
84 struct ieee80211_crypt_data **crypt); 84 struct ieee80211_crypt_data **crypt);
85#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
86#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK)
87#endif
88#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,31))
89#define crypto_alloc_tfm crypto_alloc_tfm_rsl
90#define crypto_free_tfm crypto_free_tfm_rsl
91#endif
92 85
93#endif 86#endif
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
index bbaec949bb85..7a8690f449b4 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
@@ -201,13 +201,11 @@ void free_ieee80211(struct net_device *dev)
201 int i; 201 int i;
202 //struct list_head *p, *q; 202 //struct list_head *p, *q;
203// del_timer_sync(&ieee->SwBwTimer); 203// del_timer_sync(&ieee->SwBwTimer);
204#if 1
205 if (ieee->pHTInfo != NULL) 204 if (ieee->pHTInfo != NULL)
206 { 205 {
207 kfree(ieee->pHTInfo); 206 kfree(ieee->pHTInfo);
208 ieee->pHTInfo = NULL; 207 ieee->pHTInfo = NULL;
209 } 208 }
210#endif
211 RemoveAllTS(ieee); 209 RemoveAllTS(ieee);
212 ieee80211_softmac_free(ieee); 210 ieee80211_softmac_free(ieee);
213 del_timer_sync(&ieee->crypt_deinit_timer); 211 del_timer_sync(&ieee->crypt_deinit_timer);
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
index 5b66e546416e..0e003c5bb000 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
@@ -55,11 +55,7 @@ static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
55 u16 fc = le16_to_cpu(hdr->frame_ctl); 55 u16 fc = le16_to_cpu(hdr->frame_ctl);
56 56
57 skb->dev = ieee->dev; 57 skb->dev = ieee->dev;
58#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
59 skb_reset_mac_header(skb); 58 skb_reset_mac_header(skb);
60#else
61 skb->mac.raw = skb->data;
62#endif
63 59
64 skb_pull(skb, ieee80211_get_hdrlen(fc)); 60 skb_pull(skb, ieee80211_get_hdrlen(fc));
65 skb->pkt_type = PACKET_OTHERHOST; 61 skb->pkt_type = PACKET_OTHERHOST;
@@ -351,13 +347,11 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb,
351 347
352 if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) 348 if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL)
353 return 0; 349 return 0;
354#if 1
355 if (ieee->hwsec_active) 350 if (ieee->hwsec_active)
356 { 351 {
357 cb_desc *tcb_desc = (cb_desc *)(skb->cb+ MAX_DEV_ADDR_SIZE); 352 cb_desc *tcb_desc = (cb_desc *)(skb->cb+ MAX_DEV_ADDR_SIZE);
358 tcb_desc->bHwSec = 1; 353 tcb_desc->bHwSec = 1;
359 } 354 }
360#endif
361 hdr = (struct ieee80211_hdr_4addr *) skb->data; 355 hdr = (struct ieee80211_hdr_4addr *) skb->data;
362 hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); 356 hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
363 357
@@ -534,7 +528,6 @@ AddReorderEntry(
534 ) 528 )
535{ 529{
536 struct list_head *pList = &pTS->RxPendingPktList; 530 struct list_head *pList = &pTS->RxPendingPktList;
537#if 1
538 while(pList->next != &pTS->RxPendingPktList) 531 while(pList->next != &pTS->RxPendingPktList)
539 { 532 {
540 if( SN_LESS(pReorderEntry->SeqNum, ((PRX_REORDER_ENTRY)list_entry(pList->next,RX_REORDER_ENTRY,List))->SeqNum) ) 533 if( SN_LESS(pReorderEntry->SeqNum, ((PRX_REORDER_ENTRY)list_entry(pList->next,RX_REORDER_ENTRY,List))->SeqNum) )
@@ -550,7 +543,6 @@ AddReorderEntry(
550 break; 543 break;
551 } 544 }
552 } 545 }
553#endif
554 pReorderEntry->List.next = pList->next; 546 pReorderEntry->List.next = pList->next;
555 pReorderEntry->List.next->prev = &pReorderEntry->List; 547 pReorderEntry->List.next->prev = &pReorderEntry->List;
556 pReorderEntry->List.prev = pList; 548 pReorderEntry->List.prev = pList;
@@ -626,10 +618,6 @@ void RxReorderIndicatePacket( struct ieee80211_device *ieee,
626 u8 index = 0; 618 u8 index = 0;
627 bool bMatchWinStart = false, bPktInBuf = false; 619 bool bMatchWinStart = false, bPktInBuf = false;
628 IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): Seq is %d,pTS->RxIndicateSeq is %d, WinSize is %d\n",__FUNCTION__,SeqNum,pTS->RxIndicateSeq,WinSize); 620 IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): Seq is %d,pTS->RxIndicateSeq is %d, WinSize is %d\n",__FUNCTION__,SeqNum,pTS->RxIndicateSeq,WinSize);
629#if 0
630 if(!list_empty(&ieee->RxReorder_Unused_List))
631 IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): ieee->RxReorder_Unused_List is nut NULL\n");
632#endif
633 /* Rx Reorder initialize condition.*/ 621 /* Rx Reorder initialize condition.*/
634 if(pTS->RxIndicateSeq == 0xffff) { 622 if(pTS->RxIndicateSeq == 0xffff) {
635 pTS->RxIndicateSeq = SeqNum; 623 pTS->RxIndicateSeq = SeqNum;
@@ -696,7 +684,6 @@ void RxReorderIndicatePacket( struct ieee80211_device *ieee,
696 pReorderEntry->prxb = prxb; 684 pReorderEntry->prxb = prxb;
697 // IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): pREorderEntry->SeqNum is %d\n",__FUNCTION__,pReorderEntry->SeqNum); 685 // IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): pREorderEntry->SeqNum is %d\n",__FUNCTION__,pReorderEntry->SeqNum);
698 686
699#if 1
700 if(!AddReorderEntry(pTS, pReorderEntry)) { 687 if(!AddReorderEntry(pTS, pReorderEntry)) {
701 IEEE80211_DEBUG(IEEE80211_DL_REORDER, "%s(): Duplicate packet is dropped!! IndicateSeq: %d, NewSeq: %d\n", 688 IEEE80211_DEBUG(IEEE80211_DL_REORDER, "%s(): Duplicate packet is dropped!! IndicateSeq: %d, NewSeq: %d\n",
702 __FUNCTION__, pTS->RxIndicateSeq, SeqNum); 689 __FUNCTION__, pTS->RxIndicateSeq, SeqNum);
@@ -713,7 +700,6 @@ void RxReorderIndicatePacket( struct ieee80211_device *ieee,
713 IEEE80211_DEBUG(IEEE80211_DL_REORDER, 700 IEEE80211_DEBUG(IEEE80211_DL_REORDER,
714 "Pkt insert into buffer!! IndicateSeq: %d, NewSeq: %d\n",pTS->RxIndicateSeq, SeqNum); 701 "Pkt insert into buffer!! IndicateSeq: %d, NewSeq: %d\n",pTS->RxIndicateSeq, SeqNum);
715 } 702 }
716#endif
717 } 703 }
718 else { 704 else {
719 /* 705 /*
@@ -736,7 +722,6 @@ void RxReorderIndicatePacket( struct ieee80211_device *ieee,
736 /* Check if there is any packet need indicate.*/ 722 /* Check if there is any packet need indicate.*/
737 while(!list_empty(&pTS->RxPendingPktList)) { 723 while(!list_empty(&pTS->RxPendingPktList)) {
738 IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): start RREORDER indicate\n",__FUNCTION__); 724 IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): start RREORDER indicate\n",__FUNCTION__);
739#if 1
740 pReorderEntry = (PRX_REORDER_ENTRY)list_entry(pTS->RxPendingPktList.prev,RX_REORDER_ENTRY,List); 725 pReorderEntry = (PRX_REORDER_ENTRY)list_entry(pTS->RxPendingPktList.prev,RX_REORDER_ENTRY,List);
741 if( SN_LESS(pReorderEntry->SeqNum, pTS->RxIndicateSeq) || 726 if( SN_LESS(pReorderEntry->SeqNum, pTS->RxIndicateSeq) ||
742 SN_EQUAL(pReorderEntry->SeqNum, pTS->RxIndicateSeq)) 727 SN_EQUAL(pReorderEntry->SeqNum, pTS->RxIndicateSeq))
@@ -763,7 +748,6 @@ void RxReorderIndicatePacket( struct ieee80211_device *ieee,
763 bPktInBuf = true; 748 bPktInBuf = true;
764 break; 749 break;
765 } 750 }
766#endif
767 } 751 }
768 752
769 /* Handling pending timer. Set this timer to prevent from long time Rx buffering.*/ 753 /* Handling pending timer. Set this timer to prevent from long time Rx buffering.*/
@@ -780,7 +764,6 @@ void RxReorderIndicatePacket( struct ieee80211_device *ieee,
780 ieee80211_indicate_packets(ieee, prxbIndicateArray, index); 764 ieee80211_indicate_packets(ieee, prxbIndicateArray, index);
781 } 765 }
782 766
783#if 1
784 if(bPktInBuf && pTS->RxTimeoutIndicateSeq==0xffff) { 767 if(bPktInBuf && pTS->RxTimeoutIndicateSeq==0xffff) {
785 // Set new pending timer. 768 // Set new pending timer.
786 IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): SET rx timeout timer\n", __FUNCTION__); 769 IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): SET rx timeout timer\n", __FUNCTION__);
@@ -790,7 +773,6 @@ void RxReorderIndicatePacket( struct ieee80211_device *ieee,
790 pTS->RxPktPendingTimer.expires = jiffies + MSECS(pHTInfo->RxReorderPendingTime); 773 pTS->RxPktPendingTimer.expires = jiffies + MSECS(pHTInfo->RxReorderPendingTime);
791 add_timer(&pTS->RxPktPendingTimer); 774 add_timer(&pTS->RxPktPendingTimer);
792 } 775 }
793#endif
794} 776}
795 777
796u8 parse_subframe(struct sk_buff *skb, 778u8 parse_subframe(struct sk_buff *skb,
@@ -857,11 +839,6 @@ u8 parse_subframe(struct sk_buff *skb,
857 nSubframe_Length = (nSubframe_Length>>8) + (nSubframe_Length<<8); 839 nSubframe_Length = (nSubframe_Length>>8) + (nSubframe_Length<<8);
858 840
859 if(skb->len<(ETHERNET_HEADER_SIZE + nSubframe_Length)) { 841 if(skb->len<(ETHERNET_HEADER_SIZE + nSubframe_Length)) {
860#if 0//cosa
861 RT_ASSERT(
862 (nRemain_Length>=(ETHERNET_HEADER_SIZE + nSubframe_Length)),
863 ("ParseSubframe(): A-MSDU subframe parse error!! Subframe Length: %d\n", nSubframe_Length) );
864#endif
865 printk("%s: A-MSDU parse error!! pRfd->nTotalSubframe : %d\n",\ 842 printk("%s: A-MSDU parse error!! pRfd->nTotalSubframe : %d\n",\
866 __FUNCTION__,rxb->nr_subframes); 843 __FUNCTION__,rxb->nr_subframes);
867 printk("%s: A-MSDU parse error!! Subframe Length: %d\n",__FUNCTION__, nSubframe_Length); 844 printk("%s: A-MSDU parse error!! Subframe Length: %d\n",__FUNCTION__, nSubframe_Length);
@@ -1058,19 +1035,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
1058 else 1035 else
1059 { 1036 {
1060 PRX_TS_RECORD pRxTS = NULL; 1037 PRX_TS_RECORD pRxTS = NULL;
1061 #if 0
1062 struct ieee80211_hdr_3addr *hdr;
1063 u16 fc;
1064 hdr = (struct ieee80211_hdr_3addr *)skb->data;
1065 fc = le16_to_cpu(hdr->frame_ctl);
1066 u8 tmp = (fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS);
1067
1068 u8 tid = (*((u8*)skb->data + (((fc& IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS))?30:24)))&0xf;
1069 printk("====================>fc:%x, tid:%d, tmp:%d\n", fc, tid, tmp);
1070 //u8 tid = (u8)((frameqos*)(buf + ((fc & IEEE80211_FCTL_TODS)&&(fc & IEEE80211_FCTL_FROMDS))? 30 : 24))->field.tid;
1071 #endif
1072 //IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): QOS ENABLE AND RECEIVE QOS DATA , we will get Ts, tid:%d\n",__FUNCTION__, tid); 1038 //IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): QOS ENABLE AND RECEIVE QOS DATA , we will get Ts, tid:%d\n",__FUNCTION__, tid);
1073#if 1
1074 if(GetTs( 1039 if(GetTs(
1075 ieee, 1040 ieee,
1076 (PTS_COMMON_INFO*) &pRxTS, 1041 (PTS_COMMON_INFO*) &pRxTS,
@@ -1099,22 +1064,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
1099 goto rx_dropped; 1064 goto rx_dropped;
1100 } 1065 }
1101 } 1066 }
1102#endif
1103 if (type == IEEE80211_FTYPE_MGMT) { 1067 if (type == IEEE80211_FTYPE_MGMT) {
1104 1068
1105 #if 0
1106 if ( stype == IEEE80211_STYPE_AUTH &&
1107 fc & IEEE80211_FCTL_WEP && ieee->host_decrypt &&
1108 (keyidx = hostap_rx_frame_decrypt(ieee, skb, crypt)) < 0)
1109 {
1110 printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth "
1111 "from " MAC_FMT "\n", dev->name,
1112 MAC_ARG(hdr->addr2));
1113 /* TODO: could inform hostapd about this so that it
1114 * could send auth failure report */
1115 goto rx_dropped;
1116 }
1117 #endif
1118 1069
1119 //IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len); 1070 //IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len);
1120 if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype)) 1071 if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype))
@@ -1336,7 +1287,6 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
1336 } 1287 }
1337*/ 1288*/
1338//added by amy for reorder 1289//added by amy for reorder
1339#if 1
1340 if(ieee->current_network.qos_data.active && IsQoSDataFrame(skb->data) 1290 if(ieee->current_network.qos_data.active && IsQoSDataFrame(skb->data)
1341 && !is_multicast_ether_addr(hdr->addr1) && !is_broadcast_ether_addr(hdr->addr1)) 1291 && !is_multicast_ether_addr(hdr->addr1) && !is_broadcast_ether_addr(hdr->addr1))
1342 { 1292 {
@@ -1348,7 +1298,6 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
1348 ieee->bis_any_nonbepkts = true; 1298 ieee->bis_any_nonbepkts = true;
1349 } 1299 }
1350 } 1300 }
1351#endif
1352//added by amy for reorder 1301//added by amy for reorder
1353 /* skb: hdr + (possible reassembled) full plaintext payload */ 1302 /* skb: hdr + (possible reassembled) full plaintext payload */
1354 payload = skb->data + hdrlen; 1303 payload = skb->data + hdrlen;
@@ -1974,16 +1923,6 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
1974 1923
1975 } 1924 }
1976 } 1925 }
1977#if 0
1978 if (tmp_htcap_len !=0)
1979 {
1980 u16 cap_ext = ((PHT_CAPABILITY_ELE)&info_element->data[0])->ExtHTCapInfo;
1981 if ((cap_ext & 0x0c00) == 0x0c00)
1982 {
1983 network->ralink_cap_exist = true;
1984 }
1985 }
1986#endif
1987 if(info_element->len >= 3 && 1926 if(info_element->len >= 3 &&
1988 info_element->data[0] == 0x00 && 1927 info_element->data[0] == 0x00 &&
1989 info_element->data[1] == 0x0c && 1928 info_element->data[1] == 0x0c &&
@@ -2156,44 +2095,6 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
2156 break; 2095 break;
2157#endif 2096#endif
2158/* TODO */ 2097/* TODO */
2159#if 0
2160 /* 802.11h */
2161 case MFIE_TYPE_POWER_CONSTRAINT:
2162 network->power_constraint = info_element->data[0];
2163 network->flags |= NETWORK_HAS_POWER_CONSTRAINT;
2164 break;
2165
2166 case MFIE_TYPE_CSA:
2167 network->power_constraint = info_element->data[0];
2168 network->flags |= NETWORK_HAS_CSA;
2169 break;
2170
2171 case MFIE_TYPE_QUIET:
2172 network->quiet.count = info_element->data[0];
2173 network->quiet.period = info_element->data[1];
2174 network->quiet.duration = info_element->data[2];
2175 network->quiet.offset = info_element->data[3];
2176 network->flags |= NETWORK_HAS_QUIET;
2177 break;
2178
2179 case MFIE_TYPE_IBSS_DFS:
2180 if (network->ibss_dfs)
2181 break;
2182 network->ibss_dfs = kmemdup(info_element->data,
2183 info_element->len,
2184 GFP_ATOMIC);
2185 if (!network->ibss_dfs)
2186 return 1;
2187 network->flags |= NETWORK_HAS_IBSS_DFS;
2188 break;
2189
2190 case MFIE_TYPE_TPC_REPORT:
2191 network->tpc_report.transmit_power =
2192 info_element->data[0];
2193 network->tpc_report.link_margin = info_element->data[1];
2194 network->flags |= NETWORK_HAS_TPC_REPORT;
2195 break;
2196#endif
2197 default: 2098 default:
2198 IEEE80211_DEBUG_MGMT 2099 IEEE80211_DEBUG_MGMT
2199 ("Unsupported info element: %s (%d)\n", 2100 ("Unsupported info element: %s (%d)\n",
@@ -2376,11 +2277,9 @@ static inline int ieee80211_network_init(
2376 if (ieee80211_is_empty_essid(network->ssid, network->ssid_len)) 2277 if (ieee80211_is_empty_essid(network->ssid, network->ssid_len))
2377 network->flags |= NETWORK_EMPTY_ESSID; 2278 network->flags |= NETWORK_EMPTY_ESSID;
2378 2279
2379#if 1
2380 stats->signal = 30 + (stats->SignalStrength * 70) / 100; 2280 stats->signal = 30 + (stats->SignalStrength * 70) / 100;
2381 //stats->signal = ieee80211_SignalStrengthTranslate(stats->signal); 2281 //stats->signal = ieee80211_SignalStrengthTranslate(stats->signal);
2382 stats->noise = ieee80211_translate_todbm((u8)(100-stats->signal)) -25; 2282 stats->noise = ieee80211_translate_todbm((u8)(100-stats->signal)) -25;
2383#endif
2384 2283
2385 memcpy(&network->stats, stats, sizeof(network->stats)); 2284 memcpy(&network->stats, stats, sizeof(network->stats));
2386 2285
@@ -2488,7 +2387,6 @@ static inline void update_network(struct ieee80211_network *dst,
2488 dst->qos_data.old_param_count = old_param; 2387 dst->qos_data.old_param_count = old_param;
2489 2388
2490 /* dst->last_associate is not overwritten */ 2389 /* dst->last_associate is not overwritten */
2491#if 1
2492 dst->wmm_info = src->wmm_info; //sure to exist in beacon or probe response frame. 2390 dst->wmm_info = src->wmm_info; //sure to exist in beacon or probe response frame.
2493 if(src->wmm_param[0].ac_aci_acm_aifsn|| \ 2391 if(src->wmm_param[0].ac_aci_acm_aifsn|| \
2494 src->wmm_param[1].ac_aci_acm_aifsn|| \ 2392 src->wmm_param[1].ac_aci_acm_aifsn|| \
@@ -2497,9 +2395,6 @@ static inline void update_network(struct ieee80211_network *dst,
2497 memcpy(dst->wmm_param, src->wmm_param, WME_AC_PRAM_LEN); 2395 memcpy(dst->wmm_param, src->wmm_param, WME_AC_PRAM_LEN);
2498 } 2396 }
2499 //dst->QoS_Enable = src->QoS_Enable; 2397 //dst->QoS_Enable = src->QoS_Enable;
2500#else
2501 dst->QoS_Enable = 1;//for Rtl8187 simulation
2502#endif
2503#ifdef THOMAS_TURBO 2398#ifdef THOMAS_TURBO
2504 dst->Turbo_Enable = src->Turbo_Enable; 2399 dst->Turbo_Enable = src->Turbo_Enable;
2505#endif 2400#endif
@@ -2769,10 +2664,5 @@ void ieee80211_rx_mgt(struct ieee80211_device *ieee,
2769 } 2664 }
2770} 2665}
2771 2666
2772#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
2773EXPORT_SYMBOL(ieee80211_rx_mgt); 2667EXPORT_SYMBOL(ieee80211_rx_mgt);
2774EXPORT_SYMBOL(ieee80211_rx); 2668EXPORT_SYMBOL(ieee80211_rx);
2775#else
2776EXPORT_SYMBOL_NOVERS(ieee80211_rx_mgt);
2777EXPORT_SYMBOL_NOVERS(ieee80211_rx);
2778#endif
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
index 1629b0f33f07..8a86e93465c8 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
@@ -503,34 +503,11 @@ out:
503} 503}
504} 504}
505 505
506#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
507/* called both by wq with ieee->lock held */
508void ieee80211_softmac_scan(struct ieee80211_device *ieee)
509{
510#if 0
511 short watchdog = 0;
512 do{
513 ieee->current_network.channel =
514 (ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
515 if (watchdog++ > MAX_CHANNEL_NUMBER)
516 return; /* no good chans */
517
518 }while(!ieee->channel_map[ieee->current_network.channel]);
519#endif
520
521 schedule_task(&ieee->softmac_scan_wq);
522}
523#endif
524 506
525#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
526void ieee80211_softmac_scan_wq(struct work_struct *work) 507void ieee80211_softmac_scan_wq(struct work_struct *work)
527{ 508{
528 struct delayed_work *dwork = container_of(work, struct delayed_work, work); 509 struct delayed_work *dwork = container_of(work, struct delayed_work, work);
529 struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq); 510 struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
530#else
531void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
532{
533#endif
534 static short watchdog = 0; 511 static short watchdog = 0;
535#ifdef ENABLE_DOT11D 512#ifdef ENABLE_DOT11D
536 u8 channel_map[MAX_CHANNEL_NUMBER+1]; 513 u8 channel_map[MAX_CHANNEL_NUMBER+1];
@@ -567,13 +544,7 @@ void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
567 ieee80211_send_probe_requests(ieee); 544 ieee80211_send_probe_requests(ieee);
568 545
569 546
570#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
571 queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME); 547 queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME);
572#else
573 //ieee->scan_timer.expires = jiffies + MSECS(IEEE80211_SOFTMAC_SCAN_TIME);
574 if (ieee->scanning == 1)
575 mod_timer(&ieee->scan_timer,(jiffies + MSECS(IEEE80211_SOFTMAC_SCAN_TIME)));
576#endif
577 548
578 up(&ieee->scan_sem); 549 up(&ieee->scan_sem);
579 return; 550 return;
@@ -588,17 +559,6 @@ out:
588 up(&ieee->scan_sem); 559 up(&ieee->scan_sem);
589} 560}
590 561
591#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
592void ieee80211_softmac_scan_cb(unsigned long _dev)
593{
594 unsigned long flags;
595 struct ieee80211_device *ieee = (struct ieee80211_device *)_dev;
596
597 spin_lock_irqsave(&ieee->lock, flags);
598 ieee80211_softmac_scan(ieee);
599 spin_unlock_irqrestore(&ieee->lock, flags);
600}
601#endif
602 562
603 563
604void ieee80211_beacons_start(struct ieee80211_device *ieee) 564void ieee80211_beacons_start(struct ieee80211_device *ieee)
@@ -656,11 +616,7 @@ void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee)
656 if (ieee->scanning == 1){ 616 if (ieee->scanning == 1){
657 ieee->scanning = 0; 617 ieee->scanning = 0;
658 618
659#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
660 cancel_delayed_work(&ieee->softmac_scan_wq); 619 cancel_delayed_work(&ieee->softmac_scan_wq);
661#else
662 del_timer_sync(&ieee->scan_timer);
663#endif
664 } 620 }
665 621
666// spin_unlock_irqrestore(&ieee->lock, flags); 622// spin_unlock_irqrestore(&ieee->lock, flags);
@@ -690,16 +646,7 @@ void ieee80211_start_scan(struct ieee80211_device *ieee)
690 if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){ 646 if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
691 if (ieee->scanning == 0){ 647 if (ieee->scanning == 0){
692 ieee->scanning = 1; 648 ieee->scanning = 1;
693#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
694#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
695 queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0); 649 queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
696#else
697
698 queue_work(ieee->wq, &ieee->softmac_scan_wq);
699#endif
700#else
701 ieee80211_softmac_scan(ieee);
702#endif
703 } 650 }
704 }else 651 }else
705 ieee->start_scan(ieee->dev); 652 ieee->start_scan(ieee->dev);
@@ -800,22 +747,10 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d
800 else 747 else
801 atim_len = 0; 748 atim_len = 0;
802 749
803#if 1
804 if(ieee80211_is_54g(ieee->current_network)) 750 if(ieee80211_is_54g(ieee->current_network))
805 erp_len = 3; 751 erp_len = 3;
806 else 752 else
807 erp_len = 0; 753 erp_len = 0;
808#else
809 if((ieee->current_network.mode == IEEE_G)
810 ||( ieee->current_network.mode == IEEE_N_24G && ieee->pHTInfo->bCurSuppCCK)) {
811 erp_len = 3;
812 erpinfo_content = 0;
813 if(ieee->current_network.buseprotection)
814 erpinfo_content |= ERP_UseProtection;
815 }
816 else
817 erp_len = 0;
818#endif
819 754
820 755
821 crypt = ieee->crypt[ieee->tx_keyidx]; 756 crypt = ieee->crypt[ieee->tx_keyidx];
@@ -824,7 +759,6 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d
824 encrypt = ieee->host_encrypt && crypt && crypt->ops && 759 encrypt = ieee->host_encrypt && crypt && crypt->ops &&
825 ((0 == strcmp(crypt->ops->name, "WEP") || wpa_ie_len)); 760 ((0 == strcmp(crypt->ops->name, "WEP") || wpa_ie_len));
826 //HT ralated element 761 //HT ralated element
827#if 1
828 tmp_ht_cap_buf =(u8*) &(ieee->pHTInfo->SelfHTCap); 762 tmp_ht_cap_buf =(u8*) &(ieee->pHTInfo->SelfHTCap);
829 tmp_ht_cap_len = sizeof(ieee->pHTInfo->SelfHTCap); 763 tmp_ht_cap_len = sizeof(ieee->pHTInfo->SelfHTCap);
830 tmp_ht_info_buf =(u8*) &(ieee->pHTInfo->SelfHTInfo); 764 tmp_ht_info_buf =(u8*) &(ieee->pHTInfo->SelfHTInfo);
@@ -840,7 +774,6 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d
840 HTConstructRT2RTAggElement(ieee, tmp_generic_ie_buf, &tmp_generic_ie_len); 774 HTConstructRT2RTAggElement(ieee, tmp_generic_ie_buf, &tmp_generic_ie_len);
841 } 775 }
842// printk("===============>tmp_ht_cap_len is %d,tmp_ht_info_len is %d, tmp_generic_ie_len is %d\n",tmp_ht_cap_len,tmp_ht_info_len,tmp_generic_ie_len); 776// printk("===============>tmp_ht_cap_len is %d,tmp_ht_info_len is %d, tmp_generic_ie_len is %d\n",tmp_ht_cap_len,tmp_ht_info_len,tmp_generic_ie_len);
843#endif
844 beacon_size = sizeof(struct ieee80211_probe_response)+2+ 777 beacon_size = sizeof(struct ieee80211_probe_response)+2+
845 ssid_len 778 ssid_len
846 +3 //channel 779 +3 //channel
@@ -875,10 +808,6 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d
875 cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT)); 808 cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
876 809
877 crypt = ieee->crypt[ieee->tx_keyidx]; 810 crypt = ieee->crypt[ieee->tx_keyidx];
878#if 0
879 encrypt = ieee->host_encrypt && crypt && crypt->ops &&
880 (0 == strcmp(crypt->ops->name, "WEP"));
881#endif
882 if (encrypt) 811 if (encrypt)
883 beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); 812 beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
884 813
@@ -917,14 +846,6 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d
917 *(tag++) = 1; 846 *(tag++) = 1;
918 *(tag++) = erpinfo_content; 847 *(tag++) = erpinfo_content;
919 } 848 }
920#if 0
921 //Include High Throuput capability
922
923 *(tag++) = MFIE_TYPE_HT_CAP;
924 *(tag++) = tmp_ht_cap_len - 2;
925 memcpy(tag, tmp_ht_cap_buf, tmp_ht_cap_len - 2);
926 tag += tmp_ht_cap_len - 2;
927#endif
928 if(rate_ex_len){ 849 if(rate_ex_len){
929 *(tag++) = MFIE_TYPE_RATES_EX; 850 *(tag++) = MFIE_TYPE_RATES_EX;
930 *(tag++) = rate_ex_len-2; 851 *(tag++) = rate_ex_len-2;
@@ -932,14 +853,6 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d
932 tag+=rate_ex_len-2; 853 tag+=rate_ex_len-2;
933 } 854 }
934 855
935#if 0
936 //Include High Throuput info
937
938 *(tag++) = MFIE_TYPE_HT_INFO;
939 *(tag++) = tmp_ht_info_len - 2;
940 memcpy(tag, tmp_ht_info_buf, tmp_ht_info_len -2);
941 tag += tmp_ht_info_len - 2;
942#endif
943 if (wpa_ie_len) 856 if (wpa_ie_len)
944 { 857 {
945 if (ieee->iw_mode == IW_MODE_ADHOC) 858 if (ieee->iw_mode == IW_MODE_ADHOC)
@@ -950,28 +863,6 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d
950 tag += wpa_ie_len; 863 tag += wpa_ie_len;
951 } 864 }
952 865
953#if 0
954 //
955 // Construct Realtek Proprietary Aggregation mode (Set AMPDU Factor to 2, 32k)
956 //
957 if(pHTInfo->bRegRT2RTAggregation)
958 {
959 (*tag++) = 0xdd;
960 (*tag++) = tmp_generic_ie_len - 2;
961 memcpy(tag,tmp_generic_ie_buf,tmp_generic_ie_len -2);
962 tag += tmp_generic_ie_len -2;
963
964 }
965#endif
966#if 0
967 if(ieee->qos_support)
968 {
969 (*tag++) = 0xdd;
970 (*tag++) = wmm_len;
971 memcpy(tag,QosOui,wmm_len);
972 tag += wmm_len;
973 }
974#endif
975 //skb->dev = ieee->dev; 866 //skb->dev = ieee->dev;
976 return skb; 867 return skb;
977} 868}
@@ -1380,12 +1271,8 @@ void ieee80211_associate_abort(struct ieee80211_device *ieee)
1380 1271
1381 ieee->state = IEEE80211_ASSOCIATING_RETRY; 1272 ieee->state = IEEE80211_ASSOCIATING_RETRY;
1382 1273
1383#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1384 queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, \ 1274 queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, \
1385 IEEE80211_SOFTMAC_ASSOC_RETRY_TIME); 1275 IEEE80211_SOFTMAC_ASSOC_RETRY_TIME);
1386#else
1387 schedule_task(&ieee->associate_retry_wq);
1388#endif
1389 1276
1390 spin_unlock_irqrestore(&ieee->lock, flags); 1277 spin_unlock_irqrestore(&ieee->lock, flags);
1391} 1278}
@@ -1447,10 +1334,6 @@ void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int
1447 1334
1448 softmac_mgmt_xmit(skb, ieee); 1335 softmac_mgmt_xmit(skb, ieee);
1449 mod_timer(&ieee->associate_timer, jiffies + (HZ/2)); 1336 mod_timer(&ieee->associate_timer, jiffies + (HZ/2));
1450#if 0
1451 ieee->associate_timer.expires = jiffies + (HZ / 2);
1452 add_timer(&ieee->associate_timer);
1453#endif
1454 //dev_kfree_skb_any(skb);//edit by thomas 1337 //dev_kfree_skb_any(skb);//edit by thomas
1455 } 1338 }
1456 kfree(challenge); 1339 kfree(challenge);
@@ -1472,21 +1355,12 @@ void ieee80211_associate_step2(struct ieee80211_device *ieee)
1472 else{ 1355 else{
1473 softmac_mgmt_xmit(skb, ieee); 1356 softmac_mgmt_xmit(skb, ieee);
1474 mod_timer(&ieee->associate_timer, jiffies + (HZ/2)); 1357 mod_timer(&ieee->associate_timer, jiffies + (HZ/2));
1475#if 0
1476 ieee->associate_timer.expires = jiffies + (HZ / 2);
1477 add_timer(&ieee->associate_timer);
1478#endif
1479 //dev_kfree_skb_any(skb);//edit by thomas 1358 //dev_kfree_skb_any(skb);//edit by thomas
1480 } 1359 }
1481} 1360}
1482#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
1483void ieee80211_associate_complete_wq(struct work_struct *work) 1361void ieee80211_associate_complete_wq(struct work_struct *work)
1484{ 1362{
1485 struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq); 1363 struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
1486#else
1487void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
1488{
1489#endif
1490 printk(KERN_INFO "Associated successfully\n"); 1364 printk(KERN_INFO "Associated successfully\n");
1491 if(ieee80211_is_54g(ieee->current_network) && 1365 if(ieee80211_is_54g(ieee->current_network) &&
1492 (ieee->modulation & IEEE80211_OFDM_MODULATION)){ 1366 (ieee->modulation & IEEE80211_OFDM_MODULATION)){
@@ -1537,41 +1411,14 @@ void ieee80211_associate_complete(struct ieee80211_device *ieee)
1537// struct net_device* dev = ieee->dev; 1411// struct net_device* dev = ieee->dev;
1538 del_timer_sync(&ieee->associate_timer); 1412 del_timer_sync(&ieee->associate_timer);
1539 1413
1540#if 0
1541 for(i = 0; i < 6; i++) {
1542 ieee->seq_ctrl[i] = 0;
1543 }
1544#endif
1545 ieee->state = IEEE80211_LINKED; 1414 ieee->state = IEEE80211_LINKED;
1546#if 0
1547 if (ieee->pHTInfo->bCurrentHTSupport)
1548 {
1549 printk("Successfully associated, ht enabled\n");
1550 queue_work(ieee->wq, &ieee->ht_onAssRsp);
1551 }
1552 else
1553 {
1554 printk("Successfully associated, ht not enabled\n");
1555 memset(ieee->dot11HTOperationalRateSet, 0, 16);
1556 HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
1557 }
1558#endif
1559 //ieee->UpdateHalRATRTableHandler(dev, ieee->dot11HTOperationalRateSet); 1415 //ieee->UpdateHalRATRTableHandler(dev, ieee->dot11HTOperationalRateSet);
1560#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1561 queue_work(ieee->wq, &ieee->associate_complete_wq); 1416 queue_work(ieee->wq, &ieee->associate_complete_wq);
1562#else
1563 schedule_task(&ieee->associate_complete_wq);
1564#endif
1565} 1417}
1566 1418
1567#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
1568void ieee80211_associate_procedure_wq(struct work_struct *work) 1419void ieee80211_associate_procedure_wq(struct work_struct *work)
1569{ 1420{
1570 struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq); 1421 struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
1571#else
1572void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee)
1573{
1574#endif
1575 ieee->sync_scan_hurryup = 1; 1422 ieee->sync_scan_hurryup = 1;
1576 down(&ieee->wx_sem); 1423 down(&ieee->wx_sem);
1577 1424
@@ -1669,11 +1516,7 @@ inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee
1669 } 1516 }
1670 1517
1671 ieee->state = IEEE80211_ASSOCIATING; 1518 ieee->state = IEEE80211_ASSOCIATING;
1672#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1673 queue_work(ieee->wq, &ieee->associate_procedure_wq); 1519 queue_work(ieee->wq, &ieee->associate_procedure_wq);
1674#else
1675 schedule_task(&ieee->associate_procedure_wq);
1676#endif
1677 }else{ 1520 }else{
1678 if(ieee80211_is_54g(ieee->current_network) && 1521 if(ieee80211_is_54g(ieee->current_network) &&
1679 (ieee->modulation & IEEE80211_OFDM_MODULATION)){ 1522 (ieee->modulation & IEEE80211_OFDM_MODULATION)){
@@ -1890,11 +1733,6 @@ ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
1890 1733
1891 printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest)); 1734 printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest));
1892 //FIXME 1735 //FIXME
1893 #if 0
1894 spin_lock_irqsave(&ieee->lock,flags);
1895 add_associate(ieee,dest);
1896 spin_unlock_irqrestore(&ieee->lock,flags);
1897 #endif
1898} 1736}
1899 1737
1900 1738
@@ -2179,11 +2017,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
2179 "Association response status code 0x%x\n", 2017 "Association response status code 0x%x\n",
2180 errcode); 2018 errcode);
2181 if(ieee->AsocRetryCount < RT_ASOC_RETRY_LIMIT) { 2019 if(ieee->AsocRetryCount < RT_ASOC_RETRY_LIMIT) {
2182#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2183 queue_work(ieee->wq, &ieee->associate_procedure_wq); 2020 queue_work(ieee->wq, &ieee->associate_procedure_wq);
2184#else
2185 schedule_task(&ieee->associate_procedure_wq);
2186#endif
2187 } else { 2021 } else {
2188 ieee80211_associate_abort(ieee); 2022 ieee80211_associate_abort(ieee);
2189 } 2023 }
@@ -2290,11 +2124,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
2290 notify_wx_assoc_event(ieee); 2124 notify_wx_assoc_event(ieee);
2291 //HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT); 2125 //HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
2292 RemovePeerTS(ieee, header->addr2); 2126 RemovePeerTS(ieee, header->addr2);
2293#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2294 queue_work(ieee->wq, &ieee->associate_procedure_wq); 2127 queue_work(ieee->wq, &ieee->associate_procedure_wq);
2295#else
2296 schedule_task(&ieee->associate_procedure_wq);
2297#endif
2298 } 2128 }
2299 break; 2129 break;
2300 case IEEE80211_STYPE_MANAGE_ACT: 2130 case IEEE80211_STYPE_MANAGE_ACT:
@@ -2347,7 +2177,6 @@ void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *
2347 if(tcb_desc->bMulticast) { 2177 if(tcb_desc->bMulticast) {
2348 ieee->stats.multicast++; 2178 ieee->stats.multicast++;
2349 } 2179 }
2350#if 1
2351 /* if xmit available, just xmit it immediately, else just insert it to the wait queue */ 2180 /* if xmit available, just xmit it immediately, else just insert it to the wait queue */
2352 for(i = 0; i < txb->nr_frags; i++) { 2181 for(i = 0; i < txb->nr_frags; i++) {
2353#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE 2182#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
@@ -2377,7 +2206,6 @@ void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *
2377 //ieee->dev->trans_start = jiffies; 2206 //ieee->dev->trans_start = jiffies;
2378 } 2207 }
2379 } 2208 }
2380#endif
2381 ieee80211_txb_free(txb); 2209 ieee80211_txb_free(txb);
2382 2210
2383//exit: 2211//exit:
@@ -2531,16 +2359,11 @@ void ieee80211_start_monitor_mode(struct ieee80211_device *ieee)
2531 netif_carrier_on(ieee->dev); 2359 netif_carrier_on(ieee->dev);
2532 } 2360 }
2533} 2361}
2534#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
2535void ieee80211_start_ibss_wq(struct work_struct *work) 2362void ieee80211_start_ibss_wq(struct work_struct *work)
2536{ 2363{
2537 2364
2538 struct delayed_work *dwork = container_of(work, struct delayed_work, work); 2365 struct delayed_work *dwork = container_of(work, struct delayed_work, work);
2539 struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, start_ibss_wq); 2366 struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, start_ibss_wq);
2540#else
2541void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
2542{
2543#endif
2544 /* iwconfig mode ad-hoc will schedule this and return 2367 /* iwconfig mode ad-hoc will schedule this and return
2545 * on the other hand this will block further iwconfig SET 2368 * on the other hand this will block further iwconfig SET
2546 * operations because of the wx_sem hold. 2369 * operations because of the wx_sem hold.
@@ -2650,11 +2473,7 @@ void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
2650 2473
2651inline void ieee80211_start_ibss(struct ieee80211_device *ieee) 2474inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
2652{ 2475{
2653#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2654 queue_delayed_work(ieee->wq, &ieee->start_ibss_wq, 150); 2476 queue_delayed_work(ieee->wq, &ieee->start_ibss_wq, 150);
2655#else
2656 schedule_task(&ieee->start_ibss_wq);
2657#endif
2658} 2477}
2659 2478
2660/* this is called only in user context, with wx_sem held */ 2479/* this is called only in user context, with wx_sem held */
@@ -2719,15 +2538,10 @@ void ieee80211_disassociate(struct ieee80211_device *ieee)
2719 notify_wx_assoc_event(ieee); 2538 notify_wx_assoc_event(ieee);
2720 2539
2721} 2540}
2722#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
2723void ieee80211_associate_retry_wq(struct work_struct *work) 2541void ieee80211_associate_retry_wq(struct work_struct *work)
2724{ 2542{
2725 struct delayed_work *dwork = container_of(work, struct delayed_work, work); 2543 struct delayed_work *dwork = container_of(work, struct delayed_work, work);
2726 struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq); 2544 struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
2727#else
2728void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
2729{
2730#endif
2731 unsigned long flags; 2545 unsigned long flags;
2732 2546
2733 down(&ieee->wx_sem); 2547 down(&ieee->wx_sem);
@@ -2822,10 +2636,8 @@ void ieee80211_stop_protocol(struct ieee80211_device *ieee)
2822 2636
2823 ieee80211_stop_send_beacons(ieee); 2637 ieee80211_stop_send_beacons(ieee);
2824 del_timer_sync(&ieee->associate_timer); 2638 del_timer_sync(&ieee->associate_timer);
2825#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2826 cancel_delayed_work(&ieee->associate_retry_wq); 2639 cancel_delayed_work(&ieee->associate_retry_wq);
2827 cancel_delayed_work(&ieee->start_ibss_wq); 2640 cancel_delayed_work(&ieee->start_ibss_wq);
2828#endif
2829 ieee80211_stop_scan(ieee); 2641 ieee80211_stop_scan(ieee);
2830 2642
2831 ieee80211_disassociate(ieee); 2643 ieee80211_disassociate(ieee);
@@ -2943,11 +2755,6 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee)
2943 ieee->sta_edca_param[3] = 0x002F3262; 2755 ieee->sta_edca_param[3] = 0x002F3262;
2944 ieee->aggregation = true; 2756 ieee->aggregation = true;
2945 ieee->enable_rx_imm_BA = 1; 2757 ieee->enable_rx_imm_BA = 1;
2946#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
2947 init_timer(&ieee->scan_timer);
2948 ieee->scan_timer.data = (unsigned long)ieee;
2949 ieee->scan_timer.function = ieee80211_softmac_scan_cb;
2950#endif
2951 ieee->tx_pending.txb = NULL; 2758 ieee->tx_pending.txb = NULL;
2952 2759
2953 init_timer(&ieee->associate_timer); 2760 init_timer(&ieee->associate_timer);
@@ -2958,16 +2765,12 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee)
2958 ieee->beacon_timer.data = (unsigned long) ieee; 2765 ieee->beacon_timer.data = (unsigned long) ieee;
2959 ieee->beacon_timer.function = ieee80211_send_beacon_cb; 2766 ieee->beacon_timer.function = ieee80211_send_beacon_cb;
2960 2767
2961#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2962#ifdef PF_SYNCTHREAD 2768#ifdef PF_SYNCTHREAD
2963 ieee->wq = create_workqueue(DRV_NAME,0); 2769 ieee->wq = create_workqueue(DRV_NAME,0);
2964#else 2770#else
2965 ieee->wq = create_workqueue(DRV_NAME); 2771 ieee->wq = create_workqueue(DRV_NAME);
2966#endif 2772#endif
2967#endif
2968 2773
2969#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2970#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
2971 INIT_DELAYED_WORK(&ieee->start_ibss_wq,ieee80211_start_ibss_wq); 2774 INIT_DELAYED_WORK(&ieee->start_ibss_wq,ieee80211_start_ibss_wq);
2972 INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq); 2775 INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq);
2973 INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq); 2776 INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq);
@@ -2975,23 +2778,7 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee)
2975 INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq); 2778 INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq);
2976 INIT_WORK(&ieee->wx_sync_scan_wq,ieee80211_wx_sync_scan_wq); 2779 INIT_WORK(&ieee->wx_sync_scan_wq,ieee80211_wx_sync_scan_wq);
2977 2780
2978#else
2979 INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
2980 INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
2981 INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
2982 INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
2983 INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
2984 INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
2985#endif
2986 2781
2987#else
2988 tq_init(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
2989 tq_init(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
2990 tq_init(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
2991 tq_init(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
2992 tq_init(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
2993 tq_init(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
2994#endif
2995 sema_init(&ieee->wx_sem, 1); 2782 sema_init(&ieee->wx_sem, 1);
2996 sema_init(&ieee->scan_sem, 1); 2783 sema_init(&ieee->scan_sem, 1);
2997 2784
@@ -3016,10 +2803,8 @@ void ieee80211_softmac_free(struct ieee80211_device *ieee)
3016#endif 2803#endif
3017 del_timer_sync(&ieee->associate_timer); 2804 del_timer_sync(&ieee->associate_timer);
3018 2805
3019#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
3020 cancel_delayed_work(&ieee->associate_retry_wq); 2806 cancel_delayed_work(&ieee->associate_retry_wq);
3021 destroy_workqueue(ieee->wq); 2807 destroy_workqueue(ieee->wq);
3022#endif
3023 2808
3024 up(&ieee->wx_sem); 2809 up(&ieee->wx_sem);
3025} 2810}
@@ -3296,11 +3081,7 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
3296 } 3081 }
3297 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); 3082 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
3298 new_crypt->ops = ops; 3083 new_crypt->ops = ops;
3299#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
3300 if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) 3084 if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
3301#else
3302 if (new_crypt->ops && try_inc_mod_count(new_crypt->ops->owner))
3303#endif
3304 new_crypt->priv = 3085 new_crypt->priv =
3305 new_crypt->ops->init(param->u.crypt.idx); 3086 new_crypt->ops->init(param->u.crypt.idx);
3306 3087
@@ -3483,7 +3264,6 @@ void notify_wx_assoc_event(struct ieee80211_device *ieee)
3483 wireless_send_event(ieee->dev, SIOCGIWAP, &wrqu, NULL); 3264 wireless_send_event(ieee->dev, SIOCGIWAP, &wrqu, NULL);
3484} 3265}
3485 3266
3486#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
3487EXPORT_SYMBOL(ieee80211_get_beacon); 3267EXPORT_SYMBOL(ieee80211_get_beacon);
3488EXPORT_SYMBOL(ieee80211_wake_queue); 3268EXPORT_SYMBOL(ieee80211_wake_queue);
3489EXPORT_SYMBOL(ieee80211_stop_queue); 3269EXPORT_SYMBOL(ieee80211_stop_queue);
@@ -3504,26 +3284,4 @@ EXPORT_SYMBOL(ieee80211_stop_scan);
3504EXPORT_SYMBOL(ieee80211_send_probe_requests); 3284EXPORT_SYMBOL(ieee80211_send_probe_requests);
3505EXPORT_SYMBOL(ieee80211_softmac_scan_syncro); 3285EXPORT_SYMBOL(ieee80211_softmac_scan_syncro);
3506EXPORT_SYMBOL(ieee80211_start_scan_syncro); 3286EXPORT_SYMBOL(ieee80211_start_scan_syncro);
3507#else
3508EXPORT_SYMBOL_NOVERS(ieee80211_get_beacon);
3509EXPORT_SYMBOL_NOVERS(ieee80211_wake_queue);
3510EXPORT_SYMBOL_NOVERS(ieee80211_stop_queue);
3511EXPORT_SYMBOL_NOVERS(ieee80211_reset_queue);
3512EXPORT_SYMBOL_NOVERS(ieee80211_softmac_stop_protocol);
3513EXPORT_SYMBOL_NOVERS(ieee80211_softmac_start_protocol);
3514EXPORT_SYMBOL_NOVERS(ieee80211_is_shortslot);
3515EXPORT_SYMBOL_NOVERS(ieee80211_is_54g);
3516EXPORT_SYMBOL_NOVERS(ieee80211_wpa_supplicant_ioctl);
3517EXPORT_SYMBOL_NOVERS(ieee80211_ps_tx_ack);
3518EXPORT_SYMBOL_NOVERS(ieee80211_softmac_xmit);
3519EXPORT_SYMBOL_NOVERS(ieee80211_stop_send_beacons);
3520EXPORT_SYMBOL_NOVERS(notify_wx_assoc_event);
3521EXPORT_SYMBOL_NOVERS(SendDisassociation);
3522EXPORT_SYMBOL_NOVERS(ieee80211_disassociate);
3523EXPORT_SYMBOL_NOVERS(ieee80211_start_send_beacons);
3524EXPORT_SYMBOL_NOVERS(ieee80211_stop_scan);
3525EXPORT_SYMBOL_NOVERS(ieee80211_send_probe_requests);
3526EXPORT_SYMBOL_NOVERS(ieee80211_softmac_scan_syncro);
3527EXPORT_SYMBOL_NOVERS(ieee80211_start_scan_syncro);
3528#endif
3529//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame); 3287//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame);
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
index d395fc65b704..f335c258ba84 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
@@ -234,23 +234,8 @@ int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
234 union iwreq_data *wrqu, char *extra) 234 union iwreq_data *wrqu, char *extra)
235{ 235{
236 u32 tmp_rate; 236 u32 tmp_rate;
237#if 0
238 printk("===>mode:%d, halfNmode:%d\n", ieee->mode, ieee->bHalfWirelessN24GMode);
239 if (ieee->mode & (IEEE_A | IEEE_B | IEEE_G))
240 tmp_rate = ieee->rate;
241 else if (ieee->mode & IEEE_N_5G)
242 tmp_rate = 580;
243 else if (ieee->mode & IEEE_N_24G)
244 {
245 if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))
246 tmp_rate = HTHalfMcsToDataRate(ieee, 15);
247 else
248 tmp_rate = HTMcsToDataRate(ieee, 15);
249 }
250#else
251 tmp_rate = TxCountToDataRate(ieee, ieee->softmac_stats.CurrentShowTxate); 237 tmp_rate = TxCountToDataRate(ieee, ieee->softmac_stats.CurrentShowTxate);
252 238
253#endif
254 wrqu->bitrate.value = tmp_rate * 500000; 239 wrqu->bitrate.value = tmp_rate * 500000;
255 240
256 return 0; 241 return 0;
@@ -313,14 +298,9 @@ out:
313 return 0; 298 return 0;
314} 299}
315 300
316#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
317void ieee80211_wx_sync_scan_wq(struct work_struct *work) 301void ieee80211_wx_sync_scan_wq(struct work_struct *work)
318{ 302{
319 struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq); 303 struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
320#else
321void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
322{
323#endif
324 short chan; 304 short chan;
325 HT_EXTCHNL_OFFSET chan_offset=0; 305 HT_EXTCHNL_OFFSET chan_offset=0;
326 HT_CHANNEL_WIDTH bandwidth=0; 306 HT_CHANNEL_WIDTH bandwidth=0;
@@ -392,11 +372,7 @@ int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info
392 } 372 }
393 373
394 if ( ieee->state == IEEE80211_LINKED){ 374 if ( ieee->state == IEEE80211_LINKED){
395#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
396 queue_work(ieee->wq, &ieee->wx_sync_scan_wq); 375 queue_work(ieee->wq, &ieee->wx_sync_scan_wq);
397#else
398 schedule_task(&ieee->wx_sync_scan_wq);
399#endif
400 /* intentionally forget to up sem */ 376 /* intentionally forget to up sem */
401 return 0; 377 return 0;
402 } 378 }
@@ -442,29 +418,8 @@ int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
442 if (wrqu->essid.flags && wrqu->essid.length) { 418 if (wrqu->essid.flags && wrqu->essid.length) {
443 //first flush current network.ssid 419 //first flush current network.ssid
444 len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE; 420 len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
445#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
446 strncpy(ieee->current_network.ssid, extra, len);
447 ieee->current_network.ssid_len = len;
448#if 0
449 {
450 int i;
451 for (i=0; i<len; i++)
452 printk("%c ", extra[i]);
453 printk("\n");
454 }
455#endif
456#else
457 strncpy(ieee->current_network.ssid, extra, len+1); 421 strncpy(ieee->current_network.ssid, extra, len+1);
458 ieee->current_network.ssid_len = len+1; 422 ieee->current_network.ssid_len = len+1;
459#if 0
460 {
461 int i;
462 for (i=0; i<len + 1; i++)
463 printk("%c ", extra[i]);
464 printk("\n");
465 }
466#endif
467#endif
468 ieee->ssid_set = 1; 423 ieee->ssid_set = 1;
469 } 424 }
470 else{ 425 else{
@@ -557,18 +512,6 @@ int ieee80211_wx_set_power(struct ieee80211_device *ieee,
557 union iwreq_data *wrqu, char *extra) 512 union iwreq_data *wrqu, char *extra)
558{ 513{
559 int ret = 0; 514 int ret = 0;
560#if 0
561 if(
562 (!ieee->sta_wake_up) ||
563 (!ieee->ps_request_tx_ack) ||
564 (!ieee->enter_sleep_state) ||
565 (!ieee->ps_is_queue_empty)){
566
567 // printk("ERROR. PS mode is tryied to be use but driver missed a callback\n\n");
568
569 return -1;
570 }
571#endif
572 down(&ieee->wx_sem); 515 down(&ieee->wx_sem);
573 516
574 if (wrqu->power.disabled){ 517 if (wrqu->power.disabled){
@@ -652,7 +595,6 @@ exit:
652 return ret; 595 return ret;
653 596
654} 597}
655#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
656EXPORT_SYMBOL(ieee80211_wx_get_essid); 598EXPORT_SYMBOL(ieee80211_wx_get_essid);
657EXPORT_SYMBOL(ieee80211_wx_set_essid); 599EXPORT_SYMBOL(ieee80211_wx_set_essid);
658EXPORT_SYMBOL(ieee80211_wx_set_rate); 600EXPORT_SYMBOL(ieee80211_wx_set_rate);
@@ -671,23 +613,3 @@ EXPORT_SYMBOL(ieee80211_wx_get_power);
671EXPORT_SYMBOL(ieee80211_wlan_frequencies); 613EXPORT_SYMBOL(ieee80211_wlan_frequencies);
672EXPORT_SYMBOL(ieee80211_wx_set_rts); 614EXPORT_SYMBOL(ieee80211_wx_set_rts);
673EXPORT_SYMBOL(ieee80211_wx_get_rts); 615EXPORT_SYMBOL(ieee80211_wx_get_rts);
674#else
675EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_essid);
676EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_essid);
677EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_rate);
678EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_rate);
679EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_wap);
680EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_wap);
681EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_mode);
682EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_mode);
683EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_scan);
684EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_freq);
685EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_freq);
686EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_rawtx);
687EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_name);
688EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_power);
689EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_power);
690EXPORT_SYMBOL_NOVERS(ieee80211_wlan_frequencies);
691EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_rts);
692EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_rts);
693#endif
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c
index b64e4cb0afe8..b29c36bac377 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c
@@ -235,11 +235,6 @@ void ieee80211_txb_free(struct ieee80211_txb *txb) {
235 //int i; 235 //int i;
236 if (unlikely(!txb)) 236 if (unlikely(!txb))
237 return; 237 return;
238#if 0
239 for (i = 0; i < txb->nr_frags; i++)
240 if (txb->fragments[i])
241 dev_kfree_skb_any(txb->fragments[i]);
242#endif
243 kfree(txb); 238 kfree(txb);
244} 239}
245 240
@@ -287,11 +282,7 @@ ieee80211_classify(struct sk_buff *skb, struct ieee80211_network *network)
287 return 0; 282 return 0;
288 283
289// IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len); 284// IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len);
290#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22))
291 ip = ip_hdr(skb); 285 ip = ip_hdr(skb);
292#else
293 ip = (struct iphdr*)(skb->data + sizeof(struct ether_header));
294#endif
295 switch (ip->tos & 0xfc) { 286 switch (ip->tos & 0xfc) {
296 case 0x20: 287 case 0x20:
297 return 2; 288 return 2;
@@ -334,12 +325,10 @@ void ieee80211_tx_query_agg_cap(struct ieee80211_device* ieee, struct sk_buff* s
334 if(!Adapter->HalFunc.GetNmodeSupportBySecCfgHandler(Adapter)) 325 if(!Adapter->HalFunc.GetNmodeSupportBySecCfgHandler(Adapter))
335 return; 326 return;
336#endif 327#endif
337#if 1
338 if(!ieee->GetNmodeSupportBySecCfg(ieee->dev)) 328 if(!ieee->GetNmodeSupportBySecCfg(ieee->dev))
339 { 329 {
340 return; 330 return;
341 } 331 }
342#endif
343 if(pHTInfo->bCurrentAMPDUEnable) 332 if(pHTInfo->bCurrentAMPDUEnable)
344 { 333 {
345 if (!GetTs(ieee, (PTS_COMMON_INFO*)(&pTxTs), hdr->addr1, skb->priority, TX_DIR, true)) 334 if (!GetTs(ieee, (PTS_COMMON_INFO*)(&pTxTs), hdr->addr1, skb->priority, TX_DIR, true))
@@ -602,11 +591,7 @@ void ieee80211_query_seqnum(struct ieee80211_device*ieee, struct sk_buff* skb, u
602 591
603int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) 592int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
604{ 593{
605#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
606 struct ieee80211_device *ieee = netdev_priv(dev); 594 struct ieee80211_device *ieee = netdev_priv(dev);
607#else
608 struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv;
609#endif
610 struct ieee80211_txb *txb = NULL; 595 struct ieee80211_txb *txb = NULL;
611 struct ieee80211_hdr_3addrqos *frag_hdr; 596 struct ieee80211_hdr_3addrqos *frag_hdr;
612 int i, bytes_per_frag, nr_frags, bytes_last_frag, frag_size; 597 int i, bytes_per_frag, nr_frags, bytes_last_frag, frag_size;
@@ -878,7 +863,6 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
878//WB add to fill data tcb_desc here. only first fragment is considered, need to change, and you may remove to other place. 863//WB add to fill data tcb_desc here. only first fragment is considered, need to change, and you may remove to other place.
879 if (txb) 864 if (txb)
880 { 865 {
881#if 1
882 cb_desc *tcb_desc = (cb_desc *)(txb->fragments[0]->cb + MAX_DEV_ADDR_SIZE); 866 cb_desc *tcb_desc = (cb_desc *)(txb->fragments[0]->cb + MAX_DEV_ADDR_SIZE);
883 tcb_desc->bTxEnableFwCalcDur = 1; 867 tcb_desc->bTxEnableFwCalcDur = 1;
884 if (is_multicast_ether_addr(header.addr1)) 868 if (is_multicast_ether_addr(header.addr1))
@@ -899,7 +883,6 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
899 ieee80211_query_seqnum(ieee, txb->fragments[0], header.addr1); 883 ieee80211_query_seqnum(ieee, txb->fragments[0], header.addr1);
900// IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, txb->fragments[0]->data, txb->fragments[0]->len); 884// IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, txb->fragments[0]->data, txb->fragments[0]->len);
901 //IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, tcb_desc, sizeof(cb_desc)); 885 //IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, tcb_desc, sizeof(cb_desc));
902#endif
903 } 886 }
904 spin_unlock_irqrestore(&ieee->lock, flags); 887 spin_unlock_irqrestore(&ieee->lock, flags);
905 dev_kfree_skb_any(skb); 888 dev_kfree_skb_any(skb);
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c
index 3b248cd3ce1b..d397f1d68eb7 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c
@@ -35,11 +35,6 @@
35#include <linux/module.h> 35#include <linux/module.h>
36 36
37#include "ieee80211.h" 37#include "ieee80211.h"
38#if 0
39static const char *ieee80211_modes[] = {
40 "?", "a", "b", "ab", "g", "ag", "bg", "abg"
41};
42#endif
43struct modes_unit { 38struct modes_unit {
44 char *mode_string; 39 char *mode_string;
45 int mode_size; 40 int mode_size;
@@ -53,25 +48,7 @@ struct modes_unit ieee80211_modes[] = {
53 {"N-5G",4}, 48 {"N-5G",4},
54}; 49};
55 50
56#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,20)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
57static inline char *
58iwe_stream_add_event_rsl(char * stream, /* Stream of events */
59 char * ends, /* End of stream */
60 struct iw_event *iwe, /* Payload */
61 int event_len) /* Real size of payload */
62{
63 /* Check if it's possible */
64 if((stream + event_len) < ends) {
65 iwe->len = event_len;
66 ndelay(1); //new
67 memcpy(stream, (char *) iwe, event_len);
68 stream += event_len;
69 }
70 return stream;
71}
72#else
73#define iwe_stream_add_event_rsl iwe_stream_add_event 51#define iwe_stream_add_event_rsl iwe_stream_add_event
74#endif
75 52
76#define MAX_CUSTOM_LEN 64 53#define MAX_CUSTOM_LEN 64
77static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, 54static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
@@ -92,11 +69,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
92 iwe.cmd = SIOCGIWAP; 69 iwe.cmd = SIOCGIWAP;
93 iwe.u.ap_addr.sa_family = ARPHRD_ETHER; 70 iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
94 memcpy(iwe.u.ap_addr.sa_data, network->bssid, ETH_ALEN); 71 memcpy(iwe.u.ap_addr.sa_data, network->bssid, ETH_ALEN);
95#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
96 start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_ADDR_LEN); 72 start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_ADDR_LEN);
97#else
98 start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_ADDR_LEN);
99#endif
100 /* Remaining entries will be displayed in the order we provide them */ 73 /* Remaining entries will be displayed in the order we provide them */
101 74
102 /* Add the ESSID */ 75 /* Add the ESSID */
@@ -105,18 +78,10 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
105// if (network->flags & NETWORK_EMPTY_ESSID) { 78// if (network->flags & NETWORK_EMPTY_ESSID) {
106 if (network->ssid_len == 0) { 79 if (network->ssid_len == 0) {
107 iwe.u.data.length = sizeof("<hidden>"); 80 iwe.u.data.length = sizeof("<hidden>");
108#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
109 start = iwe_stream_add_point(info, start, stop, &iwe, "<hidden>"); 81 start = iwe_stream_add_point(info, start, stop, &iwe, "<hidden>");
110#else
111 start = iwe_stream_add_point(start, stop, &iwe, "<hidden>");
112#endif
113 } else { 82 } else {
114 iwe.u.data.length = min(network->ssid_len, (u8)32); 83 iwe.u.data.length = min(network->ssid_len, (u8)32);
115#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
116 start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid); 84 start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid);
117#else
118 start = iwe_stream_add_point(start, stop, &iwe, network->ssid);
119#endif
120 } 85 }
121 /* Add the protocol name */ 86 /* Add the protocol name */
122 iwe.cmd = SIOCGIWNAME; 87 iwe.cmd = SIOCGIWNAME;
@@ -128,11 +93,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
128 } 93 }
129 *pname = '\0'; 94 *pname = '\0';
130 snprintf(iwe.u.name, IFNAMSIZ, "IEEE802.11%s", proto_name); 95 snprintf(iwe.u.name, IFNAMSIZ, "IEEE802.11%s", proto_name);
131#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
132 start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_CHAR_LEN); 96 start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_CHAR_LEN);
133#else
134 start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_CHAR_LEN);
135#endif
136 /* Add mode */ 97 /* Add mode */
137 iwe.cmd = SIOCGIWMODE; 98 iwe.cmd = SIOCGIWMODE;
138 if (network->capability & 99 if (network->capability &
@@ -141,11 +102,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
141 iwe.u.mode = IW_MODE_MASTER; 102 iwe.u.mode = IW_MODE_MASTER;
142 else 103 else
143 iwe.u.mode = IW_MODE_ADHOC; 104 iwe.u.mode = IW_MODE_ADHOC;
144#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
145 start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_UINT_LEN); 105 start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_UINT_LEN);
146#else
147 start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_UINT_LEN);
148#endif
149 } 106 }
150 107
151 /* Add frequency/channel */ 108 /* Add frequency/channel */
@@ -155,11 +112,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
155 iwe.u.freq.m = network->channel; 112 iwe.u.freq.m = network->channel;
156 iwe.u.freq.e = 0; 113 iwe.u.freq.e = 0;
157 iwe.u.freq.i = 0; 114 iwe.u.freq.i = 0;
158#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
159 start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_FREQ_LEN); 115 start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_FREQ_LEN);
160#else
161 start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_FREQ_LEN);
162#endif
163 /* Add encryption capability */ 116 /* Add encryption capability */
164 iwe.cmd = SIOCGIWENCODE; 117 iwe.cmd = SIOCGIWENCODE;
165 if (network->capability & WLAN_CAPABILITY_PRIVACY) 118 if (network->capability & WLAN_CAPABILITY_PRIVACY)
@@ -167,11 +120,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
167 else 120 else
168 iwe.u.data.flags = IW_ENCODE_DISABLED; 121 iwe.u.data.flags = IW_ENCODE_DISABLED;
169 iwe.u.data.length = 0; 122 iwe.u.data.length = 0;
170#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
171 start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid); 123 start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid);
172#else
173 start = iwe_stream_add_point(start, stop, &iwe, network->ssid);
174#endif
175 /* Add basic and extended rates */ 124 /* Add basic and extended rates */
176 max_rate = 0; 125 max_rate = 0;
177 p = custom; 126 p = custom;
@@ -215,33 +164,15 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
215 if (rate > max_rate) 164 if (rate > max_rate)
216 max_rate = rate; 165 max_rate = rate;
217 } 166 }
218#if 0
219 printk("max rate:%d ===basic rate:\n", max_rate);
220 for (i=0;i<network->rates_len;i++)
221 printk(" %x", network->rates[i]);
222 printk("\n=======extend rate\n");
223 for (i=0; i<network->rates_ex_len; i++)
224 printk(" %x", network->rates_ex[i]);
225 printk("\n");
226#endif
227 iwe.cmd = SIOCGIWRATE; 167 iwe.cmd = SIOCGIWRATE;
228 iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; 168 iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
229 iwe.u.bitrate.value = max_rate * 500000; 169 iwe.u.bitrate.value = max_rate * 500000;
230#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
231 start = iwe_stream_add_event_rsl(info, start, stop, &iwe, 170 start = iwe_stream_add_event_rsl(info, start, stop, &iwe,
232 IW_EV_PARAM_LEN); 171 IW_EV_PARAM_LEN);
233#else
234 start = iwe_stream_add_event_rsl(start, stop, &iwe,
235 IW_EV_PARAM_LEN);
236#endif
237 iwe.cmd = IWEVCUSTOM; 172 iwe.cmd = IWEVCUSTOM;
238 iwe.u.data.length = p - custom; 173 iwe.u.data.length = p - custom;
239 if (iwe.u.data.length) 174 if (iwe.u.data.length)
240#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
241 start = iwe_stream_add_point(info, start, stop, &iwe, custom); 175 start = iwe_stream_add_point(info, start, stop, &iwe, custom);
242#else
243 start = iwe_stream_add_point(start, stop, &iwe, custom);
244#endif
245 /* Add quality statistics */ 176 /* Add quality statistics */
246 /* TODO: Fix these values... */ 177 /* TODO: Fix these values... */
247 iwe.cmd = IWEVQUAL; 178 iwe.cmd = IWEVQUAL;
@@ -256,21 +187,13 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
256 if (!(network->stats.mask & IEEE80211_STATMASK_SIGNAL)) 187 if (!(network->stats.mask & IEEE80211_STATMASK_SIGNAL))
257 iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID; 188 iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID;
258 iwe.u.qual.updated = 7; 189 iwe.u.qual.updated = 7;
259#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
260 start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_QUAL_LEN); 190 start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_QUAL_LEN);
261#else
262 start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_QUAL_LEN);
263#endif
264 iwe.cmd = IWEVCUSTOM; 191 iwe.cmd = IWEVCUSTOM;
265 p = custom; 192 p = custom;
266 193
267 iwe.u.data.length = p - custom; 194 iwe.u.data.length = p - custom;
268 if (iwe.u.data.length) 195 if (iwe.u.data.length)
269#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
270 start = iwe_stream_add_point(info, start, stop, &iwe, custom); 196 start = iwe_stream_add_point(info, start, stop, &iwe, custom);
271#else
272 start = iwe_stream_add_point(start, stop, &iwe, custom);
273#endif
274#if (WIRELESS_EXT < 18) 197#if (WIRELESS_EXT < 18)
275 if (ieee->wpa_enabled && network->wpa_ie_len){ 198 if (ieee->wpa_enabled && network->wpa_ie_len){
276 char buf[MAX_WPA_IE_LEN * 2 + 30]; 199 char buf[MAX_WPA_IE_LEN * 2 + 30];
@@ -284,11 +207,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
284 memset(&iwe, 0, sizeof(iwe)); 207 memset(&iwe, 0, sizeof(iwe));
285 iwe.cmd = IWEVCUSTOM; 208 iwe.cmd = IWEVCUSTOM;
286 iwe.u.data.length = strlen(buf); 209 iwe.u.data.length = strlen(buf);
287#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
288 start = iwe_stream_add_point(info, start, stop, &iwe, buf); 210 start = iwe_stream_add_point(info, start, stop, &iwe, buf);
289#else
290 start = iwe_stream_add_point(start, stop, &iwe, buf);
291#endif
292 } 211 }
293 212
294 if (ieee->wpa_enabled && network->rsn_ie_len){ 213 if (ieee->wpa_enabled && network->rsn_ie_len){
@@ -303,11 +222,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
303 memset(&iwe, 0, sizeof(iwe)); 222 memset(&iwe, 0, sizeof(iwe));
304 iwe.cmd = IWEVCUSTOM; 223 iwe.cmd = IWEVCUSTOM;
305 iwe.u.data.length = strlen(buf); 224 iwe.u.data.length = strlen(buf);
306#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
307 start = iwe_stream_add_point(info, start, stop, &iwe, buf); 225 start = iwe_stream_add_point(info, start, stop, &iwe, buf);
308#else
309 start = iwe_stream_add_point(start, stop, &iwe, buf);
310#endif
311 } 226 }
312#else 227#else
313 memset(&iwe, 0, sizeof(iwe)); 228 memset(&iwe, 0, sizeof(iwe));
@@ -317,11 +232,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
317 memcpy(buf, network->wpa_ie, network->wpa_ie_len); 232 memcpy(buf, network->wpa_ie, network->wpa_ie_len);
318 iwe.cmd = IWEVGENIE; 233 iwe.cmd = IWEVGENIE;
319 iwe.u.data.length = network->wpa_ie_len; 234 iwe.u.data.length = network->wpa_ie_len;
320#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
321 start = iwe_stream_add_point(info, start, stop, &iwe, buf); 235 start = iwe_stream_add_point(info, start, stop, &iwe, buf);
322#else
323 start = iwe_stream_add_point(start, stop, &iwe, buf);
324#endif
325 } 236 }
326 memset(&iwe, 0, sizeof(iwe)); 237 memset(&iwe, 0, sizeof(iwe));
327 if (network->rsn_ie_len) 238 if (network->rsn_ie_len)
@@ -330,11 +241,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
330 memcpy(buf, network->rsn_ie, network->rsn_ie_len); 241 memcpy(buf, network->rsn_ie, network->rsn_ie_len);
331 iwe.cmd = IWEVGENIE; 242 iwe.cmd = IWEVGENIE;
332 iwe.u.data.length = network->rsn_ie_len; 243 iwe.u.data.length = network->rsn_ie_len;
333#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
334 start = iwe_stream_add_point(info, start, stop, &iwe, buf); 244 start = iwe_stream_add_point(info, start, stop, &iwe, buf);
335#else
336 start = iwe_stream_add_point(start, stop, &iwe, buf);
337#endif
338 } 245 }
339#endif 246#endif
340 247
@@ -347,11 +254,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
347 " Last beacon: %lums ago", (jiffies - network->last_scanned) / (HZ / 100)); 254 " Last beacon: %lums ago", (jiffies - network->last_scanned) / (HZ / 100));
348 iwe.u.data.length = p - custom; 255 iwe.u.data.length = p - custom;
349 if (iwe.u.data.length) 256 if (iwe.u.data.length)
350#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
351 start = iwe_stream_add_point(info, start, stop, &iwe, custom); 257 start = iwe_stream_add_point(info, start, stop, &iwe, custom);
352#else
353 start = iwe_stream_add_point(start, stop, &iwe, custom);
354#endif
355 258
356 return start; 259 return start;
357} 260}
@@ -486,11 +389,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
486 request_module("ieee80211_crypt_wep"); 389 request_module("ieee80211_crypt_wep");
487 new_crypt->ops = ieee80211_get_crypto_ops("WEP"); 390 new_crypt->ops = ieee80211_get_crypto_ops("WEP");
488 } 391 }
489#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
490 if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) 392 if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
491#else
492 if (new_crypt->ops && try_inc_mod_count(new_crypt->ops->owner))
493#endif
494 new_crypt->priv = new_crypt->ops->init(key); 393 new_crypt->priv = new_crypt->ops->init(key);
495 394
496 if (!new_crypt->ops || !new_crypt->priv) { 395 if (!new_crypt->ops || !new_crypt->priv) {
@@ -611,15 +510,6 @@ int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
611 erq->flags |= IW_ENCODE_DISABLED; 510 erq->flags |= IW_ENCODE_DISABLED;
612 return 0; 511 return 0;
613 } 512 }
614#if 0
615 if (strcmp(crypt->ops->name, "WEP") != 0) {
616 /* only WEP is supported with wireless extensions, so just
617 * report that encryption is used */
618 erq->length = 0;
619 erq->flags |= IW_ENCODE_ENABLED;
620 return 0;
621 }
622#endif
623 len = crypt->ops->get_key(keybuf, SCM_KEY_LEN, NULL, crypt->priv); 513 len = crypt->ops->get_key(keybuf, SCM_KEY_LEN, NULL, crypt->priv);
624 erq->length = (len >= 0 ? len : 0); 514 erq->length = (len >= 0 ? len : 0);
625 515
@@ -638,7 +528,6 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
638 union iwreq_data *wrqu, char *extra) 528 union iwreq_data *wrqu, char *extra)
639{ 529{
640 int ret = 0; 530 int ret = 0;
641#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
642 struct net_device *dev = ieee->dev; 531 struct net_device *dev = ieee->dev;
643 struct iw_point *encoding = &wrqu->encoding; 532 struct iw_point *encoding = &wrqu->encoding;
644 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; 533 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
@@ -702,12 +591,6 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
702 591
703 sec.enabled = 1; 592 sec.enabled = 1;
704 // sec.encrypt = 1; 593 // sec.encrypt = 1;
705#if 0
706 if (group_key ? !ieee->host_mc_decrypt :
707 !(ieee->host_encrypt || ieee->host_decrypt ||
708 ieee->host_encrypt_msdu))
709 goto skip_host_crypt;
710#endif
711 switch (ext->alg) { 594 switch (ext->alg) {
712 case IW_ENCODE_ALG_WEP: 595 case IW_ENCODE_ALG_WEP:
713 alg = "WEP"; 596 alg = "WEP";
@@ -747,12 +630,7 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
747 630
748 ieee80211_crypt_delayed_deinit(ieee, crypt); 631 ieee80211_crypt_delayed_deinit(ieee, crypt);
749 632
750#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13))
751 new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL); 633 new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL);
752#else
753 new_crypt = kmalloc(sizeof(*new_crypt), GFP_KERNEL);
754 memset(new_crypt,0,sizeof(*new_crypt));
755#endif
756 if (new_crypt == NULL) { 634 if (new_crypt == NULL) {
757 ret = -ENOMEM; 635 ret = -ENOMEM;
758 goto done; 636 goto done;
@@ -777,7 +655,6 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
777 ret = -EINVAL; 655 ret = -EINVAL;
778 goto done; 656 goto done;
779 } 657 }
780#if 1
781 //skip_host_crypt: 658 //skip_host_crypt:
782 //printk("skip_host_crypt:ext_flags:%x\n", ext->ext_flags); 659 //printk("skip_host_crypt:ext_flags:%x\n", ext->ext_flags);
783 if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { 660 if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
@@ -807,7 +684,6 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
807 if (group_key) 684 if (group_key)
808 sec.flags &= ~SEC_LEVEL; 685 sec.flags &= ~SEC_LEVEL;
809 } 686 }
810#endif
811done: 687done:
812 if (ieee->set_security) 688 if (ieee->set_security)
813 ieee->set_security(ieee->dev, &sec); 689 ieee->set_security(ieee->dev, &sec);
@@ -818,7 +694,6 @@ done:
818 IEEE80211_DEBUG_WX("%s: reset_port failed\n", dev->name); 694 IEEE80211_DEBUG_WX("%s: reset_port failed\n", dev->name);
819 return -EINVAL; 695 return -EINVAL;
820 } 696 }
821#endif
822 return ret; 697 return ret;
823} 698}
824 699
@@ -881,7 +756,6 @@ int ieee80211_wx_set_mlme(struct ieee80211_device *ieee,
881 struct iw_request_info *info, 756 struct iw_request_info *info,
882 union iwreq_data *wrqu, char *extra) 757 union iwreq_data *wrqu, char *extra)
883{ 758{
884#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
885 struct iw_mlme *mlme = (struct iw_mlme *) extra; 759 struct iw_mlme *mlme = (struct iw_mlme *) extra;
886 switch (mlme->cmd) { 760 switch (mlme->cmd) {
887 case IW_MLME_DEAUTH: 761 case IW_MLME_DEAUTH:
@@ -891,7 +765,6 @@ int ieee80211_wx_set_mlme(struct ieee80211_device *ieee,
891 default: 765 default:
892 return -EOPNOTSUPP; 766 return -EOPNOTSUPP;
893 } 767 }
894#endif
895 return 0; 768 return 0;
896} 769}
897 770
@@ -899,7 +772,6 @@ int ieee80211_wx_set_auth(struct ieee80211_device *ieee,
899 struct iw_request_info *info, 772 struct iw_request_info *info,
900 struct iw_param *data, char *extra) 773 struct iw_param *data, char *extra)
901{ 774{
902#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
903 switch (data->flags & IW_AUTH_INDEX) { 775 switch (data->flags & IW_AUTH_INDEX) {
904 case IW_AUTH_WPA_VERSION: 776 case IW_AUTH_WPA_VERSION:
905 /*need to support wpa2 here*/ 777 /*need to support wpa2 here*/
@@ -941,13 +813,11 @@ int ieee80211_wx_set_auth(struct ieee80211_device *ieee,
941 //printk("open_wep:%d\n", ieee->open_wep); 813 //printk("open_wep:%d\n", ieee->open_wep);
942 break; 814 break;
943 815
944#if 1
945 case IW_AUTH_WPA_ENABLED: 816 case IW_AUTH_WPA_ENABLED:
946 ieee->wpa_enabled = (data->value)?1:0; 817 ieee->wpa_enabled = (data->value)?1:0;
947 //printk("enalbe wpa:%d\n", ieee->wpa_enabled); 818 //printk("enalbe wpa:%d\n", ieee->wpa_enabled);
948 break; 819 break;
949 820
950#endif
951 case IW_AUTH_RX_UNENCRYPTED_EAPOL: 821 case IW_AUTH_RX_UNENCRYPTED_EAPOL:
952 ieee->ieee802_1x = data->value; 822 ieee->ieee802_1x = data->value;
953 break; 823 break;
@@ -957,23 +827,11 @@ int ieee80211_wx_set_auth(struct ieee80211_device *ieee,
957 default: 827 default:
958 return -EOPNOTSUPP; 828 return -EOPNOTSUPP;
959 } 829 }
960#endif
961 return 0; 830 return 0;
962} 831}
963#endif 832#endif
964#if 1
965int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len) 833int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len)
966{ 834{
967#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
968#if 0
969 printk("====>%s()\n", __FUNCTION__);
970 {
971 int i;
972 for (i=0; i<len; i++)
973 printk("%2x ", ie[i]&0xff);
974 printk("\n");
975 }
976#endif
977 u8 *buf; 835 u8 *buf;
978 836
979 if (len>MAX_WPA_IE_LEN || (len && ie == NULL)) 837 if (len>MAX_WPA_IE_LEN || (len && ie == NULL))
@@ -1004,13 +862,10 @@ int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len)
1004 ieee->wpa_ie = NULL; 862 ieee->wpa_ie = NULL;
1005 ieee->wpa_ie_len = 0; 863 ieee->wpa_ie_len = 0;
1006 } 864 }
1007#endif
1008 return 0; 865 return 0;
1009 866
1010} 867}
1011#endif
1012 868
1013#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
1014EXPORT_SYMBOL(ieee80211_wx_set_gen_ie); 869EXPORT_SYMBOL(ieee80211_wx_set_gen_ie);
1015#if (WIRELESS_EXT >= 18) 870#if (WIRELESS_EXT >= 18)
1016EXPORT_SYMBOL(ieee80211_wx_set_mlme); 871EXPORT_SYMBOL(ieee80211_wx_set_mlme);
@@ -1021,12 +876,3 @@ EXPORT_SYMBOL(ieee80211_wx_get_encode_ext);
1021EXPORT_SYMBOL(ieee80211_wx_get_scan); 876EXPORT_SYMBOL(ieee80211_wx_get_scan);
1022EXPORT_SYMBOL(ieee80211_wx_set_encode); 877EXPORT_SYMBOL(ieee80211_wx_set_encode);
1023EXPORT_SYMBOL(ieee80211_wx_get_encode); 878EXPORT_SYMBOL(ieee80211_wx_get_encode);
1024#else
1025EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_gen_ie);
1026//EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_mlme);
1027//EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_auth);
1028//EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_encode_ext);
1029EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_scan);
1030EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_encode);
1031EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_encode);
1032#endif
diff --git a/drivers/staging/rtl8192u/ieee80211/internal.h b/drivers/staging/rtl8192u/ieee80211/internal.h
index ddc22350d006..a7c096eb269f 100644
--- a/drivers/staging/rtl8192u/ieee80211/internal.h
+++ b/drivers/staging/rtl8192u/ieee80211/internal.h
@@ -22,22 +22,6 @@
22#include <asm/softirq.h> 22#include <asm/softirq.h>
23#include <asm/kmap_types.h> 23#include <asm/kmap_types.h>
24 24
25#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20))
26#define list_for_each_entry(pos, head, member) \
27 for (pos = list_entry((head)->next, typeof(*pos), member), \
28 prefetch(pos->member.next); \
29 &pos->member != (head); \
30 pos = list_entry(pos->member.next, typeof(*pos), member), \
31 prefetch(pos->member.next))
32
33static inline void cond_resched(void)
34{
35 if (need_resched()) {
36 set_current_state(TASK_RUNNING);
37 schedule();
38 }
39}
40#endif
41 25
42extern enum km_type crypto_km_types[]; 26extern enum km_type crypto_km_types[];
43 27
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
index 98b3bb6b6d69..26af43bb8390 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
@@ -174,48 +174,6 @@ static struct sk_buff* ieee80211_ADDBA(struct ieee80211_device* ieee, u8* Dst, P
174 //return NULL; 174 //return NULL;
175} 175}
176 176
177#if 0 //I try to merge ADDBA_REQ and ADDBA_RSP frames together..
178/********************************************************************************************************************
179 *function: construct ADDBAREQ frame
180 * input: u8* dst //ADDBARsp frame's destination
181 * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA_RSP.
182 * u16 StatusCode //status code.
183 * output: none
184 * return: sk_buff* skb //return constructed skb to xmit
185********************************************************************************************************************/
186static struct sk_buff* ieee80211_ADDBA_Rsp( IN struct ieee80211_device* ieee, u8* dst, PBA_RECORD pBA, u16 StatusCode)
187{
188 OCTET_STRING osADDBAFrame, tmp;
189
190 FillOctetString(osADDBAFrame, Buffer, 0);
191 *pLength = 0;
192
193 ConstructMaFrameHdr(
194 Adapter,
195 Addr,
196 ACT_CAT_BA,
197 ACT_ADDBARSP,
198 &osADDBAFrame );
199
200 // Dialog Token
201 FillOctetString(tmp, &pBA->DialogToken, 1);
202 PacketAppendData(&osADDBAFrame, tmp);
203
204 // Status Code
205 FillOctetString(tmp, &StatusCode, 2);
206 PacketAppendData(&osADDBAFrame, tmp);
207
208 // BA Parameter Set
209 FillOctetString(tmp, &pBA->BaParamSet, 2);
210 PacketAppendData(&osADDBAFrame, tmp);
211
212 // BA Timeout Value
213 FillOctetString(tmp, &pBA->BaTimeoutValue, 2);
214 PacketAppendData(&osADDBAFrame, tmp);
215
216 *pLength = osADDBAFrame.Length;
217}
218#endif
219 177
220/******************************************************************************************************************** 178/********************************************************************************************************************
221 *function: construct DELBA frame 179 *function: construct DELBA frame
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 7c0e489b6c71..2c4eb38c89a8 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -348,11 +348,6 @@ bool IsHTHalfNmodeAPs(struct ieee80211_device* ieee)
348{ 348{
349 bool retValue = false; 349 bool retValue = false;
350 struct ieee80211_network* net = &ieee->current_network; 350 struct ieee80211_network* net = &ieee->current_network;
351#if 0
352 if(pMgntInfo->bHalfNMode == false)
353 retValue = false;
354 else
355#endif
356 if((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3)==0) || 351 if((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3)==0) ||
357 (memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3)==0) || 352 (memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3)==0) ||
358 (memcmp(net->bssid, PCI_RALINK, 3)==0) || 353 (memcmp(net->bssid, PCI_RALINK, 3)==0) ||
@@ -421,24 +416,6 @@ void HTIOTPeerDetermine(struct ieee80211_device* ieee)
421u8 HTIOTActIsDisableMCS14(struct ieee80211_device* ieee, u8* PeerMacAddr) 416u8 HTIOTActIsDisableMCS14(struct ieee80211_device* ieee, u8* PeerMacAddr)
422{ 417{
423 u8 ret = 0; 418 u8 ret = 0;
424#if 0
425 // Apply for 819u only
426#if (HAL_CODE_BASE==RTL8192 && DEV_BUS_TYPE==USB_INTERFACE)
427 if((memcmp(PeerMacAddr, UNKNOWN_BORADCOM, 3)==0) ||
428 (memcmp(PeerMacAddr, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0)
429 )
430 {
431 ret = 1;
432 }
433
434
435 if(pHTInfo->bCurrentRT2RTAggregation)
436 {
437 // The parameter of pHTInfo->bCurrentRT2RTAggregation must be decided previously
438 ret = 1;
439 }
440#endif
441#endif
442 return ret; 419 return ret;
443 } 420 }
444 421
@@ -498,21 +475,6 @@ bool HTIOTActIsDisableMCSTwoSpatialStream(struct ieee80211_device* ieee, u8 *Pee
498 475
499#ifdef TODO 476#ifdef TODO
500 // Apply for 819u only 477 // Apply for 819u only
501//#if (HAL_CODE_BASE==RTL8192)
502
503 //This rule only apply to Belkin(Ralink) AP
504 if(IS_UNDER_11N_AES_MODE(Adapter))
505 {
506 if((PlatformCompareMemory(PeerMacAddr, BELKINF5D8233V1_RALINK, 3)==0) ||
507 (PlatformCompareMemory(PeerMacAddr, PCI_RALINK, 3)==0) ||
508 (PlatformCompareMemory(PeerMacAddr, EDIMAX_RALINK, 3)==0))
509 {
510 //Set True to disable this function. Disable by default, Emily, 2008.04.23
511 retValue = false;
512 }
513 }
514
515//#endif
516#endif 478#endif
517 return retValue; 479 return retValue;
518} 480}
@@ -530,18 +492,6 @@ u8 HTIOTActIsDisableEDCATurbo(struct ieee80211_device* ieee, u8* PeerMacAddr)
530 // Set specific EDCA parameter for different AP in DM handler. 492 // Set specific EDCA parameter for different AP in DM handler.
531 493
532 return retValue; 494 return retValue;
533#if 0
534 if((memcmp(PeerMacAddr, UNKNOWN_BORADCOM, 3)==0)||
535 (memcmp(PeerMacAddr, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0)||
536 (memcmp(PeerMacAddr, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3)==0)||
537 (memcmp(PeerMacAddr, NETGEAR834Bv2_BROADCOM, 3)==0))
538
539 {
540 retValue = 1; //Linksys disable EDCA turbo mode
541 }
542
543 return retValue;
544#endif
545} 495}
546 496
547/******************************************************************************************************************** 497/********************************************************************************************************************
@@ -809,7 +759,7 @@ void HTConstructRT2RTAggElement(struct ieee80211_device* ieee, u8* posRT2RTAgg,
809 *len = 6 + 2; 759 *len = 6 + 2;
810 return; 760 return;
811#ifdef TODO 761#ifdef TODO
812#if(HAL_CODE_BASE == RTL8192 && DEV_BUS_TYPE == USB_INTERFACE) 762#if (HAL_CODE_BASE == RTL8192 && DEV_BUS_TYPE == USB_INTERFACE)
813 /* 763 /*
814 //Emily. If it is required to Ask Realtek AP to send AMPDU during AES mode, enable this 764 //Emily. If it is required to Ask Realtek AP to send AMPDU during AES mode, enable this
815 section of code. 765 section of code.
@@ -988,17 +938,6 @@ u8 HTFilterMCSRate( struct ieee80211_device* ieee, u8* pSupportMCS, u8* pOperate
988 return true; 938 return true;
989} 939}
990void HTSetConnectBwMode(struct ieee80211_device* ieee, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset); 940void HTSetConnectBwMode(struct ieee80211_device* ieee, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset);
991#if 0
992//I need move this function to other places, such as rx?
993#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
994void HTOnAssocRsp_wq(struct work_struct *work)
995{
996 struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, ht_onAssRsp);
997#else
998void HTOnAssocRsp_wq(struct ieee80211_device *ieee)
999{
1000#endif
1001#endif
1002void HTOnAssocRsp(struct ieee80211_device *ieee) 941void HTOnAssocRsp(struct ieee80211_device *ieee)
1003{ 942{
1004 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; 943 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
@@ -1100,10 +1039,6 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
1100 { 1039 {
1101 // Set MPDU density to 2 to Realtek AP, and set it to 0 for others 1040 // Set MPDU density to 2 to Realtek AP, and set it to 0 for others
1102 // Replace MPDU factor declared in original association response frame format. 2007.08.20 by Emily 1041 // Replace MPDU factor declared in original association response frame format. 2007.08.20 by Emily
1103#if 0
1104 osTmp= PacketGetElement( asocpdu, EID_Vendor, OUI_SUB_REALTEK_AGG, OUI_SUBTYPE_DONT_CARE);
1105 if(osTmp.Length >= 5) //00:e0:4c:02:00
1106#endif
1107 if (ieee->current_network.bssht.bdRT2RTAggregation) 1042 if (ieee->current_network.bssht.bdRT2RTAggregation)
1108 { 1043 {
1109 if( ieee->pairwise_key_type != KEY_TYPE_NA) 1044 if( ieee->pairwise_key_type != KEY_TYPE_NA)
@@ -1122,19 +1057,12 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
1122 1057
1123 // <2> Set AMPDU Minimum MPDU Start Spacing 1058 // <2> Set AMPDU Minimum MPDU Start Spacing
1124 // 802.11n 3.0 section 9.7d.3 1059 // 802.11n 3.0 section 9.7d.3
1125#if 1
1126 if(pHTInfo->MPDU_Density > pPeerHTCap->MPDUDensity) 1060 if(pHTInfo->MPDU_Density > pPeerHTCap->MPDUDensity)
1127 pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density; 1061 pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density;
1128 else 1062 else
1129 pHTInfo->CurrentMPDUDensity = pPeerHTCap->MPDUDensity; 1063 pHTInfo->CurrentMPDUDensity = pPeerHTCap->MPDUDensity;
1130 if(ieee->pairwise_key_type != KEY_TYPE_NA ) 1064 if(ieee->pairwise_key_type != KEY_TYPE_NA )
1131 pHTInfo->CurrentMPDUDensity = 7; // 8us 1065 pHTInfo->CurrentMPDUDensity = 7; // 8us
1132#else
1133 if(pHTInfo->MPDU_Density > pPeerHTCap->MPDUDensity)
1134 pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density;
1135 else
1136 pHTInfo->CurrentMPDUDensity = pPeerHTCap->MPDUDensity;
1137#endif
1138 // Force TX AMSDU 1066 // Force TX AMSDU
1139 1067
1140 // Lanhsin: mark for tmp to avoid deauth by ap from s3 1068 // Lanhsin: mark for tmp to avoid deauth by ap from s3
@@ -1278,187 +1206,6 @@ void HTInitializeBssDesc(PBSS_HT pBssHT)
1278 pBssHT->bdRT2RTAggregation = false; 1206 pBssHT->bdRT2RTAggregation = false;
1279 pBssHT->bdRT2RTLongSlotTime = false; 1207 pBssHT->bdRT2RTLongSlotTime = false;
1280} 1208}
1281#if 0
1282//below function has merged into ieee80211_network_init() in ieee80211_rx.c
1283void
1284HTParsingHTCapElement(
1285 IN PADAPTER Adapter,
1286 IN OCTET_STRING HTCapIE,
1287 OUT PRT_WLAN_BSS pBssDesc
1288)
1289{
1290 PMGNT_INFO pMgntInfo = &Adapter->MgntInfo;
1291
1292 if( HTCapIE.Length > sizeof(pBssDesc->BssHT.bdHTCapBuf) )
1293 {
1294 RT_TRACE( COMP_HT, DBG_LOUD, ("HTParsingHTCapElement(): HT Capability Element length is too long!\n") );
1295 return;
1296 }
1297
1298 // TODO: Check the correctness of HT Cap
1299 //Print each field in detail. Driver should not print out this message by default
1300 if(!pMgntInfo->mActingAsAp && !pMgntInfo->mAssoc)
1301 HTDebugHTCapability(DBG_TRACE, Adapter, &HTCapIE, (pu8)"HTParsingHTCapElement()");
1302
1303 HTCapIE.Length = HTCapIE.Length > sizeof(pBssDesc->BssHT.bdHTCapBuf)?\
1304 sizeof(pBssDesc->BssHT.bdHTCapBuf):HTCapIE.Length; //prevent from overflow
1305
1306 CopyMem(pBssDesc->BssHT.bdHTCapBuf, HTCapIE.Octet, HTCapIE.Length);
1307 pBssDesc->BssHT.bdHTCapLen = HTCapIE.Length;
1308
1309}
1310
1311
1312void
1313HTParsingHTInfoElement(
1314 PADAPTER Adapter,
1315 OCTET_STRING HTInfoIE,
1316 PRT_WLAN_BSS pBssDesc
1317)
1318{
1319 PMGNT_INFO pMgntInfo = &Adapter->MgntInfo;
1320
1321 if( HTInfoIE.Length > sizeof(pBssDesc->BssHT.bdHTInfoBuf))
1322 {
1323 RT_TRACE( COMP_HT, DBG_LOUD, ("HTParsingHTInfoElement(): HT Information Element length is too long!\n") );
1324 return;
1325 }
1326
1327 // TODO: Check the correctness of HT Info
1328 //Print each field in detail. Driver should not print out this message by default
1329 if(!pMgntInfo->mActingAsAp && !pMgntInfo->mAssoc)
1330 HTDebugHTInfo(DBG_TRACE, Adapter, &HTInfoIE, (pu8)"HTParsingHTInfoElement()");
1331
1332 HTInfoIE.Length = HTInfoIE.Length > sizeof(pBssDesc->BssHT.bdHTInfoBuf)?\
1333 sizeof(pBssDesc->BssHT.bdHTInfoBuf):HTInfoIE.Length; //prevent from overflow
1334
1335 CopyMem( pBssDesc->BssHT.bdHTInfoBuf, HTInfoIE.Octet, HTInfoIE.Length);
1336 pBssDesc->BssHT.bdHTInfoLen = HTInfoIE.Length;
1337}
1338
1339/*
1340 * Get HT related information from beacon and save it in BssDesc
1341 *
1342 * (1) Parse HTCap, and HTInfo, and record whether it is 11n AP
1343 * (2) If peer is HT, but not WMM, call QosSetLegacyWMMParamWithHT()
1344 * (3) Check whether peer is Realtek AP (for Realtek proprietary aggregation mode).
1345 * Input:
1346 * PADAPTER Adapter
1347 *
1348 * Output:
1349 * PRT_TCB BssDesc
1350 *
1351*/
1352void HTGetValueFromBeaconOrProbeRsp(
1353 PADAPTER Adapter,
1354 POCTET_STRING pSRCmmpdu,
1355 PRT_WLAN_BSS bssDesc
1356)
1357{
1358 PMGNT_INFO pMgntInfo = &Adapter->MgntInfo;
1359 PRT_HIGH_THROUGHPUT pHTInfo = GET_HT_INFO(pMgntInfo);
1360 OCTET_STRING HTCapIE, HTInfoIE, HTRealtekAgg, mmpdu;
1361 OCTET_STRING BroadcomElement, CiscoElement;
1362
1363 mmpdu.Octet = pSRCmmpdu->Octet;
1364 mmpdu.Length = pSRCmmpdu->Length;
1365
1366 //2Note:
1367 // Mark for IOT testing using Linksys WRT350N, This AP does not contain WMM IE when
1368 // it is configured at pure-N mode.
1369 // if(bssDesc->BssQos.bdQoSMode & QOS_WMM)
1370 //
1371
1372 HTInitializeBssDesc (&bssDesc->BssHT);
1373
1374 //2<1> Parse HTCap, and HTInfo
1375 // Get HT Capability IE: (1) Get IEEE Draft N IE or (2) Get EWC IE
1376 HTCapIE = PacketGetElement(mmpdu, EID_HTCapability, OUI_SUB_DONT_CARE, OUI_SUBTYPE_DONT_CARE);
1377 if(HTCapIE.Length == 0)
1378 {
1379 HTCapIE = PacketGetElement(mmpdu, EID_Vendor, OUI_SUB_11N_EWC_HT_CAP, OUI_SUBTYPE_DONT_CARE);
1380 if(HTCapIE.Length != 0)
1381 bssDesc->BssHT.bdHTSpecVer= HT_SPEC_VER_EWC;
1382 }
1383 if(HTCapIE.Length != 0)
1384 HTParsingHTCapElement(Adapter, HTCapIE, bssDesc);
1385
1386 // Get HT Information IE: (1) Get IEEE Draft N IE or (2) Get EWC IE
1387 HTInfoIE = PacketGetElement(mmpdu, EID_HTInfo, OUI_SUB_DONT_CARE, OUI_SUBTYPE_DONT_CARE);
1388 if(HTInfoIE.Length == 0)
1389 {
1390 HTInfoIE = PacketGetElement(mmpdu, EID_Vendor, OUI_SUB_11N_EWC_HT_INFO, OUI_SUBTYPE_DONT_CARE);
1391 if(HTInfoIE.Length != 0)
1392 bssDesc->BssHT.bdHTSpecVer = HT_SPEC_VER_EWC;
1393 }
1394 if(HTInfoIE.Length != 0)
1395 HTParsingHTInfoElement(Adapter, HTInfoIE, bssDesc);
1396
1397 //2<2>If peer is HT, but not WMM, call QosSetLegacyWMMParamWithHT()
1398 if(HTCapIE.Length != 0)
1399 {
1400 bssDesc->BssHT.bdSupportHT = true;
1401 if(bssDesc->BssQos.bdQoSMode == QOS_DISABLE)
1402 QosSetLegacyWMMParamWithHT(Adapter, bssDesc);
1403 }
1404 else
1405 {
1406 bssDesc->BssHT.bdSupportHT = false;
1407 }
1408
1409 //2<3>Check whether the peer is Realtek AP/STA
1410 if(pHTInfo->bRegRT2RTAggregation)
1411 {
1412 if(bssDesc->BssHT.bdSupportHT)
1413 {
1414 HTRealtekAgg = PacketGetElement(mmpdu, EID_Vendor, OUI_SUB_REALTEK_AGG, OUI_SUBTYPE_DONT_CARE);
1415 if(HTRealtekAgg.Length >=5 )
1416 {
1417 bssDesc->BssHT.bdRT2RTAggregation = true;
1418
1419 if((HTRealtekAgg.Octet[4]==1) && (HTRealtekAgg.Octet[5] & 0x02))
1420 bssDesc->BssHT.bdRT2RTLongSlotTime = true;
1421 }
1422 }
1423 }
1424
1425 //
1426 // 2008/01/25 MH Get Broadcom AP IE for manamgent frame CCK rate problem.
1427 // AP can not receive CCK managemtn from from 92E.
1428 //
1429
1430 // Initialize every new bss broadcom cap exist as false..
1431 bssDesc->bBroadcomCapExist= false;
1432
1433 if(HTCapIE.Length != 0 || HTInfoIE.Length != 0)
1434 {
1435 u4Byte Length = 0;
1436
1437 FillOctetString(BroadcomElement, NULL, 0);
1438
1439 BroadcomElement = PacketGetElement( mmpdu, EID_Vendor, OUI_SUB_BROADCOM_IE_1, OUI_SUBTYPE_DONT_CARE);
1440 Length += BroadcomElement.Length;
1441 BroadcomElement = PacketGetElement( mmpdu, EID_Vendor, OUI_SUB_BROADCOM_IE_2, OUI_SUBTYPE_DONT_CARE);
1442 Length += BroadcomElement.Length;
1443 BroadcomElement = PacketGetElement( mmpdu, EID_Vendor, OUI_SUB_BROADCOM_IE_3, OUI_SUBTYPE_DONT_CARE);
1444 Length += BroadcomElement.Length;
1445
1446 if(Length > 0)
1447 bssDesc->bBroadcomCapExist = true;
1448 }
1449
1450
1451 // For Cisco IOT issue
1452 CiscoElement = PacketGetElement( mmpdu, EID_Vendor, OUI_SUB_CISCO_IE, OUI_SUBTYPE_DONT_CARE);
1453 if(CiscoElement.Length != 0){ // 3: 0x00, 0x40, 0x96 ....
1454 bssDesc->bCiscoCapExist = true;
1455 }else{
1456 bssDesc->bCiscoCapExist = false;
1457 }
1458}
1459
1460
1461#endif
1462/******************************************************************************************************************** 1209/********************************************************************************************************************
1463 *function: initialize Bss HT structure(struct PBSS_HT) 1210 *function: initialize Bss HT structure(struct PBSS_HT)
1464 * input: struct ieee80211_device *ieee 1211 * input: struct ieee80211_device *ieee
@@ -1712,8 +1459,4 @@ void HTSetConnectBwModeCallback(struct ieee80211_device* ieee)
1712 pHTInfo->bSwBwInProgress = false; 1459 pHTInfo->bSwBwInProgress = false;
1713} 1460}
1714 1461
1715#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
1716EXPORT_SYMBOL_NOVERS(HTUpdateSelfAndPeerSetting);
1717#else
1718EXPORT_SYMBOL(HTUpdateSelfAndPeerSetting); 1462EXPORT_SYMBOL(HTUpdateSelfAndPeerSetting);
1719#endif
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h
index 7ecfe68ddd58..13b1e5ca436d 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h
@@ -70,147 +70,6 @@ typedef enum _ACK_POLICY{
70}ACK_POLICY,*PACK_POLICY; 70}ACK_POLICY,*PACK_POLICY;
71 71
72#define WMM_PARAM_ELEMENT_SIZE (8+(4*AC_PARAM_SIZE)) 72#define WMM_PARAM_ELEMENT_SIZE (8+(4*AC_PARAM_SIZE))
73#if 0
74#define GET_QOS_CTRL(_pStart) ReadEF2Byte((u8 *)(_pStart) + 24)
75#define SET_QOS_CTRL(_pStart, _value) WriteEF2Byte((u8 *)(_pStart) + 24, _value)
76
77// WMM control field.
78#define GET_QOS_CTRL_WMM_UP(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 0, 3))
79#define SET_QOS_CTRL_WMM_UP(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 0, 3, (u8)(_value))
80
81#define GET_QOS_CTRL_WMM_EOSP(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 4, 1))
82#define SET_QOS_CTRL_WMM_EOSP(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 4, 1, (u8)(_value))
83
84#define GET_QOS_CTRL_WMM_ACK_POLICY(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 5, 2))
85#define SET_QOS_CTRL_WMM_ACK_POLICY(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 5, 2, (u8)(_value))
86
87// 802.11e control field (by STA, data)
88#define GET_QOS_CTRL_STA_DATA_TID(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 0, 4))
89#define SET_QOS_CTRL_STA_DATA_TID(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 0, 4, (u8)(_value))
90
91#define GET_QOS_CTRL_STA_DATA_QSIZE_FLAG(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 4, 1))
92#define SET_QOS_CTRL_STA_DATA_QSIZE_FLAG(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 4, 1, (u8)(_value))
93
94#define GET_QOS_CTRL_STA_DATA_ACK_POLICY(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 5, 2))
95#define SET_QOS_CTRL_STA_DATA_ACK_POLICY(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 5, 2, (u8)(_value))
96
97#define GET_QOS_CTRL_STA_DATA_TXOP(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 8, 8))
98#define SET_QOS_CTRL_STA_DATA_TXOP(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 8, 8, (u8)(_value))
99
100#define GET_QOS_CTRL_STA_DATA_QSIZE(_pStart) GET_QOS_CTRL_STA_DATA_TXOP(_pStart)
101#define SET_QOS_CTRL_STA_DATA_QSIZE(_pStart, _value) SET_QOS_CTRL_STA_DATA_TXOP(_pStart)
102
103// 802.11e control field (by HC, data)
104#define GET_QOS_CTRL_HC_DATA_TID(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 0, 4))
105#define SET_QOS_CTRL_HC_DATA_TID(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 0, 4, (u8)(_value))
106
107#define GET_QOS_CTRL_HC_DATA_EOSP(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 4, 1))
108#define SET_QOS_CTRL_HC_DATA_EOSP(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 4, 1, (u8)(_value))
109
110#define GET_QOS_CTRL_HC_DATA_ACK_POLICY(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 5, 2))
111#define SET_QOS_CTRL_HC_DATA_ACK_POLICY(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 5, 2, (u8)(_value))
112
113#define GET_QOS_CTRL_HC_DATA_PS_BUFSTATE(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 8, 8))
114#define SET_QOS_CTRL_HC_DATA_PS_BUFSTATE(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 8, 8, (u8)(_value))
115
116// 802.11e control field (by HC, CFP)
117#define GET_QOS_CTRL_HC_CFP_TID(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 0, 4))
118#define SET_QOS_CTRL_HC_CFP_TID(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 0, 4, (u8)(_value))
119
120#define GET_QOS_CTRL_HC_CFP_EOSP(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 4, 1))
121#define SET_QOS_CTRL_HC_CFP_EOSP(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 4, 1, (u8)(_value))
122
123#define GET_QOS_CTRL_HC_CFP_ACK_POLICY(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 5, 2))
124#define SET_QOS_CTRL_HC_CFP_ACK_POLICY(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 5, 2, (u8)(_value))
125
126#define GET_QOS_CTRL_HC_CFP_TXOP_LIMIT(_pStart) ((u8)LE_BITS_TO_2BYTE((u8 *)(_pStart)+24, 8, 8))
127#define SET_QOS_CTRL_HC_CFP_TXOP_LIMIT(_pStart, _value) SET_BITS_TO_LE_2BYTE((u8 *)(_pStart)+24, 8, 8, (u8)(_value))
128
129#define SET_WMM_QOS_INFO_FIELD(_pStart, _val) WriteEF1Byte(_pStart, _val)
130
131#define GET_WMM_QOS_INFO_FIELD_PARAMETERSET_COUNT(_pStart) LE_BITS_TO_1BYTE(_pStart, 0, 4)
132#define SET_WMM_QOS_INFO_FIELD_PARAMETERSET_COUNT(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 0, 4, _val)
133
134#define GET_WMM_QOS_INFO_FIELD_AP_UAPSD(_pStart) LE_BITS_TO_1BYTE(_pStart, 7, 1)
135#define SET_WMM_QOS_INFO_FIELD_AP_UAPSD(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 7, 1, _val)
136
137#define GET_WMM_QOS_INFO_FIELD_STA_AC_VO_UAPSD(_pStart) LE_BITS_TO_1BYTE(_pStart, 0, 1)
138#define SET_WMM_QOS_INFO_FIELD_STA_AC_VO_UAPSD(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 0, 1, _val)
139
140#define GET_WMM_QOS_INFO_FIELD_STA_AC_VI_UAPSD(_pStart) LE_BITS_TO_1BYTE(_pStart, 1, 1)
141#define SET_WMM_QOS_INFO_FIELD_STA_AC_VI_UAPSD(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 1, 1, _val)
142
143#define GET_WMM_QOS_INFO_FIELD_STA_AC_BE_UAPSD(_pStart) LE_BITS_TO_1BYTE(_pStart, 2, 1)
144#define SET_WMM_QOS_INFO_FIELD_STA_AC_BE_UAPSD(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 2, 1, _val)
145
146#define GET_WMM_QOS_INFO_FIELD_STA_AC_BK_UAPSD(_pStart) LE_BITS_TO_1BYTE(_pStart, 3, 1)
147#define SET_WMM_QOS_INFO_FIELD_STA_AC_BK_UAPSD(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 3, 1, _val)
148
149#define GET_WMM_QOS_INFO_FIELD_STA_MAX_SP_LEN(_pStart) LE_BITS_TO_1BYTE(_pStart, 5, 2)
150#define SET_WMM_QOS_INFO_FIELD_STA_MAX_SP_LEN(_pStart, _val) SET_BITS_TO_LE_1BYTE(_pStart, 5, 2, _val)
151
152
153#define WMM_INFO_ELEMENT_SIZE 7
154
155#define GET_WMM_INFO_ELE_OUI(_pStart) ((u8 *)(_pStart))
156#define SET_WMM_INFO_ELE_OUI(_pStart, _pVal) PlatformMoveMemory(_pStart, _pVal, 3);
157
158#define GET_WMM_INFO_ELE_OUI_TYPE(_pStart) ( EF1Byte( *((u8 *)(_pStart)+3) ) )
159#define SET_WMM_INFO_ELE_OUI_TYPE(_pStart, _val) ( *((u8 *)(_pStart)+3) = EF1Byte(_val) )
160
161#define GET_WMM_INFO_ELE_OUI_SUBTYPE(_pStart) ( EF1Byte( *((u8 *)(_pStart)+4) ) )
162#define SET_WMM_INFO_ELE_OUI_SUBTYPE(_pStart, _val) ( *((u8 *)(_pStart)+4) = EF1Byte(_val) )
163
164#define GET_WMM_INFO_ELE_VERSION(_pStart) ( EF1Byte( *((u8 *)(_pStart)+5) ) )
165#define SET_WMM_INFO_ELE_VERSION(_pStart, _val) ( *((u8 *)(_pStart)+5) = EF1Byte(_val) )
166
167#define GET_WMM_INFO_ELE_QOS_INFO_FIELD(_pStart) ( EF1Byte( *((u8 *)(_pStart)+6) ) )
168#define SET_WMM_INFO_ELE_QOS_INFO_FIELD(_pStart, _val) ( *((u8 *)(_pStart)+6) = EF1Byte(_val) )
169
170
171
172#define GET_WMM_AC_PARAM_AIFSN(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 0, 4) )
173#define SET_WMM_AC_PARAM_AIFSN(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 0, 4, _val)
174
175#define GET_WMM_AC_PARAM_ACM(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 4, 1) )
176#define SET_WMM_AC_PARAM_ACM(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 4, 1, _val)
177
178#define GET_WMM_AC_PARAM_ACI(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 5, 2) )
179#define SET_WMM_AC_PARAM_ACI(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 5, 2, _val)
180
181#define GET_WMM_AC_PARAM_ACI_AIFSN(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 0, 8) )
182#define SET_WMM_AC_PARAM_ACI_AIFSN(_pStart, _val) SET_BTIS_TO_LE_4BYTE(_pStart, 0, 8, _val)
183
184#define GET_WMM_AC_PARAM_ECWMIN(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 8, 4) )
185#define SET_WMM_AC_PARAM_ECWMIN(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 8, 4, _val)
186
187#define GET_WMM_AC_PARAM_ECWMAX(_pStart) ( (u8)LE_BITS_TO_4BYTE(_pStart, 12, 4) )
188#define SET_WMM_AC_PARAM_ECWMAX(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 12, 4, _val)
189
190#define GET_WMM_AC_PARAM_TXOP_LIMIT(_pStart) ( (u16)LE_BITS_TO_4BYTE(_pStart, 16, 16) )
191#define SET_WMM_AC_PARAM_TXOP_LIMIT(_pStart, _val) SET_BITS_TO_LE_4BYTE(_pStart, 16, 16, _val)
192
193
194
195
196#define GET_WMM_PARAM_ELE_OUI(_pStart) ((u8 *)(_pStart))
197#define SET_WMM_PARAM_ELE_OUI(_pStart, _pVal) PlatformMoveMemory(_pStart, _pVal, 3)
198
199#define GET_WMM_PARAM_ELE_OUI_TYPE(_pStart) ( EF1Byte( *((u8 *)(_pStart)+3) ) )
200#define SET_WMM_PARAM_ELE_OUI_TYPE(_pStart, _val) ( *((u8 *)(_pStart)+3) = EF1Byte(_val) )
201
202#define GET_WMM_PARAM_ELE_OUI_SUBTYPE(_pStart) ( EF1Byte( *((u8 *)(_pStart)+4) ) )
203#define SET_WMM_PARAM_ELE_OUI_SUBTYPE(_pStart, _val) ( *((u8 *)(_pStart)+4) = EF1Byte(_val) )
204
205#define GET_WMM_PARAM_ELE_VERSION(_pStart) ( EF1Byte( *((u8 *)(_pStart)+5) ) )
206#define SET_WMM_PARAM_ELE_VERSION(_pStart, _val) ( *((u8 *)(_pStart)+5) = EF1Byte(_val) )
207
208#define GET_WMM_PARAM_ELE_QOS_INFO_FIELD(_pStart) ( EF1Byte( *((u8 *)(_pStart)+6) ) )
209#define SET_WMM_PARAM_ELE_QOS_INFO_FIELD(_pStart, _val) ( *((u8 *)(_pStart)+6) = EF1Byte(_val) )
210
211#define GET_WMM_PARAM_ELE_AC_PARAM(_pStart) ( (u8 *)(_pStart)+8 )
212#define SET_WMM_PARAM_ELE_AC_PARAM(_pStart, _pVal) PlatformMoveMemory((_pStart)+8, _pVal, 16)
213#endif
214 73
215// 74//
216// QoS Control Field 75// QoS Control Field
@@ -361,21 +220,6 @@ typedef union _QOS_INFO_FIELD{
361 220
362}QOS_INFO_FIELD, *PQOS_INFO_FIELD; 221}QOS_INFO_FIELD, *PQOS_INFO_FIELD;
363 222
364#if 0
365//
366// WMM Information Element
367// Ref: WMM spec 2.2.1: WME Information Element, p.10.
368//
369typedef struct _WMM_INFO_ELEMENT{
370// u8 ElementID;
371// u8 Length;
372 u8 OUI[3];
373 u8 OUI_Type;
374 u8 OUI_SubType;
375 u8 Version;
376 QOS_INFO_FIELD QosInfo;
377}WMM_INFO_ELEMENT, *PWMM_INFO_ELEMENT;
378#endif
379 223
380// 224//
381// ACI to AC coding. 225// ACI to AC coding.
@@ -650,16 +494,6 @@ typedef struct _OCTET_STRING{
650 u8 *Octet; 494 u8 *Octet;
651 u16 Length; 495 u16 Length;
652}OCTET_STRING, *POCTET_STRING; 496}OCTET_STRING, *POCTET_STRING;
653#if 0
654#define FillOctetString(_os,_octet,_len) \
655 (_os).Octet=(u8 *)(_octet); \
656 (_os).Length=(_len);
657
658#define WMM_ELEM_HDR_LEN 6
659#define WMMElemSkipHdr(_osWMMElem) \
660 (_osWMMElem).Octet += WMM_ELEM_HDR_LEN; \
661 (_osWMMElem).Length -= WMM_ELEM_HDR_LEN;
662#endif
663// 497//
664// STA QoS data. 498// STA QoS data.
665// Ref: DOT11_QOS in 8185 code. [def. in QoS_mp.h] 499// Ref: DOT11_QOS in 8185 code. [def. in QoS_mp.h]
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c
index ecf24b9edb1f..5373d565af24 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c
@@ -2,13 +2,6 @@
2#include <linux/etherdevice.h> 2#include <linux/etherdevice.h>
3#include "rtl819x_TS.h" 3#include "rtl819x_TS.h"
4 4
5#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
6#define list_for_each_entry_safe(pos, n, head, member) \
7 for (pos = list_entry((head)->next, typeof(*pos), member), \
8 n = list_entry(pos->member.next, typeof(*pos), member); \
9 &pos->member != (head); \
10 pos = n, n = list_entry(n->member.next, typeof(*n), member))
11#endif
12void TsSetupTimeOut(unsigned long data) 5void TsSetupTimeOut(unsigned long data)
13{ 6{
14 // Not implement yet 7 // Not implement yet
@@ -28,7 +21,6 @@ void TsInactTimeout(unsigned long data)
28 * return: NULL 21 * return: NULL
29 * notice: 22 * notice:
30********************************************************************************************************************/ 23********************************************************************************************************************/
31#if 1
32void RxPktPendingTimeout(unsigned long data) 24void RxPktPendingTimeout(unsigned long data)
33{ 25{
34 PRX_TS_RECORD pRxTs = (PRX_TS_RECORD)data; 26 PRX_TS_RECORD pRxTs = (PRX_TS_RECORD)data;
@@ -102,7 +94,6 @@ void RxPktPendingTimeout(unsigned long data)
102 spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); 94 spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags);
103 //PlatformReleaseSpinLock(Adapter, RT_RX_SPINLOCK); 95 //PlatformReleaseSpinLock(Adapter, RT_RX_SPINLOCK);
104} 96}
105#endif
106 97
107/******************************************************************************************************************** 98/********************************************************************************************************************
108 *function: Add BA timer function 99 *function: Add BA timer function
@@ -366,17 +357,10 @@ bool GetTs(
366 IEEE80211_DEBUG(IEEE80211_DL_ERR, "get TS for Broadcast or Multicast\n"); 357 IEEE80211_DEBUG(IEEE80211_DL_ERR, "get TS for Broadcast or Multicast\n");
367 return false; 358 return false;
368 } 359 }
369#if 0
370 if(ieee->pStaQos->CurrentQosMode == QOS_DISABLE)
371 { UP = 0; } //only use one TS
372 else if(ieee->pStaQos->CurrentQosMode & QOS_WMM)
373 {
374#else
375 if (ieee->current_network.qos_data.supported == 0) 360 if (ieee->current_network.qos_data.supported == 0)
376 UP = 0; 361 UP = 0;
377 else 362 else
378 { 363 {
379#endif
380 // In WMM case: we use 4 TID only 364 // In WMM case: we use 4 TID only
381 if (!IsACValid(TID)) 365 if (!IsACValid(TID))
382 { 366 {
@@ -548,7 +532,6 @@ void RemovePeerTS(struct ieee80211_device* ieee, u8* Addr)
548{ 532{
549 PTS_COMMON_INFO pTS, pTmpTS; 533 PTS_COMMON_INFO pTS, pTmpTS;
550 printk("===========>RemovePeerTS,"MAC_FMT"\n", MAC_ARG(Addr)); 534 printk("===========>RemovePeerTS,"MAC_FMT"\n", MAC_ARG(Addr));
551#if 1
552 list_for_each_entry_safe(pTS, pTmpTS, &ieee->Tx_TS_Pending_List, List) 535 list_for_each_entry_safe(pTS, pTmpTS, &ieee->Tx_TS_Pending_List, List)
553 { 536 {
554 if (memcmp(pTS->Addr, Addr, 6) == 0) 537 if (memcmp(pTS->Addr, Addr, 6) == 0)
@@ -589,13 +572,11 @@ void RemovePeerTS(struct ieee80211_device* ieee, u8* Addr)
589 list_add_tail(&pTS->List, &ieee->Rx_TS_Unused_List); 572 list_add_tail(&pTS->List, &ieee->Rx_TS_Unused_List);
590 } 573 }
591 } 574 }
592#endif
593} 575}
594 576
595void RemoveAllTS(struct ieee80211_device* ieee) 577void RemoveAllTS(struct ieee80211_device* ieee)
596{ 578{
597 PTS_COMMON_INFO pTS, pTmpTS; 579 PTS_COMMON_INFO pTS, pTmpTS;
598#if 1
599 list_for_each_entry_safe(pTS, pTmpTS, &ieee->Tx_TS_Pending_List, List) 580 list_for_each_entry_safe(pTS, pTmpTS, &ieee->Tx_TS_Pending_List, List)
600 { 581 {
601 RemoveTsEntry(ieee, pTS, TX_DIR); 582 RemoveTsEntry(ieee, pTS, TX_DIR);
@@ -623,7 +604,6 @@ void RemoveAllTS(struct ieee80211_device* ieee)
623 list_del_init(&pTS->List); 604 list_del_init(&pTS->List);
624 list_add_tail(&pTS->List, &ieee->Rx_TS_Unused_List); 605 list_add_tail(&pTS->List, &ieee->Rx_TS_Unused_List);
625 } 606 }
626#endif
627} 607}
628 608
629void TsStartAddBaProcess(struct ieee80211_device* ieee, PTX_TS_RECORD pTxTS) 609void TsStartAddBaProcess(struct ieee80211_device* ieee, PTX_TS_RECORD pTxTS)
@@ -631,7 +611,6 @@ void TsStartAddBaProcess(struct ieee80211_device* ieee, PTX_TS_RECORD pTxTS)
631 if(pTxTS->bAddBaReqInProgress == false) 611 if(pTxTS->bAddBaReqInProgress == false)
632 { 612 {
633 pTxTS->bAddBaReqInProgress = true; 613 pTxTS->bAddBaReqInProgress = true;
634#if 1
635 if(pTxTS->bAddBaReqDelayed) 614 if(pTxTS->bAddBaReqDelayed)
636 { 615 {
637 IEEE80211_DEBUG(IEEE80211_DL_BA, "TsStartAddBaProcess(): Delayed Start ADDBA after 60 sec!!\n"); 616 IEEE80211_DEBUG(IEEE80211_DL_BA, "TsStartAddBaProcess(): Delayed Start ADDBA after 60 sec!!\n");
@@ -642,13 +621,8 @@ void TsStartAddBaProcess(struct ieee80211_device* ieee, PTX_TS_RECORD pTxTS)
642 IEEE80211_DEBUG(IEEE80211_DL_BA,"TsStartAddBaProcess(): Immediately Start ADDBA now!!\n"); 621 IEEE80211_DEBUG(IEEE80211_DL_BA,"TsStartAddBaProcess(): Immediately Start ADDBA now!!\n");
643 mod_timer(&pTxTS->TsAddBaTimer, jiffies+10); //set 10 ticks 622 mod_timer(&pTxTS->TsAddBaTimer, jiffies+10); //set 10 ticks
644 } 623 }
645#endif
646 } 624 }
647 else 625 else
648 IEEE80211_DEBUG(IEEE80211_DL_ERR, "%s()==>BA timer is already added\n", __FUNCTION__); 626 IEEE80211_DEBUG(IEEE80211_DL_ERR, "%s()==>BA timer is already added\n", __FUNCTION__);
649} 627}
650#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
651EXPORT_SYMBOL_NOVERS(RemovePeerTS);
652#else
653EXPORT_SYMBOL(RemovePeerTS); 628EXPORT_SYMBOL(RemovePeerTS);
654#endif
diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h
index 8f62f45517c8..69a2721e850c 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -39,9 +39,6 @@
39#include <linux/random.h> 39#include <linux/random.h>
40#include <linux/version.h> 40#include <linux/version.h>
41#include <asm/io.h> 41#include <asm/io.h>
42#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27))
43#include <asm/semaphore.h>
44#endif
45#include "ieee80211.h" 42#include "ieee80211.h"
46 43
47#define RTL8192U 44#define RTL8192U
@@ -87,11 +84,6 @@
87 84
88// Rx smooth factor 85// Rx smooth factor
89#define Rx_Smooth_Factor 20 86#define Rx_Smooth_Factor 20
90#if 0 //we need to use RT_TRACE instead DMESG as RT_TRACE will clearly show debug level wb.
91#define DMESG(x,a...) printk(KERN_INFO RTL819xU_MODULE_NAME ": " x "\n", ## a)
92#define DMESGW(x,a...) printk(KERN_WARNING RTL819xU_MODULE_NAME ": WW:" x "\n", ## a)
93#define DMESGE(x,a...) printk(KERN_WARNING RTL819xU_MODULE_NAME ": EE:" x "\n", ## a)
94#else
95#define DMESG(x,a...) 87#define DMESG(x,a...)
96#define DMESGW(x,a...) 88#define DMESGW(x,a...)
97#define DMESGE(x,a...) 89#define DMESGE(x,a...)
@@ -141,7 +133,6 @@ do { if(rt_global_debug_component & component) \
141#define COMP_DOWN BIT29 //for rm driver module 133#define COMP_DOWN BIT29 //for rm driver module
142#define COMP_RESET BIT30 //for silent reset 134#define COMP_RESET BIT30 //for silent reset
143#define COMP_ERR BIT31 //for error out, always on 135#define COMP_ERR BIT31 //for error out, always on
144#endif
145 136
146#define RTL819x_DEBUG 137#define RTL819x_DEBUG
147#ifdef RTL819x_DEBUG 138#ifdef RTL819x_DEBUG
@@ -596,16 +587,6 @@ typedef struct rtl_reg_debug{
596 587
597 588
598 589
599#if 0
600
601typedef struct tx_pendingbuf
602{
603 struct ieee80211_txb *txb;
604 short ispending;
605 short descfrag;
606} tx_pendigbuf;
607
608#endif
609 590
610typedef struct _rt_9x_tx_rate_history { 591typedef struct _rt_9x_tx_rate_history {
611 u32 cck[4]; 592 u32 cck[4];
@@ -933,11 +914,7 @@ typedef struct r8192_priv
933 spinlock_t irq_lock; 914 spinlock_t irq_lock;
934// spinlock_t irq_th_lock; 915// spinlock_t irq_th_lock;
935 spinlock_t tx_lock; 916 spinlock_t tx_lock;
936#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
937 struct semaphore mutex;
938#else
939 struct mutex mutex; 917 struct mutex mutex;
940#endif
941 //spinlock_t rf_lock; //used to lock rf write operation added by wb 918 //spinlock_t rf_lock; //used to lock rf write operation added by wb
942 919
943 u16 irq_mask; 920 u16 irq_mask;
@@ -1007,11 +984,7 @@ typedef struct r8192_priv
1007/* modified by davad for Rx process */ 984/* modified by davad for Rx process */
1008 struct sk_buff_head rx_queue; 985 struct sk_buff_head rx_queue;
1009 struct sk_buff_head skb_queue; 986 struct sk_buff_head skb_queue;
1010#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
1011 struct tq_struct qos_activate;
1012#else
1013 struct work_struct qos_activate; 987 struct work_struct qos_activate;
1014#endif
1015 short tx_urb_index; 988 short tx_urb_index;
1016 atomic_t tx_pending[0x10];//UART_PRIORITY+1 989 atomic_t tx_pending[0x10];//UART_PRIORITY+1
1017 990
@@ -1041,11 +1014,7 @@ typedef struct r8192_priv
1041 u16 rts; 1014 u16 rts;
1042 1015
1043 struct ChnlAccessSetting ChannelAccessSetting; 1016 struct ChnlAccessSetting ChannelAccessSetting;
1044#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1045 struct work_struct reset_wq; 1017 struct work_struct reset_wq;
1046#else
1047 struct tq_struct reset_wq;
1048#endif
1049 1018
1050/**********************************************************/ 1019/**********************************************************/
1051 //for rtl819xUsb 1020 //for rtl819xUsb
@@ -1194,33 +1163,14 @@ typedef struct r8192_priv
1194 u16 SifsTime; 1163 u16 SifsTime;
1195 1164
1196 //define work item by amy 080526 1165 //define work item by amy 080526
1197#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1198 1166
1199#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1200 struct delayed_work update_beacon_wq; 1167 struct delayed_work update_beacon_wq;
1201 struct delayed_work watch_dog_wq; 1168 struct delayed_work watch_dog_wq;
1202 struct delayed_work txpower_tracking_wq; 1169 struct delayed_work txpower_tracking_wq;
1203 struct delayed_work rfpath_check_wq; 1170 struct delayed_work rfpath_check_wq;
1204 struct delayed_work gpio_change_rf_wq; 1171 struct delayed_work gpio_change_rf_wq;
1205 struct delayed_work initialgain_operate_wq; 1172 struct delayed_work initialgain_operate_wq;
1206#else
1207 struct work_struct update_beacon_wq;
1208 struct work_struct watch_dog_wq;
1209 struct work_struct txpower_tracking_wq;
1210 struct work_struct rfpath_check_wq;
1211 struct work_struct gpio_change_rf_wq;
1212 struct work_struct initialgain_operate_wq;
1213#endif
1214 struct workqueue_struct *priv_wq; 1173 struct workqueue_struct *priv_wq;
1215#else
1216 /* used for periodly scan */
1217 struct tq_struct update_beacon_wq;
1218 struct tq_struct txpower_tracking_wq;
1219 struct tq_struct rfpath_check_wq;
1220 struct tq_struct watch_dog_wq;
1221 struct tq_struct gpio_change_rf_wq;
1222 struct tq_struct initialgain_operate_wq;
1223#endif
1224}r8192_priv; 1174}r8192_priv;
1225 1175
1226// for rtl8187 1176// for rtl8187
@@ -1259,60 +1209,6 @@ typedef enum{
1259 } nic_t; 1209 } nic_t;
1260 1210
1261 1211
1262#if 0 //defined in Qos.h
1263//typedef u32 AC_CODING;
1264#define AC0_BE 0 // ACI: 0x00 // Best Effort
1265#define AC1_BK 1 // ACI: 0x01 // Background
1266#define AC2_VI 2 // ACI: 0x10 // Video
1267#define AC3_VO 3 // ACI: 0x11 // Voice
1268#define AC_MAX 4 // Max: define total number; Should not to be used as a real enum.
1269
1270//
1271// ECWmin/ECWmax field.
1272// Ref: WMM spec 2.2.2: WME Parameter Element, p.13.
1273//
1274typedef union _ECW{
1275 u8 charData;
1276 struct
1277 {
1278 u8 ECWmin:4;
1279 u8 ECWmax:4;
1280 }f; // Field
1281}ECW, *PECW;
1282
1283//
1284// ACI/AIFSN Field.
1285// Ref: WMM spec 2.2.2: WME Parameter Element, p.12.
1286//
1287typedef union _ACI_AIFSN{
1288 u8 charData;
1289
1290 struct
1291 {
1292 u8 AIFSN:4;
1293 u8 ACM:1;
1294 u8 ACI:2;
1295 u8 Reserved:1;
1296 }f; // Field
1297}ACI_AIFSN, *PACI_AIFSN;
1298
1299//
1300// AC Parameters Record Format.
1301// Ref: WMM spec 2.2.2: WME Parameter Element, p.12.
1302//
1303typedef union _AC_PARAM{
1304 u32 longData;
1305 u8 charData[4];
1306
1307 struct
1308 {
1309 ACI_AIFSN AciAifsn;
1310 ECW Ecw;
1311 u16 TXOPLimit;
1312 }f; // Field
1313}AC_PARAM, *PAC_PARAM;
1314
1315#endif
1316#ifdef JOHN_HWSEC 1212#ifdef JOHN_HWSEC
1317struct ssid_thread { 1213struct ssid_thread {
1318 struct net_device *dev; 1214 struct net_device *dev;
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
index 7aa464224d10..adade13e1e19 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -71,9 +71,6 @@ double __extendsfdf2(float a) {return a;}
71//#include "r8192xU_phyreg.h" 71//#include "r8192xU_phyreg.h"
72#include <linux/usb.h> 72#include <linux/usb.h>
73// FIXME: check if 2.6.7 is ok 73// FIXME: check if 2.6.7 is ok
74#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
75#define usb_kill_urb usb_unlink_urb
76#endif
77 74
78#ifdef CONFIG_RTL8192_PM 75#ifdef CONFIG_RTL8192_PM
79#include "r8192_pm.h" 76#include "r8192_pm.h"
@@ -127,59 +124,36 @@ static struct usb_device_id rtl8192_usb_id_tbl[] = {
127}; 124};
128 125
129MODULE_LICENSE("GPL"); 126MODULE_LICENSE("GPL");
130#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
131MODULE_VERSION("V 1.1"); 127MODULE_VERSION("V 1.1");
132#endif
133MODULE_DEVICE_TABLE(usb, rtl8192_usb_id_tbl); 128MODULE_DEVICE_TABLE(usb, rtl8192_usb_id_tbl);
134MODULE_DESCRIPTION("Linux driver for Realtek RTL8192 USB WiFi cards"); 129MODULE_DESCRIPTION("Linux driver for Realtek RTL8192 USB WiFi cards");
135 130
136static char* ifname = "wlan%d"; 131static char* ifname = "wlan%d";
137#if 0
138static int hwseqnum = 0;
139static int hwwep = 0;
140#endif
141static int hwwep = 1; //default use hw. set 0 to use software security 132static int hwwep = 1; //default use hw. set 0 to use software security
142static int channels = 0x3fff; 133static int channels = 0x3fff;
143 134
144 135
145 136
146#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9)
147module_param(ifname, charp, S_IRUGO|S_IWUSR ); 137module_param(ifname, charp, S_IRUGO|S_IWUSR );
148//module_param(hwseqnum,int, S_IRUGO|S_IWUSR); 138//module_param(hwseqnum,int, S_IRUGO|S_IWUSR);
149module_param(hwwep,int, S_IRUGO|S_IWUSR); 139module_param(hwwep,int, S_IRUGO|S_IWUSR);
150module_param(channels,int, S_IRUGO|S_IWUSR); 140module_param(channels,int, S_IRUGO|S_IWUSR);
151#else
152MODULE_PARM(ifname, "s");
153//MODULE_PARM(hwseqnum,"i");
154MODULE_PARM(hwwep,"i");
155MODULE_PARM(channels,"i");
156#endif
157 141
158MODULE_PARM_DESC(ifname," Net interface name, wlan%d=default"); 142MODULE_PARM_DESC(ifname," Net interface name, wlan%d=default");
159//MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default"); 143//MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default");
160MODULE_PARM_DESC(hwwep," Try to use hardware security support. "); 144MODULE_PARM_DESC(hwwep," Try to use hardware security support. ");
161MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI"); 145MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI");
162 146
163#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
164static int __devinit rtl8192_usb_probe(struct usb_interface *intf, 147static int __devinit rtl8192_usb_probe(struct usb_interface *intf,
165 const struct usb_device_id *id); 148 const struct usb_device_id *id);
166static void __devexit rtl8192_usb_disconnect(struct usb_interface *intf); 149static void __devexit rtl8192_usb_disconnect(struct usb_interface *intf);
167#else
168static void *__devinit rtl8192_usb_probe(struct usb_device *udev,unsigned int ifnum,
169 const struct usb_device_id *id);
170static void __devexit rtl8192_usb_disconnect(struct usb_device *udev, void *ptr);
171#endif
172 150
173 151
174static struct usb_driver rtl8192_usb_driver = { 152static struct usb_driver rtl8192_usb_driver = {
175#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 15)
176 .owner = THIS_MODULE,
177#endif
178 .name = RTL819xU_MODULE_NAME, /* Driver name */ 153 .name = RTL819xU_MODULE_NAME, /* Driver name */
179 .id_table = rtl8192_usb_id_tbl, /* PCI_ID table */ 154 .id_table = rtl8192_usb_id_tbl, /* PCI_ID table */
180 .probe = rtl8192_usb_probe, /* probe fn */ 155 .probe = rtl8192_usb_probe, /* probe fn */
181 .disconnect = rtl8192_usb_disconnect, /* remove fn */ 156 .disconnect = rtl8192_usb_disconnect, /* remove fn */
182#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
183#ifdef CONFIG_RTL8192_PM 157#ifdef CONFIG_RTL8192_PM
184 .suspend = rtl8192_suspend, /* PM suspend fn */ 158 .suspend = rtl8192_suspend, /* PM suspend fn */
185 .resume = rtl8192_resume, /* PM resume fn */ 159 .resume = rtl8192_resume, /* PM resume fn */
@@ -187,7 +161,6 @@ static struct usb_driver rtl8192_usb_driver = {
187 .suspend = NULL, /* PM suspend fn */ 161 .suspend = NULL, /* PM suspend fn */
188 .resume = NULL, /* PM resume fn */ 162 .resume = NULL, /* PM resume fn */
189#endif 163#endif
190#endif
191}; 164};
192 165
193#ifdef ENABLE_DOT11D 166#ifdef ENABLE_DOT11D
@@ -280,7 +253,6 @@ static void rtl819x_set_channel_map(u8 channel_plan, struct r8192_priv* priv)
280 253
281void CamResetAllEntry(struct net_device *dev) 254void CamResetAllEntry(struct net_device *dev)
282{ 255{
283#if 1
284 u32 ulcommand = 0; 256 u32 ulcommand = 0;
285 //2004/02/11 In static WEP, OID_ADD_KEY or OID_ADD_WEP are set before STA associate to AP. 257 //2004/02/11 In static WEP, OID_ADD_KEY or OID_ADD_WEP are set before STA associate to AP.
286 // However, ResetKey is called on OID_802_11_INFRASTRUCTURE_MODE and MlmeAssociateRequest 258 // However, ResetKey is called on OID_802_11_INFRASTRUCTURE_MODE and MlmeAssociateRequest
@@ -293,12 +265,6 @@ void CamResetAllEntry(struct net_device *dev)
293 //DbgPrint("========================================\n\n"); 265 //DbgPrint("========================================\n\n");
294 ulcommand |= BIT31|BIT30; 266 ulcommand |= BIT31|BIT30;
295 write_nic_dword(dev, RWCAM, ulcommand); 267 write_nic_dword(dev, RWCAM, ulcommand);
296#else
297 for(ucIndex=0;ucIndex<TOTAL_CAM_ENTRY;ucIndex++)
298 CAM_mark_invalid(dev, ucIndex);
299 for(ucIndex=0;ucIndex<TOTAL_CAM_ENTRY;ucIndex++)
300 CAM_empty_entry(dev, ucIndex);
301#endif
302 268
303} 269}
304 270
@@ -513,13 +479,8 @@ inline void force_pci_posting(struct net_device *dev)
513static struct net_device_stats *rtl8192_stats(struct net_device *dev); 479static struct net_device_stats *rtl8192_stats(struct net_device *dev);
514void rtl8192_commit(struct net_device *dev); 480void rtl8192_commit(struct net_device *dev);
515//void rtl8192_restart(struct net_device *dev); 481//void rtl8192_restart(struct net_device *dev);
516#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
517void rtl8192_restart(struct work_struct *work); 482void rtl8192_restart(struct work_struct *work);
518//void rtl8192_rq_tx_ack(struct work_struct *work); 483//void rtl8192_rq_tx_ack(struct work_struct *work);
519#else
520 void rtl8192_restart(struct net_device *dev);
521// //void rtl8192_rq_tx_ack(struct net_device *dev);
522 #endif
523 484
524void watch_dog_timer_callback(unsigned long data); 485void watch_dog_timer_callback(unsigned long data);
525 486
@@ -590,7 +551,6 @@ len += snprintf(page + len, count - len,
590 551
591 // printk("%2x ",read_nic_byte(dev,n)); 552 // printk("%2x ",read_nic_byte(dev,n));
592 } 553 }
593#if 1
594len += snprintf(page + len, count - len, 554len += snprintf(page + len, count - len,
595 "\n####################page 1##################\n "); 555 "\n####################page 1##################\n ");
596 for(n=0;n<=max;) 556 for(n=0;n<=max;)
@@ -620,7 +580,6 @@ len += snprintf(page + len, count - len,
620 // printk("%2x ",read_nic_byte(dev,n)); 580 // printk("%2x ",read_nic_byte(dev,n));
621 } 581 }
622 582
623#endif
624 583
625 len += snprintf(page + len, count - len,"\n"); 584 len += snprintf(page + len, count - len,"\n");
626 *eof = 1; 585 *eof = 1;
@@ -629,98 +588,8 @@ len += snprintf(page + len, count - len,
629} 588}
630 589
631 590
632#if 0
633static int proc_get_cck_reg(char *page, char **start,
634 off_t offset, int count,
635 int *eof, void *data)
636{
637 struct net_device *dev = data;
638// struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
639
640 int len = 0;
641 int i,n;
642 591
643 int max = 0x5F;
644 592
645 /* This dump the current register page */
646 for(n=0;n<=max;)
647 {
648 //printk( "\nD: %2x> ", n);
649 len += snprintf(page + len, count - len,
650 "\nD: %2x > ",n);
651
652 for(i=0;i<16 && n<=max;i++,n++)
653 len += snprintf(page + len, count - len,
654 "%2x ",read_phy_cck(dev,n));
655
656 // printk("%2x ",read_nic_byte(dev,n));
657 }
658 len += snprintf(page + len, count - len,"\n");
659
660
661 *eof = 1;
662 return len;
663}
664
665#endif
666
667#if 0
668static int proc_get_ofdm_reg(char *page, char **start,
669 off_t offset, int count,
670 int *eof, void *data)
671{
672 struct net_device *dev = data;
673// struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
674
675 int len = 0;
676 int i,n;
677
678 //int max=0xff;
679 int max = 0x40;
680
681 /* This dump the current register page */
682 for(n=0;n<=max;)
683 {
684 //printk( "\nD: %2x> ", n);
685 len += snprintf(page + len, count - len,
686 "\nD: %2x > ",n);
687
688 for(i=0;i<16 && n<=max;i++,n++)
689 len += snprintf(page + len, count - len,
690 "%2x ",read_phy_ofdm(dev,n));
691
692 // printk("%2x ",read_nic_byte(dev,n));
693 }
694 len += snprintf(page + len, count - len,"\n");
695
696
697
698 *eof = 1;
699 return len;
700}
701
702#endif
703
704#if 0
705static int proc_get_stats_hw(char *page, char **start,
706 off_t offset, int count,
707 int *eof, void *data)
708{
709 struct net_device *dev = data;
710 struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
711
712 int len = 0;
713
714 len += snprintf(page + len, count - len,
715 "NIC int: %lu\n"
716 "Total int: %lu\n",
717 priv->stats.ints,
718 priv->stats.shints);
719
720 *eof = 1;
721 return len;
722}
723#endif
724 593
725static int proc_get_stats_tx(char *page, char **start, 594static int proc_get_stats_tx(char *page, char **start,
726 off_t offset, int count, 595 off_t offset, int count,
@@ -818,35 +687,16 @@ static int proc_get_stats_rx(char *page, char **start,
818 *eof = 1; 687 *eof = 1;
819 return len; 688 return len;
820} 689}
821#if 0
822#if WIRELESS_EXT >= 12 && WIRELESS_EXT < 17
823
824static struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev)
825{
826 struct r8192_priv *priv = ieee80211_priv(dev);
827
828 return &priv->wstats;
829}
830#endif
831#endif
832void rtl8192_proc_module_init(void) 690void rtl8192_proc_module_init(void)
833{ 691{
834 RT_TRACE(COMP_INIT, "Initializing proc filesystem"); 692 RT_TRACE(COMP_INIT, "Initializing proc filesystem");
835#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
836 rtl8192_proc=create_proc_entry(RTL819xU_MODULE_NAME, S_IFDIR, proc_net);
837#else
838 rtl8192_proc=create_proc_entry(RTL819xU_MODULE_NAME, S_IFDIR, init_net.proc_net); 693 rtl8192_proc=create_proc_entry(RTL819xU_MODULE_NAME, S_IFDIR, init_net.proc_net);
839#endif
840} 694}
841 695
842 696
843void rtl8192_proc_module_remove(void) 697void rtl8192_proc_module_remove(void)
844{ 698{
845#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
846 remove_proc_entry(RTL819xU_MODULE_NAME, proc_net);
847#else
848 remove_proc_entry(RTL819xU_MODULE_NAME, init_net.proc_net); 699 remove_proc_entry(RTL819xU_MODULE_NAME, init_net.proc_net);
849#endif
850} 700}
851 701
852 702
@@ -883,16 +733,6 @@ void rtl8192_proc_init_one(struct net_device *dev)
883 dev->name); 733 dev->name);
884 return; 734 return;
885 } 735 }
886 #if 0
887 e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO,
888 priv->dir_dev, proc_get_stats_hw, dev);
889
890 if (!e) {
891 DMESGE("Unable to initialize "
892 "/proc/net/rtl8192/%s/stats-hw\n",
893 dev->name);
894 }
895 #endif
896 e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO, 736 e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
897 priv->dir_dev, proc_get_stats_rx, dev); 737 priv->dir_dev, proc_get_stats_rx, dev);
898 738
@@ -911,17 +751,6 @@ void rtl8192_proc_init_one(struct net_device *dev)
911 "/proc/net/rtl8192/%s/stats-tx\n", 751 "/proc/net/rtl8192/%s/stats-tx\n",
912 dev->name); 752 dev->name);
913 } 753 }
914 #if 0
915 e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO,
916 priv->dir_dev, proc_get_stats_ieee, dev);
917
918 if (!e) {
919 DMESGE("Unable to initialize "
920 "/proc/net/rtl8192/%s/stats-ieee\n",
921 dev->name);
922 }
923
924 #endif
925 754
926 e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO, 755 e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
927 priv->dir_dev, proc_get_stats_ap, dev); 756 priv->dir_dev, proc_get_stats_ap, dev);
@@ -939,23 +768,6 @@ void rtl8192_proc_init_one(struct net_device *dev)
939 "/proc/net/rtl8192/%s/registers\n", 768 "/proc/net/rtl8192/%s/registers\n",
940 dev->name); 769 dev->name);
941 } 770 }
942#if 0
943 e = create_proc_read_entry("cck-registers", S_IFREG | S_IRUGO,
944 priv->dir_dev, proc_get_cck_reg, dev);
945 if (!e) {
946 RT_TRACE(COMP_ERR, "Unable to initialize "
947 "/proc/net/rtl8192/%s/cck-registers\n",
948 dev->name);
949 }
950
951 e = create_proc_read_entry("ofdm-registers", S_IFREG | S_IRUGO,
952 priv->dir_dev, proc_get_ofdm_reg, dev);
953 if (!e) {
954 RT_TRACE(COMP_ERR, "Unable to initialize "
955 "/proc/net/rtl8192/%s/ofdm-registers\n",
956 dev->name);
957 }
958#endif
959} 771}
960/**************************************************************************** 772/****************************************************************************
961 -----------------------------MISC STUFF------------------------- 773 -----------------------------MISC STUFF-------------------------
@@ -994,11 +806,7 @@ void tx_timeout(struct net_device *dev)
994 struct r8192_priv *priv = ieee80211_priv(dev); 806 struct r8192_priv *priv = ieee80211_priv(dev);
995 //rtl8192_commit(dev); 807 //rtl8192_commit(dev);
996 808
997#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
998 schedule_work(&priv->reset_wq); 809 schedule_work(&priv->reset_wq);
999#else
1000 schedule_task(&priv->reset_wq);
1001#endif
1002 //DMESG("TXTIMEOUT"); 810 //DMESG("TXTIMEOUT");
1003} 811}
1004 812
@@ -1033,30 +841,6 @@ void rtl8192_dump_reg(struct net_device *dev)
1033 ------------------------------HW STUFF--------------------------- 841 ------------------------------HW STUFF---------------------------
1034*****************************************************************************/ 842*****************************************************************************/
1035 843
1036#if 0
1037void rtl8192_irq_enable(struct net_device *dev)
1038{
1039 struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
1040 //priv->irq_enabled = 1;
1041/*
1042 write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
1043 INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
1044 INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
1045 INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
1046*/
1047 write_nic_word(dev,INTA_MASK, priv->irq_mask);
1048}
1049
1050
1051void rtl8192_irq_disable(struct net_device *dev)
1052{
1053// struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
1054
1055 write_nic_word(dev,INTA_MASK,0);
1056 force_pci_posting(dev);
1057// priv->irq_enabled = 0;
1058}
1059#endif
1060 844
1061void rtl8192_set_mode(struct net_device *dev,int mode) 845void rtl8192_set_mode(struct net_device *dev,int mode)
1062{ 846{
@@ -1104,15 +888,6 @@ void rtl8192_set_chan(struct net_device *dev,short ch)
1104// u32 tx; 888// u32 tx;
1105 RT_TRACE(COMP_CH, "=====>%s()====ch:%d\n", __FUNCTION__, ch); 889 RT_TRACE(COMP_CH, "=====>%s()====ch:%d\n", __FUNCTION__, ch);
1106 priv->chan=ch; 890 priv->chan=ch;
1107 #if 0
1108 if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
1109 priv->ieee80211->iw_mode == IW_MODE_MASTER){
1110
1111 priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
1112 priv->ieee80211->master_chan = ch;
1113 rtl8192_update_beacon_ch(dev);
1114 }
1115 #endif
1116 891
1117 /* this hack should avoid frame TX during channel setting*/ 892 /* this hack should avoid frame TX during channel setting*/
1118 893
@@ -1132,11 +907,7 @@ void rtl8192_set_chan(struct net_device *dev,short ch)
1132#endif 907#endif
1133} 908}
1134 909
1135#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
1136static void rtl8192_rx_isr(struct urb *urb, struct pt_regs *regs);
1137#else
1138static void rtl8192_rx_isr(struct urb *urb); 910static void rtl8192_rx_isr(struct urb *urb);
1139#endif
1140//static void rtl8192_rx_isr(struct urb *rx_urb); 911//static void rtl8192_rx_isr(struct urb *rx_urb);
1141 912
1142u32 get_rxpacket_shiftbytes_819xusb(struct ieee80211_rx_stats *pstats) 913u32 get_rxpacket_shiftbytes_819xusb(struct ieee80211_rx_stats *pstats)
@@ -1164,11 +935,7 @@ static int rtl8192_rx_initiate(struct net_device*dev)
1164 skb = __dev_alloc_skb(RX_URB_SIZE, GFP_KERNEL); 935 skb = __dev_alloc_skb(RX_URB_SIZE, GFP_KERNEL);
1165 if (!skb) 936 if (!skb)
1166 break; 937 break;
1167#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1168 entry = usb_alloc_urb(0, GFP_KERNEL); 938 entry = usb_alloc_urb(0, GFP_KERNEL);
1169#else
1170 entry = usb_alloc_urb(0);
1171#endif
1172 if (!entry) { 939 if (!entry) {
1173 kfree_skb(skb); 940 kfree_skb(skb);
1174 break; 941 break;
@@ -1191,11 +958,7 @@ static int rtl8192_rx_initiate(struct net_device*dev)
1191 skb = __dev_alloc_skb(RX_URB_SIZE ,GFP_KERNEL); 958 skb = __dev_alloc_skb(RX_URB_SIZE ,GFP_KERNEL);
1192 if (!skb) 959 if (!skb)
1193 break; 960 break;
1194#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1195 entry = usb_alloc_urb(0, GFP_KERNEL); 961 entry = usb_alloc_urb(0, GFP_KERNEL);
1196#else
1197 entry = usb_alloc_urb(0);
1198#endif
1199 if (!entry) { 962 if (!entry) {
1200 kfree_skb(skb); 963 kfree_skb(skb);
1201 break; 964 break;
@@ -1277,106 +1040,14 @@ void rtl8192_rx_enable(struct net_device *dev)
1277 rtl8192_rx_initiate(dev); 1040 rtl8192_rx_initiate(dev);
1278 1041
1279// rtl8192_set_rxconf(dev); 1042// rtl8192_set_rxconf(dev);
1280#if 0
1281 if(NIC_8187 == priv->card_8187) {
1282 cmd=read_nic_byte(dev,CMD);
1283 write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
1284 }
1285 else {
1286 //write_nic_dword(dev, RX_CONF, priv->ReceiveConfig);
1287 }
1288#endif
1289} 1043}
1290 1044
1291 1045
1292void rtl8192_tx_enable(struct net_device *dev) 1046void rtl8192_tx_enable(struct net_device *dev)
1293{ 1047{
1294#if 0
1295 u8 cmd;
1296 u8 byte;
1297 u32 txconf;
1298 struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
1299 //test loopback
1300 // priv->TransmitConfig |= (TX_LOOPBACK_BASEBAND<<TX_LOOPBACK_SHIFT);
1301 if(NIC_8187B == priv->card_8187){
1302 write_nic_dword(dev, TX_CONF, priv->TransmitConfig);
1303 byte = read_nic_byte(dev, MSR);
1304 byte |= MSR_LINK_ENEDCA;
1305 write_nic_byte(dev, MSR, byte);
1306 } else {
1307 byte = read_nic_byte(dev,CW_CONF);
1308 byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
1309 byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
1310 write_nic_byte(dev, CW_CONF, byte);
1311
1312 byte = read_nic_byte(dev, TX_AGC_CTL);
1313 byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
1314 byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
1315 byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT);
1316 write_nic_byte(dev, TX_AGC_CTL, byte);
1317
1318 txconf= read_nic_dword(dev,TX_CONF);
1319
1320
1321 txconf = txconf &~ TX_LOOPBACK_MASK;
1322
1323#ifndef LOOP_TEST
1324 txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
1325#else
1326 txconf = txconf | (TX_LOOPBACK_BASEBAND<<TX_LOOPBACK_SHIFT);
1327#endif
1328 txconf = txconf &~ TCR_SRL_MASK;
1329 txconf = txconf &~ TCR_LRL_MASK;
1330
1331 txconf = txconf | (priv->retry_data<<TX_LRLRETRY_SHIFT); // long
1332 txconf = txconf | (priv->retry_rts<<TX_SRLRETRY_SHIFT); // short
1333
1334 txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
1335
1336 txconf = txconf &~ TCR_MXDMA_MASK;
1337 txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
1338
1339 txconf = txconf | TCR_DISReqQsize;
1340 txconf = txconf | TCR_DISCW;
1341 txconf = txconf &~ TCR_SWPLCPLEN;
1342
1343 txconf=txconf | (1<<TX_NOICV_SHIFT);
1344
1345 write_nic_dword(dev,TX_CONF,txconf);
1346
1347#ifdef DEBUG_TX
1348 DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF));
1349#endif
1350
1351 cmd=read_nic_byte(dev,CMD);
1352 write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
1353 }
1354#endif
1355}
1356
1357#if 0
1358void rtl8192_beacon_tx_enable(struct net_device *dev)
1359{
1360 struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
1361 priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
1362 rtl8192_set_mode(dev,EPROM_CMD_CONFIG);
1363 write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
1364 rtl8192_set_mode(dev,EPROM_CMD_NORMAL);
1365} 1048}
1366 1049
1367 1050
1368void rtl8192_
1369_disable(struct net_device *dev)
1370{
1371 struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
1372 priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
1373 rtl8192_set_mode(dev,EPROM_CMD_CONFIG);
1374 write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
1375 rtl8192_set_mode(dev,EPROM_CMD_NORMAL);
1376}
1377
1378#endif
1379
1380 1051
1381void rtl8192_rtx_disable(struct net_device *dev) 1052void rtl8192_rtx_disable(struct net_device *dev)
1382{ 1053{
@@ -1411,91 +1082,9 @@ void rtl8192_rtx_disable(struct net_device *dev)
1411 1082
1412int alloc_tx_beacon_desc_ring(struct net_device *dev, int count) 1083int alloc_tx_beacon_desc_ring(struct net_device *dev, int count)
1413{ 1084{
1414 #if 0
1415 int i;
1416 u32 *tmp;
1417 struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
1418
1419 priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
1420 sizeof(u32)*8*count,
1421 &priv->txbeaconringdma);
1422 if (!priv->txbeaconring) return -1;
1423 for (tmp=priv->txbeaconring,i=0;i<count;i++){
1424 *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
1425 /*
1426 *(tmp+2) = (u32)dma_tmp;
1427 *(tmp+3) = bufsize;
1428 */
1429 if(i+1<count)
1430 *(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
1431 else
1432 *(tmp+4) = (u32)priv->txbeaconringdma;
1433
1434 tmp=tmp+8;
1435 }
1436 #endif
1437 return 0; 1085 return 0;
1438} 1086}
1439 1087
1440#if 0
1441void rtl8192_reset(struct net_device *dev)
1442{
1443
1444 //struct r8192_priv *priv = ieee80211_priv(dev);
1445 //u8 cr;
1446
1447
1448 /* make sure the analog power is on before
1449 * reset, otherwise reset may fail
1450 */
1451#if 0
1452 if(NIC_8187 == priv->card_8187) {
1453 rtl8192_set_anaparam(dev, RTL8225_ANAPARAM_ON);
1454 rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
1455 rtl8192_irq_disable(dev);
1456 mdelay(200);
1457 write_nic_byte_E(dev,0x18,0x10);
1458 write_nic_byte_E(dev,0x18,0x11);
1459 write_nic_byte_E(dev,0x18,0x00);
1460 mdelay(200);
1461 }
1462#endif
1463 printk("=====>reset?\n");
1464#if 0
1465 cr=read_nic_byte(dev,CMD);
1466 cr = cr & 2;
1467 cr = cr | (1<<CMD_RST_SHIFT);
1468 write_nic_byte(dev,CMD,cr);
1469
1470 force_pci_posting(dev);
1471
1472 mdelay(200);
1473
1474 if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
1475 RT_TRACE(COMP_ERR, "Card reset timeout!\n");
1476 else
1477 RT_TRACE(COMP_DOWN, "Card successfully reset\n");
1478#endif
1479#if 0
1480 if(NIC_8187 == priv->card_8187) {
1481
1482 printk("This is RTL8187 Reset procedure\n");
1483 rtl8192_set_mode(dev,EPROM_CMD_LOAD);
1484 force_pci_posting(dev);
1485 mdelay(200);
1486
1487 /* after the eeprom load cycle, make sure we have
1488 * correct anaparams
1489 */
1490 rtl8192_set_anaparam(dev, RTL8225_ANAPARAM_ON);
1491 rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
1492 }
1493 else
1494#endif
1495 printk("This is RTL8187B Reset procedure\n");
1496
1497}
1498#endif
1499inline u16 ieeerate2rtlrate(int rate) 1088inline u16 ieeerate2rtlrate(int rate)
1500{ 1089{
1501 switch(rate){ 1090 switch(rate){
@@ -1537,11 +1126,7 @@ inline u16 rtl8192_rate2rate(short rate)
1537 1126
1538 1127
1539/* The protype of rx_isr has changed since one verion of Linux Kernel */ 1128/* The protype of rx_isr has changed since one verion of Linux Kernel */
1540#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
1541static void rtl8192_rx_isr(struct urb *urb, struct pt_regs *regs)
1542#else
1543static void rtl8192_rx_isr(struct urb *urb) 1129static void rtl8192_rx_isr(struct urb *urb)
1544#endif
1545{ 1130{
1546 struct sk_buff *skb = (struct sk_buff *) urb->context; 1131 struct sk_buff *skb = (struct sk_buff *) urb->context;
1547 struct rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb; 1132 struct rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb;
@@ -1559,11 +1144,7 @@ static void rtl8192_rx_isr(struct urb *urb)
1559 // printk("%s():rx status err\n",__FUNCTION__); 1144 // printk("%s():rx status err\n",__FUNCTION__);
1560 return; 1145 return;
1561 } 1146 }
1562#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
1563 skb_unlink(skb, &priv->rx_queue); 1147 skb_unlink(skb, &priv->rx_queue);
1564#else
1565 __skb_unlink(skb,&priv->rx_queue);
1566#endif
1567 skb_put(skb, urb->actual_length); 1148 skb_put(skb, urb->actual_length);
1568 1149
1569 skb_queue_tail(&priv->skb_queue, skb); 1150 skb_queue_tail(&priv->skb_queue, skb);
@@ -1618,44 +1199,16 @@ rtl819xusb_rx_command_packet(
1618 return status; 1199 return status;
1619} 1200}
1620 1201
1621#if 0
1622void rtl8192_tx_queues_stop(struct net_device *dev)
1623{
1624 //struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
1625 u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
1626 dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
1627 dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
1628 dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
1629
1630 rtl8192_set_mode(dev,EPROM_CMD_CONFIG);
1631 write_nic_byte(dev,TX_DMA_POLLING,dma_poll_mask);
1632 rtl8192_set_mode(dev,EPROM_CMD_NORMAL);
1633}
1634#endif
1635 1202
1636void rtl8192_data_hard_stop(struct net_device *dev) 1203void rtl8192_data_hard_stop(struct net_device *dev)
1637{ 1204{
1638 //FIXME !! 1205 //FIXME !!
1639 #if 0
1640 struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
1641 priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
1642 rtl8192_set_mode(dev,EPROM_CMD_CONFIG);
1643 write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
1644 rtl8192_set_mode(dev,EPROM_CMD_NORMAL);
1645 #endif
1646} 1206}
1647 1207
1648 1208
1649void rtl8192_data_hard_resume(struct net_device *dev) 1209void rtl8192_data_hard_resume(struct net_device *dev)
1650{ 1210{
1651 // FIXME !! 1211 // FIXME !!
1652 #if 0
1653 struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
1654 priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
1655 rtl8192_set_mode(dev,EPROM_CMD_CONFIG);
1656 write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
1657 rtl8192_set_mode(dev,EPROM_CMD_NORMAL);
1658 #endif
1659} 1212}
1660 1213
1661/* this function TX data frames when the ieee80211 stack requires this. 1214/* this function TX data frames when the ieee80211 stack requires this.
@@ -1739,11 +1292,7 @@ u8 QueryIsShort(u8 TxHT, u8 TxRate, cb_desc *tcb_desc);
1739u8 MapHwQueueToFirmwareQueue(u8 QueueID); 1292u8 MapHwQueueToFirmwareQueue(u8 QueueID);
1740struct sk_buff *DrvAggr_Aggregation(struct net_device *dev, struct ieee80211_drv_agg_txb *pSendList) 1293struct sk_buff *DrvAggr_Aggregation(struct net_device *dev, struct ieee80211_drv_agg_txb *pSendList)
1741{ 1294{
1742#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
1743 struct ieee80211_device *ieee = netdev_priv(dev); 1295 struct ieee80211_device *ieee = netdev_priv(dev);
1744#else
1745 struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv;
1746#endif
1747 struct r8192_priv *priv = ieee80211_priv(dev); 1296 struct r8192_priv *priv = ieee80211_priv(dev);
1748 cb_desc *tcb_desc = NULL; 1297 cb_desc *tcb_desc = NULL;
1749 u8 i; 1298 u8 i;
@@ -1854,53 +1403,11 @@ struct sk_buff *DrvAggr_Aggregation(struct net_device *dev, struct ieee80211_drv
1854 /*DWORD 1*/ 1403 /*DWORD 1*/
1855 tx_agg_desc->SecCAMID= 0; 1404 tx_agg_desc->SecCAMID= 0;
1856 tx_agg_desc->RATid = tcb_desc->RATRIndex; 1405 tx_agg_desc->RATid = tcb_desc->RATRIndex;
1857#if 0
1858 /* Fill security related */
1859 if( pTcb->bEncrypt && !Adapter->MgntInfo.SecurityInfo.SWTxEncryptFlag)
1860 {
1861 EncAlg = SecGetEncryptionOverhead(
1862 Adapter,
1863 &EncryptionMPDUHeadOverhead,
1864 &EncryptionMPDUTailOverhead,
1865 NULL,
1866 NULL,
1867 FALSE,
1868 FALSE);
1869 //2004/07/22, kcwu, EncryptionMPDUHeadOverhead has been added in previous code
1870 //MPDUOverhead = EncryptionMPDUHeadOverhead + EncryptionMPDUTailOverhead;
1871 MPDUOverhead = EncryptionMPDUTailOverhead;
1872 tx_agg_desc->NoEnc = 0;
1873 RT_TRACE(COMP_SEC, DBG_LOUD, ("******We in the loop SecCAMID is %d SecDescAssign is %d The Sec is %d********\n",tx_agg_desc->SecCAMID,tx_agg_desc->SecDescAssign,EncAlg));
1874 //CamDumpAll(Adapter);
1875 }
1876 else
1877#endif
1878 { 1406 {
1879 //MPDUOverhead = 0; 1407 //MPDUOverhead = 0;
1880 tx_agg_desc->NoEnc = 1; 1408 tx_agg_desc->NoEnc = 1;
1881 } 1409 }
1882#if 0
1883 switch(EncAlg){
1884 case NO_Encryption:
1885 tx_agg_desc->SecType = 0x0;
1886 break;
1887 case WEP40_Encryption:
1888 case WEP104_Encryption:
1889 tx_agg_desc->SecType = 0x1;
1890 break;
1891 case TKIP_Encryption:
1892 tx_agg_desc->SecType = 0x2;
1893 break;
1894 case AESCCMP_Encryption:
1895 tx_agg_desc->SecType = 0x3;
1896 break;
1897 default:
1898 tx_agg_desc->SecType = 0x0;
1899 break;
1900 }
1901#else
1902 tx_agg_desc->SecType = 0x0; 1410 tx_agg_desc->SecType = 0x0;
1903#endif
1904 1411
1905 if (tcb_desc->bHwSec) { 1412 if (tcb_desc->bHwSec) {
1906 switch (priv->ieee80211->pairwise_key_type) 1413 switch (priv->ieee80211->pairwise_key_type)
@@ -1956,11 +1463,7 @@ struct sk_buff *DrvAggr_Aggregation(struct net_device *dev, struct ieee80211_drv
1956u8 DrvAggr_GetAggregatibleList(struct net_device *dev, struct sk_buff *skb, 1463u8 DrvAggr_GetAggregatibleList(struct net_device *dev, struct sk_buff *skb,
1957 struct ieee80211_drv_agg_txb *pSendList) 1464 struct ieee80211_drv_agg_txb *pSendList)
1958{ 1465{
1959#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
1960 struct ieee80211_device *ieee = netdev_priv(dev); 1466 struct ieee80211_device *ieee = netdev_priv(dev);
1961#else
1962 struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv;
1963#endif
1964 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; 1467 PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
1965 u16 nMaxAggrNum = pHTInfo->UsbTxAggrNum; 1468 u16 nMaxAggrNum = pHTInfo->UsbTxAggrNum;
1966 cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); 1469 cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
@@ -1979,11 +1482,7 @@ u8 DrvAggr_GetAggregatibleList(struct net_device *dev, struct sk_buff *skb,
1979} 1482}
1980#endif 1483#endif
1981 1484
1982#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
1983static void rtl8192_tx_isr(struct urb *tx_urb, struct pt_regs *reg)
1984#else
1985static void rtl8192_tx_isr(struct urb *tx_urb) 1485static void rtl8192_tx_isr(struct urb *tx_urb)
1986#endif
1987{ 1486{
1988 struct sk_buff *skb = (struct sk_buff*)tx_urb->context; 1487 struct sk_buff *skb = (struct sk_buff*)tx_urb->context;
1989 struct net_device *dev = NULL; 1488 struct net_device *dev = NULL;
@@ -2019,29 +1518,11 @@ static void rtl8192_tx_isr(struct urb *tx_urb)
2019 atomic_dec(&priv->tx_pending[queue_index]); 1518 atomic_dec(&priv->tx_pending[queue_index]);
2020 } 1519 }
2021 1520
2022#if 0 //we need to send zero byte packet just after 512 byte(64 byte)packet is transmitted, or we will halt. It will greatly reduced available page in FW, and ruin our throughput. WB 2008.08.27
2023 if(BufLen > 0 && ((BufLen % 512 == 0)||(BufLen % 64 == 0))) {
2024 bToSend0Byte = true;
2025 }
2026
2027 bToSend0Byte = false;
2028 //
2029 // Note that, we at most handle 1 MPDU to send here, either
2030 // fragment or MPDU in wait queue.
2031 //
2032 if(!bToSend0Byte)
2033#endif
2034 { 1521 {
2035 // 1522 //
2036 // Handle HW Beacon: 1523 // Handle HW Beacon:
2037 // We had transfer our beacon frame to host controler at this moment. 1524 // We had transfer our beacon frame to host controler at this moment.
2038 // 1525 //
2039#if 0
2040 if(tcb_desc->tx_queue == BEACON_QUEUE)
2041 {
2042 priv->bSendingBeacon = FALSE;
2043 }
2044#endif
2045 // 1526 //
2046 // Caution: 1527 // Caution:
2047 // Handling the wait queue of command packets. 1528 // Handling the wait queue of command packets.
@@ -2095,12 +1576,6 @@ static void rtl8192_tx_isr(struct urb *tx_urb)
2095 if(DrvAggr_GetAggregatibleList(dev, skb, &SendList) > 1) { 1576 if(DrvAggr_GetAggregatibleList(dev, skb, &SendList) > 1) {
2096 skb = DrvAggr_Aggregation(dev, &SendList); 1577 skb = DrvAggr_Aggregation(dev, &SendList);
2097 1578
2098#if 0
2099 printk("=============>to send aggregated packet!\n");
2100 RT_DEBUG_DATA(COMP_SEND, skb->cb, sizeof(skb->cb));
2101 printk("\n=================skb->len = %d\n", skb->len);
2102 RT_DEBUG_DATA(COMP_SEND, skb->data, skb->len);
2103#endif
2104 } 1579 }
2105 } 1580 }
2106 priv->ieee80211->softmac_hard_start_xmit(skb, dev); 1581 priv->ieee80211->softmac_hard_start_xmit(skb, dev);
@@ -2110,23 +1585,6 @@ static void rtl8192_tx_isr(struct urb *tx_urb)
2110 } 1585 }
2111 } 1586 }
2112 1587
2113#if 0
2114 else
2115 {
2116 RT_TRACE( COMP_SEND,"HalUsbOutComplete(%d): bToSend0Byte.\n", PipeIndex);
2117
2118 //
2119 // In this case, we don't return skb now.
2120 // It will be returned when the 0-byte request completed.
2121 //
2122
2123 //
2124 // Bulk out an 0-byte padding transfer.
2125 //
2126 HalUsbOut0Byte(pAdapter, PipeIndex, skb);
2127 }
2128
2129#endif
2130} 1588}
2131 1589
2132void rtl8192_beacon_stop(struct net_device *dev) 1590void rtl8192_beacon_stop(struct net_device *dev)
@@ -2264,46 +1722,10 @@ void rtl8192_net_update(struct net_device *dev)
2264 1722
2265//temporary hw beacon is not used any more. 1723//temporary hw beacon is not used any more.
2266//open it when necessary 1724//open it when necessary
2267#if 1
2268void rtl819xusb_beacon_tx(struct net_device *dev,u16 tx_rate) 1725void rtl819xusb_beacon_tx(struct net_device *dev,u16 tx_rate)
2269{ 1726{
2270 1727
2271#if 0
2272 struct r8192_priv *priv = ieee80211_priv(dev);
2273 struct sk_buff *skb;
2274 int i = 0;
2275 //u8 cr;
2276
2277 rtl8192_net_update(dev);
2278
2279 skb = ieee80211_get_beacon(priv->ieee80211);
2280 if(!skb){
2281 DMESG("not enought memory for allocating beacon");
2282 return;
2283 }
2284
2285
2286 write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7));
2287
2288 i=0;
2289 //while(!read_nic_byte(dev,BQREQ & (1<<7)))
2290 while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 )
2291 {
2292 msleep_interruptible_rtl(HZ/2);
2293 if(i++ > 10){
2294 DMESGW("get stuck to wait HW beacon to be ready");
2295 return ;
2296 }
2297 }
2298 skb->cb[0] = NORM_PRIORITY;
2299 skb->cb[1] = 0; //morefragment = 0
2300 skb->cb[2] = ieeerate2rtlrate(tx_rate);
2301
2302 rtl8192_tx(dev,skb);
2303
2304#endif
2305} 1728}
2306#endif
2307inline u8 rtl8192_IsWirelessBMode(u16 rate) 1729inline u8 rtl8192_IsWirelessBMode(u16 rate)
2308{ 1730{
2309 if( ((rate <= 110) && (rate != 60) && (rate != 90)) || (rate == 220) ) 1731 if( ((rate <= 110) && (rate != 60) && (rate != 90)) || (rate == 220) )
@@ -2392,38 +1814,6 @@ u16 N_DBPSOfRate(u16 DataRate)
2392 1814
2393void rtl819xU_cmd_isr(struct urb *tx_cmd_urb, struct pt_regs *regs) 1815void rtl819xU_cmd_isr(struct urb *tx_cmd_urb, struct pt_regs *regs)
2394{ 1816{
2395#if 0
2396 struct net_device *dev = (struct net_device*)tx_cmd_urb->context;
2397 struct r8192_priv *priv = ieee80211_priv(dev);
2398 int last_init_packet = 0;
2399 u8 *ptr_cmd_buf;
2400 u16 cmd_buf_len;
2401
2402 if(tx_cmd_urb->status != 0) {
2403 priv->pFirmware.firmware_seg_index = 0; //only begin transter, should it can be set to 1
2404 }
2405
2406 /* Free the urb and the corresponding buf for common Tx cmd packet, or
2407 * last segment of each firmware img.
2408 */
2409 if((priv->pFirmware.firmware_seg_index == 0) ||(priv->pFirmware.firmware_seg_index == priv->pFirmware.firmware_seg_maxnum)) {
2410 priv->pFirmware.firmware_seg_index = 0;//only begin transter, should it can be set to 1
2411 } else {
2412 /* prepare for last transfer */
2413 /* update some infomation for */
2414 /* last segment of the firmware img need indicate to device */
2415 priv->pFirmware.firmware_seg_index++;
2416 if(priv->pFirmware.firmware_seg_index == priv->pFirmware.firmware_seg_maxnum) {
2417 last_init_packet = 1;
2418 }
2419
2420 cmd_buf_len = priv->pFirmware.firmware_seg_container[priv->pFirmware.firmware_seg_index-1].seg_size;
2421 ptr_cmd_buf = priv->pFfirmware.firmware_seg_container[priv->pFfirmware.firmware_seg_index-1].seg_ptr;
2422 rtl819xU_tx_cmd(dev, ptr_cmd_buf, cmd_buf_len, last_init_packet, DESC_PACKET_TYPE_INIT);
2423 }
2424
2425 kfree(tx_cmd_urb->transfer_buffer);
2426#endif
2427 usb_free_urb(tx_cmd_urb); 1817 usb_free_urb(tx_cmd_urb);
2428} 1818}
2429 1819
@@ -2451,11 +1841,7 @@ short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb)
2451 1841
2452 //printk("\n %s::queue_index = %d\n",__FUNCTION__, queue_index); 1842 //printk("\n %s::queue_index = %d\n",__FUNCTION__, queue_index);
2453 atomic_inc(&priv->tx_pending[queue_index]); 1843 atomic_inc(&priv->tx_pending[queue_index]);
2454#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2455 tx_urb = usb_alloc_urb(0,GFP_ATOMIC); 1844 tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
2456#else
2457 tx_urb = usb_alloc_urb(0);
2458#endif
2459 if(!tx_urb){ 1845 if(!tx_urb){
2460 dev_kfree_skb(skb); 1846 dev_kfree_skb(skb);
2461 return -ENOMEM; 1847 return -ENOMEM;
@@ -2489,11 +1875,7 @@ short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb)
2489 usb_fill_bulk_urb(tx_urb,priv->udev, usb_sndbulkpipe(priv->udev,idx_pipe), \ 1875 usb_fill_bulk_urb(tx_urb,priv->udev, usb_sndbulkpipe(priv->udev,idx_pipe), \
2490 skb->data, skb->len, rtl8192_tx_isr, skb); 1876 skb->data, skb->len, rtl8192_tx_isr, skb);
2491 1877
2492#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2493 status = usb_submit_urb(tx_urb, GFP_ATOMIC); 1878 status = usb_submit_urb(tx_urb, GFP_ATOMIC);
2494#else
2495 status = usb_submit_urb(tx_urb);
2496#endif
2497 1879
2498 if (!status){ 1880 if (!status){
2499 return 0; 1881 return 0;
@@ -2612,11 +1994,7 @@ u8 QueryIsShort(u8 TxHT, u8 TxRate, cb_desc *tcb_desc)
2612 return tmp_Short; 1994 return tmp_Short;
2613} 1995}
2614 1996
2615#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
2616static void tx_zero_isr(struct urb *tx_urb, struct pt_regs *reg)
2617#else
2618static void tx_zero_isr(struct urb *tx_urb) 1997static void tx_zero_isr(struct urb *tx_urb)
2619#endif
2620{ 1998{
2621 return; 1999 return;
2622} 2000}
@@ -2639,10 +2017,6 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb)
2639 //int urb_len; 2017 //int urb_len;
2640 unsigned int idx_pipe; 2018 unsigned int idx_pipe;
2641// RT_DEBUG_DATA(COMP_SEND, tcb_desc, sizeof(cb_desc)); 2019// RT_DEBUG_DATA(COMP_SEND, tcb_desc, sizeof(cb_desc));
2642#if 0
2643 /* Added by Annie for filling Len_Adjust field. 2005-12-14. */
2644 RT_ENC_ALG EncAlg = NO_Encryption;
2645#endif
2646// printk("=============> %s\n", __FUNCTION__); 2020// printk("=============> %s\n", __FUNCTION__);
2647 pend = atomic_read(&priv->tx_pending[tcb_desc->queue_index]); 2021 pend = atomic_read(&priv->tx_pending[tcb_desc->queue_index]);
2648 /* we are locked here so the two atomic_read and inc are executed 2022 /* we are locked here so the two atomic_read and inc are executed
@@ -2650,32 +2024,12 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb)
2650 * !!! For debug purpose 2024 * !!! For debug purpose
2651 */ 2025 */
2652 if( pend > MAX_TX_URB){ 2026 if( pend > MAX_TX_URB){
2653#if 0
2654 switch (tcb_desc->queue_index) {
2655 case VO_PRIORITY:
2656 priv->stats.txvodrop++;
2657 break;
2658 case VI_PRIORITY:
2659 priv->stats.txvidrop++;
2660 break;
2661 case BE_PRIORITY:
2662 priv->stats.txbedrop++;
2663 break;
2664 default://BK_PRIORITY
2665 priv->stats.txbkdrop++;
2666 break;
2667 }
2668#endif
2669 printk("To discard skb packet!\n"); 2027 printk("To discard skb packet!\n");
2670 dev_kfree_skb_any(skb); 2028 dev_kfree_skb_any(skb);
2671 return -1; 2029 return -1;
2672 } 2030 }
2673 2031
2674#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2675 tx_urb = usb_alloc_urb(0,GFP_ATOMIC); 2032 tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
2676#else
2677 tx_urb = usb_alloc_urb(0);
2678#endif
2679 if(!tx_urb){ 2033 if(!tx_urb){
2680 dev_kfree_skb_any(skb); 2034 dev_kfree_skb_any(skb);
2681 return -ENOMEM; 2035 return -ENOMEM;
@@ -2751,53 +2105,11 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb)
2751 /*DWORD 1*/ 2105 /*DWORD 1*/
2752 tx_desc->SecCAMID= 0; 2106 tx_desc->SecCAMID= 0;
2753 tx_desc->RATid = tcb_desc->RATRIndex; 2107 tx_desc->RATid = tcb_desc->RATRIndex;
2754#if 0
2755 /* Fill security related */
2756 if( pTcb->bEncrypt && !Adapter->MgntInfo.SecurityInfo.SWTxEncryptFlag)
2757 {
2758 EncAlg = SecGetEncryptionOverhead(
2759 Adapter,
2760 &EncryptionMPDUHeadOverhead,
2761 &EncryptionMPDUTailOverhead,
2762 NULL,
2763 NULL,
2764 FALSE,
2765 FALSE);
2766 //2004/07/22, kcwu, EncryptionMPDUHeadOverhead has been added in previous code
2767 //MPDUOverhead = EncryptionMPDUHeadOverhead + EncryptionMPDUTailOverhead;
2768 MPDUOverhead = EncryptionMPDUTailOverhead;
2769 tx_desc->NoEnc = 0;
2770 RT_TRACE(COMP_SEC, DBG_LOUD, ("******We in the loop SecCAMID is %d SecDescAssign is %d The Sec is %d********\n",tx_desc->SecCAMID,tx_desc->SecDescAssign,EncAlg));
2771 //CamDumpAll(Adapter);
2772 }
2773 else
2774#endif
2775 { 2108 {
2776 //MPDUOverhead = 0; 2109 //MPDUOverhead = 0;
2777 tx_desc->NoEnc = 1; 2110 tx_desc->NoEnc = 1;
2778 } 2111 }
2779#if 0
2780 switch(EncAlg){
2781 case NO_Encryption:
2782 tx_desc->SecType = 0x0;
2783 break;
2784 case WEP40_Encryption:
2785 case WEP104_Encryption:
2786 tx_desc->SecType = 0x1;
2787 break;
2788 case TKIP_Encryption:
2789 tx_desc->SecType = 0x2;
2790 break;
2791 case AESCCMP_Encryption:
2792 tx_desc->SecType = 0x3;
2793 break;
2794 default:
2795 tx_desc->SecType = 0x0;
2796 break;
2797 }
2798#else
2799 tx_desc->SecType = 0x0; 2112 tx_desc->SecType = 0x0;
2800#endif
2801 if (tcb_desc->bHwSec) 2113 if (tcb_desc->bHwSec)
2802 { 2114 {
2803 switch (priv->ieee80211->pairwise_key_type) 2115 switch (priv->ieee80211->pairwise_key_type)
@@ -2830,13 +2142,8 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb)
2830 2142
2831 /* Fill fields that are required to be initialized in all of the descriptors */ 2143 /* Fill fields that are required to be initialized in all of the descriptors */
2832 //DWORD 0 2144 //DWORD 0
2833#if 0
2834 tx_desc->FirstSeg = (tcb_desc->bFirstSeg)? 1:0;
2835 tx_desc->LastSeg = (tcb_desc->bLastSeg)?1:0;
2836#else
2837 tx_desc->FirstSeg = 1; 2145 tx_desc->FirstSeg = 1;
2838 tx_desc->LastSeg = 1; 2146 tx_desc->LastSeg = 1;
2839#endif
2840 tx_desc->OWN = 1; 2147 tx_desc->OWN = 1;
2841 2148
2842#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE 2149#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
@@ -2863,11 +2170,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb)
2863 usb_sndbulkpipe(udev,idx_pipe), skb->data, 2170 usb_sndbulkpipe(udev,idx_pipe), skb->data,
2864 skb->len, rtl8192_tx_isr, skb); 2171 skb->len, rtl8192_tx_isr, skb);
2865 2172
2866#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2867 status = usb_submit_urb(tx_urb, GFP_ATOMIC); 2173 status = usb_submit_urb(tx_urb, GFP_ATOMIC);
2868#else
2869 status = usb_submit_urb(tx_urb);
2870#endif
2871 if (!status){ 2174 if (!status){
2872//we need to send 0 byte packet whenever 512N bytes/64N(HIGN SPEED/NORMAL SPEED) bytes packet has been transmitted. Otherwise, it will be halt to wait for another packet. WB. 2008.08.27 2175//we need to send 0 byte packet whenever 512N bytes/64N(HIGN SPEED/NORMAL SPEED) bytes packet has been transmitted. Otherwise, it will be halt to wait for another packet. WB. 2008.08.27
2873 bool bSend0Byte = false; 2176 bool bSend0Byte = false;
@@ -2884,12 +2187,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb)
2884 } 2187 }
2885 if (bSend0Byte) 2188 if (bSend0Byte)
2886 { 2189 {
2887#if 1
2888#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2889 tx_urb_zero = usb_alloc_urb(0,GFP_ATOMIC); 2190 tx_urb_zero = usb_alloc_urb(0,GFP_ATOMIC);
2890#else
2891 tx_urb_zero = usb_alloc_urb(0);
2892#endif
2893 if(!tx_urb_zero){ 2191 if(!tx_urb_zero){
2894 RT_TRACE(COMP_ERR, "can't alloc urb for zero byte\n"); 2192 RT_TRACE(COMP_ERR, "can't alloc urb for zero byte\n");
2895 return -ENOMEM; 2193 return -ENOMEM;
@@ -2897,16 +2195,11 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb)
2897 usb_fill_bulk_urb(tx_urb_zero,udev, 2195 usb_fill_bulk_urb(tx_urb_zero,udev,
2898 usb_sndbulkpipe(udev,idx_pipe), &zero, 2196 usb_sndbulkpipe(udev,idx_pipe), &zero,
2899 0, tx_zero_isr, dev); 2197 0, tx_zero_isr, dev);
2900#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2901 status = usb_submit_urb(tx_urb_zero, GFP_ATOMIC); 2198 status = usb_submit_urb(tx_urb_zero, GFP_ATOMIC);
2902#else
2903 status = usb_submit_urb(tx_urb_zero);
2904#endif
2905 if (status){ 2199 if (status){
2906 RT_TRACE(COMP_ERR, "Error TX URB for zero byte %d, error %d", atomic_read(&priv->tx_pending[tcb_desc->queue_index]), status); 2200 RT_TRACE(COMP_ERR, "Error TX URB for zero byte %d, error %d", atomic_read(&priv->tx_pending[tcb_desc->queue_index]), status);
2907 return -1; 2201 return -1;
2908 } 2202 }
2909#endif
2910 } 2203 }
2911 dev->trans_start = jiffies; 2204 dev->trans_start = jiffies;
2912 atomic_inc(&priv->tx_pending[tcb_desc->queue_index]); 2205 atomic_inc(&priv->tx_pending[tcb_desc->queue_index]);
@@ -2927,11 +2220,7 @@ short rtl8192_usb_initendpoints(struct net_device *dev)
2927#ifndef JACKSON_NEW_RX 2220#ifndef JACKSON_NEW_RX
2928 for(i=0;i<(MAX_RX_URB+1);i++){ 2221 for(i=0;i<(MAX_RX_URB+1);i++){
2929 2222
2930#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2931 priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL); 2223 priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL);
2932#else
2933 priv->rx_urb[i] = usb_alloc_urb(0);
2934#endif
2935 2224
2936 priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL); 2225 priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL);
2937 2226
@@ -3050,44 +2339,6 @@ void rtl8192_usb_deleteendpoints(struct net_device *dev)
3050} 2339}
3051#endif 2340#endif
3052 2341
3053#if 0
3054void rtl8192_set_rate(struct net_device *dev)
3055{
3056 int i;
3057 u16 word;
3058 int basic_rate,min_rr_rate,max_rr_rate;
3059
3060// struct r8192_priv *priv = ieee80211_priv(dev);
3061
3062 //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
3063// priv->ieee80211->state == IEEE80211_LINKED){
3064 basic_rate = ieeerate2rtlrate(240);
3065 min_rr_rate = ieeerate2rtlrate(60);
3066 max_rr_rate = ieeerate2rtlrate(240);
3067
3068//
3069// }else{
3070// basic_rate = ieeerate2rtlrate(20);
3071// min_rr_rate = ieeerate2rtlrate(10);
3072// max_rr_rate = ieeerate2rtlrate(110);
3073// }
3074
3075 write_nic_byte(dev, RESP_RATE,
3076 max_rr_rate<<MAX_RESP_RATE_SHIFT| min_rr_rate<<MIN_RESP_RATE_SHIFT);
3077
3078 //word = read_nic_word(dev, BRSR);
3079 word = read_nic_word(dev, BRSR_8187);
3080 word &= ~BRSR_MBR_8185;
3081
3082
3083 for(i=0;i<=basic_rate;i++)
3084 word |= (1<<i);
3085
3086 //write_nic_word(dev, BRSR, word);
3087 write_nic_word(dev, BRSR_8187, word);
3088 //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
3089}
3090#endif
3091extern void rtl8192_update_ratr_table(struct net_device* dev); 2342extern void rtl8192_update_ratr_table(struct net_device* dev);
3092void rtl8192_link_change(struct net_device *dev) 2343void rtl8192_link_change(struct net_device *dev)
3093{ 2344{
@@ -3100,11 +2351,9 @@ void rtl8192_link_change(struct net_device *dev)
3100 { 2351 {
3101 rtl8192_net_update(dev); 2352 rtl8192_net_update(dev);
3102 rtl8192_update_ratr_table(dev); 2353 rtl8192_update_ratr_table(dev);
3103#if 1
3104 //add this as in pure N mode, wep encryption will use software way, but there is no chance to set this as wep will not set group key in wext. WB.2008.07.08 2354 //add this as in pure N mode, wep encryption will use software way, but there is no chance to set this as wep will not set group key in wext. WB.2008.07.08
3105 if ((KEY_TYPE_WEP40 == ieee->pairwise_key_type) || (KEY_TYPE_WEP104 == ieee->pairwise_key_type)) 2355 if ((KEY_TYPE_WEP40 == ieee->pairwise_key_type) || (KEY_TYPE_WEP104 == ieee->pairwise_key_type))
3106 EnableHWSecurityConfig8192(dev); 2356 EnableHWSecurityConfig8192(dev);
3107#endif
3108 } 2357 }
3109 /*update timing params*/ 2358 /*update timing params*/
3110// RT_TRACE(COMP_CH, "========>%s(), chan:%d\n", __FUNCTION__, priv->chan); 2359// RT_TRACE(COMP_CH, "========>%s(), chan:%d\n", __FUNCTION__, priv->chan);
@@ -3132,16 +2381,10 @@ static struct ieee80211_qos_parameters def_qos_parameters = {
3132}; 2381};
3133 2382
3134 2383
3135#if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,20)
3136void rtl8192_update_beacon(struct work_struct * work) 2384void rtl8192_update_beacon(struct work_struct * work)
3137{ 2385{
3138 struct r8192_priv *priv = container_of(work, struct r8192_priv, update_beacon_wq.work); 2386 struct r8192_priv *priv = container_of(work, struct r8192_priv, update_beacon_wq.work);
3139 struct net_device *dev = priv->ieee80211->dev; 2387 struct net_device *dev = priv->ieee80211->dev;
3140#else
3141void rtl8192_update_beacon(struct net_device *dev)
3142{
3143 struct r8192_priv *priv = ieee80211_priv(dev);
3144#endif
3145 struct ieee80211_device* ieee = priv->ieee80211; 2388 struct ieee80211_device* ieee = priv->ieee80211;
3146 struct ieee80211_network* net = &ieee->current_network; 2389 struct ieee80211_network* net = &ieee->current_network;
3147 2390
@@ -3154,16 +2397,10 @@ void rtl8192_update_beacon(struct net_device *dev)
3154* background support to run QoS activate functionality 2397* background support to run QoS activate functionality
3155*/ 2398*/
3156int WDCAPARA_ADD[] = {EDCAPARA_BE,EDCAPARA_BK,EDCAPARA_VI,EDCAPARA_VO}; 2399int WDCAPARA_ADD[] = {EDCAPARA_BE,EDCAPARA_BK,EDCAPARA_VI,EDCAPARA_VO};
3157#if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,20)
3158void rtl8192_qos_activate(struct work_struct * work) 2400void rtl8192_qos_activate(struct work_struct * work)
3159{ 2401{
3160 struct r8192_priv *priv = container_of(work, struct r8192_priv, qos_activate); 2402 struct r8192_priv *priv = container_of(work, struct r8192_priv, qos_activate);
3161 struct net_device *dev = priv->ieee80211->dev; 2403 struct net_device *dev = priv->ieee80211->dev;
3162#else
3163void rtl8192_qos_activate(struct net_device *dev)
3164{
3165 struct r8192_priv *priv = ieee80211_priv(dev);
3166#endif
3167 struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters; 2404 struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters;
3168 u8 mode = priv->ieee80211->current_network.mode; 2405 u8 mode = priv->ieee80211->current_network.mode;
3169 //u32 size = sizeof(struct ieee80211_qos_parameters); 2406 //u32 size = sizeof(struct ieee80211_qos_parameters);
@@ -3174,11 +2411,7 @@ void rtl8192_qos_activate(struct net_device *dev)
3174 if (priv == NULL) 2411 if (priv == NULL)
3175 return; 2412 return;
3176 2413
3177#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
3178 down(&priv->mutex);
3179#else
3180 mutex_lock(&priv->mutex); 2414 mutex_lock(&priv->mutex);
3181#endif
3182 if(priv->ieee80211->state != IEEE80211_LINKED) 2415 if(priv->ieee80211->state != IEEE80211_LINKED)
3183 goto success; 2416 goto success;
3184 RT_TRACE(COMP_QOS,"qos active process with associate response received\n"); 2417 RT_TRACE(COMP_QOS,"qos active process with associate response received\n");
@@ -3198,11 +2431,7 @@ void rtl8192_qos_activate(struct net_device *dev)
3198 } 2431 }
3199 2432
3200success: 2433success:
3201#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
3202 up(&priv->mutex);
3203#else
3204 mutex_unlock(&priv->mutex); 2434 mutex_unlock(&priv->mutex);
3205#endif
3206} 2435}
3207 2436
3208static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, 2437static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv,
@@ -3229,11 +2458,7 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv,
3229 network->qos_data.param_count)) { 2458 network->qos_data.param_count)) {
3230 network->qos_data.old_param_count = 2459 network->qos_data.old_param_count =
3231 network->qos_data.param_count; 2460 network->qos_data.param_count;
3232#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
3233 queue_work(priv->priv_wq, &priv->qos_activate); 2461 queue_work(priv->priv_wq, &priv->qos_activate);
3234#else
3235 schedule_task(&priv->qos_activate);
3236#endif
3237 RT_TRACE (COMP_QOS, "QoS parameters change call " 2462 RT_TRACE (COMP_QOS, "QoS parameters change call "
3238 "qos_activate\n"); 2463 "qos_activate\n");
3239 } 2464 }
@@ -3242,11 +2467,7 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv,
3242 &def_qos_parameters, size); 2467 &def_qos_parameters, size);
3243 2468
3244 if ((network->qos_data.active == 1) && (active_network == 1)) { 2469 if ((network->qos_data.active == 1) && (active_network == 1)) {
3245#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
3246 queue_work(priv->priv_wq, &priv->qos_activate); 2470 queue_work(priv->priv_wq, &priv->qos_activate);
3247#else
3248 schedule_task(&priv->qos_activate);
3249#endif
3250 RT_TRACE(COMP_QOS, "QoS was disabled call qos_activate \n"); 2471 RT_TRACE(COMP_QOS, "QoS was disabled call qos_activate \n");
3251 } 2472 }
3252 network->qos_data.active = 0; 2473 network->qos_data.active = 0;
@@ -3264,16 +2485,7 @@ static int rtl8192_handle_beacon(struct net_device * dev,
3264 struct r8192_priv *priv = ieee80211_priv(dev); 2485 struct r8192_priv *priv = ieee80211_priv(dev);
3265 2486
3266 rtl8192_qos_handle_probe_response(priv,1,network); 2487 rtl8192_qos_handle_probe_response(priv,1,network);
3267#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
3268 queue_delayed_work(priv->priv_wq, &priv->update_beacon_wq, 0); 2488 queue_delayed_work(priv->priv_wq, &priv->update_beacon_wq, 0);
3269#else
3270#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
3271 schedule_task(&priv->update_beacon_wq);
3272#else
3273 queue_work(priv->priv_wq, &priv->update_beacon_wq);
3274#endif
3275
3276#endif
3277 return 0; 2489 return 0;
3278 2490
3279} 2491}
@@ -3306,10 +2518,6 @@ static int rtl8192_qos_association_resp(struct r8192_priv *priv,
3306 &network->qos_data.parameters,\ 2518 &network->qos_data.parameters,\
3307 sizeof(struct ieee80211_qos_parameters)); 2519 sizeof(struct ieee80211_qos_parameters));
3308 priv->ieee80211->current_network.qos_data.active = 1; 2520 priv->ieee80211->current_network.qos_data.active = 1;
3309#if 0
3310 if((priv->ieee80211->current_network.qos_data.param_count != \
3311 network->qos_data.param_count))
3312#endif
3313 { 2521 {
3314 set_qos_param = 1; 2522 set_qos_param = 1;
3315 /* update qos parameter for current network */ 2523 /* update qos parameter for current network */
@@ -3330,11 +2538,7 @@ static int rtl8192_qos_association_resp(struct r8192_priv *priv,
3330 2538
3331 RT_TRACE(COMP_QOS, "%s: network->flags = %d,%d\n",__FUNCTION__,network->flags ,priv->ieee80211->current_network.qos_data.active); 2539 RT_TRACE(COMP_QOS, "%s: network->flags = %d,%d\n",__FUNCTION__,network->flags ,priv->ieee80211->current_network.qos_data.active);
3332 if (set_qos_param == 1) 2540 if (set_qos_param == 1)
3333#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
3334 queue_work(priv->priv_wq, &priv->qos_activate); 2541 queue_work(priv->priv_wq, &priv->qos_activate);
3335#else
3336 schedule_task(&priv->qos_activate);
3337#endif
3338 2542
3339 2543
3340 return ret; 2544 return ret;
@@ -3404,7 +2608,6 @@ static u8 ccmp_ie[4] = {0x00,0x50,0xf2,0x04};
3404static u8 ccmp_rsn_ie[4] = {0x00, 0x0f, 0xac, 0x04}; 2608static u8 ccmp_rsn_ie[4] = {0x00, 0x0f, 0xac, 0x04};
3405bool GetNmodeSupportBySecCfg8192(struct net_device*dev) 2609bool GetNmodeSupportBySecCfg8192(struct net_device*dev)
3406{ 2610{
3407#if 1
3408 struct r8192_priv* priv = ieee80211_priv(dev); 2611 struct r8192_priv* priv = ieee80211_priv(dev);
3409 struct ieee80211_device* ieee = priv->ieee80211; 2612 struct ieee80211_device* ieee = priv->ieee80211;
3410 struct ieee80211_network * network = &ieee->current_network; 2613 struct ieee80211_network * network = &ieee->current_network;
@@ -3432,20 +2635,7 @@ bool GetNmodeSupportBySecCfg8192(struct net_device*dev)
3432 return true; 2635 return true;
3433 } 2636 }
3434 2637
3435#if 0
3436 //In here we discuss with SD4 David. He think we still can send TKIP in broadcast group key in MCS rate.
3437 //We can't force in G mode if Pairwie key is AES and group key is TKIP
3438 if((pSecInfo->GroupEncAlgorithm == WEP104_Encryption) || (pSecInfo->GroupEncAlgorithm == WEP40_Encryption) ||
3439 (pSecInfo->PairwiseEncAlgorithm == WEP104_Encryption) ||
3440 (pSecInfo->PairwiseEncAlgorithm == WEP40_Encryption) || (pSecInfo->PairwiseEncAlgorithm == TKIP_Encryption))
3441 {
3442 return false;
3443 }
3444 else
3445 return true;
3446#endif
3447 return true; 2638 return true;
3448#endif
3449} 2639}
3450 2640
3451bool GetHalfNmodeSupportByAPs819xUsb(struct net_device* dev) 2641bool GetHalfNmodeSupportByAPs819xUsb(struct net_device* dev)
@@ -3502,7 +2692,6 @@ void rtl8192_SetWirelessMode(struct net_device* dev, u8 wireless_mode)
3502 struct r8192_priv *priv = ieee80211_priv(dev); 2692 struct r8192_priv *priv = ieee80211_priv(dev);
3503 u8 bSupportMode = rtl8192_getSupportedWireleeMode(dev); 2693 u8 bSupportMode = rtl8192_getSupportedWireleeMode(dev);
3504 2694
3505#if 1
3506 if ((wireless_mode == WIRELESS_MODE_AUTO) || ((wireless_mode&bSupportMode)==0)) 2695 if ((wireless_mode == WIRELESS_MODE_AUTO) || ((wireless_mode&bSupportMode)==0))
3507 { 2696 {
3508 if(bSupportMode & WIRELESS_MODE_N_24G) 2697 if(bSupportMode & WIRELESS_MODE_N_24G)
@@ -3541,7 +2730,6 @@ void rtl8192_SetWirelessMode(struct net_device* dev, u8 wireless_mode)
3541 priv->ieee80211->pHTInfo->bEnableHT = 0; 2730 priv->ieee80211->pHTInfo->bEnableHT = 0;
3542 RT_TRACE(COMP_INIT, "Current Wireless Mode is %x\n", wireless_mode); 2731 RT_TRACE(COMP_INIT, "Current Wireless Mode is %x\n", wireless_mode);
3543 rtl8192_refresh_supportrate(priv); 2732 rtl8192_refresh_supportrate(priv);
3544#endif
3545 2733
3546} 2734}
3547//init priv variables here. only non_zero value should be initialized here. 2735//init priv variables here. only non_zero value should be initialized here.
@@ -3679,18 +2867,10 @@ static void rtl8192_init_priv_lock(struct r8192_priv* priv)
3679 //spin_lock_init(&priv->rf_lock); 2867 //spin_lock_init(&priv->rf_lock);
3680 sema_init(&priv->wx_sem,1); 2868 sema_init(&priv->wx_sem,1);
3681 sema_init(&priv->rf_sem,1); 2869 sema_init(&priv->rf_sem,1);
3682#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
3683 sema_init(&priv->mutex, 1);
3684#else
3685 mutex_init(&priv->mutex); 2870 mutex_init(&priv->mutex);
3686#endif
3687} 2871}
3688 2872
3689#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
3690extern void rtl819x_watchdog_wqcallback(struct work_struct *work); 2873extern void rtl819x_watchdog_wqcallback(struct work_struct *work);
3691#else
3692extern void rtl819x_watchdog_wqcallback(struct net_device *dev);
3693#endif
3694 2874
3695void rtl8192_irq_rx_tasklet(struct r8192_priv *priv); 2875void rtl8192_irq_rx_tasklet(struct r8192_priv *priv);
3696//init tasklet and wait_queue here. only 2.6 above kernel is considered 2876//init tasklet and wait_queue here. only 2.6 above kernel is considered
@@ -3699,15 +2879,12 @@ static void rtl8192_init_priv_task(struct net_device* dev)
3699{ 2879{
3700 struct r8192_priv *priv = ieee80211_priv(dev); 2880 struct r8192_priv *priv = ieee80211_priv(dev);
3701 2881
3702#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
3703#ifdef PF_SYNCTHREAD 2882#ifdef PF_SYNCTHREAD
3704 priv->priv_wq = create_workqueue(DRV_NAME,0); 2883 priv->priv_wq = create_workqueue(DRV_NAME,0);
3705#else 2884#else
3706 priv->priv_wq = create_workqueue(DRV_NAME); 2885 priv->priv_wq = create_workqueue(DRV_NAME);
3707#endif 2886#endif
3708#endif
3709 2887
3710#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
3711 INIT_WORK(&priv->reset_wq, rtl8192_restart); 2888 INIT_WORK(&priv->reset_wq, rtl8192_restart);
3712 2889
3713 //INIT_DELAYED_WORK(&priv->watch_dog_wq, hal_dm_watchdog); 2890 //INIT_DELAYED_WORK(&priv->watch_dog_wq, hal_dm_watchdog);
@@ -3720,30 +2897,6 @@ static void rtl8192_init_priv_task(struct net_device* dev)
3720 //INIT_WORK(&priv->SwChnlWorkItem, rtl8192_SwChnl_WorkItem); 2897 //INIT_WORK(&priv->SwChnlWorkItem, rtl8192_SwChnl_WorkItem);
3721 //INIT_WORK(&priv->SetBWModeWorkItem, rtl8192_SetBWModeWorkItem); 2898 //INIT_WORK(&priv->SetBWModeWorkItem, rtl8192_SetBWModeWorkItem);
3722 INIT_WORK(&priv->qos_activate, rtl8192_qos_activate); 2899 INIT_WORK(&priv->qos_activate, rtl8192_qos_activate);
3723#else
3724#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
3725 tq_init(&priv->reset_wq, (void*)rtl8192_restart, dev);
3726 tq_init(&priv->watch_dog_wq, (void*)rtl819x_watchdog_wqcallback, dev);
3727 tq_init(&priv->txpower_tracking_wq, (void*)dm_txpower_trackingcallback, dev);
3728 tq_init(&priv->rfpath_check_wq, (void*)dm_rf_pathcheck_workitemcallback, dev);
3729 tq_init(&priv->update_beacon_wq, (void*)rtl8192_update_beacon, dev);
3730 //tq_init(&priv->SwChnlWorkItem, (void*) rtl8192_SwChnl_WorkItem, dev);
3731 //tq_init(&priv->SetBWModeWorkItem, (void*)rtl8192_SetBWModeWorkItem, dev);
3732 tq_init(&priv->qos_activate, (void *)rtl8192_qos_activate, dev);
3733#else
3734 INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8192_restart,dev);
3735 //INIT_WORK(&priv->watch_dog_wq, (void(*)(void*)) hal_dm_watchdog,dev);
3736 INIT_WORK(&priv->watch_dog_wq, (void(*)(void*)) rtl819x_watchdog_wqcallback,dev);
3737 INIT_WORK(&priv->txpower_tracking_wq, (void(*)(void*)) dm_txpower_trackingcallback,dev);
3738// INIT_WORK(&priv->gpio_change_rf_wq, (void(*)(void*)) dm_gpio_change_rf_callback,dev);
3739 INIT_WORK(&priv->rfpath_check_wq, (void(*)(void*)) dm_rf_pathcheck_workitemcallback,dev);
3740 INIT_WORK(&priv->update_beacon_wq, (void(*)(void*))rtl8192_update_beacon,dev);
3741 INIT_WORK(&priv->initialgain_operate_wq, (void(*)(void*))InitialGainOperateWorkItemCallBack,dev);
3742 //INIT_WORK(&priv->SwChnlWorkItem, (void(*)(void*)) rtl8192_SwChnl_WorkItem, dev);
3743 //INIT_WORK(&priv->SetBWModeWorkItem, (void(*)(void*)) rtl8192_SetBWModeWorkItem, dev);
3744 INIT_WORK(&priv->qos_activate, (void(*)(void *))rtl8192_qos_activate, dev);
3745#endif
3746#endif
3747 2900
3748 tasklet_init(&priv->irq_rx_tasklet, 2901 tasklet_init(&priv->irq_rx_tasklet,
3749 (void(*)(unsigned long))rtl8192_irq_rx_tasklet, 2902 (void(*)(unsigned long))rtl8192_irq_rx_tasklet,
@@ -4218,7 +3371,6 @@ bool rtl8192_adapter_start(struct net_device *dev)
4218 //config BB. 3371 //config BB.
4219 rtl8192_BBConfig(dev); 3372 rtl8192_BBConfig(dev);
4220 3373
4221#if 1
4222 //Loopback mode or not 3374 //Loopback mode or not
4223 priv->LoopbackMode = RTL819xU_NO_LOOPBACK; 3375 priv->LoopbackMode = RTL819xU_NO_LOOPBACK;
4224// priv->LoopbackMode = RTL819xU_MAC_LOOPBACK; 3376// priv->LoopbackMode = RTL819xU_MAC_LOOPBACK;
@@ -4434,7 +3586,6 @@ if(Adapter->ResetProgress == RESET_TYPE_NORESET)
4434 write_nic_byte(dev, 0x87, 0x0); 3586 write_nic_byte(dev, 0x87, 0x0);
4435 3587
4436 3588
4437#endif
4438 return init_status; 3589 return init_status;
4439} 3590}
4440 3591
@@ -4442,63 +3593,6 @@ if(Adapter->ResetProgress == RESET_TYPE_NORESET)
4442 * rtl8192_beacon_tx_enable(). rtl8192_beacon_tx_disable() might 3593 * rtl8192_beacon_tx_enable(). rtl8192_beacon_tx_disable() might
4443 * be used to stop beacon transmission 3594 * be used to stop beacon transmission
4444 */ 3595 */
4445#if 0
4446void rtl8192_start_tx_beacon(struct net_device *dev)
4447{
4448 int i;
4449 struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
4450 u16 word;
4451 DMESG("Enabling beacon TX");
4452 //write_nic_byte(dev, TX_CONF,0xe6);// TX_CONF
4453 //rtl8192_init_beacon(dev);
4454 //set_nic_txring(dev);
4455// rtl8192_prepare_beacon(dev);
4456 rtl8192_irq_disable(dev);
4457// rtl8192_beacon_tx_enable(dev);
4458 rtl8192_set_mode(dev,EPROM_CMD_CONFIG);
4459 //write_nic_byte(dev,0x9d,0x20); //DMA Poll
4460 //write_nic_word(dev,0x7a,0);
4461 //write_nic_word(dev,0x7a,0x8000);
4462
4463
4464 word = read_nic_word(dev, BcnItv);
4465 word &= ~BcnItv_BcnItv; // clear Bcn_Itv
4466 write_nic_word(dev, BcnItv, word);
4467
4468 write_nic_word(dev, AtimWnd,
4469 read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd);
4470
4471 word = read_nic_word(dev, BCN_INTR_ITV);
4472 word &= ~BCN_INTR_ITV_MASK;
4473
4474 //word |= priv->ieee80211->beacon_interval *
4475 // ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1);
4476 // FIXME:FIXME check if correct ^^ worked with 0x3e8;
4477
4478 write_nic_word(dev, BCN_INTR_ITV, word);
4479
4480 //write_nic_word(dev,0x2e,0xe002);
4481 //write_nic_dword(dev,0x30,0xb8c7832e);
4482 for(i=0; i<ETH_ALEN; i++)
4483 write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]);
4484
4485// rtl8192_update_msr(dev);
4486
4487
4488 //write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */
4489
4490 rtl8192_set_mode(dev, EPROM_CMD_NORMAL);
4491
4492 rtl8192_irq_enable(dev);
4493
4494 /* VV !!!!!!!!!! VV*/
4495 /*
4496 rtl8192_set_mode(dev,EPROM_CMD_CONFIG);
4497 write_nic_byte(dev,0x9d,0x00);
4498 rtl8192_set_mode(dev,EPROM_CMD_NORMAL);
4499*/
4500}
4501#endif
4502/*************************************************************************** 3596/***************************************************************************
4503 -------------------------------NET STUFF--------------------------- 3597 -------------------------------NET STUFF---------------------------
4504***************************************************************************/ 3598***************************************************************************/
@@ -4552,21 +3646,18 @@ TxCheckStuck(struct net_device *dev)
4552 { 3646 {
4553 if(QueueID == TXCMD_QUEUE) 3647 if(QueueID == TXCMD_QUEUE)
4554 continue; 3648 continue;
4555#if 1
4556#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE 3649#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
4557 if((skb_queue_len(&priv->ieee80211->skb_waitQ[QueueID]) == 0) && (skb_queue_len(&priv->ieee80211->skb_aggQ[QueueID]) == 0) && (skb_queue_len(&priv->ieee80211->skb_drv_aggQ[QueueID]) == 0)) 3650 if((skb_queue_len(&priv->ieee80211->skb_waitQ[QueueID]) == 0) && (skb_queue_len(&priv->ieee80211->skb_aggQ[QueueID]) == 0) && (skb_queue_len(&priv->ieee80211->skb_drv_aggQ[QueueID]) == 0))
4558#else 3651#else
4559 if((skb_queue_len(&priv->ieee80211->skb_waitQ[QueueID]) == 0) && (skb_queue_len(&priv->ieee80211->skb_aggQ[QueueID]) == 0)) 3652 if((skb_queue_len(&priv->ieee80211->skb_waitQ[QueueID]) == 0) && (skb_queue_len(&priv->ieee80211->skb_aggQ[QueueID]) == 0))
4560#endif 3653#endif
4561 continue; 3654 continue;
4562#endif
4563 3655
4564 bCheckFwTxCnt = true; 3656 bCheckFwTxCnt = true;
4565 } 3657 }
4566// PlatformReleaseSpinLock(Adapter, RT_TX_SPINLOCK); 3658// PlatformReleaseSpinLock(Adapter, RT_TX_SPINLOCK);
4567// spin_unlock_irqrestore(&priv->ieee80211->lock,flags); 3659// spin_unlock_irqrestore(&priv->ieee80211->lock,flags);
4568// RT_TRACE(COMP_RESET,"bCheckFwTxCnt is %d\n",bCheckFwTxCnt); 3660// RT_TRACE(COMP_RESET,"bCheckFwTxCnt is %d\n",bCheckFwTxCnt);
4569#if 1
4570 if(bCheckFwTxCnt) 3661 if(bCheckFwTxCnt)
4571 { 3662 {
4572 if(HalTxCheckStuck819xUsb(dev)) 3663 if(HalTxCheckStuck819xUsb(dev))
@@ -4575,7 +3666,6 @@ TxCheckStuck(struct net_device *dev)
4575 return RESET_TYPE_SILENT; 3666 return RESET_TYPE_SILENT;
4576 } 3667 }
4577 } 3668 }
4578#endif
4579 return RESET_TYPE_NORESET; 3669 return RESET_TYPE_NORESET;
4580} 3670}
4581 3671
@@ -4694,7 +3784,6 @@ rtl819x_ifcheck_resetornot(struct net_device *dev)
4694 rfState = priv->ieee80211->eRFPowerState; 3784 rfState = priv->ieee80211->eRFPowerState;
4695 3785
4696 TxResetType = TxCheckStuck(dev); 3786 TxResetType = TxCheckStuck(dev);
4697#if 1
4698 if( rfState != eRfOff || 3787 if( rfState != eRfOff ||
4699 /*ADAPTER_TEST_STATUS_FLAG(Adapter, ADAPTER_STATUS_FW_DOWNLOAD_FAILURE)) &&*/ 3788 /*ADAPTER_TEST_STATUS_FLAG(Adapter, ADAPTER_STATUS_FW_DOWNLOAD_FAILURE)) &&*/
4700 (priv->ieee80211->iw_mode != IW_MODE_ADHOC)) 3789 (priv->ieee80211->iw_mode != IW_MODE_ADHOC))
@@ -4709,7 +3798,6 @@ rtl819x_ifcheck_resetornot(struct net_device *dev)
4709 // set, STA cannot hear any packet a all. Emily, 2008.04.12 3798 // set, STA cannot hear any packet a all. Emily, 2008.04.12
4710 RxResetType = RxCheckStuck(dev); 3799 RxResetType = RxCheckStuck(dev);
4711 } 3800 }
4712#endif
4713 if(TxResetType==RESET_TYPE_NORMAL || RxResetType==RESET_TYPE_NORMAL) 3801 if(TxResetType==RESET_TYPE_NORMAL || RxResetType==RESET_TYPE_NORMAL)
4714 return RESET_TYPE_NORMAL; 3802 return RESET_TYPE_NORMAL;
4715 else if(TxResetType==RESET_TYPE_SILENT || RxResetType==RESET_TYPE_SILENT){ 3803 else if(TxResetType==RESET_TYPE_SILENT || RxResetType==RESET_TYPE_SILENT){
@@ -4889,7 +3977,6 @@ RESET_START:
4889 // Set the variable for reset. 3977 // Set the variable for reset.
4890 priv->ResetProgress = RESET_TYPE_SILENT; 3978 priv->ResetProgress = RESET_TYPE_SILENT;
4891// rtl8192_close(dev); 3979// rtl8192_close(dev);
4892#if 1
4893 down(&priv->wx_sem); 3980 down(&priv->wx_sem);
4894 if(priv->up == 0) 3981 if(priv->up == 0)
4895 { 3982 {
@@ -4914,9 +4001,7 @@ RESET_START:
4914 printk("ieee->state is IEEE80211_LINKED\n"); 4001 printk("ieee->state is IEEE80211_LINKED\n");
4915 ieee80211_stop_send_beacons(priv->ieee80211); 4002 ieee80211_stop_send_beacons(priv->ieee80211);
4916 del_timer_sync(&ieee->associate_timer); 4003 del_timer_sync(&ieee->associate_timer);
4917 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
4918 cancel_delayed_work(&ieee->associate_retry_wq); 4004 cancel_delayed_work(&ieee->associate_retry_wq);
4919 #endif
4920 ieee80211_stop_scan(ieee); 4005 ieee80211_stop_scan(ieee);
4921 netif_carrier_off(dev); 4006 netif_carrier_off(dev);
4922 up(&ieee->wx_sem); 4007 up(&ieee->wx_sem);
@@ -4943,22 +4028,13 @@ RESET_START:
4943 RT_TRACE(COMP_ERR," ERR!!! %s(): Reset Failed!!\n", __FUNCTION__); 4028 RT_TRACE(COMP_ERR," ERR!!! %s(): Reset Failed!!\n", __FUNCTION__);
4944 } 4029 }
4945 } 4030 }
4946#endif
4947 ieee->is_silent_reset = 1; 4031 ieee->is_silent_reset = 1;
4948#if 1
4949 EnableHWSecurityConfig8192(dev); 4032 EnableHWSecurityConfig8192(dev);
4950#if 1
4951 if(ieee->state == IEEE80211_LINKED && ieee->iw_mode == IW_MODE_INFRA) 4033 if(ieee->state == IEEE80211_LINKED && ieee->iw_mode == IW_MODE_INFRA)
4952 { 4034 {
4953 ieee->set_chan(ieee->dev, ieee->current_network.channel); 4035 ieee->set_chan(ieee->dev, ieee->current_network.channel);
4954 4036
4955#if 1
4956#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
4957 queue_work(ieee->wq, &ieee->associate_complete_wq); 4037 queue_work(ieee->wq, &ieee->associate_complete_wq);
4958#else
4959 schedule_task(&ieee->associate_complete_wq);
4960#endif
4961#endif
4962 4038
4963 } 4039 }
4964 else if(ieee->state == IEEE80211_LINKED && ieee->iw_mode == IW_MODE_ADHOC) 4040 else if(ieee->state == IEEE80211_LINKED && ieee->iw_mode == IW_MODE_ADHOC)
@@ -4974,7 +4050,6 @@ RESET_START:
4974 ieee->data_hard_resume(ieee->dev); 4050 ieee->data_hard_resume(ieee->dev);
4975 netif_carrier_on(ieee->dev); 4051 netif_carrier_on(ieee->dev);
4976 } 4052 }
4977#endif
4978 4053
4979 CamRestoreAllEntry(dev); 4054 CamRestoreAllEntry(dev);
4980 4055
@@ -4987,7 +4062,6 @@ RESET_START:
4987 // For test --> force write UFWP. 4062 // For test --> force write UFWP.
4988 write_nic_byte(dev, UFWP, 1); 4063 write_nic_byte(dev, UFWP, 1);
4989 RT_TRACE(COMP_RESET, "Reset finished!! ====>[%d]\n", priv->reset_count); 4064 RT_TRACE(COMP_RESET, "Reset finished!! ====>[%d]\n", priv->reset_count);
4990#endif
4991 } 4065 }
4992} 4066}
4993 4067
@@ -5010,7 +4084,6 @@ void CAM_read_entry(
5010 4084
5011 //Check polling bit is clear 4085 //Check polling bit is clear
5012// mdelay(1); 4086// mdelay(1);
5013#if 1
5014 while((i--)>=0) 4087 while((i--)>=0)
5015 { 4088 {
5016 ulStatus = read_nic_dword(dev, RWCAM); 4089 ulStatus = read_nic_dword(dev, RWCAM);
@@ -5021,7 +4094,6 @@ void CAM_read_entry(
5021 break; 4094 break;
5022 } 4095 }
5023 } 4096 }
5024#endif
5025 write_nic_dword(dev, RWCAM, target_command); 4097 write_nic_dword(dev, RWCAM, target_command);
5026 RT_TRACE(COMP_SEC,"CAM_read_entry(): WRITE A0: %x \n",target_command); 4098 RT_TRACE(COMP_SEC,"CAM_read_entry(): WRITE A0: %x \n",target_command);
5027 // printk("CAM_read_entry(): WRITE A0: %lx \n",target_command); 4099 // printk("CAM_read_entry(): WRITE A0: %lx \n",target_command);
@@ -5054,17 +4126,11 @@ void rtl819x_update_rxcounts(
5054} 4126}
5055 4127
5056 4128
5057#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
5058extern void rtl819x_watchdog_wqcallback(struct work_struct *work) 4129extern void rtl819x_watchdog_wqcallback(struct work_struct *work)
5059{ 4130{
5060 struct delayed_work *dwork = container_of(work,struct delayed_work,work); 4131 struct delayed_work *dwork = container_of(work,struct delayed_work,work);
5061 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,watch_dog_wq); 4132 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,watch_dog_wq);
5062 struct net_device *dev = priv->ieee80211->dev; 4133 struct net_device *dev = priv->ieee80211->dev;
5063#else
5064extern void rtl819x_watchdog_wqcallback(struct net_device *dev)
5065{
5066 struct r8192_priv *priv = ieee80211_priv(dev);
5067#endif
5068 struct ieee80211_device* ieee = priv->ieee80211; 4134 struct ieee80211_device* ieee = priv->ieee80211;
5069 RESET_TYPE ResetType = RESET_TYPE_NORESET; 4135 RESET_TYPE ResetType = RESET_TYPE_NORESET;
5070 static u8 check_reset_cnt=0; 4136 static u8 check_reset_cnt=0;
@@ -5106,11 +4172,7 @@ extern void rtl819x_watchdog_wqcallback(struct net_device *dev)
5106 notify_wx_assoc_event(priv->ieee80211); 4172 notify_wx_assoc_event(priv->ieee80211);
5107 RemovePeerTS(priv->ieee80211,priv->ieee80211->current_network.bssid); 4173 RemovePeerTS(priv->ieee80211,priv->ieee80211->current_network.bssid);
5108 priv->ieee80211->link_change(dev); 4174 priv->ieee80211->link_change(dev);
5109#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
5110 queue_work(priv->ieee80211->wq, &priv->ieee80211->associate_procedure_wq); 4175 queue_work(priv->ieee80211->wq, &priv->ieee80211->associate_procedure_wq);
5111#else
5112 schedule_task(&priv->ieee80211->associate_procedure_wq);
5113#endif
5114 4176
5115 } 4177 }
5116 } 4178 }
@@ -5126,7 +4188,6 @@ extern void rtl819x_watchdog_wqcallback(struct net_device *dev)
5126 //DbgPrint("Start to check silent reset\n"); 4188 //DbgPrint("Start to check silent reset\n");
5127 } 4189 }
5128 // RT_TRACE(COMP_RESET,"%s():priv->force_reset is %d,priv->ResetProgress is %d, priv->bForcedSilentReset is %d,priv->bDisableNormalResetCheck is %d,ResetType is %d\n",__FUNCTION__,priv->force_reset,priv->ResetProgress,priv->bForcedSilentReset,priv->bDisableNormalResetCheck,ResetType); 4190 // RT_TRACE(COMP_RESET,"%s():priv->force_reset is %d,priv->ResetProgress is %d, priv->bForcedSilentReset is %d,priv->bDisableNormalResetCheck is %d,ResetType is %d\n",__FUNCTION__,priv->force_reset,priv->ResetProgress,priv->bForcedSilentReset,priv->bDisableNormalResetCheck,ResetType);
5129#if 1
5130 if( (priv->force_reset) || (priv->ResetProgress==RESET_TYPE_NORESET && 4191 if( (priv->force_reset) || (priv->ResetProgress==RESET_TYPE_NORESET &&
5131 (priv->bForcedSilentReset || 4192 (priv->bForcedSilentReset ||
5132 (!priv->bDisableNormalResetCheck && ResetType==RESET_TYPE_SILENT)))) // This is control by OID set in Pomelo 4193 (!priv->bDisableNormalResetCheck && ResetType==RESET_TYPE_SILENT)))) // This is control by OID set in Pomelo
@@ -5134,7 +4195,6 @@ extern void rtl819x_watchdog_wqcallback(struct net_device *dev)
5134 RT_TRACE(COMP_RESET,"%s():priv->force_reset is %d,priv->ResetProgress is %d, priv->bForcedSilentReset is %d,priv->bDisableNormalResetCheck is %d,ResetType is %d\n",__FUNCTION__,priv->force_reset,priv->ResetProgress,priv->bForcedSilentReset,priv->bDisableNormalResetCheck,ResetType); 4195 RT_TRACE(COMP_RESET,"%s():priv->force_reset is %d,priv->ResetProgress is %d, priv->bForcedSilentReset is %d,priv->bDisableNormalResetCheck is %d,ResetType is %d\n",__FUNCTION__,priv->force_reset,priv->ResetProgress,priv->bForcedSilentReset,priv->bDisableNormalResetCheck,ResetType);
5135 rtl819x_ifsilentreset(dev); 4196 rtl819x_ifsilentreset(dev);
5136 } 4197 }
5137#endif
5138 priv->force_reset = false; 4198 priv->force_reset = false;
5139 priv->bForcedSilentReset = false; 4199 priv->bForcedSilentReset = false;
5140 priv->bResetInProgress = false; 4200 priv->bResetInProgress = false;
@@ -5146,20 +4206,8 @@ void watch_dog_timer_callback(unsigned long data)
5146{ 4206{
5147 struct r8192_priv *priv = ieee80211_priv((struct net_device *) data); 4207 struct r8192_priv *priv = ieee80211_priv((struct net_device *) data);
5148 //printk("===============>watch_dog timer\n"); 4208 //printk("===============>watch_dog timer\n");
5149#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
5150 queue_delayed_work(priv->priv_wq,&priv->watch_dog_wq, 0); 4209 queue_delayed_work(priv->priv_wq,&priv->watch_dog_wq, 0);
5151#else
5152#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
5153 schedule_task(&priv->watch_dog_wq);
5154#else
5155 queue_work(priv->priv_wq,&priv->watch_dog_wq);
5156#endif
5157#endif
5158 mod_timer(&priv->watch_dog_timer, jiffies + MSECS(IEEE80211_WATCH_DOG_TIME)); 4210 mod_timer(&priv->watch_dog_timer, jiffies + MSECS(IEEE80211_WATCH_DOG_TIME));
5159#if 0
5160 priv->watch_dog_timer.expires = jiffies + MSECS(IEEE80211_WATCH_DOG_TIME);
5161 add_timer(&priv->watch_dog_timer);
5162#endif
5163} 4211}
5164int _rtl8192_up(struct net_device *dev) 4212int _rtl8192_up(struct net_device *dev)
5165{ 4213{
@@ -5298,17 +4346,10 @@ void rtl8192_restart(struct net_device *dev)
5298{ 4346{
5299 struct r8192_priv *priv = ieee80211_priv(dev); 4347 struct r8192_priv *priv = ieee80211_priv(dev);
5300*/ 4348*/
5301#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
5302void rtl8192_restart(struct work_struct *work) 4349void rtl8192_restart(struct work_struct *work)
5303{ 4350{
5304 struct r8192_priv *priv = container_of(work, struct r8192_priv, reset_wq); 4351 struct r8192_priv *priv = container_of(work, struct r8192_priv, reset_wq);
5305 struct net_device *dev = priv->ieee80211->dev; 4352 struct net_device *dev = priv->ieee80211->dev;
5306#else
5307void rtl8192_restart(struct net_device *dev)
5308{
5309
5310 struct r8192_priv *priv = ieee80211_priv(dev);
5311#endif
5312 4353
5313 down(&priv->wx_sem); 4354 down(&priv->wx_sem);
5314 4355
@@ -5347,11 +4388,7 @@ int r8192_set_mac_adr(struct net_device *dev, void *mac)
5347 4388
5348 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); 4389 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
5349 4390
5350#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
5351 schedule_work(&priv->reset_wq); 4391 schedule_work(&priv->reset_wq);
5352#else
5353 schedule_task(&priv->reset_wq);
5354#endif
5355 up(&priv->wx_sem); 4392 up(&priv->wx_sem);
5356 4393
5357 return 0; 4394 return 0;
@@ -5604,14 +4641,6 @@ void rtl8192_process_phyinfo(struct r8192_priv * priv,u8* buffer, struct ieee802
5604 bcheck = true; 4641 bcheck = true;
5605 }else 4642 }else
5606 { 4643 {
5607 #if 0
5608 // if previous packet is aggregated packet, and current packet
5609 // (1) is not AMPDU
5610 // (2) is the first packet of one AMPDU
5611 // that means the previous packet is the last one aggregated packet
5612 if( !pcurrent_stats->bIsAMPDU || pcurrent_stats->bFirstMPDU)
5613 bcheck = true;
5614 #endif
5615 } 4644 }
5616 4645
5617 4646
@@ -5728,7 +4757,6 @@ void rtl8192_process_phyinfo(struct r8192_priv * priv,u8* buffer, struct ieee802
5728 priv->undecorated_smoothed_pwdb = pprevious_stats->RxPWDBAll; 4757 priv->undecorated_smoothed_pwdb = pprevious_stats->RxPWDBAll;
5729 //DbgPrint("First pwdb initialize \n"); 4758 //DbgPrint("First pwdb initialize \n");
5730 } 4759 }
5731#if 1
5732 if(pprevious_stats->RxPWDBAll > (u32)priv->undecorated_smoothed_pwdb) 4760 if(pprevious_stats->RxPWDBAll > (u32)priv->undecorated_smoothed_pwdb)
5733 { 4761 {
5734 priv->undecorated_smoothed_pwdb = 4762 priv->undecorated_smoothed_pwdb =
@@ -5742,20 +4770,6 @@ void rtl8192_process_phyinfo(struct r8192_priv * priv,u8* buffer, struct ieee802
5742 ( ((priv->undecorated_smoothed_pwdb)*(Rx_Smooth_Factor-1)) + 4770 ( ((priv->undecorated_smoothed_pwdb)*(Rx_Smooth_Factor-1)) +
5743 (pprevious_stats->RxPWDBAll)) /(Rx_Smooth_Factor); 4771 (pprevious_stats->RxPWDBAll)) /(Rx_Smooth_Factor);
5744 } 4772 }
5745#else
5746 //Fixed by Jacken 2008-03-20
5747 if(pPreviousRfd->Status.RxPWDBAll > (u32)pHalData->UndecoratedSmoothedPWDB)
5748 {
5749 pHalData->UndecoratedSmoothedPWDB =
5750 ( ((pHalData->UndecoratedSmoothedPWDB)* 5) + (pPreviousRfd->Status.RxPWDBAll)) / 6;
5751 pHalData->UndecoratedSmoothedPWDB = pHalData->UndecoratedSmoothedPWDB + 1;
5752 }
5753 else
5754 {
5755 pHalData->UndecoratedSmoothedPWDB =
5756 ( ((pHalData->UndecoratedSmoothedPWDB)* 5) + (pPreviousRfd->Status.RxPWDBAll)) / 6;
5757 }
5758#endif
5759 4773
5760 } 4774 }
5761 4775
@@ -6133,9 +5147,6 @@ static void rtl8192_query_rxphystatus(
6133 rx_evmX /= 2; //dbm 5147 rx_evmX /= 2; //dbm
6134 5148
6135 evm = rtl819x_evm_dbtopercentage(rx_evmX); 5149 evm = rtl819x_evm_dbtopercentage(rx_evmX);
6136#if 0
6137 EVM = SignalScaleMapping(EVM);//make it good looking, from 0~100
6138#endif
6139 //if(bpacket_match_bssid) 5150 //if(bpacket_match_bssid)
6140 { 5151 {
6141 if(i==0) // Fill value in RFD, Get the first spatial stream only 5152 if(i==0) // Fill value in RFD, Get the first spatial stream only
@@ -6216,7 +5227,6 @@ void TranslateRxSignalStuff819xUsb(struct sk_buff *skb,
6216 && (!pstats->bHwError) && (!pstats->bCRC)&& (!pstats->bICV)); 5227 && (!pstats->bHwError) && (!pstats->bCRC)&& (!pstats->bICV));
6217 bpacket_toself = bpacket_match_bssid & (eqMacAddr(praddr, priv->ieee80211->dev->dev_addr)); 5228 bpacket_toself = bpacket_match_bssid & (eqMacAddr(praddr, priv->ieee80211->dev->dev_addr));
6218 5229
6219#if 1//cosa
6220 if(WLAN_FC_GET_FRAMETYPE(fc)== IEEE80211_STYPE_BEACON) 5230 if(WLAN_FC_GET_FRAMETYPE(fc)== IEEE80211_STYPE_BEACON)
6221 { 5231 {
6222 bPacketBeacon = true; 5232 bPacketBeacon = true;
@@ -6229,7 +5239,6 @@ void TranslateRxSignalStuff819xUsb(struct sk_buff *skb,
6229 //DbgPrint("BlockAck, MatchBSSID = %d, ToSelf = %d \n", bPacketMatchBSSID, bPacketToSelf); 5239 //DbgPrint("BlockAck, MatchBSSID = %d, ToSelf = %d \n", bPacketMatchBSSID, bPacketToSelf);
6230 } 5240 }
6231 5241
6232#endif
6233 5242
6234 5243
6235 if(bpacket_match_bssid) 5244 if(bpacket_match_bssid)
@@ -6416,10 +5425,6 @@ void query_rxdesc_status(struct sk_buff *skb, struct ieee80211_rx_stats *stats,
6416 5425
6417 stats->bIsAMPDU = (driver_info->PartAggr==1); 5426 stats->bIsAMPDU = (driver_info->PartAggr==1);
6418 stats->bFirstMPDU = (driver_info->PartAggr==1) && (driver_info->FirstAGGR==1); 5427 stats->bFirstMPDU = (driver_info->PartAggr==1) && (driver_info->FirstAGGR==1);
6419#if 0
6420 // TODO: it is debug only. It should be disabled in released driver. 2007.1.12 by Joseph
6421 UpdateRxAMPDUHistogramStatistics8190(Adapter, pRfd);
6422#endif
6423 stats->TimeStampLow = driver_info->TSFL; 5428 stats->TimeStampLow = driver_info->TSFL;
6424 // xiong mask it, 070514 5429 // xiong mask it, 070514
6425 //pRfd->Status.TimeStampHigh = PlatformEFIORead4Byte(Adapter, TSFR+4); 5430 //pRfd->Status.TimeStampHigh = PlatformEFIORead4Byte(Adapter, TSFR+4);
@@ -6452,17 +5457,6 @@ void query_rxdesc_status(struct sk_buff *skb, struct ieee80211_rx_stats *stats,
6452 } 5457 }
6453#endif 5458#endif
6454 /* for debug 2008.5.29 */ 5459 /* for debug 2008.5.29 */
6455#if 0
6456 {
6457 int i;
6458 printk("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
6459 for(i = 0; i < skb->len; i++) {
6460 if(i % 10 == 0) printk("\n");
6461 printk("%02x ", skb->data[i]);
6462 }
6463 printk("\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
6464 }
6465#endif
6466 5460
6467 //added by vivi, for MP, 20080108 5461 //added by vivi, for MP, 20080108
6468 stats->RxIs40MHzPacket = driver_info->BW; 5462 stats->RxIs40MHzPacket = driver_info->BW;
@@ -6753,33 +5747,6 @@ void rtl8192_rx_cmd(struct sk_buff *skb)
6753 ; 5747 ;
6754 5748
6755 5749
6756#if 0
6757 desc = (u32*)(skb->data);
6758 cmd = (desc[0] >> 30) & 0x03;
6759
6760 if(cmd == 0x00) {//beacon interrupt
6761 //send beacon packet
6762 skb = ieee80211_get_beacon(priv->ieee80211);
6763
6764 if(!skb){
6765 DMESG("not enought memory for allocating beacon");
6766 return;
6767 }
6768 skb->cb[0] = BEACON_PRIORITY;
6769 skb->cb[1] = 0;
6770 skb->cb[2] = ieeerate2rtlrate(priv->ieee80211->basic_rate);
6771 ret = rtl8192_tx(dev, skb);
6772
6773 if( ret != 0 ){
6774 printk(KERN_ALERT "tx beacon packet error : %d !\n", ret);
6775 }
6776 dev_kfree_skb_any(skb);
6777 } else {//0x00
6778 //{ log the device information
6779 // At present, It is not implemented just now.
6780 //}
6781 }
6782#endif
6783} 5750}
6784 5751
6785void rtl8192_irq_rx_tasklet(struct r8192_priv *priv) 5752void rtl8192_irq_rx_tasklet(struct r8192_priv *priv)
@@ -6833,39 +5800,22 @@ static const struct net_device_ops rtl8192_netdev_ops = {
6833 ---------------------------- USB_STUFF--------------------------- 5800 ---------------------------- USB_STUFF---------------------------
6834*****************************************************************************/ 5801*****************************************************************************/
6835 5802
6836#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
6837static int __devinit rtl8192_usb_probe(struct usb_interface *intf, 5803static int __devinit rtl8192_usb_probe(struct usb_interface *intf,
6838 const struct usb_device_id *id) 5804 const struct usb_device_id *id)
6839#else
6840static void * __devinit rtl8192_usb_probe(struct usb_device *udev,
6841 unsigned int ifnum,
6842 const struct usb_device_id *id)
6843#endif
6844{ 5805{
6845// unsigned long ioaddr = 0; 5806// unsigned long ioaddr = 0;
6846 struct net_device *dev = NULL; 5807 struct net_device *dev = NULL;
6847 struct r8192_priv *priv= NULL; 5808 struct r8192_priv *priv= NULL;
6848#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
6849 struct usb_device *udev = interface_to_usbdev(intf); 5809 struct usb_device *udev = interface_to_usbdev(intf);
6850#endif
6851 RT_TRACE(COMP_INIT, "Oops: i'm coming\n"); 5810 RT_TRACE(COMP_INIT, "Oops: i'm coming\n");
6852 5811
6853 dev = alloc_ieee80211(sizeof(struct r8192_priv)); 5812 dev = alloc_ieee80211(sizeof(struct r8192_priv));
6854 5813
6855#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
6856 SET_MODULE_OWNER(dev);
6857#endif
6858 5814
6859#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
6860 usb_set_intfdata(intf, dev); 5815 usb_set_intfdata(intf, dev);
6861 SET_NETDEV_DEV(dev, &intf->dev); 5816 SET_NETDEV_DEV(dev, &intf->dev);
6862#endif
6863 priv = ieee80211_priv(dev); 5817 priv = ieee80211_priv(dev);
6864#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
6865 priv->ieee80211 = netdev_priv(dev); 5818 priv->ieee80211 = netdev_priv(dev);
6866#else
6867 priv->ieee80211 = (struct net_device *)dev->priv;
6868#endif
6869 priv->udev=udev; 5819 priv->udev=udev;
6870 5820
6871 dev->netdev_ops = &rtl8192_netdev_ops; 5821 dev->netdev_ops = &rtl8192_netdev_ops;
@@ -6888,12 +5838,10 @@ static void * __devinit rtl8192_usb_probe(struct usb_device *udev,
6888 } 5838 }
6889 5839
6890 RT_TRACE(COMP_INIT, "Driver probe completed1\n"); 5840 RT_TRACE(COMP_INIT, "Driver probe completed1\n");
6891#if 1
6892 if(rtl8192_init(dev)!=0){ 5841 if(rtl8192_init(dev)!=0){
6893 RT_TRACE(COMP_ERR, "Initialization failed"); 5842 RT_TRACE(COMP_ERR, "Initialization failed");
6894 goto fail; 5843 goto fail;
6895 } 5844 }
6896#endif
6897 netif_carrier_off(dev); 5845 netif_carrier_off(dev);
6898 netif_stop_queue(dev); 5846 netif_stop_queue(dev);
6899 5847
@@ -6903,22 +5851,14 @@ static void * __devinit rtl8192_usb_probe(struct usb_device *udev,
6903 5851
6904 5852
6905 RT_TRACE(COMP_INIT, "Driver probe completed\n"); 5853 RT_TRACE(COMP_INIT, "Driver probe completed\n");
6906#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
6907 return dev;
6908#else
6909 return 0; 5854 return 0;
6910#endif
6911 5855
6912 5856
6913fail: 5857fail:
6914 free_ieee80211(dev); 5858 free_ieee80211(dev);
6915 5859
6916 RT_TRACE(COMP_ERR, "wlan driver load failed\n"); 5860 RT_TRACE(COMP_ERR, "wlan driver load failed\n");
6917#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
6918 return NULL;
6919#else
6920 return -ENODEV; 5861 return -ENODEV;
6921#endif
6922 5862
6923} 5863}
6924 5864
@@ -6926,38 +5866,19 @@ fail:
6926void rtl8192_cancel_deferred_work(struct r8192_priv* priv) 5866void rtl8192_cancel_deferred_work(struct r8192_priv* priv)
6927{ 5867{
6928 5868
6929#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
6930 cancel_work_sync(&priv->reset_wq); 5869 cancel_work_sync(&priv->reset_wq);
6931 cancel_delayed_work(&priv->watch_dog_wq); 5870 cancel_delayed_work(&priv->watch_dog_wq);
6932 cancel_delayed_work(&priv->update_beacon_wq); 5871 cancel_delayed_work(&priv->update_beacon_wq);
6933 cancel_work_sync(&priv->qos_activate); 5872 cancel_work_sync(&priv->qos_activate);
6934 //cancel_work_sync(&priv->SetBWModeWorkItem); 5873 //cancel_work_sync(&priv->SetBWModeWorkItem);
6935 //cancel_work_sync(&priv->SwChnlWorkItem); 5874 //cancel_work_sync(&priv->SwChnlWorkItem);
6936#else
6937#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
6938// cancel_delayed_work(&priv->reset_wq);
6939 cancel_delayed_work(&priv->watch_dog_wq);
6940 cancel_delayed_work(&priv->update_beacon_wq);
6941// cancel_delayed_work(&priv->qos_activate);
6942 //cancel_delayed_work(&priv->SetBWModeWorkItem);
6943 //cancel_delayed_work(&priv->SwChnlWorkItem);
6944#endif
6945#endif
6946 5875
6947} 5876}
6948 5877
6949 5878
6950#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
6951static void __devexit rtl8192_usb_disconnect(struct usb_interface *intf) 5879static void __devexit rtl8192_usb_disconnect(struct usb_interface *intf)
6952#else
6953static void __devexit rtl8192_usb_disconnect(struct usb_device *udev, void *ptr)
6954#endif
6955{ 5880{
6956#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
6957 struct net_device *dev = usb_get_intfdata(intf); 5881 struct net_device *dev = usb_get_intfdata(intf);
6958#else
6959 struct net_device *dev = (struct net_device *)ptr;
6960#endif
6961 5882
6962 struct r8192_priv *priv = ieee80211_priv(dev); 5883 struct r8192_priv *priv = ieee80211_priv(dev);
6963 if(dev){ 5884 if(dev){
@@ -6976,9 +5897,7 @@ static void __devexit rtl8192_usb_disconnect(struct usb_device *udev, void *ptr)
6976 // priv->rf_close(dev); 5897 // priv->rf_close(dev);
6977// rtl8192_SetRFPowerState(dev, eRfOff); 5898// rtl8192_SetRFPowerState(dev, eRfOff);
6978 rtl8192_usb_deleteendpoints(dev); 5899 rtl8192_usb_deleteendpoints(dev);
6979#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
6980 destroy_workqueue(priv->priv_wq); 5900 destroy_workqueue(priv->priv_wq);
6981#endif
6982 //rtl8192_irq_disable(dev); 5901 //rtl8192_irq_disable(dev);
6983 //rtl8192_reset(dev); 5902 //rtl8192_reset(dev);
6984 mdelay(10); 5903 mdelay(10);
@@ -7075,7 +5994,6 @@ void EnableHWSecurityConfig8192(struct net_device *dev)
7075 struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); 5994 struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
7076 struct ieee80211_device* ieee = priv->ieee80211; 5995 struct ieee80211_device* ieee = priv->ieee80211;
7077 SECR_value = SCR_TxEncEnable | SCR_RxDecEnable; 5996 SECR_value = SCR_TxEncEnable | SCR_RxDecEnable;
7078#if 1
7079 if (((KEY_TYPE_WEP40 == ieee->pairwise_key_type) || (KEY_TYPE_WEP104 == ieee->pairwise_key_type)) && (priv->ieee80211->auth_mode != 2)) 5997 if (((KEY_TYPE_WEP40 == ieee->pairwise_key_type) || (KEY_TYPE_WEP104 == ieee->pairwise_key_type)) && (priv->ieee80211->auth_mode != 2))
7080 { 5998 {
7081 SECR_value |= SCR_RxUseDK; 5999 SECR_value |= SCR_RxUseDK;
@@ -7086,7 +6004,6 @@ void EnableHWSecurityConfig8192(struct net_device *dev)
7086 SECR_value |= SCR_RxUseDK; 6004 SECR_value |= SCR_RxUseDK;
7087 SECR_value |= SCR_TxUseDK; 6005 SECR_value |= SCR_TxUseDK;
7088 } 6006 }
7089#endif
7090 //add HWSec active enable here. 6007 //add HWSec active enable here.
7091//default using hwsec. when peer AP is in N mode only and pairwise_key_type is none_aes(which HT_IOT_ACT_PURE_N_MODE indicates it), use software security. when peer AP is in b,g,n mode mixed and pairwise_key_type is none_aes, use g mode hw security. WB on 2008.7.4 6008//default using hwsec. when peer AP is in N mode only and pairwise_key_type is none_aes(which HT_IOT_ACT_PURE_N_MODE indicates it), use software security. when peer AP is in b,g,n mode mixed and pairwise_key_type is none_aes, use g mode hw security. WB on 2008.7.4
7092 6009
diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c
index 9c2505a0015b..2dde9fa5c21e 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -24,25 +24,11 @@ Major Change History:
24// 24//
25// Indicate different AP vendor for IOT issue. 25// Indicate different AP vendor for IOT issue.
26// 26//
27#if 0
28typedef enum _HT_IOT_PEER
29{
30 HT_IOT_PEER_UNKNOWN = 0,
31 HT_IOT_PEER_REALTEK = 1,
32 HT_IOT_PEER_BROADCOM = 2,
33 HT_IOT_PEER_RALINK = 3,
34 HT_IOT_PEER_ATHEROS = 4,
35 HT_IOT_PEER_CISCO = 5,
36 HT_IOT_PEER_MAX = 6
37}HT_IOT_PEER_E, *PHTIOT_PEER_E;
38#endif
39#if 1
40static u32 edca_setting_DL[HT_IOT_PEER_MAX] = 27static u32 edca_setting_DL[HT_IOT_PEER_MAX] =
41 { 0x5e4322, 0x5e4322, 0x5e4322, 0x604322, 0xa44f, 0x5ea44f}; 28 { 0x5e4322, 0x5e4322, 0x5e4322, 0x604322, 0xa44f, 0x5ea44f};
42static u32 edca_setting_UL[HT_IOT_PEER_MAX] = 29static u32 edca_setting_UL[HT_IOT_PEER_MAX] =
43 { 0x5e4322, 0xa44f, 0x5e4322, 0x604322, 0x5ea44f, 0x5ea44f}; 30 { 0x5e4322, 0xa44f, 0x5e4322, 0x604322, 0x5ea44f, 0x5ea44f};
44 31
45#endif
46 32
47#define RTK_UL_EDCA 0xa44f 33#define RTK_UL_EDCA 0xa44f
48#define RTK_DL_EDCA 0x5e4322 34#define RTK_DL_EDCA 0x5e4322
@@ -71,11 +57,7 @@ extern void hal_dm_watchdog(struct net_device *dev);
71 57
72 58
73extern void init_rate_adaptive(struct net_device *dev); 59extern void init_rate_adaptive(struct net_device *dev);
74#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
75extern void dm_txpower_trackingcallback(struct work_struct *work); 60extern void dm_txpower_trackingcallback(struct work_struct *work);
76#else
77extern void dm_txpower_trackingcallback(struct net_device *dev);
78#endif
79 61
80extern void dm_cck_txpower_adjust(struct net_device *dev,bool binch14); 62extern void dm_cck_txpower_adjust(struct net_device *dev,bool binch14);
81extern void dm_restore_dynamic_mechanism_state(struct net_device *dev); 63extern void dm_restore_dynamic_mechanism_state(struct net_device *dev);
@@ -91,15 +73,8 @@ extern void dm_force_tx_fw_info(struct net_device *dev,
91 u32 force_value); 73 u32 force_value);
92extern void dm_init_edca_turbo(struct net_device *dev); 74extern void dm_init_edca_turbo(struct net_device *dev);
93extern void dm_rf_operation_test_callback(unsigned long data); 75extern void dm_rf_operation_test_callback(unsigned long data);
94#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
95extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work); 76extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work);
96#else
97extern void dm_rf_pathcheck_workitemcallback(struct net_device *dev);
98#endif
99extern void dm_fsync_timer_callback(unsigned long data); 77extern void dm_fsync_timer_callback(unsigned long data);
100#if 0
101extern bool dm_check_lbus_status(struct net_device *dev);
102#endif
103extern void dm_check_fsync(struct net_device *dev); 78extern void dm_check_fsync(struct net_device *dev);
104extern void dm_shadow_init(struct net_device *dev); 79extern void dm_shadow_init(struct net_device *dev);
105 80
@@ -498,11 +473,9 @@ static void dm_check_rate_adaptive(struct net_device * dev)
498 } 473 }
499 474
500 // 2008.04.01 475 // 2008.04.01
501#if 1
502 // For RTL819X, if pairwisekey = wep/tkip, we support only MCS0~7. 476 // For RTL819X, if pairwisekey = wep/tkip, we support only MCS0~7.
503 if(priv->ieee80211->GetHalfNmodeSupportByAPsHandler(dev)) 477 if(priv->ieee80211->GetHalfNmodeSupportByAPsHandler(dev))
504 targetRATR &= 0xf00fffff; 478 targetRATR &= 0xf00fffff;
505#endif
506 479
507 // 480 //
508 // Check whether updating of RATR0 is required 481 // Check whether updating of RATR0 is required
@@ -884,29 +857,6 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device * dev)
884 857
885 //========================== 858 //==========================
886 // this is only for test, should be masked 859 // this is only for test, should be masked
887#if 0
888{
889 //UINT32 eRFPath;
890 //UINT32 start_rf, end_rf;
891 UINT32 curr_addr;
892 //UINT32 reg_addr;
893 //UINT32 reg_addr_end;
894 UINT32 reg_value;
895 //start_rf = RF90_PATH_A;
896 //end_rf = RF90_PATH_B;//RF90_PATH_MAX;
897 //reg_addr = 0x0;
898 //reg_addr_end = 0x2F;
899
900 for (curr_addr = 0; curr_addr < 0x2d; curr_addr++)
901 {
902 reg_value = PHY_QueryRFReg( Adapter, (RF90_RADIO_PATH_E)RF90_PATH_A,
903 curr_addr, bMaskDWord);
904 }
905
906 pHalData->TXPowercount = 0;
907 return;
908}
909#endif
910 //========================== 860 //==========================
911 861
912 // read and filter out unreasonable value 862 // read and filter out unreasonable value
@@ -981,17 +931,11 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device * dev)
981 priv->txpower_count = 0; 931 priv->txpower_count = 0;
982} 932}
983 933
984#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
985extern void dm_txpower_trackingcallback(struct work_struct *work) 934extern void dm_txpower_trackingcallback(struct work_struct *work)
986{ 935{
987 struct delayed_work *dwork = container_of(work,struct delayed_work,work); 936 struct delayed_work *dwork = container_of(work,struct delayed_work,work);
988 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,txpower_tracking_wq); 937 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,txpower_tracking_wq);
989 struct net_device *dev = priv->ieee80211->dev; 938 struct net_device *dev = priv->ieee80211->dev;
990#else
991extern void dm_txpower_trackingcallback(struct net_device *dev)
992{
993 struct r8192_priv *priv = ieee80211_priv(dev);
994#endif
995 939
996#ifdef RTL8190P 940#ifdef RTL8190P
997 dm_TXPowerTrackingCallback_TSSI(dev); 941 dm_TXPowerTrackingCallback_TSSI(dev);
@@ -1550,15 +1494,7 @@ static void dm_CheckTXPowerTracking_TSSI(struct net_device *dev)
1550 { 1494 {
1551 if((tx_power_track_counter % 30 == 0)&&(tx_power_track_counter != 0)) 1495 if((tx_power_track_counter % 30 == 0)&&(tx_power_track_counter != 0))
1552 { 1496 {
1553 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1554 queue_delayed_work(priv->priv_wq,&priv->txpower_tracking_wq,0); 1497 queue_delayed_work(priv->priv_wq,&priv->txpower_tracking_wq,0);
1555 #else
1556 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
1557 schedule_task(&priv->txpower_tracking_wq);
1558 #else
1559 queue_work(priv->priv_wq,&priv->txpower_tracking_wq);
1560 #endif
1561 #endif
1562 } 1498 }
1563 tx_power_track_counter++; 1499 tx_power_track_counter++;
1564 } 1500 }
@@ -1570,19 +1506,6 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev)
1570{ 1506{
1571 struct r8192_priv *priv = ieee80211_priv(dev); 1507 struct r8192_priv *priv = ieee80211_priv(dev);
1572 static u8 TM_Trigger=0; 1508 static u8 TM_Trigger=0;
1573#if 0
1574 u1Byte i;
1575 u4Byte tmpRegA;
1576 for(i=0; i<50; i++)
1577 {
1578 tmpRegA = PHY_QueryRFReg(Adapter, RF90_PATH_A, 0x12, 0x078); // 0x12: RF Reg[10:7]
1579 PHY_SetRFReg(Adapter, RF90_PATH_A, 0x02, bMask12Bits, 0x4d);
1580 //delay_us(100);
1581 PHY_SetRFReg(Adapter, RF90_PATH_A, 0x02, bMask12Bits, 0x4f);
1582 //delay_us(100);
1583 }
1584 DbgPrint("Trigger and readback ThermalMeter, write RF reg0x2 = 0x4d to 0x4f for 50 times\n");
1585#else
1586 //DbgPrint("dm_CheckTXPowerTracking() \n"); 1509 //DbgPrint("dm_CheckTXPowerTracking() \n");
1587 if(!priv->btxpower_tracking) 1510 if(!priv->btxpower_tracking)
1588 return; 1511 return;
@@ -1610,18 +1533,9 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev)
1610 else 1533 else
1611 { 1534 {
1612 //DbgPrint("Schedule TxPowerTrackingWorkItem\n"); 1535 //DbgPrint("Schedule TxPowerTrackingWorkItem\n");
1613 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1614 queue_delayed_work(priv->priv_wq,&priv->txpower_tracking_wq,0); 1536 queue_delayed_work(priv->priv_wq,&priv->txpower_tracking_wq,0);
1615 #else
1616 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
1617 schedule_task(&priv->txpower_tracking_wq);
1618 #else
1619 queue_work(priv->priv_wq,&priv->txpower_tracking_wq);
1620 #endif
1621 #endif
1622 TM_Trigger = 0; 1537 TM_Trigger = 0;
1623 } 1538 }
1624#endif
1625} 1539}
1626 1540
1627 1541
@@ -1829,14 +1743,6 @@ extern void dm_restore_dynamic_mechanism_state(struct net_device *dev)
1829 //cosa PlatformEFIOWrite4Byte(Adapter, RATR0, ((pu4Byte)(val))[0]); 1743 //cosa PlatformEFIOWrite4Byte(Adapter, RATR0, ((pu4Byte)(val))[0]);
1830 write_nic_dword(dev, RATR0, ratr_value); 1744 write_nic_dword(dev, RATR0, ratr_value);
1831 write_nic_byte(dev, UFWP, 1); 1745 write_nic_byte(dev, UFWP, 1);
1832#if 0 // Disable old code.
1833 u1Byte index;
1834 u4Byte input_value;
1835 index = (u1Byte)((((pu4Byte)(val))[0]) >> 28);
1836 input_value = (((pu4Byte)(val))[0]) & 0x0fffffff;
1837 // TODO: Correct it. Emily 2007.01.11
1838 PlatformEFIOWrite4Byte(Adapter, RATR0+index*4, input_value);
1839#endif
1840 } 1746 }
1841 //Resore TX Power Tracking Index 1747 //Resore TX Power Tracking Index
1842 if(priv->btxpower_trackingInit && priv->btxpower_tracking){ 1748 if(priv->btxpower_trackingInit && priv->btxpower_tracking){
@@ -2099,28 +2005,6 @@ dm_change_rxpath_selection_setting(
2099 } 2005 }
2100} 2006}
2101 2007
2102#if 0
2103extern void dm_force_tx_fw_info(struct net_device *dev,
2104 u32 force_type,
2105 u32 force_value)
2106{
2107 struct r8192_priv *priv = ieee80211_priv(dev);
2108
2109 if (force_type == 0) // don't force TxSC
2110 {
2111 //DbgPrint("Set Force SubCarrier Off\n");
2112 priv->tx_fwinfo_force_subcarriermode = 0;
2113 }
2114 else if(force_type == 1) //force
2115 {
2116 //DbgPrint("Set Force SubCarrier On\n");
2117 priv->tx_fwinfo_force_subcarriermode = 1;
2118 if(force_value > 3)
2119 force_value = 3;
2120 priv->tx_fwinfo_force_subcarrierval = (u8)force_value;
2121 }
2122}
2123#endif
2124 2008
2125/*----------------------------------------------------------------------------- 2009/*-----------------------------------------------------------------------------
2126 * Function: dm_dig_init() 2010 * Function: dm_dig_init()
@@ -2759,7 +2643,6 @@ extern void dm_init_edca_turbo(struct net_device * dev)
2759 priv->bis_cur_rdlstate = false; 2643 priv->bis_cur_rdlstate = false;
2760} // dm_init_edca_turbo 2644} // dm_init_edca_turbo
2761 2645
2762#if 1
2763static void dm_check_edca_turbo( 2646static void dm_check_edca_turbo(
2764 struct net_device * dev) 2647 struct net_device * dev)
2765{ 2648{
@@ -2777,10 +2660,8 @@ static void dm_check_edca_turbo(
2777 // Do not be Turbo if it's under WiFi config and Qos Enabled, because the EDCA parameters 2660 // Do not be Turbo if it's under WiFi config and Qos Enabled, because the EDCA parameters
2778 // should follow the settings from QAP. By Bruce, 2007-12-07. 2661 // should follow the settings from QAP. By Bruce, 2007-12-07.
2779 // 2662 //
2780 #if 1
2781 if(priv->ieee80211->state != IEEE80211_LINKED) 2663 if(priv->ieee80211->state != IEEE80211_LINKED)
2782 goto dm_CheckEdcaTurbo_EXIT; 2664 goto dm_CheckEdcaTurbo_EXIT;
2783 #endif
2784 // We do not turn on EDCA turbo mode for some AP that has IOT issue 2665 // We do not turn on EDCA turbo mode for some AP that has IOT issue
2785 if(priv->ieee80211->pHTInfo->IOTAction & HT_IOT_ACT_DISABLE_EDCA_TURBO) 2666 if(priv->ieee80211->pHTInfo->IOTAction & HT_IOT_ACT_DISABLE_EDCA_TURBO)
2786 goto dm_CheckEdcaTurbo_EXIT; 2667 goto dm_CheckEdcaTurbo_EXIT;
@@ -2871,7 +2752,6 @@ dm_CheckEdcaTurbo_EXIT:
2871 lastTxOkCnt = priv->stats.txbytesunicast; 2752 lastTxOkCnt = priv->stats.txbytesunicast;
2872 lastRxOkCnt = priv->stats.rxbytesunicast; 2753 lastRxOkCnt = priv->stats.rxbytesunicast;
2873} // dm_CheckEdcaTurbo 2754} // dm_CheckEdcaTurbo
2874#endif
2875 2755
2876extern void DM_CTSToSelfSetting(struct net_device * dev,u32 DM_Type, u32 DM_Value) 2756extern void DM_CTSToSelfSetting(struct net_device * dev,u32 DM_Type, u32 DM_Value)
2877{ 2757{
@@ -2932,20 +2812,7 @@ static void dm_ctstoself(struct net_device *dev)
2932 } 2812 }
2933 else //uplink 2813 else //uplink
2934 { 2814 {
2935 #if 1
2936 pHTInfo->IOTAction |= HT_IOT_ACT_FORCED_CTS2SELF; 2815 pHTInfo->IOTAction |= HT_IOT_ACT_FORCED_CTS2SELF;
2937 #else
2938 if(priv->undecorated_smoothed_pwdb < priv->ieee80211->CTSToSelfTH) // disable CTS to self
2939 {
2940 pHTInfo->IOTAction &= ~HT_IOT_ACT_FORCED_CTS2SELF;
2941 //DbgPrint("dm_CTSToSelf() ==> CTS to self disabled\n");
2942 }
2943 else if(priv->undecorated_smoothed_pwdb >= (priv->ieee80211->CTSToSelfTH+5)) // enable CTS to self
2944 {
2945 pHTInfo->IOTAction |= HT_IOT_ACT_FORCED_CTS2SELF;
2946 //DbgPrint("dm_CTSToSelf() ==> CTS to self enabled\n");
2947 }
2948 #endif
2949 } 2816 }
2950 2817
2951 lastTxOkCnt = priv->stats.txbytesunicast; 2818 lastTxOkCnt = priv->stats.txbytesunicast;
@@ -2954,79 +2821,6 @@ static void dm_ctstoself(struct net_device *dev)
2954} 2821}
2955 2822
2956 2823
2957#if 0
2958/*-----------------------------------------------------------------------------
2959 * Function: dm_rf_operation_test_callback()
2960 *
2961 * Overview: Only for RF operation test now.
2962 *
2963 * Input: NONE
2964 *
2965 * Output: NONE
2966 *
2967 * Return: NONE
2968 *
2969 * Revised History:
2970 * When Who Remark
2971 * 05/29/2008 amy Create Version 0 porting from windows code.
2972 *
2973 *---------------------------------------------------------------------------*/
2974extern void dm_rf_operation_test_callback(unsigned long dev)
2975{
2976// struct r8192_priv *priv = ieee80211_priv((struct net_device *)dev);
2977 u8 erfpath;
2978
2979
2980 for(erfpath=0; erfpath<4; erfpath++)
2981 {
2982 //DbgPrint("Set RF-%d\n\r", eRFPath);
2983 //PHY_SetRFReg(Adapter, (RF90_RADIO_PATH_E)eRFPath, 0x2c, bMask12Bits, 0x3d7);
2984 udelay(100);
2985 }
2986
2987 {
2988 //PlatformSetPeriodicTimer(Adapter, &pHalData->RfTest1Timer, 500);
2989 }
2990
2991 // For test
2992 {
2993 //u8 i;
2994 //PlatformSetPeriodicTimer(Adapter, &pHalData->RfTest1Timer, 500);
2995#if 0
2996 for(i=0; i<50; i++)
2997 {
2998 // Write Test
2999 PHY_SetRFReg(Adapter, RF90_PATH_A, 0x02, bMask12Bits, 0x4d);
3000 //delay_us(100);
3001 PHY_SetRFReg(Adapter, RF90_PATH_A, 0x02, bMask12Bits, 0x4f);
3002 //delay_us(100);
3003 PHY_SetRFReg(Adapter, RF90_PATH_C, 0x02, bMask12Bits, 0x4d);
3004 //delay_us(100);
3005 PHY_SetRFReg(Adapter, RF90_PATH_C, 0x02, bMask12Bits, 0x4f);
3006 //delay_us(100);
3007
3008#if 0
3009 // Read test
3010 PHY_QueryRFReg(Adapter, RF90_PATH_A, 0x02, bMask12Bits);
3011 //delay_us(100);
3012 PHY_QueryRFReg(Adapter, RF90_PATH_A, 0x02, bMask12Bits);
3013 //delay_us(100);
3014 PHY_QueryRFReg(Adapter, RF90_PATH_A, 0x12, bMask12Bits);
3015 //delay_us(100);
3016 PHY_QueryRFReg(Adapter, RF90_PATH_A, 0x12, bMask12Bits);
3017 //delay_us(100);
3018 PHY_QueryRFReg(Adapter, RF90_PATH_A, 0x21, bMask12Bits);
3019 //delay_us(100);
3020 PHY_QueryRFReg(Adapter, RF90_PATH_A, 0x21, bMask12Bits);
3021 //delay_us(100);
3022#endif
3023 }
3024#endif
3025 }
3026
3027} /* DM_RfOperationTestCallBack */
3028#endif
3029
3030/*----------------------------------------------------------------------------- 2824/*-----------------------------------------------------------------------------
3031 * Function: dm_check_rfctrl_gpio() 2825 * Function: dm_check_rfctrl_gpio()
3032 * 2826 *
@@ -3043,7 +2837,6 @@ extern void dm_rf_operation_test_callback(unsigned long dev)
3043 * 05/28/2008 amy Create Version 0 porting from windows code. 2837 * 05/28/2008 amy Create Version 0 porting from windows code.
3044 * 2838 *
3045 *---------------------------------------------------------------------------*/ 2839 *---------------------------------------------------------------------------*/
3046#if 1
3047static void dm_check_rfctrl_gpio(struct net_device * dev) 2840static void dm_check_rfctrl_gpio(struct net_device * dev)
3048{ 2841{
3049 //struct r8192_priv *priv = ieee80211_priv(dev); 2842 //struct r8192_priv *priv = ieee80211_priv(dev);
@@ -3060,20 +2853,11 @@ static void dm_check_rfctrl_gpio(struct net_device * dev)
3060 return; 2853 return;
3061#endif 2854#endif
3062#ifdef RTL8192E 2855#ifdef RTL8192E
3063 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
3064 queue_delayed_work(priv->priv_wq,&priv->gpio_change_rf_wq,0); 2856 queue_delayed_work(priv->priv_wq,&priv->gpio_change_rf_wq,0);
3065 #else
3066 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
3067 schedule_task(&priv->gpio_change_rf_wq);
3068 #else
3069 queue_work(priv->priv_wq,&priv->gpio_change_rf_wq);
3070 #endif
3071 #endif
3072#endif 2857#endif
3073 2858
3074} /* dm_CheckRfCtrlGPIO */ 2859} /* dm_CheckRfCtrlGPIO */
3075 2860
3076#endif
3077/*----------------------------------------------------------------------------- 2861/*-----------------------------------------------------------------------------
3078 * Function: dm_check_pbc_gpio() 2862 * Function: dm_check_pbc_gpio()
3079 * 2863 *
@@ -3129,17 +2913,11 @@ static void dm_check_pbc_gpio(struct net_device *dev)
3129 * 02/21/2008 MHC Create Version 0. 2913 * 02/21/2008 MHC Create Version 0.
3130 * 2914 *
3131 *---------------------------------------------------------------------------*/ 2915 *---------------------------------------------------------------------------*/
3132 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
3133extern void dm_gpio_change_rf_callback(struct work_struct *work) 2916extern void dm_gpio_change_rf_callback(struct work_struct *work)
3134{ 2917{
3135 struct delayed_work *dwork = container_of(work,struct delayed_work,work); 2918 struct delayed_work *dwork = container_of(work,struct delayed_work,work);
3136 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,gpio_change_rf_wq); 2919 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,gpio_change_rf_wq);
3137 struct net_device *dev = priv->ieee80211->dev; 2920 struct net_device *dev = priv->ieee80211->dev;
3138#else
3139extern void dm_gpio_change_rf_callback(struct net_device *dev)
3140{
3141 struct r8192_priv *priv = ieee80211_priv(dev);
3142#endif
3143 u8 tmp1byte; 2921 u8 tmp1byte;
3144 RT_RF_POWER_STATE eRfPowerStateToSet; 2922 RT_RF_POWER_STATE eRfPowerStateToSet;
3145 bool bActuallySet = false; 2923 bool bActuallySet = false;
@@ -3207,17 +2985,11 @@ extern void dm_gpio_change_rf_callback(struct net_device *dev)
3207 * 01/30/2008 MHC Create Version 0. 2985 * 01/30/2008 MHC Create Version 0.
3208 * 2986 *
3209 *---------------------------------------------------------------------------*/ 2987 *---------------------------------------------------------------------------*/
3210#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
3211extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work) 2988extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work)
3212{ 2989{
3213 struct delayed_work *dwork = container_of(work,struct delayed_work,work); 2990 struct delayed_work *dwork = container_of(work,struct delayed_work,work);
3214 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,rfpath_check_wq); 2991 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,rfpath_check_wq);
3215 struct net_device *dev =priv->ieee80211->dev; 2992 struct net_device *dev =priv->ieee80211->dev;
3216#else
3217extern void dm_rf_pathcheck_workitemcallback(struct net_device *dev)
3218{
3219 struct r8192_priv *priv = ieee80211_priv(dev);
3220#endif
3221 //bool bactually_set = false; 2993 //bool bactually_set = false;
3222 u8 rfpath = 0, i; 2994 u8 rfpath = 0, i;
3223 2995
@@ -3542,15 +3314,7 @@ static void dm_rxpath_sel_byrssi(struct net_device * dev)
3542static void dm_check_rx_path_selection(struct net_device *dev) 3314static void dm_check_rx_path_selection(struct net_device *dev)
3543{ 3315{
3544 struct r8192_priv *priv = ieee80211_priv(dev); 3316 struct r8192_priv *priv = ieee80211_priv(dev);
3545#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
3546 queue_delayed_work(priv->priv_wq,&priv->rfpath_check_wq,0); 3317 queue_delayed_work(priv->priv_wq,&priv->rfpath_check_wq,0);
3547#else
3548#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
3549 schedule_task(&priv->rfpath_check_wq);
3550#else
3551 queue_work(priv->priv_wq,&priv->rfpath_check_wq);
3552#endif
3553#endif
3554} /* dm_CheckRxRFPath */ 3318} /* dm_CheckRxRFPath */
3555 3319
3556 3320
@@ -3898,12 +3662,6 @@ void dm_check_fsync(struct net_device *dev)
3898 #endif 3662 #endif
3899 3663
3900 reg_c38_State = RegC38_NonFsync_Other_AP; 3664 reg_c38_State = RegC38_NonFsync_Other_AP;
3901 #if 0//cosa
3902 if (Adapter->HardwareType == HARDWARE_TYPE_RTL8190P)
3903 DbgPrint("Fsync is idle, rssi<=35, write 0xc38 = 0x%x \n", 0x10);
3904 else
3905 DbgPrint("Fsync is idle, rssi<=35, write 0xc38 = 0x%x \n", 0x90);
3906 #endif
3907 } 3665 }
3908 } 3666 }
3909 else if(priv->undecorated_smoothed_pwdb >= (RegC38_TH+5)) 3667 else if(priv->undecorated_smoothed_pwdb >= (RegC38_TH+5))
@@ -3948,50 +3706,6 @@ void dm_check_fsync(struct net_device *dev)
3948 } 3706 }
3949} 3707}
3950 3708
3951#if 0
3952/*-----------------------------------------------------------------------------
3953 * Function: DM_CheckLBusStatus()
3954 *
3955 * Overview: For 9x series, we must make sure LBUS is active for IO.
3956 *
3957 * Input: NONE
3958 *
3959 * Output: NONE
3960 *
3961 * Return: NONE
3962 *
3963 * Revised History:
3964 * When Who Remark
3965 * 02/22/2008 MHC Create Version 0.
3966 *
3967 *---------------------------------------------------------------------------*/
3968extern s1Byte DM_CheckLBusStatus(IN PADAPTER Adapter)
3969{
3970 PMGNT_INFO pMgntInfo=&Adapter->MgntInfo;
3971
3972#if (HAL_CODE_BASE & RTL819X)
3973
3974#if (HAL_CODE_BASE == RTL8192)
3975
3976#if( DEV_BUS_TYPE==PCI_INTERFACE)
3977 //return (pMgntInfo->bLbusEnable); // For debug only
3978 return TRUE;
3979#endif
3980
3981#if( DEV_BUS_TYPE==USB_INTERFACE)
3982 return TRUE;
3983#endif
3984
3985#endif // #if (HAL_CODE_BASE == RTL8192)
3986
3987#if (HAL_CODE_BASE == RTL8190)
3988 return TRUE;
3989#endif // #if (HAL_CODE_BASE == RTL8190)
3990
3991#endif // #if (HAL_CODE_BASE & RTL819X)
3992} /* DM_CheckLBusStatus */
3993
3994#endif
3995 3709
3996/*----------------------------------------------------------------------------- 3710/*-----------------------------------------------------------------------------
3997 * Function: dm_shadow_init() 3711 * Function: dm_shadow_init()
@@ -4164,14 +3878,12 @@ static void dm_send_rssi_tofw(struct net_device *dev)
4164 // 0x1e0(byte) to botify driver. 3878 // 0x1e0(byte) to botify driver.
4165 write_nic_byte(dev, DRIVER_RSSI, (u8)priv->undecorated_smoothed_pwdb); 3879 write_nic_byte(dev, DRIVER_RSSI, (u8)priv->undecorated_smoothed_pwdb);
4166 return; 3880 return;
4167#if 1
4168 tx_cmd.Op = TXCMD_SET_RX_RSSI; 3881 tx_cmd.Op = TXCMD_SET_RX_RSSI;
4169 tx_cmd.Length = 4; 3882 tx_cmd.Length = 4;
4170 tx_cmd.Value = priv->undecorated_smoothed_pwdb; 3883 tx_cmd.Value = priv->undecorated_smoothed_pwdb;
4171 3884
4172 cmpk_message_handle_tx(dev, (u8*)&tx_cmd, 3885 cmpk_message_handle_tx(dev, (u8*)&tx_cmd,
4173 DESC_PACKET_TYPE_INIT, sizeof(DCMD_TXCMD_T)); 3886 DESC_PACKET_TYPE_INIT, sizeof(DCMD_TXCMD_T));
4174#endif
4175} 3887}
4176 3888
4177/*---------------------------Define function prototype------------------------*/ 3889/*---------------------------Define function prototype------------------------*/
diff --git a/drivers/staging/rtl8192u/r8192U_dm.h b/drivers/staging/rtl8192u/r8192U_dm.h
index 1a619d239dc7..3ceb59b9eca7 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.h
+++ b/drivers/staging/rtl8192u/r8192U_dm.h
@@ -62,50 +62,6 @@
62#define Initial_Tx_Rate_Reg 0x1b9 62#define Initial_Tx_Rate_Reg 0x1b9
63#define Tx_Retry_Count_Reg 0x1ac 63#define Tx_Retry_Count_Reg 0x1ac
64#define RegC38_TH 20 64#define RegC38_TH 20
65#if 0
66//----------------------------------------------------------------------------
67// 8190 Rate Adaptive Table Register (offset 0x320, 4 byte)
68//----------------------------------------------------------------------------
69
70//CCK
71#define RATR_1M 0x00000001
72#define RATR_2M 0x00000002
73#define RATR_55M 0x00000004
74#define RATR_11M 0x00000008
75//OFDM
76#define RATR_6M 0x00000010
77#define RATR_9M 0x00000020
78#define RATR_12M 0x00000040
79#define RATR_18M 0x00000080
80#define RATR_24M 0x00000100
81#define RATR_36M 0x00000200
82#define RATR_48M 0x00000400
83#define RATR_54M 0x00000800
84//MCS 1 Spatial Stream
85#define RATR_MCS0 0x00001000
86#define RATR_MCS1 0x00002000
87#define RATR_MCS2 0x00004000
88#define RATR_MCS3 0x00008000
89#define RATR_MCS4 0x00010000
90#define RATR_MCS5 0x00020000
91#define RATR_MCS6 0x00040000
92#define RATR_MCS7 0x00080000
93//MCS 2 Spatial Stream
94#define RATR_MCS8 0x00100000
95#define RATR_MCS9 0x00200000
96#define RATR_MCS10 0x00400000
97#define RATR_MCS11 0x00800000
98#define RATR_MCS12 0x01000000
99#define RATR_MCS13 0x02000000
100#define RATR_MCS14 0x04000000
101#define RATR_MCS15 0x08000000
102// ALL CCK Rate
103#define RATE_ALL_CCK RATR_1M|RATR_2M|RATR_55M|RATR_11M
104#define RATE_ALL_OFDM_AG RATR_6M|RATR_9M|RATR_12M|RATR_18M|RATR_24M\
105 |RATR_36M|RATR_48M|RATR_54M
106#define RATE_ALL_OFDM_2SS RATR_MCS8|RATR_MCS9 |RATR_MCS10|RATR_MCS11| \
107 RATR_MCS12|RATR_MCS13|RATR_MCS14|RATR_MCS15
108#endif
109/*--------------------------Define Parameters-------------------------------*/ 65/*--------------------------Define Parameters-------------------------------*/
110 66
111 67
@@ -275,11 +231,7 @@ extern void deinit_hal_dm(struct net_device *dev);
275extern void hal_dm_watchdog(struct net_device *dev); 231extern void hal_dm_watchdog(struct net_device *dev);
276 232
277extern void init_rate_adaptive(struct net_device *dev); 233extern void init_rate_adaptive(struct net_device *dev);
278#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
279extern void dm_txpower_trackingcallback(struct work_struct *work); 234extern void dm_txpower_trackingcallback(struct work_struct *work);
280#else
281extern void dm_txpower_trackingcallback(struct net_device *dev);
282#endif
283extern void dm_restore_dynamic_mechanism_state(struct net_device *dev); 235extern void dm_restore_dynamic_mechanism_state(struct net_device *dev);
284extern void dm_backup_dynamic_mechanism_state(struct net_device *dev); 236extern void dm_backup_dynamic_mechanism_state(struct net_device *dev);
285extern void dm_change_dynamic_initgain_thresh(struct net_device *dev, 237extern void dm_change_dynamic_initgain_thresh(struct net_device *dev,
@@ -287,16 +239,9 @@ extern void dm_change_dynamic_initgain_thresh(struct net_device *dev,
287extern void dm_force_tx_fw_info(struct net_device *dev,u32 force_type, u32 force_value); 239extern void dm_force_tx_fw_info(struct net_device *dev,u32 force_type, u32 force_value);
288extern void dm_init_edca_turbo(struct net_device *dev); 240extern void dm_init_edca_turbo(struct net_device *dev);
289extern void dm_rf_operation_test_callback(unsigned long data); 241extern void dm_rf_operation_test_callback(unsigned long data);
290#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
291extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work); 242extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work);
292#else
293extern void dm_rf_pathcheck_workitemcallback(struct net_device *dev);
294#endif
295extern void dm_fsync_timer_callback(unsigned long data); 243extern void dm_fsync_timer_callback(unsigned long data);
296extern void dm_cck_txpower_adjust(struct net_device *dev,bool binch14); 244extern void dm_cck_txpower_adjust(struct net_device *dev,bool binch14);
297#if 0
298extern char dm_check_lbus_status(IN PADAPTER Adapter);
299#endif
300extern void dm_shadow_init(struct net_device *dev); 245extern void dm_shadow_init(struct net_device *dev);
301extern void dm_initialize_txpower_tracking(struct net_device *dev); 246extern void dm_initialize_txpower_tracking(struct net_device *dev);
302/*--------------------------Exported Function prototype---------------------*/ 247/*--------------------------Exported Function prototype---------------------*/
diff --git a/drivers/staging/rtl8192u/r8192U_hw.h b/drivers/staging/rtl8192u/r8192U_hw.h
index 0f959eda8598..e89aaf70143b 100644
--- a/drivers/staging/rtl8192u/r8192U_hw.h
+++ b/drivers/staging/rtl8192u/r8192U_hw.h
@@ -39,15 +39,6 @@ typedef enum _BaseBand_Config_Type{
39 BaseBand_Config_PHY_REG = 0, //Radio Path A 39 BaseBand_Config_PHY_REG = 0, //Radio Path A
40 BaseBand_Config_AGC_TAB = 1, //Radio Path B 40 BaseBand_Config_AGC_TAB = 1, //Radio Path B
41}BaseBand_Config_Type, *PBaseBand_Config_Type; 41}BaseBand_Config_Type, *PBaseBand_Config_Type;
42#if 0
43typedef enum _RT_RF_TYPE_819xU{
44 RF_TYPE_MIN = 0,
45 RF_8225,
46 RF_8256,
47 RF_8258,
48 RF_PSEUDO_11N = 4,
49}RT_RF_TYPE_819xU, *PRT_RF_TYPE_819xU;
50#endif
51#define RTL8187_REQT_READ 0xc0 42#define RTL8187_REQT_READ 0xc0
52#define RTL8187_REQT_WRITE 0x40 43#define RTL8187_REQT_WRITE 0x40
53#define RTL8187_REQ_GET_REGS 0x05 44#define RTL8187_REQ_GET_REGS 0x05
@@ -408,332 +399,6 @@ enum _RTL8192Usb_HW {
408 MAC4 = 0x004, 399 MAC4 = 0x004,
409 MAC5 = 0x005, 400 MAC5 = 0x005,
410 401
411#if 0
412/* 0x0006 - 0x0007 - reserved */
413 RXFIFOCOUNT = 0x010,
414 TXFIFOCOUNT = 0x012,
415 BQREQ = 0x013,
416/* 0x0010 - 0x0017 - reserved */
417 TSFTR = 0x018,
418 TLPDA = 0x020,
419 TNPDA = 0x024,
420 THPDA = 0x028,
421 BSSID = 0x02E,
422 RESP_RATE = 0x034,
423 CMD = 0x037,
424#define CMD_RST_SHIFT 4
425#define CMD_RESERVED_MASK ((1<<1) | (1<<5) | (1<<6) | (1<<7))
426#define CMD_RX_ENABLE_SHIFT 3
427#define CMD_TX_ENABLE_SHIFT 2
428#define CR_RST ((1<< 4))
429#define CR_RE ((1<< 3))
430#define CR_TE ((1<< 2))
431#define CR_MulRW ((1<< 0))
432
433 INTA_MASK = 0x03c,
434 INTA = 0x03e,
435#define INTA_TXOVERFLOW (1<<15)
436#define INTA_TIMEOUT (1<<14)
437#define INTA_BEACONTIMEOUT (1<<13)
438#define INTA_ATIM (1<<12)
439#define INTA_BEACONDESCERR (1<<11)
440#define INTA_BEACONDESCOK (1<<10)
441#define INTA_HIPRIORITYDESCERR (1<<9)
442#define INTA_HIPRIORITYDESCOK (1<<8)
443#define INTA_NORMPRIORITYDESCERR (1<<7)
444#define INTA_NORMPRIORITYDESCOK (1<<6)
445#define INTA_RXOVERFLOW (1<<5)
446#define INTA_RXDESCERR (1<<4)
447#define INTA_LOWPRIORITYDESCERR (1<<3)
448#define INTA_LOWPRIORITYDESCOK (1<<2)
449#define INTA_RXCRCERR (1<<1)
450#define INTA_RXOK (1)
451 TX_CONF = 0x040,
452#define TX_CONF_HEADER_AUTOICREMENT_SHIFT 30
453#define TX_LOOPBACK_SHIFT 17
454#define TX_LOOPBACK_MAC 1
455#define TX_LOOPBACK_BASEBAND 2
456#define TX_LOOPBACK_NONE 0
457#define TX_LOOPBACK_CONTINUE 3
458#define TX_LOOPBACK_MASK ((1<<17)|(1<<18))
459#define TX_LRLRETRY_SHIFT 0
460#define TX_SRLRETRY_SHIFT 8
461#define TX_NOICV_SHIFT 19
462#define TX_NOCRC_SHIFT 16
463#define TCR_DurProcMode ((1<<30))
464#define TCR_DISReqQsize ((1<<28))
465#define TCR_HWVERID_MASK ((1<<27)|(1<<26)|(1<<25))
466#define TCR_HWVERID_SHIFT 25
467#define TCR_SWPLCPLEN ((1<<24))
468#define TCR_PLCP_LEN TCR_SAT // rtl8180
469#define TCR_MXDMA_MASK ((1<<23)|(1<<22)|(1<<21))
470#define TCR_MXDMA_1024 6
471#define TCR_MXDMA_2048 7
472#define TCR_MXDMA_SHIFT 21
473#define TCR_DISCW ((1<<20))
474#define TCR_ICV ((1<<19))
475#define TCR_LBK ((1<<18)|(1<<17))
476#define TCR_LBK1 ((1<<18))
477#define TCR_LBK0 ((1<<17))
478#define TCR_CRC ((1<<16))
479#define TCR_SRL_MASK ((1<<15)|(1<<14)|(1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8))
480#define TCR_LRL_MASK ((1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7))
481#define TCR_PROBE_NOTIMESTAMP_SHIFT 29 //rtl8185
482 RX_CONF = 0x044,
483#define MAC_FILTER_MASK ((1<<0) | (1<<1) | (1<<2) | (1<<3) | (1<<5) | \
484(1<<12) | (1<<18) | (1<<19) | (1<<20) | (1<<21) | (1<<22) | (1<<23))
485#define RX_CHECK_BSSID_SHIFT 23
486#define ACCEPT_PWR_FRAME_SHIFT 22
487#define ACCEPT_MNG_FRAME_SHIFT 20
488#define ACCEPT_CTL_FRAME_SHIFT 19
489#define ACCEPT_DATA_FRAME_SHIFT 18
490#define ACCEPT_ICVERR_FRAME_SHIFT 12
491#define ACCEPT_CRCERR_FRAME_SHIFT 5
492#define ACCEPT_BCAST_FRAME_SHIFT 3
493#define ACCEPT_MCAST_FRAME_SHIFT 2
494#define ACCEPT_ALLMAC_FRAME_SHIFT 0
495#define ACCEPT_NICMAC_FRAME_SHIFT 1
496#define RX_FIFO_THRESHOLD_MASK ((1<<13) | (1<<14) | (1<<15))
497#define RX_FIFO_THRESHOLD_SHIFT 13
498#define RX_FIFO_THRESHOLD_128 3
499#define RX_FIFO_THRESHOLD_256 4
500#define RX_FIFO_THRESHOLD_512 5
501#define RX_FIFO_THRESHOLD_1024 6
502#define RX_FIFO_THRESHOLD_NONE 7
503#define RX_AUTORESETPHY_SHIFT 28
504#define MAX_RX_DMA_MASK ((1<<8) | (1<<9) | (1<<10))
505#define MAX_RX_DMA_2048 7
506#define MAX_RX_DMA_1024 6
507#define MAX_RX_DMA_SHIFT 10
508#define RCR_ONLYERLPKT ((1<<31))
509#define RCR_CS_SHIFT 29
510#define RCR_CS_MASK ((1<<30) | (1<<29))
511#define RCR_ENMARP ((1<<28))
512#define RCR_CBSSID ((1<<23))
513#define RCR_APWRMGT ((1<<22))
514#define RCR_ADD3 ((1<<21))
515#define RCR_AMF ((1<<20))
516#define RCR_ACF ((1<<19))
517#define RCR_ADF ((1<<18))
518#define RCR_RXFTH ((1<<15)|(1<<14)|(1<<13))
519#define RCR_RXFTH2 ((1<<15))
520#define RCR_RXFTH1 ((1<<14))
521#define RCR_RXFTH0 ((1<<13))
522#define RCR_AICV ((1<<12))
523#define RCR_MXDMA ((1<<10)|(1<< 9)|(1<< 8))
524#define RCR_MXDMA2 ((1<<10))
525#define RCR_MXDMA1 ((1<< 9))
526#define RCR_MXDMA0 ((1<< 8))
527#define RCR_9356SEL ((1<< 6))
528#define RCR_ACRC32 ((1<< 5))
529#define RCR_AB ((1<< 3))
530#define RCR_AM ((1<< 2))
531#define RCR_APM ((1<< 1))
532#define RCR_AAP ((1<< 0))
533 INT_TIMEOUT = 0x048,
534 TX_BEACON_RING_ADDR = 0x04c,
535 EPROM_CMD = 0x58,
536#define EPROM_CMD_RESERVED_MASK ((1<<5)|(1<<4))
537#define EPROM_CMD_OPERATING_MODE_SHIFT 6
538#define EPROM_CMD_OPERATING_MODE_MASK ((1<<7)|(1<<6))
539#define EPROM_CMD_CONFIG 0x3
540#define EPROM_CMD_NORMAL 0
541#define EPROM_CMD_LOAD 1
542#define EPROM_CMD_PROGRAM 2
543#define EPROM_CS_SHIFT 3
544#define EPROM_CK_SHIFT 2
545#define EPROM_W_SHIFT 1
546#define EPROM_R_SHIFT 0
547 CONFIG0 = 0x051,
548#define CONFIG0_WEP104 ((1<<6))
549#define CONFIG0_LEDGPO_En ((1<<4))
550#define CONFIG0_Aux_Status ((1<<3))
551#define CONFIG0_GL ((1<<1)|(1<<0))
552#define CONFIG0_GL1 ((1<<1))
553#define CONFIG0_GL0 ((1<<0))
554 CONFIG1 = 0x052,
555#define CONFIG1_LEDS ((1<<7)|(1<<6))
556#define CONFIG1_LEDS1 ((1<<7))
557#define CONFIG1_LEDS0 ((1<<6))
558#define CONFIG1_LWACT ((1<<4))
559#define CONFIG1_MEMMAP ((1<<3))
560#define CONFIG1_IOMAP ((1<<2))
561#define CONFIG1_VPD ((1<<1))
562#define CONFIG1_PMEn ((1<<0))
563 CONFIG2 = 0x053,
564#define CONFIG2_LCK ((1<<7))
565#define CONFIG2_ANT ((1<<6))
566#define CONFIG2_DPS ((1<<3))
567#define CONFIG2_PAPE_sign ((1<<2))
568#define CONFIG2_PAPE_time ((1<<1)|(1<<0))
569#define CONFIG2_PAPE_time1 ((1<<1))
570#define CONFIG2_PAPE_time0 ((1<<0))
571 ANA_PARAM = 0x054,
572 CONFIG3 = 0x059,
573#define CONFIG3_GNTSel ((1<<7))
574#define CONFIG3_PARM_En ((1<<6))
575#define CONFIG3_Magic ((1<<5))
576#define CONFIG3_CardB_En ((1<<3))
577#define CONFIG3_CLKRUN_En ((1<<2))
578#define CONFIG3_FuncRegEn ((1<<1))
579#define CONFIG3_FBtbEn ((1<<0))
580#define CONFIG3_CLKRUN_SHIFT 2
581#define CONFIG3_ANAPARAM_W_SHIFT 6
582 CONFIG4 = 0x05a,
583#define CONFIG4_VCOPDN ((1<<7))
584#define CONFIG4_PWROFF ((1<<6))
585#define CONFIG4_PWRMGT ((1<<5))
586#define CONFIG4_LWPME ((1<<4))
587#define CONFIG4_LWPTN ((1<<2))
588#define CONFIG4_RFTYPE ((1<<1)|(1<<0))
589#define CONFIG4_RFTYPE1 ((1<<1))
590#define CONFIG4_RFTYPE0 ((1<<0))
591 TESTR = 0x05b,
592#define TFPC_AC 0x05C
593
594#define SCR 0x05F
595 PGSELECT = 0x05e,
596#define PGSELECT_PG_SHIFT 0
597 SECURITY = 0x05f,
598#define SECURITY_WEP_TX_ENABLE_SHIFT 1
599#define SECURITY_WEP_RX_ENABLE_SHIFT 0
600#define SECURITY_ENCRYP_104 1
601#define SECURITY_ENCRYP_SHIFT 4
602#define SECURITY_ENCRYP_MASK ((1<<4)|(1<<5))
603 ANA_PARAM2 = 0x060,
604 BEACON_INTERVAL = 0x070,
605#define BEACON_INTERVAL_MASK ((1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)| \
606(1<<6)|(1<<7)|(1<<8)|(1<<9))
607 ATIM_WND = 0x072,
608#define ATIM_WND_MASK (0x01FF)
609 BCN_INTR_ITV = 0x074,
610#define BCN_INTR_ITV_MASK (0x01FF)
611 ATIM_INTR_ITV = 0x076,
612#define ATIM_INTR_ITV_MASK (0x01FF)
613 AckTimeOutReg = 0x079, //ACK timeout register, in unit of 4 us.
614 PHY_ADR = 0x07c,
615 PHY_READ = 0x07e,
616 RFPinsOutput = 0x080,
617 RFPinsEnable = 0x082,
618
619//Page 0
620 RFPinsSelect = 0x084,
621#define SW_CONTROL_GPIO 0x400
622 RFPinsInput = 0x086,
623 RF_PARA = 0x088,
624 RF_TIMING = 0x08c,
625 GP_ENABLE = 0x090,
626 GPIO = 0x091,
627 TX_AGC_CTL = 0x09c,
628#define TX_AGC_CTL_PER_PACKET_TXAGC 0x01
629#define TX_AGC_CTL_PERPACKET_GAIN_SHIFT 0
630#define TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT 1
631#define TX_AGC_CTL_FEEDBACK_ANT 2
632#define TXAGC_CTL_PER_PACKET_ANT_SEL 0x02
633 OFDM_TXAGC = 0x09e,
634 ANTSEL = 0x09f,
635 WPA_CONFIG = 0x0b0,
636 SIFS = 0x0b4,
637 DIFS = 0x0b5,
638 SLOT = 0x0b6,
639 CW_CONF = 0x0bc,
640#define CW_CONF_PERPACKET_RETRY_LIMIT 0x02
641#define CW_CONF_PERPACKET_CW 0x01
642#define CW_CONF_PERPACKET_RETRY_SHIFT 1
643#define CW_CONF_PERPACKET_CW_SHIFT 0
644 CW_VAL = 0x0bd,
645 RATE_FALLBACK = 0x0be,
646#define MAX_RESP_RATE_SHIFT 4
647#define MIN_RESP_RATE_SHIFT 0
648#define RATE_FALLBACK_CTL_ENABLE 0x80
649#define RATE_FALLBACK_CTL_AUTO_STEP0 0x00
650 ACM_CONTROL = 0x0BF, // ACM Control Registe
651//----------------------------------------------------------------------------
652// 8187B ACM_CONTROL bits (Offset 0xBF, 1 Byte)
653//----------------------------------------------------------------------------
654#define VOQ_ACM_EN (0x01 << 7) //BIT7
655#define VIQ_ACM_EN (0x01 << 6) //BIT6
656#define BEQ_ACM_EN (0x01 << 5) //BIT5
657#define ACM_HW_EN (0x01 << 4) //BIT4
658#define TXOPSEL (0x01 << 3) //BIT3
659#define VOQ_ACM_CTL (0x01 << 2) //BIT2 // Set to 1 when AC_VO used time reaches or exceeds the admitted time
660#define VIQ_ACM_CTL (0x01 << 1) //BIT1 // Set to 1 when AC_VI used time reaches or exceeds the admitted time
661#define BEQ_ACM_CTL (0x01 << 0) //BIT0 // Set to 1 when AC_BE used time reaches or exceeds the admitted time
662 CONFIG5 = 0x0D8,
663#define CONFIG5_TX_FIFO_OK ((1<<7))
664#define CONFIG5_RX_FIFO_OK ((1<<6))
665#define CONFIG5_CALON ((1<<5))
666#define CONFIG5_EACPI ((1<<2))
667#define CONFIG5_LANWake ((1<<1))
668#define CONFIG5_PME_STS ((1<<0))
669 TX_DMA_POLLING = 0x0d9,
670#define TX_DMA_POLLING_BEACON_SHIFT 7
671#define TX_DMA_POLLING_HIPRIORITY_SHIFT 6
672#define TX_DMA_POLLING_NORMPRIORITY_SHIFT 5
673#define TX_DMA_POLLING_LOWPRIORITY_SHIFT 4
674#define TX_DMA_STOP_BEACON_SHIFT 3
675#define TX_DMA_STOP_HIPRIORITY_SHIFT 2
676#define TX_DMA_STOP_NORMPRIORITY_SHIFT 1
677#define TX_DMA_STOP_LOWPRIORITY_SHIFT 0
678 CWR = 0x0DC,
679 RetryCTR = 0x0DE,
680 INT_MIG = 0x0E2, // Interrupt Migration (0xE2 ~ 0xE3)
681 TID_AC_MAP = 0x0E8, // TID to AC Mapping Register
682 ANA_PARAM3 = 0x0EE,
683
684
685//page 1
686 Wakeup0 = 0x084,
687 Wakeup1 = 0x08C,
688 Wakeup2LD = 0x094,
689 Wakeup2HD = 0x09C,
690 Wakeup3LD = 0x0A4,
691 Wakeup3HD = 0x0AC,
692 Wakeup4LD = 0x0B4,
693 Wakeup4HD = 0x0BC,
694 CRC0 = 0x0C4,
695 CRC1 = 0x0C6,
696 CRC2 = 0x0C8,
697 CRC3 = 0x0CA,
698 CRC4 = 0x0CC,
699/* 0x00CE - 0x00D3 - reserved */
700
701 RFSW_CTRL = 0x272, // 0x272-0x273.
702
703//Reg Diff between rtl8187 and rtl8187B
704/**************************************************************************/
705 BRSR_8187 = 0x02C,
706 BRSR_8187B = 0x034,
707#define BRSR_BPLCP ((1<< 8))
708#define BRSR_MBR ((1<< 1)|(1<< 0))
709#define BRSR_MBR_8185 ((1<< 11)|(1<< 10)|(1<< 9)|(1<< 8)|(1<< 7)|(1<< 6)|(1<< 5)|(1<< 4)|(1<< 3)|(1<< 2)|(1<< 1)|(1<< 0))
710#define BRSR_MBR0 ((1<< 0))
711#define BRSR_MBR1 ((1<< 1))
712
713/**************************************************************************/
714 EIFS_8187 = 0x035,
715 EIFS_8187B = 0x02D,
716
717/**************************************************************************/
718 FER = 0x0F0,
719 FEMR = 0x0F4,
720 FPSR = 0x0F8,
721 FFER = 0x0FC,
722
723 AC_VO_PARAM = 0x0F0, // AC_VO Parameters Record
724 AC_VI_PARAM = 0x0F4, // AC_VI Parameters Record
725 AC_BE_PARAM = 0x0F8, // AC_BE Parameters Record
726 AC_BK_PARAM = 0x0FC, // AC_BK Parameters Record
727 TALLY_SEL = 0x0fc,
728//----------------------------------------------------------------------------
729// 8187B AC_XX_PARAM bits
730//----------------------------------------------------------------------------
731#define AC_PARAM_TXOP_LIMIT_OFFSET 16
732#define AC_PARAM_ECW_MAX_OFFSET 12
733#define AC_PARAM_ECW_MIN_OFFSET 8
734#define AC_PARAM_AIFS_OFFSET 0
735
736#endif
737}; 402};
738//---------------------------------------------------------------------------- 403//----------------------------------------------------------------------------
739// 818xB AnaParm & AnaParm2 Register 404// 818xB AnaParm & AnaParm2 Register
diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c
index 1c953c73f73d..25d5c870b0fb 100644
--- a/drivers/staging/rtl8192u/r8192U_wx.c
+++ b/drivers/staging/rtl8192u/r8192U_wx.c
@@ -44,40 +44,6 @@ static int r8192_wx_get_freq(struct net_device *dev,
44} 44}
45 45
46 46
47#if 0
48
49static int r8192_wx_set_beaconinterval(struct net_device *dev, struct iw_request_info *aa,
50 union iwreq_data *wrqu, char *b)
51{
52 int *parms = (int *)b;
53 int bi = parms[0];
54
55 struct r8192_priv *priv = ieee80211_priv(dev);
56
57 down(&priv->wx_sem);
58 DMESG("setting beacon interval to %x",bi);
59
60 priv->ieee80211->beacon_interval=bi;
61 rtl8180_commit(dev);
62 up(&priv->wx_sem);
63
64 return 0;
65}
66
67
68static int r8192_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa,
69 union iwreq_data *wrqu, char *extra)
70{
71 struct r8192_priv *priv=ieee80211_priv(dev);
72 int *parms = (int *)extra;
73
74 priv->ieee80211->force_associate = (parms[0] > 0);
75
76
77 return 0;
78}
79
80#endif
81static int r8192_wx_get_mode(struct net_device *dev, struct iw_request_info *a, 47static int r8192_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
82 union iwreq_data *wrqu, char *b) 48 union iwreq_data *wrqu, char *b)
83{ 49{
@@ -215,10 +181,6 @@ static int r8192_wx_read_bb(struct net_device *dev,
215{ 181{
216 struct r8192_priv *priv = ieee80211_priv(dev); 182 struct r8192_priv *priv = ieee80211_priv(dev);
217 u8 databb; 183 u8 databb;
218#if 0
219 int i;
220 for(i=0;i<12;i++) printk("%8x\n", read_cam(dev, i) );
221#endif
222 184
223 down(&priv->wx_sem); 185 down(&priv->wx_sem);
224 186
@@ -317,14 +279,6 @@ static int r8192_wx_get_ap_status(struct net_device *dev,
317 279
318 280
319#endif 281#endif
320#if 0
321static int r8192_wx_null(struct net_device *dev,
322 struct iw_request_info *info,
323 union iwreq_data *wrqu, char *extra)
324{
325 return 0;
326}
327#endif
328static int r8192_wx_force_reset(struct net_device *dev, 282static int r8192_wx_force_reset(struct net_device *dev,
329 struct iw_request_info *info, 283 struct iw_request_info *info,
330 union iwreq_data *wrqu, char *extra) 284 union iwreq_data *wrqu, char *extra)
@@ -937,24 +891,12 @@ exit:
937} 891}
938 892
939#if (WIRELESS_EXT >= 18) 893#if (WIRELESS_EXT >= 18)
940#if 0
941static int r8192_wx_get_enc_ext(struct net_device *dev,
942 struct iw_request_info *info,
943 union iwreq_data *wrqu, char *extra)
944{
945 struct r8192_priv *priv = ieee80211_priv(dev);
946 int ret = 0;
947 ret = ieee80211_wx_get_encode_ext(priv->ieee80211, info, wrqu, extra);
948 return ret;
949}
950#endif
951//hw security need to reorganized. 894//hw security need to reorganized.
952static int r8192_wx_set_enc_ext(struct net_device *dev, 895static int r8192_wx_set_enc_ext(struct net_device *dev,
953 struct iw_request_info *info, 896 struct iw_request_info *info,
954 union iwreq_data *wrqu, char *extra) 897 union iwreq_data *wrqu, char *extra)
955{ 898{
956 int ret=0; 899 int ret=0;
957 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
958 struct r8192_priv *priv = ieee80211_priv(dev); 900 struct r8192_priv *priv = ieee80211_priv(dev);
959 struct ieee80211_device* ieee = priv->ieee80211; 901 struct ieee80211_device* ieee = priv->ieee80211;
960 //printk("===>%s()\n", __FUNCTION__); 902 //printk("===>%s()\n", __FUNCTION__);
@@ -969,13 +911,6 @@ static int r8192_wx_set_enc_ext(struct net_device *dev,
969 u32 key[4] = {0}; 911 u32 key[4] = {0};
970 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; 912 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
971 struct iw_point *encoding = &wrqu->encoding; 913 struct iw_point *encoding = &wrqu->encoding;
972#if 0
973 static u8 CAM_CONST_ADDR[4][6] = {
974 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
975 {0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
976 {0x00, 0x00, 0x00, 0x00, 0x00, 0x02},
977 {0x00, 0x00, 0x00, 0x00, 0x00, 0x03}};
978#endif
979 u8 idx = 0, alg = 0, group = 0; 914 u8 idx = 0, alg = 0, group = 0;
980 if ((encoding->flags & IW_ENCODE_DISABLED) || 915 if ((encoding->flags & IW_ENCODE_DISABLED) ||
981 ext->alg == IW_ENCODE_ALG_NONE) //none is not allowed to use hwsec WB 2008.07.01 916 ext->alg == IW_ENCODE_ALG_NONE) //none is not allowed to use hwsec WB 2008.07.01
@@ -1035,7 +970,6 @@ static int r8192_wx_set_enc_ext(struct net_device *dev,
1035end_hw_sec: 970end_hw_sec:
1036 971
1037 up(&priv->wx_sem); 972 up(&priv->wx_sem);
1038#endif
1039 return ret; 973 return ret;
1040 974
1041} 975}
@@ -1044,13 +978,11 @@ static int r8192_wx_set_auth(struct net_device *dev,
1044 union iwreq_data *data, char *extra) 978 union iwreq_data *data, char *extra)
1045{ 979{
1046 int ret=0; 980 int ret=0;
1047#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1048 //printk("====>%s()\n", __FUNCTION__); 981 //printk("====>%s()\n", __FUNCTION__);
1049 struct r8192_priv *priv = ieee80211_priv(dev); 982 struct r8192_priv *priv = ieee80211_priv(dev);
1050 down(&priv->wx_sem); 983 down(&priv->wx_sem);
1051 ret = ieee80211_wx_set_auth(priv->ieee80211, info, &(data->param), extra); 984 ret = ieee80211_wx_set_auth(priv->ieee80211, info, &(data->param), extra);
1052 up(&priv->wx_sem); 985 up(&priv->wx_sem);
1053#endif
1054 return ret; 986 return ret;
1055} 987}
1056 988
@@ -1061,13 +993,11 @@ static int r8192_wx_set_mlme(struct net_device *dev,
1061 //printk("====>%s()\n", __FUNCTION__); 993 //printk("====>%s()\n", __FUNCTION__);
1062 994
1063 int ret=0; 995 int ret=0;
1064#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1065 struct r8192_priv *priv = ieee80211_priv(dev); 996 struct r8192_priv *priv = ieee80211_priv(dev);
1066 down(&priv->wx_sem); 997 down(&priv->wx_sem);
1067 ret = ieee80211_wx_set_mlme(priv->ieee80211, info, wrqu, extra); 998 ret = ieee80211_wx_set_mlme(priv->ieee80211, info, wrqu, extra);
1068 999
1069 up(&priv->wx_sem); 1000 up(&priv->wx_sem);
1070#endif
1071 return ret; 1001 return ret;
1072} 1002}
1073#endif 1003#endif
@@ -1077,15 +1007,11 @@ static int r8192_wx_set_gen_ie(struct net_device *dev,
1077{ 1007{
1078 //printk("====>%s(), len:%d\n", __FUNCTION__, data->length); 1008 //printk("====>%s(), len:%d\n", __FUNCTION__, data->length);
1079 int ret=0; 1009 int ret=0;
1080#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1081 struct r8192_priv *priv = ieee80211_priv(dev); 1010 struct r8192_priv *priv = ieee80211_priv(dev);
1082 down(&priv->wx_sem); 1011 down(&priv->wx_sem);
1083#if 1
1084 ret = ieee80211_wx_set_gen_ie(priv->ieee80211, extra, data->data.length); 1012 ret = ieee80211_wx_set_gen_ie(priv->ieee80211, extra, data->data.length);
1085#endif
1086 up(&priv->wx_sem); 1013 up(&priv->wx_sem);
1087 //printk("<======%s(), ret:%d\n", __FUNCTION__, ret); 1014 //printk("<======%s(), ret:%d\n", __FUNCTION__, ret);
1088#endif
1089 return ret; 1015 return ret;
1090 1016
1091 1017
@@ -1271,11 +1197,7 @@ struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev)
1271 wstats->qual.qual = 0; 1197 wstats->qual.qual = 0;
1272 wstats->qual.level = 0; 1198 wstats->qual.level = 0;
1273 wstats->qual.noise = 0; 1199 wstats->qual.noise = 0;
1274#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14))
1275 wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; 1200 wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
1276#else
1277 wstats->qual.updated = 0x0f;
1278#endif
1279 return wstats; 1201 return wstats;
1280 } 1202 }
1281 1203
@@ -1287,11 +1209,7 @@ struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev)
1287 wstats->qual.level = tmp_level; 1209 wstats->qual.level = tmp_level;
1288 wstats->qual.qual = tmp_qual; 1210 wstats->qual.qual = tmp_qual;
1289 wstats->qual.noise = tmp_noise; 1211 wstats->qual.noise = tmp_noise;
1290#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14))
1291 wstats->qual.updated = IW_QUAL_ALL_UPDATED| IW_QUAL_DBM; 1212 wstats->qual.updated = IW_QUAL_ALL_UPDATED| IW_QUAL_DBM;
1292#else
1293 wstats->qual.updated = 0x0f;
1294#endif
1295 return wstats; 1213 return wstats;
1296} 1214}
1297//#endif 1215//#endif
diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.c b/drivers/staging/rtl8192u/r819xU_cmdpkt.c
index e9a0eb832838..fd19a85297a9 100644
--- a/drivers/staging/rtl8192u/r819xU_cmdpkt.c
+++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.c
@@ -318,42 +318,11 @@ cmpk_handle_tx_feedback(
318 /* It seems that FW use big endian(MIPS) and DRV use little endian in 318 /* It seems that FW use big endian(MIPS) and DRV use little endian in
319 windows OS. So we have to read the content byte by byte or transfer 319 windows OS. So we have to read the content byte by byte or transfer
320 endian type before copy the message copy. */ 320 endian type before copy the message copy. */
321#if 0 // The TX FEEDBACK packet element address
322 //rx_tx_fb.Element_ID = pMsg[0];
323 //rx_tx_fb.Length = pMsg[1];
324 rx_tx_fb.TOK = pMsg[2]>>7;
325 rx_tx_fb.Fail_Reason = (pMsg[2] & 0x70) >> 4;
326 rx_tx_fb.TID = (pMsg[2] & 0x0F);
327 rx_tx_fb.Qos_Pkt = pMsg[3] >> 7;
328 rx_tx_fb.Bandwidth = (pMsg[3] & 0x40) >> 6;
329 rx_tx_fb.Retry_Cnt = pMsg[5];
330 rx_tx_fb.Pkt_ID = (pMsg[6] << 8) | pMsg[7];
331 rx_tx_fb.Seq_Num = (pMsg[8] << 8) | pMsg[9];
332 rx_tx_fb.S_Rate = pMsg[10];
333 rx_tx_fb.F_Rate = pMsg[11];
334 rx_tx_fb.S_RTS_Rate = pMsg[12];
335 rx_tx_fb.F_RTS_Rate = pMsg[13];
336 rx_tx_fb.pkt_length = (pMsg[14] << 8) | pMsg[15];
337#endif
338 /* 2007/07/05 MH Use pointer to transfer structure memory. */ 321 /* 2007/07/05 MH Use pointer to transfer structure memory. */
339 //memcpy((UINT8 *)&rx_tx_fb, pMsg, sizeof(CMPK_TXFB_T)); 322 //memcpy((UINT8 *)&rx_tx_fb, pMsg, sizeof(CMPK_TXFB_T));
340 memcpy((u8*)&rx_tx_fb, pmsg, sizeof(cmpk_txfb_t)); 323 memcpy((u8*)&rx_tx_fb, pmsg, sizeof(cmpk_txfb_t));
341 /* 2. Use tx feedback info to count TX statistics. */ 324 /* 2. Use tx feedback info to count TX statistics. */
342 cmpk_count_txstatistic(dev, &rx_tx_fb); 325 cmpk_count_txstatistic(dev, &rx_tx_fb);
343#if 0
344 /* 2007/07/11 MH Assign current operate rate. */
345 if (pAdapter->RegWirelessMode == WIRELESS_MODE_A ||
346 pAdapter->RegWirelessMode == WIRELESS_MODE_B ||
347 pAdapter->RegWirelessMode == WIRELESS_MODE_G)
348 {
349 pMgntInfo->CurrentOperaRate = (rx_tx_fb.F_Rate & 0x7F);
350 }
351 else if (pAdapter->RegWirelessMode == WIRELESS_MODE_N_24G ||
352 pAdapter->RegWirelessMode == WIRELESS_MODE_N_5G)
353 {
354 pMgntInfo->HTCurrentOperaRate = (rx_tx_fb.F_Rate & 0x8F);
355 }
356#endif
357 /* 2007/01/17 MH Comment previous method for TX statistic function. */ 326 /* 2007/01/17 MH Comment previous method for TX statistic function. */
358 /* Collect info TX feedback packet to fill TCB. */ 327 /* Collect info TX feedback packet to fill TCB. */
359 /* We can not know the packet length and transmit type: broadcast or uni 328 /* We can not know the packet length and transmit type: broadcast or uni
diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.h b/drivers/staging/rtl8192u/r819xU_cmdpkt.h
index 34fbdcf1be79..a8855e61b0e5 100644
--- a/drivers/staging/rtl8192u/r819xU_cmdpkt.h
+++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.h
@@ -13,16 +13,6 @@
13#define ISR_TxBcnErr BIT26 // Transmit Beacon Error 13#define ISR_TxBcnErr BIT26 // Transmit Beacon Error
14#define ISR_BcnTimerIntr BIT13 // Beacon Timer Interrupt 14#define ISR_BcnTimerIntr BIT13 // Beacon Timer Interrupt
15 15
16#if 0
17/* Define packet type. */
18typedef enum tag_packet_type
19{
20 PACKET_BROADCAST,
21 PACKET_MULTICAST,
22 PACKET_UNICAST,
23 PACKET_TYPE_MAX
24}cmpk_pkt_type_e;
25#endif
26 16
27/* Define element ID of command packet. */ 17/* Define element ID of command packet. */
28 18
diff --git a/drivers/staging/rtl8192u/r819xU_firmware.c b/drivers/staging/rtl8192u/r819xU_firmware.c
index 20d78f461127..3cc2d571f9bd 100644
--- a/drivers/staging/rtl8192u/r819xU_firmware.c
+++ b/drivers/staging/rtl8192u/r819xU_firmware.c
@@ -16,9 +16,7 @@
16#include "r8192U_hw.h" 16#include "r8192U_hw.h"
17#include "r819xU_firmware_img.h" 17#include "r819xU_firmware_img.h"
18#include "r819xU_firmware.h" 18#include "r819xU_firmware.h"
19#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
20#include <linux/firmware.h> 19#include <linux/firmware.h>
21#endif
22void firmware_init_param(struct net_device *dev) 20void firmware_init_param(struct net_device *dev)
23{ 21{
24 struct r8192_priv *priv = ieee80211_priv(dev); 22 struct r8192_priv *priv = ieee80211_priv(dev);
@@ -107,12 +105,6 @@ bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, u32 buff
107 105
108 return rt_status; 106 return rt_status;
109 107
110#if 0
111cmdsend_downloadcode_fail:
112 rt_status = false;
113 RT_TRACE(COMP_ERR, "CmdSendDownloadCode fail !!\n");
114 return rt_status;
115#endif
116} 108}
117 109
118bool 110bool
@@ -154,52 +146,6 @@ fwSendNullPacket(
154 return rtStatus; 146 return rtStatus;
155} 147}
156 148
157#if 0
158/*
159 * Procedure : Download code into IMEM or DMEM
160 * Description: This routine will intialize firmware. If any error occurs during the initialization
161 * process, the routine shall terminate immediately and return fail.
162 * The routine copy virtual address get from opening of file into shared memory
163 * allocated during initialization. If code size larger than a conitneous shared
164 * memory may contain, the code should be divided into several section.
165 * !!!NOTES This finction should only be called during MPInitialization because
166 * A NIC driver should call NdisOpenFile only from MiniportInitialize.
167 * Arguments : The pointer of the adapter
168 * Code address (Virtual address, should fill descriptor with physical address)
169 * Code size
170 * Returns :
171 * RT_STATUS_FAILURE - the following initialization process should be terminated
172 * RT_STATUS_SUCCESS - if firmware initialization process success
173 */
174bool fwsend_download_code(struct net_device *dev)
175{
176 struct r8192_priv *priv = ieee80211_priv(dev);
177 rt_firmware *pfirmware = (rt_firmware*)(&priv->firmware);
178
179 bool rt_status = true;
180 u16 length = 0;
181 u16 offset = 0;
182 u16 frag_threhold;
183 bool last_init_packet = false;
184 u32 check_txcmdwait_queueemptytime = 100000;
185 u16 cmd_buf_len;
186 u8 *ptr_cmd_buf;
187
188 /* reset to 0 for first segment of img download */
189 pfirmware->firmware_seg_index = 1;
190
191 if(pfirmware->firmware_seg_index == pfirmware->firmware_seg_maxnum) {
192 last_init_packet = 1;
193 }
194
195 cmd_buf_len = pfirmware->firmware_seg_container[pfirmware->firmware_seg_index-1].seg_size;
196 ptr_cmd_buf = pfirmware->firmware_seg_container[pfirmware->firmware_seg_index-1].seg_ptr;
197 rtl819xU_tx_cmd(dev, ptr_cmd_buf, cmd_buf_len, last_init_packet, DESC_PACKET_TYPE_INIT);
198
199 rt_status = true;
200 return rt_status;
201}
202#endif
203 149
204//----------------------------------------------------------------------------- 150//-----------------------------------------------------------------------------
205// Procedure: Check whether main code is download OK. If OK, turn on CPU 151// Procedure: Check whether main code is download OK. If OK, turn on CPU
@@ -338,11 +284,7 @@ bool init_firmware(struct net_device *dev)
338 * Download boot, main, and data image for System reset. 284 * Download boot, main, and data image for System reset.
339 * Download data image for firmware reseta 285 * Download data image for firmware reseta
340 */ 286 */
341#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
342 priv->firmware_source = FW_SOURCE_HEADER_FILE;
343#else
344 priv->firmware_source = FW_SOURCE_IMG_FILE; 287 priv->firmware_source = FW_SOURCE_IMG_FILE;
345#endif
346 for(init_step = starting_state; init_step <= FW_INIT_STEP2_DATA; init_step++) { 288 for(init_step = starting_state; init_step <= FW_INIT_STEP2_DATA; init_step++) {
347 /* 289 /*
348 * Open Image file, and map file to contineous memory if open file success. 290 * Open Image file, and map file to contineous memory if open file success.
@@ -351,7 +293,6 @@ bool init_firmware(struct net_device *dev)
351 if(rst_opt == OPT_SYSTEM_RESET) { 293 if(rst_opt == OPT_SYSTEM_RESET) {
352 switch(priv->firmware_source) { 294 switch(priv->firmware_source) {
353 case FW_SOURCE_IMG_FILE: 295 case FW_SOURCE_IMG_FILE:
354 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
355 rc = request_firmware(&fw_entry, fw_name[init_step],&priv->udev->dev); 296 rc = request_firmware(&fw_entry, fw_name[init_step],&priv->udev->dev);
356 if(rc < 0 ) { 297 if(rc < 0 ) {
357 RT_TRACE(COMP_ERR, "request firmware fail!\n"); 298 RT_TRACE(COMP_ERR, "request firmware fail!\n");
@@ -380,7 +321,6 @@ bool init_firmware(struct net_device *dev)
380 #endif 321 #endif
381 } 322 }
382 pfirmware->firmware_buf_size = file_length; 323 pfirmware->firmware_buf_size = file_length;
383 #endif
384 break; 324 break;
385 325
386 case FW_SOURCE_HEADER_FILE: 326 case FW_SOURCE_HEADER_FILE:
@@ -411,11 +351,9 @@ bool init_firmware(struct net_device *dev)
411 * and Tx descriptor info 351 * and Tx descriptor info
412 * */ 352 * */
413 rt_status = fw_download_code(dev,mapped_file,file_length); 353 rt_status = fw_download_code(dev,mapped_file,file_length);
414 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
415 if(rst_opt == OPT_SYSTEM_RESET) { 354 if(rst_opt == OPT_SYSTEM_RESET) {
416 release_firmware(fw_entry); 355 release_firmware(fw_entry);
417 } 356 }
418 #endif
419 357
420 if(rt_status != TRUE) { 358 if(rt_status != TRUE) {
421 goto download_firmware_fail; 359 goto download_firmware_fail;
@@ -487,214 +425,10 @@ download_firmware_fail:
487 425
488} 426}
489 427
490#if 0
491/*
492 * Procedure: (1) Transform firmware code from little endian to big endian if required.
493 * (2) Number of bytes in Firmware downloading should be multiple
494 * of 4 bytes. If length is not multiple of 4 bytes, appending of zeros is required
495 *
496 */
497void CmdAppendZeroAndEndianTransform(
498 u1Byte *pDst,
499 u1Byte *pSrc,
500 u2Byte *pLength)
501{
502 428
503 u2Byte ulAppendBytes = 0, i;
504 u2Byte ulLength = *pLength;
505 429
506//test only
507 //memset(pDst, 0xcc, 12);
508 430
509 431
510 /* Transform from little endian to big endian */
511//#if DEV_BUS_TYPE==PCI_INTERFACE
512#if 0
513 for( i=0 ; i<(*pLength) ; i+=4)
514 {
515 if((i+3) < (*pLength)) pDst[i+0] = pSrc[i+3];
516 if((i+2) < (*pLength)) pDst[i+1] = pSrc[i+2];
517 if((i+1) < (*pLength)) pDst[i+2] = pSrc[i+1];
518 if((i+0) < (*pLength)) pDst[i+3] = pSrc[i+0];
519 }
520#else
521 pDst += USB_HWDESC_HEADER_LEN;
522 ulLength -= USB_HWDESC_HEADER_LEN;
523
524 for( i=0 ; i<ulLength ; i+=4) {
525 if((i+3) < ulLength) pDst[i+0] = pSrc[i+3];
526 if((i+2) < ulLength) pDst[i+1] = pSrc[i+2];
527 if((i+1) < ulLength) pDst[i+2] = pSrc[i+1];
528 if((i+0) < ulLength) pDst[i+3] = pSrc[i+0];
529
530 }
531#endif
532
533 //1(2) Append Zero
534 if( ((*pLength) % 4) >0)
535 {
536 ulAppendBytes = 4-((*pLength) % 4);
537
538 for(i=0 ; i<ulAppendBytes; i++)
539 pDst[ 4*((*pLength)/4) + i ] = 0x0;
540
541 *pLength += ulAppendBytes;
542 }
543}
544#endif
545
546#if 0
547RT_STATUS
548CmdSendPacket(
549 PADAPTER Adapter,
550 PRT_TCB pTcb,
551 PRT_TX_LOCAL_BUFFER pBuf,
552 u4Byte BufferLen,
553 u4Byte PacketType,
554 BOOLEAN bLastInitPacket
555 )
556{
557 s2Byte i;
558 u1Byte QueueID;
559 u2Byte firstDesc,curDesc = 0;
560 u2Byte FragIndex=0, FragBufferIndex=0;
561
562 RT_STATUS rtStatus = RT_STATUS_SUCCESS;
563
564 CmdInitTCB(Adapter, pTcb, pBuf, BufferLen);
565
566
567 if(CmdCheckFragment(Adapter, pTcb, pBuf))
568 CmdFragmentTCB(Adapter, pTcb);
569 else
570 pTcb->FragLength[0] = (u2Byte)pTcb->BufferList[0].Length;
571
572 QueueID=pTcb->SpecifiedQueueID;
573#if DEV_BUS_TYPE!=USB_INTERFACE
574 firstDesc=curDesc=Adapter->NextTxDescToFill[QueueID];
575#endif
576 432
577#if DEV_BUS_TYPE!=USB_INTERFACE
578 if(VacancyTxDescNum(Adapter, QueueID) > pTcb->BufferCount)
579#else
580 if(PlatformIsTxQueueAvailable(Adapter, QueueID, pTcb->BufferCount) &&
581 RTIsListEmpty(&Adapter->TcbWaitQueue[QueueID]))
582#endif
583 {
584 pTcb->nDescUsed=0;
585
586 for(i=0 ; i<pTcb->BufferCount ; i++)
587 {
588 Adapter->HalFunc.TxFillCmdDescHandler(
589 Adapter,
590 pTcb,
591 QueueID, //QueueIndex
592 curDesc, //index
593 FragBufferIndex==0, //bFirstSeg
594 FragBufferIndex==(pTcb->FragBufCount[FragIndex]-1), //bLastSeg
595 pTcb->BufferList[i].VirtualAddress, //VirtualAddress
596 pTcb->BufferList[i].PhysicalAddressLow, //PhyAddressLow
597 pTcb->BufferList[i].Length, //BufferLen
598 i!=0, //bSetOwnBit
599 (i==(pTcb->BufferCount-1)) && bLastInitPacket, //bLastInitPacket
600 PacketType, //DescPacketType
601 pTcb->FragLength[FragIndex] //PktLen
602 );
603
604 if(FragBufferIndex==(pTcb->FragBufCount[FragIndex]-1))
605 { // Last segment of the fragment.
606 pTcb->nFragSent++;
607 }
608
609 FragBufferIndex++;
610 if(FragBufferIndex==pTcb->FragBufCount[FragIndex])
611 {
612 FragIndex++;
613 FragBufferIndex=0;
614 }
615
616#if DEV_BUS_TYPE!=USB_INTERFACE
617 curDesc=(curDesc+1)%Adapter->NumTxDesc[QueueID];
618#endif
619 pTcb->nDescUsed++;
620 }
621
622#if DEV_BUS_TYPE!=USB_INTERFACE
623 RTInsertTailList(&Adapter->TcbBusyQueue[QueueID], &pTcb->List);
624 IncrementTxDescToFill(Adapter, QueueID, pTcb->nDescUsed);
625 Adapter->HalFunc.SetTxDescOWNHandler(Adapter, QueueID, firstDesc);
626 // TODO: should call poll use QueueID
627 Adapter->HalFunc.TxPollingHandler(Adapter, TXCMD_QUEUE);
628#endif
629 }
630 else
631#if DEV_BUS_TYPE!=USB_INTERFACE
632 goto CmdSendPacket_Fail;
633#else
634 {
635 pTcb->bLastInitPacket = bLastInitPacket;
636 RTInsertTailList(&Adapter->TcbWaitQueue[pTcb->SpecifiedQueueID], &pTcb->List);
637 }
638#endif
639
640 return rtStatus;
641
642#if DEV_BUS_TYPE!=USB_INTERFACE
643CmdSendPacket_Fail:
644 rtStatus = RT_STATUS_FAILURE;
645 return rtStatus;
646#endif
647
648}
649#endif
650
651
652
653
654#if 0
655RT_STATUS
656FWSendNullPacket(
657 IN PADAPTER Adapter,
658 IN u4Byte Length
659)
660{
661 RT_STATUS rtStatus = RT_STATUS_SUCCESS;
662
663
664 PRT_TCB pTcb;
665 PRT_TX_LOCAL_BUFFER pBuf;
666 BOOLEAN bLastInitPacket = FALSE;
667
668 PlatformAcquireSpinLock(Adapter, RT_TX_SPINLOCK);
669
670#if DEV_BUS_TYPE==USB_INTERFACE
671 Length += USB_HWDESC_HEADER_LEN;
672#endif
673
674 //Get TCB and local buffer from common pool. (It is shared by CmdQ, MgntQ, and USB coalesce DataQ)
675 if(MgntGetBuffer(Adapter, &pTcb, &pBuf))
676 {
677 PlatformZeroMemory(pBuf->Buffer.VirtualAddress, Length);
678 rtStatus = CmdSendPacket(Adapter, pTcb, pBuf, Length, DESC_PACKET_TYPE_INIT, bLastInitPacket); //0 : always set LastInitPacket to zero
679//#if HAL_CODE_BASE != RTL8190HW
680// // TODO: for test only
681// ReturnTCB(Adapter, pTcb, RT_STATUS_SUCCESS);
682//#endif
683 if(rtStatus == RT_STATUS_FAILURE)
684 goto CmdSendNullPacket_Fail;
685 }else
686 goto CmdSendNullPacket_Fail;
687
688 PlatformReleaseSpinLock(Adapter, RT_TX_SPINLOCK);
689 return rtStatus;
690
691
692CmdSendNullPacket_Fail:
693 PlatformReleaseSpinLock(Adapter, RT_TX_SPINLOCK);
694 rtStatus = RT_STATUS_FAILURE;
695 RT_ASSERT(rtStatus == RT_STATUS_SUCCESS, ("CmdSendDownloadCode fail !!\n"));
696 return rtStatus;
697}
698#endif
699 433
700 434
diff --git a/drivers/staging/rtl8192u/r819xU_firmware.h b/drivers/staging/rtl8192u/r819xU_firmware.h
index 5e561081cf36..a4bceeef33d3 100644
--- a/drivers/staging/rtl8192u/r819xU_firmware.h
+++ b/drivers/staging/rtl8192u/r819xU_firmware.h
@@ -23,46 +23,5 @@ typedef enum _opt_rst_type{
23 OPT_FIRMWARE_RESET = 1, 23 OPT_FIRMWARE_RESET = 1,
24}opt_rst_type_e; 24}opt_rst_type_e;
25 25
26#if 0
27/* CPU related */
28RT_STATUS
29CPUCheckMainCodeOKAndTurnOnCPU(
30 IN PADAPTER Adapter
31 );
32
33RT_STATUS
34CPUCheckFirmwareReady(
35 IN PADAPTER Adapter
36 );
37
38/* Firmware related */
39VOID
40FWInitializeParameters(
41 IN PADAPTER Adapter
42 );
43
44RT_STATUS
45FWSendDownloadCode(
46 IN PADAPTER Adapter,
47 IN pu1Byte CodeVirtualAddrress,
48 IN u4Byte BufferLen
49 );
50
51RT_STATUS
52FWSendNullPacket(
53 IN PADAPTER Adapter,
54 IN u4Byte Length
55 );
56
57RT_STATUS
58CmdSendPacket(
59 PADAPTER Adapter,
60 PRT_TCB pTcb,
61 PRT_TX_LOCAL_BUFFER pBuf,
62 u4Byte BufferLen,
63 u4Byte PacketType,
64 BOOLEAN bLastInitPacket
65 );
66#endif
67#endif 26#endif
68 27
diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c
index beeab51a2c3b..a3adaedece9a 100644
--- a/drivers/staging/rtl8192u/r819xU_phy.c
+++ b/drivers/staging/rtl8192u/r819xU_phy.c
@@ -1079,18 +1079,6 @@ bool rtl8192_SetRFPowerState(struct net_device *dev, RT_RF_POWER_STATE eRFPowerS
1079 switch( eRFPowerState ) 1079 switch( eRFPowerState )
1080 { 1080 {
1081 case eRfOn: 1081 case eRfOn:
1082#if 0
1083 rtl8192_setBBreg(dev, rFPGA0_XA_RFInterfaceOE, BIT4, 0x1); // 0x860[4]
1084 rtl8192_setBBreg(dev, rFPGA0_AnalogParameter4, 0x300, 0x3); // 0x88c[4]
1085 rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x60, 0x3); // 0x880[6:5]
1086 rtl8192_setBBreg(dev, rOFDM0_TRxPathEnable, 0xf, 0x3); // 0xc04[3:0]
1087 rtl8192_setBBreg(dev, rOFDM1_TRxPathEnable, 0xf, 0x3); // 0xd04[3:0]
1088 rtl8192_setBBreg(dev, rFPGA0_AnalogParameter2, 0x7000, 0x3); // 0x884[14:12]
1089 // for(eRFPath = 0; eRFPath <pHalData->NumTotalRFPath; eRFPath++)
1090 // PHY_SetRFReg(Adapter, (RF90_RADIO_PATH_E)eRFPath, 0x4, 0xC00, 0x2);
1091
1092 //SwChnl(Adapter->ChannelID);
1093#endif
1094 //RF-A, RF-B 1082 //RF-A, RF-B
1095 //enable RF-Chip A/B 1083 //enable RF-Chip A/B
1096 rtl8192_setBBreg(dev, rFPGA0_XA_RFInterfaceOE, BIT4, 0x1); // 0x860[4] 1084 rtl8192_setBBreg(dev, rFPGA0_XA_RFInterfaceOE, BIT4, 0x1); // 0x860[4]
@@ -1112,16 +1100,6 @@ bool rtl8192_SetRFPowerState(struct net_device *dev, RT_RF_POWER_STATE eRFPowerS
1112 break; 1100 break;
1113 1101
1114 case eRfOff: 1102 case eRfOff:
1115#if 0
1116 rtl8192_setBBreg(dev, rFPGA0_XA_RFInterfaceOE, BIT4, 0x0); // 0x860[4]
1117 rtl8192_setBBreg(dev, rFPGA0_AnalogParameter4, 0x300, 0x0); // 0x88c[4]
1118 rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x60, 0x0); // 0x880[6:5]
1119 rtl8192_setBBreg(dev, rOFDM0_TRxPathEnable, 0xf, 0); // 0xc04[3:0]
1120 rtl8192_setBBreg(dev, rOFDM1_TRxPathEnable, 0xf, 0); // 0xd04[3:0]
1121 rtl8192_setBBreg(dev, rFPGA0_AnalogParameter2, 0x7000, 0x0); // 0x884[14:12]
1122 // for(eRFPath = 0; eRFPath <pHalData->NumTotalRFPath; eRFPath++)
1123 // PHY_SetRFReg(Adapter, (RF90_RADIO_PATH_E)eRFPath, 0x4, 0xC00, 0x0);
1124#endif
1125 //RF-A, RF-B 1103 //RF-A, RF-B
1126 //disable RF-Chip A/B 1104 //disable RF-Chip A/B
1127 rtl8192_setBBreg(dev, rFPGA0_XA_RFInterfaceOE, BIT4, 0x0); // 0x860[4] 1105 rtl8192_setBBreg(dev, rFPGA0_XA_RFInterfaceOE, BIT4, 0x0); // 0x860[4]
@@ -1582,11 +1560,6 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev)
1582 rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x00100000, 1); 1560 rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x00100000, 1);
1583 1561
1584 // Correct the tx power for CCK rate in 20M. Suggest by YN, 20071207 1562 // Correct the tx power for CCK rate in 20M. Suggest by YN, 20071207
1585#if 0
1586 write_nic_dword(dev, rCCK0_TxFilter1, 0x1a1b0000);
1587 write_nic_dword(dev, rCCK0_TxFilter2, 0x090e1317);
1588 write_nic_dword(dev, rCCK0_DebugPort, 0x00000204);
1589#endif
1590 priv->cck_present_attentuation = 1563 priv->cck_present_attentuation =
1591 priv->cck_present_attentuation_20Mdefault + priv->cck_present_attentuation_difference; 1564 priv->cck_present_attentuation_20Mdefault + priv->cck_present_attentuation_difference;
1592 1565
@@ -1617,12 +1590,6 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev)
1617 rtl8192_setBBreg(dev, rCCK0_System, bCCKSideBand, (priv->nCur40MhzPrimeSC>>1)); 1590 rtl8192_setBBreg(dev, rCCK0_System, bCCKSideBand, (priv->nCur40MhzPrimeSC>>1));
1618 rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x00100000, 0); 1591 rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x00100000, 0);
1619 rtl8192_setBBreg(dev, rOFDM1_LSTF, 0xC00, priv->nCur40MhzPrimeSC); 1592 rtl8192_setBBreg(dev, rOFDM1_LSTF, 0xC00, priv->nCur40MhzPrimeSC);
1620#if 0
1621 // Correct the tx power for CCK rate in 40M. Suggest by YN, 20071207
1622 write_nic_dword(dev, rCCK0_TxFilter1, 0x35360000);
1623 write_nic_dword(dev, rCCK0_TxFilter2, 0x121c252e);
1624 write_nic_dword(dev, rCCK0_DebugPort, 0x00000409);
1625#endif
1626 priv->cck_present_attentuation = 1593 priv->cck_present_attentuation =
1627 priv->cck_present_attentuation_40Mdefault + priv->cck_present_attentuation_difference; 1594 priv->cck_present_attentuation_40Mdefault + priv->cck_present_attentuation_difference;
1628 1595
@@ -1653,7 +1620,6 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev)
1653 } 1620 }
1654 //Skip over setting of J-mode in BB register here. Default value is "None J mode". Emily 20070315 1621 //Skip over setting of J-mode in BB register here. Default value is "None J mode". Emily 20070315
1655 1622
1656#if 1
1657 //<3>Set RF related register 1623 //<3>Set RF related register
1658 switch( priv->rf_chip ) 1624 switch( priv->rf_chip )
1659 { 1625 {
@@ -1679,7 +1645,6 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev)
1679 RT_TRACE(COMP_ERR, "Unknown RFChipID: %d\n", priv->rf_chip); 1645 RT_TRACE(COMP_ERR, "Unknown RFChipID: %d\n", priv->rf_chip);
1680 break; 1646 break;
1681 } 1647 }
1682#endif
1683 priv->SetBWModeInProgress= false; 1648 priv->SetBWModeInProgress= false;
1684 1649
1685 RT_TRACE(COMP_SWBW, "<==SetBWMode819xUsb(), %d", atomic_read(&(priv->ieee80211->atm_swbw)) ); 1650 RT_TRACE(COMP_SWBW, "<==SetBWMode819xUsb(), %d", atomic_read(&(priv->ieee80211->atm_swbw)) );
@@ -1726,29 +1691,15 @@ void InitialGain819xUsb(struct net_device *dev, u8 Operation)
1726 1691
1727 if(priv->up) 1692 if(priv->up)
1728 { 1693 {
1729 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1730 queue_delayed_work(priv->priv_wq,&priv->initialgain_operate_wq,0); 1694 queue_delayed_work(priv->priv_wq,&priv->initialgain_operate_wq,0);
1731 #else
1732 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
1733 schedule_task(&priv->initialgain_operate_wq);
1734 #else
1735 queue_work(priv->priv_wq,&priv->initialgain_operate_wq);
1736 #endif
1737 #endif
1738 } 1695 }
1739} 1696}
1740 1697
1741#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
1742extern void InitialGainOperateWorkItemCallBack(struct work_struct *work) 1698extern void InitialGainOperateWorkItemCallBack(struct work_struct *work)
1743{ 1699{
1744 struct delayed_work *dwork = container_of(work,struct delayed_work,work); 1700 struct delayed_work *dwork = container_of(work,struct delayed_work,work);
1745 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,initialgain_operate_wq); 1701 struct r8192_priv *priv = container_of(dwork,struct r8192_priv,initialgain_operate_wq);
1746 struct net_device *dev = priv->ieee80211->dev; 1702 struct net_device *dev = priv->ieee80211->dev;
1747#else
1748extern void InitialGainOperateWorkItemCallBack(struct net_device *dev)
1749{
1750 struct r8192_priv *priv = ieee80211_priv(dev);
1751#endif
1752#define SCAN_RX_INITIAL_GAIN 0x17 1703#define SCAN_RX_INITIAL_GAIN 0x17
1753#define POWER_DETECTION_TH 0x08 1704#define POWER_DETECTION_TH 0x08
1754 u32 BitMask; 1705 u32 BitMask;
diff --git a/drivers/staging/rtl8192u/r819xU_phy.h b/drivers/staging/rtl8192u/r819xU_phy.h
index c165ac1265d9..3e3bc577e6c3 100644
--- a/drivers/staging/rtl8192u/r819xU_phy.h
+++ b/drivers/staging/rtl8192u/r819xU_phy.h
@@ -85,10 +85,6 @@ extern bool rtl8192_SetRFPowerState(struct net_device *dev, RT_RF_POWER_STATE eR
85//added by amy 85//added by amy
86extern void InitialGain819xUsb(struct net_device *dev, u8 Operation); 86extern void InitialGain819xUsb(struct net_device *dev, u8 Operation);
87 87
88#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
89extern void InitialGainOperateWorkItemCallBack(struct work_struct *work); 88extern void InitialGainOperateWorkItemCallBack(struct work_struct *work);
90#else
91extern void InitialGainOperateWorkItemCallBack(struct net_device *dev);
92#endif
93 89
94#endif 90#endif