Remove a bunch of useless vertical whitespace.
Convert 3 or more consecutive newlines to 2.
Remove blank lines after open brace and before close brace.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
#define WLAN_DATA_MAXLEN 2312
#define WLAN_A3FR_MAXLEN (WLAN_HDR_ADDR3_LEN + WLAN_DATA_MAXLEN + WLAN_CRC_LEN)
-
#define WLAN_BEACON_FR_MAXLEN WLAN_A3FR_MAXLEN
#define WLAN_ATIM_FR_MAXLEN (WLAN_HDR_ADDR3_LEN + 0)
#define WLAN_NULLDATA_FR_MAXLEN (WLAN_HDR_ADDR3_LEN + 0)
#define WLAN_AUTHEN_FR_MAXLEN WLAN_A3FR_MAXLEN
#define WLAN_DEAUTHEN_FR_MAXLEN (WLAN_HDR_ADDR3_LEN + 2)
-
#define WLAN_WEP_NKEYS 4
#define WLAN_WEP40_KEYLEN 5
#define WLAN_WEP104_KEYLEN 13
#define WLAN_FTYPE_CTL 0x01
#define WLAN_FTYPE_DATA 0x02
-
/* Frame Subtypes */
#define WLAN_FSTYPE_ASSOCREQ 0x00
#define WLAN_FSTYPE_ASSOCRESP 0x01
#define WLAN_FSTYPE_CFPOLL 0x06
#define WLAN_FSTYPE_CFACK_CFPOLL 0x07
-
#ifdef __BIG_ENDIAN
/* GET & SET Frame Control bit */
#define WLAN_GET_SEQ_FRGNUM(n) (((unsigned short)(n) >> 8) & (BIT0|BIT1|BIT2|BIT3))
#define WLAN_GET_SEQ_SEQNUM(n) ((((unsigned short)(n) >> 8) & (~(BIT0|BIT1|BIT2|BIT3))) >> 4)
-
/* Capability Field bit */
#define WLAN_GET_CAP_INFO_ESS(n) (((n) >> 8) & BIT0)
#define WLAN_GET_CAP_INFO_IBSS(n) ((((n) >> 8) & BIT1) >> 1)
#define WLAN_GET_CAP_INFO_DSSSOFDM(n) ((((n)) & BIT13) >> 13)
#define WLAN_GET_CAP_INFO_GRPACK(n) ((((n)) & BIT14) >> 14)
-
#else
/* GET & SET Frame Control bit */
#define WLAN_GET_FC_ISWEP(n) ((((unsigned short)(n)) & (BIT14)) >> 14)
#define WLAN_GET_FC_ORDER(n) ((((unsigned short)(n)) & (BIT15)) >> 15)
-
/* Sequence Field bit */
#define WLAN_GET_SEQ_FRGNUM(n) (((unsigned short)(n)) & (BIT0|BIT1|BIT2|BIT3))
#define WLAN_GET_SEQ_SEQNUM(n) ((((unsigned short)(n)) & (~(BIT0|BIT1|BIT2|BIT3))) >> 4)
-
/* Capability Field bit */
#define WLAN_GET_CAP_INFO_ESS(n) ((n) & BIT0)
#define WLAN_GET_CAP_INFO_IBSS(n) (((n) & BIT1) >> 1)
#define WLAN_GET_CAP_INFO_DSSSOFDM(n) (((n) & BIT13) >> 13)
#define WLAN_GET_CAP_INFO_GRPACK(n) (((n) & BIT14) >> 14)
-
#endif /*#ifdef __BIG_ENDIAN */
-
#define WLAN_SET_CAP_INFO_ESS(n) (n)
#define WLAN_SET_CAP_INFO_IBSS(n) ((n) << 1)
#define WLAN_SET_CAP_INFO_CFPOLLABLE(n) ((n) << 2)
#define WLAN_SET_CAP_INFO_DSSSOFDM(n) ((n) << 13)
#define WLAN_SET_CAP_INFO_GRPACK(n) ((n) << 14)
-
#define WLAN_SET_FC_PRVER(n) ((unsigned short)(n))
#define WLAN_SET_FC_FTYPE(n) (((unsigned short)(n)) << 2)
#define WLAN_SET_FC_FSTYPE(n) (((unsigned short)(n)) << 4)
#define WLAN_SET_ERP_USE_PROTECTION(n) ((n) << 1)
#define WLAN_SET_ERP_BARKER_MODE(n) ((n) << 2)
-
-
/* Support & Basic Rates field */
#define WLAN_MGMT_IS_BASICRATE(b) ((b) & BIT7)
#define WLAN_MGMT_GET_RATE(b) ((b) & ~BIT7)
/* 802.11 Header Format */
typedef struct tagWLAN_80211HDR_A2 {
-
unsigned short wFrameCtl;
unsigned short wDurationID;
unsigned char abyAddr1[WLAN_ADDR_LEN];
unsigned char abyAddr2[WLAN_ADDR_LEN];
-
} __attribute__ ((__packed__))
WLAN_80211HDR_A2, *PWLAN_80211HDR_A2;
typedef struct tagWLAN_80211HDR_A3 {
-
unsigned short wFrameCtl;
unsigned short wDurationID;
unsigned char abyAddr1[WLAN_ADDR_LEN];
unsigned char abyAddr2[WLAN_ADDR_LEN];
unsigned char abyAddr3[WLAN_ADDR_LEN];
unsigned short wSeqCtl;
-
} __attribute__ ((__packed__))
WLAN_80211HDR_A3, *PWLAN_80211HDR_A3;
typedef struct tagWLAN_80211HDR_A4 {
-
unsigned short wFrameCtl;
unsigned short wDurationID;
unsigned char abyAddr1[WLAN_ADDR_LEN];
unsigned char abyAddr3[WLAN_ADDR_LEN];
unsigned short wSeqCtl;
unsigned char abyAddr4[WLAN_ADDR_LEN];
-
} __attribute__ ((__packed__))
WLAN_80211HDR_A4, *PWLAN_80211HDR_A4;
-
typedef union tagUWLAN_80211HDR {
-
WLAN_80211HDR_A2 sA2;
WLAN_80211HDR_A3 sA3;
WLAN_80211HDR_A4 sA4;
-
} UWLAN_80211HDR, *PUWLAN_80211HDR;
-
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Functions --------------------------*/
-
-
#endif /* __80211HDR_H__ */
-
-
/*--------------------- Static Definitions -------------------------*/
-
-
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
//static int msglevel =MSG_LEVEL_DEBUG;
/*--------------------- Static Functions --------------------------*/
-
-
/*--------------------- Export Variables --------------------------*/
-
/*--------------------- Export Functions --------------------------*/
-
/*+
*
* Routine Description:
*
-*/
-
void
vMgrDecodeBeacon(
PWLAN_FR_BEACON pFrame
pItem = (PWLAN_IE)((unsigned char *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)))
+ WLAN_BEACON_OFF_SSID);
while (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) {
-
switch (pItem->byElementID) {
case WLAN_EID_SSID:
if (pFrame->pSSID == NULL)
return;
}
-
/*+
*
* Routine Description:
*
-*/
-
void
vMgrEncodeIBSSATIM(
PWLAN_FR_IBSSATIM pFrame
return;
}
-
/*+
*
* Routine Description:
return;
}
-
/*+
*
* Routine Description:
{
pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
-
// Fixed Fields
pFrame->pwReason = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ WLAN_DISASSOC_OFF_REASON);
return;
}
-
/*+
*
* Routine Description:
*
-*/
-
void
vMgrEncodeAssocRequest(
PWLAN_FR_ASSOCREQ pFrame
return;
}
-
/*+
*
* Routine Description: (AP)
return;
}
-
/*+
*
* Routine Description:
return;
}
-
/*+
*
* Routine Description:
return;
}
-
/*+
*
* Routine Description: (AP)
*
-*/
-
void
vMgrDecodeReassocRequest(
PWLAN_FR_REASSOCREQ pFrame
+ WLAN_REASSOCREQ_OFF_SSID);
while (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) {
-
switch (pItem->byElementID) {
case WLAN_EID_SSID:
if (pFrame->pSSID == NULL)
return;
}
-
-
/*+
*
* Routine Description:
*
-*/
-
void
vMgrEncodeProbeRequest(
PWLAN_FR_PROBEREQ pFrame
pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)));
while (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) {
-
switch (pItem->byElementID) {
case WLAN_EID_SSID:
if (pFrame->pSSID == NULL)
return;
}
-
/*+
*
* Routine Description:
*
-*/
-
void
vMgrEncodeProbeResponse(
PWLAN_FR_PROBERESP pFrame
return;
}
-
-
/*+
*
* Routine Description:
{
PWLAN_IE pItem;
-
pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
// Fixed Fields
return;
}
-
/*+
*
* Routine Description:
return;
}
-
/*+
*
* Routine Description:
return;
}
-
/*+
*
* Routine Description:
return;
}
-
/*+
*
* Routine Description:
return;
}
-
/*+
*
* Routine Description: (AP)
return;
}
-
/*+
*
* Routine Description:
*
-*/
-
void
vMgrDecodeReassocResponse(
PWLAN_FR_REASSOCRESP pFrame
// reference WiFi WPA spec.
#define WLAN_EID_RSN_WPA 221
-
#define WLAN_EID_ERP_NONERP_PRESENT 0x01
#define WLAN_EID_ERP_USE_PROTECTION 0x02
#define WLAN_EID_ERP_BARKER_MODE 0x04
#define WLAN_MGMT_STATUS_INVALID_RSN_IE_CAP 45
#define WLAN_MGMT_STATUS_CIPHER_REJECT 46
-
-
// Auth Algorithm
#define WLAN_AUTH_ALG_OPENSYSTEM 0
#define WLAN_AUTH_ALG_SHAREDKEY 1
-
-
// Management Frame Field Offsets
// Note: Not all fields are listed because of variable lengths.
// Note: These offsets are from the start of the frame data
#define WLAN_DEAUTHEN_OFF_REASON 0
-
//
// Cipher Suite Selectors defined in 802.11i
//
#define MEASURE_MODE_INCAPABLE 0x02
#define MEASURE_MODE_REFUSED 0x04
-
-
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Types ------------------------------*/
-
// Information Element Types
#pragma pack(1)
} __attribute__ ((__packed__))
WLAN_IE, *PWLAN_IE;
-
// Service Set Identity (SSID)
#pragma pack(1)
typedef struct tagWLAN_IE_SSID {
} __attribute__ ((__packed__))
WLAN_IE_SSID, *PWLAN_IE_SSID;
-
// Supported Rates
#pragma pack(1)
typedef struct tagWLAN_IE_SUPP_RATES {
} __attribute__ ((__packed__))
WLAN_IE_SUPP_RATES, *PWLAN_IE_SUPP_RATES;
-
-
// FH Parameter Set
#pragma pack(1)
typedef struct _WLAN_IE_FH_PARMS {
} __attribute__ ((__packed__))
WLAN_IE_DS_PARMS, *PWLAN_IE_DS_PARMS;
-
// CF Parameter Set
#pragma pack(1)
typedef struct tagWLAN_IE_CF_PARMS {
} __attribute__ ((__packed__))
WLAN_IE_CF_PARMS, *PWLAN_IE_CF_PARMS;
-
// TIM
#pragma pack(1)
typedef struct tagWLAN_IE_TIM {
} __attribute__ ((__packed__))
WLAN_IE_TIM, *PWLAN_IE_TIM;
-
// IBSS Parameter Set
#pragma pack(1)
typedef struct tagWLAN_IE_IBSS_PARMS {
} __attribute__ ((__packed__))
WLAN_IE_IBSS_PARMS, *PWLAN_IE_IBSS_PARMS;
-
// Challenge Text
#pragma pack(1)
typedef struct tagWLAN_IE_CHALLENGE {
} __attribute__ ((__packed__))
WLAN_IE_CHALLENGE, *PWLAN_IE_CHALLENGE;
-
#pragma pack(1)
typedef struct tagWLAN_IE_RSN_EXT {
unsigned char byElementID;
unsigned char abyRSN[WLAN_MIN_ARRAY];
} WLAN_IE_RSN, *PWLAN_IE_RSN;
-
// ERP
#pragma pack(1)
typedef struct tagWLAN_IE_ERP {
} __attribute__ ((__packed__))
WLAN_IE_ERP, *PWLAN_IE_ERP;
-
#pragma pack(1)
typedef struct _MEASEURE_REQ {
unsigned char byChannel;
} MEASEURE_REP_RPI, *PMEASEURE_REP_RPI;
typedef union _MEASEURE_REP {
-
MEASEURE_REP_BASIC sBasic;
MEASEURE_REP_CCA sCCA;
MEASEURE_REP_RPI sRPI;
-
} MEASEURE_REP, *PMEASEURE_REP;
typedef struct _WLAN_IE_MEASURE_REQ {
unsigned char byLinkMargin;
} WLAN_IE_TPC_REP, *PWLAN_IE_TPC_REP;
-
typedef struct _WLAN_IE_IBSS_DFS {
unsigned char byElementID;
unsigned char len;
#pragma pack()
-
-
// Frame Types
// prototype structure, all mgmt frame types will start with these members
typedef struct tagWLAN_FR_MGMT {
-
unsigned int uType;
unsigned int len;
unsigned char *pBuf;
PUWLAN_80211HDR pHdr;
-
} WLAN_FR_MGMT, *PWLAN_FR_MGMT;
// Beacon frame
typedef struct tagWLAN_FR_BEACON {
-
unsigned int uType;
unsigned int len;
unsigned char *pBuf;
PWLAN_IE_CH_SW pIE_CHSW;
PWLAN_IE_IBSS_DFS pIE_IBSSDFS;
PWLAN_IE_QUIET pIE_Quiet;
-
} WLAN_FR_BEACON, *PWLAN_FR_BEACON;
-
// IBSS ATIM frame
typedef struct tagWLAN_FR_IBSSATIM {
-
unsigned int uType;
unsigned int len;
unsigned char *pBuf;
// fixed fields
// info elements
// this frame type has a null body
-
} WLAN_FR_IBSSATIM, *PWLAN_FR_IBSSATIM;
// Disassociation
typedef struct tagWLAN_FR_DISASSOC {
-
unsigned int uType;
unsigned int len;
unsigned char *pBuf;
/*-- fixed fields -----------*/
unsigned short *pwReason;
/*-- info elements ----------*/
-
} WLAN_FR_DISASSOC, *PWLAN_FR_DISASSOC;
// Association Request
typedef struct tagWLAN_FR_ASSOCREQ {
-
unsigned int uType;
unsigned int len;
unsigned char *pBuf;
PWLAN_IE_SUPP_RATES pExtSuppRates;
PWLAN_IE_PW_CAP pCurrPowerCap;
PWLAN_IE_SUPP_CH pCurrSuppCh;
-
} WLAN_FR_ASSOCREQ, *PWLAN_FR_ASSOCREQ;
// Association Response
typedef struct tagWLAN_FR_ASSOCRESP {
-
unsigned int uType;
unsigned int len;
unsigned char *pBuf;
/*-- info elements ----------*/
PWLAN_IE_SUPP_RATES pSuppRates;
PWLAN_IE_SUPP_RATES pExtSuppRates;
-
} WLAN_FR_ASSOCRESP, *PWLAN_FR_ASSOCRESP;
// Reassociation Request
typedef struct tagWLAN_FR_REASSOCREQ {
-
unsigned int uType;
unsigned int len;
unsigned char *pBuf;
PWLAN_IE_RSN pRSN;
PWLAN_IE_RSN_EXT pRSNWPA;
PWLAN_IE_SUPP_RATES pExtSuppRates;
-
} WLAN_FR_REASSOCREQ, *PWLAN_FR_REASSOCREQ;
// Reassociation Response
typedef struct tagWLAN_FR_REASSOCRESP {
-
unsigned int uType;
unsigned int len;
unsigned char *pBuf;
/*-- info elements ----------*/
PWLAN_IE_SUPP_RATES pSuppRates;
PWLAN_IE_SUPP_RATES pExtSuppRates;
-
} WLAN_FR_REASSOCRESP, *PWLAN_FR_REASSOCRESP;
// Probe Request
typedef struct tagWLAN_FR_PROBEREQ {
-
unsigned int uType;
unsigned int len;
unsigned char *pBuf;
PWLAN_IE_SSID pSSID;
PWLAN_IE_SUPP_RATES pSuppRates;
PWLAN_IE_SUPP_RATES pExtSuppRates;
-
} WLAN_FR_PROBEREQ, *PWLAN_FR_PROBEREQ;
// Probe Response
typedef struct tagWLAN_FR_PROBERESP {
-
unsigned int uType;
unsigned int len;
unsigned char *pBuf;
PWLAN_IE_CH_SW pIE_CHSW;
PWLAN_IE_IBSS_DFS pIE_IBSSDFS;
PWLAN_IE_QUIET pIE_Quiet;
-
} WLAN_FR_PROBERESP, *PWLAN_FR_PROBERESP;
// Authentication
typedef struct tagWLAN_FR_AUTHEN {
-
unsigned int uType;
unsigned int len;
unsigned char *pBuf;
unsigned short *pwStatus;
/*-- info elements ----------*/
PWLAN_IE_CHALLENGE pChallenge;
-
} WLAN_FR_AUTHEN, *PWLAN_FR_AUTHEN;
// Deauthenication
typedef struct tagWLAN_FR_DEAUTHEN {
-
unsigned int uType;
unsigned int len;
unsigned char *pBuf;
unsigned short *pwReason;
/*-- info elements ----------*/
-
} WLAN_FR_DEAUTHEN, *PWLAN_FR_DEAUTHEN;
/*--------------------- Export Functions --------------------------*/
return bResult;
}
-
static bool s_bRxTPCReq(PSMgmtObject pMgmt,
PWLAN_FRAME_TPCREQ pTPCReq,
unsigned char byRate,
return true;
/* return CARDbSendPacket(pMgmt->pAdapter, pFrame, PKT_TYPE_802_11_MNG,
sizeof(WLAN_FRAME_TPCREP)); */
-
}
-
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Functions --------------------------*/
-
/*+
*
* Description:
return true;
}
-
bool IEEE11hbMSRRepTx(void *pMgmtHandle)
{
PSMgmtObject pMgmt = (PSMgmtObject) pMgmtHandle;
return true;
/* return CARDbSendPacket(pMgmt->pAdapter, pMSRRep, PKT_TYPE_802_11_MNG,
uLength); */
-
}
-
(*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++);
}
-
void xor_32(unsigned char *a, unsigned char *b, unsigned char *out)
{
unsigned long *dwPtrA = (unsigned long *)a;
void MixColumns(unsigned char *in, unsigned char *out)
{
-
out[0] = dot2_table[in[0]] ^ dot3_table[in[1]] ^ in[2] ^ in[3];
out[1] = in[0] ^ dot2_table[in[1]] ^ dot3_table[in[2]] ^ in[3];
out[2] = in[0] ^ in[1] ^ dot2_table[in[2]] ^ dot3_table[in[3]];
out[3] = dot3_table[in[0]] ^ in[1] ^ in[2] ^ dot2_table[in[3]];
}
-
void AESv128(unsigned char *key, unsigned char *data, unsigned char *ciphertext)
{
int i;
AddRoundKey(abyRoundKey, round);
}
}
-
}
/*
unsigned short wCnt;
int ii, jj, kk;
-
pbyIV = pbyFrame + WLAN_HDR_ADDR3_LEN;
if (WLAN_GET_FC_TODS(*(unsigned short *)pbyFrame) &&
WLAN_GET_FC_FROMDS(*(unsigned short *)pbyFrame)) {
memcpy(&(abyCTRPLD[1]), &(abyNonce[0]), 13);
for (jj = wPayloadSize; jj > 16; jj = jj - 16) {
-
abyCTRPLD[14] = (unsigned char)(wCnt >> 8);
abyCTRPLD[15] = (unsigned char)(wCnt & 0xff);
} else {
return false;
}
-
}
/*--------------------- Static Variables --------------------------*/
-
-
#define CB_VT3253_INIT_FOR_RFMD 446
unsigned char byVT3253InitTab_RFMD[CB_VT3253_INIT_FOR_RFMD][2] = {
{0x00, 0x30},
{0xff, 0x00},
};
-
-
#define CB_VT3253B0_INIT_FOR_UW2451 256
//For UW2451
unsigned char byVT3253B0_UW2451[CB_VT3253B0_INIT_FOR_UW2451][2] = {
const unsigned short awcFrameTime[MAX_RATE] =
{10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216};
-
/*--------------------- Static Functions --------------------------*/
static
}
}
-
/*--------------------- Export Variables --------------------------*/
/*
* Description: Calculate data frame transmitting time
unsigned int uRateIdx = (unsigned int) wRate;
unsigned int uRate = 0;
-
if (uRateIdx > RATE_54M) {
ASSERT(0);
return 0;
return true;
}
-
/*
* Description: Write a Byte to BASEBAND, by embedded programming
*
return true;
}
-
/*
* Description: Test if all bits are set for the Baseband register
*
return (byOrgData & byTestBits) == byTestBits;
}
-
/*
* Description: Test if all bits are clear for the Baseband register
*
return bResult;
}
-
-
/*
* Description: Read All Baseband Registers
*
*
*/
-
void BBvLoopbackOn(PSDevice pDevice)
{
unsigned char byData;
}
BBbReadEmbedded(dwIoBase, 0x0E, &byData);//CR14
BBbWriteEmbedded(dwIoBase, 0x0E, (unsigned char)(byData | 0x80));//CR14
-
}
-
-
/*
* Description: Set ShortSlotTime mode
*
}
BBbWriteEmbedded(pDevice->PortOffset, 0x0A, byBBRxConf);//CR10
-
}
void BBvSetVGAGainOffset(PSDevice pDevice, unsigned char byData)
BBbWriteEmbedded(pDevice->PortOffset, 0x0A, byBBRxConf);//CR10
}
-
/*
* Description: Baseband SoftwareReset
*
BBbWriteEmbedded(dwIoBase, 0x09, byBBTxConf);//CR09
}
-
-
-
/*
* Description: Set Rx Antenna mode
*
BBbWriteEmbedded(dwIoBase, 0x0A, byBBRxConf);//CR10
}
-
/*
* Description: BBvSetDeepSleep
*
BBbWriteEmbedded(dwIoBase, 0x0D, 0x01);//CR13
}
-
-
static
unsigned long
s_ulGetRatio(PSDevice pDevice)
return ulRatio;
}
-
void
BBvClearAntDivSQ3Value(PSDevice pDevice)
{
}
}
-
/*
* Description: Antenna Diversity
*
void
BBvAntennaDiversity(PSDevice pDevice, unsigned char byRxRate, unsigned char bySQ3)
{
-
if ((byRxRate >= MAX_RATE) || (pDevice->wAntDiversityMaxRate >= MAX_RATE)) {
return;
}
pDevice->uNumSQ3[byRxRate]++;
if (pDevice->byAntennaState == 0) {
-
if (pDevice->uDiversityCnt > pDevice->ulDiversityNValue) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ulDiversityNValue=[%d],54M-[%d]\n",
(int)pDevice->ulDiversityNValue, (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate]);
if (pDevice->uNumSQ3[pDevice->wAntDiversityMaxRate] < pDevice->uDiversityCnt/2) {
-
pDevice->ulRatio_State0 = s_ulGetRatio(pDevice);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SQ3_State0, rate = [%08x]\n", (int)pDevice->ulRatio_State0);
add_timer(&pDevice->TimerSQ3Tmax1);
} else {
-
pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ);
add_timer(&pDevice->TimerSQ3Tmax3);
}
} else { //byAntennaState == 1
if (pDevice->uDiversityCnt > pDevice->ulDiversityMValue) {
-
del_timer(&pDevice->TimerSQ3Tmax1);
pDevice->ulRatio_State1 = s_ulGetRatio(pDevice);
add_timer(&pDevice->TimerSQ3Tmax3);
add_timer(&pDevice->TimerSQ3Tmax2);
-
spin_unlock_irq(&pDevice->lock);
return;
}
-
/*+
*
* Description:
spin_lock_irq(&pDevice->lock);
if (pDevice->uDiversityCnt < pDevice->ulDiversityMValue/100) {
-
s_vChangeAntenna(pDevice);
pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ);
pDevice->TimerSQ3Tmax2.expires = RUN_AT(pDevice->byTMax2 * HZ);
return;
}
-
//
#define BB_MAX_CONTEXT_SIZE 256
-
//
// Baseband RF pair definition in eeprom (Bits 6..0)
//
#define PREAMBLE_LONG 0
#define PREAMBLE_SHORT 1
-
#define F5G 0
#define F2_4G 1
#define TOP_RATE_2M 0x00200000
#define TOP_RATE_1M 0x00100000
-
/*--------------------- Export Types ------------------------------*/
/*--------------------- Export Macros ------------------------------*/
#define BBvSetFOE(dwIoBase) \
BBbWriteEmbedded(dwIoBase, 0xB1, 0x0C)
-
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
/*--------------------- Static Definitions -------------------------*/
-
-
-
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
static int msglevel = MSG_LEVEL_INFO;
//static int msglevel =MSG_LEVEL_DEBUG;
-
-
const unsigned short awHWRetry0[5][5] = {
{RATE_18M, RATE_18M, RATE_12M, RATE_12M, RATE_12M},
{RATE_24M, RATE_24M, RATE_18M, RATE_12M, RATE_12M},
{RATE_54M, RATE_54M, RATE_36M, RATE_18M, RATE_18M}
};
-
-
/*--------------------- Static Functions --------------------------*/
void s_vCheckSensitivity(
);
#endif
-
void s_vCheckPreEDThreshold(
void *hDeviceContext
);
/*--------------------- Export Variables --------------------------*/
-
/*--------------------- Export Functions --------------------------*/
-
-
-
-
/*+
*
* Routine Description:
//2007-0721-01<Add>by MikeLiu
pCurrBSS->bSelected = false;
if (pCurrBSS->bActive) {
-
if (pSSID != NULL) {
// matched SSID
if (!!memcmp(pSSID->abySSID,
}
}
return NULL;
-
}
-
/*+
*
* Routine Description:
*
-*/
-
void
BSSvClearBSSList(
void *hDeviceContext,
return;
}
-
-
/*+
*
* Routine Description:
return NULL;
};
-
-
/*+
*
* Routine Description:
void *pRxPacketContext
)
{
-
PSDevice pDevice = (PSDevice)hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
PSRxMgmtPacket pRxPacket = (PSRxMgmtPacket)pRxPacketContext;
bool bParsingQuiet = false;
PWLAN_IE_QUIET pQuiet = NULL;
-
-
pBSSList = (PKnownBSS)&(pMgmt->sBSSList[0]);
for (ii = 0; ii < MAX_BSS_NUM; ii++) {
}
if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || (pBSSList->bWPA2Valid == true)) {
-
PSKeyItem pTransmitKey = NULL;
bool bIs802_1x = false;
}
if ((bIs802_1x == true) && (pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len) &&
(!memcmp(pSSID->abySSID, ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySSID, pSSID->len))) {
-
bAdd_PMKID_Candidate((void *)pDevice, pBSSList->abyBSSID, &pBSSList->sRSNCapObj);
if ((pDevice->bLinkPass == true) && (pMgmt->eCurrState == WMAC_STATE_ASSOC)) {
return true;
}
-
/*+
*
* Routine Description:
bool bParsingQuiet = false;
PWLAN_IE_QUIET pQuiet = NULL;
-
-
if (pBSSList == NULL)
return false;
-
HIDWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(HIDWORD(qwTimestamp));
LODWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(LODWORD(qwTimestamp));
pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval);
return true;
}
-
-
-
-
/*+
*
* Routine Description:
return false;
};
-
-
/*+
*
* Routine Description:
void
BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex)
{
-
PSDevice pDevice = (PSDevice)hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned int ii;
return;
};
-
-
/*+
*
* Routine Description:
unsigned int uNodeIndex
)
{
-
PSDevice pDevice = (PSDevice)hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned char byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
struct sk_buff *skb;
-
while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[uNodeIndex].sTxPSQueue)) != NULL)
dev_kfree_skb(skb);
// clear context
// Auto rate fallback function initiation.
// RATEbInit(pDevice);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->sNodeDBTable[0].wTxDataRate = %d \n", pMgmt->sNodeDBTable[0].wTxDataRate);
-
};
-
-
-
-
/*+
*
* Routine Description:
*
-*/
-
void
BSSvAddMulticastNode(
void *hDeviceContext
printk("BSSvAddMultiCastNode:pMgmt->sNodeDBTable[0].wTxDataRate is %d\n", pMgmt->sNodeDBTable[0].wTxDataRate);
#endif
pMgmt->sNodeDBTable[0].uRatePollTimeout = FALLBACK_POLL_SECOND;
-
};
-
-
-
-
/*+
*
* Routine Description:
if (((!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->bHWRadioOff == false)) || ((pDevice->byGPIO & GPIO0_DATA) && (pDevice->bHWRadioOff == true))) && (cc == false)) {
cc = true;
} else if (cc == true) {
-
if (pDevice->bHWRadioOff == true) {
if (!(pDevice->byGPIO & GPIO0_DATA))
//||(!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV)))
start:
#endif
-
if (pDevice->wUseProtectCntDown > 0) {
pDevice->wUseProtectCntDown--;
} else {
#endif
for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) {
-
if (pMgmt->sNodeDBTable[ii].bActive) {
// Increase in-activity counter
pMgmt->sNodeDBTable[ii].uInActiveCount++;
}
if (pMgmt->sNodeDBTable[ii].eNodeState >= NODE_ASSOC) {
-
pDevice->uAssocCount++;
// check if Non ERP exist
if (pMgmt->sNodeDBTable[ii].bPSEnable)
uSleepySTACnt++;
-
}
// Rate fallback check
}
-
if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->eCurrentPHYType == PHY_TYPE_11G)) {
-
// on/off protect mode
if (WLAN_GET_ERP_USE_PROTECTION(pDevice->byERPFlag)) {
if (!pDevice->bProtectMode) {
}
-
// Check if any STA in PS mode, enable DTIM multicast deliver
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
if (uSleepySTACnt > 0)
if ((pMgmt->eCurrMode == WMAC_MODE_STANDBY) ||
(pMgmt->eCurrMode == WMAC_MODE_ESS_STA)) {
-
if (pMgmt->sNodeDBTable[0].bActive) { // Assoc with BSS
if (pDevice->bUpdateBBVGA) {
// s_vCheckSensitivity((void *) pDevice);
};
}
if (pMgmt->eCurrState == WMAC_STATE_JOINTED) {
-
if (pDevice->bUpdateBBVGA) {
//s_vCheckSensitivity((void *) pDevice);
s_vCheckPreEDThreshold((void *)pDevice);
return;
}
-
-
-
/*+
*
* Routine Description:
*
-*/
-
-
void
BSSvUpdateNodeTxCounter(
void *hDeviceContext,
//for (ii=0;ii<txRetryTemp;ii++)
{
if (ii < 5) {
-
//PLICE_DEBUG
wFallBackRate = awHWRetry0[wRate-RATE_18M][ii];
//wFallBackRate = awHWRetry0[wRate-RATE_12M][ii];
if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ||
(pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) {
-
pMACHeader = (PS802_11Header)(pbyBuffer + uFIFOHeaderSize);
if (BSSDBbIsSTAInNodeDB((void *)pMgmt, &(pMACHeader->abyAddr1[0]), &uNodeIndex)) {
}
return;
-
-
}
-
-
-
/*+
*
* Routine Description:
*
-*/
-
void
BSSvClearNodeDBTable(
void *hDeviceContext,
return;
};
-
void s_vCheckSensitivity(
void *hDeviceContext
)
}
}
-
void
BSSvClearAnyBSSJoinRecord(
void *hDeviceContext
}
return;
}
-
#define MAX_WPA_IE_LEN 64
-
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
-
/*--------------------- Export Types ------------------------------*/
//
Ndis802_11NetworkTypeMax // not a real type, defined as an upper bound
} NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE;
-
typedef struct tagSERPObject {
bool bERPExist;
unsigned char byERP;
} ERPObject, *PERPObject;
-
typedef struct tagSRSNCapObject {
bool bRSNCapExist;
unsigned short wRSNCap;
ERPObject sERP;
SRSNCapObject sRSNCapObj;
unsigned char abyIEs[1024]; // don't move this field !!
-
} __attribute__ ((__packed__))
KnownBSS , *PKnownBSS;
NODE_ASSOC
} NODE_STATE, *PNODE_STATE;
-
// STA node info
typedef struct tagKnownNodeDB {
// STA info
unsigned int uTxOk[MAX_RATE+1];
unsigned int uTxFail[MAX_RATE+1];
unsigned int uTimeCount;
-
} KnownNodeDB, *PKnownNodeDB;
-
/*--------------------- Export Functions --------------------------*/
-
-
PKnownBSS
BSSpSearchBSSList(
void *hDeviceContext,
void *pRxPacketContext
);
-
bool
BSSbUpdateToBSSList(
void *hDeviceContext,
void *pRxPacketContext
);
-
bool
BSSDBbIsSTAInNodeDB(void *hDeviceContext, unsigned char *abyDstAddr,
unsigned int *puNodeIndex);
PWLAN_IE_SUPP_RATES pExtSuppRates
);
-
void
BSSvSecondCallBack(
void *hDeviceContext
);
-
void
BSSvUpdateNodeTxCounter(
void *hDeviceContext,
void *hDeviceContext
);
-
void
BSSvClearNodeDBTable(
void *hDeviceContext,
#define C_EIFS 80 // micro sec.
-
#define C_SLOT_SHORT 9 // micro sec.
#define C_SLOT_LONG 20
//1M, 2M, 5M, 11M,
static unsigned char abyDefaultSuppRatesB[] = {WLAN_EID_SUPP_RATES, 4, 0x02, 0x04, 0x0B, 0x16};
-
/*--------------------- Static Variables --------------------------*/
-
const unsigned short cwRXBCNTSFOff[MAX_RATE] =
{17, 17, 17, 17, 34, 23, 17, 11, 8, 5, 4, 3};
-
/*--------------------- Static Functions --------------------------*/
static
unsigned char *pbyRsvTime
);
-
/*--------------------- Export Functions --------------------------*/
/*
}
}
-
-
/*
* Description: Set RSPINF
*
}
*/
-
/*
* Description: Get Card short preamble option value
*
return pDevice->bShortSlotTime;
}
-
/*
* Description: Update IFS
*
PWLAN_IE_SUPP_RATES pSupportRates = (PWLAN_IE_SUPP_RATES) pvSupportRateIEs;
PWLAN_IE_SUPP_RATES pExtSupportRates = (PWLAN_IE_SUPP_RATES) pvExtSupportRateIEs;
-
//Set SIFS, DIFS, EIFS, SlotTime, CwMin
if (ePHYType == PHY_TYPE_11A) {
if (pSupportRates == NULL) {
return true;
}
-
/*
* Description: Set NIC TSF counter for first Beacon time
* Get NEXTTBTT from adjusted TSF and Beacon Interval
return true;
}
-
-
/*
* Description: Card Stop Hardware Tx
*
{
PSDevice pDevice = (PSDevice) pDeviceHandler;
-
if (ePktType == PKT_TYPE_802_11_ALL) {
pDevice->bStopBeacon = true;
pDevice->bStopTx0Pkt = true;
return true;
}
-
/*
* Description: Card Start Hardware Tx
*
{
PSDevice pDevice = (PSDevice) pDeviceHandler;
-
if (ePktType == PKT_TYPE_802_11_ALL) {
pDevice->bStopBeacon = false;
pDevice->bStopTx0Pkt = false;
return true;
}
-
-
/*
* Description: Card Set BSSID value
*
return true;
}
-
/*
* Description: Card indicate status
*
*
*/
-
-
-
/*
* Description: Save Assoc info. contain in assoc. response frame
*
if (pDevice->bRadioOff == true)
return true;
-
switch (pDevice->byRFType) {
-
case RF_RFMD2959:
MACvWordRegBitsOff(pDevice->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_TXPEINV);
MACvWordRegBitsOn(pDevice->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE1);
return bResult;
}
-
/*
* Description: Turn on Radio power
*
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_RXON);
switch (pDevice->byRFType) {
-
case RF_RFMD2959:
MACvWordRegBitsOn(pDevice->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_TXPEINV);
MACvWordRegBitsOff(pDevice->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE1);
return bResult;
}
-
-
bool CARDbRemoveKey(void *pDeviceHandler, unsigned char *pbyBSSID)
{
PSDevice pDevice = (PSDevice) pDeviceHandler;
return true;
}
-
/*
*
* Description:
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\n");
-
// Update Old Candidate
for (ii = 0; ii < pDevice->gsPMKIDCandidate.NumCandidates; ii++) {
pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[ii];
return true;
}
-
/*
*
* Description:
return bResult;
}
-
/*
*
* Description:
return true;
}
-
/*
*
* Description:
}
}
-
/*
*
* Description:
// set MAC Beacon TX pointer
MACvSetCurrBCNTxDescAddr(pDevice->PortOffset,
(pDevice->tx_beacon_dma));
-
}
-
-
/*+
*
* Description:
unsigned int uu;
PSRxDesc pDesc;
-
-
// initialize RD index
pDevice->pCurrRD[0] = &(pDevice->aRD0Ring[0]);
pDevice->pCurrRD[1] = &(pDevice->aRD1Ring[0]);
pDevice->rd1_pool_dma);
}
-
-
-
/*
* Description: Get response Control frame rate in CCK mode
*
return (unsigned short)RATE_24M;
}
-
/*
* Description: Set RSPINF
*
pDevice->byTopCCKBasicRate = byTopCCK;
}
-
/*
* Description: Set NIC Tx Basic Rate
*
// set Baseband loopback
}
-
/*
* Description: Software Reset NIC
*
return true;
}
-
/*
* Description: Calculate TSF offset of two TSF input
* Get TSF Offset from RxBCN's TSF and local TSF
return qwTSFOffset;
}
-
/*
* Description: Read NIC TSF counter
* Get local TSF counter
return true;
}
-
/*
* Description: Read NIC TSF counter
* Get NEXTTBTT from adjusted TSF and Beacon Interval
*/
QWORD CARDqGetNextTBTT(QWORD qwTSF, unsigned short wBeaconInterval)
{
-
unsigned int uLowNextTBTT;
unsigned int uHighRemain, uLowRemain;
unsigned int uBeaconInterval;
return qwTSF;
}
-
/*
* Description: Set NIC TSF counter for first Beacon time
* Get NEXTTBTT from adjusted TSF and Beacon Interval
*/
void CARDvSetFirstNextTBTT(unsigned long dwIoBase, unsigned short wBeaconInterval)
{
-
QWORD qwNextTBTT;
HIDWORD(qwNextTBTT) = 0;
return;
}
-
/*
* Description: Sync NIC TSF counter for Beacon time
* Get NEXTTBTT and write to HW
*/
void CARDvUpdateNextTBTT(unsigned long dwIoBase, QWORD qwTSF, unsigned short wBeaconInterval)
{
-
qwTSF = CARDqGetNextTBTT(qwTSF, wBeaconInterval);
// Set NextTBTT
VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT, LODWORD(qwTSF));
return;
}
-
-
-
-
-
-
-
#define CARD_LB_MAC MAKEWORD(MAC_LB_INTERNAL, 0) // PHY must ISO, avoid MAC loopback packet go out
#define CARD_LB_PHY MAKEWORD(MAC_LB_EXT, 0)
-
#define DEFAULT_MSDU_LIFETIME 512 // ms
#define DEFAULT_MSDU_LIFETIME_RES_64us 8000 // 64us
OP_MODE_UNKNOWN
} CARD_OP_MODE, *PCARD_OP_MODE;
-
-
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
unsigned short wDataRate
);
-
bool CARDbRemoveKey(void *pDeviceHandler, unsigned char *pbyBSSID);
bool
);
#endif // __CARD_H__
-
-
-
exit:
return bValid;
-
}
/**
PSDevice pDevice = (PSDevice) pDeviceHandler;
bool bResult = true;
-
if (pDevice->byCurrentCh == uConnectionChannel) {
return bResult;
}
}
//}} RobertYu
-
pDevice->byCurrentCh = (unsigned char)uConnectionChannel;
bResult &= RFbSelectChannel(pDevice->PortOffset, pDevice->byRFType, (unsigned char)uConnectionChannel);
if (pDevice->bEnablePSMode == true)
RFvWriteWakeProgSyn(pDevice->PortOffset, pDevice->byRFType, uConnectionChannel);
-
//DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "CARDbSetMediaChannel: %d\n", (unsigned char)uConnectionChannel);
BBvSoftwareReset(pDevice->PortOffset);
unsigned char byCh = 0;
PWLAN_IE_COUNTRY pIE_Country = (PWLAN_IE_COUNTRY) pIE;
-
uNumOfCountryInfo = (pIE_Country->len - 3);
uNumOfCountryInfo /= 3;
unsigned char *pbyChTupple;
unsigned char byLen = 0;
-
pIE->byElementID = WLAN_EID_SUPP_CH;
pIE->len = 0;
pbyChTupple = pIE->abyChannelTuple;
bool get_channel_map_info(void *pDeviceHandler, unsigned int uChannelIndex,
unsigned char *pbyChannelNumber, unsigned char *pbyMap)
{
-
if (uChannelIndex > CB_MAX_CHANNEL)
return false;
void set_channel_map_info(void *pDeviceHandler, unsigned int uChannelIndex,
unsigned char byMap)
{
-
if (uChannelIndex > CB_MAX_CHANNEL)
return;
unsigned char byMAP;
} SChannelTblElement, *PSChannelTblElement;
-
/*--------------------- Export Functions --------------------------*/
bool is_channel_valid(unsigned int CountryCode);
void clear_channel_map_info(void *pDeviceHandler);
unsigned char auto_channel_select(void *pDeviceHandler, CARD_PHY_TYPE ePHYType);
-
#endif /* _CHANNEL_H_ */
/*--------------------- Static Definitions -------------------------*/
-
-
-
/*--------------------- Static Classes ----------------------------*/
-
extern unsigned short TxRate_iwconfig; //2008-5-8 <add> by chester
/*--------------------- Static Variables --------------------------*/
//static int msglevel =MSG_LEVEL_DEBUG;
PKnownNodeDB psNodeDBTable
);
-
-
void
s_vResetCounter(
PKnownNodeDB psNodeDBTable
/*--------------------- Export Variables --------------------------*/
-
/*--------------------- Export Functions --------------------------*/
-
/*+
*
* Description:
return 0;
}
-
-
/*+
*
* Routine Description:
#define AUTORATE_TXCNT_THRESHOLD 20
#define AUTORATE_INC_THRESHOLD 30
-
-
-
/*+
*
* Description:
unsigned short wOldBasicRate = pDevice->wBasicRate;
unsigned int uRateLen;
-
if (pItemRates == NULL)
return;
}
if ((pItemExtRates != NULL) && (pItemExtRates->byElementID == WLAN_EID_EXTSUPP_RATES) &&
(pDevice->eCurrentPHYType != PHY_TYPE_11B)) {
-
unsigned int uExtRateLen = pItemExtRates->len;
if (uExtRateLen > WLAN_RATES_MAXLEN)
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Exit ParseMaxRate\n");
}
-
/*+
*
* Routine Description:
psNodeDBTable->uTimeCount = 0;
}
-
for (ii = 0; ii < MAX_RATE; ii++) {
if (psNodeDBTable->wSuppRate & (0x0001<<ii)) {
if (bAutoRate[ii] == true) {
// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rate: %d, U:%d, D:%d\n", psNodeDBTable->wTxDataRate, wIdxUpRate, wIdxDownRate);
return;
-
}
/*+
}
return (unsigned char)uRateCnt;
}
-
#define RETRY_TIMES_THRD_H 2 // times
#define RETRY_TIMES_THRD_L 1 // times
-
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
-
/*--------------------- Export Types ------------------------------*/
-
/*--------------------- Export Functions --------------------------*/
-
-
void
RATEvParseMaxRate(
void *pDeviceHandler,
unsigned char byRate
);
-
unsigned char
DATARATEbyGetRateIdx(
unsigned char byRate
);
-
#endif //__DATARATE_H__
#define CB_RD_NUM 32 // default # of RD
#define CB_TD_NUM 32 // default # of TD
-
// max number of physical segments
// in a single NDIS packet. Above this threshold, the packet
// is copied into a single physically contiguous buffer
#define CB_PROTOCOL_RESERVED_SECTION 16
-
-
// if retrys excess 15 times , tx will abort, and
// if tx fifo underflow, tx will fail
// we should try to resend it
#define TYPE_RXDMA1 1
#define TYPE_MAXRD 2
-
-
// TD_INFO flags control bit
#define TD_FLAGS_NETIF_SKB 0x01 // check if need release skb
#define TD_FLAGS_PRIV_SKB 0x02 // check if called from private skb(hostap)
} __attribute__ ((__packed__))
SRDES0;
-
#endif
typedef struct tagRDES1 {
#endif
-
typedef struct tagTDES1 {
volatile unsigned short wReqCount;
volatile unsigned char byTCR;
} __attribute__ ((__packed__))
STDES1;
-
typedef struct tagDEVICE_TD_INFO {
struct sk_buff *skb;
unsigned char *buf;
STxDesc, *PSTxDesc;
typedef const STxDesc *PCSTxDesc;
-
typedef struct tagSTxSyncDesc {
volatile STDES0 m_td0TD0;
volatile STDES1 m_td1TD1;
STxSyncDesc, *PSTxSyncDesc;
typedef const STxSyncDesc *PCSTxSyncDesc;
-
//
// RsvTime buffer header
//
SRTS_g, *PSRTS_g;
typedef const SRTS_g *PCSRTS_g;
-
typedef struct tagSRTS_g_FB {
unsigned char bySignalField_b;
unsigned char byServiceField_b;
SRTS_g_FB, *PSRTS_g_FB;
typedef const SRTS_g_FB *PCSRTS_g_FB;
-
typedef struct tagSRTS_ab {
unsigned char bySignalField;
unsigned char byServiceField;
SRTS_ab, *PSRTS_ab;
typedef const SRTS_ab *PCSRTS_ab;
-
typedef struct tagSRTS_a_FB {
unsigned char bySignalField;
unsigned char byServiceField;
SRTS_a_FB, *PSRTS_a_FB;
typedef const SRTS_a_FB *PCSRTS_a_FB;
-
//
// CTS buffer header
//
SCTS_FB, *PSCTS_FB;
typedef const SCTS_FB *PCSCTS_FB;
-
//
// Tx FIFO header
//
STxDataHead_g_FB, *PSTxDataHead_g_FB;
typedef const STxDataHead_g_FB *PCSTxDataHead_g_FB;
-
typedef struct tagSTxDataHead_ab {
unsigned char bySignalField;
unsigned char byServiceField;
STxDataHead_ab, *PSTxDataHead_ab;
typedef const STxDataHead_ab *PCSTxDataHead_ab;
-
typedef struct tagSTxDataHead_a_FB {
unsigned char bySignalField;
unsigned char byServiceField;
} __attribute__ ((__packed__))
SBEACONCtl;
-
typedef struct tagSSecretKey {
u32 dwLowDword;
unsigned char byHighByte;
/*--------------------- Export Functions --------------------------*/
-
-
-
#endif // __DESC_H__
-
#include "key.h"
#include "mac.h"
-
/*--------------------- Export Definitions -------------------------*/
#define MAC_MAX_CONTEXT_REG (256+128)
#define KEYSEL_TKIP 2
#define KEYSEL_CCMP 3
-
-
#define AUTO_FB_NONE 0
#define AUTO_FB_0 1
#define AUTO_FB_1 2
#define BB_VGA_LEVEL 4
#define BB_VGA_CHANGE_THRESHOLD 16
-
-
#ifndef RUN_AT
#define RUN_AT(x) (jiffies+(x))
#endif
// DMA related
#define RESERV_AC0DMA 4
-
// BUILD OBJ mode
-
#define AVAIL_TD(p, q) ((p)->sOpts.nTxDescs[(q)] - ((p)->iTDUsed[(q)]))
//PLICE_DEBUG ->
#define NUM 64
//PLICE_DEUBG <-
-
-
#define PRIVATE_Message 0
/*--------------------- Export Types ------------------------------*/
-
#define DBG_PRT(l, p, args...) { if (l <= msglevel) printk(p, ##args); }
#define PRINT_K(p, args...) { if (PRIVATE_Message) printk(p, ##args); }
PK_TYPE_11GA
} VIA_PKT_TYPE, *PVIA_PKT_TYPE;
-
typedef enum __device_msg_level {
MSG_LEVEL_ERR = 0, //Errors that will cause abnormal operation.
MSG_LEVEL_NOTICE = 1, //Some errors need users to be notified.
DEVICE_INIT_DXPL // Dx to D0 power lost init
} DEVICE_INIT_TYPE, *PDEVICE_INIT_TYPE;
-
//++ NDIS related
#define MAX_BSSIDINFO_4_PMKID 16
// PMKID Structures
typedef unsigned char NDIS_802_11_PMKID_VALUE[16];
-
typedef enum _NDIS_802_11_WEP_STATUS
{
Ndis802_11WEPEnabled,
} NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS;
-
typedef enum _NDIS_802_11_STATUS_TYPE
{
Ndis802_11StatusType_Authentication,
unsigned long Flags;
} PMKID_CANDIDATE, *PPMKID_CANDIDATE;
-
typedef struct _BSSID_INFO
{
NDIS_802_11_MAC_ADDRESS BSSID;
u32 flags;
} CHIP_INFO, *PCHIP_INFO;
-
typedef enum {
OWNED_BY_HOST = 0,
OWNED_BY_NIC = 1
} DEVICE_OWNER_TYPE, *PDEVICE_OWNER_TYPE;
-
// The receive duplicate detection cache entry
typedef struct tagSCacheEntry {
unsigned short wFmSequence;
bool bInUse;
} SDeFragControlBlock, *PSDeFragControlBlock;
-
-
//flags for options
#define DEVICE_FLAGS_IP_ALIGN 0x00000001UL
#define DEVICE_FLAGS_PREAMBLE_TYPE 0x00000002UL
//for device_set_media_duplex
#define DEVICE_LINK_CHANGE 0x00000001UL
-
//PLICE_DEBUG->
-
typedef struct _RxManagementQueue
{
int packet_num;
PSRxMgmtPacket Q[NUM];
} RxManagementQueue, *PSRxManagementQueue;
-
-
//PLICE_DEBUG<-
-
typedef struct __device_opt {
int nRxDescs0; //Number of RX descriptors0
int nRxDescs1; //Number of RX descriptors1
u32 flags;
} OPTIONS, *POPTIONS;
-
typedef struct __device_info {
struct __device_info *next;
struct __device_info *prev;
struct semaphore mlme_semaphore;
//PLICE_DEBUG <-
-
u32 rx_bytes;
// Version control
// 802.11 counter
SDot11Counters s802_11Counter;
-
// 802.11 management
PSMgmtObject pMgmt;
SMgmtObject sMgmtObj;
unsigned char byCWMaxMin;
CARD_PHY_TYPE eCurrentPHYType;
-
VIA_BB_TYPE byBBType; //0: 11A, 1:11B, 2:11G
VIA_PKT_TYPE byPacketType; //0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate)
unsigned short wBasicRate;
bool bPWBitOn;
WMAC_POWER_MODE ePSMode;
-
// GPIO Radio Control
unsigned char byRadioCtl;
unsigned char byGPIO;
bool bCmdRunning;
bool bCmdClear;
-
-
bool bRoaming;
//WOW
unsigned char abyIPAddr[4];
// for OID_802_11_ASSOCIATION_INFORMATION
bool bAssocInfoSet;
-
unsigned char byAutoFBCtrl;
bool bTxMICFail;
bool bRxMICFail;
-
unsigned int uRATEIdx;
-
// For Update BaseBand VGA Gain Offset
bool bUpdateBBVGA;
unsigned int uBBVGADiffCount;
unsigned char byBBPreEDRSSI;
unsigned char byBBPreEDIndex;
-
bool bRadioCmd;
unsigned long dwDiagRefCount;
char abyRegPwr[CB_MAX_CHANNEL+1];
char abyLocalPwr[CB_MAX_CHANNEL+1];
-
// BaseBand Loopback Use
unsigned char byBBCR4d;
unsigned char byBBCRc9;
unsigned char byReAssocCount; //mike add:re-association retry times!
unsigned char byLinkWaitCount;
-
unsigned char abyNodeName[17];
bool bDiversityRegCtlON;
struct timer_list TimerSQ3Tmax2;
struct timer_list TimerSQ3Tmax3;
-
unsigned long uNumSQ3[MAX_RATE];
unsigned short wAntDiversityMaxRate;
-
SEthernetHeader sTxEthHeader;
SEthernetHeader sRxEthHeader;
unsigned char abyBroadcastAddr[ETH_ALEN];
SPMKID gsPMKID;
SPMKIDCandidateEvent gsPMKIDCandidate;
-
// for 802.11h
bool b11hEnable;
unsigned char abyCountryCode[3];
struct iw_statistics wstats; // wireless stats
bool bCommit;
-
} DEVICE_INFO, *PSDevice;
-
//PLICE_DEBUG->
-
inline static void EnQueue(PSDevice pDevice, PSRxMgmtPacket pRxMgmtPacket)
{
if ((pDevice->rxManeQueue.tail+1) % NUM == pDevice->rxManeQueue.head) {
}
}
-
-
-
inline static PSRxMgmtPacket DeQueue(PSDevice pDevice)
{
PSRxMgmtPacket pRxMgmtPacket;
void InitRxManagementQueue(PSDevice pDevice);
-
-
//PLICE_DEBUG<-
-
-
-
-
-
inline static bool device_get_ip(PSDevice pInfo) {
struct in_device *in_dev = (struct in_device *)pInfo->dev->ip_ptr;
struct in_ifaddr *ifa;
return false;
}
-
-
static inline PDEVICE_RD_INFO alloc_rd_info(void)
{
return kzalloc(sizeof(DEVICE_RD_INFO), GFP_ATOMIC);
bool device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF);
int Config_FileOperation(PSDevice pDevice, bool fwrite, unsigned char *Parameter);
#endif
-
-
//Max: 2378=2312Payload + 30HD +4CRC + 2Padding + 4Len + 8TSF + 4RSR
#define PKT_BUF_SZ 2390
-
#define MAX_UINTS 8
#define OPTION_DEFAULT { [0 ... MAX_UINTS-1] = -1}
-
-
typedef enum _chip_type {
VT3253 = 1
} CHIP_TYPE, *PCHIP_TYPE;
-
-
#ifdef VIAWET_DEBUG
#define ASSERT(x) \
do { \
#define DBG_PORT80(value)
#endif
-
#endif
#define TX_DESC_DEF1 64
DEVICE_PARAM(TxDescriptors1, "Number of transmit descriptors1");
-
#define IP_ALIG_DEF 0
/* IP_byte_align[] is used for IP header unsigned long byte aligned
0: indicate the IP header won't be unsigned long byte aligned.(Default) .
*/
DEVICE_PARAM(IP_byte_align, "Enable IP header dword aligned");
-
#define INT_WORKS_DEF 20
#define INT_WORKS_MIN 10
#define INT_WORKS_MAX 64
DEVICE_PARAM(Channel, "Channel number");
-
/* PreambleType[] is the preamble length used for transmit.
0: indicate allows long preamble type
1: indicate allows short preamble type
DEVICE_PARAM(PreambleType, "Preamble Type");
-
#define RTS_THRESH_MIN 512
#define RTS_THRESH_MAX 2347
#define RTS_THRESH_DEF 2347
DEVICE_PARAM(RTSThreshold, "RTS threshold");
-
#define FRAG_THRESH_MIN 256
#define FRAG_THRESH_MAX 2346
#define FRAG_THRESH_DEF 2346
DEVICE_PARAM(FragThreshold, "Fragmentation threshold");
-
#define DATA_RATE_MIN 0
#define DATA_RATE_MAX 13
#define DATA_RATE_DEF 13
2: indicate AP mode used
*/
-
/* PSMode[]
0: indicate disable power saving mode
1: indicate enable power saving mode
DEVICE_PARAM(PSMode, "Power saving mode");
-
#define SHORT_RETRY_MIN 0
#define SHORT_RETRY_MAX 31
#define SHORT_RETRY_DEF 8
-
DEVICE_PARAM(ShortRetryLimit, "Short frame retry limits");
#define LONG_RETRY_MIN 0
#define LONG_RETRY_MAX 15
#define LONG_RETRY_DEF 4
-
DEVICE_PARAM(LongRetryLimit, "long frame retry limits");
-
/* BasebandType[] baseband type selected
0: indicate 802.11a type
1: indicate 802.11b type
DEVICE_PARAM(BasebandType, "baseband type");
-
-
/* 80211hEnable[]
0: indicate disable 802.11h
1: indicate enable 802.11h
DEVICE_PARAM(bDiversityANTEnable, "ANT diversity mode");
-
//
// Static vars definitions
//
-
static int device_nics = 0;
static PSDevice pDevice_Infos = NULL;
static struct net_device *root_device_dev = NULL;
/*--------------------- Static Functions --------------------------*/
-
static int vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent);
static void vt6655_init_info(struct pci_dev *pcid, PSDevice *ppDevice, PCHIP_INFO);
static void device_free_info(PSDevice pDevice);
};
#endif
-
static void device_init_rd0_ring(PSDevice pDevice);
static void device_init_rd1_ring(PSDevice pDevice);
static void device_init_defrag_cb(PSDevice pDevice);
static int Config_FileGetParameter(unsigned char *string,
unsigned char *dest, unsigned char *source);
-
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Functions --------------------------*/
-
-
static char *get_chip_name(int chip_id)
{
int i;
if (pDevice == NULL)
return;
device_free_info(pDevice);
-
}
/*
static void
device_set_options(PSDevice pDevice) {
-
unsigned char abyBroadcastAddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
unsigned char abySNAP_RFC1042[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00};
unsigned char abySNAP_Bridgetunnel[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0xF8};
-
memcpy(pDevice->abyBroadcastAddr, abyBroadcastAddr, ETH_ALEN);
memcpy(pDevice->abySNAP_RFC1042, abySNAP_RFC1042, ETH_ALEN);
memcpy(pDevice->abySNAP_Bridgetunnel, abySNAP_Bridgetunnel, ETH_ALEN);
pDevice->wCTSDuration = 0;
pDevice->byPreambleType = 0;
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " uChannel= %d\n", (int)pDevice->uChannel);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " byOpMode= %d\n", (int)pDevice->byOpMode);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " ePSMode= %d\n", (int)pDevice->ePSMode);
);
CARDbStartMeasure(pDevice, pDevice->pCurrMeasureEID++, pDevice->uNumOfMeasureEIDs);
}
-
}
-
-
//
// Initialisation of MAC & BBP registers
//
// Load power Table
-
for (ii = 0; ii < CB_MAX_CHANNEL_24G; ii++) {
pDevice->abyCCKPwrTbl[ii + 1] = SROMbyReadEmbedded(pDevice->PortOffset, (unsigned char)(ii + EEP_OFS_CCK_PWR_TBL));
if (pDevice->abyCCKPwrTbl[ii + 1] == 0) {
}
}
-
// Load OFDM A Power Table
for (ii = 0; ii < CB_MAX_CHANNEL_5G; ii++) { //RobertYu:20041224, bug using CB_MAX_CHANNEL
pDevice->abyOFDMPwrTbl[ii + CB_MAX_CHANNEL_24G + 1] = SROMbyReadEmbedded(pDevice->PortOffset, (unsigned char)(ii + EEP_OFS_OFDMA_PWR_TBL));
}
init_channel_table((void *)pDevice);
-
if (pDevice->byLocalID > REV_ID_VT3253_B1) {
MACvSelectPage1(pDevice->PortOffset);
VNSvOutPortB(pDevice->PortOffset + MAC_REG_MSRCTL + 1, (MSRCTL1_TXPWR | MSRCTL1_CSAPAREN));
MACvSelectPage0(pDevice->PortOffset);
}
-
// use relative tx timeout and 802.11i D4
MACvWordRegBitsOn(pDevice->PortOffset, MAC_REG_CFG, (CFG_TKIPOPT | CFG_NOTXTIMEOUT));
MACvStart(pDevice->PortOffset);
netif_stop_queue(pDevice->dev);
-
-
}
-
-
static void device_init_diversity_timer(PSDevice pDevice) {
-
init_timer(&pDevice->TimerSQ3Tmax1);
pDevice->TimerSQ3Tmax1.data = (unsigned long) pDevice;
pDevice->TimerSQ3Tmax1.function = (TimerFunction)TimerSQ3CallBack;
return;
}
-
static bool device_release_WPADEV(PSDevice pDevice)
{
viawget_wpa_header *wpahdr;
return -ENODEV;
}
-
dev = alloc_etherdev(sizeof(DEVICE_INFO));
pDevice = (PSDevice) netdev_priv(dev);
}
#endif
-
#endif
#ifdef DEBUG
return -ENODEV;
}
-
-
-
rc = pci_request_regions(pcid, DEVICE_NAME);
if (rc) {
printk(KERN_ERR DEVICE_NAME ": Failed to find PCI device\n");
printk("After write: value is %x\n", value);
#endif
-
-
#ifdef IO_MAP
pDevice->PortOffset = pDevice->ioaddr;
#endif
device_print_info(pDevice);
pci_set_drvdata(pcid, pDevice);
return 0;
-
}
static void device_print_info(PSDevice pDevice)
(unsigned long)pDevice->ioaddr, (unsigned long)pDevice->PortOffset);
DBG_PRT(MSG_LEVEL_INFO, KERN_INFO " IRQ=%d \n", pDevice->dev->irq);
#endif
-
}
static void vt6655_init_info(struct pci_dev *pcid, PSDevice *ppDevice,
PCHIP_INFO pChip_info) {
-
PSDevice p;
memset(*ppDevice, 0, sizeof(DEVICE_INFO));
}
static bool device_get_pci_info(PSDevice pDevice, struct pci_dev *pcid) {
-
u16 pci_cmd;
u8 b;
unsigned int cis_addr;
static bool device_init_rings(PSDevice pDevice) {
void *vir_pool;
-
/*allocate all RD/TD rings a single pool*/
vir_pool = pci_alloc_consistent(pDevice->pcid,
pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) +
pDevice->aRD1Ring = vir_pool +
pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc);
-
pDevice->rd0_pool_dma = pDevice->pool_dma;
pDevice->rd1_pool_dma = pDevice->rd0_pool_dma +
pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc);
pDevice->td1_pool_dma = pDevice->td0_pool_dma +
pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc);
-
// vir_pool: pvoid type
pDevice->apTD0Rings = vir_pool
+ pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc)
+ pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc)
+ pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc);
-
pDevice->tx1_bufs = pDevice->tx0_bufs +
pDevice->sOpts.nTxDescs[0] * PKT_BUF_SZ;
-
pDevice->tx_beacon_bufs = pDevice->tx1_bufs +
pDevice->sOpts.nTxDescs[1] * PKT_BUF_SZ;
pDevice->tx_bufs_dma1 = pDevice->tx_bufs_dma0 +
pDevice->sOpts.nTxDescs[0] * PKT_BUF_SZ;
-
pDevice->tx_beacon_dma = pDevice->tx_bufs_dma1 +
pDevice->sOpts.nTxDescs[1] * PKT_BUF_SZ;
-
return true;
}
static void device_free_rings(PSDevice pDevice) {
-
pci_free_consistent(pDevice->pcid,
pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) +
pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) +
pDevice->pCurrRD[0] = &(pDevice->aRD0Ring[0]);
}
-
static void device_init_rd1_ring(PSDevice pDevice) {
int i;
dma_addr_t curr = pDevice->rd1_pool_dma;
pDevice->pCurrRD[1] = &(pDevice->aRD1Ring[0]);
}
-
static void device_init_defrag_cb(PSDevice pDevice) {
int i;
PSDeFragControlBlock pDeF;
pDevice->cbFreeDFCB = pDevice->cbDFCB;
}
-
-
-
static void device_free_rd0_ring(PSDevice pDevice) {
int i;
kfree((void *)pDesc->pRDInfo);
}
-
}
static void device_free_rd1_ring(PSDevice pDevice) {
int i;
-
for (i = 0; i < pDevice->sOpts.nRxDescs1; i++) {
PSRxDesc pDesc = &(pDevice->aRD1Ring[i]);
PDEVICE_RD_INFO pRDInfo = pDesc->pRDInfo;
kfree((void *)pDesc->pRDInfo);
}
-
}
static void device_free_frag_buf(PSDevice pDevice) {
int i;
for (i = 0; i < CB_MAX_RX_FRAG; i++) {
-
pDeF = &(pDevice->sRxDFCB[i]);
if (pDeF->skb)
dev_kfree_skb(pDeF->skb);
}
-
}
static void device_init_td0_ring(PSDevice pDevice) {
if (i > 0)
pDevice->apTD0Rings[i-1].next_desc = cpu_to_le32(pDevice->td0_pool_dma);
pDevice->apTailTD[0] = pDevice->apCurrTD[0] = &(pDevice->apTD0Rings[0]);
-
}
static void device_init_td1_ring(PSDevice pDevice) {
pDevice->apTailTD[1] = pDevice->apCurrTD[1] = &(pDevice->apTD1Rings[0]);
}
-
-
static void device_free_td0_ring(PSDevice pDevice) {
int i;
for (i = 0; i < pDevice->sOpts.nTxDescs[0]; i++) {
kfree((void *)pDesc->pTDInfo);
}
-
}
-
-
/*-----------------------------------------------------------------*/
static int device_rx_srv(PSDevice pDevice, unsigned int uIdx) {
PSRxDesc pRD;
int works = 0;
-
for (pRD = pDevice->pCurrRD[uIdx];
pRD->m_rd0RD0.f1Owner == OWNED_BY_HOST;
pRD = pRD->next) {
return works;
}
-
static bool device_alloc_rx_buf(PSDevice pDevice, PSRxDesc pRD) {
-
PDEVICE_RD_INFO pRDInfo = pRD->pRDInfo;
-
pRDInfo->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
if (pRDInfo->skb == NULL)
return false;
return true;
}
-
-
bool device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF) {
-
pDeF->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
if (pDeF->skb == NULL)
return false;
return true;
}
-
-
static int device_tx_srv(PSDevice pDevice, unsigned int uIdx) {
PSTxDesc pTD;
bool bFull = false;
unsigned int uNodeIndex;
PSMgmtObject pMgmt = pDevice->pMgmt;
-
for (pTD = pDevice->apTailTD[uIdx]; pDevice->iTDUsed[uIdx] > 0; pTD = pTD->next) {
-
if (pTD->m_td0TD0.f1Owner == OWNED_BY_NIC)
break;
if (works++ > 15)
//Only the status of first TD in the chain is correct
if (pTD->m_td1TD1.byTCR & TCR_STP) {
-
if ((pTD->pTDInfo->byFlags & TD_FLAGS_NETIF_SKB) != 0) {
uFIFOHeaderSize = pTD->pTDInfo->dwHeaderLength;
uFrameSize = pTD->pTDInfo->dwReqCount - uFIFOHeaderSize;
(unsigned char *)(pTD->pTDInfo->buf + uFIFOHeaderSize),
uFrameSize, uIdx);
-
BSSvUpdateNodeTxCounter(pDevice,
byTsr0, byTsr1,
(unsigned char *)(pTD->pTDInfo->buf),
}
}
-
if (uIdx == TYPE_AC0DMA) {
// RESERV_AC0DMA reserved for relay
}
}
-
pDevice->apTailTD[uIdx] = pTD;
return works;
}
-
static void device_error(PSDevice pDevice, unsigned short status) {
-
if (status & ISR_FETALERR) {
DBG_PRT(MSG_LEVEL_ERR, KERN_ERR
"%s: Hardware fatal error.\n",
MACbShutdown(pDevice->PortOffset);
return;
}
-
}
static void device_free_tx_buf(PSDevice pDevice, PSTxDesc pDesc) {
pTDInfo->byFlags = 0;
}
-
-
//PLICE_DEBUG ->
void InitRxManagementQueue(PSDevice pDevice)
{
}
//PLICE_DEBUG<-
-
-
-
-
//PLICE_DEBUG ->
int MlmeThread(
void *Context)
//i = 0;
#if 1
while (1) {
-
//down(&pDevice->mlme_semaphore);
// pRxMgmtPacket = DeQueue(pDevice);
#if 1
#endif
return 0;
-
}
-
-
static int device_open(struct net_device *dev) {
PSDevice pDevice = (PSDevice)netdev_priv(dev);
int i;
device_init_td1_ring(pDevice);
// VNTWIFIvSet11h(pDevice->pMgmt, pDevice->b11hEnable);
-
if (pDevice->bDiversityRegCtlON) {
device_init_diversity_timer(pDevice);
}
mlme_kill = 1;
#endif
-
-
//wait_for_completion(&pDevice->notify);
-
-
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call device_init_registers\n");
device_init_registers(pDevice, DEVICE_INIT_COLD);
MACvReadEtherAddress(pDevice->PortOffset, pDevice->abyCurrentNetAddr);
return 0;
}
-
static int device_close(struct net_device *dev) {
PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = pDevice->pMgmt;
return 0;
}
-
-
static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev) {
PSDevice pDevice = netdev_priv(dev);
unsigned char *pbMPDU;
unsigned int cbMPDULen = 0;
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_tx_80211\n");
spin_lock_irq(&pDevice->lock);
spin_unlock_irq(&pDevice->lock);
return 0;
-
}
-
-
bool device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, unsigned int uNodeIndex) {
PSMgmtObject pMgmt = pDevice->pMgmt;
PSTxDesc pHeadTD, pLastTD;
SKeyItem STempKey;
// unsigned char byKeyIndex = 0;
-
if (pDevice->bStopTx0Pkt == true) {
dev_kfree_skb_irq(skb);
return false;
}
byPktType = (unsigned char)pDevice->byPacketType;
-
if (pDevice->bFixRate) {
if (pDevice->eCurrentPHYType == PHY_TYPE_11B) {
if (pDevice->uConnectionRate >= RATE_11M) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dma0: pDevice->wCurrentRate = %d \n", pDevice->wCurrentRate);
-
if (pDevice->wCurrentRate <= RATE_11M) {
byPktType = PK_TYPE_11B;
} else if (pDevice->eCurrentPHYType == PHY_TYPE_11A) {
MACvTransmit0(pDevice->PortOffset);
-
return true;
}
unsigned char *pbyBSSID;
bool bNodeExist = false;
-
-
spin_lock_irq(&pDevice->lock);
if (pDevice->bLinkPass == false) {
dev_kfree_skb_irq(skb);
return 0;
}
-
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
if (pDevice->uAssocCount == 0) {
dev_kfree_skb_irq(skb);
pHeadTD->m_td1TD1.byTCR = (TCR_EDP|TCR_STP);
-
memcpy(pDevice->sTxEthHeader.abyDstAddr, (unsigned char *)(skb->data), ETH_HLEN);
cbFrameBodySize = skb->len - ETH_HLEN;
// 802.1H
cbFrameBodySize += 8;
}
-
if (pDevice->bEncryptionEnable == true) {
bNeedEncryption = true;
// get Transmit key
break;
}
} else if (pDevice->pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
-
pbyBSSID = pDevice->sTxEthHeader.abyDstAddr; //TO_DS = 0 and FROM_DS = 0 --> 802.11 MAC Address1
DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "IBSS Serach Key: \n");
for (ii = 0; ii < 6; ii++)
&(pDevice->byTopCCKBasicRate),
&(pDevice->byTopOFDMBasicRate));
-
}
}
}
}
-
vGenerateFIFOHeader(pDevice, byPktType, pDevice->pbyTmpBuff, bNeedEncryption,
cbFrameBodySize, TYPE_AC0DMA, pHeadTD,
&pDevice->sTxEthHeader, (unsigned char *)skb->data, pTransmitKey, uNodeIndex,
spin_unlock_irq(&pDevice->lock);
return 0;
-
}
static irqreturn_t device_intr(int irq, void *dev_instance) {
int ii = 0;
// unsigned char byRSSI;
-
MACvReadISR(pDevice->PortOffset, &pDevice->dwIsr);
if (pDevice->dwIsr == 0)
// update ISR counter
STAvUpdate802_11Counter(&pDevice->s802_11Counter, &pDevice->scStatistic , dwMIBCounter);
while (pDevice->dwIsr != 0) {
-
STAvUpdateIsrStatCounter(&pDevice->scStatistic, pDevice->dwIsr);
MACvWriteISR(pDevice->PortOffset, pDevice->dwIsr);
}
if (pDevice->byLocalID > REV_ID_VT3253_B1) {
-
if (pDevice->dwIsr & ISR_MEASURESTART) {
// 802.11h measure start
pDevice->byOrgChannel = pDevice->byCurrentCh;
if ((pDevice->eOPMode == OP_MODE_AP) ||
(pDevice->eOPMode == OP_MODE_ADHOC)) {
-
MACvOneShotTimer1MicroSec(pDevice->PortOffset,
(pMgmt->wIBSSBeaconPeriod - MAKE_BEACON_RESERVED) << 10);
}
}
if (pDevice->dwIsr & ISR_BNTX) {
-
if (pDevice->eOPMode == OP_MODE_ADHOC) {
pDevice->bIsBeaconBufReadySet = false;
pDevice->cbBeaconBufReadySetCnt = 0;
max_count += device_tx_srv(pDevice, TYPE_AC0DMA);
}
if (pDevice->dwIsr & ISR_SOFTTIMER) {
-
}
if (pDevice->dwIsr & ISR_SOFTTIMER1) {
if (pDevice->eOPMode == OP_MODE_AP) {
return IRQ_RETVAL(handled);
}
-
static unsigned const ethernet_polynomial = 0x04c11db7U;
static inline u32 ether_crc(int length, unsigned char *data)
{
return result;
}
-
-
static void device_set_multi(struct net_device *dev) {
PSDevice pDevice = (PSDevice)netdev_priv(dev);
u32 mc_filter[2];
struct netdev_hw_addr *ha;
-
VNSvInPortB(pDevice->PortOffset + MAC_REG_RCR, &(pDevice->byRxMode));
if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byRxMode = %x\n", pDevice->byRxMode);
}
-
static struct net_device_stats *device_get_stats(struct net_device *dev) {
PSDevice pDevice = (PSDevice)netdev_priv(dev);
return &pDevice->stats;
}
-
-
static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {
PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = pDevice->pMgmt;
PSCmdRequest pReq;
-
if (pMgmt == NULL) {
rc = -EFAULT;
return rc;
}
switch (cmd) {
-
case SIOCGIWNAME:
rc = iwctl_giwname(dev, NULL, (char *)&(wrq->u.name), NULL);
break;
}
break;
-
// Get current network name (ESSID)
case SIOCGIWESSID:
rc = iwctl_siwap(dev, NULL, &(wrq->u.ap_addr), NULL);
break;
-
// Get current Access Point (BSSID)
case SIOCGIWAP:
rc = iwctl_giwap(dev, NULL, &(wrq->u.ap_addr), NULL);
break;
-
// Set desired station name
case SIOCSIWNICKN:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWNICKN \n");
char abyKey[WLAN_WEP232_KEYLEN];
if (wrq->u.encoding.pointer) {
-
-
if (wrq->u.encoding.length > WLAN_WEP232_KEYLEN) {
rc = -E2BIG;
break;
rc = iwctl_giwpower(dev, NULL, &(wrq->u.power), NULL);
break;
-
case SIOCSIWPOWER:
rc = iwctl_siwpower(dev, NULL, &(wrq->u.power), NULL);
break;
-
case SIOCGIWSENS:
rc = iwctl_giwsens(dev, NULL, &(wrq->u.sens), NULL);
}
break;
-
#ifdef WIRELESS_SPY
// Set the spy list
case SIOCSIWSPY:
*/
break;
-
//2008-0409-07, <Add> by Einsn Liu
#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
case SIOCSIWAUTH:
case IOCTL_CMD_HOSTAPD:
-
rc = vt6655_hostap_ioctl(pDevice, &wrq->u.data);
break;
rc = -EOPNOTSUPP;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Ioctl command not support..%x\n", cmd);
-
}
if (pDevice->bCommit) {
return rc;
}
-
static int ethtool_ioctl(struct net_device *dev, void *useraddr)
{
u32 ethcmd;
{
int ret;
-
// ret=pci_module_init(&device_driver);
//ret = pcie_port_service_register(&device_driver);
ret = pci_register_driver(&device_driver);
static void __exit vt6655_cleanup_module(void)
{
-
-
#ifdef CONFIG_PM
unregister_reboot_notifier(&device_notifier);
#endif
pci_unregister_driver(&device_driver);
-
}
module_init(vt6655_init_module);
module_exit(vt6655_cleanup_module);
-
#ifdef CONFIG_PM
static int
device_notify_reboot(struct notifier_block *nb, unsigned long event, void *p)
PSMgmtObject pMgmt = pDevice->pMgmt;
int power_status; // to silence the compiler
-
power_status = pci_set_power_state(pcid, 0);
power_status = pci_enable_wake(pcid, 0, 0);
pci_restore_state(pcid);
}
#endif
-
-
-
-
#include "iowpa.h"
#include "aes_ccmp.h"
-
-
/*--------------------- Static Definitions -------------------------*/
/*--------------------- Static Classes ----------------------------*/
const unsigned char acbyRxRate[MAX_RATE] =
{2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108};
-
/*--------------------- Static Functions --------------------------*/
/*--------------------- Static Definitions -------------------------*/
static unsigned char s_byGetRateIdx(unsigned char byRate);
-
static void
s_vGetDASA(unsigned char *pbyRxBufferAddr, unsigned int *pcbHeaderSize,
PSEthernetHeader psEthHeader);
int iSANodeIndex
);
-
-
static bool s_bAPModeRxData(
PSDevice pDevice,
struct sk_buff *skb,
int iDANodeIndex
);
-
static bool s_bHandleRxEncryption(
PSDevice pDevice,
unsigned char *pbyFrame,
PS802_11Header pMACHeader;
int ii;
-
pMACHeader = (PS802_11Header) (pbyRxBufferAddr + cbHeaderSize);
s_vGetDASA((unsigned char *)pMACHeader, &cbHeaderSize, &pDevice->sRxEthHeader);
*pcbHeadSize = cbHeaderSize;
}
-
-
-
static unsigned char s_byGetRateIdx(unsigned char byRate)
{
unsigned char byRateIdx;
return 0;
}
-
static void
s_vGetDASA(unsigned char *pbyRxBufferAddr, unsigned int *pcbHeaderSize,
PSEthernetHeader psEthHeader)
*pcbHeaderSize = cbHeaderSize;
}
-
-
-
//PLICE_DEBUG ->
void MngWorkItem(void *Context)
spin_unlock_irq(&pDevice->lock);
}
-
//PLICE_DEBUG<-
-
-
bool
device_receive_frame(
PSDevice pDevice,
PSRxDesc pCurrRD
)
{
-
PDEVICE_RD_INFO pRDInfo = pCurrRD->pRDInfo;
struct net_device_stats *pStats = &pDevice->stats;
struct sk_buff *skb;
skb = pRDInfo->skb;
-
//PLICE_DEBUG->
#if 1
pci_unmap_single(pDevice->pcid, pRDInfo->skb_dma,
}
}
-
// Use for TKIP MIC
s_vGetDASA(skb->data+4, &cbHeaderSize, &pDevice->sRxEthHeader);
}
}
-
if (IS_FC_WEP(pbyFrame)) {
bool bRxDecryOK = false;
(pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) ||
(pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPA2) ||
(pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) {
-
if ((pKey != NULL) && (pKey->byCipherSuite == KEY_CTL_TKIP)) {
pDevice->s802_11Counter.TKIPICVErrors++;
} else if ((pKey != NULL) && (pKey->byCipherSuite == KEY_CTL_CCMP)) {
FrameSize -= 4; // 4 is ICV
}
-
//
// RX OK
//
}
}
-
// Management & Control frame Handle
if ((IS_TYPE_DATA((skb->data+4))) == false) {
// Handle Control & Manage Frame
}
}
-
// Data frame Handle
-
if (pDevice->bEnablePSMode) {
if (IS_FC_MOREDATA((skb->data+4))) {
if (*pbyRsr & RSR_ADDROK) {
BBvAntennaDiversity(pDevice, s_byGetRateIdx(*pbyRxRate), 0);
}
-
if (pDevice->byLocalID != REV_ID_VT3253_B1) {
pDevice->uCurrRSSI = *pbyRSSI;
}
return false;
}
-
if ((pKey != NULL) && (pKey->byCipherSuite == KEY_CTL_TKIP)) {
if (bIsWEP) {
FrameSize -= 8; //MIC
unsigned long dwLocalMIC_R = 0;
viawget_wpa_header *wpahdr;
-
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
dwMICKey0 = cpu_to_le32(*(unsigned long *)(&pKey->abyKey[24]));
dwMICKey1 = cpu_to_le32(*(unsigned long *)(&pKey->abyKey[28]));
//DBG_PRN_GRP12(("LocalL: %lx, LocalR: %lx\n", dwLocalMIC_L, dwLocalMIC_R));
//DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dwMICKey0= %lx,dwMICKey1= %lx \n", dwMICKey0, dwMICKey1);
-
if ((cpu_to_le32(*pdwMIC_L) != dwLocalMIC_L) || (cpu_to_le32(*pdwMIC_R) != dwLocalMIC_R) ||
(pDevice->bRxMICFail == true)) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MIC comparison is fail!\n");
}
#endif
-
if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) {
wpahdr = (viawget_wpa_header *)pDevice->skb->data;
if ((pDevice->pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
}
} // ----- End of Reply Counter Check --------------------------
-
-
if ((pKey != NULL) && (bIsWEP)) {
// pDevice->s802_11Counter.DecryptSuccessCount.QuadPart++;
}
-
s_vProcessRxMACHeader(pDevice, (unsigned char *)(skb->data+4), FrameSize, bIsWEP, bExtIV, &cbHeaderOffset);
FrameSize -= cbHeaderOffset;
cbHeaderOffset += 4; // 4 is Rcv buffer header
iSANodeIndex,
iDANodeIndex
) == false) {
-
if (bDeFragRx) {
if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) {
DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not alloc more frag bufs\n",
skb_put(skb, FrameSize);
skb->protocol = eth_type_trans(skb, skb->dev);
-
//drop frame not met IEEE 802.3
/*
if (pDevice->flags & DEVICE_FLAGS_VAL_PKT_LEN) {
return true;
}
-
static bool s_bAPModeRxCtl(
PSDevice pDevice,
unsigned char *pbyFrame,
CMD_STATUS Status;
PSMgmtObject pMgmt = pDevice->pMgmt;
-
if (IS_CTL_PSPOLL(pbyFrame) || !IS_TYPE_CONTROL(pbyFrame)) {
-
p802_11Header = (PS802_11Header)(pbyFrame);
if (!IS_TYPE_MGMT(pbyFrame)) {
-
// Data & PS-Poll packet
// check frame class
if (iSANodeIndex > 0) {
}
}
return false;
-
}
static bool s_bHandleRxEncryption(
unsigned char byDecMode = KEY_CTL_WEP;
PSMgmtObject pMgmt = pDevice->pMgmt;
-
*pwRxTSC15_0 = 0;
*pdwRxTSC47_16 = 0;
return true;
}
-
static bool s_bHostWepRxEncryption(
PSDevice pDevice,
unsigned char *pbyFrame,
unsigned char byDecMode = KEY_CTL_WEP;
PS802_11Header pMACHeader;
-
-
*pwRxTSC15_0 = 0;
*pdwRxTSC47_16 = 0;
byKeyIdx >>= 6;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\nKeyIdx: %d\n", byKeyIdx);
-
if (pDevice->pMgmt->byCSSGK == KEY_CTL_TKIP)
byDecMode = KEY_CTL_TKIP;
else if (pDevice->pMgmt->byCSSGK == KEY_CTL_CCMP)
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "TSC0_15: %x\n", *pwRxTSC15_0);
if (byDecMode == KEY_CTL_TKIP) {
-
if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || (bOnFly == false)) {
// Software TKIP
// 1. 3253 A
return true;
}
-
-
static bool s_bAPModeRxData(
PSDevice pDevice,
struct sk_buff *skb,
unsigned char byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
unsigned short wAID;
-
struct sk_buff *skbcpy = NULL;
if (FrameSize > CB_MAX_BUF_SIZE)
// check DA
if (is_multicast_ether_addr((unsigned char *)(skb->data+cbHeaderOffset))) {
if (pMgmt->sNodeDBTable[0].bPSEnable) {
-
skbcpy = dev_alloc_skb((int)pDevice->rx_buf_sz);
// if any node in PS mode, buffer packet until DTIM.
return true;
}
-
void MngWorkItem(void *Context);
#endif // __RXTX_H__
-
-
-
/*--------------------- Static Functions --------------------------*/
-
-
-
/*--------------------- Export Variables --------------------------*/
-
/*
* Description:
* register net_device (AP) for hostap deamon
static int hostap_disable_hostapd(PSDevice pDevice, int rtnl_locked)
{
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: disabling hostapd mode\n", pDevice->dev->name);
if (pDevice->apdev && pDevice->apdev->name && pDevice->apdev->name[0]) {
return 0;
}
-
/*
* Description:
* Set enable/disable hostapd mode
return hostap_disable_hostapd(pDevice, rtnl_locked);
}
-
/*
* Description:
* remove station function supported for hostap deamon
{
unsigned int uNodeIndex;
-
if (BSSDBbIsSTAInNodeDB(pDevice->pMgmt, param->sta_addr, &uNodeIndex)) {
BSSvRemoveOneNode(pDevice, uNodeIndex);
} else {
PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned int uNodeIndex;
-
if (!BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) {
BSSvCreateOneNode((PSDevice)pDevice, &uNodeIndex);
}
return 0;
}
-
-
/*
* Description:
* set generic element (wpa ie)
{
PSMgmtObject pMgmt = pDevice->pMgmt;
-
-
memcpy(pMgmt->abyWPAIE,
param->u.generic_elem.data,
param->u.generic_elem.len
bool bKeyTableFull = false;
unsigned short wKeyCtl = 0;
-
param->u.crypt.err = 0;
/*
if (param_len !=
if (param->u.crypt.alg > WPA_ALG_CCMP)
return -EINVAL;
-
if ((param->u.crypt.idx > 3) || (param->u.crypt.key_len > MAX_KEY_LEN)) {
param->u.crypt.err = HOSTAP_CRYPT_ERR_KEY_SET_FAILED;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " HOSTAP_CRYPT_ERR_KEY_SET_FAILED\n");
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " hostap_set_encryption: alg %d \n", param->u.crypt.alg);
if (param->u.crypt.alg == WPA_ALG_NONE) {
-
if (pMgmt->sNodeDBTable[iNodeIndex].bOnFly == true) {
if (KeybRemoveKey(&(pDevice->sKey),
param->sta_addr,
}
if (param->u.crypt.alg == WPA_ALG_WEP) {
-
if ((pDevice->bEnable8021x == false) || (iNodeIndex == 0)) {
KeybSetDefaultKey(&(pDevice->sKey),
dwKeyIndex & ~(BIT30 | USE_KEYRSC),
KEY_CTL_WEP,
pDevice->PortOffset,
pDevice->byLocalID) == true) {
-
pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true;
} else {
pMgmt->byCSSGK = KEY_CTL_CCMP;
}
-
if (iNodeIndex == 0) {
KeybSetDefaultKey(&(pDevice->sKey),
dwKeyIndex,
byKeyDecMode,
pDevice->PortOffset,
pDevice->byLocalID) == true) {
-
pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true;
} else {
return ret;
}
-
-
/*
* Description:
* get each stations encryption key
int ii;
int iNodeIndex = 0;
-
param->u.crypt.err = 0;
if (is_broadcast_ether_addr(param->sta_addr)) {
return ret;
}
-
/*
* Description:
* vt6655_hostap_ioctl main function supported for hostap deamon.
break;
}
-
if ((ret == 0) && ap_ioctl) {
if (copy_to_user(p->pointer, param, p->length)) {
ret = -EFAULT;
return ret;
}
-
#define WLAN_RATE_48M BIT10
#define WLAN_RATE_54M BIT11
-
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point *p);
#endif // __HOSTAP_H__
-
-
-
//typedef uint16_t u16;
//typedef uint8_t u8;
-
// ioctl Command code
#define MAGIC_CODE 0x3142
#define IOCTL_CMD_TEST (SIOCDEVPRIVATE + 0)
#define IOCTL_CMD_HOSTAPD (SIOCDEVPRIVATE + 2)
#define IOCTL_CMD_WPA (SIOCDEVPRIVATE + 3)
-
typedef enum tagWMAC_CMD {
-
WLAN_CMD_BSS_SCAN,
WLAN_CMD_BSS_JOIN,
WLAN_CMD_DISASSOC,
WLAN_CMD_GET_NODE_CNT,
WLAN_CMD_ZONETYPE_SET,
WLAN_CMD_GET_NODE_LIST
-
} WMAC_CMD, *PWMAC_CMD;
typedef enum tagWZONETYPE {
#define ADHOC_STARTED 1
#define ADHOC_JOINTED 2
-
#define PHY80211a 0
#define PHY80211b 1
#define PHY80211g 2
//
typedef struct tagSCmdScan {
-
u8 ssid[SSID_MAXLEN + 2];
-
} SCmdScan, *PSCmdScan;
-
//
// BSS Join
//
typedef struct tagSCmdBSSJoin {
-
u16 wBSSType;
u16 wBBPType;
u8 ssid[SSID_MAXLEN + 2];
u32 uChannel;
bool bPSEnable;
bool bShareKeyAuth;
-
} SCmdBSSJoin, *PSCmdBSSJoin;
//
//
typedef struct tagSCmdZoneTypeSet {
-
bool bWrite;
WZONETYPE ZoneType;
-
} SCmdZoneTypeSet, *PSCmdZoneTypeSet;
#ifdef WPA_SM_Transtatus
#endif
typedef struct tagSCmdStartAP {
-
u16 wBSSType;
u16 wBBPType;
u8 ssid[SSID_MAXLEN + 2];
u32 uBeaconInt;
bool bShareKeyAuth;
u8 byBasicRate;
-
} SCmdStartAP, *PSCmdStartAP;
-
typedef struct tagSCmdSetWEP {
-
bool bEnableWep;
u8 byKeyIndex;
u8 abyWepKey[WEP_NKEYS][WEP_KEYMAXLEN];
bool bWepKeyAvailable[WEP_NKEYS];
u32 auWepKeyLength[WEP_NKEYS];
-
} SCmdSetWEP, *PSCmdSetWEP;
-
-
typedef struct tagSBSSIDItem {
-
u32 uChannel;
u8 abyBSSID[BSSID_LEN];
u8 abySSID[SSID_MAXLEN + 1];
bool bWEPOn;
u32 uRSSI;
-
} SBSSIDItem;
-
typedef struct tagSBSSIDList {
-
u32 uItem;
SBSSIDItem sBSSIDList[0];
} SBSSIDList, *PSBSSIDList;
-
typedef struct tagSCmdLinkStatus {
-
bool bLink;
u16 wBSSType;
u8 byState;
u8 abySSID[SSID_MAXLEN + 2];
u32 uChannel;
u32 uLinkRate;
-
} SCmdLinkStatus, *PSCmdLinkStatus;
//
u32 FCSErrorCount;
} SDot11MIBCount, *PSDot11MIBCount;
-
-
//
// statistic counter
//
u32 ullTxDirectedBytes[2];
} SStatMIBCount, *PSStatMIBCount;
-
typedef struct tagSNodeItem {
// STA info
u16 wAID;
u32 uTxFailures;
u32 uTxAttempts;
u16 wFailureRatio;
-
} SNodeItem;
-
typedef struct tagSNodeList {
-
u32 uItem;
SNodeItem sNodeList[0];
-
} SNodeList, *PSNodeList;
-
-
typedef struct tagSCmdValue {
-
u32 dwValue;
-
} SCmdValue, *PSCmdValue;
-
//
// hostapd & viawget ioctl related
//
-
// VIAGWET_IOCTL_HOSTAPD ioctl() cmd:
enum {
VIAWGET_HOSTAPD_FLUSH = 1,
VIAWGET_HOSTAPD_STA_CLEAR_STATS = 12,
};
-
#define VIAWGET_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \
((int)(&((struct viawget_hostapd_param *)0)->u.generic_elem.data))
// Maximum length for algorithm names (-1 for nul termination) used in ioctl()
-
-
struct viawget_hostapd_param {
u32 cmd;
u8 sta_addr[6];
/*--------------------- Export Variables --------------------------*/
-
/*--------------------- Export Types ------------------------------*/
-
/*--------------------- Export Functions --------------------------*/
-
-
#endif //__IOCMD_H__
/*--------------------- Export Definitions -------------------------*/
-
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
*/
#endif // __IOCTL_H__
-
-
-
/*--------------------- Export Definitions -------------------------*/
-
#define WPA_IE_LEN 64
-
//WPA related
/*
typedef enum { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP } wpa_alg;
VIAWGET_SET_DISASSOCIATE = 10
};
-
enum {
VIAWGET_ASSOC_MSG = 1,
VIAWGET_DISASSOC_MSG = 2,
VIAWGET_DEVICECLOSE_MSG = 6
};
-
-
#pragma pack(1)
typedef struct viawget_wpa_header {
u8 type;
u16 resp_ie_len;
} viawget_wpa_header;
-
-
struct viawget_wpa_param {
u32 cmd;
u8 addr[6];
} scan_results;
} u;
-
};
#pragma pack(1)
/*--------------------- Export Variables --------------------------*/
-
/*--------------------- Export Types ------------------------------*/
-
/*--------------------- Export Functions --------------------------*/
-
-
#endif //__IOWPA_H__
5700, 5745, 5765, 5785, 5805, 5825
};
-
/*--------------------- Static Classes ----------------------------*/
-
//static int msglevel =MSG_LEVEL_DEBUG;
static int msglevel = MSG_LEVEL_INFO;
-
/*--------------------- Static Variables --------------------------*/
/*--------------------- Static Functions --------------------------*/
return &pDevice->wstats;
}
-
-
/*------------------------------------------------------------------*/
-
static int iwctl_commit(struct net_device *dev,
struct iw_request_info *info,
void *wrq,
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWCOMMIT \n");
return 0;
-
}
/*
* Wireless Handler : get protocol name
PWLAN_IE_SSID pItemSSID = NULL;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSCAN \n");
-
if (pDevice->byReAssocCount > 0) { //reject scan when re-associating!
//send scan event to wpa_Supplicant
union iwreq_data wrqu;
return 0;
}
-
/*
* Wireless Handler : get scan results
*/
long ldBm;
char buf[MAX_WPA_IE_LEN * 2 + 30];
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSCAN \n");
if (pMgmt->eScanState == WMAC_IS_SCANNING) {
wrq->length = current_ev - extra;
return 0;
-
}
-
/*
* Wireless Handler : set frequency or channel
*/
}
switch (*wmode) {
-
case IW_MODE_ADHOC:
if (pMgmt->eConfigMode != WMAC_CONFIG_IBSS_STA) {
pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA;
PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWMODE \n");
// If not managed, assume it's ad-hoc
switch (pMgmt->eConfigMode) {
return 0;
}
-
/*
* Wireless Handler : get capability range
*/
int i, k;
unsigned char abySupportedRates[13] = {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRANGE \n");
if (wrq->pointer) {
wrq->length = sizeof(struct iw_range);
range->min_frag = 256;
range->max_frag = 2312;
-
// the encoding capabilities
range->num_encoding_sizes = 3;
// 64(40) bits WEP
range->avg_qual.noise = 0;
}
-
return 0;
}
-
/*
* Wireless Handler : set ap mac address
*/
PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP \n");
memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6);
wrq->sa_family = ARPHRD_ETHER;
return 0;
-
}
-
/*
* Wireless Handler : get ap list
*/
PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAPLIST \n");
// Only super-user can see AP list
}
if (wrq->pointer) {
-
PKnownBSS pBSS = &(pMgmt->sBSSList[0]);
for (ii = 0, jj = 0; ii < MAX_BSS_NUM; ii++) {
return rc;
}
-
/*
* Wireless Handler : set essid
*/
//2008-0409-05, <Add> by Einsn Liu
unsigned char len;
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWESSID \n");
pDevice->fWPA_Authened = false;
if (pMgmt->eScanState == WMAC_IS_SCANNING) {
pDevice->bCommit = true;
}
-
return 0;
}
-
/*
* Wireless Handler : get essid
*/
struct iw_point *wrq,
char *extra)
{
-
PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
PWLAN_IE_SSID pItemSSID;
wrq->length = pItemSSID->len;
wrq->flags = 1; // active
-
return 0;
}
int i;
unsigned char abySupportedRates[13] = {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRATE \n");
if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) {
rc = -EINVAL;
brate = 0x6C;
}
} else {
-
brate = abySupportedRates[TxRate_iwconfig];
}
} else brate = 0;
wrq->fixed = true;
}
-
return 0;
}
-
-
/*
* Wireless Handler : set rts threshold
*/
int rc = 0;
int fthr = wrq->value;
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFRAG \n");
-
if (wrq->disabled)
fthr = 2312;
if ((fthr < 256) || (fthr > 2312)) {
return 0;
}
-
-
/*
* Wireless Handler : set retry threshold
*/
PSDevice pDevice = (PSDevice)netdev_priv(dev);
int rc = 0;
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRETRY \n");
if (wrq->disabled) {
pDevice->wMaxTransmitMSDULifetime = wrq->value;
}
-
return rc;
}
wrq->flags |= IW_RETRY_MIN;
}
-
return 0;
}
-
/*
* Wireless Handler : set encode mode
*/
} else dwKeyIndex = 0;
} else dwKeyIndex--;
-
// Check the size of the key
if (wrq->length > WLAN_WEP232_KEYLEN) {
rc = -EINVAL;
// Send the key to the card
if (wrq->length > 0) {
-
if (wrq->length == WLAN_WEP232_KEYLEN) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n");
} else if (wrq->length == WLAN_WEP104_KEYLEN) {
}
// Read the flags
if (wrq->flags & IW_ENCODE_DISABLED) {
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n");
pMgmt->bShareKeyAlgorithm = false;
pDevice->bEncryptionEnable = false;
// return rc;
// }
-
//End Modify,Einsn
return 0;
return 0;
}
-
/*
* Wireless Handler : set power mode
*/
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int mode = pDevice->ePSMode;
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPOWER \n");
-
wrq->disabled = (mode == WMAC_POWER_CAM);
if (wrq->disabled)
return 0;
return 0;
}
-
/*
* Wireless Handler : get Sensitivity
*/
wrq->disabled = (wrq->value == 0);
wrq->fixed = 1;
-
return 0;
}
return ret;
}
-
int iwctl_giwauth(struct net_device *dev,
struct iw_request_info *info,
struct iw_param *wrq,
return -EOPNOTSUPP;
}
-
-
int iwctl_siwgenie(struct net_device *dev,
struct iw_request_info *info,
struct iw_point *wrq,
return ret;
}
-
int iwctl_siwencodeext(struct net_device *dev,
struct iw_request_info *info,
struct iw_point *wrq,
return ret;
}
-
-
int iwctl_giwencodeext(struct net_device *dev,
struct iw_request_info *info,
struct iw_point *wrq,
}
return ret;
-
}
#endif
-
/*------------------------------------------------------------------*/
/*
* Structures to export the Wireless Handlers
*/
-
/*
static const iw_handler iwctl_handler[] =
{
(iw_handler) NULL, // -- hole --
};
-
static const iw_handler iwctl_private_handler[] =
{
NULL, // SIOCIWFIRSTPRIV
};
-
struct iw_priv_args iwctl_private_args[] = {
{ IOCTL_CMD_SET,
IW_PRIV_TYPE_CHAR | 1024, 0,
"set"},
};
-
-
const struct iw_handler_def iwctl_handler_def =
{
.get_wireless_stats = &iwctl_get_wireless_stats,
/*--------------------- Export Definitions -------------------------*/
-
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev);
-
int iwctl_siwap(struct net_device *dev,
struct iw_request_info *info,
struct sockaddr *wrq,
struct iw_point *wrq,
char *extra);
-
int iwctl_giwmode(struct net_device *dev,
struct iw_request_info *info,
__u32 *wmode,
struct iw_param *wrq,
char *extra);
-
int iwctl_giwrts(struct net_device *dev,
struct iw_request_info *info,
struct iw_param *wrq,
#endif // #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
//End Add -- //2008-0409-07, <Add> by Einsn Liu
-
extern const struct iw_handler_def iwctl_handler_def;
extern const struct iw_priv_args iwctl_private_args;
#endif // __IWCTL_H__
-
-
-
(pTable->KeyTable[i].GroupKey[2].bKeyValid == false) &&
(pTable->KeyTable[i].GroupKey[3].bKeyValid == false)
) {
-
pTable->KeyTable[i].bInUse = false;
pTable->KeyTable[i].wKeyCtl = 0;
pTable->KeyTable[i].bSoftWEP = false;
}
}
-
/*--------------------- Export Functions --------------------------*/
-
/*
* Description: Init Key management table
*
}
}
-
/*
* Description: Get Key from table
*
return false;
}
-
/*
* Description: Set Key to table
*
return false;
}
-
/*
* Description: Remove Key from table
*
return false;
}
-
/*
* Description: Remove Key from table
*
unsigned long dwIoBase
)
{
-
if ((dwKeyIndex & 0x000000FF) < MAX_GROUP_KEY) {
if (pTable->KeyTable[MAX_KEY_TABLE-1].bInUse == true) {
if (pTable->KeyTable[MAX_KEY_TABLE-1].GroupKey[dwKeyIndex & 0x000000FF].byCipherSuite == KEY_CTL_WEP) {
for (i = 0; i < MAX_KEY_TABLE; i++) {
if ((pTable->KeyTable[i].bInUse == true) &&
!compare_ether_addr(pTable->KeyTable[i].abyBSSID, pbyBSSID)) {
-
if (dwKeyType == PAIRWISE_KEY) {
-
if (pTable->KeyTable[i].PairwiseKey.bKeyValid == true) {
*pKey = &(pTable->KeyTable[i].PairwiseKey);
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\n");
-
return true;
} else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PairwiseKey.bKeyValid == false\n");
return false;
}
-
/*
* Description: Check Pairewise Key
*
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enter KeybSetDefaultKey: %1x, %d \n", (int)dwKeyIndex, (int)uKeyLength);
-
if ((dwKeyIndex & PAIRWISE_KEY) != 0) { // Pairwise key
return false;
} else if ((dwKeyIndex & 0x000000FF) >= MAX_GROUP_KEY) {
pKey->dwTSC47_16 = 0;
pKey->wTSC15_0 = 0;
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybSetKey(R): \n");
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->bKeyValid: %d\n", pKey->bKeyValid);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->uKeyLength: %d\n", (int)pKey->uKeyLength);
return true;
}
-
/*
* Description: Set Key to table
*
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enter KeybSetAllGroupKey: %lX\n", dwKeyIndex);
-
if ((dwKeyIndex & PAIRWISE_KEY) != 0) { // Pairwise key
return false;
} else if ((dwKeyIndex & 0x000000FF) >= MAX_GROUP_KEY) {
#define MAX_KEY_LEN 32
#define AES_KEY_LEN 16
-
#define AUTHENTICATOR_KEY 0x10000000
#define USE_KEYRSC 0x20000000
#define PAIRWISE_KEY 0x40000000
#define KEY_CTL_CCMP 0x03
#define KEY_CTL_INVALID 0xFF
-
typedef struct tagSKeyItem
{
bool bKeyValid;
);
#endif // __KEY_H__
-
/*--------------------- Export Functions --------------------------*/
-
-
-
-
/*
* Description:
* Read All MAC Registers to buffer
}
MACvSelectPage0(dwIoBase);
-
}
/*
}
if (wFilterType & PKT_TYPE_PROMISCUOUS) {
-
byNewRCR |= (RCR_RXALLTYPE | RCR_UNICAST | RCR_MULTICAST | RCR_BROADCAST);
byNewRCR &= ~RCR_BSSID;
VNSvOutPortD(dwIoBase + MAC_REG_AC0DMAPTR, *(unsigned long *)(pbyCxtBuf + MAC_REG_AC0DMAPTR));
VNSvOutPortD(dwIoBase + MAC_REG_BCNDMAPTR, *(unsigned long *)(pbyCxtBuf + MAC_REG_BCNDMAPTR));
-
VNSvOutPortD(dwIoBase + MAC_REG_RXDMAPTR0, *(unsigned long *)(pbyCxtBuf + MAC_REG_RXDMAPTR0));
VNSvOutPortD(dwIoBase + MAC_REG_RXDMAPTR1, *(unsigned long *)(pbyCxtBuf + MAC_REG_RXDMAPTR1));
-
}
/*
return false;
}
-
return true;
}
if (ww == W_MAX_TIMEOUT)
return false;
return true;
-
}
/*
//AC0
VNSvOutPortD(dwIoBase + MAC_REG_AC0DMACTL, DMACTL_CLRRUN);
-
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
VNSvInPortD(dwIoBase + MAC_REG_TXDMACTL0, &dwData);
if (!(dwData & DMACTL_RUN))
// enable TSF counter
VNSvOutPortB(dwIoBase + MAC_REG_TFTCTL, TFTCTL_TSFCNTREN);
-
// set packet filter
// receive directed and broadcast address
MACvSetPacketFilter(dwIoBase, PKT_TYPE_DIRECTED | PKT_TYPE_BROADCAST);
-
}
/*
}
}
-
-
void MACvSetCurrTXDescAddr(int iTxType, unsigned long dwIoBase, unsigned long dwCurrDescAddr)
{
if (iTxType == TYPE_AC0DMA) {
}
}
VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, 0);
-
}
/*
VNSvOutPortB(dwIoBase + MAC_REG_TMCTL1, (TMCTL_TMD | TMCTL_TE));
}
-
void MACvSetMISCFifo(unsigned long dwIoBase, unsigned short wOffset, unsigned long dwData)
{
if (wOffset > 273)
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
}
-
bool MACbTxDMAOff(unsigned long dwIoBase, unsigned int idx)
{
unsigned char byData;
if (byLocalID <= 1)
return;
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvSetKeyEntry\n");
wOffset = MISCFIFO_KEYETRY0;
wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE);
}
}
-
-
/*
* Description:
* Disable the Key Entry by MISCFIFO
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
}
-
/*
* Description:
* Set the default Key (KeyEntry[10]) by MISCFIFO
VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "End. wOffset: %d, Data: %lX\n", wOffset+3, dwData);
-
}
-
/*
* Description:
* Enable default Key (KeyEntry[10]) by MISCFIFO
unsigned short wOffset;
unsigned long dwData;
-
if (byLocalID <= 1)
return;
unsigned short wOffset;
unsigned long dwData;
-
wOffset = MISCFIFO_KEYETRY0;
wOffset += (10 * MISCFIFO_KEYENTRYSIZE);
if (byLocalID <= 1)
return;
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvSetDefaultTKIPKeyEntry\n");
wOffset = MISCFIFO_KEYETRY0;
// Kyle test : change offset from 10 -> 0
VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, *pdwKey++);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
}
-
}
-
-
/*
* Description:
* Set the Key Control by MISCFIFO
if (byLocalID <= 1)
return;
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvSetKeyEntry\n");
wOffset = MISCFIFO_KEYETRY0;
wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
-
}
-
#define MAC_REG_PWRCCK 0x73
#define MAC_REG_PWROFDM 0x7C
-
//
// Bits in the BCFG0 register
//
#define IMR_AC0DMA 0x00000002 //
#define IMR_TXDMA0 0x00000001 //
-
//
// Bits in the ISR register
//
#define ISR_AC0DMA 0x00000002 //
#define ISR_TXDMA0 0x00000001 //
-
//
// Bits in the PSCFG register
//
//
#define MISCFFCTL_WRITE 0x0001 //
-
//
// Bits in WAKEUPEN0
//
#define GPIO1_MD 0x10 //
#define GPIO1_DATA 0x20 //
-
//
// Bits in the MSRCTL register
//
#define MSRCTL1_CSAPAREN 0x04
#define MSRCTL1_TXPAUSE 0x01
-
// Loopback mode
#define MAC_LB_EXT 0x02 //
#define MAC_LB_INTERNAL 0x01 //
#define Default_BI 0x200
-
// MiscFIFO Offset
#define MISCFIFO_KEYETRY0 32
#define MISCFIFO_KEYENTRYSIZE 22
void MACvSetDefaultKeyCtl(unsigned long dwIoBase, unsigned short wKeyCtl, unsigned int uEntryIdx, unsigned char byLocalID);
#endif // __MAC_H__
-
/*--------------------- Export Functions --------------------------*/
-
-
/*
* Description: Clear All Statistic Counter
*
memset(pStatistic, 0, sizeof(SStatCounter));
}
-
/*
* Description: Update Isr Statistic Counter
*
if (dwIsr & ISR_SOFTTIMER1) // ISR, bit21
pStatistic->ISRStat.dwIsrSTIMER1Int++;
-
}
-
/*
* Description: Update Rx Statistic Counter
*
pStatistic->dwRsrRxPacket++;
pStatistic->dwRsrRxOctet += cbFrameLength;
-
if (IS_TYPE_DATA(pbyBuffer)) {
pStatistic->dwRsrRxData++;
} else if (IS_TYPE_MGMT(pbyBuffer)) {
} else if (cbFrameLength > ETH_FRAME_LEN + 4) {
pStatistic->dwRsrLong++;
}
-
}
-
-
/*
* Description: Update Rx Statistic Counter and copy Rx buffer
*
memcpy(pStatistic->abyCntRxPattern, (unsigned char *)pbyBuffer, 10);
}
-
/*
* Description: Update Tx Statistic Counter
*
unsigned char *pbyDestAddr;
unsigned char byTSR0_NCR = byTSR0 & TSR0_NCR;
-
-
pHeader = (PWLAN_80211HDR_A4) pbyBuffer;
if (WLAN_GET_FC_TODS(pHeader->wFrameCtl) == 0) {
pbyDestAddr = &(pHeader->abyAddr1[0]);
pStatistic->dwTsrMulticast[uIdx]++;
else
pStatistic->dwTsrDirected[uIdx]++;
-
}
-
/*
* Description: Update Tx Statistic Counter and copy Tx buffer
*
memcpy(pStatistic->abyCntTxPattern, pbyBuffer, 16);
}
-
/*
* Description: Update 802.11 mib counter
*
// unsigned long long DecryptFailureCount;
} SDot11Counters, *PSDot11Counters;
-
//
// MIB2 counter
//
#define DOWN 2 //
#define TESTING 3 //
-
//
// RMON counter
//
unsigned long long ullRsr12MCRCOk;
unsigned long long ullRsr9MCRCOk;
unsigned long long ullRsr6MCRCOk;
-
} SCustomCounters, *PSCustomCounters;
-
//
// Custom counter
//
/////////////////////////////////////
} SISRCounters, *PSISRCounters;
-
// Value in the etherStatsStatus entry
#define VALID 1 //
#define CREATE_REQUEST 2 //
// ISR status count
//
-
// RSR status count
//
unsigned long dwRsrFrmAlgnErr;
unsigned char abyCntRxPattern[16];
unsigned char abyCntTxPattern[16];
-
-
// Software check....
unsigned long dwCntRxDataErr; // rx buffer data software compare CRC err count
unsigned long dwCntDecryptErr; // rx buffer data software compare CRC err count
void STAvClear802_11Counter(PSDot11Counters p802_11Counter);
#endif // __MIB_H__
-
-
-
s_vSetKey(dwK0, dwK1);
}
-
void MIC_vUnInit(void)
{
// Wipe the key material
// Reset to the empty message.
s_vClear();
}
-
#define ROR32(A, n) ROL32((A), 32-(n))
#endif //__MICHAEL_H__
-
-
/*--------------------- Static Definitions -------------------------*/
-
-
-
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
static int msglevel = MSG_LEVEL_INFO;
/*--------------------- Static Functions --------------------------*/
-
/*--------------------- Export Variables --------------------------*/
-
/*--------------------- Export Functions --------------------------*/
/*+
*
-*/
-
void
PSvEnablePowerSaving(
void *hDeviceContext,
return;
}
-
-
-
-
-
/*+
*
* Routine Description:
return;
}
-
/*+
*
* Routine Description:
* false, if fail
-*/
-
bool
PSbConsiderPowerDown(
void *hDeviceContext,
return true;
}
-
-
/*+
*
* Routine Description:
*
-*/
-
-
void
PSvSendPSPOLL(
void *hDeviceContext
PSMgmtObject pMgmt = pDevice->pMgmt;
PSTxMgmtPacket pTxPacket = NULL;
-
memset(pMgmt->pbyPSPacketPool, 0, sizeof(STxMgmtPacket) + WLAN_HDR_ADDR2_LEN);
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyPSPacketPool;
pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
return;
}
-
-
/*+
*
* Routine Description:
PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned int uIdx;
-
if (pDevice->bLinkPass == false) {
return false;
}
pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
if (pDevice->bEnablePSMode) {
-
pTxPacket->p80211Header->sA3.wFrameCtl = cpu_to_le16(
(
WLAN_SET_FC_FTYPE(WLAN_TYPE_DATA) |
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send Null Packet failed !\n");
return false;
} else {
-
// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send Null Packet success....\n");
}
-
return true;
}
void *hDeviceContext
)
{
-
PSDevice pDevice = (PSDevice)hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
bool bWakeUp = false;
return bWakeUp;
}
-
#ifndef __POWER_H__
#define __POWER_H__
-
/*--------------------- Export Definitions -------------------------*/
#define C_PWBT 1000 // micro sec. power up before TBTT
#define PS_FAST_INTERVAL 1 // Fast power saving listen interval
/*--------------------- Export Variables --------------------------*/
-
/*--------------------- Export Types ------------------------------*/
-
/*--------------------- Export Functions --------------------------*/
// PSDevice pDevice
#define SWITCH_CHANNEL_DELAY_AL2230 200 //us
#define AL2230_PWR_IDX_LEN 64
-
#define BY_AL7230_REG_LEN 23 //24bit
#define CB_AL7230_INIT_SEQ 16
#define SWITCH_CHANNEL_DELAY_AL7230 200 //us
/*--------------------- Static Variables --------------------------*/
-
-
const unsigned long dwAL2230InitTable[CB_AL2230_INIT_SEQ] = {
0x03F79000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
0x12BACF00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW // Need modify for 11b/g
};
-
const unsigned long dwAL7230ChannelTable0[CB_MAX_CHANNEL] = {
0x00379000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz
0x00379000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 2, Tf = 2417MHz
};
//}} RobertYu
-
-
-
/*--------------------- Static Functions --------------------------*/
-
-
-
/*
* Description: AIROHA IFRF chip init function
*
*
*/
-
//{{ RobertYu: 20041210
/*
* Description: UW2452 IFRF chip init function
*
*/
-
-
//}} RobertYu
////////////////////////////////////////////////////////////////////////////////
*
*/
-
-
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Functions --------------------------*/
return true;
}
-
-
/*
* Description: RFMD RF2959 IFRF chip init function
*
MACvWordRegBitsOff(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);
-
-
//patch abnormal AL2230 frequency output
//2008-8-21 chester <add>
IFRFbWriteEmbedded(dwIoBase, (0x07168700+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW));
-
for (ii = 0; ii < CB_AL2230_INIT_SEQ; ii++)
bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL2230InitTable[ii]);
//2008-8-21 chester <add>
*
*/
-
/*
* Description: Select channel with UW2451 chip
*
{
bool bResult = true;
switch (byRFType) {
-
case RF_AIROHA:
case RF_AL2230S:
bResult = RFbAL2230SelectChannel(dwIoBase, byChannel);
return false;
}
switch (pDevice->byRFType) {
-
case RF_AIROHA:
bResult &= IFRFbWriteEmbedded(pDevice->PortOffset, dwAL2230PowerTable[byPwr]);
if (uRATE <= RATE_11M) {
}
break;
-
case RF_AL2230S:
bResult &= IFRFbWriteEmbedded(pDevice->PortOffset, dwAL2230PowerTable[byPwr]);
if (uRATE <= RATE_11M) {
bResult &= IFRFbWriteEmbedded(pDevice->PortOffset, dwMax7230Pwr);
break;
-
default:
break;
}
////////////////////////////////////////////////////////////////////////////////
//{{ RobertYu: 20050104
-
// Post processing for the 11b/g and 11a.
// for save time on changing Reg2,3,5,7,10,12,15
bool RFbAL7230SelectChannelPostProcess(unsigned long dwIoBase, unsigned char byOldChannel, unsigned char byNewChannel)
return bResult;
}
-
//}} RobertYu
////////////////////////////////////////////////////////////////////////////////
-
#define CB_MAXIM2829_CHANNEL_5G_HIGH 41 //Index41: channel = 100, Tf = 5500MHz, set the (A3:A0=0101) D6=1
#define CB_UW2452_CHANNEL_5G_HIGH 41 //[20041210] Index41: channel = 100, Tf = 5500MHz, change VCO2->VCO3
-
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
//}} RobertYu
#endif // __RF_H__
-
-
-
#define PLICE_DEBUG
-
/*--------------------- Static Functions --------------------------*/
/*--------------------- Static Definitions -------------------------*/
{RATE_6M , RATE_6M, RATE_12M, RATE_12M, RATE_18M}, // fallback_rate1
};
-
#define RTSDUR_BB 0
#define RTSDUR_BA 1
#define RTSDUR_AA 2
/*--------------------- Static Functions --------------------------*/
-
-
static
void
s_vFillTxKey(
unsigned char *pMICHDR
);
-
-
static
void
s_vFillRTSHead(
unsigned short wCurrentRate
);
-
-
static void s_vFillFragParameter(
PSDevice pDevice,
unsigned char *pbyBuffer,
unsigned int cbReqCount
);
-
static unsigned int
s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyTxBufferAddr,
unsigned int cbFrameBodySize, unsigned int uDMAIdx, PSTxDesc pHeadTD,
PSEthernetHeader psEthHeader, unsigned char *pPacket, bool bNeedEncrypt,
PSKeyItem pTransmitKey, unsigned int uNodeIndex, unsigned int *puMACfragNum);
-
static
unsigned int
s_uFillDataHead(
unsigned short wCurrentRate
);
-
/*--------------------- Export Variables --------------------------*/
-
-
static
void
s_vFillTxKey(
unsigned long dwRevIVCounter;
unsigned char byKeyIndex = 0;
-
-
//Fill TXKEY
if (pTransmitKey == NULL)
return;
}
}
-
static
void
s_vSWencryption(
}
}
-
-
-
/*byPktType : PK_TYPE_11A 0
PK_TYPE_11B 1
PK_TYPE_11GB 2
uRrvTime = uRTSTime = uCTSTime = uAckTime = uDataTime = 0;
-
uDataTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, cbFrameLength, wCurrentRate);
if (byRTSRsvType == 0) { //RTSTxRrvTime_bb
uRTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 20, pDevice->byTopCCKBasicRate);
bool bLastFrag = 0;
unsigned int uAckTime = 0, uNextPktTime = 0;
-
-
if (uFragIdx == (uMACfragNum-1)) {
bLastFrag = 1;
}
-
switch (byDurType) {
-
case DATADUR_B: //DATADUR_B
if (((uMACfragNum == 1)) || (bLastFrag == 1)) {//Non Frag or Last Frag
if (bNeedAck) {
return 0;
}
-
//byFreqType: 0=>5GHZ 1=>2.4GHZ
static
unsigned int
{
unsigned int uCTSTime = 0, uDurTime = 0;
-
switch (byDurType) {
-
case RTSDUR_BB: //RTSDuration_bb
uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
}
return uDurTime;
-
}
-
-
static
unsigned int
s_uFillDataHead(
return 0;
}
-
static
void
s_vFillRTSHead(
//Get RTS Frame body
pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4
-
if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
(pDevice->eOPMode == OP_MODE_AP)) {
memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
(unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_b), (unsigned char *)&(pBuf->bySignalField_b)
);
-
pBuf->wTransmitLength_b = cpu_to_le16(wLen);
pBuf->wDuration_ba = (unsigned short)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //3:CTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data
}
}
-
-
-
-
-
/*+
*
* Description:
cbMACHdLen = WLAN_HDR_ADDR3_LEN + 6;
if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
-
if (pvRTS != NULL) { //RTS_need
//Fill RsvTime
if (pvRrvTime) {
pBuf->wCTSTxRrvTime_ba = cpu_to_le16((unsigned short)s_uGetRTSCTSRsvTime(pDevice, 3, byPktType, cbFrameSize, wCurrentRate));//3:CTSTxRrvTime_Ba, 1:2.4GHz
}
-
//Fill CTS
s_vFillCTSHead(pDevice, uDMAIdx, byPktType, pvCTS, cbFrameSize, bNeedACK, bDisCRC, wCurrentRate, byFBOption);
}
} else if (byPktType == PK_TYPE_11A) {
-
if (pvRTS != NULL) {//RTS_need, non PCF mode
//Fill RsvTime
if (pvRrvTime) {
}
}
} else if (byPktType == PK_TYPE_11B) {
-
if ((pvRTS != NULL)) {//RTS_need, non PCF mode
//Fill RsvTime
if (pvRrvTime) {
bool bIsWEP256 = false;
PSMgmtObject pMgmt = pDevice->pMgmt;
-
pvRrvTime = pMICHDR = pvRTS = pvCTS = pvTxDataHd = NULL;
//DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "s_cbFillTxBufHead...\n");
if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
(pDevice->eOPMode == OP_MODE_AP)) {
-
if (is_multicast_ether_addr(&(psEthHeader->abyDstAddr[0])))
bNeedACK = false;
else
else
cbMACHdLen = WLAN_HDR_ADDR3_LEN;
-
if ((bNeedEncrypt == true) && (pTransmitKey != NULL)) {
if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) {
cbIVlen = 4;
}
}
-
cbFrameSize = cbMACHdLen + cbIVlen + (cbFrameBodySize + cbMIClen) + cbICVlen + cbFCSlen;
if ((bNeedACK == false) ||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Start Fragmentation...\n");
wFragType = FRAGCTL_STAFRAG;
-
//Fill FIFO,RrvTime,RTS,and CTS
s_vGenerateTxParameter(pDevice, byPktType, (void *)psTxBufHd, pvRrvTime, pvRTS, pvCTS,
cbFragmentSize, bNeedACK, uDMAIdx, psEthHeader, pDevice->wCurrentRate);
}
}
-
// 802.1H
if (ntohs(psEthHeader->wType) > ETH_DATA_LEN) {
if ((psEthHeader->wType == TYPE_PKT_IPX) ||
// Copy the Packet into a tx Buffer
memcpy((pbyBuffer + uLength), (pPacket + 14), (cbFragPayloadSize - cb802_1_H_len));
-
uTotalCopyLength += cbFragPayloadSize - cb802_1_H_len;
if ((bNeedEncrypt == true) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) {
}
-
cbReqCount = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen + cbLastFragPayloadSize;
//---------------------------
// S/W or H/W Encryption
//---------------------------
-
-
pbyBuffer = (unsigned char *)pHeadTD->pTDInfo->buf;
//pbyBuffer = (unsigned char *)pDevice->aamTxBuf[uDMAIdx][tmpDescIdx].pbyVAddr;
// Copy the Packet into a tx Buffer
if (bMIC2Frag == false) {
-
memcpy((pbyBuffer + uLength),
(pPacket + 14 + uTotalCopyLength),
(cbLastFragPayloadSize - cbMIClen)
ASSERT(uTmpLen == (cbLastFragPayloadSize - cbMIClen));
}
-
//---------------------------
// S/W Encryption
//---------------------------
//5.Get S/W generate FCS
//--------------------
-
s_vFillFragParameter(pDevice, pbyBuffer, uDMAIdx, (void *)ptdCurr, wFragType, cbReqCount);
ptdCurr->pTDInfo->dwReqCount = cbReqCount - uPadding;
vGenerateMACHeader(pDevice, pbyMacHdr, (unsigned short)uDuration, psEthHeader, bNeedEncrypt,
wFragType, uDMAIdx, uFragIdx);
-
if (bNeedEncrypt == true) {
//Fill TXKEY
s_vFillTxKey(pDevice, (unsigned char *)(psTxBufHd->adwTxKey), pbyIVHead, pTransmitKey,
uTotalCopyLength += uTmpLen;
if ((bNeedEncrypt == true) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) {
-
MIC_vAppend((pbyBuffer + uLength), uTmpLen);
if (uTmpLen < cbFragPayloadSize) {
);
if ((bNeedEncrypt == true) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) {
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Length:%d, %d\n", cbFrameBodySize - cb802_1_H_len, uLength);
/*
for (ii = 0; ii < (cbFrameBodySize - cb802_1_H_len); ii++) {
MIC_vGetMIC(pdwMIC_L, pdwMIC_R);
MIC_vUnInit();
-
if (pDevice->bTxMICFail == true) {
*pdwMIC_L = 0;
*pdwMIC_R = 0;
}
-
if ((pDevice->byLocalID <= REV_ID_VT3253_A1)) {
if (bNeedEncrypt) {
s_vSWencryption(pDevice, pTransmitKey, (pbyBuffer + uLength - cb802_1_H_len),
}
}
-
ptdCurr = (PSTxDesc)pHeadTD;
ptdCurr->pTDInfo->dwReqCount = cbReqCount - uPadding;
pDevice->iTDUsed[uDMAIdx]++;
-
// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " ptdCurr->m_dwReserved0[%d] ptdCurr->m_dwReserved1[%d].\n", ptdCurr->pTDInfo->dwReqCount, ptdCurr->pTDInfo->dwHeaderLength);
// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " cbHeaderLength[%d]\n", cbHeaderLength);
return cbHeaderLength;
}
-
void
vGenerateFIFOHeader(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyTxBufferAddr,
bool bNeedEncrypt, unsigned int cbPayloadSize, unsigned int uDMAIdx,
bIsAdhoc = false;
}
-
pTxBufHead->wFIFOCtl |= FIFOCTL_TMOEN;
pTxBufHead->wTimeStamp = cpu_to_le16(DEFAULT_MSDU_LIFETIME_RES_64us);
pTxBufHead->wFIFOCtl |= FIFOCTL_GENINT;
-
//Set FIFOCTL_ISDMA0
if (TYPE_TXDMA0 == uDMAIdx) {
pTxBufHead->wFIFOCtl |= FIFOCTL_ISDMA0;
#endif
pTxBufHead->byTxPower = pDevice->byCurPwr;
-
-
-
/*
if (pDevice->bEnableHostWEP)
pTxBufHead->wFragCtl &= ~(FRAGCTL_TKIP | FRAGCTL_LEGACY |FRAGCTL_AES);
return;
}
-
-
-
/*+
*
* Description:
}
}
-
-
-
-
-
CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) {
-
PSTxDesc pFrstTD;
unsigned char byPktType;
unsigned char *pbyTxBufferAddr;
PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned short wCurrentRate = RATE_1M;
-
if (AVAIL_TD(pDevice, TYPE_TXDMA0) <= 0) {
return CMD_STATUS_RESOURCES;
}
// And cmd timer will wait data pkt TX finish before scanning so it's OK
// to set power here.
if (pDevice->pMgmt->eScanState != WMAC_NO_SCANNING) {
-
RFbSetPower(pDevice, wCurrentRate, pDevice->byCurrentCh);
} else {
RFbSetPower(pDevice, wCurrentRate, pMgmt->uCurrChannel);
pTxBufHead->wFIFOCtl |= FIFOCTL_TMOEN;
pTxBufHead->wTimeStamp = cpu_to_le16(DEFAULT_MGN_LIFETIME_RES_64us);
-
if (is_multicast_ether_addr(&(pPacket->p80211Header->sA3.abyAddr1[0])))
bNeedACK = false;
else {
if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) ||
(pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)) {
-
pTxBufHead->wFIFOCtl |= FIFOCTL_LRETRY;
}
//=========================
pTxBufHead->wFragCtl |= (unsigned short)FRAGCTL_NONFRAG;
-
//Fill FIFO,RrvTime,RTS,and CTS
s_vGenerateTxParameter(pDevice, byPktType, pbyTxBufferAddr, pvRrvTime, pvRTS, pCTS,
cbFrameSize, bNeedACK, TYPE_TXDMA0, &sEthHeader, wCurrentRate);
}
}
-
// first TD is the only TD
//Set TSR1 & ReqCount in TxDescHead
pFrstTD->m_td1TD1.byTCR = (TCR_STP | TCR_EDP | EDMSDU);
MACvTransmit0(pDevice->PortOffset);
return CMD_STATUS_PENDING;
-
}
-
CMD_STATUS csBeacon_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) {
-
unsigned char byPktType;
unsigned char *pbyBuffer = (unsigned char *)pDevice->tx_beacon_bufs;
unsigned int cbFrameSize = pPacket->cbMPDULen + WLAN_FCS_LEN;
unsigned short wCurrentRate;
unsigned short wLen = 0x0000;
-
memset(pTxBufHead, 0, wTxBufSize);
if (pDevice->eCurrentPHYType == PHY_TYPE_11A) {
pTxBufHead->wFIFOCtl |= FIFOCTL_GENINT;
-
//Set packet type & Get Duration
if (byPktType == PK_TYPE_11A) {//0000 0000 0000 0000
pTxDataHead->wDuration = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameSize, byPktType,
return CMD_STATUS_PENDING;
}
-
-
unsigned int
cbGetFragCount(
PSDevice pDevice,
unsigned int uMACfragNum = 1;
bool bNeedACK;
-
-
if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
(pDevice->eOPMode == OP_MODE_AP)) {
if (is_multicast_ether_addr(&(psEthHeader->abyDstAddr[0])))
else
cbMACHdLen = WLAN_HDR_ADDR3_LEN;
-
if (pDevice->bEncryptionEnable == true) {
-
if (pTransmitKey == NULL) {
if ((pDevice->eEncryptionStatus == Ndis802_11Encryption1Enabled) ||
(pDevice->pMgmt->eAuthenMode < WMAC_AUTH_WPA)) {
return uMACfragNum;
}
-
void
vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, unsigned int cbMPDULen) {
-
PSTxDesc pFrstTD;
unsigned char byPktType;
unsigned char *pbyTxBufferAddr;
unsigned int cbExtSuppRate = 0;
// PWLAN_IE pItem;
-
pvRrvTime = pMICHDR = pvRTS = pvCTS = pvTxDataHd = NULL;
if (cbMPDULen <= WLAN_HDR_ADDR3_LEN) {
}
p80211Header = (PUWLAN_80211HDR)pbMPDU;
-
pFrstTD = pDevice->apCurrTD[TYPE_TXDMA0];
pbyTxBufferAddr = (unsigned char *)pFrstTD->pTDInfo->buf;
pTxBufHead = (PSTxBufHead) pbyTxBufferAddr;
pTxBufHead->wFIFOCtl |= FIFOCTL_TMOEN;
pTxBufHead->wTimeStamp = cpu_to_le16(DEFAULT_MGN_LIFETIME_RES_64us);
-
if (is_multicast_ether_addr(&(p80211Header->sA3.abyAddr1[0]))) {
bNeedACK = false;
if (pDevice->bEnableHostWEP) {
if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) ||
(pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)) {
-
pTxBufHead->wFIFOCtl |= FIFOCTL_LRETRY;
}
// hostapd deamon ext support rate patch
if (WLAN_GET_FC_FSTYPE(p80211Header->sA4.wFrameCtl) == WLAN_FSTYPE_ASSOCRESP) {
-
if (((PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates)->len != 0) {
cbExtSuppRate += ((PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates)->len + WLAN_IEHDR_LEN;
}
}
}
-
//Set FRAGCTL_MACHDCNT
pTxBufHead->wFragCtl |= cpu_to_le16((unsigned short)cbMacHdLen << 10);
// no one will send a MMPDU under fragmentation. With RTS may occur.
pDevice->bAES = false; //Set FRAGCTL_WEPTYP
-
if (WLAN_GET_FC_ISWEP(p80211Header->sA4.wFrameCtl) != 0) {
if (pDevice->eEncryptionStatus == Ndis802_11Encryption1Enabled) {
cbIVlen = 4;
}
//the rest of pTxBufHead->wFragCtl:FragTyp will be set later in s_vFillFragParameter()
-
if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet
pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
//=========================
pTxBufHead->wFragCtl |= (unsigned short)FRAGCTL_NONFRAG;
-
//Fill FIFO,RrvTime,RTS,and CTS
s_vGenerateTxParameter(pDevice, byPktType, pbyTxBufferAddr, pvRrvTime, pvRTS, pvCTS,
cbFrameSize, bNeedACK, TYPE_TXDMA0, &sEthHeader, wCurrentRate);
// Set wep
if (WLAN_GET_FC_ISWEP(p80211Header->sA4.wFrameCtl) != 0) {
-
if (pDevice->bEnableHostWEP) {
pTransmitKey = &STempKey;
pTransmitKey->byCipherSuite = pMgmt->sNodeDBTable[uNodeIndex].byCipherSuite;
}
if ((pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) {
-
dwMICKey0 = *(unsigned long *)(&pTransmitKey->abyKey[16]);
dwMICKey1 = *(unsigned long *)(&pTransmitKey->abyKey[20]);
}
-
s_vFillTxKey(pDevice, (unsigned char *)(pTxBufHead->adwTxKey), pbyIVHead, pTransmitKey,
pbyMacHdr, (unsigned short)cbFrameBodySize, (unsigned char *)pMICHDR);
if (pDevice->wSeqCounter > 0x0fff)
pDevice->wSeqCounter = 0;
-
if (bIsPSPOLL) {
// The MAC will automatically replace the Duration-field of MAC header by Duration-field
// of FIFO control header.
}
}
-
// first TD is the only TD
//Set TSR1 & ReqCount in TxDescHead
pFrstTD->pTDInfo->skb = skb;
return;
}
-
-
bool bIsWEP, unsigned int *pcbHeadSize);
*/
-
void
vGenerateMACHeader(
PSDevice pDevice,
unsigned int uFragIdx
);
-
unsigned int
cbGetFragCount(
PSDevice pDevice,
PSEthernetHeader psEthHeader
);
-
void
vGenerateFIFOHeader(PSDevice pDevice, unsigned char byPktTyp, unsigned char *pbyTxBufferAddr,
bool bNeedEncrypt, unsigned int cbPayloadSize, unsigned int uDMAIdx, PSTxDesc pHeadTD,
PSEthernetHeader psEthHeader, unsigned char *pPacket, PSKeyItem pTransmitKey,
unsigned int uNodeIndex, unsigned int *puMACfragNum, unsigned int *pcbHeaderSize);
-
void vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, unsigned int cbMPDULen);
CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket);
CMD_STATUS csBeacon_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket);
/*--------------------- Export Functions --------------------------*/
-
-
-
/*
* Description: Read a byte from EEPROM, by MAC I2C
*
return byData;
}
-
/*
* Description: Write a byte to EEPROM, by MAC I2C
*
return true;
}
-
/*
* Description: Turn bits on in eeprom
*
SROMbWriteEmbedded(dwIoBase, byContntOffset, (unsigned char)(byOrgData | byBits));
}
-
/*
* Description: Turn bits off in eeprom
*
SROMbWriteEmbedded(dwIoBase, byContntOffset, (unsigned char)(byOrgData & (~byBits)));
}
-
/*
* Description: Test if bits on in eeprom
*
return (byOrgData & byTestBits) == byTestBits;
}
-
/*
* Description: Test if bits off in eeprom
*
return !(byOrgData & byTestBits);
}
-
/*
* Description: Read all contents of eeprom to buffer
*
}
}
-
/*
* Description: Write all contents of buffer to eeprom
*
}
}
-
/*
* Description: Read Ethernet Address from eeprom to buffer
*
}
}
-
/*
* Description: Write Ethernet Address from buffer to eeprom
*
}
}
-
/*
* Description: Read Sub_VID and Sub_SysId from eeprom to buffer
*
return false;
return true;
}
-
-
//}}
#define EEP_OFS_OFDMA_PWR_dBm 0xD2
-
//----------need to remove --------------------
#define EEP_OFS_BBTAB_LEN 0x70 // BB Table Length
#define EEP_OFS_BBTAB_ADR 0x71 // BB Table Offset
#define EEP_I2C_DEV_ID 0x50 // EEPROM device address on the I2C bus
-
//
// Bits in EEP_OFS_ANTENNA
//
/*--------------------- Export Variables --------------------------*/
-
-
-
/*+
*
* Description:
return dwCrc;
}
-
/*+
*
* Description:
return ~CRCdwCrc32(pbyData, cbByte, 0xFFFFFFFFL);
}
-
/*+
*
* Description:
{
return CRCdwCrc32(pbyData, cbByte, dwPreCRC);
}
-
-
unsigned long CRCdwGetCrc32Ex(unsigned char *pbyData, unsigned int cbByte, unsigned long dwPreCRC);
#endif // __TCRC_H__
-
-
-
/*--------------------- Export Variables --------------------------*/
-
-
/*
* Description: Calculate multicast hash value by CRC32
*
return byHash >> 2;
}
-
/*
* Description: Check CRC value of the buffer if Ok or not
*
}
return true;
}
-
#define U_MULTI_ADDR_LEN 8 // multicast address length
-
#ifdef __BIG_ENDIAN
#define TYPE_PKT_IP 0x0800 //
#define TYPE_CTL_CTS 0xc400
#define TYPE_CTL_ACK 0xd400
-
#else //if LITTLE_ENDIAN
//
// wType field in the SEthernetHeader
#define TYPE_CTL_CTS 0x00c4
#define TYPE_CTL_ACK 0x00d4
-
-
#endif //#ifdef __BIG_ENDIAN
#define WEP_IV_MASK 0x00FFFFFF
} __attribute__ ((__packed__))
SEthernetHeader, *PSEthernetHeader;
-
//
// 802_3 packet
//
bool ETHbIsBufferCrc32Ok(unsigned char *pbyBuffer, unsigned int cbFrameLength);
#endif // __TETHER_H__
-
-
-
0x82, 0x29, 0x5A, 0x1E, 0x7B, 0xA8, 0x6D, 0x2C
};
-
//STKIPKeyManagement sTKIPKeyTable[MAX_TKIP_KEY];
/*--------------------- Static Functions --------------------------*/
return left ^ right;
};
-
unsigned int rotr1(unsigned int a)
{
unsigned int b;
return b;
}
-
/*
* Description: Calculate RC4Key fom TK, TA, and TSC
*
);
#endif // __TKIP_H__
-
-
-
#endif
#endif // __TMACRO_H__
-
-
*
*/
-
#ifndef __TTYPE_H__
#define __TTYPE_H__
-
/******* Common definitions and typedefs ***********************************/
#ifndef TxInSleep
/*--------------------- Export Definitions -------------------------*/
-
//
// For IO mapped
//
// For memory mapped IO
//
-
#define VNSvInPortB(dwIOAddress, pbyData) \
do { \
volatile unsigned char *pbyAddr = (unsigned char *)(dwIOAddress); \
*(pbyData) = readb(pbyAddr); \
} while (0)
-
#define VNSvInPortW(dwIOAddress, pwData) \
do { \
volatile unsigned short *pwAddr = (unsigned short *)(dwIOAddress); \
writeb((unsigned char)byData, pbyAddr); \
} while (0)
-
#define VNSvOutPortW(dwIOAddress, wData) \
do { \
volatile unsigned short *pwAddr = ((unsigned short *)(dwIOAddress)); \
#endif
-
//
// ALWAYS IO-Mapped IO when in 16-bit/32-bit environment
//
} \
} while (0)
-
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Functions --------------------------*/
-
-
-
#endif // __UPC_H__
-
pMgmt->eConfigMode = eOPMode;
}
-
/*+
*
* Description:
return pMgmt->wCurrAID;
}
-
-
/*+
*
* Description:
}
}
-
-
bool
VNTWIFIbConfigPhyMode(
void *pMgmtHandle,
return true;
}
-
void
VNTWIFIbGetConfigPhyMode(
void *pMgmtHandle,
*
-*/
-
/*+
*
* Description:
*puBSSCount = uCount;
}
-
-
-
void
VNTWIFIvGetNextBSS(
void *pMgmtHandle,
}
}
-
-
-
-
/*+
*
* Description:
return;
}
-
void
VNTWIFIvGetTxRate(
void *pMgmtHandle,
PWLAN_IE_SUPP_RATES pSupportRateIEs = NULL;
PWLAN_IE_SUPP_RATES pExtSupportRateIEs = NULL;
-
if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ||
(pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) {
// Adhoc Tx rate decided from node DB
pMgmt->sNodeDBTable[0].abyMACAddr, wTxDataRate);
#endif
-
pSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates;
pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates;
}
}
}
-
/*
bool
VNTWIFIbInit(
void *pAdapterHandler,
void **pMgmtHandler
) {
-
PSMgmtObject pMgmt = NULL;
unsigned int ii;
-
pMgmt = (PSMgmtObject)kmalloc(sizeof(SMgmtObject), (int)GFP_ATOMIC);
if (pMgmt == NULL) {
*pMgmtHandler = NULL;
}
*/
-
-
bool
VNTWIFIbSetPMKIDCache(
void *pMgmtObject,
return true;
}
-
-
unsigned short
VNTWIFIwGetMaxSupportRate(
void *pMgmtObject
}
}
-
void
VNTWIFIvSet11h(
void *pMgmtObject,
return true;
}
-
bool
VNTWIFIbChannelSwitch(
void *pMgmtObject,
return true;
}
*/
-
// Pre-configured Authenticaiton Mode (from XP)
typedef enum tagWMAC_AUTHENTICATION_MODE {
-
WMAC_AUTH_OPEN,
WMAC_AUTH_SHAREKEY,
WMAC_AUTH_AUTO,
WMAC_AUTH_WPA2,
WMAC_AUTH_WPA2PSK,
WMAC_AUTH_MAX // Not a real mode, defined as upper bound
-
} WMAC_AUTHENTICATION_MODE, *PWMAC_AUTHENTICATION_MODE;
typedef enum tagWMAC_ENCRYPTION_MODE {
-
WMAC_ENCRYPTION_WEPEnabled,
WMAC_ENCRYPTION_WEPDisabled,
WMAC_ENCRYPTION_WEPKeyAbsent,
WMAC_ENCRYPTION_TKIPKeyAbsent,
WMAC_ENCRYPTION_AESEnabled,
WMAC_ENCRYPTION_AESKeyAbsent
-
} WMAC_ENCRYPTION_MODE, *PWMAC_ENCRYPTION_MODE;
// Pre-configured Mode (from XP)
typedef enum tagWMAC_CONFIG_MODE {
-
WMAC_CONFIG_ESS_STA = 0,
WMAC_CONFIG_IBSS_STA,
WMAC_CONFIG_AUTO,
WMAC_CONFIG_AP
-
} WMAC_CONFIG_MODE, *PWMAC_CONFIG_MODE;
-
-
typedef enum tagWMAC_POWER_MODE {
-
WMAC_POWER_CAM,
WMAC_POWER_FAST,
WMAC_POWER_MAX
-
} WMAC_POWER_MODE, *PWMAC_POWER_MODE;
#define VNTWIFIbIsShortSlotTime(wCapInfo) \
#define VNTWIFIbIsESS(wCapInfo) \
WLAN_GET_CAP_INFO_ESS(wCapInfo) \
-
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
-
/*--------------------- Export Types ------------------------------*/
-
/*--------------------- Export Functions --------------------------*/
void
WMAC_ENCRYPTION_MODE eEncryptionMode
);
-
bool
VNTWIFIbConfigPhyMode(
void *pMgmtHandle,
void **pvNextBSS
);
-
-
void
VNTWIFIvUpdateNodeTxCounter(
void *pMgmtHandle,
unsigned char *pbyTxFailCount
);
-
void
VNTWIFIvGetTxRate(
void *pMgmtHandle,
bool bGroupKey
);
-
-
-
bool
VNTWIFIbSetPMKIDCache(
void *pMgmtObject,
/*--------------------- Static Definitions -------------------------*/
-
-
-
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
PSDevice pDevice
);
-
static
PSTxMgmtPacket
s_MgrMakeProbeRequest(
PWLAN_IE_SUPP_RATES pCurrExtSuppRates
);
-
static
bool
s_bCommandComplete(
/*--------------------- Export Variables --------------------------*/
-
/*--------------------- Export Functions --------------------------*/
-
-
/*
* Description:
* Stop AdHoc beacon during scan process
void
vAdHocBeaconStop(PSDevice pDevice)
{
-
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
bool bStop;
if (bStop) {
MACvRegBitsOff(pDevice->PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX);
}
-
} /* vAdHocBeaconStop */
-
/*
* Description:
* Restart AdHoc beacon after scan process complete
(pMgmt->eCurrState >= WMAC_STATE_STARTED)) {
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX);
}
-
}
-
-
-
-
-
/*+
*
* Routine Description:
PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned int ii;
-
if (pDevice->eCurrentPHYType == PHY_TYPE_11A) {
pbyRate = &abyCurrSuppRatesA[0];
} else if (pDevice->eCurrentPHYType == PHY_TYPE_11B) {
}
}
}
-
}
-
-
-
/*+
*
* Routine Description:
*
-*/
-
PSTxMgmtPacket
s_MgrMakeProbeRequest(
PSDevice pDevice,
PSTxMgmtPacket pTxPacket = NULL;
WLAN_FR_PROBEREQ sFrame;
-
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_PROBEREQ_FR_MAXLEN);
pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
return pTxPacket;
}
-
-
-
-
void
vCommandTimerWait(
void *hDeviceContext,
return;
}
-
-
-
void
vCommandTimer(
void *hDeviceContext
unsigned char byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
struct sk_buff *skb;
-
if (pDevice->dwDiagRefCount != 0)
return;
if (pDevice->bCmdRunning != true)
spin_lock_irq(&pDevice->lock);
switch (pDevice->eCommandState) {
-
case WLAN_CMD_SCAN_START:
pDevice->byReAssocCount = 0;
}
-
if ((pMgmt->b11hEnable == false) ||
(pMgmt->uScanChannel < CB_MAX_CHANNEL_24G)) {
s_vProbeChannel(pDevice);
if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) ||
((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) {
-
if (pItemSSID->len == pItemSSIDCurr->len) {
if (memcmp(pItemSSID->abySSID, pItemSSIDCurr->abySSID, pItemSSID->len) == 0) {
s_bCommandComplete(pDevice);
vMgrJoinBSSBegin((void *)pDevice, &Status);
// if Infra mode
if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED)) {
-
// Call mgr to begin the deauthentication
// reason = (3) because sta has left ESS
if (pMgmt->eCurrState >= WMAC_STATE_AUTH) {
s_bCommandComplete(pDevice);
break;
-
case WLAN_CMD_RADIO_START:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState == WLAN_CMD_RADIO_START\n");
if (pDevice->bRadioCmd == true)
s_bCommandComplete(pDevice);
break;
-
case WLAN_CMD_CHECK_BBSENSITIVITY_CHANGE:
//DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState == WLAN_CMD_CHECK_BBSENSITIVITY_START\n");
// wait all TD complete
} //switch
spin_unlock_irq(&pDevice->lock);
return;
-
}
-
static
bool
s_bCommandComplete(
bool bForceSCAN = true;
PSMgmtObject pMgmt = pDevice->pMgmt;
-
pDevice->eCommandState = WLAN_CMD_IDLE;
if (pDevice->cbFreeCmdQueue == CMD_Q_SIZE) {
//Command Queue Empty
return true;
}
-
-
bool bScheduleCommand(
void *hDeviceContext,
CMD_CODE eCommand,
{
PSDevice pDevice = (PSDevice)hDeviceContext;
-
if (pDevice->cbFreeCmdQueue == 0) {
return false;
}
if (pbyItem0 != NULL) {
switch (eCommand) {
-
case WLAN_CMD_BSSID_SCAN:
memcpy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID,
pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
} else {
}
return true;
-
}
/*
pDevice->bCmdClear = false;
}
-
#ifdef TxInSleep
void
BSSvSecondTxData(
return;
}
#endif
-
/*--------------------- Export Definitions -------------------------*/
-
-
#define AUTHENTICATE_TIMEOUT 1000 //ms
#define ASSOCIATE_TIMEOUT 1000 //ms
-
// Command code
typedef enum tagCMD_CODE {
WLAN_CMD_BSSID_SCAN,
#define CMD_Q_SIZE 32
typedef enum tagCMD_STATUS {
-
CMD_STATUS_SUCCESS = 0,
CMD_STATUS_FAILURE,
CMD_STATUS_RESOURCES,
CMD_STATUS_TIMEOUT,
CMD_STATUS_PENDING
-
} CMD_STATUS, *PCMD_STATUS;
-
typedef struct tagCMD_ITEM {
CMD_CODE eCmd;
unsigned char abyCmdDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
WLAN_CMD_IDLE
} CMD_STATE, *PCMD_STATE;
-
-
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
-
/*--------------------- Export Types ------------------------------*/
-
/*--------------------- Export Functions --------------------------*/
void
vResetCommandTimer(
/*--------------------- Export Variables --------------------------*/
-
-
/*
* Description:
* Scan Rx cache. Return true if packet is duplicate, else
PSCacheEntry pCacheEntry;
if (IS_FC_RETRY(pMACHeader)) {
-
uIndex = pCache->uInPtr;
for (ii = 0; ii < DUPLICATE_RX_CACHE_LENGTH; ii++) {
pCacheEntry = &(pCache->asCacheEntry[uIndex]);
return pDevice->cbDFCB;
}
-
/*
* Description:
* Insert received fragment packet in Defragment Database
return pDevice->cbDFCB;
}
-
/*
* Description:
* Handle received fragment packet
{
unsigned int uHeaderSize;
-
if (bWEP == true) {
uHeaderSize = 28;
if (bExtIV)
if ((pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wSequence == (pMACHeader->wSeqCtl >> 4)) &&
(pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum == (pMACHeader->wSeqCtl & 0x000F)) &&
((pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].cbFrameLength + cbFrameLength - uHeaderSize) < 2346)) {
-
memcpy(pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer, ((unsigned char *)(pMACHeader) + uHeaderSize), (cbFrameLength - uHeaderSize));
pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].cbFrameLength += (cbFrameLength - uHeaderSize);
pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer += (cbFrameLength - uHeaderSize);
return false;
}
}
-
-
#define IS_CTL_PSPOLL(pMACHeader) \
((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_SUBTYPE_MASK) == TYPE_CTL_PSPOLL)
-
#define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) \
do { \
if ((uVar) >= ((uModulo) - 1)) \
(uVar)++; \
} while (0)
-
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
unsigned int WCTLuInsertDFCB(PSDevice pDevice, PS802_11Header pMACHeader);
#endif // __WCTL_H__
-
-
-
/*--------------------- Static Definitions -------------------------*/
-
-
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
PWLAN_IE_SUPP_RATES pCurrExtSuppRates
);
-
// Association response
static
PSTxMgmtPacket
unsigned short wStatus
);
-
static
void
s_vMgrSynchBSS(
PCMD_STATUS pStatus
);
-
static bool
s_bCipherMatch(
PKnownBSS pBSSNode,
PKnownBSS pCurr
);
-
-
/*--------------------- Export Variables --------------------------*/
-
/*--------------------- Export Functions --------------------------*/
-
/*+
*
* Routine Description:
PSMgmtObject pMgmt = pDevice->pMgmt;
int ii;
-
pMgmt->pbyPSPacketPool = &pMgmt->byPSPacketPool[0];
pMgmt->pbyMgmtPacketPool = &pMgmt->byMgmtPacketPool[0];
pMgmt->uCurrChannel = pDevice->uChannel;
PSDevice pDevice = (PSDevice)hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
-
init_timer(&pMgmt->sTimerSecondCallback);
pMgmt->sTimerSecondCallback.data = (unsigned long) pDevice;
pMgmt->sTimerSecondCallback.function = (TimerFunction)BSSvSecondCallBack;
return;
}
-
-
/*+
*
* Routine Description:
return;
}
-
/*+
*
* Routine Description:
*
-*/
-
void
vMgrAssocBeginSta(
void *hDeviceContext,
PSDevice pDevice = (PSDevice)hDeviceContext;
PSTxMgmtPacket pTxPacket;
-
pMgmt->wCurrCapInfo = 0;
pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_ESS(1);
if (pDevice->bEncryptionEnable) {
return;
}
-
/*+
*
* Routine Description:
PSDevice pDevice = (PSDevice)hDeviceContext;
PSTxMgmtPacket pTxPacket;
-
-
pMgmt->wCurrCapInfo = 0;
pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_ESS(1);
if (pDevice->bEncryptionEnable) {
if (pMgmt->wListenInterval == 0)
pMgmt->wListenInterval = 1; // at least one.
-
// ERP Phy (802.11g) should support short preamble.
if (pMgmt->eCurrentPHYMode == PHY_TYPE_11G) {
pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1);
if (pMgmt->b11hEnable == true)
pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SPECTRUMMNG(1);
-
pTxPacket = s_MgrMakeReAssocRequest
(
pDevice,
}
}
-
return;
}
return;
}
-
-
/*+
*
* Routine Description:(AP function)
unsigned char abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
unsigned char abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
-
if (pMgmt->eCurrMode != WMAC_MODE_ESS_AP)
return;
// node index not found
abyCurrExtSuppRates[1] = 0;
}
-
RATEvParseMaxRate((void *)pDevice,
(PWLAN_IE_SUPP_RATES)abyCurrSuppRates,
(PWLAN_IE_SUPP_RATES)abyCurrExtSuppRates,
return;
}
-
// assoc response reply..
pTxPacket = s_MgrMakeAssocResponse
(
(PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates
);
if (pTxPacket != NULL) {
-
if (pDevice->bEnableHostapd) {
return;
}
return;
}
-
/*+
*
* Description:(AP function)
abyCurrExtSuppRates[1] = 0;
}
-
RATEvParseMaxRate((void *)pDevice,
(PWLAN_IE_SUPP_RATES)abyCurrSuppRates,
(PWLAN_IE_SUPP_RATES)abyCurrExtSuppRates,
}
-
// assoc response reply..
pTxPacket = s_MgrMakeReAssocResponse
(
return;
}
-
/*+
*
* Routine Description:
unsigned char *pbyIEs;
viawget_wpa_header *wpahdr;
-
-
if (pMgmt->eCurrState == WMAC_STATE_ASSOCPENDING ||
pMgmt->eCurrState == WMAC_STATE_ASSOC) {
-
sFrame.len = pRxPacket->cbMPDULen;
sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
// decode the frame
wireless_send_event(pDevice->dev, we_event, &wrqu, buf);
}
-
memset(&wrqu, 0, sizeof(wrqu));
memcpy(wrqu.ap_addr.sa_data, &pMgmt->abyCurrBSSID[0], ETH_ALEN);
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
pDevice->bWPASuppWextEnabled = false;
#endif
-
if (pMgmt->eCurrState == WMAC_STATE_ASSOC)
timer_expire(pDevice->sTimerCommand, 0);
return;
}
-
-
/*+
*
* Routine Description:
return;
}
-
-
/*+
*
* Routine Description:
WLAN_FR_DEAUTHEN sFrame;
PSTxMgmtPacket pTxPacket = NULL;
-
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_DEAUTHEN_FR_MAXLEN);
pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
*pStatus = CMD_STATUS_SUCCESS;
}
-
return;
}
-
/*+
*
* Routine Description:
return;
}
-
-
/*+
*
* Routine Description:
*
-*/
-
static
void
s_vMgrRxAuthenSequence_1(
if (pMgmt->bShareKeyAlgorithm &&
(cpu_to_le16(*(sFrame.pwStatus)) == WLAN_MGMT_STATUS_SUCCESS)) {
-
sFrame.pChallenge = (PWLAN_IE_CHALLENGE)(sFrame.pBuf + sFrame.len);
sFrame.len += WLAN_CHALLENGE_IE_LEN;
sFrame.pChallenge->byElementID = WLAN_EID_CHALLENGE;
return;
}
-
-
/*+
*
* Routine Description:
WLAN_FR_AUTHEN sFrame;
PSTxMgmtPacket pTxPacket = NULL;
-
switch (cpu_to_le16((*(pFrame->pwAuthAlgorithm)))) {
case WLAN_AUTH_ALG_OPENSYSTEM:
if (cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS) {
return;
}
-
-
/*+
*
* Routine Description:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Authreq_reply sequence_4 tx failed.\n");
}
return;
-
}
-
-
/*+
*
* Routine Description:
PWLAN_FR_AUTHEN pFrame
)
{
-
if (cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS) {
DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (SHAREDKEY) Successful.\n");
pMgmt->eCurrState = WMAC_STATE_AUTH;
// vCommandTimerWait((void *)pDevice, 0);
// spin_lock_irq(&pDevice->lock);
}
-
}
/*+
return;
}
-
/*+
*
* Routine Description:
unsigned int uNodeIndex = 0;
viawget_wpa_header *wpahdr;
-
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
//Todo:
// if is acting an AP..
return;
}
-
//2008-8-4 <add> by chester
/*+
*
return exceed;
}
-
/*+
*
* Routine Description:
bool bInScan
)
{
-
PKnownBSS pBSSList;
WLAN_FR_BEACON sFrame;
QWORD qwTSFOffset;
bool bUpdatePhyParameter = false;
unsigned char byIEChannel = 0;
-
memset(&sFrame, 0, sizeof(WLAN_FR_BEACON));
sFrame.len = pRxPacket->cbMPDULen;
sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
return;
}
-
if (sFrame.pDSParms != NULL) {
if (byCurrChannel > CB_MAX_CHANNEL_24G) {
// channel remapping to
bIsChannelEqual = true;
if (bIsChannelEqual && (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) {
-
// if rx beacon without ERP field
if (sERP.bERPExist) {
if (WLAN_GET_ERP_USE_PROTECTION(sERP.byERP)) {
}
}
-
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)
return;
if (memcmp(sFrame.pHdr->sA3.abyAddr3,
pMgmt->abyCurrBSSID,
WLAN_BSSID_LEN) == 0) {
-
bIsBSSIDEqual = true;
// 2008-05-21 <add> by Richardtai
bIsAPBeacon = true;
if (pBSSList != NULL) {
-
// Compare PHY parameter setting
if (pMgmt->wCurrCapInfo != pBSSList->wCapInfo) {
bUpdatePhyParameter = true;
bTSFLargeDiff = true;
}
-
// if infra mode
if (bIsAPBeacon == true) {
-
// Infra mode: Local TSF always follow AP's TSF if Difference huge.
if (bTSFLargeDiff)
bUpdateTSF = true;
if ((pDevice->bEnablePSMode == true) && (sFrame.pTIM != 0)) {
-
// deal with DTIM, analysis TIM
pMgmt->bMulticastTIM = WLAN_MGMT_IS_MULTICAST_TIM(sFrame.pTIM->byBitMapCtl) ? true : false;
pMgmt->byDTIMCount = sFrame.pTIM->byDTIMCount;
// During dpc, already in spinlocked.
if (BSSDBbIsSTAInNodeDB(pMgmt, sFrame.pHdr->sA3.abyAddr2, &uNodeIndex)) {
-
// Update the STA, (Technically the Beacons of all the IBSS nodes
// should be identical, but that's not happening in practice.
pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pSuppRates,
}
} else if (bIsSSIDEqual) {
-
// See other adhoc sta with the same SSID but BSSID is different.
// adpot this vars only when TSF larger then us.
if (bTSFLargeDiff && bTSFOffsetPostive) {
pMgmt->abyCurrSuppRates,
pMgmt->abyCurrExtSuppRates);
-
// MACvRegBitsOff(pDevice->PortOffset, MAC_REG_RCR, RCR_BSSID);
// set highest basic rate
// s_vSetHighestBasicRate(pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates);
return;
}
-
-
/*+
*
* Routine Description:
pMgmt->abyCurrSuppRates[2+ii] = abyRATE[ii];
}
-
if (pMgmt->eCurrentPHYMode == PHY_TYPE_11G) {
pMgmt->abyCurrSuppRates[1] = 8;
pMgmt->abyCurrExtSuppRates[1] = 4;
pMgmt->abyCurrExtSuppRates[2+ii] = abyOFDM_RATE[ii+4];
}
-
// Disable Protect Mode
pDevice->bProtectMode = 0;
MACvDisableProtectMD(pDevice->PortOffset);
if (pMgmt->wIBSSBeaconPeriod == 0)
pMgmt->wIBSSBeaconPeriod = DEFAULT_IBSS_BI;
-
CARDbGetCurrentTSF(pDevice->PortOffset, &qwCurrTSF);
// clear TSF counter
VNSvOutPortB(pDevice->PortOffset + MAC_REG_TFTCTL, TFTCTL_TSFCNTRST);
if (pMgmt->uIBSSChannel == 0)
pMgmt->uIBSSChannel = DEFAULT_IBSS_CHANNEL;
-
// set basic rate
RATEvParseMaxRate((void *)pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates,
&wMaxBasicRate, &wMaxSuppRate, &wSuppRate,
&byTopCCKBasicRate, &byTopOFDMBasicRate);
-
if (pMgmt->eConfigMode == WMAC_CONFIG_AP) {
pMgmt->eCurrMode = WMAC_MODE_ESS_AP;
}
}
if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
-
// BSSID selected must be randomized as spec 11.1.3
pMgmt->abyCurrBSSID[5] = (unsigned char) (LODWORD(qwCurrTSF) & 0x000000ff);
pMgmt->abyCurrBSSID[4] = (unsigned char)((LODWORD(qwCurrTSF) & 0x0000ff00) >> 8);
pMgmt->abyCurrBSSID[0] &= ~IEEE_ADDR_GROUP;
pMgmt->abyCurrBSSID[0] |= IEEE_ADDR_UNIVERSAL;
-
DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Adhoc beacon created bssid:%pM\n",
pMgmt->abyCurrBSSID);
}
return;
}
-
-
/*+
*
* Routine Description:
PCMD_STATUS pStatus
)
{
-
PSDevice pDevice = (PSDevice)hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
PKnownBSS pCurr = NULL;
unsigned char byTopCCKBasicRate = RATE_1M;
unsigned char byTopOFDMBasicRate = RATE_1M;
-
for (ii = 0; ii < MAX_BSS_NUM; ii++) {
if (pMgmt->sBSSList[ii].bActive == true)
break;
DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP(BSS) finding:Found a AP(BSS)..\n");
if (WLAN_GET_CAP_INFO_ESS(cpu_to_le16(pCurr->wCapInfo))) {
-
if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA) || (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK)) {
-
// patch for CISCO migration mode
/*
if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) {
);
if (*pStatus == CMD_STATUS_SUCCESS) {
-
// Adopt this BSS state vars in Mgmt Object
pMgmt->uCurrChannel = pCurr->uChannel;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Join ESS\n");
-
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "End of Join AP -- A/B/G Action\n");
} else {
pMgmt->eCurrState = WMAC_STATE_IDLE;
};
-
} else {
// ad-hoc mode BSS
if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) {
-
if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) {
if (WPA_SearchRSN(0, WPA_TKIP, pCurr) == false) {
// encryption mode error
// TODO: check if CapInfo privacy on, but we don't..
pMgmt->uCurrChannel = pCurr->uChannel;
-
// Parse Support Rate IE
pMgmt->abyCurrSuppRates[0] = WLAN_EID_SUPP_RATES;
pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)pCurr->abySuppRates,
return;
}
-
-
/*+
*
* Routine Description:
unsigned char abyCurrSuppRatesA[] = {WLAN_EID_SUPP_RATES, 8, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C};
unsigned char abyCurrSuppRatesB[] = {WLAN_EID_SUPP_RATES, 4, 0x02, 0x04, 0x0B, 0x16};
-
*pStatus = CMD_STATUS_FAILURE;
if (s_bCipherMatch(pCurr,
memcpy(pMgmt->abyCurrExtSuppRates, &abyCurrExtSuppRatesG[0], sizeof(abyCurrExtSuppRatesG));
}
-
if (WLAN_GET_CAP_INFO_ESS(pCurr->wCapInfo)) {
CARDbSetBSSID(pMgmt->pAdapter, pCurr->abyBSSID, OP_MODE_INFRASTRUCTURE);
// Add current BSS to Candidate list
pMgmt->byERPContext = pCurr->sERP.byERP;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Sync:Set to channel = [%d]\n", (int)pCurr->uChannel);
-
*pStatus = CMD_STATUS_SUCCESS;
-
return;
};
return;
}
-
/*+
*
* Routine Description:
unsigned short wStartIndex = 0;
unsigned short wEndIndex = 0;
-
// Find size of partial virtual bitmap
for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) {
byMap = pMgmt->abyPSTxMap[ii];
}
}
-
// Round start index down to nearest even number
wStartIndex &= ~BIT0;
pTIM->byVirtBitMap[0] &= ~BIT0;
}
-
/*+
*
* Routine Description:
}
if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
-
// IBSS parameter
sFrame.pIBSSParms = (PWLAN_IE_IBSS_PARMS)(sFrame.pBuf + sFrame.len);
sFrame.len += (2) + WLAN_IEHDR_LEN;
return pTxPacket;
}
-
-
-
-
/*+
*
* Routine Description:
*
-*/
-
-
-
PSTxMgmtPacket
s_MgrMakeProbeResponse(
PSDevice pDevice,
PWLAN_IE_IBSS_DFS pIBSSDFS = NULL;
unsigned int ii;
-
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_PROBERESP_FR_MAXLEN);
pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
sFrame.len += uLength;
}
-
if (((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len != 0) {
sFrame.pExtSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len);
sFrame.len += ((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN;
return pTxPacket;
}
-
-
/*+
*
* Routine Description:
*
-*/
-
PSTxMgmtPacket
s_MgrMakeAssocRequest(
PSDevice pDevice,
unsigned char *pbyIEs;
unsigned char *pbyRSN;
-
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_ASSOCREQ_FR_MAXLEN);
pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
pbyIEs += sFrame.pRSN->len + WLAN_IEHDR_LEN;
}
-
// Adjust the length fields
pTxPacket->cbMPDULen = sFrame.len;
pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN;
return pTxPacket;
}
-
-
-
-
-
-
-
/*+
*
* Routine Description:
*
-*/
-
PSTxMgmtPacket
s_MgrMakeReAssocRequest(
PSDevice pDevice,
unsigned char *pbyIEs;
unsigned char *pbyRSN;
-
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_REASSOCREQ_FR_MAXLEN);
pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
pbyIEs += sFrame.pRSN->len + WLAN_IEHDR_LEN;
}
-
/* Adjust the length fields */
pTxPacket->cbMPDULen = sFrame.len;
pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN;
return pTxPacket;
}
-
-
/*+
*
* Routine Description:
*
-*/
-
PSTxMgmtPacket
s_MgrMakeAssocResponse(
PSDevice pDevice,
PSTxMgmtPacket pTxPacket = NULL;
WLAN_FR_ASSOCRESP sFrame;
-
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_ASSOCREQ_FR_MAXLEN);
pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
return pTxPacket;
}
-
/*+
*
* Routine Description:
*
-*/
-
PSTxMgmtPacket
s_MgrMakeReAssocResponse(
PSDevice pDevice,
PSTxMgmtPacket pTxPacket = NULL;
WLAN_FR_REASSOCRESP sFrame;
-
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_ASSOCREQ_FR_MAXLEN);
pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
return pTxPacket;
}
-
/*+
*
* Routine Description:
unsigned char byIEChannel = 0;
bool bChannelHit = true;
-
memset(&sFrame, 0, sizeof(WLAN_FR_PROBERESP));
// decode the frame
sFrame.len = pRxPacket->cbMPDULen;
sERP.byERP = 0;
}
-
// update or insert the bss
pBSSList = BSSpAddrIsInBSSList((void *)pDevice, sFrame.pHdr->sA3.abyAddr3, sFrame.pSSID);
if (pBSSList) {
);
}
return;
-
}
/*+
*
-*/
-
static
void
s_vMgrRxProbeRequest(
// STA have to response this request.
if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) ||
((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && pDevice->bBeaconSent)) {
-
memset(&sFrame, 0, sizeof(WLAN_FR_PROBEREQ));
// decode the frame
sFrame.len = pRxPacket->cbMPDULen;
return;
}
-
-
-
-
/*+
*
* Routine Description:
*
-*/
-
void
vMgrRxManagePacket(
void *hDeviceContext,
NODE_STATE eNodeState = 0;
CMD_STATUS Status;
-
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
if (BSSDBbIsSTAInNodeDB(pMgmt, pRxPacket->p80211Header->sA3.abyAddr2, &uNodeIndex))
eNodeState = pMgmt->sNodeDBTable[uNodeIndex].eNodeState;
}
switch (WLAN_GET_FC_FSTYPE((pRxPacket->p80211Header->sA3.wFrameCtl))) {
-
case WLAN_FSTYPE_ASSOCREQ:
// Frame Clase = 2
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx assocreq\n");
return;
}
-
-
-
/*+
*
* Routine Description:
return true;
}
-
-
-
/*+
*
* Routine Description:
}
}
-
/*
*
* Description:
if (pDevice->gsPMKIDCandidate.NumCandidates >= MAX_PMKIDLIST)
return false;
-
-
// Update Old Candidate
for (ii = 0; ii < pDevice->gsPMKIDCandidate.NumCandidates; ii++) {
pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[ii];
// mask our cap. with BSS
if (EncStatus == Ndis802_11Encryption1Enabled) {
-
// For supporting Cisco migration mode, don't care pairwise key cipher
if ((byMulticastCipher == KEY_CTL_WEP) &&
(byCipherMask == 0)) {
}
return true;
}
-
-
/*--------------------- Export Definitions -------------------------*/
-
-
// Scan time
#define PROBE_DELAY 100 // (us)
#define SWITCH_CHANNEL_DELAY 200 // (us)
#define WCMD_ACTIVE_SCAN_TIME 50 //(ms)
#define WCMD_PASSIVE_SCAN_TIME 100 //(ms)
-
#define DEFAULT_MSDU_LIFETIME 512 // ms
#define DEFAULT_MSDU_LIFETIME_RES_64us 8000 // 64us
#define MAKE_BEACON_RESERVED 10 //(us)
-
#define TIM_MULTICAST_MASK 0x01
#define TIM_BITMAPOFFSET_MASK 0xFE
#define DEFAULT_DTIM_PERIOD 1
#define DEFAULT_IBSS_CHANNEL 6 //2.4G
-
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
#define timer_expire(timer, next_tick) mod_timer(&timer, RUN_AT(next_tick))
typedef void (*TimerFunction)(unsigned long);
-
//+++ NDIS related
typedef unsigned char NDIS_802_11_MAC_ADDRESS[6];
unsigned long OffsetResponseIEs;
} NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION;
-
-
typedef struct tagSAssocInfo {
NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo;
unsigned char abyIEs[WLAN_BEACON_FR_MAXLEN+WLAN_BEACON_FR_MAXLEN];
} SAssocInfo, *PSAssocInfo;
//---
-
/*
typedef enum tagWMAC_AUTHENTICATION_MODE {
-
-
WMAC_AUTH_OPEN,
WMAC_AUTH_SHAREKEY,
WMAC_AUTH_AUTO,
WMAC_AUTH_WPA2PSK,
WMAC_AUTH_MAX // Not a real mode, defined as upper bound
-
} WMAC_AUTHENTICATION_MODE, *PWMAC_AUTHENTICATION_MODE;
*/
-
// Pre-configured Mode (from XP)
/*
typedef enum tagWMAC_CONFIG_MODE {
*/
typedef enum tagWMAC_SCAN_TYPE {
-
WMAC_SCAN_ACTIVE,
WMAC_SCAN_PASSIVE,
WMAC_SCAN_HYBRID
-
} WMAC_SCAN_TYPE, *PWMAC_SCAN_TYPE;
-
typedef enum tagWMAC_SCAN_STATE {
-
WMAC_NO_SCANNING,
WMAC_IS_SCANNING,
WMAC_IS_PROBEPENDING
-
} WMAC_SCAN_STATE, *PWMAC_SCAN_STATE;
-
-
// Notes:
// Basic Service Set state explained as following:
// WMAC_STATE_IDLE : no BSS is selected (Adhoc or Infra)
// WMAC_STATE_ASSOC : Associated (Infra)
typedef enum tagWMAC_BSS_STATE {
-
WMAC_STATE_IDLE,
WMAC_STATE_STARTED,
WMAC_STATE_JOINTED,
WMAC_STATE_AUTH,
WMAC_STATE_ASSOCPENDING,
WMAC_STATE_ASSOC
-
} WMAC_BSS_STATE, *PWMAC_BSS_STATE;
// WMAC selected running mode
typedef enum tagWMAC_CURRENT_MODE {
-
WMAC_MODE_STANDBY,
WMAC_MODE_ESS_STA,
WMAC_MODE_IBSS_STA,
WMAC_MODE_ESS_AP
-
} WMAC_CURRENT_MODE, *PWMAC_CURRENT_MODE;
/*
typedef enum tagWMAC_POWER_MODE {
-
WMAC_POWER_CAM,
WMAC_POWER_FAST,
WMAC_POWER_MAX
} WMAC_POWER_MODE, *PWMAC_POWER_MODE;
*/
-
// Tx Management Packet descriptor
typedef struct tagSTxMgmtPacket {
-
PUWLAN_80211HDR p80211Header;
unsigned int cbMPDULen;
unsigned int cbPayloadLen;
-
} STxMgmtPacket, *PSTxMgmtPacket;
-
// Rx Management Packet descriptor
typedef struct tagSRxMgmtPacket {
-
PUWLAN_80211HDR p80211Header;
QWORD qwLocalTSF;
unsigned int cbMPDULen;
unsigned char bySQ;
unsigned char byRxRate;
unsigned char byRxChannel;
-
} SRxMgmtPacket, *PSRxMgmtPacket;
-
-
typedef struct tagSMgmtObject
{
-
void *pAdapter;
// MAC address
unsigned char abyMACAddr[WLAN_ADDR_LEN];
CARD_PHY_TYPE eCurrentPHYMode;
CARD_PHY_TYPE eConfigPHYMode;
-
// Operation state variables
WMAC_CURRENT_MODE eCurrMode; // MAC current connection mode
WMAC_BSS_STATE eCurrState; // MAC current BSS state
unsigned char *pbyMgmtPacketPool;
unsigned char byMgmtPacketPool[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN];
-
// One second callback timer
struct timer_list sTimerSecondCallback;
// link list of known bss's (scan results)
KnownBSS sBSSList[MAX_BSS_NUM];
-
-
// table list of known node
// sNodeDBList[0] is reserved for AP under Infra mode
// sNodeDBList[0] is reserved for Multicast under adhoc/AP mode
KnownNodeDB sNodeDBTable[MAX_NODE_NUM + 1];
-
-
// WPA2 PMKID Cache
SPMKIDCache gsPMKIDCache;
bool bRoaming;
// rate fall back vars
-
-
// associate info
SAssocInfo sAssocInfo;
-
// for 802.11h
bool b11hEnable;
bool bSwitchChannel;
unsigned char byIBSSDFSRecovery;
struct sk_buff skb;
-
} SMgmtObject, *PSMgmtObject;
-
/*--------------------- Export Macros ------------------------------*/
-
/*--------------------- Export Functions --------------------------*/
-
void
vMgrObjectInit(
void *hDeviceContext
PSMgmtObject pMgmt
);
-
bool
bAdd_PMKID_Candidate(
void *hDeviceContext,
const unsigned char abyOUI04[4] = { 0x00, 0x50, 0xf2, 0x04 };
const unsigned char abyOUI05[4] = { 0x00, 0x50, 0xf2, 0x05 };
-
/*+
*
* Description:
pBSSList->bWPAValid = false;
}
-
/*+
*
* Description:
if ((pRSN->len >= 6) // oui1(4)+ver(2)
&& (pRSN->byElementID == WLAN_EID_RSN_WPA) && !memcmp(pRSN->abyOUI, abyOUI01, 4)
&& (pRSN->wVersion == 1)) {
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Legal RSN\n");
// update each variable if pRSN is long enough to contain the variable
if (pRSN->len >= 10) //oui1(4)+ver(2)+GKSuite(4)
}
if (pIE_RSN_Auth != NULL) {
-
n = pIE_RSN_Auth->wAuthCount;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "n: %d\n", n);
} else
return false;
}
-
/*--------------------- Export Types ------------------------------*/
-
/*--------------------- Export Functions --------------------------*/
void
const unsigned char abyOUI8021X[4] = { 0x00, 0x0F, 0xAC, 0x01 };
const unsigned char abyOUIPSK[4] = { 0x00, 0x0F, 0xAC, 0x02 };
-
/*--------------------- Static Functions --------------------------*/
/*--------------------- Export Variables --------------------------*/
// information element header makes sense
if ((pRSN->byElementID == WLAN_EID_RSN) &&
(pRSN->wVersion == 1)) {
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Legal 802.11i RSN\n");
pbyOUI = &(pRSN->abyRSN[0]);
pbyOUI = &(pRSN->abyRSN[6]);
for (i = 0; (i < pBSSNode->wCSSPKCount) && (j < sizeof(pBSSNode->abyCSSPK)/sizeof(unsigned char)); i++) {
-
if (pRSN->len >= 8+i*4+4) { // ver(2)+GK(4)+PKCnt(2)+PKS(4*i)
if (!memcmp(pbyOUI, abyOUIGK, 4)) {
pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_USE_GROUP;
}
}
-
/*+
*
* Description:
PMKIDInfo BSSIDInfo[MAX_PMKID_CACHE];
} SPMKIDCache, *PSPMKIDCache;
-
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
#define VIAWGET_WPA_MAX_BUF_SIZE 1024
-
-
static const int frequency_list[] = {
2412, 2417, 2422, 2427, 2432, 2437, 2442,
2447, 2452, 2457, 2462, 2467, 2472, 2484
/*--------------------- Static Functions --------------------------*/
-
-
-
/*--------------------- Export Variables --------------------------*/
static void wpadev_setup(struct net_device *dev)
{
return 0;
}
-
/*
* Description:
* unregister net_device (wpadev)
return 0;
}
-
-
-
-
/*
* Description:
* Set enable/disable dev for wpa supplicant daemon
return wpa_release_wpadev(pDevice);
}
-
/*
* Description:
* Set WPA algorithm & keys
int ret = 0;
int uu, ii;
-
if (param->u.wpa_key.alg_name > WPA_ALG_CCMP ||
param->u.wpa_key.key_len >= MAX_KEY_LEN ||
param->u.wpa_key.seq_len >= MAX_KEY_LEN)
if (param->u.wpa_key.set_tx)
dwKeyIndex |= (1 << 31);
-
if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled)
byKeyDecMode = KEY_CTL_CCMP;
else if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled)
*/
return ret;
-
}
-
/*
* Description:
* enable wpa auth & mode
static int wpa_set_wpa(PSDevice pDevice,
struct viawget_wpa_param *param)
{
-
PSMgmtObject pMgmt = pDevice->pMgmt;
int ret = 0;
return ret;
}
-
-
-
/*
* Description:
* set disassociate
return ret;
}
-
-
/*
* Description:
* enable scan process
return ret;
}
-
-
/*
* Description:
* get bssid
memcpy(param->u.wpa_associate.bssid, pMgmt->abyCurrBSSID , 6);
return ret;
-
}
-
/*
* Description:
* get bssid
return ret;
}
-
-
/*
* Description:
* get scan results
unsigned char *ptempBSS;
-
-
ptempBSS = kmalloc(sizeof(KnownBSS), (int)GFP_ATOMIC);
if (ptempBSS == NULL) {
-
printk("bubble sort kmalloc memory fail@@@\n");
ret = -ENOMEM;
}
for (ii = 0; ii < MAX_BSS_NUM; ii++) {
-
for (jj = 0; jj < MAX_BSS_NUM - ii - 1; jj++) {
-
if ((pMgmt->sBSSList[jj].bActive != true) ||
((pMgmt->sBSSList[jj].uRSSI > pMgmt->sBSSList[jj + 1].uRSSI) && (pMgmt->sBSSList[jj + 1].bActive != false))) {
-
memcpy(ptempBSS, &pMgmt->sBSSList[jj], sizeof(KnownBSS));
memcpy(&pMgmt->sBSSList[jj], &pMgmt->sBSSList[jj + 1], sizeof(KnownBSS));
//******mike:bubble sort by stronger RSSI*****//
-
-
-
count = 0;
pBSS = &(pMgmt->sBSSList[0]);
for (ii = 0; ii < MAX_BSS_NUM; ii++) {
return ret;
}
-
-
/*
* Description:
* set associate with AP
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "mode = %d\n", param->u.wpa_associate.mode);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_ie_len = %d\n", param->u.wpa_associate.wpa_ie_len);
-
if (param->u.wpa_associate.wpa_ie_len) {
if (!param->u.wpa_associate.wpa_ie)
return -EINVAL;
return ret;
}
-
/*
* Description:
* wpa_ioctl main function supported for wpa supplicant
return ret;
}
-
/*--------------------- Export Definitions -------------------------*/
-
//WPA related
typedef enum { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP } wpa_alg;
#define GENERIC_INFO_ELEM 0xdd
#define RSN_INFO_ELEM 0x30
-
-
typedef unsigned long long NDIS_802_11_KEY_RSC;
/*--------------------- Export Classes ----------------------------*/
int wpa_set_keys(PSDevice pDevice, void *ctx, bool fcpfkernel);
#endif // __WPACL_H__
-
-
-
/*--------------------- Export Variables --------------------------*/
-
-
/*
* Description:
* Relay packet. Return true if packet is copy to DMA1
unsigned int ii;
unsigned char *pbyBSSID;
-
-
-
if (AVAIL_TD(pDevice, TYPE_AC0DMA) <= 0) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Relay can't allocate TD1..\n");
return false;
return true;
}
-
-
-
bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData, unsigned int uDataLen, unsigned int uNodeIndex);
#endif // __WROUTE_H__
-
-
-