diff options
Diffstat (limited to 'drivers/staging/rtl8192u')
26 files changed, 481 insertions, 567 deletions
diff --git a/drivers/staging/rtl8192u/ieee80211/dot11d.c b/drivers/staging/rtl8192u/ieee80211/dot11d.c index 90ace791f2d7..82d60380bb40 100644 --- a/drivers/staging/rtl8192u/ieee80211/dot11d.c +++ b/drivers/staging/rtl8192u/ieee80211/dot11d.c @@ -6,7 +6,7 @@ void Dot11d_Init(struct ieee80211_device *ieee) { PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(ieee); - pDot11dInfo->bEnabled = 0; + pDot11dInfo->bEnabled = false; pDot11dInfo->State = DOT11D_STATE_NONE; pDot11dInfo->CountryIeLen = 0; diff --git a/drivers/staging/rtl8192u/ieee80211/dot11d.h b/drivers/staging/rtl8192u/ieee80211/dot11d.h index bd75e29adc2c..8ae673b217d8 100644 --- a/drivers/staging/rtl8192u/ieee80211/dot11d.h +++ b/drivers/staging/rtl8192u/ieee80211/dot11d.h @@ -53,7 +53,7 @@ typedef struct _RT_DOT11D_INFO { #define CIE_WATCHDOG_TH 1 #define GET_CIE_WATCHDOG(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->CountryIeWatchdog) -#define RESET_CIE_WATCHDOG(__pIeeeDev) GET_CIE_WATCHDOG(__pIeeeDev) = 0 +#define RESET_CIE_WATCHDOG(__pIeeeDev) (GET_CIE_WATCHDOG(__pIeeeDev) = 0) #define UPDATE_CIE_WATCHDOG(__pIeeeDev) (++GET_CIE_WATCHDOG(__pIeeeDev)) #define IS_DOT11D_STATE_DONE(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->State == DOT11D_STATE_DONE) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h index b44aa17d30a7..0f53c6a97578 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h @@ -606,33 +606,6 @@ do { if (ieee80211_debug_level & (level)) \ #define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a) #define IEEE80211_DEBUG_QOS(f, a...) IEEE80211_DEBUG(IEEE80211_DL_QOS, f, ## a) -#ifdef CONFIG_IEEE80211_DEBUG -/* Added by Annie, 2005-11-22. */ -#define MAX_STR_LEN 64 -/* I want to see ASCII 33 to 126 only. Otherwise, I print '?'. Annie, 2005-11-22.*/ -#define PRINTABLE(_ch) (_ch>'!' && _ch<'~') -#define IEEE80211_PRINT_STR(_Comp, _TitleString, _Ptr, _Len) \ - if((_Comp) & level) \ - { \ - int __i; \ - u8 buffer[MAX_STR_LEN]; \ - int length = (_Len<MAX_STR_LEN)? _Len : (MAX_STR_LEN-1) ; \ - memset(buffer, 0, MAX_STR_LEN); \ - memcpy(buffer, (u8 *)_Ptr, length ); \ - for( __i=0; __i<MAX_STR_LEN; __i++ ) \ - { \ - if( !PRINTABLE(buffer[__i]) ) buffer[__i] = '?'; \ - } \ - buffer[length] = '\0'; \ - printk("Rtl819x: "); \ - printk(_TitleString); \ - printk(": %d, <%s>\n", _Len, buffer); \ - } -#else -#define IEEE80211_PRINT_STR(_Comp, _TitleString, _Ptr, _Len) do {} while (0) -#endif - -#include <linux/netdevice.h> #include <linux/if_arp.h> /* ARPHRD_ETHER */ #ifndef WIRELESS_SPY @@ -661,7 +634,7 @@ struct ieee80211_snap_hdr { u8 ctrl; /* always 0x03 */ u8 oui[P80211_OUI_LEN]; /* organizational universal id */ -} __attribute__ ((packed)); +} __packed; #define SNAP_SIZE sizeof(struct ieee80211_snap_hdr) @@ -996,7 +969,7 @@ struct ieee80211_security { u8 keys[WEP_KEYS][SCM_KEY_LEN]; u8 level; u16 flags; -} __attribute__ ((packed)); +} __packed; /* @@ -1051,14 +1024,14 @@ struct ieee80211_hdr { __le16 frame_ctl; __le16 duration_id; u8 payload[0]; -} __attribute__ ((packed)); +} __packed; struct ieee80211_hdr_1addr { __le16 frame_ctl; __le16 duration_id; u8 addr1[ETH_ALEN]; u8 payload[0]; -} __attribute__ ((packed)); +} __packed; struct ieee80211_hdr_2addr { __le16 frame_ctl; @@ -1066,7 +1039,7 @@ struct ieee80211_hdr_2addr { u8 addr1[ETH_ALEN]; u8 addr2[ETH_ALEN]; u8 payload[0]; -} __attribute__ ((packed)); +} __packed; struct ieee80211_hdr_3addr { __le16 frame_ctl; @@ -1076,7 +1049,7 @@ struct ieee80211_hdr_3addr { u8 addr3[ETH_ALEN]; __le16 seq_ctl; u8 payload[0]; -} __attribute__ ((packed)); +} __packed; struct ieee80211_hdr_4addr { __le16 frame_ctl; @@ -1087,7 +1060,7 @@ struct ieee80211_hdr_4addr { __le16 seq_ctl; u8 addr4[ETH_ALEN]; u8 payload[0]; -} __attribute__ ((packed)); +} __packed; struct ieee80211_hdr_3addrqos { __le16 frame_ctl; @@ -1098,7 +1071,7 @@ struct ieee80211_hdr_3addrqos { __le16 seq_ctl; u8 payload[0]; __le16 qos_ctl; -} __attribute__ ((packed)); +} __packed; struct ieee80211_hdr_4addrqos { __le16 frame_ctl; @@ -1110,13 +1083,13 @@ struct ieee80211_hdr_4addrqos { u8 addr4[ETH_ALEN]; u8 payload[0]; __le16 qos_ctl; -} __attribute__ ((packed)); +} __packed; struct ieee80211_info_element { u8 id; u8 len; u8 data[0]; -} __attribute__ ((packed)); +} __packed; struct ieee80211_authentication { struct ieee80211_hdr_3addr header; @@ -1125,18 +1098,18 @@ struct ieee80211_authentication { __le16 status; /*challenge*/ struct ieee80211_info_element info_element[0]; -} __attribute__ ((packed)); +} __packed; struct ieee80211_disassoc { struct ieee80211_hdr_3addr header; __le16 reason; -} __attribute__ ((packed)); +} __packed; struct ieee80211_probe_request { struct ieee80211_hdr_3addr header; /* SSID, supported rates */ struct ieee80211_info_element info_element[0]; -} __attribute__ ((packed)); +} __packed; struct ieee80211_probe_response { struct ieee80211_hdr_3addr header; @@ -1146,7 +1119,7 @@ struct ieee80211_probe_response { /* SSID, supported rates, FH params, DS params, * CF params, IBSS params, TIM (if beacon), RSN */ struct ieee80211_info_element info_element[0]; -} __attribute__ ((packed)); +} __packed; /* Alias beacon for probe_response */ #define ieee80211_beacon ieee80211_probe_response @@ -1157,7 +1130,7 @@ struct ieee80211_assoc_request_frame { __le16 listen_interval; /* SSID, supported rates, RSN */ struct ieee80211_info_element info_element[0]; -} __attribute__ ((packed)); +} __packed; struct ieee80211_reassoc_request_frame { struct ieee80211_hdr_3addr header; @@ -1166,7 +1139,7 @@ struct ieee80211_reassoc_request_frame { u8 current_ap[ETH_ALEN]; /* SSID, supported rates, RSN */ struct ieee80211_info_element info_element[0]; -} __attribute__ ((packed)); +} __packed; struct ieee80211_assoc_response_frame { struct ieee80211_hdr_3addr header; @@ -1174,7 +1147,7 @@ struct ieee80211_assoc_response_frame { __le16 status; __le16 aid; struct ieee80211_info_element info_element[0]; /* supported rates */ -} __attribute__ ((packed)); +} __packed; struct ieee80211_txb { u8 nr_frags; @@ -1191,7 +1164,7 @@ struct ieee80211_txb { struct ieee80211_drv_agg_txb { u8 nr_drv_agg_frames; struct sk_buff *tx_agg_frames[MAX_TX_AGG_COUNT]; -}__attribute__((packed)); +} __packed; #define MAX_SUBFRAME_COUNT 64 struct ieee80211_rxb { @@ -1199,7 +1172,7 @@ struct ieee80211_rxb { struct sk_buff *subframes[MAX_SUBFRAME_COUNT]; u8 dst[ETH_ALEN]; u8 src[ETH_ALEN]; -}__attribute__((packed)); +} __packed; typedef union _frameqos { u16 shortdata; @@ -1267,19 +1240,19 @@ struct ieee80211_qos_information_element { u8 qui_subtype; u8 version; u8 ac_info; -} __attribute__ ((packed)); +} __packed; struct ieee80211_qos_ac_parameter { u8 aci_aifsn; u8 ecw_min_max; __le16 tx_op_limit; -} __attribute__ ((packed)); +} __packed; struct ieee80211_qos_parameter_info { struct ieee80211_qos_information_element info_element; u8 reserved; struct ieee80211_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM]; -} __attribute__ ((packed)); +} __packed; struct ieee80211_qos_parameters { __le16 cw_min[QOS_QUEUE_NUM]; @@ -1287,7 +1260,7 @@ struct ieee80211_qos_parameters { u8 aifs[QOS_QUEUE_NUM]; u8 flag[QOS_QUEUE_NUM]; __le16 tx_op_limit[QOS_QUEUE_NUM]; -} __attribute__ ((packed)); +} __packed; struct ieee80211_qos_data { struct ieee80211_qos_parameters parameters; @@ -1300,7 +1273,7 @@ struct ieee80211_qos_data { struct ieee80211_tim_parameters { u8 tim_count; u8 tim_period; -} __attribute__ ((packed)); +} __packed; //#else struct ieee80211_wmm_ac_param { @@ -1313,7 +1286,7 @@ struct ieee80211_wmm_ts_info { u8 ac_dir_tid; u8 ac_up_psb; u8 reserved; -} __attribute__ ((packed)); +} __packed; struct ieee80211_wmm_tspec_elem { struct ieee80211_wmm_ts_info ts_info; @@ -1332,7 +1305,7 @@ struct ieee80211_wmm_tspec_elem { u32 min_phy_rate; u16 surp_band_allow; u16 medium_time; -}__attribute__((packed)); +} __packed; enum eap_type { EAP_PACKET = 0, EAPOL_START, @@ -1371,7 +1344,7 @@ struct eapol { u8 version; u8 type; u16 length; -} __attribute__ ((packed)); +} __packed; struct ieee80211_softmac_stats{ unsigned int rx_ass_ok; @@ -1401,7 +1374,7 @@ struct ieee80211_softmac_stats{ struct ieee80211_info_element_hdr { u8 id; u8 len; -} __attribute__ ((packed)); +} __packed; /* * These are the data types that can make up management packets @@ -1414,7 +1387,7 @@ struct ieee80211_info_element_hdr { u16 listen_interval; struct { u16 association_id:14, reserved:2; - } __attribute__ ((packed)); + } __packed; u32 time_stamp[2]; u16 reason; u16 status; @@ -1475,7 +1448,7 @@ struct ether_header { u8 ether_dhost[ETHER_ADDR_LEN]; u8 ether_shost[ETHER_ADDR_LEN]; u16 ether_type; -} __attribute__((packed)); +} __packed; #ifndef ETHERTYPE_PAE #define ETHERTYPE_PAE 0x888e /* EAPOL PAE/802.1x */ @@ -1484,24 +1457,6 @@ struct ether_header { #define ETHERTYPE_IP 0x0800 /* IP protocol */ #endif -typedef struct _bss_ht{ - - bool support_ht; - - // HT related elements - u8 ht_cap_buf[32]; - u16 ht_cap_len; - u8 ht_info_buf[32]; - u16 ht_info_len; - - HT_SPEC_VER ht_spec_ver; - //HT_CAPABILITY_ELE bdHTCapEle; - //HT_INFORMATION_ELE bdHTInfoEle; - - bool aggregation; - bool long_slot_time; -}bss_ht, *pbss_ht; - typedef enum _erp_t{ ERP_NonERPpresent = 0x01, ERP_UseProtection = 0x02, diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c index 55332217c29f..3995620b3442 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c @@ -11,12 +11,11 @@ * */ -//#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/slab.h> -#include <asm/string.h> -#include <asm/errno.h> +#include <linux/string.h> +#include <linux/errno.h> #include "ieee80211.h" @@ -66,8 +65,8 @@ void ieee80211_crypt_deinit_handler(unsigned long data) spin_lock_irqsave(&ieee->lock, flags); ieee80211_crypt_deinit_entries(ieee, 0); if (!list_empty(&ieee->crypt_deinit_list)) { - printk(KERN_DEBUG "%s: entries remaining in delayed crypt " - "deletion list\n", ieee->dev->name); + netdev_dbg(ieee->dev, "%s: entries remaining in delayed crypt deletion list\n", + ieee->dev->name); ieee->crypt_deinit_timer.expires = jiffies + HZ; add_timer(&ieee->crypt_deinit_timer); } @@ -118,7 +117,7 @@ int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops) list_add(&alg->list, &hcrypt->algs); spin_unlock_irqrestore(&hcrypt->lock, flags); - printk(KERN_DEBUG "ieee80211_crypt: registered algorithm '%s'\n", + pr_debug("ieee80211_crypt: registered algorithm '%s'\n", ops->name); return 0; @@ -146,8 +145,8 @@ int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops) spin_unlock_irqrestore(&hcrypt->lock, flags); if (del_alg) { - printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " - "'%s'\n", ops->name); + pr_debug("ieee80211_crypt: unregistered algorithm '%s'\n", + ops->name); kfree(del_alg); } @@ -232,8 +231,8 @@ void __exit ieee80211_crypto_deinit(void) struct ieee80211_crypto_alg *alg = (struct ieee80211_crypto_alg *) ptr; list_del(ptr); - printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " - "'%s' (deinit)\n", alg->ops->name); + pr_debug("ieee80211_crypt: unregistered algorithm '%s' (deinit)\n", + alg->ops->name); kfree(alg); } diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c index 143b682477e5..788704b800c4 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c @@ -9,7 +9,6 @@ * more details. */ -//#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/slab.h> @@ -18,7 +17,7 @@ #include <linux/netdevice.h> #include <linux/if_ether.h> #include <linux/if_arp.h> -#include <asm/string.h> +#include <linux/string.h> #include <linux/wireless.h> #include "ieee80211.h" @@ -130,9 +129,9 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, qc_included = ((WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && (WLAN_FC_GET_STYPE(fc) & 0x08)); */ - // fixed by David :2006.9.6 - qc_included = ((WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && - (WLAN_FC_GET_STYPE(fc) & 0x80)); + /* fixed by David :2006.9.6 */ + qc_included = (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && + (WLAN_FC_GET_STYPE(fc) & 0x80); aad_len = 22; if (a4_included) aad_len += 6; @@ -209,7 +208,7 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) pos = skb_push(skb, CCMP_HDR_LEN); memmove(pos, pos + CCMP_HDR_LEN, hdr_len); pos += hdr_len; -// mic = skb_put(skb, CCMP_MIC_LEN); + /* mic = skb_put(skb, CCMP_MIC_LEN); */ i = CCMP_PN_LEN - 1; while (i >= 0) { @@ -239,7 +238,7 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) u8 *e = key->tx_e; u8 *s0 = key->tx_s0; - //mic is moved to here by john + /* mic is moved to here by john */ mic = skb_put(skb, CCMP_MIC_LEN); ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0); @@ -444,7 +443,7 @@ static char *ieee80211_ccmp_print_stats(char *p, void *priv) void ieee80211_ccmp_null(void) { -// printk("============>%s()\n", __func__); + /* printk("============>%s()\n", __func__); */ return; } diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c index fcc90a5700d6..e815c81b45dc 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c @@ -9,7 +9,6 @@ * more details. */ -//#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/slab.h> @@ -18,7 +17,7 @@ #include <linux/netdevice.h> #include <linux/if_ether.h> #include <linux/if_arp.h> -#include <asm/string.h> +#include <linux/string.h> #include "ieee80211.h" diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c index 8c1bf1f56883..0a17f84bb809 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c @@ -9,13 +9,12 @@ * more details. */ -//#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/slab.h> #include <linux/random.h> #include <linux/skbuff.h> -#include <asm/string.h> +#include <linux/string.h> #include "ieee80211.h" @@ -49,14 +48,14 @@ static void *prism2_wep_init(int keyidx) priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->tx_tfm)) { - printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " + pr_debug("ieee80211_crypt_wep: could not allocate " "crypto API arc4\n"); priv->tx_tfm = NULL; goto fail; } priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->rx_tfm)) { - printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " + pr_debug("ieee80211_crypt_wep: could not allocate " "crypto API arc4\n"); priv->rx_tfm = NULL; goto fail; @@ -110,6 +109,7 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) u32 crc; u8 *icv; struct scatterlist sg; + if (skb_headroom(skb) < 4 || skb_tailroom(skb) < 4 || skb->len < hdr_len) return -1; @@ -128,6 +128,7 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) * can be used to speedup attacks, so avoid using them. */ if ((wep->iv & 0xff00) == 0xff00) { u8 B = (wep->iv >> 16) & 0xff; + if (B >= 3 && B < klen) wep->iv += 0x0100; } @@ -180,6 +181,7 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) u32 crc; u8 icv[4]; struct scatterlist sg; + if (skb->len < hdr_len + 8) return -1; @@ -256,6 +258,7 @@ static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv) static char *prism2_wep_print_stats(char *p, void *priv) { struct prism2_wep_data *wep = priv; + p += sprintf(p, "key[%d] alg=WEP len=%d\n", wep->key_idx, wep->key_len); return p; diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c index afbd09d7300a..31233d895ee9 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c @@ -31,7 +31,7 @@ *******************************************************************************/ #include <linux/compiler.h> -//#include <linux/config.h> +/* #include <linux/config.h> */ #include <linux/errno.h> #include <linux/if_arp.h> #include <linux/in6.h> @@ -133,15 +133,14 @@ struct net_device *alloc_ieee80211(int sizeof_priv) ieee->ieee802_1x = 1; /* Default to supporting 802.1x */ INIT_LIST_HEAD(&ieee->crypt_deinit_list); - init_timer(&ieee->crypt_deinit_timer); - ieee->crypt_deinit_timer.data = (unsigned long)ieee; - ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler; + setup_timer(&ieee->crypt_deinit_timer, + ieee80211_crypt_deinit_handler, (unsigned long)ieee); spin_lock_init(&ieee->lock); spin_lock_init(&ieee->wpax_suitlist_lock); spin_lock_init(&ieee->bw_spinlock); spin_lock_init(&ieee->reorder_spinlock); - //added by WB + /* added by WB */ atomic_set(&(ieee->atm_chnlop), 0); atomic_set(&(ieee->atm_swbw), 0); @@ -153,7 +152,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) ieee->ieee802_1x = 1; ieee->raw_tx = 0; //ieee->hwsec_support = 1; //defalt support hw security. //use module_param instead. - ieee->hwsec_active = 0; //disable hwsec, switch it on when necessary. + ieee->hwsec_active = 0; /* disable hwsec, switch it on when necessary. */ ieee80211_softmac_init(ieee); @@ -164,7 +163,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) goto failed; } HTUpdateDefaultSetting(ieee); - HTInitializeHTInfo(ieee); //may move to other place. + HTInitializeHTInfo(ieee); /* may move to other place. */ TSInitialize(ieee); for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) @@ -176,7 +175,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) ieee->last_packet_time[i] = 0; } -//These function were added to load crypte module autoly +/* These function were added to load crypte module autoly */ ieee80211_tkip_null(); ieee80211_wep_null(); ieee80211_ccmp_null(); @@ -195,7 +194,7 @@ void free_ieee80211(struct net_device *dev) { struct ieee80211_device *ieee = netdev_priv(dev); int i; - //struct list_head *p, *q; + /* struct list_head *p, *q; */ // del_timer_sync(&ieee->SwBwTimer); kfree(ieee->pHTInfo); ieee->pHTInfo = NULL; @@ -239,13 +238,15 @@ static int debug = \ // IEEE80211_DL_REORDER| // IEEE80211_DL_TRACE | //IEEE80211_DL_DATA | - IEEE80211_DL_ERR //awayls open this flags to show error out + IEEE80211_DL_ERR /* awayls open this flags to show error out */ ; static struct proc_dir_entry *ieee80211_proc; static int show_debug_level(struct seq_file *m, void *v) { - return seq_printf(m, "0x%08X\n", ieee80211_debug_level); + seq_printf(m, "0x%08X\n", ieee80211_debug_level); + + return 0; } static ssize_t write_debug_level(struct file *file, const char __user *buffer, @@ -284,7 +285,7 @@ int __init ieee80211_debug_init(void) " proc directory\n"); return -EIO; } - e = proc_create("debug_level", S_IRUGO | S_IWUSR, + e = proc_create("debug_level", S_IRUGO | S_IWUSR, ieee80211_proc, &fops); if (!e) { remove_proc_entry(DRV_NAME, init_net.proc_net); @@ -303,7 +304,6 @@ void __exit ieee80211_debug_exit(void) } } -#include <linux/moduleparam.h> module_param(debug, int, 0444); MODULE_PARM_DESC(debug, "debug output mask"); #endif diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index d401dbf4c7c6..9fbb53d8c6bf 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -22,7 +22,6 @@ #include <linux/compiler.h> -//#include <linux/config.h> #include <linux/errno.h> #include <linux/if_arp.h> #include <linux/in6.h> @@ -39,7 +38,7 @@ #include <linux/types.h> #include <linux/wireless.h> #include <linux/etherdevice.h> -#include <asm/uaccess.h> +#include <linux/uaccess.h> #include <linux/ctype.h> #include "ieee80211.h" @@ -56,7 +55,7 @@ static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee, skb_pull(skb, ieee80211_get_hdrlen(fc)); skb->pkt_type = PACKET_OTHERHOST; - skb->protocol = __constant_htons(ETH_P_80211_RAW); + skb->protocol = htons(ETH_P_80211_RAW); memset(skb->cb, 0, sizeof(skb->cb)); netif_rx(skb); } @@ -222,8 +221,8 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb, rx_stats->len = skb->len; ieee80211_rx_mgt(ieee,(struct ieee80211_hdr_4addr *)skb->data,rx_stats); - //if ((ieee->state == IEEE80211_LINKED) && (memcmp(hdr->addr3, ieee->current_network.bssid, ETH_ALEN))) - if ((memcmp(hdr->addr1, ieee->dev->dev_addr, ETH_ALEN)))//use ADDR1 to perform address matching for Management frames + /* if ((ieee->state == IEEE80211_LINKED) && (memcmp(hdr->addr3, ieee->current_network.bssid, ETH_ALEN))) */ + if ((memcmp(hdr->addr1, ieee->dev->dev_addr, ETH_ALEN)))/* use ADDR1 to perform address matching for Management frames */ { dev_kfree_skb_any(skb); return 0; @@ -609,12 +608,12 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, bool bMatchWinStart = false, bPktInBuf = false; IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): Seq is %d,pTS->RxIndicateSeq is %d, WinSize is %d\n",__func__,SeqNum,pTS->RxIndicateSeq,WinSize); /* Rx Reorder initialize condition.*/ - if(pTS->RxIndicateSeq == 0xffff) { + if (pTS->RxIndicateSeq == 0xffff) { pTS->RxIndicateSeq = SeqNum; } /* Drop out the packet which SeqNum is smaller than WinStart */ - if(SN_LESS(SeqNum, pTS->RxIndicateSeq)) { + if (SN_LESS(SeqNum, pTS->RxIndicateSeq)) { IEEE80211_DEBUG(IEEE80211_DL_REORDER,"Packet Drop! IndicateSeq: %d, NewSeq: %d\n", pTS->RxIndicateSeq, SeqNum); pHTInfo->RxReorderDropCounter++; @@ -717,7 +716,7 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, SN_EQUAL(pReorderEntry->SeqNum, pTS->RxIndicateSeq)) { /* This protect buffer from overflow. */ - if(index >= REORDER_WIN_SIZE) { + if (index >= REORDER_WIN_SIZE) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "RxReorderIndicatePacket(): Buffer overflow!! \n"); bPktInBuf = true; break; @@ -741,7 +740,7 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, } /* Handling pending timer. Set this timer to prevent from long time Rx buffering.*/ - if(index>0) { + if (index>0) { // Cancel previous pending timer. // del_timer_sync(&pTS->RxPktPendingTimer); pTS->RxTimeoutIndicateSeq = 0xffff; @@ -754,7 +753,7 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, ieee80211_indicate_packets(ieee, prxbIndicateArray, index); } - if(bPktInBuf && pTS->RxTimeoutIndicateSeq==0xffff) { + if (bPktInBuf && pTS->RxTimeoutIndicateSeq==0xffff) { // Set new pending timer. IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): SET rx timeout timer\n", __func__); pTS->RxTimeoutIndicateSeq = pTS->RxIndicateSeq; @@ -784,16 +783,16 @@ static u8 parse_subframe(struct sk_buff *skb, /* just for debug purpose */ SeqNum = WLAN_GET_SEQ_SEQ(le16_to_cpu(hdr->seq_ctl)); - if((IEEE80211_QOS_HAS_SEQ(fc))&&\ + if ((IEEE80211_QOS_HAS_SEQ(fc))&&\ (((frameqos *)(skb->data + IEEE80211_3ADDR_LEN))->field.reserved)) { bIsAggregateFrame = true; } - if(IEEE80211_QOS_HAS_SEQ(fc)) { + if (IEEE80211_QOS_HAS_SEQ(fc)) { LLCOffset += 2; } - if(rx_stats->bContainHTC) { + if (rx_stats->bContainHTC) { LLCOffset += sHTCLng; } //printk("ChkLength = %d\n", LLCOffset); @@ -827,7 +826,7 @@ static u8 parse_subframe(struct sk_buff *skb, //==m==>change the length order nSubframe_Length = (nSubframe_Length>>8) + (nSubframe_Length<<8); - if(skb->len<(ETHERNET_HEADER_SIZE + nSubframe_Length)) { + if (skb->len<(ETHERNET_HEADER_SIZE + nSubframe_Length)) { printk("%s: A-MSDU parse error!! pRfd->nTotalSubframe : %d\n",\ __func__, rxb->nr_subframes); printk("%s: A-MSDU parse error!! Subframe Length: %d\n",__func__, nSubframe_Length); @@ -853,19 +852,19 @@ static u8 parse_subframe(struct sk_buff *skb, memcpy(data_ptr, skb->data, nSubframe_Length); #endif rxb->subframes[rxb->nr_subframes++] = sub_skb; - if(rxb->nr_subframes >= MAX_SUBFRAME_COUNT) { + if (rxb->nr_subframes >= MAX_SUBFRAME_COUNT) { IEEE80211_DEBUG_RX("ParseSubframe(): Too many Subframes! Packets dropped!\n"); break; } skb_pull(skb, nSubframe_Length); - if(skb->len != 0) { + if (skb->len != 0) { nPadding_Length = 4 - ((nSubframe_Length + ETHERNET_HEADER_SIZE) % 4); - if(nPadding_Length == 4) { + if (nPadding_Length == 4) { nPadding_Length = 0; } - if(skb->len < nPadding_Length) { + if (skb->len < nPadding_Length) { return 0; } @@ -939,12 +938,12 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, frag = WLAN_GET_SEQ_FRAG(sc); hdrlen = ieee80211_get_hdrlen(fc); - if(HTCCheck(ieee, skb->data)) + if (HTCCheck(ieee, skb->data)) { if(net_ratelimit()) printk("find HTCControl\n"); hdrlen += 4; - rx_stats->bContainHTC = 1; + rx_stats->bContainHTC = true; } //IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len); @@ -1274,13 +1273,13 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, } */ //added by amy for reorder - if(ieee->current_network.qos_data.active && IsQoSDataFrame(skb->data) + if (ieee->current_network.qos_data.active && IsQoSDataFrame(skb->data) && !is_multicast_ether_addr(hdr->addr1)) { TID = Frame_QoSTID(skb->data); SeqNum = WLAN_GET_SEQ_SEQ(sc); GetTs(ieee,(PTS_COMMON_INFO *) &pTS,hdr->addr2,TID,RX_DIR,true); - if(TID !=0 && TID !=3) + if (TID !=0 && TID !=3) { ieee->bis_any_nonbepkts = true; } @@ -1290,7 +1289,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, payload = skb->data + hdrlen; //ethertype = (payload[6] << 8) | payload[7]; rxb = kmalloc(sizeof(struct ieee80211_rxb), GFP_ATOMIC); - if(rxb == NULL) + if (rxb == NULL) { IEEE80211_DEBUG(IEEE80211_DL_ERR,"%s(): kmalloc rxb error\n",__func__); goto rx_dropped; @@ -1336,7 +1335,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, stats->rx_packets++; stats->rx_bytes += sub_skb->len; - if(is_multicast_ether_addr(dst)) { + if (is_multicast_ether_addr(dst)) { stats->multicast++; } @@ -1590,14 +1589,14 @@ static inline void ieee80211_extract_country_ie( u8 *addr2 ) { - if(IS_DOT11D_ENABLE(ieee)) + if (IS_DOT11D_ENABLE(ieee)) { - if(info_element->len!= 0) + if (info_element->len!= 0) { memcpy(network->CountryIeBuf, info_element->data, info_element->len); network->CountryIeLen = info_element->len; - if(!IS_COUNTRY_IE_VALID(ieee)) + if (!IS_COUNTRY_IE_VALID(ieee)) { Dot11d_UpdateCountryIe(ieee, addr2, info_element->len, info_element->data); } @@ -1608,7 +1607,7 @@ static inline void ieee80211_extract_country_ie( // some AP (e.g. Cisco 1242) don't include country IE in their // probe response frame. // - if(IS_EQUAL_CIE_SRC(ieee, addr2) ) + if (IS_EQUAL_CIE_SRC(ieee, addr2) ) { UPDATE_CIE_WATCHDOG(ieee); } @@ -1705,7 +1704,7 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee, #ifdef CONFIG_IEEE80211_DEBUG p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", - network->rates[i]); + network->rates_ex[i]); #endif if (ieee80211_is_ofdm_rate (info_element->data[i])) { @@ -1888,7 +1887,7 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee, //if(tmp_htcap_len !=0 || tmp_htinfo_len != 0) { - if((info_element->len >= 3 && + if ((info_element->len >= 3 && info_element->data[0] == 0x00 && info_element->data[1] == 0x05 && info_element->data[2] == 0xb5) || @@ -1940,7 +1939,7 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee, else network->cisco_cap_exist = false; //added by amy for LEAP of cisco - if(info_element->len > 4 && + if (info_element->len > 4 && info_element->data[0] == 0x00 && info_element->data[1] == 0x40 && info_element->data[2] == 0x96 && @@ -1976,7 +1975,7 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee, network->bCcxRmEnable = false; } } - if(info_element->len > 4 && + if (info_element->len > 4 && info_element->data[0] == 0x00 && info_element->data[1] == 0x40 && info_element->data[2] == 0x96 && @@ -2296,7 +2295,7 @@ static inline void update_network(struct ieee80211_network *dst, dst->rates_len = src->rates_len; memcpy(dst->rates_ex, src->rates_ex, src->rates_ex_len); dst->rates_ex_len = src->rates_ex_len; - if(src->ssid_len > 0) + if (src->ssid_len > 0) { memset(dst->ssid, 0, dst->ssid_len); dst->ssid_len = src->ssid_len; @@ -2352,7 +2351,7 @@ static inline void update_network(struct ieee80211_network *dst, dst->qos_data.param_count = src->qos_data.param_count; } - if(dst->qos_data.supported == 1) { + if (dst->qos_data.supported == 1) { dst->QoS_Enable = 1; if(dst->ssid_len) IEEE80211_DEBUG_QOS @@ -2367,7 +2366,7 @@ static inline void update_network(struct ieee80211_network *dst, /* dst->last_associate is not overwritten */ dst->wmm_info = src->wmm_info; //sure to exist in beacon or probe response frame. - if(src->wmm_param[0].ac_aci_acm_aifsn|| \ + if (src->wmm_param[0].ac_aci_acm_aifsn|| \ src->wmm_param[1].ac_aci_acm_aifsn|| \ src->wmm_param[2].ac_aci_acm_aifsn|| \ src->wmm_param[3].ac_aci_acm_aifsn) { @@ -2456,7 +2455,7 @@ static inline void ieee80211_process_probe_response( if (!IsLegalChannel(ieee, network.channel)) return; - if(ieee->bGlobalDomain) + if (ieee->bGlobalDomain) { if (WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == IEEE80211_STYPE_PROBE_RESP) { @@ -2472,7 +2471,7 @@ static inline void ieee80211_process_probe_response( else { // Filter over channel ch12~14 - if(network.channel > 11) + if (network.channel > 11) { printk("GetScanInfo(): For Global Domain, filter probe response at channel(%d).\n", network.channel); return; @@ -2493,7 +2492,7 @@ static inline void ieee80211_process_probe_response( else { // Filter over channel ch12~14 - if(network.channel > 14) + if (network.channel > 14) { printk("GetScanInfo(): For Global Domain, filter beacon at channel(%d).\n",network.channel); return; @@ -2514,9 +2513,9 @@ static inline void ieee80211_process_probe_response( spin_lock_irqsave(&ieee->lock, flags); - if(is_same_network(&ieee->current_network, &network, ieee)) { + if (is_same_network(&ieee->current_network, &network, ieee)) { update_network(&ieee->current_network, &network); - if((ieee->current_network.mode == IEEE_N_24G || ieee->current_network.mode == IEEE_G) + if ((ieee->current_network.mode == IEEE_N_24G || ieee->current_network.mode == IEEE_G) && ieee->current_network.berp_info_valid){ if(ieee->current_network.erp_value& ERP_UseProtection) ieee->current_network.buseprotection = true; @@ -2606,7 +2605,7 @@ static inline void ieee80211_process_probe_response( spin_unlock_irqrestore(&ieee->lock, flags); if (is_beacon(beacon->header.frame_ctl)&&is_same_network(&ieee->current_network, &network, ieee)&&\ (ieee->state == IEEE80211_LINKED)) { - if(ieee->handle_beacon != NULL) { + if (ieee->handle_beacon != NULL) { ieee->handle_beacon(ieee->dev,beacon,&ieee->current_network); } } diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index d1471877e19d..c2388812d4fd 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -62,7 +62,7 @@ static void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p) { u8 *tag = *tag_p; - if (ieee->modulation & IEEE80211_CCK_MODULATION){ + if (ieee->modulation & IEEE80211_CCK_MODULATION) { *tag++ = MFIE_TYPE_RATES; *tag++ = 4; *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB; @@ -79,7 +79,7 @@ static void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p) { u8 *tag = *tag_p; - if (ieee->modulation & IEEE80211_OFDM_MODULATION){ + if (ieee->modulation & IEEE80211_OFDM_MODULATION) { *tag++ = MFIE_TYPE_RATES_EX; *tag++ = 8; @@ -192,7 +192,7 @@ static u8 MgntQuery_MgntFrameTxRate(struct ieee80211_device *ieee) else rate = ieee->basic_rate & 0x7f; - if(rate == 0){ + if (rate == 0) { // 2005.01.26, by rcnjko. if(ieee->mode == IEEE_A|| ieee->mode== IEEE_N_5G|| @@ -369,7 +369,7 @@ static void ieee80211_send_beacon(struct ieee80211_device *ieee) //unsigned long flags; skb = ieee80211_get_beacon_(ieee); - if (skb){ + if (skb) { softmac_mgmt_xmit(skb, ieee); ieee->softmac_stats.tx_beacons++; //dev_kfree_skb_any(skb);//edit by thomas @@ -378,7 +378,7 @@ static void ieee80211_send_beacon(struct ieee80211_device *ieee) // (MSECS( ieee->current_network.beacon_interval -5)); //spin_lock_irqsave(&ieee->beacon_lock,flags); - if(ieee->beacon_txing && ieee->ieee_up){ + if (ieee->beacon_txing && ieee->ieee_up) { // if(!timer_pending(&ieee->beacon_timer)) // add_timer(&ieee->beacon_timer); mod_timer(&ieee->beacon_timer,jiffies+(MSECS(ieee->current_network.beacon_interval-5))); @@ -404,7 +404,7 @@ static void ieee80211_send_probe(struct ieee80211_device *ieee) struct sk_buff *skb; skb = ieee80211_probe_req(ieee); - if (skb){ + if (skb) { softmac_mgmt_xmit(skb, ieee); ieee->softmac_stats.tx_probe_rq++; //dev_kfree_skb_any(skb);//edit by thomas @@ -413,7 +413,7 @@ static void ieee80211_send_probe(struct ieee80211_device *ieee) static void ieee80211_send_probe_requests(struct ieee80211_device *ieee) { - if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)){ + if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)) { ieee80211_send_probe(ieee); ieee80211_send_probe(ieee); } @@ -587,7 +587,7 @@ static void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee) down(&ieee->scan_sem); // spin_lock_irqsave(&ieee->lock, flags); - if (ieee->scanning == 1){ + if (ieee->scanning == 1) { ieee->scanning = 0; cancel_delayed_work(&ieee->softmac_scan_wq); @@ -609,15 +609,15 @@ EXPORT_SYMBOL(ieee80211_stop_scan); /* called with ieee->lock held */ static void ieee80211_start_scan(struct ieee80211_device *ieee) { - if(IS_DOT11D_ENABLE(ieee) ) + if (IS_DOT11D_ENABLE(ieee) ) { - if(IS_COUNTRY_IE_VALID(ieee)) + if (IS_COUNTRY_IE_VALID(ieee)) { RESET_CIE_WATCHDOG(ieee); } } if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){ - if (ieee->scanning == 0){ + if (ieee->scanning == 0) { ieee->scanning = 1; queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0); } @@ -629,9 +629,9 @@ static void ieee80211_start_scan(struct ieee80211_device *ieee) /* called with wx_sem held */ void ieee80211_start_scan_syncro(struct ieee80211_device *ieee) { - if(IS_DOT11D_ENABLE(ieee) ) + if (IS_DOT11D_ENABLE(ieee) ) { - if(IS_COUNTRY_IE_VALID(ieee)) + if (IS_COUNTRY_IE_VALID(ieee)) { RESET_CIE_WATCHDOG(ieee); } @@ -739,7 +739,7 @@ static struct sk_buff *ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d HTConstructInfoElement(ieee,tmp_ht_info_buf,&tmp_ht_info_len, encrypt); - if(pHTInfo->bRegRT2RTAggregation) + if (pHTInfo->bRegRT2RTAggregation) { tmp_generic_ie_buf = ieee->pHTInfo->szRT2RTAggBuffer; tmp_generic_ie_len = sizeof(ieee->pHTInfo->szRT2RTAggBuffer); @@ -803,7 +803,7 @@ static struct sk_buff *ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d *(tag++) = 1; *(tag++) = ieee->current_network.channel; - if(atim_len){ + if (atim_len) { *(tag++) = MFIE_TYPE_IBSS_SET; *(tag++) = 2; @@ -812,12 +812,12 @@ static struct sk_buff *ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d tag+=2; } - if(erp_len){ + if (erp_len) { *(tag++) = MFIE_TYPE_ERP; *(tag++) = 1; *(tag++) = erpinfo_content; } - if(rate_ex_len){ + if (rate_ex_len) { *(tag++) = MFIE_TYPE_RATES_EX; *(tag++) = rate_ex_len-2; memcpy(tag, ieee->current_network.rates_ex, rate_ex_len-2); @@ -877,7 +877,7 @@ static struct sk_buff *ieee80211_assoc_resp(struct ieee80211_device *ieee, crypt = ieee->crypt[ieee->tx_keyidx]; else crypt = NULL; - encrypt = (crypt && crypt->ops); + encrypt = crypt && crypt->ops; if (encrypt) assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); @@ -1016,12 +1016,12 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco encrypt = ieee->host_encrypt && crypt && crypt->ops && ((0 == strcmp(crypt->ops->name,"WEP") || wpa_ie_len)); //Include High Throuput capability && Realtek proprietary - if(ieee->pHTInfo->bCurrentHTSupport&&ieee->pHTInfo->bEnableHT) + if (ieee->pHTInfo->bCurrentHTSupport&&ieee->pHTInfo->bEnableHT) { ht_cap_buf = (u8 *)&(ieee->pHTInfo->SelfHTCap); ht_cap_len = sizeof(ieee->pHTInfo->SelfHTCap); HTConstructCapabilityElement(ieee, ht_cap_buf, &ht_cap_len, encrypt); - if(ieee->pHTInfo->bCurrentRT2RTAggregation) + if (ieee->pHTInfo->bCurrentRT2RTAggregation) { realtek_ie_buf = ieee->pHTInfo->szRT2RTAggBuffer; realtek_ie_len = sizeof( ieee->pHTInfo->szRT2RTAggBuffer); @@ -1029,16 +1029,16 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco } } - if(ieee->qos_support){ + if (ieee->qos_support) { wmm_info_len = beacon->qos_data.supported?9:0; } - if(beacon->bCkipSupported) + if (beacon->bCkipSupported) { ckip_ie_len = 30+2; } - if(beacon->bCcxRmEnable) + if (beacon->bCcxRmEnable) { ccxrm_ie_len = 6+2; } @@ -1141,7 +1141,7 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco tag += osCcxAironetIE.Length; } - if(beacon->bCcxRmEnable) + if (beacon->bCcxRmEnable) { static u8 CcxRmCapBuf[] = {0x00, 0x40, 0x96, 0x01, 0x01, 0x00}; OCTET_STRING osCcxRmCap; @@ -1168,8 +1168,8 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco tag += osCcxVerNum.Length; } //HT cap element - if(ieee->pHTInfo->bCurrentHTSupport&&ieee->pHTInfo->bEnableHT){ - if(ieee->pHTInfo->ePeerHTSpecVer != HT_SPEC_VER_EWC) + if (ieee->pHTInfo->bCurrentHTSupport && ieee->pHTInfo->bEnableHT) { + if (ieee->pHTInfo->ePeerHTSpecVer != HT_SPEC_VER_EWC) { tag = skb_put(skb, ht_cap_len); *tag++ = MFIE_TYPE_HT_CAP; @@ -1182,22 +1182,22 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco //choose what wpa_supplicant gives to associate. tag = skb_put(skb, wpa_ie_len); - if (wpa_ie_len){ + if (wpa_ie_len) { memcpy(tag, ieee->wpa_ie, ieee->wpa_ie_len); } tag = skb_put(skb, wmm_info_len); - if(wmm_info_len) { + if (wmm_info_len) { ieee80211_WMM_Info(ieee, &tag); } #ifdef THOMAS_TURBO tag = skb_put(skb, turbo_info_len); - if(turbo_info_len) { + if (turbo_info_len) { ieee80211_TURBO_Info(ieee, &tag); } #endif - if(ieee->pHTInfo->bCurrentHTSupport&&ieee->pHTInfo->bEnableHT){ + if (ieee->pHTInfo->bCurrentHTSupport && ieee->pHTInfo->bEnableHT) { if(ieee->pHTInfo->ePeerHTSpecVer == HT_SPEC_VER_EWC) { tag = skb_put(skb, ht_cap_len); @@ -1207,7 +1207,7 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco tag += ht_cap_len -2; } - if(ieee->pHTInfo->bCurrentRT2RTAggregation){ + if (ieee->pHTInfo->bCurrentRT2RTAggregation) { tag = skb_put(skb, realtek_ie_len); *tag++ = MFIE_TYPE_GENERIC; *tag++ = realtek_ie_len - 2; @@ -1273,7 +1273,7 @@ static void ieee80211_associate_step1(struct ieee80211_device *ieee) //printk(KERN_WARNING "Sending authentication request\n"); softmac_mgmt_xmit(skb, ieee); //BUGON when you try to add_timer twice, using mod_timer may be better, john0709 - if(!timer_pending(&ieee->associate_timer)){ + if (!timer_pending(&ieee->associate_timer)) { ieee->associate_timer.expires = jiffies + (HZ / 2); add_timer(&ieee->associate_timer); } @@ -1358,7 +1358,7 @@ static void ieee80211_associate_complete_wq(struct work_struct *work) } ieee->LinkDetectInfo.SlotNum = 2 * (1 + ieee->current_network.beacon_interval/500); // To prevent the immediately calling watch_dog after association. - if(ieee->LinkDetectInfo.NumRecvBcnInPeriod==0||ieee->LinkDetectInfo.NumRecvDataInPeriod==0 ) + if (ieee->LinkDetectInfo.NumRecvBcnInPeriod==0||ieee->LinkDetectInfo.NumRecvDataInPeriod==0 ) { ieee->LinkDetectInfo.NumRecvBcnInPeriod = 1; ieee->LinkDetectInfo.NumRecvDataInPeriod= 1; @@ -1371,7 +1371,7 @@ static void ieee80211_associate_complete_wq(struct work_struct *work) else if(ieee->is_silent_reset == 1) { printk("==================>silent reset associate\n"); - ieee->is_silent_reset = 0; + ieee->is_silent_reset = false; } if (ieee->data_hard_resume) @@ -1430,7 +1430,7 @@ inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee return; - if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC){ + if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC) { /* if the user specified the AP MAC, we need also the essid * This could be obtained by beacons or, if the network does not * broadcast it, it can be put manually. @@ -1458,13 +1458,13 @@ inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee /* if the essid is hidden replace it with the * essid provided by the user. */ - if (!ssidbroad){ + if (!ssidbroad) { strncpy(tmp_ssid, ieee->current_network.ssid, IW_ESSID_MAX_SIZE); tmp_ssid_len = ieee->current_network.ssid_len; } memcpy(&ieee->current_network, net, sizeof(struct ieee80211_network)); - if (!ssidbroad){ + if (!ssidbroad) { strncpy(ieee->current_network.ssid, tmp_ssid, IW_ESSID_MAX_SIZE); ieee->current_network.ssid_len = tmp_ssid_len; } @@ -1541,16 +1541,16 @@ static inline u16 auth_parse(struct sk_buff *skb, u8 **challenge, int *chlen) { struct ieee80211_authentication *a; u8 *t; - if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){ + if (skb->len < (sizeof(struct ieee80211_authentication) - sizeof(struct ieee80211_info_element))) { IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n",skb->len); return 0xcafe; } *challenge = NULL; a = (struct ieee80211_authentication *) skb->data; - if(skb->len > (sizeof(struct ieee80211_authentication) +3)){ + if (skb->len > (sizeof(struct ieee80211_authentication) + 3)) { t = skb->data + sizeof(struct ieee80211_authentication); - if(*(t++) == MFIE_TYPE_CHALLENGE){ + if (*(t++) == MFIE_TYPE_CHALLENGE) { *chlen = *(t++); *challenge = kmemdup(t, *chlen, GFP_ATOMIC); if (!*challenge) @@ -1567,7 +1567,7 @@ static int auth_rq_parse(struct sk_buff *skb, u8 *dest) { struct ieee80211_authentication *a; - if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){ + if (skb->len < (sizeof(struct ieee80211_authentication) - sizeof(struct ieee80211_info_element))) { IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len); return -1; } @@ -1601,7 +1601,7 @@ static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, tag = skb->data + sizeof (struct ieee80211_hdr_3addr ); while (tag+1 < skbend){ - if (*tag == 0){ + if (*tag == 0) { ssid = tag+2; ssidlen = *(tag+1); break; @@ -1642,7 +1642,7 @@ static inline u16 assoc_parse(struct ieee80211_device *ieee, struct sk_buff *skb struct ieee80211_assoc_response_frame *response_head; u16 status_code; - if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){ + if (skb->len < sizeof(struct ieee80211_assoc_response_frame)) { IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len); return 0xcafe; } @@ -1672,7 +1672,7 @@ ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb) //IEEE80211DMESG("Rx probe"); ieee->softmac_stats.rx_probe_rq++; //DMESG("Dest is "MACSTR, MAC2STR(dest)); - if (probe_rq_parse(ieee, skb, dest)){ + if (probe_rq_parse(ieee, skb, dest)) { //IEEE80211DMESG("Was for me!"); ieee->softmac_stats.tx_probe_rs++; ieee80211_resp_to_probe(ieee, dest); @@ -1703,7 +1703,7 @@ ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb) //unsigned long flags; ieee->softmac_stats.rx_ass_rq++; - if (assoc_rq_parse(skb,dest) != -1){ + if (assoc_rq_parse(skb, dest) != -1) { ieee80211_resp_to_assoc_rq(ieee, dest); } @@ -1755,13 +1755,13 @@ static short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, (ieee->mgmt_queue_tail != ieee->mgmt_queue_head)) return 0; - if(time_l){ + if (time_l) { *time_l = ieee->current_network.last_dtim_sta_time[0] + (ieee->current_network.beacon_interval * ieee->current_network.dtim_period) * 1000; } - if(time_h){ + if (time_h) { *time_h = ieee->current_network.last_dtim_sta_time[1]; if(time_l && *time_l < ieee->current_network.last_dtim_sta_time[0]) *time_h += 1; @@ -1782,7 +1782,7 @@ static inline void ieee80211_sta_ps(struct ieee80211_device *ieee) spin_lock_irqsave(&ieee->lock, flags); - if((ieee->ps == IEEE80211_PS_DISABLED || + if ((ieee->ps == IEEE80211_PS_DISABLED || ieee->iw_mode != IW_MODE_INFRA || ieee->state != IEEE80211_LINKED)){ @@ -1841,8 +1841,8 @@ out: void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl) { - if(ieee->sta_sleep == 0){ - if(nl){ + if (ieee->sta_sleep == 0) { + if (nl) { printk("Warning: driver is probably failing to report TX ps error\n"); ieee->ps_request_tx_ack(ieee->dev); ieee80211_sta_ps_send_null_frame(ieee, 0); @@ -1856,7 +1856,7 @@ void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl) ieee->sta_sleep = 0; - if(nl){ + if (nl) { ieee->ps_request_tx_ack(ieee->dev); ieee80211_sta_ps_send_null_frame(ieee, 0); } @@ -1870,7 +1870,7 @@ void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success) if(ieee->sta_sleep == 2){ /* Null frame with PS bit set */ - if(success){ + if (success) { ieee->sta_sleep = 1; ieee->enter_sleep_state(ieee->dev,ieee->ps_th,ieee->ps_tl); } @@ -1881,7 +1881,7 @@ void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success) /* 21112005 - tx again null without PS bit if lost */ else { - if((ieee->sta_sleep == 0) && !success){ + if ((ieee->sta_sleep == 0) && !success) { spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); ieee80211_sta_ps_send_null_frame(ieee, 0); spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); @@ -1920,6 +1920,66 @@ static void ieee80211_process_action(struct ieee80211_device *ieee, return; } + +static void ieee80211_check_auth_response(struct ieee80211_device *ieee, + struct sk_buff *skb) +{ + /* default support N mode, disable halfNmode */ + bool bSupportNmode = true, bHalfSupportNmode = false; + u16 errcode; + u8 *challenge; + int chlen = 0; + u32 iotAction; + + errcode = auth_parse(skb, &challenge, &chlen); + if (!errcode) { + if (ieee->open_wep || !challenge) { + ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED; + ieee->softmac_stats.rx_auth_rs_ok++; + iotAction = ieee->pHTInfo->IOTAction; + if (!(iotAction & HT_IOT_ACT_PURE_N_MODE)) { + if (!ieee->GetNmodeSupportBySecCfg(ieee->dev)) { + /* WEP or TKIP encryption */ + if (IsHTHalfNmodeAPs(ieee)) { + bSupportNmode = true; + bHalfSupportNmode = true; + } else { + bSupportNmode = false; + bHalfSupportNmode = false; + } + netdev_dbg(ieee->dev, "SEC(%d, %d)\n", + bSupportNmode, + bHalfSupportNmode); + } + } + /* Dummy wirless mode setting- avoid encryption issue */ + if (bSupportNmode) { + /* N mode setting */ + ieee->SetWirelessMode(ieee->dev, + ieee->current_network.mode); + } else { + /* b/g mode setting - TODO */ + ieee->SetWirelessMode(ieee->dev, IEEE_G); + } + + if (ieee->current_network.mode == IEEE_N_24G && + bHalfSupportNmode == true) { + netdev_dbg(ieee->dev, "enter half N mode\n"); + ieee->bHalfWirelessN24GMode = true; + } else + ieee->bHalfWirelessN24GMode = false; + + ieee80211_associate_step2(ieee); + } else { + ieee80211_auth_challenge(ieee, challenge, chlen); + } + } else { + ieee->softmac_stats.rx_auth_rs_err++; + IEEE80211_DEBUG_MGMT("Auth response status code 0x%x", errcode); + ieee80211_associate_abort(ieee); + } +} + inline int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_rx_stats *rx_stats, u16 type, @@ -1927,12 +1987,9 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, { struct ieee80211_hdr_3addr *header = (struct ieee80211_hdr_3addr *) skb->data; u16 errcode; - u8 *challenge; - int chlen=0; int aid; struct ieee80211_assoc_response_frame *assoc_resp; // struct ieee80211_info_element *info_element; - bool bSupportNmode = true, bHalfSupportNmode = false; //default support N mode, disable halfNmode if(!ieee->proto_started) return 0; @@ -1967,7 +2024,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, ieee->softmac_stats.rx_ass_ok++; /* station support qos */ /* Let the register setting defaultly with Legacy station */ - if(ieee->qos_support) { + if (ieee->qos_support) { assoc_resp = (struct ieee80211_assoc_response_frame *)skb->data; memset(network, 0, sizeof(*network)); if (ieee80211_parse_info_param(ieee,assoc_resp->info_element,\ @@ -2013,68 +2070,16 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, case IEEE80211_STYPE_AUTH: - if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE){ - if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING && - ieee->iw_mode == IW_MODE_INFRA){ + if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) { + if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING + && ieee->iw_mode == IW_MODE_INFRA) { - IEEE80211_DEBUG_MGMT("Received authentication response"); - - errcode = auth_parse(skb, &challenge, &chlen); - if (!errcode) { - if(ieee->open_wep || !challenge){ - ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED; - ieee->softmac_stats.rx_auth_rs_ok++; - if(!(ieee->pHTInfo->IOTAction&HT_IOT_ACT_PURE_N_MODE)) - { - if (!ieee->GetNmodeSupportBySecCfg(ieee->dev)) - { - // WEP or TKIP encryption - if(IsHTHalfNmodeAPs(ieee)) - { - bSupportNmode = true; - bHalfSupportNmode = true; - } - else - { - bSupportNmode = false; - bHalfSupportNmode = false; - } - printk("==========>to link with AP using SEC(%d, %d)", bSupportNmode, bHalfSupportNmode); - } - } - /* Dummy wirless mode setting to avoid encryption issue */ - if(bSupportNmode) { - //N mode setting - ieee->SetWirelessMode(ieee->dev, \ - ieee->current_network.mode); - }else{ - //b/g mode setting - /*TODO*/ - ieee->SetWirelessMode(ieee->dev, IEEE_G); - } - - if (ieee->current_network.mode == IEEE_N_24G && bHalfSupportNmode == true) - { - printk("===============>entern half N mode\n"); - ieee->bHalfWirelessN24GMode = true; - } - else - ieee->bHalfWirelessN24GMode = false; - - ieee80211_associate_step2(ieee); - }else{ - ieee80211_auth_challenge(ieee, challenge, chlen); - } - }else{ - ieee->softmac_stats.rx_auth_rs_err++; - IEEE80211_DEBUG_MGMT("Authentication response status code 0x%x",errcode); - ieee80211_associate_abort(ieee); - } - - }else if (ieee->iw_mode == IW_MODE_MASTER){ - ieee80211_rx_auth_rq(ieee, skb); - } + IEEE80211_DEBUG_MGMT("Received auth response"); + ieee80211_check_auth_response(ieee, skb); + } else if (ieee->iw_mode == IW_MODE_MASTER) { + ieee80211_rx_auth_rq(ieee, skb); } + } break; case IEEE80211_STYPE_PROBE_REQ: @@ -2110,27 +2115,26 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, break; default: return -1; - break; } //dev_kfree_skb_any(skb); return 0; } -/* following are for a simpler TX queue management. - * Instead of using netif_[stop/wake]_queue the driver - * will uses these two function (plus a reset one), that - * will internally uses the kernel netif_* and takes - * care of the ieee802.11 fragmentation. - * So the driver receives a fragment per time and might - * call the stop function when it want without take care - * to have enought room to TX an entire packet. - * This might be useful if each fragment need it's own - * descriptor, thus just keep a total free memory > than - * the max fragmentation treshold is not enought.. If the - * ieee802.11 stack passed a TXB struct then you needed +/* The following are for a simpler TX queue management. + * Instead of using netif_[stop/wake]_queue, the driver + * will use these two functions (plus a reset one) that + * will internally call the kernel netif_* and take care + * of the ieee802.11 fragmentation. + * So, the driver receives a fragment at a time and might + * call the stop function when it wants, without taking + * care to have enough room to TX an entire packet. + * This might be useful if each fragment needs its own + * descriptor. Thus, just keeping a total free memory > than + * the max fragmentation threshold is not enough. If the + * ieee802.11 stack passed a TXB struct, then you would need * to keep N free descriptors where - * N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD + * N = MAX_PACKET_SIZE / MIN_FRAG_THRESHOLD. * In this way you need just one and the 802.11 stack * will take care of buffering fragments and pass them to * to the driver later, when it wakes the queue. @@ -2152,7 +2156,7 @@ void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device * ieee->stats.tx_bytes += txb->payload_size; ieee->stats.tx_packets++; tcb_desc = (cb_desc *)(txb->fragments[0]->cb + MAX_DEV_ADDR_SIZE); - if(tcb_desc->bMulticast) { + if (tcb_desc->bMulticast) { ieee->stats.multicast++; } /* if xmit available, just xmit it immediately, else just insert it to the wait queue */ @@ -2224,7 +2228,7 @@ void ieee80211_reset_queue(struct ieee80211_device *ieee) spin_lock_irqsave(&ieee->lock, flags); init_mgmt_queue(ieee); - if (ieee->tx_pending.txb){ + if (ieee->tx_pending.txb) { ieee80211_txb_free(ieee->tx_pending.txb); ieee->tx_pending.txb = NULL; } @@ -2246,7 +2250,7 @@ void ieee80211_wake_queue(struct ieee80211_device *ieee) ieee->queue_stop = 0; - if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){ + if (ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE) { while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){ header = (struct ieee80211_hdr_3addr *) skb->data; @@ -2265,7 +2269,7 @@ void ieee80211_wake_queue(struct ieee80211_device *ieee) if (!ieee->queue_stop && ieee->tx_pending.txb) ieee80211_resume_tx(ieee); - if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){ + if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)) { ieee->softmac_stats.swtxawake++; netif_wake_queue(ieee->dev); } @@ -2280,7 +2284,7 @@ void ieee80211_stop_queue(struct ieee80211_device *ieee) //unsigned long flags; //spin_lock_irqsave(&ieee->lock,flags); - if (! netif_queue_stopped(ieee->dev)){ + if (!netif_queue_stopped(ieee->dev)) { netif_stop_queue(ieee->dev); ieee->softmac_stats.swtxstop++; } @@ -2301,7 +2305,7 @@ void ieee80211_start_master_bss(struct ieee80211_device *ieee) { ieee->assoc_id = 1; - if (ieee->current_network.ssid_len == 0){ + if (ieee->current_network.ssid_len == 0) { strncpy(ieee->current_network.ssid, IEEE80211_DEFAULT_TX_ESSID, IW_ESSID_MAX_SIZE); @@ -2325,7 +2329,7 @@ void ieee80211_start_master_bss(struct ieee80211_device *ieee) static void ieee80211_start_monitor_mode(struct ieee80211_device *ieee) { - if(ieee->raw_tx){ + if (ieee->raw_tx) { if (ieee->data_hard_resume) ieee->data_hard_resume(ieee->dev); @@ -2345,13 +2349,13 @@ static void ieee80211_start_ibss_wq(struct work_struct *work) * (abort) this wq (when syncro scanning) before sleeping * on the semaphore */ - if(!ieee->proto_started){ + if (!ieee->proto_started) { printk("==========oh driver down return\n"); return; } down(&ieee->wx_sem); - if (ieee->current_network.ssid_len == 0){ + if (ieee->current_network.ssid_len == 0) { strcpy(ieee->current_network.ssid, IEEE80211_DEFAULT_TX_ESSID); ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID); ieee->ssid_set = 1; @@ -2382,7 +2386,7 @@ static void ieee80211_start_ibss_wq(struct work_struct *work) ieee80211_start_scan_syncro(ieee); /* the network definitively is not here.. create a new cell */ - if (ieee->state == IEEE80211_NOLINK){ + if (ieee->state == IEEE80211_NOLINK) { printk("creating new IBSS cell\n"); if(!ieee->wap_set) ieee80211_randomize_cell(ieee); @@ -2456,9 +2460,9 @@ void ieee80211_start_bss(struct ieee80211_device *ieee) // Ref: 802.11d 11.1.3.3 // STA shall not start a BSS unless properly formed Beacon frame including a Country IE. // - if(IS_DOT11D_ENABLE(ieee) && !IS_COUNTRY_IE_VALID(ieee)) + if (IS_DOT11D_ENABLE(ieee) && !IS_COUNTRY_IE_VALID(ieee)) { - if(! ieee->bGlobalDomain) + if (! ieee->bGlobalDomain) { return; } @@ -2479,7 +2483,7 @@ void ieee80211_start_bss(struct ieee80211_device *ieee) */ spin_lock_irqsave(&ieee->lock, flags); - if (ieee->state == IEEE80211_NOLINK){ + if (ieee->state == IEEE80211_NOLINK) { ieee->actscanning = true; ieee80211_start_scan(ieee); } @@ -2633,7 +2637,7 @@ void ieee80211_start_protocol(struct ieee80211_device *ieee) ieee->proto_started = 1; - if (ieee->current_network.channel == 0){ + if (ieee->current_network.channel == 0) { do{ ch++; if (ch > MAX_CHANNEL_NUMBER) @@ -2719,16 +2723,14 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee) ieee->sta_edca_param[2] = 0x005E4342; ieee->sta_edca_param[3] = 0x002F3262; ieee->aggregation = true; - ieee->enable_rx_imm_BA = 1; + ieee->enable_rx_imm_BA = true; ieee->tx_pending.txb = NULL; - init_timer(&ieee->associate_timer); - ieee->associate_timer.data = (unsigned long)ieee; - ieee->associate_timer.function = ieee80211_associate_abort_cb; + setup_timer(&ieee->associate_timer, ieee80211_associate_abort_cb, + (unsigned long)ieee); - init_timer(&ieee->beacon_timer); - ieee->beacon_timer.data = (unsigned long) ieee; - ieee->beacon_timer.function = ieee80211_send_beacon_cb; + setup_timer(&ieee->beacon_timer, ieee80211_send_beacon_cb, + (unsigned long)ieee); ieee->wq = create_workqueue(DRV_NAME); @@ -3027,12 +3029,11 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee, ieee80211_crypt_delayed_deinit(ieee, crypt); - new_crypt = kmalloc(sizeof(*new_crypt), GFP_KERNEL); + new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL); if (new_crypt == NULL) { ret = -ENOMEM; goto done; } - memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); new_crypt->ops = ops; if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) new_crypt->priv = @@ -3140,7 +3141,7 @@ SendDisassociation( struct ieee80211_network *beacon = &ieee->current_network; struct sk_buff *skb; skb = ieee80211_disassociate_skb(beacon,ieee,asRsn); - if (skb){ + if (skb) { softmac_mgmt_xmit(skb, ieee); //dev_kfree_skb_any(skb);//edit by thomas } @@ -3155,7 +3156,7 @@ int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_poin down(&ieee->wx_sem); //IEEE_DEBUG_INFO("wpa_supplicant: len=%d\n", p->length); - if (p->length < sizeof(struct ieee_param) || !p->pointer){ + if (p->length < sizeof(struct ieee_param) || !p->pointer) { ret = -EINVAL; goto out; } @@ -3210,7 +3211,7 @@ void notify_wx_assoc_event(struct ieee80211_device *ieee) if (ieee->state == IEEE80211_LINKED) memcpy(wrqu.ap_addr.sa_data, ieee->current_network.bssid, ETH_ALEN); else - memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); + eth_zero_addr(wrqu.ap_addr.sa_data); wireless_send_event(ieee->dev, SIOCGIWAP, &wrqu, NULL); } EXPORT_SYMBOL(notify_wx_assoc_event); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c index 644368df6342..714fbcace72b 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c @@ -36,7 +36,7 @@ int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info down(&ieee->wx_sem); - if(ieee->iw_mode == IW_MODE_INFRA){ + if (ieee->iw_mode == IW_MODE_INFRA) { ret = -EOPNOTSUPP; goto out; } @@ -121,7 +121,7 @@ int ieee80211_wx_get_wap(struct ieee80211_device *ieee, ieee->state != IEEE80211_LINKED_SCANNING && ieee->wap_set == 0) - memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); + eth_zero_addr(wrqu->ap_addr.sa_data); else memcpy(wrqu->ap_addr.sa_data, ieee->current_network.bssid, ETH_ALEN); @@ -148,12 +148,12 @@ int ieee80211_wx_set_wap(struct ieee80211_device *ieee, down(&ieee->wx_sem); /* use ifconfig hw ether */ - if (ieee->iw_mode == IW_MODE_MASTER){ + if (ieee->iw_mode == IW_MODE_MASTER) { ret = -1; goto out; } - if (temp->sa_family != ARPHRD_ETHER){ + if (temp->sa_family != ARPHRD_ETHER) { ret = -EINVAL; goto out; } @@ -345,7 +345,7 @@ void ieee80211_wx_sync_scan_wq(struct work_struct *work) ieee->state = IEEE80211_LINKED; ieee->link_change(ieee->dev); // To prevent the immediately calling watch_dog after scan. - if(ieee->LinkDetectInfo.NumRecvBcnInPeriod==0||ieee->LinkDetectInfo.NumRecvDataInPeriod==0 ) + if (ieee->LinkDetectInfo.NumRecvBcnInPeriod==0||ieee->LinkDetectInfo.NumRecvDataInPeriod==0 ) { ieee->LinkDetectInfo.NumRecvBcnInPeriod = 1; ieee->LinkDetectInfo.NumRecvDataInPeriod= 1; @@ -369,7 +369,7 @@ int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info down(&ieee->wx_sem); - if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){ + if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)) { ret = -1; goto out; } @@ -400,12 +400,12 @@ int ieee80211_wx_set_essid(struct ieee80211_device *ieee, proto_started = ieee->proto_started; - if (wrqu->essid.length > IW_ESSID_MAX_SIZE){ + if (wrqu->essid.length > IW_ESSID_MAX_SIZE) { ret= -E2BIG; goto out; } - if (ieee->iw_mode == IW_MODE_MONITOR){ + if (ieee->iw_mode == IW_MODE_MONITOR) { ret= -1; goto out; } @@ -469,9 +469,9 @@ EXPORT_SYMBOL(ieee80211_wx_get_mode); printk(KERN_INFO"raw TX is %s\n", ieee->raw_tx ? "enabled" : "disabled"); - if(ieee->iw_mode == IW_MODE_MONITOR) + if (ieee->iw_mode == IW_MODE_MONITOR) { - if(prev == 0 && ieee->raw_tx){ + if (prev == 0 && ieee->raw_tx) { if (ieee->data_hard_resume) ieee->data_hard_resume(ieee->dev); @@ -522,7 +522,7 @@ int ieee80211_wx_set_power(struct ieee80211_device *ieee, int ret = 0; down(&ieee->wx_sem); - if (wrqu->power.disabled){ + if (wrqu->power.disabled) { ieee->ps = IEEE80211_PS_DISABLED; goto exit; } @@ -572,7 +572,7 @@ int ieee80211_wx_get_power(struct ieee80211_device *ieee, { down(&ieee->wx_sem); - if(ieee->ps == IEEE80211_PS_DISABLED){ + if (ieee->ps == IEEE80211_PS_DISABLED) { wrqu->power.disabled = 1; goto exit; } diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c index fca73c7c9fbe..9f68c652fb2b 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c @@ -32,7 +32,6 @@ ******************************************************************************/ #include <linux/compiler.h> -//#include <linux/config.h> #include <linux/errno.h> #include <linux/if_arp.h> #include <linux/in6.h> @@ -554,16 +553,16 @@ static void ieee80211_txrate_selectmode(struct ieee80211_device *ieee, #ifdef TO_DO_LIST if(!IsDataFrame(pFrame)) { - pTcb->bTxDisableRateFallBack = TRUE; - pTcb->bTxUseDriverAssingedRate = TRUE; + pTcb->bTxDisableRateFallBack = true; + pTcb->bTxUseDriverAssingedRate = true; pTcb->RATRIndex = 7; return; } if(pMgntInfo->ForcedDataRate!= 0) { - pTcb->bTxDisableRateFallBack = TRUE; - pTcb->bTxUseDriverAssingedRate = TRUE; + pTcb->bTxDisableRateFallBack = true; + pTcb->bTxUseDriverAssingedRate = true; return; } #endif diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c index 1b4623c3f95e..618d2cbc049e 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c @@ -46,14 +46,14 @@ static u8 TxTsDeleteBA(struct ieee80211_device *ieee, PTX_TS_RECORD pTxTs) u8 bSendDELBA = false; // Delete pending BA - if(pPendingBa->bValid) + if (pPendingBa->bValid) { DeActivateBAEntry(ieee, pPendingBa); bSendDELBA = true; } // Delete admitted BA - if(pAdmittedBa->bValid) + if (pAdmittedBa->bValid) { DeActivateBAEntry(ieee, pAdmittedBa); bSendDELBA = true; @@ -74,7 +74,7 @@ static u8 RxTsDeleteBA(struct ieee80211_device *ieee, PRX_TS_RECORD pRxTs) PBA_RECORD pBa = &pRxTs->RxAdmittedBARecord; u8 bSendDELBA = false; - if(pBa->bValid) + if (pBa->bValid) { DeActivateBAEntry(ieee, pBa); bSendDELBA = true; @@ -363,7 +363,7 @@ int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, struct sk_buff *skb) printk("====================>rx ADDBAREQ from :%pM\n", dst); //some other capability is not ready now. - if( (ieee->current_network.qos_data.active == 0) || + if ((ieee->current_network.qos_data.active == 0) || (ieee->pHTInfo->bCurrentHTSupport == false)) //|| // (ieee->pStaQos->bEnableRxImmBA == false) ) { @@ -373,7 +373,7 @@ int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, struct sk_buff *skb) } // Search for related traffic stream. // If there is no matched TS, reject the ADDBA request. - if( !GetTs( + if (!GetTs( ieee, (PTS_COMMON_INFO *)(&pTS), dst, @@ -390,7 +390,7 @@ int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, struct sk_buff *skb) // We can do much more check here, including BufferSize, AMSDU_Support, Policy, StartSeqCtrl... // I want to check StartSeqCtrl to make sure when we start aggregation!!! // - if(pBaParamSet->field.BAPolicy == BA_POLICY_DELAYED) + if (pBaParamSet->field.BAPolicy == BA_POLICY_DELAYED) { rc = ADDBA_STATUS_INVALID_PARAM; IEEE80211_DEBUG(IEEE80211_DL_ERR, "BA Policy is not correct in %s()\n", __func__); @@ -522,7 +522,7 @@ int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, struct sk_buff *skb) // We can compare the value of BA parameter set that Peer returned and Self sent. // If it is OK, then admitted. Or we can send DELBA to cancel BA mechanism. // - if(pBaParamSet->field.BAPolicy == BA_POLICY_DELAYED) + if (pBaParamSet->field.BAPolicy == BA_POLICY_DELAYED) { // Since this is a kind of ADDBA failed, we delay next ADDBA process. pTS->bAddBaReqDelayed = true; @@ -582,7 +582,7 @@ int ieee80211_rx_DELBA(struct ieee80211_device *ieee, struct sk_buff *skb) return -1; } - if(ieee->current_network.qos_data.active == 0 || + if (ieee->current_network.qos_data.active == 0 || ieee->pHTInfo->bCurrentHTSupport == false ) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "received DELBA while QOS or HT is not supported(%d, %d)\n",ieee->current_network.qos_data.active, ieee->pHTInfo->bCurrentHTSupport); @@ -600,7 +600,7 @@ int ieee80211_rx_DELBA(struct ieee80211_device *ieee, struct sk_buff *skb) { PRX_TS_RECORD pRxTs; - if( !GetTs( + if (!GetTs( ieee, (PTS_COMMON_INFO *)&pRxTs, dst, @@ -618,7 +618,7 @@ int ieee80211_rx_DELBA(struct ieee80211_device *ieee, struct sk_buff *skb) { PTX_TS_RECORD pTxTs; - if(!GetTs( + if (!GetTs( ieee, (PTS_COMMON_INFO *)&pTxTs, dst, diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c index e60d926a3973..c2588f80625b 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c @@ -471,12 +471,10 @@ static bool HTIOTActIsDisableMCS15(struct ieee80211_device *ieee) static bool HTIOTActIsDisableMCSTwoSpatialStream(struct ieee80211_device *ieee, u8 *PeerMacAddr) { - bool retValue = false; - #ifdef TODO // Apply for 819u only #endif - return retValue; + return false; } /******************************************************************************************************************** @@ -488,11 +486,8 @@ static bool HTIOTActIsDisableMCSTwoSpatialStream(struct ieee80211_device *ieee, * *****************************************************************************************************************/ static u8 HTIOTActIsDisableEDCATurbo(struct ieee80211_device *ieee, u8 *PeerMacAddr) -{ - u8 retValue = false; // default enable EDCA Turbo mode. - // Set specific EDCA parameter for different AP in DM handler. - - return retValue; +{ /* default enable EDCA Turbo mode. */ + return false; } /******************************************************************************************************************** @@ -508,7 +503,7 @@ static u8 HTIOTActIsMgntUseCCK6M(struct ieee80211_network *network) // 2008/01/25 MH Judeg if we need to use OFDM to sned MGNT frame for broadcom AP. // 2008/01/28 MH We must prevent that we select null bssid to link. - if(network->broadcom_cap_exist) + if (network->broadcom_cap_exist) { retValue = 1; } @@ -625,7 +620,7 @@ void HTConstructCapabilityElement(struct ieee80211_device *ieee, u8 *posHTCap, u // 2008.06.12 // For RTL819X, if pairwisekey = wep/tkip, ap is ralink, we support only MCS0~7. - if(ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) + if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) { int i; for(i = 1; i< 16; i++) @@ -752,7 +747,7 @@ void HTConstructRT2RTAggElement(struct ieee80211_device *ieee, u8 *posRT2RTAgg, *posRT2RTAgg++ = 0x01; *posRT2RTAgg = 0x10;//*posRT2RTAgg = 0x02; - if(ieee->bSupportRemoteWakeUp) { + if (ieee->bSupportRemoteWakeUp) { *posRT2RTAgg |= 0x08;//RT_HT_CAP_USE_WOW; } @@ -879,17 +874,17 @@ u8 HTGetHighestMCSRate(struct ieee80211_device *ieee, u8 *pMCSRateSet, u8 *pMCSF for(i = 0; i < 16; i++) { - if(availableMcsRate[i] != 0) + if (availableMcsRate[i] != 0) { bitMap = availableMcsRate[i]; for(j = 0; j < 8; j++) { - if((bitMap%2) != 0) + if ((bitMap%2) != 0) { if(HTMcsToDataRate(ieee, (8*i+j)) > HTMcsToDataRate(ieee, mcsRate)) mcsRate = (8*i+j); } - bitMap = bitMap>>1; + bitMap >>= 1; } } } @@ -1067,7 +1062,7 @@ void HTOnAssocRsp(struct ieee80211_device *ieee) // Lanhsin: mark for tmp to avoid deauth by ap from s3 //if(memcmp(pMgntInfo->Bssid, NETGEAR834Bv2_BROADCOM, 3)==0) - if(0) + if (0) { pHTInfo->bCurrentAMPDUEnable = false; @@ -1303,7 +1298,7 @@ void HTUpdateSelfAndPeerSetting(struct ieee80211_device *ieee, struct ieee80211_ // PHT_CAPABILITY_ELE pPeerHTCap = (PHT_CAPABILITY_ELE)pNetwork->bssht.bdHTCapBuf; PHT_INFORMATION_ELE pPeerHTInfo = (PHT_INFORMATION_ELE)pNetwork->bssht.bdHTInfoBuf; - if(pHTInfo->bCurrentHTSupport) + if (pHTInfo->bCurrentHTSupport) { // // Config current operation mode. @@ -1328,7 +1323,7 @@ EXPORT_SYMBOL(HTUpdateSelfAndPeerSetting); ********************************************************************************************************************/ u8 HTCCheck(struct ieee80211_device *ieee, u8 *pFrame) { - if(ieee->pHTInfo->bCurrentHTSupport) + if (ieee->pHTInfo->bCurrentHTSupport) { if ((IsQoSDataFrame(pFrame) && Frame_Order(pFrame)) == 1) { IEEE80211_DEBUG(IEEE80211_DL_HT, "HT CONTROL FILED EXIST!!\n"); @@ -1357,7 +1352,7 @@ void HTSetConnectBwMode(struct ieee80211_device *ieee, HT_CHANNEL_WIDTH Bandwidt // return; // spin_lock_irqsave(&(ieee->bw_spinlock), flags); - if(pHTInfo->bSwBwInProgress) { + if (pHTInfo->bSwBwInProgress) { // spin_unlock_irqrestore(&(ieee->bw_spinlock), flags); return; } diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h index 7ed7243b1fb0..873969c9f226 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h @@ -1,14 +1,14 @@ #ifndef _TSTYPE_H_ #define _TSTYPE_H_ #include "rtl819x_Qos.h" -#define TS_SETUP_TIMEOUT 60 // In millisecond +#define TS_SETUP_TIMEOUT 60 /* In millisecond */ #define TS_INACT_TIMEOUT 60 #define TS_ADDBA_DELAY 60 #define TOTAL_TS_NUM 16 #define TCLAS_NUM 4 -// This define the Tx/Rx directions +/* This define the Tx/Rx directions */ typedef enum _TR_SELECT { TX_DIR = 0, RX_DIR = 1, @@ -28,9 +28,9 @@ typedef struct _TS_COMMON_INFO{ typedef struct _TX_TS_RECORD{ TS_COMMON_INFO TsCommonInfo; u16 TxCurSeq; - BA_RECORD TxPendingBARecord; // For BA Originator - BA_RECORD TxAdmittedBARecord; // For BA Originator -// QOS_DL_RECORD DLRecord; + BA_RECORD TxPendingBARecord; /* For BA Originator */ + BA_RECORD TxAdmittedBARecord; /* For BA Originator */ +/* QOS_DL_RECORD DLRecord; */ u8 bAddBaReqInProgress; u8 bAddBaReqDelayed; u8 bUsingBa; @@ -44,11 +44,11 @@ typedef struct _RX_TS_RECORD { u16 RxTimeoutIndicateSeq; struct list_head RxPendingPktList; struct timer_list RxPktPendingTimer; - BA_RECORD RxAdmittedBARecord; // For BA Recipient + BA_RECORD RxAdmittedBARecord; /* For BA Recipient */ u16 RxLastSeqNum; u8 RxLastFragNum; u8 num; -// QOS_DL_RECORD DLRecord; +/* QOS_DL_RECORD DLRecord; */ } RX_TS_RECORD, *PRX_TS_RECORD; diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c index acaa723817e7..ea92fdebe5a7 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c @@ -156,26 +156,16 @@ void TSInitialize(struct ieee80211_device *ieee) pTxTS->num = count; // The timers for the operation of Traffic Stream and Block Ack. // DLS related timer will be add here in the future!! - init_timer(&pTxTS->TsCommonInfo.SetupTimer); - pTxTS->TsCommonInfo.SetupTimer.data = (unsigned long)pTxTS; - pTxTS->TsCommonInfo.SetupTimer.function = TsSetupTimeOut; - - init_timer(&pTxTS->TsCommonInfo.InactTimer); - pTxTS->TsCommonInfo.InactTimer.data = (unsigned long)pTxTS; - pTxTS->TsCommonInfo.InactTimer.function = TsInactTimeout; - - init_timer(&pTxTS->TsAddBaTimer); - pTxTS->TsAddBaTimer.data = (unsigned long)pTxTS; - pTxTS->TsAddBaTimer.function = TsAddBaProcess; - - init_timer(&pTxTS->TxPendingBARecord.Timer); - pTxTS->TxPendingBARecord.Timer.data = (unsigned long)pTxTS; - pTxTS->TxPendingBARecord.Timer.function = BaSetupTimeOut; - - init_timer(&pTxTS->TxAdmittedBARecord.Timer); - pTxTS->TxAdmittedBARecord.Timer.data = (unsigned long)pTxTS; - pTxTS->TxAdmittedBARecord.Timer.function = TxBaInactTimeout; - + setup_timer(&pTxTS->TsCommonInfo.SetupTimer, TsSetupTimeOut, + (unsigned long)pTxTS); + setup_timer(&pTxTS->TsCommonInfo.InactTimer, TsInactTimeout, + (unsigned long)pTxTS); + setup_timer(&pTxTS->TsAddBaTimer, TsAddBaProcess, + (unsigned long)pTxTS); + setup_timer(&pTxTS->TxPendingBARecord.Timer, BaSetupTimeOut, + (unsigned long)pTxTS); + setup_timer(&pTxTS->TxAdmittedBARecord.Timer, + TxBaInactTimeout, (unsigned long)pTxTS); ResetTxTsEntry(pTxTS); list_add_tail(&pTxTS->TsCommonInfo.List, &ieee->Tx_TS_Unused_List); pTxTS++; @@ -189,23 +179,14 @@ void TSInitialize(struct ieee80211_device *ieee) { pRxTS->num = count; INIT_LIST_HEAD(&pRxTS->RxPendingPktList); - - init_timer(&pRxTS->TsCommonInfo.SetupTimer); - pRxTS->TsCommonInfo.SetupTimer.data = (unsigned long)pRxTS; - pRxTS->TsCommonInfo.SetupTimer.function = TsSetupTimeOut; - - init_timer(&pRxTS->TsCommonInfo.InactTimer); - pRxTS->TsCommonInfo.InactTimer.data = (unsigned long)pRxTS; - pRxTS->TsCommonInfo.InactTimer.function = TsInactTimeout; - - init_timer(&pRxTS->RxAdmittedBARecord.Timer); - pRxTS->RxAdmittedBARecord.Timer.data = (unsigned long)pRxTS; - pRxTS->RxAdmittedBARecord.Timer.function = RxBaInactTimeout; - - init_timer(&pRxTS->RxPktPendingTimer); - pRxTS->RxPktPendingTimer.data = (unsigned long)pRxTS; - pRxTS->RxPktPendingTimer.function = RxPktPendingTimeout; - + setup_timer(&pRxTS->TsCommonInfo.SetupTimer, TsSetupTimeOut, + (unsigned long)pRxTS); + setup_timer(&pRxTS->TsCommonInfo.InactTimer, TsInactTimeout, + (unsigned long)pRxTS); + setup_timer(&pRxTS->RxAdmittedBARecord.Timer, + RxBaInactTimeout, (unsigned long)pRxTS); + setup_timer(&pRxTS->RxPktPendingTimer, RxPktPendingTimeout, + (unsigned long)pRxTS); ResetRxTsEntry(pRxTS); list_add_tail(&pRxTS->TsCommonInfo.List, &ieee->Rx_TS_Unused_List); pRxTS++; @@ -288,7 +269,7 @@ static PTS_COMMON_INFO SearchAdmitTRStream(struct ieee80211_device *ieee, //for(dir = DIR_UP; dir <= DIR_BI_DIR; dir++) for(dir = 0; dir <= DIR_BI_DIR; dir++) { - if(search_dir[dir] ==false ) + if (!search_dir[dir]) continue; list_for_each_entry(pRet, psearch_list, List){ // IEEE80211_DEBUG(IEEE80211_DL_TS, "ADD:%pM, TID:%d, dir:%d\n", pRet->Addr, pRet->TSpec.f.TSInfo.field.ucTSID, pRet->TSpec.f.TSInfo.field.ucDirection); @@ -400,8 +381,7 @@ bool GetTs( } else { - if(bAddNewTs == false) - { + if (!bAddNewTs) { IEEE80211_DEBUG(IEEE80211_DL_TS, "add new TS failed(tid:%d)\n", UP); return false; } diff --git a/drivers/staging/rtl8192u/r8190_rtl8256.c b/drivers/staging/rtl8192u/r8190_rtl8256.c index 1868352d3789..e00032947e0f 100644 --- a/drivers/staging/rtl8192u/r8190_rtl8256.c +++ b/drivers/staging/rtl8192u/r8190_rtl8256.c @@ -225,7 +225,7 @@ void PHY_SetRF8256CCKTxPower(struct net_device *dev, u8 powerlevel) struct r8192_priv *priv = ieee80211_priv(dev); TxAGC = powerlevel; - if (priv->bDynamicTxLowPower == TRUE) { + if (priv->bDynamicTxLowPower) { if (priv->CustomerID == RT_CID_819x_Netcore) TxAGC = 0x22; else @@ -275,7 +275,7 @@ void PHY_SetRF8256OFDMTxPower(struct net_device *dev, u8 powerlevel) priv->Pwr_Track = writeVal_tmp; } - if (priv->bDynamicTxHighPower == TRUE) { + if (priv->bDynamicTxHighPower) { /*Add by Jacken 2008/03/06 *Emily, 20080613. Set low tx power for both MCS and legacy OFDM */ diff --git a/drivers/staging/rtl8192u/r8190_rtl8256.h b/drivers/staging/rtl8192u/r8190_rtl8256.h index fa6dd37d85e6..6e5662f7951c 100644 --- a/drivers/staging/rtl8192u/r8190_rtl8256.h +++ b/drivers/staging/rtl8192u/r8190_rtl8256.h @@ -13,8 +13,9 @@ #ifndef RTL8225H #define RTL8225H -#define RTL819X_TOTAL_RF_PATH 2 //for 8192U -extern void PHY_SetRF8256Bandwidth(struct net_device *dev , HT_CHANNEL_WIDTH Bandwidth); +#define RTL819X_TOTAL_RF_PATH 2 /* for 8192U */ +extern void PHY_SetRF8256Bandwidth(struct net_device *dev, + HT_CHANNEL_WIDTH Bandwidth); extern void PHY_RF8256_Config(struct net_device *dev); extern void phy_RF8256_Config_ParaFile(struct net_device *dev); extern void PHY_SetRF8256CCKTxPower(struct net_device *dev, u8 powerlevel); diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h index c9d8c102cca3..6c2e438c9af4 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -40,8 +40,6 @@ #define RTL8192U #define RTL819xU_MODULE_NAME "rtl819xU" /* HW security */ -#define FALSE 0 -#define TRUE 1 #define MAX_KEY_LEN 61 #define KEY_BUF_SIZE 5 diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index e031a253e2ae..a4795afeeb9c 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -408,9 +408,8 @@ inline void force_pci_posting(struct net_device *dev) } static struct net_device_stats *rtl8192_stats(struct net_device *dev); -void rtl8192_commit(struct net_device *dev); -void rtl8192_restart(struct work_struct *work); -void watch_dog_timer_callback(unsigned long data); +static void rtl8192_restart(struct work_struct *work); +static void watch_dog_timer_callback(unsigned long data); /**************************************************************************** * -----------------------------PROCFS STUFF------------------------- @@ -827,7 +826,6 @@ void rtl8192_rtx_disable(struct net_device *dev) netdev_warn(dev, "skb_queue not empty\n"); skb_queue_purge(&priv->skb_queue); - return; } inline u16 ieeerate2rtlrate(int rate) @@ -966,8 +964,6 @@ static void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, ret = rtl8192_tx(dev, skb); spin_unlock_irqrestore(&priv->tx_lock, flags); - - return; } /* This is a rough attempt to TX a frame @@ -1766,7 +1762,7 @@ void rtl8192_usb_deleteendpoints(struct net_device *dev) } #endif -extern void rtl8192_update_ratr_table(struct net_device *dev); +static void rtl8192_update_ratr_table(struct net_device *dev); static void rtl8192_link_change(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -1971,7 +1967,7 @@ static int rtl8192_handle_assoc_response(struct net_device *dev, } -void rtl8192_update_ratr_table(struct net_device *dev) +static void rtl8192_update_ratr_table(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); struct ieee80211_device *ieee = priv->ieee80211; @@ -2067,7 +2063,6 @@ static void rtl8192_refresh_supportrate(struct r8192_priv *priv) memcpy(ieee->Regdot11HTOperationalRateSet, ieee->RegHTSuppRateSet, 16); else memset(ieee->Regdot11HTOperationalRateSet, 0, 16); - return; } static u8 rtl8192_getSupportedWireleeMode(struct net_device *dev) @@ -2078,10 +2073,10 @@ static u8 rtl8192_getSupportedWireleeMode(struct net_device *dev) case RF_8225: case RF_8256: case RF_PSEUDO_11N: - ret = (WIRELESS_MODE_N_24G|WIRELESS_MODE_G|WIRELESS_MODE_B); + ret = WIRELESS_MODE_N_24G|WIRELESS_MODE_G|WIRELESS_MODE_B; break; case RF_8258: - ret = (WIRELESS_MODE_A|WIRELESS_MODE_N_5G); + ret = WIRELESS_MODE_A|WIRELESS_MODE_N_5G; break; default: ret = WIRELESS_MODE_B; @@ -2143,7 +2138,7 @@ static void rtl8192_init_priv_variable(struct net_device *dev) //for silent reset priv->IrpPendingCount = 1; priv->ResetProgress = RESET_TYPE_NORESET; - priv->bForcedSilentReset = 0; + priv->bForcedSilentReset = false; priv->bDisableNormalResetCheck = false; priv->force_reset = false; @@ -2247,9 +2242,9 @@ static void rtl8192_init_priv_lock(struct r8192_priv *priv) mutex_init(&priv->mutex); } -extern void rtl819x_watchdog_wqcallback(struct work_struct *work); +static void rtl819x_watchdog_wqcallback(struct work_struct *work); -void rtl8192_irq_rx_tasklet(struct r8192_priv *priv); +static void rtl8192_irq_rx_tasklet(struct r8192_priv *priv); //init tasklet and wait_queue here. only 2.6 above kernel is considered #define DRV_NAME "wlan0" static void rtl8192_init_priv_task(struct net_device *dev) @@ -2310,11 +2305,11 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) } if (bLoad_From_EEPOM) { - tmpValue = eprom_read(dev, (EEPROM_VID>>1)); + tmpValue = eprom_read(dev, EEPROM_VID>>1); priv->eeprom_vid = endian_swap(&tmpValue); - priv->eeprom_pid = eprom_read(dev, (EEPROM_PID>>1)); - tmpValue = eprom_read(dev, (EEPROM_ChannelPlan>>1)); - priv->eeprom_ChannelPlan = ((tmpValue&0xff00)>>8); + priv->eeprom_pid = eprom_read(dev, EEPROM_PID>>1); + tmpValue = eprom_read(dev, EEPROM_ChannelPlan>>1); + priv->eeprom_ChannelPlan = (tmpValue & 0xff00)>>8; priv->btxpowerdata_readfromEEPORM = true; priv->eeprom_CustomerID = eprom_read(dev, (EEPROM_Customer_ID>>1)) >>8; } else { @@ -2397,7 +2392,8 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) } } else if (priv->EEPROM_Def_Ver == 1) { if (bLoad_From_EEPOM) { - tmpValue = eprom_read(dev, (EEPROM_TxPwIndex_CCK_V1>>1)); + tmpValue = eprom_read(dev, + EEPROM_TxPwIndex_CCK_V1 >> 1); tmpValue = (tmpValue & 0xff00) >> 8; } else { tmpValue = 0x10; @@ -2410,7 +2406,8 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) tmpValue = 0x1010; *((u16 *)(&priv->EEPROMTxPowerLevelCCK_V1[1])) = tmpValue; if (bLoad_From_EEPOM) - tmpValue = eprom_read(dev, (EEPROM_TxPwIndex_OFDM_24G_V1>>1)); + tmpValue = eprom_read(dev, + EEPROM_TxPwIndex_OFDM_24G_V1 >> 1); else tmpValue = 0x1010; *((u16 *)(&priv->EEPROMTxPowerLevelOFDM24G[0])) = tmpValue; @@ -2453,7 +2450,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) // Antenna B gain offset to antenna A, bit0~3 priv->AntennaTxPwDiff[0] = (priv->EEPROMTxPowerDiff & 0xf); // Antenna C gain offset to antenna A, bit4~7 - priv->AntennaTxPwDiff[1] = ((priv->EEPROMTxPowerDiff & 0xf0)>>4); + priv->AntennaTxPwDiff[1] = (priv->EEPROMTxPowerDiff & 0xf0)>>4; // CrystalCap, bit12~15 priv->CrystalCap = priv->EEPROMCrystalCap; // ThermalMeter, bit0~3 for RFIC1, bit4~7 for RFIC2 @@ -2505,7 +2502,6 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) //we need init DIG RATR table here again. RT_TRACE(COMP_EPROM, "<===========%s()\n", __func__); - return; } static short rtl8192_get_channel_map(struct net_device *dev) @@ -2547,9 +2543,8 @@ static short rtl8192_init(struct net_device *dev) rtl8192_read_eeprom_info(dev); rtl8192_get_channel_map(dev); init_hal_dm(dev); - init_timer(&priv->watch_dog_timer); - priv->watch_dog_timer.data = (unsigned long)dev; - priv->watch_dog_timer.function = watch_dog_timer_callback; + setup_timer(&priv->watch_dog_timer, watch_dog_timer_callback, + (unsigned long)dev); if (rtl8192_usb_initendpoints(dev) != 0) { DMESG("Endopoints initialization failed"); return -ENOMEM; @@ -2686,7 +2681,7 @@ static bool rtl8192_adapter_start(struct net_device *dev) read_nic_dword(dev, CPU_GEN, &dwRegRead); if (priv->LoopbackMode == RTL819xU_NO_LOOPBACK) - dwRegRead = ((dwRegRead & CPU_GEN_NO_LOOPBACK_MSK) | CPU_GEN_NO_LOOPBACK_SET); + dwRegRead = (dwRegRead & CPU_GEN_NO_LOOPBACK_MSK) | CPU_GEN_NO_LOOPBACK_SET; else if (priv->LoopbackMode == RTL819xU_MAC_LOOPBACK) dwRegRead |= CPU_CCK_LOOPBACK; else @@ -2767,7 +2762,7 @@ static bool rtl8192_adapter_start(struct net_device *dev) // #ifdef TO_DO_LIST if (Adapter->ResetProgress == RESET_TYPE_NORESET) { - if (pMgntInfo->RegRfOff == TRUE) { /* User disable RF via registry. */ + if (pMgntInfo->RegRfOff == true) { /* User disable RF via registry. */ RT_TRACE((COMP_INIT|COMP_RF), DBG_LOUD, ("InitializeAdapter819xUsb(): Turn off RF for RegRfOff ----------\n")); MgntActSet_RF_State(Adapter, eRfOff, RF_CHANGE_BY_SW); // Those actions will be discard in MgntActSet_RF_State because of the same state @@ -2814,15 +2809,15 @@ static bool rtl8192_adapter_start(struct net_device *dev) u8 tmpvalue; read_nic_byte(dev, 0x301, &tmpvalue); if (tmpvalue == 0x03) { - priv->bDcut = TRUE; + priv->bDcut = true; RT_TRACE(COMP_POWER_TRACKING, "D-cut\n"); } else { - priv->bDcut = FALSE; + priv->bDcut = false; RT_TRACE(COMP_POWER_TRACKING, "C-cut\n"); } dm_initialize_txpower_tracking(dev); - if (priv->bDcut == TRUE) { + if (priv->bDcut) { u32 i, TempCCk; u32 tmpRegA = rtl8192_QueryBBReg(dev, rOFDM0_XATxIQImbalance, bMaskDWord); for (i = 0; i < TxBBGainTableLength; i++) { @@ -2874,11 +2869,11 @@ static bool HalTxCheckStuck819xUsb(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); u16 RegTxCounter; - bool bStuck = FALSE; + bool bStuck = false; read_nic_word(dev, 0x128, &RegTxCounter); RT_TRACE(COMP_RESET, "%s():RegTxCounter is %d,TxCounter is %d\n", __func__, RegTxCounter, priv->TxCounter); if (priv->TxCounter == RegTxCounter) - bStuck = TRUE; + bStuck = true; priv->TxCounter = RegTxCounter; @@ -2920,7 +2915,7 @@ static bool HalRxCheckStuck819xUsb(struct net_device *dev) { u16 RegRxCounter; struct r8192_priv *priv = ieee80211_priv(dev); - bool bStuck = FALSE; + bool bStuck = false; static u8 rx_chk_cnt; read_nic_word(dev, 0x130, &RegRxCounter); RT_TRACE(COMP_RESET, "%s(): RegRxCounter is %d,RxCounter is %d\n", __func__, RegRxCounter, priv->RxCounter); @@ -2951,7 +2946,7 @@ static bool HalRxCheckStuck819xUsb(struct net_device *dev) } if (priv->RxCounter == RegRxCounter) - bStuck = TRUE; + bStuck = true; priv->RxCounter = RegRxCounter; @@ -2961,10 +2956,10 @@ static bool HalRxCheckStuck819xUsb(struct net_device *dev) static RESET_TYPE RxCheckStuck(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); - bool bRxCheck = FALSE; + bool bRxCheck = false; if (priv->IrpPendingCount > 1) - bRxCheck = TRUE; + bRxCheck = true; if (bRxCheck) { if (HalRxCheckStuck819xUsb(dev)) { @@ -3021,9 +3016,9 @@ static RESET_TYPE rtl819x_ifcheck_resetornot(struct net_device *dev) } -void rtl8192_cancel_deferred_work(struct r8192_priv *priv); -int _rtl8192_up(struct net_device *dev); -int rtl8192_close(struct net_device *dev); +static void rtl8192_cancel_deferred_work(struct r8192_priv *priv); +static int _rtl8192_up(struct net_device *dev); +static int rtl8192_close(struct net_device *dev); @@ -3642,7 +3637,7 @@ static u8 HwRateToMRate90(bool bIsHT, u8 rate) ret_rate = MGN_MCS15; break; case DESC90_RATEMCS32: - ret_rate = (0x80|0x20); + ret_rate = 0x80|0x20; break; default: @@ -4038,7 +4033,7 @@ static void rtl8192_query_rxphystatus(struct r8192_priv *priv, if (!priv->bCckHighPower) { report = pcck_buf->cck_agc_rpt & 0xc0; - report = report>>6; + report >>= 6; switch (report) { //Fixed by Jacken from Bryant 2008-03-20 //Original value is -38 , -26 , -14 , -2 @@ -4058,7 +4053,7 @@ static void rtl8192_query_rxphystatus(struct r8192_priv *priv, } } else { report = pcck_buf->cck_agc_rpt & 0x60; - report = report>>5; + report >>= 5; switch (report) { case 0x3: rx_pwr_all = -35 - ((pcck_buf->cck_agc_rpt & 0x1f)<<1); @@ -4208,7 +4203,7 @@ static void TranslateRxSignalStuff819xUsb(struct sk_buff *skb, struct net_device *dev = info->dev; struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); bool bpacket_match_bssid, bpacket_toself; - bool bPacketBeacon = FALSE, bToSelfBA = FALSE; + bool bPacketBeacon = false, bToSelfBA = false; static struct ieee80211_rx_stats previous_stats; struct ieee80211_hdr_3addr *hdr;//by amy u16 fc, type; @@ -4227,9 +4222,9 @@ static void TranslateRxSignalStuff819xUsb(struct sk_buff *skb, praddr = hdr->addr1; /* Check if the received packet is acceptable. */ - bpacket_match_bssid = ((IEEE80211_FTYPE_CTL != type) && + bpacket_match_bssid = (IEEE80211_FTYPE_CTL != type) && (eqMacAddr(priv->ieee80211->current_network.bssid, (fc & IEEE80211_FCTL_TODS) ? hdr->addr1 : (fc & IEEE80211_FCTL_FROMDS) ? hdr->addr2 : hdr->addr3)) - && (!pstats->bHwError) && (!pstats->bCRC) && (!pstats->bICV)); + && (!pstats->bHwError) && (!pstats->bCRC) && (!pstats->bICV); bpacket_toself = bpacket_match_bssid & (eqMacAddr(praddr, priv->ieee80211->dev->dev_addr)); if (WLAN_FC_GET_FRAMETYPE(fc) == IEEE80211_STYPE_BEACON) @@ -4474,13 +4469,10 @@ static void query_rxdesc_status(struct sk_buff *skb, skb_pull(skb, stats->RxBufShift + stats->RxDrvInfoSize); } - /* for debug 2008.5.29 */ - - //added by vivi, for MP, 20080108 - stats->RxIs40MHzPacket = driver_info->BW; - if (stats->RxDrvInfoSize != 0) + if (driver_info) { + stats->RxIs40MHzPacket = driver_info->BW; TranslateRxSignalStuff819xUsb(skb, stats, driver_info); - + } } static void rtl8192_rx_nomal(struct sk_buff *skb) diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index ee6b936efef2..12dd19e1159b 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -36,11 +36,12 @@ static u32 edca_setting_UL[HT_IOT_PEER_MAX] = { /*------------------------Define global variable-----------------------------*/ /* Debug variable ? */ -dig_t dm_digtable; +struct dig dm_digtable; /* Store current software write register content for MAC PHY. */ u8 dm_shadow[16][256] = { {0} }; /* For Dynamic Rx Path Selection by Signal Strength */ -DRxPathSel DM_RxPathSelTable; +struct dynamic_rx_path_sel DM_RxPathSelTable; + /*------------------------Define global variable-----------------------------*/ @@ -502,7 +503,7 @@ static u8 CCKSwingTable_Ch14[CCK_Table_length][8] = { static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); - bool bHighpowerstate, viviflag = FALSE; + bool bHighpowerstate, viviflag = false; DCMD_TXCMD_T tx_cmd; u8 powerlevelOFDM24G; int i = 0, j = 0, k = 0; @@ -558,13 +559,13 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) /* check if the report value is right */ for (k = 0; k < 5; k++) { if (tmp_report[k] <= 20) { - viviflag = TRUE; + viviflag = true; break; } } - if (viviflag == TRUE) { + if (viviflag == true) { write_nic_byte(dev, 0x1ba, 0); - viviflag = FALSE; + viviflag = false; RT_TRACE(COMP_POWER_TRACKING, "we filtered the data\n"); for (k = 0; k < 5; k++) tmp_report[k] = 0; @@ -587,7 +588,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) delta = TSSI_13dBm - Avg_TSSI_Meas_from_driver; if (delta <= E_FOR_TX_POWER_TRACK) { - priv->ieee80211->bdynamic_txpower_enable = TRUE; + priv->ieee80211->bdynamic_txpower_enable = true; write_nic_byte(dev, 0x1ba, 0); RT_TRACE(COMP_POWER_TRACKING, "tx power track is done\n"); RT_TRACE(COMP_POWER_TRACKING, "priv->rfa_txpowertrackingindex = %d\n", priv->rfa_txpowertrackingindex); @@ -624,10 +625,10 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) if (priv->cck_present_attentuation > -1 && priv->cck_present_attentuation < 23) { if (priv->ieee80211->current_network.channel == 14 && !priv->bcck_in_ch14) { - priv->bcck_in_ch14 = TRUE; + priv->bcck_in_ch14 = true; dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); } else if (priv->ieee80211->current_network.channel != 14 && priv->bcck_in_ch14) { - priv->bcck_in_ch14 = FALSE; + priv->bcck_in_ch14 = false; dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); } else dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); @@ -638,7 +639,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) RT_TRACE(COMP_POWER_TRACKING, "priv->cck_present_attentuation = %d\n", priv->cck_present_attentuation); if (priv->cck_present_attentuation_difference <= -12 || priv->cck_present_attentuation_difference >= 24) { - priv->ieee80211->bdynamic_txpower_enable = TRUE; + priv->ieee80211->bdynamic_txpower_enable = true; write_nic_byte(dev, 0x1ba, 0); RT_TRACE(COMP_POWER_TRACKING, "tx power track--->limited\n"); return; @@ -651,7 +652,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) break; } } - priv->ieee80211->bdynamic_txpower_enable = TRUE; + priv->ieee80211->bdynamic_txpower_enable = true; write_nic_byte(dev, 0x1ba, 0); } @@ -684,7 +685,7 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev) break; } } - priv->btxpower_trackingInit = TRUE; + priv->btxpower_trackingInit = true; /*pHalData->TXPowercount = 0;*/ return; } @@ -717,7 +718,7 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev) if (tmpCCK40Mindex >= CCK_Table_length) tmpCCK40Mindex = CCK_Table_length-1; } else { - tmpval = ((u8)tmpRegA - priv->ThermalMeter[0]); + tmpval = (u8)tmpRegA - priv->ThermalMeter[0]; if (tmpval >= 6) /* higher temperature */ tmpOFDMindex = tmpCCK20Mindex = 0; /* max to +6dB */ @@ -734,10 +735,10 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev) tmpCCKindex = tmpCCK20Mindex; if (priv->ieee80211->current_network.channel == 14 && !priv->bcck_in_ch14) { - priv->bcck_in_ch14 = TRUE; + priv->bcck_in_ch14 = true; CCKSwingNeedUpdate = 1; } else if (priv->ieee80211->current_network.channel != 14 && priv->bcck_in_ch14) { - priv->bcck_in_ch14 = FALSE; + priv->bcck_in_ch14 = false; CCKSwingNeedUpdate = 1; } @@ -765,7 +766,7 @@ void dm_txpower_trackingcallback(struct work_struct *work) struct r8192_priv *priv = container_of(dwork, struct r8192_priv, txpower_tracking_wq); struct net_device *dev = priv->ieee80211->dev; - if (priv->bDcut == TRUE) + if (priv->bDcut == true) dm_TXPowerTrackingCallback_TSSI(dev); else dm_TXPowerTrackingCallback_ThermalMeter(dev); @@ -1273,9 +1274,9 @@ static void dm_InitializeTXPowerTracking_TSSI(struct net_device *dev) priv->cck_txbbgain_ch14_table[22].ccktxbb_valuearray[6] = 0x00; priv->cck_txbbgain_ch14_table[22].ccktxbb_valuearray[7] = 0x00; - priv->btxpower_tracking = TRUE; + priv->btxpower_tracking = true; priv->txpower_count = 0; - priv->btxpower_trackingInit = FALSE; + priv->btxpower_trackingInit = false; } @@ -1289,18 +1290,18 @@ static void dm_InitializeTXPowerTracking_ThermalMeter(struct net_device *dev) * 3-wire by driver causes RF to go into a wrong state. */ if (priv->ieee80211->FwRWRF) - priv->btxpower_tracking = TRUE; + priv->btxpower_tracking = true; else - priv->btxpower_tracking = FALSE; + priv->btxpower_tracking = false; priv->txpower_count = 0; - priv->btxpower_trackingInit = FALSE; + priv->btxpower_trackingInit = false; } void dm_initialize_txpower_tracking(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); - if (priv->bDcut == TRUE) + if (priv->bDcut == true) dm_InitializeTXPowerTracking_TSSI(dev); else dm_InitializeTXPowerTracking_ThermalMeter(dev); @@ -1356,7 +1357,7 @@ static void dm_check_txpower_tracking(struct net_device *dev) #ifdef RTL8190P dm_CheckTXPowerTracking_TSSI(dev); #else - if (priv->bDcut == TRUE) + if (priv->bDcut == true) dm_CheckTXPowerTracking_TSSI(dev); else dm_CheckTXPowerTracking_ThermalMeter(dev); @@ -1466,7 +1467,7 @@ void dm_cck_txpower_adjust(struct net_device *dev, bool binch14) { /* dm_CCKTxPowerAdjust */ struct r8192_priv *priv = ieee80211_priv(dev); - if (priv->bDcut == TRUE) + if (priv->bDcut == true) dm_CCKTxPowerAdjust_TSSI(dev, binch14); else dm_CCKTxPowerAdjust_ThermalMeter(dev, binch14); @@ -1628,8 +1629,8 @@ void dm_change_dynamic_initgain_thresh(struct net_device *dev, u32 dm_type, dm_digtable.rssi_low_thresh = dm_value; } else if (dm_type == DIG_TYPE_THRESH_HIGHPWR_HIGH) { dm_digtable.rssi_high_power_highthresh = dm_value; - } else if (dm_type == DIG_TYPE_THRESH_HIGHPWR_HIGH) { - dm_digtable.rssi_high_power_highthresh = dm_value; + } else if (dm_type == DIG_TYPE_THRESH_HIGHPWR_LOW) { + dm_digtable.rssi_high_power_lowthresh = dm_value; } else if (dm_type == DIG_TYPE_ENABLE) { dm_digtable.dig_state = DM_STA_DIG_MAX; dm_digtable.dig_enable_flag = true; @@ -2270,10 +2271,10 @@ static void dm_check_edca_turbo( /* For Each time updating EDCA parameter, reset EDCA turbo mode status. */ dm_init_edca_turbo(dev); u1bAIFS = qos_parameters->aifs[0] * ((mode&(IEEE_G|IEEE_N_24G)) ? 9 : 20) + aSifsTime; - u4bAcParam = ((((u32)(qos_parameters->tx_op_limit[0])) << AC_PARAM_TXOP_LIMIT_OFFSET)| + u4bAcParam = (((u32)(qos_parameters->tx_op_limit[0])) << AC_PARAM_TXOP_LIMIT_OFFSET)| (((u32)(qos_parameters->cw_max[0])) << AC_PARAM_ECW_MAX_OFFSET)| (((u32)(qos_parameters->cw_min[0])) << AC_PARAM_ECW_MIN_OFFSET)| - ((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET)); + ((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET); /*write_nic_dword(dev, WDCAPARA_ADD[i], u4bAcParam);*/ write_nic_dword(dev, EDCAPARA_BE, u4bAcParam); @@ -2314,7 +2315,7 @@ static void dm_init_ctstoself(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv((struct net_device *)dev); - priv->ieee80211->bCTSToSelfEnable = TRUE; + priv->ieee80211->bCTSToSelfEnable = true; priv->ieee80211->CTSToSelfTH = CTSToSelfTHVal; } @@ -2327,7 +2328,7 @@ static void dm_ctstoself(struct net_device *dev) unsigned long curTxOkCnt = 0; unsigned long curRxOkCnt = 0; - if (priv->ieee80211->bCTSToSelfEnable != TRUE) { + if (priv->ieee80211->bCTSToSelfEnable != true) { pHTInfo->IOTAction &= ~HT_IOT_ACT_FORCED_CTS2SELF; return; } @@ -2419,9 +2420,9 @@ void dm_rf_pathcheck_workitemcallback(struct work_struct *work) /* Check Bit 0-3, it means if RF A-D is enabled. */ for (i = 0; i < RF90_PATH_MAX; i++) { if (rfpath & (0x01<<i)) - priv->brfpath_rxenable[i] = 1; + priv->brfpath_rxenable[i] = true; else - priv->brfpath_rxenable[i] = 0; + priv->brfpath_rxenable[i] = false; } if (!DM_RxPathSelTable.Enable) return; @@ -2681,10 +2682,8 @@ static void dm_init_fsync(struct net_device *dev) priv->ieee80211->fsync_seconddiff_ratethreshold = 200; priv->ieee80211->fsync_state = Default_Fsync; priv->framesyncMonitor = 1; /* current default 0xc38 monitor on */ - - init_timer(&priv->fsync_timer); - priv->fsync_timer.data = (unsigned long)dev; - priv->fsync_timer.function = dm_fsync_timer_callback; + setup_timer(&priv->fsync_timer, dm_fsync_timer_callback, + (unsigned long)dev); } static void dm_deInit_fsync(struct net_device *dev) diff --git a/drivers/staging/rtl8192u/r8192U_dm.h b/drivers/staging/rtl8192u/r8192U_dm.h index 3008f91ad4cf..6cd32eb44085 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.h +++ b/drivers/staging/rtl8192u/r8192U_dm.h @@ -67,7 +67,7 @@ /*------------------------------Define structure----------------------------*/ /* 2007/10/04 MH Define upper and lower threshold of DIG enable or disable. */ -typedef struct _dynamic_initial_gain_threshold_ { +struct dig { u8 dig_enable_flag; u8 dig_algorithm; u8 dbg_mode; @@ -98,7 +98,7 @@ typedef struct _dynamic_initial_gain_threshold_ { bool initialgain_lowerbound_state; long rssi_val; -} dig_t; +}; typedef enum tag_dynamic_init_gain_state_definition { DM_STA_DIG_OFF = 0, @@ -163,7 +163,7 @@ typedef enum tag_dig_cck_cs_ratio_state_definition { DIG_CS_RATIO_HIGHER = 1, DIG_CS_MAX } dm_dig_cs_ratio_e; -typedef struct _Dynamic_Rx_Path_Selection_ { +struct dynamic_rx_path_sel { u8 Enable; u8 DbgMode; u8 cck_method; @@ -177,7 +177,7 @@ typedef struct _Dynamic_Rx_Path_Selection_ { u8 rf_rssi[4]; u8 rf_enable_rssi_th[4]; long cck_pwdb_sta[4]; -} DRxPathSel; +}; typedef enum tag_CCK_Rx_Path_Method_Definition { CCK_Rx_Version_1 = 0, @@ -200,9 +200,9 @@ typedef struct tag_Tx_Config_Cmd_Format { /*------------------------Export global variable----------------------------*/ -extern dig_t dm_digtable; +extern struct dig dm_digtable; extern u8 dm_shadow[16][256]; -extern DRxPathSel DM_RxPathSelTable; +extern struct dynamic_rx_path_sel DM_RxPathSelTable; /*------------------------Export global variable----------------------------*/ diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c index 361d2d0c3df1..83597051a448 100644 --- a/drivers/staging/rtl8192u/r8192U_wx.c +++ b/drivers/staging/rtl8192u/r8192U_wx.c @@ -139,7 +139,7 @@ static int r8192_wx_force_reset(struct net_device *dev, down(&priv->wx_sem); - printk("%s(): force reset ! extra is %d\n", __func__, *extra); + netdev_dbg(dev, "%s(): force reset ! extra is %d\n", __func__, *extra); priv->force_reset = *extra; up(&priv->wx_sem); return 0; @@ -335,7 +335,7 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a, if (!priv->up) return -ENETDOWN; - if (priv->ieee80211->LinkDetectInfo.bBusyTraffic == true) + if (priv->ieee80211->LinkDetectInfo.bBusyTraffic) return -EAGAIN; if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { struct iw_scan_req *req = (struct iw_scan_req *)b; diff --git a/drivers/staging/rtl8192u/r8192U_wx.h b/drivers/staging/rtl8192u/r8192U_wx.h index ae7a617740a3..d6a2d9756531 100644 --- a/drivers/staging/rtl8192u/r8192U_wx.h +++ b/drivers/staging/rtl8192u/r8192U_wx.h @@ -1,20 +1,21 @@ /* - This is part of rtl8180 OpenSource driver - v 0.3 - Copyright (C) Andrea Merello 2004 <andrea.merello@gmail.com> - Released under the terms of GPL (General Public Licence) + * This is part of rtl8180 OpenSource driver - v 0.3 + * Copyright (C) Andrea Merello 2004 <andrea.merello@gmail.com> + * Released under the terms of GPL (General Public Licence) + * + * Parts of this driver are based on the GPL part of the official realtek driver + * Parts of this driver are based on the rtl8180 driver skeleton from Patric + * Schenke & Andres Salomon + * Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver + * + * We want to thank the Authors of such projects and the Ndiswrapper project + * Authors. + */ - Parts of this driver are based on the GPL part of the official realtek driver - Parts of this driver are based on the rtl8180 driver skeleton from Patric Schenke & Andres Salomon - Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver - - We want to thank the Authors of such projects and the Ndiswrapper project Authors. -*/ - -/* this file (will) contains wireless extension handlers*/ +/* this file (will) contains wireless extension handlers */ #ifndef R8180_WX_H #define R8180_WX_H -//#include <linux/wireless.h> extern struct iw_handler_def r8192_wx_handlers_def; /* Enable the rtl819x_core.c to share this function, david 2008.9.22 */ diff --git a/drivers/staging/rtl8192u/r819xU_firmware.c b/drivers/staging/rtl8192u/r819xU_firmware.c index c230be290ab6..d27b1e24ca4a 100644 --- a/drivers/staging/rtl8192u/r819xU_firmware.c +++ b/drivers/staging/rtl8192u/r819xU_firmware.c @@ -37,7 +37,6 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, bool rt_status = true; u16 frag_threshold; u16 frag_length, frag_offset = 0; - //u16 total_size; int i; rt_firmware *pfirmware = priv->pFirmware; @@ -48,7 +47,7 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, u8 index; firmware_init_param(dev); - //Fragmentation might be required + /* Fragmentation might be required */ frag_threshold = pfirmware->cmdpacket_frag_thresold; do { if ((buffer_len - frag_offset) > frag_threshold) { @@ -107,19 +106,20 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, } -//----------------------------------------------------------------------------- -// Procedure: Check whether main code is download OK. If OK, turn on CPU -// -// Description: CPU register locates in different page against general register. -// Switch to CPU register in the begin and switch back before return -// -// -// Arguments: The pointer of the adapter -// -// Returns: -// NDIS_STATUS_FAILURE - the following initialization process should be terminated -// NDIS_STATUS_SUCCESS - if firmware initialization process success -//----------------------------------------------------------------------------- +/* + * Procedure: Check whether main code is download OK. If OK, turn on CPU + * + * Description: CPU register locates in different page against general register. + * Switch to CPU register in the begin and switch back before return + * + * + * Arguments: The pointer of the adapter + * + * Returns: + * NDIS_STATUS_FAILURE - the following initialization process should + * be terminated + * NDIS_STATUS_SUCCESS - if firmware initialization process success + */ static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev) { bool rt_status = true; @@ -164,7 +164,7 @@ static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev) CPUCheckMainCodeOKAndTurnOnCPU_Fail: RT_TRACE(COMP_ERR, "ERR in %s()\n", __func__); - rt_status = FALSE; + rt_status = false; return rt_status; } @@ -201,7 +201,7 @@ CPUCheckFirmwareReady_Fail: bool init_firmware(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); - bool rt_status = TRUE; + bool rt_status = true; u32 file_length = 0; u8 *mapped_file = NULL; @@ -222,7 +222,7 @@ bool init_firmware(struct net_device *dev) /* it is called by reset */ rst_opt = OPT_SYSTEM_RESET; starting_state = FW_INIT_STEP0_BOOT; - // TODO: system reset + /* TODO: system reset */ } else if (pfirmware->firmware_status == FW_STATUS_5_READY) { /* it is called by Initialize */ @@ -281,7 +281,7 @@ bool init_firmware(struct net_device *dev) if (rst_opt == OPT_SYSTEM_RESET) release_firmware(fw_entry); - if (rt_status != TRUE) + if (!rt_status) goto download_firmware_fail; switch (init_step) { @@ -291,7 +291,7 @@ bool init_firmware(struct net_device *dev) * will set polling bit when firmware code is also configured */ pfirmware->firmware_status = FW_STATUS_1_MOVE_BOOT_CODE; - //mdelay(1000); + /* mdelay(1000); */ /* * To initialize IMEM, CPU move code from 0x80000080, * hence, we send 0x80 byte packet @@ -304,7 +304,7 @@ bool init_firmware(struct net_device *dev) /* Check Put Code OK and Turn On CPU */ rt_status = CPUcheck_maincodeok_turnonCPU(dev); - if (rt_status != TRUE) { + if (!rt_status) { RT_TRACE(COMP_ERR, "CPUcheck_maincodeok_turnonCPU fail!\n"); goto download_firmware_fail; } @@ -318,7 +318,7 @@ bool init_firmware(struct net_device *dev) mdelay(1); rt_status = CPUcheck_firmware_ready(dev); - if (rt_status != TRUE) { + if (!rt_status) { RT_TRACE(COMP_ERR, "CPUcheck_firmware_ready fail(%d)!\n",rt_status); goto download_firmware_fail; } @@ -330,13 +330,11 @@ bool init_firmware(struct net_device *dev) } RT_TRACE(COMP_FIRMWARE, "Firmware Download Success\n"); - //assert(pfirmware->firmware_status == FW_STATUS_5_READY, ("Firmware Download Fail\n")); - return rt_status; download_firmware_fail: RT_TRACE(COMP_ERR, "ERR in %s()\n", __func__); - rt_status = FALSE; + rt_status = false; return rt_status; } diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c index 058960251bac..e5dbaca9e518 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.c +++ b/drivers/staging/rtl8192u/r819xU_phy.c @@ -106,10 +106,10 @@ void rtl8192_setBBreg(struct net_device *dev, u32 reg_addr, u32 bitmask, /****************************************************************************** * function: This function reads specific bits from BB register * input: net_device *dev - * u32 reg_addr //target addr to be readback - * u32 bitmask //taget bit pos to be readback + * u32 reg_addr //target addr to be readback + * u32 bitmask //taget bit pos to be readback * output: none - * return: u32 data //the readback register value + * return: u32 data //the readback register value * notice: ******************************************************************************/ u32 rtl8192_QueryBBReg(struct net_device *dev, u32 reg_addr, u32 bitmask) @@ -352,16 +352,14 @@ u32 rtl8192_phy_QueryRFReg(struct net_device *dev, RF90_RADIO_PATH_E eRFPath, return 0; if (priv->Rf_Mode == RF_OP_By_FW) { reg = phy_FwRFSerialRead(dev, eRFPath, reg_addr); - bitshift = rtl8192_CalculateBitShift(bitmask); - reg = (reg & bitmask) >> bitshift; udelay(200); - return reg; } else { reg = rtl8192_phy_RFSerialRead(dev, eRFPath, reg_addr); - bitshift = rtl8192_CalculateBitShift(bitmask); - reg = (reg & bitmask) >> bitshift; - return reg; } + bitshift = rtl8192_CalculateBitShift(bitmask); + reg = (reg & bitmask) >> bitshift; + return reg; + } /****************************************************************************** @@ -478,7 +476,7 @@ static void phy_FwRFSerialWrite(struct net_device *dev, /****************************************************************************** * function: This function reads BB parameters from header file we generate, * and do register read/write - * input: net_device *dev + * input: net_device *dev * output: none * return: none * notice: BB parameters may change all the time, so please make @@ -825,8 +823,8 @@ static void rtl8192_BB_Config_ParaFile(struct net_device *dev) write_nic_byte_E(dev, 0x5e, 0x00); if (priv->card_8192_version == (u8)VERSION_819xU_A) { /* Antenna gain offset from B/C/D to A */ - reg_u32 = (priv->AntennaTxPwDiff[1]<<4 | - priv->AntennaTxPwDiff[0]); + reg_u32 = priv->AntennaTxPwDiff[1]<<4 | + priv->AntennaTxPwDiff[0]; rtl8192_setBBreg(dev, rFPGA0_TxGainStage, (bXBTxAGC|bXCTxAGC), reg_u32); @@ -900,7 +898,7 @@ void rtl8192_phy_getTxPower(struct net_device *dev) read_nic_byte(dev, rOFDM0_RxDetector3, &priv->framesync); read_nic_byte(dev, rOFDM0_RxDetector2, &tmp); priv->framesyncC34 = tmp; - RT_TRACE(COMP_INIT, "Default framesync (0x%x) = 0x%x \n", + RT_TRACE(COMP_INIT, "Default framesync (0x%x) = 0x%x\n", rOFDM0_RxDetector3, priv->framesync); /* Read SIFS (save the value read fome MACPHY_REG.txt) */ @@ -1101,7 +1099,7 @@ bool rtl8192_SetRFPowerState(struct net_device *dev, if (eRFPowerState == priv->ieee80211->eRFPowerState) return false; - if (priv->SetRFPowerStateInProgress == true) + if (priv->SetRFPowerStateInProgress) return false; priv->SetRFPowerStateInProgress = true; @@ -1187,7 +1185,7 @@ bool rtl8192_SetRFPowerState(struct net_device *dev, /* Turn on RF we are still linked, which might happen when we quickly turn off and on HW RF. */ - if (pMgntInfo->bMediaConnect == TRUE) + if (pMgntInfo->bMediaConnect) Adapter->HalFunc.LedControlHandler(Adapter, LED_CTL_LINK); else /* Turn off LED if RF is not ON. */ @@ -1344,7 +1342,6 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel, default: RT_TRACE(COMP_ERR, "Unknown RFChipID: %d\n", priv->rf_chip); return true; - break; } @@ -1365,11 +1362,10 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel, if ((*stage) == 2) { (*delay) = CurrentCmd->msDelay; return true; - } else { - (*stage)++; - (*step) = 0; - continue; } + (*stage)++; + (*step) = 0; + continue; } switch (CurrentCmd->CmdID) { @@ -1579,10 +1575,10 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev) priv->cck_present_attentuation); if (priv->chan == 14 && !priv->bcck_in_ch14) { - priv->bcck_in_ch14 = TRUE; + priv->bcck_in_ch14 = true; dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); } else if (priv->chan != 14 && priv->bcck_in_ch14) { - priv->bcck_in_ch14 = FALSE; + priv->bcck_in_ch14 = false; dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); } else { dm_cck_txpower_adjust(dev, priv->bcck_in_ch14); @@ -1746,13 +1742,13 @@ void InitialGainOperateWorkItemCallBack(struct work_struct *work) RT_TRACE(COMP_SCAN, "Scan InitialGainBackup 0xa0a is %x\n", priv->initgain_backup.cca); - RT_TRACE(COMP_SCAN, "Write scan initial gain = 0x%x \n", + RT_TRACE(COMP_SCAN, "Write scan initial gain = 0x%x\n", initial_gain); write_nic_byte(dev, rOFDM0_XAAGCCore1, initial_gain); write_nic_byte(dev, rOFDM0_XBAGCCore1, initial_gain); write_nic_byte(dev, rOFDM0_XCAGCCore1, initial_gain); write_nic_byte(dev, rOFDM0_XDAGCCore1, initial_gain); - RT_TRACE(COMP_SCAN, "Write scan 0xa0a = 0x%x \n", + RT_TRACE(COMP_SCAN, "Write scan 0xa0a = 0x%x\n", POWER_DETECTION_TH); write_nic_byte(dev, 0xa0a, POWER_DETECTION_TH); break; @@ -1793,7 +1789,7 @@ void InitialGainOperateWorkItemCallBack(struct work_struct *work) rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); break; default: - RT_TRACE(COMP_SCAN, "Unknown IG Operation. \n"); + RT_TRACE(COMP_SCAN, "Unknown IG Operation.\n"); break; } } |