From 4f6807e8d2e972393009830d305ecec2d80c0449 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Mon, 11 Jul 2011 08:56:20 +0900 Subject: [PATCH] rtl8192e: Remove occurences of #if 1 Signed-off-by: Mike McCormack --- drivers/staging/rtl8192e/r8192E_phy.c | 3 +- drivers/staging/rtl8192e/rtl819x_TSProc.c | 9 +- drivers/staging/rtl8192e/rtl_core.c | 7 +- drivers/staging/rtl8192e/rtl_dm.c | 15 - drivers/staging/rtl8192e/rtl_ps.c | 2 - drivers/staging/rtl8192e/rtllib_rx.c | 619 +------------------ drivers/staging/rtl8192e/rtllib_softmac.c | 4 +- drivers/staging/rtl8192e/rtllib_softmac_wx.c | 4 +- drivers/staging/rtl8192e/rtllib_tx.c | 2 - 9 files changed, 14 insertions(+), 651 deletions(-) diff --git a/drivers/staging/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/r8192E_phy.c index 78395a1a998e..7ec00c218c48 100644 --- a/drivers/staging/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/r8192E_phy.c @@ -1394,7 +1394,6 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev) } -#if 1 switch ( priv->rf_chip ) { case RF_8225: @@ -1417,7 +1416,7 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev) RT_TRACE(COMP_ERR, "Unknown RFChipID: %d\n", priv->rf_chip); break; } -#endif + atomic_dec(&(priv->rtllib->atm_swbw)); priv->SetBWModeInProgress= false; diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c index 4159cb85a8b3..3fbf91c8cbfb 100644 --- a/drivers/staging/rtl8192e/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c @@ -540,7 +540,7 @@ void RemovePeerTS(struct rtllib_device* ieee, u8* Addr) { PTS_COMMON_INFO pTS, pTmpTS; printk("===========>RemovePeerTS,"MAC_FMT"\n", MAC_ARG(Addr)); -#if 1 + list_for_each_entry_safe(pTS, pTmpTS, &ieee->Tx_TS_Pending_List, List) { if (memcmp(pTS->Addr, Addr, 6) == 0) @@ -581,13 +581,12 @@ void RemovePeerTS(struct rtllib_device* ieee, u8* Addr) list_add_tail(&pTS->List, &ieee->Rx_TS_Unused_List); } } -#endif } void RemoveAllTS(struct rtllib_device* ieee) { PTS_COMMON_INFO pTS, pTmpTS; -#if 1 + list_for_each_entry_safe(pTS, pTmpTS, &ieee->Tx_TS_Pending_List, List) { RemoveTsEntry(ieee, pTS, TX_DIR); @@ -615,7 +614,6 @@ void RemoveAllTS(struct rtllib_device* ieee) list_del_init(&pTS->List); list_add_tail(&pTS->List, &ieee->Rx_TS_Unused_List); } -#endif } void TsStartAddBaProcess(struct rtllib_device* ieee, PTX_TS_RECORD pTxTS) @@ -623,7 +621,7 @@ void TsStartAddBaProcess(struct rtllib_device* ieee, PTX_TS_RECORD pTxTS) if (pTxTS->bAddBaReqInProgress == false) { pTxTS->bAddBaReqInProgress = true; -#if 1 + if (pTxTS->bAddBaReqDelayed) { RTLLIB_DEBUG(RTLLIB_DL_BA, "TsStartAddBaProcess(): Delayed Start ADDBA after 60 sec!!\n"); @@ -634,7 +632,6 @@ void TsStartAddBaProcess(struct rtllib_device* ieee, PTX_TS_RECORD pTxTS) RTLLIB_DEBUG(RTLLIB_DL_BA,"TsStartAddBaProcess(): Immediately Start ADDBA now!!\n"); mod_timer(&pTxTS->TsAddBaTimer, jiffies+10); } -#endif } else RTLLIB_DEBUG(RTLLIB_DL_BA, "%s()==>BA timer is already added\n", __func__); diff --git a/drivers/staging/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl_core.c index fd21c253d6e7..240b59b2d543 100644 --- a/drivers/staging/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl_core.c @@ -398,7 +398,7 @@ MgntActSet_RF_State( { spin_unlock_irqrestore(&priv->rf_ps_lock,flag); RT_TRACE((COMP_PS | COMP_RF), "MgntActSet_RF_State(): RF Change in progress! Wait to set..StateToSet(%d).\n", StateToSet); - #if 1 + while(priv->RFChangeInProgress) { RFWaitCounter ++; @@ -411,7 +411,6 @@ MgntActSet_RF_State( return false; } } - #endif } else { @@ -2796,7 +2795,7 @@ void rtl8192_rx_normal(struct net_device *dev) }else{ dev_kfree_skb_any(skb); } -#if 1 + new_skb = dev_alloc_skb(priv->rxbuffersize); if (unlikely(!new_skb)) { @@ -2805,7 +2804,7 @@ void rtl8192_rx_normal(struct net_device *dev) } skb=new_skb; skb->dev = dev; -#endif + priv->rx_buf[rx_queue_idx][priv->rx_idx[rx_queue_idx]] = skb; *((dma_addr_t *) skb->cb) = pci_map_single(priv->pdev, skb_tail_pointer_rsl(skb), priv->rxbuffersize, PCI_DMA_FROMDEVICE); diff --git a/drivers/staging/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl_dm.c index e864acb2c0b1..9f32e30f3191 100644 --- a/drivers/staging/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl_dm.c @@ -469,10 +469,8 @@ static void dm_check_rate_adaptive(struct net_device * dev) } } -#if 1 if (priv->rtllib->GetHalfNmodeSupportByAPsHandler(dev)) targetRATR &= 0xf00fffff; -#endif currentRATR = read_nic_dword(dev, RATR0); if ( targetRATR != currentRATR ) @@ -2983,7 +2981,6 @@ extern void dm_init_edca_turbo(struct net_device * dev) priv->bis_cur_rdlstate = false; } -#if 1 static void dm_check_edca_turbo( struct net_device * dev) { @@ -3086,7 +3083,6 @@ dm_CheckEdcaTurbo_EXIT: lastTxOkCnt = priv->stats.txbytesunicast; lastRxOkCnt = priv->stats.rxbytesunicast; } -#endif extern void DM_CTSToSelfSetting(struct net_device * dev,u32 DM_Type, u32 DM_Value) { @@ -3138,18 +3134,7 @@ static void dm_ctstoself(struct net_device *dev) } else { - #if 1 pHTInfo->IOTAction |= HT_IOT_ACT_FORCED_CTS2SELF; - #else - if (priv->undecorated_smoothed_pwdb < priv->rtllib->CTSToSelfTH) - { - pHTInfo->IOTAction &= ~HT_IOT_ACT_FORCED_CTS2SELF; - } - else if (priv->undecorated_smoothed_pwdb >= (priv->rtllib->CTSToSelfTH+5)) - { - pHTInfo->IOTAction |= HT_IOT_ACT_FORCED_CTS2SELF; - } - #endif } lastTxOkCnt = priv->stats.txbytesunicast; diff --git a/drivers/staging/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl_ps.c index 65bb397154ed..786106f0d8c6 100644 --- a/drivers/staging/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl_ps.c @@ -460,10 +460,8 @@ PlatformDisableASPM(struct net_device *dev) { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); PRT_POWER_SAVE_CONTROL pPSC = (PRT_POWER_SAVE_CONTROL)(&(priv->rtllib->PowerSaveControl)); -#if 1 u32 PciCfgAddrPort=0; u8 Num4Bytes; -#endif u8 LinkCtrlReg; u16 PciBridgeLinkCtrlReg, ASPMLevel=0; diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index 9d8b2770b0ee..4c3590b4a96a 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -608,7 +608,7 @@ rtllib_rx_frame_decrypt(struct rtllib_device* ieee, struct sk_buff *skb, if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) return 0; -#if 1 + if (ieee->hwsec_active) { cb_desc *tcb_desc = (cb_desc *)(skb->cb+ MAX_DEV_ADDR_SIZE); @@ -617,7 +617,7 @@ rtllib_rx_frame_decrypt(struct rtllib_device* ieee, struct sk_buff *skb, if (ieee->need_sw_enc) tcb_desc->bHwSec = 0; } -#endif + hdr = (struct rtllib_hdr_4addr *) skb->data; hdrlen = rtllib_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); @@ -983,7 +983,6 @@ void RxReorderIndicatePacket( struct rtllib_device *ieee, pReorderEntry->SeqNum = SeqNum; pReorderEntry->prxb = prxb; -#if 1 if (!AddReorderEntry(pTS, pReorderEntry)) { RTLLIB_DEBUG(RTLLIB_DL_REORDER, "%s(): Duplicate packet is dropped!! IndicateSeq: %d, NewSeq: %d\n", __func__, pTS->RxIndicateSeq, SeqNum); @@ -1000,7 +999,6 @@ void RxReorderIndicatePacket( struct rtllib_device *ieee, RTLLIB_DEBUG(RTLLIB_DL_REORDER, "Pkt insert into buffer!! IndicateSeq: %d, NewSeq: %d\n",pTS->RxIndicateSeq, SeqNum); } -#endif } else { /* @@ -1023,7 +1021,7 @@ void RxReorderIndicatePacket( struct rtllib_device *ieee, /* Check if there is any packet need indicate.*/ while(!list_empty(&pTS->RxPendingPktList)) { RTLLIB_DEBUG(RTLLIB_DL_REORDER,"%s(): start RREORDER indicate\n",__func__); -#if 1 + pReorderEntry = (PRX_REORDER_ENTRY)list_entry(pTS->RxPendingPktList.prev,RX_REORDER_ENTRY,List); if ( SN_LESS(pReorderEntry->SeqNum, pTS->RxIndicateSeq) || SN_EQUAL(pReorderEntry->SeqNum, pTS->RxIndicateSeq)) @@ -1049,7 +1047,6 @@ void RxReorderIndicatePacket( struct rtllib_device *ieee, bPktInBuf = true; break; } -#endif } /* Handling pending timer. Set this timer to prevent from long time Rx buffering.*/ @@ -1831,7 +1828,6 @@ int rtllib_rx_Mesh(struct rtllib_device *ieee, struct sk_buff *skb, return 0; } -#if 1 /* All received frames are sent to this function. @skb contains the frame in * IEEE 802.11 format, i.e., in the format it was sent over air. * This function is called only as a tasklet (software IRQ). */ @@ -1875,595 +1871,6 @@ int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb, ieee->stats.rx_dropped++; return 0; } -#else -int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb, - struct rtllib_rx_stats *rx_stats) -{ - struct net_device *dev = ieee->dev; - struct rtllib_hdr_4addr *hdr; - size_t hdrlen; - u16 fc, type, stype, sc; - struct net_device_stats *stats = NULL; - unsigned int frag; - u8 *payload; - u16 ethertype; - u8 TID = 0; - u16 SeqNum = 0; - PRX_TS_RECORD pTS = NULL; -#ifdef NOT_YET - struct net_device *wds = NULL; - struct sk_buff *skb2 = NULL; - struct net_device *wds = NULL; - int frame_authorized = 0; - int from_assoc_ap = 0; - void *sta = NULL; -#endif - u8 dst[ETH_ALEN]; - u8 src[ETH_ALEN]; - u8 bssid[ETH_ALEN] = {0}; - u8 zero_addr[ETH_ALEN] = {0}; - struct rtllib_crypt_data *crypt = NULL; - int keyidx = 0; -#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE) - struct sta_info * psta = NULL; -#endif - bool unicast_packet = false; - int i; - struct rtllib_rxb* rxb = NULL; - int multicast = 0; - bool tmp_dump = false; - bool bToOtherSTA = false; - hdr = (struct rtllib_hdr_4addr *)skb->data; - stats = &ieee->stats; - - multicast = is_multicast_ether_addr(hdr->addr1)|is_broadcast_ether_addr(hdr->addr1); - if (!multicast && (compare_ether_addr(dev->dev_addr, hdr->addr1) != 0)) { - if ((ieee->iw_mode == IW_MODE_MONITOR) || ieee->bNetPromiscuousMode){ - bToOtherSTA = true; - }else{ - goto rx_dropped; - } - } - - fc = le16_to_cpu(hdr->frame_ctl); - type = WLAN_FC_GET_TYPE(fc); - stype = WLAN_FC_GET_STYPE(fc); - sc = le16_to_cpu(hdr->seq_ctl); - frag = WLAN_GET_SEQ_FRAG(sc); - - ieee->need_sw_enc = 0; - - hdrlen = rtllib_get_hdrlen(fc); - if (skb->len < hdrlen){ - printk("%s():ERR!!! skb->len is smaller than hdrlen\n",__func__); - goto rx_dropped; - } - - if (HTCCheck(ieee, skb->data)) { - if (net_ratelimit()) - printk("find HTCControl\n"); - hdrlen += 4; - rx_stats->bContainHTC = 1; - } - if (RTLLIB_QOS_HAS_SEQ(fc)) - rx_stats->bIsQosData = 1; - if ((0) && (type == RTLLIB_FTYPE_DATA) && ((is_broadcast_ether_addr(hdr->addr1)) || (compare_ether_addr(dev->dev_addr, hdr->addr1) == 0))) { - printk("===>RX data before decrypt\n"); - tmp_dump = true; - dump_buf(skb->data,skb->len); - } -#ifdef NOT_YET - hostap_update_rx_stats(local->ap, hdr, rx_stats); -#endif - - if (ieee->host_decrypt) { - int idx = 0; - if (skb->len >= hdrlen + 3) - idx = skb->data[hdrlen + 3] >> 6; - crypt = ieee->crypt[idx]; -#ifdef NOT_YET - sta = NULL; - - /* Use station specific key to override default keys if the - * receiver address is a unicast address ("individual RA"). If - * bcrx_sta_key parameter is set, station specific key is used - * even with broad/multicast targets (this is against IEEE - * 802.11, but makes it easier to use different keys with - * stations that do not support WEP key mapping). */ - - if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key) - (void) hostap_handle_sta_crypto(local, hdr, &crypt, - &sta); -#endif - - /* allow NULL decrypt to indicate an station specific override - * for default encryption */ - if (crypt && (crypt->ops == NULL || - crypt->ops->decrypt_mpdu == NULL)) - crypt = NULL; - - if (!crypt && (fc & RTLLIB_FCTL_WEP)) { - /* This seems to be triggered by some (multicast?) - * frames from other than current BSS, so just drop the - * frames silently instead of filling system log with - * these reports. */ - RTLLIB_DEBUG_DROP("Decryption failed (not set)" - " (SA=" MAC_FMT ")\n", - MAC_ARG(hdr->addr2)); - ieee->ieee_stats.rx_discards_undecryptable++; - goto rx_dropped; - } - } - - if (skb->len < RTLLIB_DATA_HDR3_LEN) - goto rx_dropped; - - if ( (ieee->pHTInfo->bCurRxReorderEnable == false) || - !ieee->current_network.qos_data.active || - !IsDataFrame(skb->data) || - IsLegacyDataFrame(skb->data)) { - if (!((type == RTLLIB_FTYPE_MGMT) && (stype == RTLLIB_STYPE_BEACON))){ - if (is_duplicate_packet(ieee, hdr)){ - goto rx_dropped; - } - } - } else { - PRX_TS_RECORD pRxTS = NULL; - if (GetTs(ieee, (PTS_COMMON_INFO*) &pRxTS, hdr->addr2, - (u8)Frame_QoSTID((u8*)(skb->data)), RX_DIR, true)) { - if ((fc & (1<<11)) && (frag == pRxTS->RxLastFragNum) && - (WLAN_GET_SEQ_SEQ(sc) == pRxTS->RxLastSeqNum)) { - goto rx_dropped; - } else { - pRxTS->RxLastFragNum = frag; - pRxTS->RxLastSeqNum = WLAN_GET_SEQ_SEQ(sc); - } - } else { - RTLLIB_DEBUG(RTLLIB_DL_ERR, "ERR!!%s(): No TS!! Skip the check!!\n",__func__); - goto rx_dropped; - } - } - if (type == RTLLIB_FTYPE_MGMT) { - if (bToOtherSTA) - goto rx_dropped; - if (rtllib_rx_frame_mgmt(ieee, skb, rx_stats, type, stype)) - goto rx_dropped; - else - goto rx_exit; - } - if (type == RTLLIB_FTYPE_CTL) { - goto rx_dropped; - } - /* Data frame - extract src/dst addresses */ - switch (fc & (RTLLIB_FCTL_FROMDS | RTLLIB_FCTL_TODS)) { - case RTLLIB_FCTL_FROMDS: - memcpy(dst, hdr->addr1, ETH_ALEN); - memcpy(src, hdr->addr3, ETH_ALEN); - memcpy(bssid, hdr->addr2, ETH_ALEN); - break; - case RTLLIB_FCTL_TODS: - memcpy(dst, hdr->addr3, ETH_ALEN); - memcpy(src, hdr->addr2, ETH_ALEN); - memcpy(bssid, hdr->addr1, ETH_ALEN); - break; - case RTLLIB_FCTL_FROMDS | RTLLIB_FCTL_TODS: - if (skb->len < RTLLIB_DATA_HDR4_LEN) - goto rx_dropped; - memcpy(dst, hdr->addr3, ETH_ALEN); - memcpy(src, hdr->addr4, ETH_ALEN); - memcpy(bssid, ieee->current_network.bssid, ETH_ALEN); - break; - case 0: - memcpy(dst, hdr->addr1, ETH_ALEN); - memcpy(src, hdr->addr2, ETH_ALEN); - memcpy(bssid, hdr->addr3, ETH_ALEN); - break; - } - - /* Filter frames from different BSS */ - if ((type != RTLLIB_FTYPE_CTL) && ((fc & RTLLIB_FCTL_DSTODS) != RTLLIB_FCTL_DSTODS) - && (compare_ether_addr(ieee->current_network.bssid, bssid) != 0) && memcmp(ieee->current_network.bssid, zero_addr, ETH_ALEN)) { - goto rx_dropped; - } - - /* Filter packets sent by an STA that will be forwarded by AP */ - if ( ieee->IntelPromiscuousModeInfo.bPromiscuousOn && - ieee->IntelPromiscuousModeInfo.bFilterSourceStationFrame ) { - if ((fc & RTLLIB_FCTL_TODS) && !(fc & RTLLIB_FCTL_FROMDS) && - (compare_ether_addr(dst, ieee->current_network.bssid) != 0) && - (compare_ether_addr(bssid, ieee->current_network.bssid) == 0)) { - goto rx_dropped; - } - } - -#ifdef NOT_YET - if (hostap_rx_frame_wds(ieee, hdr, fc, &wds)) - goto rx_dropped; - if (wds) { - skb->dev = dev = wds; - stats = hostap_get_stats(dev); - } - - if (ieee->iw_mode == IW_MODE_MASTER && !wds && - (fc & (RTLLIB_FCTL_TODS | RTLLIB_FCTL_FROMDS)) == RTLLIB_FCTL_FROMDS && - ieee->stadev && - memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) { - /* Frame from BSSID of the AP for which we are a client */ - skb->dev = dev = ieee->stadev; - stats = hostap_get_stats(dev); - from_assoc_ap = 1; - } -#endif - - dev->last_rx = jiffies; - -#ifdef NOT_YET - if ((ieee->iw_mode == IW_MODE_MASTER || - ieee->iw_mode == IW_MODE_REPEAT) && - !from_assoc_ap) { - switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats, - wds != NULL)) { - case AP_RX_CONTINUE_NOT_AUTHORIZED: - frame_authorized = 0; - break; - case AP_RX_CONTINUE: - frame_authorized = 1; - break; - case AP_RX_DROP: - goto rx_dropped; - case AP_RX_EXIT: - goto rx_exit; - } - } -#endif - /* Nullfunc frames may have PS-bit set, so they must be passed to - * hostap_handle_sta_rx() before being dropped here. */ - if (stype != RTLLIB_STYPE_DATA && - stype != RTLLIB_STYPE_DATA_CFACK && - stype != RTLLIB_STYPE_DATA_CFPOLL && - stype != RTLLIB_STYPE_DATA_CFACKPOLL&& - stype != RTLLIB_STYPE_QOS_DATA - ) { - if (stype != RTLLIB_STYPE_NULLFUNC) - RTLLIB_DEBUG_DROP( - "RX: dropped data frame " - "with no data (type=0x%02x, " - "subtype=0x%02x, len=%d)\n", - type, stype, skb->len); - goto rx_dropped; - } - - if (skb->len == hdrlen){ - goto rx_dropped; - } - - { - /* network filter more precisely */ - switch (ieee->iw_mode) { - case IW_MODE_ADHOC: - /* packets from our adapter are dropped (echo) */ - if (!memcmp(hdr->addr2, dev->dev_addr, ETH_ALEN)) - goto rx_dropped; - - /* {broad,multi}cast packets to our BSSID go through */ - if (is_multicast_ether_addr(hdr->addr1)) { - if (!memcmp(hdr->addr3, ieee->current_network.bssid, ETH_ALEN)) - break; - else - goto rx_dropped; - } - - /* packets not to our adapter, just discard it */ - if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) { - if (bToOtherSTA) - break; - else - goto rx_dropped; - } - - break; - - case IW_MODE_INFRA: - /* packets from our adapter are dropped (echo) */ - if (!memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN)) - goto rx_dropped; - - /* {broad,multi}cast packets to our BSS go through */ - if (is_multicast_ether_addr(hdr->addr1)) { - if (!memcmp(hdr->addr2, ieee->current_network.bssid, ETH_ALEN)) - break; - else - goto rx_dropped; - } - - /* packets to our adapter go through */ - if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) { - if (bToOtherSTA) - break; - else - goto rx_dropped; - } - - break; - } - - - } - - if ((ieee->iw_mode == IW_MODE_INFRA) && (ieee->sta_sleep == LPS_IS_SLEEP) - && (ieee->polling)) { - if (WLAN_FC_MORE_DATA(fc)) { - /* more data bit is set, let's request a new frame from the AP */ - rtllib_sta_ps_send_pspoll_frame(ieee); - } else { - ieee->polling = false; - } - } - -#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE) - if (ieee->iw_mode == IW_MODE_ADHOC){ - psta = GetStaInfo(ieee, src); - if (NULL != psta) - psta->LastActiveTime = jiffies; - } -#endif - /* skb: hdr + (possibly fragmented, possibly encrypted) payload */ - if ((!rx_stats->Decrypted)){ - ieee->need_sw_enc = 1; - } - - if (ieee->host_decrypt && (fc & RTLLIB_FCTL_WEP) && - ((keyidx = rtllib_rx_frame_decrypt(ieee, skb, crypt)) < 0)) { - printk("decrypt frame error\n"); - goto rx_dropped; - } - if (tmp_dump) { - printk("************after decrypt\n"); - dump_buf(skb->data,skb->len); - } - hdr = (struct rtllib_hdr_4addr *) skb->data; - - /* skb: hdr + (possibly fragmented) plaintext payload */ - if ((frag != 0 || (fc & RTLLIB_FCTL_MOREFRAGS))) { - int flen; - struct sk_buff *frag_skb = rtllib_frag_cache_get(ieee, hdr); - RTLLIB_DEBUG_FRAG("Rx Fragment received (%u)\n", frag); - - if (!frag_skb) { - RTLLIB_DEBUG(RTLLIB_DL_RX | RTLLIB_DL_FRAG, - "Rx cannot get skb from fragment " - "cache (morefrag=%d seq=%u frag=%u)\n", - (fc & RTLLIB_FCTL_MOREFRAGS) != 0, - WLAN_GET_SEQ_SEQ(sc), frag); - goto rx_dropped; - } - flen = skb->len; - if (frag != 0) - flen -= hdrlen; - - if (frag_skb->tail + flen > frag_skb->end) { - printk(KERN_WARNING "%s: host decrypted and " - "reassembled frame did not fit skb\n", - dev->name); - rtllib_frag_cache_invalidate(ieee, hdr); - goto rx_dropped; - } - - if (frag == 0) { - /* copy first fragment (including full headers) into - * beginning of the fragment cache skb */ - memcpy(skb_put(frag_skb, flen), skb->data, flen); - } else { - /* append frame payload to the end of the fragment - * cache skb */ - memcpy(skb_put(frag_skb, flen), skb->data + hdrlen, - flen); - } - dev_kfree_skb_any(skb); - skb = NULL; - - if (fc & RTLLIB_FCTL_MOREFRAGS) { - /* more fragments expected - leave the skb in fragment - * cache for now; it will be delivered to upper layers - * after all fragments have been received */ - goto rx_exit; - } - - /* this was the last fragment and the frame will be - * delivered, so remove skb from fragment cache */ - skb = frag_skb; - hdr = (struct rtllib_hdr_4addr *) skb->data; - rtllib_frag_cache_invalidate(ieee, hdr); - } - - /* skb: hdr + (possible reassembled) full MSDU payload; possibly still - * encrypted/authenticated */ - if (ieee->host_decrypt && (fc & RTLLIB_FCTL_WEP) && - rtllib_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt)) { - printk("==>decrypt msdu error\n"); - goto rx_dropped; - } - - ieee->LinkDetectInfo.NumRecvDataInPeriod++; - ieee->LinkDetectInfo.NumRxOkInPeriod++; - - hdr = (struct rtllib_hdr_4addr *) skb->data; - if ((!is_multicast_ether_addr(hdr->addr1)) && (!is_broadcast_ether_addr(hdr->addr1))) - unicast_packet = true; - if (crypt && !(fc & RTLLIB_FCTL_WEP) && !ieee->open_wep) { - if (/*ieee->ieee802_1x &&*/ - rtllib_is_eapol_frame(ieee, skb, hdrlen)) { - -#ifdef CONFIG_RTLLIB_DEBUG - /* pass unencrypted EAPOL frames even if encryption is - * configured */ - struct eapol *eap = (struct eapol *)(skb->data + - 24); - RTLLIB_DEBUG_EAP("RX: IEEE 802.1X EAPOL frame: %s\n", - eap_get_type(eap->type)); -#endif - } else { - RTLLIB_DEBUG_DROP( - "encryption configured, but RX " - "frame not encrypted (SA=" MAC_FMT ")\n", - MAC_ARG(hdr->addr2)); - goto rx_dropped; - } - } - -#ifdef CONFIG_RTLLIB_DEBUG - if (crypt && !(fc & RTLLIB_FCTL_WEP) && - rtllib_is_eapol_frame(ieee, skb, hdrlen)) { - struct eapol *eap = (struct eapol *)(skb->data + - 24); - RTLLIB_DEBUG_EAP("RX: IEEE 802.1X EAPOL frame: %s\n", - eap_get_type(eap->type)); - } -#endif - - if (crypt && !(fc & RTLLIB_FCTL_WEP) && !ieee->open_wep && - !rtllib_is_eapol_frame(ieee, skb, hdrlen)) { - RTLLIB_DEBUG_DROP( - "dropped unencrypted RX data " - "frame from " MAC_FMT - " (drop_unencrypted=1)\n", - MAC_ARG(hdr->addr2)); - goto rx_dropped; - } - if (ieee->current_network.qos_data.active && IsQoSDataFrame(skb->data) - && !is_multicast_ether_addr(hdr->addr1) && !is_broadcast_ether_addr(hdr->addr1)) { - TID = Frame_QoSTID(skb->data); - SeqNum = WLAN_GET_SEQ_SEQ(sc); - GetTs(ieee,(PTS_COMMON_INFO*) &pTS,hdr->addr2,TID,RX_DIR,true); - if (TID !=0 && TID !=3) - ieee->bis_any_nonbepkts = true; - } - /* skb: hdr + (possible reassembled) full plaintext payload */ - payload = skb->data + hdrlen; - rxb = (struct rtllib_rxb*)kmalloc(sizeof(struct rtllib_rxb),GFP_ATOMIC); - if (rxb == NULL) { - RTLLIB_DEBUG(RTLLIB_DL_ERR,"%s(): kmalloc rxb error\n",__func__); - goto rx_dropped; - } - /* to parse amsdu packets */ - /* qos data packets & reserved bit is 1 */ - if (parse_subframe(ieee,skb,rx_stats,rxb,src,dst) == 0) { - /* only to free rxb, and not submit the packets to upper layer */ - for (i =0; i < rxb->nr_subframes; i++) { - dev_kfree_skb(rxb->subframes[i]); - } - kfree(rxb); - rxb = NULL; - goto rx_dropped; - } -#if !defined(RTL8192SU) && !defined(RTL8192U) - if (unicast_packet) { - if (type == RTLLIB_FTYPE_DATA) { - if (ieee->bIsAggregateFrame) - ieee->LinkDetectInfo.NumRxUnicastOkInPeriod+=rxb->nr_subframes; - else - ieee->LinkDetectInfo.NumRxUnicastOkInPeriod++; - - if ((ieee->state == RTLLIB_LINKED) /*&& !MgntInitAdapterInProgress(pMgntInfo)*/) { - if (((ieee->LinkDetectInfo.NumRxUnicastOkInPeriod +ieee->LinkDetectInfo.NumTxOkInPeriod) > 8 ) || - (ieee->LinkDetectInfo.NumRxUnicastOkInPeriod > 2)) { - if (ieee->LeisurePSLeave) - ieee->LeisurePSLeave(dev); - } - } - } - } -#endif - ieee->last_rx_ps_time = jiffies; - if (ieee->pHTInfo->bCurRxReorderEnable == false ||pTS == NULL || bToOtherSTA ){ - for (i = 0; inr_subframes; i++) { - struct sk_buff *sub_skb = rxb->subframes[i]; - - if (sub_skb) { - /* convert hdr + possible LLC headers into Ethernet header */ - ethertype = (sub_skb->data[6] << 8) | sub_skb->data[7]; - if (sub_skb->len >= 8 && - ((memcmp(sub_skb->data, rfc1042_header, SNAP_SIZE) == 0 && - ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) || - memcmp(sub_skb->data, bridge_tunnel_header, SNAP_SIZE) == 0)) { - /* remove RFC1042 or Bridge-Tunnel encapsulation and - * replace EtherType */ - skb_pull(sub_skb, SNAP_SIZE); - memcpy(skb_push(sub_skb, ETH_ALEN), src, ETH_ALEN); - memcpy(skb_push(sub_skb, ETH_ALEN), dst, ETH_ALEN); - } else { - u16 len; - /* Leave Ethernet header part of hdr and full payload */ - len = htons(sub_skb->len); - memcpy(skb_push(sub_skb, 2), &len, 2); - memcpy(skb_push(sub_skb, ETH_ALEN), src, ETH_ALEN); - memcpy(skb_push(sub_skb, ETH_ALEN), dst, ETH_ALEN); - } - - stats->rx_packets++; - stats->rx_bytes += sub_skb->len; - - if (is_multicast_ether_addr(dst)) { - stats->multicast++; - } - - /* Indicat the packets to upper layer */ - memset(sub_skb->cb, 0, sizeof(sub_skb->cb)); - sub_skb->protocol = eth_type_trans(sub_skb, dev); - sub_skb->dev = dev; - sub_skb->dev->stats.rx_packets++; - sub_skb->dev->stats.rx_bytes += sub_skb->len; -#ifdef TCP_CSUM_OFFLOAD_RX - if ( rx_stats->tcp_csum_valid) - sub_skb->ip_summed = CHECKSUM_UNNECESSARY; - else - sub_skb->ip_summed = CHECKSUM_NONE; -#else - sub_skb->ip_summed = CHECKSUM_NONE; /* 802.11 crc not sufficient */ -#endif - - netif_rx(sub_skb); - } - } - kfree(rxb); - rxb = NULL; - - } - else - { - RTLLIB_DEBUG(RTLLIB_DL_REORDER,"%s(): REORDER ENABLE AND PTS not NULL, and we will enter RxReorderIndicatePacket()\n",__func__); -#ifdef TCP_CSUM_OFFLOAD_RX - rxb->tcp_csum_valid = rx_stats->tcp_csum_valid; -#endif - RxReorderIndicatePacket(ieee, rxb, pTS, SeqNum); - } -#ifndef JOHN_NOCPY - dev_kfree_skb(skb); -#endif - - rx_exit: -#ifdef NOT_YET - if (sta) - hostap_handle_sta_release(sta); -#endif - return 1; - - rx_dropped: - if (rxb != NULL) - { - kfree(rxb); - rxb = NULL; - } - stats->rx_dropped++; - - /* Returning 0 indicates to caller that we have not handled the SKB-- - * so it is still allocated and can be used again by underlying - * hardware as a DMA target */ - return 0; -} -#endif - -#define MGMT_FRAME_FIXED_PART_LENGTH 0x24 static u8 qos_oui[QOS_OUI_LEN] = { 0x00, 0x50, 0xF2 }; @@ -2852,7 +2259,6 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, if (info_element->data[2] & 1) network->dtim_data |= RTLLIB_DTIM_MBCAST; -#if 1 offset = (info_element->data[2] >> 1)*2; @@ -2864,25 +2270,6 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, offset = (ieee->assoc_id / 8) - offset; if (info_element->data[3+offset] & (1<<(ieee->assoc_id%8))) network->dtim_data |= RTLLIB_DTIM_UCAST; -#else - { - u16 numSta = 0; - u16 offset_byte = 0; - u16 offset_bit = 0; - - numSta = (info_element->data[2] &0xFE)*8; - - if (ieee->assoc_id < numSta || - ieee->assoc_id > (numSta + (info_element->len -3)*8)) - break; - - offset = ieee->assoc_id - numSta; - offset_byte = offset / 8; - offset_bit = offset % 8; - if (info_element->data[3+offset_byte] & (0x01<dtim_data |= RTLLIB_DTIM_UCAST; - } -#endif network->listen_interval = network->dtim_period; break; diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 3ac740a7c0d4..1b2e6c44cd10 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -2750,7 +2750,7 @@ void rtllib_softmac_xmit(struct rtllib_txb *txb, struct rtllib_device *ieee) if (tcb_desc->bMulticast) { ieee->stats.multicast++; } -#if 1 + /* if xmit available, just xmit it immediately, else just insert it to the wait queue */ for (i = 0; i < txb->nr_frags; i++) { #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE @@ -2785,7 +2785,7 @@ void rtllib_softmac_xmit(struct rtllib_txb *txb, struct rtllib_device *ieee) ieee->dev,ieee->rate); } } -#endif + rtllib_txb_free(txb); spin_unlock_irqrestore(&ieee->lock,flags); diff --git a/drivers/staging/rtl8192e/rtllib_softmac_wx.c b/drivers/staging/rtl8192e/rtllib_softmac_wx.c index 863b2851657b..d88bb109a31e 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac_wx.c +++ b/drivers/staging/rtl8192e/rtllib_softmac_wx.c @@ -570,7 +570,7 @@ int rtllib_wx_set_power(struct rtllib_device *ieee, union iwreq_data *wrqu, char *extra) { int ret = 0; -#if 1 + if ( (!ieee->sta_wake_up) || (!ieee->enter_sleep_state) || @@ -580,7 +580,7 @@ int rtllib_wx_set_power(struct rtllib_device *ieee, return -1; } -#endif + down(&ieee->wx_sem); if (wrqu->power.disabled){ diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c index 3cc066eb530e..78b1707b12ae 100644 --- a/drivers/staging/rtl8192e/rtllib_tx.c +++ b/drivers/staging/rtl8192e/rtllib_tx.c @@ -978,7 +978,6 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) success: if (txb) { -#if 1 cb_desc *tcb_desc = (cb_desc *)(txb->fragments[0]->cb + MAX_DEV_ADDR_SIZE); tcb_desc->bTxEnableFwCalcDur = 1; tcb_desc->priority = skb->priority; @@ -1086,7 +1085,6 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) rtllib_query_protectionmode(ieee, tcb_desc, txb->fragments[0]); #endif } -#endif } spin_unlock_irqrestore(&ieee->lock, flags); dev_kfree_skb_any(skb); -- 2.30.2