INVAILD_TRIGGER_MAC_ENTRY *RepeaterInvaildMacLookup( IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr) { ULONG HashIdx; INVAILD_TRIGGER_MAC_ENTRY *pEntry = NULL; HashIdx = MAC_ADDR_HASH_INDEX(pAddr); pEntry = pAd->ApCfg.ReptControl.ReptInvaildHash[HashIdx]; while (pEntry) { if (MAC_ADDR_EQUAL(pEntry->MacAddr, pAddr)) { break; } else pEntry = pEntry->pNext; } if (pEntry && pEntry->bInsert) return pEntry; else return NULL; }
MAC_TABLE_ENTRY *WdsTableLookup(RTMP_ADAPTER *pAd, UCHAR *addr, BOOLEAN bResetIdelCount) { USHORT HashIdx; PMAC_TABLE_ENTRY pEntry = NULL; NdisAcquireSpinLock(&pAd->WdsTabLock); NdisAcquireSpinLock(&pAd->MacTabLock); HashIdx = MAC_ADDR_HASH_INDEX(addr); pEntry = pAd->MacTab.Hash[HashIdx]; while (pEntry) { if (IS_ENTRY_WDS(pEntry) && MAC_ADDR_EQUAL(pEntry->Addr, addr)) { if(bResetIdelCount) { pEntry->NoDataIdleCount = 0; // TODO: shiang-usw, remove upper setting becasue we need to migrate to tr_entry! pAd->MacTab.tr_entry[pEntry->wcid].NoDataIdleCount = 0; } break; } else pEntry = pEntry->pNext; } NdisReleaseSpinLock(&pAd->MacTabLock); NdisReleaseSpinLock(&pAd->WdsTabLock); return pEntry; }
MAC_TABLE_ENTRY *WdsTableLookup( IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr, IN BOOLEAN bResetIdelCount) { USHORT HashIdx; PMAC_TABLE_ENTRY pEntry = NULL; NdisAcquireSpinLock(&pAd->WdsTabLock); NdisAcquireSpinLock(&pAd->MacTabLock); HashIdx = MAC_ADDR_HASH_INDEX(pAddr); pEntry = pAd->MacTab.Hash[HashIdx]; while (pEntry) { if (IS_ENTRY_WDS(pEntry) && MAC_ADDR_EQUAL(pEntry->Addr, pAddr)) { if(bResetIdelCount) pEntry->NoDataIdleCount = 0; break; } else pEntry = pEntry->pNext; } NdisReleaseSpinLock(&pAd->MacTabLock); NdisReleaseSpinLock(&pAd->WdsTabLock); return pEntry; }
BOOLEAN RTMPRepeaterRemoveInvaildMacEntry( IN PRTMP_ADAPTER pAd, IN UCHAR idx, IN PUCHAR pAddr) { USHORT HashIdx; INVAILD_TRIGGER_MAC_ENTRY *pEntry = NULL; INVAILD_TRIGGER_MAC_ENTRY *pPrevEntry, *pProbeEntry; NdisAcquireSpinLock(&pAd->ApCfg.ReptCliEntryLock); HashIdx = MAC_ADDR_HASH_INDEX(pAddr); pEntry = &pAd->ApCfg.ReptControl.RepeaterInvaildEntry[idx]; if (pEntry && pEntry->bInsert) { pPrevEntry = NULL; pProbeEntry = pAd->ApCfg.ReptControl.ReptInvaildHash[HashIdx]; ASSERT(pProbeEntry); if (pProbeEntry != NULL) { /* update Hash list*/ do { if (pProbeEntry == pEntry) { if (pPrevEntry == NULL) { pAd->ApCfg.ReptControl.ReptInvaildHash[HashIdx] = pEntry->pNext; } else { pPrevEntry->pNext = pEntry->pNext; } break; } pPrevEntry = pProbeEntry; pProbeEntry = pProbeEntry->pNext; } while (pProbeEntry); } /* not found !!!*/ ASSERT(pProbeEntry != NULL); pAd->ApCfg.ReptControl.ReptInVaildMacSize--; } NdisZeroMemory(pEntry->MacAddr, MAC_ADDR_LEN); pEntry->bInsert = FALSE; NdisReleaseSpinLock(&pAd->ApCfg.ReptCliEntryLock); return TRUE; }
INT BndStrg_InsertEntry( PBND_STRG_CLI_TABLE table, PUCHAR pAddr, PBND_STRG_CLI_ENTRY *entry_out) { INT i; UCHAR HashIdx; PBND_STRG_CLI_ENTRY entry = NULL, this_entry = NULL; INT ret_val = BND_STRG_SUCCESS; if (table->Size >= BND_STRG_MAX_TABLE_SIZE) { DBGPRINT(RT_DEBUG_WARN, ("%s(): Table is full!\n", __FUNCTION__)); return BND_STRG_TABLE_FULL; } NdisAcquireSpinLock(&table->Lock); for (i = 0; i< BND_STRG_MAX_TABLE_SIZE; i++) { entry = &table->Entry[i]; /* pick up the first available vacancy*/ if (entry->bValid == FALSE) { NdisZeroMemory(entry, sizeof(BND_STRG_CLI_ENTRY)); /* Fill Entry */ RTMP_GetCurrentSystemTick(&entry->jiffies); COPY_MAC_ADDR(entry->Addr, pAddr); entry->bValid = TRUE; break; } } if (entry) { /* add this MAC entry into HASH table */ HashIdx = MAC_ADDR_HASH_INDEX(pAddr); if (table->Hash[HashIdx] == NULL) { table->Hash[HashIdx] = entry; } else { this_entry = table->Hash[HashIdx]; while (this_entry->pNext != NULL) { this_entry = this_entry->pNext; } this_entry->pNext = entry; } *entry_out = entry; table->Size++; } NdisReleaseSpinLock(&table->Lock); return ret_val; }
REPEATER_CLIENT_ENTRY *RTMPLookupRepeaterCliEntry( IN PRTMP_ADAPTER pAd, IN BOOLEAN bRealMAC, IN PUCHAR pAddr) { ULONG HashIdx; UCHAR tempMAC[6]; REPEATER_CLIENT_ENTRY *pEntry = NULL; REPEATER_CLIENT_ENTRY_MAP *pMapEntry = NULL; NdisAcquireSpinLock(&pAd->ApCfg.ReptCliEntryLock); COPY_MAC_ADDR(tempMAC, pAddr); HashIdx = MAC_ADDR_HASH_INDEX(tempMAC); if (bRealMAC == TRUE) { pMapEntry = pAd->ApCfg.ReptMapHash[HashIdx]; while (pMapEntry) { pEntry = pMapEntry->pReptCliEntry; if (pEntry->CliValid && MAC_ADDR_EQUAL(pEntry->OriginalAddress, tempMAC)) break; else { pEntry = NULL; pMapEntry = pMapEntry->pNext; } } } else { pEntry = pAd->ApCfg.ReptCliHash[HashIdx]; while (pEntry) { if (pEntry->CliValid && MAC_ADDR_EQUAL(pEntry->CurrentAddress, tempMAC)) break; else pEntry = pEntry->pNext; } } NdisReleaseSpinLock(&pAd->ApCfg.ReptCliEntryLock); return pEntry; }
/* ========================================================================== Description: Look up the MAC address in the MAC table. Return NULL if not found. Return: pEntry - pointer to the MAC entry; NULL is not found ========================================================================== */ MAC_TABLE_ENTRY *MacTableLookup(RTMP_ADAPTER *pAd, UCHAR *pAddr) { ULONG HashIdx; MAC_TABLE_ENTRY *pEntry = NULL; HashIdx = MAC_ADDR_HASH_INDEX(pAddr); pEntry = pAd->MacTab.Hash[HashIdx]; while (pEntry && !IS_ENTRY_NONE(pEntry)) { if (MAC_ADDR_EQUAL(pEntry->Addr, pAddr)) break; else pEntry = pEntry->pNext; } return pEntry; }
PBND_STRG_CLI_ENTRY BndStrg_TableLookup(PBND_STRG_CLI_TABLE table, PUCHAR pAddr) { ULONG HashIdx; BND_STRG_CLI_ENTRY *entry = NULL; HashIdx = MAC_ADDR_HASH_INDEX(pAddr); entry = table->Hash[HashIdx]; while (entry && entry->bValid) { if (MAC_ADDR_EQUAL(entry->Addr, pAddr)) break; else entry = entry->pNext; } return entry; }
VOID RTMPRepeaterInsertInvaildMacEntry( IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr) { UCHAR HashIdx, idx = 0; INVAILD_TRIGGER_MAC_ENTRY *pEntry = NULL; INVAILD_TRIGGER_MAC_ENTRY *pCurrEntry = NULL; if (pAd->ApCfg.ReptControl.ReptInVaildMacSize >= 32) return; if (MAC_ADDR_EQUAL(pAddr, ZERO_MAC_ADDR)) return; NdisAcquireSpinLock(&pAd->ApCfg.ReptCliEntryLock); for (idx = 0; idx< 32; idx++) { pEntry = &pAd->ApCfg.ReptControl.RepeaterInvaildEntry[idx]; if (MAC_ADDR_EQUAL(pEntry->MacAddr, pAddr)) { if (pEntry->bInsert) { NdisReleaseSpinLock(&pAd->ApCfg.ReptCliEntryLock); return; } else { pEntry->bInsert = TRUE; break; } } /* pick up the first available vacancy*/ if (pEntry->bInsert == FALSE) { NdisZeroMemory(pEntry->MacAddr, MAC_ADDR_LEN); COPY_MAC_ADDR(pEntry->MacAddr, pAddr); pEntry->bInsert = TRUE; break; } } /* add this entry into HASH table */ if (pEntry) { HashIdx = MAC_ADDR_HASH_INDEX(pAddr); pEntry->pNext = NULL; if (pAd->ApCfg.ReptControl.ReptInvaildHash[HashIdx] == NULL) { pAd->ApCfg.ReptControl.ReptInvaildHash[HashIdx] = pEntry; } else { pCurrEntry = pAd->ApCfg.ReptControl.ReptInvaildHash[HashIdx]; while (pCurrEntry->pNext != NULL) pCurrEntry = pCurrEntry->pNext; pCurrEntry->pNext = pEntry; } } DBGPRINT(RT_DEBUG_ERROR, (" Store Invaild MacAddr = %02x:%02x:%02x:%02x:%02x:%02x. !!!\n", PRINT_MAC(pEntry->MacAddr))); pAd->ApCfg.ReptControl.ReptInVaildMacSize++; NdisReleaseSpinLock(&pAd->ApCfg.ReptCliEntryLock); return; }
MAC_TABLE_ENTRY *RTMPInsertRepeaterMacEntry( IN RTMP_ADAPTER *pAd, IN UCHAR *pAddr, IN struct wifi_dev *wdev, IN UCHAR apIdx, IN UCHAR cliIdx, IN BOOLEAN CleanAll) { UCHAR HashIdx; int i; MAC_TABLE_ENTRY *pEntry = NULL, *pCurrEntry; BOOLEAN Cancelled; /* if FULL, return*/ if (pAd->MacTab.Size >= MAX_LEN_OF_MAC_TABLE) return NULL; /* allocate one MAC entry*/ NdisAcquireSpinLock(&pAd->MacTabLock); i = (MAX_NUMBER_OF_MAC + ((MAX_EXT_MAC_ADDR_SIZE + 1) * (apIdx - MIN_NET_DEVICE_FOR_APCLI))); if (cliIdx != 0xFF) i = i + cliIdx + 1; /* pick up the first available vacancy*/ pEntry = &pAd->MacTab.Content[i]; if (pEntry == NULL) { printk("###### %s pEntry == NULL, i = %d\n", __func__, i); } if (pEntry && IS_ENTRY_NONE(pEntry)) { /* ENTRY PREEMPTION: initialize the entry */ if (pEntry->RetryTimer.Valid) RTMPCancelTimer(&pEntry->RetryTimer, &Cancelled); if (pEntry->EnqueueStartForPSKTimer.Valid) RTMPCancelTimer(&pEntry->EnqueueStartForPSKTimer, &Cancelled); NdisZeroMemory(pEntry, sizeof(MAC_TABLE_ENTRY)); if (CleanAll == TRUE) { pEntry->MaxSupportedRate = RATE_11; pEntry->CurrTxRate = RATE_11; NdisZeroMemory(pEntry, sizeof(MAC_TABLE_ENTRY)); pEntry->PairwiseKey.KeyLen = 0; pEntry->PairwiseKey.CipherAlg = CIPHER_NONE; } SET_ENTRY_APCLI(pEntry); pEntry->wdev = wdev; pEntry->wcid = i; pEntry->isCached = FALSE; pEntry->bIAmBadAtheros = FALSE; RTMPInitTimer(pAd, &pEntry->EnqueueStartForPSKTimer, GET_TIMER_FUNCTION(EnqueueStartForPSKExec), pEntry, FALSE); RTMPInitTimer(pAd, &pEntry->RetryTimer, GET_TIMER_FUNCTION(WPARetryExec), pEntry, FALSE); #ifdef TXBF_SUPPORT if (pAd->chipCap.FlgHwTxBfCap) RTMPInitTimer(pAd, &pEntry->eTxBfProbeTimer, GET_TIMER_FUNCTION(eTxBfProbeTimerExec), pEntry, FALSE); #endif /* TXBF_SUPPORT */ pEntry->pAd = pAd; pEntry->CMTimerRunning = FALSE; pEntry->EnqueueEapolStartTimerRunning = EAPOL_START_DISABLE; pEntry->RSNIE_Len = 0; NdisZeroMemory(pEntry->R_Counter, sizeof(pEntry->R_Counter)); pEntry->ReTryCounter = PEER_MSG1_RETRY_TIMER_CTR; pEntry->apidx = (apIdx - MIN_NET_DEVICE_FOR_APCLI); pEntry->pMbss = &pAd->ApCfg.MBSSID[pEntry->apidx]; pEntry->AuthMode = pAd->ApCfg.ApCliTab[pEntry->apidx].wdev.AuthMode; pEntry->WepStatus = pAd->ApCfg.ApCliTab[pEntry->apidx].wdev.WepStatus; pEntry->wdev_idx = pEntry->apidx; if (pEntry->AuthMode < Ndis802_11AuthModeWPA) { pEntry->WpaState = AS_NOTUSE; pEntry->PrivacyFilter = Ndis802_11PrivFilterAcceptAll; } else { pEntry->WpaState = AS_PTKSTART; pEntry->PrivacyFilter = Ndis802_11PrivFilter8021xWEP; } pEntry->GTKState = REKEY_NEGOTIATING; pEntry->PairwiseKey.KeyLen = 0; pEntry->PairwiseKey.CipherAlg = CIPHER_NONE; pEntry->PortSecured = WPA_802_1X_PORT_NOT_SECURED; pEntry->PMKID_CacheIdx = ENTRY_NOT_FOUND; COPY_MAC_ADDR(pEntry->Addr, pAddr); //COPY_MAC_ADDR(pEntry->HdrAddr1, pAddr); //COPY_MAC_ADDR(pEntry->HdrAddr2, pAd->ApCfg.ApCliTab[pEntry->apidx].CurrentAddress); //COPY_MAC_ADDR(pEntry->HdrAddr3, pAddr); COPY_MAC_ADDR(pEntry->bssid, pAddr); pEntry->Sst = SST_NOT_AUTH; pEntry->AuthState = AS_NOT_AUTH; pEntry->Aid = (USHORT)i; /*0;*/ pEntry->CapabilityInfo = 0; pEntry->PsMode = PWR_ACTIVE; pEntry->PsQIdleCount = 0; pEntry->NoDataIdleCount = 0; pEntry->AssocDeadLine = MAC_TABLE_ASSOC_TIMEOUT; pEntry->ContinueTxFailCnt = 0; pEntry->TimeStamp_toTxRing = 0; InitializeQueueHeader(&pEntry->PsQueue); #ifdef PS_ENTRY_MAITENANCE pEntry->continuous_ps_count = 0; #endif /* PS_ENTRY_MAITENANCE */ pAd->MacTab.Size ++; /* Set the security mode of this entry as OPEN-NONE in ASIC */ RTMP_REMOVE_PAIRWISE_KEY_ENTRY(pAd, (UCHAR)i); /* Add this entry into ASIC RX WCID search table */ RTMP_STA_ENTRY_ADD(pAd, pEntry); #ifdef WSC_AP_SUPPORT pEntry->bWscCapable = FALSE; pEntry->Receive_EapolStart_EapRspId = 0; #endif /* WSC_AP_SUPPORT */ #ifdef TXBF_SUPPORT if (pAd->chipCap.FlgHwTxBfCap) NdisAllocateSpinLock(pAd, &pEntry->TxSndgLock); #endif /* TXBF_SUPPORT */ #ifdef PEER_DELBA_TX_ADAPT Peer_DelBA_Tx_Adapt_Init(pAd, pEntry); #endif /* PEER_DELBA_TX_ADAPT */ #ifdef DROP_MASK_SUPPORT drop_mask_init_per_client(pAd, pEntry); #endif /* DROP_MASK_SUPPORT */ #ifdef FIFO_EXT_SUPPORT if (pAd->chipCap.FlgHwFifoExtCap) { UCHAR tblIdx; if ((cliIdx != 0xFF) && IsFifoExtTblAvailable(pAd, &tblIdx)) FifoExtTblUpdateEntry(pAd, tblIdx, i); } #endif DBGPRINT(RT_DEBUG_TRACE, ("%s - allocate entry #%d, Aid = %d, Wcid = %d Addr(%02x:%02x:%02x:%02x:%02x:%02x) Total= %d\n",__FUNCTION__, i, pEntry->Aid, pEntry->wcid, PRINT_MAC(pEntry->Addr), pAd->MacTab.Size)); } else { DBGPRINT(RT_DEBUG_ERROR, ("%s - exist entry #%d, Aid = %d, Total= %d\n", __FUNCTION__, i, pEntry->Aid, pAd->MacTab.Size)); NdisReleaseSpinLock(&pAd->MacTabLock); return pEntry; } /* add this MAC entry into HASH table */ if (pEntry) { pEntry->pNext = NULL; HashIdx = MAC_ADDR_HASH_INDEX(pAddr); if (pAd->MacTab.Hash[HashIdx] == NULL) { pAd->MacTab.Hash[HashIdx] = pEntry; } else { pCurrEntry = pAd->MacTab.Hash[HashIdx]; while (pCurrEntry->pNext != NULL) pCurrEntry = pCurrEntry->pNext; pCurrEntry->pNext = pEntry; } } NdisReleaseSpinLock(&pAd->MacTabLock); return pEntry; }
VOID RTMPRemoveRepeaterEntry( IN PRTMP_ADAPTER pAd, IN UCHAR apIdx, IN UCHAR CliIdx) { USHORT HashIdx; REPEATER_CLIENT_ENTRY *pEntry, *pPrevEntry, *pProbeEntry; REPEATER_CLIENT_ENTRY_MAP *pMapEntry, *pPrevMapEntry, *pProbeMapEntry; BOOLEAN bVaild; DBGPRINT(RT_DEBUG_OFF, (" %s. apIdx=%d CliIdx=%d\n", __FUNCTION__,apIdx,CliIdx)); RTMPRemoveRepeaterAsicEntry(pAd, CliIdx); NdisAcquireSpinLock(&pAd->ApCfg.ReptCliEntryLock); pEntry = &pAd->ApCfg.ApCliTab[apIdx].RepeaterCli[CliIdx]; bVaild = TRUE; HashIdx = MAC_ADDR_HASH_INDEX(pEntry->CurrentAddress); pPrevEntry = NULL; pProbeEntry = pAd->ApCfg.ReptCliHash[HashIdx]; ASSERT(pProbeEntry); if (pProbeEntry == NULL) { bVaild = FALSE; goto done; } if (pProbeEntry != NULL) { /* update Hash list*/ do { if (pProbeEntry == pEntry) { if (pPrevEntry == NULL) { pAd->ApCfg.ReptCliHash[HashIdx] = pEntry->pNext; } else { pPrevEntry->pNext = pEntry->pNext; } break; } pPrevEntry = pProbeEntry; pProbeEntry = pProbeEntry->pNext; } while (pProbeEntry); } /* not found !!!*/ ASSERT(pProbeEntry != NULL); if (pProbeEntry == NULL) { bVaild = FALSE; goto done; } pMapEntry = &pAd->ApCfg.ApCliTab[apIdx].RepeaterCliMap[CliIdx]; HashIdx = MAC_ADDR_HASH_INDEX(pEntry->OriginalAddress); pPrevMapEntry = NULL; pProbeMapEntry = pAd->ApCfg.ReptMapHash[HashIdx]; ASSERT(pProbeMapEntry); if (pProbeMapEntry != NULL) { /* update Hash list*/ do { if (pProbeMapEntry == pMapEntry) { if (pPrevMapEntry == NULL) { pAd->ApCfg.ReptMapHash[HashIdx] = pMapEntry->pNext; } else { pPrevMapEntry->pNext = pMapEntry->pNext; } break; } pPrevMapEntry = pProbeMapEntry; pProbeMapEntry = pProbeMapEntry->pNext; } while (pProbeMapEntry); } /* not found !!!*/ ASSERT(pProbeMapEntry != NULL); done: pAd->ApCfg.ApCliTab[apIdx].RepeaterCli[CliIdx].CliConnectState = 0; NdisZeroMemory(pAd->ApCfg.ApCliTab[apIdx].RepeaterCli[CliIdx].OriginalAddress, MAC_ADDR_LEN); if ((bVaild == TRUE) && (pAd->ApCfg.RepeaterCliSize > 0)) pAd->ApCfg.RepeaterCliSize--; /* set the apcli interface be invalid. */ pAd->ApCfg.ApCliTab[apIdx].RepeaterCli[CliIdx].CliValid = FALSE; pAd->ApCfg.ApCliTab[apIdx].RepeaterCli[CliIdx].CliEnable = FALSE; NdisReleaseSpinLock(&pAd->ApCfg.ReptCliEntryLock); return; }
MAC_TABLE_ENTRY *RTMPInsertRepeaterMacEntry( IN RTMP_ADAPTER *pAd, IN UCHAR *pAddr, IN struct wifi_dev *wdev, IN UCHAR apIdx, IN UCHAR cliIdx, IN BOOLEAN CleanAll) { UCHAR HashIdx; int i; MAC_TABLE_ENTRY *pEntry = NULL, *pCurrEntry; BOOLEAN Cancelled; if (pAd->MacTab.Size >= MAX_LEN_OF_MAC_TABLE) return NULL; /* allocate one MAC entry*/ NdisAcquireSpinLock(&pAd->MacTabLock); i = (MAX_NUMBER_OF_MAC + ((MAX_EXT_MAC_ADDR_SIZE + 1) * (apIdx - MIN_NET_DEVICE_FOR_APCLI))); if (cliIdx != 0xFF) i = i + cliIdx + 1; /* pick up the first available vacancy*/ if (IS_ENTRY_NONE(&pAd->MacTab.Content[i])) { pEntry = &pAd->MacTab.Content[i]; /* ENTRY PREEMPTION: initialize the entry */ if (pEntry->RetryTimer.Valid) RTMPCancelTimer(&pEntry->RetryTimer, &Cancelled); if (pEntry->EnqueueStartForPSKTimer.Valid) RTMPCancelTimer(&pEntry->EnqueueStartForPSKTimer, &Cancelled); #ifdef DOT11W_PMF_SUPPORT RTMPCancelTimer(&pEntry->SAQueryTimer, &Cancelled); RTMPCancelTimer(&pEntry->SAQueryConfirmTimer, &Cancelled); #endif /* DOT11W_PMF_SUPPORT */ NdisZeroMemory(pEntry, sizeof(MAC_TABLE_ENTRY)); if (CleanAll == TRUE) { pEntry->MaxSupportedRate = RATE_11; pEntry->CurrTxRate = RATE_11; NdisZeroMemory(pEntry, sizeof(MAC_TABLE_ENTRY)); pEntry->PairwiseKey.KeyLen = 0; pEntry->PairwiseKey.CipherAlg = CIPHER_NONE; } #ifdef CONFIG_AP_SUPPORT #ifdef APCLI_SUPPORT if (apIdx >= MIN_NET_DEVICE_FOR_APCLI) { SET_ENTRY_APCLI(pEntry); } #endif /* APCLI_SUPPORT */ #endif /* CONFIG_AP_SUPPORT */ pEntry->wdev = wdev; pEntry->wcid = i; //SET_ENTRY_AP(pEntry);//Carter, why set Apcli Entry then set to AP entry? pAd->MacTab.tr_entry[i].isCached = FALSE; //tr_entry->isCached = FALSE; pEntry->bIAmBadAtheros = FALSE; RTMPInitTimer(pAd, &pEntry->EnqueueStartForPSKTimer, GET_TIMER_FUNCTION(EnqueueStartForPSKExec), pEntry, FALSE); #ifdef APCLI_SUPPORT if (IS_ENTRY_APCLI(pEntry)) { RTMPInitTimer(pAd, &pEntry->RetryTimer, GET_TIMER_FUNCTION(WPARetryExec), pEntry, FALSE); } #endif /* APCLI_SUPPORT */ pEntry->pAd = pAd; pEntry->CMTimerRunning = FALSE; pEntry->EnqueueEapolStartTimerRunning = EAPOL_START_DISABLE; pEntry->RSNIE_Len = 0; NdisZeroMemory(pEntry->R_Counter, sizeof(pEntry->R_Counter)); pEntry->ReTryCounter = PEER_MSG1_RETRY_TIMER_CTR; pEntry->func_tb_idx = (apIdx - MIN_NET_DEVICE_FOR_APCLI); if (IS_ENTRY_APCLI(pEntry)) pEntry->func_tb_idx = (apIdx - MIN_NET_DEVICE_FOR_APCLI); pEntry->pMbss = NULL; #ifdef APCLI_SUPPORT if (IS_ENTRY_APCLI(pEntry)) { pEntry->AuthMode = pAd->ApCfg.ApCliTab[pEntry->func_tb_idx].wdev.AuthMode; pEntry->WepStatus = pAd->ApCfg.ApCliTab[pEntry->func_tb_idx].wdev.WepStatus; if (pEntry->AuthMode < Ndis802_11AuthModeWPA) { pEntry->WpaState = AS_NOTUSE; pEntry->PrivacyFilter = Ndis802_11PrivFilterAcceptAll; } else { pEntry->WpaState = AS_PTKSTART; pEntry->PrivacyFilter = Ndis802_11PrivFilter8021xWEP; } } #endif /* APCLI_SUPPORT */ pEntry->GTKState = REKEY_NEGOTIATING; pEntry->PairwiseKey.KeyLen = 0; pEntry->PairwiseKey.CipherAlg = CIPHER_NONE; pAd->MacTab.tr_entry[i].PortSecured = WPA_802_1X_PORT_NOT_SECURED; //pEntry->PortSecured = WPA_802_1X_PORT_NOT_SECURED; pEntry->PMKID_CacheIdx = ENTRY_NOT_FOUND; COPY_MAC_ADDR(pEntry->Addr, pAddr); #ifdef APCLI_SUPPORT if (IS_ENTRY_APCLI(pEntry)) { COPY_MAC_ADDR(pEntry->bssid, pAddr); } #endif // APCLI_SUPPORT // pEntry->Sst = SST_NOT_AUTH; pEntry->AuthState = AS_NOT_AUTH; pEntry->Aid = (USHORT)i; pEntry->CapabilityInfo = 0; pEntry->PsMode = PWR_ACTIVE; pAd->MacTab.tr_entry[i].PsQIdleCount = 0; //pEntry->PsQIdleCount = 0; pEntry->NoDataIdleCount = 0; pEntry->AssocDeadLine = MAC_TABLE_ASSOC_TIMEOUT; pEntry->ContinueTxFailCnt = 0; pEntry->TimeStamp_toTxRing = 0; // TODO: shiang-usw, remove upper setting becasue we need to migrate to tr_entry! pAd->MacTab.tr_entry[i].PsMode = PWR_ACTIVE; pAd->MacTab.tr_entry[i].NoDataIdleCount = 0; pAd->MacTab.tr_entry[i].ContinueTxFailCnt = 0; pAd->MacTab.tr_entry[i].LockEntryTx = FALSE; pAd->MacTab.tr_entry[i].TimeStamp_toTxRing = 0; pAd->MacTab.Size ++; /* Set the security mode of this entry as OPEN-NONE in ASIC */ RTMP_REMOVE_PAIRWISE_KEY_ENTRY(pAd, (UCHAR)i); /* Add this entry into ASIC RX WCID search table */ RTMP_STA_ENTRY_ADD(pAd, pEntry); MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_TRACE, ("%s - allocate entry #%d, Aid = %d, Total= %d\n",__FUNCTION__, i, pEntry->Aid, pAd->MacTab.Size)); } else { MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_ERROR, ("%s - exist entry #%d, Aid = %d, Total= %d\n", __FUNCTION__, i, pEntry->Aid, pAd->MacTab.Size)); NdisReleaseSpinLock(&pAd->MacTabLock); return pEntry; } /* add this MAC entry into HASH table */ if (pEntry) { HashIdx = MAC_ADDR_HASH_INDEX(pAddr); if (pAd->MacTab.Hash[HashIdx] == NULL) { pAd->MacTab.Hash[HashIdx] = pEntry; } else { pCurrEntry = pAd->MacTab.Hash[HashIdx]; while (pCurrEntry->pNext != NULL) pCurrEntry = pCurrEntry->pNext; pCurrEntry->pNext = pEntry; } } NdisReleaseSpinLock(&pAd->MacTabLock); rtmp_tx_burst_set(pAd); return pEntry; }
VOID RTMPInsertRepeaterEntry( IN PRTMP_ADAPTER pAd, IN UCHAR apidx, IN PUCHAR pAddr) { INT CliIdx, idx; UCHAR HashIdx; BOOLEAN Cancelled; UCHAR tempMAC[MAC_ADDR_LEN]; APCLI_CTRL_MSG_STRUCT ApCliCtrlMsg; PREPEATER_CLIENT_ENTRY pReptCliEntry = NULL, pCurrEntry = NULL; PREPEATER_CLIENT_ENTRY_MAP pReptCliMap; UCHAR SPEC_ADDR[6][3] = {{0x02, 0x0F, 0xB5}, {0x02, 0x09, 0x5B}, {0x02, 0x14, 0x6C}, {0x02, 0x18, 0x4D}, {0x02, 0x1B, 0x2F}, {0x02, 0x1E, 0x2A}}; MAC_TABLE_ENTRY *pMacEntry = NULL; DBGPRINT(RT_DEBUG_TRACE, (" %s.\n", __FUNCTION__)); pMacEntry = MacTableLookup(pAd, pAddr); if (pMacEntry && IS_ENTRY_CLIENT(pMacEntry)) { if (pMacEntry->PortSecured == WPA_802_1X_PORT_NOT_SECURED) { DBGPRINT(RT_DEBUG_ERROR, (" wireless client is not ready !!!\n")); return; } } NdisAcquireSpinLock(&pAd->ApCfg.ReptCliEntryLock); if (pAd->ApCfg.RepeaterCliSize >= MAX_EXT_MAC_ADDR_SIZE) { DBGPRINT(RT_DEBUG_ERROR, (" Repeater Client Full !!!\n")); NdisReleaseSpinLock(&pAd->ApCfg.ReptCliEntryLock); return ; } for (CliIdx = 0; CliIdx < MAX_EXT_MAC_ADDR_SIZE; CliIdx++) { pReptCliEntry = &pAd->ApCfg.ApCliTab[apidx].RepeaterCli[CliIdx]; if ((pReptCliEntry->CliEnable) && (MAC_ADDR_EQUAL(pReptCliEntry->OriginalAddress, pAddr) || MAC_ADDR_EQUAL(pReptCliEntry->CurrentAddress, pAddr))) { DBGPRINT(RT_DEBUG_ERROR, ("\n receive mac :%02x:%02x:%02x:%02x:%02x:%02x !!!\n", pAddr[0], pAddr[1], pAddr[2], pAddr[3], pAddr[4], pAddr[5])); DBGPRINT(RT_DEBUG_ERROR, (" duplicate Insert !!!\n")); NdisReleaseSpinLock(&pAd->ApCfg.ReptCliEntryLock); return ; } if (pReptCliEntry->CliEnable == FALSE) break; } if (CliIdx >= MAX_EXT_MAC_ADDR_SIZE) { DBGPRINT(RT_DEBUG_ERROR, (" Repeater Client Full !!!\n")); NdisReleaseSpinLock(&pAd->ApCfg.ReptCliEntryLock); return ; } pReptCliEntry = &pAd->ApCfg.ApCliTab[apidx].RepeaterCli[CliIdx]; pReptCliMap = &pAd->ApCfg.ApCliTab[apidx].RepeaterCliMap[CliIdx]; /* ENTRY PREEMPTION: initialize the entry */ RTMPCancelTimer(&pReptCliEntry->ApCliAuthTimer, &Cancelled); RTMPCancelTimer(&pReptCliEntry->ApCliAssocTimer, &Cancelled); pReptCliEntry->CtrlCurrState = APCLI_CTRL_DISCONNECTED; pReptCliEntry->AuthCurrState = APCLI_AUTH_REQ_IDLE; pReptCliEntry->AssocCurrState = APCLI_ASSOC_IDLE; pReptCliEntry->CliConnectState = 0; pReptCliEntry->CliValid = FALSE; pReptCliEntry->bEthCli = FALSE; pReptCliEntry->MacTabWCID = 0xFF; pReptCliEntry->AuthReqCnt = 0; pReptCliEntry->AssocReqCnt = 0; pReptCliEntry->CliTriggerTime = 0; pReptCliEntry->pNext = NULL; pReptCliMap->pReptCliEntry = pReptCliEntry; pReptCliMap->pNext = NULL; COPY_MAC_ADDR(pReptCliEntry->OriginalAddress, pAddr); COPY_MAC_ADDR(tempMAC, pAddr); #ifdef SMART_MESH NdisZeroMemory(pAd->vMacAddrPrefix,sizeof(pAd->vMacAddrPrefix)); #endif /* SMART_MESH */ if (pAd->ApCfg.MACRepeaterOuiMode == 1) { DBGPRINT(RT_DEBUG_ERROR, (" todo !!!\n")); } else if (pAd->ApCfg.MACRepeaterOuiMode == 2) { INT IdxToUse; for (idx = 0; idx < 6; idx++) { if (RTMPEqualMemory(SPEC_ADDR[idx], pAddr, 3)) break; } /* If there is a matched one, use the next one; otherwise, use the first one. */ if (idx >= 0 && idx < 5) IdxToUse = idx + 1; else IdxToUse = 0; NdisCopyMemory(tempMAC, SPEC_ADDR[IdxToUse], 3); #ifdef SMART_MESH INT vMacIdx; if (IdxToUse >= 0 && IdxToUse < 5) vMacIdx = IdxToUse + 1; else vMacIdx = 0; NdisCopyMemory(pAd->vMacAddrPrefix, SPEC_ADDR[vMacIdx], sizeof(pAd->vMacAddrPrefix)); #endif /* SMART_MESH */ } else { NdisCopyMemory(tempMAC, pAd->ApCfg.ApCliTab[apidx].wdev.if_addr, 3); } COPY_MAC_ADDR(pReptCliEntry->CurrentAddress, tempMAC); pReptCliEntry->CliEnable = TRUE; pReptCliEntry->CliConnectState = 1; pReptCliEntry->pNext = NULL; NdisGetSystemUpTime(&pReptCliEntry->CliTriggerTime); RTMPInsertRepeaterAsicEntry(pAd, CliIdx, tempMAC); HashIdx = MAC_ADDR_HASH_INDEX(tempMAC); if (pAd->ApCfg.ReptCliHash[HashIdx] == NULL) { pAd->ApCfg.ReptCliHash[HashIdx] = pReptCliEntry; } else { pCurrEntry = pAd->ApCfg.ReptCliHash[HashIdx]; while (pCurrEntry->pNext != NULL) pCurrEntry = pCurrEntry->pNext; pCurrEntry->pNext = pReptCliEntry; } HashIdx = MAC_ADDR_HASH_INDEX(pReptCliEntry->OriginalAddress); if (pAd->ApCfg.ReptMapHash[HashIdx] == NULL) pAd->ApCfg.ReptMapHash[HashIdx] = pReptCliMap; else { PREPEATER_CLIENT_ENTRY_MAP pCurrMapEntry; pCurrMapEntry = pAd->ApCfg.ReptMapHash[HashIdx]; while (pCurrMapEntry->pNext != NULL) pCurrMapEntry = pCurrMapEntry->pNext; pCurrMapEntry->pNext = pReptCliMap; } pAd->ApCfg.RepeaterCliSize++; NdisReleaseSpinLock(&pAd->ApCfg.ReptCliEntryLock); NdisZeroMemory(&ApCliCtrlMsg, sizeof(APCLI_CTRL_MSG_STRUCT)); ApCliCtrlMsg.Status = MLME_SUCCESS; COPY_MAC_ADDR(&ApCliCtrlMsg.SrcAddr[0], tempMAC); ApCliCtrlMsg.BssIdx = apidx; ApCliCtrlMsg.CliIdx = CliIdx; MlmeEnqueue(pAd, APCLI_CTRL_STATE_MACHINE, APCLI_CTRL_MT2_AUTH_REQ, sizeof(APCLI_CTRL_MSG_STRUCT), &ApCliCtrlMsg, apidx); }
VOID RTMPRemoveRepeaterEntry( IN PRTMP_ADAPTER pAd, IN UCHAR apidx, IN UCHAR CliIdx) { USHORT HashIdx; REPEATER_CLIENT_ENTRY *pEntry, *pPrevEntry, *pProbeEntry; REPEATER_CLIENT_ENTRY_MAP *pMapEntry, *pPrevMapEntry, *pProbeMapEntry; DBGPRINT(RT_DEBUG_ERROR, (" %s.\n", __FUNCTION__)); RTMPRemoveRepeaterAsicEntry(pAd, CliIdx); NdisAcquireSpinLock(&pAd->ApCfg.ReptCliEntryLock); pEntry = &pAd->ApCfg.ApCliTab[apidx].RepeaterCli[CliIdx]; HashIdx = MAC_ADDR_HASH_INDEX(pEntry->CurrentAddress); pPrevEntry = NULL; pProbeEntry = pAd->ApCfg.ReptCliHash[HashIdx]; ASSERT(pProbeEntry); if (pProbeEntry != NULL) { /* update Hash list*/ do { if (pProbeEntry == pEntry) { if (pPrevEntry == NULL) { pAd->ApCfg.ReptCliHash[HashIdx] = pEntry->pNext; } else { pPrevEntry->pNext = pEntry->pNext; } break; } pPrevEntry = pProbeEntry; pProbeEntry = pProbeEntry->pNext; } while (pProbeEntry); } /* not found !!!*/ ASSERT(pProbeEntry != NULL); pMapEntry = &pAd->ApCfg.ApCliTab[apidx].RepeaterCliMap[CliIdx]; HashIdx = MAC_ADDR_HASH_INDEX(pEntry->OriginalAddress); pPrevMapEntry = NULL; pProbeMapEntry = pAd->ApCfg.ReptMapHash[HashIdx]; ASSERT(pProbeMapEntry); if (pProbeMapEntry != NULL) { /* update Hash list*/ do { if (pProbeMapEntry == pMapEntry) { if (pPrevMapEntry == NULL) { pAd->ApCfg.ReptMapHash[HashIdx] = pMapEntry->pNext; } else { pPrevMapEntry->pNext = pMapEntry->pNext; } break; } pPrevMapEntry = pProbeMapEntry; pProbeMapEntry = pProbeMapEntry->pNext; } while (pProbeMapEntry); } /* not found !!!*/ ASSERT(pProbeMapEntry != NULL); pAd->ApCfg.ApCliTab[apidx].RepeaterCli[CliIdx].CliConnectState = 0; NdisZeroMemory(pAd->ApCfg.ApCliTab[apidx].RepeaterCli[CliIdx].OriginalAddress, MAC_ADDR_LEN); pAd->ApCfg.RepeaterCliSize--; NdisReleaseSpinLock(&pAd->ApCfg.ReptCliEntryLock); return; }
INT BndStrg_DeleteEntry(PBND_STRG_CLI_TABLE table, PUCHAR pAddr, UINT32 Index) { USHORT HashIdx; PBND_STRG_CLI_ENTRY entry, pre_entry, this_entry; INT ret_val = BND_STRG_SUCCESS; NdisAcquireSpinLock(&table->Lock); HashIdx = MAC_ADDR_HASH_INDEX(pAddr); if (Index >= BND_STRG_MAX_TABLE_SIZE) { entry = table->Hash[HashIdx]; while (entry) { if (MAC_ADDR_EQUAL(pAddr, entry->Addr)) { /* this is the entry we're looking for */ break; } else { entry = entry->pNext; } } if (entry == NULL) { BND_STRG_DBGPRINT(RT_DEBUG_WARN, ("%s(): Index=%u, %02x:%02x:%02x:%02x:%02x:%02x, " "Entry not found.\n", __FUNCTION__, Index, PRINT_MAC(pAddr))); NdisReleaseSpinLock(&table->Lock); return BND_STRG_INVALID_ARG; } } else entry = &table->Entry[Index]; if (entry && entry->bValid) { { pre_entry = NULL; this_entry = table->Hash[HashIdx]; ASSERT(this_entry); if (this_entry != NULL) { /* update Hash list*/ do { if (this_entry == entry) { if (pre_entry == NULL) table->Hash[HashIdx] = entry->pNext; else pre_entry->pNext = entry->pNext; break; } pre_entry = this_entry; this_entry = this_entry->pNext; } while (this_entry); } /* not found !!!*/ ASSERT(this_entry != NULL); NdisZeroMemory(entry->Addr, MAC_ADDR_LEN); entry->pNext = NULL; entry->bValid = FALSE; table->Size--; } } NdisReleaseSpinLock(&table->Lock); return ret_val; }
REPEATER_CLIENT_ENTRY *RTMPLookupRepeaterCliEntry( IN PVOID pData, IN BOOLEAN bRealMAC, IN PUCHAR pAddr, IN BOOLEAN bIsPad, OUT PUCHAR pIsLinkValid) { ULONG HashIdx; UCHAR tempMAC[6]; REPEATER_CLIENT_ENTRY *pEntry = NULL; REPEATER_CLIENT_ENTRY_MAP *pMapEntry = NULL; if (bIsPad == TRUE) { NdisAcquireSpinLock(&((PRTMP_ADAPTER)pData)->ApCfg.ReptCliEntryLock); } else { NdisAcquireSpinLock(((REPEATER_ADAPTER_DATA_TABLE *)pData)->EntryLock); } COPY_MAC_ADDR(tempMAC, pAddr); HashIdx = MAC_ADDR_HASH_INDEX(tempMAC); *pIsLinkValid = TRUE; if (bRealMAC == TRUE) { if (bIsPad == TRUE) { pMapEntry = ((PRTMP_ADAPTER)pData)->ApCfg.ReptMapHash[HashIdx]; } else pMapEntry = *((((REPEATER_ADAPTER_DATA_TABLE *)pData)->MapHash) + HashIdx) ; while (pMapEntry) { pEntry = pMapEntry->pReptCliEntry; if (MAC_ADDR_EQUAL(pEntry->OriginalAddress, tempMAC)) { if (pEntry->CliValid == FALSE) { *pIsLinkValid = FALSE; pEntry = NULL; } break; } else { pEntry = NULL; pMapEntry = pMapEntry->pNext; } } } else { if (bIsPad == TRUE) { pEntry = ((PRTMP_ADAPTER)pData)->ApCfg.ReptCliHash[HashIdx]; } else { pEntry = *((((REPEATER_ADAPTER_DATA_TABLE *)pData)->CliHash) + HashIdx) ; } while (pEntry) { if (MAC_ADDR_EQUAL(pEntry->CurrentAddress, tempMAC)) { if (pEntry->CliValid == FALSE) { *pIsLinkValid = FALSE; pEntry = NULL; } break; } else pEntry = pEntry->pNext; } } if (bIsPad == TRUE) { NdisReleaseSpinLock(&((PRTMP_ADAPTER)pData)->ApCfg.ReptCliEntryLock); } else { NdisReleaseSpinLock(((REPEATER_ADAPTER_DATA_TABLE *)pData)->EntryLock); } return pEntry; }
MAC_TABLE_ENTRY *RTMPInsertRepeaterMacEntry( IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr, IN UCHAR apidx, IN UCHAR cliidx, IN BOOLEAN CleanAll) { UCHAR HashIdx; int i; MAC_TABLE_ENTRY *pEntry = NULL, *pCurrEntry; BOOLEAN Cancelled; /* if FULL, return*/ if (pAd->MacTab.Size >= MAX_MAC_TABLE_SIZE_WITH_REPEATER) return NULL; /* allocate one MAC entry*/ NdisAcquireSpinLock(&pAd->MacTabLock); i = (MAX_LEN_OF_MAC_TABLE + ((MAX_EXT_MAC_ADDR_SIZE + 1) * (apidx - MIN_NET_DEVICE_FOR_APCLI))); if (cliidx != 0xFF) i = i + cliidx + 1; pEntry = &pAd->MacTab.Content[i]; if (IS_ENTRY_NONE(pEntry)) { /* ENTRY PREEMPTION: initialize the entry */ if (pEntry->RetryTimer.Valid) RTMPCancelTimer(&pEntry->RetryTimer, &Cancelled); if (pEntry->EnqueueStartForPSKTimer.Valid) RTMPCancelTimer(&pEntry->EnqueueStartForPSKTimer, &Cancelled); NdisZeroMemory(pEntry, sizeof(MAC_TABLE_ENTRY)); if (CleanAll == TRUE) { pEntry->MaxSupportedRate = RATE_11; pEntry->CurrTxRate = RATE_11; NdisZeroMemory(pEntry, sizeof(MAC_TABLE_ENTRY)); pEntry->PairwiseKey.KeyLen = 0; pEntry->PairwiseKey.CipherAlg = CIPHER_NONE; } SET_ENTRY_APCLI(pEntry); pEntry->isCached = FALSE; pEntry->bIAmBadAtheros = FALSE; RTMPInitTimer(pAd, &pEntry->EnqueueStartForPSKTimer, GET_TIMER_FUNCTION(EnqueueStartForPSKExec), pEntry, FALSE); RTMPInitTimer(pAd, &pEntry->RetryTimer, GET_TIMER_FUNCTION(WPARetryExec), pEntry, FALSE); pEntry->pAd = pAd; pEntry->CMTimerRunning = FALSE; pEntry->EnqueueEapolStartTimerRunning = EAPOL_START_DISABLE; pEntry->RSNIE_Len = 0; NdisZeroMemory(pEntry->R_Counter, sizeof(pEntry->R_Counter)); pEntry->ReTryCounter = PEER_MSG1_RETRY_TIMER_CTR; pEntry->apidx = (apidx - MIN_NET_DEVICE_FOR_APCLI); pEntry->pMbss = NULL; pEntry->AuthMode = pAd->ApCfg.ApCliTab[pEntry->apidx].AuthMode; pEntry->WepStatus = pAd->ApCfg.ApCliTab[pEntry->apidx].WepStatus; pEntry->MatchAPCLITabIdx = pEntry->apidx; if (pEntry->AuthMode < Ndis802_11AuthModeWPA) { pEntry->WpaState = AS_NOTUSE; pEntry->PrivacyFilter = Ndis802_11PrivFilterAcceptAll; } else { pEntry->WpaState = AS_PTKSTART; pEntry->PrivacyFilter = Ndis802_11PrivFilter8021xWEP; } pEntry->GTKState = REKEY_NEGOTIATING; pEntry->PairwiseKey.KeyLen = 0; pEntry->PairwiseKey.CipherAlg = CIPHER_NONE; pEntry->PortSecured = WPA_802_1X_PORT_NOT_SECURED; pEntry->PMKID_CacheIdx = ENTRY_NOT_FOUND; COPY_MAC_ADDR(pEntry->Addr, pAddr); COPY_MAC_ADDR(pEntry->HdrAddr1, pAddr); COPY_MAC_ADDR(pEntry->HdrAddr2, pAd->ApCfg.ApCliTab[pEntry->apidx].CurrentAddress); COPY_MAC_ADDR(pEntry->HdrAddr3, pAddr); pEntry->Sst = SST_NOT_AUTH; pEntry->AuthState = AS_NOT_AUTH; pEntry->Aid = (USHORT)i; /*0;*/ pEntry->CapabilityInfo = 0; pEntry->PsMode = PWR_ACTIVE; pEntry->PsQIdleCount = 0; pEntry->NoDataIdleCount = 0; pEntry->AssocDeadLine = MAC_TABLE_ASSOC_TIMEOUT; pEntry->ContinueTxFailCnt = 0; pEntry->TimeStamp_toTxRing = 0; InitializeQueueHeader(&pEntry->PsQueue); pAd->MacTab.Size ++; /* Set the security mode of this entry as OPEN-NONE in ASIC */ RTMP_REMOVE_PAIRWISE_KEY_ENTRY(pAd, (UCHAR)i); /* Add this entry into ASIC RX WCID search table */ RTMP_STA_ENTRY_ADD(pAd, pEntry); #ifdef WSC_AP_SUPPORT pEntry->bWscCapable = FALSE; pEntry->Receive_EapolStart_EapRspId = 0; #endif /* WSC_AP_SUPPORT */ DBGPRINT(RT_DEBUG_TRACE, ("MacTableInsertEntry - allocate entry #%d, Aid = %d, Total= %d\n",i, pEntry->Aid, pAd->MacTab.Size)); } else { DBGPRINT(RT_DEBUG_ERROR, ("%s - exist entry #%d, Aid = %d, Total= %d\n", __FUNCTION__, i, pEntry->Aid, pAd->MacTab.Size)); NdisReleaseSpinLock(&pAd->MacTabLock); return pEntry; } /* add this MAC entry into HASH table */ if (pEntry) { HashIdx = MAC_ADDR_HASH_INDEX(pAddr); if (pAd->MacTab.Hash[HashIdx] == NULL) { pAd->MacTab.Hash[HashIdx] = pEntry; } else { pCurrEntry = pAd->MacTab.Hash[HashIdx]; while (pCurrEntry->pNext != NULL) pCurrEntry = pCurrEntry->pNext; pCurrEntry->pNext = pEntry; } } NdisReleaseSpinLock(&pAd->MacTabLock); return pEntry; }