diff options
Diffstat (limited to 'kernel/drivers/staging/rtl8192u/ieee80211')
14 files changed, 488 insertions, 706 deletions
diff --git a/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211.h index 0f53c6a97..967ef9a98 100644 --- a/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211.h +++ b/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211.h @@ -24,7 +24,7 @@ #ifndef IEEE80211_H #define IEEE80211_H #include <linux/if_ether.h> /* ETH_ALEN */ -#include <linux/kernel.h> /* ARRAY_SIZE */ +#include <linux/kernel.h> #include <linux/module.h> #include <linux/jiffies.h> #include <linux/timer.h> @@ -34,6 +34,7 @@ #include <linux/delay.h> #include <linux/wireless.h> +#include <linux/ieee80211.h> #include "rtl819x_HT.h" #include "rtl819x_BA.h" @@ -48,21 +49,6 @@ #define IWEVCUSTOM 0x8c02 #endif - -#ifndef container_of -/** - * container_of - cast a member of a structure out to the containing structure - * - * @ptr: the pointer to the member. - * @type: the type of the container struct this is embedded in. - * @member: the name of the member within the struct. - * - */ -#define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) -#endif - #define KEY_TYPE_NA 0x0 #define KEY_TYPE_WEP40 0x1 #define KEY_TYPE_TKIP 0x2 @@ -187,54 +173,6 @@ typedef struct cb_desc { #define MGN_MCS14 0x8e #define MGN_MCS15 0x8f -//---------------------------------------------------------------------------- -// 802.11 Management frame Reason Code field -//---------------------------------------------------------------------------- -enum _ReasonCode{ - unspec_reason = 0x1, - auth_not_valid = 0x2, - deauth_lv_ss = 0x3, - inactivity = 0x4, - ap_overload = 0x5, - class2_err = 0x6, - class3_err = 0x7, - disas_lv_ss = 0x8, - asoc_not_auth = 0x9, - - //----MIC_CHECK - mic_failure = 0xe, - //----END MIC_CHECK - - // Reason code defined in 802.11i D10.0 p.28. - invalid_IE = 0x0d, - four_way_tmout = 0x0f, - two_way_tmout = 0x10, - IE_dismatch = 0x11, - invalid_Gcipher = 0x12, - invalid_Pcipher = 0x13, - invalid_AKMP = 0x14, - unsup_RSNIEver = 0x15, - invalid_RSNIE = 0x16, - auth_802_1x_fail= 0x17, - ciper_reject = 0x18, - - // Reason code defined in 7.3.1.7, 802.1e D13.0, p.42. Added by Annie, 2005-11-15. - QoS_unspec = 0x20, // 32 - QAP_bandwidth = 0x21, // 33 - poor_condition = 0x22, // 34 - no_facility = 0x23, // 35 - // Where is 36??? - req_declined = 0x25, // 37 - invalid_param = 0x26, // 38 - req_not_honored= 0x27, // 39 - TS_not_created = 0x2F, // 47 - DL_not_allowed = 0x30, // 48 - dest_not_exist = 0x31, // 49 - dest_not_QSTA = 0x32, // 50 -}; - - - #define aSifsTime ((priv->ieee80211->current_network.mode == IEEE_A || \ priv->ieee80211->current_network.mode == IEEE_N_24G || \ priv->ieee80211->current_network.mode == IEEE_N_5G) ? \ @@ -477,7 +415,7 @@ typedef struct ieee_param { /* QOS control */ #define IEEE80211_QCTL_TID 0x000F -#define FC_QOS_BIT BIT7 +#define FC_QOS_BIT BIT(7) #define IsDataFrame(pdu) ( ((pdu[0] & 0x0C)==0x08) ? true : false ) #define IsLegacyDataFrame(pdu) (IsDataFrame(pdu) && (!(pdu[0]&FC_QOS_BIT)) ) //added by wb. Is this right? @@ -646,13 +584,6 @@ struct ieee80211_snap_hdr { #define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG) #define WLAN_GET_SEQ_SEQ(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4) -/* Authentication algorithms */ -#define WLAN_AUTH_OPEN 0 -#define WLAN_AUTH_SHARED_KEY 1 -#define WLAN_AUTH_LEAP 2 - -#define WLAN_AUTH_CHALLENGE_LEN 128 - #define WLAN_CAPABILITY_BSS (1<<0) #define WLAN_CAPABILITY_IBSS (1<<1) #define WLAN_CAPABILITY_CF_POLLABLE (1<<2) @@ -671,69 +602,6 @@ struct ieee80211_snap_hdr { #define WLAN_ERP_USE_PROTECTION (1<<1) #define WLAN_ERP_BARKER_PREAMBLE (1<<2) -/* Status codes */ -enum ieee80211_statuscode { - WLAN_STATUS_SUCCESS = 0, - WLAN_STATUS_UNSPECIFIED_FAILURE = 1, - WLAN_STATUS_CAPS_UNSUPPORTED = 10, - WLAN_STATUS_REASSOC_NO_ASSOC = 11, - WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12, - WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13, - WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14, - WLAN_STATUS_CHALLENGE_FAIL = 15, - WLAN_STATUS_AUTH_TIMEOUT = 16, - WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17, - WLAN_STATUS_ASSOC_DENIED_RATES = 18, - /* 802.11b */ - WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19, - WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20, - WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21, - /* 802.11h */ - WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22, - WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23, - WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24, - /* 802.11g */ - WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25, - WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26, - /* 802.11i */ - WLAN_STATUS_INVALID_IE = 40, - WLAN_STATUS_INVALID_GROUP_CIPHER = 41, - WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42, - WLAN_STATUS_INVALID_AKMP = 43, - WLAN_STATUS_UNSUPP_RSN_VERSION = 44, - WLAN_STATUS_INVALID_RSN_IE_CAP = 45, - WLAN_STATUS_CIPHER_SUITE_REJECTED = 46, -}; - -/* Reason codes */ -enum ieee80211_reasoncode { - WLAN_REASON_UNSPECIFIED = 1, - WLAN_REASON_PREV_AUTH_NOT_VALID = 2, - WLAN_REASON_DEAUTH_LEAVING = 3, - WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4, - WLAN_REASON_DISASSOC_AP_BUSY = 5, - WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6, - WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7, - WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8, - WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9, - /* 802.11h */ - WLAN_REASON_DISASSOC_BAD_POWER = 10, - WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11, - /* 802.11i */ - WLAN_REASON_INVALID_IE = 13, - WLAN_REASON_MIC_FAILURE = 14, - WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15, - WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16, - WLAN_REASON_IE_DIFFERENT = 17, - WLAN_REASON_INVALID_GROUP_CIPHER = 18, - WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19, - WLAN_REASON_INVALID_AKMP = 20, - WLAN_REASON_UNSUPP_RSN_VERSION = 21, - WLAN_REASON_INVALID_RSN_IE_CAP = 22, - WLAN_REASON_IEEE8021X_FAILED = 23, - WLAN_REASON_CIPHER_SUITE_REJECTED = 24, -}; - #define IEEE80211_STATMASK_SIGNAL (1<<0) #define IEEE80211_STATMASK_RSSI (1<<1) #define IEEE80211_STATMASK_NOISE (1<<2) @@ -961,10 +829,10 @@ struct ieee80211_device; struct ieee80211_security { u16 active_key:2, enabled:1, - auth_mode:2, auth_algo:4, unicast_uses_group:1, encrypt:1; + u8 auth_mode; u8 key_sizes[WEP_KEYS]; u8 keys[WEP_KEYS][SCM_KEY_LEN]; u8 level; @@ -1020,20 +888,20 @@ enum ieee80211_mfie { /* Minimal header; can be used for passing 802.11 frames with sufficient * information to determine what type of underlying data type is actually * stored in the data. */ -struct ieee80211_hdr { +struct rtl_80211_hdr { __le16 frame_ctl; __le16 duration_id; u8 payload[0]; } __packed; -struct ieee80211_hdr_1addr { +struct rtl_80211_hdr_1addr { __le16 frame_ctl; __le16 duration_id; u8 addr1[ETH_ALEN]; u8 payload[0]; } __packed; -struct ieee80211_hdr_2addr { +struct rtl_80211_hdr_2addr { __le16 frame_ctl; __le16 duration_id; u8 addr1[ETH_ALEN]; @@ -1041,7 +909,7 @@ struct ieee80211_hdr_2addr { u8 payload[0]; } __packed; -struct ieee80211_hdr_3addr { +struct rtl_80211_hdr_3addr { __le16 frame_ctl; __le16 duration_id; u8 addr1[ETH_ALEN]; @@ -1051,7 +919,7 @@ struct ieee80211_hdr_3addr { u8 payload[0]; } __packed; -struct ieee80211_hdr_4addr { +struct rtl_80211_hdr_4addr { __le16 frame_ctl; __le16 duration_id; u8 addr1[ETH_ALEN]; @@ -1062,7 +930,7 @@ struct ieee80211_hdr_4addr { u8 payload[0]; } __packed; -struct ieee80211_hdr_3addrqos { +struct rtl_80211_hdr_3addrqos { __le16 frame_ctl; __le16 duration_id; u8 addr1[ETH_ALEN]; @@ -1073,7 +941,7 @@ struct ieee80211_hdr_3addrqos { __le16 qos_ctl; } __packed; -struct ieee80211_hdr_4addrqos { +struct rtl_80211_hdr_4addrqos { __le16 frame_ctl; __le16 duration_id; u8 addr1[ETH_ALEN]; @@ -1092,7 +960,7 @@ struct ieee80211_info_element { } __packed; struct ieee80211_authentication { - struct ieee80211_hdr_3addr header; + struct rtl_80211_hdr_3addr header; __le16 algorithm; __le16 transaction; __le16 status; @@ -1101,18 +969,18 @@ struct ieee80211_authentication { } __packed; struct ieee80211_disassoc { - struct ieee80211_hdr_3addr header; + struct rtl_80211_hdr_3addr header; __le16 reason; } __packed; struct ieee80211_probe_request { - struct ieee80211_hdr_3addr header; + struct rtl_80211_hdr_3addr header; /* SSID, supported rates */ struct ieee80211_info_element info_element[0]; } __packed; struct ieee80211_probe_response { - struct ieee80211_hdr_3addr header; + struct rtl_80211_hdr_3addr header; __le32 time_stamp[2]; __le16 beacon_interval; __le16 capability; @@ -1125,7 +993,7 @@ struct ieee80211_probe_response { #define ieee80211_beacon ieee80211_probe_response struct ieee80211_assoc_request_frame { - struct ieee80211_hdr_3addr header; + struct rtl_80211_hdr_3addr header; __le16 capability; __le16 listen_interval; /* SSID, supported rates, RSN */ @@ -1133,7 +1001,7 @@ struct ieee80211_assoc_request_frame { } __packed; struct ieee80211_reassoc_request_frame { - struct ieee80211_hdr_3addr header; + struct rtl_80211_hdr_3addr header; __le16 capability; __le16 listen_interval; u8 current_ap[ETH_ALEN]; @@ -1142,7 +1010,7 @@ struct ieee80211_reassoc_request_frame { } __packed; struct ieee80211_assoc_response_frame { - struct ieee80211_hdr_3addr header; + struct rtl_80211_hdr_3addr header; __le16 capability; __le16 status; __le16 aid; @@ -1276,12 +1144,6 @@ struct ieee80211_tim_parameters { } __packed; //#else -struct ieee80211_wmm_ac_param { - u8 ac_aci_acm_aifsn; - u8 ac_ecwmin_ecwmax; - u16 ac_txop_limit; -}; - struct ieee80211_wmm_ts_info { u8 ac_dir_tid; u8 ac_up_psb; @@ -1329,9 +1191,9 @@ static inline const char *eap_get_type(int type) //added by amy for reorder static inline u8 Frame_QoSTID(u8 *buf) { - struct ieee80211_hdr_3addr *hdr; + struct rtl_80211_hdr_3addr *hdr; u16 fc; - hdr = (struct ieee80211_hdr_3addr *)buf; + hdr = (struct rtl_80211_hdr_3addr *)buf; fc = le16_to_cpu(hdr->frame_ctl); return (u8)((frameqos *)(buf + (((fc & IEEE80211_FCTL_TODS)&&(fc & IEEE80211_FCTL_FROMDS))? 30 : 24)))->field.tid; } @@ -1703,10 +1565,10 @@ typedef struct _RT_POWER_SAVE_CONTROL { } RT_POWER_SAVE_CONTROL, *PRT_POWER_SAVE_CONTROL; typedef u32 RT_RF_CHANGE_SOURCE; -#define RF_CHANGE_BY_SW BIT31 -#define RF_CHANGE_BY_HW BIT30 -#define RF_CHANGE_BY_PS BIT29 -#define RF_CHANGE_BY_IPS BIT28 +#define RF_CHANGE_BY_SW BIT(31) +#define RF_CHANGE_BY_HW BIT(30) +#define RF_CHANGE_BY_PS BIT(29) +#define RF_CHANGE_BY_IPS BIT(28) #define RF_CHANGE_BY_INIT 0 // Do not change the RFOff reason. Defined by Bruce, 2008-01-17. typedef enum @@ -2262,17 +2124,17 @@ static inline int ieee80211_get_hdrlen(u16 fc) return hdrlen; } -static inline u8 *ieee80211_get_payload(struct ieee80211_hdr *hdr) +static inline u8 *ieee80211_get_payload(struct rtl_80211_hdr *hdr) { switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) { case IEEE80211_1ADDR_LEN: - return ((struct ieee80211_hdr_1addr *)hdr)->payload; + return ((struct rtl_80211_hdr_1addr *)hdr)->payload; case IEEE80211_2ADDR_LEN: - return ((struct ieee80211_hdr_2addr *)hdr)->payload; + return ((struct rtl_80211_hdr_2addr *)hdr)->payload; case IEEE80211_3ADDR_LEN: - return ((struct ieee80211_hdr_3addr *)hdr)->payload; + return ((struct rtl_80211_hdr_3addr *)hdr)->payload; case IEEE80211_4ADDR_LEN: - return ((struct ieee80211_hdr_4addr *)hdr)->payload; + return ((struct rtl_80211_hdr_4addr *)hdr)->payload; } return NULL; } @@ -2307,98 +2169,99 @@ static inline int ieee80211_is_cck_rate(u8 rate) /* ieee80211.c */ -extern void free_ieee80211(struct net_device *dev); -extern struct net_device *alloc_ieee80211(int sizeof_priv); +void free_ieee80211(struct net_device *dev); +struct net_device *alloc_ieee80211(int sizeof_priv); -extern int ieee80211_set_encryption(struct ieee80211_device *ieee); +int ieee80211_set_encryption(struct ieee80211_device *ieee); /* ieee80211_tx.c */ -extern int ieee80211_encrypt_fragment( - struct ieee80211_device *ieee, - struct sk_buff *frag, - int hdr_len); +int ieee80211_encrypt_fragment(struct ieee80211_device *ieee, + struct sk_buff *frag, int hdr_len); -extern int ieee80211_xmit(struct sk_buff *skb, - struct net_device *dev); -extern void ieee80211_txb_free(struct ieee80211_txb *); +int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev); +void ieee80211_txb_free(struct ieee80211_txb *); /* ieee80211_rx.c */ -extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, - struct ieee80211_rx_stats *rx_stats); -extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, - struct ieee80211_hdr_4addr *header, - struct ieee80211_rx_stats *stats); +int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, + struct ieee80211_rx_stats *rx_stats); +void ieee80211_rx_mgt(struct ieee80211_device *ieee, + struct rtl_80211_hdr_4addr *header, + struct ieee80211_rx_stats *stats); /* ieee80211_wx.c */ -extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *key); -extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *key); -extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *key); -extern int ieee80211_wx_get_encode_ext(struct ieee80211_device *ieee, +int ieee80211_wx_get_scan(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *key); +int ieee80211_wx_set_encode(struct ieee80211_device *ieee, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); -extern int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, + union iwreq_data *wrqu, char *key); +int ieee80211_wx_get_encode(struct ieee80211_device *ieee, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); -extern int ieee80211_wx_set_auth(struct ieee80211_device *ieee, - struct iw_request_info *info, - struct iw_param *data, char *extra); -extern int ieee80211_wx_set_mlme(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); -extern int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len); + union iwreq_data *wrqu, char *key); +int ieee80211_wx_get_encode_ext(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); +int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); +int ieee80211_wx_set_auth(struct ieee80211_device *ieee, + struct iw_request_info *info, + struct iw_param *data, char *extra); +int ieee80211_wx_set_mlme(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); +int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len); /* ieee80211_softmac.c */ -extern short ieee80211_is_54g(const struct ieee80211_network *net); -extern short ieee80211_is_shortslot(const struct ieee80211_network *net); -extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, - struct ieee80211_rx_stats *rx_stats, u16 type, - u16 stype); -extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net); +short ieee80211_is_54g(const struct ieee80211_network *net); +short ieee80211_is_shortslot(const struct ieee80211_network *net); +int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, + struct sk_buff *skb, + struct ieee80211_rx_stats *rx_stats, + u16 type, u16 stype); +void ieee80211_softmac_new_net(struct ieee80211_device *ieee, + struct ieee80211_network *net); void SendDisassociation(struct ieee80211_device *ieee, u8 *asSta, u8 asRsn); -extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee); - -extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee); -extern void notify_wx_assoc_event(struct ieee80211_device *ieee); -extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee); -extern void ieee80211_start_bss(struct ieee80211_device *ieee); -extern void ieee80211_start_master_bss(struct ieee80211_device *ieee); -extern void ieee80211_start_ibss(struct ieee80211_device *ieee); -extern void ieee80211_softmac_init(struct ieee80211_device *ieee); -extern void ieee80211_softmac_free(struct ieee80211_device *ieee); -extern void ieee80211_associate_abort(struct ieee80211_device *ieee); -extern void ieee80211_disassociate(struct ieee80211_device *ieee); -extern void ieee80211_stop_scan(struct ieee80211_device *ieee); -extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee); -extern void ieee80211_check_all_nets(struct ieee80211_device *ieee); -extern void ieee80211_start_protocol(struct ieee80211_device *ieee); -extern void ieee80211_stop_protocol(struct ieee80211_device *ieee); -extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee); -extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee); -extern void ieee80211_reset_queue(struct ieee80211_device *ieee); -extern void ieee80211_wake_queue(struct ieee80211_device *ieee); -extern void ieee80211_stop_queue(struct ieee80211_device *ieee); -extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee); -extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee); -extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee); -extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p); -extern void notify_wx_assoc_event(struct ieee80211_device *ieee); -extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success); - -extern void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee); +void ieee80211_softmac_xmit(struct ieee80211_txb *txb, + struct ieee80211_device *ieee); + +void ieee80211_stop_send_beacons(struct ieee80211_device *ieee); +void notify_wx_assoc_event(struct ieee80211_device *ieee); +void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee); +void ieee80211_start_bss(struct ieee80211_device *ieee); +void ieee80211_start_master_bss(struct ieee80211_device *ieee); +void ieee80211_start_ibss(struct ieee80211_device *ieee); +void ieee80211_softmac_init(struct ieee80211_device *ieee); +void ieee80211_softmac_free(struct ieee80211_device *ieee); +void ieee80211_associate_abort(struct ieee80211_device *ieee); +void ieee80211_disassociate(struct ieee80211_device *ieee); +void ieee80211_stop_scan(struct ieee80211_device *ieee); +void ieee80211_start_scan_syncro(struct ieee80211_device *ieee); +void ieee80211_check_all_nets(struct ieee80211_device *ieee); +void ieee80211_start_protocol(struct ieee80211_device *ieee); +void ieee80211_stop_protocol(struct ieee80211_device *ieee); +void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee); +void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee); +void ieee80211_reset_queue(struct ieee80211_device *ieee); +void ieee80211_wake_queue(struct ieee80211_device *ieee); +void ieee80211_stop_queue(struct ieee80211_device *ieee); +struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee); +void ieee80211_start_send_beacons(struct ieee80211_device *ieee); +void ieee80211_stop_send_beacons(struct ieee80211_device *ieee); +int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, + struct iw_point *p); +void notify_wx_assoc_event(struct ieee80211_device *ieee); +void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success); + +void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee); /* ieee80211_crypt_ccmp&tkip&wep.c */ -extern void ieee80211_tkip_null(void); -extern void ieee80211_wep_null(void); -extern void ieee80211_ccmp_null(void); +void ieee80211_tkip_null(void); +void ieee80211_wep_null(void); +void ieee80211_ccmp_null(void); int ieee80211_crypto_init(void); void ieee80211_crypto_deinit(void); @@ -2411,116 +2274,128 @@ void ieee80211_crypto_wep_exit(void); /* ieee80211_softmac_wx.c */ -extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *ext); +int ieee80211_wx_get_wap(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *ext); -extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee, +int ieee80211_wx_set_wap(struct ieee80211_device *ieee, struct iw_request_info *info, union iwreq_data *awrq, char *extra); -extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b); +int ieee80211_wx_get_essid(struct ieee80211_device *ieee, + struct iw_request_info *a, + union iwreq_data *wrqu, char *b); -extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); +int ieee80211_wx_set_rate(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); -extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); +int ieee80211_wx_get_rate(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); -extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a, - union iwreq_data *wrqu, char *b); +int ieee80211_wx_set_mode(struct ieee80211_device *ieee, + struct iw_request_info *a, + union iwreq_data *wrqu, char *b); -extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a, - union iwreq_data *wrqu, char *b); +int ieee80211_wx_set_scan(struct ieee80211_device *ieee, + struct iw_request_info *a, + union iwreq_data *wrqu, char *b); -extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee, - struct iw_request_info *a, - union iwreq_data *wrqu, char *extra); +int ieee80211_wx_set_essid(struct ieee80211_device *ieee, + struct iw_request_info *a, + union iwreq_data *wrqu, char *extra); -extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a, - union iwreq_data *wrqu, char *b); +int ieee80211_wx_get_mode(struct ieee80211_device *ieee, + struct iw_request_info *a, + union iwreq_data *wrqu, char *b); -extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a, - union iwreq_data *wrqu, char *b); +int ieee80211_wx_set_freq(struct ieee80211_device *ieee, + struct iw_request_info *a, + union iwreq_data *wrqu, char *b); -extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a, - union iwreq_data *wrqu, char *b); +int ieee80211_wx_get_freq(struct ieee80211_device *ieee, + struct iw_request_info *a, + union iwreq_data *wrqu, char *b); /* ieee80211_module.c */ -extern int ieee80211_debug_init(void); -extern void ieee80211_debug_exit(void); +int ieee80211_debug_init(void); +void ieee80211_debug_exit(void); //extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee); -extern void ieee80211_wx_sync_scan_wq(struct work_struct *work); +void ieee80211_wx_sync_scan_wq(struct work_struct *work); -extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, - struct iw_request_info *info, +int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, + struct iw_request_info *info, union iwreq_data *wrqu, char *extra); -extern int ieee80211_wx_get_name(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); +int ieee80211_wx_get_name(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); -extern int ieee80211_wx_set_power(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); +int ieee80211_wx_set_power(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); -extern int ieee80211_wx_get_power(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); +int ieee80211_wx_get_power(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); -extern int ieee80211_wx_set_rts(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); +int ieee80211_wx_set_rts(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); -extern int ieee80211_wx_get_rts(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); +int ieee80211_wx_get_rts(struct ieee80211_device *ieee, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); //HT #define MAX_RECEIVE_BUFFER_SIZE 9100 // -extern void HTDebugHTCapability(u8 *CapIE, u8 *TitleString ); -extern void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString); - -void HTSetConnectBwMode(struct ieee80211_device *ieee, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset); -extern void HTUpdateDefaultSetting(struct ieee80211_device *ieee); -extern void HTConstructCapabilityElement(struct ieee80211_device *ieee, u8 *posHTCap, u8 *len, u8 isEncrypt); -extern void HTConstructInfoElement(struct ieee80211_device *ieee, u8 *posHTInfo, u8 *len, u8 isEncrypt); -extern void HTConstructRT2RTAggElement(struct ieee80211_device *ieee, u8 *posRT2RTAgg, u8 *len); -extern void HTOnAssocRsp(struct ieee80211_device *ieee); -extern void HTInitializeHTInfo(struct ieee80211_device *ieee); -extern void HTInitializeBssDesc(PBSS_HT pBssHT); -extern void HTResetSelfAndSavePeerSetting(struct ieee80211_device *ieee, struct ieee80211_network *pNetwork); -extern void HTUpdateSelfAndPeerSetting(struct ieee80211_device *ieee, struct ieee80211_network *pNetwork); -extern u8 HTGetHighestMCSRate(struct ieee80211_device *ieee, u8 *pMCSRateSet, u8 *pMCSFilter); +void HTDebugHTCapability(u8 *CapIE, u8 *TitleString); +void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString); + +void HTSetConnectBwMode(struct ieee80211_device *ieee, + HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset); +void HTUpdateDefaultSetting(struct ieee80211_device *ieee); +void HTConstructCapabilityElement(struct ieee80211_device *ieee, u8 *posHTCap, + u8 *len, u8 isEncrypt); +void HTConstructInfoElement(struct ieee80211_device *ieee, u8 *posHTInfo, + u8 *len, u8 isEncrypt); +void HTConstructRT2RTAggElement(struct ieee80211_device *ieee, u8 *posRT2RTAgg, + u8 *len); +void HTOnAssocRsp(struct ieee80211_device *ieee); +void HTInitializeHTInfo(struct ieee80211_device *ieee); +void HTInitializeBssDesc(PBSS_HT pBssHT); +void HTResetSelfAndSavePeerSetting(struct ieee80211_device *ieee, + struct ieee80211_network *pNetwork); +void HTUpdateSelfAndPeerSetting(struct ieee80211_device *ieee, + struct ieee80211_network *pNetwork); +u8 HTGetHighestMCSRate(struct ieee80211_device *ieee, + u8 *pMCSRateSet, u8 *pMCSFilter); extern u8 MCS_FILTER_ALL[]; extern u16 MCS_DATA_RATE[2][2][77] ; -extern u8 HTCCheck(struct ieee80211_device *ieee, u8 *pFrame); +u8 HTCCheck(struct ieee80211_device *ieee, u8 *pFrame); //extern void HTSetConnectBwModeCallback(unsigned long data); -extern void HTResetIOTSetting(PRT_HIGH_THROUGHPUT pHTInfo); -extern bool IsHTHalfNmodeAPs(struct ieee80211_device *ieee); -extern u16 HTHalfMcsToDataRate(struct ieee80211_device *ieee, u8 nMcsRate); -extern u16 HTMcsToDataRate(struct ieee80211_device *ieee, u8 nMcsRate); -extern u16 TxCountToDataRate(struct ieee80211_device *ieee, u8 nDataRate); +void HTResetIOTSetting(PRT_HIGH_THROUGHPUT pHTInfo); +bool IsHTHalfNmodeAPs(struct ieee80211_device *ieee); +u16 HTHalfMcsToDataRate(struct ieee80211_device *ieee, u8 nMcsRate); +u16 HTMcsToDataRate(struct ieee80211_device *ieee, u8 nMcsRate); +u16 TxCountToDataRate(struct ieee80211_device *ieee, u8 nDataRate); //function in BAPROC.c -extern int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, - struct sk_buff *skb); -extern int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, - struct sk_buff *skb); -extern int ieee80211_rx_DELBA(struct ieee80211_device *ieee,struct sk_buff *skb); -extern void TsInitAddBA(struct ieee80211_device *ieee, PTX_TS_RECORD pTS, - u8 Policy, u8 bOverwritePending); -extern void TsInitDelBA(struct ieee80211_device *ieee, - PTS_COMMON_INFO pTsCommonInfo, TR_SELECT TxRxSelect); -extern void BaSetupTimeOut(unsigned long data); -extern void TxBaInactTimeout(unsigned long data); -extern void RxBaInactTimeout(unsigned long data); -extern void ResetBaEntry(PBA_RECORD pBA); +int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, struct sk_buff *skb); +int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, struct sk_buff *skb); +int ieee80211_rx_DELBA(struct ieee80211_device *ieee, struct sk_buff *skb); +void TsInitAddBA(struct ieee80211_device *ieee, PTX_TS_RECORD pTS, + u8 Policy, u8 bOverwritePending); +void TsInitDelBA(struct ieee80211_device *ieee, + PTS_COMMON_INFO pTsCommonInfo, TR_SELECT TxRxSelect); +void BaSetupTimeOut(unsigned long data); +void TxBaInactTimeout(unsigned long data); +void RxBaInactTimeout(unsigned long data); +void ResetBaEntry(PBA_RECORD pBA); //function in TS.c -extern bool GetTs( +bool GetTs( struct ieee80211_device *ieee, PTS_COMMON_INFO *ppTS, u8 *Addr, @@ -2528,10 +2403,10 @@ extern bool GetTs( TR_SELECT TxRxSelect, //Rx:1, Tx:0 bool bAddNewTs ); -extern void TSInitialize(struct ieee80211_device *ieee); -extern void TsStartAddBaProcess(struct ieee80211_device *ieee, PTX_TS_RECORD pTxTS); -extern void RemovePeerTS(struct ieee80211_device *ieee, u8 *Addr); -extern void RemoveAllTS(struct ieee80211_device *ieee); +void TSInitialize(struct ieee80211_device *ieee); +void TsStartAddBaProcess(struct ieee80211_device *ieee, PTX_TS_RECORD pTxTS); +void RemovePeerTS(struct ieee80211_device *ieee, u8 *Addr); +void RemoveAllTS(struct ieee80211_device *ieee); void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee); extern const long ieee80211_wlan_frequencies[]; @@ -2561,14 +2436,16 @@ static inline const char *escape_essid(const char *essid, u8 essid_len) { /* For the function is more related to hardware setting, it's better to use the * ieee handler to refer to it. */ -extern short check_nic_enough_desc(struct net_device *dev, int queue_index); -extern int ieee80211_data_xmit(struct sk_buff *skb, struct net_device *dev); -extern int ieee80211_parse_info_param(struct ieee80211_device *ieee, - struct ieee80211_info_element *info_element, - u16 length, - struct ieee80211_network *network, - struct ieee80211_rx_stats *stats); - -void ieee80211_indicate_packets(struct ieee80211_device *ieee, struct ieee80211_rxb **prxbIndicateArray,u8 index); +short check_nic_enough_desc(struct net_device *dev, int queue_index); +int ieee80211_data_xmit(struct sk_buff *skb, struct net_device *dev); +int ieee80211_parse_info_param(struct ieee80211_device *ieee, + struct ieee80211_info_element *info_element, + u16 length, + struct ieee80211_network *network, + struct ieee80211_rx_stats *stats); + +void ieee80211_indicate_packets(struct ieee80211_device *ieee, + struct ieee80211_rxb **prxbIndicateArray, + u8 index); #define RT_ASOC_RETRY_LIMIT 5 #endif /* IEEE80211_H */ diff --git a/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c b/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c index 788704b80..27ce4817f 100644 --- a/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c +++ b/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c @@ -71,10 +71,9 @@ static void *ieee80211_ccmp_init(int key_idx) goto fail; priv->key_idx = key_idx; - priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); + priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->tfm)) { - printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate " - "crypto API aes\n"); + printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate crypto API aes\n"); priv->tfm = NULL; goto fail; } @@ -105,6 +104,7 @@ static void ieee80211_ccmp_deinit(void *priv) static inline void xor_block(u8 *b, u8 *a, size_t len) { int i; + for (i = 0; i < len; i++) b[i] ^= a[i]; } @@ -112,7 +112,7 @@ static inline void xor_block(u8 *b, u8 *a, size_t len) static void ccmp_init_blocks(struct crypto_tfm *tfm, - struct ieee80211_hdr_4addr *hdr, + struct rtl_80211_hdr_4addr *hdr, u8 *pn, size_t dlen, u8 *b0, u8 *auth, u8 *s0) { @@ -125,10 +125,9 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, fc = le16_to_cpu(hdr->frame_ctl); a4_included = ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)); - /* - qc_included = ((WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && - (WLAN_FC_GET_STYPE(fc) & 0x08)); - */ + /* qc_included = ((WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && + * (WLAN_FC_GET_STYPE(fc) & 0x08)); + */ /* fixed by David :2006.9.6 */ qc_included = (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && (WLAN_FC_GET_STYPE(fc) & 0x80); @@ -146,7 +145,8 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, * Flag (Include authentication header, M=3 (8-octet MIC), * L=1 (2-octet Dlen)) * Nonce: 0x00 | A2 | PN - * Dlen */ + * Dlen + */ b0[0] = 0x59; b0[1] = qc; memcpy(b0 + 2, hdr->addr2, ETH_ALEN); @@ -196,7 +196,7 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) struct ieee80211_ccmp_data *key = priv; int data_len, i; u8 *pos; - struct ieee80211_hdr_4addr *hdr; + struct rtl_80211_hdr_4addr *hdr; cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); if (skb_headroom(skb) < CCMP_HDR_LEN || @@ -228,9 +228,8 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) *pos++ = key->tx_pn[0]; - hdr = (struct ieee80211_hdr_4addr *) skb->data; - if (!tcb_desc->bHwSec) - { + hdr = (struct rtl_80211_hdr_4addr *) skb->data; + if (!tcb_desc->bHwSec) { int blocks, last, len; u8 *mic; u8 *b0 = key->tx_b0; @@ -270,7 +269,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) { struct ieee80211_ccmp_data *key = priv; u8 keyidx, *pos; - struct ieee80211_hdr_4addr *hdr; + struct rtl_80211_hdr_4addr *hdr; cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); u8 pn[6]; @@ -279,28 +278,27 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) return -1; } - hdr = (struct ieee80211_hdr_4addr *) skb->data; + hdr = (struct rtl_80211_hdr_4addr *) skb->data; pos = skb->data + hdr_len; keyidx = pos[3]; if (!(keyidx & (1 << 5))) { if (net_ratelimit()) { - printk(KERN_DEBUG "CCMP: received packet without ExtIV" - " flag from %pM\n", hdr->addr2); + printk(KERN_DEBUG "CCMP: received packet without ExtIV flag from %pM\n", + hdr->addr2); } key->dot11RSNAStatsCCMPFormatErrors++; return -2; } keyidx >>= 6; if (key->key_idx != keyidx) { - printk(KERN_DEBUG "CCMP: RX tkey->key_idx=%d frame " - "keyidx=%d priv=%p\n", key->key_idx, keyidx, priv); + printk(KERN_DEBUG "CCMP: RX tkey->key_idx=%d frame keyidx=%d priv=%p\n", + key->key_idx, keyidx, priv); return -6; } if (!key->key_set) { if (net_ratelimit()) { - printk(KERN_DEBUG "CCMP: received packet from %pM" - " with keyid=%d that does not have a configured" - " key\n", hdr->addr2, keyidx); + printk(KERN_DEBUG "CCMP: received packet from %pM with keyid=%d that does not have a configured key\n", + hdr->addr2, keyidx); } return -3; } @@ -315,15 +313,13 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) if (memcmp(pn, key->rx_pn, CCMP_PN_LEN) <= 0) { if (net_ratelimit()) { - printk(KERN_DEBUG "CCMP: replay detected: STA=%pM" - " previous PN %pm received PN %pm\n", + printk(KERN_DEBUG "CCMP: replay detected: STA=%pM previous PN %pm received PN %pm\n", hdr->addr2, key->rx_pn, pn); } key->dot11RSNAStatsCCMPReplays++; return -4; } - if (!tcb_desc->bHwSec) - { + if (!tcb_desc->bHwSec) { size_t data_len = skb->len - hdr_len - CCMP_HDR_LEN - CCMP_MIC_LEN; u8 *mic = skb->data + skb->len - CCMP_MIC_LEN; u8 *b0 = key->rx_b0; @@ -353,8 +349,8 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) if (memcmp(mic, a, CCMP_MIC_LEN) != 0) { if (net_ratelimit()) { - printk(KERN_DEBUG "CCMP: decrypt failed: STA=" - "%pM\n", hdr->addr2); + printk(KERN_DEBUG "CCMP: decrypt failed: STA=%pM\n", + hdr->addr2); } key->dot11RSNAStatsCCMPDecryptErrors++; return -5; @@ -429,9 +425,8 @@ static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv) static char *ieee80211_ccmp_print_stats(char *p, void *priv) { struct ieee80211_ccmp_data *ccmp = priv; - p += sprintf(p, "key[%d] alg=CCMP key_set=%d " - "tx_pn=%pm rx_pn=%pm " - "format_errors=%d replays=%d decrypt_errors=%d\n", + + p += sprintf(p, "key[%d] alg=CCMP key_set=%d tx_pn=%pm rx_pn=%pm format_errors=%d replays=%d decrypt_errors=%d\n", ccmp->key_idx, ccmp->key_set, ccmp->tx_pn, ccmp->rx_pn, ccmp->dot11RSNAStatsCCMPFormatErrors, diff --git a/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c index e815c81b4..908bc2eb4 100644 --- a/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +++ b/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c @@ -185,8 +185,7 @@ static inline u16 Mk16_le(u16 *v) } -static const u16 Sbox[256] = -{ +static const u16 Sbox[256] = { 0xC6A5, 0xF884, 0xEE99, 0xF68D, 0xFF0D, 0xD6BD, 0xDEB1, 0x9154, 0x6050, 0x0203, 0xCEA9, 0x567D, 0xE719, 0xB562, 0x4DE6, 0xEC9A, 0x8F45, 0x1F9D, 0x8940, 0xFA87, 0xEF15, 0xB2EB, 0x8EC9, 0xFB0B, @@ -257,8 +256,10 @@ static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32) static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, u16 IV16) { - /* Make temporary area overlap WEP seed so that the final copy can be - * avoided on little endian hosts. */ + /* + * Make temporary area overlap WEP seed so that the final copy can be + * avoided on little endian hosts. + */ u16 *PPK = (u16 *) &WEPSeed[4]; /* Step 1 - make copy of TTAK and bring in TSC */ @@ -284,8 +285,10 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, PPK[4] += RotR1(PPK[3]); PPK[5] += RotR1(PPK[4]); - /* Step 3 - bring in last of TK bits, assign 24-bit WEP IV value - * WEPSeed[0..2] is transmitted as WEP IV */ + /* + * Step 3 - bring in last of TK bits, assign 24-bit WEP IV value + * WEPSeed[0..2] is transmitted as WEP IV + */ WEPSeed[0] = Hi8(IV16); WEPSeed[1] = (Hi8(IV16) | 0x20) & 0x7F; WEPSeed[2] = Lo8(IV16); @@ -294,6 +297,7 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, #ifdef __BIG_ENDIAN { int i; + for (i = 0; i < 6; i++) PPK[i] = (PPK[i] << 8) | (PPK[i] >> 8); } @@ -304,9 +308,9 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) { struct ieee80211_tkip_data *tkey = priv; - int len; + int len; u8 *pos; - struct ieee80211_hdr_4addr *hdr; + struct rtl_80211_hdr_4addr *hdr; cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); struct blkcipher_desc desc = {.tfm = tkey->tx_tfm_arc4}; int ret = 0; @@ -318,19 +322,17 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) skb->len < hdr_len) return -1; - hdr = (struct ieee80211_hdr_4addr *) skb->data; + hdr = (struct rtl_80211_hdr_4addr *) skb->data; - if (!tcb_desc->bHwSec) - { + if (!tcb_desc->bHwSec) { if (!tkey->tx_phase1_done) { tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2, - tkey->tx_iv32); + tkey->tx_iv32); tkey->tx_phase1_done = 1; } tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16); - } - else - tkey->tx_phase1_done = 1; + } else + tkey->tx_phase1_done = 1; len = skb->len - hdr_len; @@ -338,14 +340,11 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) memmove(pos, pos + 8, hdr_len); pos += hdr_len; - if (tcb_desc->bHwSec) - { + if (tcb_desc->bHwSec) { *pos++ = Hi8(tkey->tx_iv16); *pos++ = (Hi8(tkey->tx_iv16) | 0x20) & 0x7F; *pos++ = Lo8(tkey->tx_iv16); - } - else - { + } else { *pos++ = rc4key[0]; *pos++ = rc4key[1]; *pos++ = rc4key[2]; @@ -357,8 +356,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) *pos++ = (tkey->tx_iv32 >> 16) & 0xff; *pos++ = (tkey->tx_iv32 >> 24) & 0xff; - if (!tcb_desc->bHwSec) - { + if (!tcb_desc->bHwSec) { icv = skb_put(skb, 4); crc = ~crc32_le(~0, pos, len); icv[0] = crc; @@ -367,7 +365,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) icv[3] = crc >> 24; crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16); sg_init_one(&sg, pos, len+4); - ret= crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); + ret = crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); } tkey->tx_iv16++; @@ -390,7 +388,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) u8 keyidx, *pos; u32 iv32; u16 iv16; - struct ieee80211_hdr_4addr *hdr; + struct rtl_80211_hdr_4addr *hdr; cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); struct blkcipher_desc desc = {.tfm = tkey->rx_tfm_arc4}; u8 rc4key[16]; @@ -398,10 +396,11 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) u32 crc; struct scatterlist sg; int plen; + if (skb->len < hdr_len + 8 + 4) return -1; - hdr = (struct ieee80211_hdr_4addr *) skb->data; + hdr = (struct rtl_80211_hdr_4addr *) skb->data; pos = skb->data + hdr_len; keyidx = pos[3]; if (!(keyidx & (1 << 5))) { @@ -429,8 +428,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) iv32 = pos[4] | (pos[5] << 8) | (pos[6] << 16) | (pos[7] << 24); pos += 8; - if (!tcb_desc->bHwSec) - { + if (!tcb_desc->bHwSec) { if (iv32 < tkey->rx_iv32 || (iv32 == tkey->rx_iv32 && iv16 <= tkey->rx_iv16)) { if (net_ratelimit()) { @@ -471,8 +469,11 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) if (memcmp(icv, pos + plen, 4) != 0) { if (iv32 != tkey->rx_iv32) { - /* Previously cached Phase1 result was already lost, so - * it needs to be recalculated for the next packet. */ + /* + * Previously cached Phase1 result was already + * lost, so it needs to be recalculated for the + * next packet. + */ tkey->rx_phase1_done = 0; } if (net_ratelimit()) { @@ -485,8 +486,10 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) } - /* Update real counters only after Michael MIC verification has - * completed */ + /* + * Update real counters only after Michael MIC verification has + * completed. + */ tkey->rx_iv32_new = iv32; tkey->rx_iv16_new = iv16; @@ -523,9 +526,9 @@ static int michael_mic(struct crypto_hash *tfm_michael, u8 *key, u8 *hdr, static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr) { - struct ieee80211_hdr_4addr *hdr11; + struct rtl_80211_hdr_4addr *hdr11; - hdr11 = (struct ieee80211_hdr_4addr *) skb->data; + hdr11 = (struct rtl_80211_hdr_4addr *) skb->data; switch (le16_to_cpu(hdr11->frame_ctl) & (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) { case IEEE80211_FCTL_TODS: @@ -556,9 +559,9 @@ static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *pri { struct ieee80211_tkip_data *tkey = priv; u8 *pos; - struct ieee80211_hdr_4addr *hdr; + struct rtl_80211_hdr_4addr *hdr; - hdr = (struct ieee80211_hdr_4addr *) skb->data; + hdr = (struct rtl_80211_hdr_4addr *) skb->data; if (skb_tailroom(skb) < 8 || skb->len < hdr_len) { printk(KERN_DEBUG "Invalid packet for Michael MIC add " @@ -571,9 +574,8 @@ static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *pri // { david, 2006.9.1 // fix the wpa process with wmm enabled. - if(IEEE80211_QOS_HAS_SEQ(le16_to_cpu(hdr->frame_ctl))) { + if (IEEE80211_QOS_HAS_SEQ(le16_to_cpu(hdr->frame_ctl))) tkey->tx_hdr[12] = *(skb->data + hdr_len - 2) & 0x07; - } // } pos = skb_put(skb, 8); @@ -585,7 +587,7 @@ static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *pri } static void ieee80211_michael_mic_failure(struct net_device *dev, - struct ieee80211_hdr_4addr *hdr, + struct rtl_80211_hdr_4addr *hdr, int keyidx) { union iwreq_data wrqu; @@ -606,13 +608,13 @@ static void ieee80211_michael_mic_failure(struct net_device *dev, } static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, - int hdr_len, void *priv) + int hdr_len, void *priv) { struct ieee80211_tkip_data *tkey = priv; u8 mic[8]; - struct ieee80211_hdr_4addr *hdr; + struct rtl_80211_hdr_4addr *hdr; - hdr = (struct ieee80211_hdr_4addr *) skb->data; + hdr = (struct rtl_80211_hdr_4addr *) skb->data; if (!tkey->key_set) return -1; @@ -620,17 +622,17 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, michael_mic_hdr(skb, tkey->rx_hdr); // { david, 2006.9.1 // fix the wpa process with wmm enabled. - if(IEEE80211_QOS_HAS_SEQ(le16_to_cpu(hdr->frame_ctl))) { + if (IEEE80211_QOS_HAS_SEQ(le16_to_cpu(hdr->frame_ctl))) tkey->rx_hdr[12] = *(skb->data + hdr_len - 2) & 0x07; - } // } if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr, - skb->data + hdr_len, skb->len - 8 - hdr_len, mic)) + skb->data + hdr_len, skb->len - 8 - hdr_len, mic)) return -1; if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) { - struct ieee80211_hdr_4addr *hdr; - hdr = (struct ieee80211_hdr_4addr *) skb->data; + struct rtl_80211_hdr_4addr *hdr; + hdr = (struct rtl_80211_hdr_4addr *) skb->data; + printk(KERN_DEBUG "%s: Michael MIC verification failed for " "MSDU from %pM keyidx=%d\n", skb->dev ? skb->dev->name : "N/A", hdr->addr2, @@ -641,8 +643,10 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, return -1; } - /* Update TSC counters for RX now that the packet verification has - * completed. */ + /* + * Update TSC counters for RX now that the packet verification has + * completed. + */ tkey->rx_iv32 = tkey->rx_iv32_new; tkey->rx_iv16 = tkey->rx_iv16_new; @@ -702,6 +706,7 @@ static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv) /* Return the sequence number of the last transmitted frame. */ u16 iv16 = tkey->tx_iv16; u32 iv32 = tkey->tx_iv32; + if (iv16 == 0) iv32--; iv16--; @@ -720,6 +725,7 @@ static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv) static char *ieee80211_tkip_print_stats(char *p, void *priv) { struct ieee80211_tkip_data *tkip = priv; + p += sprintf(p, "key[%d] alg=TKIP key_set=%d " "tx_pn=%02x%02x%02x%02x%02x%02x " "rx_pn=%02x%02x%02x%02x%02x%02x " diff --git a/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c b/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c index 0a17f84bb..681611dc9 100644 --- a/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c +++ b/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c @@ -19,7 +19,7 @@ #include "ieee80211.h" #include <linux/crypto.h> - #include <linux/scatterlist.h> +#include <linux/scatterlist.h> #include <linux/crc32.h> MODULE_AUTHOR("Jouni Malinen"); @@ -43,38 +43,24 @@ static void *prism2_wep_init(int keyidx) priv = kzalloc(sizeof(*priv), GFP_ATOMIC); if (priv == NULL) - goto fail; + return NULL; priv->key_idx = keyidx; priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); - if (IS_ERR(priv->tx_tfm)) { - pr_debug("ieee80211_crypt_wep: could not allocate " - "crypto API arc4\n"); - priv->tx_tfm = NULL; - goto fail; - } + if (IS_ERR(priv->tx_tfm)) + goto free_priv; priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); - if (IS_ERR(priv->rx_tfm)) { - pr_debug("ieee80211_crypt_wep: could not allocate " - "crypto API arc4\n"); - priv->rx_tfm = NULL; - goto fail; - } + if (IS_ERR(priv->rx_tfm)) + goto free_tx; /* start WEP IV from a random value */ get_random_bytes(&priv->iv, 4); return priv; - -fail: - if (priv) { - if (priv->tx_tfm) - crypto_free_blkcipher(priv->tx_tfm); - if (priv->rx_tfm) - crypto_free_blkcipher(priv->rx_tfm); - kfree(priv); - } - +free_tx: + crypto_free_blkcipher(priv->tx_tfm); +free_priv: + kfree(priv); return NULL; } @@ -142,9 +128,7 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) /* Copy rest of the WEP key (the secret part) */ memcpy(key + 3, wep->key, wep->key_len); - if (!tcb_desc->bHwSec) - { - + if (!tcb_desc->bHwSec) { /* Append little-endian CRC32 and encrypt it to produce ICV */ crc = ~crc32_le(~0, pos, len); icv = skb_put(skb, 4); @@ -201,8 +185,7 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) /* Apply RC4 to data and compute CRC32 over decrypted data */ plen = skb->len - hdr_len - 8; - if (!tcb_desc->bHwSec) - { + if (!tcb_desc->bHwSec) { crypto_blkcipher_setkey(wep->rx_tfm, key, klen); sg_init_one(&sg, pos, plen+4); @@ -293,6 +276,4 @@ void __exit ieee80211_crypto_wep_exit(void) void ieee80211_wep_null(void) { -// printk("============>%s()\n", __func__); - return; } diff --git a/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c index 31233d895..425b2ddfc 100644 --- a/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +++ b/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c @@ -48,7 +48,7 @@ #include <linux/types.h> #include <linux/wireless.h> #include <linux/etherdevice.h> -#include <asm/uaccess.h> +#include <linux/uaccess.h> #include <net/arp.h> #include "ieee80211.h" diff --git a/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index 9fbb53d8c..130c852ff 100644 --- a/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -47,7 +47,7 @@ static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_rx_stats *rx_stats) { - struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *)skb->data; + struct rtl_80211_hdr_4addr *hdr = (struct rtl_80211_hdr_4addr *)skb->data; u16 fc = le16_to_cpu(hdr->frame_ctl); skb->dev = ieee->dev; @@ -94,7 +94,7 @@ ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq, /* Called only as a tasklet (software IRQ) */ static struct sk_buff * ieee80211_frag_cache_get(struct ieee80211_device *ieee, - struct ieee80211_hdr_4addr *hdr) + struct rtl_80211_hdr_4addr *hdr) { struct sk_buff *skb = NULL; u16 fc = le16_to_cpu(hdr->frame_ctl); @@ -102,17 +102,17 @@ ieee80211_frag_cache_get(struct ieee80211_device *ieee, unsigned int frag = WLAN_GET_SEQ_FRAG(sc); unsigned int seq = WLAN_GET_SEQ_SEQ(sc); struct ieee80211_frag_entry *entry; - struct ieee80211_hdr_3addrqos *hdr_3addrqos; - struct ieee80211_hdr_4addrqos *hdr_4addrqos; + struct rtl_80211_hdr_3addrqos *hdr_3addrqos; + struct rtl_80211_hdr_4addrqos *hdr_4addrqos; u8 tid; if (((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS)&&IEEE80211_QOS_HAS_SEQ(fc)) { - hdr_4addrqos = (struct ieee80211_hdr_4addrqos *)hdr; + hdr_4addrqos = (struct rtl_80211_hdr_4addrqos *)hdr; tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QCTL_TID; tid = UP2AC(tid); tid ++; } else if (IEEE80211_QOS_HAS_SEQ(fc)) { - hdr_3addrqos = (struct ieee80211_hdr_3addrqos *)hdr; + hdr_3addrqos = (struct rtl_80211_hdr_3addrqos *)hdr; tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QCTL_TID; tid = UP2AC(tid); tid ++; @@ -123,7 +123,7 @@ ieee80211_frag_cache_get(struct ieee80211_device *ieee, if (frag == 0) { /* Reserve enough space to fit maximum frame length */ skb = dev_alloc_skb(ieee->dev->mtu + - sizeof(struct ieee80211_hdr_4addr) + + sizeof(struct rtl_80211_hdr_4addr) + 8 /* LLC */ + 2 /* alignment */ + 8 /* WEP */ + @@ -163,23 +163,23 @@ ieee80211_frag_cache_get(struct ieee80211_device *ieee, /* Called only as a tasklet (software IRQ) */ static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee, - struct ieee80211_hdr_4addr *hdr) + struct rtl_80211_hdr_4addr *hdr) { u16 fc = le16_to_cpu(hdr->frame_ctl); u16 sc = le16_to_cpu(hdr->seq_ctl); unsigned int seq = WLAN_GET_SEQ_SEQ(sc); struct ieee80211_frag_entry *entry; - struct ieee80211_hdr_3addrqos *hdr_3addrqos; - struct ieee80211_hdr_4addrqos *hdr_4addrqos; + struct rtl_80211_hdr_3addrqos *hdr_3addrqos; + struct rtl_80211_hdr_4addrqos *hdr_4addrqos; u8 tid; if(((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS)&&IEEE80211_QOS_HAS_SEQ(fc)) { - hdr_4addrqos = (struct ieee80211_hdr_4addrqos *)hdr; + hdr_4addrqos = (struct rtl_80211_hdr_4addrqos *)hdr; tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QCTL_TID; tid = UP2AC(tid); tid ++; } else if (IEEE80211_QOS_HAS_SEQ(fc)) { - hdr_3addrqos = (struct ieee80211_hdr_3addrqos *)hdr; + hdr_3addrqos = (struct rtl_80211_hdr_3addrqos *)hdr; tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QCTL_TID; tid = UP2AC(tid); tid ++; @@ -217,10 +217,10 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb, * this is not mandatory.... but seems that the probe * response parser uses it */ - struct ieee80211_hdr_3addr *hdr = (struct ieee80211_hdr_3addr *)skb->data; + struct rtl_80211_hdr_3addr *hdr = (struct rtl_80211_hdr_3addr *)skb->data; rx_stats->len = skb->len; - ieee80211_rx_mgt(ieee,(struct ieee80211_hdr_4addr *)skb->data,rx_stats); + ieee80211_rx_mgt(ieee,(struct rtl_80211_hdr_4addr *)skb->data,rx_stats); /* if ((ieee->state == IEEE80211_LINKED) && (memcmp(hdr->addr3, ieee->current_network.bssid, ETH_ALEN))) */ if ((memcmp(hdr->addr1, ieee->dev->dev_addr, ETH_ALEN)))/* use ADDR1 to perform address matching for Management frames */ { @@ -298,13 +298,13 @@ static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee, { struct net_device *dev = ieee->dev; u16 fc, ethertype; - struct ieee80211_hdr_4addr *hdr; + struct rtl_80211_hdr_4addr *hdr; u8 *pos; if (skb->len < 24) return 0; - hdr = (struct ieee80211_hdr_4addr *) skb->data; + hdr = (struct rtl_80211_hdr_4addr *) skb->data; fc = le16_to_cpu(hdr->frame_ctl); /* check that the frame is unicast frame to us */ @@ -338,7 +338,7 @@ static inline int ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_crypt_data *crypt) { - struct ieee80211_hdr_4addr *hdr; + struct rtl_80211_hdr_4addr *hdr; int res, hdrlen; if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) @@ -348,7 +348,7 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb, cb_desc *tcb_desc = (cb_desc *)(skb->cb+ MAX_DEV_ADDR_SIZE); tcb_desc->bHwSec = 1; } - hdr = (struct ieee80211_hdr_4addr *) skb->data; + hdr = (struct rtl_80211_hdr_4addr *) skb->data; hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); if (ieee->tkip_countermeasures && @@ -385,7 +385,7 @@ static inline int ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee, struct sk_buff *skb, int keyidx, struct ieee80211_crypt_data *crypt) { - struct ieee80211_hdr_4addr *hdr; + struct rtl_80211_hdr_4addr *hdr; int res, hdrlen; if (crypt == NULL || crypt->ops->decrypt_msdu == NULL) @@ -396,7 +396,7 @@ ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee, struct sk_buff *s tcb_desc->bHwSec = 1; } - hdr = (struct ieee80211_hdr_4addr *) skb->data; + hdr = (struct rtl_80211_hdr_4addr *) skb->data; hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); atomic_inc(&crypt->refcnt); @@ -416,7 +416,7 @@ ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee, struct sk_buff *s /* this function is stolen from ipw2200 driver*/ #define IEEE_PACKET_RETRY_TIME (5*HZ) static int is_duplicate_packet(struct ieee80211_device *ieee, - struct ieee80211_hdr_4addr *header) + struct rtl_80211_hdr_4addr *header) { u16 fc = le16_to_cpu(header->frame_ctl); u16 sc = le16_to_cpu(header->seq_ctl); @@ -424,19 +424,19 @@ static int is_duplicate_packet(struct ieee80211_device *ieee, u16 frag = WLAN_GET_SEQ_FRAG(sc); u16 *last_seq, *last_frag; unsigned long *last_time; - struct ieee80211_hdr_3addrqos *hdr_3addrqos; - struct ieee80211_hdr_4addrqos *hdr_4addrqos; + struct rtl_80211_hdr_3addrqos *hdr_3addrqos; + struct rtl_80211_hdr_4addrqos *hdr_4addrqos; u8 tid; //TO2DS and QoS if(((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS)&&IEEE80211_QOS_HAS_SEQ(fc)) { - hdr_4addrqos = (struct ieee80211_hdr_4addrqos *)header; + hdr_4addrqos = (struct rtl_80211_hdr_4addrqos *)header; tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QCTL_TID; tid = UP2AC(tid); tid ++; } else if(IEEE80211_QOS_HAS_SEQ(fc)) { //QoS - hdr_3addrqos = (struct ieee80211_hdr_3addrqos *)header; + hdr_3addrqos = (struct rtl_80211_hdr_3addrqos *)header; tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QCTL_TID; tid = UP2AC(tid); tid ++; @@ -492,14 +492,10 @@ static int is_duplicate_packet(struct ieee80211_device *ieee, // } if ((*last_seq == seq) && time_after(*last_time + IEEE_PACKET_RETRY_TIME, jiffies)) { - if (*last_frag == frag){ - //printk(KERN_WARNING "[1] go drop!\n"); + if (*last_frag == frag) goto drop; - - } if (*last_frag + 1 != frag) /* out-of-order fragment */ - //printk(KERN_WARNING "[2] go drop!\n"); goto drop; } else *last_seq = seq; @@ -510,7 +506,6 @@ static int is_duplicate_packet(struct ieee80211_device *ieee, drop: // BUG_ON(!(fc & IEEE80211_FCTL_RETRY)); -// printk("DUP\n"); return 1; } @@ -578,14 +573,12 @@ void ieee80211_indicate_packets(struct ieee80211_device *ieee, struct ieee80211_ /* Indicat the packets to upper layer */ if (sub_skb) { - //printk("0skb_len(%d)\n", skb->len); sub_skb->protocol = eth_type_trans(sub_skb, ieee->dev); memset(sub_skb->cb, 0, sizeof(sub_skb->cb)); sub_skb->dev = ieee->dev; sub_skb->ip_summed = CHECKSUM_NONE; /* 802.11 crc not sufficient */ //skb->ip_summed = CHECKSUM_UNNECESSARY; /* 802.11 crc not sufficient */ ieee->last_rx_ps_time = jiffies; - //printk("1skb_len(%d)\n", skb->len); netif_rx(sub_skb); } } @@ -768,10 +761,10 @@ static u8 parse_subframe(struct sk_buff *skb, struct ieee80211_rx_stats *rx_stats, struct ieee80211_rxb *rxb, u8 *src, u8 *dst) { - struct ieee80211_hdr_3addr *hdr = (struct ieee80211_hdr_3addr *)skb->data; + struct rtl_80211_hdr_3addr *hdr = (struct rtl_80211_hdr_3addr *)skb->data; u16 fc = le16_to_cpu(hdr->frame_ctl); - u16 LLCOffset= sizeof(struct ieee80211_hdr_3addr); + u16 LLCOffset= sizeof(struct rtl_80211_hdr_3addr); u16 ChkLength; bool bIsAggregateFrame = false; u16 nSubframe_Length; @@ -795,7 +788,6 @@ static u8 parse_subframe(struct sk_buff *skb, if (rx_stats->bContainHTC) { LLCOffset += sHTCLng; } - //printk("ChkLength = %d\n", LLCOffset); // Null packet, don't indicate it to upper layer ChkLength = LLCOffset;/* + (Frame_WEP(frame)!=0 ?Adapter->MgntInfo.SecurityInfo.EncryptionHeadOverhead:0);*/ @@ -888,8 +880,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_rx_stats *rx_stats) { struct net_device *dev = ieee->dev; - struct ieee80211_hdr_4addr *hdr; - //struct ieee80211_hdr_3addrqos *hdr; + struct rtl_80211_hdr_4addr *hdr; + //struct rtl_80211_hdr_3addrqos *hdr; size_t hdrlen; u16 fc, type, stype, sc; @@ -907,7 +899,6 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, struct net_device *wds = NULL; struct sk_buff *skb2 = NULL; struct net_device *wds = NULL; - int frame_authorized = 0; int from_assoc_ap = 0; void *sta = NULL; #endif @@ -921,7 +912,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, int i; struct ieee80211_rxb *rxb = NULL; // cheat the the hdr type - hdr = (struct ieee80211_hdr_4addr *)skb->data; + hdr = (struct rtl_80211_hdr_4addr *)skb->data; stats = &ieee->stats; if (skb->len < 10) { @@ -1014,7 +1005,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, goto rx_dropped; // if QoS enabled, should check the sequence for each of the AC - if( (ieee->pHTInfo->bCurRxReorderEnable == false) || !ieee->current_network.qos_data.active|| !IsDataFrame(skb->data) || IsLegacyDataFrame(skb->data)){ + if ((!ieee->pHTInfo->bCurRxReorderEnable) || !ieee->current_network.qos_data.active|| !IsDataFrame(skb->data) || IsLegacyDataFrame(skb->data)) { if (is_duplicate_packet(ieee, hdr)) goto rx_dropped; @@ -1114,10 +1105,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats, wds != NULL)) { case AP_RX_CONTINUE_NOT_AUTHORIZED: - frame_authorized = 0; - break; case AP_RX_CONTINUE: - frame_authorized = 1; break; case AP_RX_DROP: goto rx_dropped; @@ -1156,7 +1144,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, } - hdr = (struct ieee80211_hdr_4addr *) skb->data; + hdr = (struct rtl_80211_hdr_4addr *) skb->data; /* skb: hdr + (possibly fragmented) plaintext payload */ // PR: FIXME: hostap has additional conditions in the "if" below: @@ -1209,7 +1197,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, /* this was the last fragment and the frame will be * delivered, so remove skb from fragment cache */ skb = frag_skb; - hdr = (struct ieee80211_hdr_4addr *) skb->data; + hdr = (struct rtl_80211_hdr_4addr *) skb->data; ieee80211_frag_cache_invalidate(ieee, hdr); } @@ -1226,7 +1214,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, ieee->LinkDetectInfo.NumRecvDataInPeriod++; ieee->LinkDetectInfo.NumRxOkInPeriod++; - hdr = (struct ieee80211_hdr_4addr *) skb->data; + hdr = (struct rtl_80211_hdr_4addr *) skb->data; if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) { if (/*ieee->ieee802_1x &&*/ ieee80211_is_eapol_frame(ieee, skb, hdrlen)) { @@ -1307,7 +1295,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, } //added by amy for reorder - if(ieee->pHTInfo->bCurRxReorderEnable == false ||pTS == NULL){ + if (!ieee->pHTInfo->bCurRxReorderEnable || pTS == NULL){ //added by amy for reorder for(i = 0; i<rxb->nr_subframes; i++) { struct sk_buff *sub_skb = rxb->subframes[i]; @@ -1340,14 +1328,12 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, } /* Indicat the packets to upper layer */ - //printk("0skb_len(%d)\n", skb->len); sub_skb->protocol = eth_type_trans(sub_skb, dev); memset(sub_skb->cb, 0, sizeof(sub_skb->cb)); sub_skb->dev = dev; sub_skb->ip_summed = CHECKSUM_NONE; /* 802.11 crc not sufficient */ //skb->ip_summed = CHECKSUM_UNNECESSARY; /* 802.11 crc not sufficient */ ieee->last_rx_ps_time = jiffies; - //printk("1skb_len(%d)\n", skb->len); netif_rx(sub_skb); } } @@ -1758,8 +1744,6 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee, offset = (info_element->data[2] >> 1)*2; - //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id); - if(ieee->assoc_id < 8*offset || ieee->assoc_id > 8*(offset + info_element->len -3)) @@ -2070,7 +2054,6 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee, case MFIE_TYPE_COUNTRY: IEEE80211_DEBUG_SCAN("MFIE_TYPE_COUNTRY: %d bytes\n", info_element->len); - //printk("=====>Receive <%s> Country IE\n",network->ssid); ieee80211_extract_country_ie(ieee, info_element, network, network->bssid);//addr2 is same as addr3 when from an AP break; /* TODO */ @@ -2366,10 +2349,10 @@ static inline void update_network(struct ieee80211_network *dst, /* dst->last_associate is not overwritten */ dst->wmm_info = src->wmm_info; //sure to exist in beacon or probe response frame. - if (src->wmm_param[0].ac_aci_acm_aifsn|| \ - src->wmm_param[1].ac_aci_acm_aifsn|| \ - src->wmm_param[2].ac_aci_acm_aifsn|| \ - src->wmm_param[3].ac_aci_acm_aifsn) { + if (src->wmm_param[0].aci_aifsn|| \ + src->wmm_param[1].aci_aifsn|| \ + src->wmm_param[2].aci_aifsn|| \ + src->wmm_param[3].aci_aifsn) { memcpy(dst->wmm_param, src->wmm_param, WME_AC_PRAM_LEN); } //dst->QoS_Enable = src->QoS_Enable; @@ -2612,7 +2595,7 @@ static inline void ieee80211_process_probe_response( } void ieee80211_rx_mgt(struct ieee80211_device *ieee, - struct ieee80211_hdr_4addr *header, + struct rtl_80211_hdr_4addr *header, struct ieee80211_rx_stats *stats) { switch (WLAN_FC_GET_STYPE(header->frame_ctl)) { diff --git a/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index c2388812d..38c3eb780 100644 --- a/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -19,7 +19,7 @@ #include <linux/random.h> #include <linux/delay.h> #include <linux/slab.h> -#include <asm/uaccess.h> +#include <linux/uaccess.h> #include <linux/etherdevice.h> #include "dot11d.h" @@ -222,8 +222,8 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee { unsigned long flags; short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE; - struct ieee80211_hdr_3addr *header= - (struct ieee80211_hdr_3addr *) skb->data; + struct rtl_80211_hdr_3addr *header= + (struct rtl_80211_hdr_3addr *) skb->data; cb_desc *tcb_desc = (cb_desc *)(skb->cb + 8); spin_lock_irqsave(&ieee->lock, flags); @@ -277,7 +277,6 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee printk("%s():insert to waitqueue!\n",__func__); skb_queue_tail(&ieee->skb_waitQ[tcb_desc->queue_index], skb); } else { - //printk("TX packet!\n"); ieee->softmac_hard_start_xmit(skb, ieee->dev); //dev_kfree_skb_any(skb);//edit by thomas } @@ -289,8 +288,8 @@ inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *i { short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE; - struct ieee80211_hdr_3addr *header = - (struct ieee80211_hdr_3addr *) skb->data; + struct rtl_80211_hdr_3addr *header = + (struct rtl_80211_hdr_3addr *) skb->data; if(single){ @@ -418,7 +417,6 @@ static void ieee80211_send_probe_requests(struct ieee80211_device *ieee) ieee80211_send_probe(ieee); } } -EXPORT_SYMBOL(ieee80211_send_probe_requests); /* this performs syncro scan blocking the caller until all channels * in the allowed channel map has been checked. @@ -467,13 +465,9 @@ void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee) /* this prevent excessive time wait when we * need to wait for a syncro scan to end.. */ - if(ieee->state < IEEE80211_LINKED) - ; - else - if (ieee->sync_scan_hurryup) + if (ieee->state >= IEEE80211_LINKED && ieee->sync_scan_hurryup) goto out; - msleep_interruptible_rsl(IEEE80211_SOFTMAC_SCAN_TIME); } @@ -660,10 +654,13 @@ inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *be auth = (struct ieee80211_authentication *) skb_put(skb, sizeof(struct ieee80211_authentication)); - auth->header.frame_ctl = IEEE80211_STYPE_AUTH; - if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP; + if (challengelen) + auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH + | IEEE80211_FCTL_WEP); + else + auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH); - auth->header.duration_id = 0x013a; //FIXME + auth->header.duration_id = cpu_to_le16(0x013a); memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN); memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN); @@ -673,7 +670,7 @@ inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *be if(ieee->auth_mode == 0) auth->algorithm = WLAN_AUTH_OPEN; else if(ieee->auth_mode == 1) - auth->algorithm = WLAN_AUTH_SHARED_KEY; + auth->algorithm = cpu_to_le16(WLAN_AUTH_SHARED_KEY); else if(ieee->auth_mode == 2) auth->algorithm = WLAN_AUTH_OPEN;//0x80; printk("=================>%s():auth->algorithm is %d\n",__func__,auth->algorithm); @@ -928,14 +925,14 @@ static struct sk_buff *ieee80211_null_func(struct ieee80211_device *ieee, short pwr) { struct sk_buff *skb; - struct ieee80211_hdr_3addr *hdr; + struct rtl_80211_hdr_3addr *hdr; - skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr)); + skb = dev_alloc_skb(sizeof(struct rtl_80211_hdr_3addr)); if (!skb) return NULL; - hdr = (struct ieee80211_hdr_3addr *)skb_put(skb,sizeof(struct ieee80211_hdr_3addr)); + hdr = (struct rtl_80211_hdr_3addr *)skb_put(skb,sizeof(struct rtl_80211_hdr_3addr)); memcpy(hdr->addr1, ieee->current_network.bssid, ETH_ALEN); memcpy(hdr->addr2, ieee->dev->dev_addr, ETH_ALEN); @@ -1084,7 +1081,7 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco hdr->header.frame_ctl = IEEE80211_STYPE_ASSOC_REQ; - hdr->header.duration_id= 37; //FIXME + hdr->header.duration_id = cpu_to_le16(37); memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN); memcpy(hdr->header.addr2, ieee->dev->dev_addr, ETH_ALEN); memcpy(hdr->header.addr3, beacon->bssid, ETH_ALEN); @@ -1103,7 +1100,7 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco if (wmm_info_len) //QOS hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_QOS); - hdr->listen_interval = 0xa; //FIXME + hdr->listen_interval = cpu_to_le16(0xa); hdr->info_element[0].id = MFIE_TYPE_SSID; @@ -1174,7 +1171,7 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco tag = skb_put(skb, ht_cap_len); *tag++ = MFIE_TYPE_HT_CAP; *tag++ = ht_cap_len - 2; - memcpy(tag, ht_cap_buf,ht_cap_len -2); + memcpy(tag, ht_cap_buf, ht_cap_len - 2); tag += ht_cap_len -2; } } @@ -1211,7 +1208,7 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco tag = skb_put(skb, realtek_ie_len); *tag++ = MFIE_TYPE_GENERIC; *tag++ = realtek_ie_len - 2; - memcpy(tag, realtek_ie_buf,realtek_ie_len -2 ); + memcpy(tag, realtek_ie_buf, realtek_ie_len - 2); } } // printk("<=====%s(), %p, %p\n", __func__, ieee->dev, ieee->dev->dev_addr); @@ -1270,7 +1267,6 @@ static void ieee80211_associate_step1(struct ieee80211_device *ieee) else{ ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ; IEEE80211_DEBUG_MGMT("Sending authentication request\n"); - //printk(KERN_WARNING "Sending authentication request\n"); softmac_mgmt_xmit(skb, ieee); //BUGON when you try to add_timer twice, using mod_timer may be better, john0709 if (!timer_pending(&ieee->associate_timer)) { @@ -1304,7 +1300,7 @@ static void ieee80211_auth_challenge(struct ieee80211_device *ieee, IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n"); - ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr )); + ieee80211_encrypt_fragment(ieee, skb, sizeof(struct rtl_80211_hdr_3addr )); softmac_mgmt_xmit(skb, ieee); mod_timer(&ieee->associate_timer, jiffies + (HZ/2)); @@ -1364,12 +1360,10 @@ static void ieee80211_associate_complete_wq(struct work_struct *work) ieee->LinkDetectInfo.NumRecvDataInPeriod= 1; } ieee->link_change(ieee->dev); - if(ieee->is_silent_reset == 0){ + if (!ieee->is_silent_reset) { printk("============>normal associate\n"); - notify_wx_assoc_event(ieee); - } - else if(ieee->is_silent_reset == 1) - { + notify_wx_assoc_event(ieee); + } else { printk("==================>silent reset associate\n"); ieee->is_silent_reset = false; } @@ -1464,10 +1458,8 @@ inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee } memcpy(&ieee->current_network, net, sizeof(struct ieee80211_network)); - if (!ssidbroad) { - strncpy(ieee->current_network.ssid, tmp_ssid, IW_ESSID_MAX_SIZE); - ieee->current_network.ssid_len = tmp_ssid_len; - } + strncpy(ieee->current_network.ssid, tmp_ssid, IW_ESSID_MAX_SIZE); + ieee->current_network.ssid_len = tmp_ssid_len; printk(KERN_INFO"Linking with %s,channel:%d, qos:%d, myHT:%d, networkHT:%d\n",ieee->current_network.ssid,ieee->current_network.channel, ieee->current_network.qos_data.supported, ieee->pHTInfo->bEnableHT, ieee->current_network.bssht.bdSupportHT); //ieee->pHTInfo->IOTAction = 0; @@ -1558,7 +1550,7 @@ static inline u16 auth_parse(struct sk_buff *skb, u8 **challenge, int *chlen) } } - return cpu_to_le16(a->status); + return le16_to_cpu(a->status); } @@ -1588,17 +1580,17 @@ static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *ssid=NULL; u8 ssidlen = 0; - struct ieee80211_hdr_3addr *header = - (struct ieee80211_hdr_3addr *) skb->data; + struct rtl_80211_hdr_3addr *header = + (struct rtl_80211_hdr_3addr *) skb->data; - if (skb->len < sizeof (struct ieee80211_hdr_3addr )) + if (skb->len < sizeof (struct rtl_80211_hdr_3addr )) return -1; /* corrupted */ memcpy(src,header->addr2, ETH_ALEN); skbend = (u8 *)skb->data + skb->len; - tag = skb->data + sizeof (struct ieee80211_hdr_3addr ); + tag = skb->data + sizeof (struct rtl_80211_hdr_3addr ); while (tag+1 < skbend){ if (*tag == 0) { @@ -1735,11 +1727,9 @@ static short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, return 0; */ dtim = ieee->current_network.dtim_data; - //printk("DTIM\n"); if(!(dtim & IEEE80211_DTIM_VALID)) return 0; timeout = ieee->current_network.beacon_interval; //should we use ps_timeout value or beacon_interval - //printk("VALID\n"); ieee->current_network.dtim_data = IEEE80211_DTIM_INVALID; if(dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST)& ieee->ps)) @@ -1894,7 +1884,7 @@ EXPORT_SYMBOL(ieee80211_ps_tx_ack); static void ieee80211_process_action(struct ieee80211_device *ieee, struct sk_buff *skb) { - struct ieee80211_hdr *header = (struct ieee80211_hdr *)skb->data; + struct rtl_80211_hdr *header = (struct rtl_80211_hdr *)skb->data; u8 *act = ieee80211_get_payload(header); u8 tmp = 0; // IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA|IEEE80211_DL_BA, skb->data, skb->len); @@ -1963,7 +1953,7 @@ static void ieee80211_check_auth_response(struct ieee80211_device *ieee, } if (ieee->current_network.mode == IEEE_N_24G && - bHalfSupportNmode == true) { + bHalfSupportNmode) { netdev_dbg(ieee->dev, "enter half N mode\n"); ieee->bHalfWirelessN24GMode = true; } else @@ -1985,7 +1975,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_rx_stats *rx_stats, u16 type, u16 stype) { - struct ieee80211_hdr_3addr *header = (struct ieee80211_hdr_3addr *) skb->data; + struct rtl_80211_hdr_3addr *header = (struct rtl_80211_hdr_3addr *) skb->data; u16 errcode; int aid; struct ieee80211_assoc_response_frame *assoc_resp; @@ -2153,7 +2143,7 @@ void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device * ieee80211_sta_wakeup(ieee, 0); /* update the tx status */ - ieee->stats.tx_bytes += txb->payload_size; + ieee->stats.tx_bytes += le16_to_cpu(txb->payload_size); ieee->stats.tx_packets++; tcb_desc = (cb_desc *)(txb->fragments[0]->cb + MAX_DEV_ADDR_SIZE); if (tcb_desc->bMulticast) { @@ -2243,7 +2233,7 @@ void ieee80211_wake_queue(struct ieee80211_device *ieee) unsigned long flags; struct sk_buff *skb; - struct ieee80211_hdr_3addr *header; + struct rtl_80211_hdr_3addr *header; spin_lock_irqsave(&ieee->lock, flags); if (! ieee->queue_stop) goto exit; @@ -2253,7 +2243,7 @@ void ieee80211_wake_queue(struct ieee80211_device *ieee) if (ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE) { while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){ - header = (struct ieee80211_hdr_3addr *) skb->data; + header = (struct rtl_80211_hdr_3addr *) skb->data; header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4); @@ -3126,7 +3116,7 @@ inline struct sk_buff *ieee80211_disassociate_skb( memcpy(disass->header.addr2, ieee->dev->dev_addr, ETH_ALEN); memcpy(disass->header.addr3, beacon->bssid, ETH_ALEN); - disass->reason = asRsn; + disass->reason = cpu_to_le16(asRsn); return skb; } diff --git a/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c b/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c index 714fbcace..aad288a1f 100644 --- a/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c +++ b/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c @@ -32,7 +32,7 @@ int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info union iwreq_data *wrqu, char *b) { int ret; - struct iw_freq *fwrq = & wrqu->freq; + struct iw_freq *fwrq = &wrqu->freq; down(&ieee->wx_sem); @@ -57,11 +57,11 @@ int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info } } - if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){ + if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1) { ret = -EOPNOTSUPP; goto out; - }else { /* Set the channel */ + } else { /* Set the channel */ if (!(GET_DOT11D_INFO(ieee)->channel_map)[fwrq->m]) { ret = -EINVAL; @@ -70,11 +70,10 @@ int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info ieee->current_network.channel = fwrq->m; ieee->set_chan(ieee->dev, ieee->current_network.channel); - if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER) - if(ieee->state == IEEE80211_LINKED){ - - ieee80211_stop_send_beacons(ieee); - ieee80211_start_send_beacons(ieee); + if (ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER) + if (ieee->state == IEEE80211_LINKED) { + ieee80211_stop_send_beacons(ieee); + ieee80211_start_send_beacons(ieee); } } @@ -89,15 +88,15 @@ int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a, union iwreq_data *wrqu, char *b) { - struct iw_freq *fwrq = & wrqu->freq; + struct iw_freq *fwrq = &wrqu->freq; if (ieee->current_network.channel == 0) return -1; - //NM 0.7.0 will not accept channel any more. + /* NM 0.7.0 will not accept channel any more. */ fwrq->m = ieee80211_wlan_frequencies[ieee->current_network.channel-1] * 100000; fwrq->e = 1; -// fwrq->m = ieee->current_network.channel; -// fwrq->e = 0; + /* fwrq->m = ieee->current_network.channel; */ + /* fwrq->e = 0; */ return 0; } @@ -141,7 +140,7 @@ int ieee80211_wx_set_wap(struct ieee80211_device *ieee, int ret = 0; unsigned long flags; - short ifup = ieee->proto_started;//dev->flags & IFF_UP; + short ifup = ieee->proto_started; /* dev->flags & IFF_UP; */ struct sockaddr *temp = (struct sockaddr *)awrq; ieee->sync_scan_hurryup = 1; @@ -179,7 +178,7 @@ out: } EXPORT_SYMBOL(ieee80211_wx_set_wap); - int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b) +int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a, union iwreq_data *wrqu, char *b) { int len, ret = 0; unsigned long flags; @@ -191,14 +190,14 @@ EXPORT_SYMBOL(ieee80211_wx_set_wap); spin_lock_irqsave(&ieee->lock, flags); if (ieee->current_network.ssid[0] == '\0' || - ieee->current_network.ssid_len == 0){ + ieee->current_network.ssid_len == 0) { ret = -1; goto out; } if (ieee->state != IEEE80211_LINKED && ieee->state != IEEE80211_LINKED_SCANNING && - ieee->ssid_set == 0){ + ieee->ssid_set == 0) { ret = -1; goto out; } @@ -223,7 +222,7 @@ int ieee80211_wx_set_rate(struct ieee80211_device *ieee, u32 target_rate = wrqu->bitrate.value; ieee->rate = target_rate/100000; - //FIXME: we might want to limit rate also in management protocols. + /* FIXME: we might want to limit rate also in management protocols. */ return 0; } EXPORT_SYMBOL(ieee80211_wx_set_rate); @@ -233,6 +232,7 @@ int ieee80211_wx_get_rate(struct ieee80211_device *ieee, union iwreq_data *wrqu, char *extra) { u32 tmp_rate; + tmp_rate = TxCountToDataRate(ieee, ieee->softmac_stats.CurrentShowTxate); wrqu->bitrate.value = tmp_rate * 500000; @@ -247,8 +247,7 @@ int ieee80211_wx_set_rts(struct ieee80211_device *ieee, { if (wrqu->rts.disabled || !wrqu->rts.fixed) ieee->rts = DEFAULT_RTS_THRESHOLD; - else - { + else { if (wrqu->rts.value < MIN_RTS_THRESHOLD || wrqu->rts.value > MAX_RTS_THRESHOLD) return -EINVAL; @@ -280,16 +279,14 @@ int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info if (wrqu->mode == ieee->iw_mode) goto out; - if (wrqu->mode == IW_MODE_MONITOR){ - + if (wrqu->mode == IW_MODE_MONITOR) ieee->dev->type = ARPHRD_IEEE80211; - }else{ + else ieee->dev->type = ARPHRD_ETHER; - } - if (!ieee->proto_started){ + if (!ieee->proto_started) { ieee->iw_mode = wrqu->mode; - }else{ + } else { ieee80211_stop_protocol(ieee); ieee->iw_mode = wrqu->mode; ieee80211_start_protocol(ieee); @@ -305,10 +302,10 @@ void ieee80211_wx_sync_scan_wq(struct work_struct *work) { struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq); short chan; - HT_EXTCHNL_OFFSET chan_offset=0; - HT_CHANNEL_WIDTH bandwidth=0; + HT_EXTCHNL_OFFSET chan_offset = 0; + HT_CHANNEL_WIDTH bandwidth = 0; int b40M = 0; - static int count; + chan = ieee->current_network.channel; netif_carrier_off(ieee->dev); @@ -344,20 +341,18 @@ void ieee80211_wx_sync_scan_wq(struct work_struct *work) ieee->InitialGainHandler(ieee->dev, IG_Restore); ieee->state = IEEE80211_LINKED; ieee->link_change(ieee->dev); - // To prevent the immediately calling watch_dog after scan. - if (ieee->LinkDetectInfo.NumRecvBcnInPeriod==0||ieee->LinkDetectInfo.NumRecvDataInPeriod==0 ) - { + /* To prevent the immediately calling watch_dog after scan. */ + if (ieee->LinkDetectInfo.NumRecvBcnInPeriod == 0 || ieee->LinkDetectInfo.NumRecvDataInPeriod == 0) { ieee->LinkDetectInfo.NumRecvBcnInPeriod = 1; - ieee->LinkDetectInfo.NumRecvDataInPeriod= 1; + ieee->LinkDetectInfo.NumRecvDataInPeriod = 1; } if (ieee->data_hard_resume) ieee->data_hard_resume(ieee->dev); - if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER) + if (ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER) ieee80211_start_send_beacons(ieee); netif_carrier_on(ieee->dev); - count = 0; up(&ieee->wx_sem); } @@ -391,7 +386,7 @@ int ieee80211_wx_set_essid(struct ieee80211_device *ieee, union iwreq_data *wrqu, char *extra) { - int ret=0,len; + int ret = 0, len; short proto_started; unsigned long flags; @@ -401,16 +396,16 @@ int ieee80211_wx_set_essid(struct ieee80211_device *ieee, proto_started = ieee->proto_started; if (wrqu->essid.length > IW_ESSID_MAX_SIZE) { - ret= -E2BIG; + ret = -E2BIG; goto out; } if (ieee->iw_mode == IW_MODE_MONITOR) { - ret= -1; + ret = -1; goto out; } - if(proto_started) + if (proto_started) ieee80211_stop_protocol(ieee); @@ -420,13 +415,12 @@ int ieee80211_wx_set_essid(struct ieee80211_device *ieee, spin_lock_irqsave(&ieee->lock, flags); if (wrqu->essid.flags && wrqu->essid.length) { - //first flush current network.ssid + /* first flush current network.ssid */ len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE; strncpy(ieee->current_network.ssid, extra, len+1); ieee->current_network.ssid_len = len+1; ieee->ssid_set = 1; - } - else{ + } else { ieee->ssid_set = 0; ieee->current_network.ssid[0] = '\0'; ieee->current_network.ssid_len = 0; @@ -441,7 +435,7 @@ out: } EXPORT_SYMBOL(ieee80211_wx_set_essid); - int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a, +int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a, union iwreq_data *wrqu, char *b) { @@ -450,7 +444,7 @@ EXPORT_SYMBOL(ieee80211_wx_set_essid); } EXPORT_SYMBOL(ieee80211_wx_get_mode); - int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, +int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { @@ -461,7 +455,7 @@ EXPORT_SYMBOL(ieee80211_wx_get_mode); down(&ieee->wx_sem); - if(enable) + if (enable) ieee->raw_tx = 1; else ieee->raw_tx = 0; @@ -469,8 +463,7 @@ EXPORT_SYMBOL(ieee80211_wx_get_mode); printk(KERN_INFO"raw TX is %s\n", ieee->raw_tx ? "enabled" : "disabled"); - if (ieee->iw_mode == IW_MODE_MONITOR) - { + if (ieee->iw_mode == IW_MODE_MONITOR) { if (prev == 0 && ieee->raw_tx) { if (ieee->data_hard_resume) ieee->data_hard_resume(ieee->dev); @@ -478,7 +471,7 @@ EXPORT_SYMBOL(ieee80211_wx_get_mode); netif_carrier_on(ieee->dev); } - if(prev && ieee->raw_tx == 1) + if (prev && ieee->raw_tx == 1) netif_carrier_off(ieee->dev); } @@ -520,6 +513,7 @@ int ieee80211_wx_set_power(struct ieee80211_device *ieee, union iwreq_data *wrqu, char *extra) { int ret = 0; + down(&ieee->wx_sem); if (wrqu->power.disabled) { @@ -527,15 +521,15 @@ int ieee80211_wx_set_power(struct ieee80211_device *ieee, goto exit; } if (wrqu->power.flags & IW_POWER_TIMEOUT) { - //ieee->ps_period = wrqu->power.value / 1000; + /* ieee->ps_period = wrqu->power.value / 1000; */ ieee->ps_timeout = wrqu->power.value / 1000; } if (wrqu->power.flags & IW_POWER_PERIOD) { - //ieee->ps_timeout = wrqu->power.value / 1000; + /* ieee->ps_timeout = wrqu->power.value / 1000; */ ieee->ps_period = wrqu->power.value / 1000; - //wrq->value / 1024; + /* wrq->value / 1024; */ } switch (wrqu->power.flags & IW_POWER_MODE) { @@ -550,7 +544,7 @@ int ieee80211_wx_set_power(struct ieee80211_device *ieee, break; case IW_POWER_ON: - // ieee->ps = IEEE80211_PS_DISABLED; + /* ieee->ps = IEEE80211_PS_DISABLED; */ break; default: @@ -583,14 +577,14 @@ int ieee80211_wx_get_power(struct ieee80211_device *ieee, wrqu->power.flags = IW_POWER_TIMEOUT; wrqu->power.value = ieee->ps_timeout * 1000; } else { -// ret = -EOPNOTSUPP; -// goto exit; + /* ret = -EOPNOTSUPP; */ + /* goto exit; */ wrqu->power.flags = IW_POWER_PERIOD; wrqu->power.value = ieee->ps_period * 1000; -//ieee->current_network.dtim_period * ieee->current_network.beacon_interval * 1024; + /* ieee->current_network.dtim_period * ieee->current_network.beacon_interval * 1024; */ } - if ((ieee->ps & (IEEE80211_PS_MBCAST | IEEE80211_PS_UNICAST)) == (IEEE80211_PS_MBCAST | IEEE80211_PS_UNICAST)) + if ((ieee->ps & (IEEE80211_PS_MBCAST | IEEE80211_PS_UNICAST)) == (IEEE80211_PS_MBCAST | IEEE80211_PS_UNICAST)) wrqu->power.flags |= IW_POWER_ALL_R; else if (ieee->ps & IEEE80211_PS_MBCAST) wrqu->power.flags |= IW_POWER_MULTICAST_R; diff --git a/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c b/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c index 9f68c652f..1ab0aead2 100644 --- a/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c +++ b/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c @@ -48,7 +48,7 @@ #include <linux/types.h> #include <linux/wireless.h> #include <linux/etherdevice.h> -#include <asm/uaccess.h> +#include <linux/uaccess.h> #include <linux/if_vlan.h> #include "ieee80211.h" @@ -194,9 +194,9 @@ int ieee80211_encrypt_fragment( if (ieee->tkip_countermeasures && crypt && crypt->ops && strcmp(crypt->ops->name, "TKIP") == 0) { if (net_ratelimit()) { - struct ieee80211_hdr_3addrqos *header; + struct rtl_80211_hdr_3addrqos *header; - header = (struct ieee80211_hdr_3addrqos *)frag->data; + header = (struct rtl_80211_hdr_3addrqos *)frag->data; printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " "TX packet to %pM\n", ieee->dev->name, header->addr1); @@ -308,7 +308,7 @@ static void ieee80211_tx_query_agg_cap(struct ieee80211_device *ieee, { PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; PTX_TS_RECORD pTxTs = NULL; - struct ieee80211_hdr_1addr *hdr = (struct ieee80211_hdr_1addr *)skb->data; + struct rtl_80211_hdr_1addr *hdr = (struct rtl_80211_hdr_1addr *)skb->data; if (!pHTInfo->bCurrentHTSupport||!pHTInfo->bEnableHT) return; @@ -336,12 +336,12 @@ static void ieee80211_tx_query_agg_cap(struct ieee80211_device *ieee, printk("===>can't get TS\n"); return; } - if (pTxTs->TxAdmittedBARecord.bValid == false) + if (!pTxTs->TxAdmittedBARecord.bValid) { TsStartAddBaProcess(ieee, pTxTs); goto FORCED_AGG_SETTING; } - else if (pTxTs->bUsingBa == false) + else if (!pTxTs->bUsingBa) { if (SN_LESS(pTxTs->TxAdmittedBARecord.BaStartSeqCtrl.field.SeqNum, (pTxTs->TxCurSeq+1)%4096)) pTxTs->bUsingBa = true; @@ -598,14 +598,14 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) { struct ieee80211_device *ieee = netdev_priv(dev); struct ieee80211_txb *txb = NULL; - struct ieee80211_hdr_3addrqos *frag_hdr; + struct rtl_80211_hdr_3addrqos *frag_hdr; int i, bytes_per_frag, nr_frags, bytes_last_frag, frag_size; unsigned long flags; struct net_device_stats *stats = &ieee->stats; int ether_type = 0, encrypt; int bytes, fc, qos_ctl = 0, hdr_len; struct sk_buff *skb_frag; - struct ieee80211_hdr_3addrqos header = { /* Ensure zero initialized */ + struct rtl_80211_hdr_3addrqos header = { /* Ensure zero initialized */ .duration_id = 0, .seq_ctl = 0, .qos_ctl = 0 @@ -787,7 +787,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) { tcb_desc->bHwSec = 0; } - frag_hdr = (struct ieee80211_hdr_3addrqos *)skb_put(skb_frag, hdr_len); + frag_hdr = (struct rtl_80211_hdr_3addrqos *)skb_put(skb_frag, hdr_len); memcpy(frag_hdr, &header, hdr_len); /* If this is not the last fragment, then add the MOREFRAGS @@ -845,7 +845,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) ieee->seq_ctrl[0]++; } }else{ - if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) { + if (unlikely(skb->len < sizeof(struct rtl_80211_hdr_3addr))) { printk(KERN_WARNING "%s: skb too small (%d).\n", ieee->dev->name, skb->len); goto success; diff --git a/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c b/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c index ae1b3cf28..208be5fc5 100644 --- a/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c +++ b/kernel/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c @@ -522,7 +522,6 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, struct ieee80211_security sec = { .flags = 0, }; - //printk("======>encoding flag:%x,ext flag:%x, ext alg:%d\n", encoding->flags,ext->ext_flags, ext->alg); idx = encoding->flags & IW_ENCODE_INDEX; if (idx) { if (idx < 1 || idx > WEP_KEYS) @@ -538,7 +537,6 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, group_key = 1; } else { /* some Cisco APs use idx>0 for unicast in dynamic WEP */ - //printk("not group key, flags:%x, ext->alg:%d\n", ext->ext_flags, ext->alg); if (idx != 0 && ext->alg != IW_ENCODE_ALG_WEP) return -EINVAL; if (ieee->iw_mode == IW_MODE_INFRA) @@ -567,7 +565,6 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, sec.level = SEC_LEVEL_0; sec.flags |= SEC_LEVEL; } - //printk("disabled: flag:%x\n", encoding->flags); goto done; } @@ -638,7 +635,6 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, goto done; } //skip_host_crypt: - //printk("skip_host_crypt:ext_flags:%x\n", ext->ext_flags); if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { ieee->tx_keyidx = idx; sec.active_key = idx; @@ -760,7 +756,6 @@ int ieee80211_wx_set_auth(struct ieee80211_device *ieee, switch (data->flags & IW_AUTH_INDEX) { case IW_AUTH_WPA_VERSION: /*need to support wpa2 here*/ - //printk("wpa version:%x\n", data->value); break; case IW_AUTH_CIPHER_PAIRWISE: case IW_AUTH_CIPHER_GROUP: @@ -791,16 +786,13 @@ int ieee80211_wx_set_auth(struct ieee80211_device *ieee, else if(data->value & IW_AUTH_ALG_LEAP){ ieee->open_wep = 1; ieee->auth_mode = 2; - //printk("hahahaa:LEAP\n"); } else return -EINVAL; - //printk("open_wep:%d\n", ieee->open_wep); break; case IW_AUTH_WPA_ENABLED: ieee->wpa_enabled = (data->value)?1:0; - //printk("enalbe wpa:%d\n", ieee->wpa_enabled); break; case IW_AUTH_RX_UNENCRYPTED_EAPOL: diff --git a/kernel/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c b/kernel/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c index 618d2cbc0..3bde74460 100644 --- a/kernel/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c +++ b/kernel/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c @@ -110,7 +110,7 @@ void ResetBaEntry(PBA_RECORD pBA) static struct sk_buff *ieee80211_ADDBA(struct ieee80211_device *ieee, u8 *Dst, PBA_RECORD pBA, u16 StatusCode, u8 type) { struct sk_buff *skb = NULL; - struct ieee80211_hdr_3addr *BAReq = NULL; + struct rtl_80211_hdr_3addr *BAReq = NULL; u8 *tag = NULL; u16 len = ieee->tx_headroom + 9; //category(1) + action field(1) + Dialog Token(1) + BA Parameter Set(2) + BA Timeout Value(2) + BA Start SeqCtrl(2)(or StatusCode(2)) @@ -120,17 +120,17 @@ static struct sk_buff *ieee80211_ADDBA(struct ieee80211_device *ieee, u8 *Dst, P IEEE80211_DEBUG(IEEE80211_DL_ERR, "pBA is NULL\n"); return NULL; } - skb = dev_alloc_skb(len + sizeof( struct ieee80211_hdr_3addr)); //need to add something others? FIXME + skb = dev_alloc_skb(len + sizeof( struct rtl_80211_hdr_3addr)); //need to add something others? FIXME if (skb == NULL) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc skb for ADDBA_REQ\n"); return NULL; } - memset(skb->data, 0, sizeof( struct ieee80211_hdr_3addr)); //I wonder whether it's necessary. Apparently kernel will not do it when alloc a skb. + memset(skb->data, 0, sizeof( struct rtl_80211_hdr_3addr)); //I wonder whether it's necessary. Apparently kernel will not do it when alloc a skb. skb_reserve(skb, ieee->tx_headroom); - BAReq = ( struct ieee80211_hdr_3addr *) skb_put(skb,sizeof( struct ieee80211_hdr_3addr)); + BAReq = ( struct rtl_80211_hdr_3addr *) skb_put(skb,sizeof( struct rtl_80211_hdr_3addr)); memcpy(BAReq->addr1, Dst, ETH_ALEN); memcpy(BAReq->addr2, ieee->dev->dev_addr, ETH_ALEN); @@ -139,7 +139,7 @@ static struct sk_buff *ieee80211_ADDBA(struct ieee80211_device *ieee, u8 *Dst, P BAReq->frame_ctl = cpu_to_le16(IEEE80211_STYPE_MANAGE_ACT); //action frame - //tag += sizeof( struct ieee80211_hdr_3addr); //move to action field + //tag += sizeof( struct rtl_80211_hdr_3addr); //move to action field tag = (u8 *)skb_put(skb, 9); *tag ++= ACT_CAT_BA; *tag ++= type; @@ -195,7 +195,7 @@ static struct sk_buff *ieee80211_DELBA( { DELBA_PARAM_SET DelbaParamSet; struct sk_buff *skb = NULL; - struct ieee80211_hdr_3addr *Delba = NULL; + struct rtl_80211_hdr_3addr *Delba = NULL; u8 *tag = NULL; //len = head len + DELBA Parameter Set(2) + Reason Code(2) u16 len = 6 + ieee->tx_headroom; @@ -208,16 +208,16 @@ static struct sk_buff *ieee80211_DELBA( DelbaParamSet.field.Initiator = (TxRxSelect==TX_DIR)?1:0; DelbaParamSet.field.TID = pBA->BaParamSet.field.TID; - skb = dev_alloc_skb(len + sizeof( struct ieee80211_hdr_3addr)); //need to add something others? FIXME + skb = dev_alloc_skb(len + sizeof( struct rtl_80211_hdr_3addr)); //need to add something others? FIXME if (skb == NULL) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc skb for ADDBA_REQ\n"); return NULL; } -// memset(skb->data, 0, len+sizeof( struct ieee80211_hdr_3addr)); +// memset(skb->data, 0, len+sizeof( struct rtl_80211_hdr_3addr)); skb_reserve(skb, ieee->tx_headroom); - Delba = ( struct ieee80211_hdr_3addr *) skb_put(skb,sizeof( struct ieee80211_hdr_3addr)); + Delba = ( struct rtl_80211_hdr_3addr *) skb_put(skb,sizeof( struct rtl_80211_hdr_3addr)); memcpy(Delba->addr1, dst, ETH_ALEN); memcpy(Delba->addr2, ieee->dev->dev_addr, ETH_ALEN); @@ -333,7 +333,7 @@ static void ieee80211_send_DELBA(struct ieee80211_device *ieee, u8 *dst, ********************************************************************************************************************/ int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, struct sk_buff *skb) { - struct ieee80211_hdr_3addr *req = NULL; + struct rtl_80211_hdr_3addr *req = NULL; u16 rc = 0; u8 *dst = NULL, *pDialogToken = NULL, *tag = NULL; PBA_RECORD pBA = NULL; @@ -342,20 +342,20 @@ int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, struct sk_buff *skb) PSEQUENCE_CONTROL pBaStartSeqCtrl = NULL; PRX_TS_RECORD pTS = NULL; - if (skb->len < sizeof(struct ieee80211_hdr_3addr) + 9) { + if (skb->len < sizeof(struct rtl_80211_hdr_3addr) + 9) { IEEE80211_DEBUG(IEEE80211_DL_ERR, " Invalid skb len in BAREQ(%d / %zu)\n", skb->len, - (sizeof(struct ieee80211_hdr_3addr) + 9)); + (sizeof(struct rtl_80211_hdr_3addr) + 9)); return -1; } IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA|IEEE80211_DL_BA, skb->data, skb->len); - req = (struct ieee80211_hdr_3addr *) skb->data; + req = (struct rtl_80211_hdr_3addr *) skb->data; tag = (u8 *)req; dst = (u8 *)(&req->addr2[0]); - tag += sizeof(struct ieee80211_hdr_3addr); + tag += sizeof(struct rtl_80211_hdr_3addr); pDialogToken = tag + 2; //category+action pBaParamSet = (PBA_PARAM_SET)(tag + 3); //+DialogToken pBaTimeoutVal = (u16 *)(tag + 5); @@ -364,8 +364,8 @@ int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, struct sk_buff *skb) printk("====================>rx ADDBAREQ from :%pM\n", dst); //some other capability is not ready now. if ((ieee->current_network.qos_data.active == 0) || - (ieee->pHTInfo->bCurrentHTSupport == false)) //|| - // (ieee->pStaQos->bEnableRxImmBA == false) ) + (!ieee->pHTInfo->bCurrentHTSupport)) //|| + // (!ieee->pStaQos->bEnableRxImmBA) ) { rc = ADDBA_STATUS_REFUSED; IEEE80211_DEBUG(IEEE80211_DL_ERR, "Failed to reply on ADDBA_REQ as some capability is not ready(%d, %d)\n", ieee->current_network.qos_data.active, ieee->pHTInfo->bCurrentHTSupport); @@ -435,7 +435,7 @@ OnADDBAReq_Fail: ********************************************************************************************************************/ int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, struct sk_buff *skb) { - struct ieee80211_hdr_3addr *rsp = NULL; + struct rtl_80211_hdr_3addr *rsp = NULL; PBA_RECORD pPendingBA, pAdmittedBA; PTX_TS_RECORD pTS = NULL; u8 *dst = NULL, *pDialogToken = NULL, *tag = NULL; @@ -443,17 +443,17 @@ int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, struct sk_buff *skb) PBA_PARAM_SET pBaParamSet = NULL; u16 ReasonCode; - if (skb->len < sizeof(struct ieee80211_hdr_3addr) + 9) { + if (skb->len < sizeof(struct rtl_80211_hdr_3addr) + 9) { IEEE80211_DEBUG(IEEE80211_DL_ERR, " Invalid skb len in BARSP(%d / %zu)\n", skb->len, - (sizeof(struct ieee80211_hdr_3addr) + 9)); + (sizeof(struct rtl_80211_hdr_3addr) + 9)); return -1; } - rsp = (struct ieee80211_hdr_3addr *)skb->data; + rsp = (struct rtl_80211_hdr_3addr *)skb->data; tag = (u8 *)rsp; dst = (u8 *)(&rsp->addr2[0]); - tag += sizeof(struct ieee80211_hdr_3addr); + tag += sizeof(struct rtl_80211_hdr_3addr); pDialogToken = tag + 2; pStatusCode = (u16 *)(tag + 3); pBaParamSet = (PBA_PARAM_SET)(tag + 5); @@ -462,8 +462,8 @@ int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, struct sk_buff *skb) // Check the capability // Since we can always receive A-MPDU, we just check if it is under HT mode. if (ieee->current_network.qos_data.active == 0 || - ieee->pHTInfo->bCurrentHTSupport == false || - ieee->pHTInfo->bCurrentAMPDUEnable == false) { + !ieee->pHTInfo->bCurrentHTSupport || + !ieee->pHTInfo->bCurrentAMPDUEnable) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "reject to ADDBA_RSP as some capability is not ready(%d, %d, %d)\n",ieee->current_network.qos_data.active, ieee->pHTInfo->bCurrentHTSupport, ieee->pHTInfo->bCurrentAMPDUEnable); ReasonCode = DELBA_REASON_UNKNOWN_BA; goto OnADDBARsp_Reject; @@ -502,7 +502,7 @@ int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, struct sk_buff *skb) IEEE80211_DEBUG(IEEE80211_DL_BA, "OnADDBARsp(): Recv ADDBA Rsp. Drop because already admit it! \n"); return -1; } - else if((pPendingBA->bValid == false) ||(*pDialogToken != pPendingBA->DialogToken)) + else if((!pPendingBA->bValid) ||(*pDialogToken != pPendingBA->DialogToken)) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "OnADDBARsp(): Recv ADDBA Rsp. BA invalid, DELBA! \n"); ReasonCode = DELBA_REASON_UNKNOWN_BA; @@ -569,32 +569,29 @@ OnADDBARsp_Reject: ********************************************************************************************************************/ int ieee80211_rx_DELBA(struct ieee80211_device *ieee, struct sk_buff *skb) { - struct ieee80211_hdr_3addr *delba = NULL; + struct rtl_80211_hdr_3addr *delba = NULL; PDELBA_PARAM_SET pDelBaParamSet = NULL; - u16 *pReasonCode = NULL; u8 *dst = NULL; - if (skb->len < sizeof(struct ieee80211_hdr_3addr) + 6) { + if (skb->len < sizeof(struct rtl_80211_hdr_3addr) + 6) { IEEE80211_DEBUG(IEEE80211_DL_ERR, " Invalid skb len in DELBA(%d / %zu)\n", skb->len, - (sizeof(struct ieee80211_hdr_3addr) + 6)); + (sizeof(struct rtl_80211_hdr_3addr) + 6)); return -1; } if (ieee->current_network.qos_data.active == 0 || - ieee->pHTInfo->bCurrentHTSupport == false ) + !ieee->pHTInfo->bCurrentHTSupport) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "received DELBA while QOS or HT is not supported(%d, %d)\n",ieee->current_network.qos_data.active, ieee->pHTInfo->bCurrentHTSupport); return -1; } IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA|IEEE80211_DL_BA, skb->data, skb->len); - delba = (struct ieee80211_hdr_3addr *)skb->data; + delba = (struct rtl_80211_hdr_3addr *)skb->data; dst = (u8 *)(&delba->addr2[0]); - delba += sizeof(struct ieee80211_hdr_3addr); - pDelBaParamSet = (PDELBA_PARAM_SET)(delba+2); - pReasonCode = (u16 *)(delba+4); + pDelBaParamSet = (PDELBA_PARAM_SET)&delba->payload[2]; if(pDelBaParamSet->field.Initiator == 1) { diff --git a/kernel/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/kernel/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c index c2588f806..c27397b14 100644 --- a/kernel/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c +++ b/kernel/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c @@ -224,9 +224,9 @@ static bool IsHTHalfNmode40Bandwidth(struct ieee80211_device *ieee) bool retValue = false; PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; - if(pHTInfo->bCurrentHTSupport == false ) // wireless is n mode + if(!pHTInfo->bCurrentHTSupport) // wireless is n mode retValue = false; - else if(pHTInfo->bRegBW40MHz == false) // station supports 40 bw + else if(!pHTInfo->bRegBW40MHz) // station supports 40 bw retValue = false; else if(!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) // station in half n mode retValue = false; @@ -243,7 +243,7 @@ static bool IsHTHalfNmodeSGI(struct ieee80211_device *ieee, bool is40MHz) bool retValue = false; PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; - if(pHTInfo->bCurrentHTSupport == false ) // wireless is n mode + if(!pHTInfo->bCurrentHTSupport) // wireless is n mode retValue = false; else if(!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) // station in half n mode retValue = false; @@ -675,7 +675,7 @@ void HTConstructInfoElement(struct ieee80211_device *ieee, u8 *posHTInfo, u8 *le if ( (ieee->iw_mode == IW_MODE_ADHOC) || (ieee->iw_mode == IW_MODE_MASTER)) //ap mode is not currently supported { pHTInfoEle->ControlChl = ieee->current_network.channel; - pHTInfoEle->ExtChlOffset = ((pHT->bRegBW40MHz == false)?HT_EXTCHNL_OFFSET_NO_EXT: + pHTInfoEle->ExtChlOffset = ((!pHT->bRegBW40MHz)?HT_EXTCHNL_OFFSET_NO_EXT: (ieee->current_network.channel<=6)? HT_EXTCHNL_OFFSET_UPPER:HT_EXTCHNL_OFFSET_LOWER); pHTInfoEle->RecommemdedTxWidth = pHT->bRegBW40MHz; @@ -945,7 +945,7 @@ void HTOnAssocRsp(struct ieee80211_device *ieee) static u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33}; // For 11n EWC definition, 2007.07.17, by Emily static u8 EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34}; // For 11n EWC definition, 2007.07.17, by Emily - if (pHTInfo->bCurrentHTSupport == false) { + if (!pHTInfo->bCurrentHTSupport) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "<=== HTOnAssocRsp(): HT_DISABLE\n"); return; } @@ -956,7 +956,7 @@ void HTOnAssocRsp(struct ieee80211_device *ieee) // HTDebugHTCapability(pHTInfo->PeerHTCapBuf,"HTOnAssocRsp_wq"); // HTDebugHTInfo(pHTInfo->PeerHTInfoBuf,"HTOnAssocRsp_wq"); // - if(!memcmp(pHTInfo->PeerHTCapBuf,EWC11NHTCap, sizeof(EWC11NHTCap))) + if (!memcmp(pHTInfo->PeerHTCapBuf, EWC11NHTCap, sizeof(EWC11NHTCap))) pPeerHTCap = (PHT_CAPABILITY_ELE)(&pHTInfo->PeerHTCapBuf[4]); else pPeerHTCap = (PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf); @@ -976,7 +976,7 @@ void HTOnAssocRsp(struct ieee80211_device *ieee) // HTSetConnectBwMode(ieee, (HT_CHANNEL_WIDTH)(pPeerHTCap->ChlWidth), (HT_EXTCHNL_OFFSET)(pPeerHTInfo->ExtChlOffset)); -// if(pHTInfo->bCurBW40MHz == true) +// if (pHTInfo->bCurBW40MHz) pHTInfo->bCurTxBW40MHz = ((pPeerHTInfo->RecommemdedTxWidth == 1)?true:false); // @@ -1341,7 +1341,7 @@ void HTSetConnectBwMode(struct ieee80211_device *ieee, HT_CHANNEL_WIDTH Bandwidt PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; // u32 flags = 0; - if(pHTInfo->bRegBW40MHz == false) + if(!pHTInfo->bRegBW40MHz) return; diff --git a/kernel/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h b/kernel/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h index 9fbce912a..49c23c720 100644 --- a/kernel/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h +++ b/kernel/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h @@ -1,39 +1,6 @@ #ifndef __INC_QOS_TYPE_H #define __INC_QOS_TYPE_H -#define BIT0 0x00000001 -#define BIT1 0x00000002 -#define BIT2 0x00000004 -#define BIT3 0x00000008 -#define BIT4 0x00000010 -#define BIT5 0x00000020 -#define BIT6 0x00000040 -#define BIT7 0x00000080 -#define BIT8 0x00000100 -#define BIT9 0x00000200 -#define BIT10 0x00000400 -#define BIT11 0x00000800 -#define BIT12 0x00001000 -#define BIT13 0x00002000 -#define BIT14 0x00004000 -#define BIT15 0x00008000 -#define BIT16 0x00010000 -#define BIT17 0x00020000 -#define BIT18 0x00040000 -#define BIT19 0x00080000 -#define BIT20 0x00100000 -#define BIT21 0x00200000 -#define BIT22 0x00400000 -#define BIT23 0x00800000 -#define BIT24 0x01000000 -#define BIT25 0x02000000 -#define BIT26 0x04000000 -#define BIT27 0x08000000 -#define BIT28 0x10000000 -#define BIT29 0x20000000 -#define BIT30 0x40000000 -#define BIT31 0x80000000 - #define MAX_WMMELE_LENGTH 64 // @@ -375,17 +342,17 @@ typedef struct _ACM{ typedef u8 AC_UAPSD, *PAC_UAPSD; -#define GET_VO_UAPSD(_apsd) ((_apsd) & BIT0) -#define SET_VO_UAPSD(_apsd) ((_apsd) |= BIT0) +#define GET_VO_UAPSD(_apsd) ((_apsd) & BIT(0)) +#define SET_VO_UAPSD(_apsd) ((_apsd) |= BIT(0)) -#define GET_VI_UAPSD(_apsd) ((_apsd) & BIT1) -#define SET_VI_UAPSD(_apsd) ((_apsd) |= BIT1) +#define GET_VI_UAPSD(_apsd) ((_apsd) & BIT(1)) +#define SET_VI_UAPSD(_apsd) ((_apsd) |= BIT(1)) -#define GET_BK_UAPSD(_apsd) ((_apsd) & BIT2) -#define SET_BK_UAPSD(_apsd) ((_apsd) |= BIT2) +#define GET_BK_UAPSD(_apsd) ((_apsd) & BIT(2)) +#define SET_BK_UAPSD(_apsd) ((_apsd) |= BIT(2)) -#define GET_BE_UAPSD(_apsd) ((_apsd) & BIT3) -#define SET_BE_UAPSD(_apsd) ((_apsd) |= BIT3) +#define GET_BE_UAPSD(_apsd) ((_apsd) & BIT(3)) +#define SET_BE_UAPSD(_apsd) ((_apsd) |= BIT(3)) //typedef struct _TCLASS{ diff --git a/kernel/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c b/kernel/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c index ea92fdebe..f33c74342 100644 --- a/kernel/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c +++ b/kernel/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c @@ -112,7 +112,7 @@ static void TsAddBaProcess(unsigned long data) static void ResetTsCommonInfo(PTS_COMMON_INFO pTsCommonInfo) { - memset(pTsCommonInfo->Addr, 0, 6); + eth_zero_addr(pTsCommonInfo->Addr); memset(&pTsCommonInfo->TSpec, 0, sizeof(TSPEC_BODY)); memset(&pTsCommonInfo->TClass, 0, sizeof(QOS_TCLAS)*TCLAS_NUM); pTsCommonInfo->TClasProc = 0; @@ -584,7 +584,7 @@ void RemoveAllTS(struct ieee80211_device *ieee) void TsStartAddBaProcess(struct ieee80211_device *ieee, PTX_TS_RECORD pTxTS) { - if(pTxTS->bAddBaReqInProgress == false) + if(!pTxTS->bAddBaReqInProgress) { pTxTS->bAddBaReqInProgress = true; if(pTxTS->bAddBaReqDelayed) |