diff options
author | Scott Wood <scottwood@freescale.com> | 2014-04-07 23:49:35 (GMT) |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2014-04-07 23:49:35 (GMT) |
commit | 62b8c978ee6b8d135d9e7953221de58000dba986 (patch) | |
tree | 683b04b2e627f6710c22c151b23c8cc9a165315e /drivers/staging/rtl8187se/ieee80211 | |
parent | 78fd82238d0e5716578c326404184a27ba67fd6e (diff) | |
download | linux-fsl-qoriq-62b8c978ee6b8d135d9e7953221de58000dba986.tar.xz |
Rewind v3.13-rc3+ (78fd82238d0e5716) to v3.12
Diffstat (limited to 'drivers/staging/rtl8187se/ieee80211')
4 files changed, 122 insertions, 134 deletions
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c index 3045790..10b2210 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c @@ -858,7 +858,7 @@ static inline void ieee80211_extract_country_ie( } -static int +int ieee80211_TranslateToDbm( unsigned char SignalStrengthIndex // 0-100 index. ) diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c index 0290706..b65db54 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c @@ -887,8 +887,7 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d return skb; } -static struct sk_buff *ieee80211_assoc_resp(struct ieee80211_device *ieee, - u8 *dest) +struct sk_buff* ieee80211_assoc_resp(struct ieee80211_device *ieee, u8 *dest) { struct sk_buff *skb; u8* tag; @@ -941,8 +940,7 @@ static struct sk_buff *ieee80211_assoc_resp(struct ieee80211_device *ieee, return skb; } -static struct sk_buff *ieee80211_auth_resp(struct ieee80211_device *ieee, - int status, u8 *dest) +struct sk_buff* ieee80211_auth_resp(struct ieee80211_device *ieee,int status, u8 *dest) { struct sk_buff *skb; struct ieee80211_authentication *auth; @@ -2944,9 +2942,14 @@ int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_poin goto out; } - param = memdup_user(p->pointer, p->length); - if (IS_ERR(param)) { - ret = PTR_ERR(param); + param = kmalloc(p->length, GFP_KERNEL); + if (param == NULL){ + ret = -ENOMEM; + goto out; + } + if (copy_from_user(param, p->pointer, p->length)) { + kfree(param); + ret = -EFAULT; goto out; } diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c index f5a5219..b346653 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c @@ -32,6 +32,7 @@ ******************************************************************************/ #include <linux/compiler.h> +//#include <linux/config.h> #include <linux/errno.h> #include <linux/if_arp.h> #include <linux/in6.h> @@ -185,12 +186,9 @@ int ieee80211_encrypt_fragment( struct ieee80211_crypt_data* crypt = ieee->crypt[ieee->tx_keyidx]; int res; - /* - * added to care about null crypt condition, to solve that system hangs - * when shared keys error - */ - if (!crypt || !crypt->ops) - return -1; + /*added to care about null crypt condition, to solve that system hangs when shared keys error*/ + if (!crypt || !crypt->ops) + return -1; #ifdef CONFIG_IEEE80211_CRYPT_TKIP struct ieee80211_hdr_4addr *header; @@ -199,22 +197,19 @@ int ieee80211_encrypt_fragment( crypt && crypt->ops && strcmp(crypt->ops->name, "TKIP") == 0) { header = (struct ieee80211_hdr_4addr *)frag->data; if (net_ratelimit()) { - netdev_dbg(ieee->dev, "TKIP countermeasures: dropped " - "TX packet to %pM\n", header->addr1); + printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " + "TX packet to %pM\n", + ieee->dev->name, header->addr1); } return -1; } #endif - /* - * To encrypt, frame format is: - * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes) - * - * PR: FIXME: Copied from hostap. Check fragmentation/MSDU/MPDU - * encryption. - * - * Host-based IEEE 802.11 fragmentation for TX is not yet supported, so - * call both MSDU and MPDU encryption functions from here. - */ + /* To encrypt, frame format is: + * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes) */ + + // PR: FIXME: Copied from hostap. Check fragmentation/MSDU/MPDU encryption. + /* Host-based IEEE 802.11 fragmentation for TX is not yet supported, so + * call both MSDU and MPDU encryption functions from here. */ atomic_inc(&crypt->refcnt); res = 0; if (crypt->ops->encrypt_msdu) @@ -224,7 +219,8 @@ int ieee80211_encrypt_fragment( atomic_dec(&crypt->refcnt); if (res < 0) { - netdev_info(ieee->dev, "Encryption failed: len=%d.\n", frag->len); + printk(KERN_INFO "%s: Encryption failed: len=%d.\n", + ieee->dev->name, frag->len); ieee->ieee_stats.tx_discards++; return -1; } @@ -233,8 +229,7 @@ int ieee80211_encrypt_fragment( } -void ieee80211_txb_free(struct ieee80211_txb *txb) -{ +void ieee80211_txb_free(struct ieee80211_txb *txb) { int i; if (unlikely(!txb)) return; @@ -244,13 +239,13 @@ void ieee80211_txb_free(struct ieee80211_txb *txb) kfree(txb); } -static struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size, - gfp_t gfp_mask) +struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size, + int gfp_mask) { struct ieee80211_txb *txb; int i; txb = kmalloc( - sizeof(struct ieee80211_txb) + (sizeof(u8 *) * nr_frags), + sizeof(struct ieee80211_txb) + (sizeof(u8*) * nr_frags), gfp_mask); if (!txb) return NULL; @@ -275,43 +270,42 @@ static struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size, return txb; } -/* - * Classify the to-be send data packet - * Need to acquire the sent queue index. - */ +// Classify the to-be send data packet +// Need to acquire the sent queue index. static int ieee80211_classify(struct sk_buff *skb, struct ieee80211_network *network) { - struct ether_header *eh = (struct ether_header *)skb->data; - unsigned int wme_UP = 0; + struct ether_header *eh = (struct ether_header*)skb->data; + unsigned int wme_UP = 0; - if (!network->QoS_Enable) { - skb->priority = 0; - return(wme_UP); - } + if(!network->QoS_Enable) { + skb->priority = 0; + return(wme_UP); + } - if (eh->ether_type == __constant_htons(ETHERTYPE_IP)) { - const struct iphdr *ih = (struct iphdr *)(skb->data + + if(eh->ether_type == __constant_htons(ETHERTYPE_IP)) { + const struct iphdr *ih = (struct iphdr*)(skb->data + \ sizeof(struct ether_header)); - wme_UP = (ih->tos >> 5)&0x07; - } else if (vlan_tx_tag_present(skb)) {/* vtag packet */ + wme_UP = (ih->tos >> 5)&0x07; + } else if (vlan_tx_tag_present(skb)) {//vtag packet #ifndef VLAN_PRI_SHIFT #define VLAN_PRI_SHIFT 13 /* Shift to find VLAN user priority */ #define VLAN_PRI_MASK 7 /* Mask for user priority bits in VLAN */ #endif - u32 tag = vlan_tx_tag_get(skb); - wme_UP = (tag >> VLAN_PRI_SHIFT) & VLAN_PRI_MASK; - } else if (ETH_P_PAE == ntohs(((struct ethhdr *)skb->data)->h_proto)) { - wme_UP = 7; - } - - skb->priority = wme_UP; - return(wme_UP); + u32 tag = vlan_tx_tag_get(skb); + wme_UP = (tag >> VLAN_PRI_SHIFT) & VLAN_PRI_MASK; + } else if(ETH_P_PAE == ntohs(((struct ethhdr *)skb->data)->h_proto)) { + //printk(KERN_WARNING "type = normal packet\n"); + wme_UP = 7; + } + + skb->priority = wme_UP; + return(wme_UP); } /* SKBs are added to the ieee->tx_queue. */ int ieee80211_rtl_xmit(struct sk_buff *skb, - struct net_device *dev) + struct net_device *dev) { struct ieee80211_device *ieee = netdev_priv(dev); struct ieee80211_txb *txb = NULL; @@ -331,25 +325,24 @@ int ieee80211_rtl_xmit(struct sk_buff *skb, struct ieee80211_crypt_data* crypt; + //printk(KERN_WARNING "upper layer packet!\n"); spin_lock_irqsave(&ieee->lock, flags); - /* - * If there is no driver handler to take the TXB, don't bother - * creating it... - */ - if ((!ieee->hard_start_xmit && - !(ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)) || - ((!ieee->softmac_data_hard_start_xmit && - (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)))) { - netdev_warn(ieee->dev, "No xmit handler.\n"); + /* If there is no driver handler to take the TXB, don't bother + * creating it... */ + if ((!ieee->hard_start_xmit && !(ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE))|| + ((!ieee->softmac_data_hard_start_xmit && (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)))) { + printk(KERN_WARNING "%s: No xmit handler.\n", + ieee->dev->name); goto success; } ieee80211_classify(skb,&ieee->current_network); - if (likely(ieee->raw_tx == 0)){ + if(likely(ieee->raw_tx == 0)){ if (unlikely(skb->len < SNAP_SIZE + sizeof(u16))) { - netdev_warn(ieee->dev, "skb too small (%d).\n", skb->len); + printk(KERN_WARNING "%s: skb too small (%d).\n", + ieee->dev->name, skb->len); goto success; } @@ -385,7 +378,7 @@ int ieee80211_rtl_xmit(struct sk_buff *skb, /* Determine total amount of storage required for TXB packets */ bytes = skb->len + SNAP_SIZE + sizeof(u16); - if (ieee->current_network.QoS_Enable) { + if(ieee->current_network.QoS_Enable) { if (encrypt) fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA | IEEE80211_FCTL_WEP; @@ -402,31 +395,31 @@ int ieee80211_rtl_xmit(struct sk_buff *skb, if (ieee->iw_mode == IW_MODE_INFRA) { fc |= IEEE80211_FCTL_TODS; - /* To DS: Addr1 = BSSID, Addr2 = SA, Addr3 = DA */ + /* To DS: Addr1 = BSSID, Addr2 = SA, + Addr3 = DA */ memcpy(&header.addr1, ieee->current_network.bssid, ETH_ALEN); memcpy(&header.addr2, &src, ETH_ALEN); memcpy(&header.addr3, &dest, ETH_ALEN); } else if (ieee->iw_mode == IW_MODE_ADHOC) { - /* - * not From/To DS: Addr1 = DA, Addr2 = SA, - * Addr3 = BSSID - */ + /* not From/To DS: Addr1 = DA, Addr2 = SA, + Addr3 = BSSID */ memcpy(&header.addr1, dest, ETH_ALEN); memcpy(&header.addr2, src, ETH_ALEN); memcpy(&header.addr3, ieee->current_network.bssid, ETH_ALEN); } + // printk(KERN_WARNING "essid MAC address is %pM", &header.addr1); header.frame_ctl = cpu_to_le16(fc); + //hdr_len = IEEE80211_3ADDR_LEN; - /* - * Determine fragmentation size based on destination (multicast - * and broadcast are not fragmented) - */ + /* Determine fragmentation size based on destination (multicast + * and broadcast are not fragmented) */ if (is_multicast_ether_addr(header.addr1)) { frag_size = MAX_FRAG_THRESHOLD; qos_ctl = QOS_CTL_NOTCONTAIN_ACK; - } else { - /* default:392 */ - frag_size = ieee->fts; + } + else { + //printk(KERN_WARNING "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&frag_size = %d\n", frag_size); + frag_size = ieee->fts;//default:392 qos_ctl = 0; } @@ -439,12 +432,11 @@ int ieee80211_rtl_xmit(struct sk_buff *skb, hdr_len = IEEE80211_3ADDR_LEN; } - /* - * Determine amount of payload per fragment. Regardless of if - * this stack is providing the full 802.11 header, one will - * eventually be affixed to this fragment -- so we must account - * for it when determining the amount of payload space. - */ + /* Determine amount of payload per fragment. Regardless of if + * this stack is providing the full 802.11 header, one will + * eventually be affixed to this fragment -- so we must account for + * it when determining the amount of payload space. */ + //bytes_per_frag = frag_size - (IEEE80211_3ADDR_LEN + (ieee->current_network->QoS_Enable ? 2:0)); bytes_per_frag = frag_size - hdr_len; if (ieee->config & (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) @@ -455,10 +447,8 @@ int ieee80211_rtl_xmit(struct sk_buff *skb, bytes_per_frag -= crypt->ops->extra_prefix_len + crypt->ops->extra_postfix_len; - /* - * Number of fragments is the total bytes_per_frag / - * payload_per_fragment - */ + /* Number of fragments is the total bytes_per_frag / + * payload_per_fragment */ nr_frags = bytes / bytes_per_frag; bytes_last_frag = bytes % bytes_per_frag; if (bytes_last_frag) @@ -466,14 +456,13 @@ int ieee80211_rtl_xmit(struct sk_buff *skb, else bytes_last_frag = bytes_per_frag; - /* - * When we allocate the TXB we allocate enough space for the - * reserve and full fragment bytes (bytes_per_frag doesn't - * include prefix, postfix, header, FCS, etc.) - */ + /* When we allocate the TXB we allocate enough space for the reserve + * and full fragment bytes (bytes_per_frag doesn't include prefix, + * postfix, header, FCS, etc.) */ txb = ieee80211_alloc_txb(nr_frags, frag_size, GFP_ATOMIC); if (unlikely(!txb)) { - netdev_warn(ieee->dev, "Could not allocate TXB\n"); + printk(KERN_WARNING "%s: Could not allocate TXB\n", + ieee->dev->name); goto failed; } txb->encrypted = encrypt; @@ -485,14 +474,11 @@ int ieee80211_rtl_xmit(struct sk_buff *skb, if (encrypt) skb_reserve(skb_frag, crypt->ops->extra_prefix_len); - frag_hdr = (struct ieee80211_hdr_3addrqos *)skb_put( - skb_frag, hdr_len); + frag_hdr = (struct ieee80211_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 - * bit to the frame control - */ + /* If this is not the last fragment, then add the MOREFRAGS + * bit to the frame control */ if (i != nr_frags - 1) { frag_hdr->frame_ctl = cpu_to_le16( fc | IEEE80211_FCTL_MOREFRAGS); @@ -502,17 +488,16 @@ int ieee80211_rtl_xmit(struct sk_buff *skb, /* The last fragment takes the remaining length */ bytes = bytes_last_frag; } - if (ieee->current_network.QoS_Enable) { - /* - * add 1 only indicate to corresponding seq - * number control 2006/7/12 - */ - frag_hdr->seq_ctl = cpu_to_le16( - ieee->seq_ctrl[UP2AC(skb->priority)+1]<<4 | i); + if(ieee->current_network.QoS_Enable) { + // add 1 only indicate to corresponding seq number control 2006/7/12 + frag_hdr->seq_ctl = cpu_to_le16(ieee->seq_ctrl[UP2AC(skb->priority)+1]<<4 | i); + //printk(KERN_WARNING "skb->priority = %d,", skb->priority); + //printk(KERN_WARNING "type:%d: seq = %d\n",UP2AC(skb->priority),ieee->seq_ctrl[UP2AC(skb->priority)+1]); } else { - frag_hdr->seq_ctl = cpu_to_le16( - ieee->seq_ctrl[0]<<4 | i); + frag_hdr->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0]<<4 | i); } + //frag_hdr->seq_ctl = cpu_to_le16(ieee->seq_ctrl<<4 | i); + // /* Put a SNAP header on the first fragment */ if (i == 0) { @@ -527,53 +512,54 @@ int ieee80211_rtl_xmit(struct sk_buff *skb, /* Advance the SKB... */ skb_pull(skb, bytes); - /* - * Encryption routine will move the header forward in - * order to insert the IV between the header and the - * payload - */ + /* Encryption routine will move the header forward in order + * to insert the IV between the header and the payload */ if (encrypt) ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len); if (ieee->config & (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) skb_put(skb_frag, 4); } - /* Advance sequence number in data frame. */ + // Advance sequence number in data frame. + //printk(KERN_WARNING "QoS Enalbed? %s\n", ieee->current_network.QoS_Enable?"Y":"N"); if (ieee->current_network.QoS_Enable) { - if (ieee->seq_ctrl[UP2AC(skb->priority) + 1] == 0xFFF) - ieee->seq_ctrl[UP2AC(skb->priority) + 1] = 0; - else - ieee->seq_ctrl[UP2AC(skb->priority) + 1]++; + if (ieee->seq_ctrl[UP2AC(skb->priority) + 1] == 0xFFF) + ieee->seq_ctrl[UP2AC(skb->priority) + 1] = 0; + else + ieee->seq_ctrl[UP2AC(skb->priority) + 1]++; } else { - if (ieee->seq_ctrl[0] == 0xFFF) - ieee->seq_ctrl[0] = 0; - else - ieee->seq_ctrl[0]++; + if (ieee->seq_ctrl[0] == 0xFFF) + ieee->seq_ctrl[0] = 0; + else + ieee->seq_ctrl[0]++; } - } else { + //--- + }else{ if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) { - netdev_warn(ieee->dev, "skb too small (%d).\n", skb->len); + printk(KERN_WARNING "%s: skb too small (%d).\n", + ieee->dev->name, skb->len); goto success; } txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC); - if (!txb) { - netdev_warn(ieee->dev, "Could not allocate TXB\n"); + if(!txb){ + printk(KERN_WARNING "%s: Could not allocate TXB\n", + ieee->dev->name); goto failed; } txb->encrypted = 0; txb->payload_size = skb->len; - memcpy(skb_put(txb->fragments[0], skb->len), skb->data, skb->len); + memcpy(skb_put(txb->fragments[0],skb->len), skb->data, skb->len); } success: spin_unlock_irqrestore(&ieee->lock, flags); dev_kfree_skb_any(skb); if (txb) { - if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE) { + if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE){ ieee80211_softmac_xmit(txb, ieee); - } else { + }else{ if ((*ieee->hard_start_xmit)(txb, dev) == 0) { stats->tx_packets++; stats->tx_bytes += txb->payload_size; diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c index 24d39cc..e014f7e 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c @@ -145,8 +145,7 @@ static inline char *rtl818x_translate_scan(struct ieee80211_device *ieee, /* Add quality statistics */ /* TODO: Fix these values... */ if (network->stats.signal == 0 || network->stats.rssi == 0) - printk("========>signal:%d, rssi:%d\n", network->stats.signal, - network->stats.rssi); + printk("========>signal:%d, rssi:%d\n", network->stats.signal, network->stats.rssi); iwe.cmd = IWEVQUAL; // printk("SIGNAL: %d,RSSI: %d,NOISE: %d\n",network->stats.signal,network->stats.rssi,network->stats.noise); iwe.u.qual.qual = network->stats.signalstrength; @@ -623,7 +622,7 @@ done: if (ieee->set_security) ieee->set_security(ieee->dev, &sec); - if (ieee->reset_on_keychange && + if (ieee->reset_on_keychange && ieee->iw_mode != IW_MODE_INFRA && ieee->reset_port && ieee->reset_port(dev)) { IEEE80211_DEBUG_WX("%s: reset_port failed\n", dev->name); |