******************************************************************************/
#include "rtl_core.h"
-#ifdef RTL8192SE
-#include "rtl8192s/r8192S_phyreg.h"
-#include "rtl8192s/r8192S_phy.h"
-#else
#include "r8192E_phyreg.h"
#include "r8192E_phy.h"
-#endif
#include "r8190P_rtl8256.h"
void PHY_SetRF8256Bandwidth(struct net_device* dev , HT_CHANNEL_WIDTH Bandwidth)
return false;
}
-#ifndef RTL8192SE
void PHY_SetRF8256CCKTxPower(struct net_device* dev, u8 powerlevel)
{
u32 TxAGC=0;
#endif
return;
}
-
-
-
-#endif
{
long retsig;
-#if defined RTL8192SE || defined RTL8192CE
- if (priv->CustomerID == RT_CID_819x_Lenovo)
- {
- return currsig;
- }
- else if (priv->CustomerID == RT_CID_819x_Netcore)
- {
- if (currsig >= 31 && currsig <= 100)
- {
- retsig = 100;
- }
- else if (currsig >= 21 && currsig <= 30)
- {
- retsig = 90 + ((currsig - 20) / 1);
- }
- else if (currsig >= 11 && currsig <= 20)
- {
- retsig = 80 + ((currsig - 10) / 1);
- }
- else if (currsig >= 7 && currsig <= 10)
- {
- retsig = 69 + (currsig - 7);
- }
- else if (currsig == 6)
- {
- retsig = 54;
- }
- else if (currsig == 5)
- {
- retsig = 45;
- }
- else if (currsig == 4)
- {
- retsig = 36;
- }
- else if (currsig == 3)
- {
- retsig = 27;
- }
- else if (currsig == 2)
- {
- retsig = 18;
- }
- else if (currsig == 1)
- {
- retsig = 9;
- }
- else
- {
- retsig = currsig;
- }
- return retsig;
- }
-#endif
-
if (currsig >= 61 && currsig <= 100)
{
retsig = 90 + ((currsig - 60) / 4);
write_nic_dword(dev,INTA_MASK, priv->irq_mask[0]);
#endif
-#ifdef RTL8192SE
- write_nic_dword(dev,INTA_MASK+4, priv->irq_mask[1]&0x3F);
-#endif
-
}
void rtl8192_DisableInterrupt(struct net_device *dev)
write_nic_dword(dev,INTA_MASK,0);
#endif
-#ifdef RTL8192SE
- write_nic_dword(dev,INTA_MASK + 4,0);
-#endif
priv->irq_enabled = 0;
}
write_nic_dword(dev, ISR, tmp);
#endif
-#ifdef RTL8192SE
- tmp = read_nic_dword(dev, ISR+4);
- write_nic_dword(dev, ISR+4, tmp);
-#endif
}
void rtl8192_interrupt_recognized(struct net_device *dev, u32 *p_inta, u32 *p_intb)
{
-#ifdef RTL8192SE
- struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
- *p_inta = read_nic_dword(dev, ISR) & priv->irq_mask[0];
-#else
*p_inta = read_nic_dword(dev, ISR) ;
-#endif
write_nic_dword(dev,ISR,*p_inta);
-#ifdef RTL8192SE
- *p_intb = read_nic_dword(dev, ISR+4);
- write_nic_dword(dev, ISR+4, *p_intb);
-#endif
}
bool rtl8192_HalRxCheckStuck(struct net_device *dev)
bool rtl8192_GetNmodeSupportBySecCfg(struct net_device *dev)
{
-#ifdef RTL8192SE
- return true;
-#else
struct r8192_priv *priv = rtllib_priv(dev);
struct rtllib_device *ieee = priv->rtllib;
if (ieee->rtllib_ap_sec_type &&
} else {
return true;
}
-#endif
}
bool rtl8192_GetHalfNmodeSupportByAPs(struct net_device* dev)
{
-#ifdef RTL8192SE
- return false;
-#else
bool Reval;
struct r8192_priv* priv = rtllib_priv(dev);
struct rtllib_device* ieee = priv->rtllib;
Reval = false;
return Reval;
-#endif
}
u8 rtl8192_QueryIsShort(u8 TxHT, u8 TxRate, cb_desc *tcb_desc)
}
#endif
-#ifndef RTL8192SE
bool
SetRFPowerState8190(
struct net_device* dev,
return bResult;
}
-#endif
extern void
PHY_ScanOperationBackup8192(
(pHTInfo->IOTPeer != HT_IOT_PEER_RALINK) )
retValue = true;
}
-#elif defined(RTL8192SE)
- PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
- if (ieee->rtllib_ap_sec_type &&
- (ieee->rtllib_ap_sec_type(ieee)&SEC_ALG_TKIP)) {
- if (pHTInfo->IOTPeer == HT_IOT_PEER_RALINK){
- retValue = true;
- }
- }
#endif
return retValue;
}
u8 HTIOTActIsForcedCTS2Self(struct rtllib_device *ieee, struct rtllib_network *network)
{
u8 retValue = 0;
-#if (defined RTL8192SE || defined RTL8192SU || defined RTL8192CE)
- if ((ieee->pHTInfo->IOTPeer == HT_IOT_PEER_MARVELL) ||(ieee->pHTInfo->IOTPeer == HT_IOT_PEER_ATHEROS) )
-#else
if (ieee->pHTInfo->IOTPeer == HT_IOT_PEER_MARVELL)
-#endif
{
retValue = 1;
}
u8 HTIOTActIsForcedRTSCTS(struct rtllib_device *ieee, struct rtllib_network *network)
{
u8 retValue = 0;
-#if defined(RTL8192SE) || defined(RTL8192SU)
- if (ieee->pHTInfo->bCurrentHTSupport)
- {
- if ((ieee->pHTInfo->IOTPeer != HT_IOT_PEER_REALTEK)&&
- (ieee->pHTInfo->IOTPeer != HT_IOT_PEER_REALTEK_92SE))
- {
- if ((ieee->pHTInfo->IOTAction & HT_IOT_ACT_TX_NO_AGGREGATION) == 0)
- retValue = 1;
- }
- }
-#endif
return retValue;
}
HTIOCActRejcectADDBARequest(struct rtllib_network *network)
{
u8 retValue = 0;
-#if (defined RTL8192SE || defined RTL8192SU || defined RTL8192CE)
- {
-
-
- }
-#endif
return retValue;
pHTInfo->IOTPeer==HT_IOT_PEER_RALINK)
return 1;
- }
-#elif defined RTL8192SE
- PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
- {
- if (ieee->rtllib_ap_sec_type != NULL)
- if (ieee->rtllib_ap_sec_type(ieee) == SEC_ALG_CCMP)
- if (pHTInfo->IOTPeer==HT_IOT_PEER_RALINK){
- return 1;
- }
-
}
#endif
return retValue;
HTIOTActDisableHighPower(struct rtllib_device* ieee,struct rtllib_network *network)
{
u8 retValue = 0;
-#if (defined RTL8192SE || defined RTL8192SU || defined RTL8192CE)
- PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
-#endif
#ifdef RTL8192SU
if (pHTInfo->IOTPeer==HT_IOT_PEER_RALINK ||
{
retValue = 1;
}
-#elif defined RTL8192SE || defined RTL8192CE
- if (pHTInfo->IOTPeer==HT_IOT_PEER_RALINK ||
- pHTInfo->IOTPeer==HT_IOT_PEER_REALTEK )
- {
- retValue = 1;
- }
#endif
return retValue;
}
{
u8 retValue = 0;
-#if (defined RTL8192SU || defined RTL8192SE || defined RTL8192CE)
- PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
- if ( (KEY_TYPE_WEP104 == ieee->pairwise_key_type) ||
- (KEY_TYPE_WEP40 == ieee->pairwise_key_type) ||
- (KEY_TYPE_WEP104 == ieee->group_key_type) ||
- (KEY_TYPE_WEP40 == ieee->group_key_type) ||
- (KEY_TYPE_TKIP == ieee->pairwise_key_type) )
- {
- if ((pHTInfo->IOTPeer==HT_IOT_PEER_REALTEK) && (network->bssht.bdSupportHT))
- retValue = 1;
- }
-#endif
-
return retValue;
}
{
u8 retValue = 0;
-#if (defined RTL8192SU || defined RTL8192SE || defined RTL8192CE)
- PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
- if ( (KEY_TYPE_WEP104 == ieee->pairwise_key_type) ||
- (KEY_TYPE_WEP40 == ieee->pairwise_key_type) ||
- (KEY_TYPE_WEP104 == ieee->group_key_type) ||
- (KEY_TYPE_WEP40 == ieee->group_key_type) ||
- (KEY_TYPE_TKIP == ieee->pairwise_key_type) )
- {
- if (pHTInfo->IOTPeer==HT_IOT_PEER_REALTEK)
- retValue = 1;
- }
-#endif
-
return retValue;
}
{
u8 retValue = 0;
-#if (defined RTL8192SU || defined RTL8192SE || defined RTL8192CE)
- PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
- if ( (KEY_TYPE_WEP104 == ieee->pairwise_key_type) ||
- (KEY_TYPE_WEP40 == ieee->pairwise_key_type) ||
- (KEY_TYPE_WEP104 == ieee->group_key_type) ||
- (KEY_TYPE_WEP40 == ieee->group_key_type) ||
- (KEY_TYPE_TKIP == ieee->pairwise_key_type) )
- {
- if ((pHTInfo->IOTPeer==HT_IOT_PEER_REALTEK) && (network->bssht.bdSupportHT))
- retValue = 1;
- }
-#endif
-
return retValue;
}
bool HTIOCActAllowPeerAggOnePacket(struct rtllib_device* ieee,struct rtllib_network *network)
{
bool retValue = false;
-#if defined(RTL8192SE) || defined(RTL8192SU)
- PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
- {
- if (ieee->VersionID<2)
- if (pHTInfo->IOTPeer == HT_IOT_PEER_MARVELL)
- return true;
-
- }
-#endif
return retValue;
}
HTIOTActIsNullDataPowerSaving(struct rtllib_device* ieee,struct rtllib_network *network)
{
bool retValue = false;
-#if defined(RTL8192SE) || defined(RTL8192SU)
- PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
- {
- if (pHTInfo->IOTPeer == HT_IOT_PEER_BROADCOM)
- return true;
-
- }
-#endif
return retValue;
}
pCapELE->ShortGI40Mhz = 1;
pCapELE->TxSTBC = 1;
-#if defined RTL8192SE || defined RTL8192CE
- pCapELE->TxSTBC = 0;
-#endif
pCapELE->RxSTBC = 0;
pCapELE->DelayBA = 0;
pCapELE->MaxAMSDUSize = (MAX_RECEIVE_BUFFER_SIZE>=7935)?1:0;
pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density;
else
pHTInfo->CurrentMPDUDensity = pPeerHTCap->MPDUDensity;
-#if (defined RTL8192SE || defined RTL8192SU || defined RTL8192CE)
- if (ieee->SetHwRegHandler != NULL) {
- ieee->SetHwRegHandler( ieee->dev, HW_VAR_SHORTGI_DENSITY, (u8*)(&ieee->MaxMssDensity));
- ieee->SetHwRegHandler(ieee->dev, HW_VAR_AMPDU_FACTOR, &pHTInfo->CurrentAMPDUFactor);
- ieee->SetHwRegHandler(ieee->dev, HW_VAR_AMPDU_MIN_SPACE, &pHTInfo->CurrentMPDUDensity);
- }
-#elif defined RTL8192CE
- if (ieee->SetHwRegHandler != NULL) {
- ieee->SetHwRegHandler(ieee->dev, HW_VAR_AMPDU_FACTOR, &pHTInfo->CurrentAMPDUFactor);
- ieee->SetHwRegHandler(ieee->dev, HW_VAR_AMPDU_MIN_SPACE, &pHTInfo->CurrentMPDUDensity);
- }
-#endif
if (pHTInfo->IOTAction & HT_IOT_ACT_TX_USE_AMSDU_8K)
{
pHTInfo->bCurrentAMPDUEnable = false;
bIOTAction = HTIOTActIsCCDFsync(ieee);
if (bIOTAction)
pHTInfo->IOTAction |= HT_IOT_ACT_CDD_FSYNC;
-#if defined(RTL8192SU) || defined(RTL8192SE) || defined RTL8192CE
- bIOTAction = HTIOTActIsForcedCTS2Self(ieee,pNetwork);
- if (bIOTAction)
- pHTInfo->IOTAction |= HT_IOT_ACT_FORCED_CTS2SELF;
-
-
- bIOTAction = HTIOTActIsEnableBETxOPLimit(ieee);
- if (bIOTAction)
- pHTInfo->IOTAction |= HT_IOT_ACT_FORCED_ENABLE_BE_TXOP;
-
-#if defined(RTL8192SU)
- bIOTAction = HTIOCActRejcectADDBARequest(pNetwork);
- if (bIOTAction)
- pHTInfo->IOTAction |= HT_IOT_ACT_REJECT_ADDBA_REQ;
-#endif
-
- bIOTAction = HTIOCActAllowPeerAggOnePacket(ieee, pNetwork);
- if (bIOTAction)
- pHTInfo->IOTAction |= HT_IOT_ACT_ALLOW_PEER_AGG_ONE_PKT;
-
- bIOTAction = HTIOTActIsEDCABiasRx(ieee, pNetwork);
- if (bIOTAction)
- pHTInfo->IOTAction |= HT_IOT_ACT_EDCA_BIAS_ON_RX;
-
-#if defined(RTL8192SU)
- bIOTAction = HTIOCActIsDisableCckRate(ieee, pNetwork);
- if (bIOTAction)
- pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_CCK_RATE;
-#endif
- bIOTAction = HTIOTActDisableShortGI(ieee, pNetwork);
- if (bIOTAction)
- pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_SHORT_GI;
-
- bIOTAction = HTIOTActDisableHighPower(ieee, pNetwork);
- if (bIOTAction)
- pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_HIGH_POWER;
-
-
- bIOTAction = HTIOTActIsForcedAMSDU8K(ieee, pNetwork);
- if (bIOTAction)
- pHTInfo->IOTAction |= HT_IOT_ACT_TX_USE_AMSDU_8K;
-
-#if defined(RTL8192SU)
- bIOTAction = HTIOTActIsTxNoAggregation(ieee, pNetwork);
- if (bIOTAction)
- pHTInfo->IOTAction |= HT_IOT_ACT_TX_NO_AGGREGATION;
-
- bIOTAction = HTIOTActIsDisableTx40MHz(ieee, pNetwork);
- if (bIOTAction)
- pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_TX_40_MHZ;
-
- bIOTAction = HTIOTActIsDisableTx2SS(ieee, pNetwork);
- if (bIOTAction)
- pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_TX_2SS;
-#endif
-
- bIOTAction = HTIOTActIsForcedRTSCTS(ieee, pNetwork);
- if (bIOTAction)
- pHTInfo->IOTAction |= HT_IOT_ACT_FORCED_RTS;
-
- bIOTAction = HTIOTActIsNullDataPowerSaving(ieee, pNetwork);
- if (bIOTAction)
- pHTInfo->IOTAction |= HT_IOT_ACT_NULL_DATA_POWER_SAVING;
-#endif
-
} else {
pHTInfo->bCurrentHTSupport = false;
pHTInfo->bCurrentRT2RTAggregation = false;
{
writeb(y,(u8*)dev->mem_start +x);
-#if !(defined RTL8192SE || defined RTL8192CE)
udelay(20);
-#endif
#if defined RTL8192CE
read_nic_byte(dev, x);
{
writel(y,(u8*)dev->mem_start +x);
-#if !(defined RTL8192SE || defined RTL8192CE)
udelay(20);
-#endif
#if defined RTL8192CE
read_nic_dword(dev, x);
{
writew(y,(u8*)dev->mem_start +x);
-#if !(defined RTL8192SE || defined RTL8192CE)
udelay(20);
-#endif
#if defined RTL8192CE
read_nic_word(dev, x);
}
#endif
-#ifdef RTL8192SE
- if (priv->rf_type == RF_1T1R) {
- ieee->Regdot11HTOperationalRateSet[1] = 0;
- }
- if (priv->rf_type == RF_1T1R || priv->rf_type == RF_1T2R)
- {
- ieee->Regdot11TxHTOperationalRateSet[1] = 0;
- }
-
- if (priv->rtllib->b1SSSupport == true) {
- ieee->Regdot11HTOperationalRateSet[1] = 0;
- }
-#endif
} else {
memset(ieee->Regdot11HTOperationalRateSet, 0, 16);
}
RT_TRACE(COMP_INIT, "start adapter finished\n");
RT_CLEAR_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_HALT_NIC);
priv->bfirst_init = false;
-#if defined RTL8192SE || defined RTL8192CE
- if (priv->rtllib->eRFPowerState!=eRfOn)
- MgntActSet_RF_State(dev, eRfOn, priv->rtllib->RfOffReason,true);
-#endif
#ifdef ENABLE_GPIO_RADIO_CTL
if (priv->polling_timer_on == 0){
static void rtl8192_init_priv_constant(struct net_device* dev)
{
-#if defined RTL8192SE || defined RTL8192CE || defined RTL8192E
struct r8192_priv *priv = rtllib_priv(dev);
PRT_POWER_SAVE_CONTROL pPSC = (PRT_POWER_SAVE_CONTROL)(&(priv->rtllib->PowerSaveControl));
-#endif
-#if defined RTL8192SE || defined RTL8192CE || defined RTL8192E
pPSC->RegMaxLPSAwakeIntvl = 5;
-#endif
#ifdef RTL8192CE
priv->bWEPinNmodeFromReg = 0;
priv->RegSupportPciASPM = 1;
-#elif defined RTL8192SE
- priv->RegPciASPM = 2;
-
- priv->RegDevicePciASPMSetting = 0x03;
-
- priv->RegHostPciASPMSetting = 0x02;
-
- priv->RegHwSwRfOffD3 = 2;
-
- priv->RegSupportPciASPM = 2;
-
#elif defined RTL8192E
priv->RegPciASPM = 2;
priv->ccktxpower_adjustcnt_ch14 = 0;
priv->ccktxpower_adjustcnt_not_ch14 = 0;
-#if defined RTL8192SE
- for (i = 0; i<PEER_MAX_ASSOC; i++){
- priv->rtllib->peer_assoc_list[i]=NULL;
- priv->rtllib->AvailableAIDTable[i] = 99;
- }
- priv->RATRTableBitmap = 0;
- priv->rtllib->amsdu_in_process = 0;
-#endif
-
priv->rtllib->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
priv->rtllib->iw_mode = IW_MODE_INFRA;
priv->rtllib->active_scan = 1;
init_hal_dm(dev);
-#if defined RTL8192SE || defined RTL8192CE
- InitSwLeds(dev);
-#endif
init_timer(&priv->watch_dog_timer);
setup_timer(&priv->watch_dog_timer,
watch_dog_timer_callback,
bCheckFwTxCnt = true;
if (tcb_desc->nStuckCount > 1)
printk("%s: QueueID=%d tcb_desc->nStuckCount=%d\n",__func__,QueueID,tcb_desc->nStuckCount);
-#if defined RTL8192SE || defined RTL8192CE
- if (tcb_desc->nStuckCount > ResetThreshold)
- {
- RT_TRACE( COMP_RESET, "TxCheckStuck(): Need silent reset because nStuckCount > ResetThreshold.\n" );
- spin_unlock_irqrestore(&priv->irq_th_lock,flags);
- return RESET_TYPE_SILENT;
- }
- bCheckFwTxCnt = false;
- #endif
}
}
spin_unlock_irqrestore(&priv->irq_th_lock,flags);
rtllib_softmac_stop_protocol(priv->rtllib, 0 ,true);
}
-#if !(defined RTL8192SE || defined RTL8192CE)
dm_backup_dynamic_mechanism_state(dev);
-#endif
-
up(&priv->wx_sem);
RT_TRACE(COMP_RESET,"%s():<==========down process is finished\n",__func__);
}
CamRestoreAllEntry(dev);
-#if !(defined RTL8192SE || defined RTL8192CE)
dm_restore_dynamic_mechanism_state(dev);
-#endif
END:
priv->ResetProgress = RESET_TYPE_NORESET;
priv->reset_count++;
priv->bForcedSilentReset =false;
priv->bResetInProgress = false;
-#if !(defined RTL8192SE || defined RTL8192CE)
write_nic_byte(dev, UFWP, 1);
-#endif
RT_TRACE(COMP_RESET, "Reset finished!! ====>[%d]\n", priv->reset_count);
}
}
}
{
-#if defined RTL8192SE
- if (priv->rtllib->iw_mode == IW_MODE_ADHOC)
- IbssAgeFunction(ieee);
-#endif
-
if (ieee->state == RTLLIB_LINKED && ieee->iw_mode == IW_MODE_INFRA)
{
u32 TotalRxBcnNum = 0;
priv->rtllib->bAwakePktSent = true;
-#if defined RTL8192SE || defined RTL8192CE
- fwinfo_size = 0;
-#else
fwinfo_size = sizeof(TX_FWINFO_8190PCI);
-#endif
header = (struct rtllib_hdr_1addr *)(((u8*)skb->data) + fwinfo_size);
fc = header->frame_ctl;
void rtl8192_rx_cmd(struct net_device *dev)
{
-#ifdef RTL8192SE
- struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
-
- unsigned int count = priv->rxringcount;
- int rx_queue_idx = RX_CMD_QUEUE;
-
- struct rtllib_rx_stats stats = {
- .signal = 0,
- .noise = -98,
- .rate = 0,
- .freq = RTLLIB_24GHZ_BAND,
- };
- stats.nic_type = NIC_8192E;
-
- while (count--) {
- rx_desc *pdesc = &priv->rx_ring[rx_queue_idx][priv->rx_idx[rx_queue_idx]];
- struct sk_buff *skb = priv->rx_buf[rx_queue_idx][priv->rx_idx[rx_queue_idx]];
-
- if (pdesc->OWN){
- return;
- } else {
- struct sk_buff *new_skb = NULL;
-
- pci_unmap_single(priv->pdev,
- *((dma_addr_t *)skb->cb),
- priv->rxbuffersize,
- PCI_DMA_FROMDEVICE);
-
- skb_put(skb, pdesc->Length);
-
- if (pdesc->MACID == 0x1e) {
-
- pdesc->Length = pdesc->Length - 32;
- pdesc->DrvInfoSize = 4;
- printk(">>>>%s()CMD PKT RX, beacon_len:%d payload_len:%d\n",__func__, pdesc->Length,skb->len);
-
-
- priv->ops->rx_query_status_descriptor(dev, &stats, pdesc, skb);
- skb_reserve(skb, stats.RxDrvInfoSize + stats.RxBufShift);
- }
-
- skb_trim(skb, skb->len - 4/*sCrcLng*/);
-
- if (pdesc->MACID == 0x1e){
- if (!rtllib_rx(priv->rtllib, skb, &stats)){
- dev_kfree_skb_any(skb);
- }
- }else{
- if (priv->ops->rx_command_packet_handler != NULL)
- priv->ops->rx_command_packet_handler(dev, skb, pdesc);
- dev_kfree_skb_any(skb);
- }
-
-
- new_skb = dev_alloc_skb(priv->rxbuffersize);
- if (unlikely(!new_skb))
- {
- printk("==========>can't alloc skb for rx\n");
- goto done;
- }
- skb=new_skb;
- skb->dev = dev;
-
- 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);
-
- }
-done:
- pdesc->BufferAddress = cpu_to_le32(*((dma_addr_t *)skb->cb));
- pdesc->OWN = 1;
- pdesc->Length = priv->rxbuffersize;
- if (priv->rx_idx[rx_queue_idx] == priv->rxringcount-1)
- pdesc->EOR = 1;
- priv->rx_idx[rx_queue_idx] = (priv->rx_idx[rx_queue_idx] + 1) % priv->rxringcount;
- }
-#endif
}
goto done;
}
-#if defined RTL8192SE
- if (intb & IMR_TBDOK){
- RT_TRACE(COMP_INTR, "beacon ok interrupt!\n");
- priv->stats.txbeaconokint++;
- priv->bIbssCoordinator = true;
- }
-
- if (intb & IMR_TBDER){
- RT_TRACE(COMP_INTR, "beacon error interrupt!\n");
- priv->stats.txbeaconerr++;
- priv->bIbssCoordinator = false;
- }
-
- if ((intb & IMR_TBDOK) ||(intb & IMR_TBDER))
- FairBeacon(dev);
-#else
if (inta & IMR_TBDOK){
RT_TRACE(COMP_INTR, "beacon ok interrupt!\n");
priv->stats.txbeaconokint++;
RT_TRACE(COMP_INTR, "beacon ok interrupt!\n");
priv->stats.txbeaconerr++;
}
-#endif
if (inta & IMR_BDOK) {
RT_TRACE(COMP_INTR, "beacon interrupt!\n");
rtl8192_tx_isr(dev,HIGH_QUEUE);
}
-#ifdef RTL8192SE
- if ((inta & IMR_ROK) || (inta & IMR_RXCMDOK))
-#else
if (inta & IMR_ROK)
-#endif
{
priv->stats.rxint++;
priv->InterruptLog.nIMR_ROK++;
dev->mem_start = ioaddr;
dev->mem_end = ioaddr + pci_resource_len(pdev, 0);
-#if defined RTL8192SE || defined RTL8192CE
- pci_write_config_byte(pdev, 0x81,0);
- pci_write_config_byte(pdev,0x44,0);
- pci_write_config_byte(pdev,0x04,0x06);
- pci_write_config_byte(pdev,0x04,0x07);
-#endif
-
pci_read_config_byte(pdev, 0x08, &revision_id);
/* If the revisionid is 0x10, the device uses rtl8192se. */
if (pdev->device == 0x8192 && revision_id == 0x10)
}
pci_disable_device(pdev);
-#ifdef RTL8192SE
- pci_write_config_byte(pdev, 0x81,1);
- pci_write_config_byte(pdev,0x44,3);
-#endif
RT_TRACE(COMP_DOWN, "wlan driver removed\n");
}
if (!priv->debug->hw_type) {
page_no = (priv->debug->hw_offset > 0x0f)? 0x0f: priv->debug->hw_offset;
-#ifdef RTL8192SE
- if (page_no >= 0x08 ) {
- len += snprintf(buf + len, count - len,
- "\n#################### BB page- %x##################\n ", page_no);
- for (n=0;n<=max;)
- {
- len += snprintf(buf + len, count - len, "\nD: %2x > ",n);
- for (i=0;i<4 && n<=max;n+=4,i++)
- len += snprintf(buf + len, count - len,
- "%8.8x ",rtl8192_QueryBBReg(dev,(page_no << 8|n),
- bMaskDWord));
- }
-
- } else
-#endif
{
len += snprintf(buf + len,count - len,
"\n#################### MAC page- %x##################\n ", page_no);
int max=0xff;
page0 = 0x000;
-#ifdef RTL8192SE
- /* This dump the current register page */
- if (!IS_BB_REG_OFFSET_92S(page0)){
- len += snprintf(page + len, count - len,
- "\n####################page %x##################\n ", (page0>>8));
- for (n=0;n<=max;)
- {
- len += snprintf(page + len, count - len,
- "\nD: %2x > ",n);
- for (i=0;i<16 && n<=max;i++,n++)
- len += snprintf(page + len, count - len,
- "%2.2x ",read_nic_byte(dev,(page0|n)));
- }
- }else
-#endif
{
len += snprintf(page + len, count - len,
"\n####################page %x##################\n ", (page0>>8));
void dump_eprom(struct net_device *dev);
void rtl8192_dump_reg(struct net_device *dev);
-#ifdef RTL8192SE
-void rtl8192se_dump_tx_desc(struct _tx_desc_8192se *pDesc);
-#endif
#ifdef RTL8192CE
void rtl8192ce_dump_tx_desc(struct _TX_DESC_8192CE *pDesc);
#endif
extern void dm_shadow_init(struct net_device *dev);
extern void dm_initialize_txpower_tracking(struct net_device *dev);
-#if (defined RTL8192E || defined RTL8192SE)
extern void dm_CheckRfCtrlGPIO(void *data);
-#endif
-
-#ifdef RTL8192SE
-extern void DM_TXPowerTracking92SDirectCall(struct net_device *dev);
-static void dm_CtrlInitGainByTwoPort(struct net_device *dev);
-static void dm_CtrlInitGainBeforeConnectByRssiAndFalseAlarm(struct net_device *dev);
-static void dm_initial_gain_STABeforeConnect(struct net_device *dev);
-void dm_InitRateAdaptiveMask(struct net_device *dev);
-void Adhoc_InitRateAdaptive(struct net_device *dev,struct sta_info *pEntry);
-#endif
/*--------------------Define export function prototype-----------------------*/
static void dm_init_ctstoself(struct net_device *dev);
static void dm_Init_WA_Broadcom_IOT(struct net_device *dev);
-#ifdef RTL8192SE
-static void dm_WA_Broadcom_IOT(struct net_device *dev);
-#endif
static void dm_check_edca_turbo(struct net_device *dev);
static void dm_send_rssi_tofw(struct net_device *dev);
static void dm_ctstoself(struct net_device *dev);
-#if defined RTL8192SE
-static void dm_RefreshRateAdaptiveMask(struct net_device *dev);
-#endif
/*---------------------------Define function prototype------------------------*/
extern void
dm_init_dynamic_txpower(dev);
-#ifdef RTL8192SE
- if (IS_HARDWARE_TYPE_8192SE(dev))
- dm_InitRateAdaptiveMask(dev);
- else
-#endif
- init_rate_adaptive(dev);
+ init_rate_adaptive(dev);
dm_dig_init(dev);
dm_init_edca_turbo(dev);
if (IS_HARDWARE_TYPE_8192SE(dev))
dm_Init_WA_Broadcom_IOT(dev);
-#if (defined RTL8192E || defined RTL8192SE)
INIT_DELAYED_WORK_RSL(&priv->gpio_change_rf_wq, (void *)dm_CheckRfCtrlGPIO,dev);
-#endif
-
}
extern void deinit_hal_dm(struct net_device *dev)
dm_check_txrateandretrycount(dev);
dm_check_edca_turbo(dev);
- if (IS_HARDWARE_TYPE_8192SE(dev)){
-#ifdef RTL8192SE
- dm_RefreshRateAdaptiveMask(dev);
- dm_WA_Broadcom_IOT(dev);
- return;
-#endif
- }
dm_check_rate_adaptive(dev);
dm_dynamic_txpower(dev);
dm_check_txpower_tracking(dev);
#define Tssi_Report_Value2 0x13e
#define FW_Busy_Flag 0x13f
-#ifndef RTL8192SE
static void dm_TXPowerTrackingCallback_TSSI(struct net_device * dev)
{
struct r8192_priv *priv = rtllib_priv(dev);
priv->rtllib->bdynamic_txpower_enable = true;
write_nic_byte(dev, Pw_Track_Flag, 0);
}
-#endif
#ifdef RTL8192E
static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device * dev)
}
priv->txpower_count = 0;
}
-#elif defined (RTL8192SE)
-static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device * dev)
-{
- struct r8192_priv *priv = rtllib_priv(dev);
- u8 ThermalValue=0;
- u32 FwCmdVal=0;
-
- priv->btxpower_trackingInit = true;
-
-
- ThermalValue = (u8)rtl8192_phy_QueryRFReg(dev, RF90_PATH_A, RF_T_METER, 0x1f);
- RT_TRACE(COMP_POWER_TRACKING, "Readback Thermal Meter = 0x%x\n", ThermalValue);
- printk("%s()Readback Thermal Meter = 0x%x\n", __func__,ThermalValue);
- if (ThermalValue)
- {
- priv->ThermalValue = ThermalValue;
- if (priv->pFirmware->FirmwareVersion >= 0x35)
- {
- priv->rtllib->SetFwCmdHandler(dev, FW_CMD_TXPWR_TRACK_THERMAL);
- }
- else
- {
- FwCmdVal = (FW_TXPWR_TRACK_THERMAL|
- (priv->ThermalMeter[0]<<8)|(ThermalValue<<16));
- RT_TRACE(COMP_POWER_TRACKING, "Write to FW Thermal Val = 0x%x\n", FwCmdVal);
- write_nic_dword(dev, WFM5, FwCmdVal);
- ChkFwCmdIoDone(dev);
- }
- }
-
- priv->txpower_count = 0;
-}
#endif
void dm_txpower_trackingcallback(void *data)
dm_TXPowerTrackingCallback_ThermalMeter(dev);
}
-#ifndef RTL8192SE
static void dm_InitializeTXPowerTracking_TSSI(struct net_device *dev)
{
priv->btxpower_trackingInit = false;
}
-#endif
+
static void dm_InitializeTXPowerTracking_ThermalMeter(struct net_device *dev)
{
struct r8192_priv *priv = rtllib_priv(dev);
if (!TM_Trigger)
{
-#ifdef RTL8192SE
- if (IS_HARDWARE_TYPE_8192SE(dev))
- {
- rtl8192_phy_SetRFReg(dev, RF90_PATH_A, RF_T_METER, bRFRegOffsetMask, 0x60);
- RT_TRACE(COMP_POWER_TRACKING, "Trigger 92S Thermal Meter!!\n");
- }
- else
-#endif
{
rtl8192_phy_SetRFReg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4d);
rtl8192_phy_SetRFReg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4f);
return;
} else {
printk("===============>Schedule TxPowerTrackingWorkItem\n");
-#ifdef RTL8192SE
- DM_TXPowerTracking92SDirectCall(dev);
-#else
queue_delayed_work_rsl(priv->priv_wq,&priv->txpower_tracking_wq,0);
-#endif
TM_Trigger = 0;
}
}
-#ifdef RTL8192SE
-void DM_TXPowerTracking92SDirectCall(struct net_device *dev)
-{
- dm_TXPowerTrackingCallback_ThermalMeter(dev);
- }
-#endif
-
static void dm_check_txpower_tracking(struct net_device *dev)
{
-#ifdef RTL8192E
struct r8192_priv *priv = rtllib_priv(dev);
-#endif
+
if (priv->IC_Cut >= IC_VersionCut_D)
dm_CheckTXPowerTracking_TSSI(dev);
else
dm_CheckTXPowerTracking_ThermalMeter(dev);
}
-#ifndef RTL8192SE
static void dm_CCKTxPowerAdjust_TSSI(struct net_device *dev, bool bInCH14)
{
u32 TempVal;
}
-#endif
#ifdef RTL8192E
static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH14)
{
}
#endif
-#ifndef RTL8192SE
extern void dm_cck_txpower_adjust(
struct net_device *dev,
bool binch14
else
dm_CCKTxPowerAdjust_ThermalMeter(dev, binch14);
}
-#endif
static void dm_txpower_reset_recovery(
struct net_device *dev
u32 dm_type,
u32 dm_value)
{
-#ifdef RTL8192SE
- struct r8192_priv *priv = rtllib_priv(dev);
- if (dm_type == DIG_TYPE_THRESH_HIGHPWR_HIGH)
- priv->MidHighPwrTHR_L2 = (u8)dm_value;
- else if (dm_type == DIG_TYPE_THRESH_HIGHPWR_LOW)
- priv->MidHighPwrTHR_L1 = (u8)dm_value;
- return;
-#endif
if (dm_type == DIG_TYPE_THRESH_HIGH)
{
dm_digtable.rssi_high_thresh = dm_value;
dm_digtable.dig_enable_flag = true;
dm_digtable.Backoff_Enable_Flag = true;
-#ifdef RTL8192SE
- if ((priv->DM_Type == DM_Type_ByDriver) && (priv->pFirmware->FirmwareVersion >= 0x3c))
- dm_digtable.dig_algorithm = DIG_ALGO_BY_TOW_PORT;
- else
- dm_digtable.dig_algorithm = DIG_ALGO_BEFORE_CONNECT_BY_RSSI_AND_ALARM;
-#else
dm_digtable.dig_algorithm = DIG_ALGO_BY_RSSI;
-#endif
dm_digtable.Dig_TwoPort_Algorithm = DIG_TWO_PORT_ALGO_RSSI;
dm_digtable.Dig_Ext_Port_Stage = DIG_EXT_PORT_STAGE_MAX;
FalseAlmCnt->Cnt_Ofdm_fail, FalseAlmCnt->Cnt_Cck_fail , FalseAlmCnt->Cnt_all);
}
-#ifdef RTL8192SE
-static void dm_CtrlInitGainAPByFalseAlarm(struct net_device *dev)
-{
- static u8 binitialized = false;
-
- {
- binitialized = false;
- dm_digtable.Dig_Ext_Port_Stage = DIG_EXT_PORT_STAGE_MAX;
- return;
- }
-}
-#endif
-
static void dm_ctrl_initgain_byrssi(struct net_device *dev)
{
dm_ctrl_initgain_byrssi_by_fwfalse_alarm(dev);
else if (dm_digtable.dig_algorithm == DIG_ALGO_BY_RSSI)
dm_ctrl_initgain_byrssi_by_driverrssi(dev);
-#ifdef RTL8192SE
- else if (dm_digtable.dig_algorithm == DIG_ALGO_BEFORE_CONNECT_BY_RSSI_AND_ALARM)
- dm_CtrlInitGainBeforeConnectByRssiAndFalseAlarm(dev);
- else if (dm_digtable.dig_algorithm == DIG_ALGO_BY_TOW_PORT)
- dm_CtrlInitGainByTwoPort(dev);
-#endif
else
return;
}
-#ifdef RTL8192SE
-static void dm_CtrlInitGainByTwoPort(struct net_device *dev)
-{
- struct r8192_priv *priv = rtllib_priv(dev);
-
- if (rtllib_act_scanning(priv->rtllib,true) == true)
- return;
-
- if ((priv->rtllib->state > RTLLIB_NOLINK) && (priv->rtllib->state < RTLLIB_LINKED))
- dm_digtable.CurSTAConnectState = DIG_STA_BEFORE_CONNECT;
- else if ((priv->rtllib->state == RTLLIB_LINKED) ||(priv->rtllib->state == RTLLIB_LINKED_SCANNING))
- dm_digtable.CurSTAConnectState = DIG_STA_CONNECT;
- else
- dm_digtable.CurSTAConnectState = DIG_STA_DISCONNECT;
-
- dm_digtable.rssi_val = priv->undecorated_smoothed_pwdb;
-
- if (dm_digtable.CurSTAConnectState != DIG_STA_DISCONNECT)
- {
- if (dm_digtable.Dig_TwoPort_Algorithm == DIG_TWO_PORT_ALGO_FALSE_ALARM)
- {
- dm_digtable.Dig_TwoPort_Algorithm = DIG_TWO_PORT_ALGO_RSSI;
- priv->rtllib->SetFwCmdHandler(dev, FW_CMD_DIG_MODE_SS);
- }
- }
-
- dm_FalseAlarmCounterStatistics(dev);
- dm_initial_gain_STABeforeConnect(dev);
- dm_CtrlInitGainAPByFalseAlarm(dev);
-
- dm_digtable.PreSTAConnectState = dm_digtable.CurSTAConnectState;
-}
-#endif
-
/*-----------------------------------------------------------------------------
* Function: dm_CtrlInitGainBeforeConnectByRssiAndFalseAlarm()
*
*
*---------------------------------------------------------------------------*/
-#ifdef RTL8192SE
-static void dm_CtrlInitGainBeforeConnectByRssiAndFalseAlarm(struct net_device *dev)
-{
- struct r8192_priv *priv = rtllib_priv(dev);
-
- if (rtllib_act_scanning(priv->rtllib,true) == true)
- return;
-
- if ((priv->rtllib->state > RTLLIB_NOLINK) && (priv->rtllib->state < RTLLIB_LINKED))
- dm_digtable.CurSTAConnectState = DIG_STA_BEFORE_CONNECT;
- else if ((priv->rtllib->state == RTLLIB_LINKED) ||(priv->rtllib->state == RTLLIB_LINKED_SCANNING))
- dm_digtable.CurSTAConnectState = DIG_STA_CONNECT;
- else
- dm_digtable.CurSTAConnectState = DIG_STA_DISCONNECT;
-
- if (dm_digtable.dbg_mode == DM_DBG_OFF)
- dm_digtable.rssi_val = priv->undecorated_smoothed_pwdb;
-
- dm_FalseAlarmCounterStatistics(dev);
- dm_initial_gain_STABeforeConnect(dev);
- dm_digtable.PreSTAConnectState = dm_digtable.CurSTAConnectState;
-
-}
-#endif
static void dm_ctrl_initgain_byrssi_by_driverrssi(
struct net_device *dev)
{
pHTInfo->WAIotTH = WAIotTHVal;
}
-#ifdef RTL8192SE
-static void
-dm_WA_Broadcom_IOT(struct net_device * dev)
-{
- struct r8192_priv *priv = rtllib_priv((struct net_device *)dev);
- PRT_HIGH_THROUGHPUT pHTInfo = priv->rtllib->pHTInfo;
- u8 update=0;
- static enum rtllib_state connectState = RTLLIB_NOLINK;
-
- if ( (pHTInfo->bWAIotBroadcom != true) ||
- (priv->rtllib->mode == WIRELESS_MODE_B) ||
- (pHTInfo->bCurBW40MHz))
- {
- if (pHTInfo->IOTAction & HT_IOT_ACT_WA_IOT_Broadcom)
- {
- pHTInfo->IOTAction &= ~HT_IOT_ACT_WA_IOT_Broadcom;
- update = 1;
- printk(" dm_WA_Broadcom_IOT(), disable HT_IOT_ACT_WA_IOT_Broadcom\n");
- }
- else
- return;
- }
-
- if (connectState == RTLLIB_LINKED && priv->rtllib->state == RTLLIB_LINKED)
- {
- if (pHTInfo->IOTAction & HT_IOT_ACT_WA_IOT_Broadcom)
- {
- pHTInfo->IOTAction &= ~HT_IOT_ACT_WA_IOT_Broadcom;
- update = 1;
- pHTInfo->bWAIotBroadcom = false;
- printk("dm_WA_Broadcom_IOT(), from connect to disconnected, disable HT_IOT_ACT_WA_IOT_Broadcom\n");
- }
- }
- connectState = priv->rtllib->state;
-
- if (!update && pHTInfo->IOTPeer == HT_IOT_PEER_BROADCOM)
- {
- if (priv->undecorated_smoothed_pwdb < pHTInfo->WAIotTH)
- {
- if (pHTInfo->IOTAction & HT_IOT_ACT_WA_IOT_Broadcom)
- {
- pHTInfo->IOTAction &= ~HT_IOT_ACT_WA_IOT_Broadcom;
- update = 1;
- printk("dm_WA_Broadcom_IOT() ==> WA_IOT enable cck rates\n");
- }
- }
- else if (priv->undecorated_smoothed_pwdb >= (priv->rtllib->CTSToSelfTH+5))
- {
- if ((pHTInfo->IOTAction & HT_IOT_ACT_WA_IOT_Broadcom) == 0)
- {
- pHTInfo->IOTAction |= HT_IOT_ACT_WA_IOT_Broadcom;
- update = 1;
- printk("dm_WA_Broadcom_IOT() ==> WA_IOT disable cck rates\n");
- }
- }
- }
-
- if (update){
- if (priv->rtllib->bUseRAMask){
- priv->rtllib->UpdateHalRAMaskHandler(
- dev,
- false,
- 0,
- priv->rtllib->pHTInfo->PeerMimoPs,
- priv->rtllib->mode,
- priv->rtllib->pHTInfo->bCurTxBW40MHz,
- 0);
- }else{
- priv->ops->update_ratr_table(dev, priv->rtllib->dot11HTOperationalRateSet, NULL);
- }
- priv->rtllib->SetHwRegHandler( dev, HW_VAR_BASIC_RATE, (u8*)(&priv->basic_rate));
- }
-}
-#endif
-
static void dm_check_pbc_gpio(struct net_device *dev)
{
#ifdef RTL8192U
}
}
-#elif defined RTL8192SE
-extern void Power_DomainInit92SE(struct net_device *dev)
-{
- struct r8192_priv *priv = rtllib_priv(dev);
- u8 tmpU1b;
- u16 tmpU2b;
-
-
-
- priv->PwrDomainProtect = true;
-
- tmpU1b = read_nic_byte(dev, (SYS_CLKR + 1));
- if (tmpU1b & BIT7)
- {
- tmpU1b &= ~(BIT6 | BIT7);
- if (!HalSetSysClk8192SE(dev, tmpU1b)){
- priv->PwrDomainProtect = false;
- return;
- }
- }
-
- write_nic_byte(dev, AFE_PLL_CTRL, 0x0);
- write_nic_byte(dev, LDOA15_CTRL, 0x34);
-
- tmpU1b = read_nic_byte(dev, SYS_FUNC_EN+1);
- if (priv->rtllib->RfOffReason & (RF_CHANGE_BY_IPS | RF_CHANGE_BY_HW)) {
- tmpU1b &= 0xFB;
- } else {
- tmpU1b &= 0x73;
- }
-
- write_nic_byte(dev, SYS_FUNC_EN+1, tmpU1b);
- udelay(1000);
-
- write_nic_byte(dev, CMDR, 0);
- write_nic_byte(dev, TCR, 0);
-
- tmpU1b = read_nic_byte(dev, 0x562);
- tmpU1b |= 0x08;
- write_nic_byte(dev, 0x562, tmpU1b);
- tmpU1b &= ~(BIT3);
- write_nic_byte(dev, 0x562, tmpU1b);
-
- tmpU1b = read_nic_byte(dev, AFE_XTAL_CTRL);
- write_nic_byte(dev, AFE_XTAL_CTRL, (tmpU1b|0x01));
- udelay(1500);
- tmpU1b = read_nic_byte(dev, AFE_XTAL_CTRL+1);
- write_nic_byte(dev, AFE_XTAL_CTRL+1, (tmpU1b&0xfb));
-
-
- tmpU1b = read_nic_byte(dev, AFE_MISC);
- write_nic_byte(dev, AFE_MISC, (tmpU1b|BIT0));
- udelay(1000);
-
- tmpU1b = read_nic_byte(dev, AFE_MISC);
- write_nic_byte(dev, AFE_MISC, (tmpU1b|0x02));
- udelay(1000);
-
- tmpU1b = read_nic_byte(dev, LDOA15_CTRL);
- write_nic_byte(dev, LDOA15_CTRL, (tmpU1b|BIT0));
-
- tmpU2b = read_nic_word(dev, SYS_ISO_CTRL);
- write_nic_word(dev, SYS_ISO_CTRL, (tmpU2b|BIT11));
-
-
- tmpU2b = read_nic_word(dev, SYS_FUNC_EN);
- write_nic_word(dev, SYS_FUNC_EN, (tmpU2b |BIT13));
-
- write_nic_byte(dev, SYS_ISO_CTRL+1, 0x68);
-
- tmpU1b = read_nic_byte(dev, AFE_PLL_CTRL);
- write_nic_byte(dev, AFE_PLL_CTRL, (tmpU1b|BIT0|BIT4));
- tmpU1b = read_nic_byte(dev, AFE_PLL_CTRL+1);
- write_nic_byte(dev, AFE_PLL_CTRL+1, (tmpU1b|BIT0));
- udelay(1000);
-
- write_nic_byte(dev, SYS_ISO_CTRL, 0xA6);
-
- tmpU2b = read_nic_word(dev, SYS_CLKR);
- write_nic_word(dev, SYS_CLKR, (tmpU2b|BIT12|BIT11));
-
- tmpU2b = read_nic_word(dev, SYS_FUNC_EN);
- write_nic_word(dev, SYS_FUNC_EN, (tmpU2b|BIT11));
- write_nic_word(dev, SYS_FUNC_EN, (tmpU2b|BIT11|BIT15));
-
- tmpU2b = read_nic_word(dev, SYS_CLKR);
- write_nic_word(dev, SYS_CLKR, (tmpU2b&(~BIT2)));
-
- tmpU1b = read_nic_byte(dev, (SYS_CLKR + 1));
- tmpU1b = ((tmpU1b | BIT7) & (~BIT6));
- if (!HalSetSysClk8192SE(dev, tmpU1b))
- {
- priv->PwrDomainProtect = false;
- return;
- }
-
- write_nic_word(dev, CMDR, 0x37FC);
-
- gen_RefreshLedState(dev);
-
- priv->PwrDomainProtect = false;
-
-}
-
-void SET_RTL8192SE_RF_HALT(struct net_device *dev)
-{
- u8 u1bTmp;
- struct r8192_priv *priv = rtllib_priv(dev);
-
- if (priv->rtllib->RfOffReason == RF_CHANGE_BY_IPS && priv->LedStrategy == SW_LED_MODE8)
- {
- SET_RTL8192SE_RF_SLEEP(dev);
- return;
- }
-
- u1bTmp = read_nic_byte(dev, LDOV12D_CTRL);
- u1bTmp |= BIT0;
- write_nic_byte(dev, LDOV12D_CTRL, u1bTmp);
- write_nic_byte(dev, SPS1_CTRL, 0x0);
- write_nic_byte(dev, TXPAUSE, 0xFF);
- write_nic_word(dev, CMDR, 0x57FC);
- udelay(100);
- write_nic_word(dev, CMDR, 0x77FC);
- write_nic_byte(dev, PHY_CCA, 0x0);
- udelay(10);
- write_nic_word(dev, CMDR, 0x37FC);
- udelay(10);
- write_nic_word(dev, CMDR, 0x77FC);
- udelay(10);
- write_nic_word(dev, CMDR, 0x57FC);
- write_nic_word(dev, CMDR, 0x0000);
- u1bTmp = read_nic_byte(dev, (SYS_CLKR + 1));
- if (u1bTmp & BIT7)
- {
- u1bTmp &= ~(BIT6 | BIT7);
- if (!HalSetSysClk8192SE(dev, u1bTmp))
- return;
- }
- if (priv->rtllib->RfOffReason==RF_CHANGE_BY_IPS )
- {
- write_nic_byte(dev, 0x03, 0xF9);
- }
- else
- {
- write_nic_byte(dev, 0x03, 0x71);
- }
- write_nic_byte(dev, SYS_CLKR+1, 0x70);
- write_nic_byte(dev, AFE_PLL_CTRL+1, 0x68);
- write_nic_byte(dev, AFE_PLL_CTRL, 0x00);
- write_nic_byte(dev, LDOA15_CTRL, 0x34);
- write_nic_byte(dev, AFE_XTAL_CTRL, 0x0E);
-
-}
-
-u8 RfOnOffDetect(struct net_device *dev)
-{
- struct r8192_priv *priv = rtllib_priv(dev);
- u8 u1Tmp;
- u8 retval=eRfOn;
-
- if (priv->pwrdown)
- {
- u1Tmp = read_nic_byte(dev, 0x06);
- printk("pwrdown, 0x6(BIT6)=%02x\n", u1Tmp);
- retval = (u1Tmp & BIT6) ? eRfOn: eRfOff;
- }
- else
- {
-#ifdef CONFIG_BT_COEXIST
- if (pHalData->bt_coexist.BluetoothCoexist)
- {
- if (pHalData->bt_coexist.BT_CoexistType == BT_2Wire)
- {
- PlatformEFIOWrite1Byte(pAdapter, MAC_PINMUX_CFG, 0xa);
- u1Tmp = PlatformEFIORead1Byte(pAdapter, GPIO_IO_SEL);
- delay_us(100);
- u1Tmp = PlatformEFIORead1Byte(pAdapter, GPIO_IN);
- RTPRINT(FPWR, PWRHW, ("GPIO_IN=%02x\n", u1Tmp));
- retval = (u1Tmp & HAL_8192S_HW_GPIO_OFF_BIT) ? eRfOn : eRfOff;
- }
- else if ( (pHalData->bt_coexist.BT_CoexistType == BT_ISSC_3Wire) ||
- (pHalData->bt_coexist.BT_CoexistType == BT_Accel) ||
- (pHalData->bt_coexist.BT_CoexistType == BT_CSR) )
- {
- u4tmp = PHY_QueryBBReg(pAdapter, 0x87c, bMaskDWord);
- if ((u4tmp & BIT17) != 0)
- {
- PHY_SetBBReg(pAdapter, 0x87c, bMaskDWord, u4tmp & ~BIT17);
- delay_us(50);
- RTPRINT(FBT, BT_RFPoll, ("BT write 0x87c (~BIT17) = 0x%x\n", u4tmp &~BIT17));
- }
- u4tmp = PHY_QueryBBReg(pAdapter, 0x8e0, bMaskDWord);
- RTPRINT(FBT, BT_RFPoll, ("BT read 0x8e0 (BIT24)= 0x%x\n", u4tmp));
- retval = (u4tmp & BIT24) ? eRfOn : eRfOff;
- RTPRINT(FBT, BT_RFPoll, ("BT check RF state to %s\n", (retval==eRfOn)? "ON":"OFF"));
- }
- }
- else
-#endif
- {
- write_nic_byte(dev, MAC_PINMUX_CFG, (GPIOMUX_EN | GPIOSEL_GPIO));
- u1Tmp = read_nic_byte(dev, GPIO_IO_SEL);
-
- u1Tmp &= HAL_8192S_HW_GPIO_OFF_MASK;
- write_nic_byte(dev, GPIO_IO_SEL, u1Tmp);
-
- mdelay(10);
-
- u1Tmp = read_nic_byte(dev, GPIO_IN);
- retval = (u1Tmp & HAL_8192S_HW_GPIO_OFF_BIT) ? eRfOn : eRfOff;
- }
- }
-
- return retval;
-}
-
-extern void dm_CheckRfCtrlGPIO(void *data)
-{
- struct net_device *dev = (struct net_device *)data;
- struct r8192_priv *priv = rtllib_priv(dev);
-
- RT_RF_POWER_STATE eRfPowerStateToSet, CurRfState;
- bool bActuallySet = false;
- PRT_POWER_SAVE_CONTROL pPSC = (PRT_POWER_SAVE_CONTROL)(&(priv->rtllib->PowerSaveControl));
- unsigned long flag = 0;
- bool turnonbypowerdomain = false;
-
-
-#ifdef CONFIG_RTL_RFKILL
- return;
-#endif
- if ((priv->up_first_time == 1) || (priv->being_init_adapter))
- {
- ;
- return;
- }
-
- if (priv->ResetProgress == RESET_TYPE_SILENT)
- {
- RT_TRACE((COMP_INIT | COMP_POWER | COMP_RF), "GPIOChangeRFWorkItemCallBack(): Silent Reseting!!!!!!!\n");
- return;
- }
-
-
- if (pPSC->bSwRfProcessing)
- {
- RT_TRACE(COMP_SCAN, "GPIOChangeRFWorkItemCallBack(): Rf is in switching state.\n");
- return;
- }
-
- RT_TRACE(COMP_RF, "GPIOChangeRFWorkItemCallBack() ---------> \n");
-
- spin_lock_irqsave(&priv->rf_ps_lock,flag);
- if (priv->RFChangeInProgress) {
- spin_unlock_irqrestore(&priv->rf_ps_lock,flag);
- RT_TRACE(COMP_RF, "GPIOChangeRFWorkItemCallBack(): RF Change in progress! \n");
- return;
- } else {
- priv->RFChangeInProgress = true;
- spin_unlock_irqrestore(&priv->rf_ps_lock,flag);
- }
- CurRfState = priv->rtllib->eRFPowerState;
-#ifdef CONFIG_ASPM_OR_D3
- if ((pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_ASPM) && RT_IN_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_ASPM))
- {
- RT_DISABLE_ASPM(dev);
- RT_CLEAR_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_ASPM);
- }
-
-#endif
- if (RT_IN_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_HALT_NIC))
- {
- Power_DomainInit92SE(dev);
- turnonbypowerdomain = true;
- }
-
- eRfPowerStateToSet = RfOnOffDetect(dev);
- if (priv->bResetInProgress) {
- spin_lock_irqsave(&priv->rf_ps_lock,flag);
- priv->RFChangeInProgress = false;
- spin_unlock_irqrestore(&priv->rf_ps_lock,flag);
- return;
- }
-
- if ( (priv->bHwRadioOff == true) && \
- (((eRfPowerStateToSet == eRfOn)&&(priv->sw_radio_on == true))
-#ifdef CONFIG_RTLWIFI_DEBUGFS
- ||priv->debug->hw_holding
-#endif
- ))
- {
- RT_TRACE(COMP_RF, "GPIOChangeRF - HW Radio ON, RF ON\n");
- printk("GPIOChangeRF - HW Radio ON, RF ON\n");
- eRfPowerStateToSet = eRfOn;
- bActuallySet = true;
- } else if ((priv->bHwRadioOff == false) &&
- ((eRfPowerStateToSet == eRfOff) || (priv->sw_radio_on == false)))
- {
- RT_TRACE(COMP_RF, "GPIOChangeRF - HW Radio OFF\n");
- printk("GPIOChangeRF - HW Radio OFF\n");
- eRfPowerStateToSet = eRfOff;
- bActuallySet = true;
- }
-
- if (bActuallySet) {
- priv->bHwRfOffAction = 1;
-#ifdef CONFIG_ASPM_OR_D3
- if (eRfPowerStateToSet == eRfOn) {
- if ((pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_ASPM) &&
- RT_IN_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_ASPM)) {
- RT_DISABLE_ASPM(dev);
- RT_CLEAR_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_ASPM);
- }
- }
-#endif
- spin_lock_irqsave(&priv->rf_ps_lock,flag);
- priv->RFChangeInProgress = false;
- spin_unlock_irqrestore(&priv->rf_ps_lock,flag);
- MgntActSet_RF_State(dev, eRfPowerStateToSet, RF_CHANGE_BY_HW,true);
-
- {
-#ifdef CONFIG_CFG_80211
- struct wireless_dev *wdev = &priv->rtllib->wdev;
- wiphy_rfkill_set_hw_state(wdev->wiphy, priv->bHwRadioOff);
-#else
- char *argv[3];
- static char *RadioPowerPath = "/etc/acpi/events/RadioPower.sh";
- static char *envp[] = {"HOME=/", "TERM=linux", "PATH=/usr/bin:/bin", NULL};
-
- if (priv->bHwRadioOff == true)
- argv[1] = "RFOFF";
- else
- argv[1] = "RFON";
-
- argv[0] = RadioPowerPath;
- argv[2] = NULL;
- call_usermodehelper(RadioPowerPath,argv,envp,1);
-
-#endif
- }
-
- if (eRfPowerStateToSet == eRfOff)
- {
- if (priv->pwrdown)
- write_nic_byte(dev, SYS_FUNC_EN+1, 0x31);
-#ifdef CONFIG_ASPM_OR_D3
- if (pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_ASPM) {
- RT_ENABLE_ASPM(dev);
- RT_SET_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_ASPM);
- }
-#endif
- }
- } else if (eRfPowerStateToSet == eRfOff || CurRfState == eRfOff ||
- priv->bDriverIsGoingToUnload) {
-
- if (pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_HALT_NIC &&
- turnonbypowerdomain) {
- PHY_SetRtl8192seRfHalt(dev);
- RT_SET_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_HALT_NIC);
- }
-#ifdef CONFIG_ASPM_OR_D3
- if (pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_ASPM) {
- RT_ENABLE_ASPM(dev);
- RT_SET_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_ASPM);
- }
-#endif
- spin_lock_irqsave(&priv->rf_ps_lock,flag);
- priv->RFChangeInProgress = false;
- spin_unlock_irqrestore(&priv->rf_ps_lock,flag);
- } else {
- spin_lock_irqsave(&priv->rf_ps_lock,flag);
- priv->RFChangeInProgress = false;
- spin_unlock_irqrestore(&priv->rf_ps_lock,flag);
- }
- RT_TRACE(COMP_RF, "GPIOChangeRFWorkItemCallBack() <--------- \n");
-}
#endif
void dm_rf_pathcheck_workitemcallback(void *data)
{
extern void init_rate_adaptive(struct net_device *dev);
extern void dm_txpower_trackingcallback(void *data);
-#ifndef RTL8192SE
extern void dm_cck_txpower_adjust(struct net_device *dev,bool binch14);
-#endif
extern void dm_restore_dynamic_mechanism_state(struct net_device *dev);
extern void dm_backup_dynamic_mechanism_state(struct net_device *dev);
extern void dm_shadow_init(struct net_device *dev);
extern void dm_initialize_txpower_tracking(struct net_device *dev);
-#if (defined RTL8192E || defined RTL8192SE)
extern void dm_CheckRfCtrlGPIO(void *data);
-#endif
-
-#ifdef RTL8192SE
-extern void Power_DomainInit92SE(struct net_device *dev);
-#endif
extern void dm_InitRateAdaptiveMask(struct net_device * dev);
u32 PlatformResetPciSpace(struct net_device *dev,u8 Value);
#endif
-#if defined(RTL8192E) || defined(RTL8192SE) || defined RTL8192CE
void rtl8192_hw_wakeup(struct net_device *dev);
void rtl8192_hw_to_sleep(struct net_device *dev, u32 th, u32 tl);
void rtllib_ips_leave_wq(struct net_device *dev);
void rtllib_ips_leave(struct net_device *dev);
void IPSLeave_wq (void *data);
-#endif
void IPSEnter(struct net_device *dev);
void IPSLeave(struct net_device *dev);
adhoc_peer_entry_t Entry[MAX_ADHOC_PEER_NUM];
unsigned char num;
} adhoc_peers_info_t, *p_adhoc_peers_info_t;
+
int r8192_wx_get_adhoc_peers(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-#ifndef RTL8192SE
- return 0;
-#else
- struct r8192_priv *priv = rtllib_priv(dev);
- struct sta_info * psta = NULL;
- adhoc_peers_info_t adhoc_peers_info;
- p_adhoc_peers_info_t padhoc_peers_info = &adhoc_peers_info;
- p_adhoc_peer_entry_t padhoc_peer_entry = NULL;
- int k=0;
-
-
- memset(extra, 0, 2047);
- padhoc_peers_info->num = 0;
-
- down(&priv->wx_sem);
-
- for (k=0; k<PEER_MAX_ASSOC; k++)
- {
- psta = priv->rtllib->peer_assoc_list[k];
- if (NULL != psta)
- {
- padhoc_peer_entry = &padhoc_peers_info->Entry[padhoc_peers_info->num];
- memset(padhoc_peer_entry,0, sizeof(adhoc_peer_entry_t));
- memcpy(padhoc_peer_entry->MacAddr, psta->macaddr, ETH_ALEN);
- padhoc_peer_entry->WirelessMode = psta->wireless_mode;
- padhoc_peer_entry->bCurTxBW40MHz = psta->htinfo.bCurTxBW40MHz;
- padhoc_peers_info->num ++;
- printk("[%d] MacAddr:"MAC_FMT" \tWirelessMode:%d \tBW40MHz:%d \n", \
- k, MAC_ARG(padhoc_peer_entry->MacAddr), padhoc_peer_entry->WirelessMode, padhoc_peer_entry->bCurTxBW40MHz);
- sprintf(extra, "[%d] MacAddr:"MAC_FMT" \tWirelessMode:%d \tBW40MHz:%d \n", \
- k, MAC_ARG(padhoc_peer_entry->MacAddr), padhoc_peer_entry->WirelessMode, padhoc_peer_entry->bCurTxBW40MHz);
- }
- }
-
- up(&priv->wx_sem);
-
- wrqu->data.length = strlen(extra);
- wrqu->data.flags = 0;
return 0;
-
-#endif
}
struct rtllib_rx_stats *stats);
void rtllib_indicate_packets(struct rtllib_device *ieee, struct rtllib_rxb** prxbIndicateArray,u8 index);
-#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE)
-extern void IbssAgeFunction(struct rtllib_device *ieee);
-extern struct sta_info *GetStaInfo(struct rtllib_device *ieee, u8 *addr);
-extern void DelStaInfoList(struct rtllib_device *ieee);
-extern void DelStaInfo(struct rtllib_device *ieee, u8 *addr);
-#endif
extern u8 HTFilterMCSRate( struct rtllib_device* ieee, u8* pSupportMCS, u8* pOperateMCS);
extern void HTUseDefaultSetting(struct rtllib_device* ieee);
#define RT_ASOC_RETRY_LIMIT 5
struct net_device *dev = ieee->dev;
struct rtllib_hdr_4addr *hdr = (struct rtllib_hdr_4addr *)skb->data;
struct rtllib_crypt_data *crypt = NULL;
-#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE)
- struct sta_info * psta = NULL;
-#endif
struct rtllib_rxb* rxb = NULL;
PRX_TS_RECORD pTS = NULL;
u16 fc, sc, SeqNum = 0;
}
}
-#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
-
/* Get crypt if encrypted */
ret = rtllib_rx_get_crypt(ieee, skb, &crypt, hdrlen);
if (ret == -1)
return (WLAN_FC_GET_STYPE(le16_to_cpu(fc)) == RTLLIB_STYPE_BEACON);
}
-#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE)
-u8 AsocEntry_ComputeSum(u8 *paddr)
-{
- u32 sum;
-
- sum = paddr[0]+
- paddr[1]+
- paddr[2]+
- paddr[3]+
- paddr[4]+
- paddr[5];
-
- return (u8)(sum % PEER_MAX_ASSOC);
-}
-u8 AsocEntry_AssignAvailableAID(struct rtllib_device *ieee, u8 *paddr)
-{
- int i;
-
- for (i = 0; i < PEER_MAX_ASSOC; i++)
- {
- if (ieee->AvailableAIDTable[i] == 99)
- {
- ieee->AvailableAIDTable[i] = AsocEntry_ComputeSum(paddr);
- return i+1;
- }
- }
-
- return 1;
-}
-
-void InitStaInfo(struct rtllib_device *ieee,int index)
-{
- int idx = index;
- ieee->peer_assoc_list[idx]->StaDataRate = 0;
- ieee->peer_assoc_list[idx]->StaSS = 0;
- ieee->peer_assoc_list[idx]->RetryFrameCnt = 0;
- ieee->peer_assoc_list[idx]->NoRetryFrameCnt = 0;
- ieee->peer_assoc_list[idx]->LastRetryCnt = 0;
- ieee->peer_assoc_list[idx]->LastNoRetryCnt = 0;
- ieee->peer_assoc_list[idx]->AvgRetryRate = 0;
- ieee->peer_assoc_list[idx]->LastRetryRate = 0;
- ieee->peer_assoc_list[idx]->txRateIndex = 11;
- ieee->peer_assoc_list[idx]->APDataRate = 0x2;
- ieee->peer_assoc_list[idx]->ForcedDataRate = 0x2;
-
-}
-static u8 IsStaInfoExist(struct rtllib_device *ieee, u8 *addr)
-{
- int k=0;
- struct sta_info * psta = NULL;
- u8 sta_idx = PEER_MAX_ASSOC;
-
- for (k=0; k<PEER_MAX_ASSOC; k++)
- {
- psta = ieee->peer_assoc_list[k];
- if (NULL != psta)
- {
- if (memcmp(addr, psta->macaddr, ETH_ALEN) == 0)
- {
- sta_idx = k;
- break;
- }
- }
- }
- return sta_idx;
-}
-static u8 GetFreeStaInfoIdx(struct rtllib_device *ieee, u8 *addr)
-{
- int k = 0;
- while((ieee->peer_assoc_list[k] != NULL) && (k < PEER_MAX_ASSOC))
- k++;
- printk("%s: addr:"MAC_FMT" index: %d\n", __func__, MAC_ARG(addr), k);
- return k;
-}
-struct sta_info *GetStaInfo(struct rtllib_device *ieee, u8 *addr)
-{
- int k=0;
- struct sta_info * psta = NULL;
- struct sta_info * psta_find = NULL;
-
- for (k=0; k<PEER_MAX_ASSOC; k++)
- {
- psta = ieee->peer_assoc_list[k];
- if (NULL != psta)
- {
- if (memcmp(addr, psta->macaddr, ETH_ALEN) == 0)
- {
- psta_find = psta;
- break;
- }
- }
- }
- return psta_find;
-}
-void DelStaInfoList(struct rtllib_device *ieee)
-{
- int idx = 0;
- struct sta_info * AsocEntry = NULL;
-
- atomic_set(&ieee->AsocEntryNum, 0);
- for (idx=0; idx<PEER_MAX_ASSOC; idx++){
- AsocEntry = ieee->peer_assoc_list[idx];
- if (NULL != AsocEntry){
- kfree(AsocEntry);
- ieee->peer_assoc_list[idx] = NULL;
- }
- ieee->AvailableAIDTable[idx] = 99;
- }
-}
-void DelStaInfo(struct rtllib_device *ieee, u8 *addr)
-{
- struct sta_info * psta = NULL;
- int k=0;
-
- for (k=0; k<PEER_MAX_ASSOC; k++)
- {
- psta = ieee->peer_assoc_list[k];
- if (NULL != psta){
- if (memcmp(addr, psta->macaddr, ETH_ALEN) == 0){
- if (psta->aid > 0 && psta->aid-1 < PEER_MAX_ASSOC)
- ieee->AvailableAIDTable[psta->aid-1] = 99;
- else
- printk("%s(): clear non-existing entry AID\n", __func__);
-
- kfree(psta);
- ieee->peer_assoc_list[k] = NULL;
- atomic_dec(&ieee->AsocEntryNum);
- }
- }
- }
-}
-void IbssAgeFunction(struct rtllib_device *ieee)
-{
- struct sta_info* AsocEntry = NULL;
- int idx;
- unsigned long CurrentTime;
- signed long TimeDifference;
- struct rtllib_network *target;
-
- CurrentTime = jiffies;
-
- for (idx = 0; idx < PEER_MAX_ASSOC; idx++)
- {
- AsocEntry = ieee->peer_assoc_list[idx];
- if (AsocEntry)
- {
- TimeDifference = jiffies_to_msecs(CurrentTime - AsocEntry->LastActiveTime);
-
- if (TimeDifference > 20000)
- {
- printk("IbssAgeFunction(): "MAC_FMT" timeout\n", MAC_ARG(AsocEntry->macaddr));
- kfree(AsocEntry);
- ieee->peer_assoc_list[idx] = NULL;
- atomic_dec(&ieee->AsocEntryNum);
-
- if (atomic_read(&ieee->AsocEntryNum) == 0){
-
- down(&ieee->wx_sem);
- rtllib_stop_protocol(ieee,true);
-
- list_for_each_entry(target, &ieee->network_list, list) {
- if (is_same_network(target, &ieee->current_network,(target->ssid_len?1:0))){
- printk("delete sta of previous Ad-hoc\n");
- list_del(&target->list);
- break;
- }
- }
-
- rtllib_start_protocol(ieee);
- up(&ieee->wx_sem);
- }
- }
- }
- }
-
-#ifdef TO_DO_LIST
- if (AsocEntry_AnyStationAssociated(pMgntInfo)==false)
- DrvIFIndicateDisassociation(Adapter, unspec_reason);
-
- if (pMgntInfo->dot11CurrentWirelessMode == WIRELESS_MODE_G ||
- (IS_WIRELESS_MODE_N_24G(Adapter) && pMgntInfo->pHTInfo->bCurSuppCCK) )
- {
- if (nBModeStaCnt == 0)
- {
- pMgntInfo->bUseProtection = false;
- ActUpdate_mCapInfo(Adapter, pMgntInfo->mCap);
- }
- }
-
- if (IS_WIRELESS_MODE_N_24G(Adapter) || IS_WIRELESS_MODE_N_5G(Adapter) )
- {
- if (nLegacyStaCnt > 0)
- {
- pMgntInfo->pHTInfo->CurrentOpMode = HT_OPMODE_MIXED;
- }
- else
- {
- if ((pMgntInfo->pHTInfo->bCurBW40MHz) && (n20MHzStaCnt > 0))
- pMgntInfo->pHTInfo->CurrentOpMode = HT_OPMODE_40MHZ_PROTECT;
- else
- pMgntInfo->pHTInfo->CurrentOpMode = HT_OPMODE_NO_PROTECT;
-
- }
- }
-
- if (IS_WIRELESS_MODE_G(Adapter) ||
- (IS_WIRELESS_MODE_N_24G(Adapter) && pMgntInfo->pHTInfo->bCurSuppCCK))
- {
- if (pMgntInfo->bUseProtection)
- {
- u8 CckRate[4] = { MGN_1M, MGN_2M, MGN_5_5M, MGN_11M };
- OCTET_STRING osCckRate;
- FillOctetString(osCckRate, CckRate, 4);
- FilterSupportRate(pMgntInfo->mBrates, &osCckRate, false);
- Adapter->HalFunc.SetHwRegHandler(Adapter, HW_VAR_BASIC_RATE, (pu1Byte)&osCckRate);
- }
- else
- {
- Adapter->HalFunc.SetHwRegHandler( Adapter, HW_VAR_BASIC_RATE, (pu1Byte)(&pMgntInfo->mBrates) );
- }
- }
-#endif
-}
-#endif
-
static int IsPassiveChannel( struct rtllib_device *rtllib, u8 channel)
{
if (MAX_CHANNEL_NUMBER < channel) {
* already there. */
spin_lock_irqsave(&ieee->lock, flags);
-#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE)
- if (is_beacon(beacon->header.frame_ctl)){
- if ((ieee->iw_mode == IW_MODE_ADHOC) && (ieee->state == RTLLIB_LINKED))
- {
- if ((network->ssid_len == ieee->current_network.ssid_len)
- && (!memcmp(network->ssid,ieee->current_network.ssid,ieee->current_network.ssid_len))
- && (network->channel == ieee->current_network.channel)
- && (ieee->current_network.channel > 0)
- && (ieee->current_network.channel <= 14))
- {
- if (!memcmp(ieee->current_network.bssid,network->bssid,6))
- {
- int idx = 0;
- struct rtllib_hdr_3addr* header = NULL;
- int idx_exist = 0;
- if (timer_pending(&ieee->ibss_wait_timer))
- del_timer_sync(&ieee->ibss_wait_timer);
- header = (struct rtllib_hdr_3addr*)&(beacon->header);
- idx_exist = IsStaInfoExist(ieee,header->addr2);
- if (idx_exist >= PEER_MAX_ASSOC) {
- idx = GetFreeStaInfoIdx(ieee, header->addr2);
- } else {
- ieee->peer_assoc_list[idx_exist]->LastActiveTime = jiffies;
- goto no_alloc;
- }
- if (idx >= PEER_MAX_ASSOC - 1) {
- printk("\n%s():ERR!!!Buffer overflow - could not append!!!",__func__);
- goto free_network;
- } else {
- ieee->peer_assoc_list[idx] = (struct sta_info *)kmalloc(sizeof(struct sta_info), GFP_ATOMIC);
- memset(ieee->peer_assoc_list[idx], 0, sizeof(struct sta_info));
- ieee->peer_assoc_list[idx]->LastActiveTime = jiffies;
- memcpy(ieee->peer_assoc_list[idx]->macaddr,header->addr2,ETH_ALEN);
- ieee->peer_assoc_list[idx]->ratr_index = 8;
- InitStaInfo(ieee,idx);
- atomic_inc(&ieee->AsocEntryNum);
- ieee->peer_assoc_list[idx]->aid = AsocEntry_AssignAvailableAID(ieee, ieee->peer_assoc_list[idx]->macaddr);
- ieee->check_ht_cap(ieee->dev,ieee->peer_assoc_list[idx],network);
- queue_delayed_work_rsl(ieee->wq, &ieee->update_assoc_sta_info_wq, 0);
- ieee->Adhoc_InitRateAdaptive(ieee->dev,ieee->peer_assoc_list[idx]);
- }
- }
- }
- }
- }
- if (ieee->iw_mode == IW_MODE_ADHOC){
- if ((network->ssid_len == ieee->current_network.ssid_len)
- && (!memcmp(network->ssid,ieee->current_network.ssid,ieee->current_network.ssid_len))
- && (network->capability & WLAN_CAPABILITY_IBSS)
- && (ieee->state == RTLLIB_LINKED_SCANNING))
- {
- if (memcmp(ieee->current_network.bssid,network->bssid,6))
- {
- printk("%s(): SSID matched but BSSID mismatched.\n",__func__);
-
- ieee->TargetTsf = beacon->time_stamp[1];
- ieee->TargetTsf <<= 32;
- ieee->TargetTsf |= beacon->time_stamp[0];
-
- ieee->CurrTsf = stats->TimeStampLow;
-
- queue_delayed_work_rsl(ieee->wq, &ieee->check_tsf_wq, 0);
- }
- }
- }
-#endif
-#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE)
-no_alloc:
- if (ieee->iw_mode == IW_MODE_INFRA)
-#endif
{
if (is_same_network(&ieee->current_network, network, (network->ssid_len?1:0))) {
update_network(&ieee->current_network, network);
}
}
}
-#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE)
- else if (ieee->iw_mode == IW_MODE_ADHOC)
- {
- if (is_same_network(&ieee->current_network, network, (network->ssid_len?1:0))) {
- update_ibss_network(&ieee->current_network, network);
- }
- }
-#endif
list_for_each_entry(target, &ieee->network_list, list) {
if (is_same_network(target, network,(target->ssid_len?1:0)))
break;
*(tag++) = 1;
*(tag++) = erpinfo_content;
}
-#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE)
- if (tmp_ht_cap_len){
- *(tag++) = MFIE_TYPE_HT_CAP;
- *(tag++) = tmp_ht_cap_len - 2;
- memcpy(tag, tmp_ht_cap_buf, tmp_ht_cap_len - 2);
- tag += tmp_ht_cap_len - 2;
- }
-#endif
if (rate_ex_len){
*(tag++) = MFIE_TYPE_RATES_EX;
*(tag++) = rate_ex_len-2;
tag+=rate_ex_len-2;
}
-#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE)
- if (tmp_ht_info_len){
- *(tag++) = MFIE_TYPE_HT_INFO;
- *(tag++) = tmp_ht_info_len - 2;
- memcpy(tag, tmp_ht_info_buf, tmp_ht_info_len -2);
- tag += tmp_ht_info_len - 2;
- }
-#endif
-
if (wpa_ie_len)
{
if (ieee->iw_mode == IW_MODE_ADHOC)
tag += ieee->wpa_ie_len;
}
-#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE)
- if (tmp_generic_ie_len)
- {
- (*tag++) = 0xdd;
- (*tag++) = tmp_generic_ie_len - 2;
- memcpy(tag,tmp_generic_ie_buf,tmp_generic_ie_len -2);
- tag += tmp_generic_ie_len -2;
-
- }
-#endif
-
-#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE)
- if (wmm_len) {
- memcpy(tag,wmmie,wmm_len);
- tag += wmm_len;
- }
-#endif
return skb;
}
void rtllib_rx_probe_rq(struct rtllib_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
-#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE)
- struct sta_info *psta = NULL;
-#endif
ieee->softmac_stats.rx_probe_rq++;
if (probe_rq_parse(ieee, skb, dest) > 0){
ieee->softmac_stats.tx_probe_rs++;
rtllib_resp_to_probe(ieee, dest);
-#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE)
- if (ieee->iw_mode == IW_MODE_ADHOC){
- psta = GetStaInfo(ieee, dest);
- if (NULL != psta)
- psta->LastActiveTime = jiffies;
- }
-#endif
}
}
ieee->rate = 22;
}
-#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE)
-#ifdef ADHOC_11N
- ieee->current_network.qos_data.supported = 1;
-#else
- ieee->current_network.qos_data.supported = 0;
-#endif
- ieee->SetWirelessMode(ieee->dev, ieee->mode);
-#else
ieee->current_network.qos_data.supported = 0;
ieee->SetWirelessMode(ieee->dev, IEEE_G);
-#endif
ieee->current_network.mode = ieee->mode;
ieee->current_network.atim_window = 0;
ieee->current_network.capability = WLAN_CAPABILITY_IBSS;
union iwreq_data *wrqu, char *extra)
{
u32 tmp_rate = 0;
-#if defined RTL8192SU
- if (ieee->mode & (IEEE_A | IEEE_B | IEEE_G))
- tmp_rate = ieee->rate;
- else if (ieee->mode & IEEE_N_5G)
- tmp_rate = 580;
- else if (ieee->mode & IEEE_N_24G) {
- if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))
- tmp_rate = HTHalfMcsToDataRate(ieee, 15);
- else
- tmp_rate = HTMcsToDataRate(ieee, 15);
- }
-#elif defined RTL8192SE || defined RTL8192CE
- tmp_rate = ieee->rtl_11n_user_show_rates(ieee->dev);
-#else
tmp_rate = TxCountToDataRate(ieee, ieee->softmac_stats.CurrentShowTxate);
-#endif
wrqu->bitrate.value = tmp_rate * 500000;
return 0;
tcb_desc->bPacketBW = true;
return;
}
-#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE)
-extern void rtllib_ibss_query_HTCapShortGI(struct rtllib_device *ieee, cb_desc *tcb_desc,u8 is_peer_shortGI_40M,u8 is_peer_shortGI_20M)
-{
- PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
-
- tcb_desc->bUseShortGI = false;
-
- if (!pHTInfo->bCurrentHTSupport||!pHTInfo->bEnableHT || (ieee->iw_mode != IW_MODE_ADHOC))
- {
- return;
- }
- if (pHTInfo->bForcedShortGI)
- {
- tcb_desc->bUseShortGI = true;
- return;
- }
- if ((pHTInfo->bCurBW40MHz==true) && is_peer_shortGI_40M)
- tcb_desc->bUseShortGI = true;
- else if ((pHTInfo->bCurBW40MHz==false) && is_peer_shortGI_20M)
- tcb_desc->bUseShortGI = true;
-}
-void rtllib_ibss_query_BandwidthMode(struct rtllib_device* ieee, cb_desc *tcb_desc, u8 is_peer_40M)
-{
- PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
-
- tcb_desc->bPacketBW = false;
-
- if (!pHTInfo->bCurrentHTSupport||!pHTInfo->bEnableHT || (ieee->iw_mode != IW_MODE_ADHOC))
- {
- return;
- }
-
- if (tcb_desc->bMulticast || tcb_desc->bBroadcast)
- {
- return;
- }
-
- if ((tcb_desc->data_rate & 0x80)==0)
- {
- return;
- }
- if (pHTInfo->bCurBW40MHz && is_peer_40M && !ieee->bandwidth_auto_switch.bforced_tx20Mhz)
- tcb_desc->bPacketBW = true;
- return;
-}
-#endif
void rtllib_query_protectionmode(struct rtllib_device* ieee, cb_desc* tcb_desc, struct sk_buff* skb)
{
tcb_desc->bRTSSTBC = false;
}
-#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE)
-void rtllib_txrate_selectmode(struct rtllib_device* ieee, cb_desc* tcb_desc,struct sta_info *psta)
-#else
void rtllib_txrate_selectmode(struct rtllib_device* ieee, cb_desc* tcb_desc)
-#endif
{
#ifdef TO_DO_LIST
if (!IsDataFrame(pFrame))
tcb_desc->bMulticast = 1;
if (is_broadcast_ether_addr(header.addr1))
tcb_desc->bBroadcast = 1;
-#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE)
- if ( tcb_desc->bMulticast || tcb_desc->bBroadcast){
- rtllib_txrate_selectmode(ieee, tcb_desc, p_sta);
- tcb_desc->data_rate = ieee->basic_rate;
- }
- else
- {
- if (ieee->iw_mode == IW_MODE_ADHOC)
- {
- u8 is_peer_shortGI_40M = 0;
- u8 is_peer_shortGI_20M = 0;
- u8 is_peer_BW_40M = 0;
- p_sta = GetStaInfo(ieee, header.addr1);
- if (NULL == p_sta)
- {
- rtllib_txrate_selectmode(ieee, tcb_desc, p_sta);
- tcb_desc->data_rate = ieee->rate;
- }
- else
- {
- rtllib_txrate_selectmode(ieee, tcb_desc, p_sta);
- tcb_desc->data_rate = CURRENT_RATE(p_sta->wireless_mode, p_sta->CurDataRate, p_sta->htinfo.HTHighestOperaRate);
- is_peer_shortGI_40M = p_sta->htinfo.bCurShortGI40MHz;
- is_peer_shortGI_20M = p_sta->htinfo.bCurShortGI20MHz;
- is_peer_BW_40M = p_sta->htinfo.bCurTxBW40MHz;
- }
- rtllib_qurey_ShortPreambleMode(ieee, tcb_desc);
- rtllib_tx_query_agg_cap(ieee, txb->fragments[0], tcb_desc);
- rtllib_ibss_query_HTCapShortGI(ieee, tcb_desc,is_peer_shortGI_40M,is_peer_shortGI_20M);
- rtllib_ibss_query_BandwidthMode(ieee, tcb_desc,is_peer_BW_40M);
- rtllib_query_protectionmode(ieee, tcb_desc, txb->fragments[0]);
- }
- else {
- rtllib_txrate_selectmode(ieee, tcb_desc, p_sta);
- tcb_desc->data_rate = CURRENT_RATE(ieee->mode, ieee->rate, ieee->HTCurrentOperaRate);
- if (bdhcp == true){
- if (ieee->pHTInfo->IOTAction & HT_IOT_ACT_WA_IOT_Broadcom) {
- tcb_desc->data_rate = MGN_1M;
- tcb_desc->bTxDisableRateFallBack = false;
- }else{
- tcb_desc->data_rate = MGN_1M;
- tcb_desc->bTxDisableRateFallBack = 1;
- }
-
- tcb_desc->RATRIndex = 7;
- tcb_desc->bTxUseDriverAssingedRate = 1;
- tcb_desc->bdhcp = 1;
- }
- rtllib_qurey_ShortPreambleMode(ieee, tcb_desc);
- rtllib_tx_query_agg_cap(ieee, txb->fragments[0], tcb_desc);
- rtllib_query_HTCapShortGI(ieee, tcb_desc);
- rtllib_query_BandwidthMode(ieee, tcb_desc);
- rtllib_query_protectionmode(ieee, tcb_desc, txb->fragments[0]);
- }
- }
-#else
rtllib_txrate_selectmode(ieee, tcb_desc);
if ( tcb_desc->bMulticast || tcb_desc->bBroadcast)
tcb_desc->data_rate = ieee->basic_rate;
rtllib_query_HTCapShortGI(ieee, tcb_desc);
rtllib_query_BandwidthMode(ieee, tcb_desc);
rtllib_query_protectionmode(ieee, tcb_desc, txb->fragments[0]);
-#endif
}
}
spin_unlock_irqrestore(&ieee->lock, flags);