staging: rtl8192su: cleanup in ieee80211_softmac.c
authorFlorian Schilhabel <florian.c.schilhabel@googlemail.com>
Thu, 15 Jul 2010 17:03:49 +0000 (19:03 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 22 Jul 2010 19:00:21 +0000 (12:00 -0700)
Signed-off-by: Florian Schilhabel <florian.c.schilhabel@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c

index ba78050..7d4567d 100644 (file)
@@ -160,7 +160,6 @@ void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb)
        ieee->mgmt_queue_head = nh;
        ieee->mgmt_queue_ring[nh] = skb;
 
-       //return 0;
 }
 
 struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee)
@@ -274,9 +273,7 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee
                                ieee->seq_ctrl[0]++;
 
                        /* avoid watchdog triggers */
-       //              ieee->dev->trans_start = jiffies;
                        ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
-                       //dev_kfree_skb_any(skb);//edit by thomas
                }
 
                spin_unlock_irqrestore(&ieee->lock, flags);
@@ -302,9 +299,7 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee
                        printk("%s():insert to waitqueue!\n",__FUNCTION__);
                        skb_queue_tail(&ieee->skb_waitQ[tcb_desc->queue_index], skb);
                } else {
-                       //printk("TX packet!\n");
                        ieee->softmac_hard_start_xmit(skb,ieee->dev);
-                       //dev_kfree_skb_any(skb);//edit by thomas
                }
                spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags);
        }
@@ -343,7 +338,6 @@ inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *i
 
                }
                /* avoid watchdog triggers */
-       //      ieee->dev->trans_start = jiffies;
                ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
 
        }else{
@@ -359,7 +353,6 @@ inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *i
                ieee->softmac_hard_start_xmit(skb,ieee->dev);
 
        }
-       //dev_kfree_skb_any(skb);//edit by thomas
 }
 
 inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee)
@@ -406,24 +399,16 @@ void ieee80211_send_beacon(struct ieee80211_device *ieee)
        struct sk_buff *skb;
        if(!ieee->ieee_up)
                return;
-       //unsigned long flags;
        skb = ieee80211_get_beacon_(ieee);
 
        if (skb){
                softmac_mgmt_xmit(skb, ieee);
                ieee->softmac_stats.tx_beacons++;
-               //dev_kfree_skb_any(skb);//edit by thomas
        }
-//     ieee->beacon_timer.expires = jiffies +
-//             (MSECS( ieee->current_network.beacon_interval -5));
 
-       //spin_lock_irqsave(&ieee->beacon_lock,flags);
        if(ieee->beacon_txing && ieee->ieee_up){
-//             if(!timer_pending(&ieee->beacon_timer))
-//                     add_timer(&ieee->beacon_timer);
                mod_timer(&ieee->beacon_timer,jiffies+(MSECS(ieee->current_network.beacon_interval-5)));
        }
-       //spin_unlock_irqrestore(&ieee->beacon_lock,flags);
 }
 
 
@@ -447,7 +432,6 @@ void ieee80211_send_probe(struct ieee80211_device *ieee)
        if (skb){
                softmac_mgmt_xmit(skb, ieee);
                ieee->softmac_stats.tx_probe_rq++;
-               //dev_kfree_skb_any(skb);//edit by thomas
        }
 }
 
@@ -618,12 +602,8 @@ void ieee80211_start_send_beacons(struct ieee80211_device *ieee)
 
 void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee)
 {
-//     unsigned long flags;
-
-       //ieee->sync_scan_hurryup = 1;
 
        down(&ieee->scan_sem);
-//     spin_lock_irqsave(&ieee->lock, flags);
        ieee->scan_watch_dog = 0;
        if (ieee->scanning == 1){
                ieee->scanning = 0;
@@ -631,7 +611,6 @@ void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee)
                cancel_delayed_work(&ieee->softmac_scan_wq);
        }
 
-//     spin_unlock_irqrestore(&ieee->lock, flags);
        up(&ieee->scan_sem);
 }
 
@@ -794,7 +773,6 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d
                tmp_generic_ie_len = sizeof(ieee->pHTInfo->szRT2RTAggBuffer);
                HTConstructRT2RTAggElement(ieee, tmp_generic_ie_buf, &tmp_generic_ie_len);
         }
-//     printk("===============>tmp_ht_cap_len is %d,tmp_ht_info_len is %d, tmp_generic_ie_len is %d\n",tmp_ht_cap_len,tmp_ht_info_len,tmp_generic_ie_len);
 #endif
        beacon_size = sizeof(struct ieee80211_probe_response)+2+
                ssid_len
@@ -858,7 +836,6 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d
        u16 val16;
                *(tag++) = MFIE_TYPE_IBSS_SET;
                *(tag++) = 2;
-               //*((u16*)(tag)) = cpu_to_le16(ieee->current_network.atim_window);
                 val16 = cpu_to_le16(ieee->current_network.atim_window);
                memcpy((u8 *)tag, (u8 *)&val16, 2);
                tag+=2;
@@ -887,7 +864,6 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d
                tag += wpa_ie_len;
        }
 
-       //skb->dev = ieee->dev;
        return skb;
 }
 
@@ -1032,16 +1008,9 @@ void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest)
 inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
 {
        struct sk_buff *skb;
-       //unsigned long flags;
 
        struct ieee80211_assoc_request_frame *hdr;
        u8 *tag;//,*rsn_ie;
-       //short info_addr = 0;
-       //int i;
-       //u16 suite_count = 0;
-       //u8 suit_select = 0;
-       //unsigned int wpa_len = beacon->wpa_ie_len;
-       //for HT
        u8* ht_cap_buf = NULL;
        u8 ht_cap_len=0;
        u8* realtek_ie_buf=NULL;
@@ -1248,8 +1217,6 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco
                        memcpy(tag, realtek_ie_buf,realtek_ie_len -2 );
                }
        }
-//     printk("<=====%s(), %p, %p\n", __FUNCTION__, ieee->dev, ieee->dev->dev_addr);
-//     IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len);
        return skb;
 }
 
@@ -1304,7 +1271,6 @@ void ieee80211_associate_step1(struct ieee80211_device *ieee)
        else{
                ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ;
                IEEE80211_DEBUG_MGMT("Sending authentication request\n");
-               //printk(KERN_WARNING "Sending authentication request\n");
                softmac_mgmt_xmit(skb, ieee);
                //BUGON when you try to add_timer twice, using mod_timer may be better, john0709
                if(!timer_pending(&ieee->associate_timer)){
@@ -1320,7 +1286,6 @@ void ieee80211_rtl_auth_challenge(struct ieee80211_device *ieee, u8 *challenge,
        u8 *c;
        struct sk_buff *skb;
        struct ieee80211_network *beacon = &ieee->current_network;
-//     int hlen = sizeof(struct ieee80211_authentication);
 
        ieee->associate_seq++;
        ieee->softmac_stats.tx_auth_rq++;
@@ -1340,7 +1305,6 @@ void ieee80211_rtl_auth_challenge(struct ieee80211_device *ieee, u8 *challenge,
 
                softmac_mgmt_xmit(skb, ieee);
                mod_timer(&ieee->associate_timer, jiffies + (HZ/2));
-               //dev_kfree_skb_any(skb);//edit by thomas
        }
        kfree(challenge);
 }
@@ -1361,7 +1325,6 @@ void ieee80211_associate_step2(struct ieee80211_device *ieee)
        else{
                softmac_mgmt_xmit(skb, ieee);
                mod_timer(&ieee->associate_timer, jiffies + (HZ/2));
-               //dev_kfree_skb_any(skb);//edit by thomas
        }
 }
 
@@ -1389,7 +1352,6 @@ void ieee80211_associate_complete_wq(struct work_struct *work)
        {
                printk("Successfully associated, ht not enabled(%d, %d)\n", ieee->pHTInfo->bCurrentHTSupport, ieee->pHTInfo->bEnableHT);
                memset(ieee->dot11HTOperationalRateSet, 0, 16);
-               //HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
        }
        ieee->LinkDetectInfo.SlotNum = 2 * (1 + ieee->current_network.beacon_interval/500);
        // To prevent the immediately calling watch_dog after association.
@@ -1421,7 +1383,6 @@ void ieee80211_associate_complete(struct ieee80211_device *ieee)
        del_timer_sync(&ieee->associate_timer);
 
        ieee->state = IEEE80211_LINKED;
-       //ieee->UpdateHalRATRTableHandler(dev, ieee->dot11HTOperationalRateSet);
        queue_work(ieee->wq, &ieee->associate_complete_wq);
 }
 
@@ -1437,7 +1398,6 @@ void ieee80211_associate_procedure_wq(struct work_struct *work)
 
        ieee80211_stop_scan(ieee);
        printk("===>%s(), chan:%d\n", __FUNCTION__, ieee->current_network.channel);
-       //ieee->set_chan(ieee->dev, ieee->current_network.channel);
        HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
 
        if(ieee->eRFPowerState == eRfOff)
@@ -1479,8 +1439,8 @@ inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee
                 * This could be obtained by beacons or, if the network does not
                 * broadcast it, it can be put manually.
                 */
-               apset = ieee->wap_set;//(memcmp(ieee->current_network.bssid, zero,ETH_ALEN)!=0 );
-               ssidset = ieee->ssid_set;//ieee->current_network.ssid[0] != '\0';
+               apset = ieee->wap_set;
+               ssidset = ieee->ssid_set;
                ssidbroad =  !(net->ssid_len == 0 || net->ssid[0]== '\0');
                apmatch = (memcmp(ieee->current_network.bssid, net->bssid, ETH_ALEN)==0);
                ssidmatch = (ieee->current_network.ssid_len == net->ssid_len)&&\
@@ -1521,7 +1481,6 @@ inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee
                                        ieee->AsocRetryCount = 0;
                                        //for HT by amy 080514
                                        if((ieee->current_network.qos_data.supported == 1) &&
-                                         // (ieee->pHTInfo->bEnableHT && ieee->current_network.bssht.bdSupportHT))
                                           ieee->current_network.bssht.bdSupportHT)
 /*WB, 2008.09.09:bCurrentHTSupport and bEnableHT two flags are going to put together to check whether we are in HT now, so needn't to check bEnableHT flags here. That's is to say we will set to HT support whenever joined AP has the ability to support HT. And whether we are in HT or not, please check bCurrentHTSupport&&bEnableHT now please.*/
                                        {
@@ -1549,7 +1508,6 @@ inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee
                                                printk(KERN_INFO"Using B rates\n");
                                        }
                                        memset(ieee->dot11HTOperationalRateSet, 0, 16);
-                                       //HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
                                        ieee->state = IEEE80211_LINKED;
                                }
 
@@ -1723,11 +1681,8 @@ ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
 {
        u8 dest[ETH_ALEN];
 
-       //IEEE80211DMESG("Rx probe");
        ieee->softmac_stats.rx_probe_rq++;
-       //DMESG("Dest is "MACSTR, MAC2STR(dest));
        if (probe_rq_parse(ieee, skb, dest)){
-               //IEEE80211DMESG("Was for me!");
                ieee->softmac_stats.tx_probe_rs++;
                ieee80211_resp_to_probe(ieee, dest);
        }
@@ -1738,14 +1693,12 @@ ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
 {
        u8 dest[ETH_ALEN];
        int status;
-       //IEEE80211DMESG("Rx probe");
        ieee->softmac_stats.rx_auth_rq++;
 
        status = auth_rq_parse(skb, dest);
        if (status != -1) {
                ieee80211_resp_to_auth(ieee, status, dest);
        }
-       //DMESG("Dest is "MACSTR, MAC2STR(dest));
 
 }
 
@@ -1754,7 +1707,6 @@ ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
 {
 
        u8 dest[ETH_ALEN];
-       //unsigned long flags;
 
        ieee->softmac_stats.rx_ass_rq++;
        if (assoc_rq_parse(skb,dest) != -1){
@@ -1789,7 +1741,6 @@ short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *ti
                return 0;
        */
        dtim = ieee->current_network.dtim_data;
-       //printk("DTIM\n");
        if(!(dtim & IEEE80211_DTIM_VALID))
                return 0;
        timeout = ieee->current_network.beacon_interval; //should we use ps_timeout value or beacon_interval
@@ -1812,7 +1763,6 @@ short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *ti
        if(time_l){
                *time_l = ieee->current_network.last_dtim_sta_time[0]
                        + (ieee->current_network.beacon_interval);
-               //      * ieee->current_network.dtim_period) * 1000;
        }
 
        if(time_h){
@@ -1840,7 +1790,6 @@ inline void ieee80211_sta_ps(struct ieee80211_device *ieee)
                ieee->iw_mode != IW_MODE_INFRA ||
                ieee->state != IEEE80211_LINKED)){
 
-       //      #warning CHECK_LOCK_HERE
                spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
 
                ieee80211_sta_wakeup(ieee, 1);
@@ -1859,7 +1808,6 @@ inline void ieee80211_sta_ps(struct ieee80211_device *ieee)
                        ieee->enter_sleep_state(ieee->dev,th,tl);
 
                else if(ieee->sta_sleep == 0){
-               //      printk("send null 1\n");
                        spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
 
                        if(ieee->ps_is_queue_empty(ieee->dev)){
@@ -1968,8 +1916,6 @@ void ieee80211_process_action(struct ieee80211_device* ieee, struct sk_buff* skb
                        ieee80211_rx_DELBA(ieee, skb);
                        break;
                default:
-//                     if (net_ratelimit())
-//                     IEEE80211_DEBUG(IEEE80211_DL_BA, "unknown action frame(%d)\n", tmp);
                        break;
        }
        return;
@@ -1986,7 +1932,6 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
        int chlen=0;
        int aid;
        struct ieee80211_assoc_response_frame *assoc_resp;
-//     struct ieee80211_info_element *info_element;
        bool bSupportNmode = true, bHalfSupportNmode = false; //default support N mode, disable halfNmode
 
        if(!ieee->proto_started)
@@ -2145,8 +2090,6 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
                                ieee->softmac_stats.reassoc++;
                                ieee->is_roaming = true;
                                ieee80211_disassociate(ieee);
-                       //      notify_wx_assoc_event(ieee);
-                               //HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
                                RemovePeerTS(ieee, header->addr2);
                                if(ieee->LedControlHandler != NULL)
                                        ieee->LedControlHandler(ieee->dev, LED_CTL_START_TO_LINK); //added by amy for LED 090318
@@ -2161,7 +2104,6 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
                        break;
        }
 
-       //dev_kfree_skb_any(skb);
        return 0;
 }
 
@@ -2213,22 +2155,16 @@ void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *
                        /* as for the completion function, it does not need
                         * to check it any more.
                         * */
-                       //printk("error:no descriptor left@queue_index %d, %d, %d\n", queue_index, skb_queue_len(&ieee->skb_waitQ[queue_index]), ieee->check_nic_enough_desc(ieee->dev,queue_index));
-                       //ieee80211_rtl_stop_queue(ieee);
                        skb_queue_tail(&ieee->skb_waitQ[queue_index], txb->fragments[i]);
                }else{
                        ieee->softmac_data_hard_start_xmit(
                                        txb->fragments[i],
                                        ieee->dev,ieee->rate);
-                       //ieee->stats.tx_packets++;
-                       //ieee->stats.tx_bytes += txb->fragments[i]->len;
-                       //ieee->dev->trans_start = jiffies;
                }
        }
 #endif
        ieee80211_txb_free(txb);
 
-//exit:
        spin_unlock_irqrestore(&ieee->lock,flags);
 
 }
@@ -2247,9 +2183,7 @@ void ieee80211_resume_tx(struct ieee80211_device *ieee)
                        ieee->softmac_data_hard_start_xmit(
                                ieee->tx_pending.txb->fragments[i],
                                ieee->dev,ieee->rate);
-                               //(i+1)<ieee->tx_pending.txb->nr_frags);
                        ieee->stats.tx_packets++;
-               //      ieee->dev->trans_start = jiffies;
                }
        }
 
@@ -2299,7 +2233,6 @@ void ieee80211_rtl_wake_queue(struct ieee80211_device *ieee)
                                ieee->seq_ctrl[0]++;
 
                        ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
-                       //dev_kfree_skb_any(skb);//edit by thomas
                }
        }
        if (!ieee->queue_stop && ieee->tx_pending.txb)
@@ -2317,15 +2250,12 @@ exit :
 
 void ieee80211_rtl_stop_queue(struct ieee80211_device *ieee)
 {
-       //unsigned long flags;
-       //spin_lock_irqsave(&ieee->lock,flags);
 
        if (! netif_queue_stopped(ieee->dev)){
                netif_stop_queue(ieee->dev);
                ieee->softmac_stats.swtxstop++;
        }
        ieee->queue_stop = 1;
-       //spin_unlock_irqrestore(&ieee->lock,flags);
 
 }
 
@@ -2559,11 +2489,9 @@ void ieee80211_disassociate(struct ieee80211_device *ieee)
        ieee->state = IEEE80211_NOLINK;
        ieee->is_set_key = false;
 
-       //LZM for usb dev crash.
-       //ieee->link_change(ieee->dev);
        queue_delayed_work(ieee->wq, &ieee->link_change_wq, 0);
 
-       //HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
+
        notify_wx_assoc_event(ieee);
 
 }
@@ -2707,8 +2635,6 @@ void ieee80211_start_protocol(struct ieee80211_device *ieee)
 
        if (ieee->current_network.beacon_interval == 0)
                ieee->current_network.beacon_interval = 100;
-//     printk("===>%s(), chan:%d\n", __FUNCTION__, ieee->current_network.channel);
-//     ieee->set_chan(ieee->dev,ieee->current_network.channel);
 
                for(i = 0; i < 17; i++) {
          ieee->last_rxseq_num[i] = -1;
@@ -2771,7 +2697,6 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee)
        ieee->Regdot11HTOperationalRateSet[0]= 0xff;//support MCS 0~7
        ieee->Regdot11HTOperationalRateSet[1]= 0xff;//support MCS 8~15
        ieee->Regdot11HTOperationalRateSet[4]= 0x01;
-       //added by amy
        ieee->actscanning = false;
        ieee->beinretry = false;
        ieee->is_set_key = false;
@@ -2941,8 +2866,6 @@ static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value)
 
        if (ieee->set_security)
                ieee->set_security(ieee->dev, &sec);
-       //else
-       //      ret = -EOPNOTSUPP;
 
        return ret;
 }
@@ -3223,7 +3146,6 @@ int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_poin
        int ret=0;
 
        down(&ieee->wx_sem);
-       //IEEE_DEBUG_INFO("wpa_supplicant: len=%d\n", p->length);
 
        if (p->length < sizeof(struct ieee_param) || !p->pointer){
                ret = -EINVAL;