#ifndef __80211HDR_H__
#define __80211HDR_H__
-
/* bit type */
#define BIT0 0x00000001
#define BIT1 0x00000002
} UWLAN_80211HDR, *PUWLAN_80211HDR;
-
-
-
#endif /* __80211HDR_H__ */
#include "80211hdr.h"
#include "wpa.h"
-
-
-
-
-
static int msglevel = MSG_LEVEL_INFO;
/*static int msglevel =MSG_LEVEL_DEBUG;*/
-
-
-
-
-
-
/*+
*
* Routine Description:
*
-*/
-
void
vMgrDecodeBeacon(
PWLAN_FR_BEACON pFrame
{
pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
-
/* Fixed Fields */
pFrame->pwReason = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ WLAN_DISASSOC_OFF_REASON);
pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_DISASSOC_OFF_REASON + sizeof(*(pFrame->pwReason));
}
-
/*+
*
* Routine Description:
*
-*/
-
void
vMgrEncodeAssocRequest(
PWLAN_FR_ASSOCREQ pFrame
pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_ASSOCREQ_OFF_LISTEN_INT + sizeof(*(pFrame->pwListenInterval));
}
-
/*+
*
* Routine Description: (AP)
+ sizeof(*(pFrame->pwAid));
}
-
/*+
*
* Routine Description:
pFrame->pExtSuppRates = NULL;
}
-
/*+
*
* Routine Description:
pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_REASSOCREQ_OFF_CURR_AP + sizeof(*(pFrame->pAddrCurrAP));
}
-
/*+
*
* Routine Description: (AP)
*
-*/
-
void
vMgrDecodeReassocRequest(
PWLAN_FR_REASSOCREQ pFrame
}
}
-
-
/*+
*
* Routine Description:
*
-*/
-
void
vMgrEncodeProbeRequest(
PWLAN_FR_PROBEREQ pFrame
}
}
-
/*+
*
* Routine Description:
*
-*/
-
void
vMgrEncodeProbeResponse(
PWLAN_FR_PROBERESP pFrame
sizeof(*(pFrame->pwCapInfo));
}
-
-
/*+
*
* Routine Description:
{
PWLAN_IE pItem;
-
pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
/* Fixed Fields */
}
}
-
/*+
*
* Routine Description:
pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_AUTHEN_OFF_STATUS + sizeof(*(pFrame->pwStatus));
}
-
/*+
*
* Routine Description:
pFrame->pChallenge = (PWLAN_IE_CHALLENGE)pItem;
}
-
/*+
*
* Routine Description:
pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_DEAUTHEN_OFF_REASON + sizeof(*(pFrame->pwReason));
}
-
/*+
*
* Routine Description:
+ WLAN_DEAUTHEN_OFF_REASON);
}
-
/*+
*
* Routine Description: (AP)
#include "80211hdr.h"
-
#define WLAN_MIN_ARRAY 1
/* Information Element ID value */
#define MEASURE_MODE_INCAPABLE 0x02
#define MEASURE_MODE_REFUSED 0x04
-
-
-
/* Information Element types */
#pragma pack(1)
u8 byLinkMargin;
} WLAN_IE_TPC_REP, *PWLAN_IE_TPC_REP;
-
typedef struct _WLAN_IE_IBSS_DFS {
u8 byElementID;
u8 len;
} WLAN_FR_DEAUTHEN, *PWLAN_FR_DEAUTHEN;
-
void
vMgrEncodeBeacon(
PWLAN_FR_BEACON pFrame
#include "device.h"
#include "80211hdr.h"
-
-
-
/*
* SBOX Table
*/
0x0b, 0x08, 0x0d, 0x0e, 0x07, 0x04, 0x01, 0x02, 0x13, 0x10, 0x15, 0x16, 0x1f, 0x1c, 0x19, 0x1a
};
-
-
-
static void xor_128(u8 *a, u8 *b, u8 *out)
{
u32 * dwPtrA = (u32 *) a;
(*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++);
}
-
static void xor_32(u8 *a, u8 *b, u8 *out)
{
u32 * dwPtrA = (u32 *) a;
#ifndef __AES_H__
#define __AES_H__
-
-
-
-
bool AESbGenCCMP(u8 * pbyRxKey, u8 * pbyFrame, u16 wFrameSize);
#endif /* __AES_CCMP_H__ */
static int msglevel =MSG_LEVEL_INFO;
//static int msglevel =MSG_LEVEL_DEBUG;
-
-
-
-
-
-
-
-
u8 abyVT3184_AGC[] = {
0x00, //0
0x00, //1
0x3E //3F
};
-
u8 abyVT3184_AL2230[] = {
0x31,//00
0x00,
0x00
};
-
-
//{{RobertYu:20060515, new BB setting for VT3226D0
u8 abyVT3184_VT3226D0[] = {
0x31,//00
const u16 awcFrameTime[MAX_RATE] =
{10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216};
-
/*
static
unsigned long
unsigned int uRateIdx = (unsigned int)wRate;
unsigned int uRate = 0;
-
if (uRateIdx > RATE_54M) {
ASSERT(0);
return 0;
}
}
-
/*
* Description: Set Antenna mode
*
break;
}
-
CONTROLnsRequestOut(pDevice,
MESSAGE_TYPE_SET_ANTMD,
(u16) byAntennaMode,
return false;
}
-
// if ((pDevice->abyEEPROM[EEP_OFS_RADIOCTL]&0x06)==0x04)
// return false;
abyArray
);
-
if ((pDevice->byRFType == RF_VT3226) || //RobertYu:20051116, 20060111 remove VT3226D0
(pDevice->byRFType == RF_VT3342A0) //RobertYu:20060609
) {
MACvRegBitsOn(pDevice,MAC_REG_PAPEDELAY,0x01);
}
-
ControlvWriteByte(pDevice,MESSAGE_REQUEST_BBREG,0x04,0x7F);
ControlvWriteByte(pDevice,MESSAGE_REQUEST_BBREG,0x0D,0x01);
ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0A, pDevice->byBBRxConf);
}
-
void BBvSetVGAGainOffset(struct vnt_private *pDevice, u8 byData)
{
ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0D, 0x01);//CR13
}
-
static unsigned long s_ulGetLowSQ3(struct vnt_private *pDevice)
{
int ii;
return ulRatio;
}
-
static void s_vClearSQ3Value(struct vnt_private *pDevice)
{
int ii;
}
}
-
/*
* Description: Antenna Diversity
*
} //byAntennaState
}
-
/*+
*
* Description:
add_timer(&pDevice->TimerSQ3Tmax3);
add_timer(&pDevice->TimerSQ3Tmax2);
-
spin_unlock_irq(&pDevice->lock);
}
-
/*+
*
* Description:
void BBvUpdatePreEDThreshold(struct vnt_private *pDevice, int bScanning)
{
-
switch(pDevice->byRFType)
{
case RF_AL2230:
#include "tether.h"
#include "device.h"
-
#define PREAMBLE_LONG 0
#define PREAMBLE_SHORT 1
#define TOP_RATE_2M 0x00200000
#define TOP_RATE_1M 0x00100000
-
-
-
-
-
-
unsigned int
BBuGetFrameTime(
u8 byPreambleType,
#include "rndis.h"
#include "iowpa.h"
-
-
-
-
-
static int msglevel =MSG_LEVEL_INFO;
//static int msglevel =MSG_LEVEL_DEBUG;
-
-
const u16 awHWRetry0[5][5] = {
{RATE_18M, RATE_18M, RATE_12M, RATE_12M, RATE_12M},
{RATE_24M, RATE_24M, RATE_18M, RATE_12M, RATE_12M},
{RATE_54M, RATE_54M, RATE_36M, RATE_18M, RATE_18M}
};
-
-
-
static void s_vCheckSensitivity(struct vnt_private *pDevice);
static void s_vCheckPreEDThreshold(struct vnt_private *pDevice);
static void s_uCalculateLinkQual(struct vnt_private *pDevice);
-
-
-
-
-
-
-
/*+
*
* Routine Description:
pCurrBSS->abyBSSID);
jj++;
-
if (pSelect == NULL) {
pSelect = pCurrBSS;
} else {
}
-
/*+
*
* Routine Description:
*
-*/
-
void BSSvClearBSSList(struct vnt_private *pDevice, int bKeepCurrBSSID)
{
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
BSSvClearAnyBSSJoinRecord(pDevice);
}
-
-
/*+
*
* Routine Description:
return NULL;
};
-
-
/*+
*
* Routine Description:
unsigned int ii;
bool bParsingQuiet = false;
-
pBSSList = (PKnownBSS)&(pMgmt->sBSSList[0]);
for (ii = 0; ii < MAX_BSS_NUM; ii++) {
return true;
}
-
/*+
*
* Routine Description:
if (pBSSList == NULL)
return false;
-
pBSSList->qwBSSTimestamp = cpu_to_le64(qwTimestamp);
pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval);
return true;
}
-
-
-
-
/*+
*
* Routine Description:
return false;
};
-
-
/*+
*
* Routine Description:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Create node index = %d\n", ii);
};
-
-
/*+
*
* Routine Description:
u8 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
if (pMgmt->sNodeDBTable[ii].bPSEnable)
uSleepySTACnt++;
-
}
// Rate fallback check
}
-
if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->byBBType == BB_TYPE_11G)) {
// on/off protect mode
}
-
// Check if any STA in PS mode, enable DTIM multicast deliver
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
if (uSleepySTACnt > 0)
#include "card.h"
#include "mib.h"
-
#define MAX_NODE_NUM 64
#define MAX_BSS_NUM 42
#define LOST_BEACON_COUNT 10 /* 10 sec, XP defined */
#define MAX_WPA_IE_LEN 64
-
-
-
-
-
//
// IEEE 802.11 Structures and definitions
//
u8 byERP;
} ERPObject, *PERPObject;
-
typedef struct tagSRSNCapObject {
bool bRSNCapExist;
u16 wRSNCap;
} __attribute__ ((__packed__))
KnownBSS , *PKnownBSS;
-
-
typedef enum tagNODE_STATE {
NODE_FREE,
NODE_AGED,
NODE_ASSOC
} NODE_STATE, *PNODE_STATE;
-
// STA node info
typedef struct tagKnownNodeDB {
// STA info
} KnownNodeDB, *PKnownNodeDB;
-
PKnownBSS BSSpSearchBSSList(struct vnt_private *, u8 *pbyDesireBSSID,
u8 *pbyDesireSSID, CARD_PHY_TYPE ePhyType);
#include "rndis.h"
#include "control.h"
-
//static int msglevel =MSG_LEVEL_DEBUG;
static int msglevel =MSG_LEVEL_INFO;
-
-
-
//const u16 cwRXBCNTSFOff[MAX_RATE] =
//{17, 34, 96, 192, 34, 23, 17, 11, 8, 5, 4, 3};
const u16 cwRXBCNTSFOff[MAX_RATE] =
{192, 96, 34, 17, 34, 23, 17, 11, 8, 5, 4, 3};
-
-
/*
* Description: Set NIC media channel
*
}
}
-
/*
* Description: Calculate TSF offset of two TSF input
* Get TSF Offset from RxBCN's TSF and local TSF
return qwTSFOffset;
}
-
-
/*
* Description: Sync. TSF counter to BSS
* Get TSF offset and write to HW
u64 qwTSFOffset = 0;
u8 pbyData[8];
-
qwTSFOffset = CARDqGetTSFOffset(byRxRate, qwBSSTimestamp, qwLocalTSF);
// adjust TSF
// HW's TSF add TSF Offset reg
return true;
}
-
/*
* Description: Clear NIC TSF counter
* Clear local TSF counter
return (qwTSF);
}
-
/*
* Description: Set NIC TSF counter for first Beacon time
* Get NEXTTBTT from adjusted TSF and Beacon Interval
return;
}
-
/*
* Description: Sync NIC TSF counter for Beacon time
* Get NEXTTBTT and write to HW
pbyData
);
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
"Card:Update Next TBTT[%8lx]\n", (unsigned long)qwTSF);
return bResult;
}
-
/*
* Description: Turn on Radio power
*
#define __CARD_H__
#include "device.h"
-
-
/* init card type */
typedef enum _CARD_PHY_TYPE {
#define CB_MAX_CHANNEL_5G 42 /* add channel9(5045MHz), 41==>42 */
#define CB_MAX_CHANNEL (CB_MAX_CHANNEL_24G+CB_MAX_CHANNEL_5G)
-
struct vnt_private;
void CARDbSetMediaChannel(struct vnt_private *pDevice, u32 uConnectionChannel);
static int msglevel = MSG_LEVEL_INFO;
//static int msglevel =MSG_LEVEL_DEBUG;
-
-
-
static SChannelTblElement sChannelTbl[CB_MAX_CHANNEL+1] =
{
{0, 0, false},
{165, 5825, true} //56
};
-
-
/************************************************************************
* The Radar regulation rules for each country
************************************************************************/
#include "device.h"
-
-
typedef struct tagSChannelTblElement {
u8 byChannelNumber;
unsigned int uFrequency;
bool bValid;
} SChannelTblElement, *PSChannelTblElement;
-
-
bool ChannelValid(unsigned int CountryCode, unsigned int ChannelNum);
void CHvInitChannelTable(struct vnt_private *pDevice);
/* static int msglevel =MSG_LEVEL_INFO; */
/* static int msglevel =MSG_LEVEL_DEBUG; */
-
-
-
-
void ControlvWriteByte(struct vnt_private *pDevice, u8 reg, u8 reg_off,
u8 data)
{
#include "device.h"
#include "usbpipe.h"
-
#define CONTROLnsRequestOut(Device, Request, Value, Index, Length, Buffer) \
PIPEnsControlOut(Device, Request, Value, Index, Length, Buffer)
#define CONTROLnsRequestIn(Device, Request, Value, Index, Length, Buffer) \
PIPEnsControlIn(Device, Request, Value, Index, Length, Buffer)
-
-
-
void ControlvWriteByte(struct vnt_private *pDevice, u8 reg, u8 reg_off,
u8 data);
void ControlvMaskByte(struct vnt_private *pDevice, u8 reg_type, u8 reg_off,
u8 reg_mask, u8 data);
-
#endif /* __CONTROL_H__ */
CCODE_MAX
} COUNTRY_CODE;
-
/************************************************************************
* Function prototype
************************************************************************/
#include "srom.h"
#include "rf.h"
-
-
-
-
-
-
-
-
/* static int msglevel = MSG_LEVEL_DEBUG; */
static int msglevel =MSG_LEVEL_INFO;
const u8 acbyIERate[MAX_RATE] =
#define AUTORATE_TXFAIL_CNT 0x0064
#define AUTORATE_TIMEOUT 10
-
void s_vResetCounter(PKnownNodeDB psNodeDBTable);
void s_vResetCounter(PKnownNodeDB psNodeDBTable)
}
}
-
-
-
/*+
*
* Routine Description:
#define AUTORATE_TXCNT_THRESHOLD 20
#define AUTORATE_INC_THRESHOLD 30
-
-
-
/*+
*
* Description:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Exit ParseMaxRate\n");
}
-
/*+
*
* Routine Description:
#ifndef __DATARATE_H__
#define __DATARATE_H__
-
-
#define FALLBACK_PKT_COLLECT_TR_H 50 /* pkts */
#define FALLBACK_PKT_COLLECT_TR_L 10 /* pkts */
#define FALLBACK_POLL_SECOND 5 /* 5 sec */
#define RATE_AUTO 12
#define MAX_RATE 12
-
-
-
-
-
-
-
-
void RATEvParseMaxRate(struct vnt_private *, PWLAN_IE_SUPP_RATES pItemRates,
PWLAN_IE_SUPP_RATES pItemExtRates, int bUpdateBasicRate,
u16 *pwMaxBasicRate, u16 *pwMaxSuppRate, u16 *pwSuppRate,
#include <linux/timer.h>
#include <linux/usb.h>
-
#ifdef SIOCETHTOOL
#define DEVICE_ETHTOOL_IOCTL_SUPPORT
#include <linux/ethtool.h>
#define ANT_RXA 2
#define ANT_RXB 3
-
#define MAXCHECKHANGCNT 4
/* Packet type */
#define PRIVATE_Message 0
-
#define DBG_PRT(l, p, args...) { if (l <= msglevel) printk(p, ##args); }
#define PRINT_K(p, args...) { if (PRIVATE_Message) printk(p, ##args); }
/* 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;
/* for device_set_media_duplex */
#define DEVICE_LINK_CHANGE 0x00000001UL
-
typedef struct __device_opt {
int nRxDescs0; /* number of RX descriptors 0 */
int nTxDescs0; /* number of TX descriptors 0, 1, 2, 3 */
u32 flags;
} OPTIONS, *POPTIONS;
-
struct vnt_private {
/* netdev */
struct usb_device *usb;
u32 cbFreeDFCB;
u32 uCurrentDFCBIdx;
-
/* USB */
struct urb *pControlURB;
struct urb *pInterruptURB;
/* default config from file by user setting */
DEFAULT_CONFIG config_file;
-
/* Statistic for USB */
unsigned long ulBulkInPosted;
unsigned long ulBulkInError;
unsigned long ulIntInContCRCError;
unsigned long ulIntInBytesRead;
-
/* Version control */
u16 wFirmwareVersion;
u8 byLocalID;
u8 byRFType;
u8 byBBRxConf;
-
u8 byZoneType;
int bZoneRegExist;
u8 byTopOFDMBasicRate;
u8 byTopCCKBasicRate;
-
u32 dwAotoRateTxOkCnt;
u32 dwAotoRateTxFailCnt;
u32 dwErrorRateThreshold[13];
SKeyManagement sKey;
u32 dwIVCounter;
-
RC4Ext SBox;
u8 abyPRNG[WLAN_WEPMAX_KEYLEN+3];
u8 byKeyIndex;
/* QoS */
int bGrpAckPolicy;
-
u8 byAutoFBCtrl;
int bTxMICFail;
int bRxMICFail;
-
/* For Update BaseBand VGA Gain Offset */
int bUpdateBBVGA;
u32 uBBVGADiffCount;
u8 byBBPreEDRSSI;
u8 byBBPreEDIndex;
-
int bRadioCmd;
u32 dwDiagRefCount;
SPMKID gsPMKID;
SPMKIDCandidateEvent gsPMKIDCandidate;
-
/* for 802.11h */
int b11hEnable;
};
-
-
-
#define EnqueueRCB(_Head, _Tail, _RCB) \
{ \
if (!_Head) { \
Head = RCB->Next; \
}
-
#define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) { \
if ((uVar) >= ((uModulo) - 1)) \
(uVar) = 0; \
(uVar)++; \
}
-
#define fMP_RESET_IN_PROGRESS 0x00000001
#define fMP_DISCONNECTED 0x00000002
#define fMP_HALT_IN_PROGRESS 0x00000004
#define MP_IS_READY(_M) (((_M)->Flags & \
(fMP_DISCONNECTED | fMP_RESET_IN_PROGRESS | fMP_HALT_IN_PROGRESS | fMP_INIT_IN_PROGRESS | fMP_SURPRISE_REMOVED)) == 0)
-
int device_alloc_frag_buf(struct vnt_private *, PSDeFragControlBlock pDeF);
#endif
#include "datarate.h"
#include "usbpipe.h"
-
-
//static int msglevel =MSG_LEVEL_DEBUG;
static int msglevel =MSG_LEVEL_INFO;
const u8 acbyRxRate[MAX_RATE] =
{2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108};
-
-
-
-
static u8 s_byGetRateIdx(u8 byRate);
static
u32 FrameSize, u8 *pbyRsr, int bOnFly, PSKeyItem pKey, u8 *pbyNewRsr,
s32 *pbExtIV, u16 *pwRxTSC15_0, u32 *pdwRxTSC47_16);
-
/*+
*
* Description:
struct ieee80211_hdr *pMACHeader;
int ii;
-
pMACHeader = (struct ieee80211_hdr *) (pbyRxBufferAddr + cbHeaderSize);
s_vGetDASA((u8 *)pMACHeader, &cbHeaderSize, &pDevice->sRxEthHeader);
*pcbHeadSize = cbHeaderSize;
}
-
-
-
static u8 s_byGetRateIdx(u8 byRate)
{
u8 byRateIdx;
return 0;
}
-
static
void
s_vGetDASA (
*pcbHeaderSize = cbHeaderSize;
}
-
int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB,
unsigned long BytesToIndicate)
{
struct ieee80211_hdr *pMACHeader;
int bRxeapol_key = false;
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---------- RXbBulkInProcessData---\n");
skb = pRCB->skb;
FrameSize
);
-
pMACHeader = (struct ieee80211_hdr *) pbyFrame;
//mike add: to judge if current AP is activated?
}
}
-
// Use for TKIP MIC
s_vGetDASA(pbyFrame, &cbHeaderSize, &pDevice->sRxEthHeader);
}
}
-
if (IS_FC_WEP(pbyFrame)) {
bool bRxDecryOK = false;
FrameSize -= 4; // 4 is ICV
}
-
//
// RX OK
//
}
}
-
// Data frame Handle
-
if (pDevice->bEnablePSMode) {
if (IS_FC_MOREDATA((pbyFrame))) {
if (*pbyRsr & RSR_ADDROK) {
}
*/
-
// -----------------------------------------------
if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->bEnable8021x == true)){
return false;
}
-
if ((pKey != NULL) && (pKey->byCipherSuite == KEY_CTL_TKIP)) {
if (bIsWEP) {
FrameSize -= 8; //MIC
u32 dwLocalMIC_L = 0;
u32 dwLocalMIC_R = 0;
-
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
dwMICKey0 = cpu_to_le32(*(u32 *)(&pKey->abyKey[24]));
dwMICKey1 = cpu_to_le32(*(u32 *)(&pKey->abyKey[28]));
pdwMIC_L = (u32 *)(skb->data + 8 + FrameSize);
pdwMIC_R = (u32 *)(skb->data + 8 + FrameSize + 4);
-
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");
}
} // ----- End of Reply Counter Check --------------------------
-
s_vProcessRxMACHeader(pDevice, (u8 *)(skb->data+8), FrameSize, bIsWEP, bExtIV, &cbHeaderOffset);
FrameSize -= cbHeaderOffset;
cbHeaderOffset += 8; // 8 is Rcv buffer header
struct ieee80211_hdr *p802_11Header;
CMD_STATUS Status;
-
if (IS_CTL_PSPOLL(pbyFrame) || !IS_TYPE_CONTROL(pbyFrame)) {
p802_11Header = (struct ieee80211_hdr *) (pbyFrame);
PSKeyItem pKey = NULL;
u8 byDecMode = KEY_CTL_WEP;
-
*pwRxTSC15_0 = 0;
*pdwRxTSC47_16 = 0;
byKeyIdx >>= 6;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\nKeyIdx: %d\n", byKeyIdx);
-
if (pMgmt->byCSSGK == KEY_CTL_TKIP)
byDecMode = KEY_CTL_TKIP;
else if (pMgmt->byCSSGK == KEY_CTL_CCMP)
u8 byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
u16 wAID;
-
if (FrameSize > CB_MAX_BUF_SIZE)
return false;
// check DA
return true;
}
-
-
-
void RXvWorkItem(struct vnt_private *pDevice)
{
int ntStatus;
}
-
void RXvFreeRCB(PRCB pRCB, int bReAllocSkb)
{
struct vnt_private *pDevice = pRCB->pDevice;
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->RXvFreeRCB\n");
ASSERT(!pRCB->Ref); // should be 0
EnqueueRCB(pDevice->FirstRecvFreeList, pDevice->LastRecvFreeList, pRCB);
pDevice->NumRecvFreeList++;
-
if ((pDevice->Flags & fMP_POST_READS) && MP_IS_READY(pDevice) &&
(pDevice->bIsRxWorkItemQueued == false) ) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"<----RXFreeRCB %d %d\n",pDevice->NumRecvFreeList, pDevice->NumRecvMngList);
}
-
void RXvMngWorkItem(struct vnt_private *pDevice)
{
PRCB pRCB = NULL;
}
-
#include "device.h"
#include "wcmd.h"
-
-
-
-
void RXvWorkItem(void *Context);
void RXvMngWorkItem(void *Context);
#include "control.h"
#include "rndis.h"
-
static int msglevel =MSG_LEVEL_INFO;
//static int msglevel =MSG_LEVEL_DEBUG;
#define FIRMWARE_CHUNK_SIZE 0x400
-
-
-
-
-
-
int FIRMWAREbDownload(struct vnt_private *pDevice)
{
struct device *dev = &pDevice->usb->dev;
u16 wLength;
int ii, rc;
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Download firmware\n");
spin_unlock_irq(&pDevice->lock);
}
}
-
int FIRMWAREbCheckVersion(struct vnt_private *pDevice)
{
int ntStatus;
#include "device.h"
-
-
-
-
int FIRMWAREbDownload(struct vnt_private *);
int FIRMWAREbBrach2Sram(struct vnt_private *);
int FIRMWAREbCheckVersion(struct vnt_private *);
return 0;
}
-
/*
* Description:
* Set enable/disable hostapd mode
return hostap_disable_hostapd(pDevice, rtnl_locked);
}
-
/*
* Description:
* remove station function supported for hostap daemon
{
unsigned int uNodeIndex;
-
if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &uNodeIndex)) {
BSSvRemoveOneNode(pDevice, uNodeIndex);
}
return 0;
}
-
/*
* Description:
* set station flag
return 0;
}
-
-
/*
* Description:
* set generic element (wpa ie)
{
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
-
-
memcpy( pMgmt->abyWPAIE,
param->u.generic_elem.data,
param->u.generic_elem.len
int bKeyTableFull = false;
u16 wKeyCtl = 0;
-
param->u.crypt.err = 0;
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");
KEY_CTL_WEP
) == true) {
-
pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true;
} else {
pMgmt->byCSSGK = KEY_CTL_CCMP;
}
-
if (iNodeIndex == 0) {
KeybSetDefaultKey( pDevice,
&(pDevice->sKey),
return ret;
}
-
-
/*
* Description:
* get each stations encryption key
int ii;
s32 iNodeIndex = 0;
-
param->u.crypt.err = 0;
if (is_broadcast_ether_addr(param->sta_addr)) {
return ret;
}
-
/*
* Description:
* vt6656_hostap_ioctl main function supported for hostap daemon.
goto out;
}
-
if ((ret == 0) && ap_ioctl) {
if (copy_to_user(p->pointer, param, p->length)) {
ret = -EFAULT;
#include "device.h"
-
#define WLAN_RATE_1M BIT0
#define WLAN_RATE_2M BIT1
#define WLAN_RATE_5M5 BIT2
#define WLAN_RATE_48M BIT10
#define WLAN_RATE_54M BIT11
-
-
-
-
#ifndef ETH_P_PAE
#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
#endif /* ETH_P_PAE */
static int msglevel = MSG_LEVEL_INFO; /* MSG_LEVEL_DEBUG */
-
-
-
-
-
/*+
*
* Function: InterruptPollingThread
} __attribute__ ((__packed__))
SINTData, *PSINTData;
-
-
-
void INTvWorkItem(struct vnt_private *);
void INTnsProcessData(struct vnt_private *);
#ifndef __IOCMD_H__
#define __IOCMD_H__
-
// ioctl Command code
#define MAGIC_CODE 0x3142
#define IOCTL_CMD_TEST (SIOCDEVPRIVATE + 0)
} __packed SBSSIDItem;
-
typedef struct tagSBSSIDList {
u32 uItem;
SBSSIDItem sBSSIDList[0];
} __packed SBSSIDList, *PSBSSIDList;
-
typedef struct tagSNodeItem {
// STA info
u16 wAID;
} __packed SNodeItem;
-
typedef struct tagSNodeList {
u32 uItem;
} __packed SNodeList, *PSNodeList;
-
typedef struct tagSCmdLinkStatus {
bool bLink;
u32 FCSErrorCount;
} __packed SDot11MIBCount, *PSDot11MIBCount;
-
-
//
// statistic counter
//
} u;
} __packed;
-
-
-
-
#endif /* __IOCMD_H__ */
#ifndef __IOWPA_H__
#define __IOWPA_H__
-
#define WPA_IE_LEN 64
//WPA related
VIAWGET_SET_DISASSOCIATE = 10
};
-
enum {
VIAWGET_ASSOC_MSG = 1,
VIAWGET_DISASSOC_MSG = 2,
VIAWGET_DEVICECLOSE_MSG = 6
};
-
-
typedef struct viawget_wpa_header {
u8 type;
u16 req_ie_len;
int maxrate;
} __packed;
-
-
-
-
#endif /* __IOWPA_H__ */
#include "control.h"
#include "rndis.h"
-
static const long frequency_list[] = {
2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472, 2484,
4915, 4920, 4925, 4935, 4940, 4945, 4960, 4980,
if (pMgmt == NULL)
return -EFAULT;
-
#ifdef WEXT_USECHANNELS
wrq->m = (int)pMgmt->uCurrChannel;
wrq->e = 0;
pDevice->bCommit = false;
}
-
return rc;
}
#include "device.h"
-
-
-
-
struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev);
int iwctl_siwap(struct net_device *dev, struct iw_request_info *info,
#include "rndis.h"
#include "control.h"
-
-
static int msglevel =MSG_LEVEL_INFO;
//static int msglevel =MSG_LEVEL_DEBUG;
-
-
-
-
static void s_vCheckKeyTableValid(struct vnt_private *pDevice,
PSKeyManagement pTable)
{
}
-
-
-
/*
* Description: Init Key management table
*
return;
}
-
/*
* Description: Get Key from table
*
return (false);
}
-
/*
* Description: Set Key to table
*
return (false);
}
-
/*
* Description: Remove Key from table
*
s_vCheckKeyTableValid(pDevice,pTable);
return bReturnValue;
-
}
-
/*
* Description: Remove Key from table
*
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n");
-
return (true);
}
else {
else
pKey->KeyRSC = *KeyRSC;
-
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: %X\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;
SKeyTable KeyTable[MAX_KEY_TABLE];
} SKeyManagement, *PSKeyManagement;
-
-
-
-
-
void KeyvInitTable(struct vnt_private *, PSKeyManagement pTable);
int KeybGetKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyIndex,
//static int msglevel =MSG_LEVEL_DEBUG;
static int msglevel =MSG_LEVEL_INFO;
-
-
-
-
/*
* Description:
* Write MAC Multicast Address Mask
&byData1);
}
-
/*
* Description:
* Shut Down MAC
{
u8 pbyData[2];
-
pbyData[0] = byType;
pbyData[1] = EnCFG_BBType_MASK;
u16 wOffset;
u8 byData;
-
byData = (u8) uEntryIdx;
wOffset = MISCFIFO_KEYETRY0;
);
}
-
/*
* Description:
* Set the Key by MISCFIFO
pbyData
);
-
}
-
void MACvRegBitsOff(struct vnt_private *pDevice, u8 byRegOfs, u8 byBits)
{
u8 pbyData[2];
);
}
-
void MACvRegBitsOn(struct vnt_private *pDevice, u8 byRegOfs, u8 byBits)
{
u8 pbyData[2];
-
pbyData[0] = byBits;
pbyData[1] = byBits;
{
u8 pbyData[2];
-
pbyData[0] = (u8)(wData & 0xff);
pbyData[1] = (u8)(wData >> 8);
{
u8 pbyData[6];
-
pbyData[0] = *((u8 *)pbyEtherAddr);
pbyData[1] = *((u8 *)pbyEtherAddr+1);
pbyData[2] = *((u8 *)pbyEtherAddr+2);
{
u8 pbyData[2];
-
pbyData[0] = EnCFG_ProtectMd;
pbyData[1] = EnCFG_ProtectMd;
{
u8 pbyData[2];
-
pbyData[0] = 0;
pbyData[1] = EnCFG_ProtectMd;
{
u8 pbyData[2];
-
pbyData[0] = EnCFG_BarkerPream;
pbyData[1] = EnCFG_BarkerPream;
{
u8 pbyData[2];
-
pbyData[0] = 0;
pbyData[1] = EnCFG_BarkerPream;
);
}
-
void MACvWriteBeaconInterval(struct vnt_private *pDevice, u16 wInterval)
{
u8 pbyData[2];
#include "device.h"
#include "tmacro.h"
-
#define REV_ID_VT3253_A0 0x00
#define REV_ID_VT3253_A1 0x01
#define REV_ID_VT3253_B0 0x08
#define MAC_REG_RSPINF_A_54 0xFA
#define MAC_REG_RSPINF_A_72 0xFC
-
//
// Bits in the I2MCFG EEPROM register
//
#define TCR_SYNCDCFOPT 0x02 //
#define TCR_AUTOBCNTX 0x01 // Beacon automatically transmit enable
-
//ISR1
#define ISR_GPIO3 0x40
#define ISR_RXNOBUF 0x08
//
#define MISCFFCTL_WRITE 0x0001 //
-
// Loopback mode
#define MAC_LB_EXT 0x02 //
#define MAC_LB_INTERNAL 0x01 //
#define MAC_REVISION_A0 0x00
#define MAC_REVISION_A1 0x01
-
-
-
-
-
-
void MACvWriteMultiAddr(struct vnt_private *, u32, u8);
void MACbShutdown(struct vnt_private *);
void MACvSetBBType(struct vnt_private *, u8);
#define RX_DESC_DEF0 64
DEVICE_PARAM(RxDescriptors0,"Number of receive usb desc buffer");
-
#define TX_DESC_DEF0 64
DEVICE_PARAM(TxDescriptors0,"Number of transmit usb desc buffer");
#define CHANNEL_DEF 6
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
#define FRAG_THRESH_DEF 2346
DEVICE_PARAM(FragThreshold, "Fragmentation threshold");
-
#define DATA_RATE_DEF 13
/* datarate[] index
0: indicate 1 Mbps 0x02
2: indicate AP mode used
*/
-
/* PSMode[]
0: indicate disable power saving mode
1: indicate enable power saving mode
#define PS_MODE_DEF 0
DEVICE_PARAM(PSMode, "Power saving mode");
-
#define SHORT_RETRY_DEF 8
DEVICE_PARAM(ShortRetryLimit, "Short frame retry limits");
#define BBP_TYPE_DEF 2
DEVICE_PARAM(BasebandType, "baseband type");
-
-
/* 80211hEnable[]
0: indicate disable 802.11h
1: indicate enable 802.11h
DEVICE_PARAM(b80211hEnable, "802.11h mode");
-
/*
* Static vars definitions
*/
5700, 5745, 5765, 5785, 5805, 5825
};
-
static const struct iw_handler_def iwctl_handler_def;
*/
-
static int vt6656_probe(struct usb_interface *intf,
const struct usb_device_id *id);
static void vt6656_disconnect(struct usb_interface *intf);
unsigned char *dest,
unsigned char *source);
-
static void usb_device_reset(struct vnt_private *pDevice);
-
-
-
-
-
static void
device_set_options(struct vnt_private *pDevice) {
pDevice->bDiversityRegCtlON = false;
}
-
static void device_init_diversity_timer(struct vnt_private *pDevice)
{
init_timer(&pDevice->TimerSQ3Tmax1);
return;
}
-
/*
* initialization of MAC & BBP registers
*/
return;
}
-
static void device_free_rx_bufs(struct vnt_private *pDevice)
{
PRCB pRCB;
return;
}
-
static bool device_alloc_bufs(struct vnt_private *pDevice)
{
PRCB pRCB;
int ii;
-
for (ii = 0; ii < pDevice->cbTD; ii++) {
pTxContext = kmalloc(sizeof(USB_SEND_CONTEXT), GFP_KERNEL);
goto free_tx;
}
-
pDevice->FirstRecvFreeList = NULL;
pDevice->LastRecvFreeList = NULL;
pDevice->FirstRecvMngList = NULL;
pRCB++;
}
-
pDevice->pControlURB = usb_alloc_urb(0, GFP_ATOMIC);
if (pDevice->pControlURB == NULL) {
DBG_PRT(MSG_LEVEL_ERR,KERN_ERR"Failed to alloc control urb\n");
return false;
}
-
-
-
static bool device_init_defrag_cb(struct vnt_private *pDevice)
{
int i;
return false;
}
-
-
static void device_free_frag_bufs(struct vnt_private *pDevice)
{
PSDeFragControlBlock pDeF;
}
}
-
-
int device_alloc_frag_buf(struct vnt_private *pDevice,
PSDeFragControlBlock pDeF)
{
return true;
}
-
-
static int device_open(struct net_device *dev)
{
struct vnt_private *pDevice = netdev_priv(dev);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " device_open...\n");
-
pDevice->rx_buf_sz = MAX_TOTAL_SIZE_WITH_ALL_HEADERS;
if (device_alloc_bufs(pDevice) == false) {
else
bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL);
-
netif_stop_queue(pDevice->dev);
pDevice->flags |= DEVICE_FLAGS_OPENED;
return -ENOMEM;
}
-
-
static int device_close(struct net_device *dev)
{
struct vnt_private *pDevice = netdev_priv(dev);
mdelay(30);
}
-
memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
pMgmt->bShareKeyAlgorithm = false;
pDevice->bEncryptionEnable = false;
if (!device)
return;
-
usb_set_intfdata(intf, NULL);
usb_put_dev(interface_to_usbdev(intf));
u8 byTmpMode = 0;
int rc;
-
spin_lock_irq(&pDevice->lock);
rc = CONTROLnsRequestIn(pDevice,
MESSAGE_TYPE_READ,
return rc;
}
-
static int ethtool_ioctl(struct net_device *dev, void *useraddr)
{
u32 ethcmd;
static int msglevel =MSG_LEVEL_INFO;
-
-
-
-
/*
* Description: Update Isr Statistic Counter
*
return;
}
-
if (byIsr0 & ISR_ACTX) // ISR, bit0
pStatistic->ISRStat.dwIsrTx0OK++; // TXDMA0 successful
if (byIsr0 & ISR_WATCHDOG) // ISR, bit7
pStatistic->ISRStat.dwIsrWatchDog++;
-
if (byIsr1 & ISR_FETALERR) // ISR, bit8
pStatistic->ISRStat.dwIsrUnrecoverableError++;
}
-
/*
* Description: Update Rx Statistic Counter
*
pStatistic->dwRsrRxPacket++;
pStatistic->dwRsrRxOctet += cbFrameLength;
-
if (IS_TYPE_DATA(pbyBuffer)) {
pStatistic->dwRsrRxData++;
} else if (IS_TYPE_MGMT(pbyBuffer)){
}
}
-
-
/*
* Description: Update 802.11 mib counter
*
#include "tether.h"
#include "desc.h"
-
-
//
// USB counter
//
} SUSBCounter, *PSUSBCounter;
-
-
//
// 802.11 counter
//
-
typedef struct tagSDot11Counters {
/* unsigned long Length; // Length of structure */
unsigned long long TransmittedFragmentCount;
*/
} SDot11Counters, *PSDot11Counters;
-
//
// MIB2 counter
//
#define DOWN 2 //
#define TESTING 3 //
-
//
// RMON counter
//
} SCustomCounters, *PSCustomCounters;
-
//
// Custom counter
//
/////////////////////////////////////
} SISRCounters, *PSISRCounters;
-
// Value in the etherStatsStatus entry
#define VALID 1 //
#define CREATE_REQUEST 2 //
#define UNDER_CREATION 3 //
#define INVALID 4 //
-
//
// Tx packet information
//
u8 abyDestAddr[ETH_ALEN];
} STxPktInfo, *PSTxPktInfo;
-
#define MAX_RATE 12
//
// statistic counter
u8 abyCntRxPattern[16];
u8 abyCntTxPattern[16];
-
-
// Software check....
u32 dwCntRxDataErr; // rx buffer data software compare CRC err count
u32 dwCntDecryptErr; // rx buffer data software compare CRC err count
u32 dwCntRxICVErr; // rx buffer data software compare CRC err count
-
// 64-bit OID
unsigned long long ullTsrOK;
} SStatCounter, *PSStatCounter;
-
-
-
void STAvUpdateIsrStatCounter(PSStatCounter pStatistic,
u8 byIsr0,
u8 byIsr1);
#include "tmacro.h"
#include "michael.h"
-
-
/*
* static u32 s_dwGetUINT32(u8 * p); Get u32 from
* 4 bytes LSByte first
static u32 M; /* Message accumulator (single word) */
static unsigned int nBytesInM; /* # bytes in M */
-
/*
static u32 s_dwGetUINT32 (u8 * p)
// Convert from u8[] to u32 in a portable way
s_vSetKey(dwK0, dwK1);
}
-
void MIC_vUnInit(void)
{
/* Wipe the key material */
#include <linux/types.h>
-
-
void MIC_vInit(u32 dwK0, u32 dwK1);
void MIC_vUnInit(void);
// This also resets the message to empty.
void MIC_vGetMIC(u32 * pdwL, u32 * pdwR);
-
// Rotation functions on 32 bit values
#define ROL32(A, n) \
(((A) << (n)) | (((A)>>(32-(n))) & ((1UL << (n)) - 1)))
#include "control.h"
#include "rndis.h"
-
-
static int msglevel = MSG_LEVEL_INFO;
-
-
/*
*
* Routine Description:
#ifndef __POWER_H__
#define __POWER_H__
-
#define C_PWBT 1000 // micro sec. power up before TBTT
#define PS_FAST_INTERVAL 1 // Fast power saving listen interval
#define PS_MAX_INTERVAL 4 // MAX power saving listen interval
-
-
-
-
-
-
/* PSDevice pDevice */
/* PSDevice hDeviceContext */
#define VT3342_PWR_IDX_LEN 64
//}}
-
-
-
-
-
u8 abyAL2230InitTable[CB_AL2230_INIT_SEQ][3] = {
{0x03, 0xF7, 0x90},
{0x03, 0x33, 0x31},
{0x02, 0x01, 0xAA} //RobertYu:20060523
};
-
u8 abyVT3226_ChannelTable0[CB_MAX_CHANNEL_24G][3] = {
{0x01, 0x97, 0x83}, // channel = 1, Tf = 2412MHz
{0x01, 0x97, 0x83}, // channel = 2, Tf = 2417MHz
};
///}}RobertYu
-
//{{RobertYu:20060502, TWIF 1.14, LO Current for 11b mode
u32 dwVT3226D0LoCurrentTable[CB_MAX_CHANNEL_24G] = {
0x0135C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz
};
//}}
-
//{{RobertYu:20060609
u8 abyVT3342A0_InitTable[CB_VT3342_INIT_SEQ][3] = { /* 11b/g mode */
{0x03, 0xFF, 0x80}, //update for mode//
{0x03, 0x00, 0x04} // channel = 165, Tf = 5825MHz (56), TBD
};
-
/*+
*
* Power Table
0x0407F900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW
};
-
-
//{{ RobertYu:20050103, Channel 11a Number To Index
// 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22)
// 5G => Ch 7, 8, 9, 11, 12, 16, 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64,
};
//}} RobertYu
-
/*
* Description: Write to IF/RF, by embedded programming
*
CONTROLnsRequestOut(pDevice,
MESSAGE_TYPE_WRITE_IFRF, 0, 0, 4, pbyData);
-
return true;
}
-
/*
* Description: Set Tx power
*
return bResult;
}
-
/*
* Description: Set Tx power
*
}
break;
-
case RF_AIROHA7230:
{
u32 dwMax7230Pwr;
*pldBm = -1 * (a + b * 2);
}
-
-
void RFbRFTableDownload(struct vnt_private *pDevice)
{
u16 wLength1 = 0, wLength2 = 0, wLength3 = 0;
#define RF_EMU 0x80
#define RF_MASK 0x7F
-
-
-
extern const u8 RFaby11aChannelIndex[200];
int IFRFbWriteEmbedded(struct vnt_private *, u32 dwData);
*
*/
-
#ifndef __RNDIS_H__
#define __RNDIS_H__
#define MESSAGE_REQUEST_RF_CH1 0x0C
#define MESSAGE_REQUEST_RF_CH2 0x0D
-
#define VIAUSB20_PACKET_HEADER 0x04
-
-
typedef struct _CMD_MESSAGE
{
u8 byData[256];
u16 wRSPINF_a[9];
} CMD_CHANGE_BBTYPE, *PCMD_CHANGE_BBTYPE;
-
#define EXCH_WORD(w) ((u16)((u16)(w)<<8) | (u16)((u16)(w)>>8))
-
-
#endif /* _RNDIS_H_ */
#include "usbpipe.h"
#include "iocmd.h"
-
-
static int msglevel = MSG_LEVEL_INFO;
-
-
const u16 wTimeStampOff[2][MAX_RATE] = {
{384, 288, 226, 209, 54, 43, 37, 31, 28, 25, 24, 23}, // Long Preamble
{384, 192, 130, 113, 54, 43, 37, 31, 28, 25, 24, 23}, // Short Preamble
{RATE_6M , RATE_6M, RATE_12M, RATE_12M, RATE_18M}, // fallback_rate1
};
-
#define RTSDUR_BB 0
#define RTSDUR_BA 1
#define RTSDUR_AA 2
#define DATADUR_A_F0 12
#define DATADUR_A_F1 13
-
static void s_vSaveTxPktInfo(struct vnt_private *pDevice, u8 byPktNum,
u8 *pbyDestAddr, u16 wPktLength, u16 wFIFOCtl);
u32 uDMAIdx, int bNeedAck, u32 uFragIdx, u32 cbLastFragmentSize,
u32 uMACfragNum, u8 byFBOption);
-
static void s_vGenerateMACHeader(struct vnt_private *pDevice,
u8 *pbyBufferAddr, u16 wDuration, struct ethhdr *psEthHeader,
int bNeedEncrypt, u16 wFragType, u32 uDMAIdx, u32 uFragIdx);
u8 byDurType, u32 cbFrameLength, u8 byPktType, u16 wRate,
int bNeedAck, u8 byFBOption);
-
-
static void *s_vGetFreeContext(struct vnt_private *pDevice)
{
PUSB_SEND_CONTEXT pContext = NULL;
return (void *) pReturnContext;
}
-
static void s_vSaveTxPktInfo(struct vnt_private *pDevice, u8 byPktNum,
u8 *pbyDestAddr, u16 wPktLength, u16 wFIFOCtl)
{
struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *)pbyHdrBuf;
u32 dwRevIVCounter;
-
//Fill TXKEY
if (pTransmitKey == NULL)
return;
}
}
-
static void s_vSWencryption(struct vnt_private *pDevice,
PSKeyItem pTransmitKey, u8 *pbyPayloadHead, u16 wPayloadSize)
{
}
}
-
-
-
/*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);
}
break;
-
case DATADUR_A: //DATADUR_A
if (((uMACfragNum==1)) || (bLastFrag==1)) {//Non Frag or Last Frag
if(bNeedAck){
return 0;
}
-
//byFreqType: 0=>5GHZ 1=>2.4GHZ
static u32 s_uGetRTSCTSDuration(struct vnt_private *pDevice, u8 byDurType,
u32 cbFrameLength, u8 byPktType, u16 wRate, int bNeedAck,
{
u32 uCTSTime = 0, uDurTime = 0;
-
switch (byDurType) {
case RTSDUR_BB: //RTSDuration_bb
}
}
-
if ((bNeedEncryption) && (pTransmitKey != NULL)) {
if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) {
cbIVlen = 4;
pbyIVHead = (u8 *)(pbyMacHdr + cbMACHdLen + uPadding);
pbyPayloadHead = (u8 *)(pbyMacHdr + cbMACHdLen + uPadding + cbIVlen);
-
//=========================
// No Fragmentation
//=========================
//uDMAIdx = TYPE_AC0DMA;
//pTxBufHead = (PSTxBufHead) &(pTxBufHead->adwTxKey[0]);
-
//Fill FIFO,RrvTime,RTS,and CTS
s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate,
(void *)pbyTxBufferAddr, pvRrvTime, pvRTS, pvCTS,
}
-
if (pPacket != NULL) {
// Copy the Packet into a tx Buffer
memcpy((pbyPayloadHead + cb802_1_H_len),
//DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC:%lX, %lX\n", *pdwMIC_L, *pdwMIC_R);
}
-
if (bSoftWEP == true) {
s_vSWencryption(pDevice, pTransmitKey, (pbyPayloadHead), (u16)(cbFrameBodySize + cbMIClen));
*pcbHeaderLen = cbHeaderLength;
*pcbTotalLen = cbHeaderLength + cbFrameSize ;
-
//Set FragCtl in TxBufferHead
pTxBufHead->wFragCtl |= (u16)byFragType;
-
return true;
}
-
/*+
*
* Description:
}
}
-
-
/*+
*
* Description:
u32 cbMacHdLen;
u16 wCurrentRate = RATE_1M;
-
-
pContext = (PUSB_SEND_CONTEXT)s_vGetFreeContext(pDevice);
if (NULL == pContext) {
}
pDevice->wCurrentRate = wCurrentRate;
-
//Set packet type
if (byPktType == PK_TYPE_11A) {//0000 0000 0000 0000
pTxBufHead->wFIFOCtl = 0;
//=========================
pTxBufHead->wFragCtl |= (u16)FRAGCTL_NONFRAG;
-
//Fill FIFO,RrvTime,RTS,and CTS
s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate, pbyTxBufferAddr, pvRrvTime, pvRTS, pCTS,
cbFrameSize, bNeedACK, TYPE_TXDMA0, &sEthHeader);
}
}
-
pTX_Buffer->wTxByteCount = cpu_to_le16((u16)(cbReqCount));
pTX_Buffer->byPKTNO = (u8) (((wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F));
pTX_Buffer->byType = 0x00;
return CMD_STATUS_PENDING;
}
-
CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice,
struct vnt_tx_mgmt *pPacket)
{
PUSB_SEND_CONTEXT pContext;
CMD_STATUS status;
-
pContext = (PUSB_SEND_CONTEXT)s_vGetFreeContext(pDevice);
if (NULL == pContext) {
status = CMD_STATUS_RESOURCES;
}
-
void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb)
{
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
PTX_BUFFER pTX_Buffer;
PUSB_SEND_CONTEXT pContext;
-
pvRrvTime = pMICHDR = pvRTS = pvCTS = pvTxDataHd = NULL;
if(skb->len <= WLAN_HDR_ADDR3_LEN) {
}
}
-
//Set FRAGCTL_MACHDCNT
pTxBufHead->wFragCtl |= cpu_to_le16((u16)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 |= (u16)FRAGCTL_NONFRAG;
-
//Fill FIFO,RrvTime,RTS,and CTS
s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate, pbyTxBufferAddr, pvRrvTime, pvRTS, pvCTS,
cbFrameSize, bNeedACK, TYPE_TXDMA0, &sEthHeader);
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.
}
-
-
-
//TYPE_AC0DMA data tx
/*
* Description:
u16 wKeepRate = pDevice->wCurrentRate;
int bTxeapol_key = false;
-
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
if (pDevice->uAssocCount == 0) {
}
-
-
/*
* Description:
* Relay packet send (AC1DMA) from rx dpc.
u32 status;
u16 wKeepRate = pDevice->wCurrentRate;
-
-
pContext = (PUSB_SEND_CONTEXT)s_vGetFreeContext(pDevice);
if (NULL == pContext) {
#include "device.h"
#include "wcmd.h"
-
-
//
// RTS buffer header
//
u32 adwHDR2[4];
} SMICHDR, *PSMICHDR;
-
typedef struct tagSTX_NAF_G_RTS
{
//RsvTime
} TX_NAF_G_CTS, *PTX_NAF_G_CTS;
-
typedef struct tagSTX_NAF_G_CTS_MIC
{
//RsvTime
u16 wTxRrvTime_b;
u16 wTxRrvTime_a;
-
SMICHDR sMICHDR;
//CTS
} TX_NAF_G_CTS_MIC, *PTX_NAF_G_CTS_MIC;
-
typedef struct tagSTX_NAF_G_BEACON
{
u16 wFIFOCtl;
u16 wDuration_a;
u16 wTimeStampOff_a;
-
} TX_NAF_G_BEACON, *PTX_NAF_G_BEACON;
-
typedef struct tagSTX_NAF_AB_RTS
{
//RsvTime
u16 wDuration_ab;
u16 wTimeStampOff_ab;
-
} TX_NAF_AB_RTS, *PTX_NAF_AB_RTS;
-
typedef struct tagSTX_NAF_AB_RTS_MIC
{
//RsvTime
u16 wDuration_ab;
u16 wTimeStampOff_ab;
-
} TX_NAF_AB_RTS_MIC, *PTX_NAF_AB_RTS_MIC;
-
-
typedef struct tagSTX_NAF_AB_CTS
{
//RsvTime
} TX_NAF_AB_CTS_MIC, *PTX_NAF_AB_CTS_MIC;
-
typedef struct tagSTX_NAF_AB_BEACON
{
u16 wFIFOCtl;
} TX_AF_G_RTS, *PTX_AF_G_RTS;
-
typedef struct tagSTX_AF_G_RTS_MIC
{
//RsvTime
} TX_AF_G_RTS_MIC, *PTX_AF_G_RTS_MIC;
-
-
typedef struct tagSTX_AF_G_CTS
{
//RsvTime
} TX_AF_G_CTS, *PTX_AF_G_CTS;
-
typedef struct tagSTX_AF_G_CTS_MIC
{
//RsvTime
u16 wTxRrvTime_b;
u16 wTxRrvTime_a;
-
SMICHDR sMICHDR;
//CTS
} TX_AF_G_CTS_MIC, *PTX_AF_G_CTS_MIC;
-
-
typedef struct tagSTX_AF_A_RTS
{
//RsvTime
} TX_AF_A_RTS, *PTX_AF_A_RTS;
-
typedef struct tagSTX_AF_A_RTS_MIC
{
//RsvTime
} TX_AF_A_RTS_MIC, *PTX_AF_A_RTS_MIC;
-
-
typedef struct tagSTX_AF_A_CTS
{
//RsvTime
} TX_AF_A_CTS, *PTX_AF_A_CTS;
-
typedef struct tagSTX_AF_A_CTS_MIC
{
//RsvTime
} TX_AF_A_CTS_MIC, *PTX_AF_A_CTS_MIC;
-
//
// union with all of the TX Buffer Type
//
} TX_BUFFER_CONTAINER, *PTX_BUFFER_CONTAINER;
-
//
// Remote NDIS message format
//
u16 wFragCtl;
u16 wReserved;
-
// Actual message
TX_BUFFER_CONTAINER BufferHeader;
} TX_BUFFER, *PTX_BUFFER;
-
//
// Remote NDIS message format
//
} BEACON_BUFFER, *PBEACON_BUFFER;
-
-
-
void vDMA0_tx_80211(struct vnt_private *, struct sk_buff *skb);
int nsDMA_tx_packet(struct vnt_private *, u32 uDMAIdx, struct sk_buff *skb);
CMD_STATUS csMgmt_xmit(struct vnt_private *, struct vnt_tx_mgmt *);
#ifndef __SROM_H__
#define __SROM_H__
-
#define EEP_MAX_CONTEXT_SIZE 256
#define CB_EEPROM_READBYTE_WAIT 900 //us
#define EEP_OFS_SETPT_CCK 0x21
#define EEP_OFS_PWR_OFDMG 0x23
-
#define EEP_OFS_CALIB_TX_IQ 0x24
#define EEP_OFS_CALIB_TX_DC 0x25
#define EEP_OFS_CALIB_RX_IQ 0x26
//
#define EEP_RADIOCTL_ENABLE 0x80
-
// AT24C02 eeprom contents
// 2048 bits = 256 bytes = 128 words
//
u8 abyCIS[128]; // 0x80 (u16)
} SSromReg, *PSSromReg;
-
-
-
-
#endif /* __EEPROM_H__ */
#include "tcrc.h"
-
-
-
/* 32-bit CRC table */
static const u32 s_adwCrc32Table[256] = {
0x00000000L, 0x77073096L, 0xEE0E612CL, 0x990951BAL,
0xB40BBE37L, 0xC30C8EA1L, 0x5A05DF1BL, 0x2D02EF8DL
};
-
-
-
-
-
/*+
*
* Description:
return dwCrc;
}
-
/*+
*
* Description:
return ~CRCdwCrc32(pbyData, cbByte, 0xFFFFFFFFL);
}
-
/*+
*
* Description:
return CRCdwCrc32(pbyData, cbByte, dwPreCRC);
}
-
#include <linux/types.h>
-
-
-
-
-
-
u32 CRCdwCrc32(u8 * pbyData, unsigned int cbByte, u32 dwCrcSeed);
u32 CRCdwGetCrc32(u8 * pbyData, unsigned int cbByte);
u32 CRCdwGetCrc32Ex(u8 * pbyData, unsigned int cbByte, u32 dwPreCRC);
#include "tcrc.h"
#include "tether.h"
-
-
-
-
-
/*
* Description: Check CRC value of the buffer if Ok or not
*
#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__))
S802_3Header, *PS802_3Header;
-
-
-
-
//u8 ETHbyGetHashIndexByCrc(u8 * pbyMultiAddr);
bool ETHbIsBufferCrc32Ok(u8 * pbyBuffer, unsigned int cbFrameLength);
#include "tmacro.h"
#include "tkip.h"
-
-
-
-
-
-
-
-
/* The Sbox is reduced to 2 16-bit wide tables, each with 256 entries. */
/* The 2nd table is the same as the 1st but with the upper and lower */
/* bytes swapped. To allow an endian tolerant implementation, the byte */
0x82,0x29,0x5A,0x1E,0x7B,0xA8,0x6D,0x2C
};
-
//STKIPKeyManagement sTKIPKeyTable[MAX_TKIP_KEY];
-
-
/************************************************************/
/* tkip_sbox() */
/* Returns a 16 bit value from a 64K entry table. The Table */
return (left ^ right);
};
-
static unsigned int rotr1(unsigned int a)
{
unsigned int b;
return b;
}
-
/*
* Description: Calculate RC4Key fom TK, TA, and TSC
*
#define TKIP_KEY_LEN 16
-
-
-
-
-
void TKIPvMixKey(
u8 * pbyTKey,
u8 * pbyTA,
//static int msglevel =MSG_LEVEL_DEBUG;
static int msglevel =MSG_LEVEL_INFO;
-
#define USB_CTL_WAIT 500 //ms
#ifndef URB_ASYNC_UNLINK
#define URB_ASYNC_UNLINK 0
#endif
-
-
static void s_nsInterruptUsbIoCompleteRead(struct urb *urb);
static void s_nsBulkInUsbIoCompleteRead(struct urb *urb);
static void s_nsBulkOutIoCompleteWrite(struct urb *urb);
static void s_nsControlInUsbIoCompleteRead(struct urb *urb);
static void s_nsControlInUsbIoCompleteWrite(struct urb *urb);
-
-
int PIPEnsControlOutAsyn(struct vnt_private *pDevice, u8 byRequest,
u16 wValue, u16 wIndex, u16 wLength, u8 *pbyBuffer)
{
MP_CLEAR_FLAG(pDevice, fMP_CONTROL_WRITES);
}
-
-
/*
* Description:
* Complete function of usb Control callback
MP_CLEAR_FLAG(pDevice, fMP_CONTROL_READS);
}
-
-
-
/*
* Description:
* Allocates an usb interrupt in irp and calls USBD.
return ntStatus;
}
-
/*
* Description:
* Complete function of usb interrupt in irp.
STAvUpdateUSBCounter(&pDevice->scStatistic.USB_InterruptStat, ntStatus);
-
if (pDevice->fKillEventPollingThread != true) {
usb_fill_bulk_urb(pDevice->pInterruptURB,
pDevice->usb,
int ntStatus = 0;
struct urb *pUrb;
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsStartBulkInUsbRead\n");
if (pDevice->Flags & fMP_DISCONNECTED)
pDevice->ulBulkInPosted++;
-
pUrb = pRCB->pUrb;
//
// Now that we have created the urb, we will send a
return ntStatus;
}
-
-
-
/*
* Description:
* Complete function of usb BulkIn irp.
pDevice->scStatistic.RxOkCnt ++;
}
-
STAvUpdateUSBCounter(&pDevice->scStatistic.USB_BulkInStat, status);
if (bIndicateReceive) {
spin_unlock(&pDevice->lock);
}
-
return;
}
int status;
struct urb *pUrb;
-
-
pDevice->bPWBitOn = false;
/*
unsigned long ulBufLen;
PUSB_SEND_CONTEXT pContext;
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsBulkOutIoCompleteWrite\n");
//
// The context given to IoSetCompletionRoutine is an USB_CONTEXT struct
pDevice->dev->trans_start = jiffies;
-
if (status == STATUS_SUCCESS) {
pDevice->packetsSent++;
}
#include "device.h"
-
-
-
-
int PIPEnsControlOut(struct vnt_private *, u8 byRequest, u16 wValue,
u16 wIndex, u16 wLength, u8 *pbyBuffer);
int PIPEnsControlOutAsyn(struct vnt_private *, u8 byRequest,
#include "channel.h"
#include "iowpa.h"
-
-
-
-
-
static int msglevel =MSG_LEVEL_INFO;
//static int msglevel =MSG_LEVEL_DEBUG;
struct vnt_manager *pMgmt, u8 *pScanBSSID, PWLAN_IE_SSID pSSID,
PWLAN_IE_SUPP_RATES pCurrRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates);
-
static int s_bCommandComplete(struct vnt_private *);
-
static int s_bClearBSSID_SCAN(struct vnt_private *);
-
-
/*
* Description:
* Stop AdHoc beacon during scan process
} /* vAdHocBeaconStop */
-
/*
* Description:
* Restart AdHoc beacon after scan process complete
}
-
/*+
*
* Routine Description:
u8 *pbyRate;
int ii;
-
if (pDevice->byBBType == BB_TYPE_11A) {
pbyRate = &abyCurrSuppRatesA[0];
} else if (pDevice->byBBType == BB_TYPE_11B) {
}
-
-
-
/*+
*
* Routine Description:
*
-*/
-
struct vnt_tx_mgmt *s_MgrMakeProbeRequest(struct vnt_private *pDevice,
struct vnt_manager *pMgmt, u8 *pScanBSSID, PWLAN_IE_SSID pSSID,
PWLAN_IE_SUPP_RATES pCurrRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates)
struct vnt_tx_mgmt *pTxPacket = NULL;
WLAN_FR_PROBEREQ sFrame;
-
pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt)
+ WLAN_PROBEREQ_FR_MAXLEN);
u8 byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
u8 byData;
-
if (pDevice->dwDiagRefCount != 0)
return;
if (pDevice->bCmdRunning != true)
s_bCommandComplete(pDevice);
break;
-
case WLAN_CMD_SSID_START:
pDevice->byReAssocCount = 0;
s_bCommandComplete(pDevice);
break;
-
case WLAN_CMD_CHANGE_BBSENSITIVITY_START:
pDevice->bStopDataPkt = true;
s_bCommandComplete(pDevice);
break;
-
case WLAN_CMD_MAC_DISPOWERSAVING_START:
ControlvReadByte (pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PSCTL, &byData);
if ( (byData & PSCTL_PS) != 0 ) {
return;
}
-
static int s_bCommandComplete(struct vnt_private *pDevice)
{
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
int bRadioCmd = false;
int bForceSCAN = true;
-
pDevice->eCommandState = WLAN_CMD_IDLE;
if (pDevice->cbFreeCmdQueue == CMD_Q_SIZE) {
//Command Queue Empty
return true;
}
-
//mike add:reset command timer
void vResetCommandTimer(struct vnt_private *pDevice)
{
#include "80211hdr.h"
#include "80211mgr.h"
-
-
-
#define AUTHENTICATE_TIMEOUT 1000 //ms
#define ASSOCIATE_TIMEOUT 1000 //ms
-
// Command code
typedef enum tagCMD_CODE {
WLAN_CMD_BSSID_SCAN,
WLAN_CMD_IDLE
} CMD_STATE, *PCMD_STATE;
-
-
-
struct vnt_private;
void vResetCommandTimer(struct vnt_private *);
#include "card.h"
#include "tmacro.h"
-
-
// static int msglevel =MSG_LEVEL_INFO;
-
-
-
/*
* Description:
* Scan Rx cache. Return true if packet is duplicate, else
return(pDevice->cbDFCB);
}
-
/*
* Description:
* Handle received fragment packet
{
unsigned int uHeaderSize;
-
if (bWEP == true) {
uHeaderSize = 28;
if (bExtIV)
}
}
-
#include "tether.h"
#include "device.h"
-
#define IS_TYPE_DATA(pMACHeader) \
((((struct ieee80211_hdr *) pMACHeader)->frame_control & TYPE_802_11_MASK) == TYPE_802_11_DATA)
#define IS_CTL_PSPOLL(pMACHeader) \
((((struct ieee80211_hdr *) pMACHeader)->frame_control & TYPE_SUBTYPE_MASK) == TYPE_CTL_PSPOLL)
-
#define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) { \
if ((uVar) >= ((uModulo) - 1)) \
(uVar) = 0; \
(uVar)++; \
}
-
-
-
bool WCTLbIsDuplicate(PSCache pCache, struct ieee80211_hdr *pMACHeader);
bool WCTLbHandleFragment(struct vnt_private *, struct ieee80211_hdr *pMACHeader, unsigned int cbFrameLength, bool bWEP, bool bExtIV);
unsigned int WCTLuSearchDFCB(struct vnt_private *, struct ieee80211_hdr *pMACHeader);
#include "control.h"
#include "rndis.h"
-
-
-
-
static int msglevel =MSG_LEVEL_INFO;
//static int msglevel =MSG_LEVEL_DEBUG;
-
static int ChannelExceedZoneType(struct vnt_private *, u8 byCurrChannel);
/* Association/diassociation functions */
u8 *pCurrBSSID, PWLAN_IE_SUPP_RATES pCurrSuppRates,
PWLAN_IE_SUPP_RATES pCurrExtSuppRates);
-
/* Association response */
static struct vnt_tx_mgmt *s_MgrMakeAssocResponse(struct vnt_private *,
struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wAssocStatus,
/* received status */
static void s_vMgrLogStatus(struct vnt_manager *pMgmt, u16 wStatus);
-
static void s_vMgrSynchBSS(struct vnt_private *, u32 uBSSMode,
PKnownBSS pCurr, PCMD_STATUS pStatus);
-
static bool
s_bCipherMatch (
PKnownBSS pBSSNode,
static void Encyption_Rebuild(struct vnt_private *, PKnownBSS pCurr);
-
-
/*+
*
* Routine Description:
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
int ii;
-
pMgmt->pbyPSPacketPool = &pMgmt->byPSPacketPool[0];
pMgmt->pbyMgmtPacketPool = &pMgmt->byMgmtPacketPool[0];
pMgmt->uCurrChannel = pDevice->uChannel;
{
struct vnt_tx_mgmt *pTxPacket;
-
pMgmt->wCurrCapInfo = 0;
pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_ESS(1);
if (pDevice->bEncryptionEnable) {
return ;
}
-
/*+
*
* Routine Description:
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)
u8 abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
u8 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,
pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate);
}
-
// assoc response reply..
pTxPacket = s_MgrMakeAssocResponse
(
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:
PWLAN_IE_SSID pItemSSID;
u8 *pbyIEs;
-
-
if (pMgmt->eCurrState == WMAC_STATE_ASSOCPENDING ||
pMgmt->eCurrState == WMAC_STATE_ASSOC) {
*pStatus = CMD_STATUS_SUCCESS;
}
-
return ;
}
-
/*+
*
* Routine Description:
return;
}
-
-
/*+
*
* Routine Description:
*
-*/
-
static void s_vMgrRxAuthenSequence_1(struct vnt_private *pDevice,
struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame)
{
return;
}
-
-
/*+
*
* Routine Description:
WLAN_FR_AUTHEN sFrame;
struct vnt_tx_mgmt *pTxPacket = NULL;
-
switch (cpu_to_le16((*(pFrame->pwAuthAlgorithm))))
{
case WLAN_AUTH_ALG_OPENSYSTEM:
return;
}
-
-
/*+
*
* Routine Description:
}
-
-
/*+
*
* Routine Description:
return;
}
-
/*+
*
* Routine Description:
WLAN_FR_DEAUTHEN sFrame;
u32 uNodeIndex = 0;
-
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP ){
//Todo:
// if is acting an AP..
int bChannelHit = false;
u8 byOldPreambleType;
-
-
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)
return;
if (qwTSFOffset > TRIVIAL_SYNC_DIFFERENCE)
bTSFLargeDiff = true;
-
// if infra mode
if (bIsAPBeacon == true) {
if (pDevice->byPreambleType != byOldPreambleType)
CARDvSetRSPINF(pDevice, (u8)pDevice->byBBType);
-
// MACvRegBitsOff(pDevice->PortOffset, MAC_REG_RCR, RCR_BSSID);
// set highest basic rate
// s_vSetHighestBasicRate(pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates);
u8 abyOFDM_RATE[] = {0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C};
u16 wSuppRate;
-
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Create Basic Service Set .......\n");
if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) {
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);
&wMaxBasicRate, &wMaxSuppRate, &wSuppRate,
&byTopCCKBasicRate, &byTopOFDMBasicRate);
-
-
if (pDevice->byBBType == BB_TYPE_11A) {
pDevice->bShortSlotTime = true;
} else {
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);
}
u8 byTopOFDMBasicRate = RATE_1M;
u8 bShortSlotTime = false;
-
for (ii = 0; ii < MAX_BSS_NUM; ii++) {
if (pMgmt->sBSSList[ii].bActive == true)
break;
pMgmt->eCurrState = WMAC_STATE_IDLE;
};
-
}
else {
// ad-hoc mode BSS
// 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:
return;
}
-
/*+
*
* Routine Description:
u16 wStartIndex = 0;
u16 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:
WLAN_FR_BEACON sFrame;
u8 abyBroadcastAddr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-
/* prepare beacon frame */
pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt)
}
}
-
if (pMgmt->eCurrentPHYMode == PHY_TYPE_11G) {
sFrame.pERP = (PWLAN_IE_ERP)(sFrame.pBuf + sFrame.len);
sFrame.len += 1 + WLAN_IEHDR_LEN;
return pTxPacket;
}
-
-
-
-
/*+
*
* Routine Description:
*
-*/
-
-
-
struct vnt_tx_mgmt *s_MgrMakeProbeResponse(struct vnt_private *pDevice,
struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wCurrBeaconPeriod,
u32 uCurrChannel, u16 wCurrATIMWinodw, u8 *pDstAddr,
struct vnt_tx_mgmt *pTxPacket = NULL;
WLAN_FR_PROBERESP sFrame;
-
pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt)
+ WLAN_PROBERESP_FR_MAXLEN);
return pTxPacket;
}
-
-
/*+
*
* Routine Description:
*
-*/
-
struct vnt_tx_mgmt *s_MgrMakeAssocRequest(struct vnt_private *pDevice,
struct vnt_manager *pMgmt, u8 *pDAddr, u16 wCurrCapInfo,
u16 wListenInterval,
u8 *pbyIEs;
u8 *pbyRSN;
-
pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt)
+ WLAN_ASSOCREQ_FR_MAXLEN);
memcpy(pbyIEs, pCurrRates, pCurrRates->len + WLAN_IEHDR_LEN);
pbyIEs += pCurrRates->len + WLAN_IEHDR_LEN;
-
if (((pMgmt->eAuthenMode == WMAC_AUTH_WPA) ||
(pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) ||
(pMgmt->eAuthenMode == WMAC_AUTH_WPANONE)) &&
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:
*
-*/
-
struct vnt_tx_mgmt *s_MgrMakeReAssocRequest(struct vnt_private *pDevice,
struct vnt_manager *pMgmt, u8 *pDAddr, u16 wCurrCapInfo,
u16 wListenInterval, PWLAN_IE_SSID pCurrSSID,
u8 *pbyIEs;
u8 *pbyRSN;
-
pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt)
+ WLAN_REASSOCREQ_FR_MAXLEN);
pbyIEs += sFrame.pRSN->len + WLAN_IEHDR_LEN;
}
-
-
/* Adjust the length fields */
pTxPacket->cbMPDULen = sFrame.len;
pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN;
struct vnt_tx_mgmt *pTxPacket = NULL;
WLAN_FR_ASSOCRESP sFrame;
-
pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt)
+ WLAN_ASSOCREQ_FR_MAXLEN);
return pTxPacket;
}
-
/*+
*
* Routine Description:
*
-*/
-
struct vnt_tx_mgmt *s_MgrMakeReAssocResponse(struct vnt_private *pDevice,
struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wAssocStatus,
u16 wAssocAID, u8 *pDstAddr, PWLAN_IE_SUPP_RATES pCurrSuppRates,
struct vnt_tx_mgmt *pTxPacket = NULL;
WLAN_FR_REASSOCRESP sFrame;
-
pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt)
+ WLAN_ASSOCREQ_FR_MAXLEN);
return pTxPacket;
}
-
/*+
*
* Routine Description:
ERPObject sERP;
int bChannelHit = true;
-
memset(&sFrame, 0, sizeof(WLAN_FR_PROBERESP));
// decode the frame
sFrame.len = pRxPacket->cbMPDULen;
if(sFrame.pSSID->len == 0)
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx Probe resp: SSID len = 0 \n");
-
//{{ RobertYu:20050201, 11a byCurrChannel != sFrame.pDSParms->byCurrChannel mapping
if( byCurrChannel > CB_MAX_CHANNEL_24G )
{
sERP.byERP = 0;
}
-
// update or insert the bss
pBSSList = BSSpAddrIsInBSSList((void *) pDevice,
sFrame.pHdr->sA3.abyAddr3,
*
-*/
-
static void s_vMgrRxProbeRequest(struct vnt_private *pDevice,
struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket)
{
NODE_STATE eNodeState = 0;
CMD_STATUS Status;
-
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
if (BSSbIsSTAInNodeDB(pDevice, pRxPacket->p80211Header->sA3.abyAddr2, &uNodeIndex))
eNodeState = pMgmt->sNodeDBTable[uNodeIndex].eNodeState;
return true;
}
-
-
-
/*+
*
* Routine 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];
return true;
}
-
#include "wpa2.h"
#include "card.h"
-
-
-
// Scan time
#define PROBE_DELAY 100 // (us)
#define SWITCH_CHANNEL_DELAY 200 // (us)
#define WCMD_ACTIVE_SCAN_TIME 20 //(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
-
-
-
//mike define: make timer to expire after desired times
#define timer_expire(timer, next_tick) mod_timer(&timer, RUN_AT(next_tick))
typedef void (*TimerFunction)(unsigned long);
-
//+++ NDIS related
typedef u8 NDIS_802_11_MAC_ADDRESS[ETH_ALEN];
u32 OffsetResponseIEs;
} NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION;
-
-
typedef struct tagSAssocInfo {
NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo;
u8 abyIEs[WLAN_BEACON_FR_MAXLEN+WLAN_BEACON_FR_MAXLEN];
u8 abyReqIEs[WLAN_BEACON_FR_MAXLEN];
} SAssocInfo, *PSAssocInfo;
-
-
-
typedef enum tagWMAC_AUTHENTICATION_MODE {
WMAC_AUTH_OPEN,
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 {
} WMAC_CONFIG_MODE, *PWMAC_CONFIG_MODE;
-
typedef enum tagWMAC_SCAN_TYPE {
WMAC_SCAN_ACTIVE,
} WMAC_SCAN_TYPE, *PWMAC_SCAN_TYPE;
-
typedef enum tagWMAC_SCAN_STATE {
WMAC_NO_SCANNING,
} 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_CURRENT_MODE, *PWMAC_CURRENT_MODE;
-
typedef enum tagWMAC_POWER_MODE {
WMAC_POWER_CAM,
} WMAC_POWER_MODE, *PWMAC_POWER_MODE;
-
-
/* Tx Management Packet descriptor */
struct vnt_tx_mgmt {
PUWLAN_80211HDR p80211Header;
u32 cbPayloadLen;
};
-
/* Rx Management Packet descriptor */
struct vnt_rx_mgmt {
PUWLAN_80211HDR p80211Header;
u8 byRxChannel;
};
-
struct vnt_manager {
void *pAdapter;
u8 byMgmtPacketPool[sizeof(struct vnt_tx_mgmt)
+ WLAN_A3FR_MAXLEN];
-
/* One second callback timer */
struct timer_list sTimerSecondCallback;
};
-
-
void vMgrObjectInit(struct vnt_private *pDevice);
void vMgrAssocBeginSta(struct vnt_private *pDevice,
const u8 abyOUI04[4] = { 0x00, 0x50, 0xf2, 0x04 };
const u8 abyOUI05[4] = { 0x00, 0x50, 0xf2, 0x05 };
-
/*+
*
* Description:
pBSSList->bWPAValid = false;
}
-
/*+
*
* Description:
#include "80211hdr.h"
-
#define WPA_NONE 0
#define WPA_WEP40 1
#define WPA_TKIP 2
#define WPA_REPLAYBITSSHIFT 2
#define WPA_REPLAYBITS 0x03
-
-
-
-
-
void
WPA_ClearRSN(
PKnownBSS pBSSList
static int msglevel =MSG_LEVEL_INFO;
//static int msglevel =MSG_LEVEL_DEBUG;
-
const u8 abyOUIGK[4] = { 0x00, 0x0F, 0xAC, 0x00 };
const u8 abyOUIWEP40[4] = { 0x00, 0x0F, 0xAC, 0x01 };
const u8 abyOUIWEP104[4] = { 0x00, 0x0F, 0xAC, 0x05 };
const u8 abyOUI8021X[4] = { 0x00, 0x0F, 0xAC, 0x01 };
const u8 abyOUIPSK[4] = { 0x00, 0x0F, 0xAC, 0x02 };
-
-
-
-
/*+
*
* Description:
PMKIDInfo BSSIDInfo[MAX_PMKID_CACHE];
} SPMKIDCache, *PSPMKIDCache;
-
-
-
-
-
void WPA2_ClearRSN(PKnownBSS pBSSNode);
void WPA2vParseRSN(PKnownBSS pBSSNode, PWLAN_IE_RSN pRSN);
#include "rndis.h"
#include "rf.h"
-
-
static int msglevel = MSG_LEVEL_INFO;
-
-
-
/*
* Description:
* Set WPA algorithm & keys
return ret;
}
-
if (param->u.wpa_key.seq && param->u.wpa_key.seq_len > sizeof(abySeq))
return -EINVAL;
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;
}
-
#include "device.h"
#include "iowpa.h"
-
-
//WPA related
typedef enum { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP } wpa_alg;
#define AUTH_ALG_SHARED_KEY 0x02
#define AUTH_ALG_LEAP 0x04
-
typedef unsigned long long NDIS_802_11_KEY_RSC;
-
-
-
int wpa_set_keys(struct vnt_private *, void *ctx);
#endif /* __WPACL_H__ */