Commit 14b40d92 authored by Mateusz Kulikowski's avatar Mateusz Kulikowski Committed by Greg Kroah-Hartman

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: default avatarMateusz Kulikowski <mateusz.kulikowski@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e725fb6f
...@@ -165,7 +165,7 @@ static void cmdpkt_beacontimerinterrupt_819xusb(struct net_device *dev) ...@@ -165,7 +165,7 @@ static void cmdpkt_beacontimerinterrupt_819xusb(struct net_device *dev)
static void cmpk_handle_interrupt_status(struct net_device *dev, u8 *pmsg) static void cmpk_handle_interrupt_status(struct net_device *dev, u8 *pmsg)
{ {
struct cmpk_intr_sta rx_intr_status; /* */ struct cmpk_intr_sta rx_intr_status;
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
DMESG("---> cmpk_Handle_Interrupt_Status()\n"); DMESG("---> cmpk_Handle_Interrupt_Status()\n");
......
...@@ -33,28 +33,28 @@ ...@@ -33,28 +33,28 @@
struct cmpk_txfb { struct cmpk_txfb {
u8 element_id; u8 element_id;
u8 length; u8 length;
u8 TID:4; /* */ u8 TID:4;
u8 fail_reason:3; /* */ u8 fail_reason:3;
u8 tok:1; u8 tok:1;
u8 reserve1:4; /* */ u8 reserve1:4;
u8 pkt_type:2; /* */ u8 pkt_type:2;
u8 bandwidth:1; /* */ u8 bandwidth:1;
u8 qos_pkt:1; /* */ u8 qos_pkt:1;
u8 reserve2; /* */ u8 reserve2;
u8 retry_cnt; /* */ u8 retry_cnt;
u16 pkt_id; /* */ u16 pkt_id;
u16 seq_num; /* */ u16 seq_num;
u8 s_rate; u8 s_rate;
u8 f_rate; u8 f_rate;
u8 s_rts_rate; /* */ u8 s_rts_rate;
u8 f_rts_rate; /* */ u8 f_rts_rate;
u16 pkt_length; /* */ u16 pkt_length;
u16 reserve3; /* */ u16 reserve3;
u16 duration; /* */ u16 duration;
}; };
struct cmpk_intr_sta { struct cmpk_intr_sta {
......
...@@ -304,7 +304,7 @@ static u32 phy_FwRFSerialRead(struct net_device *dev, ...@@ -304,7 +304,7 @@ static u32 phy_FwRFSerialRead(struct net_device *dev,
} }
return read_nic_dword(dev, RF_DATA); return read_nic_dword(dev, RF_DATA);
} /* phy_FwRFSerialRead */ }
static void phy_FwRFSerialWrite(struct net_device *dev, static void phy_FwRFSerialWrite(struct net_device *dev,
enum rf90_radio_path eRFPath, enum rf90_radio_path eRFPath,
...@@ -325,7 +325,7 @@ static void phy_FwRFSerialWrite(struct net_device *dev, ...@@ -325,7 +325,7 @@ static void phy_FwRFSerialWrite(struct net_device *dev,
} }
write_nic_dword(dev, QPNR, Data); write_nic_dword(dev, QPNR, Data);
} /* phy_FwRFSerialWrite */ }
void rtl8192_phy_configmac(struct net_device *dev) void rtl8192_phy_configmac(struct net_device *dev)
......
...@@ -2332,7 +2332,8 @@ static void rtl8192_rx_normal(struct net_device *dev) ...@@ -2332,7 +2332,8 @@ static void rtl8192_rx_normal(struct net_device *dev)
goto done; goto done;
new_skb = dev_alloc_skb(priv->rxbuffersize); new_skb = dev_alloc_skb(priv->rxbuffersize);
/* if allocation of new skb failed - drop current packet /* if allocation of new skb failed - drop current packet
* and reuse skb */ * and reuse skb
*/
if (unlikely(!new_skb)) if (unlikely(!new_skb))
goto done; goto done;
......
...@@ -1221,11 +1221,10 @@ static iw_handler r8192_wx_handlers[] = { ...@@ -1221,11 +1221,10 @@ static iw_handler r8192_wx_handlers[] = {
IW_IOCTL(SIOCSIWENCODEEXT) = r8192_wx_set_enc_ext, IW_IOCTL(SIOCSIWENCODEEXT) = r8192_wx_set_enc_ext,
}; };
/* /* the following rule need to be following,
* the following rule need to be following,
* Odd : get (world access), * Odd : get (world access),
* even : set (root access) * even : set (root access)
* */ */
static const struct iw_priv_args r8192_private_args[] = { static const struct iw_priv_args r8192_private_args[] = {
{ {
SIOCIWFIRSTPRIV + 0x0, SIOCIWFIRSTPRIV + 0x0,
......
...@@ -719,7 +719,8 @@ void HTResetSelfAndSavePeerSetting(struct rtllib_device *ieee, ...@@ -719,7 +719,8 @@ void HTResetSelfAndSavePeerSetting(struct rtllib_device *ieee,
RTLLIB_DEBUG(RTLLIB_DL_HT, "==============>%s()\n", __func__); RTLLIB_DEBUG(RTLLIB_DL_HT, "==============>%s()\n", __func__);
/* unmark bEnableHT flag here is the same reason why unmarked in /* unmark bEnableHT flag here is the same reason why unmarked in
* function rtllib_softmac_new_net. WB 2008.09.10*/ * function rtllib_softmac_new_net. WB 2008.09.10
*/
if (pNetwork->bssht.bdSupportHT) { if (pNetwork->bssht.bdSupportHT) {
pHTInfo->bCurrentHTSupport = true; pHTInfo->bCurrentHTSupport = true;
pHTInfo->ePeerHTSpecVer = pNetwork->bssht.bdHTSpecVer; pHTInfo->ePeerHTSpecVer = pNetwork->bssht.bdHTSpecVer;
......
...@@ -509,12 +509,13 @@ struct ieee_param { ...@@ -509,12 +509,13 @@ struct ieee_param {
#define RTLLIB_DATA_LEN 2304 #define RTLLIB_DATA_LEN 2304
/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
6.2.1.1.2. * 6.2.1.1.2.
*
The figure in section 7.1.2 suggests a body size of up to 2312 * 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 * bytes is allowed, which is a bit confusing, I suspect this
represents the 2304 bytes of real data, plus a possible 8 bytes of * represents the 2304 bytes of real data, plus a possible 8 bytes of
WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */ * WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro)
*/
#define RTLLIB_1ADDR_LEN 10 #define RTLLIB_1ADDR_LEN 10
#define RTLLIB_2ADDR_LEN 16 #define RTLLIB_2ADDR_LEN 16
#define RTLLIB_3ADDR_LEN 24 #define RTLLIB_3ADDR_LEN 24
...@@ -696,8 +697,7 @@ do { \ ...@@ -696,8 +697,7 @@ do { \
} \ } \
} while (0) } while (0)
/* /* To use the debug system;
* To use the debug system;
* *
* If you are defining a new debug classification, simply add it to the #define * If you are defining a new debug classification, simply add it to the #define
* list here in the form of: * list here in the form of:
...@@ -716,8 +716,6 @@ do { \ ...@@ -716,8 +716,6 @@ do { \
* % cat /proc/net/ipw/debug_level * % cat /proc/net/ipw/debug_level
* *
* you simply need to add your entry to the ipw_debug_levels array. * you simply need to add your entry to the ipw_debug_levels array.
*
*
*/ */
#define RTLLIB_DL_INFO (1<<0) #define RTLLIB_DL_INFO (1<<0)
...@@ -975,7 +973,8 @@ struct rtllib_rx_stats { ...@@ -975,7 +973,8 @@ struct rtllib_rx_stats {
/* IEEE 802.11 requires that STA supports concurrent reception of at least /* IEEE 802.11 requires that STA supports concurrent reception of at least
* three fragmented frames. This define can be increased to support more * three fragmented frames. This define can be increased to support more
* concurrent frames, but it should be noted that each entry can consume about * 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 RTLLIB_FRAG_CACHE_LEN 4 #define RTLLIB_FRAG_CACHE_LEN 4
struct rtllib_frag_entry { struct rtllib_frag_entry {
...@@ -1053,16 +1052,15 @@ struct rtllib_security { ...@@ -1053,16 +1052,15 @@ struct rtllib_security {
} __packed; } __packed;
/* /* 802.11 data frame from AP
802.11 data frame from AP * ,-------------------------------------------------------------------.
,-------------------------------------------------------------------. * Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 |
Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | * |------|------|---------|---------|---------|------|---------|------|
|------|------|---------|---------|---------|------|---------|------| * Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs |
Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs | * | | tion | (BSSID) | | | ence | data | |
| | tion | (BSSID) | | | ence | data | | * `-------------------------------------------------------------------'
`-------------------------------------------------------------------' * Total: 28-2340 bytes
Total: 28-2340 bytes */
*/
/* Management Frame Information Element Types */ /* Management Frame Information Element Types */
enum rtllib_mfie { enum rtllib_mfie {
...@@ -1100,7 +1098,8 @@ enum rtllib_mfie { ...@@ -1100,7 +1098,8 @@ enum rtllib_mfie {
/* Minimal header; can be used for passing 802.11 frames with sufficient /* Minimal header; can be used for passing 802.11 frames with sufficient
* information to determine what type of underlying data type is actually * information to determine what type of underlying data type is actually
* stored in the data. */ * stored in the data.
*/
struct rtllib_pspoll_hdr { struct rtllib_pspoll_hdr {
__le16 frame_ctl; __le16 frame_ctl;
__le16 aid; __le16 aid;
...@@ -1210,7 +1209,8 @@ struct rtllib_probe_response { ...@@ -1210,7 +1209,8 @@ struct rtllib_probe_response {
__le16 beacon_interval; __le16 beacon_interval;
__le16 capability; __le16 capability;
/* SSID, supported rates, FH params, DS params, /* SSID, supported rates, FH params, DS params,
* CF params, IBSS params, TIM (if beacon), RSN */ * CF params, IBSS params, TIM (if beacon), RSN
*/
struct rtllib_info_element info_element[0]; struct rtllib_info_element info_element[0];
} __packed; } __packed;
...@@ -1285,7 +1285,8 @@ union frameqos { ...@@ -1285,7 +1285,8 @@ union frameqos {
/* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs /* 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 * only use 8, and then use extended rates for the remaining supported
* rates. Other APs, however, stick all of their supported rates on the * 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_LENGTH ((u8)12)
#define MAX_RATES_EX_LENGTH ((u8)16) #define MAX_RATES_EX_LENGTH ((u8)16)
#define MAX_NETWORK_COUNT 96 #define MAX_NETWORK_COUNT 96
...@@ -1472,22 +1473,21 @@ struct rtllib_info_element_hdr { ...@@ -1472,22 +1473,21 @@ struct rtllib_info_element_hdr {
u8 len; u8 len;
} __packed; } __packed;
/* /* These are the data types that can make up management packets
* These are the data types that can make up management packets
* *
u16 auth_algorithm; * u16 auth_algorithm;
u16 auth_sequence; * u16 auth_sequence;
u16 beacon_interval; * u16 beacon_interval;
u16 capability; * u16 capability;
u8 current_ap[ETH_ALEN]; * u8 current_ap[ETH_ALEN];
u16 listen_interval; * u16 listen_interval;
struct { * struct {
u16 association_id:14, reserved:2; * u16 association_id:14, reserved:2;
} __packed; * } __packed;
u32 time_stamp[2]; * u32 time_stamp[2];
u16 reason; * u16 reason;
u16 status; * u16 status;
*/ */
#define RTLLIB_DEFAULT_TX_ESSID "Penguin" #define RTLLIB_DEFAULT_TX_ESSID "Penguin"
#define RTLLIB_DEFAULT_BASIC_RATE 2 #define RTLLIB_DEFAULT_BASIC_RATE 2
...@@ -2085,14 +2085,16 @@ struct rtllib_device { ...@@ -2085,14 +2085,16 @@ struct rtllib_device {
spinlock_t wpax_suitlist_lock; spinlock_t wpax_suitlist_lock;
int tx_headroom; /* Set to size of any additional room needed at front int tx_headroom; /* Set to size of any additional room needed at front
* of allocated Tx SKBs */ * of allocated Tx SKBs
*/
u32 config; u32 config;
/* WEP and other encryption related settings at the device level */ /* WEP and other encryption related settings at the device level */
int open_wep; /* Set to 1 to allow unencrypted frames */ int open_wep; /* Set to 1 to allow unencrypted frames */
int auth_mode; int auth_mode;
int reset_on_keychange; /* Set to 1 if the HW needs to be reset on 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 */ /* If the host performs {en,de}cryption, then set to 1 */
int host_encrypt; int host_encrypt;
...@@ -2362,7 +2364,7 @@ struct rtllib_device { ...@@ -2362,7 +2364,7 @@ struct rtllib_device {
/* OK this is complementing to data_poll_hard_stop */ /* OK this is complementing to data_poll_hard_stop */
void (*data_hard_resume)(struct net_device *dev); void (*data_hard_resume)(struct net_device *dev);
/* ask to the driver to retune the radio . /* ask to the driver to retune the radio.
* This function can sleep. the driver should ensure * This function can sleep. the driver should ensure
* the radio has been switched before return. * the radio has been switched before return.
*/ */
...@@ -2456,7 +2458,8 @@ struct rtllib_device { ...@@ -2456,7 +2458,8 @@ struct rtllib_device {
void (*rtllib_rfkill_poll)(struct net_device *dev); void (*rtllib_rfkill_poll)(struct net_device *dev);
/* This must be the last item so that it points to the data /* This must be the last item so that it points to the data
* allocated beyond this structure by alloc_rtllib */ * allocated beyond this structure by alloc_rtllib
*/
u8 priv[0]; u8 priv[0];
}; };
...@@ -2485,7 +2488,8 @@ struct rtllib_device { ...@@ -2485,7 +2488,8 @@ struct rtllib_device {
/* The ieee802.11 stack will manage the netif queue /* The ieee802.11 stack will manage the netif queue
* wake/stop for the driver, taking care of 802.11 * 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) #define IEEE_SOFTMAC_TX_QUEUE (1<<7)
/* Uses only the softmac_data_hard_start_xmit /* 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,11 +2526,9 @@ static inline int rtllib_is_empty_essid(const char *essid, int essid_len)
static inline int rtllib_is_valid_mode(struct rtllib_device *ieee, int mode) static inline int rtllib_is_valid_mode(struct rtllib_device *ieee, int mode)
{ {
/* /* It is possible for both access points and our device to support
* It is possible for both access points and our device to support
* combinations of modes, so as long as there is one valid combination * combinations of modes, so as long as there is one valid combination
* of ap/device supported modes, then return success * of ap/device supported modes, then return success
*
*/ */
if ((mode & IEEE_A) && if ((mode & IEEE_A) &&
(ieee->modulation & RTLLIB_OFDM_MODULATION) && (ieee->modulation & RTLLIB_OFDM_MODULATION) &&
......
...@@ -87,7 +87,8 @@ void rtllib_crypt_delayed_deinit(struct lib80211_crypt_info *info, ...@@ -87,7 +87,8 @@ void rtllib_crypt_delayed_deinit(struct lib80211_crypt_info *info,
/* must not run ops->deinit() while there may be pending encrypt or /* must not run ops->deinit() while there may be pending encrypt or
* decrypt operations. Use a list of delayed deinits to avoid needing * decrypt operations. Use a list of delayed deinits to avoid needing
* locking. */ * locking.
*/
spin_lock_irqsave(info->lock, flags); spin_lock_irqsave(info->lock, flags);
list_add(&tmp->list, &info->crypt_deinit_list); list_add(&tmp->list, &info->crypt_deinit_list);
......
...@@ -17,8 +17,7 @@ ...@@ -17,8 +17,7 @@
* more details. * more details.
*/ */
/* /* This file defines the interface to the rtllib crypto module.
* This file defines the interface to the rtllib crypto module.
*/ */
#ifndef RTLLIB_CRYPT_H #ifndef RTLLIB_CRYPT_H
#define RTLLIB_CRYPT_H #define RTLLIB_CRYPT_H
......
...@@ -140,7 +140,8 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, ...@@ -140,7 +140,8 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm,
* Flag (Include authentication header, M=3 (8-octet MIC), * Flag (Include authentication header, M=3 (8-octet MIC),
* L=1 (2-octet Dlen)) * L=1 (2-octet Dlen))
* Nonce: 0x00 | A2 | PN * Nonce: 0x00 | A2 | PN
* Dlen */ * Dlen
*/
b0[0] = 0x59; b0[0] = 0x59;
b0[1] = qc; b0[1] = qc;
memcpy(b0 + 2, hdr->addr2, ETH_ALEN); memcpy(b0 + 2, hdr->addr2, ETH_ALEN);
......
...@@ -249,7 +249,8 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, ...@@ -249,7 +249,8 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
u16 IV16) u16 IV16)
{ {
/* Make temporary area overlap WEP seed so that the final copy can be /* Make temporary area overlap WEP seed so that the final copy can be
* avoided on little endian hosts. */ * avoided on little endian hosts.
*/
u16 *PPK = (u16 *) &WEPSeed[4]; u16 *PPK = (u16 *) &WEPSeed[4];
/* Step 1 - make copy of TTAK and bring in TSC */ /* 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,7 +277,8 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
PPK[5] += RotR1(PPK[4]); PPK[5] += RotR1(PPK[4]);
/* Step 3 - bring in last of TK bits, assign 24-bit WEP IV value /* Step 3 - bring in last of TK bits, assign 24-bit WEP IV value
* WEPSeed[0..2] is transmitted as WEP IV */ * WEPSeed[0..2] is transmitted as WEP IV
*/
WEPSeed[0] = Hi8(IV16); WEPSeed[0] = Hi8(IV16);
WEPSeed[1] = (Hi8(IV16) | 0x20) & 0x7F; WEPSeed[1] = (Hi8(IV16) | 0x20) & 0x7F;
WEPSeed[2] = Lo8(IV16); WEPSeed[2] = Lo8(IV16);
...@@ -470,7 +472,8 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -470,7 +472,8 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
if (iv32 != tkey->rx_iv32) { if (iv32 != tkey->rx_iv32) {
/* Previously cached Phase1 result was already /* Previously cached Phase1 result was already
* lost, so it needs to be recalculated for the * lost, so it needs to be recalculated for the
* next packet. */ * next packet.
*/
tkey->rx_phase1_done = 0; tkey->rx_phase1_done = 0;
} }
if (net_ratelimit()) { if (net_ratelimit()) {
...@@ -485,7 +488,8 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -485,7 +488,8 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
} }
/* Update real counters only after Michael MIC verification has /* Update real counters only after Michael MIC verification has
* completed */ * completed
*/
tkey->rx_iv32_new = iv32; tkey->rx_iv32_new = iv32;
tkey->rx_iv16_new = iv16; tkey->rx_iv16_new = iv16;
...@@ -639,7 +643,8 @@ static int rtllib_michael_mic_verify(struct sk_buff *skb, int keyidx, ...@@ -639,7 +643,8 @@ static int rtllib_michael_mic_verify(struct sk_buff *skb, int keyidx,
} }
/* Update TSC counters for RX now that the packet verification has /* Update TSC counters for RX now that the packet verification has
* completed. */ * completed.
*/
tkey->rx_iv32 = tkey->rx_iv32_new; tkey->rx_iv32 = tkey->rx_iv32_new;
tkey->rx_iv16 = tkey->rx_iv16_new; tkey->rx_iv16 = tkey->rx_iv16_new;
......
...@@ -121,7 +121,8 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -121,7 +121,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 /* Fluhrer, Mantin, and Shamir have reported weaknesses in the key
* scheduling algorithm of RC4. At least IVs (KeyByte + 3, 0xff, N) * 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) { if ((wep->iv & 0xff00) == 0xff00) {
u8 B = (wep->iv >> 16) & 0xff; u8 B = (wep->iv >> 16) & 0xff;
......
...@@ -143,7 +143,8 @@ rtllib_frag_cache_get(struct rtllib_device *ieee, ...@@ -143,7 +143,8 @@ rtllib_frag_cache_get(struct rtllib_device *ieee,
memcpy(entry->dst_addr, hdr->addr1, ETH_ALEN); memcpy(entry->dst_addr, hdr->addr1, ETH_ALEN);
} else { } else {
/* received a fragment of a frame for which the head fragment /* received a fragment of a frame for which the head fragment
* should have already been received */ * should have already been received
*/
entry = rtllib_frag_cache_find(ieee, seq, frag, tid, hdr->addr2, entry = rtllib_frag_cache_find(ieee, seq, frag, tid, hdr->addr2,
hdr->addr1); hdr->addr1);
if (entry != NULL) { if (entry != NULL) {
...@@ -199,7 +200,8 @@ static int rtllib_frag_cache_invalidate(struct rtllib_device *ieee, ...@@ -199,7 +200,8 @@ static int rtllib_frag_cache_invalidate(struct rtllib_device *ieee,
* *
* Responsible for handling management control frames * Responsible for handling management control frames
* *
* Called by rtllib_rx */ * Called by rtllib_rx
*/
static inline int static inline int
rtllib_rx_frame_mgmt(struct rtllib_device *ieee, struct sk_buff *skb, rtllib_rx_frame_mgmt(struct rtllib_device *ieee, struct sk_buff *skb,
struct rtllib_rx_stats *rx_stats, u16 type, 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,8 +226,9 @@ rtllib_rx_frame_mgmt(struct rtllib_device *ieee, struct sk_buff *skb,
return 0; return 0;
} }
/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ /* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation
/* Ethernet-II snap header (RFC1042 for most EtherTypes) */ * Ethernet-II snap header (RFC1042 for most EtherTypes)
*/
static unsigned char rfc1042_header[] = { static unsigned char rfc1042_header[] = {
0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00
}; };
...@@ -482,7 +485,8 @@ void rtllib_indicate_packets(struct rtllib_device *ieee, struct rtllib_rxb **prx ...@@ -482,7 +485,8 @@ void rtllib_indicate_packets(struct rtllib_device *ieee, struct rtllib_rxb **prx
ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) || ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
memcmp(sub_skb->data, bridge_tunnel_header, SNAP_SIZE) == 0)) { memcmp(sub_skb->data, bridge_tunnel_header, SNAP_SIZE) == 0)) {
/* remove RFC1042 or Bridge-Tunnel encapsulation /* remove RFC1042 or Bridge-Tunnel encapsulation
* and replace EtherType */ * and replace EtherType
*/
skb_pull(sub_skb, SNAP_SIZE); skb_pull(sub_skb, SNAP_SIZE);
memcpy(skb_push(sub_skb, ETH_ALEN), prxb->src, ETH_ALEN); memcpy(skb_push(sub_skb, ETH_ALEN), prxb->src, ETH_ALEN);
memcpy(skb_push(sub_skb, ETH_ALEN), prxb->dst, ETH_ALEN); memcpy(skb_push(sub_skb, ETH_ALEN), prxb->dst, ETH_ALEN);
...@@ -582,8 +586,7 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, ...@@ -582,8 +586,7 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee,
return; return;
} }
/* /* Sliding window manipulation. Conditions includes:
* Sliding window manipulation. Conditions includes:
* 1. Incoming SeqNum is equal to WinStart =>Window shift 1 * 1. Incoming SeqNum is equal to WinStart =>Window shift 1
* 2. Incoming SeqNum is larger than the WinEnd => Window shift N * 2. Incoming SeqNum is larger than the WinEnd => Window shift N
*/ */
...@@ -598,13 +601,12 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, ...@@ -598,13 +601,12 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee,
RTLLIB_DEBUG(RTLLIB_DL_REORDER, "Window Shift! IndicateSeq: %d, NewSeq: %d\n", pTS->RxIndicateSeq, SeqNum); RTLLIB_DEBUG(RTLLIB_DL_REORDER, "Window Shift! IndicateSeq: %d, NewSeq: %d\n", pTS->RxIndicateSeq, SeqNum);
} }
/* /* Indication process.
* Indication process.
* After Packet dropping and Sliding Window shifting as above, we can * After Packet dropping and Sliding Window shifting as above, we can
* now just indicate the packets with the SeqNum smaller than latest * now just indicate the packets with the SeqNum smaller than latest
* WinStart and struct buffer other packets. * WinStart and struct buffer other packets.
*/ *
/* For Rx Reorder condition: * For Rx Reorder condition:
* 1. All packets with SeqNum smaller than WinStart => Indicate * 1. All packets with SeqNum smaller than WinStart => Indicate
* 2. All packets with SeqNum larger than or equal to * 2. All packets with SeqNum larger than or equal to
* WinStart => Buffer it. * WinStart => Buffer it.
...@@ -647,8 +649,7 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, ...@@ -647,8 +649,7 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee,
pTS->RxIndicateSeq, SeqNum); pTS->RxIndicateSeq, SeqNum);
} }
} else { } else {
/* /* Packets are dropped if there are not enough reorder
* Packets are dropped if there are not enough reorder
* entries. This part should be modified!! We can just * entries. This part should be modified!! We can just
* indicate all the packets in struct buffer and get * indicate all the packets in struct buffer and get
* reorder entries. * reorder entries.
...@@ -698,7 +699,8 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, ...@@ -698,7 +699,8 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee,
} }
/* Handling pending timer. Set this timer to prevent from long time /* Handling pending timer. Set this timer to prevent from long time
* Rx buffering.*/ * Rx buffering.
*/
if (index > 0) { if (index > 0) {
if (timer_pending(&pTS->RxPktPendingTimer)) if (timer_pending(&pTS->RxPktPendingTimer))
del_timer_sync(&pTS->RxPktPendingTimer); del_timer_sync(&pTS->RxPktPendingTimer);
...@@ -973,7 +975,8 @@ static int rtllib_rx_data_filter(struct rtllib_device *ieee, u16 fc, ...@@ -973,7 +975,8 @@ static int rtllib_rx_data_filter(struct rtllib_device *ieee, u16 fc,
} }
/* Nullfunc frames may have PS-bit set, so they must be passed to /* Nullfunc frames may have PS-bit set, so they must be passed to
* hostap_handle_sta_rx() before being dropped here. */ * hostap_handle_sta_rx() before being dropped here.
*/
if (!ieee->IntelPromiscuousModeInfo.bPromiscuousOn) { if (!ieee->IntelPromiscuousModeInfo.bPromiscuousOn) {
if (stype != RTLLIB_STYPE_DATA && if (stype != RTLLIB_STYPE_DATA &&
stype != RTLLIB_STYPE_DATA_CFACK && stype != RTLLIB_STYPE_DATA_CFACK &&
...@@ -1015,7 +1018,8 @@ static int rtllib_rx_get_crypt(struct rtllib_device *ieee, struct sk_buff *skb, ...@@ -1015,7 +1018,8 @@ static int rtllib_rx_get_crypt(struct rtllib_device *ieee, struct sk_buff *skb,
*crypt = ieee->crypt_info.crypt[idx]; *crypt = ieee->crypt_info.crypt[idx];
/* allow NULL decrypt to indicate an station specific override /* allow NULL decrypt to indicate an station specific override
* for default encryption */ * for default encryption
*/
if (*crypt && ((*crypt)->ops == NULL || if (*crypt && ((*crypt)->ops == NULL ||
(*crypt)->ops->decrypt_mpdu == NULL)) (*crypt)->ops->decrypt_mpdu == NULL))
*crypt = NULL; *crypt = NULL;
...@@ -1024,7 +1028,8 @@ static int rtllib_rx_get_crypt(struct rtllib_device *ieee, struct sk_buff *skb, ...@@ -1024,7 +1028,8 @@ static int rtllib_rx_get_crypt(struct rtllib_device *ieee, struct sk_buff *skb,
/* This seems to be triggered by some (multicast?) /* This seems to be triggered by some (multicast?)
* frames from other than current BSS, so just drop the * frames from other than current BSS, so just drop the
* frames silently instead of filling system log with * frames silently instead of filling system log with
* these reports. */ * these reports.
*/
RTLLIB_DEBUG_DROP("Decryption failed (not set) (SA= %pM)\n", RTLLIB_DEBUG_DROP("Decryption failed (not set) (SA= %pM)\n",
hdr->addr2); hdr->addr2);
ieee->ieee_stats.rx_discards_undecryptable++; ieee->ieee_stats.rx_discards_undecryptable++;
...@@ -1088,11 +1093,13 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, ...@@ -1088,11 +1093,13 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb,
if (frag == 0) { if (frag == 0) {
/* copy first fragment (including full headers) into /* copy first fragment (including full headers) into
* beginning of the fragment cache skb */ * beginning of the fragment cache skb
*/
memcpy(skb_put(frag_skb, flen), skb->data, flen); memcpy(skb_put(frag_skb, flen), skb->data, flen);
} else { } else {
/* append frame payload to the end of the fragment /* append frame payload to the end of the fragment
* cache skb */ * cache skb
*/
memcpy(skb_put(frag_skb, flen), skb->data + hdrlen, memcpy(skb_put(frag_skb, flen), skb->data + hdrlen,
flen); flen);
} }
...@@ -1102,19 +1109,22 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, ...@@ -1102,19 +1109,22 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb,
if (fc & RTLLIB_FCTL_MOREFRAGS) { if (fc & RTLLIB_FCTL_MOREFRAGS) {
/* more fragments expected - leave the skb in fragment /* more fragments expected - leave the skb in fragment
* cache for now; it will be delivered to upper layers * cache for now; it will be delivered to upper layers
* after all fragments have been received */ * after all fragments have been received
*/
return -2; return -2;
} }
/* this was the last fragment and the frame will be /* this was the last fragment and the frame will be
* delivered, so remove skb from fragment cache */ * delivered, so remove skb from fragment cache
*/
skb = frag_skb; skb = frag_skb;
hdr = (struct rtllib_hdr_4addr *) skb->data; hdr = (struct rtllib_hdr_4addr *) skb->data;
rtllib_frag_cache_invalidate(ieee, hdr); rtllib_frag_cache_invalidate(ieee, hdr);
} }
/* skb: hdr + (possible reassembled) full MSDU payload; possibly still /* skb: hdr + (possible reassembled) full MSDU payload; possibly still
* encrypted/authenticated */ * encrypted/authenticated
*/
if (ieee->host_decrypt && (fc & RTLLIB_FCTL_WEP) && if (ieee->host_decrypt && (fc & RTLLIB_FCTL_WEP) &&
rtllib_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt)) { rtllib_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt)) {
netdev_info(ieee->dev, "%s: ==>decrypt msdu error\n", __func__); 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,7 +1137,8 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb,
rtllib_is_eapol_frame(ieee, skb, hdrlen)) { rtllib_is_eapol_frame(ieee, skb, hdrlen)) {
/* pass unencrypted EAPOL frames even if encryption is /* pass unencrypted EAPOL frames even if encryption is
* configured */ * configured
*/
struct eapol *eap = (struct eapol *)(skb->data + struct eapol *eap = (struct eapol *)(skb->data +
24); 24);
RTLLIB_DEBUG_EAP("RX: IEEE 802.1X EAPOL frame: %s\n", 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,7 +1215,8 @@ static void rtllib_rx_indicate_pkt_legacy(struct rtllib_device *ieee,
ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) || ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
memcmp(sub_skb->data, bridge_tunnel_header, SNAP_SIZE) == 0)) { memcmp(sub_skb->data, bridge_tunnel_header, SNAP_SIZE) == 0)) {
/* remove RFC1042 or Bridge-Tunnel encapsulation and /* remove RFC1042 or Bridge-Tunnel encapsulation and
* replace EtherType */ * replace EtherType
*/
skb_pull(sub_skb, SNAP_SIZE); skb_pull(sub_skb, SNAP_SIZE);
memcpy(skb_push(sub_skb, ETH_ALEN), src, ETH_ALEN); memcpy(skb_push(sub_skb, ETH_ALEN), src, ETH_ALEN);
memcpy(skb_push(sub_skb, ETH_ALEN), dst, ETH_ALEN); 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,7 +1408,8 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb,
/* Returning 0 indicates to caller that we have not handled the SKB-- /* Returning 0 indicates to caller that we have not handled the SKB--
* so it is still allocated and can be used again by underlying * so it is still allocated and can be used again by underlying
* hardware as a DMA target */ * hardware as a DMA target
*/
return 0; return 0;
} }
...@@ -1442,7 +1455,8 @@ static int rtllib_rx_Mesh(struct rtllib_device *ieee, struct sk_buff *skb, ...@@ -1442,7 +1455,8 @@ static int rtllib_rx_Mesh(struct rtllib_device *ieee, struct sk_buff *skb,
/* All received frames are sent to this function. @skb contains the frame in /* All received frames are sent to this function. @skb contains the frame in
* IEEE 802.11 format, i.e., in the format it was sent over air. * IEEE 802.11 format, i.e., in the format it was sent over air.
* This function is called only as a tasklet (software IRQ). */ * This function is called only as a tasklet (software IRQ).
*/
int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb, int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb,
struct rtllib_rx_stats *rx_stats) struct rtllib_rx_stats *rx_stats)
{ {
...@@ -1488,10 +1502,7 @@ EXPORT_SYMBOL(rtllib_rx); ...@@ -1488,10 +1502,7 @@ EXPORT_SYMBOL(rtllib_rx);
static u8 qos_oui[QOS_OUI_LEN] = { 0x00, 0x50, 0xF2 }; static u8 qos_oui[QOS_OUI_LEN] = { 0x00, 0x50, 0xF2 };
/* /* Make ther structure we read from the beacon packet has the right values */
* Make ther structure we read from the beacon packet has
* the right values
*/
static int rtllib_verify_qos_info(struct rtllib_qos_information_element static int rtllib_verify_qos_info(struct rtllib_qos_information_element
*info_element, int sub_type) *info_element, int sub_type)
{ {
...@@ -1509,9 +1520,7 @@ static int rtllib_verify_qos_info(struct rtllib_qos_information_element ...@@ -1509,9 +1520,7 @@ static int rtllib_verify_qos_info(struct rtllib_qos_information_element
} }
/* /* Parse a QoS parameter element */
* Parse a QoS parameter element
*/
static int rtllib_read_qos_param_element(struct rtllib_qos_parameter_info static int rtllib_read_qos_param_element(struct rtllib_qos_parameter_info
*element_param, struct rtllib_info_element *element_param, struct rtllib_info_element
*info_element) *info_element)
...@@ -1535,9 +1544,7 @@ static int rtllib_read_qos_param_element(struct rtllib_qos_parameter_info ...@@ -1535,9 +1544,7 @@ static int rtllib_read_qos_param_element(struct rtllib_qos_parameter_info
return ret; return ret;
} }
/* /* Parse a QoS information element */
* Parse a QoS information element
*/
static int rtllib_read_qos_info_element(struct static int rtllib_read_qos_info_element(struct
rtllib_qos_information_element rtllib_qos_information_element
*element_info, struct rtllib_info_element *element_info, struct rtllib_info_element
...@@ -1566,9 +1573,7 @@ static int rtllib_read_qos_info_element(struct ...@@ -1566,9 +1573,7 @@ static int rtllib_read_qos_info_element(struct
} }
/* /* Write QoS parameters from the ac parameters. */
* Write QoS parameters from the ac parameters.
*/
static int rtllib_qos_convert_ac_to_parameters(struct rtllib_qos_parameter_info *param_elm, static int rtllib_qos_convert_ac_to_parameters(struct rtllib_qos_parameter_info *param_elm,
struct rtllib_qos_data *qos_data) struct rtllib_qos_data *qos_data)
{ {
...@@ -1627,8 +1632,7 @@ static int rtllib_qos_convert_ac_to_parameters(struct rtllib_qos_parameter_info ...@@ -1627,8 +1632,7 @@ static int rtllib_qos_convert_ac_to_parameters(struct rtllib_qos_parameter_info
return 0; return 0;
} }
/* /* we have a generic data element which it may contain QoS information or
* we have a generic data element which it may contain QoS information or
* parameters element. check the information element length to decide * parameters element. check the information element length to decide
* which type to read * which type to read
*/ */
...@@ -1750,7 +1754,8 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, ...@@ -1750,7 +1754,8 @@ int rtllib_parse_info_param(struct rtllib_device *ieee,
length, info_element->id); length, info_element->id);
/* We stop processing but don't return an error here /* We stop processing but don't return an error here
* because some misbehaviour APs break this rule. ie. * because some misbehaviour APs break this rule. ie.
* Orinoco AP1000. */ * Orinoco AP1000.
*/
break; break;
} }
...@@ -2302,7 +2307,8 @@ static inline int is_same_network(struct rtllib_network *src, ...@@ -2302,7 +2307,8 @@ static inline int is_same_network(struct rtllib_network *src,
/* A network is only a duplicate if the channel, BSSID, ESSID /* A network is only a duplicate if the channel, BSSID, ESSID
* and the capability field (in particular IBSS and BSS) all match. * and the capability field (in particular IBSS and BSS) all match.
* We treat all <hidden> with the same BSSID and channel * We treat all <hidden> with the same BSSID and channel
* as one network */ * as one network
*/
return (((src->ssid_len == dst->ssid_len) || (!ssidbroad)) && return (((src->ssid_len == dst->ssid_len) || (!ssidbroad)) &&
(src->channel == dst->channel) && (src->channel == dst->channel) &&
!memcmp(src->bssid, dst->bssid, ETH_ALEN) && !memcmp(src->bssid, dst->bssid, ETH_ALEN) &&
...@@ -2524,10 +2530,12 @@ static inline void rtllib_process_probe_response( ...@@ -2524,10 +2530,12 @@ static inline void rtllib_process_probe_response(
* *
* NOTE: This search is definitely not optimized. Once its doing * NOTE: This search is definitely not optimized. Once its doing
* the "right thing" we'll optimize it for efficiency if * the "right thing" we'll optimize it for efficiency if
* necessary */ * necessary
*/
/* Search for this entry in the list and update it if it is /* Search for this entry in the list and update it if it is
* already there. */ * already there.
*/
spin_lock_irqsave(&ieee->lock, flags); spin_lock_irqsave(&ieee->lock, flags);
if (is_same_network(&ieee->current_network, network, if (is_same_network(&ieee->current_network, network,
...@@ -2556,7 +2564,8 @@ static inline void rtllib_process_probe_response( ...@@ -2556,7 +2564,8 @@ static inline void rtllib_process_probe_response(
} }
/* If we didn't find a match, then get a new network slot to initialize /* If we didn't find a match, then get a new network slot to initialize
* with this beacon's information */ * with this beacon's information
*/
if (&target->list == &ieee->network_list) { if (&target->list == &ieee->network_list) {
if (list_empty(&ieee->network_free_list)) { if (list_empty(&ieee->network_free_list)) {
/* If there are no more slots, expire the oldest */ /* If there are no more slots, expire the oldest */
......
...@@ -68,7 +68,8 @@ static void rtllib_MFIE_Brate(struct rtllib_device *ieee, u8 **tag_p) ...@@ -68,7 +68,8 @@ static void rtllib_MFIE_Brate(struct rtllib_device *ieee, u8 **tag_p)
} }
/* We may add an option for custom rates that specific HW /* We may add an option for custom rates that specific HW
* might support */ * might support
*/
*tag_p = tag; *tag_p = tag;
} }
...@@ -89,7 +90,8 @@ static void rtllib_MFIE_Grate(struct rtllib_device *ieee, u8 **tag_p) ...@@ -89,7 +90,8 @@ static void rtllib_MFIE_Grate(struct rtllib_device *ieee, u8 **tag_p)
*tag++ = RTLLIB_BASIC_RATE_MASK | RTLLIB_OFDM_RATE_54MB; *tag++ = RTLLIB_BASIC_RATE_MASK | RTLLIB_OFDM_RATE_54MB;
} }
/* We may add an option for custom rates that specific HW might /* We may add an option for custom rates that specific HW might
* support */ * support
*/
*tag_p = tag; *tag_p = tag;
} }
...@@ -133,8 +135,7 @@ static void enqueue_mgmt(struct rtllib_device *ieee, struct sk_buff *skb) ...@@ -133,8 +135,7 @@ static void enqueue_mgmt(struct rtllib_device *ieee, struct sk_buff *skb)
nh = (ieee->mgmt_queue_head + 1) % MGMT_QUEUE_NUM; nh = (ieee->mgmt_queue_head + 1) % MGMT_QUEUE_NUM;
/* /* if the queue is full but we have newer frames then
* if the queue is full but we have newer frames then
* just overwrites the oldest. * just overwrites the oldest.
* *
* if (nh == ieee->mgmt_queue_tail) * if (nh == ieee->mgmt_queue_tail)
...@@ -273,10 +274,11 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct rtllib_device *ieee) ...@@ -273,10 +274,11 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct rtllib_device *ieee)
if (!ieee->check_nic_enough_desc(ieee->dev, tcb_desc->queue_index) || if (!ieee->check_nic_enough_desc(ieee->dev, tcb_desc->queue_index) ||
(skb_queue_len(&ieee->skb_waitQ[tcb_desc->queue_index]) != 0) || (skb_queue_len(&ieee->skb_waitQ[tcb_desc->queue_index]) != 0) ||
(ieee->queue_stop)) { (ieee->queue_stop)) {
/* insert the skb packet to the management queue */ /* insert the skb packet to the management queue
/* as for the completion function, it does not need *
* as for the completion function, it does not need
* to check it any more. * to check it any more.
* */ */
netdev_info(ieee->dev, netdev_info(ieee->dev,
"%s():insert to waitqueue, queue_index:%d!\n", "%s():insert to waitqueue, queue_index:%d!\n",
__func__, tcb_desc->queue_index); __func__, tcb_desc->queue_index);
...@@ -417,10 +419,7 @@ static void rtllib_send_beacon_cb(unsigned long _ieee) ...@@ -417,10 +419,7 @@ static void rtllib_send_beacon_cb(unsigned long _ieee)
spin_unlock_irqrestore(&ieee->beacon_lock, flags); spin_unlock_irqrestore(&ieee->beacon_lock, flags);
} }
/* /* Enables network monitor mode, all rx packets will be received. */
* Description:
* Enable network monitor mode, all rx packets will be received.
*/
void rtllib_EnableNetMonitorMode(struct net_device *dev, void rtllib_EnableNetMonitorMode(struct net_device *dev,
bool bInitState) bool bInitState)
{ {
...@@ -432,10 +431,8 @@ void rtllib_EnableNetMonitorMode(struct net_device *dev, ...@@ -432,10 +431,8 @@ void rtllib_EnableNetMonitorMode(struct net_device *dev,
} }
/* /* Disables network monitor mode. Only packets destinated to
* Description: * us will be received.
* Disable network network monitor mode, only packets destinated to
* us will be received.
*/ */
void rtllib_DisableNetMonitorMode(struct net_device *dev, void rtllib_DisableNetMonitorMode(struct net_device *dev,
bool bInitState) bool bInitState)
...@@ -448,9 +445,7 @@ void rtllib_DisableNetMonitorMode(struct net_device *dev, ...@@ -448,9 +445,7 @@ void rtllib_DisableNetMonitorMode(struct net_device *dev,
} }
/* /* Enables the specialized promiscuous mode required by Intel.
* Description:
* This enables the specialized promiscuous mode required by Intel.
* In this mode, Intel intends to hear traffics from/to other STAs in the * In this mode, Intel intends to hear traffics from/to other STAs in the
* same BSS. Therefore we don't have to disable checking BSSID and we only need * same BSS. Therefore we don't have to disable checking BSSID and we only need
* to allow all dest. BUT: if we enable checking BSSID then we can't recv * 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, ...@@ -474,10 +469,8 @@ void rtllib_EnableIntelPromiscuousMode(struct net_device *dev,
EXPORT_SYMBOL(rtllib_EnableIntelPromiscuousMode); EXPORT_SYMBOL(rtllib_EnableIntelPromiscuousMode);
/* /* Disables the specialized promiscuous mode required by Intel.
* Description: * See MgntEnableIntelPromiscuousMode for detail.
* This disables the specialized promiscuous mode required by Intel.
* See MgntEnableIntelPromiscuousMode for detail.
*/ */
void rtllib_DisableIntelPromiscuousMode(struct net_device *dev, void rtllib_DisableIntelPromiscuousMode(struct net_device *dev,
bool bInitState) bool bInitState)
...@@ -1709,8 +1702,8 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee, ...@@ -1709,8 +1702,8 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee,
(!apset && ssidset && ssidbroad && ssidmatch) || (!apset && ssidset && ssidbroad && ssidmatch) ||
(ieee->is_roaming && ssidset && ssidbroad && ssidmatch)) { (ieee->is_roaming && ssidset && ssidbroad && ssidmatch)) {
/* if the essid is hidden replace it with the /* if the essid is hidden replace it with the
* essid provided by the user. * essid provided by the user.
*/ */
if (!ssidbroad) { if (!ssidbroad) {
strncpy(tmp_ssid, ieee->current_network.ssid, strncpy(tmp_ssid, ieee->current_network.ssid,
IW_ESSID_MAX_SIZE); IW_ESSID_MAX_SIZE);
...@@ -2008,7 +2001,8 @@ static short rtllib_sta_ps_sleep(struct rtllib_device *ieee, u64 *time) ...@@ -2008,7 +2001,8 @@ static short rtllib_sta_ps_sleep(struct rtllib_device *ieee, u64 *time)
timeout = ieee->current_network.beacon_interval; timeout = ieee->current_network.beacon_interval;
ieee->current_network.dtim_data = RTLLIB_DTIM_INVALID; ieee->current_network.dtim_data = RTLLIB_DTIM_INVALID;
/* there's no need to nofity AP that I find you buffered /* there's no need to nofity AP that I find you buffered
* with broadcast packet */ * with broadcast packet
*/
if (dtim & (RTLLIB_DTIM_UCAST & ieee->ps)) if (dtim & (RTLLIB_DTIM_UCAST & ieee->ps))
return 2; return 2;
...@@ -2348,8 +2342,7 @@ static void rtllib_rx_auth_resp(struct rtllib_device *ieee, struct sk_buff *skb) ...@@ -2348,8 +2342,7 @@ static void rtllib_rx_auth_resp(struct rtllib_device *ieee, struct sk_buff *skb)
} }
} }
} }
/* Dummy wirless mode setting to avoid /* Dummy wirless mode setting to avoid encryption issue */
* encryption issue */
if (bSupportNmode) { if (bSupportNmode) {
ieee->SetWirelessMode(ieee->dev, ieee->SetWirelessMode(ieee->dev,
ieee->current_network.mode); ieee->current_network.mode);
...@@ -2395,8 +2388,8 @@ inline int rtllib_rx_deauth(struct rtllib_device *ieee, struct sk_buff *skb) ...@@ -2395,8 +2388,8 @@ inline int rtllib_rx_deauth(struct rtllib_device *ieee, struct sk_buff *skb)
return 0; return 0;
/* FIXME for now repeat all the association procedure /* FIXME for now repeat all the association procedure
* both for disassociation and deauthentication * both for disassociation and deauthentication
*/ */
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
ieee->state == RTLLIB_LINKED && ieee->state == RTLLIB_LINKED &&
(ieee->iw_mode == IW_MODE_INFRA)) { (ieee->iw_mode == IW_MODE_INFRA)) {
...@@ -2499,16 +2492,17 @@ void rtllib_softmac_xmit(struct rtllib_txb *txb, struct rtllib_device *ieee) ...@@ -2499,16 +2492,17 @@ void rtllib_softmac_xmit(struct rtllib_txb *txb, struct rtllib_device *ieee)
ieee->stats.multicast++; ieee->stats.multicast++;
/* if xmit available, just xmit it immediately, else just insert it to /* if xmit available, just xmit it immediately, else just insert it to
* the wait queue */ * the wait queue
*/
for (i = 0; i < txb->nr_frags; i++) { for (i = 0; i < txb->nr_frags; i++) {
queue_len = skb_queue_len(&ieee->skb_waitQ[queue_index]); queue_len = skb_queue_len(&ieee->skb_waitQ[queue_index]);
if ((queue_len != 0) || if ((queue_len != 0) ||
(!ieee->check_nic_enough_desc(ieee->dev, queue_index)) || (!ieee->check_nic_enough_desc(ieee->dev, queue_index)) ||
(ieee->queue_stop)) { (ieee->queue_stop)) {
/* insert the skb packet to the wait queue */ /* insert the skb packet to the wait queue
/* as for the completion function, it does not need * as for the completion function, it does not need
* to check it any more. * to check it any more.
* */ */
if (queue_len < 200) if (queue_len < 200)
skb_queue_tail(&ieee->skb_waitQ[queue_index], skb_queue_tail(&ieee->skb_waitQ[queue_index],
txb->fragments[i]); txb->fragments[i]);
...@@ -2886,18 +2880,18 @@ static void rtllib_associate_retry_wq(void *data) ...@@ -2886,18 +2880,18 @@ static void rtllib_associate_retry_wq(void *data)
goto exit; goto exit;
/* until we do not set the state to RTLLIB_NOLINK /* until we do not set the state to RTLLIB_NOLINK
* there are no possibility to have someone else trying * there are no possibility to have someone else trying
* to start an association procedure (we get here with * to start an association procedure (we get here with
* ieee->state = RTLLIB_ASSOCIATING). * ieee->state = RTLLIB_ASSOCIATING).
* When we set the state to RTLLIB_NOLINK it is possible * When we set the state to RTLLIB_NOLINK it is possible
* that the RX path run an attempt to associate, but * that the RX path run an attempt to associate, but
* both rtllib_softmac_check_all_nets and the * both rtllib_softmac_check_all_nets and the
* RX path works with ieee->lock held so there are no * RX path works with ieee->lock held so there are no
* problems. If we are still disassociated then start a scan. * problems. If we are still disassociated then start a scan.
* the lock here is necessary to ensure no one try to start * the lock here is necessary to ensure no one try to start
* an association procedure when we have just checked the * an association procedure when we have just checked the
* state and we are going to start the scan. * state and we are going to start the scan.
*/ */
ieee->beinretry = true; ieee->beinretry = true;
ieee->state = RTLLIB_NOLINK; ieee->state = RTLLIB_NOLINK;
...@@ -3185,7 +3179,8 @@ void rtllib_softmac_free(struct rtllib_device *ieee) ...@@ -3185,7 +3179,8 @@ void rtllib_softmac_free(struct rtllib_device *ieee)
static int rtllib_wpa_enable(struct rtllib_device *ieee, int value) static int rtllib_wpa_enable(struct rtllib_device *ieee, int value)
{ {
/* This is called when wpa_supplicant loads and closes the driver /* This is called when wpa_supplicant loads and closes the driver
* interface. */ * interface.
*/
netdev_info(ieee->dev, "%s WPA\n", value ? "enabling" : "disabling"); netdev_info(ieee->dev, "%s WPA\n", value ? "enabling" : "disabling");
ieee->wpa_enabled = value; ieee->wpa_enabled = value;
memset(ieee->ap_mac_addr, 0, 6); memset(ieee->ap_mac_addr, 0, 6);
...@@ -3490,7 +3485,8 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, ...@@ -3490,7 +3485,8 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee,
* generate new IEEE 802.11 authentication which may end up in looping * generate new IEEE 802.11 authentication which may end up in looping
* with IEEE 802.1X. If your hardware requires a reset after WEP * with IEEE 802.1X. If your hardware requires a reset after WEP
* configuration (for example... Prism2), implement the reset_port in * configuration (for example... Prism2), implement the reset_port in
* the callbacks structures used to initialize the 802.11 stack. */ * the callbacks structures used to initialize the 802.11 stack.
*/
if (ieee->reset_on_keychange && if (ieee->reset_on_keychange &&
ieee->iw_mode != IW_MODE_INFRA && ieee->iw_mode != IW_MODE_INFRA &&
ieee->reset_port && ieee->reset_port &&
......
...@@ -53,102 +53,99 @@ ...@@ -53,102 +53,99 @@
#include "rtllib.h" #include "rtllib.h"
/* /* 802.11 Data Frame
*
*
802.11 Data Frame * 802.11 frame_control for data frames - 2 bytes
* ,-----------------------------------------------------------------------------------------.
* bits | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e |
802.11 frame_control for data frames - 2 bytes * |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------|
,-----------------------------------------------------------------------------------------. * val | 0 | 0 | 0 | 1 | x | 0 | 0 | 0 | 1 | 0 | x | x | x | x | x |
bits | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | * |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------|
|----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| * desc | ^-ver-^ | ^type-^ | ^-----subtype-----^ | to |from |more |retry| pwr |more |wep |
val | 0 | 0 | 0 | 1 | x | 0 | 0 | 0 | 1 | 0 | x | x | x | x | x | * | | | x=0 data,x=1 data+ack | DS | DS |frag | | mgm |data | |
|----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| * '-----------------------------------------------------------------------------------------'
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 >-----------'
| * |
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 |
Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | * | | tion | (BSSID) | | | ence | data | |
|------|------|---------|---------|---------|------|---------|------| * `--------------------------------------------------| |------'
Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | Frame | fcs | * Total: 28 non-data bytes `----.----'
| | tion | (BSSID) | | | ence | data | | * |
`--------------------------------------------------| |------' * .- 'Frame data' expands to <---------------------------'
Total: 28 non-data bytes `----.----' * |
| * V
.- 'Frame data' expands to <---------------------------' * ,---------------------------------------------------.
| * Bytes | 1 | 1 | 1 | 3 | 2 | 0-2304 |
V * |------|------|---------|----------|------|---------|
,---------------------------------------------------. * Desc. | SNAP | SNAP | Control |Eth Tunnel| Type | IP |
Bytes | 1 | 1 | 1 | 3 | 2 | 0-2304 | * | DSAP | SSAP | | | | Packet |
|------|------|---------|----------|------|---------| * | 0xAA | 0xAA |0x03 (UI)|0x00-00-F8| | |
Desc. | SNAP | SNAP | Control |Eth Tunnel| Type | IP | * `-----------------------------------------| |
| DSAP | SSAP | | | | Packet | * Total: 8 non-data bytes `----.----'
| 0xAA | 0xAA |0x03 (UI)|0x00-00-F8| | | * |
`-----------------------------------------| | * .- 'IP Packet' expands, if WEP enabled, to <--'
Total: 8 non-data bytes `----.----' * |
| * V
.- 'IP Packet' expands, if WEP enabled, to <--' * ,-----------------------.
| * Bytes | 4 | 0-2296 | 4 |
V * |-----|-----------|-----|
,-----------------------. * Desc. | IV | Encrypted | ICV |
Bytes | 4 | 0-2296 | 4 | * | | IP Packet | |
|-----|-----------|-----| * `-----------------------'
Desc. | IV | Encrypted | ICV | * Total: 8 non-data bytes
| | IP Packet | | *
`-----------------------' *
Total: 8 non-data bytes * 802.3 Ethernet Data Frame
*
* ,-----------------------------------------.
802.3 Ethernet Data Frame * Bytes | 6 | 6 | 2 | Variable | 4 |
* |-------|-------|------|-----------|------|
,-----------------------------------------. * Desc. | Dest. | Source| Type | IP Packet | fcs |
Bytes | 6 | 6 | 2 | Variable | 4 | * | MAC | MAC | | | |
|-------|-------|------|-----------|------| * `-----------------------------------------'
Desc. | Dest. | Source| Type | IP Packet | fcs | * Total: 18 non-data bytes
| MAC | MAC | | | | *
`-----------------------------------------' * In the event that fragmentation is required, the incoming payload is split into
Total: 18 non-data bytes * N parts of size ieee->fts. The first fragment contains the SNAP header and the
* remaining packets are just data.
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 * If encryption is enabled, each fragment payload size is reduced by enough space
remaining packets are just data. * 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
If encryption is enabled, each fragment payload size is reduced by enough space * encryption it will take 3 frames. With WEP it will take 4 frames as the
to add the prefix and postfix (IV and ICV totalling 8 bytes in the case of WEP) * payload of each frame is reduced to 492 bytes.
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 * SKB visualization
payload of each frame is reduced to 492 bytes. *
* ,- skb->data
* SKB visualization * |
* * | ETHERNET HEADER ,-<-- PAYLOAD
* ,- skb->data * | | 14 bytes from skb->data
* | * | 2 bytes for Type --> ,T. | (sizeof ethhdr)
* | ETHERNET HEADER ,-<-- PAYLOAD * | | | |
* | | 14 bytes from skb->data * |,-Dest.--. ,--Src.---. | | |
* | 2 bytes for Type --> ,T. | (sizeof ethhdr) * | 6 bytes| | 6 bytes | | | |
* | | | | * v | | | | | |
* |,-Dest.--. ,--Src.---. | | | * 0 | v 1 | v | v 2
* | 6 bytes| | 6 bytes | | | | * 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
* 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
* | | | | `T' <---- 2 bytes for Type * | |
* | | | | * `-IV--' <-------------------- 4 bytes for IV (WEP)
* | | '---SNAP--' <-------- 6 bytes for SNAP *
* | | * SNAP HEADER
* `-IV--' <-------------------- 4 bytes for IV (WEP) *
* */
* SNAP HEADER
*
*/
static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; static 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,10 +187,12 @@ int rtllib_encrypt_fragment(struct rtllib_device *ieee, struct sk_buff *frag,
return -1; return -1;
} }
/* To encrypt, frame format is: /* 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)
*/
/* Host-based IEEE 802.11 fragmentation for TX is not yet supported, so /* 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); atomic_inc(&crypt->refcnt);
res = 0; res = 0;
if (crypt->ops->encrypt_msdu) if (crypt->ops->encrypt_msdu)
...@@ -591,7 +590,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) ...@@ -591,7 +590,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
spin_lock_irqsave(&ieee->lock, flags); spin_lock_irqsave(&ieee->lock, flags);
/* If there is no driver handler to take the TXB, don't bother /* If there is no driver handler to take the TXB, don't bother
* creating it... */ * creating it...
*/
if ((!ieee->hard_start_xmit && !(ieee->softmac_features & if ((!ieee->hard_start_xmit && !(ieee->softmac_features &
IEEE_SOFTMAC_TX_QUEUE)) || IEEE_SOFTMAC_TX_QUEUE)) ||
((!ieee->softmac_data_hard_start_xmit && ((!ieee->softmac_data_hard_start_xmit &&
...@@ -692,7 +692,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) ...@@ -692,7 +692,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
if (ieee->iw_mode == IW_MODE_INFRA) { if (ieee->iw_mode == IW_MODE_INFRA) {
fc |= RTLLIB_FCTL_TODS; fc |= RTLLIB_FCTL_TODS;
/* To DS: Addr1 = BSSID, Addr2 = SA, /* To DS: Addr1 = BSSID, Addr2 = SA,
Addr3 = DA */ * Addr3 = DA
*/
memcpy(&header.addr1, ieee->current_network.bssid, memcpy(&header.addr1, ieee->current_network.bssid,
ETH_ALEN); ETH_ALEN);
memcpy(&header.addr2, &src, ETH_ALEN); memcpy(&header.addr2, &src, ETH_ALEN);
...@@ -703,7 +704,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) ...@@ -703,7 +704,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
memcpy(&header.addr3, &dest, ETH_ALEN); memcpy(&header.addr3, &dest, ETH_ALEN);
} else if (ieee->iw_mode == IW_MODE_ADHOC) { } else if (ieee->iw_mode == IW_MODE_ADHOC) {
/* not From/To DS: Addr1 = DA, Addr2 = SA, /* not From/To DS: Addr1 = DA, Addr2 = SA,
Addr3 = BSSID */ * Addr3 = BSSID
*/
memcpy(&header.addr1, dest, ETH_ALEN); memcpy(&header.addr1, dest, ETH_ALEN);
memcpy(&header.addr2, src, ETH_ALEN); memcpy(&header.addr2, src, ETH_ALEN);
memcpy(&header.addr3, ieee->current_network.bssid, memcpy(&header.addr3, ieee->current_network.bssid,
...@@ -715,7 +717,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) ...@@ -715,7 +717,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
header.frame_ctl = cpu_to_le16(fc); header.frame_ctl = cpu_to_le16(fc);
/* Determine fragmentation size based on destination (multicast /* Determine fragmentation size based on destination (multicast
* and broadcast are not fragmented) */ * and broadcast are not fragmented)
*/
if (bIsMulticast) { if (bIsMulticast) {
frag_size = MAX_FRAG_THRESHOLD; frag_size = MAX_FRAG_THRESHOLD;
qos_ctl |= QOS_CTL_NOTCONTAIN_ACK; qos_ctl |= QOS_CTL_NOTCONTAIN_ACK;
...@@ -744,14 +747,16 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) ...@@ -744,14 +747,16 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
/* Determine amount of payload per fragment. Regardless of if /* Determine amount of payload per fragment. Regardless of if
* this stack is providing the full 802.11 header, one will * this stack is providing the full 802.11 header, one will
* eventually be affixed to this fragment -- so we must account * eventually be affixed to this fragment -- so we must account
* for it when determining the amount of payload space. */ * for it when determining the amount of payload space.
*/
bytes_per_frag = frag_size - hdr_len; bytes_per_frag = frag_size - hdr_len;
if (ieee->config & if (ieee->config &
(CFG_RTLLIB_COMPUTE_FCS | CFG_RTLLIB_RESERVE_FCS)) (CFG_RTLLIB_COMPUTE_FCS | CFG_RTLLIB_RESERVE_FCS))
bytes_per_frag -= RTLLIB_FCS_LEN; bytes_per_frag -= RTLLIB_FCS_LEN;
/* Each fragment may need to have room for encrypting /* Each fragment may need to have room for encrypting
* pre/postfix */ * pre/postfix
*/
if (encrypt) { if (encrypt) {
bytes_per_frag -= crypt->ops->extra_mpdu_prefix_len + bytes_per_frag -= crypt->ops->extra_mpdu_prefix_len +
crypt->ops->extra_mpdu_postfix_len + crypt->ops->extra_mpdu_postfix_len +
...@@ -759,7 +764,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) ...@@ -759,7 +764,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
crypt->ops->extra_msdu_postfix_len; crypt->ops->extra_msdu_postfix_len;
} }
/* Number of fragments is the total bytes_per_frag / /* Number of fragments is the total bytes_per_frag /
* payload_per_fragment */ * payload_per_fragment
*/
nr_frags = bytes / bytes_per_frag; nr_frags = bytes / bytes_per_frag;
bytes_last_frag = bytes % bytes_per_frag; bytes_last_frag = bytes % bytes_per_frag;
if (bytes_last_frag) if (bytes_last_frag)
...@@ -769,7 +775,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) ...@@ -769,7 +775,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
/* When we allocate the TXB we allocate enough space for the /* When we allocate the TXB we allocate enough space for the
* reserve and full fragment bytes (bytes_per_frag doesn't * reserve and full fragment bytes (bytes_per_frag doesn't
* include prefix, postfix, header, FCS, etc.) */ * include prefix, postfix, header, FCS, etc.)
*/
txb = rtllib_alloc_txb(nr_frags, frag_size + txb = rtllib_alloc_txb(nr_frags, frag_size +
ieee->tx_headroom, GFP_ATOMIC); ieee->tx_headroom, GFP_ATOMIC);
if (unlikely(!txb)) { if (unlikely(!txb)) {
...@@ -813,7 +820,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) ...@@ -813,7 +820,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
memcpy(frag_hdr, &header, hdr_len); memcpy(frag_hdr, &header, hdr_len);
/* If this is not the last fragment, then add the /* If this is not the last fragment, then add the
* MOREFRAGS bit to the frame control */ * MOREFRAGS bit to the frame control
*/
if (i != nr_frags - 1) { if (i != nr_frags - 1) {
frag_hdr->frame_ctl = cpu_to_le16( frag_hdr->frame_ctl = cpu_to_le16(
fc | RTLLIB_FCTL_MOREFRAGS); fc | RTLLIB_FCTL_MOREFRAGS);
...@@ -848,7 +856,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) ...@@ -848,7 +856,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
/* Encryption routine will move the header forward in /* Encryption routine will move the header forward in
* order to insert the IV between the header and the * order to insert the IV between the header and the
* payload */ * payload
*/
if (encrypt) if (encrypt)
rtllib_encrypt_fragment(ieee, skb_frag, rtllib_encrypt_fragment(ieee, skb_frag,
hdr_len); hdr_len);
......
...@@ -241,7 +241,8 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee, ...@@ -241,7 +241,8 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee,
} }
/* Add EXTRA: Age to display seconds since last beacon/probe response /* Add EXTRA: Age to display seconds since last beacon/probe response
* for given network. */ * for given network.
*/
iwe.cmd = IWEVCUSTOM; iwe.cmd = IWEVCUSTOM;
p = custom; p = custom;
p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), p += snprintf(p, MAX_CUSTOM_LEN - (p - custom),
...@@ -337,7 +338,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, ...@@ -337,7 +338,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
RTLLIB_DEBUG_WX("Disabling encryption.\n"); RTLLIB_DEBUG_WX("Disabling encryption.\n");
/* Check all the keys to see if any are still configured, /* Check all the keys to see if any are still configured,
* and if no key index was provided, de-init them all */ * and if no key index was provided, de-init them all
*/
for (i = 0; i < NUM_WEP_KEYS; i++) { for (i = 0; i < NUM_WEP_KEYS; i++) {
if (ieee->crypt_info.crypt[i] != NULL) { if (ieee->crypt_info.crypt[i] != NULL) {
if (key_provided) if (key_provided)
...@@ -364,7 +366,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, ...@@ -364,7 +366,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
if (*crypt != NULL && (*crypt)->ops != NULL && if (*crypt != NULL && (*crypt)->ops != NULL &&
strcmp((*crypt)->ops->name, "R-WEP") != 0) { strcmp((*crypt)->ops->name, "R-WEP") != 0) {
/* changing to use WEP; deinit previously used algorithm /* changing to use WEP; deinit previously used algorithm
* on this key */ * on this key
*/
lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt);
} }
...@@ -412,7 +415,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, ...@@ -412,7 +415,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
(*crypt)->priv); (*crypt)->priv);
sec.flags |= (1 << key); sec.flags |= (1 << key);
/* This ensures a key will be activated if no key is /* This ensures a key will be activated if no key is
* explicitly set */ * explicitly set
*/
if (key == sec.active_key) if (key == sec.active_key)
sec.flags |= SEC_ACTIVE_KEY; sec.flags |= SEC_ACTIVE_KEY;
ieee->crypt_info.tx_keyidx = key; ieee->crypt_info.tx_keyidx = key;
...@@ -451,7 +455,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, ...@@ -451,7 +455,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
"OPEN" : "SHARED KEY"); "OPEN" : "SHARED KEY");
/* For now we just support WEP, so only set that security level... /* For now we just support WEP, so only set that security level...
* TODO: When WPA is added this is one place that needs to change */ * TODO: When WPA is added this is one place that needs to change
*/
sec.flags |= SEC_LEVEL; sec.flags |= SEC_LEVEL;
sec.level = SEC_LEVEL_1; /* 40 and 104 bit WEP */ sec.level = SEC_LEVEL_1; /* 40 and 104 bit WEP */
...@@ -462,7 +467,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, ...@@ -462,7 +467,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
* generate new IEEE 802.11 authentication which may end up in looping * generate new IEEE 802.11 authentication which may end up in looping
* with IEEE 802.1X. If your hardware requires a reset after WEP * with IEEE 802.1X. If your hardware requires a reset after WEP
* configuration (for example... Prism2), implement the reset_port in * configuration (for example... Prism2), implement the reset_port in
* the callbacks structures used to initialize the 802.11 stack. */ * the callbacks structures used to initialize the 802.11 stack.
*/
if (ieee->reset_on_keychange && if (ieee->reset_on_keychange &&
ieee->iw_mode != IW_MODE_INFRA && ieee->iw_mode != IW_MODE_INFRA &&
ieee->reset_port && ieee->reset_port(dev)) { ieee->reset_port && ieee->reset_port(dev)) {
...@@ -791,8 +797,7 @@ int rtllib_wx_set_auth(struct rtllib_device *ieee, ...@@ -791,8 +797,7 @@ int rtllib_wx_set_auth(struct rtllib_device *ieee,
case IW_AUTH_CIPHER_PAIRWISE: case IW_AUTH_CIPHER_PAIRWISE:
case IW_AUTH_CIPHER_GROUP: case IW_AUTH_CIPHER_GROUP:
case IW_AUTH_KEY_MGMT: case IW_AUTH_KEY_MGMT:
/* /* Host AP driver does not use these parameters and allows
* Host AP driver does not use these parameters and allows
* wpa_supplicant to control them internally. * wpa_supplicant to control them internally.
*/ */
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment