diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-22 12:14:01 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-22 12:14:01 -0800 |
commit | caa59428971d5ad81d19512365c9ba580d83268c (patch) | |
tree | cd9615719bad9a97f02bb5bc1021396a1b484762 /drivers/staging/rtl8192u | |
parent | b2064617c74f301dab1448f1f9c8dbb3c8021058 (diff) | |
parent | 0a441275018b69deffd35bc22a84fd51c54d7d85 (diff) | |
download | op-kernel-dev-caa59428971d5ad81d19512365c9ba580d83268c.zip op-kernel-dev-caa59428971d5ad81d19512365c9ba580d83268c.tar.gz |
Merge tag 'staging-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging/iio driver updates from Greg KH:
"Here is the big staging and iio driver patchsets for 4.11-rc1.
We almost broke even this time around, with only a few thousand lines
added overall, as we removed the old and obsolete i4l code, but added
some new drivers for the RPi platform, as well as adding some new IIO
drivers.
All of these have been in linux-next for a while with no reported
issues"
* tag 'staging-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (669 commits)
Staging: vc04_services: Fix the "space prohibited" code style errors
Staging: vc04_services: Fix the "wrong indent" code style errors
staging: octeon: Use net_device_stats from struct net_device
Staging: rtl8192u: ieee80211: ieee80211.h - style fix
Staging: rtl8192u: ieee80211: ieee80211_tx.c - style fix
Staging: rtl8192u: ieee80211: rtl819x_BAProc.c - style fix
Staging: rtl8192u: ieee80211: ieee80211_module.c - style fix
Staging: rtl8192u: ieee80211: rtl819x_TSProc.c - style fix
Staging: rtl8192u: r8192U.h - style fix
Staging: rtl8192u: r8192U_core.c - style fix
Staging: rtl8192u: r819xU_cmdpkt.c - style fix
staging: rtl8192u: blank lines aren't necessary before a close brace '}'
staging: rtl8192u: Adding space after enum and struct definition
staging: rtl8192u: Adding space after struct definition
Staging: ks7010: Add required and preferred spaces around operators
Staging: ks7010: ks*: Remove redundant blank lines
Staging: ks7010: ks*: Add missing blank lines after declarations
staging: visorbus, replace init_timer with setup_timer
staging: vt6656: rxtx.c Removed multiple dereferencing
staging: vt6656: Alignment match open parenthesis
...
Diffstat (limited to 'drivers/staging/rtl8192u')
27 files changed, 610 insertions, 606 deletions
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h index 077ea13..0d24705 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h @@ -83,7 +83,7 @@ #define SUPPORT_CKIP_PK 0x10 // bit4 /* defined for skb cb field */ /* At most 28 byte */ -typedef struct cb_desc { +struct cb_desc { /* Tx Desc Related flags (8-9) */ u8 bLastIniPkt:1; u8 bCmdOrInit:1; @@ -139,7 +139,7 @@ typedef struct cb_desc { u8 DrvAggrNum; u16 pkt_size; u8 reserved12; -}cb_desc, *pcb_desc; +}; /*--------------------------Define -------------------------------------------*/ #define MGN_1M 0x02 @@ -329,12 +329,13 @@ typedef struct ieee_param { // linux under 2.6.9 release may not support it, so modify it for common use #define IEEE80211_DATA_LEN 2304 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section - 6.2.1.1.2. - - The figure in section 7.1.2 suggests a body size of up to 2312 - bytes is allowed, which is a bit confusing, I suspect this - represents the 2304 bytes of real data, plus a possible 8 bytes of - WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */ + * 6.2.1.1.2. + * + * The figure in section 7.1.2 suggests a body size of up to 2312 + * bytes is allowed, which is a bit confusing, I suspect this + * represents the 2304 bytes of real data, plus a possible 8 bytes of + * WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) + */ #define IEEE80211_1ADDR_LEN 10 #define IEEE80211_2ADDR_LEN 16 #define IEEE80211_3ADDR_LEN 24 @@ -685,7 +686,8 @@ struct ieee_ibss_seq { /* NOTE: This data is for statistical purposes; not all hardware provides this * information for frames received. Not setting these will not cause - * any adverse affects. */ + * any adverse affects. + */ struct ieee80211_rx_stats { u32 mac_time[2]; s8 rssi; @@ -754,7 +756,8 @@ struct ieee80211_rx_stats { /* IEEE 802.11 requires that STA supports concurrent reception of at least * three fragmented frames. This define can be increased to support more * concurrent frames, but it should be noted that each entry can consume about - * 2 kB of RAM and increasing cache size will slow down frame reassembly. */ + * 2 kB of RAM and increasing cache size will slow down frame reassembly. + */ #define IEEE80211_FRAG_CACHE_LEN 4 struct ieee80211_frag_entry { @@ -836,15 +839,15 @@ struct ieee80211_security { /* - 802.11 data frame from AP - ,-------------------------------------------------------------------. -Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | - |------|------|---------|---------|---------|------|---------|------| -Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs | - | | tion | (BSSID) | | | ence | data | | - `-------------------------------------------------------------------' -Total: 28-2340 bytes -*/ + * 802.11 data frame from AP + * ,-------------------------------------------------------------------. + * Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | + * |------|------|---------|---------|---------|------|---------|------| + * Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs | + * | | tion | (BSSID) | | | ence | data | | + * `-------------------------------------------------------------------' + * Total: 28-2340 bytes + */ /* Management Frame Information Element Types */ enum ieee80211_mfie { @@ -882,7 +885,8 @@ enum ieee80211_mfie { /* Minimal header; can be used for passing 802.11 frames with sufficient * information to determine what type of underlying data type is actually - * stored in the data. */ + * stored in the data. + */ struct rtl_80211_hdr { __le16 frame_ctl; __le16 duration_id; @@ -980,7 +984,8 @@ struct ieee80211_probe_response { __le16 beacon_interval; __le16 capability; /* SSID, supported rates, FH params, DS params, - * CF params, IBSS params, TIM (if beacon), RSN */ + * CF params, IBSS params, TIM (if beacon), RSN + */ struct ieee80211_info_element info_element[0]; } __packed; @@ -1055,7 +1060,8 @@ typedef union _frameqos { /* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs * only use 8, and then use extended rates for the remaining supported * rates. Other APs, however, stick all of their supported rates on the - * main rates information element... */ + * main rates information element... + */ #define MAX_RATES_LENGTH ((u8)12) #define MAX_RATES_EX_LENGTH ((u8)16) #define MAX_NETWORK_COUNT 128 @@ -1677,14 +1683,16 @@ struct ieee80211_device { spinlock_t wpax_suitlist_lock; int tx_headroom; /* Set to size of any additional room needed at front - * of allocated Tx SKBs */ + * of allocated Tx SKBs + */ u32 config; /* WEP and other encryption related settings at the device level */ int open_wep; /* Set to 1 to allow unencrypted frames */ int auth_mode; int reset_on_keychange; /* Set to 1 if the HW needs to be reset on - * WEP key changes */ + * WEP key changes + */ /* If the host performs {en,de}cryption, then set to 1 */ int host_encrypt; @@ -1719,7 +1727,8 @@ struct ieee80211_device { int crypt_quiesced; int bcrx_sta_key; /* use individual keys to override default keys even - * with RX of broad/multicast frames */ + * with RX of broad/multicast frames + */ /* Fragmentation structures */ // each streaming contain a entry @@ -1894,6 +1903,7 @@ struct ieee80211_device { //u32 STA_EDCA_PARAM[4]; //CHANNEL_ACCESS_SETTING ChannelAccessSetting; + struct ieee80211_rxb *stats_IndicateArray[REORDER_WIN_SIZE]; /* Callback functions */ void (*set_security)(struct net_device *dev, @@ -2003,7 +2013,8 @@ struct ieee80211_device { void (*InitialGainHandler)(struct net_device *dev, u8 Operation); /* This must be the last item so that it points to the data - * allocated beyond this structure by alloc_ieee80211 */ + * allocated beyond this structure by alloc_ieee80211 + */ u8 priv[0]; }; @@ -2032,7 +2043,8 @@ struct ieee80211_device { /* The ieee802.11 stack will manages the netif queue * wake/stop for the driver, taking care of 802.11 - * fragmentation. See softmac.c for details. */ + * fragmentation. See softmac.c for details. + */ #define IEEE_SOFTMAC_TX_QUEUE (1<<7) /* Uses only the softmac_data_hard_start_xmit @@ -2255,7 +2267,6 @@ void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee); /* ieee80211_crypt_ccmp&tkip&wep.c */ void ieee80211_tkip_null(void); -void ieee80211_ccmp_null(void); int ieee80211_crypto_init(void); void ieee80211_crypto_deinit(void); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c index 9cf90d0..48e80be 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c @@ -80,7 +80,7 @@ void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, struct ieee80211_crypt_data *tmp; unsigned long flags; - if (*crypt == NULL) + if (!(*crypt)) return; tmp = *crypt; @@ -88,7 +88,8 @@ void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, /* must not run ops->deinit() while there may be pending encrypt or * decrypt operations. Use a list of delayed deinits to avoid needing - * locking. */ + * locking. + */ spin_lock_irqsave(&ieee->lock, flags); list_add(&tmp->list, &ieee->crypt_deinit_list); @@ -104,11 +105,11 @@ int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops) unsigned long flags; struct ieee80211_crypto_alg *alg; - if (hcrypt == NULL) + if (!hcrypt) return -1; alg = kzalloc(sizeof(*alg), GFP_KERNEL); - if (alg == NULL) + if (!alg) return -ENOMEM; alg->ops = ops; @@ -129,13 +130,13 @@ int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops) struct list_head *ptr; struct ieee80211_crypto_alg *del_alg = NULL; - if (hcrypt == NULL) + if (!hcrypt) return -1; spin_lock_irqsave(&hcrypt->lock, flags); for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) { struct ieee80211_crypto_alg *alg = - (struct ieee80211_crypto_alg *) ptr; + (struct ieee80211_crypto_alg *)ptr; if (alg->ops == ops) { list_del(&alg->list); del_alg = alg; @@ -160,13 +161,13 @@ struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name) struct list_head *ptr; struct ieee80211_crypto_alg *found_alg = NULL; - if (hcrypt == NULL) + if (!hcrypt) return NULL; spin_lock_irqsave(&hcrypt->lock, flags); for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) { struct ieee80211_crypto_alg *alg = - (struct ieee80211_crypto_alg *) ptr; + (struct ieee80211_crypto_alg *)ptr; if (strcmp(alg->ops->name, name) == 0) { found_alg = alg; break; @@ -222,13 +223,13 @@ void __exit ieee80211_crypto_deinit(void) { struct list_head *ptr, *n; - if (hcrypt == NULL) + if (!hcrypt) return; for (ptr = hcrypt->algs.next, n = ptr->next; ptr != &hcrypt->algs; ptr = n, n = ptr->next) { struct ieee80211_crypto_alg *alg = - (struct ieee80211_crypto_alg *) ptr; + (struct ieee80211_crypto_alg *)ptr; list_del(ptr); pr_debug("ieee80211_crypt: unregistered algorithm '%s' (deinit)\n", alg->ops->name); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h index 0b4ea43..005bf89 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h @@ -30,7 +30,8 @@ struct ieee80211_crypto_ops { /* init new crypto context (e.g., allocate private data space, * select IV, etc.); returns NULL on failure or pointer to allocated - * private data on success */ + * private data on success + */ void * (*init)(int keyidx); /* deinitialize crypto context and free allocated private data */ @@ -46,7 +47,8 @@ struct ieee80211_crypto_ops { int (*decrypt_mpdu)(struct sk_buff *skb, int hdr_len, void *priv); /* These functions are called for full MSDUs, i.e. full frames. - * These can be NULL if full MSDU operations are not needed. */ + * These can be NULL if full MSDU operations are not needed. + */ int (*encrypt_msdu)(struct sk_buff *skb, int hdr_len, void *priv); int (*decrypt_msdu)(struct sk_buff *skb, int keyidx, int hdr_len, void *priv); @@ -55,14 +57,16 @@ struct ieee80211_crypto_ops { int (*get_key)(void *key, int len, u8 *seq, void *priv); /* procfs handler for printing out key information and possible - * statistics */ + * statistics + */ char * (*print_stats)(char *p, void *priv); /* maximum number of bytes added by encryption; encrypt buf is * allocated with extra_prefix_len bytes, copy of in_buf, and * extra_postfix_len; encrypt need not use all this space, but * the result must start at the beginning of the buffer and correct - * length must be returned */ + * length must be returned + */ int extra_prefix_len, extra_postfix_len; struct module *owner; diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c index 2dc25cc..e6648f7 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c @@ -67,7 +67,7 @@ static void *ieee80211_ccmp_init(int key_idx) struct ieee80211_ccmp_data *priv; priv = kzalloc(sizeof(*priv), GFP_ATOMIC); - if (priv == NULL) + if (!priv) goto fail; priv->key_idx = key_idx; @@ -90,7 +90,6 @@ fail: return NULL; } - static void ieee80211_ccmp_deinit(void *priv) { struct ieee80211_ccmp_data *_priv = priv; @@ -100,7 +99,6 @@ static void ieee80211_ccmp_deinit(void *priv) kfree(priv); } - static inline void xor_block(u8 *b, u8 *a, size_t len) { int i; @@ -109,8 +107,6 @@ static inline void xor_block(u8 *b, u8 *a, size_t len) b[i] ^= a[i]; } - - static void ccmp_init_blocks(struct crypto_tfm *tfm, struct rtl_80211_hdr_4addr *hdr, u8 *pn, size_t dlen, u8 *b0, u8 *auth, @@ -135,7 +131,7 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, if (a4_included) aad_len += 6; if (qc_included) { - pos = (u8 *) &hdr->addr4; + pos = (u8 *)&hdr->addr4; if (a4_included) pos += 6; qc = *pos & 0x0f; @@ -161,13 +157,13 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, * A4 (if present) * QC (if present) */ - pos = (u8 *) hdr; + pos = (u8 *)hdr; aad[0] = 0; /* aad_len >> 8 */ aad[1] = aad_len & 0xff; aad[2] = pos[0] & 0x8f; aad[3] = pos[1] & 0xc7; memcpy(aad + 4, hdr->addr1, 3 * ETH_ALEN); - pos = (u8 *) &hdr->seq_ctl; + pos = (u8 *)&hdr->seq_ctl; aad[22] = pos[0] & 0x0f; aad[23] = 0; /* all bits masked */ memset(aad + 24, 0, 8); @@ -185,19 +181,18 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN); ieee80211_ccmp_aes_encrypt(tfm, auth, auth); b0[0] &= 0x07; - b0[14] = b0[15] = 0; + b0[14] = 0; + b0[15] = 0; ieee80211_ccmp_aes_encrypt(tfm, b0, s0); } - - static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) { struct ieee80211_ccmp_data *key = priv; int data_len, i; u8 *pos; struct rtl_80211_hdr_4addr *hdr; - cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); if (skb_headroom(skb) < CCMP_HDR_LEN || skb_tailroom(skb) < CCMP_MIC_LEN || @@ -227,8 +222,7 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) *pos++ = key->tx_pn[1]; *pos++ = key->tx_pn[0]; - - hdr = (struct rtl_80211_hdr_4addr *) skb->data; + hdr = (struct rtl_80211_hdr_4addr *)skb->data; if (!tcb_desc->bHwSec) { int blocks, last, len; u8 *mic; @@ -264,13 +258,12 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) return 0; } - static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) { struct ieee80211_ccmp_data *key = priv; u8 keyidx, *pos; struct rtl_80211_hdr_4addr *hdr; - cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); u8 pn[6]; if (skb->len < hdr_len + CCMP_HDR_LEN + CCMP_MIC_LEN) { @@ -278,7 +271,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) return -1; } - hdr = (struct rtl_80211_hdr_4addr *) skb->data; + hdr = (struct rtl_80211_hdr_4addr *)skb->data; pos = skb->data + hdr_len; keyidx = pos[3]; if (!(keyidx & (1 << 5))) { @@ -327,7 +320,6 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) u8 *a = key->rx_a; int i, blocks, last, len; - ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b); xor_block(mic, b, CCMP_MIC_LEN); @@ -366,7 +358,6 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) return keyidx; } - static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv) { struct ieee80211_ccmp_data *data = priv; @@ -389,15 +380,15 @@ static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv) data->rx_pn[5] = seq[0]; } crypto_cipher_setkey((void *)data->tfm, data->key, CCMP_TK_LEN); - } else if (len == 0) + } else if (len == 0) { data->key_set = 0; - else + } else { return -1; + } return 0; } - static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv) { struct ieee80211_ccmp_data *data = priv; @@ -421,7 +412,6 @@ static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv) return CCMP_TK_LEN; } - static char *ieee80211_ccmp_print_stats(char *p, void *priv) { struct ieee80211_ccmp_data *ccmp = priv; @@ -436,12 +426,6 @@ static char *ieee80211_ccmp_print_stats(char *p, void *priv) return p; } -void ieee80211_ccmp_null(void) -{ - /* printk("============>%s()\n", __func__); */ - return; -} - static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = { .name = "CCMP", .init = ieee80211_ccmp_init, diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c index e688508..2453413 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c @@ -304,7 +304,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) int len; u8 *pos; struct rtl_80211_hdr_4addr *hdr; - cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); int ret = 0; u8 rc4key[16], *icv; u32 crc; @@ -387,7 +387,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) u32 iv32; u16 iv16; struct rtl_80211_hdr_4addr *hdr; - cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); u8 rc4key[16]; u8 icv[4]; u32 crc; diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c index 1999bc5..0e8c876 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c @@ -88,7 +88,7 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) u32 klen, len; u8 key[WEP_KEY_LEN + 3]; u8 *pos; - cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); u32 crc; u8 *icv; struct scatterlist sg; @@ -109,7 +109,8 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) /* Fluhrer, Mantin, and Shamir have reported weaknesses in the key * scheduling algorithm of RC4. At least IVs (KeyByte + 3, 0xff, N) - * can be used to speedup attacks, so avoid using them. */ + * can be used to speedup attacks, so avoid using them. + */ if ((wep->iv & 0xff00) == 0xff00) { u8 B = (wep->iv >> 16) & 0xff; @@ -166,7 +167,7 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) u32 klen, plen; u8 key[WEP_KEY_LEN + 3]; u8 keyidx, *pos; - cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); u32 crc; u8 icv[4]; struct scatterlist sg; diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c index 30fff6c..5fdfff0 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c @@ -1,34 +1,34 @@ /******************************************************************************* - - Copyright(c) 2004 Intel Corporation. All rights reserved. - - Portions of this file are based on the WEP enablement code provided by the - Host AP project hostap-drivers v0.1.3 - Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen - <jkmaline@cc.hut.fi> - Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> - - This program is free software; you can redistribute it and/or modify it - under the terms of version 2 of the GNU General Public License as - published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 - Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - The full GNU General Public License is included in this distribution in the - file called LICENSE. - - Contact Information: - James P. Ketrenos <ipw2100-admin@linux.intel.com> - Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - -*******************************************************************************/ + * + * Copyright(c) 2004 Intel Corporation. All rights reserved. + * + * Portions of this file are based on the WEP enablement code provided by the + * Host AP project hostap-drivers v0.1.3 + * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen + * <jkmaline@cc.hut.fi> + * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The full GNU General Public License is included in this distribution in the + * file called LICENSE. + * + * Contact Information: + * James P. Ketrenos <ipw2100-admin@linux.intel.com> + * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 + * + *******************************************************************************/ #include <linux/compiler.h> /* #include <linux/config.h> */ @@ -141,8 +141,8 @@ struct net_device *alloc_ieee80211(int sizeof_priv) spin_lock_init(&ieee->bw_spinlock); spin_lock_init(&ieee->reorder_spinlock); /* added by WB */ - atomic_set(&(ieee->atm_chnlop), 0); - atomic_set(&(ieee->atm_swbw), 0); + atomic_set(&ieee->atm_chnlop, 0); + atomic_set(&ieee->atm_swbw, 0); ieee->wpax_type_set = 0; ieee->wpa_enabled = 0; @@ -177,7 +177,6 @@ struct net_device *alloc_ieee80211(int sizeof_priv) /* These function were added to load crypte module autoly */ ieee80211_tkip_null(); - ieee80211_ccmp_null(); return dev; diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index b1f2fdf..5241c50 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -345,7 +345,7 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb, return 0; if (ieee->hwsec_active) { - cb_desc *tcb_desc = (cb_desc *)(skb->cb+ MAX_DEV_ADDR_SIZE); + struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb+ MAX_DEV_ADDR_SIZE); tcb_desc->bHwSec = 1; } hdr = (struct rtl_80211_hdr_4addr *) skb->data; @@ -392,7 +392,7 @@ ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee, struct sk_buff *s return 0; if (ieee->hwsec_active) { - cb_desc *tcb_desc = (cb_desc *)(skb->cb+ MAX_DEV_ADDR_SIZE); + struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb+ MAX_DEV_ADDR_SIZE); tcb_desc->bHwSec = 1; } diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index d7d85b3..1bff0e9 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -146,6 +146,7 @@ static void ieee80211_TURBO_Info(struct ieee80211_device *ieee, u8 **tag_p) static void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb) { int nh; + nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM; /* @@ -225,7 +226,8 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee struct rtl_80211_hdr_3addr *header= (struct rtl_80211_hdr_3addr *) skb->data; - cb_desc *tcb_desc = (cb_desc *)(skb->cb + 8); + struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + 8); + spin_lock_irqsave(&ieee->lock, flags); /* called with 2nd param 0, no mgmt lock required */ @@ -364,6 +366,7 @@ struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee); static void ieee80211_send_beacon(struct ieee80211_device *ieee) { struct sk_buff *skb; + if(!ieee->ieee_up) return; //unsigned long flags; @@ -427,6 +430,7 @@ void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee) { short ch = 0; u8 channel_map[MAX_CHANNEL_NUMBER+1]; + memcpy(channel_map, GET_DOT11D_INFO(ieee)->channel_map, MAX_CHANNEL_NUMBER+1); mutex_lock(&ieee->scan_mutex); @@ -493,6 +497,7 @@ static void ieee80211_softmac_scan_wq(struct work_struct *work) struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq); static short watchdog; u8 channel_map[MAX_CHANNEL_NUMBER+1]; + memcpy(channel_map, GET_DOT11D_INFO(ieee)->channel_map, MAX_CHANNEL_NUMBER+1); if(!ieee->ieee_up) return; @@ -2142,7 +2147,7 @@ void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device * unsigned int queue_index = txb->queue_index; unsigned long flags; int i; - cb_desc *tcb_desc = NULL; + struct cb_desc *tcb_desc = NULL; spin_lock_irqsave(&ieee->lock, flags); @@ -2152,7 +2157,7 @@ void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device * /* update the tx status */ ieee->stats.tx_bytes += le16_to_cpu(txb->payload_size); ieee->stats.tx_packets++; - tcb_desc = (cb_desc *)(txb->fragments[0]->cb + MAX_DEV_ADDR_SIZE); + tcb_desc = (struct cb_desc *)(txb->fragments[0]->cb + MAX_DEV_ADDR_SIZE); if (tcb_desc->bMulticast) { ieee->stats.multicast++; } @@ -2623,6 +2628,7 @@ void ieee80211_start_protocol(struct ieee80211_device *ieee) { short ch = 0; int i = 0; + if (ieee->proto_started) return; @@ -2766,7 +2772,7 @@ static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value) { /* This is called when wpa_supplicant loads and closes the driver * interface. */ - printk("%s WPA\n",value ? "enabling" : "disabling"); + printk("%s WPA\n", value ? "enabling" : "disabling"); ieee->wpa_enabled = value; return 0; } @@ -2869,7 +2875,7 @@ static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value) static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value) { - int ret=0; + int ret = 0; unsigned long flags; switch (name) { @@ -2878,7 +2884,7 @@ static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 v break; case IEEE_PARAM_TKIP_COUNTERMEASURES: - ieee->tkip_countermeasures=value; + ieee->tkip_countermeasures = value; break; case IEEE_PARAM_DROP_UNENCRYPTED: { @@ -2915,7 +2921,7 @@ static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 v } case IEEE_PARAM_PRIVACY_INVOKED: - ieee->privacy_invoked=value; + ieee->privacy_invoked = value; break; case IEEE_PARAM_AUTH_ALGS: @@ -2923,7 +2929,7 @@ static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 v break; case IEEE_PARAM_IEEE_802_1X: - ieee->ieee802_1x=value; + ieee->ieee802_1x = value; break; case IEEE_PARAM_WPAX_SELECT: // added for WPA2 mixed mode @@ -2934,7 +2940,7 @@ static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 v break; default: - printk("Unknown WPA param: %d\n",name); + printk("Unknown WPA param: %d\n", name); ret = -EOPNOTSUPP; } @@ -3056,23 +3062,21 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee, } else sec.flags &= ~SEC_ACTIVE_KEY; - if (param->u.crypt.alg != NULL) { - memcpy(sec.keys[param->u.crypt.idx], - param->u.crypt.key, - param->u.crypt.key_len); - sec.key_sizes[param->u.crypt.idx] = param->u.crypt.key_len; - sec.flags |= (1 << param->u.crypt.idx); - - if (strcmp(param->u.crypt.alg, "WEP") == 0) { - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_1; - } else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_2; - } else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_3; - } + memcpy(sec.keys[param->u.crypt.idx], + param->u.crypt.key, + param->u.crypt.key_len); + sec.key_sizes[param->u.crypt.idx] = param->u.crypt.key_len; + sec.flags |= (1 << param->u.crypt.idx); + + if (strcmp(param->u.crypt.alg, "WEP") == 0) { + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_1; + } else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_2; + } else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_3; } done: if (ieee->set_security) @@ -3107,7 +3111,7 @@ static inline struct sk_buff *ieee80211_disassociate_skb( if (!skb) return NULL; - disass = (struct ieee80211_disassoc *) skb_put(skb,sizeof(struct ieee80211_disassoc)); + disass = (struct ieee80211_disassoc *) skb_put(skb, sizeof(struct ieee80211_disassoc)); disass->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_DISASSOC); disass->header.duration_id = 0; @@ -3129,7 +3133,8 @@ SendDisassociation( { struct ieee80211_network *beacon = &ieee->current_network; struct sk_buff *skb; - skb = ieee80211_disassociate_skb(beacon,ieee,asRsn); + + skb = ieee80211_disassociate_skb(beacon, ieee, asRsn); if (skb) { softmac_mgmt_xmit(skb, ieee); //dev_kfree_skb_any(skb);//edit by thomas @@ -3140,7 +3145,7 @@ EXPORT_SYMBOL(SendDisassociation); int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p) { struct ieee_param *param; - int ret=0; + int ret = 0; mutex_lock(&ieee->wx_mutex); //IEEE_DEBUG_INFO("wpa_supplicant: len=%d\n", p->length); @@ -3196,6 +3201,7 @@ EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl); void notify_wx_assoc_event(struct ieee80211_device *ieee) { union iwreq_data wrqu; + wrqu.ap_addr.sa_family = ARPHRD_ETHER; if (ieee->state == IEEE80211_LINKED) memcpy(wrqu.ap_addr.sa_data, ieee->current_network.bssid, ETH_ALEN); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c index 1ab0aea..5704e4d 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c @@ -1,35 +1,34 @@ /****************************************************************************** - - Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved. - - This program is free software; you can redistribute it and/or modify it - under the terms of version 2 of the GNU General Public License as - published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 - Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - The full GNU General Public License is included in this distribution in the - file called LICENSE. - - Contact Information: - James P. Ketrenos <ipw2100-admin@linux.intel.com> - Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - -****************************************************************************** - - Few modifications for Realtek's Wi-Fi drivers by - Andrea Merello <andrea.merello@gmail.com> - - A special thanks goes to Realtek for their support ! - -******************************************************************************/ + * + * Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The full GNU General Public License is included in this distribution in the + * file called LICENSE. + * + * Contact Information: + * James P. Ketrenos <ipw2100-admin@linux.intel.com> + * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 + * + * + * Few modifications for Realtek's Wi-Fi drivers by + * Andrea Merello <andrea.merello@gmail.com> + * + * A special thanks goes to Realtek for their support ! + * + ******************************************************************************/ #include <linux/compiler.h> #include <linux/errno.h> @@ -55,101 +54,101 @@ /* - - -802.11 Data Frame - - -802.11 frame_contorl for data frames - 2 bytes - ,-----------------------------------------------------------------------------------------. -bits | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | - |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| -val | 0 | 0 | 0 | 1 | x | 0 | 0 | 0 | 1 | 0 | x | x | x | x | x | - |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| -desc | ^-ver-^ | ^type-^ | ^-----subtype-----^ | to |from |more |retry| pwr |more |wep | - | | | x=0 data,x=1 data+ack | DS | DS |frag | | mgm |data | | - '-----------------------------------------------------------------------------------------' - /\ - | -802.11 Data Frame | - ,--------- 'ctrl' expands to >-----------' - | - ,--'---,-------------------------------------------------------------. -Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | - |------|------|---------|---------|---------|------|---------|------| -Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | Frame | fcs | - | | tion | (BSSID) | | | ence | data | | - `--------------------------------------------------| |------' -Total: 28 non-data bytes `----.----' - | - .- 'Frame data' expands to <---------------------------' - | - V - ,---------------------------------------------------. -Bytes | 1 | 1 | 1 | 3 | 2 | 0-2304 | - |------|------|---------|----------|------|---------| -Desc. | SNAP | SNAP | Control |Eth Tunnel| Type | IP | - | DSAP | SSAP | | | | Packet | - | 0xAA | 0xAA |0x03 (UI)|0x00-00-F8| | | - `-----------------------------------------| | -Total: 8 non-data bytes `----.----' - | - .- 'IP Packet' expands, if WEP enabled, to <--' - | - V - ,-----------------------. -Bytes | 4 | 0-2296 | 4 | - |-----|-----------|-----| -Desc. | IV | Encrypted | ICV | - | | IP Packet | | - `-----------------------' -Total: 8 non-data bytes - - -802.3 Ethernet Data Frame - - ,-----------------------------------------. -Bytes | 6 | 6 | 2 | Variable | 4 | - |-------|-------|------|-----------|------| -Desc. | Dest. | Source| Type | IP Packet | fcs | - | MAC | MAC | | | | - `-----------------------------------------' -Total: 18 non-data bytes - -In the event that fragmentation is required, the incoming payload is split into -N parts of size ieee->fts. The first fragment contains the SNAP header and the -remaining packets are just data. - -If encryption is enabled, each fragment payload size is reduced by enough space -to add the prefix and postfix (IV and ICV totalling 8 bytes in the case of WEP) -So if you have 1500 bytes of payload with ieee->fts set to 500 without -encryption it will take 3 frames. With WEP it will take 4 frames as the -payload of each frame is reduced to 492 bytes. - -* SKB visualization -* -* ,- skb->data -* | -* | ETHERNET HEADER ,-<-- PAYLOAD -* | | 14 bytes from skb->data -* | 2 bytes for Type --> ,T. | (sizeof ethhdr) -* | | | | -* |,-Dest.--. ,--Src.---. | | | -* | 6 bytes| | 6 bytes | | | | -* v | | | | | | -* 0 | v 1 | v | v 2 -* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 -* ^ | ^ | ^ | -* | | | | | | -* | | | | `T' <---- 2 bytes for Type -* | | | | -* | | '---SNAP--' <-------- 6 bytes for SNAP -* | | -* `-IV--' <-------------------- 4 bytes for IV (WEP) -* -* SNAP HEADER -* -*/ + * + * + * 802.11 Data Frame + * + * + * 802.11 frame_contorl for data frames - 2 bytes + * ,-----------------------------------------------------------------------------------------. + * bits | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | + * |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| + * val | 0 | 0 | 0 | 1 | x | 0 | 0 | 0 | 1 | 0 | x | x | x | x | x | + * |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| + * desc | ^-ver-^ | ^type-^ | ^-----subtype-----^ | to |from |more |retry| pwr |more |wep | + * | | | x=0 data,x=1 data+ack | DS | DS |frag | | mgm |data | | + * '-----------------------------------------------------------------------------------------' + * /\ + * | + * 802.11 Data Frame | + * ,--------- 'ctrl' expands to >-----------' + * | + * ,--'---,-------------------------------------------------------------. + * Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | + * |------|------|---------|---------|---------|------|---------|------| + * Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | Frame | fcs | + * | | tion | (BSSID) | | | ence | data | | + * `--------------------------------------------------| |------' + * Total: 28 non-data bytes `----.----' + * | + * .- 'Frame data' expands to <---------------------------' + * | + * V + * ,---------------------------------------------------. + * Bytes | 1 | 1 | 1 | 3 | 2 | 0-2304 | + * |------|------|---------|----------|------|---------| + * Desc. | SNAP | SNAP | Control |Eth Tunnel| Type | IP | + * | DSAP | SSAP | | | | Packet | + * | 0xAA | 0xAA |0x03 (UI)|0x00-00-F8| | | + * `-----------------------------------------| | + * Total: 8 non-data bytes `----.----' + * | + * .- 'IP Packet' expands, if WEP enabled, to <--' + * | + * V + * ,-----------------------. + * Bytes | 4 | 0-2296 | 4 | + * |-----|-----------|-----| + * Desc. | IV | Encrypted | ICV | + * | | IP Packet | | + * `-----------------------' + * Total: 8 non-data bytes + * + * + * 802.3 Ethernet Data Frame + * + * ,-----------------------------------------. + * Bytes | 6 | 6 | 2 | Variable | 4 | + * |-------|-------|------|-----------|------| + * Desc. | Dest. | Source| Type | IP Packet | fcs | + * | MAC | MAC | | | | + * `-----------------------------------------' + * Total: 18 non-data bytes + * + * In the event that fragmentation is required, the incoming payload is split into + * N parts of size ieee->fts. The first fragment contains the SNAP header and the + * remaining packets are just data. + * + * If encryption is enabled, each fragment payload size is reduced by enough space + * to add the prefix and postfix (IV and ICV totalling 8 bytes in the case of WEP) + * So if you have 1500 bytes of payload with ieee->fts set to 500 without + * encryption it will take 3 frames. With WEP it will take 4 frames as the + * payload of each frame is reduced to 492 bytes. + * + * SKB visualization + * + * ,- skb->data + * | + * | ETHERNET HEADER ,-<-- PAYLOAD + * | | 14 bytes from skb->data + * | 2 bytes for Type --> ,T. | (sizeof ethhdr) + * | | | | + * |,-Dest.--. ,--Src.---. | | | + * | 6 bytes| | 6 bytes | | | | + * v | | | | | | + * 0 | v 1 | v | v 2 + * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 + * ^ | ^ | ^ | + * | | | | | | + * | | | | `T' <---- 2 bytes for Type + * | | | | + * | | '---SNAP--' <-------- 6 bytes for SNAP + * | | + * `-IV--' <-------------------- 4 bytes for IV (WEP) + * + * SNAP HEADER + * + */ static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; @@ -205,11 +204,13 @@ int ieee80211_encrypt_fragment( } /* To encrypt, frame format is: - * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes) */ + * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes) + */ // PR: FIXME: Copied from hostap. Check fragmentation/MSDU/MPDU encryption. /* Host-based IEEE 802.11 fragmentation for TX is not yet supported, so - * call both MSDU and MPDU encryption functions from here. */ + * call both MSDU and MPDU encryption functions from here. + */ atomic_inc(&crypt->refcnt); res = 0; if (crypt->ops->encrypt_msdu) @@ -250,7 +251,7 @@ static struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size, memset(txb, 0, sizeof(struct ieee80211_txb)); txb->nr_frags = nr_frags; - txb->frag_size = txb_size; + txb->frag_size = __cpu_to_le16(txb_size); for (i = 0; i < nr_frags; i++) { txb->fragments[i] = dev_alloc_skb(txb_size); @@ -304,7 +305,7 @@ ieee80211_classify(struct sk_buff *skb, struct ieee80211_network *network) #define SN_LESS(a, b) (((a-b)&0x800)!=0) static void ieee80211_tx_query_agg_cap(struct ieee80211_device *ieee, - struct sk_buff *skb, cb_desc *tcb_desc) + struct sk_buff *skb, struct cb_desc *tcb_desc) { PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; PTX_TS_RECORD pTxTs = NULL; @@ -379,7 +380,7 @@ FORCED_AGG_SETTING: } static void ieee80211_qurey_ShortPreambleMode(struct ieee80211_device *ieee, - cb_desc *tcb_desc) + struct cb_desc *tcb_desc) { tcb_desc->bUseShortPreamble = false; if (tcb_desc->data_rate == 2) @@ -393,7 +394,7 @@ static void ieee80211_qurey_ShortPreambleMode(struct ieee80211_device *ieee, return; } static void -ieee80211_query_HTCapShortGI(struct ieee80211_device *ieee, cb_desc *tcb_desc) +ieee80211_query_HTCapShortGI(struct ieee80211_device *ieee, struct cb_desc *tcb_desc) { PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; @@ -415,7 +416,7 @@ ieee80211_query_HTCapShortGI(struct ieee80211_device *ieee, cb_desc *tcb_desc) } static void ieee80211_query_BandwidthMode(struct ieee80211_device *ieee, - cb_desc *tcb_desc) + struct cb_desc *tcb_desc) { PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; @@ -436,7 +437,7 @@ static void ieee80211_query_BandwidthMode(struct ieee80211_device *ieee, } static void ieee80211_query_protectionmode(struct ieee80211_device *ieee, - cb_desc *tcb_desc, + struct cb_desc *tcb_desc, struct sk_buff *skb) { // Common Settings @@ -548,7 +549,7 @@ NO_PROTECTION: static void ieee80211_txrate_selectmode(struct ieee80211_device *ieee, - cb_desc *tcb_desc) + struct cb_desc *tcb_desc) { #ifdef TO_DO_LIST if(!IsDataFrame(pFrame)) @@ -615,12 +616,13 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) struct ieee80211_crypt_data *crypt; - cb_desc *tcb_desc; + struct cb_desc *tcb_desc; spin_lock_irqsave(&ieee->lock, flags); /* If there is no driver handler to take the TXB, dont' bother - * creating it... */ + * creating it... + */ if ((!ieee->hard_start_xmit && !(ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE))|| ((!ieee->softmac_data_hard_start_xmit && (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)))) { printk(KERN_WARNING "%s: No xmit handler.\n", @@ -683,13 +685,15 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) if (ieee->iw_mode == IW_MODE_INFRA) { fc |= IEEE80211_FCTL_TODS; /* To DS: Addr1 = BSSID, Addr2 = SA, - Addr3 = DA */ + * Addr3 = DA + */ memcpy(&header.addr1, ieee->current_network.bssid, ETH_ALEN); memcpy(&header.addr2, &src, ETH_ALEN); memcpy(&header.addr3, &dest, ETH_ALEN); } else if (ieee->iw_mode == IW_MODE_ADHOC) { /* not From/To DS: Addr1 = DA, Addr2 = SA, - Addr3 = BSSID */ + * Addr3 = BSSID + */ memcpy(&header.addr1, dest, ETH_ALEN); memcpy(&header.addr2, src, ETH_ALEN); memcpy(&header.addr3, ieee->current_network.bssid, ETH_ALEN); @@ -698,7 +702,8 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) header.frame_ctl = cpu_to_le16(fc); /* Determine fragmentation size based on destination (multicast - * and broadcast are not fragmented) */ + * and broadcast are not fragmented) + */ if (is_multicast_ether_addr(header.addr1)) { frag_size = MAX_FRAG_THRESHOLD; qos_ctl |= QOS_CTL_NOTCONTAIN_ACK; @@ -720,9 +725,10 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) hdr_len = IEEE80211_3ADDR_LEN; } /* Determine amount of payload per fragment. Regardless of if - * this stack is providing the full 802.11 header, one will - * eventually be affixed to this fragment -- so we must account for - * it when determining the amount of payload space. */ + * this stack is providing the full 802.11 header, one will + * eventually be affixed to this fragment -- so we must account for + * it when determining the amount of payload space. + */ bytes_per_frag = frag_size - hdr_len; if (ieee->config & (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) @@ -734,7 +740,8 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) crypt->ops->extra_postfix_len; /* Number of fragments is the total bytes_per_frag / - * payload_per_fragment */ + * payload_per_fragment + */ nr_frags = bytes / bytes_per_frag; bytes_last_frag = bytes % bytes_per_frag; if (bytes_last_frag) @@ -743,8 +750,9 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) bytes_last_frag = bytes_per_frag; /* When we allocate the TXB we allocate enough space for the reserve - * and full fragment bytes (bytes_per_frag doesn't include prefix, - * postfix, header, FCS, etc.) */ + * and full fragment bytes (bytes_per_frag doesn't include prefix, + * postfix, header, FCS, etc.) + */ txb = ieee80211_alloc_txb(nr_frags, frag_size + ieee->tx_headroom, GFP_ATOMIC); if (unlikely(!txb)) { printk(KERN_WARNING "%s: Could not allocate TXB\n", @@ -752,7 +760,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) goto failed; } txb->encrypted = encrypt; - txb->payload_size = bytes; + txb->payload_size = __cpu_to_le16(bytes); //if (ieee->current_network.QoS_Enable) if(qos_actived) @@ -766,7 +774,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) for (i = 0; i < nr_frags; i++) { skb_frag = txb->fragments[i]; - tcb_desc = (cb_desc *)(skb_frag->cb + MAX_DEV_ADDR_SIZE); + tcb_desc = (struct cb_desc *)(skb_frag->cb + MAX_DEV_ADDR_SIZE); if(qos_actived){ skb_frag->priority = skb->priority;//UP2AC(skb->priority); tcb_desc->queue_index = UP2AC(skb->priority); @@ -791,7 +799,8 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) memcpy(frag_hdr, &header, hdr_len); /* If this is not the last fragment, then add the MOREFRAGS - * bit to the frame control */ + * bit to the frame control + */ if (i != nr_frags - 1) { frag_hdr->frame_ctl = cpu_to_le16( fc | IEEE80211_FCTL_MOREFRAGS); @@ -824,7 +833,8 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) skb_pull(skb, bytes); /* Encryption routine will move the header forward in order - * to insert the IV between the header and the payload */ + * to insert the IV between the header and the payload + */ if (encrypt) ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len); if (ieee->config & @@ -859,7 +869,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) } txb->encrypted = 0; - txb->payload_size = skb->len; + txb->payload_size = __cpu_to_le16(skb->len); memcpy(skb_put(txb->fragments[0],skb->len), skb->data, skb->len); } @@ -867,7 +877,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) //WB add to fill data tcb_desc here. only first fragment is considered, need to change, and you may remove to other place. if (txb) { - cb_desc *tcb_desc = (cb_desc *)(txb->fragments[0]->cb + MAX_DEV_ADDR_SIZE); + struct cb_desc *tcb_desc = (struct cb_desc *)(txb->fragments[0]->cb + MAX_DEV_ADDR_SIZE); tcb_desc->bTxEnableFwCalcDur = 1; if (is_multicast_ether_addr(header.addr1)) tcb_desc->bMulticast = 1; @@ -896,7 +906,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) }else{ if ((*ieee->hard_start_xmit)(txb, dev) == 0) { stats->tx_packets++; - stats->tx_bytes += txb->payload_size; + stats->tx_bytes += __le16_to_cpu(txb->payload_size); return 0; } ieee80211_txb_free(txb); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c index 563d7fe..e383ec2 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c @@ -623,7 +623,6 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, goto done; } *crypt = new_crypt; - } if (ext->key_len > 0 && (*crypt)->ops->set_key && @@ -725,7 +724,6 @@ int ieee80211_wx_get_encode_ext(struct ieee80211_device *ieee, (ext->alg == IW_ENCODE_ALG_TKIP || ext->alg == IW_ENCODE_ALG_CCMP)) ext->ext_flags |= IW_ENCODE_EXT_TX_SEQ_VALID; - } return 0; @@ -839,6 +837,5 @@ int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len) ieee->wpa_ie_len = 0; } return 0; - } EXPORT_SYMBOL(ieee80211_wx_set_gen_ie); diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c index 98fbb6e..6619b8f 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c @@ -14,7 +14,7 @@ * input: PBA_RECORD pBA //BA entry to be enabled * u16 Time //indicate time delay. * output: none -********************************************************************************************************************/ + ********************************************************************************************************************/ static void ActivateBAEntry(struct ieee80211_device *ieee, PBA_RECORD pBA, u16 Time) { pBA->bValid = true; @@ -26,7 +26,7 @@ static void ActivateBAEntry(struct ieee80211_device *ieee, PBA_RECORD pBA, u16 T *function: deactivate BA entry, including its timer. * input: PBA_RECORD pBA //BA entry to be disabled * output: none -********************************************************************************************************************/ + ********************************************************************************************************************/ static void DeActivateBAEntry(struct ieee80211_device *ieee, PBA_RECORD pBA) { pBA->bValid = false; @@ -38,7 +38,7 @@ static void DeActivateBAEntry(struct ieee80211_device *ieee, PBA_RECORD pBA) * PTX_TS_RECORD pTxTs //Tx Ts which is to deactivate BA entry. * output: none * notice: As PTX_TS_RECORD structure will be defined in QOS, so wait to be merged. //FIXME -********************************************************************************************************************/ + ********************************************************************************************************************/ static u8 TxTsDeleteBA(struct ieee80211_device *ieee, PTX_TS_RECORD pTxTs) { PBA_RECORD pAdmittedBa = &pTxTs->TxAdmittedBARecord; //These two BA entries must exist in TS structure @@ -46,15 +46,13 @@ 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; } @@ -68,14 +66,13 @@ static u8 TxTsDeleteBA(struct ieee80211_device *ieee, PTX_TS_RECORD pTxTs) * PRX_TS_RECORD pRxTs //Rx Ts which is to deactivate BA entry. * output: none * notice: As PRX_TS_RECORD structure will be defined in QOS, so wait to be merged. //FIXME, same with above -********************************************************************************************************************/ + ********************************************************************************************************************/ 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; } @@ -88,7 +85,7 @@ static u8 RxTsDeleteBA(struct ieee80211_device *ieee, PRX_TS_RECORD pRxTs) * input: * PBA_RECORD pBA //entry to be reset * output: none -********************************************************************************************************************/ + ********************************************************************************************************************/ void ResetBaEntry(PBA_RECORD pBA) { pBA->bValid = false; @@ -106,7 +103,7 @@ void ResetBaEntry(PBA_RECORD pBA) * u8 type //indicate whether it's RSP(ACT_ADDBARSP) ow REQ(ACT_ADDBAREQ) * output: none * return: sk_buff* skb //return constructed skb to xmit -*******************************************************************************************************************************/ + *******************************************************************************************************************************/ static struct sk_buff *ieee80211_ADDBA(struct ieee80211_device *ieee, u8 *Dst, PBA_RECORD pBA, u16 StatusCode, u8 type) { struct sk_buff *skb = NULL; @@ -115,14 +112,12 @@ static struct sk_buff *ieee80211_ADDBA(struct ieee80211_device *ieee, u8 *Dst, P u16 len = ieee->tx_headroom + 9; //category(1) + action field(1) + Dialog Token(1) + BA Parameter Set(2) + BA Timeout Value(2) + BA Start SeqCtrl(2)(or StatusCode(2)) IEEE80211_DEBUG(IEEE80211_DL_TRACE | IEEE80211_DL_BA, "========>%s(), frame(%d) sentd to:%pM, ieee->dev:%p\n", __func__, type, Dst, ieee->dev); - if (pBA == NULL) - { + if (pBA == NULL) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "pBA is NULL\n"); return NULL; } skb = dev_alloc_skb(len + sizeof( struct rtl_80211_hdr_3addr)); //need to add something others? FIXME - if (skb == NULL) - { + if (skb == NULL) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc skb for ADDBA_REQ\n"); return NULL; } @@ -146,10 +141,9 @@ static struct sk_buff *ieee80211_ADDBA(struct ieee80211_device *ieee, u8 *Dst, P // Dialog Token *tag ++= pBA->DialogToken; - if (ACT_ADDBARSP == type) - { + if (ACT_ADDBARSP == type) { // Status Code - printk("=====>to send ADDBARSP\n"); + printk(KERN_INFO "=====>to send ADDBARSP\n"); put_unaligned_le16(StatusCode, tag); tag += 2; @@ -163,8 +157,7 @@ static struct sk_buff *ieee80211_ADDBA(struct ieee80211_device *ieee, u8 *Dst, P put_unaligned_le16(pBA->BaTimeoutValue, tag); tag += 2; - if (ACT_ADDBAREQ == type) - { + if (ACT_ADDBAREQ == type) { // BA Start SeqCtrl memcpy(tag, (u8 *)&(pBA->BaStartSeqCtrl), 2); tag += 2; @@ -184,7 +177,7 @@ static struct sk_buff *ieee80211_ADDBA(struct ieee80211_device *ieee, u8 *Dst, P * u16 ReasonCode //status code. * output: none * return: sk_buff* skb //return constructed skb to xmit -********************************************************************************************************************/ + ********************************************************************************************************************/ static struct sk_buff *ieee80211_DELBA( struct ieee80211_device *ieee, u8 *dst, @@ -209,8 +202,7 @@ static struct sk_buff *ieee80211_DELBA( DelbaParamSet.field.TID = pBA->BaParamSet.field.TID; skb = dev_alloc_skb(len + sizeof( struct rtl_80211_hdr_3addr)); //need to add something others? FIXME - if (skb == NULL) - { + if (skb == NULL) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc skb for ADDBA_REQ\n"); return NULL; } @@ -250,25 +242,22 @@ static struct sk_buff *ieee80211_DELBA( * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA * output: none * notice: If any possible, please hide pBA in ieee. And temporarily use Manage Queue as softmac_mgmt_xmit() usually does -********************************************************************************************************************/ + ********************************************************************************************************************/ static void ieee80211_send_ADDBAReq(struct ieee80211_device *ieee, u8 *dst, PBA_RECORD pBA) { struct sk_buff *skb; skb = ieee80211_ADDBA(ieee, dst, pBA, 0, ACT_ADDBAREQ); //construct ACT_ADDBAREQ frames so set statuscode zero. - if (skb) - { + if (skb) { softmac_mgmt_xmit(skb, ieee); //add statistic needed here. //and skb will be freed in softmac_mgmt_xmit(), so omit all dev_kfree_skb_any() outside softmac_mgmt_xmit() //WB } - else - { + else { IEEE80211_DEBUG(IEEE80211_DL_ERR, "alloc skb error in function %s()\n", __func__); } - return; } /******************************************************************************************************************** @@ -278,19 +267,17 @@ static void ieee80211_send_ADDBAReq(struct ieee80211_device *ieee, * u16 StatusCode //RSP StatusCode * output: none * notice: If any possible, please hide pBA in ieee. And temporarily use Manage Queue as softmac_mgmt_xmit() usually does -********************************************************************************************************************/ + ********************************************************************************************************************/ static void ieee80211_send_ADDBARsp(struct ieee80211_device *ieee, u8 *dst, PBA_RECORD pBA, u16 StatusCode) { struct sk_buff *skb; skb = ieee80211_ADDBA(ieee, dst, pBA, StatusCode, ACT_ADDBARSP); //construct ACT_ADDBARSP frames - if (skb) - { + if (skb) { softmac_mgmt_xmit(skb, ieee); //same above } - else - { + else { IEEE80211_DEBUG(IEEE80211_DL_ERR, "alloc skb error in function %s()\n", __func__); } @@ -305,7 +292,7 @@ static void ieee80211_send_ADDBARsp(struct ieee80211_device *ieee, u8 *dst, * u16 ReasonCode //DEL ReasonCode * output: none * notice: If any possible, please hide pBA in ieee. And temporarily use Manage Queue as softmac_mgmt_xmit() usually does -********************************************************************************************************************/ + ********************************************************************************************************************/ static void ieee80211_send_DELBA(struct ieee80211_device *ieee, u8 *dst, PBA_RECORD pBA, TR_SELECT TxRxSelect, @@ -313,16 +300,13 @@ static void ieee80211_send_DELBA(struct ieee80211_device *ieee, u8 *dst, { struct sk_buff *skb; skb = ieee80211_DELBA(ieee, dst, pBA, TxRxSelect, ReasonCode); //construct ACT_ADDBARSP frames - if (skb) - { + if (skb) { softmac_mgmt_xmit(skb, ieee); //same above } - else - { + else { IEEE80211_DEBUG(IEEE80211_DL_ERR, "alloc skb error in function %s()\n", __func__); } - return ; } /******************************************************************************************************************** @@ -330,7 +314,7 @@ static void ieee80211_send_DELBA(struct ieee80211_device *ieee, u8 *dst, * input: struct sk_buff * skb //incoming ADDBAReq skb. * return: 0(pass), other(fail) * notice: As this function need support of QOS, I comment some code out. And when qos is ready, this code need to be support. -********************************************************************************************************************/ + ********************************************************************************************************************/ int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, struct sk_buff *skb) { struct rtl_80211_hdr_3addr *req = NULL; @@ -361,7 +345,7 @@ int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, struct sk_buff *skb) pBaTimeoutVal = (u16 *)(tag + 5); pBaStartSeqCtrl = (PSEQUENCE_CONTROL)(req + 7); - printk("====================>rx ADDBAREQ from :%pM\n", dst); + printk(KERN_INFO "====================>rx ADDBAREQ from :%pM\n", dst); //some other capability is not ready now. if ((ieee->current_network.qos_data.active == 0) || (!ieee->pHTInfo->bCurrentHTSupport)) //|| @@ -379,8 +363,7 @@ int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, struct sk_buff *skb) dst, (u8)(pBaParamSet->field.TID), RX_DIR, - true) ) - { + true) ) { rc = ADDBA_STATUS_REFUSED; IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't get TS in %s()\n", __func__); goto OnADDBAReq_Fail; @@ -390,8 +373,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__); goto OnADDBAReq_Fail; @@ -432,7 +414,7 @@ OnADDBAReq_Fail: * input: struct sk_buff * skb //incoming ADDBAReq skb. * return: 0(pass), other(fail) * notice: As this function need support of QOS, I comment some code out. And when qos is ready, this code need to be support. -********************************************************************************************************************/ + ********************************************************************************************************************/ int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, struct sk_buff *skb) { struct rtl_80211_hdr_3addr *rsp = NULL; @@ -480,8 +462,7 @@ int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, struct sk_buff *skb) dst, (u8)(pBaParamSet->field.TID), TX_DIR, - false) ) - { + false) ) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't get TS in %s()\n", __func__); ReasonCode = DELBA_REASON_UNKNOWN_BA; goto OnADDBARsp_Reject; @@ -496,34 +477,29 @@ int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, struct sk_buff *skb) // Check if related BA is waiting for setup. // If not, reject by sending DELBA frame. // - if((pAdmittedBA->bValid==true)) - { + if (pAdmittedBA->bValid) { // Since BA is already setup, we ignore all other ADDBA Response. IEEE80211_DEBUG(IEEE80211_DL_BA, "OnADDBARsp(): Recv ADDBA Rsp. Drop because already admit it! \n"); return -1; } - else if((!pPendingBA->bValid) ||(*pDialogToken != pPendingBA->DialogToken)) - { + else if((!pPendingBA->bValid) ||(*pDialogToken != pPendingBA->DialogToken)) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "OnADDBARsp(): Recv ADDBA Rsp. BA invalid, DELBA! \n"); ReasonCode = DELBA_REASON_UNKNOWN_BA; goto OnADDBARsp_Reject; } - else - { + else { IEEE80211_DEBUG(IEEE80211_DL_BA, "OnADDBARsp(): Recv ADDBA Rsp. BA is admitted! Status code:%X\n", *pStatusCode); DeActivateBAEntry(ieee, pPendingBA); } - if(*pStatusCode == ADDBA_STATUS_SUCCESS) - { + if(*pStatusCode == ADDBA_STATUS_SUCCESS) { // // Determine ADDBA Rsp content here. // 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; DeActivateBAEntry(ieee, pAdmittedBA); @@ -542,8 +518,7 @@ int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, struct sk_buff *skb) DeActivateBAEntry(ieee, pAdmittedBA); ActivateBAEntry(ieee, pAdmittedBA, *pBaTimeoutVal); } - else - { + else { // Delay next ADDBA process. pTS->bAddBaReqDelayed = true; } @@ -566,7 +541,7 @@ OnADDBARsp_Reject: * input: struct sk_buff * skb //incoming ADDBAReq skb. * return: 0(pass), other(fail) * notice: As this function need support of QOS, I comment some code out. And when qos is ready, this code need to be support. -********************************************************************************************************************/ + ********************************************************************************************************************/ int ieee80211_rx_DELBA(struct ieee80211_device *ieee, struct sk_buff *skb) { struct rtl_80211_hdr_3addr *delba = NULL; @@ -582,8 +557,7 @@ int ieee80211_rx_DELBA(struct ieee80211_device *ieee, struct sk_buff *skb) } if (ieee->current_network.qos_data.active == 0 || - !ieee->pHTInfo->bCurrentHTSupport) - { + !ieee->pHTInfo->bCurrentHTSupport) { 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); return -1; } @@ -593,8 +567,7 @@ int ieee80211_rx_DELBA(struct ieee80211_device *ieee, struct sk_buff *skb) dst = &delba->addr2[0]; pDelBaParamSet = (PDELBA_PARAM_SET)&delba->payload[2]; - if(pDelBaParamSet->field.Initiator == 1) - { + if(pDelBaParamSet->field.Initiator == 1) { PRX_TS_RECORD pRxTs; if (!GetTs( @@ -603,16 +576,14 @@ int ieee80211_rx_DELBA(struct ieee80211_device *ieee, struct sk_buff *skb) dst, (u8)pDelBaParamSet->field.TID, RX_DIR, - false) ) - { + false) ) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't get TS for RXTS in %s()\n", __func__); return -1; } RxTsDeleteBA(ieee, pRxTs); } - else - { + else { PTX_TS_RECORD pTxTs; if (!GetTs( @@ -621,8 +592,7 @@ int ieee80211_rx_DELBA(struct ieee80211_device *ieee, struct sk_buff *skb) dst, (u8)pDelBaParamSet->field.TID, TX_DIR, - false) ) - { + false) ) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't get TS for TXTS in %s()\n", __func__); return -1; } @@ -650,7 +620,7 @@ TsInitAddBA( { PBA_RECORD pBA = &pTS->TxPendingBARecord; - if(pBA->bValid==true && bOverwritePending==false) + if (pBA->bValid && !bOverwritePending) return; // Set parameters to "Pending" variable set @@ -674,8 +644,7 @@ void TsInitDelBA( struct ieee80211_device *ieee, PTS_COMMON_INFO pTsCommonInfo, TR_SELECT TxRxSelect) { - if(TxRxSelect == TX_DIR) - { + if(TxRxSelect == TX_DIR) { PTX_TS_RECORD pTxTs = (PTX_TS_RECORD)pTsCommonInfo; if(TxTsDeleteBA(ieee, pTxTs)) @@ -686,8 +655,7 @@ TsInitDelBA( struct ieee80211_device *ieee, PTS_COMMON_INFO pTsCommonInfo, TR_SE TxRxSelect, DELBA_REASON_END_BA); } - else if(TxRxSelect == RX_DIR) - { + else if(TxRxSelect == RX_DIR) { PRX_TS_RECORD pRxTs = (PRX_TS_RECORD)pTsCommonInfo; if(RxTsDeleteBA(ieee, pRxTs)) ieee80211_send_DELBA( @@ -703,7 +671,7 @@ TsInitDelBA( struct ieee80211_device *ieee, PTS_COMMON_INFO pTsCommonInfo, TR_SE * input: unsigned long data //acturally we send TX_TS_RECORD or RX_TS_RECORD to these timer * return: NULL * notice: -********************************************************************************************************************/ + ********************************************************************************************************************/ void BaSetupTimeOut(unsigned long data) { PTX_TS_RECORD pTxTs = (PTX_TS_RECORD)data; @@ -738,5 +706,4 @@ void RxBaInactTimeout(unsigned long data) &pRxTs->RxAdmittedBARecord, RX_DIR, DELBA_REASON_TIMEOUT); - return ; } diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h index c3aabba..5f54d93 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h @@ -35,7 +35,7 @@ #define HT_SUPPORTED_MCS_1SS_2SS_BITMAP HT_MCS_1SS_BITMAP|HT_MCS_1SS_2SS_BITMAP -typedef enum _HT_MCS_RATE{ +typedef enum _HT_MCS_RATE { HT_MCS0 = 0x00000001, HT_MCS1 = 0x00000002, HT_MCS2 = 0x00000004, @@ -58,7 +58,7 @@ typedef enum _HT_MCS_RATE{ // // Represent Channel Width in HT Capabilities // -typedef enum _HT_CHANNEL_WIDTH{ +typedef enum _HT_CHANNEL_WIDTH { HT_CHANNEL_WIDTH_20 = 0, HT_CHANNEL_WIDTH_20_40 = 1, }HT_CHANNEL_WIDTH, *PHT_CHANNEL_WIDTH; @@ -67,14 +67,14 @@ typedef enum _HT_CHANNEL_WIDTH{ // Represent Extension Channel Offset in HT Capabilities // This is available only in 40Mhz mode. // -typedef enum _HT_EXTCHNL_OFFSET{ +typedef enum _HT_EXTCHNL_OFFSET { HT_EXTCHNL_OFFSET_NO_EXT = 0, HT_EXTCHNL_OFFSET_UPPER = 1, HT_EXTCHNL_OFFSET_NO_DEF = 2, HT_EXTCHNL_OFFSET_LOWER = 3, }HT_EXTCHNL_OFFSET, *PHT_EXTCHNL_OFFSET; -typedef enum _CHNLOP{ +typedef enum _CHNLOP { CHNLOP_NONE = 0, // No Action now CHNLOP_SCAN = 1, // Scan in progress CHNLOP_SWBW = 2, // Bandwidth switching in progress @@ -119,7 +119,7 @@ typedef union _HT_CAPABILITY_MACPARA{ }HT_CAPABILITY_MACPARA, *PHT_CAPABILITY_MACPARA; */ -typedef enum _HT_ACTION{ +typedef enum _HT_ACTION { ACT_RECOMMAND_WIDTH = 0, ACT_MIMO_PWR_SAVE = 1, ACT_PSMP = 2, @@ -134,14 +134,14 @@ typedef enum _HT_ACTION{ /* 2007/06/07 MH Define sub-carrier mode for 40MHZ. */ -typedef enum _HT_Bandwidth_40MHZ_Sub_Carrier{ +typedef enum _HT_Bandwidth_40MHZ_Sub_Carrier { SC_MODE_DUPLICATE = 0, SC_MODE_LOWER = 1, SC_MODE_UPPER = 2, SC_MODE_FULL40MHZ = 3, }HT_BW40_SC_E; -typedef struct _HT_CAPABILITY_ELE{ +typedef struct _HT_CAPABILITY_ELE { //HT capability info u8 AdvCoding:1; @@ -184,7 +184,7 @@ typedef struct _HT_CAPABILITY_ELE{ // Only AP is required to include this element //------------------------------------------------------------ -typedef struct _HT_INFORMATION_ELE{ +typedef struct _HT_INFORMATION_ELE { u8 ControlChl; u8 ExtChlOffset:2; @@ -215,18 +215,18 @@ typedef struct _HT_INFORMATION_ELE{ // MIMO Power Save control field. // This is appear in MIMO Power Save Action Frame // -typedef struct _MIMOPS_CTRL{ +typedef struct _MIMOPS_CTRL { u8 MimoPsEnable:1; u8 MimoPsMode:1; u8 Reserved:6; } MIMOPS_CTRL, *PMIMOPS_CTRL; -typedef enum _HT_SPEC_VER{ +typedef enum _HT_SPEC_VER { HT_SPEC_VER_IEEE = 0, HT_SPEC_VER_EWC = 1, }HT_SPEC_VER, *PHT_SPEC_VER; -typedef enum _HT_AGGRE_MODE_E{ +typedef enum _HT_AGGRE_MODE_E { HT_AGG_AUTO = 0, HT_AGG_FORCE_ENABLE = 1, HT_AGG_FORCE_DISABLE = 2, @@ -238,7 +238,7 @@ typedef enum _HT_AGGRE_MODE_E{ // to default value in HTInitializeHTInfo() //------------------------------------------------------------ -typedef struct _RT_HIGH_THROUGHPUT{ +typedef struct _RT_HIGH_THROUGHPUT { u8 bEnableHT; u8 bCurrentHTSupport; @@ -347,7 +347,7 @@ typedef struct _RT_HIGH_THROUGHPUT{ // when card is configured as "AP mode" //------------------------------------------------------------ -typedef struct _RT_HTINFO_STA_ENTRY{ +typedef struct _RT_HTINFO_STA_ENTRY { u8 bEnableHT; u8 bSupportCck; @@ -377,7 +377,7 @@ typedef struct _RT_HTINFO_STA_ENTRY{ // when card is configured as "STA mode" //------------------------------------------------------------ -typedef struct _BSS_HT{ +typedef struct _BSS_HT { u8 bdSupportHT; @@ -395,7 +395,7 @@ typedef struct _BSS_HT{ u8 bdRT2RTLongSlotTime; } __attribute__ ((packed)) BSS_HT, *PBSS_HT; -typedef struct _MIMO_RSSI{ +typedef struct _MIMO_RSSI { u32 EnableAntenna; u32 AntennaA; u32 AntennaB; @@ -404,12 +404,12 @@ typedef struct _MIMO_RSSI{ u32 Average; }MIMO_RSSI, *PMIMO_RSSI; -typedef struct _MIMO_EVM{ +typedef struct _MIMO_EVM { u32 EVM1; u32 EVM2; }MIMO_EVM, *PMIMO_EVM; -typedef struct _FALSE_ALARM_STATISTICS{ +typedef struct _FALSE_ALARM_STATISTICS { u32 Cnt_Parity_Fail; u32 Cnt_Rate_Illegal; u32 Cnt_Crc8_fail; @@ -442,7 +442,7 @@ extern u8 MCS_FILTER_1SS[16]; #define IS_11N_MCS_RATE(rate) (rate&0x80) -typedef enum _HT_AGGRE_SIZE{ +typedef enum _HT_AGGRE_SIZE { HT_AGG_SIZE_8K = 0, HT_AGG_SIZE_16K = 1, HT_AGG_SIZE_32K = 2, @@ -464,7 +464,7 @@ typedef enum _HT_IOT_PEER // // IOT Action for different AP // -typedef enum _HT_IOT_ACTION{ +typedef enum _HT_IOT_ACTION { HT_IOT_ACT_TX_USE_AMSDU_4K = 0x00000001, HT_IOT_ACT_TX_USE_AMSDU_8K = 0x00000002, HT_IOT_ACT_DISABLE_MCS14 = 0x00000004, diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h index 873969c..e25b697 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h @@ -14,7 +14,7 @@ typedef enum _TR_SELECT { RX_DIR = 1, } TR_SELECT, *PTR_SELECT; -typedef struct _TS_COMMON_INFO{ +typedef struct _TS_COMMON_INFO { struct list_head List; struct timer_list SetupTimer; struct timer_list InactTimer; @@ -25,7 +25,7 @@ typedef struct _TS_COMMON_INFO{ u8 TClasNum; } TS_COMMON_INFO, *PTS_COMMON_INFO; -typedef struct _TX_TS_RECORD{ +typedef struct _TX_TS_RECORD { TS_COMMON_INFO TsCommonInfo; u16 TxCurSeq; BA_RECORD TxPendingBARecord; /* For BA Originator */ diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c index 6033502..b4c13ff 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c @@ -21,7 +21,7 @@ static void TsInactTimeout(unsigned long data) * input: unsigned long data //acturally we send TX_TS_RECORD or RX_TS_RECORD to these timer * return: NULL * notice: -********************************************************************************************************************/ + ********************************************************************************************************************/ static void RxPktPendingTimeout(unsigned long data) { PRX_TS_RECORD pRxTs = (PRX_TS_RECORD)data; @@ -31,7 +31,6 @@ static void RxPktPendingTimeout(unsigned long data) //u32 flags = 0; unsigned long flags = 0; - struct ieee80211_rxb *stats_IndicateArray[REORDER_WIN_SIZE]; u8 index = 0; bool bPktInBuf = false; @@ -55,7 +54,7 @@ static void RxPktPendingTimeout(unsigned long data) pRxTs->RxIndicateSeq = (pRxTs->RxIndicateSeq + 1) % 4096; IEEE80211_DEBUG(IEEE80211_DL_REORDER,"RxPktPendingTimeout(): IndicateSeq: %d\n", pReorderEntry->SeqNum); - stats_IndicateArray[index] = pReorderEntry->prxb; + ieee->stats_IndicateArray[index] = pReorderEntry->prxb; index++; list_add_tail(&pReorderEntry->List, &ieee->RxReorder_Unused_List); @@ -79,7 +78,7 @@ static void RxPktPendingTimeout(unsigned long data) spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); return; } - ieee80211_indicate_packets(ieee, stats_IndicateArray, index); + ieee80211_indicate_packets(ieee, ieee->stats_IndicateArray, index); } if(bPktInBuf && (pRxTs->RxTimeoutIndicateSeq==0xffff)) @@ -96,7 +95,7 @@ static void RxPktPendingTimeout(unsigned long data) * input: unsigned long data //acturally we send TX_TS_RECORD or RX_TS_RECORD to these timer * return: NULL * notice: -********************************************************************************************************************/ + ********************************************************************************************************************/ static void TsAddBaProcess(unsigned long data) { PTX_TS_RECORD pTxTs = (PTX_TS_RECORD)data; diff --git a/drivers/staging/rtl8192u/r8180_93cx6.c b/drivers/staging/rtl8192u/r8180_93cx6.c index f35defc..c414efc 100644 --- a/drivers/staging/rtl8192u/r8180_93cx6.c +++ b/drivers/staging/rtl8192u/r8180_93cx6.c @@ -1,22 +1,22 @@ /* - This files contains card eeprom (93c46 or 93c56) programming routines, - memory is addressed by 16 bits words. - - This is part of rtl8180 OpenSource driver. - 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 those projects and the Ndiswrapper - project Authors. -*/ + * This files contains card eeprom (93c46 or 93c56) programming routines, + * memory is addressed by 16 bits words. + * + * This is part of rtl8180 OpenSource driver. + * 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 those projects and the Ndiswrapper + * project Authors. + */ #include "r8180_93cx6.h" diff --git a/drivers/staging/rtl8192u/r8180_93cx6.h b/drivers/staging/rtl8192u/r8180_93cx6.h index 9cf7f58..643d465 100644 --- a/drivers/staging/rtl8192u/r8180_93cx6.h +++ b/drivers/staging/rtl8192u/r8180_93cx6.h @@ -1,17 +1,17 @@ /* - This is part of rtl8187 OpenSource driver - Copyright (C) Andrea Merello 2004-2005 <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. -*/ + * This is part of rtl8187 OpenSource driver + * Copyright (C) Andrea Merello 2004-2005 <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. + */ /*This files contains card eeprom (93c46 or 93c56) programming routines*/ /*memory is addressed by WORDS*/ @@ -39,5 +39,4 @@ #define EPROM_TXPW2 0x1b #define EPROM_TXPW1 0x3d - int eprom_read(struct net_device *dev, u32 addr); /* reads a 16 bits word */ diff --git a/drivers/staging/rtl8192u/r8190_rtl8256.c b/drivers/staging/rtl8192u/r8190_rtl8256.c index d733fb2..e54f6fa 100644 --- a/drivers/staging/rtl8192u/r8190_rtl8256.c +++ b/drivers/staging/rtl8192u/r8190_rtl8256.c @@ -1,12 +1,12 @@ /* -* This is part of the rtl8192 driver -* released under the GPL (See file COPYING for details). -* -* This files contains programming code for the rtl8256 -* radio frontend. -* -* *Many* thanks to Realtek Corp. for their great support! -*/ + * This is part of the rtl8192 driver + * released under the GPL (See file COPYING for details). + * + * This files contains programming code for the rtl8256 + * radio frontend. + * + * *Many* thanks to Realtek Corp. for their great support! + */ #include "r8192U.h" #include "r8192U_hw.h" diff --git a/drivers/staging/rtl8192u/r8190_rtl8256.h b/drivers/staging/rtl8192u/r8190_rtl8256.h index 1ba4f83..5c325ce 100644 --- a/drivers/staging/rtl8192u/r8190_rtl8256.h +++ b/drivers/staging/rtl8192u/r8190_rtl8256.h @@ -1,14 +1,14 @@ /* - This is part of the rtl8180-sa2400 driver - released under the GPL (See file COPYING for details). - Copyright (c) 2005 Andrea Merello <andrea.merello@gmail.com> - - This files contains programming code for the rtl8256 - radio frontend. - - *Many* thanks to Realtek Corp. for their great support! - -*/ + * This is part of the rtl8180-sa2400 driver + * released under the GPL (See file COPYING for details). + * Copyright (c) 2005 Andrea Merello <andrea.merello@gmail.com> + * + * + * This files contains programming code for the rtl8256 + * radio frontend. + * + * *Many* thanks to Realtek Corp. for their great support! + */ #ifndef RTL8225H #define RTL8225H diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h index 0b7b04e..a7ba8f3 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -626,7 +626,8 @@ typedef struct Stats { long signal_quality; long last_signal_strength_inpercent; /* Correct smoothed ss in dbm, only used in driver - * to report real power now */ + * to report real power now + */ long recv_signal_power; u8 rx_rssi_percentage[4]; u8 rx_evm_percentage[2]; @@ -672,32 +673,40 @@ typedef struct _BB_REGISTER_DEFINITION { /* Tx gain stage: 0x80c~0x80f [4 bytes] */ u32 rfTxGainStage; /* wire parameter control1: 0x820~0x823, 0x828~0x82b, - * 0x830~0x833, 0x838~0x83b [16 bytes] */ + * 0x830~0x833, 0x838~0x83b [16 bytes] + */ u32 rfHSSIPara1; /* wire parameter control2: 0x824~0x827, 0x82c~0x82f, - * 0x834~0x837, 0x83c~0x83f [16 bytes] */ + * 0x834~0x837, 0x83c~0x83f [16 bytes] + */ u32 rfHSSIPara2; /* Tx Rx antenna control: 0x858~0x85f [16 bytes] */ u32 rfSwitchControl; /* AGC parameter control1: 0xc50~0xc53, 0xc58~0xc5b, - * 0xc60~0xc63, 0xc68~0xc6b [16 bytes] */ + * 0xc60~0xc63, 0xc68~0xc6b [16 bytes] + */ u32 rfAGCControl1; /* AGC parameter control2: 0xc54~0xc57, 0xc5c~0xc5f, - * 0xc64~0xc67, 0xc6c~0xc6f [16 bytes] */ + * 0xc64~0xc67, 0xc6c~0xc6f [16 bytes] + */ u32 rfAGCControl2; /* OFDM Rx IQ imbalance matrix: 0xc14~0xc17, 0xc1c~0xc1f, - * 0xc24~0xc27, 0xc2c~0xc2f [16 bytes] */ + * 0xc24~0xc27, 0xc2c~0xc2f [16 bytes] + */ u32 rfRxIQImbalance; /* Rx IQ DC offset and Rx digital filter, Rx DC notch filter: * 0xc10~0xc13, 0xc18~0xc1b, - * 0xc20~0xc23, 0xc28~0xc2b [16 bytes] */ + * 0xc20~0xc23, 0xc28~0xc2b [16 bytes] + */ u32 rfRxAFE; /* OFDM Tx IQ imbalance matrix: 0xc80~0xc83, 0xc88~0xc8b, - * 0xc90~0xc93, 0xc98~0xc9b [16 bytes] */ + * 0xc90~0xc93, 0xc98~0xc9b [16 bytes] + */ u32 rfTxIQImbalance; /* Tx IQ DC Offset and Tx DFIR type: * 0xc84~0xc87, 0xc8c~0xc8f, - * 0xc94~0xc97, 0xc9c~0xc9f [16 bytes] */ + * 0xc94~0xc97, 0xc9c~0xc9f [16 bytes] + */ u32 rfTxAFE; /* LSSI RF readback data: 0x8a0~0x8af [16 bytes] */ u32 rfLSSIReadBack; @@ -776,7 +785,8 @@ typedef struct _phy_ofdm_rx_status_report_819xusb { typedef struct _phy_cck_rx_status_report_819xusb { /* For CCK rate descriptor. This is an unsigned 8:1 variable. * LSB bit presend 0.5. And MSB 7 bts presend a signed value. - * Range from -64~+63.5. */ + * Range from -64~+63.5. + */ u8 adc_pwdb_X[4]; u8 sq_rpt; u8 cck_agc_rpt; @@ -991,7 +1001,8 @@ typedef struct r8192_priv { /* Control channel sub-carrier */ u8 nCur40MhzPrimeSC; /* Test for shorten RF configuration time. - * We save RF reg0 in this variable to reduce RF reading. */ + * We save RF reg0 in this variable to reduce RF reading. + */ u32 RfReg0Value[4]; u8 NumTotalRFPath; bool brfpath_rxenable[4]; @@ -1009,11 +1020,13 @@ typedef struct r8192_priv { bool bstore_last_dtpflag; /* Define to discriminate on High power State or - * on sitesurvey to change Tx gain index */ + * on sitesurvey to change Tx gain index + */ bool bstart_txctrl_bydtp; rate_adaptive rate_adaptive; /* TX power tracking - * OPEN/CLOSE TX POWER TRACKING */ + * OPEN/CLOSE TX POWER TRACKING + */ txbbgain_struct txbbgain_table[TxBBGainTableLength]; u8 txpower_count; /* For 6 sec do tracking again */ bool btxpower_trackingInit; diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index fdb03dc..b631990 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -503,8 +503,7 @@ static void watch_dog_timer_callback(unsigned long data); /**************************************************************************** * -----------------------------PROCFS STUFF------------------------- -***************************************************************************** - */ + ****************************************************************************/ static struct proc_dir_entry *rtl8192_proc; @@ -715,8 +714,8 @@ static void rtl8192_proc_remove_one(struct net_device *dev) } /**************************************************************************** - -----------------------------MISC STUFF------------------------- -*****************************************************************************/ + * -----------------------------MISC STUFF------------------------- + *****************************************************************************/ short check_nic_enough_desc(struct net_device *dev, int queue_index) { @@ -1009,7 +1008,7 @@ static void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); int ret; unsigned long flags; - cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); u8 queue_index = tcb_desc->queue_index; /* shall not be referred by command packet */ @@ -1035,7 +1034,7 @@ static int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); int ret; unsigned long flags; - cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); u8 queue_index = tcb_desc->queue_index; @@ -1061,14 +1060,14 @@ static void rtl8192_tx_isr(struct urb *tx_urb) struct sk_buff *skb = (struct sk_buff *)tx_urb->context; struct net_device *dev; struct r8192_priv *priv = NULL; - cb_desc *tcb_desc; + struct cb_desc *tcb_desc; u8 queue_index; if (!skb) return; dev = *(struct net_device **)(skb->cb); - tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); queue_index = tcb_desc->queue_index; priv = ieee80211_priv(dev); @@ -1285,7 +1284,7 @@ short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb) struct urb *tx_urb; unsigned int idx_pipe; tx_desc_cmd_819x_usb *pdesc = (tx_desc_cmd_819x_usb *)skb->data; - cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); u8 queue_index = tcb_desc->queue_index; atomic_inc(&priv->tx_pending[queue_index]); @@ -1328,7 +1327,7 @@ short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb) * 2006.10.30 by Emily * * \param QUEUEID Software Queue -*/ + */ static u8 MapHwQueueToFirmwareQueue(u8 QueueID) { u8 QueueSelect = 0x0; /* default set to */ @@ -1477,7 +1476,7 @@ static u8 MRateToHwRate8190Pci(u8 rate) } -static u8 QueryIsShort(u8 TxHT, u8 TxRate, cb_desc *tcb_desc) +static u8 QueryIsShort(u8 TxHT, u8 TxRate, struct cb_desc *tcb_desc) { u8 tmp_Short; @@ -1499,11 +1498,11 @@ static void tx_zero_isr(struct urb *tx_urb) * The tx procedure is just as following, * skb->cb will contain all the following information, * priority, morefrag, rate, &dev. - * */ + */ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) { struct r8192_priv *priv = ieee80211_priv(dev); - cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); tx_desc_819x_usb *tx_desc = (tx_desc_819x_usb *)skb->data; tx_fwinfo_819x_usb *tx_fwinfo = (tx_fwinfo_819x_usb *)(skb->data + USB_HWDESC_HEADER_LEN); @@ -1840,8 +1839,8 @@ static void rtl8192_update_beacon(struct work_struct *work) } /* -* background support to run QoS activate functionality -*/ + * background support to run QoS activate functionality + */ static int WDCAPARA_ADD[] = {EDCAPARA_BE, EDCAPARA_BK, EDCAPARA_VI, EDCAPARA_VO}; static void rtl8192_qos_activate(struct work_struct *work) @@ -1946,10 +1945,10 @@ static int rtl8192_handle_beacon(struct net_device *dev, } /* -* handling the beaconing responses. if we get different QoS setting -* off the network from the associated setting, adjust the QoS -* setting -*/ + * handling the beaconing responses. if we get different QoS setting + * off the network from the associated setting, adjust the QoS + * setting + */ static int rtl8192_qos_association_resp(struct r8192_priv *priv, struct ieee80211_network *network) { @@ -3045,8 +3044,8 @@ static bool rtl8192_adapter_start(struct net_device *dev) * be used to stop beacon transmission */ /*************************************************************************** - -------------------------------NET STUFF--------------------------- -***************************************************************************/ + * -------------------------------NET STUFF--------------------------- + ***************************************************************************/ static struct net_device_stats *rtl8192_stats(struct net_device *dev) { @@ -3074,9 +3073,9 @@ static bool HalTxCheckStuck819xUsb(struct net_device *dev) } /* -* <Assumption: RT_TX_SPINLOCK is acquired.> -* First added: 2006.11.19 by emily -*/ + * <Assumption: RT_TX_SPINLOCK is acquired.> + * First added: 2006.11.19 by emily + */ static RESET_TYPE TxCheckStuck(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -4156,7 +4155,8 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, * Output: NONE * * Return: 0-100 percentage - *---------------------------------------------------------------------------*/ + *--------------------------------------------------------------------------- + */ static u8 rtl819x_query_rxpwrpercentage(s8 antpower) { if ((antpower <= -100) || (antpower >= 20)) @@ -4529,19 +4529,19 @@ static void TranslateRxSignalStuff819xUsb(struct sk_buff *skb, } /** -* Function: UpdateReceivedRateHistogramStatistics -* Overview: Record the received data rate -* -* Input: -* struct net_device *dev -* struct ieee80211_rx_stats *stats -* -* Output: -* -* (priv->stats.ReceivedRateHistogram[] is updated) -* Return: -* None -*/ + * Function: UpdateReceivedRateHistogramStatistics + * Overview: Record the received data rate + * + * Input: + * struct net_device *dev + * struct ieee80211_rx_stats *stats + * + * Output: + * + * (priv->stats.ReceivedRateHistogram[] is updated) + * Return: + * None + */ static void UpdateReceivedRateHistogramStatistics8190(struct net_device *dev, struct ieee80211_rx_stats *stats) @@ -4935,8 +4935,8 @@ static const struct net_device_ops rtl8192_netdev_ops = { /**************************************************************************** - ---------------------------- USB_STUFF--------------------------- -*****************************************************************************/ + * ---------------------------- USB_STUFF--------------------------- + *****************************************************************************/ static int rtl8192_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) @@ -5177,7 +5177,7 @@ void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, } /*************************************************************************** - ------------------- module init / exit stubs ---------------- -****************************************************************************/ + * ------------------- module init / exit stubs ---------------- + ****************************************************************************/ module_init(rtl8192_usb_module_init); module_exit(rtl8192_usb_module_exit); diff --git a/drivers/staging/rtl8192u/r8192U_hw.h b/drivers/staging/rtl8192u/r8192U_hw.h index e07d65d..174ccf6 100644 --- a/drivers/staging/rtl8192u/r8192U_hw.h +++ b/drivers/staging/rtl8192u/r8192U_hw.h @@ -1,18 +1,18 @@ /* - This is part of rtl8187 OpenSource driver. - Copyright (C) Andrea Merello 2004-2005 <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 those projects - and the Ndiswrapper project Authors. -*/ + * This is part of rtl8187 OpenSource driver. + * Copyright (C) Andrea Merello 2004-2005 <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 those projects + * and the Ndiswrapper project Authors. + */ /* Mariusz Matuszek added full registers definition with Realtek's name */ diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c index d2f2f24..a954538 100644 --- a/drivers/staging/rtl8192u/r8192U_wx.c +++ b/drivers/staging/rtl8192u/r8192U_wx.c @@ -562,7 +562,7 @@ static int r8192_wx_set_enc(struct net_device *dev, } if (wrqu->encoding.length == 0x5) { - ieee->pairwise_key_type = KEY_TYPE_WEP40; + ieee->pairwise_key_type = KEY_TYPE_WEP40; EnableHWSecurityConfig8192(dev); setKey(dev, @@ -576,8 +576,8 @@ static int r8192_wx_set_enc(struct net_device *dev, } else if (wrqu->encoding.length == 0xd) { - ieee->pairwise_key_type = KEY_TYPE_WEP104; - EnableHWSecurityConfig8192(dev); + ieee->pairwise_key_type = KEY_TYPE_WEP104; + EnableHWSecurityConfig8192(dev); setKey(dev, key_idx, /* EntryNo */ diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.c b/drivers/staging/rtl8192u/r819xU_cmdpkt.c index 545f49e..3e0731b 100644 --- a/drivers/staging/rtl8192u/r819xU_cmdpkt.c +++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.c @@ -30,16 +30,17 @@ rt_status SendTxCommandPacket(struct net_device *dev, void *pData, u32 DataLen) { struct r8192_priv *priv = ieee80211_priv(dev); struct sk_buff *skb; - cb_desc *tcb_desc; + struct cb_desc *tcb_desc; unsigned char *ptr_buf; /* Get TCB and local buffer from common pool. - (It is shared by CmdQ, MgntQ, and USB coalesce DataQ) */ + * (It is shared by CmdQ, MgntQ, and USB coalesce DataQ) + */ skb = dev_alloc_skb(USB_HWDESC_HEADER_LEN + DataLen + 4); if (!skb) return RT_STATUS_FAILURE; memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev)); - tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); tcb_desc->queue_index = TXCMD_QUEUE; tcb_desc->bCmdOrInit = DESC_PACKET_TYPE_NORMAL; tcb_desc->bLastIniPkt = 0; @@ -76,7 +77,8 @@ rt_status SendTxCommandPacket(struct net_device *dev, void *pData, u32 DataLen) * When Who Remark * 05/12/2008 amy Create Version 0 porting from windows code. * - *---------------------------------------------------------------------------*/ + *--------------------------------------------------------------------------- + */ static void cmpk_count_txstatistic(struct net_device *dev, cmpk_txfb_t *pstx_fb) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -87,8 +89,9 @@ static void cmpk_count_txstatistic(struct net_device *dev, cmpk_txfb_t *pstx_fb) (pu1Byte)(&rtState)); /* When RF is off, we should not count the packet for hw/sw synchronize - reason, ie. there may be a duration while sw switch is changed and - hw switch is being changed. */ + * reason, ie. there may be a duration while sw switch is changed and + * hw switch is being changed. + */ if (rtState == eRfOff) return; #endif @@ -98,8 +101,9 @@ static void cmpk_count_txstatistic(struct net_device *dev, cmpk_txfb_t *pstx_fb) return; #endif /* We can not know the packet length and transmit type: - broadcast or uni or multicast. So the relative statistics - must be collected in tx feedback info. */ + * broadcast or uni or multicast. So the relative statistics + * must be collected in tx feedback info. + */ if (pstx_fb->tok) { priv->stats.txfeedbackok++; priv->stats.txoktotal++; @@ -133,11 +137,8 @@ static void cmpk_count_txstatistic(struct net_device *dev, cmpk_txfb_t *pstx_fb) priv->stats.txretrycount += pstx_fb->retry_cnt; priv->stats.txfeedbackretry += pstx_fb->retry_cnt; - } - - /*----------------------------------------------------------------------------- * Function: cmpk_handle_tx_feedback() * @@ -158,7 +159,8 @@ static void cmpk_count_txstatistic(struct net_device *dev, cmpk_txfb_t *pstx_fb) * When Who Remark * 05/08/2008 amy Create Version 0 porting from windows code. * - *---------------------------------------------------------------------------*/ + *--------------------------------------------------------------------------- + */ static void cmpk_handle_tx_feedback(struct net_device *dev, u8 *pmsg) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -168,8 +170,9 @@ static void cmpk_handle_tx_feedback(struct net_device *dev, u8 *pmsg) /* 1. Extract TX feedback info from RFD to temp structure buffer. */ /* It seems that FW use big endian(MIPS) and DRV use little endian in - windows OS. So we have to read the content byte by byte or transfer - endian type before copy the message copy. */ + * windows OS. So we have to read the content byte by byte or transfer + * endian type before copy the message copy. + */ /* Use pointer to transfer structure memory. */ memcpy((u8 *)&rx_tx_fb, pmsg, sizeof(cmpk_txfb_t)); /* 2. Use tx feedback info to count TX statistics. */ @@ -177,8 +180,8 @@ static void cmpk_handle_tx_feedback(struct net_device *dev, u8 *pmsg) /* Comment previous method for TX statistic function. */ /* Collect info TX feedback packet to fill TCB. */ /* We can not know the packet length and transmit type: broadcast or uni - or multicast. */ - + * or multicast. + */ } static void cmdpkt_beacontimerinterrupt_819xusb(struct net_device *dev) @@ -187,9 +190,9 @@ static void cmdpkt_beacontimerinterrupt_819xusb(struct net_device *dev) u16 tx_rate; /* 87B have to S/W beacon for DTM encryption_cmn. */ if (priv->ieee80211->current_network.mode == IEEE_A || - priv->ieee80211->current_network.mode == IEEE_N_5G || - (priv->ieee80211->current_network.mode == IEEE_N_24G && - (!priv->ieee80211->pHTInfo->bCurSuppCCK))) { + priv->ieee80211->current_network.mode == IEEE_N_5G || + (priv->ieee80211->current_network.mode == IEEE_N_24G && + (!priv->ieee80211->pHTInfo->bCurSuppCCK))) { tx_rate = 60; DMESG("send beacon frame tx rate is 6Mbpm\n"); } else { @@ -198,13 +201,8 @@ static void cmdpkt_beacontimerinterrupt_819xusb(struct net_device *dev) } rtl819xusb_beacon_tx(dev, tx_rate); /* HW Beacon */ - - } - - - /*----------------------------------------------------------------------------- * Function: cmpk_handle_interrupt_status() * @@ -224,7 +222,8 @@ static void cmdpkt_beacontimerinterrupt_819xusb(struct net_device *dev) * When Who Remark * 05/12/2008 amy Add this for rtl8192 porting from windows code. * - *---------------------------------------------------------------------------*/ + *--------------------------------------------------------------------------- + */ static void cmpk_handle_interrupt_status(struct net_device *dev, u8 *pmsg) { cmpk_intr_sta_t rx_intr_status; /* */ @@ -234,15 +233,15 @@ static void cmpk_handle_interrupt_status(struct net_device *dev, u8 *pmsg) /* 1. Extract TX feedback info from RFD to temp structure buffer. */ /* It seems that FW use big endian(MIPS) and DRV use little endian in - windows OS. So we have to read the content byte by byte or transfer - endian type before copy the message copy. */ + * windows OS. So we have to read the content byte by byte or transfer + * endian type before copy the message copy. + */ rx_intr_status.length = pmsg[1]; if (rx_intr_status.length != (sizeof(cmpk_intr_sta_t) - 2)) { DMESG("cmpk_Handle_Interrupt_Status: wrong length!\n"); return; } - /* Statistics of beacon for ad-hoc mode. */ if (priv->ieee80211->iw_mode == IW_MODE_ADHOC) { /* 2 maybe need endian transform? */ @@ -261,17 +260,13 @@ static void cmpk_handle_interrupt_status(struct net_device *dev, u8 *pmsg) if (rx_intr_status.interrupt_status & ISR_BcnTimerIntr) cmdpkt_beacontimerinterrupt_819xusb(dev); - } /* Other informations in interrupt status we need? */ - DMESG("<---- cmpk_handle_interrupt_status()\n"); - } - /*----------------------------------------------------------------------------- * Function: cmpk_handle_query_config_rx() * @@ -290,16 +285,17 @@ static void cmpk_handle_interrupt_status(struct net_device *dev, u8 *pmsg) * When Who Remark * 05/12/2008 amy Create Version 0 porting from windows code. * - *---------------------------------------------------------------------------*/ + *--------------------------------------------------------------------------- + */ static void cmpk_handle_query_config_rx(struct net_device *dev, u8 *pmsg) { cmpk_query_cfg_t rx_query_cfg; - /* 1. Extract TX feedback info from RFD to temp structure buffer. */ /* It seems that FW use big endian(MIPS) and DRV use little endian in - windows OS. So we have to read the content byte by byte or transfer - endian type before copy the message copy. */ + * windows OS. So we have to read the content byte by byte or transfer + * endian type before copy the message copy. + */ rx_query_cfg.cfg_action = (pmsg[4] & 0x80000000) >> 31; rx_query_cfg.cfg_type = (pmsg[4] & 0x60) >> 5; rx_query_cfg.cfg_size = (pmsg[4] & 0x18) >> 3; @@ -309,10 +305,8 @@ static void cmpk_handle_query_config_rx(struct net_device *dev, u8 *pmsg) (pmsg[10] << 8) | (pmsg[11] << 0); rx_query_cfg.mask = (pmsg[12] << 24) | (pmsg[13] << 16) | (pmsg[14] << 8) | (pmsg[15] << 0); - } - /*----------------------------------------------------------------------------- * Function: cmpk_count_tx_status() * @@ -329,7 +323,8 @@ static void cmpk_handle_query_config_rx(struct net_device *dev, u8 *pmsg) * When Who Remark * 05/12/2008 amy Create Version 0 porting from windows code. * - *---------------------------------------------------------------------------*/ + *--------------------------------------------------------------------------- + */ static void cmpk_count_tx_status(struct net_device *dev, cmpk_tx_status_t *pstx_status) { @@ -343,8 +338,9 @@ static void cmpk_count_tx_status(struct net_device *dev, (pu1Byte)(&rtState)); /* When RF is off, we should not count the packet for hw/sw synchronize - reason, ie. there may be a duration while sw switch is changed and - hw switch is being changed. */ + * reason, ie. there may be a duration while sw switch is changed and + * hw switch is being changed. + */ if (rtState == eRfOff) return; #endif @@ -374,8 +370,6 @@ static void cmpk_count_tx_status(struct net_device *dev, priv->stats.last_packet_rate = pstx_status->rate; } - - /*----------------------------------------------------------------------------- * Function: cmpk_handle_tx_status() * @@ -392,7 +386,8 @@ static void cmpk_count_tx_status(struct net_device *dev, * When Who Remark * 05/12/2008 amy Create Version 0 porting from windows code. * - *---------------------------------------------------------------------------*/ + *--------------------------------------------------------------------------- + */ static void cmpk_handle_tx_status(struct net_device *dev, u8 *pmsg) { cmpk_tx_status_t rx_tx_sts; @@ -400,10 +395,8 @@ static void cmpk_handle_tx_status(struct net_device *dev, u8 *pmsg) memcpy((void *)&rx_tx_sts, (void *)pmsg, sizeof(cmpk_tx_status_t)); /* 2. Use tx feedback info to count TX statistics. */ cmpk_count_tx_status(dev, &rx_tx_sts); - } - /*----------------------------------------------------------------------------- * Function: cmpk_handle_tx_rate_history() * @@ -419,7 +412,8 @@ static void cmpk_handle_tx_status(struct net_device *dev, u8 *pmsg) * When Who Remark * 05/12/2008 amy Create Version 0 porting from windows code. * - *---------------------------------------------------------------------------*/ + *--------------------------------------------------------------------------- + */ static void cmpk_handle_tx_rate_history(struct net_device *dev, u8 *pmsg) { cmpk_tx_rahis_t *ptxrate; @@ -428,14 +422,14 @@ static void cmpk_handle_tx_rate_history(struct net_device *dev, u8 *pmsg) u32 *ptemp; struct r8192_priv *priv = ieee80211_priv(dev); - #ifdef ENABLE_PS pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_RF_STATE, (pu1Byte)(&rtState)); /* When RF is off, we should not count the packet for hw/sw synchronize - reason, ie. there may be a duration while sw switch is changed and - hw switch is being changed. */ + * reason, ie. there may be a duration while sw switch is changed and + * hw switch is being changed. + */ if (rtState == eRfOff) return; #endif @@ -443,7 +437,8 @@ static void cmpk_handle_tx_rate_history(struct net_device *dev, u8 *pmsg) ptemp = (u32 *)pmsg; /* Do endian transfer to word alignment(16 bits) for windows system. - You must do different endian transfer for linux and MAC OS */ + * You must do different endian transfer for linux and MAC OS + */ for (i = 0; i < (length/4); i++) { u16 temp1, temp2; @@ -469,10 +464,8 @@ static void cmpk_handle_tx_rate_history(struct net_device *dev, u8 *pmsg) for (j = 0; j < 4; j++) priv->stats.txrate.ht_mcs[j][i] += ptxrate->ht_mcs[j][i]; } - } - /*----------------------------------------------------------------------------- * Function: cmpk_message_handle_rx() * @@ -492,7 +485,8 @@ static void cmpk_handle_tx_rate_history(struct net_device *dev, u8 *pmsg) * When Who Remark * 05/06/2008 amy Create Version 0 porting from windows code. * - *---------------------------------------------------------------------------*/ + *--------------------------------------------------------------------------- + */ u32 cmpk_message_handle_rx(struct net_device *dev, struct ieee80211_rx_stats *pstats) { @@ -502,7 +496,8 @@ u32 cmpk_message_handle_rx(struct net_device *dev, u8 *pcmd_buff; /* 0. Check inpt arguments. If is is a command queue message or - pointer is null. */ + * pointer is null. + */ if (pstats == NULL) return 0; /* This is not a command packet. */ @@ -516,10 +511,12 @@ u32 cmpk_message_handle_rx(struct net_device *dev, element_id = pcmd_buff[0]; /* 4. Check every received command packet content according to different - element type. Because FW may aggregate RX command packet to - minimize transmit time between DRV and FW.*/ + * element type. Because FW may aggregate RX command packet to + * minimize transmit time between DRV and FW. + */ /* Add a counter to prevent the lock in the loop from being held too - long */ + * long + */ while (total_length > 0 && exe_cnt++ < 100) { /* We support aggregation of different cmd in the same packet */ element_id = pcmd_buff[0]; @@ -547,7 +544,8 @@ u32 cmpk_message_handle_rx(struct net_device *dev, case RX_TX_PER_PKT_FEEDBACK: /* You must at lease add a switch case element here, - Otherwise, we will jump to default case. */ + * Otherwise, we will jump to default case. + */ cmd_length = CMPK_RX_TX_FB_SIZE; break; @@ -567,5 +565,4 @@ u32 cmpk_message_handle_rx(struct net_device *dev, pcmd_buff += cmd_length; } return 1; /* This is a command packet. */ - } diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.h b/drivers/staging/rtl8192u/r819xU_cmdpkt.h index f490e25..ad0f600 100644 --- a/drivers/staging/rtl8192u/r819xU_cmdpkt.h +++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.h @@ -55,7 +55,8 @@ typedef struct tag_cmd_pkt_tx_feedback { } cmpk_txfb_t; /* 2. RX side: Interrupt status packet. It includes Beacon State, - * Beacon Timer Interrupt and other useful informations in MAC ISR Reg. */ + * Beacon Timer Interrupt and other useful informations in MAC ISR Reg. + */ typedef struct tag_cmd_pkt_interrupt_status { u8 element_id; /* Command packet type. */ u8 length; /* Command packet length. */ @@ -83,13 +84,15 @@ typedef struct tag_cmd_pkt_set_configuration { } cmpk_set_cfg_t; /* 4. Both side : TX/RX query configuraton packet. The query structure is the - same as set configuration. */ + * same as set configuration. + */ #define cmpk_query_cfg_t cmpk_set_cfg_t /* 5. Multi packet feedback status. */ typedef struct tag_tx_stats_feedback { /* For endian transfer --> Driver will not the same as - firmware structure. */ + * firmware structure. + */ /* DW 0 */ u16 reserve1; u8 length; /* Command packet length */ diff --git a/drivers/staging/rtl8192u/r819xU_firmware.c b/drivers/staging/rtl8192u/r819xU_firmware.c index 08302df..35d1786 100644 --- a/drivers/staging/rtl8192u/r819xU_firmware.c +++ b/drivers/staging/rtl8192u/r819xU_firmware.c @@ -10,7 +10,7 @@ * Returns: * NDIS_STATUS_FAILURE - the following initialization process should be terminated * NDIS_STATUS_SUCCESS - if firmware initialization process success -**************************************************************************************************/ + **************************************************************************************************/ #include "r8192U.h" #include "r8192U_hw.h" @@ -42,7 +42,7 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, rt_firmware *pfirmware = priv->pFirmware; struct sk_buff *skb; unsigned char *seg_ptr; - cb_desc *tcb_desc; + struct cb_desc *tcb_desc; u8 bLastIniPkt; u8 index; @@ -62,12 +62,12 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, /* Allocate skb buffer to contain firmware info and tx descriptor info * add 4 to avoid packet appending overflow. - * */ + */ skb = dev_alloc_skb(USB_HWDESC_HEADER_LEN + frag_length + 4); if (!skb) return false; memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev)); - tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); tcb_desc->queue_index = TXCMD_QUEUE; tcb_desc->bCmdOrInit = DESC_PACKET_TYPE_INIT; tcb_desc->bLastIniPkt = bLastIniPkt; @@ -277,7 +277,7 @@ bool init_firmware(struct net_device *dev) * 2. each packet segment will be put in the skb_buff packet. * 3. each skb_buff packet data content will already include the firmware info * and Tx descriptor info - * */ + */ rt_status = fw_download_code(dev, mapped_file, file_length); if (rst_opt == OPT_SYSTEM_RESET) release_firmware(fw_entry); diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c index 696df34..c99130f 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.c +++ b/drivers/staging/rtl8192u/r819xU_phy.c @@ -367,7 +367,8 @@ static u32 phy_FwRFSerialRead(struct net_device *dev, RF90_RADIO_PATH_E eRFPath, /* Firmware RF Write control. * We can not execute the scheme in the initial step. * Otherwise, RF-R/W will waste much time. - * This is only for site survey. */ + * This is only for site survey. + */ /* 1. Read operation need not insert data. bit 0-11 */ /* 2. Write RF register address. bit 12-19 */ data |= ((offset&0xFF)<<12); @@ -380,7 +381,8 @@ static u32 phy_FwRFSerialRead(struct net_device *dev, RF90_RADIO_PATH_E eRFPath, read_nic_dword(dev, QPNR, &tmp); while (tmp & 0x80000000) { /* If FW can not finish RF-R/W for more than ?? times. - We must reset FW. */ + * We must reset FW. + */ if (time++ < 100) { udelay(10); read_nic_dword(dev, QPNR, &tmp); @@ -394,7 +396,8 @@ static u32 phy_FwRFSerialRead(struct net_device *dev, RF90_RADIO_PATH_E eRFPath, read_nic_dword(dev, QPNR, &tmp); while (tmp & 0x80000000) { /* If FW can not finish RF-R/W for more than ?? times. - We must reset FW. */ + * We must reset FW. + */ if (time++ < 100) { udelay(10); read_nic_dword(dev, QPNR, &tmp); @@ -426,7 +429,8 @@ static void phy_FwRFSerialWrite(struct net_device *dev, /* Firmware RF Write control. * We can not execute the scheme in the initial step. * Otherwise, RF-R/W will waste much time. - * This is only for site survey. */ + * This is only for site survey. + */ /* 1. Set driver write bit and 12 bit data. bit 0-11 */ /* 2. Write RF register address. bit 12-19 */ @@ -442,7 +446,8 @@ static void phy_FwRFSerialWrite(struct net_device *dev, read_nic_dword(dev, QPNR, &tmp); while (tmp & 0x80000000) { /* If FW can not finish RF-R/W for more than ?? times. - We must reset FW. */ + * We must reset FW. + */ if (time++ < 100) { udelay(10); read_nic_dword(dev, QPNR, &tmp); @@ -451,10 +456,12 @@ static void phy_FwRFSerialWrite(struct net_device *dev, } } /* 7. No matter check bit. We always force the write. - Because FW will not accept the command. */ + * Because FW will not accept the command. + */ write_nic_dword(dev, QPNR, data); /* According to test, we must delay 20us to wait firmware - to finish RF write operation. */ + * to finish RF write operation. + */ /* We support delay in firmware side now. */ } @@ -723,7 +730,8 @@ u8 rtl8192_phy_checkBBAndRF(struct net_device *dev, HW90_BLOCK_E CheckBlock, WriteAddr[HW90_BLOCK_RF], bMask12Bits, WriteData[i]); /* TODO: we should not delay for such a long time. - Ask SD3 */ + * Ask SD3 + */ usleep_range(1000, 1000); reg = rtl8192_phy_QueryRFReg(dev, eRFPath, WriteAddr[HW90_BLOCK_RF], @@ -820,7 +828,8 @@ static void rtl8192_BB_Config_ParaFile(struct net_device *dev) } /* Check if the CCK HighPower is turned ON. - This is used to calculate PWDB. */ + * This is used to calculate PWDB. + */ priv->bCckHighPower = (u8)rtl8192_QueryBBReg(dev, rFPGA0_XA_HSSIParameter2, 0x200); @@ -839,7 +848,8 @@ void rtl8192_BBConfig(struct net_device *dev) rtl8192_InitBBRFRegDef(dev); /* config BB&RF. As hardCode based initialization has not been well * implemented, so use file first. - * FIXME: should implement it for hardcode? */ + * FIXME: should implement it for hardcode? + */ rtl8192_BB_Config_ParaFile(dev); } @@ -1158,7 +1168,8 @@ bool rtl8192_SetRFPowerState(struct net_device *dev, switch (pHalData->eRFPowerState) { case eRfOff: /* If Rf off reason is from IPS, - LED should blink with no link */ + * LED should blink with no link + */ if (pMgntInfo->RfOffReason == RF_CHANGE_BY_IPS) Adapter->HalFunc.LedControlHandler(Adapter, LED_CTL_NO_LINK); else @@ -1168,7 +1179,7 @@ bool rtl8192_SetRFPowerState(struct net_device *dev, case eRfOn: /* Turn on RF we are still linked, which might - happen when we quickly turn off and on HW RF. + * happen when we quickly turn off and on HW RF. */ if (pMgntInfo->bMediaConnect) Adapter->HalFunc.LedControlHandler(Adapter, LED_CTL_LINK); @@ -1263,7 +1274,8 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel, if (!IsLegalChannel(priv->ieee80211, channel)) { RT_TRACE(COMP_ERR, "set to illegal channel: %d\n", channel); /* return true to tell upper caller function this channel - setting is finished! Or it will in while loop. */ + * setting is finished! Or it will in while loop. + */ return true; } /* FIXME: need to check whether channel is legal or not here */ @@ -1609,7 +1621,8 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev) } /* Skip over setting of J-mode in BB register here. - Default value is "None J mode". */ + * Default value is "None J mode". + */ /* <3> Set RF related register */ switch (priv->rf_chip) { |