summaryrefslogtreecommitdiff
path: root/drivers/staging/vt6656
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/vt6656')
-rw-r--r--drivers/staging/vt6656/baseband.c80
-rw-r--r--drivers/staging/vt6656/baseband.h10
-rw-r--r--drivers/staging/vt6656/card.c78
-rw-r--r--drivers/staging/vt6656/desc.h224
-rw-r--r--drivers/staging/vt6656/device.h51
-rw-r--r--drivers/staging/vt6656/device_cfg.h14
-rw-r--r--drivers/staging/vt6656/dpc.c16
-rw-r--r--drivers/staging/vt6656/dpc.h4
-rw-r--r--drivers/staging/vt6656/main_usb.c23
-rw-r--r--drivers/staging/vt6656/rxtx.c1536
-rw-r--r--drivers/staging/vt6656/rxtx.h761
-rw-r--r--drivers/staging/vt6656/usbpipe.c12
-rw-r--r--drivers/staging/vt6656/usbpipe.h5
-rw-r--r--drivers/staging/vt6656/wmgr.c2
14 files changed, 952 insertions, 1864 deletions
diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c
index 33fa76759bf1..1e8b8412e67e 100644
--- a/drivers/staging/vt6656/baseband.c
+++ b/drivers/staging/vt6656/baseband.c
@@ -680,7 +680,6 @@ BBuGetFrameTime(
unsigned int uRate = 0;
if (uRateIdx > RATE_54M) {
- ASSERT(0);
return 0;
}
@@ -724,16 +723,16 @@ BBuGetFrameTime(
* cbFrameLength - Tx Frame Length
* wRate - Tx Rate
* Out:
- * pwPhyLen - pointer to Phy Length field
- * pbyPhySrv - pointer to Phy Service field
- * pbyPhySgn - pointer to Phy Signal field
+ * struct vnt_phy_field *phy
+ * - pointer to Phy Length field
+ * - pointer to Phy Service field
+ * - pointer to Phy Signal field
*
* Return Value: none
*
*/
void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength,
- u16 wRate, u8 byPacketType, u16 *pwPhyLen, u8 *pbyPhySrv,
- u8 *pbyPhySgn)
+ u16 wRate, u8 byPacketType, struct vnt_phy_field *phy)
{
u32 cbBitCount;
u32 cbUsCount = 0;
@@ -748,15 +747,15 @@ void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength,
switch (wRate) {
case RATE_1M :
cbUsCount = cbBitCount;
- *pbyPhySgn = 0x00;
+ phy->signal = 0x00;
break;
case RATE_2M :
cbUsCount = cbBitCount / 2;
if (byPreambleType == 1)
- *pbyPhySgn = 0x09;
+ phy->signal = 0x09;
else // long preamble
- *pbyPhySgn = 0x01;
+ phy->signal = 0x01;
break;
case RATE_5M :
@@ -767,9 +766,9 @@ void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength,
if (cbTmp != cbBitCount)
cbUsCount ++;
if (byPreambleType == 1)
- *pbyPhySgn = 0x0a;
+ phy->signal = 0x0a;
else // long preamble
- *pbyPhySgn = 0x02;
+ phy->signal = 0x02;
break;
case RATE_11M :
@@ -784,103 +783,102 @@ void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength,
bExtBit = true;
}
if (byPreambleType == 1)
- *pbyPhySgn = 0x0b;
+ phy->signal = 0x0b;
else // long preamble
- *pbyPhySgn = 0x03;
+ phy->signal = 0x03;
break;
case RATE_6M :
if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
- *pbyPhySgn = 0x9B; //1001 1011
+ phy->signal = 0x9b;
}
else {//11g, 2.4GHZ
- *pbyPhySgn = 0x8B; //1000 1011
+ phy->signal = 0x8b;
}
break;
case RATE_9M :
if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
- *pbyPhySgn = 0x9F; //1001 1111
+ phy->signal = 0x9f;
}
else {//11g, 2.4GHZ
- *pbyPhySgn = 0x8F; //1000 1111
+ phy->signal = 0x8f;
}
break;
case RATE_12M :
if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
- *pbyPhySgn = 0x9A; //1001 1010
+ phy->signal = 0x9a;
}
else {//11g, 2.4GHZ
- *pbyPhySgn = 0x8A; //1000 1010
+ phy->signal = 0x8a;
}
break;
case RATE_18M :
if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
- *pbyPhySgn = 0x9E; //1001 1110
+ phy->signal = 0x9e;
}
else {//11g, 2.4GHZ
- *pbyPhySgn = 0x8E; //1000 1110
+ phy->signal = 0x8e;
}
break;
case RATE_24M :
if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
- *pbyPhySgn = 0x99; //1001 1001
+ phy->signal = 0x99;
}
else {//11g, 2.4GHZ
- *pbyPhySgn = 0x89; //1000 1001
+ phy->signal = 0x89;
}
break;
case RATE_36M :
if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
- *pbyPhySgn = 0x9D; //1001 1101
+ phy->signal = 0x9d;
}
else {//11g, 2.4GHZ
- *pbyPhySgn = 0x8D; //1000 1101
+ phy->signal = 0x8d;
}
break;
case RATE_48M :
if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
- *pbyPhySgn = 0x98; //1001 1000
+ phy->signal = 0x98;
}
else {//11g, 2.4GHZ
- *pbyPhySgn = 0x88; //1000 1000
+ phy->signal = 0x88;
}
break;
case RATE_54M :
if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
- *pbyPhySgn = 0x9C; //1001 1100
+ phy->signal = 0x9c;
}
else {//11g, 2.4GHZ
- *pbyPhySgn = 0x8C; //1000 1100
+ phy->signal = 0x8c;
}
break;
default :
if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
- *pbyPhySgn = 0x9C; //1001 1100
+ phy->signal = 0x9c;
}
else {//11g, 2.4GHZ
- *pbyPhySgn = 0x8C; //1000 1100
+ phy->signal = 0x8c;
}
break;
}
- if (byPacketType == PK_TYPE_11B) {
- *pbyPhySrv = 0x00;
- if (bExtBit)
- *pbyPhySrv = *pbyPhySrv | 0x80;
- *pwPhyLen = (u16) cbUsCount;
- }
- else {
- *pbyPhySrv = 0x00;
- *pwPhyLen = (u16)cbFrameLength;
- }
+ if (byPacketType == PK_TYPE_11B) {
+ phy->service = 0x00;
+ if (bExtBit)
+ phy->service |= 0x80;
+ phy->len = cpu_to_le16((u16)cbUsCount);
+ } else {
+ phy->service = 0x00;
+ phy->len = cpu_to_le16((u16)cbFrameLength);
+ }
}
/*
diff --git a/drivers/staging/vt6656/baseband.h b/drivers/staging/vt6656/baseband.h
index 0a634adabf0e..79faedf4a5e9 100644
--- a/drivers/staging/vt6656/baseband.h
+++ b/drivers/staging/vt6656/baseband.h
@@ -81,6 +81,13 @@
#define TOP_RATE_2M 0x00200000
#define TOP_RATE_1M 0x00100000
+/* Length, Service, and Signal fields of Phy for Tx */
+struct vnt_phy_field {
+ u8 signal;
+ u8 service;
+ __le16 len;
+} __packed;
+
unsigned int
BBuGetFrameTime(
u8 byPreambleType,
@@ -90,8 +97,7 @@ BBuGetFrameTime(
);
void BBvCalculateParameter(struct vnt_private *, u32 cbFrameLength,
- u16 wRate, u8 byPacketType, u16 *pwPhyLen, u8 *pbyPhySrv,
- u8 *pbyPhySgn);
+ u16 wRate, u8 byPacketType, struct vnt_phy_field *);
/* timer for antenna diversity */
diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c
index 24291aee58b5..dbf11ecb794e 100644
--- a/drivers/staging/vt6656/card.c
+++ b/drivers/staging/vt6656/card.c
@@ -319,53 +319,27 @@ CARDvCalculateOFDMRParameter (
*/
void CARDvSetRSPINF(struct vnt_private *pDevice, u8 byBBType)
{
- u8 abyServ[4] = {0, 0, 0, 0}; /* For CCK */
- u8 abySignal[4] = {0, 0, 0, 0};
- u16 awLen[4] = {0, 0, 0, 0};
+ struct vnt_phy_field phy[4];
u8 abyTxRate[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; /* For OFDM */
u8 abyRsvTime[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
u8 abyData[34];
int i;
//RSPINF_b_1
- BBvCalculateParameter(pDevice,
- 14,
- swGetCCKControlRate(pDevice, RATE_1M),
- PK_TYPE_11B,
- &awLen[0],
- &abyServ[0],
- &abySignal[0]
- );
+ BBvCalculateParameter(pDevice, 14,
+ swGetCCKControlRate(pDevice, RATE_1M), PK_TYPE_11B, &phy[0]);
///RSPINF_b_2
- BBvCalculateParameter(pDevice,
- 14,
- swGetCCKControlRate(pDevice, RATE_2M),
- PK_TYPE_11B,
- &awLen[1],
- &abyServ[1],
- &abySignal[1]
- );
+ BBvCalculateParameter(pDevice, 14,
+ swGetCCKControlRate(pDevice, RATE_2M), PK_TYPE_11B, &phy[1]);
//RSPINF_b_5
- BBvCalculateParameter(pDevice,
- 14,
- swGetCCKControlRate(pDevice, RATE_5M),
- PK_TYPE_11B,
- &awLen[2],
- &abyServ[2],
- &abySignal[2]
- );
+ BBvCalculateParameter(pDevice, 14,
+ swGetCCKControlRate(pDevice, RATE_5M), PK_TYPE_11B, &phy[2]);
//RSPINF_b_11
- BBvCalculateParameter(pDevice,
- 14,
- swGetCCKControlRate(pDevice, RATE_11M),
- PK_TYPE_11B,
- &awLen[3],
- &abyServ[3],
- &abySignal[3]
- );
+ BBvCalculateParameter(pDevice, 14,
+ swGetCCKControlRate(pDevice, RATE_11M), PK_TYPE_11B, &phy[3]);
//RSPINF_a_6
CARDvCalculateOFDMRParameter (RATE_6M,
@@ -421,25 +395,21 @@ void CARDvSetRSPINF(struct vnt_private *pDevice, u8 byBBType)
&abyTxRate[8],
&abyRsvTime[8]);
- abyData[0] = (u8)(awLen[0]&0xFF);
- abyData[1] = (u8)(awLen[0]>>8);
- abyData[2] = abySignal[0];
- abyData[3] = abyServ[0];
-
- abyData[4] = (u8)(awLen[1]&0xFF);
- abyData[5] = (u8)(awLen[1]>>8);
- abyData[6] = abySignal[1];
- abyData[7] = abyServ[1];
-
- abyData[8] = (u8)(awLen[2]&0xFF);
- abyData[9] = (u8)(awLen[2]>>8);
- abyData[10] = abySignal[2];
- abyData[11] = abyServ[2];
-
- abyData[12] = (u8)(awLen[3]&0xFF);
- abyData[13] = (u8)(awLen[3]>>8);
- abyData[14] = abySignal[3];
- abyData[15] = abyServ[3];
+ put_unaligned(phy[0].len, (u16 *)&abyData[0]);
+ abyData[2] = phy[0].signal;
+ abyData[3] = phy[0].service;
+
+ put_unaligned(phy[1].len, (u16 *)&abyData[4]);
+ abyData[6] = phy[1].signal;
+ abyData[7] = phy[1].service;
+
+ put_unaligned(phy[2].len, (u16 *)&abyData[8]);
+ abyData[10] = phy[2].signal;
+ abyData[11] = phy[2].service;
+
+ put_unaligned(phy[3].len, (u16 *)&abyData[12]);
+ abyData[14] = phy[3].signal;
+ abyData[15] = phy[3].service;
for (i = 0; i < 9; i++) {
abyData[16+i*2] = abyTxRate[i];
diff --git a/drivers/staging/vt6656/desc.h b/drivers/staging/vt6656/desc.h
index 64cb046fe988..4675135aa258 100644
--- a/drivers/staging/vt6656/desc.h
+++ b/drivers/staging/vt6656/desc.h
@@ -144,160 +144,6 @@
#define TD_FLAGS_PS_RETRY 0x04 /* check if PS STA frame re-transmit */
/*
- * RsvTime buffer header
- */
-typedef struct tagSRrvTime_gRTS {
- u16 wRTSTxRrvTime_ba;
- u16 wRTSTxRrvTime_aa;
- u16 wRTSTxRrvTime_bb;
- u16 wReserved;
- u16 wTxRrvTime_b;
- u16 wTxRrvTime_a;
-} __attribute__ ((__packed__))
-SRrvTime_gRTS, *PSRrvTime_gRTS;
-
-typedef const SRrvTime_gRTS *PCSRrvTime_gRTS;
-
-typedef struct tagSRrvTime_gCTS {
- u16 wCTSTxRrvTime_ba;
- u16 wReserved;
- u16 wTxRrvTime_b;
- u16 wTxRrvTime_a;
-} __attribute__ ((__packed__))
-SRrvTime_gCTS, *PSRrvTime_gCTS;
-
-typedef const SRrvTime_gCTS *PCSRrvTime_gCTS;
-
-typedef struct tagSRrvTime_ab {
- u16 wRTSTxRrvTime;
- u16 wTxRrvTime;
-} __attribute__ ((__packed__))
-SRrvTime_ab, *PSRrvTime_ab;
-
-typedef const SRrvTime_ab *PCSRrvTime_ab;
-
-typedef struct tagSRrvTime_atim {
- u16 wCTSTxRrvTime_ba;
- u16 wTxRrvTime_a;
-} __attribute__ ((__packed__))
-SRrvTime_atim, *PSRrvTime_atim;
-
-typedef const SRrvTime_atim *PCSRrvTime_atim;
-
-/*
- * RTS buffer header
- */
-typedef struct tagSRTSData {
- u16 wFrameControl;
- u16 wDurationID;
- u8 abyRA[ETH_ALEN];
- u8 abyTA[ETH_ALEN];
-} __attribute__ ((__packed__))
-SRTSData, *PSRTSData;
-
-typedef const SRTSData *PCSRTSData;
-
-typedef struct tagSRTS_g {
- u8 bySignalField_b;
- u8 byServiceField_b;
- u16 wTransmitLength_b;
- u8 bySignalField_a;
- u8 byServiceField_a;
- u16 wTransmitLength_a;
- u16 wDuration_ba;
- u16 wDuration_aa;
- u16 wDuration_bb;
- u16 wReserved;
- SRTSData Data;
-} __attribute__ ((__packed__))
-SRTS_g, *PSRTS_g;
-typedef const SRTS_g *PCSRTS_g;
-
-typedef struct tagSRTS_g_FB {
- u8 bySignalField_b;
- u8 byServiceField_b;
- u16 wTransmitLength_b;
- u8 bySignalField_a;
- u8 byServiceField_a;
- u16 wTransmitLength_a;
- u16 wDuration_ba;
- u16 wDuration_aa;
- u16 wDuration_bb;
- u16 wReserved;
- u16 wRTSDuration_ba_f0;
- u16 wRTSDuration_aa_f0;
- u16 wRTSDuration_ba_f1;
- u16 wRTSDuration_aa_f1;
- SRTSData Data;
-} __attribute__ ((__packed__))
-SRTS_g_FB, *PSRTS_g_FB;
-
-typedef const SRTS_g_FB *PCSRTS_g_FB;
-
-typedef struct tagSRTS_ab {
- u8 bySignalField;
- u8 byServiceField;
- u16 wTransmitLength;
- u16 wDuration;
- u16 wReserved;
- SRTSData Data;
-} __attribute__ ((__packed__))
-SRTS_ab, *PSRTS_ab;
-
-typedef const SRTS_ab *PCSRTS_ab;
-
-typedef struct tagSRTS_a_FB {
- u8 bySignalField;
- u8 byServiceField;
- u16 wTransmitLength;
- u16 wDuration;
- u16 wReserved;
- u16 wRTSDuration_f0;
- u16 wRTSDuration_f1;
- SRTSData Data;
-} __attribute__ ((__packed__))
-SRTS_a_FB, *PSRTS_a_FB;
-
-typedef const SRTS_a_FB *PCSRTS_a_FB;
-
-/*
- * CTS buffer header
- */
-typedef struct tagSCTSData {
- u16 wFrameControl;
- u16 wDurationID;
- u8 abyRA[ETH_ALEN];
- u16 wReserved;
-} __attribute__ ((__packed__))
-SCTSData, *PSCTSData;
-
-typedef struct tagSCTS {
- u8 bySignalField_b;
- u8 byServiceField_b;
- u16 wTransmitLength_b;
- u16 wDuration_ba;
- u16 wReserved;
- SCTSData Data;
-} __attribute__ ((__packed__))
-SCTS, *PSCTS;
-
-typedef const SCTS *PCSCTS;
-
-typedef struct tagSCTS_FB {
- u8 bySignalField_b;
- u8 byServiceField_b;
- u16 wTransmitLength_b;
- u16 wDuration_ba;
- u16 wReserved;
- u16 wCTSDuration_ba_f0;
- u16 wCTSDuration_ba_f1;
- SCTSData Data;
-} __attribute__ ((__packed__))
-SCTS_FB, *PSCTS_FB;
-
-typedef const SCTS_FB *PCSCTS_FB;
-
-/*
* TX FIFO header
*/
typedef struct tagSTxBufHead {
@@ -317,76 +163,6 @@ typedef struct tagSTxShortBufHead {
STxShortBufHead, *PSTxShortBufHead;
typedef const STxShortBufHead *PCSTxShortBufHead;
-/*
- * TX data header
- */
-typedef struct tagSTxDataHead_g {
- u8 bySignalField_b;
- u8 byServiceField_b;
- u16 wTransmitLength_b;
- u8 bySignalField_a;
- u8 byServiceField_a;
- u16 wTransmitLength_a;
- u16 wDuration_b;
- u16 wDuration_a;
- u16 wTimeStampOff_b;
- u16 wTimeStampOff_a;
-} __attribute__ ((__packed__))
-STxDataHead_g, *PSTxDataHead_g;
-
-typedef const STxDataHead_g *PCSTxDataHead_g;
-
-typedef struct tagSTxDataHead_g_FB {
- u8 bySignalField_b;
- u8 byServiceField_b;
- u16 wTransmitLength_b;
- u8 bySignalField_a;
- u8 byServiceField_a;
- u16 wTransmitLength_a;
- u16 wDuration_b;
- u16 wDuration_a;
- u16 wDuration_a_f0;
- u16 wDuration_a_f1;
- u16 wTimeStampOff_b;
- u16 wTimeStampOff_a;
-} __attribute__ ((__packed__))
-STxDataHead_g_FB, *PSTxDataHead_g_FB;
-typedef const STxDataHead_g_FB *PCSTxDataHead_g_FB;
-
-typedef struct tagSTxDataHead_ab {
- u8 bySignalField;
- u8 byServiceField;
- u16 wTransmitLength;
- u16 wDuration;
- u16 wTimeStampOff;
-} __attribute__ ((__packed__))
-STxDataHead_ab, *PSTxDataHead_ab;
-typedef const STxDataHead_ab *PCSTxDataHead_ab;
-
-typedef struct tagSTxDataHead_a_FB {
- u8 bySignalField;
- u8 byServiceField;
- u16 wTransmitLength;
- u16 wDuration;
- u16 wTimeStampOff;
- u16 wDuration_f0;
- u16 wDuration_f1;
-} __attribute__ ((__packed__))
-STxDataHead_a_FB, *PSTxDataHead_a_FB;
-typedef const STxDataHead_a_FB *PCSTxDataHead_a_FB;
-
-/*
- * MICHDR data header
- */
-typedef struct tagSMICHDRHead {
- u32 adwHDR0[4];
- u32 adwHDR1[4];
- u32 adwHDR2[4];
-} __attribute__ ((__packed__))
-SMICHDRHead, *PSMICHDRHead;
-
-typedef const SMICHDRHead *PCSMICHDRHead;
-
typedef struct tagSBEACONCtl {
u32 BufReady:1;
u32 TSF:15;
diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
index f07ba242811b..8e396341c5e8 100644
--- a/drivers/staging/vt6656/device.h
+++ b/drivers/staging/vt6656/device.h
@@ -166,8 +166,7 @@ typedef enum _CONTEXT_TYPE {
} CONTEXT_TYPE;
/* RCB (Receive Control Block) */
-typedef struct _RCB
-{
+struct vnt_rcb {
void *Next;
signed long Ref;
void *pDevice;
@@ -175,21 +174,20 @@ typedef struct _RCB
struct vnt_rx_mgmt sMngPacket;
struct sk_buff *skb;
int bBoolInUse;
-
-} RCB, *PRCB;
+};
/* used to track bulk out irps */
-typedef struct _USB_SEND_CONTEXT {
- void *pDevice;
- struct sk_buff *pPacket;
- struct urb *pUrb;
- unsigned int uBufLen;
- CONTEXT_TYPE Type;
- struct ethhdr sEthHeader;
- void *Next;
- bool bBoolInUse;
- unsigned char Data[MAX_TOTAL_SIZE_WITH_ALL_HEADERS];
-} USB_SEND_CONTEXT, *PUSB_SEND_CONTEXT;
+struct vnt_usb_send_context {
+ void *pDevice;
+ struct sk_buff *pPacket;
+ struct urb *pUrb;
+ unsigned int uBufLen;
+ CONTEXT_TYPE Type;
+ struct ethhdr sEthHeader;
+ void *Next;
+ bool bBoolInUse;
+ unsigned char Data[MAX_TOTAL_SIZE_WITH_ALL_HEADERS];
+};
/* structure got from configuration file as user-desired default settings */
typedef struct _DEFAULT_CONFIG {
@@ -416,21 +414,21 @@ struct vnt_private {
u32 int_interval;
/* Variables to track resources for the BULK In Pipe */
- PRCB pRCBMem;
- PRCB apRCB[CB_MAX_RX_DESC];
+ struct vnt_rcb *pRCBMem;
+ struct vnt_rcb *apRCB[CB_MAX_RX_DESC];
u32 cbRD;
- PRCB FirstRecvFreeList;
- PRCB LastRecvFreeList;
+ struct vnt_rcb *FirstRecvFreeList;
+ struct vnt_rcb *LastRecvFreeList;
u32 NumRecvFreeList;
- PRCB FirstRecvMngList;
- PRCB LastRecvMngList;
+ struct vnt_rcb *FirstRecvMngList;
+ struct vnt_rcb *LastRecvMngList;
u32 NumRecvMngList;
int bIsRxWorkItemQueued;
int bIsRxMngWorkItemQueued;
unsigned long ulRcvRefCount; /* packets that have not returned back */
/* Variables to track resources for the BULK Out Pipe */
- PUSB_SEND_CONTEXT apTD[CB_MAX_TX_DESC];
+ struct vnt_usb_send_context *apTD[CB_MAX_TX_DESC];
u32 cbTD;
/* Variables to track resources for the Interrupt In Pipe */
@@ -591,18 +589,11 @@ struct vnt_private {
u8 abyBSSID[ETH_ALEN];
u8 abyDesireBSSID[ETH_ALEN];
- u16 wCTSDuration; /* update while speed change */
- u16 wACKDuration;
- u16 wRTSTransmitLen;
- u8 byRTSServiceField;
- u8 byRTSSignalField;
-
u32 dwMaxReceiveLifetime; /* dot11MaxReceiveLifetime */
int bCCK;
int bEncryptionEnable;
int bLongHeader;
- int bSoftwareGenCrcErr;
int bShortSlotTime;
int bProtectMode;
int bNonERPPresent;
@@ -781,7 +772,7 @@ struct vnt_private {
#define DequeueRCB(Head, Tail) \
{ \
- PRCB RCB = Head; \
+ struct vnt_rcb *RCB = Head; \
if (!RCB->Next) { \
Tail = NULL; \
} \
diff --git a/drivers/staging/vt6656/device_cfg.h b/drivers/staging/vt6656/device_cfg.h
index ea66b975fa5b..a97f7bb13db8 100644
--- a/drivers/staging/vt6656/device_cfg.h
+++ b/drivers/staging/vt6656/device_cfg.h
@@ -82,18 +82,4 @@ typedef enum _chip_type {
VT3184 = 1
} CHIP_TYPE, *PCHIP_TYPE;
-#ifdef VIAWET_DEBUG
-#define ASSERT(x) { \
- if (!(x)) { \
- printk(KERN_ERR "assertion %s failed: file %s line %d\n", #x, \
- __FUNCTION__, __LINE__);\
- *(int *) 0 = 0; \
- } \
-}
-#define DBG_PORT80(value) outb(value, 0x80)
-#else
-#define ASSERT(x)
-#define DBG_PORT80(value)
-#endif
-
#endif
diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c
index 7ec166a2ac81..ea7d443b11d0 100644
--- a/drivers/staging/vt6656/dpc.c
+++ b/drivers/staging/vt6656/dpc.c
@@ -246,7 +246,7 @@ s_vGetDASA (
*pcbHeaderSize = cbHeaderSize;
}
-int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB,
+int RXbBulkInProcessData(struct vnt_private *pDevice, struct vnt_rcb *pRCB,
unsigned long BytesToIndicate)
{
struct net_device_stats *pStats = &pDevice->stats;
@@ -271,7 +271,7 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB,
/* signed long ldBm = 0; */
int bIsWEP = false; int bExtIV = false;
u32 dwWbkStatus;
- PRCB pRCBIndicate = pRCB;
+ struct vnt_rcb *pRCBIndicate = pRCB;
u8 *pbyDAddress;
u16 *pwPLCP_Length;
u8 abyVaildRate[MAX_RATE]
@@ -314,7 +314,6 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB,
(BytesToIndicate < (*pwPLCP_Length)) ) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Wrong PLCP Length %x\n", (int) *pwPLCP_Length);
- ASSERT(0);
return false;
}
for ( ii=RATE_1M;ii<MAX_RATE;ii++) {
@@ -1337,7 +1336,7 @@ static int s_bAPModeRxData(struct vnt_private *pDevice, struct sk_buff *skb,
void RXvWorkItem(struct vnt_private *pDevice)
{
int ntStatus;
- PRCB pRCB = NULL;
+ struct vnt_rcb *pRCB = NULL;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Rx Polling Thread\n");
spin_lock_irq(&pDevice->lock);
@@ -1347,7 +1346,6 @@ void RXvWorkItem(struct vnt_private *pDevice)
(pDevice->NumRecvFreeList != 0) ) {
pRCB = pDevice->FirstRecvFreeList;
pDevice->NumRecvFreeList--;
- ASSERT(pRCB);// cannot be NULL
DequeueRCB(pDevice->FirstRecvFreeList, pDevice->LastRecvFreeList);
ntStatus = PIPEnsBulkInUsbRead(pDevice, pRCB);
}
@@ -1356,15 +1354,12 @@ void RXvWorkItem(struct vnt_private *pDevice)
}
-void RXvFreeRCB(PRCB pRCB, int bReAllocSkb)
+void RXvFreeRCB(struct vnt_rcb *pRCB, int bReAllocSkb)
{
struct vnt_private *pDevice = pRCB->pDevice;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->RXvFreeRCB\n");
- ASSERT(!pRCB->Ref); // should be 0
- ASSERT(pRCB->pDevice); // shouldn't be NULL
-
if (bReAllocSkb == false) {
kfree_skb(pRCB->skb);
bReAllocSkb = true;
@@ -1396,7 +1391,7 @@ void RXvFreeRCB(PRCB pRCB, int bReAllocSkb)
void RXvMngWorkItem(struct vnt_private *pDevice)
{
- PRCB pRCB = NULL;
+ struct vnt_rcb *pRCB = NULL;
struct vnt_rx_mgmt *pRxPacket;
int bReAllocSkb = false;
@@ -1411,7 +1406,6 @@ void RXvMngWorkItem(struct vnt_private *pDevice)
if(!pRCB){
break;
}
- ASSERT(pRCB);// cannot be NULL
pRxPacket = &(pRCB->sMngPacket);
vMgrRxManagePacket(pDevice, &pDevice->vnt_mgmt, pRxPacket);
pRCB->Ref--;
diff --git a/drivers/staging/vt6656/dpc.h b/drivers/staging/vt6656/dpc.h
index 876468f2c3d2..95388dc03ee3 100644
--- a/drivers/staging/vt6656/dpc.h
+++ b/drivers/staging/vt6656/dpc.h
@@ -36,9 +36,9 @@ void RXvWorkItem(void *Context);
void RXvMngWorkItem(void *Context);
-void RXvFreeRCB(PRCB pRCB, int bReAllocSkb);
+void RXvFreeRCB(struct vnt_rcb *pRCB, int bReAllocSkb);
-int RXbBulkInProcessData(struct vnt_private *, PRCB pRCB,
+int RXbBulkInProcessData(struct vnt_private *, struct vnt_rcb *pRCB,
unsigned long BytesToIndicate);
#endif /* __RXTX_H__ */
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index 3a3fdc58b6da..536971786ae8 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -267,7 +267,6 @@ device_set_options(struct vnt_private *pDevice) {
pDevice->bUpdateBBVGA = true;
pDevice->byFOETuning = 0;
pDevice->byAutoPwrTunning = 0;
- pDevice->wCTSDuration = 0;
pDevice->byPreambleType = 0;
pDevice->bExistSWNetAddr = false;
/* pDevice->bDiversityRegCtlON = true; */
@@ -734,7 +733,7 @@ err_nomem:
static void device_free_tx_bufs(struct vnt_private *pDevice)
{
- PUSB_SEND_CONTEXT pTxContext;
+ struct vnt_usb_send_context *pTxContext;
int ii;
for (ii = 0; ii < pDevice->cbTD; ii++) {
@@ -752,8 +751,8 @@ static void device_free_tx_bufs(struct vnt_private *pDevice)
static void device_free_rx_bufs(struct vnt_private *pDevice)
{
- PRCB pRCB;
- int ii;
+ struct vnt_rcb *pRCB;
+ int ii;
for (ii = 0; ii < pDevice->cbRD; ii++) {
@@ -789,14 +788,13 @@ static void device_free_int_bufs(struct vnt_private *pDevice)
static bool device_alloc_bufs(struct vnt_private *pDevice)
{
-
- PUSB_SEND_CONTEXT pTxContext;
- PRCB pRCB;
- int ii;
+ struct vnt_usb_send_context *pTxContext;
+ struct vnt_rcb *pRCB;
+ int ii;
for (ii = 0; ii < pDevice->cbTD; ii++) {
- pTxContext = kmalloc(sizeof(USB_SEND_CONTEXT), GFP_KERNEL);
+ pTxContext = kmalloc(sizeof(struct vnt_usb_send_context), GFP_KERNEL);
if (pTxContext == NULL) {
DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s : allocate tx usb context failed\n", pDevice->dev->name);
goto free_tx;
@@ -813,7 +811,8 @@ static bool device_alloc_bufs(struct vnt_private *pDevice)
}
/* allocate RCB mem */
- pDevice->pRCBMem = kzalloc((sizeof(RCB) * pDevice->cbRD), GFP_KERNEL);
+ pDevice->pRCBMem = kzalloc((sizeof(struct vnt_rcb) * pDevice->cbRD),
+ GFP_KERNEL);
if (pDevice->pRCBMem == NULL) {
DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s : alloc rx usb context failed\n", pDevice->dev->name);
goto free_tx;
@@ -824,7 +823,8 @@ static bool device_alloc_bufs(struct vnt_private *pDevice)
pDevice->FirstRecvMngList = NULL;
pDevice->LastRecvMngList = NULL;
pDevice->NumRecvFreeList = 0;
- pRCB = (PRCB) pDevice->pRCBMem;
+
+ pRCB = (struct vnt_rcb *)pDevice->pRCBMem;
for (ii = 0; ii < pDevice->cbRD; ii++) {
@@ -925,7 +925,6 @@ int device_alloc_frag_buf(struct vnt_private *pDevice,
pDeF->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
if (pDeF->skb == NULL)
return false;
- ASSERT(pDeF->skb);
pDeF->skb->dev = pDevice->dev;
return true;
diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 9bf2f8d562c3..fb743a8811bb 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -52,7 +52,6 @@
#include "card.h"
#include "bssdb.h"
#include "mac.h"
-#include "baseband.h"
#include "michael.h"
#include "tkip.h"
#include "tcrc.h"
@@ -101,13 +100,12 @@ static void *s_vGetFreeContext(struct vnt_private *pDevice);
static void s_vGenerateTxParameter(struct vnt_private *pDevice,
u8 byPktType, u16 wCurrentRate, void *pTxBufHead, void *pvRrvTime,
- void *pvRTS, void *pvCTS, u32 cbFrameSize, int bNeedACK, u32 uDMAIdx,
- struct ethhdr *psEthHeader);
+ void *rts_cts, u32 cbFrameSize, int bNeedACK, u32 uDMAIdx,
+ struct ethhdr *psEthHeader, bool need_rts);
static u32 s_uFillDataHead(struct vnt_private *pDevice,
u8 byPktType, u16 wCurrentRate, void *pTxDataHead, u32 cbFrameLength,
- u32 uDMAIdx, int bNeedAck, u32 uFragIdx, u32 cbLastFragmentSize,
- u32 uMACfragNum, u8 byFBOption);
+ u32 uDMAIdx, int bNeedAck, u8 byFBOption);
static void s_vGenerateMACHeader(struct vnt_private *pDevice,
u8 *pbyBufferAddr, u16 wDuration, struct ethhdr *psEthHeader,
@@ -115,7 +113,7 @@ static void s_vGenerateMACHeader(struct vnt_private *pDevice,
static void s_vFillTxKey(struct vnt_private *pDevice, u8 *pbyBuf,
u8 *pbyIVHead, PSKeyItem pTransmitKey, u8 *pbyHdrBuf, u16 wPayloadLen,
- u8 *pMICHDR);
+ struct vnt_mic_hdr *mic_hdr);
static void s_vSWencryption(struct vnt_private *pDevice,
PSKeyItem pTransmitKey, u8 *pbyPayloadHead, u16 wPayloadSize);
@@ -123,30 +121,28 @@ static void s_vSWencryption(struct vnt_private *pDevice,
static unsigned int s_uGetTxRsvTime(struct vnt_private *pDevice, u8 byPktType,
u32 cbFrameLength, u16 wRate, int bNeedAck);
-static u32 s_uGetRTSCTSRsvTime(struct vnt_private *pDevice, u8 byRTSRsvType,
+static u16 s_uGetRTSCTSRsvTime(struct vnt_private *pDevice, u8 byRTSRsvType,
u8 byPktType, u32 cbFrameLength, u16 wCurrentRate);
static void s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx,
- u8 byPktType, void *pvCTS, u32 cbFrameLength, int bNeedAck,
- int bDisCRC, u16 wCurrentRate, u8 byFBOption);
+ u8 byPktType, union vnt_tx_data_head *head, u32 cbFrameLength,
+ int bNeedAck, u16 wCurrentRate, u8 byFBOption);
static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType,
- void *pvRTS, u32 cbFrameLength, int bNeedAck, int bDisCRC,
+ union vnt_tx_data_head *head, u32 cbFrameLength, int bNeedAck,
struct ethhdr *psEthHeader, u16 wCurrentRate, u8 byFBOption);
-static u32 s_uGetDataDuration(struct vnt_private *pDevice, u8 byDurType,
- u32 cbFrameLength, u8 byPktType, u16 wRate, int bNeedAck,
- u32 uFragIdx, u32 cbLastFragmentSize, u32 uMACfragNum,
- u8 byFBOption);
+static u16 s_uGetDataDuration(struct vnt_private *pDevice,
+ u8 byPktType, int bNeedAck);
-static unsigned int s_uGetRTSCTSDuration(struct vnt_private *pDevice,
+static u16 s_uGetRTSCTSDuration(struct vnt_private *pDevice,
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;
- PUSB_SEND_CONTEXT pReturnContext = NULL;
+ struct vnt_usb_send_context *pContext = NULL;
+ struct vnt_usb_send_context *pReturnContext = NULL;
int ii;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"GetFreeContext()\n");
@@ -155,6 +151,7 @@ static void *s_vGetFreeContext(struct vnt_private *pDevice)
pContext = pDevice->apTD[ii];
if (pContext->bBoolInUse == false) {
pContext->bBoolInUse = true;
+ memset(pContext->Data, 0, MAX_TOTAL_SIZE_WITH_ALL_HEADERS);
pReturnContext = pContext;
break;
}
@@ -186,109 +183,117 @@ static void s_vSaveTxPktInfo(struct vnt_private *pDevice, u8 byPktNum,
static void s_vFillTxKey(struct vnt_private *pDevice, u8 *pbyBuf,
u8 *pbyIVHead, PSKeyItem pTransmitKey, u8 *pbyHdrBuf,
- u16 wPayloadLen, u8 *pMICHDR)
+ u16 wPayloadLen, struct vnt_mic_hdr *mic_hdr)
{
u32 *pdwIV = (u32 *)pbyIVHead;
u32 *pdwExtIV = (u32 *)((u8 *)pbyIVHead + 4);
- u16 wValue;
struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *)pbyHdrBuf;
u32 dwRevIVCounter;
- //Fill TXKEY
- if (pTransmitKey == NULL)
- return;
+ /* Fill TXKEY */
+ if (pTransmitKey == NULL)
+ return;
- dwRevIVCounter = cpu_to_le32(pDevice->dwIVCounter);
- *pdwIV = pDevice->dwIVCounter;
- pDevice->byKeyIndex = pTransmitKey->dwKeyIndex & 0xf;
+ dwRevIVCounter = cpu_to_le32(pDevice->dwIVCounter);
+ *pdwIV = pDevice->dwIVCounter;
+ pDevice->byKeyIndex = pTransmitKey->dwKeyIndex & 0xf;
- if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) {
- if (pTransmitKey->uKeyLength == WLAN_WEP232_KEYLEN ){
- memcpy(pDevice->abyPRNG, (u8 *)&(dwRevIVCounter), 3);
- memcpy(pDevice->abyPRNG+3, pTransmitKey->abyKey, pTransmitKey->uKeyLength);
- } else {
- memcpy(pbyBuf, (u8 *)&(dwRevIVCounter), 3);
- memcpy(pbyBuf+3, pTransmitKey->abyKey, pTransmitKey->uKeyLength);
- if(pTransmitKey->uKeyLength == WLAN_WEP40_KEYLEN) {
- memcpy(pbyBuf+8, (u8 *)&(dwRevIVCounter), 3);
- memcpy(pbyBuf+11, pTransmitKey->abyKey, pTransmitKey->uKeyLength);
- }
- memcpy(pDevice->abyPRNG, pbyBuf, 16);
- }
- // Append IV after Mac Header
- *pdwIV &= WEP_IV_MASK;//00000000 11111111 11111111 11111111
- *pdwIV |= (u32)pDevice->byKeyIndex << 30;
- *pdwIV = cpu_to_le32(*pdwIV);
- pDevice->dwIVCounter++;
- if (pDevice->dwIVCounter > WEP_IV_MASK) {
- pDevice->dwIVCounter = 0;
- }
- } else if (pTransmitKey->byCipherSuite == KEY_CTL_TKIP) {
- pTransmitKey->wTSC15_0++;
- if (pTransmitKey->wTSC15_0 == 0) {
- pTransmitKey->dwTSC47_16++;
- }
- TKIPvMixKey(pTransmitKey->abyKey, pDevice->abyCurrentNetAddr,
- pTransmitKey->wTSC15_0, pTransmitKey->dwTSC47_16, pDevice->abyPRNG);
- memcpy(pbyBuf, pDevice->abyPRNG, 16);
- // Make IV
- memcpy(pdwIV, pDevice->abyPRNG, 3);
-
- *(pbyIVHead+3) = (u8)(((pDevice->byKeyIndex << 6) & 0xc0) | 0x20); // 0x20 is ExtIV
- // Append IV&ExtIV after Mac Header
- *pdwExtIV = cpu_to_le32(pTransmitKey->dwTSC47_16);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"vFillTxKey()---- pdwExtIV: %x\n",
- *pdwExtIV);
-
- } else if (pTransmitKey->byCipherSuite == KEY_CTL_CCMP) {
- pTransmitKey->wTSC15_0++;
- if (pTransmitKey->wTSC15_0 == 0) {
- pTransmitKey->dwTSC47_16++;
- }
- memcpy(pbyBuf, pTransmitKey->abyKey, 16);
-
- // Make IV
- *pdwIV = 0;
- *(pbyIVHead+3) = (u8)(((pDevice->byKeyIndex << 6) & 0xc0) | 0x20); // 0x20 is ExtIV
- *pdwIV |= cpu_to_le16((u16)(pTransmitKey->wTSC15_0));
- //Append IV&ExtIV after Mac Header
- *pdwExtIV = cpu_to_le32(pTransmitKey->dwTSC47_16);
-
- //Fill MICHDR0
- *pMICHDR = 0x59;
- *((u8 *)(pMICHDR+1)) = 0; // TxPriority
- memcpy(pMICHDR+2, &(pMACHeader->addr2[0]), 6);
- *((u8 *)(pMICHDR+8)) = HIBYTE(HIWORD(pTransmitKey->dwTSC47_16));
- *((u8 *)(pMICHDR+9)) = LOBYTE(HIWORD(pTransmitKey->dwTSC47_16));
- *((u8 *)(pMICHDR+10)) = HIBYTE(LOWORD(pTransmitKey->dwTSC47_16));
- *((u8 *)(pMICHDR+11)) = LOBYTE(LOWORD(pTransmitKey->dwTSC47_16));
- *((u8 *)(pMICHDR+12)) = HIBYTE(pTransmitKey->wTSC15_0);
- *((u8 *)(pMICHDR+13)) = LOBYTE(pTransmitKey->wTSC15_0);
- *((u8 *)(pMICHDR+14)) = HIBYTE(wPayloadLen);
- *((u8 *)(pMICHDR+15)) = LOBYTE(wPayloadLen);
-
- //Fill MICHDR1
- *((u8 *)(pMICHDR+16)) = 0; // HLEN[15:8]
- if (pDevice->bLongHeader) {
- *((u8 *)(pMICHDR+17)) = 28; // HLEN[7:0]
- } else {
- *((u8 *)(pMICHDR+17)) = 22; // HLEN[7:0]
- }
- wValue = cpu_to_le16(pMACHeader->frame_control & 0xC78F);
- memcpy(pMICHDR+18, (u8 *)&wValue, 2); // MSKFRACTL
- memcpy(pMICHDR+20, &(pMACHeader->addr1[0]), 6);
- memcpy(pMICHDR+26, &(pMACHeader->addr2[0]), 6);
-
- //Fill MICHDR2
- memcpy(pMICHDR+32, &(pMACHeader->addr3[0]), 6);
- wValue = pMACHeader->seq_ctrl;
- wValue &= 0x000F;
- wValue = cpu_to_le16(wValue);
- memcpy(pMICHDR+38, (u8 *)&wValue, 2); // MSKSEQCTL
- if (pDevice->bLongHeader) {
- memcpy(pMICHDR+40, &(pMACHeader->addr4[0]), 6);
- }
- }
+ switch (pTransmitKey->byCipherSuite) {
+ case KEY_CTL_WEP:
+ if (pTransmitKey->uKeyLength == WLAN_WEP232_KEYLEN) {
+ memcpy(pDevice->abyPRNG, (u8 *)&dwRevIVCounter, 3);
+ memcpy(pDevice->abyPRNG + 3, pTransmitKey->abyKey,
+ pTransmitKey->uKeyLength);
+ } else {
+ memcpy(pbyBuf, (u8 *)&dwRevIVCounter, 3);
+ memcpy(pbyBuf + 3, pTransmitKey->abyKey,
+ pTransmitKey->uKeyLength);
+ if (pTransmitKey->uKeyLength == WLAN_WEP40_KEYLEN) {
+ memcpy(pbyBuf+8, (u8 *)&dwRevIVCounter, 3);
+ memcpy(pbyBuf+11, pTransmitKey->abyKey,
+ pTransmitKey->uKeyLength);
+ }
+
+ memcpy(pDevice->abyPRNG, pbyBuf, 16);
+ }
+ /* Append IV after Mac Header */
+ *pdwIV &= WEP_IV_MASK;
+ *pdwIV |= (u32)pDevice->byKeyIndex << 30;
+ *pdwIV = cpu_to_le32(*pdwIV);
+
+ pDevice->dwIVCounter++;
+ if (pDevice->dwIVCounter > WEP_IV_MASK)
+ pDevice->dwIVCounter = 0;
+
+ break;
+ case KEY_CTL_TKIP:
+ pTransmitKey->wTSC15_0++;
+ if (pTransmitKey->wTSC15_0 == 0)
+ pTransmitKey->dwTSC47_16++;
+
+ TKIPvMixKey(pTransmitKey->abyKey, pDevice->abyCurrentNetAddr,
+ pTransmitKey->wTSC15_0, pTransmitKey->dwTSC47_16,
+ pDevice->abyPRNG);
+ memcpy(pbyBuf, pDevice->abyPRNG, 16);
+
+ /* Make IV */
+ memcpy(pdwIV, pDevice->abyPRNG, 3);
+
+ *(pbyIVHead+3) = (u8)(((pDevice->byKeyIndex << 6) &
+ 0xc0) | 0x20);
+ /* Append IV&ExtIV after Mac Header */
+ *pdwExtIV = cpu_to_le32(pTransmitKey->dwTSC47_16);
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "vFillTxKey()---- pdwExtIV: %x\n", *pdwExtIV);
+
+ break;
+ case KEY_CTL_CCMP:
+ pTransmitKey->wTSC15_0++;
+ if (pTransmitKey->wTSC15_0 == 0)
+ pTransmitKey->dwTSC47_16++;
+
+ memcpy(pbyBuf, pTransmitKey->abyKey, 16);
+
+ /* Make IV */
+ *pdwIV = 0;
+ *(pbyIVHead+3) = (u8)(((pDevice->byKeyIndex << 6) &
+ 0xc0) | 0x20);
+
+ *pdwIV |= cpu_to_le16((u16)(pTransmitKey->wTSC15_0));
+
+ /* Append IV&ExtIV after Mac Header */
+ *pdwExtIV = cpu_to_le32(pTransmitKey->dwTSC47_16);
+
+ if (!mic_hdr)
+ return;
+
+ /* MICHDR0 */
+ mic_hdr->id = 0x59;
+ mic_hdr->payload_len = cpu_to_be16(wPayloadLen);
+ memcpy(mic_hdr->mic_addr2, pMACHeader->addr2, ETH_ALEN);
+
+ mic_hdr->tsc_47_16 = cpu_to_be32(pTransmitKey->dwTSC47_16);
+ mic_hdr->tsc_15_0 = cpu_to_be16(pTransmitKey->wTSC15_0);
+
+ /* MICHDR1 */
+ if (pDevice->bLongHeader)
+ mic_hdr->hlen = cpu_to_be16(28);
+ else
+ mic_hdr->hlen = cpu_to_be16(22);
+
+ memcpy(mic_hdr->addr1, pMACHeader->addr1, ETH_ALEN);
+ memcpy(mic_hdr->addr2, pMACHeader->addr2, ETH_ALEN);
+
+ /* MICHDR2 */
+ memcpy(mic_hdr->addr3, pMACHeader->addr3, ETH_ALEN);
+ mic_hdr->frame_control = cpu_to_le16(pMACHeader->frame_control
+ & 0xc78f);
+ mic_hdr->seq_ctrl = cpu_to_le16(pMACHeader->seq_ctrl & 0xf);
+
+ if (pDevice->bLongHeader)
+ memcpy(mic_hdr->addr4, pMACHeader->addr4, ETH_ALEN);
+ }
}
static void s_vSWencryption(struct vnt_private *pDevice,
@@ -326,6 +331,12 @@ static void s_vSWencryption(struct vnt_private *pDevice,
}
}
+static u16 vnt_time_stamp_off(struct vnt_private *priv, u16 rate)
+{
+ return cpu_to_le16(wTimeStampOff[priv->byPreambleType % 2]
+ [rate % MAX_RATE]);
+}
+
/*byPktType : PK_TYPE_11A 0
PK_TYPE_11B 1
PK_TYPE_11GB 2
@@ -351,8 +362,15 @@ static u32 s_uGetTxRsvTime(struct vnt_private *pDevice, u8 byPktType,
}
}
+static u16 vnt_rxtx_rsvtime_le16(struct vnt_private *priv, u8 pkt_type,
+ u32 frame_length, u16 rate, int need_ack)
+{
+ return cpu_to_le16((u16)s_uGetTxRsvTime(priv, pkt_type,
+ frame_length, rate, need_ack));
+}
+
//byFreqType: 0=>5GHZ 1=>2.4GHZ
-static u32 s_uGetRTSCTSRsvTime(struct vnt_private *pDevice,
+static u16 s_uGetRTSCTSRsvTime(struct vnt_private *pDevice,
u8 byRTSRsvType, u8 byPktType, u32 cbFrameLength, u16 wCurrentRate)
{
u32 uRrvTime, uRTSTime, uCTSTime, uAckTime, uDataTime;
@@ -382,168 +400,30 @@ static u32 s_uGetRTSCTSRsvTime(struct vnt_private *pDevice,
//RTSRrvTime
uRrvTime = uRTSTime + uCTSTime + uAckTime + uDataTime + 3*pDevice->uSIFS;
- return uRrvTime;
+ return cpu_to_le16((u16)uRrvTime);
}
//byFreqType 0: 5GHz, 1:2.4Ghz
-static u32 s_uGetDataDuration(struct vnt_private *pDevice, u8 byDurType,
- u32 cbFrameLength, u8 byPktType, u16 wRate, int bNeedAck,
- u32 uFragIdx, u32 cbLastFragmentSize, u32 uMACfragNum,
- u8 byFBOption)
+static u16 s_uGetDataDuration(struct vnt_private *pDevice,
+ u8 byPktType, int bNeedAck)
{
- int bLastFrag = 0;
- u32 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) {
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
- return (pDevice->uSIFS + uAckTime);
- } else {
- return 0;
- }
- }
- else {//First Frag or Mid Frag
- if (uFragIdx == (uMACfragNum-2)) {
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wRate, bNeedAck);
- } else {
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
- }
- if (bNeedAck) {
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
- return (pDevice->uSIFS + uAckTime + uNextPktTime);
- } else {
- return (pDevice->uSIFS + uNextPktTime);
- }
- }
- break;
-
- case DATADUR_A: //DATADUR_A
- if (((uMACfragNum==1)) || (bLastFrag==1)) {//Non Frag or Last Frag
- if(bNeedAck){
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
- return (pDevice->uSIFS + uAckTime);
- } else {
- return 0;
- }
- }
- else {//First Frag or Mid Frag
- if(uFragIdx == (uMACfragNum-2)){
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wRate, bNeedAck);
- } else {
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
- }
- if(bNeedAck){
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
- return (pDevice->uSIFS + uAckTime + uNextPktTime);
- } else {
- return (pDevice->uSIFS + uNextPktTime);
- }
- }
- break;
-
- case DATADUR_A_F0: //DATADUR_A_F0
- if (((uMACfragNum==1)) || (bLastFrag==1)) {//Non Frag or Last Frag
- if(bNeedAck){
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
- return (pDevice->uSIFS + uAckTime);
- } else {
- return 0;
- }
- }
- else { //First Frag or Mid Frag
- if (byFBOption == AUTO_FB_0) {
- if (wRate < RATE_18M)
- wRate = RATE_18M;
- else if (wRate > RATE_54M)
- wRate = RATE_54M;
-
- if(uFragIdx == (uMACfragNum-2)){
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck);
- } else {
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck);
- }
- } else { // (byFBOption == AUTO_FB_1)
- if (wRate < RATE_18M)
- wRate = RATE_18M;
- else if (wRate > RATE_54M)
- wRate = RATE_54M;
-
- if(uFragIdx == (uMACfragNum-2)){
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck);
- } else {
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck);
- }
- }
-
- if(bNeedAck){
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
- return (pDevice->uSIFS + uAckTime + uNextPktTime);
- } else {
- return (pDevice->uSIFS + uNextPktTime);
- }
- }
- break;
-
- case DATADUR_A_F1: //DATADUR_A_F1
- if (((uMACfragNum==1)) || (bLastFrag==1)) {//Non Frag or Last Frag
- if(bNeedAck){
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
- return (pDevice->uSIFS + uAckTime);
- } else {
- return 0;
- }
- }
- else { //First Frag or Mid Frag
- if (byFBOption == AUTO_FB_0) {
- if (wRate < RATE_18M)
- wRate = RATE_18M;
- else if (wRate > RATE_54M)
- wRate = RATE_54M;
-
- if(uFragIdx == (uMACfragNum-2)){
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck);
- } else {
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck);
- }
-
- } else { // (byFBOption == AUTO_FB_1)
- if (wRate < RATE_18M)
- wRate = RATE_18M;
- else if (wRate > RATE_54M)
- wRate = RATE_54M;
-
- if(uFragIdx == (uMACfragNum-2)){
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck);
- } else {
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck);
- }
- }
- if(bNeedAck){
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
- return (pDevice->uSIFS + uAckTime + uNextPktTime);
- } else {
- return (pDevice->uSIFS + uNextPktTime);
- }
- }
- break;
-
- default:
- break;
- }
+ u32 uAckTime = 0;
+
+ if (bNeedAck) {
+ if (byPktType == PK_TYPE_11B)
+ uAckTime = BBuGetFrameTime(pDevice->byPreambleType,
+ byPktType, 14, pDevice->byTopCCKBasicRate);
+ else
+ uAckTime = BBuGetFrameTime(pDevice->byPreambleType,
+ byPktType, 14, pDevice->byTopOFDMBasicRate);
+ return cpu_to_le16((u16)(pDevice->uSIFS + uAckTime));
+ }
- ASSERT(false);
return 0;
}
//byFreqType: 0=>5GHZ 1=>2.4GHZ
-static u32 s_uGetRTSCTSDuration(struct vnt_private *pDevice, u8 byDurType,
+static u16 s_uGetRTSCTSDuration(struct vnt_private *pDevice, u8 byDurType,
u32 cbFrameLength, u8 byPktType, u16 wRate, int bNeedAck,
u8 byFBOption)
{
@@ -626,14 +506,12 @@ static u32 s_uGetRTSCTSDuration(struct vnt_private *pDevice, u8 byDurType,
break;
}
- return uDurTime;
-
+ return cpu_to_le16((u16)uDurTime);
}
static u32 s_uFillDataHead(struct vnt_private *pDevice,
u8 byPktType, u16 wCurrentRate, void *pTxDataHead, u32 cbFrameLength,
- u32 uDMAIdx, int bNeedAck, u32 uFragIdx, u32 cbLastFragmentSize,
- u32 uMACfragNum, u8 byFBOption)
+ u32 uDMAIdx, int bNeedAck, u8 byFBOption)
{
if (pTxDataHead == NULL) {
@@ -641,409 +519,301 @@ static u32 s_uFillDataHead(struct vnt_private *pDevice,
}
if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
- if ((uDMAIdx == TYPE_ATIMDMA) || (uDMAIdx == TYPE_BEACONDMA)) {
- PSTxDataHead_ab pBuf = (PSTxDataHead_ab) pTxDataHead;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
- (u16 *)&(pBuf->wTransmitLength), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField)
- );
- //Get Duration and TimeStampOff
- pBuf->wDuration = (u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx,
- cbLastFragmentSize, uMACfragNum,
- byFBOption); //1: 2.4GHz
- if(uDMAIdx!=TYPE_ATIMDMA) {
- pBuf->wTimeStampOff = wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE];
- }
- return (pBuf->wDuration);
- }
- else { // DATA & MANAGE Frame
if (byFBOption == AUTO_FB_NONE) {
- PSTxDataHead_g pBuf = (PSTxDataHead_g)pTxDataHead;
+ struct vnt_tx_datahead_g *pBuf =
+ (struct vnt_tx_datahead_g *)pTxDataHead;
//Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
- (u16 *)&(pBuf->wTransmitLength_a), (u8 *)&(pBuf->byServiceField_a), (u8 *)&(pBuf->bySignalField_a)
- );
- BBvCalculateParameter(pDevice, cbFrameLength, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
- (u16 *)&(pBuf->wTransmitLength_b), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b)
- );
+ BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate,
+ byPktType, &pBuf->a);
+ BBvCalculateParameter(pDevice, cbFrameLength,
+ pDevice->byTopCCKBasicRate, PK_TYPE_11B, &pBuf->b);
//Get Duration and TimeStamp
- pBuf->wDuration_a = (u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength,
- byPktType, wCurrentRate, bNeedAck, uFragIdx,
- cbLastFragmentSize, uMACfragNum,
- byFBOption); //1: 2.4GHz
- pBuf->wDuration_b = (u16)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength,
- PK_TYPE_11B, pDevice->byTopCCKBasicRate,
- bNeedAck, uFragIdx, cbLastFragmentSize,
- uMACfragNum, byFBOption); //1: 2.4GHz
-
- pBuf->wTimeStampOff_a = wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE];
- pBuf->wTimeStampOff_b = wTimeStampOff[pDevice->byPreambleType%2][pDevice->byTopCCKBasicRate%MAX_RATE];
+ pBuf->wDuration_a = s_uGetDataDuration(pDevice,
+ byPktType, bNeedAck);
+ pBuf->wDuration_b = s_uGetDataDuration(pDevice,
+ PK_TYPE_11B, bNeedAck);
+
+ pBuf->wTimeStampOff_a = vnt_time_stamp_off(pDevice,
+ wCurrentRate);
+ pBuf->wTimeStampOff_b = vnt_time_stamp_off(pDevice,
+ pDevice->byTopCCKBasicRate);
return (pBuf->wDuration_a);
} else {
// Auto Fallback
- PSTxDataHead_g_FB pBuf = (PSTxDataHead_g_FB)pTxDataHead;
+ struct vnt_tx_datahead_g_fb *pBuf =
+ (struct vnt_tx_datahead_g_fb *)pTxDataHead;
//Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
- (u16 *)&(pBuf->wTransmitLength_a), (u8 *)&(pBuf->byServiceField_a), (u8 *)&(pBuf->bySignalField_a)
- );
- BBvCalculateParameter(pDevice, cbFrameLength, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
- (u16 *)&(pBuf->wTransmitLength_b), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b)
- );
+ BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate,
+ byPktType, &pBuf->a);
+ BBvCalculateParameter(pDevice, cbFrameLength,
+ pDevice->byTopCCKBasicRate, PK_TYPE_11B, &pBuf->b);
//Get Duration and TimeStamp
- pBuf->wDuration_a = (u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption); //1: 2.4GHz
- pBuf->wDuration_b = (u16)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, PK_TYPE_11B,
- pDevice->byTopCCKBasicRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption); //1: 2.4GHz
- pBuf->wDuration_a_f0 = (u16)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption); //1: 2.4GHz
- pBuf->wDuration_a_f1 = (u16)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption); //1: 2.4GHz
- pBuf->wTimeStampOff_a = wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE];
- pBuf->wTimeStampOff_b = wTimeStampOff[pDevice->byPreambleType%2][pDevice->byTopCCKBasicRate%MAX_RATE];
+ pBuf->wDuration_a = s_uGetDataDuration(pDevice,
+ byPktType, bNeedAck);
+ pBuf->wDuration_b = s_uGetDataDuration(pDevice,
+ PK_TYPE_11B, bNeedAck);
+ pBuf->wDuration_a_f0 = s_uGetDataDuration(pDevice,
+ byPktType, bNeedAck);
+ pBuf->wDuration_a_f1 = s_uGetDataDuration(pDevice,
+ byPktType, bNeedAck);
+ pBuf->wTimeStampOff_a = vnt_time_stamp_off(pDevice,
+ wCurrentRate);
+ pBuf->wTimeStampOff_b = vnt_time_stamp_off(pDevice,
+ pDevice->byTopCCKBasicRate);
return (pBuf->wDuration_a);
} //if (byFBOption == AUTO_FB_NONE)
- }
}
else if (byPktType == PK_TYPE_11A) {
- if ((byFBOption != AUTO_FB_NONE) && (uDMAIdx != TYPE_ATIMDMA) && (uDMAIdx != TYPE_BEACONDMA)) {
- // Auto Fallback
- PSTxDataHead_a_FB pBuf = (PSTxDataHead_a_FB)pTxDataHead;
+ if (byFBOption != AUTO_FB_NONE) {
+ struct vnt_tx_datahead_a_fb *pBuf =
+ (struct vnt_tx_datahead_a_fb *)pTxDataHead;
//Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
- (u16 *)&(pBuf->wTransmitLength), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField)
- );
+ BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate,
+ byPktType, &pBuf->a);
//Get Duration and TimeStampOff
- pBuf->wDuration = (u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption); //0: 5GHz
- pBuf->wDuration_f0 = (u16)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption); //0: 5GHz
- pBuf->wDuration_f1 = (u16)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption); //0: 5GHz
- if(uDMAIdx!=TYPE_ATIMDMA) {
- pBuf->wTimeStampOff = wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE];
- }
+ pBuf->wDuration = s_uGetDataDuration(pDevice,
+ byPktType, bNeedAck);
+ pBuf->wDuration_f0 = s_uGetDataDuration(pDevice,
+ byPktType, bNeedAck);
+ pBuf->wDuration_f1 = s_uGetDataDuration(pDevice,
+ byPktType, bNeedAck);
+ pBuf->wTimeStampOff = vnt_time_stamp_off(pDevice,
+ wCurrentRate);
return (pBuf->wDuration);
} else {
- PSTxDataHead_ab pBuf = (PSTxDataHead_ab)pTxDataHead;
+ struct vnt_tx_datahead_ab *pBuf =
+ (struct vnt_tx_datahead_ab *)pTxDataHead;
//Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
- (u16 *)&(pBuf->wTransmitLength), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField)
- );
+ BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate,
+ byPktType, &pBuf->ab);
//Get Duration and TimeStampOff
- pBuf->wDuration = (u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx,
- cbLastFragmentSize, uMACfragNum,
- byFBOption);
-
- if(uDMAIdx!=TYPE_ATIMDMA) {
- pBuf->wTimeStampOff = wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE];
- }
+ pBuf->wDuration = s_uGetDataDuration(pDevice,
+ byPktType, bNeedAck);
+ pBuf->wTimeStampOff = vnt_time_stamp_off(pDevice,
+ wCurrentRate);
return (pBuf->wDuration);
}
}
else if (byPktType == PK_TYPE_11B) {
- PSTxDataHead_ab pBuf = (PSTxDataHead_ab)pTxDataHead;
+ struct vnt_tx_datahead_ab *pBuf =
+ (struct vnt_tx_datahead_ab *)pTxDataHead;
//Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
- (u16 *)&(pBuf->wTransmitLength), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField)
- );
+ BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate,
+ byPktType, &pBuf->ab);
//Get Duration and TimeStampOff
- pBuf->wDuration = (u16)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx,
- cbLastFragmentSize, uMACfragNum,
- byFBOption);
- if (uDMAIdx != TYPE_ATIMDMA) {
- pBuf->wTimeStampOff = wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE];
- }
+ pBuf->wDuration = s_uGetDataDuration(pDevice,
+ byPktType, bNeedAck);
+ pBuf->wTimeStampOff = vnt_time_stamp_off(pDevice,
+ wCurrentRate);
return (pBuf->wDuration);
}
return 0;
}
-static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType,
- void *pvRTS, u32 cbFrameLength, int bNeedAck, int bDisCRC,
- struct ethhdr *psEthHeader, u16 wCurrentRate, u8 byFBOption)
+static int vnt_fill_ieee80211_rts(struct vnt_private *priv,
+ struct ieee80211_rts *rts, struct ethhdr *eth_hdr,
+ u16 duration)
{
- u32 uRTSFrameLen = 20;
- u16 wLen = 0;
+ rts->duration = duration;
+ rts->frame_control = TYPE_CTL_RTS;
- if (pvRTS == NULL)
- return;
+ if (priv->eOPMode == OP_MODE_ADHOC || priv->eOPMode == OP_MODE_AP)
+ memcpy(rts->ra, eth_hdr->h_dest, ETH_ALEN);
+ else
+ memcpy(rts->ra, priv->abyBSSID, ETH_ALEN);
- if (bDisCRC) {
- // When CRCDIS bit is on, H/W forgot to generate FCS for RTS frame,
- // in this case we need to decrease its length by 4.
- uRTSFrameLen -= 4;
- }
+ if (priv->eOPMode == OP_MODE_AP)
+ memcpy(rts->ta, priv->abyBSSID, ETH_ALEN);
+ else
+ memcpy(rts->ta, eth_hdr->h_source, ETH_ALEN);
- // Note: So far RTSHead doesn't appear in ATIM & Beacom DMA, so we don't need to take them into account.
- // Otherwise, we need to modified codes for them.
- if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
- if (byFBOption == AUTO_FB_NONE) {
- PSRTS_g pBuf = (PSRTS_g)pvRTS;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
- (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b)
- );
- pBuf->wTransmitLength_b = cpu_to_le16(wLen);
- BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType,
- (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_a), (u8 *)&(pBuf->bySignalField_a)
- );
- pBuf->wTransmitLength_a = cpu_to_le16(wLen);
- //Get Duration
- pBuf->wDuration_bb = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, PK_TYPE_11B, pDevice->byTopCCKBasicRate, bNeedAck, byFBOption)); //0:RTSDuration_bb, 1:2.4G, 1:CCKData
- pBuf->wDuration_aa = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //2:RTSDuration_aa, 1:2.4G, 2,3: 2.4G OFDMData
- pBuf->wDuration_ba = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //1:RTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data
-
- pBuf->Data.wDurationID = pBuf->wDuration_aa;
- //Get RTS Frame body
- pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4
+ return 0;
+}
- if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
- (pDevice->eOPMode == OP_MODE_AP)) {
- memcpy(&(pBuf->Data.abyRA[0]),
- &(psEthHeader->h_dest[0]),
- ETH_ALEN);
- }
- else {
- memcpy(&(pBuf->Data.abyRA[0]),
- &(pDevice->abyBSSID[0]),
- ETH_ALEN);
- }
- if (pDevice->eOPMode == OP_MODE_AP) {
- memcpy(&(pBuf->Data.abyTA[0]),
- &(pDevice->abyBSSID[0]),
- ETH_ALEN);
- }
- else {
- memcpy(&(pBuf->Data.abyTA[0]),
- &(psEthHeader->h_source[0]),
- ETH_ALEN);
- }
- }
- else {
- PSRTS_g_FB pBuf = (PSRTS_g_FB)pvRTS;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
- (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b)
- );
- pBuf->wTransmitLength_b = cpu_to_le16(wLen);
- BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType,
- (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_a), (u8 *)&(pBuf->bySignalField_a)
- );
- pBuf->wTransmitLength_a = cpu_to_le16(wLen);
- //Get Duration
- pBuf->wDuration_bb = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, PK_TYPE_11B, pDevice->byTopCCKBasicRate, bNeedAck, byFBOption)); //0:RTSDuration_bb, 1:2.4G, 1:CCKData
- pBuf->wDuration_aa = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //2:RTSDuration_aa, 1:2.4G, 2,3:2.4G OFDMData
- pBuf->wDuration_ba = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //1:RTSDuration_ba, 1:2.4G, 2,3:2.4G OFDMData
- pBuf->wRTSDuration_ba_f0 = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //4:wRTSDuration_ba_f0, 1:2.4G, 1:CCKData
- pBuf->wRTSDuration_aa_f0 = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //5:wRTSDuration_aa_f0, 1:2.4G, 1:CCKData
- pBuf->wRTSDuration_ba_f1 = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //6:wRTSDuration_ba_f1, 1:2.4G, 1:CCKData
- pBuf->wRTSDuration_aa_f1 = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //7:wRTSDuration_aa_f1, 1:2.4G, 1:CCKData
- pBuf->Data.wDurationID = pBuf->wDuration_aa;
- //Get RTS Frame body
- pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4
+static int vnt_rxtx_rts_g_head(struct vnt_private *priv,
+ struct vnt_rts_g *buf, struct ethhdr *eth_hdr,
+ u8 pkt_type, u32 frame_len, int need_ack,
+ u16 current_rate, u8 fb_option)
+{
+ u16 rts_frame_len = 20;
- if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
- (pDevice->eOPMode == OP_MODE_AP)) {
- memcpy(&(pBuf->Data.abyRA[0]),
- &(psEthHeader->h_dest[0]),
- ETH_ALEN);
- }
- else {
- memcpy(&(pBuf->Data.abyRA[0]),
- &(pDevice->abyBSSID[0]),
- ETH_ALEN);
- }
+ BBvCalculateParameter(priv, rts_frame_len, priv->byTopCCKBasicRate,
+ PK_TYPE_11B, &buf->b);
+ BBvCalculateParameter(priv, rts_frame_len,
+ priv->byTopOFDMBasicRate, pkt_type, &buf->a);
- if (pDevice->eOPMode == OP_MODE_AP) {
- memcpy(&(pBuf->Data.abyTA[0]),
- &(pDevice->abyBSSID[0]),
- ETH_ALEN);
- }
- else {
- memcpy(&(pBuf->Data.abyTA[0]),
- &(psEthHeader->h_source[0]),
- ETH_ALEN);
- }
+ buf->wDuration_bb = s_uGetRTSCTSDuration(priv, RTSDUR_BB, frame_len,
+ PK_TYPE_11B, priv->byTopCCKBasicRate, need_ack, fb_option);
+ buf->wDuration_aa = s_uGetRTSCTSDuration(priv, RTSDUR_AA, frame_len,
+ pkt_type, current_rate, need_ack, fb_option);
+ buf->wDuration_ba = s_uGetRTSCTSDuration(priv, RTSDUR_BA, frame_len,
+ pkt_type, current_rate, need_ack, fb_option);
- } // if (byFBOption == AUTO_FB_NONE)
- }
- else if (byPktType == PK_TYPE_11A) {
- if (byFBOption == AUTO_FB_NONE) {
- PSRTS_ab pBuf = (PSRTS_ab)pvRTS;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType,
- (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField)
- );
- pBuf->wTransmitLength = cpu_to_le16(wLen);
- //Get Duration
- pBuf->wDuration = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_aa, 0:5G, 0: 5G OFDMData
- pBuf->Data.wDurationID = pBuf->wDuration;
- //Get RTS Frame body
- pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4
+ vnt_fill_ieee80211_rts(priv, &buf->data, eth_hdr, buf->wDuration_aa);
- if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
- (pDevice->eOPMode == OP_MODE_AP)) {
- memcpy(&(pBuf->Data.abyRA[0]),
- &(psEthHeader->h_dest[0]),
- ETH_ALEN);
- } else {
- memcpy(&(pBuf->Data.abyRA[0]),
- &(pDevice->abyBSSID[0]),
- ETH_ALEN);
- }
+ return 0;
+}
- if (pDevice->eOPMode == OP_MODE_AP) {
- memcpy(&(pBuf->Data.abyTA[0]),
- &(pDevice->abyBSSID[0]),
- ETH_ALEN);
- } else {
- memcpy(&(pBuf->Data.abyTA[0]),
- &(psEthHeader->h_source[0]),
- ETH_ALEN);
- }
+static int vnt_rxtx_rts_g_fb_head(struct vnt_private *priv,
+ struct vnt_rts_g_fb *buf, struct ethhdr *eth_hdr,
+ u8 pkt_type, u32 frame_len, int need_ack,
+ u16 current_rate, u8 fb_option)
+{
+ u16 rts_frame_len = 20;
- }
- else {
- PSRTS_a_FB pBuf = (PSRTS_a_FB)pvRTS;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType,
- (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField)
- );
- pBuf->wTransmitLength = cpu_to_le16(wLen);
- //Get Duration
- pBuf->wDuration = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_aa, 0:5G, 0: 5G OFDMData
- pBuf->wRTSDuration_f0 = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //5:RTSDuration_aa_f0, 0:5G, 0: 5G OFDMData
- pBuf->wRTSDuration_f1 = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //7:RTSDuration_aa_f1, 0:5G, 0:
- pBuf->Data.wDurationID = pBuf->wDuration;
- //Get RTS Frame body
- pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4
+ BBvCalculateParameter(priv, rts_frame_len, priv->byTopCCKBasicRate,
+ PK_TYPE_11B, &buf->b);
+ BBvCalculateParameter(priv, rts_frame_len,
+ priv->byTopOFDMBasicRate, pkt_type, &buf->a);
- if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
- (pDevice->eOPMode == OP_MODE_AP)) {
- memcpy(&(pBuf->Data.abyRA[0]),
- &(psEthHeader->h_dest[0]),
- ETH_ALEN);
- } else {
- memcpy(&(pBuf->Data.abyRA[0]),
- &(pDevice->abyBSSID[0]),
- ETH_ALEN);
- }
- if (pDevice->eOPMode == OP_MODE_AP) {
- memcpy(&(pBuf->Data.abyTA[0]),
- &(pDevice->abyBSSID[0]),
- ETH_ALEN);
- } else {
- memcpy(&(pBuf->Data.abyTA[0]),
- &(psEthHeader->h_source[0]),
- ETH_ALEN);
- }
- }
- }
- else if (byPktType == PK_TYPE_11B) {
- PSRTS_ab pBuf = (PSRTS_ab)pvRTS;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
- (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField)
- );
- pBuf->wTransmitLength = cpu_to_le16(wLen);
- //Get Duration
- pBuf->wDuration = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_bb, 1:2.4G, 1:CCKData
- pBuf->Data.wDurationID = pBuf->wDuration;
- //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->h_dest[0]),
- ETH_ALEN);
- }
- else {
- memcpy(&(pBuf->Data.abyRA[0]),
- &(pDevice->abyBSSID[0]),
- ETH_ALEN);
- }
+ buf->wDuration_bb = s_uGetRTSCTSDuration(priv, RTSDUR_BB, frame_len,
+ PK_TYPE_11B, priv->byTopCCKBasicRate, need_ack, fb_option);
+ buf->wDuration_aa = s_uGetRTSCTSDuration(priv, RTSDUR_AA, frame_len,
+ pkt_type, current_rate, need_ack, fb_option);
+ buf->wDuration_ba = s_uGetRTSCTSDuration(priv, RTSDUR_BA, frame_len,
+ pkt_type, current_rate, need_ack, fb_option);
- if (pDevice->eOPMode == OP_MODE_AP) {
- memcpy(&(pBuf->Data.abyTA[0]),
- &(pDevice->abyBSSID[0]),
- ETH_ALEN);
- } else {
- memcpy(&(pBuf->Data.abyTA[0]),
- &(psEthHeader->h_source[0]),
- ETH_ALEN);
- }
- }
+
+ buf->wRTSDuration_ba_f0 = s_uGetRTSCTSDuration(priv, RTSDUR_BA_F0,
+ frame_len, pkt_type, current_rate, need_ack, fb_option);
+ buf->wRTSDuration_aa_f0 = s_uGetRTSCTSDuration(priv, RTSDUR_AA_F0,
+ frame_len, pkt_type, current_rate, need_ack, fb_option);
+ buf->wRTSDuration_ba_f1 = s_uGetRTSCTSDuration(priv, RTSDUR_BA_F1,
+ frame_len, pkt_type, current_rate, need_ack, fb_option);
+ buf->wRTSDuration_aa_f1 = s_uGetRTSCTSDuration(priv, RTSDUR_AA_F1,
+ frame_len, pkt_type, current_rate, need_ack, fb_option);
+
+ vnt_fill_ieee80211_rts(priv, &buf->data, eth_hdr, buf->wDuration_aa);
+
+ return 0;
}
-static void s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx,
- u8 byPktType, void *pvCTS, u32 cbFrameLength, int bNeedAck,
- int bDisCRC, u16 wCurrentRate, u8 byFBOption)
+static int vnt_rxtx_rts_ab_head(struct vnt_private *priv,
+ struct vnt_rts_ab *buf, struct ethhdr *eth_hdr,
+ u8 pkt_type, u32 frame_len, int need_ack,
+ u16 current_rate, u8 fb_option)
{
- u32 uCTSFrameLen = 14;
- u16 wLen = 0;
+ u16 rts_frame_len = 20;
- if (pvCTS == NULL) {
- return;
- }
+ BBvCalculateParameter(priv, rts_frame_len,
+ priv->byTopOFDMBasicRate, pkt_type, &buf->ab);
- if (bDisCRC) {
- // When CRCDIS bit is on, H/W forgot to generate FCS for CTS frame,
- // in this case we need to decrease its length by 4.
- uCTSFrameLen -= 4;
- }
+ buf->wDuration = s_uGetRTSCTSDuration(priv, RTSDUR_AA, frame_len,
+ pkt_type, current_rate, need_ack, fb_option);
- if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
- if (byFBOption != AUTO_FB_NONE && uDMAIdx != TYPE_ATIMDMA && uDMAIdx != TYPE_BEACONDMA) {
- // Auto Fall back
- PSCTS_FB pBuf = (PSCTS_FB)pvCTS;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, uCTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
- (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b)
- );
- pBuf->wTransmitLength_b = cpu_to_le16(wLen);
- pBuf->wDuration_ba = (u16)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //3:CTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data
- pBuf->wDuration_ba += pDevice->wCTSDuration;
- pBuf->wDuration_ba = cpu_to_le16(pBuf->wDuration_ba);
- //Get CTSDuration_ba_f0
- pBuf->wCTSDuration_ba_f0 = (u16)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //8:CTSDuration_ba_f0, 1:2.4G, 2,3:2.4G OFDM Data
- pBuf->wCTSDuration_ba_f0 += pDevice->wCTSDuration;
- pBuf->wCTSDuration_ba_f0 = cpu_to_le16(pBuf->wCTSDuration_ba_f0);
- //Get CTSDuration_ba_f1
- pBuf->wCTSDuration_ba_f1 = (u16)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //9:CTSDuration_ba_f1, 1:2.4G, 2,3:2.4G OFDM Data
- pBuf->wCTSDuration_ba_f1 += pDevice->wCTSDuration;
- pBuf->wCTSDuration_ba_f1 = cpu_to_le16(pBuf->wCTSDuration_ba_f1);
- //Get CTS Frame body
- pBuf->Data.wDurationID = pBuf->wDuration_ba;
- pBuf->Data.wFrameControl = TYPE_CTL_CTS;//0x00C4
- pBuf->Data.wReserved = 0x0000;
- memcpy(&(pBuf->Data.abyRA[0]),
- &(pDevice->abyCurrentNetAddr[0]),
- ETH_ALEN);
- } else { //if (byFBOption != AUTO_FB_NONE && uDMAIdx != TYPE_ATIMDMA && uDMAIdx != TYPE_BEACONDMA)
- PSCTS pBuf = (PSCTS)pvCTS;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, uCTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
- (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b)
- );
- pBuf->wTransmitLength_b = cpu_to_le16(wLen);
- //Get CTSDuration_ba
- pBuf->wDuration_ba = cpu_to_le16((u16)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //3:CTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data
- pBuf->wDuration_ba += pDevice->wCTSDuration;
- pBuf->wDuration_ba = cpu_to_le16(pBuf->wDuration_ba);
-
- //Get CTS Frame body
- pBuf->Data.wDurationID = pBuf->wDuration_ba;
- pBuf->Data.wFrameControl = TYPE_CTL_CTS;//0x00C4
- pBuf->Data.wReserved = 0x0000;
- memcpy(&(pBuf->Data.abyRA[0]),
- &(pDevice->abyCurrentNetAddr[0]),
- ETH_ALEN);
+ vnt_fill_ieee80211_rts(priv, &buf->data, eth_hdr, buf->wDuration);
+
+ return 0;
+}
+
+static int vnt_rxtx_rts_a_fb_head(struct vnt_private *priv,
+ struct vnt_rts_a_fb *buf, struct ethhdr *eth_hdr,
+ u8 pkt_type, u32 frame_len, int need_ack,
+ u16 current_rate, u8 fb_option)
+{
+ u16 rts_frame_len = 20;
+
+ BBvCalculateParameter(priv, rts_frame_len,
+ priv->byTopOFDMBasicRate, pkt_type, &buf->a);
+
+ buf->wDuration = s_uGetRTSCTSDuration(priv, RTSDUR_AA, frame_len,
+ pkt_type, current_rate, need_ack, fb_option);
+
+ buf->wRTSDuration_f0 = s_uGetRTSCTSDuration(priv, RTSDUR_AA_F0,
+ frame_len, pkt_type, current_rate, need_ack, fb_option);
+
+ buf->wRTSDuration_f1 = s_uGetRTSCTSDuration(priv, RTSDUR_AA_F1,
+ frame_len, pkt_type, current_rate, need_ack, fb_option);
+
+ vnt_fill_ieee80211_rts(priv, &buf->data, eth_hdr, buf->wDuration);
+
+ return 0;
+}
+
+static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType,
+ union vnt_tx_data_head *head, u32 cbFrameLength, int bNeedAck,
+ struct ethhdr *psEthHeader, u16 wCurrentRate, u8 byFBOption)
+{
+
+ if (!head)
+ return;
+
+ /* Note: So far RTSHead doesn't appear in ATIM
+ * & Beacom DMA, so we don't need to take them
+ * into account.
+ * Otherwise, we need to modified codes for them.
+ */
+ switch (byPktType) {
+ case PK_TYPE_11GB:
+ case PK_TYPE_11GA:
+ if (byFBOption == AUTO_FB_NONE)
+ vnt_rxtx_rts_g_head(pDevice, &head->rts_g,
+ psEthHeader, byPktType, cbFrameLength,
+ bNeedAck, wCurrentRate, byFBOption);
+ else
+ vnt_rxtx_rts_g_fb_head(pDevice, &head->rts_g_fb,
+ psEthHeader, byPktType, cbFrameLength,
+ bNeedAck, wCurrentRate, byFBOption);
+ break;
+ case PK_TYPE_11A:
+ if (byFBOption) {
+ vnt_rxtx_rts_a_fb_head(pDevice, &head->rts_a_fb,
+ psEthHeader, byPktType, cbFrameLength,
+ bNeedAck, wCurrentRate, byFBOption);
+ break;
+ }
+ case PK_TYPE_11B:
+ vnt_rxtx_rts_ab_head(pDevice, &head->rts_ab,
+ psEthHeader, byPktType, cbFrameLength,
+ bNeedAck, wCurrentRate, byFBOption);
+ }
+}
+
+static void s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx,
+ u8 byPktType, union vnt_tx_data_head *head, u32 cbFrameLength,
+ int bNeedAck, u16 wCurrentRate, u8 byFBOption)
+{
+ u32 uCTSFrameLen = 14;
+
+ if (!head)
+ return;
+
+ if (byFBOption != AUTO_FB_NONE) {
+ /* Auto Fall back */
+ struct vnt_cts_fb *pBuf = &head->cts_g_fb;
+ /* Get SignalField,ServiceField,Length */
+ BBvCalculateParameter(pDevice, uCTSFrameLen,
+ pDevice->byTopCCKBasicRate, PK_TYPE_11B, &pBuf->b);
+ pBuf->wDuration_ba = s_uGetRTSCTSDuration(pDevice, CTSDUR_BA,
+ cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck, byFBOption);
+ /* Get CTSDuration_ba_f0 */
+ pBuf->wCTSDuration_ba_f0 = s_uGetRTSCTSDuration(pDevice,
+ CTSDUR_BA_F0, cbFrameLength, byPktType, wCurrentRate,
+ bNeedAck, byFBOption);
+ /* Get CTSDuration_ba_f1 */
+ pBuf->wCTSDuration_ba_f1 = s_uGetRTSCTSDuration(pDevice,
+ CTSDUR_BA_F1, cbFrameLength, byPktType, wCurrentRate,
+ bNeedAck, byFBOption);
+ /* Get CTS Frame body */
+ pBuf->data.duration = pBuf->wDuration_ba;
+ pBuf->data.frame_control = TYPE_CTL_CTS;
+ memcpy(pBuf->data.ra, pDevice->abyCurrentNetAddr, ETH_ALEN);
+ } else {
+ struct vnt_cts *pBuf = &head->cts_g;
+ /* Get SignalField,ServiceField,Length */
+ BBvCalculateParameter(pDevice, uCTSFrameLen,
+ pDevice->byTopCCKBasicRate, PK_TYPE_11B, &pBuf->b);
+ /* Get CTSDuration_ba */
+ pBuf->wDuration_ba = s_uGetRTSCTSDuration(pDevice,
+ CTSDUR_BA, cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck, byFBOption);
+ /*Get CTS Frame body*/
+ pBuf->data.duration = pBuf->wDuration_ba;
+ pBuf->data.frame_control = TYPE_CTL_CTS;
+ memcpy(pBuf->data.ra, pDevice->abyCurrentNetAddr, ETH_ALEN);
}
- }
}
/*+
@@ -1071,12 +841,12 @@ static void s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx,
static void s_vGenerateTxParameter(struct vnt_private *pDevice,
u8 byPktType, u16 wCurrentRate, void *pTxBufHead, void *pvRrvTime,
- void *pvRTS, void *pvCTS, u32 cbFrameSize, int bNeedACK, u32 uDMAIdx,
- struct ethhdr *psEthHeader)
+ void *rts_cts, u32 cbFrameSize, int bNeedACK, u32 uDMAIdx,
+ struct ethhdr *psEthHeader, bool need_rts)
{
+ union vnt_tx_data_head *head = rts_cts;
u32 cbMACHdLen = WLAN_HDR_ADDR3_LEN; /* 24 */
u16 wFifoCtl;
- int bDisCRC = false;
u8 byFBOption = AUTO_FB_NONE;
//DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_vGenerateTxParameter...\n");
@@ -1084,10 +854,6 @@ static void s_vGenerateTxParameter(struct vnt_private *pDevice,
pFifoHead->wReserved = wCurrentRate;
wFifoCtl = pFifoHead->wFIFOCtl;
- if (wFifoCtl & FIFOCTL_CRCDIS) {
- bDisCRC = true;
- }
-
if (wFifoCtl & FIFOCTL_AUTO_FB_0) {
byFBOption = AUTO_FB_0;
}
@@ -1095,75 +861,87 @@ static void s_vGenerateTxParameter(struct vnt_private *pDevice,
byFBOption = AUTO_FB_1;
}
+ if (!pvRrvTime)
+ return;
+
if (pDevice->bLongHeader)
cbMACHdLen = WLAN_HDR_ADDR3_LEN + 6;
if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
-
- if (pvRTS != NULL) { //RTS_need
+ if (need_rts) {
//Fill RsvTime
- if (pvRrvTime) {
- PSRrvTime_gRTS pBuf = (PSRrvTime_gRTS)pvRrvTime;
- pBuf->wRTSTxRrvTime_aa = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate));//2:RTSTxRrvTime_aa, 1:2.4GHz
- pBuf->wRTSTxRrvTime_ba = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 1, byPktType, cbFrameSize, wCurrentRate));//1:RTSTxRrvTime_ba, 1:2.4GHz
- pBuf->wRTSTxRrvTime_bb = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate));//0:RTSTxRrvTime_bb, 1:2.4GHz
- pBuf->wTxRrvTime_a = cpu_to_le16((u16) s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));//2.4G OFDM
- pBuf->wTxRrvTime_b = cpu_to_le16((u16) s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK));//1:CCK
- }
- //Fill RTS
- s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption);
+ struct vnt_rrv_time_rts *pBuf =
+ (struct vnt_rrv_time_rts *)pvRrvTime;
+ pBuf->wRTSTxRrvTime_aa = s_uGetRTSCTSRsvTime(pDevice, 2,
+ byPktType, cbFrameSize, wCurrentRate);
+ pBuf->wRTSTxRrvTime_ba = s_uGetRTSCTSRsvTime(pDevice, 1,
+ byPktType, cbFrameSize, wCurrentRate);
+ pBuf->wRTSTxRrvTime_bb = s_uGetRTSCTSRsvTime(pDevice, 0,
+ byPktType, cbFrameSize, wCurrentRate);
+ pBuf->wTxRrvTime_a = vnt_rxtx_rsvtime_le16(pDevice,
+ byPktType, cbFrameSize, wCurrentRate, bNeedACK);
+ pBuf->wTxRrvTime_b = vnt_rxtx_rsvtime_le16(pDevice,
+ PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate,
+ bNeedACK);
+ /* Fill RTS */
+ s_vFillRTSHead(pDevice, byPktType, head, cbFrameSize,
+ bNeedACK, psEthHeader, wCurrentRate, byFBOption);
}
else {//RTS_needless, PCF mode
-
//Fill RsvTime
- if (pvRrvTime) {
- PSRrvTime_gCTS pBuf = (PSRrvTime_gCTS)pvRrvTime;
- pBuf->wTxRrvTime_a = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));//2.4G OFDM
- pBuf->wTxRrvTime_b = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK));//1:CCK
- pBuf->wCTSTxRrvTime_ba = cpu_to_le16((u16)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);
+ struct vnt_rrv_time_cts *pBuf =
+ (struct vnt_rrv_time_cts *)pvRrvTime;
+ pBuf->wTxRrvTime_a = vnt_rxtx_rsvtime_le16(pDevice, byPktType,
+ cbFrameSize, wCurrentRate, bNeedACK);
+ pBuf->wTxRrvTime_b = vnt_rxtx_rsvtime_le16(pDevice,
+ PK_TYPE_11B, cbFrameSize,
+ pDevice->byTopCCKBasicRate, bNeedACK);
+ pBuf->wCTSTxRrvTime_ba = s_uGetRTSCTSRsvTime(pDevice, 3,
+ byPktType, cbFrameSize, wCurrentRate);
+ /* Fill CTS */
+ s_vFillCTSHead(pDevice, uDMAIdx, byPktType, head,
+ cbFrameSize, bNeedACK, wCurrentRate, byFBOption);
}
}
else if (byPktType == PK_TYPE_11A) {
-
- if (pvRTS != NULL) {//RTS_need, non PCF mode
+ if (need_rts) {
//Fill RsvTime
- if (pvRrvTime) {
- PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime;
- pBuf->wRTSTxRrvTime = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate));//2:RTSTxRrvTime_aa, 0:5GHz
- pBuf->wTxRrvTime = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));//0:OFDM
- }
- //Fill RTS
- s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption);
- }
- else if (pvRTS == NULL) {//RTS_needless, non PCF mode
+ struct vnt_rrv_time_ab *pBuf =
+ (struct vnt_rrv_time_ab *)pvRrvTime;
+ pBuf->wRTSTxRrvTime = s_uGetRTSCTSRsvTime(pDevice, 2,
+ byPktType, cbFrameSize, wCurrentRate);
+ pBuf->wTxRrvTime = vnt_rxtx_rsvtime_le16(pDevice, byPktType,
+ cbFrameSize, wCurrentRate, bNeedACK);
+ /* Fill RTS */
+ s_vFillRTSHead(pDevice, byPktType, head, cbFrameSize,
+ bNeedACK, psEthHeader, wCurrentRate, byFBOption);
+ } else {
//Fill RsvTime
- if (pvRrvTime) {
- PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime;
- pBuf->wTxRrvTime = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, PK_TYPE_11A, cbFrameSize, wCurrentRate, bNeedACK)); //0:OFDM
- }
+ struct vnt_rrv_time_ab *pBuf =
+ (struct vnt_rrv_time_ab *)pvRrvTime;
+ pBuf->wTxRrvTime = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11A,
+ cbFrameSize, wCurrentRate, bNeedACK);
}
}
else if (byPktType == PK_TYPE_11B) {
-
- if ((pvRTS != NULL)) {//RTS_need, non PCF mode
+ if (need_rts) {
//Fill RsvTime
- if (pvRrvTime) {
- PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime;
- pBuf->wRTSTxRrvTime = cpu_to_le16((u16)s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate));//0:RTSTxRrvTime_bb, 1:2.4GHz
- pBuf->wTxRrvTime = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK));//1:CCK
- }
- //Fill RTS
- s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption);
+ struct vnt_rrv_time_ab *pBuf =
+ (struct vnt_rrv_time_ab *)pvRrvTime;
+ pBuf->wRTSTxRrvTime = s_uGetRTSCTSRsvTime(pDevice, 0,
+ byPktType, cbFrameSize, wCurrentRate);
+ pBuf->wTxRrvTime = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B,
+ cbFrameSize, wCurrentRate, bNeedACK);
+ /* Fill RTS */
+ s_vFillRTSHead(pDevice, byPktType, head, cbFrameSize,
+ bNeedACK, psEthHeader, wCurrentRate, byFBOption);
}
else { //RTS_needless, non PCF mode
//Fill RsvTime
- if (pvRrvTime) {
- PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime;
- pBuf->wTxRrvTime = cpu_to_le16((u16)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK)); //1:CCK
- }
+ struct vnt_rrv_time_ab *pBuf =
+ (struct vnt_rrv_time_ab *)pvRrvTime;
+ pBuf->wTxRrvTime = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B,
+ cbFrameSize, wCurrentRate, bNeedACK);
}
}
//DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_vGenerateTxParameter END.\n");
@@ -1175,17 +953,18 @@ static void s_vGenerateTxParameter(struct vnt_private *pDevice,
*/
static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType,
- u8 *usbPacketBuf, int bNeedEncryption, u32 uSkbPacketLen, u32 uDMAIdx,
- struct ethhdr *psEthHeader, u8 *pPacket, PSKeyItem pTransmitKey,
- u32 uNodeIndex, u16 wCurrentRate, u32 *pcbHeaderLen, u32 *pcbTotalLen)
+ struct vnt_tx_buffer *pTxBufHead, int bNeedEncryption,
+ u32 uSkbPacketLen, u32 uDMAIdx, struct ethhdr *psEthHeader,
+ u8 *pPacket, PSKeyItem pTransmitKey, u32 uNodeIndex, u16 wCurrentRate,
+ u32 *pcbHeaderLen, u32 *pcbTotalLen)
{
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
u32 cbFrameSize, cbFrameBodySize;
- PTX_BUFFER pTxBufHead;
u32 cb802_1_H_len;
u32 cbIVlen = 0, cbICVlen = 0, cbMIClen = 0, cbMACHdLen = 0;
u32 cbFCSlen = 4, cbMICHDR = 0;
- int bNeedACK, bRTS;
+ int bNeedACK;
+ bool bRTS = false;
u8 *pbyType, *pbyMacHdr, *pbyIVHead, *pbyPayloadHead, *pbyTxBufferAddr;
u8 abySNAP_RFC1042[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00};
u8 abySNAP_Bridgetunnel[ETH_ALEN]
@@ -1193,26 +972,22 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType,
u32 uDuration;
u32 cbHeaderLength = 0, uPadding = 0;
void *pvRrvTime;
- PSMICHDRHead pMICHDR;
- void *pvRTS;
- void *pvCTS;
+ struct vnt_mic_hdr *pMICHDR;
+ void *rts_cts = NULL;
void *pvTxDataHd;
u8 byFBOption = AUTO_FB_NONE, byFragType;
u16 wTxBufSize;
- u32 dwMICKey0, dwMICKey1, dwMIC_Priority, dwCRC;
+ u32 dwMICKey0, dwMICKey1, dwMIC_Priority;
u32 *pdwMIC_L, *pdwMIC_R;
int bSoftWEP = false;
- pvRrvTime = pMICHDR = pvRTS = pvCTS = pvTxDataHd = NULL;
+ pvRrvTime = pMICHDR = pvTxDataHd = NULL;
if (bNeedEncryption && pTransmitKey->pvKeyTable) {
if (((PSKeyTable)pTransmitKey->pvKeyTable)->bSoftWEP == true)
bSoftWEP = true; /* WEP 256 */
}
- pTxBufHead = (PTX_BUFFER) usbPacketBuf;
- memset(pTxBufHead, 0, sizeof(TX_BUFFER));
-
// Get pkt type
if (ntohs(psEthHeader->h_proto) > ETH_DATA_LEN) {
if (pDevice->dwDiagRefCount == 0) {
@@ -1257,10 +1032,6 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType,
if (pDevice->bLongHeader)
pTxBufHead->wFIFOCtl |= FIFOCTL_LHEAD;
- if (pDevice->bSoftwareGenCrcErr) {
- pTxBufHead->wFIFOCtl |= FIFOCTL_CRCDIS; // set tx descriptors to NO hardware CRC
- }
-
//Set FRAGCTL_MACHDCNT
if (pDevice->bLongHeader) {
cbMACHdLen = WLAN_HDR_ADDR3_LEN + 6;
@@ -1313,7 +1084,7 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType,
if (pTransmitKey->byCipherSuite == KEY_CTL_CCMP) {
cbIVlen = 8;//RSN Header
cbICVlen = 8;//MIC
- cbMICHDR = sizeof(SMICHDRHead);
+ cbMICHDR = sizeof(struct vnt_mic_hdr);
}
if (bSoftWEP == false) {
//MAC Header should be padding 0 to DW alignment.
@@ -1336,76 +1107,116 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType,
if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet
if (byFBOption == AUTO_FB_NONE) {
if (bRTS == true) {//RTS_need
- pvRrvTime = (PSRrvTime_gRTS) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS));
- pvRTS = (PSRTS_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR);
- pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g));
- cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g) + sizeof(STxDataHead_g);
+ pvRrvTime = (struct vnt_rrv_time_rts *)
+ (pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_rts));
+ rts_cts = (struct vnt_rts_g *) (pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_rts) + cbMICHDR);
+ pvTxDataHd = (struct vnt_tx_datahead_g *) (pbyTxBufferAddr +
+ wTxBufSize + sizeof(struct vnt_rrv_time_rts) +
+ cbMICHDR + sizeof(struct vnt_rts_g));
+ cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_rts) +
+ cbMICHDR + sizeof(struct vnt_rts_g) +
+ sizeof(struct vnt_tx_datahead_g);
}
else { //RTS_needless
- pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
- pvRTS = NULL;
- pvCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR);
- pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS));
- cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS) + sizeof(STxDataHead_g);
+ pvRrvTime = (struct vnt_rrv_time_cts *)
+ (pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_cts));
+ rts_cts = (struct vnt_cts *) (pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_cts) + cbMICHDR);
+ pvTxDataHd = (struct vnt_tx_datahead_g *)(pbyTxBufferAddr +
+ wTxBufSize + sizeof(struct vnt_rrv_time_cts) +
+ cbMICHDR + sizeof(struct vnt_cts));
+ cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_cts) +
+ cbMICHDR + sizeof(struct vnt_cts) +
+ sizeof(struct vnt_tx_datahead_g);
}
} else {
// Auto Fall Back
if (bRTS == true) {//RTS_need
- pvRrvTime = (PSRrvTime_gRTS) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS));
- pvRTS = (PSRTS_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR);
- pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g_FB));
- cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g_FB) + sizeof(STxDataHead_g_FB);
+ pvRrvTime = (struct vnt_rrv_time_rts *)(pbyTxBufferAddr +
+ wTxBufSize);
+ pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_rts));
+ rts_cts = (struct vnt_rts_g_fb *)(pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_rts) + cbMICHDR);
+ pvTxDataHd = (struct vnt_tx_datahead_g_fb *) (pbyTxBufferAddr +
+ wTxBufSize + sizeof(struct vnt_rrv_time_rts) +
+ cbMICHDR + sizeof(struct vnt_rts_g_fb));
+ cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_rts) +
+ cbMICHDR + sizeof(struct vnt_rts_g_fb) +
+ sizeof(struct vnt_tx_datahead_g_fb);
}
else if (bRTS == false) { //RTS_needless
- pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
- pvRTS = NULL;
- pvCTS = (PSCTS_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR);
- pvTxDataHd = (PSTxDataHead_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS_FB));
- cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS_FB) + sizeof(STxDataHead_g_FB);
+ pvRrvTime = (struct vnt_rrv_time_cts *)
+ (pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_cts));
+ rts_cts = (struct vnt_cts_fb *) (pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_cts) + cbMICHDR);
+ pvTxDataHd = (struct vnt_tx_datahead_g_fb *) (pbyTxBufferAddr +
+ wTxBufSize + sizeof(struct vnt_rrv_time_cts) +
+ cbMICHDR + sizeof(struct vnt_cts_fb));
+ cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_cts) +
+ cbMICHDR + sizeof(struct vnt_cts_fb) +
+ sizeof(struct vnt_tx_datahead_g_fb);
}
} // Auto Fall Back
}
else {//802.11a/b packet
if (byFBOption == AUTO_FB_NONE) {
if (bRTS == true) {//RTS_need
- pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
- pvRTS = (PSRTS_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
- pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR + sizeof(SRTS_ab));
- cbHeaderLength = wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_ab) + sizeof(STxDataHead_ab);
+ pvRrvTime = (struct vnt_rrv_time_ab *) (pbyTxBufferAddr +
+ wTxBufSize);
+ pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_ab));
+ rts_cts = (struct vnt_rts_ab *) (pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_ab) + cbMICHDR);
+ pvTxDataHd = (struct vnt_tx_datahead_ab *)(pbyTxBufferAddr +
+ wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR +
+ sizeof(struct vnt_rts_ab));
+ cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) +
+ cbMICHDR + sizeof(struct vnt_rts_ab) +
+ sizeof(struct vnt_tx_datahead_ab);
}
else if (bRTS == false) { //RTS_needless, no MICHDR
- pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
- pvRTS = NULL;
- pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
- cbHeaderLength = wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR + sizeof(STxDataHead_ab);
+ pvRrvTime = (struct vnt_rrv_time_ab *)(pbyTxBufferAddr +
+ wTxBufSize);
+ pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_ab));
+ pvTxDataHd = (struct vnt_tx_datahead_ab *)(pbyTxBufferAddr +
+ wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR);
+ cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) +
+ cbMICHDR + sizeof(struct vnt_tx_datahead_ab);
}
} else {
// Auto Fall Back
if (bRTS == true) {//RTS_need
- pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
- pvRTS = (PSRTS_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
- pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR + sizeof(SRTS_a_FB));
- cbHeaderLength = wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_a_FB) + sizeof(STxDataHead_a_FB);
+ pvRrvTime = (struct vnt_rrv_time_ab *)(pbyTxBufferAddr +
+ wTxBufSize);
+ pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_ab));
+ rts_cts = (struct vnt_rts_a_fb *)(pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_ab) + cbMICHDR);
+ pvTxDataHd = (struct vnt_tx_datahead_a_fb *)(pbyTxBufferAddr +
+ wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR +
+ sizeof(struct vnt_rts_a_fb));
+ cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) +
+ cbMICHDR + sizeof(struct vnt_rts_a_fb) +
+ sizeof(struct vnt_tx_datahead_a_fb);
}
else if (bRTS == false) { //RTS_needless
- pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
- pvRTS = NULL;
- pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
- cbHeaderLength = wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR + sizeof(STxDataHead_a_FB);
+ pvRrvTime = (struct vnt_rrv_time_ab *)(pbyTxBufferAddr +
+ wTxBufSize);
+ pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_ab));
+ pvTxDataHd = (struct vnt_tx_datahead_a_fb *)(pbyTxBufferAddr +
+ wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR);
+ cbHeaderLength = wTxBufSize + sizeof(struct vnt_rrv_time_ab) +
+ cbMICHDR + sizeof(struct vnt_tx_datahead_a_fb);
}
} // Auto Fall Back
}
@@ -1424,11 +1235,11 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType,
//Fill FIFO,RrvTime,RTS,and CTS
s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate,
- (void *)pbyTxBufferAddr, pvRrvTime, pvRTS, pvCTS,
- cbFrameSize, bNeedACK, uDMAIdx, psEthHeader);
+ (void *)pbyTxBufferAddr, pvRrvTime, rts_cts,
+ cbFrameSize, bNeedACK, uDMAIdx, psEthHeader, bRTS);
//Fill DataHead
uDuration = s_uFillDataHead(pDevice, byPktType, wCurrentRate, pvTxDataHd, cbFrameSize, uDMAIdx, bNeedACK,
- 0, 0, 1/*uMACfragNum*/, byFBOption);
+ byFBOption);
// Generate TX MAC Header
s_vGenerateMACHeader(pDevice, pbyMacHdr, (u16)uDuration, psEthHeader, bNeedEncryption,
byFragType, uDMAIdx, 0);
@@ -1436,7 +1247,7 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType,
if (bNeedEncryption == true) {
//Fill TXKEY
s_vFillTxKey(pDevice, (u8 *)(pTxBufHead->adwTxKey), pbyIVHead, pTransmitKey,
- pbyMacHdr, (u16)cbFrameBodySize, (u8 *)pMICHDR);
+ pbyMacHdr, (u16)cbFrameBodySize, pMICHDR);
if (pDevice->bEnableHostWEP) {
pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16 = pTransmitKey->dwTSC47_16;
@@ -1475,8 +1286,6 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType,
memcpy((pbyPayloadHead + cb802_1_H_len), ((u8 *)psEthHeader) + ETH_HLEN, uSkbPacketLen - ETH_HLEN);
}
- ASSERT(uLength == cbNdisBodySize);
-
if ((bNeedEncryption == true) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) {
///////////////////////////////////////////////////////////////////
@@ -1537,22 +1346,7 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType,
cbFrameSize -= cbICVlen;
}
- if (pDevice->bSoftwareGenCrcErr == true) {
- unsigned int cbLen;
- u32 * pdwCRC;
-
- dwCRC = 0xFFFFFFFFL;
- cbLen = cbFrameSize - cbFCSlen;
- // calculate CRC, and wrtie CRC value to end of TD
- dwCRC = CRCdwGetCrc32Ex(pbyMacHdr, cbLen, dwCRC);
- pdwCRC = (u32 *)(pbyMacHdr + cbLen);
- // finally, we must invert dwCRC to get the correct answer
- *pdwCRC = ~dwCRC;
- // Force Error
- *pdwCRC -= 1;
- } else {
cbFrameSize -= cbFCSlen;
- }
*pcbHeaderLen = cbHeaderLength;
*pcbTotalLen = cbHeaderLength + cbFrameSize ;
@@ -1589,13 +1383,7 @@ static void s_vGenerateMACHeader(struct vnt_private *pDevice,
{
struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *)pbyBufferAddr;
- memset(pMACHeader, 0, (sizeof(struct ieee80211_hdr)));
-
- if (uDMAIdx == TYPE_ATIMDMA) {
- pMACHeader->frame_control = TYPE_802_11_ATIM;
- } else {
- pMACHeader->frame_control = TYPE_802_11_DATA;
- }
+ pMACHeader->frame_control = TYPE_802_11_DATA;
if (pDevice->eOPMode == OP_MODE_AP) {
memcpy(&(pMACHeader->addr1[0]),
@@ -1678,14 +1466,14 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice,
struct vnt_tx_mgmt *pPacket)
{
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
- PTX_BUFFER pTX_Buffer;
+ struct vnt_tx_buffer *pTX_Buffer;
PSTxBufHead pTxBufHead;
- PUSB_SEND_CONTEXT pContext;
+ struct vnt_usb_send_context *pContext;
struct ieee80211_hdr *pMACHeader;
- PSCTS pCTS;
struct ethhdr sEthHeader;
u8 byPktType, *pbyTxBufferAddr;
- void *pvRTS, *pvTxDataHd, *pvRrvTime, *pMICHDR;
+ void *rts_cts = NULL;
+ void *pvTxDataHd, *pvRrvTime, *pMICHDR;
u32 uDuration, cbReqCount, cbHeaderSize, cbFrameBodySize, cbFrameSize;
int bNeedACK, bIsPSPOLL = false;
u32 cbIVlen = 0, cbICVlen = 0, cbMIClen = 0, cbFCSlen = 4;
@@ -1694,19 +1482,18 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice,
u32 cbMacHdLen;
u16 wCurrentRate = RATE_1M;
- pContext = (PUSB_SEND_CONTEXT)s_vGetFreeContext(pDevice);
+ pContext = (struct vnt_usb_send_context *)s_vGetFreeContext(pDevice);
if (NULL == pContext) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ManagementSend TX...NO CONTEXT!\n");
return CMD_STATUS_RESOURCES;
}
- pTX_Buffer = (PTX_BUFFER) (&pContext->Data[0]);
+ pTX_Buffer = (struct vnt_tx_buffer *)&pContext->Data[0];
pbyTxBufferAddr = (u8 *)&(pTX_Buffer->adwTxKey[0]);
cbFrameBodySize = pPacket->cbPayloadLen;
pTxBufHead = (PSTxBufHead) pbyTxBufferAddr;
wTxBufSize = sizeof(STxBufHead);
- memset(pTxBufHead, 0, wTxBufSize);
if (pDevice->byBBType == BB_TYPE_11A) {
wCurrentRate = RATE_6M;
@@ -1819,25 +1606,24 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice,
//Set RrvTime/RTS/CTS Buffer
if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet
- pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
+ pvRrvTime = (struct vnt_rrv_time_cts *) (pbyTxBufferAddr + wTxBufSize);
pMICHDR = NULL;
- pvRTS = NULL;
- pCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
- pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + sizeof(SCTS));
- cbHeaderSize = wTxBufSize + sizeof(SRrvTime_gCTS) + sizeof(SCTS) + sizeof(STxDataHead_g);
+ rts_cts = (struct vnt_cts *) (pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_cts));
+ pvTxDataHd = (struct vnt_tx_datahead_g *)(pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_cts) + sizeof(struct vnt_cts));
+ cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_cts) +
+ sizeof(struct vnt_cts) + sizeof(struct vnt_tx_datahead_g);
}
else { // 802.11a/b packet
- pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
+ pvRrvTime = (struct vnt_rrv_time_ab *) (pbyTxBufferAddr + wTxBufSize);
pMICHDR = NULL;
- pvRTS = NULL;
- pCTS = NULL;
- pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
- cbHeaderSize = wTxBufSize + sizeof(SRrvTime_ab) + sizeof(STxDataHead_ab);
+ pvTxDataHd = (struct vnt_tx_datahead_ab *) (pbyTxBufferAddr +
+ wTxBufSize + sizeof(struct vnt_rrv_time_ab));
+ cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_ab) +
+ sizeof(struct vnt_tx_datahead_ab);
}
- memset((void *)(pbyTxBufferAddr + wTxBufSize), 0,
- (cbHeaderSize - wTxBufSize));
-
memcpy(&(sEthHeader.h_dest[0]),
&(pPacket->p80211Header->sA3.abyAddr1[0]),
ETH_ALEN);
@@ -1849,13 +1635,14 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice,
//=========================
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);
+ /* Fill FIFO,RrvTime,RTS,and CTS */
+ s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate,
+ pbyTxBufferAddr, pvRrvTime, rts_cts,
+ cbFrameSize, bNeedACK, TYPE_TXDMA0, &sEthHeader, false);
//Fill DataHead
uDuration = s_uFillDataHead(pDevice, byPktType, wCurrentRate, pvTxDataHd, cbFrameSize, TYPE_TXDMA0, bNeedACK,
- 0, 0, 1, AUTO_FB_NONE);
+ AUTO_FB_NONE);
pMACHeader = (struct ieee80211_hdr *) (pbyTxBufferAddr + cbHeaderSize);
@@ -1918,12 +1705,15 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice,
// This will cause AID-field of PS-POLL packet be incorrect (Because PS-POLL's AID field is
// in the same place of other packet's Duration-field).
// And it will cause Cisco-AP to issue Disassociation-packet
- if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
- ((PSTxDataHead_g)pvTxDataHd)->wDuration_a = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID);
- ((PSTxDataHead_g)pvTxDataHd)->wDuration_b = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID);
- } else {
- ((PSTxDataHead_ab)pvTxDataHd)->wDuration = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID);
- }
+ if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
+ ((struct vnt_tx_datahead_g *)pvTxDataHd)->wDuration_a =
+ cpu_to_le16(pPacket->p80211Header->sA2.wDurationID);
+ ((struct vnt_tx_datahead_g *)pvTxDataHd)->wDuration_b =
+ cpu_to_le16(pPacket->p80211Header->sA2.wDurationID);
+ } else {
+ ((struct vnt_tx_datahead_ab *)pvTxDataHd)->wDuration =
+ cpu_to_le16(pPacket->p80211Header->sA2.wDurationID);
+ }
}
pTX_Buffer->wTxByteCount = cpu_to_le16((u16)(cbReqCount));
@@ -1948,60 +1738,60 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice,
CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice,
struct vnt_tx_mgmt *pPacket)
{
+ struct vnt_beacon_buffer *pTX_Buffer;
u32 cbFrameSize = pPacket->cbMPDULen + WLAN_FCS_LEN;
u32 cbHeaderSize = 0;
u16 wTxBufSize = sizeof(STxShortBufHead);
PSTxShortBufHead pTxBufHead;
struct ieee80211_hdr *pMACHeader;
- PSTxDataHead_ab pTxDataHead;
+ struct vnt_tx_datahead_ab *pTxDataHead;
u16 wCurrentRate;
u32 cbFrameBodySize;
u32 cbReqCount;
- PBEACON_BUFFER pTX_Buffer;
u8 *pbyTxBufferAddr;
- PUSB_SEND_CONTEXT pContext;
+ struct vnt_usb_send_context *pContext;
CMD_STATUS status;
- pContext = (PUSB_SEND_CONTEXT)s_vGetFreeContext(pDevice);
+ pContext = (struct vnt_usb_send_context *)s_vGetFreeContext(pDevice);
if (NULL == pContext) {
status = CMD_STATUS_RESOURCES;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ManagementSend TX...NO CONTEXT!\n");
return status ;
}
- pTX_Buffer = (PBEACON_BUFFER) (&pContext->Data[0]);
+
+ pTX_Buffer = (struct vnt_beacon_buffer *)&pContext->Data[0];
pbyTxBufferAddr = (u8 *)&(pTX_Buffer->wFIFOCtl);
cbFrameBodySize = pPacket->cbPayloadLen;
pTxBufHead = (PSTxShortBufHead) pbyTxBufferAddr;
wTxBufSize = sizeof(STxShortBufHead);
- memset(pTxBufHead, 0, wTxBufSize);
if (pDevice->byBBType == BB_TYPE_11A) {
wCurrentRate = RATE_6M;
- pTxDataHead = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize);
+ pTxDataHead = (struct vnt_tx_datahead_ab *)
+ (pbyTxBufferAddr + wTxBufSize);
//Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, cbFrameSize, wCurrentRate, PK_TYPE_11A,
- (u16 *)&(pTxDataHead->wTransmitLength), (u8 *)&(pTxDataHead->byServiceField), (u8 *)&(pTxDataHead->bySignalField)
- );
+ BBvCalculateParameter(pDevice, cbFrameSize, wCurrentRate, PK_TYPE_11A,
+ &pTxDataHead->ab);
//Get Duration and TimeStampOff
- pTxDataHead->wDuration = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameSize, PK_TYPE_11A,
- wCurrentRate, false, 0, 0, 1, AUTO_FB_NONE));
- pTxDataHead->wTimeStampOff = wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE];
- cbHeaderSize = wTxBufSize + sizeof(STxDataHead_ab);
+ pTxDataHead->wDuration = s_uGetDataDuration(pDevice,
+ PK_TYPE_11A, false);
+ pTxDataHead->wTimeStampOff = vnt_time_stamp_off(pDevice, wCurrentRate);
+ cbHeaderSize = wTxBufSize + sizeof(struct vnt_tx_datahead_ab);
} else {
wCurrentRate = RATE_1M;
pTxBufHead->wFIFOCtl |= FIFOCTL_11B;
- pTxDataHead = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize);
+ pTxDataHead = (struct vnt_tx_datahead_ab *)
+ (pbyTxBufferAddr + wTxBufSize);
//Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, cbFrameSize, wCurrentRate, PK_TYPE_11B,
- (u16 *)&(pTxDataHead->wTransmitLength), (u8 *)&(pTxDataHead->byServiceField), (u8 *)&(pTxDataHead->bySignalField)
- );
+ BBvCalculateParameter(pDevice, cbFrameSize, wCurrentRate, PK_TYPE_11B,
+ &pTxDataHead->ab);
//Get Duration and TimeStampOff
- pTxDataHead->wDuration = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameSize, PK_TYPE_11B,
- wCurrentRate, false, 0, 0, 1, AUTO_FB_NONE));
- pTxDataHead->wTimeStampOff = wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE];
- cbHeaderSize = wTxBufSize + sizeof(STxDataHead_ab);
+ pTxDataHead->wDuration = s_uGetDataDuration(pDevice,
+ PK_TYPE_11B, false);
+ pTxDataHead->wTimeStampOff = vnt_time_stamp_off(pDevice, wCurrentRate);
+ cbHeaderSize = wTxBufSize + sizeof(struct vnt_tx_datahead_ab);
}
//Generate Beacon Header
@@ -2032,9 +1822,11 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice,
void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb)
{
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
+ struct vnt_tx_buffer *pTX_Buffer;
u8 byPktType;
u8 *pbyTxBufferAddr;
- void *pvRTS, *pvCTS, *pvTxDataHd;
+ void *rts_cts = NULL;
+ void *pvTxDataHd;
u32 uDuration, cbReqCount;
struct ieee80211_hdr *pMACHeader;
u32 cbHeaderSize, cbFrameBodySize;
@@ -2059,10 +1851,9 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb)
PSKeyItem pTransmitKey = NULL;
u8 *pbyIVHead, *pbyPayloadHead, *pbyMacHdr;
u32 cbExtSuppRate = 0;
- PTX_BUFFER pTX_Buffer;
- PUSB_SEND_CONTEXT pContext;
+ struct vnt_usb_send_context *pContext;
- pvRrvTime = pMICHDR = pvRTS = pvCTS = pvTxDataHd = NULL;
+ pvRrvTime = pMICHDR = pvTxDataHd = NULL;
if(skb->len <= WLAN_HDR_ADDR3_LEN) {
cbFrameBodySize = 0;
@@ -2072,7 +1863,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb)
}
p80211Header = (PUWLAN_80211HDR)skb->data;
- pContext = (PUSB_SEND_CONTEXT)s_vGetFreeContext(pDevice);
+ pContext = (struct vnt_usb_send_context *)s_vGetFreeContext(pDevice);
if (NULL == pContext) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"DMA0 TX...NO CONTEXT!\n");
@@ -2080,11 +1871,10 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb)
return ;
}
- pTX_Buffer = (PTX_BUFFER)(&pContext->Data[0]);
+ pTX_Buffer = (struct vnt_tx_buffer *)&pContext->Data[0];
pbyTxBufferAddr = (u8 *)(&pTX_Buffer->adwTxKey[0]);
pTxBufHead = (PSTxBufHead) pbyTxBufferAddr;
wTxBufSize = sizeof(STxBufHead);
- memset(pTxBufHead, 0, wTxBufSize);
if (pDevice->byBBType == BB_TYPE_11A) {
wCurrentRate = RATE_6M;
@@ -2204,7 +1994,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb)
else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) {
cbIVlen = 8;//RSN Header
cbICVlen = 8;//MIC
- cbMICHDR = sizeof(SMICHDRHead);
+ cbMICHDR = sizeof(struct vnt_mic_hdr);
pTxBufHead->wFragCtl |= FRAGCTL_AES;
pDevice->bAES = true;
}
@@ -2222,26 +2012,28 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb)
//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);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
- pvRTS = NULL;
- pvCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR);
- pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS));
- cbHeaderSize = wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS) + sizeof(STxDataHead_g);
+ pvRrvTime = (struct vnt_rrv_time_cts *) (pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_cts));
+ rts_cts = (struct vnt_cts *) (pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_cts) + cbMICHDR);
+ pvTxDataHd = (struct vnt_tx_datahead_g *) (pbyTxBufferAddr +
+ wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR +
+ sizeof(struct vnt_cts));
+ cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR +
+ sizeof(struct vnt_cts) + sizeof(struct vnt_tx_datahead_g);
}
else {//802.11a/b packet
- pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
- pvRTS = NULL;
- pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
- cbHeaderSize = wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR + sizeof(STxDataHead_ab);
+ pvRrvTime = (struct vnt_rrv_time_ab *) (pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize +
+ sizeof(struct vnt_rrv_time_ab));
+ pvTxDataHd = (struct vnt_tx_datahead_ab *)(pbyTxBufferAddr +
+ wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR);
+ cbHeaderSize = wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR +
+ sizeof(struct vnt_tx_datahead_ab);
}
- memset((void *)(pbyTxBufferAddr + wTxBufSize), 0,
- (cbHeaderSize - wTxBufSize));
memcpy(&(sEthHeader.h_dest[0]),
&(p80211Header->sA3.abyAddr1[0]),
ETH_ALEN);
@@ -2253,13 +2045,14 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb)
//=========================
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);
+ /* Fill FIFO,RrvTime,RTS,and CTS */
+ s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate,
+ pbyTxBufferAddr, pvRrvTime, rts_cts,
+ cbFrameSize, bNeedACK, TYPE_TXDMA0, &sEthHeader, false);
//Fill DataHead
uDuration = s_uFillDataHead(pDevice, byPktType, wCurrentRate, pvTxDataHd, cbFrameSize, TYPE_TXDMA0, bNeedACK,
- 0, 0, 1, AUTO_FB_NONE);
+ AUTO_FB_NONE);
pMACHeader = (struct ieee80211_hdr *) (pbyTxBufferAddr + cbHeaderSize);
@@ -2345,7 +2138,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb)
}
s_vFillTxKey(pDevice, (u8 *)(pTxBufHead->adwTxKey), pbyIVHead, pTransmitKey,
- pbyMacHdr, (u16)cbFrameBodySize, (u8 *)pMICHDR);
+ pbyMacHdr, (u16)cbFrameBodySize, pMICHDR);
if (pDevice->bEnableHostWEP) {
pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16 = pTransmitKey->dwTSC47_16;
@@ -2368,12 +2161,15 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb)
// This will cause AID-field of PS-POLL packet be incorrect (Because PS-POLL's AID field is
// in the same place of other packet's Duration-field).
// And it will cause Cisco-AP to issue Disassociation-packet
- if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
- ((PSTxDataHead_g)pvTxDataHd)->wDuration_a = cpu_to_le16(p80211Header->sA2.wDurationID);
- ((PSTxDataHead_g)pvTxDataHd)->wDuration_b = cpu_to_le16(p80211Header->sA2.wDurationID);
- } else {
- ((PSTxDataHead_ab)pvTxDataHd)->wDuration = cpu_to_le16(p80211Header->sA2.wDurationID);
- }
+ if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
+ ((struct vnt_tx_datahead_g *)pvTxDataHd)->wDuration_a =
+ cpu_to_le16(p80211Header->sA2.wDurationID);
+ ((struct vnt_tx_datahead_g *)pvTxDataHd)->wDuration_b =
+ cpu_to_le16(p80211Header->sA2.wDurationID);
+ } else {
+ ((struct vnt_tx_datahead_ab *)pvTxDataHd)->wDuration =
+ cpu_to_le16(p80211Header->sA2.wDurationID);
+ }
}
pTX_Buffer->wTxByteCount = cpu_to_le16((u16)(cbReqCount));
@@ -2415,6 +2211,7 @@ int nsDMA_tx_packet(struct vnt_private *pDevice,
{
struct net_device_stats *pStats = &pDevice->stats;
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
+ struct vnt_tx_buffer *pTX_Buffer;
u32 BytesToWrite = 0, uHeaderLen = 0;
u32 uNodeIndex = 0;
u8 byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
@@ -2428,9 +2225,8 @@ int nsDMA_tx_packet(struct vnt_private *pDevice,
int bNeedDeAuth = false;
u8 *pbyBSSID;
int bNodeExist = false;
- PUSB_SEND_CONTEXT pContext;
+ struct vnt_usb_send_context *pContext;
bool fConvertedPacket;
- PTX_BUFFER pTX_Buffer;
u32 status;
u16 wKeepRate = pDevice->wCurrentRate;
int bTxeapol_key = false;
@@ -2500,7 +2296,7 @@ int nsDMA_tx_packet(struct vnt_private *pDevice,
}
}
- pContext = (PUSB_SEND_CONTEXT)s_vGetFreeContext(pDevice);
+ pContext = (struct vnt_usb_send_context *)s_vGetFreeContext(pDevice);
if (pContext == NULL) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG" pContext == NULL\n");
@@ -2738,8 +2534,10 @@ int nsDMA_tx_packet(struct vnt_private *pDevice,
}
}
+ pTX_Buffer = (struct vnt_tx_buffer *)&pContext->Data[0];
+
fConvertedPacket = s_bPacketToWirelessUsb(pDevice, byPktType,
- (u8 *)(&pContext->Data[0]), bNeedEncryption,
+ pTX_Buffer, bNeedEncryption,
skb->len, uDMAIdx, &pDevice->sTxEthHeader,
(u8 *)skb->data, pTransmitKey, uNodeIndex,
pDevice->wCurrentRate,
@@ -2761,7 +2559,6 @@ int nsDMA_tx_packet(struct vnt_private *pDevice,
}
}
- pTX_Buffer = (PTX_BUFFER)&(pContext->Data[0]);
pTX_Buffer->byPKTNO = (u8) (((pDevice->wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F));
pTX_Buffer->wTxByteCount = (u16)BytesToWrite;
@@ -2808,20 +2605,20 @@ int bRelayPacketSend(struct vnt_private *pDevice, u8 *pbySkbData, u32 uDataLen,
u32 uNodeIndex)
{
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
+ struct vnt_tx_buffer *pTX_Buffer;
u32 BytesToWrite = 0, uHeaderLen = 0;
u8 byPktType = PK_TYPE_11B;
int bNeedEncryption = false;
SKeyItem STempKey;
PSKeyItem pTransmitKey = NULL;
u8 *pbyBSSID;
- PUSB_SEND_CONTEXT pContext;
+ struct vnt_usb_send_context *pContext;
u8 byPktTyp;
int fConvertedPacket;
- PTX_BUFFER pTX_Buffer;
u32 status;
u16 wKeepRate = pDevice->wCurrentRate;
- pContext = (PUSB_SEND_CONTEXT)s_vGetFreeContext(pDevice);
+ pContext = (struct vnt_usb_send_context *)s_vGetFreeContext(pDevice);
if (NULL == pContext) {
return false;
@@ -2898,8 +2695,10 @@ int bRelayPacketSend(struct vnt_private *pDevice, u8 *pbySkbData, u32 uDataLen,
// Convert the packet to an usb frame and copy into our buffer
// and send the irp.
+ pTX_Buffer = (struct vnt_tx_buffer *)&pContext->Data[0];
+
fConvertedPacket = s_bPacketToWirelessUsb(pDevice, byPktType,
- (u8 *)(&pContext->Data[0]), bNeedEncryption,
+ pTX_Buffer, bNeedEncryption,
uDataLen, TYPE_AC0DMA, &pDevice->sTxEthHeader,
pbySkbData, pTransmitKey, uNodeIndex,
pDevice->wCurrentRate,
@@ -2911,7 +2710,6 @@ int bRelayPacketSend(struct vnt_private *pDevice, u8 *pbySkbData, u32 uDataLen,
return false;
}
- pTX_Buffer = (PTX_BUFFER)&(pContext->Data[0]);
pTX_Buffer->byPKTNO = (u8) (((pDevice->wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F));
pTX_Buffer->wTxByteCount = (u16)BytesToWrite;
diff --git a/drivers/staging/vt6656/rxtx.h b/drivers/staging/vt6656/rxtx.h
index dd7e85dde1a2..4bbee1c2fcac 100644
--- a/drivers/staging/vt6656/rxtx.h
+++ b/drivers/staging/vt6656/rxtx.h
@@ -31,602 +31,173 @@
#include "device.h"
#include "wcmd.h"
-
-//
-// RTS buffer header
-//
-typedef struct tagSRTSDataF {
- u16 wFrameControl;
- u16 wDurationID;
- u8 abyRA[ETH_ALEN];
- u8 abyTA[ETH_ALEN];
-} SRTSDataF, *PSRTSDataF;
-
-//
-// CTS buffer header
-//
-typedef struct tagSCTSDataF {
- u16 wFrameControl;
- u16 wDurationID;
- u8 abyRA[ETH_ALEN];
- u16 wReserved;
-} SCTSDataF, *PSCTSDataF;
-
-//
-// MICHDR data header
-//
-typedef struct tagSMICHDR {
- u32 adwHDR0[4];
- u32 adwHDR1[4];
- u32 adwHDR2[4];
-} SMICHDR, *PSMICHDR;
-
-typedef struct tagSTX_NAF_G_RTS
-{
- //RsvTime
- u16 wRTSTxRrvTime_ba;
- u16 wRTSTxRrvTime_aa;
- u16 wRTSTxRrvTime_bb;
- u16 wReserved2;
- u16 wTxRrvTime_b;
- u16 wTxRrvTime_a;
-
- //RTS
- u8 byRTSSignalField_b;
- u8 byRTSServiceField_b;
- u16 wRTSTransmitLength_b;
- u8 byRTSSignalField_a;
- u8 byRTSServiceField_a;
- u16 wRTSTransmitLength_a;
- u16 wRTSDuration_ba;
- u16 wRTSDuration_aa;
- u16 wRTSDuration_bb;
- u16 wReserved3;
- SRTSDataF sRTS;
-
- //Data
- u8 bySignalField_b;
- u8 byServiceField_b;
- u16 wTransmitLength_b;
- u8 bySignalField_a;
- u8 byServiceField_a;
- u16 wTransmitLength_a;
- u16 wDuration_b;
- u16 wDuration_a;
- u16 wTimeStampOff_b;
- u16 wTimeStampOff_a;
-
-} TX_NAF_G_RTS, *PTX_NAF_G_RTS;
-
-typedef struct tagSTX_NAF_G_RTS_MIC
-{
- //RsvTime
- u16 wRTSTxRrvTime_ba;
- u16 wRTSTxRrvTime_aa;
- u16 wRTSTxRrvTime_bb;
- u16 wReserved2;
- u16 wTxRrvTime_b;
- u16 wTxRrvTime_a;
-
- SMICHDR sMICHDR;
-
- //RTS
- u8 byRTSSignalField_b;
- u8 byRTSServiceField_b;
- u16 wRTSTransmitLength_b;
- u8 byRTSSignalField_a;
- u8 byRTSServiceField_a;
- u16 wRTSTransmitLength_a;
- u16 wRTSDuration_ba;
- u16 wRTSDuration_aa;
- u16 wRTSDuration_bb;
- u16 wReserved3;
- SRTSDataF sRTS;
-
- //Data
- u8 bySignalField_b;
- u8 byServiceField_b;
- u16 wTransmitLength_b;
- u8 bySignalField_a;
- u8 byServiceField_a;
- u16 wTransmitLength_a;
- u16 wDuration_b;
- u16 wDuration_a;
- u16 wTimeStampOff_b;
- u16 wTimeStampOff_a;
-
-} TX_NAF_G_RTS_MIC, *PTX_NAF_G_RTS_MIC;
-
-typedef struct tagSTX_NAF_G_CTS
-{
- //RsvTime
- u16 wCTSTxRrvTime_ba;
- u16 wReserved2;
- u16 wTxRrvTime_b;
- u16 wTxRrvTime_a;
-
- //CTS
- u8 byCTSSignalField_b;
- u8 byCTSServiceField_b;
- u16 wCTSTransmitLength_b;
- u16 wCTSDuration_ba;
- u16 wReserved3;
- SCTSDataF sCTS;
-
- //Data
- u8 bySignalField_b;
- u8 byServiceField_b;
- u16 wTransmitLength_b;
- u8 bySignalField_a;
- u8 byServiceField_a;
- u16 wTransmitLength_a;
- u16 wDuration_b;
- u16 wDuration_a;
- u16 wTimeStampOff_b;
- u16 wTimeStampOff_a;
-
-} TX_NAF_G_CTS, *PTX_NAF_G_CTS;
-
-typedef struct tagSTX_NAF_G_CTS_MIC
-{
- //RsvTime
- u16 wCTSTxRrvTime_ba;
- u16 wReserved2;
- u16 wTxRrvTime_b;
- u16 wTxRrvTime_a;
-
- SMICHDR sMICHDR;
-
- //CTS
- u8 byCTSSignalField_b;
- u8 byCTSServiceField_b;
- u16 wCTSTransmitLength_b;
- u16 wCTSDuration_ba;
- u16 wReserved3;
- SCTSDataF sCTS;
-
- //Data
- u8 bySignalField_b;
- u8 byServiceField_b;
- u16 wTransmitLength_b;
- u8 bySignalField_a;
- u8 byServiceField_a;
- u16 wTransmitLength_a;
- u16 wDuration_b;
- u16 wDuration_a;
- u16 wTimeStampOff_b;
- u16 wTimeStampOff_a;
-
-} TX_NAF_G_CTS_MIC, *PTX_NAF_G_CTS_MIC;
-
-typedef struct tagSTX_NAF_G_BEACON
-{
- u16 wFIFOCtl;
- u16 wTimeStamp;
-
- //CTS
- u8 byCTSSignalField_b;
- u8 byCTSServiceField_b;
- u16 wCTSTransmitLength_b;
- u16 wCTSDuration_ba;
- u16 wReserved1;
- SCTSDataF sCTS;
-
- //Data
- u8 bySignalField_a;
- u8 byServiceField_a;
- u16 wTransmitLength_a;
- u16 wDuration_a;
- u16 wTimeStampOff_a;
-
-} TX_NAF_G_BEACON, *PTX_NAF_G_BEACON;
-
-typedef struct tagSTX_NAF_AB_RTS
-{
- //RsvTime
- u16 wRTSTxRrvTime_ab;
- u16 wTxRrvTime_ab;
-
- //RTS
- u8 byRTSSignalField_ab;
- u8 byRTSServiceField_ab;
- u16 wRTSTransmitLength_ab;
- u16 wRTSDuration_ab;
- u16 wReserved2;
- SRTSDataF sRTS;
-
- //Data
- u8 bySignalField_ab;
- u8 byServiceField_ab;
- u16 wTransmitLength_ab;
- u16 wDuration_ab;
- u16 wTimeStampOff_ab;
-
-} TX_NAF_AB_RTS, *PTX_NAF_AB_RTS;
-
-typedef struct tagSTX_NAF_AB_RTS_MIC
-{
- //RsvTime
- u16 wRTSTxRrvTime_ab;
- u16 wTxRrvTime_ab;
-
- SMICHDR sMICHDR;
-
- //RTS
- u8 byRTSSignalField_ab;
- u8 byRTSServiceField_ab;
- u16 wRTSTransmitLength_ab;
- u16 wRTSDuration_ab;
- u16 wReserved2;
- SRTSDataF sRTS;
-
- //Data
- u8 bySignalField_ab;
- u8 byServiceField_ab;
- u16 wTransmitLength_ab;
- u16 wDuration_ab;
- u16 wTimeStampOff_ab;
-
-} TX_NAF_AB_RTS_MIC, *PTX_NAF_AB_RTS_MIC;
-
-typedef struct tagSTX_NAF_AB_CTS
-{
- //RsvTime
- u16 wReserved2;
- u16 wTxRrvTime_ab;
-
- //Data
- u8 bySignalField_ab;
- u8 byServiceField_ab;
- u16 wTransmitLength_ab;
- u16 wDuration_ab;
- u16 wTimeStampOff_ab;
-
-} TX_NAF_AB_CTS, *PTX_NAF_AB_CTS;
-
-typedef struct tagSTX_NAF_AB_CTS_MIC
-{
- //RsvTime
- u16 wReserved2;
- u16 wTxRrvTime_ab;
-
- SMICHDR sMICHDR;
-
- //Data
- u8 bySignalField_ab;
- u8 byServiceField_ab;
- u16 wTransmitLength_ab;
- u16 wDuration_ab;
- u16 wTimeStampOff_ab;
-
-} TX_NAF_AB_CTS_MIC, *PTX_NAF_AB_CTS_MIC;
-
-typedef struct tagSTX_NAF_AB_BEACON
-{
- u16 wFIFOCtl;
- u16 wTimeStamp;
-
- //Data
- u8 bySignalField_ab;
- u8 byServiceField_ab;
- u16 wTransmitLength_ab;
- u16 wDuration_ab;
- u16 wTimeStampOff_ab;
-
-} TX_NAF_AB_BEACON, *PTX_NAF_AB_BEACON;
-
-typedef struct tagSTX_AF_G_RTS
-{
- //RsvTime
- u16 wRTSTxRrvTime_ba;
- u16 wRTSTxRrvTime_aa;
- u16 wRTSTxRrvTime_bb;
- u16 wReserved2;
- u16 wTxRrvTime_b;
- u16 wTxRrvTime_a;
-
- //RTS
- u8 byRTSSignalField_b;
- u8 byRTSServiceField_b;
- u16 wRTSTransmitLength_b;
- u8 byRTSSignalField_a;
- u8 byRTSServiceField_a;
- u16 wRTSTransmitLength_a;
- u16 wRTSDuration_ba;
- u16 wRTSDuration_aa;
- u16 wRTSDuration_bb;
- u16 wReserved3;
- u16 wRTSDuration_ba_f0;
- u16 wRTSDuration_aa_f0;
- u16 wRTSDuration_ba_f1;
- u16 wRTSDuration_aa_f1;
- SRTSDataF sRTS;
-
- //Data
- u8 bySignalField_b;
- u8 byServiceField_b;
- u16 wTransmitLength_b;
- u8 bySignalField_a;
- u8 byServiceField_a;
- u16 wTransmitLength_a;
- u16 wDuration_b;
- u16 wDuration_a;
- u16 wDuration_a_f0;
- u16 wDuration_a_f1;
- u16 wTimeStampOff_b;
- u16 wTimeStampOff_a;
-
-} TX_AF_G_RTS, *PTX_AF_G_RTS;
-
-typedef struct tagSTX_AF_G_RTS_MIC
-{
- //RsvTime
- u16 wRTSTxRrvTime_ba;
- u16 wRTSTxRrvTime_aa;
- u16 wRTSTxRrvTime_bb;
- u16 wReserved2;
- u16 wTxRrvTime_b;
- u16 wTxRrvTime_a;
-
- SMICHDR sMICHDR;
-
- //RTS
- u8 byRTSSignalField_b;
- u8 byRTSServiceField_b;
- u16 wRTSTransmitLength_b;
- u8 byRTSSignalField_a;
- u8 byRTSServiceField_a;
- u16 wRTSTransmitLength_a;
- u16 wRTSDuration_ba;
- u16 wRTSDuration_aa;
- u16 wRTSDuration_bb;
- u16 wReserved3;
- u16 wRTSDuration_ba_f0;
- u16 wRTSDuration_aa_f0;
- u16 wRTSDuration_ba_f1;
- u16 wRTSDuration_aa_f1;
- SRTSDataF sRTS;
-
- //Data
- u8 bySignalField_b;
- u8 byServiceField_b;
- u16 wTransmitLength_b;
- u8 bySignalField_a;
- u8 byServiceField_a;
- u16 wTransmitLength_a;
- u16 wDuration_b;
- u16 wDuration_a;
- u16 wDuration_a_f0;
- u16 wDuration_a_f1;
- u16 wTimeStampOff_b;
- u16 wTimeStampOff_a;
-
-} TX_AF_G_RTS_MIC, *PTX_AF_G_RTS_MIC;
-
-typedef struct tagSTX_AF_G_CTS
-{
- //RsvTime
- u16 wCTSTxRrvTime_ba;
- u16 wReserved2;
- u16 wTxRrvTime_b;
- u16 wTxRrvTime_a;
-
- //CTS
- u8 byCTSSignalField_b;
- u8 byCTSServiceField_b;
- u16 wCTSTransmitLength_b;
- u16 wCTSDuration_ba;
- u16 wReserved3;
- u16 wCTSDuration_ba_f0;
- u16 wCTSDuration_ba_f1;
- SCTSDataF sCTS;
-
- //Data
- u8 bySignalField_b;
- u8 byServiceField_b;
- u16 wTransmitLength_b;
- u8 bySignalField_a;
- u8 byServiceField_a;
- u16 wTransmitLength_a;
- u16 wDuration_b;
- u16 wDuration_a;
- u16 wDuration_a_f0;
- u16 wDuration_a_f1;
- u16 wTimeStampOff_b;
- u16 wTimeStampOff_a;
-
-} TX_AF_G_CTS, *PTX_AF_G_CTS;
-
-typedef struct tagSTX_AF_G_CTS_MIC
-{
- //RsvTime
- u16 wCTSTxRrvTime_ba;
- u16 wReserved2;
- u16 wTxRrvTime_b;
- u16 wTxRrvTime_a;
-
- SMICHDR sMICHDR;
-
- //CTS
- u8 byCTSSignalField_b;
- u8 byCTSServiceField_b;
- u16 wCTSTransmitLength_b;
- u16 wCTSDuration_ba;
- u16 wReserved3;
- u16 wCTSDuration_ba_f0;
- u16 wCTSDuration_ba_f1;
- SCTSDataF sCTS;
-
- //Data
- u8 bySignalField_b;
- u8 byServiceField_b;
- u16 wTransmitLength_b;
- u8 bySignalField_a;
- u8 byServiceField_a;
- u16 wTransmitLength_a;
- u16 wDuration_b;
- u16 wDuration_a;
- u16 wDuration_a_f0;
- u16 wDuration_a_f1;
- u16 wTimeStampOff_b;
- u16 wTimeStampOff_a;
-
-} TX_AF_G_CTS_MIC, *PTX_AF_G_CTS_MIC;
-
-typedef struct tagSTX_AF_A_RTS
-{
- //RsvTime
- u16 wRTSTxRrvTime_a;
- u16 wTxRrvTime_a;
-
- //RTS
- u8 byRTSSignalField_a;
- u8 byRTSServiceField_a;
- u16 wRTSTransmitLength_a;
- u16 wRTSDuration_a;
- u16 wReserved2;
- u16 wRTSDuration_a_f0;
- u16 wRTSDuration_a_f1;
- SRTSDataF sRTS;
-
- //Data
- u8 bySignalField_a;
- u8 byServiceField_a;
- u16 wTransmitLength_a;
- u16 wDuration_a;
- u16 wTimeStampOff_a;
- u16 wDuration_a_f0;
- u16 wDuration_a_f1;
-
-} TX_AF_A_RTS, *PTX_AF_A_RTS;
-
-typedef struct tagSTX_AF_A_RTS_MIC
-{
- //RsvTime
- u16 wRTSTxRrvTime_a;
- u16 wTxRrvTime_a;
-
- SMICHDR sMICHDR;
-
- //RTS
- u8 byRTSSignalField_a;
- u8 byRTSServiceField_a;
- u16 wRTSTransmitLength_a;
- u16 wRTSDuration_a;
- u16 wReserved2;
- u16 wRTSDuration_a_f0;
- u16 wRTSDuration_a_f1;
- SRTSDataF sRTS;
-
- //Data
- u8 bySignalField_a;
- u8 byServiceField_a;
- u16 wTransmitLength_a;
- u16 wDuration_a;
- u16 wTimeStampOff_a;
- u16 wDuration_a_f0;
- u16 wDuration_a_f1;
-
-} TX_AF_A_RTS_MIC, *PTX_AF_A_RTS_MIC;
-
-typedef struct tagSTX_AF_A_CTS
-{
- //RsvTime
- u16 wReserved2;
- u16 wTxRrvTime_a;
-
- //Data
- u8 bySignalField_a;
- u8 byServiceField_a;
- u16 wTransmitLength_a;
- u16 wDuration_a;
- u16 wTimeStampOff_a;
- u16 wDuration_a_f0;
- u16 wDuration_a_f1;
-
-} TX_AF_A_CTS, *PTX_AF_A_CTS;
-
-typedef struct tagSTX_AF_A_CTS_MIC
-{
- //RsvTime
- u16 wReserved2;
- u16 wTxRrvTime_a;
-
- SMICHDR sMICHDR;
-
- //Data
- u8 bySignalField_a;
- u8 byServiceField_a;
- u16 wTransmitLength_a;
- u16 wDuration_a;
- u16 wTimeStampOff_a;
- u16 wDuration_a_f0;
- u16 wDuration_a_f1;
-
-} TX_AF_A_CTS_MIC, *PTX_AF_A_CTS_MIC;
-
-//
-// union with all of the TX Buffer Type
-//
-typedef union tagUTX_BUFFER_CONTAINER
-{
- TX_NAF_G_RTS RTS_G;
- TX_NAF_G_RTS_MIC RTS_G_MIC;
- TX_NAF_G_CTS CTS_G;
- TX_NAF_G_CTS_MIC CTS_G_MIC;
- //TX_NAF_G_BEACON Beacon_G;
- TX_NAF_AB_RTS RTS_AB;
- TX_NAF_AB_RTS_MIC RTS_AB_MIC;
- TX_NAF_AB_CTS CTS_AB;
- TX_NAF_AB_CTS_MIC CTS_AB_MIC;
- //TX_NAF_AB_BEACON Beacon_AB;
- TX_AF_G_RTS RTS_G_AutoFB;
- TX_AF_G_RTS_MIC RTS_G_AutoFB_MIC;
- TX_AF_G_CTS CTS_G_AutoFB;
- TX_AF_G_CTS_MIC CTS_G_AutoFB_MIC;
- TX_AF_A_RTS RTS_A_AutoFB;
- TX_AF_A_RTS_MIC RTS_A_AutoFB_MIC;
- TX_AF_A_CTS CTS_A_AutoFB;
- TX_AF_A_CTS_MIC CTS_A_AutoFB_MIC;
-
-} TX_BUFFER_CONTAINER, *PTX_BUFFER_CONTAINER;
-
-//
-// Remote NDIS message format
-//
-typedef struct tagSTX_BUFFER
-{
- u8 byType;
- u8 byPKTNO;
- u16 wTxByteCount;
-
+#include "baseband.h"
+
+/* MIC HDR data header */
+struct vnt_mic_hdr {
+ u8 id;
+ u8 tx_priority;
+ u8 mic_addr2[6];
+ __be32 tsc_47_16;
+ __be16 tsc_15_0;
+ __be16 payload_len;
+ __be16 hlen;
+ __le16 frame_control;
+ u8 addr1[6];
+ u8 addr2[6];
+ u8 addr3[6];
+ __le16 seq_ctrl;
+ u8 addr4[6];
+ u16 packing; /* packing to 48 bytes */
+} __packed;
+
+/* RsvTime buffer header */
+struct vnt_rrv_time_rts {
+ u16 wRTSTxRrvTime_ba;
+ u16 wRTSTxRrvTime_aa;
+ u16 wRTSTxRrvTime_bb;
+ u16 wReserved;
+ u16 wTxRrvTime_b;
+ u16 wTxRrvTime_a;
+} __packed;
+
+struct vnt_rrv_time_cts {
+ u16 wCTSTxRrvTime_ba;
+ u16 wReserved;
+ u16 wTxRrvTime_b;
+ u16 wTxRrvTime_a;
+} __packed;
+
+struct vnt_rrv_time_ab {
+ u16 wRTSTxRrvTime;
+ u16 wTxRrvTime;
+} __packed;
+
+/* TX data header */
+struct vnt_tx_datahead_g {
+ struct vnt_phy_field b;
+ struct vnt_phy_field a;
+ u16 wDuration_b;
+ u16 wDuration_a;
+ u16 wTimeStampOff_b;
+ u16 wTimeStampOff_a;
+} __packed;
+
+struct vnt_tx_datahead_g_fb {
+ struct vnt_phy_field b;
+ struct vnt_phy_field a;
+ u16 wDuration_b;
+ u16 wDuration_a;
+ u16 wDuration_a_f0;
+ u16 wDuration_a_f1;
+ u16 wTimeStampOff_b;
+ u16 wTimeStampOff_a;
+} __packed;
+
+struct vnt_tx_datahead_ab {
+ struct vnt_phy_field ab;
+ u16 wDuration;
+ u16 wTimeStampOff;
+} __packed;
+
+struct vnt_tx_datahead_a_fb {
+ struct vnt_phy_field a;
+ u16 wDuration;
+ u16 wTimeStampOff;
+ u16 wDuration_f0;
+ u16 wDuration_f1;
+} __packed;
+
+/* RTS buffer header */
+struct vnt_rts_g {
+ struct vnt_phy_field b;
+ struct vnt_phy_field a;
+ u16 wDuration_ba;
+ u16 wDuration_aa;
+ u16 wDuration_bb;
+ u16 wReserved;
+ struct ieee80211_rts data;
+} __packed;
+
+struct vnt_rts_g_fb {
+ struct vnt_phy_field b;
+ struct vnt_phy_field a;
+ u16 wDuration_ba;
+ u16 wDuration_aa;
+ u16 wDuration_bb;
+ u16 wReserved;
+ u16 wRTSDuration_ba_f0;
+ u16 wRTSDuration_aa_f0;
+ u16 wRTSDuration_ba_f1;
+ u16 wRTSDuration_aa_f1;
+ struct ieee80211_rts data;
+} __packed;
+
+struct vnt_rts_ab {
+ struct vnt_phy_field ab;
+ u16 wDuration;
+ u16 wReserved;
+ struct ieee80211_rts data;
+} __packed;
+
+struct vnt_rts_a_fb {
+ struct vnt_phy_field a;
+ u16 wDuration;
+ u16 wReserved;
+ u16 wRTSDuration_f0;
+ u16 wRTSDuration_f1;
+ struct ieee80211_rts data;
+} __packed;
+
+/* CTS buffer header */
+struct vnt_cts {
+ struct vnt_phy_field b;
+ u16 wDuration_ba;
+ u16 wReserved;
+ struct ieee80211_cts data;
+ u16 reserved2;
+} __packed;
+
+struct vnt_cts_fb {
+ struct vnt_phy_field b;
+ u16 wDuration_ba;
+ u16 wReserved;
+ u16 wCTSDuration_ba_f0;
+ u16 wCTSDuration_ba_f1;
+ struct ieee80211_cts data;
+ u16 reserved2;
+} __packed;
+
+union vnt_tx_data_head {
+ /* rts g */
+ struct vnt_rts_g rts_g;
+ struct vnt_rts_g_fb rts_g_fb;
+ /* rts a/b */
+ struct vnt_rts_ab rts_ab;
+ struct vnt_rts_a_fb rts_a_fb;
+ /* cts g */
+ struct vnt_cts cts_g;
+ struct vnt_cts_fb cts_g_fb;
+};
+
+struct vnt_tx_buffer {
+ u8 byType;
+ u8 byPKTNO;
+ u16 wTxByteCount;
u32 adwTxKey[4];
- u16 wFIFOCtl;
- u16 wTimeStamp;
- u16 wFragCtl;
- u16 wReserved;
-
- // Actual message
- TX_BUFFER_CONTAINER BufferHeader;
-
-} TX_BUFFER, *PTX_BUFFER;
-
-//
-// Remote NDIS message format
-//
-typedef struct tagSBEACON_BUFFER
-{
- u8 byType;
- u8 byPKTNO;
- u16 wTxByteCount;
-
- u16 wFIFOCtl;
- u16 wTimeStamp;
-
- // Actual message
- TX_BUFFER_CONTAINER BufferHeader;
-
-} BEACON_BUFFER, *PBEACON_BUFFER;
+ u16 wFIFOCtl;
+ u16 wTimeStamp;
+ u16 wFragCtl;
+ u16 wReserved;
+} __packed;
+
+struct vnt_beacon_buffer {
+ u8 byType;
+ u8 byPKTNO;
+ u16 wTxByteCount;
+ u16 wFIFOCtl;
+ u16 wTimeStamp;
+} __packed;
void vDMA0_tx_80211(struct vnt_private *, struct sk_buff *skb);
int nsDMA_tx_packet(struct vnt_private *, u32 uDMAIdx, struct sk_buff *skb);
diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index 098be609107c..3a03f1d5b685 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -421,7 +421,7 @@ static void s_nsInterruptUsbIoCompleteRead(struct urb *urb)
*
*/
-int PIPEnsBulkInUsbRead(struct vnt_private *pDevice, PRCB pRCB)
+int PIPEnsBulkInUsbRead(struct vnt_private *pDevice, struct vnt_rcb *pRCB)
{
int ntStatus = 0;
struct urb *pUrb;
@@ -479,7 +479,7 @@ int PIPEnsBulkInUsbRead(struct vnt_private *pDevice, PRCB pRCB)
static void s_nsBulkInUsbIoCompleteRead(struct urb *urb)
{
- PRCB pRCB = (PRCB)urb->context;
+ struct vnt_rcb *pRCB = (struct vnt_rcb *)urb->context;
struct vnt_private *pDevice = pRCB->pDevice;
unsigned long bytesRead;
int bIndicateReceive = false;
@@ -546,7 +546,8 @@ static void s_nsBulkInUsbIoCompleteRead(struct urb *urb)
*
*/
-int PIPEnsSendBulkOut(struct vnt_private *pDevice, PUSB_SEND_CONTEXT pContext)
+int PIPEnsSendBulkOut(struct vnt_private *pDevice,
+ struct vnt_usb_send_context *pContext)
{
int status;
struct urb *pUrb;
@@ -628,14 +629,13 @@ static void s_nsBulkOutIoCompleteWrite(struct urb *urb)
int status;
CONTEXT_TYPE ContextType;
unsigned long ulBufLen;
- PUSB_SEND_CONTEXT pContext;
+ struct vnt_usb_send_context *pContext;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsBulkOutIoCompleteWrite\n");
//
// The context given to IoSetCompletionRoutine is an USB_CONTEXT struct
//
- pContext = (PUSB_SEND_CONTEXT) urb->context;
- ASSERT( NULL != pContext );
+ pContext = (struct vnt_usb_send_context *)urb->context;
pDevice = pContext->pDevice;
ContextType = pContext->Type;
diff --git a/drivers/staging/vt6656/usbpipe.h b/drivers/staging/vt6656/usbpipe.h
index bb7a61111a62..f53770329e75 100644
--- a/drivers/staging/vt6656/usbpipe.h
+++ b/drivers/staging/vt6656/usbpipe.h
@@ -40,7 +40,8 @@ int PIPEnsControlIn(struct vnt_private *, u8 byRequest, u16 wValue,
u16 wIndex, u16 wLength, u8 *pbyBuffer);
int PIPEnsInterruptRead(struct vnt_private *);
-int PIPEnsBulkInUsbRead(struct vnt_private *, PRCB pRCB);
-int PIPEnsSendBulkOut(struct vnt_private *, PUSB_SEND_CONTEXT pContext);
+int PIPEnsBulkInUsbRead(struct vnt_private *, struct vnt_rcb *pRCB);
+int PIPEnsSendBulkOut(struct vnt_private *,
+ struct vnt_usb_send_context *pContext);
#endif /* __USBPIPE_H__ */
diff --git a/drivers/staging/vt6656/wmgr.c b/drivers/staging/vt6656/wmgr.c
index 6d1ff5eeafa9..b6cbd138a2b4 100644
--- a/drivers/staging/vt6656/wmgr.c
+++ b/drivers/staging/vt6656/wmgr.c
@@ -751,7 +751,6 @@ static void s_vMgrRxAssocResponse(struct vnt_private *pDevice,
|| (sFrame.pwStatus == NULL)
|| (sFrame.pwAid == NULL)
|| (sFrame.pSuppRates == NULL)) {
- DBG_PORT80(0xCC);
return;
}
@@ -3750,7 +3749,6 @@ static void s_vMgrRxProbeResponse(struct vnt_private *pDevice,
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe resp:Fail addr:[%p]\n",
pRxPacket->p80211Header);
- DBG_PORT80(0xCC);
return;
}