2009-06-13 11:38:31 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
|
|
|
* File: bssdb.c
|
|
|
|
*
|
|
|
|
* Purpose: Handles the Basic Service Set & Node Database functions
|
|
|
|
*
|
|
|
|
* Functions:
|
2014-01-04 15:25:06 +00:00
|
|
|
* BSSpSearchBSSList - Search known BSS list for Desire SSID or BSSID
|
|
|
|
* BSSvClearBSSList - Clear BSS List
|
|
|
|
* BSSbInsertToBSSList - Insert a BSS set into known BSS list
|
|
|
|
* BSSbUpdateToBSSList - Update BSS set in known BSS list
|
|
|
|
* BSSbIsSTAInNodeDB - Search Node DB table to find the index of matched DstAddr
|
|
|
|
* BSSvCreateOneNode - Allocate an Node for Node DB
|
|
|
|
* BSSvUpdateAPNode - Update AP Node content in Index 0 of KnownNodeDB
|
|
|
|
* BSSvSecondCallBack - One second timer callback function to update Node DB info & AP link status
|
|
|
|
* BSSvUpdateNodeTxCounter - Update Tx attemps, Tx failure counter in Node DB for auto-fallback rate control
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
* Revision History:
|
|
|
|
*
|
|
|
|
* Author: Lyndon Chen
|
|
|
|
*
|
|
|
|
* Date: July 17, 2002
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "tmacro.h"
|
|
|
|
#include "tether.h"
|
|
|
|
#include "device.h"
|
|
|
|
#include "80211hdr.h"
|
|
|
|
#include "bssdb.h"
|
|
|
|
#include "wmgr.h"
|
|
|
|
#include "datarate.h"
|
|
|
|
#include "desc.h"
|
|
|
|
#include "wcmd.h"
|
|
|
|
#include "wpa.h"
|
|
|
|
#include "baseband.h"
|
|
|
|
#include "rf.h"
|
|
|
|
#include "card.h"
|
|
|
|
#include "mac.h"
|
|
|
|
#include "wpa2.h"
|
|
|
|
#include "control.h"
|
|
|
|
#include "rndis.h"
|
|
|
|
#include "iowpa.h"
|
2013-10-14 18:46:52 +00:00
|
|
|
#include "power.h"
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:09 +00:00
|
|
|
static int msglevel = MSG_LEVEL_INFO;
|
|
|
|
/* static int msglevel = MSG_LEVEL_DEBUG; */
|
2014-01-04 15:25:06 +00:00
|
|
|
|
|
|
|
static const u16 awHWRetry0[5][5] = {
|
|
|
|
{RATE_18M, RATE_18M, RATE_12M, RATE_12M, RATE_12M},
|
|
|
|
{RATE_24M, RATE_24M, RATE_18M, RATE_12M, RATE_12M},
|
|
|
|
{RATE_36M, RATE_36M, RATE_24M, RATE_18M, RATE_18M},
|
|
|
|
{RATE_48M, RATE_48M, RATE_36M, RATE_24M, RATE_24M},
|
|
|
|
{RATE_54M, RATE_54M, RATE_48M, RATE_36M, RATE_36M}
|
|
|
|
};
|
|
|
|
static const u16 awHWRetry1[5][5] = {
|
|
|
|
{RATE_18M, RATE_18M, RATE_12M, RATE_6M, RATE_6M},
|
|
|
|
{RATE_24M, RATE_24M, RATE_18M, RATE_6M, RATE_6M},
|
|
|
|
{RATE_36M, RATE_36M, RATE_24M, RATE_12M, RATE_12M},
|
|
|
|
{RATE_48M, RATE_48M, RATE_24M, RATE_12M, RATE_12M},
|
|
|
|
{RATE_54M, RATE_54M, RATE_36M, RATE_18M, RATE_18M}
|
|
|
|
};
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2013-01-17 23:15:22 +00:00
|
|
|
static void s_vCheckSensitivity(struct vnt_private *pDevice);
|
|
|
|
static void s_vCheckPreEDThreshold(struct vnt_private *pDevice);
|
|
|
|
static void s_uCalculateLinkQual(struct vnt_private *pDevice);
|
2010-05-06 23:34:29 +00:00
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/*
|
2009-06-13 11:38:31 +00:00
|
|
|
* Routine Description:
|
2014-01-04 15:25:06 +00:00
|
|
|
* Search known BSS list for Desire SSID or BSSID.
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2014-01-04 15:25:06 +00:00
|
|
|
* PTR to KnownBSS or NULL
|
2014-01-04 15:25:07 +00:00
|
|
|
*/
|
2013-01-17 23:15:22 +00:00
|
|
|
PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
|
2014-01-04 15:25:06 +00:00
|
|
|
u8 *pbyDesireBSSID, u8 *pbyDesireSSID,
|
|
|
|
CARD_PHY_TYPE ePhyType)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2013-01-17 23:15:22 +00:00
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
|
|
|
u8 *pbyBSSID = NULL;
|
|
|
|
PWLAN_IE_SSID pSSID = NULL;
|
|
|
|
PKnownBSS pCurrBSS = NULL;
|
|
|
|
PKnownBSS pSelect = NULL;
|
|
|
|
u8 ZeroBSSID[WLAN_BSSID_LEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|
|
|
int ii = 0;
|
|
|
|
int jj = 0;
|
|
|
|
|
2014-01-04 15:25:17 +00:00
|
|
|
if (pbyDesireBSSID) {
|
2012-07-06 15:28:17 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
|
|
|
|
"BSSpSearchBSSList BSSID[%pM]\n", pbyDesireBSSID);
|
2014-01-04 15:25:16 +00:00
|
|
|
if (!is_broadcast_ether_addr(pbyDesireBSSID) &&
|
2014-01-04 15:25:18 +00:00
|
|
|
memcmp(pbyDesireBSSID, ZeroBSSID, 6) != 0)
|
|
|
|
pbyBSSID = pbyDesireBSSID;
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
2014-01-04 15:25:17 +00:00
|
|
|
if (pbyDesireSSID &&
|
2014-01-04 15:25:16 +00:00
|
|
|
((PWLAN_IE_SSID) pbyDesireSSID)->len != 0)
|
2014-01-04 15:25:15 +00:00
|
|
|
pSSID = (PWLAN_IE_SSID) pbyDesireSSID;
|
2014-01-04 15:25:06 +00:00
|
|
|
|
2014-01-04 15:25:17 +00:00
|
|
|
if (pbyBSSID && pDevice->bRoaming == false) {
|
2014-01-04 15:25:07 +00:00
|
|
|
/* match BSSID first */
|
2014-01-04 15:25:09 +00:00
|
|
|
for (ii = 0; ii < MAX_BSS_NUM; ii++) {
|
2014-01-04 15:25:06 +00:00
|
|
|
pCurrBSS = &(pMgmt->sBSSList[ii]);
|
|
|
|
|
|
|
|
pCurrBSS->bSelected = false;
|
|
|
|
|
2014-01-04 15:25:16 +00:00
|
|
|
if (pCurrBSS->bActive &&
|
|
|
|
pCurrBSS->bSelected == false &&
|
|
|
|
ether_addr_equal(pCurrBSS->abyBSSID, pbyBSSID)) {
|
2014-01-04 15:25:17 +00:00
|
|
|
if (pSSID) {
|
2014-01-04 15:25:15 +00:00
|
|
|
/* compare ssid */
|
2014-01-04 15:25:16 +00:00
|
|
|
if (!memcmp(pSSID->abySSID,
|
2014-01-04 15:25:15 +00:00
|
|
|
((PWLAN_IE_SSID) pCurrBSS->abySSID)->abySSID,
|
2014-01-04 15:25:16 +00:00
|
|
|
pSSID->len) &&
|
|
|
|
(pMgmt->eConfigMode == WMAC_CONFIG_AUTO ||
|
|
|
|
(pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA &&
|
2014-01-04 15:25:15 +00:00
|
|
|
WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ||
|
2014-01-04 15:25:16 +00:00
|
|
|
(pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA &&
|
2014-01-04 15:25:15 +00:00
|
|
|
WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)))) {
|
|
|
|
|
2014-01-04 15:25:13 +00:00
|
|
|
pCurrBSS->bSelected = true;
|
|
|
|
return pCurrBSS;
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
2014-01-04 15:25:16 +00:00
|
|
|
} else if (pMgmt->eConfigMode == WMAC_CONFIG_AUTO ||
|
2014-01-04 15:25:18 +00:00
|
|
|
(pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA &&
|
|
|
|
WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ||
|
|
|
|
(pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA &&
|
|
|
|
WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo))) {
|
2014-01-04 15:25:15 +00:00
|
|
|
pCurrBSS->bSelected = true;
|
|
|
|
return pCurrBSS;
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2014-01-04 15:25:07 +00:00
|
|
|
/* ignore BSSID */
|
2014-01-04 15:25:09 +00:00
|
|
|
for (ii = 0; ii < MAX_BSS_NUM; ii++) {
|
2014-01-04 15:25:06 +00:00
|
|
|
pCurrBSS = &(pMgmt->sBSSList[ii]);
|
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/* 2007-0721-01<Mark>by MikeLiu
|
|
|
|
* if ((pCurrBSS->bActive) &&
|
|
|
|
* (pCurrBSS->bSelected == false)) { */
|
2014-01-04 15:25:06 +00:00
|
|
|
|
|
|
|
pCurrBSS->bSelected = false;
|
|
|
|
if (pCurrBSS->bActive) {
|
|
|
|
|
2014-01-04 15:25:17 +00:00
|
|
|
if (pSSID &&
|
2014-01-04 15:25:15 +00:00
|
|
|
/* matched SSID */
|
|
|
|
(memcmp(pSSID->abySSID,
|
|
|
|
((PWLAN_IE_SSID) pCurrBSS->abySSID)->abySSID,
|
|
|
|
pSSID->len) ||
|
2014-01-04 15:25:16 +00:00
|
|
|
pSSID->len !=
|
|
|
|
((PWLAN_IE_SSID) pCurrBSS->abySSID)->len)) {
|
2014-01-04 15:25:15 +00:00
|
|
|
/* SSID not match skip this BSS */
|
|
|
|
continue;
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
2014-01-04 15:25:15 +00:00
|
|
|
|
2014-01-04 15:25:18 +00:00
|
|
|
if ((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA &&
|
|
|
|
WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)) ||
|
|
|
|
(pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA &&
|
|
|
|
WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo))) {
|
2014-01-04 15:25:07 +00:00
|
|
|
/* Type not match skip this BSS */
|
2014-01-04 15:25:18 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG,
|
|
|
|
KERN_INFO "BSS type mismatch.... Config[%d] BSS[0x%04x]\n",
|
|
|
|
pMgmt->eConfigMode,
|
|
|
|
pCurrBSS->wCapInfo);
|
2014-01-04 15:25:06 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-01-04 15:25:16 +00:00
|
|
|
if (ePhyType != PHY_TYPE_AUTO &&
|
|
|
|
((ePhyType == PHY_TYPE_11A &&
|
|
|
|
PHY_TYPE_11A != pCurrBSS->eNetworkTypeInUse) ||
|
|
|
|
(ePhyType != PHY_TYPE_11A &&
|
|
|
|
PHY_TYPE_11A == pCurrBSS->eNetworkTypeInUse))) {
|
2014-01-04 15:25:15 +00:00
|
|
|
/* PhyType not match skip this BSS */
|
2014-01-04 15:25:18 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG,
|
|
|
|
KERN_INFO "Physical type mismatch.... ePhyType[%d] BSS[%d]\n",
|
|
|
|
ePhyType,
|
|
|
|
pCurrBSS->eNetworkTypeInUse);
|
2014-01-04 15:25:15 +00:00
|
|
|
continue;
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pMgmt->pSameBSS[jj].uChannel = pCurrBSS->uChannel;
|
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
|
|
|
|
"BSSpSearchBSSList pSelect1[%pM]\n",
|
|
|
|
pCurrBSS->abyBSSID);
|
|
|
|
jj++;
|
|
|
|
|
2014-01-04 15:25:17 +00:00
|
|
|
if (!pSelect)
|
2014-01-04 15:25:06 +00:00
|
|
|
pSelect = pCurrBSS;
|
2014-01-04 15:25:13 +00:00
|
|
|
/* compare RSSI, select the strongest signal */
|
2014-01-04 15:25:14 +00:00
|
|
|
else if (pCurrBSS->uRSSI < pSelect->uRSSI)
|
2014-01-04 15:25:13 +00:00
|
|
|
pSelect = pCurrBSS;
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pDevice->bSameBSSMaxNum = jj;
|
|
|
|
|
2014-01-04 15:25:17 +00:00
|
|
|
if (pSelect) {
|
2014-01-04 15:25:06 +00:00
|
|
|
pSelect->bSelected = true;
|
2014-01-04 15:25:14 +00:00
|
|
|
if (pDevice->bRoaming == false) {
|
2014-01-04 15:25:07 +00:00
|
|
|
/* Einsn Add @20070907 */
|
2014-01-04 15:25:14 +00:00
|
|
|
memcpy(pbyDesireSSID,
|
|
|
|
pCurrBSS->abySSID,
|
|
|
|
WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
|
|
|
|
2014-01-04 15:25:09 +00:00
|
|
|
return pSelect;
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
|
|
|
}
|
2014-01-04 15:25:09 +00:00
|
|
|
return NULL;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/*
|
2009-06-13 11:38:31 +00:00
|
|
|
* Routine Description:
|
2014-01-04 15:25:06 +00:00
|
|
|
* Clear BSS List
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2014-01-04 15:25:06 +00:00
|
|
|
* None.
|
2014-01-04 15:25:07 +00:00
|
|
|
*/
|
2013-01-17 23:15:22 +00:00
|
|
|
void BSSvClearBSSList(struct vnt_private *pDevice, int bKeepCurrBSSID)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2013-01-17 23:15:22 +00:00
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
|
|
|
int ii;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:06 +00:00
|
|
|
for (ii = 0; ii < MAX_BSS_NUM; ii++) {
|
2014-01-04 15:25:15 +00:00
|
|
|
if (bKeepCurrBSSID &&
|
|
|
|
pMgmt->sBSSList[ii].bActive &&
|
|
|
|
ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID,
|
2014-01-04 15:25:18 +00:00
|
|
|
pMgmt->abyCurrBSSID)) {
|
2014-01-04 15:25:15 +00:00
|
|
|
|
|
|
|
/* mike mark:
|
|
|
|
* there are two BSSID's in list. If that AP is
|
|
|
|
* in hidden ssid mode, one SSID is null, but
|
|
|
|
* other's might not be obvious, so if it
|
|
|
|
* associate's with your STA, you must keep the
|
|
|
|
* two of them!! bKeepCurrBSSID = false;
|
|
|
|
*/
|
|
|
|
|
|
|
|
continue;
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pMgmt->sBSSList[ii].bActive = false;
|
|
|
|
memset(&pMgmt->sBSSList[ii], 0, sizeof(KnownBSS));
|
|
|
|
}
|
|
|
|
BSSvClearAnyBSSJoinRecord(pDevice);
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/*
|
2009-06-13 11:38:31 +00:00
|
|
|
* Routine Description:
|
2014-01-04 15:25:06 +00:00
|
|
|
* search BSS list by BSSID & SSID if matched
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2014-01-04 15:25:06 +00:00
|
|
|
* true if found.
|
2014-01-04 15:25:07 +00:00
|
|
|
*/
|
2013-01-17 23:15:22 +00:00
|
|
|
PKnownBSS BSSpAddrIsInBSSList(struct vnt_private *pDevice,
|
2014-01-04 15:25:06 +00:00
|
|
|
u8 *abyBSSID,
|
|
|
|
PWLAN_IE_SSID pSSID)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2013-01-17 23:15:22 +00:00
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
|
|
|
PKnownBSS pBSSList = NULL;
|
|
|
|
int ii;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:06 +00:00
|
|
|
for (ii = 0; ii < MAX_BSS_NUM; ii++) {
|
|
|
|
pBSSList = &(pMgmt->sBSSList[ii]);
|
2014-01-04 15:25:16 +00:00
|
|
|
if (pBSSList->bActive &&
|
|
|
|
ether_addr_equal(pBSSList->abyBSSID, abyBSSID) &&
|
|
|
|
pSSID->len == ((PWLAN_IE_SSID) pBSSList->abySSID)->len &&
|
|
|
|
memcmp(pSSID->abySSID,
|
2014-01-04 15:25:15 +00:00
|
|
|
((PWLAN_IE_SSID) pBSSList->abySSID)->abySSID,
|
2014-01-04 15:25:16 +00:00
|
|
|
pSSID->len) == 0)
|
2014-01-04 15:25:15 +00:00
|
|
|
return pBSSList;
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
2014-01-04 15:25:08 +00:00
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/*
|
2009-06-13 11:38:31 +00:00
|
|
|
* Routine Description:
|
2014-01-04 15:25:06 +00:00
|
|
|
* Insert a BSS set into known BSS list
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2014-01-04 15:25:06 +00:00
|
|
|
* true if success.
|
2014-01-04 15:25:07 +00:00
|
|
|
*/
|
2013-01-17 23:15:22 +00:00
|
|
|
int BSSbInsertToBSSList(struct vnt_private *pDevice,
|
|
|
|
u8 *abyBSSIDAddr,
|
2012-11-28 21:11:02 +00:00
|
|
|
u64 qwTimestamp,
|
2013-01-17 23:15:22 +00:00
|
|
|
u16 wBeaconInterval,
|
|
|
|
u16 wCapInfo,
|
|
|
|
u8 byCurrChannel,
|
|
|
|
PWLAN_IE_SSID pSSID,
|
|
|
|
PWLAN_IE_SUPP_RATES pSuppRates,
|
|
|
|
PWLAN_IE_SUPP_RATES pExtSuppRates,
|
|
|
|
PERPObject psERP,
|
|
|
|
PWLAN_IE_RSN pRSN,
|
|
|
|
PWLAN_IE_RSN_EXT pRSNWPA,
|
|
|
|
PWLAN_IE_COUNTRY pIE_Country,
|
|
|
|
PWLAN_IE_QUIET pIE_Quiet,
|
|
|
|
u32 uIELength,
|
|
|
|
u8 *pbyIEs,
|
|
|
|
void *pRxPacketContext)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2013-01-17 23:15:22 +00:00
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
|
|
|
struct vnt_rx_mgmt *pRxPacket =
|
2014-01-04 15:25:10 +00:00
|
|
|
(struct vnt_rx_mgmt *) pRxPacketContext;
|
2013-01-17 23:15:22 +00:00
|
|
|
PKnownBSS pBSSList = NULL;
|
|
|
|
unsigned int ii;
|
2013-02-13 01:36:29 +00:00
|
|
|
bool bParsingQuiet = false;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:10 +00:00
|
|
|
pBSSList = (PKnownBSS) &(pMgmt->sBSSList[0]);
|
2014-01-04 15:25:06 +00:00
|
|
|
|
|
|
|
for (ii = 0; ii < MAX_BSS_NUM; ii++) {
|
2014-01-04 15:25:10 +00:00
|
|
|
pBSSList = (PKnownBSS) &(pMgmt->sBSSList[ii]);
|
2014-01-04 15:25:06 +00:00
|
|
|
if (!pBSSList->bActive)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-01-04 15:25:10 +00:00
|
|
|
if (ii == MAX_BSS_NUM) {
|
2014-01-04 15:25:18 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG,
|
|
|
|
KERN_INFO "Get free KnowBSS node failed.\n");
|
2014-01-04 15:25:06 +00:00
|
|
|
return false;
|
|
|
|
}
|
2014-01-04 15:25:07 +00:00
|
|
|
/* save the BSS info */
|
2014-01-04 15:25:06 +00:00
|
|
|
pBSSList->bActive = true;
|
2014-01-04 15:25:10 +00:00
|
|
|
memcpy(pBSSList->abyBSSID, abyBSSIDAddr, WLAN_BSSID_LEN);
|
2012-11-28 21:11:02 +00:00
|
|
|
pBSSList->qwBSSTimestamp = cpu_to_le64(qwTimestamp);
|
2014-01-04 15:25:06 +00:00
|
|
|
pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval);
|
|
|
|
pBSSList->wCapInfo = cpu_to_le16(wCapInfo);
|
|
|
|
pBSSList->uClearCount = 0;
|
|
|
|
|
|
|
|
if (pSSID->len > WLAN_SSID_MAXLEN)
|
|
|
|
pSSID->len = WLAN_SSID_MAXLEN;
|
2014-01-04 15:25:10 +00:00
|
|
|
memcpy(pBSSList->abySSID, pSSID, pSSID->len + WLAN_IEHDR_LEN);
|
2014-01-04 15:25:06 +00:00
|
|
|
|
|
|
|
pBSSList->uChannel = byCurrChannel;
|
|
|
|
|
|
|
|
if (pSuppRates->len > WLAN_RATES_MAXLEN)
|
|
|
|
pSuppRates->len = WLAN_RATES_MAXLEN;
|
2014-01-04 15:25:18 +00:00
|
|
|
memcpy(pBSSList->abySuppRates, pSuppRates,
|
|
|
|
pSuppRates->len + WLAN_IEHDR_LEN);
|
2014-01-04 15:25:06 +00:00
|
|
|
|
2014-01-04 15:25:17 +00:00
|
|
|
if (pExtSuppRates) {
|
2014-01-04 15:25:06 +00:00
|
|
|
if (pExtSuppRates->len > WLAN_RATES_MAXLEN)
|
|
|
|
pExtSuppRates->len = WLAN_RATES_MAXLEN;
|
2014-01-04 15:25:18 +00:00
|
|
|
memcpy(pBSSList->abyExtSuppRates, pExtSuppRates,
|
|
|
|
pExtSuppRates->len + WLAN_IEHDR_LEN);
|
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG,
|
|
|
|
KERN_INFO "BSSbInsertToBSSList: pExtSuppRates->len = %d\n",
|
|
|
|
pExtSuppRates->len);
|
2014-01-04 15:25:06 +00:00
|
|
|
|
|
|
|
} else {
|
2014-01-04 15:25:18 +00:00
|
|
|
memset(pBSSList->abyExtSuppRates, 0,
|
|
|
|
WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1);
|
2010-05-18 00:34:01 +00:00
|
|
|
}
|
2014-01-04 15:25:06 +00:00
|
|
|
pBSSList->sERP.byERP = psERP->byERP;
|
|
|
|
pBSSList->sERP.bERPExist = psERP->bERPExist;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/* Check if BSS is 802.11a/b/g */
|
2014-01-04 15:25:13 +00:00
|
|
|
if (pBSSList->uChannel > CB_MAX_CHANNEL_24G)
|
2014-01-04 15:25:06 +00:00
|
|
|
pBSSList->eNetworkTypeInUse = PHY_TYPE_11A;
|
2014-01-04 15:25:13 +00:00
|
|
|
else if (pBSSList->sERP.bERPExist == true)
|
|
|
|
pBSSList->eNetworkTypeInUse = PHY_TYPE_11G;
|
|
|
|
else
|
|
|
|
pBSSList->eNetworkTypeInUse = PHY_TYPE_11B;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:06 +00:00
|
|
|
pBSSList->byRxRate = pRxPacket->byRxRate;
|
|
|
|
pBSSList->qwLocalTSF = pRxPacket->qwLocalTSF;
|
|
|
|
pBSSList->uRSSI = pRxPacket->uRSSI;
|
|
|
|
pBSSList->bySQ = pRxPacket->bySQ;
|
2010-05-18 00:34:01 +00:00
|
|
|
|
2014-01-04 15:25:16 +00:00
|
|
|
if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA &&
|
|
|
|
pMgmt->eCurrState == WMAC_STATE_ASSOC &&
|
2014-01-04 15:25:15 +00:00
|
|
|
/* assoc with BSS */
|
2014-01-04 15:25:16 +00:00
|
|
|
pBSSList == pMgmt->pCurrBSS)
|
2014-01-04 15:25:15 +00:00
|
|
|
bParsingQuiet = true;
|
2014-01-04 15:25:06 +00:00
|
|
|
|
|
|
|
WPA_ClearRSN(pBSSList);
|
|
|
|
|
2014-01-04 15:25:17 +00:00
|
|
|
if (pRSNWPA) {
|
2014-01-04 15:25:06 +00:00
|
|
|
unsigned int uLen = pRSNWPA->len + 2;
|
|
|
|
|
|
|
|
if (uLen <= (uIELength -
|
2014-01-04 15:25:18 +00:00
|
|
|
(unsigned int) (u32) ((u8 *) pRSNWPA - pbyIEs))) {
|
2014-01-04 15:25:06 +00:00
|
|
|
pBSSList->wWPALen = uLen;
|
|
|
|
memcpy(pBSSList->byWPAIE, pRSNWPA, uLen);
|
|
|
|
WPA_ParseRSN(pBSSList, pRSNWPA);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
WPA2_ClearRSN(pBSSList);
|
|
|
|
|
2014-01-04 15:25:17 +00:00
|
|
|
if (pRSN) {
|
2014-01-04 15:25:06 +00:00
|
|
|
unsigned int uLen = pRSN->len + 2;
|
|
|
|
|
|
|
|
if (uLen <= (uIELength -
|
2014-01-04 15:25:18 +00:00
|
|
|
(unsigned int) (u32) ((u8 *) pRSN - pbyIEs))) {
|
2014-01-04 15:25:06 +00:00
|
|
|
pBSSList->wRSNLen = uLen;
|
|
|
|
memcpy(pBSSList->byRSNIE, pRSN, uLen);
|
|
|
|
WPA2vParseRSN(pBSSList, pRSN);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-04 15:25:18 +00:00
|
|
|
if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2 ||
|
|
|
|
pBSSList->bWPA2Valid == true) {
|
2014-01-04 15:25:06 +00:00
|
|
|
|
|
|
|
PSKeyItem pTransmitKey = NULL;
|
|
|
|
bool bIs802_1x = false;
|
|
|
|
|
2014-01-04 15:25:09 +00:00
|
|
|
for (ii = 0; ii < pBSSList->wAKMSSAuthCount; ii++) {
|
2014-01-04 15:25:18 +00:00
|
|
|
if (pBSSList->abyAKMSSAuthType[ii] ==
|
|
|
|
WLAN_11i_AKMSS_802_1X) {
|
2014-01-04 15:25:06 +00:00
|
|
|
bIs802_1x = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2014-01-04 15:25:18 +00:00
|
|
|
if (bIs802_1x == true &&
|
|
|
|
pSSID->len == ((PWLAN_IE_SSID) pMgmt->abyDesireSSID)->len &&
|
|
|
|
!memcmp(pSSID->abySSID,
|
|
|
|
((PWLAN_IE_SSID) pMgmt->abyDesireSSID)->abySSID,
|
|
|
|
pSSID->len)) {
|
2014-01-04 15:25:06 +00:00
|
|
|
|
|
|
|
bAdd_PMKID_Candidate((void *) pDevice,
|
|
|
|
pBSSList->abyBSSID,
|
|
|
|
&pBSSList->sRSNCapObj);
|
|
|
|
|
2014-01-04 15:25:16 +00:00
|
|
|
if (pDevice->bLinkPass == true &&
|
|
|
|
pMgmt->eCurrState == WMAC_STATE_ASSOC &&
|
|
|
|
(KeybGetTransmitKey(&(pDevice->sKey),
|
2014-01-04 15:25:15 +00:00
|
|
|
pDevice->abyBSSID,
|
|
|
|
PAIRWISE_KEY,
|
2014-01-04 15:25:16 +00:00
|
|
|
&pTransmitKey) == true ||
|
|
|
|
KeybGetTransmitKey(&(pDevice->sKey),
|
2014-01-04 15:25:15 +00:00
|
|
|
pDevice->abyBSSID,
|
|
|
|
GROUP_KEY,
|
2014-01-04 15:25:16 +00:00
|
|
|
&pTransmitKey) == true)) {
|
2014-01-04 15:25:18 +00:00
|
|
|
pDevice->gsPMKIDCandidate.StatusType =
|
|
|
|
Ndis802_11StatusType_PMKID_CandidateList;
|
2014-01-04 15:25:15 +00:00
|
|
|
pDevice->gsPMKIDCandidate.Version = 1;
|
2014-01-04 15:25:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pDevice->bUpdateBBVGA) {
|
2014-01-04 15:25:07 +00:00
|
|
|
/* Monitor if RSSI is too strong. */
|
2014-01-04 15:25:06 +00:00
|
|
|
pBSSList->byRSSIStatCnt = 0;
|
2014-01-04 15:25:18 +00:00
|
|
|
RFvRSSITodBm(pDevice, (u8) (pRxPacket->uRSSI),
|
|
|
|
&pBSSList->ldBmMAX);
|
2014-01-04 15:25:06 +00:00
|
|
|
pBSSList->ldBmAverage[0] = pBSSList->ldBmMAX;
|
|
|
|
pBSSList->ldBmAverRange = pBSSList->ldBmMAX;
|
|
|
|
for (ii = 1; ii < RSSI_STAT_COUNT; ii++)
|
|
|
|
pBSSList->ldBmAverage[ii] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
pBSSList->uIELength = uIELength;
|
|
|
|
if (pBSSList->uIELength > WLAN_BEACON_FR_MAXLEN)
|
|
|
|
pBSSList->uIELength = WLAN_BEACON_FR_MAXLEN;
|
|
|
|
memcpy(pBSSList->abyIEs, pbyIEs, pBSSList->uIELength);
|
|
|
|
|
|
|
|
return true;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/*
|
2009-06-13 11:38:31 +00:00
|
|
|
* Routine Description:
|
2014-01-04 15:25:06 +00:00
|
|
|
* Update BSS set in known BSS list
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2014-01-04 15:25:06 +00:00
|
|
|
* true if success.
|
2014-01-04 15:25:07 +00:00
|
|
|
*/
|
|
|
|
/* TODO: input structure modify */
|
2013-01-17 23:15:22 +00:00
|
|
|
int BSSbUpdateToBSSList(struct vnt_private *pDevice,
|
2012-11-28 21:11:02 +00:00
|
|
|
u64 qwTimestamp,
|
2013-01-17 23:15:22 +00:00
|
|
|
u16 wBeaconInterval,
|
|
|
|
u16 wCapInfo,
|
|
|
|
u8 byCurrChannel,
|
|
|
|
int bChannelHit,
|
|
|
|
PWLAN_IE_SSID pSSID,
|
|
|
|
PWLAN_IE_SUPP_RATES pSuppRates,
|
|
|
|
PWLAN_IE_SUPP_RATES pExtSuppRates,
|
|
|
|
PERPObject psERP,
|
|
|
|
PWLAN_IE_RSN pRSN,
|
|
|
|
PWLAN_IE_RSN_EXT pRSNWPA,
|
|
|
|
PWLAN_IE_COUNTRY pIE_Country,
|
|
|
|
PWLAN_IE_QUIET pIE_Quiet,
|
|
|
|
PKnownBSS pBSSList,
|
|
|
|
u32 uIELength,
|
|
|
|
u8 *pbyIEs,
|
|
|
|
void *pRxPacketContext)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2013-01-17 23:15:22 +00:00
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
|
|
|
struct vnt_rx_mgmt *pRxPacket =
|
2014-01-04 15:25:10 +00:00
|
|
|
(struct vnt_rx_mgmt *) pRxPacketContext;
|
2013-01-17 23:15:22 +00:00
|
|
|
int ii, jj;
|
|
|
|
signed long ldBm, ldBmSum;
|
2013-02-13 01:36:29 +00:00
|
|
|
bool bParsingQuiet = false;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:17 +00:00
|
|
|
if (!pBSSList)
|
2014-01-04 15:25:06 +00:00
|
|
|
return false;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2012-11-28 21:11:02 +00:00
|
|
|
pBSSList->qwBSSTimestamp = cpu_to_le64(qwTimestamp);
|
|
|
|
|
2014-01-04 15:25:06 +00:00
|
|
|
pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval);
|
|
|
|
pBSSList->wCapInfo = cpu_to_le16(wCapInfo);
|
|
|
|
pBSSList->uClearCount = 0;
|
|
|
|
pBSSList->uChannel = byCurrChannel;
|
|
|
|
|
|
|
|
if (pSSID->len > WLAN_SSID_MAXLEN)
|
|
|
|
pSSID->len = WLAN_SSID_MAXLEN;
|
|
|
|
|
2014-01-04 15:25:16 +00:00
|
|
|
if (pSSID->len != 0 && pSSID->abySSID[0] != 0)
|
2014-01-04 15:25:06 +00:00
|
|
|
memcpy(pBSSList->abySSID, pSSID, pSSID->len + WLAN_IEHDR_LEN);
|
2014-01-04 15:25:18 +00:00
|
|
|
memcpy(pBSSList->abySuppRates, pSuppRates,
|
|
|
|
pSuppRates->len + WLAN_IEHDR_LEN);
|
2014-01-04 15:25:06 +00:00
|
|
|
|
2014-01-04 15:25:17 +00:00
|
|
|
if (pExtSuppRates)
|
2014-01-04 15:25:18 +00:00
|
|
|
memcpy(pBSSList->abyExtSuppRates, pExtSuppRates,
|
|
|
|
pExtSuppRates->len + WLAN_IEHDR_LEN);
|
2014-01-04 15:25:14 +00:00
|
|
|
else
|
2014-01-04 15:25:18 +00:00
|
|
|
memset(pBSSList->abyExtSuppRates, 0,
|
|
|
|
WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1);
|
2014-01-04 15:25:06 +00:00
|
|
|
pBSSList->sERP.byERP = psERP->byERP;
|
|
|
|
pBSSList->sERP.bERPExist = psERP->bERPExist;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/* Check if BSS is 802.11a/b/g */
|
2014-01-04 15:25:13 +00:00
|
|
|
if (pBSSList->uChannel > CB_MAX_CHANNEL_24G)
|
2014-01-04 15:25:06 +00:00
|
|
|
pBSSList->eNetworkTypeInUse = PHY_TYPE_11A;
|
2014-01-04 15:25:13 +00:00
|
|
|
else if (pBSSList->sERP.bERPExist == true)
|
|
|
|
pBSSList->eNetworkTypeInUse = PHY_TYPE_11G;
|
|
|
|
else
|
|
|
|
pBSSList->eNetworkTypeInUse = PHY_TYPE_11B;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:06 +00:00
|
|
|
pBSSList->byRxRate = pRxPacket->byRxRate;
|
|
|
|
pBSSList->qwLocalTSF = pRxPacket->qwLocalTSF;
|
2014-01-04 15:25:10 +00:00
|
|
|
if (bChannelHit)
|
2014-01-04 15:25:06 +00:00
|
|
|
pBSSList->uRSSI = pRxPacket->uRSSI;
|
|
|
|
pBSSList->bySQ = pRxPacket->bySQ;
|
|
|
|
|
2014-01-04 15:25:16 +00:00
|
|
|
if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA &&
|
|
|
|
pMgmt->eCurrState == WMAC_STATE_ASSOC &&
|
2014-01-04 15:25:15 +00:00
|
|
|
/* assoc with BSS */
|
2014-01-04 15:25:16 +00:00
|
|
|
pBSSList == pMgmt->pCurrBSS)
|
2014-01-04 15:25:15 +00:00
|
|
|
bParsingQuiet = true;
|
2014-01-04 15:25:06 +00:00
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
WPA_ClearRSN(pBSSList); /* mike update */
|
2014-01-04 15:25:06 +00:00
|
|
|
|
2014-01-04 15:25:17 +00:00
|
|
|
if (pRSNWPA) {
|
2014-01-04 15:25:06 +00:00
|
|
|
unsigned int uLen = pRSNWPA->len + 2;
|
|
|
|
if (uLen <= (uIELength -
|
2014-01-04 15:25:18 +00:00
|
|
|
(unsigned int) (u32) ((u8 *) pRSNWPA - pbyIEs))) {
|
2014-01-04 15:25:06 +00:00
|
|
|
pBSSList->wWPALen = uLen;
|
|
|
|
memcpy(pBSSList->byWPAIE, pRSNWPA, uLen);
|
|
|
|
WPA_ParseRSN(pBSSList, pRSNWPA);
|
2010-05-20 02:50:00 +00:00
|
|
|
}
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
WPA2_ClearRSN(pBSSList); /* mike update */
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:17 +00:00
|
|
|
if (pRSN) {
|
2014-01-04 15:25:06 +00:00
|
|
|
unsigned int uLen = pRSN->len + 2;
|
|
|
|
if (uLen <= (uIELength -
|
2014-01-04 15:25:18 +00:00
|
|
|
(unsigned int) (u32) ((u8 *) pRSN - pbyIEs))) {
|
2014-01-04 15:25:06 +00:00
|
|
|
pBSSList->wRSNLen = uLen;
|
|
|
|
memcpy(pBSSList->byRSNIE, pRSN, uLen);
|
|
|
|
WPA2vParseRSN(pBSSList, pRSN);
|
|
|
|
}
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:06 +00:00
|
|
|
if (pRxPacket->uRSSI != 0) {
|
2014-01-04 15:25:10 +00:00
|
|
|
RFvRSSITodBm(pDevice, (u8) (pRxPacket->uRSSI), &ldBm);
|
2014-01-04 15:25:07 +00:00
|
|
|
/* Monitor if RSSI is too strong. */
|
2014-01-04 15:25:06 +00:00
|
|
|
pBSSList->byRSSIStatCnt++;
|
|
|
|
pBSSList->byRSSIStatCnt %= RSSI_STAT_COUNT;
|
|
|
|
pBSSList->ldBmAverage[pBSSList->byRSSIStatCnt] = ldBm;
|
|
|
|
ldBmSum = 0;
|
|
|
|
for (ii = 0, jj = 0; ii < RSSI_STAT_COUNT; ii++) {
|
|
|
|
if (pBSSList->ldBmAverage[ii] != 0) {
|
|
|
|
pBSSList->ldBmMAX =
|
|
|
|
max(pBSSList->ldBmAverage[ii], ldBm);
|
|
|
|
ldBmSum +=
|
|
|
|
pBSSList->ldBmAverage[ii];
|
|
|
|
jj++;
|
|
|
|
}
|
|
|
|
}
|
2014-01-04 15:25:09 +00:00
|
|
|
pBSSList->ldBmAverRange = ldBmSum / jj;
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pBSSList->uIELength = uIELength;
|
|
|
|
if (pBSSList->uIELength > WLAN_BEACON_FR_MAXLEN)
|
|
|
|
pBSSList->uIELength = WLAN_BEACON_FR_MAXLEN;
|
|
|
|
memcpy(pBSSList->abyIEs, pbyIEs, pBSSList->uIELength);
|
|
|
|
|
|
|
|
return true;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/*
|
2009-06-13 11:38:31 +00:00
|
|
|
* Routine Description:
|
2014-01-04 15:25:06 +00:00
|
|
|
* Search Node DB table to find the index of matched DstAddr
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2014-01-04 15:25:06 +00:00
|
|
|
* None
|
2014-01-04 15:25:07 +00:00
|
|
|
*/
|
2013-01-17 23:15:22 +00:00
|
|
|
int BSSbIsSTAInNodeDB(struct vnt_private *pDevice,
|
2014-01-04 15:25:06 +00:00
|
|
|
u8 *abyDstAddr,
|
|
|
|
u32 *puNodeIndex)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2013-01-17 23:15:22 +00:00
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
|
|
|
unsigned int ii;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/* Index = 0 reserved for AP Node */
|
2014-01-04 15:25:06 +00:00
|
|
|
for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) {
|
2014-01-04 15:25:16 +00:00
|
|
|
if (pMgmt->sNodeDBTable[ii].bActive &&
|
|
|
|
ether_addr_equal(abyDstAddr,
|
|
|
|
pMgmt->sNodeDBTable[ii].abyMACAddr)) {
|
2014-01-04 15:25:15 +00:00
|
|
|
*puNodeIndex = ii;
|
|
|
|
return true;
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2009-06-13 11:38:31 +00:00
|
|
|
};
|
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/*
|
2009-06-13 11:38:31 +00:00
|
|
|
* Routine Description:
|
2014-01-04 15:25:06 +00:00
|
|
|
* Find an empty node and allocate it; if no empty node
|
|
|
|
* is found, then use the most inactive one.
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2014-01-04 15:25:06 +00:00
|
|
|
* None
|
2014-01-04 15:25:07 +00:00
|
|
|
*/
|
2013-01-17 23:15:22 +00:00
|
|
|
void BSSvCreateOneNode(struct vnt_private *pDevice, u32 *puNodeIndex)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2013-01-17 23:15:22 +00:00
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2014-01-04 15:25:06 +00:00
|
|
|
int ii;
|
2013-01-17 23:15:22 +00:00
|
|
|
u32 BigestCount = 0;
|
|
|
|
u32 SelectIndex;
|
2014-01-04 15:25:06 +00:00
|
|
|
struct sk_buff *skb;
|
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/* Index = 0 reserved for AP Node (In STA mode)
|
|
|
|
Index = 0 reserved for Broadcast/MultiCast (In AP mode) */
|
2014-01-04 15:25:06 +00:00
|
|
|
SelectIndex = 1;
|
|
|
|
for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) {
|
|
|
|
if (pMgmt->sNodeDBTable[ii].bActive) {
|
|
|
|
if (pMgmt->sNodeDBTable[ii].uInActiveCount > BigestCount) {
|
2014-01-04 15:25:18 +00:00
|
|
|
BigestCount =
|
|
|
|
pMgmt->sNodeDBTable[ii].uInActiveCount;
|
2014-01-04 15:25:06 +00:00
|
|
|
SelectIndex = ii;
|
|
|
|
}
|
2014-01-04 15:25:11 +00:00
|
|
|
} else {
|
2014-01-04 15:25:06 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/* if not found replace uInActiveCount with the largest one. */
|
2014-01-04 15:25:10 +00:00
|
|
|
if (ii == (MAX_NODE_NUM + 1)) {
|
2014-01-04 15:25:06 +00:00
|
|
|
*puNodeIndex = SelectIndex;
|
2014-01-04 15:25:18 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG,
|
|
|
|
KERN_INFO "Replace inactive node = %d\n", SelectIndex);
|
2014-01-04 15:25:07 +00:00
|
|
|
/* clear ps buffer */
|
2014-01-04 15:25:17 +00:00
|
|
|
if (pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue.next) {
|
|
|
|
while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue)))
|
2014-01-04 15:25:06 +00:00
|
|
|
dev_kfree_skb(skb);
|
|
|
|
}
|
2014-01-04 15:25:11 +00:00
|
|
|
} else {
|
2014-01-04 15:25:06 +00:00
|
|
|
*puNodeIndex = ii;
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(&pMgmt->sNodeDBTable[*puNodeIndex], 0, sizeof(KnownNodeDB));
|
|
|
|
pMgmt->sNodeDBTable[*puNodeIndex].bActive = true;
|
|
|
|
pMgmt->sNodeDBTable[*puNodeIndex].uRatePollTimeout = FALLBACK_POLL_SECOND;
|
2014-01-04 15:25:07 +00:00
|
|
|
/* for AP mode PS queue */
|
2014-01-04 15:25:06 +00:00
|
|
|
skb_queue_head_init(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue);
|
|
|
|
pMgmt->sNodeDBTable[*puNodeIndex].byAuthSequence = 0;
|
|
|
|
pMgmt->sNodeDBTable[*puNodeIndex].wEnQueueCnt = 0;
|
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Create node index = %d\n", ii);
|
2014-01-04 15:25:08 +00:00
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/*
|
2009-06-13 11:38:31 +00:00
|
|
|
* Routine Description:
|
2014-01-04 15:25:06 +00:00
|
|
|
* Remove Node by NodeIndex
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* Return Value:
|
2014-01-04 15:25:06 +00:00
|
|
|
* None
|
2014-01-04 15:25:07 +00:00
|
|
|
*/
|
2013-01-17 23:15:22 +00:00
|
|
|
void BSSvRemoveOneNode(struct vnt_private *pDevice, u32 uNodeIndex)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2013-01-17 23:15:22 +00:00
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
|
|
|
u8 byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
|
2014-01-04 15:25:06 +00:00
|
|
|
struct sk_buff *skb;
|
|
|
|
|
2014-01-04 15:25:17 +00:00
|
|
|
while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[uNodeIndex].sTxPSQueue)))
|
2014-01-04 15:25:06 +00:00
|
|
|
dev_kfree_skb(skb);
|
2014-01-04 15:25:07 +00:00
|
|
|
/* clear context */
|
2014-01-04 15:25:06 +00:00
|
|
|
memset(&pMgmt->sNodeDBTable[uNodeIndex], 0, sizeof(KnownNodeDB));
|
2014-01-04 15:25:07 +00:00
|
|
|
/* clear tx bit map */
|
2014-01-04 15:25:18 +00:00
|
|
|
pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[uNodeIndex].wAID >> 3] &=
|
|
|
|
~byMask[pMgmt->sNodeDBTable[uNodeIndex].wAID & 7];
|
2014-01-04 15:25:08 +00:00
|
|
|
}
|
2014-01-04 15:25:07 +00:00
|
|
|
|
|
|
|
/*
|
2009-06-13 11:38:31 +00:00
|
|
|
* Routine Description:
|
2014-01-04 15:25:06 +00:00
|
|
|
* Update AP Node content in Index 0 of KnownNodeDB
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* Return Value:
|
2014-01-04 15:25:06 +00:00
|
|
|
* None
|
2014-01-04 15:25:07 +00:00
|
|
|
*/
|
2014-01-04 15:25:06 +00:00
|
|
|
void BSSvUpdateAPNode(struct vnt_private *pDevice,
|
|
|
|
u16 *pwCapInfo,
|
|
|
|
PWLAN_IE_SUPP_RATES pSuppRates,
|
|
|
|
PWLAN_IE_SUPP_RATES pExtSuppRates)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2013-01-17 23:19:37 +00:00
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2013-01-17 23:15:22 +00:00
|
|
|
u32 uRateLen = WLAN_RATES_MAXLEN;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:06 +00:00
|
|
|
memset(&pMgmt->sNodeDBTable[0], 0, sizeof(KnownNodeDB));
|
|
|
|
|
|
|
|
pMgmt->sNodeDBTable[0].bActive = true;
|
2014-01-04 15:25:14 +00:00
|
|
|
if (pDevice->byBBType == BB_TYPE_11B)
|
2014-01-04 15:25:06 +00:00
|
|
|
uRateLen = WLAN_RATES_MAXLEN_11B;
|
2014-01-04 15:25:10 +00:00
|
|
|
pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES) pSuppRates,
|
|
|
|
(PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates,
|
2014-01-04 15:25:06 +00:00
|
|
|
uRateLen);
|
2014-01-04 15:25:10 +00:00
|
|
|
pMgmt->abyCurrExtSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES) pExtSuppRates,
|
2014-01-04 15:25:18 +00:00
|
|
|
(PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates,
|
|
|
|
uRateLen);
|
2014-01-04 15:25:06 +00:00
|
|
|
RATEvParseMaxRate((void *) pDevice,
|
2014-01-04 15:25:10 +00:00
|
|
|
(PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates,
|
|
|
|
(PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates,
|
2014-01-04 15:25:06 +00:00
|
|
|
true,
|
|
|
|
&(pMgmt->sNodeDBTable[0].wMaxBasicRate),
|
|
|
|
&(pMgmt->sNodeDBTable[0].wMaxSuppRate),
|
|
|
|
&(pMgmt->sNodeDBTable[0].wSuppRate),
|
|
|
|
&(pMgmt->sNodeDBTable[0].byTopCCKBasicRate),
|
|
|
|
&(pMgmt->sNodeDBTable[0].byTopOFDMBasicRate));
|
2014-01-04 15:25:18 +00:00
|
|
|
memcpy(pMgmt->sNodeDBTable[0].abyMACAddr, pMgmt->abyCurrBSSID,
|
|
|
|
WLAN_ADDR_LEN);
|
2014-01-04 15:25:06 +00:00
|
|
|
pMgmt->sNodeDBTable[0].wTxDataRate = pMgmt->sNodeDBTable[0].wMaxSuppRate;
|
2014-01-04 15:25:18 +00:00
|
|
|
pMgmt->sNodeDBTable[0].bShortPreamble =
|
|
|
|
WLAN_GET_CAP_INFO_SHORTPREAMBLE(*pwCapInfo);
|
2014-01-04 15:25:06 +00:00
|
|
|
pMgmt->sNodeDBTable[0].uRatePollTimeout = FALLBACK_POLL_SECOND;
|
2014-01-04 15:25:07 +00:00
|
|
|
/* Auto rate fallback function initiation.
|
|
|
|
* RATEbInit(pDevice); */
|
2014-01-04 15:25:18 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG,
|
|
|
|
KERN_INFO"pMgmt->sNodeDBTable[0].wTxDataRate = %d\n",
|
|
|
|
pMgmt->sNodeDBTable[0].wTxDataRate);
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:08 +00:00
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/*
|
2009-06-13 11:38:31 +00:00
|
|
|
* Routine Description:
|
2014-01-04 15:25:06 +00:00
|
|
|
* Add Multicast Node content in Index 0 of KnownNodeDB
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* Return Value:
|
2014-01-04 15:25:06 +00:00
|
|
|
* None
|
2014-01-04 15:25:07 +00:00
|
|
|
*/
|
2013-01-17 23:15:22 +00:00
|
|
|
void BSSvAddMulticastNode(struct vnt_private *pDevice)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2013-01-17 23:15:22 +00:00
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:06 +00:00
|
|
|
if (!pDevice->bEnableHostWEP)
|
|
|
|
memset(&pMgmt->sNodeDBTable[0], 0, sizeof(KnownNodeDB));
|
|
|
|
memset(pMgmt->sNodeDBTable[0].abyMACAddr, 0xff, WLAN_ADDR_LEN);
|
|
|
|
pMgmt->sNodeDBTable[0].bActive = true;
|
|
|
|
pMgmt->sNodeDBTable[0].bPSEnable = false;
|
|
|
|
skb_queue_head_init(&pMgmt->sNodeDBTable[0].sTxPSQueue);
|
|
|
|
RATEvParseMaxRate((void *) pDevice,
|
2014-01-04 15:25:10 +00:00
|
|
|
(PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates,
|
|
|
|
(PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates,
|
2014-01-04 15:25:06 +00:00
|
|
|
true,
|
|
|
|
&(pMgmt->sNodeDBTable[0].wMaxBasicRate),
|
|
|
|
&(pMgmt->sNodeDBTable[0].wMaxSuppRate),
|
|
|
|
&(pMgmt->sNodeDBTable[0].wSuppRate),
|
|
|
|
&(pMgmt->sNodeDBTable[0].byTopCCKBasicRate),
|
|
|
|
&(pMgmt->sNodeDBTable[0].byTopOFDMBasicRate));
|
|
|
|
pMgmt->sNodeDBTable[0].wTxDataRate = pMgmt->sNodeDBTable[0].wMaxBasicRate;
|
|
|
|
pMgmt->sNodeDBTable[0].uRatePollTimeout = FALLBACK_POLL_SECOND;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:08 +00:00
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/*
|
2009-06-13 11:38:31 +00:00
|
|
|
* Routine Description:
|
|
|
|
*
|
|
|
|
*
|
2014-01-04 15:25:06 +00:00
|
|
|
* Second call back function to update Node DB info & AP link status
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* Return Value:
|
2014-01-04 15:25:06 +00:00
|
|
|
* none.
|
2014-01-04 15:25:07 +00:00
|
|
|
*/
|
2013-09-27 15:51:13 +00:00
|
|
|
void BSSvSecondCallBack(struct work_struct *work)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2013-09-27 15:51:13 +00:00
|
|
|
struct vnt_private *pDevice = container_of(work,
|
|
|
|
struct vnt_private, second_callback_work.work);
|
2013-01-17 23:15:22 +00:00
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
|
|
|
int ii;
|
|
|
|
PWLAN_IE_SSID pItemSSID, pCurrSSID;
|
|
|
|
u32 uSleepySTACnt = 0;
|
|
|
|
u32 uNonShortSlotSTACnt = 0;
|
|
|
|
u32 uLongPreambleSTACnt = 0;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2013-10-14 18:51:45 +00:00
|
|
|
if (pDevice->Flags & fMP_DISCONNECTED)
|
|
|
|
return;
|
|
|
|
|
2014-01-04 15:25:06 +00:00
|
|
|
spin_lock_irq(&pDevice->lock);
|
|
|
|
|
|
|
|
pDevice->uAssocCount = 0;
|
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/* Power Saving Mode Tx Burst */
|
2014-01-04 15:25:10 +00:00
|
|
|
if (pDevice->bEnablePSMode == true) {
|
2014-01-04 15:25:06 +00:00
|
|
|
pDevice->ulPSModeWaitTx++;
|
2014-01-04 15:25:10 +00:00
|
|
|
if (pDevice->ulPSModeWaitTx >= 2) {
|
2014-01-04 15:25:06 +00:00
|
|
|
pDevice->ulPSModeWaitTx = 0;
|
|
|
|
pDevice->bPSModeTxBurst = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pDevice->byERPFlag &=
|
|
|
|
~(WLAN_SET_ERP_BARKER_MODE(1) | WLAN_SET_ERP_NONERP_PRESENT(1));
|
|
|
|
|
|
|
|
if (pDevice->wUseProtectCntDown > 0) {
|
2014-01-04 15:25:09 +00:00
|
|
|
pDevice->wUseProtectCntDown--;
|
2014-01-04 15:25:11 +00:00
|
|
|
} else {
|
2014-01-04 15:25:07 +00:00
|
|
|
/* disable protect mode */
|
2014-01-04 15:25:06 +00:00
|
|
|
pDevice->byERPFlag &= ~(WLAN_SET_ERP_USE_PROTECTION(1));
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:10 +00:00
|
|
|
if (pDevice->byReAssocCount > 0) {
|
2014-01-04 15:25:06 +00:00
|
|
|
pDevice->byReAssocCount++;
|
2014-01-04 15:25:18 +00:00
|
|
|
if (pDevice->byReAssocCount > 10 &&
|
|
|
|
pDevice->bLinkPass != true) { /* 10 sec timeout */
|
2014-01-04 15:25:06 +00:00
|
|
|
printk("Re-association timeout!!!\n");
|
|
|
|
pDevice->byReAssocCount = 0;
|
2014-01-04 15:25:10 +00:00
|
|
|
/* if (pDevice->bWPASuppWextEnabled == true) */
|
2014-01-04 15:25:06 +00:00
|
|
|
{
|
|
|
|
union iwreq_data wrqu;
|
2014-01-04 15:25:10 +00:00
|
|
|
memset(&wrqu, 0, sizeof(wrqu));
|
2014-01-04 15:25:06 +00:00
|
|
|
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
|
|
|
|
PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n");
|
2014-01-04 15:25:18 +00:00
|
|
|
wireless_send_event(pDevice->dev, SIOCGIWAP,
|
|
|
|
&wrqu, NULL);
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
2014-01-04 15:25:14 +00:00
|
|
|
} else if (pDevice->bLinkPass == true) {
|
2014-01-04 15:25:06 +00:00
|
|
|
pDevice->byReAssocCount = 0;
|
2014-01-04 15:25:14 +00:00
|
|
|
}
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
|
|
|
|
2014-01-04 15:25:10 +00:00
|
|
|
pMgmt->eLastState = pMgmt->eCurrState;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2013-01-17 23:15:22 +00:00
|
|
|
s_uCalculateLinkQual(pDevice);
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:06 +00:00
|
|
|
for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) {
|
|
|
|
|
|
|
|
if (pMgmt->sNodeDBTable[ii].bActive) {
|
2014-01-04 15:25:07 +00:00
|
|
|
/* Increase in-activity counter */
|
2014-01-04 15:25:06 +00:00
|
|
|
pMgmt->sNodeDBTable[ii].uInActiveCount++;
|
|
|
|
|
|
|
|
if (ii > 0) {
|
2014-01-04 15:25:18 +00:00
|
|
|
if (pMgmt->sNodeDBTable[ii].uInActiveCount >
|
|
|
|
MAX_INACTIVE_COUNT) {
|
2014-01-04 15:25:06 +00:00
|
|
|
BSSvRemoveOneNode(pDevice, ii);
|
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
|
2014-01-04 15:25:18 +00:00
|
|
|
"Inactive timeout [%d] sec, STA index = [%d] remove\n",
|
|
|
|
MAX_INACTIVE_COUNT, ii);
|
2014-01-04 15:25:06 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-01-04 15:25:18 +00:00
|
|
|
if (pMgmt->sNodeDBTable[ii].eNodeState >=
|
|
|
|
NODE_ASSOC) {
|
2014-01-04 15:25:06 +00:00
|
|
|
|
|
|
|
pDevice->uAssocCount++;
|
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/* check if Non ERP exist */
|
2014-01-04 15:25:18 +00:00
|
|
|
if (pMgmt->sNodeDBTable[ii].uInActiveCount <
|
|
|
|
ERP_RECOVER_COUNT) {
|
2014-01-04 15:25:06 +00:00
|
|
|
if (!pMgmt->sNodeDBTable[ii].bShortPreamble) {
|
2014-01-04 15:25:18 +00:00
|
|
|
pDevice->byERPFlag |=
|
|
|
|
WLAN_SET_ERP_BARKER_MODE(1);
|
2014-01-04 15:25:09 +00:00
|
|
|
uLongPreambleSTACnt++;
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
|
|
|
if (!pMgmt->sNodeDBTable[ii].bERPExist) {
|
2014-01-04 15:25:18 +00:00
|
|
|
pDevice->byERPFlag |=
|
|
|
|
WLAN_SET_ERP_NONERP_PRESENT(1);
|
|
|
|
pDevice->byERPFlag |=
|
|
|
|
WLAN_SET_ERP_USE_PROTECTION(1);
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
|
|
|
if (!pMgmt->sNodeDBTable[ii].bShortSlotTime)
|
|
|
|
uNonShortSlotSTACnt++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/* check if any STA in PS mode */
|
2014-01-04 15:25:06 +00:00
|
|
|
if (pMgmt->sNodeDBTable[ii].bPSEnable)
|
|
|
|
uSleepySTACnt++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/* Rate fallback check */
|
2014-01-04 15:25:06 +00:00
|
|
|
if (!pDevice->bFixRate) {
|
|
|
|
if (ii > 0) {
|
2014-01-04 15:25:07 +00:00
|
|
|
/* ii = 0 for multicast node (AP & Adhoc) */
|
2014-01-04 15:25:10 +00:00
|
|
|
RATEvTxRateFallBack((void *) pDevice,
|
2014-01-04 15:25:06 +00:00
|
|
|
&(pMgmt->sNodeDBTable[ii]));
|
2014-01-04 15:25:13 +00:00
|
|
|
} else if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) {
|
2014-01-04 15:25:07 +00:00
|
|
|
/* ii = 0 reserved for unicast AP node (Infra STA) */
|
2014-01-04 15:25:13 +00:00
|
|
|
RATEvTxRateFallBack((void *) pDevice,
|
|
|
|
&(pMgmt->sNodeDBTable[ii]));
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/* check if pending PS queue */
|
2014-01-04 15:25:06 +00:00
|
|
|
if (pMgmt->sNodeDBTable[ii].wEnQueueCnt != 0) {
|
2014-01-04 15:25:18 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG,
|
|
|
|
KERN_INFO "Index= %d, Queue = %d pending\n",
|
|
|
|
ii,
|
|
|
|
pMgmt->sNodeDBTable[ii].wEnQueueCnt);
|
|
|
|
if (ii > 0 &&
|
|
|
|
pMgmt->sNodeDBTable[ii].wEnQueueCnt > 15) {
|
2014-01-04 15:25:06 +00:00
|
|
|
BSSvRemoveOneNode(pDevice, ii);
|
2014-01-04 15:25:18 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_NOTICE,
|
|
|
|
KERN_INFO "Pending many queues PS STA Index = %d remove\n",
|
|
|
|
ii);
|
2014-01-04 15:25:06 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2010-05-06 23:34:29 +00:00
|
|
|
}
|
2014-01-04 15:25:06 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-01-04 15:25:18 +00:00
|
|
|
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP &&
|
|
|
|
pDevice->byBBType == BB_TYPE_11G) {
|
2014-01-04 15:25:06 +00:00
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/* on/off protect mode */
|
2014-01-04 15:25:06 +00:00
|
|
|
if (WLAN_GET_ERP_USE_PROTECTION(pDevice->byERPFlag)) {
|
|
|
|
if (!pDevice->bProtectMode) {
|
|
|
|
MACvEnableProtectMD(pDevice);
|
|
|
|
pDevice->bProtectMode = true;
|
|
|
|
}
|
2014-01-04 15:25:13 +00:00
|
|
|
} else if (pDevice->bProtectMode) {
|
|
|
|
MACvDisableProtectMD(pDevice);
|
|
|
|
pDevice->bProtectMode = false;
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
2014-01-04 15:25:07 +00:00
|
|
|
/* on/off short slot time */
|
2014-01-04 15:25:06 +00:00
|
|
|
|
|
|
|
if (uNonShortSlotSTACnt > 0) {
|
|
|
|
if (pDevice->bShortSlotTime) {
|
|
|
|
pDevice->bShortSlotTime = false;
|
|
|
|
BBvSetShortSlotTime(pDevice);
|
2014-01-04 15:25:10 +00:00
|
|
|
vUpdateIFS((void *) pDevice);
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
2014-01-04 15:25:13 +00:00
|
|
|
} else if (!pDevice->bShortSlotTime) {
|
2014-01-04 15:25:06 +00:00
|
|
|
pDevice->bShortSlotTime = true;
|
|
|
|
BBvSetShortSlotTime(pDevice);
|
2014-01-04 15:25:10 +00:00
|
|
|
vUpdateIFS((void *) pDevice);
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/* on/off barker long preamble mode */
|
2014-01-04 15:25:06 +00:00
|
|
|
|
|
|
|
if (uLongPreambleSTACnt > 0) {
|
|
|
|
if (!pDevice->bBarkerPreambleMd) {
|
|
|
|
MACvEnableBarkerPreambleMd(pDevice);
|
|
|
|
pDevice->bBarkerPreambleMd = true;
|
|
|
|
}
|
2014-01-04 15:25:13 +00:00
|
|
|
} else if (pDevice->bBarkerPreambleMd) {
|
2014-01-04 15:25:06 +00:00
|
|
|
MACvDisableBarkerPreambleMd(pDevice);
|
|
|
|
pDevice->bBarkerPreambleMd = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/* Check if any STA in PS mode, enable DTIM multicast deliver */
|
2014-01-04 15:25:06 +00:00
|
|
|
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
|
|
|
|
if (uSleepySTACnt > 0)
|
|
|
|
pMgmt->sNodeDBTable[0].bPSEnable = true;
|
|
|
|
else
|
|
|
|
pMgmt->sNodeDBTable[0].bPSEnable = false;
|
|
|
|
}
|
|
|
|
|
2014-01-04 15:25:10 +00:00
|
|
|
pItemSSID = (PWLAN_IE_SSID) pMgmt->abyDesireSSID;
|
|
|
|
pCurrSSID = (PWLAN_IE_SSID) pMgmt->abyCurrSSID;
|
2014-01-04 15:25:06 +00:00
|
|
|
|
2014-01-04 15:25:16 +00:00
|
|
|
if (pMgmt->eCurrMode == WMAC_MODE_STANDBY ||
|
2014-01-04 15:25:18 +00:00
|
|
|
pMgmt->eCurrMode == WMAC_MODE_ESS_STA) {
|
2014-01-04 15:25:06 +00:00
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
if (pMgmt->sNodeDBTable[0].bActive) { /* Assoc with BSS */
|
2014-01-04 15:25:06 +00:00
|
|
|
|
|
|
|
if (pDevice->bUpdateBBVGA) {
|
|
|
|
s_vCheckSensitivity(pDevice);
|
|
|
|
s_vCheckPreEDThreshold(pDevice);
|
|
|
|
}
|
|
|
|
|
2014-01-04 15:25:18 +00:00
|
|
|
if (pMgmt->sNodeDBTable[0].uInActiveCount >=
|
|
|
|
(LOST_BEACON_COUNT/2) &&
|
|
|
|
pDevice->byBBVGACurrent != pDevice->abyBBVGA[0]) {
|
2014-01-04 15:25:06 +00:00
|
|
|
pDevice->byBBVGANew = pDevice->abyBBVGA[0];
|
|
|
|
bScheduleCommand((void *) pDevice,
|
2014-01-04 15:25:18 +00:00
|
|
|
WLAN_CMD_CHANGE_BBSENSITIVITY,
|
|
|
|
NULL);
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
|
|
|
|
2014-01-04 15:25:18 +00:00
|
|
|
if (pMgmt->sNodeDBTable[0].uInActiveCount >=
|
|
|
|
LOST_BEACON_COUNT) {
|
2014-01-04 15:25:06 +00:00
|
|
|
pMgmt->sNodeDBTable[0].bActive = false;
|
|
|
|
pMgmt->eCurrMode = WMAC_MODE_STANDBY;
|
|
|
|
pMgmt->eCurrState = WMAC_STATE_IDLE;
|
|
|
|
netif_stop_queue(pDevice->dev);
|
|
|
|
pDevice->bLinkPass = false;
|
2014-01-04 15:25:18 +00:00
|
|
|
ControlvMaskByte(pDevice,
|
|
|
|
MESSAGE_REQUEST_MACREG,
|
|
|
|
MAC_REG_PAPEDELAY, LEDSTS_STS,
|
|
|
|
LEDSTS_SLOW);
|
2014-01-04 15:25:06 +00:00
|
|
|
pDevice->bRoaming = true;
|
|
|
|
pDevice->bIsRoaming = false;
|
|
|
|
|
2014-01-04 15:25:18 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_NOTICE,
|
|
|
|
KERN_INFO "Lost AP beacon [%d] sec, disconnected !\n",
|
|
|
|
pMgmt->sNodeDBTable[0].uInActiveCount);
|
2014-01-04 15:25:06 +00:00
|
|
|
/* let wpa supplicant know AP may disconnect */
|
|
|
|
{
|
|
|
|
union iwreq_data wrqu;
|
2014-01-04 15:25:10 +00:00
|
|
|
memset(&wrqu, 0, sizeof(wrqu));
|
2014-01-04 15:25:06 +00:00
|
|
|
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
|
|
|
|
PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n");
|
2014-01-04 15:25:18 +00:00
|
|
|
wireless_send_event(pDevice->dev,
|
|
|
|
SIOCGIWAP,
|
|
|
|
&wrqu,
|
|
|
|
NULL);
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
|
|
|
}
|
2014-01-04 15:25:11 +00:00
|
|
|
} else if (pItemSSID->len != 0) {
|
2014-01-04 15:25:07 +00:00
|
|
|
/* Davidwang */
|
2014-01-04 15:25:18 +00:00
|
|
|
if ((pDevice->bEnableRoaming == true) &&
|
|
|
|
(!(pMgmt->Cisco_cckm))) {
|
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG,
|
|
|
|
KERN_INFO "bRoaming %d, !\n",
|
|
|
|
pDevice->bRoaming);
|
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG,
|
|
|
|
KERN_INFO "bIsRoaming %d, !\n",
|
|
|
|
pDevice->bIsRoaming);
|
|
|
|
if ((pDevice->bRoaming == true) &&
|
|
|
|
(pDevice->bIsRoaming == true)) {
|
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG,
|
|
|
|
KERN_INFO "Fast Roaming ...\n");
|
|
|
|
BSSvClearBSSList((void *) pDevice,
|
|
|
|
pDevice->bLinkPass);
|
2014-01-04 15:25:06 +00:00
|
|
|
bScheduleCommand((void *) pDevice,
|
2014-01-04 15:25:18 +00:00
|
|
|
WLAN_CMD_BSSID_SCAN,
|
|
|
|
pMgmt->abyDesireSSID);
|
2014-01-04 15:25:06 +00:00
|
|
|
bScheduleCommand((void *) pDevice,
|
2014-01-04 15:25:18 +00:00
|
|
|
WLAN_CMD_SSID,
|
|
|
|
pMgmt->abyDesireSSID);
|
2014-01-04 15:25:06 +00:00
|
|
|
pDevice->uAutoReConnectTime = 0;
|
|
|
|
pDevice->uIsroamingTime = 0;
|
|
|
|
pDevice->bRoaming = false;
|
2014-01-04 15:25:18 +00:00
|
|
|
} else if (pDevice->bRoaming == false &&
|
|
|
|
pDevice->bIsRoaming == true) {
|
2014-01-04 15:25:06 +00:00
|
|
|
pDevice->uIsroamingTime++;
|
|
|
|
if (pDevice->uIsroamingTime >= 20)
|
|
|
|
pDevice->bIsRoaming = false;
|
|
|
|
}
|
2014-01-04 15:25:13 +00:00
|
|
|
} else if (pDevice->uAutoReConnectTime < 10) {
|
|
|
|
pDevice->uAutoReConnectTime++;
|
|
|
|
/* network manager support need not do Roaming scan??? */
|
|
|
|
if (pDevice->bWPASuppWextEnabled == true)
|
2014-01-04 15:25:06 +00:00
|
|
|
pDevice->uAutoReConnectTime = 0;
|
2014-01-04 15:25:13 +00:00
|
|
|
} else {
|
|
|
|
/* mike use old encryption status for wpa reauthen */
|
|
|
|
if (pDevice->bWPADEVUp)
|
2014-01-04 15:25:18 +00:00
|
|
|
pDevice->eEncryptionStatus =
|
|
|
|
pDevice->eOldEncryptionStatus;
|
2014-01-04 15:25:13 +00:00
|
|
|
|
2014-01-04 15:25:18 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG,
|
|
|
|
KERN_INFO "Roaming ...\n");
|
|
|
|
BSSvClearBSSList((void *) pDevice,
|
|
|
|
pDevice->bLinkPass);
|
2014-01-04 15:25:13 +00:00
|
|
|
pMgmt->eScanType = WMAC_SCAN_ACTIVE;
|
|
|
|
bScheduleCommand((void *) pDevice,
|
|
|
|
WLAN_CMD_BSSID_SCAN,
|
|
|
|
pMgmt->abyDesireSSID);
|
|
|
|
bScheduleCommand((void *) pDevice,
|
|
|
|
WLAN_CMD_SSID,
|
|
|
|
pMgmt->abyDesireSSID);
|
|
|
|
pDevice->uAutoReConnectTime = 0;
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
|
2014-01-04 15:25:07 +00:00
|
|
|
/* if adhoc started which essid is NULL string, rescanning. */
|
2014-01-04 15:25:18 +00:00
|
|
|
if (pMgmt->eCurrState == WMAC_STATE_STARTED &&
|
|
|
|
pCurrSSID->len == 0) {
|
2014-01-04 15:25:06 +00:00
|
|
|
if (pDevice->uAutoReConnectTime < 10) {
|
|
|
|
pDevice->uAutoReConnectTime++;
|
2014-01-04 15:25:11 +00:00
|
|
|
} else {
|
2014-01-04 15:25:18 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_NOTICE,
|
|
|
|
KERN_INFO "Adhoc re-scanning ...\n");
|
2014-01-04 15:25:06 +00:00
|
|
|
pMgmt->eScanType = WMAC_SCAN_ACTIVE;
|
2014-01-04 15:25:18 +00:00
|
|
|
bScheduleCommand((void *) pDevice,
|
|
|
|
WLAN_CMD_BSSID_SCAN, NULL);
|
|
|
|
bScheduleCommand((void *) pDevice,
|
|
|
|
WLAN_CMD_SSID, NULL);
|
2014-01-04 15:25:06 +00:00
|
|
|
pDevice->uAutoReConnectTime = 0;
|
2014-01-04 15:25:08 +00:00
|
|
|
}
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
|
|
|
if (pMgmt->eCurrState == WMAC_STATE_JOINTED) {
|
|
|
|
|
|
|
|
if (pDevice->bUpdateBBVGA) {
|
|
|
|
s_vCheckSensitivity(pDevice);
|
|
|
|
s_vCheckPreEDThreshold(pDevice);
|
|
|
|
}
|
2014-01-04 15:25:18 +00:00
|
|
|
if (pMgmt->sNodeDBTable[0].uInActiveCount >=
|
|
|
|
ADHOC_LOST_BEACON_COUNT) {
|
|
|
|
DBG_PRT(MSG_LEVEL_NOTICE,
|
|
|
|
KERN_INFO "Lost other STA beacon [%d] sec, started !\n",
|
|
|
|
pMgmt->sNodeDBTable[0].uInActiveCount);
|
2014-01-04 15:25:06 +00:00
|
|
|
pMgmt->sNodeDBTable[0].uInActiveCount = 0;
|
|
|
|
pMgmt->eCurrState = WMAC_STATE_STARTED;
|
|
|
|
netif_stop_queue(pDevice->dev);
|
|
|
|
pDevice->bLinkPass = false;
|
2014-01-04 15:25:18 +00:00
|
|
|
ControlvMaskByte(pDevice,
|
|
|
|
MESSAGE_REQUEST_MACREG,
|
|
|
|
MAC_REG_PAPEDELAY, LEDSTS_STS,
|
|
|
|
LEDSTS_SLOW);
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2013-10-14 18:46:52 +00:00
|
|
|
if (pDevice->bLinkPass == true) {
|
2014-01-04 15:25:15 +00:00
|
|
|
if ((pMgmt->eAuthenMode < WMAC_AUTH_WPA ||
|
|
|
|
pDevice->fWPA_Authened == true) &&
|
|
|
|
(++pDevice->tx_data_time_out > 40)) {
|
|
|
|
pDevice->tx_trigger = true;
|
2013-10-14 18:46:52 +00:00
|
|
|
|
2014-01-04 15:25:15 +00:00
|
|
|
PSbSendNullPacket(pDevice);
|
2013-10-14 18:46:52 +00:00
|
|
|
|
2014-01-04 15:25:15 +00:00
|
|
|
pDevice->tx_trigger = false;
|
|
|
|
pDevice->tx_data_time_out = 0;
|
2013-10-14 18:46:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (netif_queue_stopped(pDevice->dev))
|
|
|
|
netif_wake_queue(pDevice->dev);
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:06 +00:00
|
|
|
spin_unlock_irq(&pDevice->lock);
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2013-09-27 15:51:13 +00:00
|
|
|
schedule_delayed_work(&pDevice->second_callback_work, HZ);
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/*
|
2009-06-13 11:38:31 +00:00
|
|
|
* Routine Description:
|
|
|
|
*
|
|
|
|
*
|
2014-01-04 15:25:06 +00:00
|
|
|
* Update Tx attemps, Tx failure counter in Node DB
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* Return Value:
|
2014-01-04 15:25:06 +00:00
|
|
|
* none.
|
2014-01-04 15:25:07 +00:00
|
|
|
*/
|
2013-12-09 22:30:14 +00:00
|
|
|
void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2013-01-17 23:15:22 +00:00
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2013-12-09 22:30:14 +00:00
|
|
|
struct vnt_tx_pkt_info *pkt_info = pDevice->pkt_info;
|
2013-01-17 23:15:22 +00:00
|
|
|
u32 uNodeIndex = 0;
|
|
|
|
u8 byTxRetry;
|
|
|
|
u16 wRate;
|
|
|
|
u16 wFallBackRate = RATE_1M;
|
|
|
|
u8 byFallBack;
|
|
|
|
int ii;
|
|
|
|
u8 *pbyDestAddr;
|
|
|
|
u8 byPktNum;
|
|
|
|
u16 wFIFOCtl;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:06 +00:00
|
|
|
byPktNum = (byPktNO & 0x0F) >> 4;
|
|
|
|
byTxRetry = (byTSR & 0xF0) >> 4;
|
|
|
|
wRate = (u16) (byPktNO & 0xF0) >> 4;
|
|
|
|
wFIFOCtl = pkt_info[byPktNum].fifo_ctl;
|
|
|
|
pbyDestAddr = pkt_info[byPktNum].dest_addr;
|
|
|
|
|
2014-01-04 15:25:14 +00:00
|
|
|
if (wFIFOCtl & FIFOCTL_AUTO_FB_0)
|
2014-01-04 15:25:06 +00:00
|
|
|
byFallBack = AUTO_FB_0;
|
2014-01-04 15:25:14 +00:00
|
|
|
else if (wFIFOCtl & FIFOCTL_AUTO_FB_1)
|
2014-01-04 15:25:06 +00:00
|
|
|
byFallBack = AUTO_FB_1;
|
2014-01-04 15:25:14 +00:00
|
|
|
else
|
2014-01-04 15:25:06 +00:00
|
|
|
byFallBack = AUTO_FB_NONE;
|
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/* Only Unicast using support rates */
|
2014-01-04 15:25:06 +00:00
|
|
|
if (wFIFOCtl & FIFOCTL_NEEDACK) {
|
|
|
|
if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) {
|
|
|
|
pMgmt->sNodeDBTable[0].uTxAttempts += 1;
|
2014-01-04 15:25:10 +00:00
|
|
|
if (!(byTSR & (TSR_TMO | TSR_RETRYTMO))) {
|
2014-01-04 15:25:07 +00:00
|
|
|
/* transmit success, TxAttempts at least plus one */
|
2014-01-04 15:25:06 +00:00
|
|
|
pMgmt->sNodeDBTable[0].uTxOk[MAX_RATE]++;
|
2014-01-04 15:25:10 +00:00
|
|
|
if ((byFallBack == AUTO_FB_NONE) ||
|
2014-01-04 15:25:18 +00:00
|
|
|
(wRate < RATE_18M)) {
|
2014-01-04 15:25:06 +00:00
|
|
|
wFallBackRate = wRate;
|
|
|
|
} else if (byFallBack == AUTO_FB_0) {
|
|
|
|
if (byTxRetry < 5)
|
2014-01-04 15:25:18 +00:00
|
|
|
wFallBackRate =
|
|
|
|
awHWRetry0[wRate-RATE_18M][byTxRetry];
|
2014-01-04 15:25:06 +00:00
|
|
|
else
|
2014-01-04 15:25:18 +00:00
|
|
|
wFallBackRate =
|
|
|
|
awHWRetry0[wRate-RATE_18M][4];
|
2014-01-04 15:25:06 +00:00
|
|
|
} else if (byFallBack == AUTO_FB_1) {
|
|
|
|
if (byTxRetry < 5)
|
2014-01-04 15:25:18 +00:00
|
|
|
wFallBackRate =
|
|
|
|
awHWRetry1[wRate-RATE_18M][byTxRetry];
|
2014-01-04 15:25:06 +00:00
|
|
|
else
|
|
|
|
wFallBackRate = awHWRetry1[wRate-RATE_18M][4];
|
|
|
|
}
|
|
|
|
pMgmt->sNodeDBTable[0].uTxOk[wFallBackRate]++;
|
|
|
|
} else {
|
2014-01-04 15:25:09 +00:00
|
|
|
pMgmt->sNodeDBTable[0].uTxFailures++;
|
2010-05-20 02:50:00 +00:00
|
|
|
}
|
2014-01-04 15:25:06 +00:00
|
|
|
pMgmt->sNodeDBTable[0].uTxRetry += byTxRetry;
|
|
|
|
if (byTxRetry != 0) {
|
2014-01-04 15:25:09 +00:00
|
|
|
pMgmt->sNodeDBTable[0].uTxFail[MAX_RATE] += byTxRetry;
|
2014-01-04 15:25:16 +00:00
|
|
|
if (byFallBack == AUTO_FB_NONE ||
|
2014-01-04 15:25:18 +00:00
|
|
|
wRate < RATE_18M) {
|
2014-01-04 15:25:09 +00:00
|
|
|
pMgmt->sNodeDBTable[0].uTxFail[wRate] += byTxRetry;
|
2014-01-04 15:25:06 +00:00
|
|
|
} else if (byFallBack == AUTO_FB_0) {
|
|
|
|
for (ii = 0; ii < byTxRetry; ii++) {
|
|
|
|
if (ii < 5)
|
|
|
|
wFallBackRate =
|
|
|
|
awHWRetry0[wRate-RATE_18M][ii];
|
|
|
|
else
|
|
|
|
wFallBackRate =
|
|
|
|
awHWRetry0[wRate-RATE_18M][4];
|
|
|
|
pMgmt->sNodeDBTable[0].uTxFail[wFallBackRate]++;
|
|
|
|
}
|
|
|
|
} else if (byFallBack == AUTO_FB_1) {
|
|
|
|
for (ii = 0; ii < byTxRetry; ii++) {
|
|
|
|
if (ii < 5)
|
|
|
|
wFallBackRate =
|
|
|
|
awHWRetry1[wRate-RATE_18M][ii];
|
|
|
|
else
|
|
|
|
wFallBackRate =
|
|
|
|
awHWRetry1[wRate-RATE_18M][4];
|
|
|
|
pMgmt->sNodeDBTable[0].uTxFail[wFallBackRate]++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-04 15:25:16 +00:00
|
|
|
if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA ||
|
|
|
|
pMgmt->eCurrMode == WMAC_MODE_ESS_AP) &&
|
|
|
|
BSSbIsSTAInNodeDB((void *) pDevice,
|
2014-01-04 15:25:15 +00:00
|
|
|
pbyDestAddr,
|
2014-01-04 15:25:16 +00:00
|
|
|
&uNodeIndex)) {
|
2014-01-04 15:25:15 +00:00
|
|
|
pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts += 1;
|
|
|
|
if (!(byTSR & (TSR_TMO | TSR_RETRYTMO))) {
|
|
|
|
/* transmit success, TxAttempts at least plus one */
|
|
|
|
pMgmt->sNodeDBTable[uNodeIndex].uTxOk[MAX_RATE]++;
|
|
|
|
if ((byFallBack == AUTO_FB_NONE) ||
|
|
|
|
(wRate < RATE_18M)) {
|
|
|
|
wFallBackRate = wRate;
|
|
|
|
} else if (byFallBack == AUTO_FB_0) {
|
|
|
|
if (byTxRetry < 5)
|
2014-01-04 15:25:18 +00:00
|
|
|
wFallBackRate =
|
|
|
|
awHWRetry0[wRate-RATE_18M][byTxRetry];
|
2014-01-04 15:25:15 +00:00
|
|
|
else
|
2014-01-04 15:25:18 +00:00
|
|
|
wFallBackRate =
|
|
|
|
awHWRetry0[wRate-RATE_18M][4];
|
2014-01-04 15:25:15 +00:00
|
|
|
} else if (byFallBack == AUTO_FB_1) {
|
|
|
|
if (byTxRetry < 5)
|
2014-01-04 15:25:18 +00:00
|
|
|
wFallBackRate =
|
|
|
|
awHWRetry1[wRate-RATE_18M][byTxRetry];
|
2014-01-04 15:25:15 +00:00
|
|
|
else
|
2014-01-04 15:25:18 +00:00
|
|
|
wFallBackRate =
|
|
|
|
awHWRetry1[wRate-RATE_18M][4];
|
2014-01-04 15:25:15 +00:00
|
|
|
}
|
|
|
|
pMgmt->sNodeDBTable[uNodeIndex].uTxOk[wFallBackRate]++;
|
|
|
|
} else {
|
|
|
|
pMgmt->sNodeDBTable[uNodeIndex].uTxFailures++;
|
|
|
|
}
|
|
|
|
pMgmt->sNodeDBTable[uNodeIndex].uTxRetry += byTxRetry;
|
|
|
|
if (byTxRetry != 0) {
|
|
|
|
pMgmt->sNodeDBTable[uNodeIndex].uTxFail[MAX_RATE] += byTxRetry;
|
|
|
|
if ((byFallBack == AUTO_FB_NONE) ||
|
2014-01-04 15:25:18 +00:00
|
|
|
(wRate < RATE_18M)) {
|
2014-01-04 15:25:15 +00:00
|
|
|
pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wRate] += byTxRetry;
|
|
|
|
} else if (byFallBack == AUTO_FB_0) {
|
|
|
|
for (ii = 0; ii < byTxRetry; ii++) {
|
|
|
|
if (ii < 5)
|
|
|
|
wFallBackRate =
|
|
|
|
awHWRetry0[wRate-RATE_18M][ii];
|
2014-01-04 15:25:06 +00:00
|
|
|
else
|
2014-01-04 15:25:15 +00:00
|
|
|
wFallBackRate =
|
|
|
|
awHWRetry0[wRate-RATE_18M][4];
|
|
|
|
pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wFallBackRate]++;
|
|
|
|
}
|
|
|
|
} else if (byFallBack == AUTO_FB_1) {
|
|
|
|
for (ii = 0; ii < byTxRetry; ii++) {
|
|
|
|
if (ii < 5)
|
|
|
|
wFallBackRate = awHWRetry1[wRate-RATE_18M][ii];
|
2014-01-04 15:25:06 +00:00
|
|
|
else
|
|
|
|
wFallBackRate = awHWRetry1[wRate-RATE_18M][4];
|
2014-01-04 15:25:15 +00:00
|
|
|
pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wFallBackRate]++;
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
|
|
|
}
|
2010-05-20 02:50:00 +00:00
|
|
|
}
|
2014-01-04 15:25:06 +00:00
|
|
|
}
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
2014-01-04 15:25:07 +00:00
|
|
|
/*
|
2009-06-13 11:38:31 +00:00
|
|
|
* Routine Description:
|
2014-01-04 15:25:06 +00:00
|
|
|
* Clear Nodes & skb in DB Table
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* Parameters:
|
2014-01-04 15:25:06 +00:00
|
|
|
* In:
|
|
|
|
* hDeviceContext - The adapter context.
|
|
|
|
* uStartIndex - starting index
|
|
|
|
* Out:
|
|
|
|
* none
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2014-01-04 15:25:06 +00:00
|
|
|
* None.
|
2014-01-04 15:25:07 +00:00
|
|
|
*/
|
2013-01-17 23:15:22 +00:00
|
|
|
void BSSvClearNodeDBTable(struct vnt_private *pDevice, u32 uStartIndex)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2013-01-17 23:15:22 +00:00
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2014-01-04 15:25:06 +00:00
|
|
|
struct sk_buff *skb;
|
2013-01-17 23:15:22 +00:00
|
|
|
int ii;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:06 +00:00
|
|
|
for (ii = uStartIndex; ii < (MAX_NODE_NUM + 1); ii++) {
|
|
|
|
if (pMgmt->sNodeDBTable[ii].bActive) {
|
2014-01-04 15:25:07 +00:00
|
|
|
/* check if sTxPSQueue has been initial */
|
2014-01-04 15:25:17 +00:00
|
|
|
if (pMgmt->sNodeDBTable[ii].sTxPSQueue.next) {
|
|
|
|
while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue))) {
|
2014-01-04 15:25:18 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG,
|
|
|
|
KERN_INFO "PS skb != NULL %d\n",
|
|
|
|
ii);
|
2014-01-04 15:25:06 +00:00
|
|
|
dev_kfree_skb(skb);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
memset(&pMgmt->sNodeDBTable[ii], 0, sizeof(KnownNodeDB));
|
|
|
|
}
|
|
|
|
}
|
2014-01-04 15:25:08 +00:00
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2013-01-17 23:15:22 +00:00
|
|
|
static void s_vCheckSensitivity(struct vnt_private *pDevice)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2013-01-17 23:15:22 +00:00
|
|
|
PKnownBSS pBSSList = NULL;
|
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
|
|
|
int ii;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:16 +00:00
|
|
|
if (pMgmt->eCurrState == WMAC_STATE_ASSOC ||
|
2014-01-04 15:25:18 +00:00
|
|
|
(pMgmt->eCurrMode == WMAC_MODE_IBSS_STA &&
|
|
|
|
pMgmt->eCurrState == WMAC_STATE_JOINTED)) {
|
|
|
|
pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID,
|
|
|
|
(PWLAN_IE_SSID) pMgmt->abyCurrSSID);
|
2014-01-04 15:25:17 +00:00
|
|
|
if (pBSSList) {
|
2014-01-04 15:25:06 +00:00
|
|
|
/* Update BB register if RSSI is too strong */
|
|
|
|
signed long LocalldBmAverage = 0;
|
|
|
|
signed long uNumofdBm = 0;
|
|
|
|
for (ii = 0; ii < RSSI_STAT_COUNT; ii++) {
|
|
|
|
if (pBSSList->ldBmAverage[ii] != 0) {
|
2014-01-04 15:25:09 +00:00
|
|
|
uNumofdBm++;
|
2014-01-04 15:25:06 +00:00
|
|
|
LocalldBmAverage += pBSSList->ldBmAverage[ii];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (uNumofdBm > 0) {
|
|
|
|
LocalldBmAverage = LocalldBmAverage/uNumofdBm;
|
2014-01-04 15:25:09 +00:00
|
|
|
for (ii = 0; ii < BB_VGA_LEVEL; ii++) {
|
2014-01-04 15:25:18 +00:00
|
|
|
DBG_PRT(MSG_LEVEL_DEBUG,
|
|
|
|
KERN_INFO"LocalldBmAverage:%ld, %ld %02x\n",
|
|
|
|
LocalldBmAverage,
|
|
|
|
pDevice->ldBmThreshold[ii],
|
|
|
|
pDevice->abyBBVGA[ii]);
|
2014-01-04 15:25:06 +00:00
|
|
|
if (LocalldBmAverage < pDevice->ldBmThreshold[ii]) {
|
2014-01-04 15:25:18 +00:00
|
|
|
pDevice->byBBVGANew =
|
|
|
|
pDevice->abyBBVGA[ii];
|
2014-01-04 15:25:06 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2014-01-04 15:25:18 +00:00
|
|
|
if (pDevice->byBBVGANew !=
|
|
|
|
pDevice->byBBVGACurrent) {
|
2014-01-04 15:25:06 +00:00
|
|
|
pDevice->uBBVGADiffCount++;
|
2014-01-04 15:25:18 +00:00
|
|
|
if (pDevice->uBBVGADiffCount >=
|
|
|
|
BB_VGA_CHANGE_THRESHOLD)
|
2014-01-04 15:25:06 +00:00
|
|
|
bScheduleCommand(pDevice,
|
|
|
|
WLAN_CMD_CHANGE_BBSENSITIVITY,
|
|
|
|
NULL);
|
|
|
|
} else {
|
|
|
|
pDevice->uBBVGADiffCount = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
2013-01-17 23:15:22 +00:00
|
|
|
static void s_uCalculateLinkQual(struct vnt_private *pDevice)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2013-12-09 22:25:48 +00:00
|
|
|
struct net_device_stats *stats = &pDevice->stats;
|
2013-01-17 23:15:22 +00:00
|
|
|
unsigned long TxOkRatio, TxCnt;
|
|
|
|
unsigned long RxOkRatio, RxCnt;
|
|
|
|
unsigned long RssiRatio;
|
2013-12-09 22:25:48 +00:00
|
|
|
unsigned long qual;
|
2013-01-17 23:15:22 +00:00
|
|
|
long ldBm;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2013-12-09 22:25:48 +00:00
|
|
|
TxCnt = stats->tx_packets + pDevice->wstats.discard.retries;
|
|
|
|
|
2013-12-09 22:28:24 +00:00
|
|
|
RxCnt = stats->rx_packets + stats->rx_frame_errors;
|
2013-12-09 22:25:48 +00:00
|
|
|
|
|
|
|
TxOkRatio = (TxCnt < 6) ? 4000:((stats->tx_packets * 4000) / TxCnt);
|
|
|
|
|
|
|
|
RxOkRatio = (RxCnt < 6) ? 2000 :
|
2013-12-09 22:28:24 +00:00
|
|
|
((stats->rx_packets * 2000) / RxCnt);
|
2013-12-09 22:25:48 +00:00
|
|
|
|
|
|
|
/* decide link quality */
|
|
|
|
if (pDevice->bLinkPass != true) {
|
|
|
|
pDevice->wstats.qual.qual = 0;
|
|
|
|
} else {
|
2014-01-04 15:25:10 +00:00
|
|
|
RFvRSSITodBm(pDevice, (u8) (pDevice->uCurrRSSI), &ldBm);
|
2013-12-09 22:25:48 +00:00
|
|
|
if (-ldBm < 50)
|
|
|
|
RssiRatio = 4000;
|
|
|
|
else if (-ldBm > 90)
|
|
|
|
RssiRatio = 0;
|
|
|
|
else
|
|
|
|
RssiRatio = (40-(-ldBm-50)) * 4000 / 40;
|
|
|
|
|
|
|
|
qual = (RssiRatio + TxOkRatio + RxOkRatio) / 100;
|
|
|
|
if (qual < 100)
|
2014-01-04 15:25:10 +00:00
|
|
|
pDevice->wstats.qual.qual = (u8) qual;
|
2013-12-09 22:25:48 +00:00
|
|
|
else
|
|
|
|
pDevice->wstats.qual.qual = 100;
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
2013-01-17 23:15:22 +00:00
|
|
|
void BSSvClearAnyBSSJoinRecord(struct vnt_private *pDevice)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2013-01-17 23:15:22 +00:00
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
|
|
|
int ii;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2011-11-30 02:19:25 +00:00
|
|
|
for (ii = 0; ii < MAX_BSS_NUM; ii++)
|
2013-02-13 01:36:29 +00:00
|
|
|
pMgmt->sBSSList[ii].bSelected = false;
|
2013-01-17 23:15:22 +00:00
|
|
|
|
|
|
|
return;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
2013-01-17 23:15:22 +00:00
|
|
|
static void s_vCheckPreEDThreshold(struct vnt_private *pDevice)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2013-01-17 23:15:22 +00:00
|
|
|
PKnownBSS pBSSList = NULL;
|
|
|
|
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-04 15:25:16 +00:00
|
|
|
if (pMgmt->eCurrState == WMAC_STATE_ASSOC ||
|
2014-01-04 15:25:18 +00:00
|
|
|
(pMgmt->eCurrMode == WMAC_MODE_IBSS_STA &&
|
|
|
|
pMgmt->eCurrState == WMAC_STATE_JOINTED)) {
|
|
|
|
pBSSList = BSSpAddrIsInBSSList(pDevice,
|
|
|
|
pMgmt->abyCurrBSSID,
|
|
|
|
(PWLAN_IE_SSID) pMgmt->abyCurrSSID);
|
2014-01-04 15:25:17 +00:00
|
|
|
if (pBSSList) {
|
2014-01-04 15:25:18 +00:00
|
|
|
pDevice->byBBPreEDRSSI =
|
|
|
|
(u8) (~(pBSSList->ldBmAverRange) + 1);
|
2014-01-04 15:25:06 +00:00
|
|
|
BBvUpdatePreEDThreshold(pDevice, false);
|
|
|
|
}
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|