From 0604384d4ba4cebb4e1c81a8b2c61958f49e31fe Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Mon, 13 Jul 2009 20:01:44 +0200 Subject: [PATCH] Staging: rtl8187se: rename struct ieee80211_hdr to struct ieee80211_hdr_4addr ieee80211_hdr name is too generic so use ieee80211_hdr_4addr one instead (which matches the naming used by rtl8192su driver). Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/TODO | 1 - .../staging/rtl8187se/ieee80211/ieee80211.h | 4 +- .../ieee80211/ieee80211_crypt_ccmp.c | 10 ++--- .../ieee80211/ieee80211_crypt_tkip.c | 26 ++++++------ .../rtl8187se/ieee80211/ieee80211_rx.c | 42 ++++++++++--------- .../rtl8187se/ieee80211/ieee80211_tx.c | 8 +--- drivers/staging/rtl8187se/r8180_core.c | 4 +- 7 files changed, 46 insertions(+), 49 deletions(-) diff --git a/drivers/staging/rtl8187se/TODO b/drivers/staging/rtl8187se/TODO index 10c4f34c577..4e1b59970c0 100644 --- a/drivers/staging/rtl8187se/TODO +++ b/drivers/staging/rtl8187se/TODO @@ -1,6 +1,5 @@ TODO: - prepare private ieee80211 stack for merge with rtl8192su's version: - - rename struct ieee80211_hdr to struct ieee80211_hdr_4addr - rename struct ieee80211_hdr_3addr_QOS to struct ieee80211_hdr_3addrqos - rename struct ieee80211_hdr_QOS to struct ieee80211_hdr_4addrqos - add hwsec_active flag to struct ieee80211_device diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211.h b/drivers/staging/rtl8187se/ieee80211/ieee80211.h index 0a5e7158d66..f8701c14c65 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211.h @@ -170,7 +170,7 @@ struct ieee_ibss_seq { struct list_head list; }; -struct ieee80211_hdr { +struct ieee80211_hdr_4addr { u16 frame_ctl; u16 duration_id; u8 addr1[ETH_ALEN]; @@ -1450,7 +1450,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 *header, + struct ieee80211_hdr_4addr *header, struct ieee80211_rx_stats *stats); /* ieee80211_wx.c */ diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c index 72056d7db31..172e8f3ae6c 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c @@ -114,7 +114,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 *hdr, + struct ieee80211_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 *hdr; + struct ieee80211_hdr_4addr *hdr; int blocks, last, len; u8 *mic; u8 *b0 = key->tx_b0; @@ -232,7 +232,7 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) *pos++ = key->tx_pn[1]; *pos++ = key->tx_pn[0]; - hdr = (struct ieee80211_hdr *) skb->data; + hdr = (struct ieee80211_hdr_4addr *)skb->data; //mic is moved to here by john mic = skb_put(skb, CCMP_MIC_LEN); @@ -265,7 +265,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 *hdr; + struct ieee80211_hdr_4addr *hdr; u8 pn[6]; size_t data_len = skb->len - hdr_len - CCMP_HDR_LEN - CCMP_MIC_LEN; u8 *mic = skb->data + skb->len - CCMP_MIC_LEN; @@ -279,7 +279,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) return -1; } - hdr = (struct ieee80211_hdr *) skb->data; + hdr = (struct ieee80211_hdr_4addr *)skb->data; pos = skb->data + hdr_len; keyidx = pos[3]; if (!(keyidx & (1 << 5))) { diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c index 85be6269f2c..e6d8385e1d8 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c @@ -310,7 +310,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) struct blkcipher_desc desc = {.tfm = tkey->tx_tfm_arc4}; int len; u8 *pos; - struct ieee80211_hdr *hdr; + struct ieee80211_hdr_4addr *hdr; u8 rc4key[16],*icv; u32 crc; struct scatterlist sg; @@ -321,7 +321,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 *) skb->data; + hdr = (struct ieee80211_hdr_4addr *)skb->data; if (!tkey->tx_phase1_done) { tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2, @@ -369,7 +369,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 *hdr; + struct ieee80211_hdr_4addr *hdr; u8 icv[4]; u32 crc; struct scatterlist sg; @@ -379,7 +379,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 *) skb->data; + hdr = (struct ieee80211_hdr_4addr *)skb->data; pos = skb->data + hdr_len; keyidx = pos[3]; if (!(keyidx & (1 << 5))) { @@ -494,9 +494,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 *hdr11; + struct ieee80211_hdr_4addr *hdr11; - hdr11 = (struct ieee80211_hdr *) skb->data; + hdr11 = (struct ieee80211_hdr_4addr *)skb->data; switch (le16_to_cpu(hdr11->frame_ctl) & (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) { case IEEE80211_FCTL_TODS: @@ -527,9 +527,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 *hdr; + struct ieee80211_hdr_4addr *hdr; - hdr = (struct ieee80211_hdr *) skb->data; + hdr = (struct ieee80211_hdr_4addr *)skb->data; if (skb_tailroom(skb) < 8 || skb->len < hdr_len) { printk(KERN_DEBUG "Invalid packet for Michael MIC add " @@ -556,7 +556,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 *hdr, + struct ieee80211_hdr_4addr *hdr, int keyidx) { union iwreq_data wrqu; @@ -581,9 +581,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 *hdr; + struct ieee80211_hdr_4addr *hdr; - hdr = (struct ieee80211_hdr *) skb->data; + hdr = (struct ieee80211_hdr_4addr *)skb->data; if (!tkey->key_set) return -1; @@ -601,8 +601,8 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, return -1; if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) { - struct ieee80211_hdr *hdr; - hdr = (struct ieee80211_hdr *) skb->data; + struct ieee80211_hdr_4addr *hdr; + hdr = (struct ieee80211_hdr_4addr *)skb->data; printk(KERN_DEBUG "%s: Michael MIC verification failed for " "MSDU from " MAC_FMT " keyidx=%d\n", skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2), diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c index 8ab921a0e07..367ee47a4b0 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c @@ -49,7 +49,8 @@ static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_rx_stats *rx_stats) { - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; + struct ieee80211_hdr_4addr *hdr = + (struct ieee80211_hdr_4addr *)skb->data; u16 fc = le16_to_cpu(hdr->frame_ctl); skb->dev = ieee->dev; @@ -95,7 +96,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 *hdr) + struct ieee80211_hdr_4addr *hdr) { struct sk_buff *skb = NULL; u16 fc = le16_to_cpu(hdr->frame_ctl); @@ -124,7 +125,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) + + sizeof(struct ieee80211_hdr_4addr) + 8 /* LLC */ + 2 /* alignment */ + 8 /* WEP */ + @@ -164,7 +165,7 @@ 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 *hdr) + struct ieee80211_hdr_4addr *hdr) { u16 fc = le16_to_cpu(hdr->frame_ctl); u16 sc = le16_to_cpu(hdr->seq_ctl); @@ -214,17 +215,18 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_rx_stats *rx_stats, u16 type, u16 stype) { - struct ieee80211_hdr *hdr; + struct ieee80211_hdr_4addr *hdr; // cheat the the hdr type - hdr = (struct ieee80211_hdr *)skb->data; + hdr = (struct ieee80211_hdr_4addr *)skb->data; /* On the struct stats definition there is written that * this is not mandatory.... but seems that the probe * response parser uses it */ rx_stats->len = skb->len; - ieee80211_rx_mgt(ieee,(struct ieee80211_hdr *)skb->data,rx_stats); + ieee80211_rx_mgt(ieee, (struct ieee80211_hdr_4addr *)skb->data, + rx_stats); if((ieee->state == IEEE80211_LINKED)&&(memcmp(hdr->addr3,ieee->current_network.bssid,ETH_ALEN))) { dev_kfree_skb_any(skb); @@ -256,13 +258,13 @@ static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee, { struct net_device *dev = ieee->dev; u16 fc, ethertype; - struct ieee80211_hdr *hdr; + struct ieee80211_hdr_4addr *hdr; u8 *pos; if (skb->len < 24) return 0; - hdr = (struct ieee80211_hdr *) skb->data; + hdr = (struct ieee80211_hdr_4addr *)skb->data; fc = le16_to_cpu(hdr->frame_ctl); /* check that the frame is unicast frame to us */ @@ -296,13 +298,13 @@ static inline int ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb, struct ieee80211_crypt_data *crypt) { - struct ieee80211_hdr *hdr; + struct ieee80211_hdr_4addr *hdr; int res, hdrlen; if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) return 0; - hdr = (struct ieee80211_hdr *) skb->data; + hdr = (struct ieee80211_hdr_4addr *)skb->data; hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); #ifdef CONFIG_IEEE80211_CRYPT_TKIP @@ -341,13 +343,13 @@ 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 *hdr; + struct ieee80211_hdr_4addr *hdr; int res, hdrlen; if (crypt == NULL || crypt->ops->decrypt_msdu == NULL) return 0; - hdr = (struct ieee80211_hdr *) skb->data; + hdr = (struct ieee80211_hdr_4addr *)skb->data; hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); atomic_inc(&crypt->refcnt); @@ -367,7 +369,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 *header) + struct ieee80211_hdr_4addr *header) { u16 fc = le16_to_cpu(header->frame_ctl); u16 sc = le16_to_cpu(header->seq_ctl); @@ -473,7 +475,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, { struct net_device *dev = ieee->dev; //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); - struct ieee80211_hdr *hdr; + struct ieee80211_hdr_4addr *hdr; //struct ieee80211_hdr_3addr_QOS *hdr; size_t hdrlen; @@ -490,7 +492,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, int keyidx = 0; // cheat the the hdr type - hdr = (struct ieee80211_hdr *)skb->data; + hdr = (struct ieee80211_hdr_4addr *)skb->data; stats = &ieee->stats; if (skb->len < 10) { @@ -631,7 +633,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0) goto rx_dropped; - hdr = (struct ieee80211_hdr *) skb->data; + hdr = (struct ieee80211_hdr_4addr *)skb->data; /* skb: hdr + (possibly fragmented) plaintext payload */ // PR: FIXME: hostap has additional conditions in the "if" below: @@ -684,7 +686,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 *) skb->data; + hdr = (struct ieee80211_hdr_4addr *)skb->data; ieee80211_frag_cache_invalidate(ieee, hdr); } @@ -694,7 +696,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt)) goto rx_dropped; - hdr = (struct ieee80211_hdr *) skb->data; + hdr = (struct ieee80211_hdr_4addr *)skb->data; if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) { if (/*ieee->ieee802_1x &&*/ ieee80211_is_eapol_frame(ieee, skb, hdrlen)) { @@ -1525,7 +1527,7 @@ inline void ieee80211_process_probe_response( } void ieee80211_rx_mgt(struct ieee80211_device *ieee, - struct ieee80211_hdr *header, + struct ieee80211_hdr_4addr *header, struct ieee80211_rx_stats *stats) { switch (WLAN_FC_GET_STYPE(header->frame_ctl)) { diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c index f520652954a..a23d6543d25 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c @@ -192,11 +192,11 @@ int ieee80211_encrypt_fragment( return -1; #ifdef CONFIG_IEEE80211_CRYPT_TKIP - struct ieee80211_hdr *header; + struct ieee80211_hdr_4addr *header; if (ieee->tkip_countermeasures && crypt && crypt->ops && strcmp(crypt->ops->name, "TKIP") == 0) { - header = (struct ieee80211_hdr *) frag->data; + header = (struct ieee80211_hdr_4addr *)frag->data; if (net_ratelimit()) { printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " "TX packet to " MAC_FMT "\n", @@ -317,10 +317,6 @@ int ieee80211_xmit(struct sk_buff *skb, int ether_type, encrypt; int bytes, fc, QOS_ctl, hdr_len; struct sk_buff *skb_frag; - //struct ieee80211_hdr header = { /* Ensure zero initialized */ - // .duration_id = 0, - // .seq_ctl = 0 - //}; struct ieee80211_hdr_3addr_QOS header = { /* Ensure zero initialized */ .duration_id = 0, .seq_ctl = 0, diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c index 18292d497b3..89311efdf62 100644 --- a/drivers/staging/rtl8187se/r8180_core.c +++ b/drivers/staging/rtl8187se/r8180_core.c @@ -1540,7 +1540,7 @@ void rtl8180_rx(struct net_device *dev) u8 LNA=0, BB=0; u8 LNA_gain[4]={02, 17, 29, 39}; u8 Antenna = 0; - struct ieee80211_hdr *hdr; + struct ieee80211_hdr_4addr *hdr; u16 fc,type; u8 bHwError = 0,bCRC = 0,bICV = 0; bool bCckRate = false; @@ -1736,7 +1736,7 @@ void rtl8180_rx(struct net_device *dev) | (((*(priv->rxringtail))& (0x08000000)) != 0 )| (((~(*(priv->rxringtail)))& (0x10000000)) != 0 )| (((~(*(priv->rxringtail)))& (0x20000000)) != 0 ); bCRC = ((*(priv->rxringtail)) & (0x00002000)) >> 13; bICV = ((*(priv->rxringtail)) & (0x00001000)) >> 12; - hdr = (struct ieee80211_hdr *)priv->rxbuffer->buf; + hdr = (struct ieee80211_hdr_4addr *)priv->rxbuffer->buf; fc = le16_to_cpu(hdr->frame_ctl); type = WLAN_FC_GET_TYPE(fc); -- 2.41.0