aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMateusz Kulikowski <mateusz.kulikowski@gmail.com>2015-03-31 18:24:37 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-04-03 09:29:31 -0400
commit14b40d92881533dca8b25647f105b9546433cda2 (patch)
treef98466b91afa587137ec78fd6bb33c7757066fd1
parente725fb6f814b290fbf967e475f2a136efca66986 (diff)
staging: rtl8192e: Comment cleanup (style/format)
- Multiline comments use "network subsystem comment style" - Merge short multiline comments - Remove empty comments - Remove function name comment at the end of small (<1 screen) functions - Reformat 802.11 data frame format to use spaces and network format Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c2
-rw-r--r--drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h30
-rw-r--r--drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c4
-rw-r--r--drivers/staging/rtl8192e/rtl8192e/rtl_core.c3
-rw-r--r--drivers/staging/rtl8192e/rtl8192e/rtl_wx.c5
-rw-r--r--drivers/staging/rtl8192e/rtl819x_HTProc.c3
-rw-r--r--drivers/staging/rtl8192e/rtllib.h96
-rw-r--r--drivers/staging/rtl8192e/rtllib_crypt.c3
-rw-r--r--drivers/staging/rtl8192e/rtllib_crypt.h3
-rw-r--r--drivers/staging/rtl8192e/rtllib_crypt_ccmp.c3
-rw-r--r--drivers/staging/rtl8192e/rtllib_crypt_tkip.c15
-rw-r--r--drivers/staging/rtl8192e/rtllib_crypt_wep.c3
-rw-r--r--drivers/staging/rtl8192e/rtllib_rx.c101
-rw-r--r--drivers/staging/rtl8192e/rtllib_softmac.c90
-rw-r--r--drivers/staging/rtl8192e/rtllib_tx.c225
-rw-r--r--drivers/staging/rtl8192e/rtllib_wx.c21
16 files changed, 318 insertions, 289 deletions
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c
index e2ef0a3fcb83..ecdd2e5c6bac 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c
@@ -165,7 +165,7 @@ static void cmdpkt_beacontimerinterrupt_819xusb(struct net_device *dev)
165 165
166static void cmpk_handle_interrupt_status(struct net_device *dev, u8 *pmsg) 166static void cmpk_handle_interrupt_status(struct net_device *dev, u8 *pmsg)
167{ 167{
168 struct cmpk_intr_sta rx_intr_status; /* */ 168 struct cmpk_intr_sta rx_intr_status;
169 struct r8192_priv *priv = rtllib_priv(dev); 169 struct r8192_priv *priv = rtllib_priv(dev);
170 170
171 DMESG("---> cmpk_Handle_Interrupt_Status()\n"); 171 DMESG("---> cmpk_Handle_Interrupt_Status()\n");
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h
index 23219e17e5a1..2693682644df 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h
@@ -33,28 +33,28 @@
33struct cmpk_txfb { 33struct cmpk_txfb {
34 u8 element_id; 34 u8 element_id;
35 u8 length; 35 u8 length;
36 u8 TID:4; /* */ 36 u8 TID:4;
37 u8 fail_reason:3; /* */ 37 u8 fail_reason:3;
38 u8 tok:1; 38 u8 tok:1;
39 u8 reserve1:4; /* */ 39 u8 reserve1:4;
40 u8 pkt_type:2; /* */ 40 u8 pkt_type:2;
41 u8 bandwidth:1; /* */ 41 u8 bandwidth:1;
42 u8 qos_pkt:1; /* */ 42 u8 qos_pkt:1;
43 43
44 u8 reserve2; /* */ 44 u8 reserve2;
45 u8 retry_cnt; /* */ 45 u8 retry_cnt;
46 u16 pkt_id; /* */ 46 u16 pkt_id;
47 47
48 u16 seq_num; /* */ 48 u16 seq_num;
49 u8 s_rate; 49 u8 s_rate;
50 u8 f_rate; 50 u8 f_rate;
51 51
52 u8 s_rts_rate; /* */ 52 u8 s_rts_rate;
53 u8 f_rts_rate; /* */ 53 u8 f_rts_rate;
54 u16 pkt_length; /* */ 54 u16 pkt_length;
55 55
56 u16 reserve3; /* */ 56 u16 reserve3;
57 u16 duration; /* */ 57 u16 duration;
58}; 58};
59 59
60struct cmpk_intr_sta { 60struct cmpk_intr_sta {
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
index 28b44c9f1339..4664a4fd1e48 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
@@ -304,7 +304,7 @@ static u32 phy_FwRFSerialRead(struct net_device *dev,
304 } 304 }
305 return read_nic_dword(dev, RF_DATA); 305 return read_nic_dword(dev, RF_DATA);
306 306
307} /* phy_FwRFSerialRead */ 307}
308 308
309static void phy_FwRFSerialWrite(struct net_device *dev, 309static void phy_FwRFSerialWrite(struct net_device *dev,
310 enum rf90_radio_path eRFPath, 310 enum rf90_radio_path eRFPath,
@@ -325,7 +325,7 @@ static void phy_FwRFSerialWrite(struct net_device *dev,
325 } 325 }
326 write_nic_dword(dev, QPNR, Data); 326 write_nic_dword(dev, QPNR, Data);
327 327
328} /* phy_FwRFSerialWrite */ 328}
329 329
330 330
331void rtl8192_phy_configmac(struct net_device *dev) 331void rtl8192_phy_configmac(struct net_device *dev)
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index fb3cb01e67e8..352d381b7c4a 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -2332,7 +2332,8 @@ static void rtl8192_rx_normal(struct net_device *dev)
2332 goto done; 2332 goto done;
2333 new_skb = dev_alloc_skb(priv->rxbuffersize); 2333 new_skb = dev_alloc_skb(priv->rxbuffersize);
2334 /* if allocation of new skb failed - drop current packet 2334 /* if allocation of new skb failed - drop current packet
2335 * and reuse skb */ 2335 * and reuse skb
2336 */
2336 if (unlikely(!new_skb)) 2337 if (unlikely(!new_skb))
2337 goto done; 2338 goto done;
2338 2339
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
index 04f1f26b83c5..8d6a109e023b 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
@@ -1221,11 +1221,10 @@ static iw_handler r8192_wx_handlers[] = {
1221 IW_IOCTL(SIOCSIWENCODEEXT) = r8192_wx_set_enc_ext, 1221 IW_IOCTL(SIOCSIWENCODEEXT) = r8192_wx_set_enc_ext,
1222}; 1222};
1223 1223
1224/* 1224/* the following rule need to be following,
1225 * the following rule need to be following,
1226 * Odd : get (world access), 1225 * Odd : get (world access),
1227 * even : set (root access) 1226 * even : set (root access)
1228 * */ 1227 */
1229static const struct iw_priv_args r8192_private_args[] = { 1228static const struct iw_priv_args r8192_private_args[] = {
1230 { 1229 {
1231 SIOCIWFIRSTPRIV + 0x0, 1230 SIOCIWFIRSTPRIV + 0x0,
diff --git a/drivers/staging/rtl8192e/rtl819x_HTProc.c b/drivers/staging/rtl8192e/rtl819x_HTProc.c
index 573325cbd2e1..7f103114d5d2 100644
--- a/drivers/staging/rtl8192e/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c
@@ -719,7 +719,8 @@ void HTResetSelfAndSavePeerSetting(struct rtllib_device *ieee,
719 719
720 RTLLIB_DEBUG(RTLLIB_DL_HT, "==============>%s()\n", __func__); 720 RTLLIB_DEBUG(RTLLIB_DL_HT, "==============>%s()\n", __func__);
721 /* unmark bEnableHT flag here is the same reason why unmarked in 721 /* unmark bEnableHT flag here is the same reason why unmarked in
722 * function rtllib_softmac_new_net. WB 2008.09.10*/ 722 * function rtllib_softmac_new_net. WB 2008.09.10
723 */
723 if (pNetwork->bssht.bdSupportHT) { 724 if (pNetwork->bssht.bdSupportHT) {
724 pHTInfo->bCurrentHTSupport = true; 725 pHTInfo->bCurrentHTSupport = true;
725 pHTInfo->ePeerHTSpecVer = pNetwork->bssht.bdHTSpecVer; 726 pHTInfo->ePeerHTSpecVer = pNetwork->bssht.bdHTSpecVer;
diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index c7487772f21d..3c8b708df5c3 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -509,12 +509,13 @@ struct ieee_param {
509 509
510#define RTLLIB_DATA_LEN 2304 510#define RTLLIB_DATA_LEN 2304
511/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section 511/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
512 6.2.1.1.2. 512 * 6.2.1.1.2.
513 513 *
514 The figure in section 7.1.2 suggests a body size of up to 2312 514 * The figure in section 7.1.2 suggests a body size of up to 2312
515 bytes is allowed, which is a bit confusing, I suspect this 515 * bytes is allowed, which is a bit confusing, I suspect this
516 represents the 2304 bytes of real data, plus a possible 8 bytes of 516 * represents the 2304 bytes of real data, plus a possible 8 bytes of
517 WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */ 517 * WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro)
518 */
518#define RTLLIB_1ADDR_LEN 10 519#define RTLLIB_1ADDR_LEN 10
519#define RTLLIB_2ADDR_LEN 16 520#define RTLLIB_2ADDR_LEN 16
520#define RTLLIB_3ADDR_LEN 24 521#define RTLLIB_3ADDR_LEN 24
@@ -696,8 +697,7 @@ do { \
696 } \ 697 } \
697 } while (0) 698 } while (0)
698 699
699/* 700/* To use the debug system;
700 * To use the debug system;
701 * 701 *
702 * If you are defining a new debug classification, simply add it to the #define 702 * If you are defining a new debug classification, simply add it to the #define
703 * list here in the form of: 703 * list here in the form of:
@@ -716,8 +716,6 @@ do { \
716 * % cat /proc/net/ipw/debug_level 716 * % cat /proc/net/ipw/debug_level
717 * 717 *
718 * you simply need to add your entry to the ipw_debug_levels array. 718 * you simply need to add your entry to the ipw_debug_levels array.
719 *
720 *
721 */ 719 */
722 720
723#define RTLLIB_DL_INFO (1<<0) 721#define RTLLIB_DL_INFO (1<<0)
@@ -975,7 +973,8 @@ struct rtllib_rx_stats {
975/* IEEE 802.11 requires that STA supports concurrent reception of at least 973/* IEEE 802.11 requires that STA supports concurrent reception of at least
976 * three fragmented frames. This define can be increased to support more 974 * three fragmented frames. This define can be increased to support more
977 * concurrent frames, but it should be noted that each entry can consume about 975 * concurrent frames, but it should be noted that each entry can consume about
978 * 2 kB of RAM and increasing cache size will slow down frame reassembly. */ 976 * 2 kB of RAM and increasing cache size will slow down frame reassembly.
977 */
979#define RTLLIB_FRAG_CACHE_LEN 4 978#define RTLLIB_FRAG_CACHE_LEN 4
980 979
981struct rtllib_frag_entry { 980struct rtllib_frag_entry {
@@ -1053,16 +1052,15 @@ struct rtllib_security {
1053} __packed; 1052} __packed;
1054 1053
1055 1054
1056/* 1055/* 802.11 data frame from AP
1057 802.11 data frame from AP 1056 * ,-------------------------------------------------------------------.
1058 ,-------------------------------------------------------------------. 1057 * Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 |
1059Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | 1058 * |------|------|---------|---------|---------|------|---------|------|
1060 |------|------|---------|---------|---------|------|---------|------| 1059 * Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs |
1061Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs | 1060 * | | tion | (BSSID) | | | ence | data | |
1062 | | tion | (BSSID) | | | ence | data | | 1061 * `-------------------------------------------------------------------'
1063 `-------------------------------------------------------------------' 1062 * Total: 28-2340 bytes
1064Total: 28-2340 bytes 1063 */
1065*/
1066 1064
1067/* Management Frame Information Element Types */ 1065/* Management Frame Information Element Types */
1068enum rtllib_mfie { 1066enum rtllib_mfie {
@@ -1100,7 +1098,8 @@ enum rtllib_mfie {
1100 1098
1101/* Minimal header; can be used for passing 802.11 frames with sufficient 1099/* Minimal header; can be used for passing 802.11 frames with sufficient
1102 * information to determine what type of underlying data type is actually 1100 * information to determine what type of underlying data type is actually
1103 * stored in the data. */ 1101 * stored in the data.
1102 */
1104struct rtllib_pspoll_hdr { 1103struct rtllib_pspoll_hdr {
1105 __le16 frame_ctl; 1104 __le16 frame_ctl;
1106 __le16 aid; 1105 __le16 aid;
@@ -1210,7 +1209,8 @@ struct rtllib_probe_response {
1210 __le16 beacon_interval; 1209 __le16 beacon_interval;
1211 __le16 capability; 1210 __le16 capability;
1212 /* SSID, supported rates, FH params, DS params, 1211 /* SSID, supported rates, FH params, DS params,
1213 * CF params, IBSS params, TIM (if beacon), RSN */ 1212 * CF params, IBSS params, TIM (if beacon), RSN
1213 */
1214 struct rtllib_info_element info_element[0]; 1214 struct rtllib_info_element info_element[0];
1215} __packed; 1215} __packed;
1216 1216
@@ -1285,7 +1285,8 @@ union frameqos {
1285/* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs 1285/* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs
1286 * only use 8, and then use extended rates for the remaining supported 1286 * only use 8, and then use extended rates for the remaining supported
1287 * rates. Other APs, however, stick all of their supported rates on the 1287 * rates. Other APs, however, stick all of their supported rates on the
1288 * main rates information element... */ 1288 * main rates information element...
1289 */
1289#define MAX_RATES_LENGTH ((u8)12) 1290#define MAX_RATES_LENGTH ((u8)12)
1290#define MAX_RATES_EX_LENGTH ((u8)16) 1291#define MAX_RATES_EX_LENGTH ((u8)16)
1291#define MAX_NETWORK_COUNT 96 1292#define MAX_NETWORK_COUNT 96
@@ -1472,22 +1473,21 @@ struct rtllib_info_element_hdr {
1472 u8 len; 1473 u8 len;
1473} __packed; 1474} __packed;
1474 1475
1475/* 1476/* These are the data types that can make up management packets
1476 * These are the data types that can make up management packets
1477 * 1477 *
1478 u16 auth_algorithm; 1478 * u16 auth_algorithm;
1479 u16 auth_sequence; 1479 * u16 auth_sequence;
1480 u16 beacon_interval; 1480 * u16 beacon_interval;
1481 u16 capability; 1481 * u16 capability;
1482 u8 current_ap[ETH_ALEN]; 1482 * u8 current_ap[ETH_ALEN];
1483 u16 listen_interval; 1483 * u16 listen_interval;
1484 struct { 1484 * struct {
1485 u16 association_id:14, reserved:2; 1485 * u16 association_id:14, reserved:2;
1486 } __packed; 1486 * } __packed;
1487 u32 time_stamp[2]; 1487 * u32 time_stamp[2];
1488 u16 reason; 1488 * u16 reason;
1489 u16 status; 1489 * u16 status;
1490*/ 1490 */
1491 1491
1492#define RTLLIB_DEFAULT_TX_ESSID "Penguin" 1492#define RTLLIB_DEFAULT_TX_ESSID "Penguin"
1493#define RTLLIB_DEFAULT_BASIC_RATE 2 1493#define RTLLIB_DEFAULT_BASIC_RATE 2
@@ -2085,14 +2085,16 @@ struct rtllib_device {
2085 spinlock_t wpax_suitlist_lock; 2085 spinlock_t wpax_suitlist_lock;
2086 2086
2087 int tx_headroom; /* Set to size of any additional room needed at front 2087 int tx_headroom; /* Set to size of any additional room needed at front
2088 * of allocated Tx SKBs */ 2088 * of allocated Tx SKBs
2089 */
2089 u32 config; 2090 u32 config;
2090 2091
2091 /* WEP and other encryption related settings at the device level */ 2092 /* WEP and other encryption related settings at the device level */
2092 int open_wep; /* Set to 1 to allow unencrypted frames */ 2093 int open_wep; /* Set to 1 to allow unencrypted frames */
2093 int auth_mode; 2094 int auth_mode;
2094 int reset_on_keychange; /* Set to 1 if the HW needs to be reset on 2095 int reset_on_keychange; /* Set to 1 if the HW needs to be reset on
2095 * WEP key changes */ 2096 * WEP key changes
2097 */
2096 2098
2097 /* If the host performs {en,de}cryption, then set to 1 */ 2099 /* If the host performs {en,de}cryption, then set to 1 */
2098 int host_encrypt; 2100 int host_encrypt;
@@ -2362,7 +2364,7 @@ struct rtllib_device {
2362 /* OK this is complementing to data_poll_hard_stop */ 2364 /* OK this is complementing to data_poll_hard_stop */
2363 void (*data_hard_resume)(struct net_device *dev); 2365 void (*data_hard_resume)(struct net_device *dev);
2364 2366
2365 /* ask to the driver to retune the radio . 2367 /* ask to the driver to retune the radio.
2366 * This function can sleep. the driver should ensure 2368 * This function can sleep. the driver should ensure
2367 * the radio has been switched before return. 2369 * the radio has been switched before return.
2368 */ 2370 */
@@ -2456,7 +2458,8 @@ struct rtllib_device {
2456 void (*rtllib_rfkill_poll)(struct net_device *dev); 2458 void (*rtllib_rfkill_poll)(struct net_device *dev);
2457 2459
2458 /* This must be the last item so that it points to the data 2460 /* This must be the last item so that it points to the data
2459 * allocated beyond this structure by alloc_rtllib */ 2461 * allocated beyond this structure by alloc_rtllib
2462 */
2460 u8 priv[0]; 2463 u8 priv[0];
2461}; 2464};
2462 2465
@@ -2485,7 +2488,8 @@ struct rtllib_device {
2485 2488
2486/* The ieee802.11 stack will manage the netif queue 2489/* The ieee802.11 stack will manage the netif queue
2487 * wake/stop for the driver, taking care of 802.11 2490 * wake/stop for the driver, taking care of 802.11
2488 * fragmentation. See softmac.c for details. */ 2491 * fragmentation. See softmac.c for details.
2492 */
2489#define IEEE_SOFTMAC_TX_QUEUE (1<<7) 2493#define IEEE_SOFTMAC_TX_QUEUE (1<<7)
2490 2494
2491/* Uses only the softmac_data_hard_start_xmit 2495/* Uses only the softmac_data_hard_start_xmit
@@ -2522,11 +2526,9 @@ static inline int rtllib_is_empty_essid(const char *essid, int essid_len)
2522 2526
2523static inline int rtllib_is_valid_mode(struct rtllib_device *ieee, int mode) 2527static inline int rtllib_is_valid_mode(struct rtllib_device *ieee, int mode)
2524{ 2528{
2525 /* 2529 /* It is possible for both access points and our device to support
2526 * It is possible for both access points and our device to support
2527 * combinations of modes, so as long as there is one valid combination 2530 * combinations of modes, so as long as there is one valid combination
2528 * of ap/device supported modes, then return success 2531 * of ap/device supported modes, then return success
2529 *
2530 */ 2532 */
2531 if ((mode & IEEE_A) && 2533 if ((mode & IEEE_A) &&
2532 (ieee->modulation & RTLLIB_OFDM_MODULATION) && 2534 (ieee->modulation & RTLLIB_OFDM_MODULATION) &&
diff --git a/drivers/staging/rtl8192e/rtllib_crypt.c b/drivers/staging/rtl8192e/rtllib_crypt.c
index 807ba1b92447..1e6ae9bead23 100644
--- a/drivers/staging/rtl8192e/rtllib_crypt.c
+++ b/drivers/staging/rtl8192e/rtllib_crypt.c
@@ -87,7 +87,8 @@ void rtllib_crypt_delayed_deinit(struct lib80211_crypt_info *info,
87 87
88 /* must not run ops->deinit() while there may be pending encrypt or 88 /* must not run ops->deinit() while there may be pending encrypt or
89 * decrypt operations. Use a list of delayed deinits to avoid needing 89 * decrypt operations. Use a list of delayed deinits to avoid needing
90 * locking. */ 90 * locking.
91 */
91 92
92 spin_lock_irqsave(info->lock, flags); 93 spin_lock_irqsave(info->lock, flags);
93 list_add(&tmp->list, &info->crypt_deinit_list); 94 list_add(&tmp->list, &info->crypt_deinit_list);
diff --git a/drivers/staging/rtl8192e/rtllib_crypt.h b/drivers/staging/rtl8192e/rtllib_crypt.h
index e177c9287b44..b8cf59f39a60 100644
--- a/drivers/staging/rtl8192e/rtllib_crypt.h
+++ b/drivers/staging/rtl8192e/rtllib_crypt.h
@@ -17,8 +17,7 @@
17 * more details. 17 * more details.
18 */ 18 */
19 19
20/* 20/* This file defines the interface to the rtllib crypto module.
21 * This file defines the interface to the rtllib crypto module.
22 */ 21 */
23#ifndef RTLLIB_CRYPT_H 22#ifndef RTLLIB_CRYPT_H
24#define RTLLIB_CRYPT_H 23#define RTLLIB_CRYPT_H
diff --git a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c
index c0b8bb289e7d..505d466a6a8d 100644
--- a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c
+++ b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c
@@ -140,7 +140,8 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm,
140 * Flag (Include authentication header, M=3 (8-octet MIC), 140 * Flag (Include authentication header, M=3 (8-octet MIC),
141 * L=1 (2-octet Dlen)) 141 * L=1 (2-octet Dlen))
142 * Nonce: 0x00 | A2 | PN 142 * Nonce: 0x00 | A2 | PN
143 * Dlen */ 143 * Dlen
144 */
144 b0[0] = 0x59; 145 b0[0] = 0x59;
145 b0[1] = qc; 146 b0[1] = qc;
146 memcpy(b0 + 2, hdr->addr2, ETH_ALEN); 147 memcpy(b0 + 2, hdr->addr2, ETH_ALEN);
diff --git a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
index ccf85309b4b6..656b4b359c50 100644
--- a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
+++ b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
@@ -249,7 +249,8 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
249 u16 IV16) 249 u16 IV16)
250{ 250{
251 /* Make temporary area overlap WEP seed so that the final copy can be 251 /* Make temporary area overlap WEP seed so that the final copy can be
252 * avoided on little endian hosts. */ 252 * avoided on little endian hosts.
253 */
253 u16 *PPK = (u16 *) &WEPSeed[4]; 254 u16 *PPK = (u16 *) &WEPSeed[4];
254 255
255 /* Step 1 - make copy of TTAK and bring in TSC */ 256 /* Step 1 - make copy of TTAK and bring in TSC */
@@ -276,7 +277,8 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
276 PPK[5] += RotR1(PPK[4]); 277 PPK[5] += RotR1(PPK[4]);
277 278
278 /* Step 3 - bring in last of TK bits, assign 24-bit WEP IV value 279 /* Step 3 - bring in last of TK bits, assign 24-bit WEP IV value
279 * WEPSeed[0..2] is transmitted as WEP IV */ 280 * WEPSeed[0..2] is transmitted as WEP IV
281 */
280 WEPSeed[0] = Hi8(IV16); 282 WEPSeed[0] = Hi8(IV16);
281 WEPSeed[1] = (Hi8(IV16) | 0x20) & 0x7F; 283 WEPSeed[1] = (Hi8(IV16) | 0x20) & 0x7F;
282 WEPSeed[2] = Lo8(IV16); 284 WEPSeed[2] = Lo8(IV16);
@@ -470,7 +472,8 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
470 if (iv32 != tkey->rx_iv32) { 472 if (iv32 != tkey->rx_iv32) {
471 /* Previously cached Phase1 result was already 473 /* Previously cached Phase1 result was already
472 * lost, so it needs to be recalculated for the 474 * lost, so it needs to be recalculated for the
473 * next packet. */ 475 * next packet.
476 */
474 tkey->rx_phase1_done = 0; 477 tkey->rx_phase1_done = 0;
475 } 478 }
476 if (net_ratelimit()) { 479 if (net_ratelimit()) {
@@ -485,7 +488,8 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
485 } 488 }
486 489
487 /* Update real counters only after Michael MIC verification has 490 /* Update real counters only after Michael MIC verification has
488 * completed */ 491 * completed
492 */
489 tkey->rx_iv32_new = iv32; 493 tkey->rx_iv32_new = iv32;
490 tkey->rx_iv16_new = iv16; 494 tkey->rx_iv16_new = iv16;
491 495
@@ -639,7 +643,8 @@ static int rtllib_michael_mic_verify(struct sk_buff *skb, int keyidx,
639 } 643 }
640 644
641 /* Update TSC counters for RX now that the packet verification has 645 /* Update TSC counters for RX now that the packet verification has
642 * completed. */ 646 * completed.
647 */
643 tkey->rx_iv32 = tkey->rx_iv32_new; 648 tkey->rx_iv32 = tkey->rx_iv32_new;
644 tkey->rx_iv16 = tkey->rx_iv16_new; 649 tkey->rx_iv16 = tkey->rx_iv16_new;
645 650
diff --git a/drivers/staging/rtl8192e/rtllib_crypt_wep.c b/drivers/staging/rtl8192e/rtllib_crypt_wep.c
index 06c79fabdcd3..21d7eee4c9a9 100644
--- a/drivers/staging/rtl8192e/rtllib_crypt_wep.c
+++ b/drivers/staging/rtl8192e/rtllib_crypt_wep.c
@@ -121,7 +121,8 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
121 121
122 /* Fluhrer, Mantin, and Shamir have reported weaknesses in the key 122 /* Fluhrer, Mantin, and Shamir have reported weaknesses in the key
123 * scheduling algorithm of RC4. At least IVs (KeyByte + 3, 0xff, N) 123 * scheduling algorithm of RC4. At least IVs (KeyByte + 3, 0xff, N)
124 * can be used to speedup attacks, so avoid using them. */ 124 * can be used to speedup attacks, so avoid using them.
125 */
125 if ((wep->iv & 0xff00) == 0xff00) { 126 if ((wep->iv & 0xff00) == 0xff00) {
126 u8 B = (wep->iv >> 16) & 0xff; 127 u8 B = (wep->iv >> 16) & 0xff;
127 128
diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
index c17112396d45..c1418b457a45 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -143,7 +143,8 @@ rtllib_frag_cache_get(struct rtllib_device *ieee,
143 memcpy(entry->dst_addr, hdr->addr1, ETH_ALEN); 143 memcpy(entry->dst_addr, hdr->addr1, ETH_ALEN);
144 } else { 144 } else {
145 /* received a fragment of a frame for which the head fragment 145 /* received a fragment of a frame for which the head fragment
146 * should have already been received */ 146 * should have already been received
147 */
147 entry = rtllib_frag_cache_find(ieee, seq, frag, tid, hdr->addr2, 148 entry = rtllib_frag_cache_find(ieee, seq, frag, tid, hdr->addr2,
148 hdr->addr1); 149 hdr->addr1);
149 if (entry != NULL) { 150 if (entry != NULL) {
@@ -199,7 +200,8 @@ static int rtllib_frag_cache_invalidate(struct rtllib_device *ieee,
199 * 200 *
200 * Responsible for handling management control frames 201 * Responsible for handling management control frames
201 * 202 *
202 * Called by rtllib_rx */ 203 * Called by rtllib_rx
204 */
203static inline int 205static inline int
204rtllib_rx_frame_mgmt(struct rtllib_device *ieee, struct sk_buff *skb, 206rtllib_rx_frame_mgmt(struct rtllib_device *ieee, struct sk_buff *skb,
205 struct rtllib_rx_stats *rx_stats, u16 type, 207 struct rtllib_rx_stats *rx_stats, u16 type,
@@ -224,8 +226,9 @@ rtllib_rx_frame_mgmt(struct rtllib_device *ieee, struct sk_buff *skb,
224 return 0; 226 return 0;
225} 227}
226 228
227/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ 229/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation
228/* Ethernet-II snap header (RFC1042 for most EtherTypes) */ 230 * Ethernet-II snap header (RFC1042 for most EtherTypes)
231 */
229static unsigned char rfc1042_header[] = { 232static unsigned char rfc1042_header[] = {
230 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 233 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00
231}; 234};
@@ -482,7 +485,8 @@ void rtllib_indicate_packets(struct rtllib_device *ieee, struct rtllib_rxb **prx
482 ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) || 485 ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
483 memcmp(sub_skb->data, bridge_tunnel_header, SNAP_SIZE) == 0)) { 486 memcmp(sub_skb->data, bridge_tunnel_header, SNAP_SIZE) == 0)) {
484 /* remove RFC1042 or Bridge-Tunnel encapsulation 487 /* remove RFC1042 or Bridge-Tunnel encapsulation
485 * and replace EtherType */ 488 * and replace EtherType
489 */
486 skb_pull(sub_skb, SNAP_SIZE); 490 skb_pull(sub_skb, SNAP_SIZE);
487 memcpy(skb_push(sub_skb, ETH_ALEN), prxb->src, ETH_ALEN); 491 memcpy(skb_push(sub_skb, ETH_ALEN), prxb->src, ETH_ALEN);
488 memcpy(skb_push(sub_skb, ETH_ALEN), prxb->dst, ETH_ALEN); 492 memcpy(skb_push(sub_skb, ETH_ALEN), prxb->dst, ETH_ALEN);
@@ -582,8 +586,7 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee,
582 return; 586 return;
583 } 587 }
584 588
585 /* 589 /* Sliding window manipulation. Conditions includes:
586 * Sliding window manipulation. Conditions includes:
587 * 1. Incoming SeqNum is equal to WinStart =>Window shift 1 590 * 1. Incoming SeqNum is equal to WinStart =>Window shift 1
588 * 2. Incoming SeqNum is larger than the WinEnd => Window shift N 591 * 2. Incoming SeqNum is larger than the WinEnd => Window shift N
589 */ 592 */
@@ -598,13 +601,12 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee,
598 RTLLIB_DEBUG(RTLLIB_DL_REORDER, "Window Shift! IndicateSeq: %d, NewSeq: %d\n", pTS->RxIndicateSeq, SeqNum); 601 RTLLIB_DEBUG(RTLLIB_DL_REORDER, "Window Shift! IndicateSeq: %d, NewSeq: %d\n", pTS->RxIndicateSeq, SeqNum);
599 } 602 }
600 603
601 /* 604 /* Indication process.
602 * Indication process.
603 * After Packet dropping and Sliding Window shifting as above, we can 605 * After Packet dropping and Sliding Window shifting as above, we can
604 * now just indicate the packets with the SeqNum smaller than latest 606 * now just indicate the packets with the SeqNum smaller than latest
605 * WinStart and struct buffer other packets. 607 * WinStart and struct buffer other packets.
606 */ 608 *
607 /* For Rx Reorder condition: 609 * For Rx Reorder condition:
608 * 1. All packets with SeqNum smaller than WinStart => Indicate 610 * 1. All packets with SeqNum smaller than WinStart => Indicate
609 * 2. All packets with SeqNum larger than or equal to 611 * 2. All packets with SeqNum larger than or equal to
610 * WinStart => Buffer it. 612 * WinStart => Buffer it.
@@ -647,8 +649,7 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee,
647 pTS->RxIndicateSeq, SeqNum); 649 pTS->RxIndicateSeq, SeqNum);
648 } 650 }
649 } else { 651 } else {
650 /* 652 /* Packets are dropped if there are not enough reorder
651 * Packets are dropped if there are not enough reorder
652 * entries. This part should be modified!! We can just 653 * entries. This part should be modified!! We can just
653 * indicate all the packets in struct buffer and get 654 * indicate all the packets in struct buffer and get
654 * reorder entries. 655 * reorder entries.
@@ -698,7 +699,8 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee,
698 } 699 }
699 700
700 /* Handling pending timer. Set this timer to prevent from long time 701 /* Handling pending timer. Set this timer to prevent from long time
701 * Rx buffering.*/ 702 * Rx buffering.
703 */
702 if (index > 0) { 704 if (index > 0) {
703 if (timer_pending(&pTS->RxPktPendingTimer)) 705 if (timer_pending(&pTS->RxPktPendingTimer))
704 del_timer_sync(&pTS->RxPktPendingTimer); 706 del_timer_sync(&pTS->RxPktPendingTimer);
@@ -973,7 +975,8 @@ static int rtllib_rx_data_filter(struct rtllib_device *ieee, u16 fc,
973 } 975 }
974 976
975 /* Nullfunc frames may have PS-bit set, so they must be passed to 977 /* Nullfunc frames may have PS-bit set, so they must be passed to
976 * hostap_handle_sta_rx() before being dropped here. */ 978 * hostap_handle_sta_rx() before being dropped here.
979 */
977 if (!ieee->IntelPromiscuousModeInfo.bPromiscuousOn) { 980 if (!ieee->IntelPromiscuousModeInfo.bPromiscuousOn) {
978 if (stype != RTLLIB_STYPE_DATA && 981 if (stype != RTLLIB_STYPE_DATA &&
979 stype != RTLLIB_STYPE_DATA_CFACK && 982 stype != RTLLIB_STYPE_DATA_CFACK &&
@@ -1015,7 +1018,8 @@ static int rtllib_rx_get_crypt(struct rtllib_device *ieee, struct sk_buff *skb,
1015 1018
1016 *crypt = ieee->crypt_info.crypt[idx]; 1019 *crypt = ieee->crypt_info.crypt[idx];
1017 /* allow NULL decrypt to indicate an station specific override 1020 /* allow NULL decrypt to indicate an station specific override
1018 * for default encryption */ 1021 * for default encryption
1022 */
1019 if (*crypt && ((*crypt)->ops == NULL || 1023 if (*crypt && ((*crypt)->ops == NULL ||
1020 (*crypt)->ops->decrypt_mpdu == NULL)) 1024 (*crypt)->ops->decrypt_mpdu == NULL))
1021 *crypt = NULL; 1025 *crypt = NULL;
@@ -1024,7 +1028,8 @@ static int rtllib_rx_get_crypt(struct rtllib_device *ieee, struct sk_buff *skb,
1024 /* This seems to be triggered by some (multicast?) 1028 /* This seems to be triggered by some (multicast?)
1025 * frames from other than current BSS, so just drop the 1029 * frames from other than current BSS, so just drop the
1026 * frames silently instead of filling system log with 1030 * frames silently instead of filling system log with
1027 * these reports. */ 1031 * these reports.
1032 */
1028 RTLLIB_DEBUG_DROP("Decryption failed (not set) (SA= %pM)\n", 1033 RTLLIB_DEBUG_DROP("Decryption failed (not set) (SA= %pM)\n",
1029 hdr->addr2); 1034 hdr->addr2);
1030 ieee->ieee_stats.rx_discards_undecryptable++; 1035 ieee->ieee_stats.rx_discards_undecryptable++;
@@ -1088,11 +1093,13 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb,
1088 1093
1089 if (frag == 0) { 1094 if (frag == 0) {
1090 /* copy first fragment (including full headers) into 1095 /* copy first fragment (including full headers) into
1091 * beginning of the fragment cache skb */ 1096 * beginning of the fragment cache skb
1097 */
1092 memcpy(skb_put(frag_skb, flen), skb->data, flen); 1098 memcpy(skb_put(frag_skb, flen), skb->data, flen);
1093 } else { 1099 } else {
1094 /* append frame payload to the end of the fragment 1100 /* append frame payload to the end of the fragment
1095 * cache skb */ 1101 * cache skb
1102 */
1096 memcpy(skb_put(frag_skb, flen), skb->data + hdrlen, 1103 memcpy(skb_put(frag_skb, flen), skb->data + hdrlen,
1097 flen); 1104 flen);
1098 } 1105 }
@@ -1102,19 +1109,22 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb,
1102 if (fc & RTLLIB_FCTL_MOREFRAGS) { 1109 if (fc & RTLLIB_FCTL_MOREFRAGS) {
1103 /* more fragments expected - leave the skb in fragment 1110 /* more fragments expected - leave the skb in fragment
1104 * cache for now; it will be delivered to upper layers 1111 * cache for now; it will be delivered to upper layers
1105 * after all fragments have been received */ 1112 * after all fragments have been received
1113 */
1106 return -2; 1114 return -2;
1107 } 1115 }
1108 1116
1109 /* this was the last fragment and the frame will be 1117 /* this was the last fragment and the frame will be
1110 * delivered, so remove skb from fragment cache */ 1118 * delivered, so remove skb from fragment cache
1119 */
1111 skb = frag_skb; 1120 skb = frag_skb;
1112 hdr = (struct rtllib_hdr_4addr *) skb->data; 1121 hdr = (struct rtllib_hdr_4addr *) skb->data;
1113 rtllib_frag_cache_invalidate(ieee, hdr); 1122 rtllib_frag_cache_invalidate(ieee, hdr);
1114 } 1123 }
1115 1124
1116 /* skb: hdr + (possible reassembled) full MSDU payload; possibly still 1125 /* skb: hdr + (possible reassembled) full MSDU payload; possibly still
1117 * encrypted/authenticated */ 1126 * encrypted/authenticated
1127 */
1118 if (ieee->host_decrypt && (fc & RTLLIB_FCTL_WEP) && 1128 if (ieee->host_decrypt && (fc & RTLLIB_FCTL_WEP) &&
1119 rtllib_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt)) { 1129 rtllib_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt)) {
1120 netdev_info(ieee->dev, "%s: ==>decrypt msdu error\n", __func__); 1130 netdev_info(ieee->dev, "%s: ==>decrypt msdu error\n", __func__);
@@ -1127,7 +1137,8 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb,
1127 rtllib_is_eapol_frame(ieee, skb, hdrlen)) { 1137 rtllib_is_eapol_frame(ieee, skb, hdrlen)) {
1128 1138
1129 /* pass unencrypted EAPOL frames even if encryption is 1139 /* pass unencrypted EAPOL frames even if encryption is
1130 * configured */ 1140 * configured
1141 */
1131 struct eapol *eap = (struct eapol *)(skb->data + 1142 struct eapol *eap = (struct eapol *)(skb->data +
1132 24); 1143 24);
1133 RTLLIB_DEBUG_EAP("RX: IEEE 802.1X EAPOL frame: %s\n", 1144 RTLLIB_DEBUG_EAP("RX: IEEE 802.1X EAPOL frame: %s\n",
@@ -1204,7 +1215,8 @@ static void rtllib_rx_indicate_pkt_legacy(struct rtllib_device *ieee,
1204 ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) || 1215 ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
1205 memcmp(sub_skb->data, bridge_tunnel_header, SNAP_SIZE) == 0)) { 1216 memcmp(sub_skb->data, bridge_tunnel_header, SNAP_SIZE) == 0)) {
1206 /* remove RFC1042 or Bridge-Tunnel encapsulation and 1217 /* remove RFC1042 or Bridge-Tunnel encapsulation and
1207 * replace EtherType */ 1218 * replace EtherType
1219 */
1208 skb_pull(sub_skb, SNAP_SIZE); 1220 skb_pull(sub_skb, SNAP_SIZE);
1209 memcpy(skb_push(sub_skb, ETH_ALEN), src, ETH_ALEN); 1221 memcpy(skb_push(sub_skb, ETH_ALEN), src, ETH_ALEN);
1210 memcpy(skb_push(sub_skb, ETH_ALEN), dst, ETH_ALEN); 1222 memcpy(skb_push(sub_skb, ETH_ALEN), dst, ETH_ALEN);
@@ -1396,7 +1408,8 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb,
1396 1408
1397 /* Returning 0 indicates to caller that we have not handled the SKB-- 1409 /* Returning 0 indicates to caller that we have not handled the SKB--
1398 * so it is still allocated and can be used again by underlying 1410 * so it is still allocated and can be used again by underlying
1399 * hardware as a DMA target */ 1411 * hardware as a DMA target
1412 */
1400 return 0; 1413 return 0;
1401} 1414}
1402 1415
@@ -1442,7 +1455,8 @@ static int rtllib_rx_Mesh(struct rtllib_device *ieee, struct sk_buff *skb,
1442 1455
1443/* All received frames are sent to this function. @skb contains the frame in 1456/* All received frames are sent to this function. @skb contains the frame in
1444 * IEEE 802.11 format, i.e., in the format it was sent over air. 1457 * IEEE 802.11 format, i.e., in the format it was sent over air.
1445 * This function is called only as a tasklet (software IRQ). */ 1458 * This function is called only as a tasklet (software IRQ).
1459 */
1446int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb, 1460int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb,
1447 struct rtllib_rx_stats *rx_stats) 1461 struct rtllib_rx_stats *rx_stats)
1448{ 1462{
@@ -1488,10 +1502,7 @@ EXPORT_SYMBOL(rtllib_rx);
1488 1502
1489static u8 qos_oui[QOS_OUI_LEN] = { 0x00, 0x50, 0xF2 }; 1503static u8 qos_oui[QOS_OUI_LEN] = { 0x00, 0x50, 0xF2 };
1490 1504
1491/* 1505/* Make ther structure we read from the beacon packet has the right values */
1492* Make ther structure we read from the beacon packet has
1493* the right values
1494*/
1495static int rtllib_verify_qos_info(struct rtllib_qos_information_element 1506static int rtllib_verify_qos_info(struct rtllib_qos_information_element
1496 *info_element, int sub_type) 1507 *info_element, int sub_type)
1497{ 1508{
@@ -1509,9 +1520,7 @@ static int rtllib_verify_qos_info(struct rtllib_qos_information_element
1509} 1520}
1510 1521
1511 1522
1512/* 1523/* Parse a QoS parameter element */
1513 * Parse a QoS parameter element
1514 */
1515static int rtllib_read_qos_param_element(struct rtllib_qos_parameter_info 1524static int rtllib_read_qos_param_element(struct rtllib_qos_parameter_info
1516 *element_param, struct rtllib_info_element 1525 *element_param, struct rtllib_info_element
1517 *info_element) 1526 *info_element)
@@ -1535,9 +1544,7 @@ static int rtllib_read_qos_param_element(struct rtllib_qos_parameter_info
1535 return ret; 1544 return ret;
1536} 1545}
1537 1546
1538/* 1547/* Parse a QoS information element */
1539 * Parse a QoS information element
1540 */
1541static int rtllib_read_qos_info_element(struct 1548static int rtllib_read_qos_info_element(struct
1542 rtllib_qos_information_element 1549 rtllib_qos_information_element
1543 *element_info, struct rtllib_info_element 1550 *element_info, struct rtllib_info_element
@@ -1566,9 +1573,7 @@ static int rtllib_read_qos_info_element(struct
1566} 1573}
1567 1574
1568 1575
1569/* 1576/* Write QoS parameters from the ac parameters. */
1570 * Write QoS parameters from the ac parameters.
1571 */
1572static int rtllib_qos_convert_ac_to_parameters(struct rtllib_qos_parameter_info *param_elm, 1577static int rtllib_qos_convert_ac_to_parameters(struct rtllib_qos_parameter_info *param_elm,
1573 struct rtllib_qos_data *qos_data) 1578 struct rtllib_qos_data *qos_data)
1574{ 1579{
@@ -1627,8 +1632,7 @@ static int rtllib_qos_convert_ac_to_parameters(struct rtllib_qos_parameter_info
1627 return 0; 1632 return 0;
1628} 1633}
1629 1634
1630/* 1635/* we have a generic data element which it may contain QoS information or
1631 * we have a generic data element which it may contain QoS information or
1632 * parameters element. check the information element length to decide 1636 * parameters element. check the information element length to decide
1633 * which type to read 1637 * which type to read
1634 */ 1638 */
@@ -1750,7 +1754,8 @@ int rtllib_parse_info_param(struct rtllib_device *ieee,
1750 length, info_element->id); 1754 length, info_element->id);
1751 /* We stop processing but don't return an error here 1755 /* We stop processing but don't return an error here
1752 * because some misbehaviour APs break this rule. ie. 1756 * because some misbehaviour APs break this rule. ie.
1753 * Orinoco AP1000. */ 1757 * Orinoco AP1000.
1758 */
1754 break; 1759 break;
1755 } 1760 }
1756 1761
@@ -2302,7 +2307,8 @@ static inline int is_same_network(struct rtllib_network *src,
2302 /* A network is only a duplicate if the channel, BSSID, ESSID 2307 /* A network is only a duplicate if the channel, BSSID, ESSID
2303 * and the capability field (in particular IBSS and BSS) all match. 2308 * and the capability field (in particular IBSS and BSS) all match.
2304 * We treat all <hidden> with the same BSSID and channel 2309 * We treat all <hidden> with the same BSSID and channel
2305 * as one network */ 2310 * as one network
2311 */
2306 return (((src->ssid_len == dst->ssid_len) || (!ssidbroad)) && 2312 return (((src->ssid_len == dst->ssid_len) || (!ssidbroad)) &&
2307 (src->channel == dst->channel) && 2313 (src->channel == dst->channel) &&
2308 !memcmp(src->bssid, dst->bssid, ETH_ALEN) && 2314 !memcmp(src->bssid, dst->bssid, ETH_ALEN) &&
@@ -2524,10 +2530,12 @@ static inline void rtllib_process_probe_response(
2524 * 2530 *
2525 * NOTE: This search is definitely not optimized. Once its doing 2531 * NOTE: This search is definitely not optimized. Once its doing
2526 * the "right thing" we'll optimize it for efficiency if 2532 * the "right thing" we'll optimize it for efficiency if
2527 * necessary */ 2533 * necessary
2534 */
2528 2535
2529 /* Search for this entry in the list and update it if it is 2536 /* Search for this entry in the list and update it if it is
2530 * already there. */ 2537 * already there.
2538 */
2531 2539
2532 spin_lock_irqsave(&ieee->lock, flags); 2540 spin_lock_irqsave(&ieee->lock, flags);
2533 if (is_same_network(&ieee->current_network, network, 2541 if (is_same_network(&ieee->current_network, network,
@@ -2556,7 +2564,8 @@ static inline void rtllib_process_probe_response(
2556 } 2564 }
2557 2565
2558 /* If we didn't find a match, then get a new network slot to initialize 2566 /* If we didn't find a match, then get a new network slot to initialize
2559 * with this beacon's information */ 2567 * with this beacon's information
2568 */
2560 if (&target->list == &ieee->network_list) { 2569 if (&target->list == &ieee->network_list) {
2561 if (list_empty(&ieee->network_free_list)) { 2570 if (list_empty(&ieee->network_free_list)) {
2562 /* If there are no more slots, expire the oldest */ 2571 /* If there are no more slots, expire the oldest */
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index c043d8cb6c8a..23b7a4c3b699 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -68,7 +68,8 @@ static void rtllib_MFIE_Brate(struct rtllib_device *ieee, u8 **tag_p)
68 } 68 }
69 69
70 /* We may add an option for custom rates that specific HW 70 /* We may add an option for custom rates that specific HW
71 * might support */ 71 * might support
72 */
72 *tag_p = tag; 73 *tag_p = tag;
73} 74}
74 75
@@ -89,7 +90,8 @@ static void rtllib_MFIE_Grate(struct rtllib_device *ieee, u8 **tag_p)
89 *tag++ = RTLLIB_BASIC_RATE_MASK | RTLLIB_OFDM_RATE_54MB; 90 *tag++ = RTLLIB_BASIC_RATE_MASK | RTLLIB_OFDM_RATE_54MB;
90 } 91 }
91 /* We may add an option for custom rates that specific HW might 92 /* We may add an option for custom rates that specific HW might
92 * support */ 93 * support
94 */
93 *tag_p = tag; 95 *tag_p = tag;
94} 96}
95 97
@@ -133,8 +135,7 @@ static void enqueue_mgmt(struct rtllib_device *ieee, struct sk_buff *skb)
133 135
134 nh = (ieee->mgmt_queue_head + 1) % MGMT_QUEUE_NUM; 136 nh = (ieee->mgmt_queue_head + 1) % MGMT_QUEUE_NUM;
135 137
136/* 138/* if the queue is full but we have newer frames then
137 * if the queue is full but we have newer frames then
138 * just overwrites the oldest. 139 * just overwrites the oldest.
139 * 140 *
140 * if (nh == ieee->mgmt_queue_tail) 141 * if (nh == ieee->mgmt_queue_tail)
@@ -273,10 +274,11 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct rtllib_device *ieee)
273 if (!ieee->check_nic_enough_desc(ieee->dev, tcb_desc->queue_index) || 274 if (!ieee->check_nic_enough_desc(ieee->dev, tcb_desc->queue_index) ||
274 (skb_queue_len(&ieee->skb_waitQ[tcb_desc->queue_index]) != 0) || 275 (skb_queue_len(&ieee->skb_waitQ[tcb_desc->queue_index]) != 0) ||
275 (ieee->queue_stop)) { 276 (ieee->queue_stop)) {
276 /* insert the skb packet to the management queue */ 277 /* insert the skb packet to the management queue
277 /* as for the completion function, it does not need 278 *
279 * as for the completion function, it does not need
278 * to check it any more. 280 * to check it any more.
279 * */ 281 */
280 netdev_info(ieee->dev, 282 netdev_info(ieee->dev,
281 "%s():insert to waitqueue, queue_index:%d!\n", 283 "%s():insert to waitqueue, queue_index:%d!\n",
282 __func__, tcb_desc->queue_index); 284 __func__, tcb_desc->queue_index);
@@ -417,10 +419,7 @@ static void rtllib_send_beacon_cb(unsigned long _ieee)
417 spin_unlock_irqrestore(&ieee->beacon_lock, flags); 419 spin_unlock_irqrestore(&ieee->beacon_lock, flags);
418} 420}
419 421
420/* 422/* Enables network monitor mode, all rx packets will be received. */
421 * Description:
422 * Enable network monitor mode, all rx packets will be received.
423 */
424void rtllib_EnableNetMonitorMode(struct net_device *dev, 423void rtllib_EnableNetMonitorMode(struct net_device *dev,
425 bool bInitState) 424 bool bInitState)
426{ 425{
@@ -432,10 +431,8 @@ void rtllib_EnableNetMonitorMode(struct net_device *dev,
432} 431}
433 432
434 433
435/* 434/* Disables network monitor mode. Only packets destinated to
436 * Description: 435 * us will be received.
437 * Disable network network monitor mode, only packets destinated to
438 * us will be received.
439 */ 436 */
440void rtllib_DisableNetMonitorMode(struct net_device *dev, 437void rtllib_DisableNetMonitorMode(struct net_device *dev,
441 bool bInitState) 438 bool bInitState)
@@ -448,9 +445,7 @@ void rtllib_DisableNetMonitorMode(struct net_device *dev,
448} 445}
449 446
450 447
451/* 448/* Enables the specialized promiscuous mode required by Intel.
452 * Description:
453 * This enables the specialized promiscuous mode required by Intel.
454 * In this mode, Intel intends to hear traffics from/to other STAs in the 449 * In this mode, Intel intends to hear traffics from/to other STAs in the
455 * same BSS. Therefore we don't have to disable checking BSSID and we only need 450 * same BSS. Therefore we don't have to disable checking BSSID and we only need
456 * to allow all dest. BUT: if we enable checking BSSID then we can't recv 451 * to allow all dest. BUT: if we enable checking BSSID then we can't recv
@@ -474,10 +469,8 @@ void rtllib_EnableIntelPromiscuousMode(struct net_device *dev,
474EXPORT_SYMBOL(rtllib_EnableIntelPromiscuousMode); 469EXPORT_SYMBOL(rtllib_EnableIntelPromiscuousMode);
475 470
476 471
477/* 472/* Disables the specialized promiscuous mode required by Intel.
478 * Description: 473 * See MgntEnableIntelPromiscuousMode for detail.
479 * This disables the specialized promiscuous mode required by Intel.
480 * See MgntEnableIntelPromiscuousMode for detail.
481 */ 474 */
482void rtllib_DisableIntelPromiscuousMode(struct net_device *dev, 475void rtllib_DisableIntelPromiscuousMode(struct net_device *dev,
483 bool bInitState) 476 bool bInitState)
@@ -1709,8 +1702,8 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee,
1709 (!apset && ssidset && ssidbroad && ssidmatch) || 1702 (!apset && ssidset && ssidbroad && ssidmatch) ||
1710 (ieee->is_roaming && ssidset && ssidbroad && ssidmatch)) { 1703 (ieee->is_roaming && ssidset && ssidbroad && ssidmatch)) {
1711 /* if the essid is hidden replace it with the 1704 /* if the essid is hidden replace it with the
1712 * essid provided by the user. 1705 * essid provided by the user.
1713 */ 1706 */
1714 if (!ssidbroad) { 1707 if (!ssidbroad) {
1715 strncpy(tmp_ssid, ieee->current_network.ssid, 1708 strncpy(tmp_ssid, ieee->current_network.ssid,
1716 IW_ESSID_MAX_SIZE); 1709 IW_ESSID_MAX_SIZE);
@@ -2008,7 +2001,8 @@ static short rtllib_sta_ps_sleep(struct rtllib_device *ieee, u64 *time)
2008 timeout = ieee->current_network.beacon_interval; 2001 timeout = ieee->current_network.beacon_interval;
2009 ieee->current_network.dtim_data = RTLLIB_DTIM_INVALID; 2002 ieee->current_network.dtim_data = RTLLIB_DTIM_INVALID;
2010 /* there's no need to nofity AP that I find you buffered 2003 /* there's no need to nofity AP that I find you buffered
2011 * with broadcast packet */ 2004 * with broadcast packet
2005 */
2012 if (dtim & (RTLLIB_DTIM_UCAST & ieee->ps)) 2006 if (dtim & (RTLLIB_DTIM_UCAST & ieee->ps))
2013 return 2; 2007 return 2;
2014 2008
@@ -2348,8 +2342,7 @@ static void rtllib_rx_auth_resp(struct rtllib_device *ieee, struct sk_buff *skb)
2348 } 2342 }
2349 } 2343 }
2350 } 2344 }
2351 /* Dummy wirless mode setting to avoid 2345 /* Dummy wirless mode setting to avoid encryption issue */
2352 * encryption issue */
2353 if (bSupportNmode) { 2346 if (bSupportNmode) {
2354 ieee->SetWirelessMode(ieee->dev, 2347 ieee->SetWirelessMode(ieee->dev,
2355 ieee->current_network.mode); 2348 ieee->current_network.mode);
@@ -2395,8 +2388,8 @@ inline int rtllib_rx_deauth(struct rtllib_device *ieee, struct sk_buff *skb)
2395 return 0; 2388 return 0;
2396 2389
2397 /* FIXME for now repeat all the association procedure 2390 /* FIXME for now repeat all the association procedure
2398 * both for disassociation and deauthentication 2391 * both for disassociation and deauthentication
2399 */ 2392 */
2400 if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && 2393 if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
2401 ieee->state == RTLLIB_LINKED && 2394 ieee->state == RTLLIB_LINKED &&
2402 (ieee->iw_mode == IW_MODE_INFRA)) { 2395 (ieee->iw_mode == IW_MODE_INFRA)) {
@@ -2499,16 +2492,17 @@ void rtllib_softmac_xmit(struct rtllib_txb *txb, struct rtllib_device *ieee)
2499 ieee->stats.multicast++; 2492 ieee->stats.multicast++;
2500 2493
2501 /* if xmit available, just xmit it immediately, else just insert it to 2494 /* if xmit available, just xmit it immediately, else just insert it to
2502 * the wait queue */ 2495 * the wait queue
2496 */
2503 for (i = 0; i < txb->nr_frags; i++) { 2497 for (i = 0; i < txb->nr_frags; i++) {
2504 queue_len = skb_queue_len(&ieee->skb_waitQ[queue_index]); 2498 queue_len = skb_queue_len(&ieee->skb_waitQ[queue_index]);
2505 if ((queue_len != 0) || 2499 if ((queue_len != 0) ||
2506 (!ieee->check_nic_enough_desc(ieee->dev, queue_index)) || 2500 (!ieee->check_nic_enough_desc(ieee->dev, queue_index)) ||
2507 (ieee->queue_stop)) { 2501 (ieee->queue_stop)) {
2508 /* insert the skb packet to the wait queue */ 2502 /* insert the skb packet to the wait queue
2509 /* as for the completion function, it does not need 2503 * as for the completion function, it does not need
2510 * to check it any more. 2504 * to check it any more.
2511 * */ 2505 */
2512 if (queue_len < 200) 2506 if (queue_len < 200)
2513 skb_queue_tail(&ieee->skb_waitQ[queue_index], 2507 skb_queue_tail(&ieee->skb_waitQ[queue_index],
2514 txb->fragments[i]); 2508 txb->fragments[i]);
@@ -2886,18 +2880,18 @@ static void rtllib_associate_retry_wq(void *data)
2886 goto exit; 2880 goto exit;
2887 2881
2888 /* until we do not set the state to RTLLIB_NOLINK 2882 /* until we do not set the state to RTLLIB_NOLINK
2889 * there are no possibility to have someone else trying 2883 * there are no possibility to have someone else trying
2890 * to start an association procedure (we get here with 2884 * to start an association procedure (we get here with
2891 * ieee->state = RTLLIB_ASSOCIATING). 2885 * ieee->state = RTLLIB_ASSOCIATING).
2892 * When we set the state to RTLLIB_NOLINK it is possible 2886 * When we set the state to RTLLIB_NOLINK it is possible
2893 * that the RX path run an attempt to associate, but 2887 * that the RX path run an attempt to associate, but
2894 * both rtllib_softmac_check_all_nets and the 2888 * both rtllib_softmac_check_all_nets and the
2895 * RX path works with ieee->lock held so there are no 2889 * RX path works with ieee->lock held so there are no
2896 * problems. If we are still disassociated then start a scan. 2890 * problems. If we are still disassociated then start a scan.
2897 * the lock here is necessary to ensure no one try to start 2891 * the lock here is necessary to ensure no one try to start
2898 * an association procedure when we have just checked the 2892 * an association procedure when we have just checked the
2899 * state and we are going to start the scan. 2893 * state and we are going to start the scan.
2900 */ 2894 */
2901 ieee->beinretry = true; 2895 ieee->beinretry = true;
2902 ieee->state = RTLLIB_NOLINK; 2896 ieee->state = RTLLIB_NOLINK;
2903 2897
@@ -3185,7 +3179,8 @@ void rtllib_softmac_free(struct rtllib_device *ieee)
3185static int rtllib_wpa_enable(struct rtllib_device *ieee, int value) 3179static int rtllib_wpa_enable(struct rtllib_device *ieee, int value)
3186{ 3180{
3187 /* This is called when wpa_supplicant loads and closes the driver 3181 /* This is called when wpa_supplicant loads and closes the driver
3188 * interface. */ 3182 * interface.
3183 */
3189 netdev_info(ieee->dev, "%s WPA\n", value ? "enabling" : "disabling"); 3184 netdev_info(ieee->dev, "%s WPA\n", value ? "enabling" : "disabling");
3190 ieee->wpa_enabled = value; 3185 ieee->wpa_enabled = value;
3191 memset(ieee->ap_mac_addr, 0, 6); 3186 memset(ieee->ap_mac_addr, 0, 6);
@@ -3490,7 +3485,8 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee,
3490 * generate new IEEE 802.11 authentication which may end up in looping 3485 * generate new IEEE 802.11 authentication which may end up in looping
3491 * with IEEE 802.1X. If your hardware requires a reset after WEP 3486 * with IEEE 802.1X. If your hardware requires a reset after WEP
3492 * configuration (for example... Prism2), implement the reset_port in 3487 * configuration (for example... Prism2), implement the reset_port in
3493 * the callbacks structures used to initialize the 802.11 stack. */ 3488 * the callbacks structures used to initialize the 802.11 stack.
3489 */
3494 if (ieee->reset_on_keychange && 3490 if (ieee->reset_on_keychange &&
3495 ieee->iw_mode != IW_MODE_INFRA && 3491 ieee->iw_mode != IW_MODE_INFRA &&
3496 ieee->reset_port && 3492 ieee->reset_port &&
diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c
index 2e1aab1230c5..3b159638bba2 100644
--- a/drivers/staging/rtl8192e/rtllib_tx.c
+++ b/drivers/staging/rtl8192e/rtllib_tx.c
@@ -53,102 +53,99 @@
53 53
54#include "rtllib.h" 54#include "rtllib.h"
55 55
56/* 56/* 802.11 Data Frame
57 57 *
58 58 *
59802.11 Data Frame 59 * 802.11 frame_control for data frames - 2 bytes
60 60 * ,-----------------------------------------------------------------------------------------.
61 61 * bits | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e |
62802.11 frame_control for data frames - 2 bytes 62 * |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------|
63 ,-----------------------------------------------------------------------------------------. 63 * val | 0 | 0 | 0 | 1 | x | 0 | 0 | 0 | 1 | 0 | x | x | x | x | x |
64bits | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | 64 * |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------|
65 |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| 65 * desc | ^-ver-^ | ^type-^ | ^-----subtype-----^ | to |from |more |retry| pwr |more |wep |
66val | 0 | 0 | 0 | 1 | x | 0 | 0 | 0 | 1 | 0 | x | x | x | x | x | 66 * | | | x=0 data,x=1 data+ack | DS | DS |frag | | mgm |data | |
67 |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| 67 * '-----------------------------------------------------------------------------------------'
68desc | ^-ver-^ | ^type-^ | ^-----subtype-----^ | to |from |more |retry| pwr |more |wep | 68 * /\
69 | | | x=0 data,x=1 data+ack | DS | DS |frag | | mgm |data | | 69 * |
70 '-----------------------------------------------------------------------------------------' 70 * 802.11 Data Frame |
71 /\ 71 * ,--------- 'ctrl' expands to >-----------'
72 | 72 * |
73802.11 Data Frame | 73 * ,--'---,-------------------------------------------------------------.
74 ,--------- 'ctrl' expands to >-----------' 74 * Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 |
75 | 75 * |------|------|---------|---------|---------|------|---------|------|
76 ,--'---,-------------------------------------------------------------. 76 * Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | Frame | fcs |
77Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | 77 * | | tion | (BSSID) | | | ence | data | |
78 |------|------|---------|---------|---------|------|---------|------| 78 * `--------------------------------------------------| |------'
79Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | Frame | fcs | 79 * Total: 28 non-data bytes `----.----'
80 | | tion | (BSSID) | | | ence | data | | 80 * |
81 `--------------------------------------------------| |------' 81 * .- 'Frame data' expands to <---------------------------'
82Total: 28 non-data bytes `----.----' 82 * |
83 | 83 * V
84 .- 'Frame data' expands to <---------------------------' 84 * ,---------------------------------------------------.
85 | 85 * Bytes | 1 | 1 | 1 | 3 | 2 | 0-2304 |
86 V 86 * |------|------|---------|----------|------|---------|
87 ,---------------------------------------------------. 87 * Desc. | SNAP | SNAP | Control |Eth Tunnel| Type | IP |
88Bytes | 1 | 1 | 1 | 3 | 2 | 0-2304 | 88 * | DSAP | SSAP | | | | Packet |
89 |------|------|---------|----------|------|---------| 89 * | 0xAA | 0xAA |0x03 (UI)|0x00-00-F8| | |
90Desc. | SNAP | SNAP | Control |Eth Tunnel| Type | IP | 90 * `-----------------------------------------| |
91 | DSAP | SSAP | | | | Packet | 91 * Total: 8 non-data bytes `----.----'
92 | 0xAA | 0xAA |0x03 (UI)|0x00-00-F8| | | 92 * |
93 `-----------------------------------------| | 93 * .- 'IP Packet' expands, if WEP enabled, to <--'
94Total: 8 non-data bytes `----.----' 94 * |
95 | 95 * V
96 .- 'IP Packet' expands, if WEP enabled, to <--' 96 * ,-----------------------.
97 | 97 * Bytes | 4 | 0-2296 | 4 |
98 V 98 * |-----|-----------|-----|
99 ,-----------------------. 99 * Desc. | IV | Encrypted | ICV |
100Bytes | 4 | 0-2296 | 4 | 100 * | | IP Packet | |
101 |-----|-----------|-----| 101 * `-----------------------'
102Desc. | IV | Encrypted | ICV | 102 * Total: 8 non-data bytes
103 | | IP Packet | | 103 *
104 `-----------------------' 104 *
105Total: 8 non-data bytes 105 * 802.3 Ethernet Data Frame
106 106 *
107 107 * ,-----------------------------------------.
108802.3 Ethernet Data Frame 108 * Bytes | 6 | 6 | 2 | Variable | 4 |
109 109 * |-------|-------|------|-----------|------|
110 ,-----------------------------------------. 110 * Desc. | Dest. | Source| Type | IP Packet | fcs |
111Bytes | 6 | 6 | 2 | Variable | 4 | 111 * | MAC | MAC | | | |
112 |-------|-------|------|-----------|------| 112 * `-----------------------------------------'
113Desc. | Dest. | Source| Type | IP Packet | fcs | 113 * Total: 18 non-data bytes
114 | MAC | MAC | | | | 114 *
115 `-----------------------------------------' 115 * In the event that fragmentation is required, the incoming payload is split into
116Total: 18 non-data bytes 116 * N parts of size ieee->fts. The first fragment contains the SNAP header and the
117 117 * remaining packets are just data.
118In the event that fragmentation is required, the incoming payload is split into 118 *
119N parts of size ieee->fts. The first fragment contains the SNAP header and the 119 * If encryption is enabled, each fragment payload size is reduced by enough space
120remaining packets are just data. 120 * to add the prefix and postfix (IV and ICV totalling 8 bytes in the case of WEP)
121 121 * So if you have 1500 bytes of payload with ieee->fts set to 500 without
122If encryption is enabled, each fragment payload size is reduced by enough space 122 * encryption it will take 3 frames. With WEP it will take 4 frames as the
123to add the prefix and postfix (IV and ICV totalling 8 bytes in the case of WEP) 123 * payload of each frame is reduced to 492 bytes.
124So if you have 1500 bytes of payload with ieee->fts set to 500 without 124 *
125encryption it will take 3 frames. With WEP it will take 4 frames as the 125 * SKB visualization
126payload of each frame is reduced to 492 bytes. 126 *
127 127 * ,- skb->data
128* SKB visualization 128 * |
129* 129 * | ETHERNET HEADER ,-<-- PAYLOAD
130* ,- skb->data 130 * | | 14 bytes from skb->data
131* | 131 * | 2 bytes for Type --> ,T. | (sizeof ethhdr)
132* | ETHERNET HEADER ,-<-- PAYLOAD 132 * | | | |
133* | | 14 bytes from skb->data 133 * |,-Dest.--. ,--Src.---. | | |
134* | 2 bytes for Type --> ,T. | (sizeof ethhdr) 134 * | 6 bytes| | 6 bytes | | | |
135* | | | | 135 * v | | | | | |
136* |,-Dest.--. ,--Src.---. | | | 136 * 0 | v 1 | v | v 2
137* | 6 bytes| | 6 bytes | | | | 137 * 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
138* v | | | | | | 138 * ^ | ^ | ^ |
139* 0 | v 1 | v | v 2 139 * | | | | | |
140* 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 140 * | | | | `T' <---- 2 bytes for Type
141* ^ | ^ | ^ | 141 * | | | |
142* | | | | | | 142 * | | '---SNAP--' <-------- 6 bytes for SNAP
143* | | | | `T' <---- 2 bytes for Type 143 * | |
144* | | | | 144 * `-IV--' <-------------------- 4 bytes for IV (WEP)
145* | | '---SNAP--' <-------- 6 bytes for SNAP 145 *
146* | | 146 * SNAP HEADER
147* `-IV--' <-------------------- 4 bytes for IV (WEP) 147 *
148* 148 */
149* SNAP HEADER
150*
151*/
152 149
153static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; 150static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
154static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; 151static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
@@ -190,10 +187,12 @@ int rtllib_encrypt_fragment(struct rtllib_device *ieee, struct sk_buff *frag,
190 return -1; 187 return -1;
191 } 188 }
192 /* To encrypt, frame format is: 189 /* To encrypt, frame format is:
193 * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes) */ 190 * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes)
191 */
194 192
195 /* Host-based IEEE 802.11 fragmentation for TX is not yet supported, so 193 /* Host-based IEEE 802.11 fragmentation for TX is not yet supported, so
196 * call both MSDU and MPDU encryption functions from here. */ 194 * call both MSDU and MPDU encryption functions from here.
195 */
197 atomic_inc(&crypt->refcnt); 196 atomic_inc(&crypt->refcnt);
198 res = 0; 197 res = 0;
199 if (crypt->ops->encrypt_msdu) 198 if (crypt->ops->encrypt_msdu)
@@ -591,7 +590,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
591 spin_lock_irqsave(&ieee->lock, flags); 590 spin_lock_irqsave(&ieee->lock, flags);
592 591
593 /* If there is no driver handler to take the TXB, don't bother 592 /* If there is no driver handler to take the TXB, don't bother
594 * creating it... */ 593 * creating it...
594 */
595 if ((!ieee->hard_start_xmit && !(ieee->softmac_features & 595 if ((!ieee->hard_start_xmit && !(ieee->softmac_features &
596 IEEE_SOFTMAC_TX_QUEUE)) || 596 IEEE_SOFTMAC_TX_QUEUE)) ||
597 ((!ieee->softmac_data_hard_start_xmit && 597 ((!ieee->softmac_data_hard_start_xmit &&
@@ -692,7 +692,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
692 if (ieee->iw_mode == IW_MODE_INFRA) { 692 if (ieee->iw_mode == IW_MODE_INFRA) {
693 fc |= RTLLIB_FCTL_TODS; 693 fc |= RTLLIB_FCTL_TODS;
694 /* To DS: Addr1 = BSSID, Addr2 = SA, 694 /* To DS: Addr1 = BSSID, Addr2 = SA,
695 Addr3 = DA */ 695 * Addr3 = DA
696 */
696 memcpy(&header.addr1, ieee->current_network.bssid, 697 memcpy(&header.addr1, ieee->current_network.bssid,
697 ETH_ALEN); 698 ETH_ALEN);
698 memcpy(&header.addr2, &src, ETH_ALEN); 699 memcpy(&header.addr2, &src, ETH_ALEN);
@@ -703,7 +704,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
703 memcpy(&header.addr3, &dest, ETH_ALEN); 704 memcpy(&header.addr3, &dest, ETH_ALEN);
704 } else if (ieee->iw_mode == IW_MODE_ADHOC) { 705 } else if (ieee->iw_mode == IW_MODE_ADHOC) {
705 /* not From/To DS: Addr1 = DA, Addr2 = SA, 706 /* not From/To DS: Addr1 = DA, Addr2 = SA,
706 Addr3 = BSSID */ 707 * Addr3 = BSSID
708 */
707 memcpy(&header.addr1, dest, ETH_ALEN); 709 memcpy(&header.addr1, dest, ETH_ALEN);
708 memcpy(&header.addr2, src, ETH_ALEN); 710 memcpy(&header.addr2, src, ETH_ALEN);
709 memcpy(&header.addr3, ieee->current_network.bssid, 711 memcpy(&header.addr3, ieee->current_network.bssid,
@@ -715,7 +717,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
715 header.frame_ctl = cpu_to_le16(fc); 717 header.frame_ctl = cpu_to_le16(fc);
716 718
717 /* Determine fragmentation size based on destination (multicast 719 /* Determine fragmentation size based on destination (multicast
718 * and broadcast are not fragmented) */ 720 * and broadcast are not fragmented)
721 */
719 if (bIsMulticast) { 722 if (bIsMulticast) {
720 frag_size = MAX_FRAG_THRESHOLD; 723 frag_size = MAX_FRAG_THRESHOLD;
721 qos_ctl |= QOS_CTL_NOTCONTAIN_ACK; 724 qos_ctl |= QOS_CTL_NOTCONTAIN_ACK;
@@ -744,14 +747,16 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
744 /* Determine amount of payload per fragment. Regardless of if 747 /* Determine amount of payload per fragment. Regardless of if
745 * this stack is providing the full 802.11 header, one will 748 * this stack is providing the full 802.11 header, one will
746 * eventually be affixed to this fragment -- so we must account 749 * eventually be affixed to this fragment -- so we must account
747 * for it when determining the amount of payload space. */ 750 * for it when determining the amount of payload space.
751 */
748 bytes_per_frag = frag_size - hdr_len; 752 bytes_per_frag = frag_size - hdr_len;
749 if (ieee->config & 753 if (ieee->config &
750 (CFG_RTLLIB_COMPUTE_FCS | CFG_RTLLIB_RESERVE_FCS)) 754 (CFG_RTLLIB_COMPUTE_FCS | CFG_RTLLIB_RESERVE_FCS))
751 bytes_per_frag -= RTLLIB_FCS_LEN; 755 bytes_per_frag -= RTLLIB_FCS_LEN;
752 756
753 /* Each fragment may need to have room for encrypting 757 /* Each fragment may need to have room for encrypting
754 * pre/postfix */ 758 * pre/postfix
759 */
755 if (encrypt) { 760 if (encrypt) {
756 bytes_per_frag -= crypt->ops->extra_mpdu_prefix_len + 761 bytes_per_frag -= crypt->ops->extra_mpdu_prefix_len +
757 crypt->ops->extra_mpdu_postfix_len + 762 crypt->ops->extra_mpdu_postfix_len +
@@ -759,7 +764,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
759 crypt->ops->extra_msdu_postfix_len; 764 crypt->ops->extra_msdu_postfix_len;
760 } 765 }
761 /* Number of fragments is the total bytes_per_frag / 766 /* Number of fragments is the total bytes_per_frag /
762 * payload_per_fragment */ 767 * payload_per_fragment
768 */
763 nr_frags = bytes / bytes_per_frag; 769 nr_frags = bytes / bytes_per_frag;
764 bytes_last_frag = bytes % bytes_per_frag; 770 bytes_last_frag = bytes % bytes_per_frag;
765 if (bytes_last_frag) 771 if (bytes_last_frag)
@@ -769,7 +775,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
769 775
770 /* When we allocate the TXB we allocate enough space for the 776 /* When we allocate the TXB we allocate enough space for the
771 * reserve and full fragment bytes (bytes_per_frag doesn't 777 * reserve and full fragment bytes (bytes_per_frag doesn't
772 * include prefix, postfix, header, FCS, etc.) */ 778 * include prefix, postfix, header, FCS, etc.)
779 */
773 txb = rtllib_alloc_txb(nr_frags, frag_size + 780 txb = rtllib_alloc_txb(nr_frags, frag_size +
774 ieee->tx_headroom, GFP_ATOMIC); 781 ieee->tx_headroom, GFP_ATOMIC);
775 if (unlikely(!txb)) { 782 if (unlikely(!txb)) {
@@ -813,7 +820,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
813 memcpy(frag_hdr, &header, hdr_len); 820 memcpy(frag_hdr, &header, hdr_len);
814 821
815 /* If this is not the last fragment, then add the 822 /* If this is not the last fragment, then add the
816 * MOREFRAGS bit to the frame control */ 823 * MOREFRAGS bit to the frame control
824 */
817 if (i != nr_frags - 1) { 825 if (i != nr_frags - 1) {
818 frag_hdr->frame_ctl = cpu_to_le16( 826 frag_hdr->frame_ctl = cpu_to_le16(
819 fc | RTLLIB_FCTL_MOREFRAGS); 827 fc | RTLLIB_FCTL_MOREFRAGS);
@@ -848,7 +856,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
848 856
849 /* Encryption routine will move the header forward in 857 /* Encryption routine will move the header forward in
850 * order to insert the IV between the header and the 858 * order to insert the IV between the header and the
851 * payload */ 859 * payload
860 */
852 if (encrypt) 861 if (encrypt)
853 rtllib_encrypt_fragment(ieee, skb_frag, 862 rtllib_encrypt_fragment(ieee, skb_frag,
854 hdr_len); 863 hdr_len);
diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c
index a1cae3748ae6..64709decb57e 100644
--- a/drivers/staging/rtl8192e/rtllib_wx.c
+++ b/drivers/staging/rtl8192e/rtllib_wx.c
@@ -241,7 +241,8 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee,
241 } 241 }
242 242
243 /* Add EXTRA: Age to display seconds since last beacon/probe response 243 /* Add EXTRA: Age to display seconds since last beacon/probe response
244 * for given network. */ 244 * for given network.
245 */
245 iwe.cmd = IWEVCUSTOM; 246 iwe.cmd = IWEVCUSTOM;
246 p = custom; 247 p = custom;
247 p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), 248 p += snprintf(p, MAX_CUSTOM_LEN - (p - custom),
@@ -337,7 +338,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
337 RTLLIB_DEBUG_WX("Disabling encryption.\n"); 338 RTLLIB_DEBUG_WX("Disabling encryption.\n");
338 339
339 /* Check all the keys to see if any are still configured, 340 /* Check all the keys to see if any are still configured,
340 * and if no key index was provided, de-init them all */ 341 * and if no key index was provided, de-init them all
342 */
341 for (i = 0; i < NUM_WEP_KEYS; i++) { 343 for (i = 0; i < NUM_WEP_KEYS; i++) {
342 if (ieee->crypt_info.crypt[i] != NULL) { 344 if (ieee->crypt_info.crypt[i] != NULL) {
343 if (key_provided) 345 if (key_provided)
@@ -364,7 +366,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
364 if (*crypt != NULL && (*crypt)->ops != NULL && 366 if (*crypt != NULL && (*crypt)->ops != NULL &&
365 strcmp((*crypt)->ops->name, "R-WEP") != 0) { 367 strcmp((*crypt)->ops->name, "R-WEP") != 0) {
366 /* changing to use WEP; deinit previously used algorithm 368 /* changing to use WEP; deinit previously used algorithm
367 * on this key */ 369 * on this key
370 */
368 lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); 371 lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt);
369 } 372 }
370 373
@@ -412,7 +415,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
412 (*crypt)->priv); 415 (*crypt)->priv);
413 sec.flags |= (1 << key); 416 sec.flags |= (1 << key);
414 /* This ensures a key will be activated if no key is 417 /* This ensures a key will be activated if no key is
415 * explicitly set */ 418 * explicitly set
419 */
416 if (key == sec.active_key) 420 if (key == sec.active_key)
417 sec.flags |= SEC_ACTIVE_KEY; 421 sec.flags |= SEC_ACTIVE_KEY;
418 ieee->crypt_info.tx_keyidx = key; 422 ieee->crypt_info.tx_keyidx = key;
@@ -451,7 +455,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
451 "OPEN" : "SHARED KEY"); 455 "OPEN" : "SHARED KEY");
452 456
453 /* For now we just support WEP, so only set that security level... 457 /* For now we just support WEP, so only set that security level...
454 * TODO: When WPA is added this is one place that needs to change */ 458 * TODO: When WPA is added this is one place that needs to change
459 */
455 sec.flags |= SEC_LEVEL; 460 sec.flags |= SEC_LEVEL;
456 sec.level = SEC_LEVEL_1; /* 40 and 104 bit WEP */ 461 sec.level = SEC_LEVEL_1; /* 40 and 104 bit WEP */
457 462
@@ -462,7 +467,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
462 * generate new IEEE 802.11 authentication which may end up in looping 467 * generate new IEEE 802.11 authentication which may end up in looping
463 * with IEEE 802.1X. If your hardware requires a reset after WEP 468 * with IEEE 802.1X. If your hardware requires a reset after WEP
464 * configuration (for example... Prism2), implement the reset_port in 469 * configuration (for example... Prism2), implement the reset_port in
465 * the callbacks structures used to initialize the 802.11 stack. */ 470 * the callbacks structures used to initialize the 802.11 stack.
471 */
466 if (ieee->reset_on_keychange && 472 if (ieee->reset_on_keychange &&
467 ieee->iw_mode != IW_MODE_INFRA && 473 ieee->iw_mode != IW_MODE_INFRA &&
468 ieee->reset_port && ieee->reset_port(dev)) { 474 ieee->reset_port && ieee->reset_port(dev)) {
@@ -791,8 +797,7 @@ int rtllib_wx_set_auth(struct rtllib_device *ieee,
791 case IW_AUTH_CIPHER_PAIRWISE: 797 case IW_AUTH_CIPHER_PAIRWISE:
792 case IW_AUTH_CIPHER_GROUP: 798 case IW_AUTH_CIPHER_GROUP:
793 case IW_AUTH_KEY_MGMT: 799 case IW_AUTH_KEY_MGMT:
794 /* 800 /* Host AP driver does not use these parameters and allows
795 * Host AP driver does not use these parameters and allows
796 * wpa_supplicant to control them internally. 801 * wpa_supplicant to control them internally.
797 */ 802 */
798 break; 803 break;