staging/rtl8xxx: delete ieee80211 constant duplication
cover staging/rtl8xxx: delete ieee80211 constant duplication
While looking at a non-staging wifi driver, I was searching for a constant definition for an error code, and in addition to the expected one living in the main include dir, I found a whole bunch of local copies in the staging dir rtl8xxx wifi drivers. This duplication covers the families of WLAN_STATUS_<text> and WLAN_REASON_<text> values.
While one can understand that these things were wholesale copied at one point to simplify out of tree building, we don't want duplicated stuff for drivers that are in tree. Even if they are in staging, they will need cleanups like this if they ever want to get out of staging.
Some could be removed and trivially replaced with the associated include of <linux/ieee80211.h> but for a couple of others a couple of struct fields had to be renamed to align with the main include first, and a struct namespace collision between the main include and the local ones had to be resolved to allow the duplicate constant removal as well.
Compile tested only, but the changes seem trivial enough so as to be presumably zero runtime impact (famous last words....)
---
Paul Gortmaker (8):
rtl8188eu: don't duplicate ieee80211 constants for status/reason
rtl8712: don't duplicate ieee80211 constants for status/reason
rtl8192u: don't trample on <linux/ieee80211.h> struct namespace
rtl8192u: promote auth_mode to a full 8 bits
rtl8192u: align local ieee80211_wmm_ac_param struct fields with global
rtl8192u: don't duplicate ieee80211 constants for status/auth/reason
rtl8192u: delete another embedded instance of generic reason codes
rtl8192e: delete local copy of iee80211 reason codes.
drivers/staging/rtl8188eu/core/rtw_ap.c | 2 + drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 10 +- drivers/staging/rtl8188eu/core/rtw_recv.c | 2 + drivers/staging/rtl8188eu/include/ieee80211.h | 29 +--- drivers/staging/rtl8188eu/include/wifi.h | 77 ---------- drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 2 + drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 +- drivers/staging/rtl8192e/rtllib.h | 39 ----- drivers/staging/rtl8192e/rtllib_softmac.c | 3 +- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 171 +++------------------ .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c | 10 +- .../rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 26 ++-- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 76 ++++----- .../staging/rtl8192u/ieee80211/ieee80211_softmac.c | 32 ++-- drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c | 14 +- .../staging/rtl8192u/ieee80211/rtl819x_BAProc.c | 48 +++--- drivers/staging/rtl8192u/r8192U_core.c | 12 +- drivers/staging/rtl8712/ieee80211.h | 29 ---- 18 files changed, 150 insertions(+), 435 deletions(-)
Signature · 1 line
2.2.1
PATCH 1/8 rtl8188eu: don't duplicate ieee80211 constants for status/reason
These are all defined as a part of the standard and should not be duplicated on a per-driver basis. Use the global ones and delete the local ones.
Note that a couple of them had slight wording differences, things like INVALID vs. NOT_VALID or similar, so they are aligned with the global naming conventions here, as dictated by compile testing.
This isn't the totality of duplicated data removed, but it is a start.
--- drivers/staging/rtl8188eu/core/rtw_ap.c | 2 + drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 10 ++-- drivers/staging/rtl8188eu/core/rtw_recv.c | 2 + drivers/staging/rtl8188eu/include/ieee80211.h | 29 +--------- drivers/staging/rtl8188eu/include/wifi.h | 77 -------------------------- drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 2 + 6 files changed, 13 insertions(+), 109 deletions(-)
drivers/staging/rtl8188eu/core/rtw_ap.c +2 -0
@@ -19,6 +19,8 @@******************************************************************************/ #define _RTW_AP_C_ +#include <linux/ieee80211.h> +#include <osdep_service.h> #include <drv_types.h> #include <wifi.h>
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +6 -4
@@ -19,6 +19,8 @@******************************************************************************/ #define _RTW_MLME_EXT_C_ +#include <linux/ieee80211.h> +#include <osdep_service.h> #include <drv_types.h> #include <wifi.h>
@@ -1048,10 +1050,10 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame pstat->wpa2_pairwise_cipher = pairwise_cipher&psecuritypriv->wpa2_pairwise_cipher;if (!pstat->wpa2_group_cipher) - status =WLAN_STATUS_GROUP_CIPHER_NOT_VALID ; + status =WLAN_STATUS_INVALID_GROUP_CIPHER ;if (!pstat->wpa2_pairwise_cipher) - status =WLAN_STATUS_PAIRWISE_CIPHER_NOT_VALID ; + status =WLAN_STATUS_INVALID_PAIRWISE_CIPHER ; }else { status =WLAN_STATUS_INVALID_IE ; }
@@ -1069,10 +1071,10 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame pstat->wpa_pairwise_cipher = pairwise_cipher&psecuritypriv->wpa_pairwise_cipher;if (!pstat->wpa_group_cipher) - status =WLAN_STATUS_GROUP_CIPHER_NOT_VALID ; + status =WLAN_STATUS_INVALID_GROUP_CIPHER ;if (!pstat->wpa_pairwise_cipher) - status =WLAN_STATUS_PAIRWISE_CIPHER_NOT_VALID ; + status =WLAN_STATUS_INVALID_PAIRWISE_CIPHER ; }else { status =WLAN_STATUS_INVALID_IE ; }
drivers/staging/rtl8188eu/core/rtw_recv.c +2 -0
@@ -19,6 +19,8 @@******************************************************************************/ #define _RTW_RECV_C_ +#include <linux/ieee80211.h> +#include <osdep_service.h> #include <drv_types.h> #include <recv_osdep.h>
drivers/staging/rtl8188eu/include/ieee80211.h +1 -28
@@ -493,34 +493,7 @@ struct ieee80211_snap_hdr {#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)#define WLAN_CAPABILITY_SHORT_SLOT (1<<10) -/* Status codes */ -#define WLAN_STATUS_SUCCESS 0 -#define WLAN_STATUS_UNSPECIFIED_FAILURE 1 -#define WLAN_STATUS_CAPS_UNSUPPORTED 10 -#define WLAN_STATUS_REASSOC_NO_ASSOC 11 -#define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12 -#define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13 -#define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14 -#define WLAN_STATUS_CHALLENGE_FAIL 15 -#define WLAN_STATUS_AUTH_TIMEOUT 16 -#define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17 -#define WLAN_STATUS_ASSOC_DENIED_RATES 18 -/* 802.11b */ -#define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19 -#define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20 -#define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21 - -/* Reason codes */ -#define WLAN_REASON_UNSPECIFIED 1 -#define WLAN_REASON_PREV_AUTH_NOT_VALID 2 -#define WLAN_REASON_DEAUTH_LEAVING 3 -#define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4 -#define WLAN_REASON_DISASSOC_AP_BUSY 5 -#define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6 -#define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7 -#define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8 -#define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9 -#define WLAN_REASON_JOIN_WRONG_CHANNEL 65534 +/* Non standard? Not in <linux/ieee80211.h> */ #define WLAN_REASON_EXPIRATION_CHK 65535/* Information Element IDs */
drivers/staging/rtl8188eu/include/wifi.h +0 -77
89 lines not on this page · raw message
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c +2 -0
@@ -19,6 +19,8 @@******************************************************************************/ #define _IOCTL_LINUX_C_ +#include <linux/ieee80211.h> +#include <osdep_service.h> #include <drv_types.h> #include <wlan_bssdef.h>
Signature · 1 line
2.2.1
PATCH 2/8 rtl8712: don't duplicate ieee80211 constants for status/reason
In reply to Paul GortmakerThese are all defined as a part of the standard and should not be duplicated on a per-driver basis. Use the global ones and delete the local ones.
It seems that ieee80211 was already included everywhere it was needed, since no explicit include <...> were needed to be added in order to preserve getting a successful compile.
This isn't the totality of duplicated data removed, but it is a start.
--- drivers/staging/rtl8712/ieee80211.h | 29 ----------------------------- 1 file changed, 29 deletions(-)
drivers/staging/rtl8712/ieee80211.h +0 -29
@@ -314,35 +314,6 @@ struct ieee80211_snap_hdr {#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)#define WLAN_CAPABILITY_SHORT_SLOT (1<<10) -/* Status codes */ -#define WLAN_STATUS_SUCCESS 0 -#define WLAN_STATUS_UNSPECIFIED_FAILURE 1 -#define WLAN_STATUS_CAPS_UNSUPPORTED 10 -#define WLAN_STATUS_REASSOC_NO_ASSOC 11 -#define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12 -#define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13 -#define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14 -#define WLAN_STATUS_CHALLENGE_FAIL 15 -#define WLAN_STATUS_AUTH_TIMEOUT 16 -#define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17 -#define WLAN_STATUS_ASSOC_DENIED_RATES 18 -/* 802.11b */ -#define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19 -#define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20 -#define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21 - -/* Reason codes */ -#define WLAN_REASON_UNSPECIFIED 1 -#define WLAN_REASON_PREV_AUTH_NOT_VALID 2 -#define WLAN_REASON_DEAUTH_LEAVING 3 -#define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4 -#define WLAN_REASON_DISASSOC_AP_BUSY 5 -#define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6 -#define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7 -#define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8 -#define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9 - -/* Information Element IDs */ #define WLAN_EID_SSID 0#define WLAN_EID_SUPP_RATES 1
Signature · 1 line
2.2.1
PATCH 3/8 rtl8192u: don't trample on <linux/ieee80211.h> struct namespace
In reply to Paul GortmakerIn order to start reducing the duplicated code/constants/macros in this driver, we need to include <linux/ieee80211.h> to provide the defacto versions. However this driver has structs with the same name as the ones in the main include, so namespace collision prevents us from doing step #1.
Since the structs actually differ in their respective fields, we can't simply delete the local ones without impacting the runtime; a conversion to use the global ones can be considered at a later date if desired.
Rename the ones here with a vendor specific prefix so that we won't have the namespace collision, and hence can continue on with the cleanup.
Automated conversion done with:
for i in `find . -name '*.[ch]'` ; do \
sed -i 's/struct ieee80211_hdr/struct rtl_80211_hdr/g' $i ; \
done--- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 44 +++++++------- .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c | 10 ++-- .../rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 26 ++++----- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 68 +++++++++++----------- .../staging/rtl8192u/ieee80211/ieee80211_softmac.c | 32 +++++----- drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c | 14 ++--- .../staging/rtl8192u/ieee80211/rtl819x_BAProc.c | 48 +++++++-------- drivers/staging/rtl8192u/r8192U_core.c | 12 ++-- 8 files changed, 127 insertions(+), 127 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211.h +22 -22
@@ -1020,20 +1020,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 +1041,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 +1051,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 +1062,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 +1073,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 +1092,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 +1101,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 +1125,7 @@ struct ieee80211_probe_response {#define ieee80211_beacon ieee80211_probe_responsestruct 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 +1133,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 +1142,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;
@@ -1329,9 +1329,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; }
@@ -2262,17 +2262,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 ; }
@@ -2328,7 +2328,7 @@ extern void ieee80211_txb_free(struct ieee80211_txb *);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 rtl_80211_hdr_4addr *header,struct ieee80211_rx_stats *stats);/* ieee80211_wx.c */
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c +5 -5
@@ -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) {
@@ -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,7 +228,7 @@ 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; + hdr = (struct rtl_80211_hdr_4addr *) skb->data;if (!tcb_desc->bHwSec) {int blocks, last, len;
@@ -270,7 +270,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,7 +279,7 @@ 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 ))) {
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +13 -13
@@ -306,7 +306,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)struct ieee80211_tkip_data *tkey = priv;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,7 +318,7 @@ 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) {
@@ -390,7 +390,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 ];
@@ -401,7 +401,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)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 ))) {
@@ -523,9 +523,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 +556,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 "
@@ -585,7 +585,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;
@@ -610,9 +610,9 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, {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 ;
@@ -629,8 +629,8 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, 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,
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +34 -34
225 lines not on this page · raw message
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +16 -16
@@ -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);
@@ -289,8 +289,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){
@@ -928,14 +928,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 );
@@ -1304,7 +1304,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 ));
@@ -1588,17 +1588,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 ) {
@@ -1894,7 +1894,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);
@@ -1985,7 +1985,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;
@@ -2243,7 +2243,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 +2253,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 );
drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c +7 -7
@@ -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 ;
@@ -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;
drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c +24 -24
154 lines not on this page · raw message
drivers/staging/rtl8192u/r8192U_core.c +6 -6
@@ -3711,10 +3711,10 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer,static u32 slide_beacon_adc_pwdb_index, slide_beacon_adc_pwdb_statistics;static u32 last_beacon_adc_pwdb; -struct ieee80211_hdr_3addr *hdr; +struct rtl_80211_hdr_3addr *hdr;u16 sc;unsigned int frag, seq; - hdr = (struct ieee80211_hdr_3addr *)buffer; + hdr = (struct rtl_80211_hdr_3addr *)buffer; sc =le16_to_cpu (hdr->seq_ctl); frag =WLAN_GET_SEQ_FRAG (sc); seq =WLAN_GET_SEQ_SEQ (sc);
@@ -4205,7 +4205,7 @@ static void TranslateRxSignalStuff819xUsb(struct sk_buff *skb,bool bpacket_match_bssid, bpacket_toself;bool bPacketBeacon = false, bToSelfBA = false;static struct ieee80211_rx_stats previous_stats; -struct ieee80211_hdr_3addr *hdr;//by amy +struct rtl_80211_hdr_3addr *hdr;//by amy u16 fc, type;// Get Signal Quality for only RX data queue (but not command queue)
@@ -4216,7 +4216,7 @@ static void TranslateRxSignalStuff819xUsb(struct sk_buff *skb,/* Get MAC frame start address. */ tmp_buf = (u8 *)skb->data; - hdr = (struct ieee80211_hdr_3addr *)tmp_buf; + hdr = (struct rtl_80211_hdr_3addr *)tmp_buf; fc =le16_to_cpu (hdr->frame_ctl); type =WLAN_FC_GET_TYPE (fc); praddr = hdr->addr1;
@@ -4487,7 +4487,7 @@ static void rtl8192_rx_nomal(struct sk_buff *skb) .freq = IEEE80211_24GHZ_BAND, };u32 rx_pkt_len =0 ; -struct ieee80211_hdr_1addr *ieee80211_hdr =NULL ; +struct rtl_80211_hdr_1addr *ieee80211_hdr =NULL ;bool unicast_packet = false;/* 20 is for ps-poll */
@@ -4500,7 +4500,7 @@ static void rtl8192_rx_nomal(struct sk_buff *skb)skb_trim (skb, skb->len -4 /*sCrcLng*/ ); rx_pkt_len = skb->len; - ieee80211_hdr = (struct ieee80211_hdr_1addr *)skb->data; + ieee80211_hdr = (struct rtl_80211_hdr_1addr *)skb->data; unicast_packet = false;if (is_broadcast_ether_addr (ieee80211_hdr->addr1)) {//TODO
Signature · 1 line
2.2.1
Re: [PATCH 3/8] rtl8192u: don't trample on <linux/ieee80211.h> struct namespace
Quoted 20 lines · Paul Gortmaker
In order to start reducing the duplicated code/constants/macros in this driver, we need to include <
linux/ieee80211.h> to provide the defacto versions. However this driver has structs with the same name as the ones in the main include, so namespace collision prevents us from doing step #1.Since the structs actually differ in their respective fields, we can't simply delete the local ones without impacting the runtime; a conversion to use the global ones can be considered at a later date if desired.
Rename the ones here with a vendor specific prefix so that we won't have the namespace collision, and hence can continue on with the cleanup.
Automated conversion done with:
for i in `find . -name '*.[ch]'` ; do \ sed -i 's/struct ieee80211_hdr/struct rtl_80211_hdr/g' $i ; \ doneSigned-off-by Paul Gortmaker <[email protected]>
Quoted 10 lines
--- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 44 +++++++------- .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c | 10 ++-- .../rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 26 ++++----- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 68 +++++++++++----------- .../staging/rtl8192u/ieee80211/ieee80211_softmac.c | 32 +++++----- drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c | 14 ++--- .../staging/rtl8192u/ieee80211/rtl819x_BAProc.c | 48 +++++++-------- drivers/staging/rtl8192u/r8192U_core.c | 12 ++-- 8 files changed, 127 insertions(+), 127 deletions(-)
Rather than just renaming these headers to avoid the conflict, it seems to me the better solution is to convert the code to use the ieee80211.h provided ones from the kernel?
Cheers,
Jes
Quoted 953 lines
drivers/staging/rtl8192u/ieee80211/ieee80211.h +22
-22@@ -1020,20 +1020,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 +1041,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 +1051,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 +1062,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 +1073,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 +1092,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 +1101,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 +1125,7 @@ struct ieee80211_probe_response {#define ieee80211_beacon ieee80211_probe_responsestruct 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 +1133,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 +1142,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;@@ -1329,9 +1329,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; }@@ -2262,17 +2262,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 ; }@@ -2328,7 +2328,7 @@ extern void ieee80211_txb_free(struct ieee80211_txb *);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 rtl_80211_hdr_4addr *header,struct ieee80211_rx_stats *stats);/* ieee80211_wx.c */ drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c +5
-5@@ -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) {@@ -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,7 +228,7 @@ 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; + hdr = (struct rtl_80211_hdr_4addr *) skb->data;if (!tcb_desc->bHwSec) {int blocks, last, len;@@ -270,7 +270,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,7 +279,7 @@ 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 ))) {drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +13
-13@@ -306,7 +306,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)struct ieee80211_tkip_data *tkey = priv;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,7 +318,7 @@ 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) {@@ -390,7 +390,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 ];@@ -401,7 +401,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)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 ))) {@@ -523,9 +523,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 +556,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 "@@ -585,7 +585,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;@@ -610,9 +610,9 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, {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 ;@@ -629,8 +629,8 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, 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,drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +34
-34@@ -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 ++;@@ -768,10 +768,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;@@ -888,8 +888,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;@@ -921,7 +921,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 ) {@@ -1156,7 +1156,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 +1209,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 +1226,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)) {@@ -2612,7 +2612,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)) {drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +16
-16@@ -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);@@ -289,8 +289,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){@@ -928,14 +928,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 );@@ -1304,7 +1304,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 ));@@ -1588,17 +1588,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 ) {@@ -1894,7 +1894,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); @@ -1985,7 +1985,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;@@ -2243,7 +2243,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 +2253,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 );drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c +7
-7@@ -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 ;@@ -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;drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c +24
-24@@ -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, PIEEE80211_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 );@@ -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 );@@ -569,16 +569,16 @@ 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 ; }@@ -590,9 +590,9 @@ int ieee80211_rx_DELBA(struct ieee80211_device *ieee, struct sk_buff *skb) }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 ); + delba +=sizeof (struct rtl_80211_hdr_3addr ); pDelBaParamSet = (PDELBA_PARAM_SET )(delba+2 ); pReasonCode = (u16 *)(delba+4 );drivers/staging/rtl8192u/r8192U_core.c +6
-6@@ -3711,10 +3711,10 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer,static u32 slide_beacon_adc_pwdb_index, slide_beacon_adc_pwdb_statistics;static u32 last_beacon_adc_pwdb; -struct ieee80211_hdr_3addr *hdr; +struct rtl_80211_hdr_3addr *hdr;u16 sc;unsigned int frag, seq; - hdr = (struct ieee80211_hdr_3addr *)buffer; + hdr = (struct rtl_80211_hdr_3addr *)buffer; sc =le16_to_cpu (hdr->seq_ctl); frag =WLAN_GET_SEQ_FRAG (sc); seq =WLAN_GET_SEQ_SEQ (sc);@@ -4205,7 +4205,7 @@ static void TranslateRxSignalStuff819xUsb(struct sk_buff *skb,bool bpacket_match_bssid, bpacket_toself;bool bPacketBeacon = false, bToSelfBA = false;static struct ieee80211_rx_stats previous_stats; -struct ieee80211_hdr_3addr *hdr;//by amy +struct rtl_80211_hdr_3addr *hdr;//by amy u16 fc, type;// Get Signal Quality for only RX data queue (but not command queue) @@ -4216,7 +4216,7 @@ static void TranslateRxSignalStuff819xUsb(struct sk_buff *skb,/* Get MAC frame start address. */ tmp_buf = (u8 *)skb->data; - hdr = (struct ieee80211_hdr_3addr *)tmp_buf; + hdr = (struct rtl_80211_hdr_3addr *)tmp_buf; fc =le16_to_cpu (hdr->frame_ctl); type =WLAN_FC_GET_TYPE (fc); praddr = hdr->addr1;@@ -4487,7 +4487,7 @@ static void rtl8192_rx_nomal(struct sk_buff *skb) .freq = IEEE80211_24GHZ_BAND, };u32 rx_pkt_len =0 ; -struct ieee80211_hdr_1addr *ieee80211_hdr =NULL ; +struct rtl_80211_hdr_1addr *ieee80211_hdr =NULL ;bool unicast_packet = false;/* 20 is for ps-poll */ @@ -4500,7 +4500,7 @@ static void rtl8192_rx_nomal(struct sk_buff *skb)skb_trim (skb, skb->len -4 /*sCrcLng*/ ); rx_pkt_len = skb->len; - ieee80211_hdr = (struct ieee80211_hdr_1addr *)skb->data; + ieee80211_hdr = (struct rtl_80211_hdr_1addr *)skb->data; unicast_packet = false;if (is_broadcast_ether_addr (ieee80211_hdr->addr1)) {//TODO
Re: [PATCH 3/8] rtl8192u: don't trample on <linux/ieee80211.h> struct namespace
Quoted 10 lines · [Re: [PATCH 3/8] rtl8192u: don't trample on <linux/ieee80211.h> struct…
Quoted 9 lines · Paul Gortmaker
In order to start reducing the duplicated code/constants/macros in this driver, we need to include <
linux/ieee80211.h> to provide the defacto versions. However this driver has structs with the same name as the ones in the main include, so namespace collision prevents us from doing step #1.Since the structs actually differ in their respective fields, we can't simply delete the local ones without impacting the runtime; a conversion to use the global ones can be considered at a later date if desired.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Quoted 22 lines
Quoted 11 lines
Rename the ones here with a vendor specific prefix so that we won't have the namespace collision, and hence can continue on with the cleanup.
Automated conversion done with:
for i in `find . -name '*.[ch]'` ; do \ sed -i 's/struct ieee80211_hdr/struct rtl_80211_hdr/g' $i ; \ doneSigned-off-by Paul Gortmaker <[email protected]>Quoted 10 lines
--- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 44 +++++++------- .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c | 10 ++-- .../rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 26 ++++----- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 68 +++++++++++----------- .../staging/rtl8192u/ieee80211/ieee80211_softmac.c | 32 +++++----- drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c | 14 ++--- .../staging/rtl8192u/ieee80211/rtl819x_BAProc.c | 48 +++++++-------- drivers/staging/rtl8192u/r8192U_core.c | 12 ++-- 8 files changed, 127 insertions(+), 127 deletions(-)
Quoted 3 lines
Rather than just renaming these headers to avoid the conflict, it seems to me the better solution is to convert the code to use the
ieee80211.hprovided ones from the kernel?
That is what I said in paragraph #2 above. If someone wants to do this later, then fine. And then it can be done incrementally and tested by someone who has the actual hardware. In the meantime, this is better than what was there, and since it is in staging, a realisitc expectation is multiple small incremental improvements IMHO.
Paul.
--
Quoted 957 lines
Cheers,
JesQuoted 953 lines
drivers/staging/rtl8192u/ieee80211/ieee80211.h +22
-22@@ -1020,20 +1020,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 +1041,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 +1051,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 +1062,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 +1073,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 +1092,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 +1101,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 +1125,7 @@ struct ieee80211_probe_response {#define ieee80211_beacon ieee80211_probe_responsestruct 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 +1133,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 +1142,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;@@ -1329,9 +1329,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; }@@ -2262,17 +2262,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 ; }@@ -2328,7 +2328,7 @@ extern void ieee80211_txb_free(struct ieee80211_txb *);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 rtl_80211_hdr_4addr *header,struct ieee80211_rx_stats *stats);/* ieee80211_wx.c */ drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c +5
-5@@ -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) {@@ -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,7 +228,7 @@ 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; + hdr = (struct rtl_80211_hdr_4addr *) skb->data;if (!tcb_desc->bHwSec) {int blocks, last, len;@@ -270,7 +270,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,7 +279,7 @@ 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 ))) {drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +13
-13@@ -306,7 +306,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)struct ieee80211_tkip_data *tkey = priv;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,7 +318,7 @@ 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) {@@ -390,7 +390,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 ];@@ -401,7 +401,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)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 ))) {@@ -523,9 +523,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 +556,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 "@@ -585,7 +585,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;@@ -610,9 +610,9 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, {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 ;@@ -629,8 +629,8 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, 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,drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +34
-34@@ -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 ++;@@ -768,10 +768,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;@@ -888,8 +888,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;@@ -921,7 +921,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 ) {@@ -1156,7 +1156,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 +1209,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 +1226,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)) {@@ -2612,7 +2612,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)) {drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +16
-16@@ -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);@@ -289,8 +289,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){@@ -928,14 +928,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 );@@ -1304,7 +1304,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 ));@@ -1588,17 +1588,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 ) {@@ -1894,7 +1894,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); @@ -1985,7 +1985,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;@@ -2243,7 +2243,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 +2253,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 );drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c +7
-7@@ -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 ;@@ -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;drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c +24
-24@@ -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, PIEEE80211_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 );@@ -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 );@@ -569,16 +569,16 @@ 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 ; }@@ -590,9 +590,9 @@ int ieee80211_rx_DELBA(struct ieee80211_device *ieee, struct sk_buff *skb) }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 ); + delba +=sizeof (struct rtl_80211_hdr_3addr ); pDelBaParamSet = (PDELBA_PARAM_SET )(delba+2 ); pReasonCode = (u16 *)(delba+4 );drivers/staging/rtl8192u/r8192U_core.c +6
-6@@ -3711,10 +3711,10 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer,static u32 slide_beacon_adc_pwdb_index, slide_beacon_adc_pwdb_statistics;static u32 last_beacon_adc_pwdb; -struct ieee80211_hdr_3addr *hdr; +struct rtl_80211_hdr_3addr *hdr;u16 sc;unsigned int frag, seq; - hdr = (struct ieee80211_hdr_3addr *)buffer; + hdr = (struct rtl_80211_hdr_3addr *)buffer; sc =le16_to_cpu (hdr->seq_ctl); frag =WLAN_GET_SEQ_FRAG (sc); seq =WLAN_GET_SEQ_SEQ (sc);@@ -4205,7 +4205,7 @@ static void TranslateRxSignalStuff819xUsb(struct sk_buff *skb,bool bpacket_match_bssid, bpacket_toself;bool bPacketBeacon = false, bToSelfBA = false;static struct ieee80211_rx_stats previous_stats; -struct ieee80211_hdr_3addr *hdr;//by amy +struct rtl_80211_hdr_3addr *hdr;//by amy u16 fc, type;// Get Signal Quality for only RX data queue (but not command queue) @@ -4216,7 +4216,7 @@ static void TranslateRxSignalStuff819xUsb(struct sk_buff *skb,/* Get MAC frame start address. */ tmp_buf = (u8 *)skb->data; - hdr = (struct ieee80211_hdr_3addr *)tmp_buf; + hdr = (struct rtl_80211_hdr_3addr *)tmp_buf; fc =le16_to_cpu (hdr->frame_ctl); type =WLAN_FC_GET_TYPE (fc); praddr = hdr->addr1;@@ -4487,7 +4487,7 @@ static void rtl8192_rx_nomal(struct sk_buff *skb) .freq = IEEE80211_24GHZ_BAND, };u32 rx_pkt_len =0 ; -struct ieee80211_hdr_1addr *ieee80211_hdr =NULL ; +struct rtl_80211_hdr_1addr *ieee80211_hdr =NULL ;bool unicast_packet = false;/* 20 is for ps-poll */ @@ -4500,7 +4500,7 @@ static void rtl8192_rx_nomal(struct sk_buff *skb)skb_trim (skb, skb->len -4 /*sCrcLng*/ ); rx_pkt_len = skb->len; - ieee80211_hdr = (struct ieee80211_hdr_1addr *)skb->data; + ieee80211_hdr = (struct rtl_80211_hdr_1addr *)skb->data; unicast_packet = false;if (is_broadcast_ether_addr (ieee80211_hdr->addr1)) {//TODO
Re: [PATCH 3/8] rtl8192u: don't trample on <linux/ieee80211.h> struct namespace
Quoted 41 lines · Paul Gortmaker
[Re: [PATCH 3/8] rtl8192u: don't trample on <
linux/ieee80211.h> structQuoted 10 lines · namespace] On 30/04/2015 (Thu 09:52) Jes Sorensen wrote:
Quoted 9 lines · Paul Gortmaker
In order to start reducing the duplicated code/constants/macros in this driver, we need to include <
linux/ieee80211.h> to provide the defacto versions. However this driver has structs with the same name as the ones in the main include, so namespace collision prevents us from doing step #1.Since the structs actually differ in their respective fields, we can't simply delete the local ones without impacting the runtime; a conversion to use the global ones can be considered at a later date if desired.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Quoted 10 lines
Quoted 10 lines
Rename the ones here with a vendor specific prefix so that we won't have the namespace collision, and hence can continue on with the cleanup.
Automated conversion done with:
for i in `find . -name '*.[ch]'` ; do \ sed -i 's/struct ieee80211_hdr/struct rtl_80211_hdr/g' $i ; \ doneQuoted 6 lines
Quoted 6 lines
Signed-off-by Paul Gortmaker <[email protected]>--- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 44 +++++++------- .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c | 10 ++-- .../rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 26 ++++-----
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c| 68+++++++++++-----------
Quoted 9 lines
Quoted 5 lines
.../staging/rtl8192u/ieee80211/ieee80211_softmac.c | 32 +++++----- drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c | 14 ++--- .../staging/rtl8192u/ieee80211/rtl819x_BAProc.c | 48 +++++++-------- drivers/staging/rtl8192u/r8192U_core.c | 12 ++-- 8 files changed, 127 insertions(+), 127 deletions(-)Rather than just renaming these headers to avoid the conflict, it seems to me the better solution is to convert the code to use the
ieee80211.hprovided ones from the kernel?
Quoted 5 lines
That is what I said in paragraph #2 above. If someone wants to do this later, then fine. And then it can be done incrementally and tested by someone who has the actual hardware. In the meantime, this is better than what was there, and since it is in staging, a realisitc expectation is multiple small incremental improvements IMHO.
Sorry too far behind on emails, I missed that part.
I am fine with this approach - we just need a volunteer!
Jes
PATCH 4/8 rtl8192u: promote auth_mode to a full 8 bits
In reply to Paul GortmakerCurrently LEAP is defined to two locally but the identically named global constant is 128 in <linux/ieee80211.h>. In order for us to switch over to using the global value, we need to adjust the local storage which is currently not enough to hold the larger value.
This is now consistent with the similar struct used in drivers/net/wireless/ipw2x00/libipw.h and other drivers.
--- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211.h +2 -2
@@ -649,7 +649,7 @@ struct ieee80211_snap_hdr {/* Authentication algorithms */ #define WLAN_AUTH_OPEN 0#define WLAN_AUTH_SHARED_KEY 1 -#define WLAN_AUTH_LEAP 2 +#define WLAN_AUTH_LEAP 128#define WLAN_AUTH_CHALLENGE_LEN 128
@@ -961,10 +961,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;
Signature · 1 line
2.2.1
PATCH 5/8 rtl8192u: align local ieee80211_wmm_ac_param struct fields with global
In reply to Paul GortmakerThe <linux/ieee80211.h> and this local file both have a struct of the same name. They also have the same field sizes and generally the same fields, as can be seen here:
~/git/linux-head$ git grep -A4 'struct ieee80211_wmm_ac_param {'
drivers/staging/rtl8192u/ieee80211/ieee80211.h:struct ieee80211_wmm_ac_param {
drivers/staging/rtl8192u/ieee80211/ieee80211.h- u8 ac_aci_acm_aifsn;
drivers/staging/rtl8192u/ieee80211/ieee80211.h- u8 ac_ecwmin_ecwmax;
drivers/staging/rtl8192u/ieee80211/ieee80211.h- u16 ac_txop_limit;
drivers/staging/rtl8192u/ieee80211/ieee80211.h-};
--
include/linux/ieee80211.h:struct ieee80211_wmm_ac_param {
include/linux/ieee80211.h- u8 aci_aifsn; /* AIFSN, ACM, ACI */
include/linux/ieee80211.h- u8 cw; /* ECWmin, ECWmax (CW = 2^ECW - 1) */
include/linux/ieee80211.h- __le16 txop_limit;
include/linux/ieee80211.h-} __packed;
~/git/linux-head$Here we just align the local field names with the main system one. Then we can add an include of the system one and delete the local copy in one smooth step in a follow-on commit.
Not that the replacement:
for i in find . -name '*.[ch]' ; do sed -i 's/ac_aci_acm_aifsn/aci_aifsn/g' $i ; done for i in find . -name '*.[ch]' ; do sed -i 's/ac_ecwmin_ecwmax/cw/g' $i ; done for i in find . -name '*.[ch]' ; do sed -i 's/ac_txop_limit/txop_limit/g' $i ; done
implicitly shows that only one of the three fields is currently used.
--- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 6 +++--- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211.h +3 -3
@@ -1277,9 +1277,9 @@ struct ieee80211_tim_parameters {//#else struct ieee80211_wmm_ac_param { -u8 ac_aci_acm_aifsn; -u8 ac_ecwmin_ecwmax; -u16 ac_txop_limit; +u8 aci_aifsn; +u8 cw; +u16 txop_limit; };struct ieee80211_wmm_ts_info {
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +4 -4
@@ -2366,10 +2366,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;
Signature · 1 line
2.2.1
PATCH 6/8 rtl8192u: don't duplicate ieee80211 constants for status/auth/reason
In reply to Paul GortmakerThese are all defined as a part of the standard and should not be duplicated on a per-driver basis. Use the global ones and delete the local ones.
In switching to <linux/ieee80211.h> we have to delete a local copy of an identical struct that we prepped earlier to have identical field names, and we add explicit include <...> where needed in order to preserve getting a successful compile.
This isn't the totality of duplicated data removed, but it is a start.
--- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 77 +------------------------- 1 file changed, 1 insertion(+), 76 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211.h +1 -76
@@ -34,6 +34,7 @@#include <linux/delay.h> #include <linux/wireless.h> +#include <linux/ieee80211.h> #include "rtl819x_HT.h" #include "rtl819x_BA.h"
@@ -646,13 +647,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 128 - -#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 +665,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)
@@ -1276,12 +1207,6 @@ struct ieee80211_tim_parameters { } __packed;//#else -struct ieee80211_wmm_ac_param { -u8 aci_aifsn; -u8 cw; -u16 txop_limit; -}; -struct ieee80211_wmm_ts_info {u8 ac_dir_tid;u8 ac_up_psb;
Signature · 1 line
2.2.1
PATCH 7/8 rtl8192u: delete another embedded instance of generic reason codes
In reply to Paul GortmakerWe have global copies of all these reason codes. We don't need local copies. Worse is that these seem totally unused; a grep for some of the fields comes up empty, and it still compiles after its complete removal.
--- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 48 -------------------------- 1 file changed, 48 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211.h +0 -48
@@ -188,54 +188,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) ? \
Signature · 1 line
2.2.1
PATCH 8/8 rtl8192e: delete local copy of iee80211 reason codes.
In reply to Paul GortmakerThis driver has a copy of the standard reason codes from the file <linux/ieee80211.h> but with slightly different name fields.
Delete the local copy and remap the only two use cases onto the names used by the global implementation with the same values.
--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 ++- drivers/staging/rtl8192e/rtllib.h | 39 ---------------------------- drivers/staging/rtl8192e/rtllib_softmac.c | 3 ++- 3 files changed, 4 insertions(+), 41 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +2 -1
@@ -44,6 +44,7 @@#include <linux/uaccess.h> #include <linux/pci.h> #include <linux/vmalloc.h> +#include <linux/ieee80211.h> #include "rtl_core.h" #include "r8192E_phy.h" #include "r8192E_phyreg.h"
@@ -391,7 +392,7 @@ bool MgntActSet_RF_State(struct net_device *dev,else priv->blinked_ingpio = false;rtllib_MgntDisconnect (priv->rtllib, - disas_lv_ss); +WLAN_REASON_DISASSOC_STA_HAS_LEFT ); } }if ((ChangeSource ==RF_CHANGE_BY_HW ) && !priv->bHwRadioOff)
drivers/staging/rtl8192e/rtllib.h +0 -39
@@ -261,45 +261,6 @@ struct sw_chnl_cmd {#define MGN_MCS14_SG 0x9e#define MGN_MCS15_SG 0x9f - -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_failure =0xe , - - 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 , - - QoS_unspec =0x20 , - QAP_bandwidth =0x21 , - poor_condition =0x22 , - no_facility =0x23 , - req_declined =0x25 , - invalid_param =0x26 , - req_not_honored =0x27 , - TS_not_created =0x2F , - DL_not_allowed =0x30 , - dest_not_exist =0x31 , - dest_not_QSTA =0x32 , -}; -enum hal_def_variable {HAL_DEF_TPC_ENABLE ,HAL_DEF_INIT_GAIN ,
drivers/staging/rtl8192e/rtllib_softmac.c +2 -1
@@ -20,6 +20,7 @@#include <linux/delay.h> #include <linux/uaccess.h> #include <linux/etherdevice.h> +#include <linux/ieee80211.h> #include "dot11d.h" short rtllib_is_54g (struct rtllib_network *net)
@@ -2983,7 +2984,7 @@ void rtllib_stop_protocol(struct rtllib_device *ieee, u8 shutdown)if (ieee->state ==RTLLIB_LINKED ) {if (ieee->iw_mode ==IW_MODE_INFRA ) -SendDisassociation (ieee,1 , deauth_lv_ss); +SendDisassociation (ieee,1 ,WLAN_REASON_DEAUTH_LEAVING );rtllib_disassociate (ieee); }
Signature · 1 line
2.2.1
Quoted 11 lines · Paul Gortmaker
While looking at a non-staging wifi driver, I was searching for a constant definition for an error code, and in addition to the expected one living in the main include dir, I found a whole bunch of local copies in the staging dir rtl8xxx wifi drivers. This duplication covers the families of WLAN_STATUS_<text> and WLAN_REASON_<text> values.
While one can understand that these things were wholesale copied at one point to simplify out of tree building, we don't want duplicated stuff for drivers that are in tree. Even if they are in staging, they will need cleanups like this if they ever want to get out of staging.
Quoted 8 lines
Some could be removed and trivially replaced with the associated include of <
linux/ieee80211.h> but for a couple of others a couple of struct fields had to be renamed to align with the main include first, and a struct namespace collision between the main include and the local ones had to be resolved to allow the duplicate constant removal as well.Compile tested only, but the changes seem trivial enough so as to be presumably zero runtime impact (famous last words....)
These drivers do not use mac80211, which is a prerequisite for inclusion in the regular wifi tree. A complete rewrite will be needed to get them out of staging. Nonetheless, cleanups are in order.
The patches against rtl8188eu and rtl8712 are certainly OK. The patches against rtl8192u are not so easily seen to be correct. In addition, I do not have this hardware and I cannot test. In fact, I wonder if anyone is using this particular hardware.
With the above qualification,
Thanks,
Larry
Quoted 33 lines
---
Paul Gortmaker (8):
rtl8188eu: don't duplicate ieee80211 constants for status/reason
rtl8712: don't duplicate ieee80211 constants for status/reason
rtl8192u: don't trample on <linux/ieee80211.h> struct namespace
rtl8192u: promoteauth_modeto a full 8 bits
rtl8192u: align localieee80211_wmm_ac_paramstruct fields with global
rtl8192u: don't duplicate ieee80211 constants for status/auth/reason
rtl8192u: delete another embedded instance of generic reason codes
rtl8192e: delete local copy of iee80211 reason codes.drivers/staging/rtl8188eu/core/rtw_ap.c | 2 + drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 10 +- drivers/staging/rtl8188eu/core/rtw_recv.c | 2 + drivers/staging/rtl8188eu/include/ieee80211.h | 29 +--- drivers/staging/rtl8188eu/include/wifi.h | 77 ---------- drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 2 + drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 +- drivers/staging/rtl8192e/rtllib.h | 39 ----- drivers/staging/rtl8192e/rtllib_softmac.c | 3 +- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 171 +++------------------ .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c | 10 +- .../rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 26 ++-- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 76 ++++----- .../staging/rtl8192u/ieee80211/ieee80211_softmac.c | 32 ++-- drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c | 14 +- .../staging/rtl8192u/ieee80211/rtl819x_BAProc.c | 48 +++--- drivers/staging/rtl8192u/r8192U_core.c | 12 +- drivers/staging/rtl8712/ieee80211.h | 29 ---- 18 files changed, 150 insertions(+), 435 deletions(-)
Quoted 3 lines · Larry Finger
These drivers do not use mac80211, which is a prerequisite for inclusion in the regular wifi tree. A complete rewrite will be needed to get them out of staging. Nonetheless, cleanups are in order.
Regarding the rtl8188eu driver, would it be acceptable to rewrite it to use the rtlwifi interface instead of using mac80211 directly?
I can't help but notice some similarities between the structure of rtl8188eu and the drivers from the rtlwifi family. Then again, perhaps I'm missing something that makes it a bad idea.
Thanks,
Jakub
Quoted 11 lines · Jakub Sitnicki
Quoted 3 lines · Larry Finger
These drivers do not use mac80211, which is a prerequisite for inclusion in the regular wifi tree. A complete rewrite will be needed to get them out of staging. Nonetheless, cleanups are in order.
Regarding the rtl8188eu driver, would it be acceptable to rewrite it to use the rtlwifi interface instead of using mac80211 directly?
I can't help but notice some similarities between the structure of rtl8188eu and the drivers from the rtlwifi family. Then again, perhaps I'm missing something that makes it a bad idea.
You can use any part of rtlwifi and rtl_usb, but that won't cover all of the things needed to implement mac80211.
Jes Sorensen has posted some code that implements a mac80211-based driver for the RTL8723AU. The structure of the Realtek driver for this card is very similar to the one for the RTL8188EU.
Larry